@vectorize-io/hindsight-control-plane 0.5.0 → 0.5.1

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 (46) 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.html +1 -1
  13. package/standalone/.next/server/app/_not-found.rsc +1 -1
  14. package/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  15. package/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  16. package/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  17. package/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  18. package/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  19. package/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  20. package/standalone/.next/server/app/banks/[bankId]/page_client-reference-manifest.js +1 -1
  21. package/standalone/.next/server/app/dashboard.html +1 -1
  22. package/standalone/.next/server/app/dashboard.rsc +1 -1
  23. package/standalone/.next/server/app/dashboard.segments/_full.segment.rsc +1 -1
  24. package/standalone/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  25. package/standalone/.next/server/app/dashboard.segments/_index.segment.rsc +1 -1
  26. package/standalone/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  27. package/standalone/.next/server/app/dashboard.segments/dashboard/__PAGE__.segment.rsc +1 -1
  28. package/standalone/.next/server/app/dashboard.segments/dashboard.segment.rsc +1 -1
  29. package/standalone/.next/server/app/index.html +1 -1
  30. package/standalone/.next/server/app/index.rsc +1 -1
  31. package/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  32. package/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  33. package/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  34. package/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  35. package/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  36. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0xh78e6._.js +1 -1
  37. package/standalone/.next/server/middleware-build-manifest.js +3 -3
  38. package/standalone/.next/server/pages/404.html +1 -1
  39. package/standalone/.next/server/pages/500.html +1 -1
  40. package/standalone/.next/server/server-reference-manifest.js +1 -1
  41. package/standalone/.next/server/server-reference-manifest.json +1 -1
  42. package/standalone/.next/static/chunks/{181_1rq8~1lzn.js → 11l.u2xgm7pbv.js} +1 -1
  43. package/standalone/package.json +1 -1
  44. /package/standalone/.next/static/{B0uT9Qo3CGlr2foy882-4 → 7IvxIcFEVWIHo9s7ooeJ4}/_buildManifest.js +0 -0
  45. /package/standalone/.next/static/{B0uT9Qo3CGlr2foy882-4 → 7IvxIcFEVWIHo9s7ooeJ4}/_clientMiddlewareManifest.js +0 -0
  46. /package/standalone/.next/static/{B0uT9Qo3CGlr2foy882-4 → 7IvxIcFEVWIHo9s7ooeJ4}/_ssgManifest.js +0 -0
@@ -5,4 +5,4 @@ You can add a description to the \`${fY}\` by passing a \`${fQ}\` 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 \`${fY}\`. 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 eg.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null};let f3=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(fW,{className:(0,eT.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}));f3.displayName=fW.displayName;let f4=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsxs)(fH,{children:[(0,ep.jsx)(f3,{}),(0,ep.jsx)(fq,{ref:n,className:(0,eT.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})]}));f4.displayName=fq.displayName;let f6=({className:e,...t})=>(0,ep.jsx)("div",{className:(0,eT.cn)("flex flex-col space-y-2 text-center sm:text-left",e),...t});f6.displayName="AlertDialogHeader";let f8=({className:e,...t})=>(0,ep.jsx)("div",{className:(0,eT.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});f8.displayName="AlertDialogFooter";let f7=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(fZ,{ref:n,className:(0,eT.cn)("text-lg font-semibold",e),...t}));f7.displayName=fZ.displayName;let f9=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(fJ,{ref:n,className:(0,eT.cn)("text-sm text-muted-foreground",e),...t}));f9.displayName=fJ.displayName;let pe=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(f0,{ref:n,className:(0,eT.cn)((0,eD.buttonVariants)(),e),...t}));pe.displayName=f0.displayName;let pt=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(f2,{ref:n,className:(0,eT.cn)((0,eD.buttonVariants)({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));pt.displayName=f2.displayName;let pn=(0,ej.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"}]]),pr=(0,ej.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"}]]);function pi(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function pa({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 po(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,eg.useState)([]),[r,i]=(0,eg.useState)(!1),[a,o]=(0,eg.useState)(""),[s,l]=(0,eg.useState)(0),[c,u]=(0,eg.useState)(1),d=Math.ceil(s/50),h=(c-1)*50,[f,p]=(0,eg.useState)(null),[g,v]=(0,eg.useState)(!1),[x,y]=(0,eg.useState)(null),[b,w]=(0,eg.useState)(!1),[j,N]=(0,eg.useState)(""),[k,E]=(0,eg.useState)(!1),[C,_]=(0,eg.useState)(null),[S,A]=(0,eg.useState)(null),T=async(t=1)=>{if(e){i(!0);try{let r=await eP.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)}}},O=e=>{u(e),T(e)},M=async t=>{if(e){v(!0),p({id:t}),w(!1),N("");try{let n=await eP.client.getDocument(t,e);p(n)}catch(e){p(null)}finally{v(!1)}}},P=async()=>{if(!e||!C)return;let t=C.id;y(t),_(null);try{let n=await eP.client.deleteDocument(t,e);A({success:!0,message:`Deleted document and ${n.memory_units_deleted} memory units.`}),f?.id===t&&p(null),T(c)}catch(e){console.error("Error deleting document:",e),A({success:!1,message:"Error deleting document: "+e.message})}finally{y(null)}},D=()=>{w(!1),N("")},L=async()=>{if(!e||!f)return;let t=j.split(",").map(e=>e.trim()).filter(e=>e.length>0);E(!0);try{await eP.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,eg.useEffect)(()=>{e&&(u(1),T(1))},[e]),(0,eg.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{u(1),T(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)(eL.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)(e$,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{children:"Document ID"}),(0,ep.jsx)(eQ,{children:"Created"}),(0,ep.jsx)(eQ,{children:"Tags"}),(0,ep.jsx)(eQ,{children:"Metadata"}),(0,ep.jsx)(eQ,{children:"Size"}),(0,ep.jsx)(eQ,{children:"Memory Units"})]})}),(0,ep.jsx)(eK,{children:t.length>0?t.map(e=>(0,ep.jsxs)(eZ,{className:`cursor-pointer hover:bg-muted/50 ${f?.id===e.id?"bg-primary/10":""}`,onClick:()=>M(e.id),children:[(0,ep.jsx)(eJ,{className:"text-card-foreground font-mono text-xs break-all",children:e.id}),(0,ep.jsx)(eJ,{className:"text-card-foreground",title:e.created_at?new Date(e.created_at).toLocaleString():"",children:e.created_at?function(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`}(e.created_at):"N/A"}),(0,ep.jsx)(eJ,{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)(eJ,{className:"text-card-foreground",children:e.document_metadata&&Object.keys(e.document_metadata).length>0?(0,ep.jsx)(pa,{metadata:e.document_metadata}):"-"}),(0,ep.jsx)(eJ,{className:"text-card-foreground",children:pi(e.text_length||0)}),(0,ep.jsx)(eJ,{className:"text-card-foreground",children:e.memory_unit_count})]},e.id)):(0,ep.jsx)(eZ,{children:(0,ep.jsx)(eJ,{colSpan:6,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)(eD.Button,{variant:"outline",size:"sm",onClick:()=>O(1),disabled:1===c||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(ez,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>O(c-1),disabled:1===c||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(e_,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",d]}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>O(c+1),disabled:c===d||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>O(d),disabled:c===d||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{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"})]})}),t.length>0&&f&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[560px] 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-foreground",children:"Document Details"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Original document text and metadata"})]}),(0,ep.jsxs)(eD.Button,{variant:"secondary",size:"sm",onClick:()=>p(null),className:"h-9 px-3 gap-2",children:[(0,ep.jsx)(eX.X,{className:"h-4 w-4"}),"Close"]})]}),g?(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 document..."})]})}):(0,ep.jsxs)("div",{className:"space-y-5",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:"Document ID"}),(0,ep.jsx)("div",{className:"text-sm font-mono break-all text-card-foreground",children:f.id})]}),f.created_at&&(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:"Created"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:new Date(f.created_at).toLocaleString()})]}),(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:"Memory Units"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:f.memory_unit_count})]})]}),f.original_text&&(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:"Size"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:pi(new Blob([f.original_text]).size)})]}),f.retain_params&&(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg space-y-3",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase",children:"Retain Parameters"}),f.retain_params.context&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mb-1",children:"Context"}),(0,ep.jsx)("div",{className:"text-sm text-card-foreground",children:f.retain_params.context})]}),f.retain_params.event_date&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mb-1",children:"Event Date"}),(0,ep.jsx)("div",{className:"text-sm text-card-foreground",children:new Date(f.retain_params.event_date).toLocaleString()})]}),f.retain_params.metadata&&Object.keys(f.retain_params.metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mb-1",children:"Metadata"}),(0,ep.jsx)(pa,{metadata:f.retain_params.metadata})]})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase",children:"Tags"}),!b&&(0,ep.jsxs)(eD.Button,{variant:"ghost",size:"sm",onClick:()=>{N((f?.tags??[]).join(", ")),w(!0)},className:"h-6 px-2 gap-1 text-xs",children:[(0,ep.jsx)(pr,{className:"h-3 w-3"}),"Edit"]})]}),b?(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(eL.Input,{value:j,onChange:e=>N(e.target.value),placeholder:"tag1, tag2, tag3",className:"text-sm h-8",onKeyDown:e=>{"Enter"===e.key&&L(),"Escape"===e.key&&D()},autoFocus:!0}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Comma-separated. Leave empty to remove all tags."}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(eD.Button,{size:"sm",onClick:L,disabled:k,className:"h-7 px-3 gap-1 text-xs",children:[k?(0,ep.jsx)("span",{className:"animate-spin",children:"⏳"}):(0,ep.jsx)(tB.Check,{className:"h-3 w-3"}),"Save"]}),(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",onClick:D,disabled:k,className:"h-7 px-3 gap-1 text-xs",children:[(0,ep.jsx)(eX.X,{className:"h-3 w-3"}),"Cancel"]})]})]}):f.tags&&f.tags.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:f.tags.map((e,t)=>(0,ep.jsx)("span",{className:"text-sm px-3 py-1.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:e},t))}):(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No tags"})]}),(0,ep.jsx)("div",{className:"pt-2 border-t border-border",children:(0,ep.jsxs)(eD.Button,{variant:"destructive",size:"sm",onClick:()=>{_({id:f.id,memoryCount:f.memory_unit_count})},className:"w-full gap-2",disabled:x===f.id,children:[x===f.id?(0,ep.jsx)("span",{className:"animate-spin",children:"⏳"}):(0,ep.jsx)(pn,{className:"h-4 w-4"}),"Delete Document"]})}),f.original_text&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Original Text"}),(0,ep.jsx)("div",{className:"p-4 bg-muted/50 rounded-lg border border-border max-h-[400px] overflow-y-auto",children:(0,ep.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono leading-relaxed text-card-foreground",children:f.original_text})})]})]})]})}),(0,ep.jsx)(fU,{open:!!C,onOpenChange:e=>!e&&_(null),children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Delete Document"}),(0,ep.jsxs)(f9,{children:["Are you sure you want to delete document"," ",(0,ep.jsxs)("span",{className:"font-mono font-semibold",children:['"',C?.id,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),"This will also delete"," ",C?.memoryCount!==void 0?(0,ep.jsxs)("span",{className:"font-semibold",children:[C.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)(f8,{children:[(0,ep.jsx)(pt,{children:"Cancel"}),(0,ep.jsx)(pe,{onClick:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),(0,ep.jsx)(fU,{open:!!S,onOpenChange:e=>!e&&A(null),children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:S?.success?"Document Deleted":"Error"}),(0,ep.jsx)(f9,{children:S?.message})]}),(0,ep.jsx)(f8,{children:(0,ep.jsx)(pe,{onClick:()=>A(null),children:"OK"})})]})})]})}function ps(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,eg.useState)([]),[r,i]=(0,eg.useState)(!1),[a,o]=(0,eg.useState)(null),[s,l]=(0,eg.useState)(!1),[c,u]=(0,eg.useState)(1),[d,h]=(0,eg.useState)(0),f=Math.ceil(d/50),p=(c-1)*50,g=async(t=1)=>{if(e){i(!0);try{let r=await eP.client.listEntities({bank_id:e,limit:50,offset:(t-1)*50});n(r.items||[]),h(r.total||0)}catch(e){}finally{i(!1)}}},v=async t=>{if(e){l(!0);try{let n=await eP.client.getEntity(t,e);o(n)}catch(e){}finally{l(!1)}}},x=e=>{u(e),g(e)};(0,eg.useEffect)(()=>{e&&(u(1),g(1),o(null))},[e]);let y=e=>e?new Date(e).toLocaleDateString():"N/A";return(0,ep.jsxs)("div",{children:[(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:[d," ",1===d?"entity":"entities"]}),(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(e$,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{children:"Name"}),(0,ep.jsx)(eQ,{children:"Mentions"}),(0,ep.jsx)(eQ,{children:"First Seen"}),(0,ep.jsx)(eQ,{children:"Last Seen"})]})}),(0,ep.jsx)(eK,{children:t.map(e=>(0,ep.jsxs)(eZ,{onClick:()=>v(e.id),className:`cursor-pointer hover:bg-muted/50 ${a?.id===e.id?"bg-primary/10":""}`,children:[(0,ep.jsx)(eJ,{className:"font-medium text-card-foreground",children:e.canonical_name}),(0,ep.jsx)(eJ,{className:"text-card-foreground",children:e.mention_count}),(0,ep.jsx)(eJ,{className:"text-card-foreground",children:y(e.first_seen)}),(0,ep.jsx)(eJ,{className:"text-card-foreground",children:y(e.last_seen)})]},e.id))})]})}),f>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:[p+1,"-",Math.min(p+50,d)," of ",d]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>x(1),disabled:1===c||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(ez,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>x(c-1),disabled:1===c||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(e_,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",f]}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>x(c+1),disabled:c===f||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>x(f),disabled:c===f||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{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)(eD.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:y(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 pl=e.i(53489),pc=e.i(32089);let pu=["world","experience","observation"],pd={world:{label:"World",active:"bg-blue-500/15 text-blue-700 border-blue-400 dark:text-blue-300 dark:border-blue-500",inactive:"border-border text-muted-foreground hover:border-blue-300 hover:text-blue-600 dark:hover:text-blue-400",dot:"bg-blue-500"},experience:{label:"Experience",active:"bg-emerald-500/15 text-emerald-700 border-emerald-400 dark:text-emerald-300 dark:border-emerald-500",inactive:"border-border text-muted-foreground hover:border-emerald-300 hover:text-emerald-600 dark:hover:text-emerald-400",dot:"bg-emerald-500"},observation:{label:"Observation",active:"bg-amber-500/15 text-amber-700 border-amber-400 dark:text-amber-300 dark:border-amber-500",inactive:"border-border text-muted-foreground hover:border-amber-300 hover:text-amber-600 dark:hover:text-amber-400",dot:"bg-amber-500"}};function ph({ft:e,active:t,onToggle:n}){let r=pd[e];return(0,ep.jsxs)("button",{type:"button",onClick:n,className:(0,eT.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,eT.cn)("h-1.5 w-1.5 rounded-full",t?r.dot:"bg-muted-foreground/50")}),r.label]})}function pf({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:pu.map(n=>(0,ep.jsx)(ph,{ft:n,active:e.includes(n),onToggle:()=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n])},n))})]})}function pp({value:e,onChange:t}){return(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:pu.map(n=>(0,ep.jsx)(ph,{ft:n,active:e.includes(n),onToggle:()=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n])},n))})}let pg=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eT.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));pg.displayName="Card";let pm=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eT.cn)("flex flex-col space-y-1.5 p-6",e),...t}));pm.displayName="CardHeader";let pv=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eT.cn)("text-2xl font-semibold leading-none tracking-tight",e),...t}));pv.displayName="CardTitle";let px=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eT.cn)("text-sm text-muted-foreground",e),...t}));px.displayName="CardDescription";let py=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eT.cn)("p-6 pt-0",e),...t}));py.displayName="CardContent",eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eT.cn)("flex items-center p-6 pt-0",e),...t})).displayName="CardFooter";var pb=e.i(52571);let pw=(0,ej.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"}]]),pj=(0,ej.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"}]]),pN=(0,ej.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"}]]),pk=(0,ej.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 pE=e.i(1864);"function"==typeof SuppressedError&&SuppressedError;var pC=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()}},p_={"text/plain":"Text","text/html":"Url",default:"Text"},pS=function(e,t){var n,r,i,a,o,s,l,c,u=!1;t||(t={}),i=t.debug||!1;try{if(o=pC(),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=p_[t.format]||p_.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 pA(e){return"[object Object]"===Object.prototype.toString.call(e)}function pT(e){return Array.isArray(e)?e.length:pA(e)?Object.keys(e).length:0}function pO(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=pT(e);if("function"==typeof r){let i=pD(r,[{node:e,depth:t,indexOrName:n,size:o}]);if("boolean"==typeof i)return i}return!!(Array.isArray(e)&&o>i||pA(e)&&o>i)}function pM(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=pD(r,[{node:e,depth:t,indexOrName:n,size:o}]);if("boolean"==typeof i)return i}return!!(Array.isArray(e)&&o>i||pA(e)&&o>i)}function pP(e,t,n){return"boolean"==typeof e?e:"number"==typeof e&&!!(t>e)||"collapsed"===e&&!!n||"expanded"===e&&!n}function pD(e,t){try{return e(...t)}catch(e){reportError(e)}}function pL(e){if(!0===e||pA(e)&&!0===e.add)return!0}function pI(e){if(!0===e||pA(e)&&!0===e.edit)return!0}function pR(e){if(!0===e||pA(e)&&!0===e.delete)return!0}function pB(e){return!e||void 0===e.add||!!e.add}function pz(e){return!e||void 0===e.edit||!!e.edit}function pF(e){return!e||void 0===e.delete||!!e.delete}function pV(e){return!e||void 0===e.enableClipboard||!!e.enableClipboard}function pU(){return(pU=Object.assign.bind()).apply(this,arguments)}var pH=function(e){return eg.createElement("svg",pU({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),w||(w=eg.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 pW(){return(pW=Object.assign.bind()).apply(this,arguments)}var pY=function(e){return eg.createElement("svg",pW({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),j||(j=eg.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 pG(){return(pG=Object.assign.bind()).apply(this,arguments)}var pX=function(e){return eg.createElement("svg",pG({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),N||(N=eg.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=eg.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 p$({node:e,nodeMeta:t}){let{customizeCopy:n,CopyComponent:r,CopiedComponent:i}=(0,eg.useContext)(gi),[a,o]=(0,eg.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){pS(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)(pX,{className:"json-view--copy",style:{display:"inline-block"}}):"function"==typeof r?(0,ep.jsx)(r,{onClick:s,className:"json-view--copy"}):(0,ep.jsx)(pY,{onClick:s,className:"json-view--copy"})}function pq({indexOrName:e,value:t,depth:n,deleteHandle:r,editHandle:i,parent:a,parentPath:o}){let{displayArrayIndex:s}=(0,eg.useContext)(gi),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)(gn,{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 pK(){return(pK=Object.assign.bind()).apply(this,arguments)}var pZ=function(e){return eg.createElement("svg",pK({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),E||(E=eg.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=eg.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 pQ(){return(pQ=Object.assign.bind()).apply(this,arguments)}var pJ=function(e){return eg.createElement("svg",pQ({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_||(_=eg.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=eg.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 p0(){return(p0=Object.assign.bind()).apply(this,arguments)}var p1=function(e){return eg.createElement("svg",p0({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),A||(A=eg.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"})),T||(T=eg.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 p2(){return(p2=Object.assign.bind()).apply(this,arguments)}var p5=function(e){return eg.createElement("svg",p2({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),O||(O=eg.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=eg.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 p3({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,eg.useContext)(gi),v=[...l,String(r)],[x,y]=(0,eg.useState)(!0),b=(0,eg.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:[pP(p,n,x)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[pT(t)," Items"]})),(0,ep.jsx)(pH,{className:"jv-chevron"})]})),!x&&c&&pV(a)&&(0,ep.jsx)(p$,{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)(pq,{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 p4({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,eg.useContext)(gi),[w,j]=(0,eg.useState)(pM(e,t,r,c,d,i));(0,eg.useEffect)(()=>{j(pM(e,t,r,c,d,i))},[c,d]);let[N,k]=(0,eg.useState)(!1),[E,C]=(0,eg.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,A=(0,ep.jsxs)(ep.Fragment,{children:[!w&&!S&&(0,ep.jsxs)("span",Object.assign({onClick:()=>j(!0),className:"jv-size-chevron"},{children:[pP(b,t,w)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[e.length," Items"]})),(0,ep.jsx)(pH,{className:"jv-chevron"})]})),S&&(0,ep.jsx)(p1,{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)(p5,{className:"json-view--edit",style:{display:"inline-block"},onClick:()=>{k(!1),C(!1)}}),!w&&!S&&u&&pV(i)&&(0,ep.jsx)(p$,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:a,parentPath:o,currentPath:s}}),!w&&!S&&pL(h)&&pB(i)&&(0,ep.jsx)(pJ,{className:"json-view--edit",onClick:()=>{_()}}),!w&&!S&&pR(h)&&pF(i)&&n&&(0,ep.jsx)(pZ,{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:"["}),A,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)(p3,{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&&pP(b,t,w)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>j(!1),className:"jv-size"},{children:[e.length," Items"]}))]})}function p6({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,eg.useContext)(gi),j=void 0!==n?[...o,String(n)]:o;if(!u&&Array.isArray(e)&&e.length>100)return(0,ep.jsx)(p4,{node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:i,parentPath:j});let N=pA(e),[k,E]=(0,eg.useState)(pO(e,t,n,s,d,i)),C=r=>{null==l||l({isCollapsing:!r,node:e,depth:t,indexOrName:n}),E(r)};(0,eg.useEffect)(()=>{C(pO(e,t,n,s,d,i))},[s,d]);let _=(0,eg.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()},[A,T]=(0,eg.useState)(!1),[O,M]=(0,eg.useState)(!1),P=(0,eg.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=A||O,I=()=>{T(!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:[pP(b,t,k)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[pT(e)," Items"]})),(0,ep.jsx)(pH,{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)(p1,{className:"json-view--edit",style:{display:"inline-block"},onClick:O?D:()=>{T(!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)(p5,{className:"json-view--edit",style:{display:"inline-block"},onClick:I}),!k&&!L&&c&&pV(i)&&(0,ep.jsx)(p$,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:a,parentPath:o,currentPath:j}}),!k&&!L&&pL(h)&&pB(i)&&(0,ep.jsx)(pJ,{className:"json-view--edit",onClick:()=>{N?(M(!0),setTimeout(()=>{var e;return null==(e=P.current)?void 0:e.focus()})):D()}}),!k&&!L&&pR(h)&&pF(i)&&r&&(0,ep.jsx)(pZ,{className:"json-view--edit",onClick:()=>T(!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)(pq,{indexOrName:i,value:r,depth:t,parent:e,deleteHandle:S,editHandle:_,parentPath:j},String(n)+String(i)))})),(0,ep.jsx)("span",{children:"]"}),k&&pP(b,t,k)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>C(!1),className:"jv-size"},{children:[pT(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)(pq,{indexOrName:r,value:i,depth:t,parent:e,deleteHandle:S,editHandle:_,parentPath:j},String(n)+String(r)))})),(0,ep.jsx)("span",{children:"}"}),k&&pP(b,t,k)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>C(!1),className:"jv-size"},{children:[pT(e)," Items"]}))]}):(0,ep.jsx)("span",{children:String(e)})}let p8=eg.default.forwardRef(({str:e,className:t,ctrlClick:n},r)=>{let{collapseStringMode:i,collapseStringsAfterLength:a,customizeCollapseStringUI:o}=(0,eg.useContext)(gi),[s,l]=(0,eg.useState)(!0),c=(0,eg.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 p7(){return(p7=Object.assign.bind()).apply(this,arguments)}var p9=function(e){return eg.createElement("svg",p7({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),P||(P=eg.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 ge(){return(ge=Object.assign.bind()).apply(this,arguments)}var gt=function(e){return eg.createElement("svg",ge({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),D||(D=eg.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=eg.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 gn({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,eg.useContext)(gi);if("function"==typeof p&&(s=pD(p,[{node:e,depth:t,indexOrName:r}])),s){if((0,eg.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)||pA(e))return(0,ep.jsx)(p6,{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,eg.useState)(!1),[C,_]=(0,eg.useState)(!1),S=(0,eg.useRef)(null),A=()=>{E(!0),setTimeout(()=>{var e,t;null==(e=window.getSelection())||e.selectAllChildren(S.current),null==(t=S.current)||t.focus()})},T=(0,eg.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,eg.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),T()):"Escape"===e.key&&O()},[T]),D=k||C,L=!D&&pI(u)&&pz(s)&&a?e=>{(e.ctrlKey||e.metaKey)&&A()}: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:T}):(0,ep.jsx)(p1,{className:"json-view--edit",style:{display:"inline-block"},onClick:C?M:T})),D&&("function"==typeof b?(0,ep.jsx)(b,{className:"json-view--edit",style:{display:"inline-block"},onClick:O}):(0,ep.jsx)(p5,{className:"json-view--edit",style:{display:"inline-block"},onClick:O})),!D&&c&&pV(s)&&(0,ep.jsx)(p$,{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)(gt,{})})),!D&&pI(u)&&pz(s)&&a&&("function"==typeof x?(0,ep.jsx)(x,{className:"json-view--edit",onClick:A}):(0,ep.jsx)(p9,{className:"json-view--edit",onClick:A})),!D&&pR(u)&&pF(s)&&n&&(0,ep.jsx)(pZ,{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,eg.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)(p8,{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 gr=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,gi=(0,eg.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:gr,ignoreLargeArray:!1,CopyComponent:void 0,CopiedComponent:void 0,EditComponent:void 0,CancelComponent:void 0,DoneComponent:void 0,CustomOperation:void 0});function ga({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=gr,ignoreLargeArray:k=!1,CopyComponent:E,CopiedComponent:C,EditComponent:_,CancelComponent:S,DoneComponent:A,CustomOperation:T}){let[O,M]=(0,eg.useState)(0),P=(0,eg.useCallback)(()=>M(e=>++e),[]),[D,L]=(0,eg.useState)(e);return(0,eg.useEffect)(()=>L(e),[e]),(0,ep.jsx)(gi.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:A,CustomOperation:T}},{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)(gn,{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 go=e.i(59411),tz=tz;let gs=(0,ej.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 gl(){}function gc(){}let gu=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gd=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gh={};function gf(e,t){return((t||gh).jsx?gd:gu).test(e)}let gp=/[ \t\n\f\r]/g;function gg(e){return""===e.replace(gp,"")}class gm{constructor(e,t){this.attribute=t,this.property=e}}gm.prototype.attribute="",gm.prototype.booleanish=!1,gm.prototype.boolean=!1,gm.prototype.commaOrSpaceSeparated=!1,gm.prototype.commaSeparated=!1,gm.prototype.defined=!1,gm.prototype.mustUseProperty=!1,gm.prototype.number=!1,gm.prototype.overloadedBoolean=!1,gm.prototype.property="",gm.prototype.spaceSeparated=!1,gm.prototype.space=void 0;let gv=0,gx=gE(),gy=gE(),gb=gE(),gw=gE(),gj=gE(),gN=gE(),gk=gE();function gE(){return 2**++gv}e.s(["boolean",0,gx,"booleanish",0,gy,"commaOrSpaceSeparated",0,gk,"commaSeparated",0,gN,"number",0,gw,"overloadedBoolean",0,gb,"spaceSeparated",0,gj],744);var gC=e.i(744);let g_=Object.keys(gC);class gS extends gm{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<g_.length;){const e=g_[i];!function(e,t,n){n&&(e[t]=n)}(this,g_[i],(n&gC[e])===gC[e])}}}function gA(e){return e.toLowerCase()}gS.prototype.defined=!0;let gT=/[A-Z]/g,gO=/-[a-z]/g,gM=/^data[-\w.:]+$/i;function gP(e){return"-"+e.toLowerCase()}function gD(e){return e.charAt(1).toUpperCase()}let gL={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 gI{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function gR(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new gI(n,r,t)}function gB(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new gS(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[gA(r)]=r,n[gA(a.attribute)]=r}return new gI(t,n,e.space)}gI.prototype.normal={},gI.prototype.property={},gI.prototype.space=void 0;let gz=gB({properties:{ariaActiveDescendant:null,ariaAtomic:gy,ariaAutoComplete:null,ariaBusy:gy,ariaChecked:gy,ariaColCount:gw,ariaColIndex:gw,ariaColSpan:gw,ariaControls:gj,ariaCurrent:null,ariaDescribedBy:gj,ariaDetails:null,ariaDisabled:gy,ariaDropEffect:gj,ariaErrorMessage:null,ariaExpanded:gy,ariaFlowTo:gj,ariaGrabbed:gy,ariaHasPopup:null,ariaHidden:gy,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gj,ariaLevel:gw,ariaLive:null,ariaModal:gy,ariaMultiLine:gy,ariaMultiSelectable:gy,ariaOrientation:null,ariaOwns:gj,ariaPlaceholder:null,ariaPosInSet:gw,ariaPressed:gy,ariaReadOnly:gy,ariaRelevant:null,ariaRequired:gy,ariaRoleDescription:gj,ariaRowCount:gw,ariaRowIndex:gw,ariaRowSpan:gw,ariaSelected:gy,ariaSetSize:gw,ariaSort:null,ariaValueMax:gw,ariaValueMin:gw,ariaValueNow:gw,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function gF(e,t){return t in e?e[t]:t}function gV(e,t){return gF(e,t.toLowerCase())}let gU=gB({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:gN,acceptCharset:gj,accessKey:gj,action:null,allow:null,allowFullScreen:gx,allowPaymentRequest:gx,allowUserMedia:gx,alt:null,as:null,async:gx,autoCapitalize:null,autoComplete:gj,autoFocus:gx,autoPlay:gx,blocking:gj,capture:null,charSet:null,checked:gx,cite:null,className:gj,cols:gw,colSpan:null,content:null,contentEditable:gy,controls:gx,controlsList:gj,coords:gw|gN,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gx,defer:gx,dir:null,dirName:null,disabled:gx,download:gb,draggable:gy,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gx,formTarget:null,headers:gj,height:gw,hidden:gb,high:gw,href:null,hrefLang:null,htmlFor:gj,httpEquiv:gj,id:null,imageSizes:null,imageSrcSet:null,inert:gx,inputMode:null,integrity:null,is:null,isMap:gx,itemId:null,itemProp:gj,itemRef:gj,itemScope:gx,itemType:gj,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gx,low:gw,manifest:null,max:null,maxLength:gw,media:null,method:null,min:null,minLength:gw,multiple:gx,muted:gx,name:null,nonce:null,noModule:gx,noValidate:gx,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:gx,optimum:gw,pattern:null,ping:gj,placeholder:null,playsInline:gx,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gx,referrerPolicy:null,rel:gj,required:gx,reversed:gx,rows:gw,rowSpan:gw,sandbox:gj,scope:null,scoped:gx,seamless:gx,selected:gx,shadowRootClonable:gx,shadowRootDelegatesFocus:gx,shadowRootMode:null,shape:null,size:gw,sizes:null,slot:null,span:gw,spellCheck:gy,src:null,srcDoc:null,srcLang:null,srcSet:null,start:gw,step:null,style:null,tabIndex:gw,target:null,title:null,translate:null,type:null,typeMustMatch:gx,useMap:null,value:gy,width:gw,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gj,axis:null,background:null,bgColor:null,border:gw,borderColor:null,bottomMargin:gw,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gx,declare:gx,event:null,face:null,frame:null,frameBorder:null,hSpace:gw,leftMargin:gw,link:null,longDesc:null,lowSrc:null,marginHeight:gw,marginWidth:gw,noResize:gx,noHref:gx,noShade:gx,noWrap:gx,object:null,profile:null,prompt:null,rev:null,rightMargin:gw,rules:null,scheme:null,scrolling:gy,standby:null,summary:null,text:null,topMargin:gw,valueType:null,version:null,vAlign:null,vLink:null,vSpace:gw,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:gx,disableRemotePlayback:gx,prefix:null,property:null,results:gw,security:null,unselectable:null},space:"html",transform:gV}),gH=gB({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:gk,accentHeight:gw,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:gw,amplitude:gw,arabicForm:null,ascent:gw,attributeName:null,attributeType:null,azimuth:gw,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:gw,by:null,calcMode:null,capHeight:gw,className:gj,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:gw,diffuseConstant:gw,direction:null,display:null,dur:null,divisor:gw,dominantBaseline:null,download:gx,dx:null,dy:null,edgeMode:null,editable:null,elevation:gw,enableBackground:null,end:null,event:null,exponent:gw,externalResourcesRequired:null,fill:null,fillOpacity:gw,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:gN,g2:gN,glyphName:gN,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:gw,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:gw,horizOriginX:gw,horizOriginY:gw,id:null,ideographic:gw,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:gw,k:gw,k1:gw,k2:gw,k3:gw,k4:gw,kernelMatrix:gk,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:gw,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:gw,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:gw,overlineThickness:gw,paintOrder:null,panose1:null,path:null,pathLength:gw,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gj,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:gw,pointsAtY:gw,pointsAtZ:gw,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gk,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gk,rev:gk,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gk,requiredFeatures:gk,requiredFonts:gk,requiredFormats:gk,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:gw,specularExponent:gw,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:gw,strikethroughThickness:gw,string:null,stroke:null,strokeDashArray:gk,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:gw,strokeOpacity:gw,strokeWidth:null,style:null,surfaceScale:gw,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gk,tabIndex:gw,tableValues:null,target:null,targetX:gw,targetY:gw,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gk,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:gw,underlineThickness:gw,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:gw,values:null,vAlphabetic:gw,vMathematical:gw,vectorEffect:null,vHanging:gw,vIdeographic:gw,version:null,vertAdvY:gw,vertOriginX:gw,vertOriginY:gw,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:gw,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:gF}),gW=gB({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()}),gY=gB({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gV}),gG=gB({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),gX=gR([gz,gU,gW,gY,gG],"html"),g$=gR([gz,gH,gW,gY,gG],"svg");var gq=e.i(15511);let gK=gQ("end"),gZ=gQ("start");function gQ(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 gJ(e){return e&&"object"==typeof e?"position"in e||"type"in e?g1(e.position):"start"in e||"end"in e?g1(e):"line"in e||"column"in e?g0(e):"":""}function g0(e){return g2(e&&e.line)+":"+g2(e&&e.column)}function g1(e){return g0(e&&e.start)+"-"+g0(e&&e.end)}function g2(e){return e&&"number"==typeof e?e:1}class g5 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=gJ(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}}g5.prototype.file="",g5.prototype.name="",g5.prototype.reason="",g5.prototype.message="",g5.prototype.stack="",g5.prototype.column=void 0,g5.prototype.line=void 0,g5.prototype.ancestors=void 0,g5.prototype.cause=void 0,g5.prototype.fatal=void 0,g5.prototype.place=void 0,g5.prototype.ruleId=void 0,g5.prototype.source=void 0;let g3={}.hasOwnProperty,g4=new Map,g6=/[A-Z]/g,g8=new Set(["table","tbody","thead","tfoot","tr"]),g7=new Set(["td","th"]),g9="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function me(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=g$),r.ancestors.push(i),p=mi(r,i.tagName,!1),g=function(e,t){let n,r,i={};for(r in t.properties)if("children"!==r&&g3.call(t.properties,r)){let a=function(e,t,n){let r=function(e,t){let n=gA(t),r=t,i=gm;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&gM.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(gO,gD);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!gO.test(e)){let n=e.replace(gT,gP);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=gS}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,gq.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let t=new g5("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=g9+"#cannot-parse-style-attribute",t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,n={};for(t in e)g3.call(e,t)&&(n[function(e){let t=e.replace(g6,mo);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return n}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?gL[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&&g7.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=mr(r,i),g8.has(i.tagName)&&(v=v.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&gg(e.value):gg(e))})),mt(r,g,p,i),mn(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 gl("ExpressionStatement"===n.type),e.evaluater.evaluateExpression(n.expression)}ma(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=g$),o.ancestors.push(s),b=null===s.name?o.Fragment:mi(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];gl("ExpressionStatement"===t.type);let i=t.expression;gl("ObjectExpression"===i.type);let a=i.properties[0];gl("SpreadElement"===a.type),Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else ma(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];gl("ExpressionStatement"===t.type),i=e.evaluater.evaluateExpression(t.expression)}else ma(e,t.position);else i=null===r.value||r.value;n[a]=i}return n}(o,s),j=mr(o,s),mt(o,w,b,s),mn(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);ma(e,t.position)}(e,t):"root"===t.type?(c=e,u=t,d=n,mn(N={},mr(c,u)),c.create(u,c.Fragment,N,d)):"text"===t.type?t.value:void 0}function mt(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function mn(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function mr(e,t){let n=[],r=-1,i=e.passKeys?new Map:g4;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=me(e,o,a);void 0!==s&&n.push(s)}return n}function mi(e,t,n){let r;if(n)if(t.includes(".")){let e,n=t.split("."),i=-1;for(;++i<n.length;){let t=gf(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}gl(e,"always a result"),r=e}else r=gf(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 g3.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);ma(e)}function ma(e,t){let n=new g5("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=g9+"#cannot-handle-mdx-estrees-without-createevaluater",n}function mo(e){return"-"+e.toLowerCase()}let ms={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"]},ml={};function mc(e,t){let n=t||ml;return mu(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function mu(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 md(e.children,t,n)}return Array.isArray(e)?md(e,t,n):""}function md(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=mu(e[i],t,n);return r.join("")}function mh(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 mf(e,t){return e.length>0?(mh(e,e.length,0,t),e):t}let mp={}.hasOwnProperty;function mg(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(mp.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];if(a)for(r in a){mp.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]);mh(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}function mm(e){return null!==e&&e<-2}function mv(e){return -2===e||-1===e||32===e}function mx(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function my(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return mv(r)?(e.enter(n),function r(o){return mv(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}mx(/[A-Za-z]/),mx(/[\dA-Za-z]/),mx(/[#-'*+\--9=?A-Z^-~]/),mx(/\d/),mx(/[\dA-Fa-f]/),mx(/[!-/:-@[-`{-~]/),mx(/\p{P}|\p{S}/u),mx(/\s/);let mb={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"),my(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 mm(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},mw={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 mh(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(mj,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(mj,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 mm(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++;mh(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}}},mj={tokenize:function(e,t,n){return my(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},mN=mM(/[A-Za-z]/),mk=mM(/[\dA-Za-z]/),mE=mM(/[#-'*+\--9=?A-Z^-~]/),mC=mM(/\d/),m_=mM(/[\dA-Fa-f]/),mS=mM(/[!-/:-@[-`{-~]/);function mA(e){return null!==e&&e<-2}function mT(e){return null!==e&&(e<0||32===e)}function mO(e){return -2===e||-1===e||32===e}function mM(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function mP(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return mO(r)?(e.enter(n),function r(o){return mO(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}mM(/\p{P}|\p{S}/u),mM(/\s/);let mD={partial:!0,tokenize:function(e,t,n){return function(t){return mO(t)?mP(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||mA(e)?t(e):n(e)}}};class mL{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&&mI(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),mI(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),mI(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);mI(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);mI(this.left,t.reverse())}}}function mI(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 mR(e){let t,n,r,i,a,o,s,l={},c=-1,u=new mL(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 mh(e,0,1/0,u.slice(0)),!s}let mB={resolve:function(e){return mR(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):mA(t)?e.check(mz,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}}},mz={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"),mP(e,i,"linePrefix")};function i(i){if(null===i||mA(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)}}},mF={tokenize:function(e){let t=this,n=e.attempt(mD,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,my(e,e.attempt(this.parser.constructs.flow,r,e.attempt(mB,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)}}},mV={resolveAll:mY()},mU=mW("string"),mH=mW("text");function mW(e){return{resolveAll:mY("text"===e?mG: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 mY(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 mG(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}mq(/[A-Za-z]/),mq(/[\dA-Za-z]/),mq(/[#-'*+\--9=?A-Z^-~]/),mq(/\d/),mq(/[\dA-Fa-f]/),mq(/[!-/:-@[-`{-~]/);let mX=mq(/\p{P}|\p{S}/u),m$=mq(/\s/);function mq(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function mK(e){return null===e||null!==e&&(e<0||32===e)||m$(e)?1:mX(e)?2:void 0}function mZ(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 mQ={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};mJ(d,-s),mJ(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=mf(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=mf(l,[["enter",r,t],["enter",a,t],["exit",a,t],["enter",i,t]]),l=mf(l,mZ(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=mf(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=mf(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,mh(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=mK(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=mK(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 mJ(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let m0={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return mO(t)?mP(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(m0,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 mO(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},m1={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 mS(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},m2=document.createElement("i");function m5(e){let t="&"+e+";";m2.innerHTML=t;let n=m2.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let m3={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=mk,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=m_,c):(e.enter("characterReferenceValue"),r=7,i=mC,c(t))}function c(s){if(59===s&&o){let r=e.exit("characterReferenceValue");return i!==mk||m5(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)}}},m4={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)}}},m6={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"),mO(t)?mP(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"),mO(i)?mP(e,c,"whitespace")(i):c(i)):n(i)}(t)):n(t)}function c(r){return null===r||mA(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"),mO(i)?mP(e,l,"whitespace")(i):l(i))}(a)};function l(a){return null===a||mA(a)?(e.exit("codeFencedFence"),i.interrupt?t(a):e.check(m4,u,p)(a)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||mA(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):mO(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),mP(e,c,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(a))}function c(t){return null===t||mA(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||mA(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&&mO(t)?mP(e,f,"linePrefix",o+1)(t):f(t)}function f(t){return null===t||mA(t)?e.check(m4,u,p)(t):(e.enter("codeFlowValue"),function t(n){return null===n||mA(n)?(e.exit("codeFlowValue"),f(n)):(e.consume(n),t)}(t))}function p(n){return e.exit("codeFenced"),t(n)}}},m8={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),mP(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):mA(n)?e.attempt(m7,t,a)(n):(e.enter("codeFlowValue"),function n(r){return null===r||mA(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function a(n){return e.exit("codeIndented"),t(n)}}},m7={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):mA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):mP(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):mA(e)?i(e):n(e)}}};function m9(e){return null!==e&&(e<32||127===e)}function ve(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function vt(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||m9(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||m9(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 vn(e){return null!==e&&e<-2}function vr(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function vi(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):vn(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||vn(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 va(e){return null!==e&&e<-2}function vo(e){return -2===e||-1===e||32===e}function vs(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function vl(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(va(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 vo(t)?(e.enter(i),function t(o){return vo(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||va(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 vc(e){return -2===e||-1===e||32===e}function vu(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function vd(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(vc(i)){let t,s;return(a=r,o=n?"linePrefix":"lineSuffix",t=1/0,s=0,function(n){return vc(n)?(e.enter(o),function n(r){return vc(r)&&s++<t?(e.consume(r),n):(e.exit(o),a(r))}(n)):a(n)})(i)}return t(i)}}function vh(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}ve(/[A-Za-z]/),ve(/[\dA-Za-z]/),ve(/[#-'*+\--9=?A-Z^-~]/),ve(/\d/),ve(/[\dA-Fa-f]/),ve(/[!-/:-@[-`{-~]/),ve(/\p{P}|\p{S}/u),ve(/\s/),vr(/[A-Za-z]/),vr(/[\dA-Za-z]/),vr(/[#-'*+\--9=?A-Z^-~]/),vr(/\d/),vr(/[\dA-Fa-f]/),vr(/[!-/:-@[-`{-~]/),vr(/\p{P}|\p{S}/u),vr(/\s/),vs(/[A-Za-z]/),vs(/[\dA-Za-z]/),vs(/[#-'*+\--9=?A-Z^-~]/),vs(/\d/),vs(/[\dA-Fa-f]/),vs(/[!-/:-@[-`{-~]/),vs(/\p{P}|\p{S}/u),vs(/\s/),vu(/[A-Za-z]/),vu(/[\dA-Za-z]/),vu(/[#-'*+\--9=?A-Z^-~]/),vu(/\d/),vu(/[\dA-Fa-f]/),vu(/[!-/:-@[-`{-~]/),vu(/\p{P}|\p{S}/u),vu(/\s/);let vf={partial:!0,tokenize:function(e,t,n){return function(t){return mT(t)?vd(e,r)(t):n(t)};function r(t){return vl(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return mO(t)?mP(e,a,"whitespace")(t):a(t)}function a(e){return null===e||mA(e)?t(e):n(e)}}},vp=["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"],vg=["pre","script","style","textarea"],vm={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(mD,t,n)}}},vv={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return mA(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)}}},vx={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&&mh(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=mf(a=[["enter",l,t],["enter",c,t]],e.slice(r+1,r+s+3)),a=mf(a,[["enter",u,t]]),a=mf(a,mZ(t.parser.constructs.insideSpan.null,e.slice(r+s+4,i-3),t)),a=mf(a,[["exit",u,t],e[i-2],e[i-1],["exit",c,t]]),a=mf(a,e.slice(i+1)),a=mf(a,[["exit",l,t]]),mh(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(vh(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(vy,c,i?c:u)(t):91===t?e.attempt(vb,c,i?l:u)(t):i?c(t):u(t)}function l(t){return e.attempt(vw,c,u)(t)}function c(e){return t(e)}function u(e){return r._balanced=!0,n(e)}}},vy={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 mT(t)?vd(e,i)(t):i(t)}function i(t){return 41===t?c(t):vt(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function a(t){return mT(t)?vd(e,s)(t):c(t)}function o(e){return n(e)}function s(t){return 34===t||39===t||40===t?vl(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return mT(t)?vd(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)}}},vb={tokenize:function(e,t,n){let r=this;return function(t){return vi.call(r,e,i,a,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(vh(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function a(e){return n(e)}}},vw={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)}}},vj={name:"labelStartImage",resolveAll:vx.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)}}},vN={name:"labelStartLink",resolveAll:vx.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)}}},vk={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),mP(e,t,"linePrefix")}}},vE={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"),mO(n)?mP(e,a,"whitespace")(n):a(n))}(o)):i>=3&&(null===o||mA(o))?(e.exit("thematicBreak"),t(o)):n(o)}(o)}}},vC={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(mD,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,mP(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!mO(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(vS,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,mP(e,e.attempt(vC,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:mC(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(vE,n,s)(t):s(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return mC(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(mD,r.interrupt?n:l,e.attempt(v_,u,c))}function l(e){return r.containerState.initialBlankLine=!0,a++,u(e)}function c(t){return mO(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)}}},v_={partial:!0,tokenize:function(e,t,n){let r=this;return mP(e,function(e){let i=r.events[r.events.length-1];return!mO(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},vS={partial:!0,tokenize:function(e,t,n){let r=this;return mP(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)}},vA={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"),mO(n)?mP(e,a,"lineSuffix")(n):a(n))}(o)):n(t)};function a(r){return null===r||mA(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,vi.call(i,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function a(t){return(r=vh(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 mT(t)?vd(e,s)(t):s(t)}function s(t){return vt(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(vf,c,c)(t)}function c(t){return mO(t)?mP(e,u,"whitespace")(t):u(t)}function u(a){return null===a||mA(a)?(e.exit("definition"),i.parser.defined.push(r),t(a)):n(a)}}}},"disable",0,{null:[]},"document",0,{42:vC,43:vC,45:vC,48:vC,49:vC,50:vC,51:vC,52:vC,53:vC,54:vC,55:vC,56:vC,57:vC,62:m0},"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"},mh(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||mT(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||mA(r)?(e.exit("atxHeading"),t(r)):mO(r)?mP(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||mT(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(a)):n(a)}(a)}}},42:vE,45:[vA,vE],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):mN(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):mN(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 mN(t)?(e.consume(t),a=String.fromCharCode(t),p):n(t)}function p(o){if(null===o||47===o||62===o||mT(o)){let s=47===o,c=a.toLowerCase();return!s&&!i&&vg.includes(c)?(r=1,l.interrupt?t(o):E(o)):vp.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 mO(n)?(e.consume(n),t):N(n)}(o):v(o))}return 45===o||mk(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||mN(t)?(e.consume(t),x):mO(t)?(e.consume(t),v):N(t)}function x(t){return 45===t||46===t||58===t||95===t||mk(t)?(e.consume(t),x):y(t)}function y(t){return 61===t?(e.consume(t),b):mO(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):mO(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||mT(n)?y(n):(e.consume(n),t)}(t)}function w(t){return t===s?(e.consume(t),s=null,j):null===t||mA(t)?n(t):(e.consume(t),w)}function j(e){return 47===e||62===e||mO(e)?v(e):n(e)}function N(t){return 62===t?(e.consume(t),k):n(t)}function k(t){return null===t||mA(t)?E(t):mO(t)?(e.consume(t),k):n(t)}function E(t){return 45===t&&2===r?(e.consume(t),A):60===t&&1===r?(e.consume(t),T):62===t&&4===r?(e.consume(t),D):63===t&&3===r?(e.consume(t),P):93===t&&5===r?(e.consume(t),M):mA(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(vm,L,C)(t)):null===t||mA(t)?(e.exit("htmlFlowData"),C(t)):(e.consume(t),E)}function C(t){return e.check(vv,_,L)(t)}function _(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),S}function S(t){return null===t||mA(t)?C(t):(e.enter("htmlFlowData"),E(t))}function A(t){return 45===t?(e.consume(t),P):E(t)}function T(t){return 47===t?(e.consume(t),a="",O):E(t)}function O(t){if(62===t){let n=a.toLowerCase();return vg.includes(n)?(e.consume(t),D):E(t)}return mN(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||mA(t)?(e.exit("htmlFlowData"),L(t)):(e.consume(t),D)}function L(n){return e.exit("htmlFlow"),t(n)}}},61:vA,95:vE,96:m6,126:m6},"flowInitial",0,{[-2]:m8,[-1]:m8,32:m8},"insideSpan",0,{null:[mQ,mV]},"string",0,{38:m3,92:m1},"text",0,{[-5]:vk,[-4]:vk,[-3]:vk,33:vj,38:m3,42:mQ,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 mN(t)?(e.consume(t),a):64===t?n(t):s(t)}function a(t){return 43===t||45===t||46===t||mk(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,o):(43===n||45===n||46===n||mk(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):mE(t)?(e.consume(t),s):n(t)}function l(i){return mk(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||mk(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):mN(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):mN(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):mA(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?T(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):mA(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?T(t):93===t?(e.consume(t),v):p(t)}function x(t){return null===t||62===t?T(t):mA(t)?(a=x,O(t)):(e.consume(t),x)}function y(t){return null===t?n(t):63===t?(e.consume(t),b):mA(t)?(a=y,O(t)):(e.consume(t),y)}function b(e){return 62===e?T(e):y(e)}function w(t){return mN(t)?(e.consume(t),j):n(t)}function j(t){return 45===t||mk(t)?(e.consume(t),j):function t(n){return mA(n)?(a=t,O(n)):mO(n)?(e.consume(n),t):T(n)}(t)}function N(t){return 45===t||mk(t)?(e.consume(t),N):47===t||62===t||mT(t)?k(t):n(t)}function k(t){return 47===t?(e.consume(t),T):58===t||95===t||mN(t)?(e.consume(t),E):mA(t)?(a=k,O(t)):mO(t)?(e.consume(t),k):T(t)}function E(t){return 45===t||46===t||58===t||95===t||mk(t)?(e.consume(t),E):function t(n){return 61===n?(e.consume(n),C):mA(n)?(a=t,O(n)):mO(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,_):mA(t)?(a=C,O(t)):mO(t)?(e.consume(t),C):(e.consume(t),S)}function _(t){return t===r?(e.consume(t),r=void 0,A):null===t?n(t):mA(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||mT(t)?k(t):(e.consume(t),S)}function A(e){return 47===e||62===e||mT(e)?k(e):n(e)}function T(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 mO(t)?mP(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:vN,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return mA(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},m1],93:vx,95:mQ,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)):mA(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||mA(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),s)}}}}],4127);var vT=e.i(4127);let vO=/[\0\t\n\r]/g;function vM(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 vP=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function vD(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return vM(n.slice(t?2:1),t?16:10)}return m5(n)||e}let vL={}.hasOwnProperty;function vI(e){return{line:e.line,column:e.column,offset:e.offset}}function vR(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+gJ({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+gJ({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+gJ({start:t.start,end:t.end})+") is still open")}function vB(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=vM(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=m5(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=vI(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=vh(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(vP,vD),n.identifier=vh(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=vI(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=vh(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(vL.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]];vL.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]||vR).call(o,void 0,e[0])}for(r.position={start:vI(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:vI(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:vI(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]||vR).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+gJ({start:e.start,end:e.end})+"): it’s not open");n.position.end=vI(e.end)}function l(){return mc(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:vI(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=vI(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(;!mR(e););return e}((function(e){let t={constructs:mg([vT,...(e||{}).extensions||[]]),content:n(mb),defined:[],document:n(mw),flow:n(mF),lazy:{},string:n(mU),text:n(mH)};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){mm(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=mf(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=mZ(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&&mh(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(vO.lastIndex=c,u=(r=vO.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 vz="object"==typeof self?self:globalThis,vF=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 vz[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 vz[a](o),i)})(0)},{toString:vV}={},{keys:vU}=Object,vH=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=vV.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]},vW=([e,t])=>0===e&&("function"===t||"symbol"===t),vY=(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]=vH(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 vU(e))(r||!vW(vH(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||!(vW(vH(t))||vW(vH(i))))&&n.push([s(t),s(i)]);return i}case 6:{let n=[],i=o([t,n],e);for(let t of e)(r||!vW(vH(t)))&&n.push(s(t));return i}}let{message:l}=e;return o([t,{name:n,message:l}],e)})(e),l},vG="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?vF(vY(e,t)):structuredClone(e):(e,t)=>vF(vY(e,t));v$(/[A-Za-z]/);let vX=v$(/[\dA-Za-z]/);function v$(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function vq(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o="";if(37===a&&vX(e.charCodeAt(n+1))&&vX(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 vK(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 vZ(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}v$(/[#-'*+\--9=?A-Z^-~]/),v$(/\d/),v$(/[\dA-Fa-f]/),v$(/[!-/:-@[-`{-~]/),v$(/\p{P}|\p{S}/u),v$(/\s/);let vQ=function(e){var t,n;if(null==e)return v0;if("function"==typeof e)return vJ(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=vQ(e[n]);return vJ(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,vJ(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,vJ(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function vJ(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 v0(){return!0}let v1=[];function v2(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let a=vQ(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=v1;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?v1:[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 v5(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),v2(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 v3(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 v4(e){let t=e.spread;return null==t?e.children.length>1:t}function v6(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 v8={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=vq(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 v3(e,t);let i={src:vq(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:vq(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 v3(e,t);let i={href:vq(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:vq(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=v4(n[r])}return t}(n):v4(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=gZ(t.children[1]),o=gK(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(v6(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(v6(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:v7,yaml:v7,definition:v7,footnoteDefinition:v7};function v7(){}let v9={}.hasOwnProperty,xe={};function xt(e,t){e.position&&(t.position=function(e){let t=gZ(e),n=gK(e);if(t&&n)return{start:t,end:n}}(e))}function xn(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,vG(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function xr(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 xi(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function xa(e,t){let n,r,i,a,o=(n=t||xe,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=xi(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=xi(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:xn,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...v8,...n.handlers},one:function(e,t){let n=e.type,r=a.handlers[n];if(v9.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=vG(n);return r.children=a.all(e),r}return vG(e)}return(a.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(v9.call(n,"hProperties")||v9.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:xt,wrap:xr},v5(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||vK,r=e.options.footnoteBackLabel||vZ,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=vq(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:{...vG(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&&(gl("children"in c),c.children.push({type:"text",value:"\n"},l)),c}function xo(e,t){return e&&"run"in e?async function(n,r){let i=xa(n,{file:r,...t});await e.run(i,r)}:function(n,r){return xa(n,{file:r,...e||t})}}function xs(e){if(e)throw e}var xl=e.i(4100);function xc(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 xu=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');xp(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)},xd=function(e){let t;if(xp(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)},xh=function(e){let t;xp(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)},xf=function(...e){var t;let n,r,i,a=-1;for(;++a<e.length;)xp(e[a]),e[a]&&(i=void 0===i?e[a]:i+"/"+e[a]);return void 0===i?".":(xp(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 xp(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function xg(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let xm=["history","path","basename","stem","extname","dirname"];class xv{constructor(e){let t,n;t=e?xg(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<xm.length;){const e=xm[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)xm.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?xu(this.path):void 0}set basename(e){xy(e,"basename"),xx(e,"basename"),this.path=xf(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?xd(this.path):void 0}set dirname(e){xb(this.basename,"dirname"),this.path=xf(e||"",this.basename)}get extname(){return"string"==typeof this.path?xh(this.path):void 0}set extname(e){if(xx(e,"extname"),xb(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=xf(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){xg(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!xg(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)),xy(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?xu(this.path,this.extname):void 0}set stem(e){xy(e,"stem"),xx(e,"stem"),this.path=xf(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 g5(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 xx(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function xy(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function xb(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let xw=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},xj={}.hasOwnProperty;class xN extends xw{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 xN,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,xl.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(x_("data",this.frozen),this.namespace[e]=t,this):xj.call(this.namespace,e)&&this.namespace[e]||void 0:e?(x_("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=xT(e),n=this.parser||this.Parser;return xE("parse",n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),xE("process",this.parser||this.Parser),xC("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=xT(e),o=n.parse(a);function s(e,n){e||!n?i(e):r?r(n):(gl(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(),xE("processSync",this.parser||this.Parser),xC("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,xs(e),t=r}),xA("processSync","process",n),gl(t,"we either bailed on an error or have a tree"),t}run(e,t,n){xS(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){gl("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=xT(t);r.run(e,o,function(t,r,o){let s=r||e;t?a(t):i?i(s):(gl(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){xs(e),n=t,r=!0}),xA("runSync","run",r),gl(n,"we either bailed on an error or have a tree"),n}stringify(e,t){this.freeze();let n=xT(t),r=this.compiler||this.Compiler;return xC("stringify",r),xS(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(x_("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,xl.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];xc(o)&&xc(r)&&(r=(0,xl.default)(!0,o,r)),n[i]=[e,r,...a]}}}}let xk=new xN().freeze();function xE(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function xC(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function x_(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 xS(e){if(!xc(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function xA(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function xT(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new xv(e)}let xO=[],xM={allowDangerousHtml:!0},xP=/^(https?|ircs?|mailto|xmpp)$/i,xD=[{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 xL(e){var t;let n,r,i,a,o,s=(n=(t=e).rehypePlugins||xO,r=t.remarkPlugins||xO,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...xM}:xM,xk().use(vB).use(r).use(xo,i).use(n)),l=(a=e.children||"",o=new xv,"string"==typeof a?o.value=a:gc("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||xI;for(let e of xD)Object.hasOwn(t,e.from)&&gc("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&&gc("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),v5(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 ms)if(Object.hasOwn(ms,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=ms[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=gZ(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?g$:gX,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},c=me(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 xI(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||xP.test(e.slice(0,t))?e:""}function xR(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}xF(/[A-Za-z]/),xF(/[\dA-Za-z]/),xF(/[#-'*+\--9=?A-Z^-~]/),xF(/\d/),xF(/[\dA-Fa-f]/),xF(/[!-/:-@[-`{-~]/);let xB=xF(/\p{P}|\p{S}/u),xz=xF(/\s/);function xF(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let xV="phrasing",xU=["autolink","link","image","label"];function xH(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function xW(e){this.config.enter.autolinkProtocol.call(this,e)}function xY(e){this.config.exit.autolinkProtocol.call(this,e)}function xG(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];gl("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function xX(e){this.config.exit.autolinkEmail.call(this,e)}function x$(e){this.exit(e)}function xq(e){!function(e,t,n){let r=vQ((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;)v2(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,xK],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,xZ]],{ignore:["link","linkReference"]})}function xK(e,t,n,r,i){let a,o="";if(!xQ(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=xR(e,"("),a=xR(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 xZ(e,t,n,r){return!(!xQ(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function xQ(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||xz(n)||xB(n))&&(!t||47!==n)}function xJ(){this.buffer()}function x0(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function x1(){this.buffer()}function x2(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function x5(e){let t=this.resume(),n=this.stack[this.stack.length-1];gl("footnoteReference"===n.type),n.identifier=vh(this.sliceSerialize(e)).toLowerCase(),n.label=t}function x3(e){this.exit(e)}function x4(e){let t=this.resume(),n=this.stack[this.stack.length-1];gl("footnoteDefinition"===n.type),n.identifier=vh(this.sliceSerialize(e)).toLowerCase(),n.label=t}function x6(e){this.exit(e)}function x8(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 x7(e,t,n){return 0===t?e:x9(e,t,n)}function x9(e,t,n){return(n?"":" ")+e}x8.peek=function(){return"["};let ye=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function yt(e){this.enter({type:"delete",children:[]},e)}function yn(e){this.exit(e)}function yr(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 yi(e){return e.length}function ya(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)}yr.peek=function(){return"~"};function yo(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}yo.peek=function(){return"`"};vQ(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let ys=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 yl(e){let t=e._align;gl(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 yc(e){this.exit(e),this.data.inTable=void 0}function yu(e){this.enter({type:"tableRow",children:[]},e)}function yd(e){this.exit(e)}function yh(e){this.enter({type:"tableCell",children:[]},e)}function yf(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,yp));let n=this.stack[this.stack.length-1];gl("inlineCode"===n.type),n.value=t,this.exit(e)}function yp(e,t){return"|"===t?t:e}function yg(e){let t=this.stack[this.stack.length-2];gl("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function ym(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];gl("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 yv(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=ys(e,t,n,{...r,...s.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}let yx=yN(/[A-Za-z]/),yy=yN(/[\dA-Za-z]/);function yb(e){return null!==e&&(e<0||32===e)}yN(/[#-'*+\--9=?A-Z^-~]/),yN(/\d/),yN(/[\dA-Fa-f]/),yN(/[!-/:-@[-`{-~]/);let yw=yN(/\p{P}|\p{S}/u),yj=yN(/\s/);function yN(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let yk={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},yE={tokenize:function(e,t,n){let r,i,a;return o;function o(t){return 46===t||95===t?e.check(y_,l,s)(t):null===t||yb(t)||yj(t)||45!==t&&yw(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},yC={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(y_,t,a)(o):null===o||yb(o)||yj(o)?t(o):(e.consume(o),i)}function a(t){return 41===t&&r++,e.consume(t),i}},partial:!0},y_={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||yb(o)||yj(o)?t(o):n(o)}function i(e){return null===e||40===e||91===e||yb(e)||yj(e)?t(e):r(e)}function a(t){return yx(t)?function t(i){return 59===i?(e.consume(i),r):yx(i)?(e.consume(i),t):n(i)}(t):n(t)}},partial:!0},yS={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return yy(e)?n(e):t(e)}},partial:!0},yA={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!yD.call(r,r.previous)||yB(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(yk,e.attempt(yE,e.attempt(yC,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:yD},yT={name:"protocolAutolink",tokenize:function(e,t,n){let r=this,i="",a=!1;return function(t){return(72===t||104===t)&&yL.call(r,r.previous)&&!yB(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),o):n(t)};function o(t){if(yx(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)||yb(t)||yj(t)||yw(t)?n(t):e.attempt(yE,e.attempt(yC,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:yL},yO={name:"emailAutolink",tokenize:function(e,t,n){let r,i,a=this;return function(t){return!yR(t)||!yI.call(a,a.previous)||yB(a.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return yR(r)?(e.consume(r),t):64===r?(e.consume(r),o):n(r)}(t))};function o(t){return 46===t?e.check(yS,l,s)(t):45===t||95===t||yy(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&&yx(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):n(o)}},previous:yI},yM={},yP=48;for(;yP<123;)yM[yP]=yO,58==++yP?yP=65:91===yP&&(yP=97);function yD(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||yb(e)}function yL(e){return!yx(e)}function yI(e){return!(47===e||yR(e))}function yR(e){return 43===e||45===e||46===e||95===e||yy(e)}function yB(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 yz(e){return null!==e&&(e<0||32===e)}function yF(e){return -2===e||-1===e||32===e}function yV(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function yU(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return yF(r)?(e.enter(n),function r(o){return yF(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}yM[43]=yO,yM[45]=yO,yM[46]=yO,yM[95]=yO,yM[72]=[yO,yT],yM[104]=[yO,yT],yM[87]=[yO,yA],yM[119]=[yO,yA],yV(/[A-Za-z]/),yV(/[\dA-Za-z]/),yV(/[#-'*+\--9=?A-Z^-~]/),yV(/\d/),yV(/[\dA-Fa-f]/),yV(/[!-/:-@[-`{-~]/),yV(/\p{P}|\p{S}/u),yV(/\s/);let yH={tokenize:function(e,t,n){let r=this;return yU(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 yW(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=vh(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 yY(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 yG(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||yz(s))return n(s);if(93===s){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return a.includes(vh(i.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(s)}return yz(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 yX(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||yz(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=vh(a.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return yz(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),yU(e,h,"gfmFootnoteDefinitionWhitespace")):n(t)}function h(e){return t(e)}}function y$(e,t,n){return e.check(mD,t,e.attempt(yH,t,n))}function yq(e){e.exit("gfmFootnoteDefinition")}function yK(e){return null!==e&&e<-2}function yZ(e){return null!==e&&(e<0||32===e)}function yQ(e){return -2===e||-1===e||32===e}function yJ(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function y0(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return yQ(r)?(e.enter(n),function r(o){return yQ(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}yJ(/[A-Za-z]/),yJ(/[\dA-Za-z]/),yJ(/[#-'*+\--9=?A-Z^-~]/),yJ(/\d/),yJ(/[\dA-Fa-f]/),yJ(/[!-/:-@[-`{-~]/),yJ(/\p{P}|\p{S}/u),yJ(/\s/);class y1{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 y2(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):yK(t)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):yQ(t)?y0(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||yZ(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,yQ(t))?y0(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 yQ(t)?y0(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||yK(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 yQ(t)?y0(e,x,"whitespace")(t):x(t)}function x(i){if(124===i)return h(i);if(null===i||yK(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||yK(n)?(e.exit("tableRow"),t(n)):yQ(n)?y0(e,b,"whitespace")(n):(e.enter("data"),w(n))}function w(t){return null===t||124===t||yZ(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 y5(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 y1;for(;++a<e.length;){let f=e[a],p=f[1];"enter"===f[0]?"tableHead"===p.type?(u=!1,0!==d&&(y4(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=y3(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=y3(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=y3(h,t,l,s,a,i)):0!==c[1]&&(i=y3(h,t,c,s,a,i)),s=0):s&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)&&(c[3]=a)}for(0!==d&&y4(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 y3(e,t,n,r,i,a){0!==n[0]&&(a.end=Object.assign({},y6(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));let o=y6(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=y6(t.events,n[2]),a=y6(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({},y6(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function y4(e,t,n,r,i){let a=[],o=y6(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 y6(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}function y8(e){return -2===e||-1===e||32===e}function y7(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}y7(/[A-Za-z]/),y7(/[\dA-Za-z]/),y7(/[#-'*+\--9=?A-Z^-~]/),y7(/\d/),y7(/[\dA-Fa-f]/),y7(/[!-/:-@[-`{-~]/),y7(/\p{P}|\p{S}/u),y7(/\s/);let y9={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):y8(r)?e.check({tokenize:be},t,n)(r):n(r)}}};function be(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 y8(t)?(e.enter(i),function t(n){return y8(n)&&o++<a?(e.consume(n),t):(e.exit(i),r(n))}(t)):r(t)}}let bt={};function bn(e){let t,n,r,i=e||bt,a=this.data(),o=a.micromarkExtensions||(a.micromarkExtensions=[]),s=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);o.push(mg([{text:yM},{document:{91:{name:"gfmFootnoteDefinition",tokenize:yX,continuation:{tokenize:y$},exit:yq}},text:{91:{name:"gfmFootnoteCall",tokenize:yG},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:yW,resolveTo:yY}}},(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=mK(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=mK(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&&mh(o,o.length,0,mZ(s,e.slice(r+1,n),t)),mh(o,o.length,0,[["exit",a,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),mh(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:y2,resolveAll:y5}}},{text:{91:y9}}])),s.push([{transforms:[xq],enter:{literalAutolink:xH,literalAutolinkEmail:xW,literalAutolinkHttp:xW,literalAutolinkWww:xW},exit:{literalAutolink:x$,literalAutolinkEmail:xX,literalAutolinkHttp:xY,literalAutolinkWww:xG}},{enter:{gfmFootnoteCallString:xJ,gfmFootnoteCall:x0,gfmFootnoteDefinitionLabelString:x1,gfmFootnoteDefinition:x2},exit:{gfmFootnoteCallString:x5,gfmFootnoteCall:x3,gfmFootnoteDefinitionLabelString:x4,gfmFootnoteDefinition:x6}},{canContainEols:["delete"],enter:{strikethrough:yt},exit:{strikethrough:yn}},{enter:{table:yl,tableData:yh,tableHeader:yh,tableRow:yu},exit:{codeText:yf,table:yc,tableData:yd,tableHeader:yd,tableRow:yd}},{exit:{taskListCheckValueChecked:yg,taskListCheckValueUnchecked:yg,paragraph:ym}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:xV,notInConstruct:xU},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:xV,notInConstruct:xU},{character:":",before:"[ps]",after:"\\/",inConstruct:xV,notInConstruct:xU}]},(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?x9:x7))),s(),o},footnoteReference:x8},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ye}],handlers:{delete:yr}},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=yo(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||yi,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]=ya(r[h]);else{let e=ya(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:yv}}]})}let br=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 bi({mentalModel:e}){return(0,ep.jsxs)("div",{className:"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:e.name}),e.trigger?.refresh_after_consolidation&&(0,ep.jsxs)("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 text-xs font-medium",children:[(0,ep.jsx)(gs,{className:"w-3 h-3"}),"Auto refresh"]})]}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground/70",children:e.id}),e.source_query&&(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:e.source_query})]}),(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:br(e.created_at)})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:"Last Refreshed"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:br(e.last_refreshed_at)})]})]}),(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)(xL,{remarkPlugins:[bn],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-1.5",children:e.tags.map((e,t)=>(0,ep.jsx)("span",{className:"px-2 py-0.5 bg-amber-500/10 text-amber-600 dark:text-amber-400 rounded text-xs",children:e},t))})]})]})}function ba({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(e),d.push(e),h++;else{let e=[],t=[];for(;h<s.length&&"same"!==s[h].type;)"removed"===s[h].type?e.push(s[h].text):t.push(s[h].text),h++;let n=Math.max(e.length,t.length);for(let r=0;r<n;r++)u.push(r<e.length?{type:"removed",text:e[r]}:{type:"same",text:""}),d.push(r<t.length?{type:"added",text:t[r]}:{type:"same",text:""})}}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/10 text-red-700 dark:text-red-400":"text-foreground"}`,children:e.text},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/10 text-green-700 dark:text-green-400":"text-foreground"}`,children:e.text},t))]})]}):(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"unchanged"})}function bo({history:e,currentContent:t}){let[n,r]=(0,eg.useState)(0),i=e[n],a=0===n?t:e[n-1].previous_content??"";return(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Change ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:e.length-n})," of"," ",e.length," · ",new Date(i.changed_at).toLocaleString()]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:n===e.length-1,onClick:()=>r(n+1),children:(0,ep.jsx)(e_,{className:"h-3.5 w-3.5"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:0===n,onClick:()=>r(n-1),children:(0,ep.jsx)(eS.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),null!==i.previous_content?(0,ep.jsx)(ba,{before:i.previous_content,after:a}):(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"})})]})}function bs({mentalModelId:e,onClose:t,initialTab:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,eg.useState)(null),[o,s]=(0,eg.useState)(!1),[l,c]=(0,eg.useState)(null),[u,d]=(0,eg.useState)(n??"model"),[h,f]=(0,eg.useState)(null),[p,g]=(0,eg.useState)(!1);(0,eg.useEffect)(()=>{e&&r&&(async()=>{s(!0),c(null),a(null),f(null),d(n??"model");try{let t=await eP.client.getMentalModel(r,e);a(t)}catch(e){console.error("Error loading mental model:",e),c(e.message)}finally{s(!1)}})()},[e,r]),(0,eg.useEffect)(()=>{"history"===u&&i&&r&&null===h&&(async()=>{g(!0);try{let e=await eP.client.getMentalModelHistory(r,i.id);f(e)}catch(e){console.error("Error loading mental model history:",e),f([])}finally{g(!1)}})()},[u,i,r,h]);let v=null!==e;return(0,ep.jsx)(tV.Dialog,{open:v,onOpenChange:e=>!e&&t(),children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col p-6",children:[(0,ep.jsx)(go.VisuallyHidden,{children:(0,ep.jsx)(tV.DialogTitle,{children:"Mental Model Details"})}),o?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)(tz.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)(tH.Tabs,{value:u,onValueChange:d,className:"flex-1 flex flex-col overflow-hidden",children:[(0,ep.jsxs)(tH.TabsList,{className:"grid w-full grid-cols-2",children:[(0,ep.jsxs)(tH.TabsTrigger,{value:"model",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eE.FileText,{className:"w-3.5 h-3.5"}),"Mental Model"]}),(0,ep.jsxs)(tH.TabsTrigger,{value:"history",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(tF,{className:"w-3.5 h-3.5"}),"History",h&&h.length>0?` (${h.length})`:""]})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ep.jsx)(tH.TabsContent,{value:"model",className:"mt-0",children:(0,ep.jsx)(bi,{mentalModel:i})}),(0,ep.jsx)(tH.TabsContent,{value:"history",className:"mt-0",children:p?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tz.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):h&&h.length>0?(0,ep.jsx)(bo,{history:h,currentContent:i.content}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No history recorded yet."})})]})]}):null]})})}function bl(){let e,t,n,r,i,a,o,s,l,c,u,{currentBank:d}=(0,ey.useBank)(),[h,f]=(0,eg.useState)(""),[p,g]=(0,eg.useState)("mid"),[v,x]=(0,eg.useState)(4096),[y,b]=(0,eg.useState)(!0),[w,j]=(0,eg.useState)(!0),[N,k]=(0,eg.useState)("answer"),[E,C]=(0,eg.useState)(null),[_,S]=(0,eg.useState)(!1),[A,T]=(0,eg.useState)(""),[O,M]=(0,eg.useState)("any"),[P,D]=(0,eg.useState)([]),[L,I]=(0,eg.useState)(!1),[R,B]=(0,eg.useState)(""),[z,F]=(0,eg.useState)(""),[V,U]=(0,eg.useState)(!1),[H,W]=(0,eg.useState)(!1),[Y,G]=(0,eg.useState)(null),[X,$]=(0,eg.useState)(null),[q,K]=(0,eg.useState)(null),[Z,Q]=(0,eg.useState)(!1),[J,ee]=(0,eg.useState)(null),[et,en]=(0,eg.useState)(null),[er,ei]=(0,eg.useState)(!1),[ea,eo]=(0,eg.useState)(null),[es,el]=(0,eg.useState)("world"),ec="General Feedback",eu=async e=>{if(ee(e),en(null),d&&e?.id){ei(!0);try{let t=await eP.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 eP.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 eP.client.updateDirective(d,t.id,{content:e})}else await eP.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=A.split(",").map(e=>e.trim()).filter(e=>e.length>0),t=R.split(",").map(e=>e.trim()).filter(e=>e.length>0),n=await eP.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)(pg,{children:(0,ep.jsxs)(py,{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)(eN,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eL.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)(eD.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)(pl.Select,{value:p,onValueChange:e=>g(e),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(pl.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(pl.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)(eL.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)(pc.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)(pc.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)(eG,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eL.Input,{type:"text",value:A,onChange:e=>T(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(pl.Select,{value:O,onValueChange:e=>M(e),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(pl.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(pl.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(pl.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)(pf,{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)(pc.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)(eL.Input,{type:"text",value:R,onChange:e=>B(e.target.value),placeholder:"model-a, model-b",className:"h-8 w-48"})]})]})]})}),_&&(0,ep.jsx)(pg,{children:(0,ep.jsxs)(py,{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)(pg,{children:[(0,ep.jsx)(pm,{children:(0,ep.jsx)(pv,{children:"Answer"})}),(0,ep.jsx)(py,{children:(0,ep.jsx)("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:(0,ep.jsx)(xL,{remarkPlugins:[bn],children:E.text})})})]}),(0,ep.jsxs)(pg,{className:"border-blue-200 dark:border-blue-800",children:[(0,ep.jsxs)(pm,{className:"py-4",children:[(0,ep.jsxs)(pv,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(pj,{className:"w-4 h-4"}),"Add Directive"]}),(0,ep.jsx)(px,{className:"text-xs",children:"Hard rules injected into prompts that the agent must follow"})]}),(0,ep.jsx)(py,{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)(pE.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)(eD.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)(pg,{className:"border-emerald-200 dark:border-emerald-800",children:[(0,ep.jsxs)(pm,{className:"bg-emerald-50 dark:bg-emerald-950 py-3",children:[(0,ep.jsxs)(pv,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(pw,{className:"w-4 h-4 text-emerald-600"}),"Observations Created (",E.observations_created.length,")"]}),(0,ep.jsx)(px,{className:"text-xs",children:"New observations learned during this reflection"})]}),(0,ep.jsx)(py,{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)(pg,{className:"h-fit",children:[(0,ep.jsxs)(pm,{className:"pb-3",children:[(0,ep.jsx)(pv,{className:"text-base",children:"Execution Trace"}),(0,ep.jsxs)(px,{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)(py,{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)(tB.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)(eH,{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)(pk,{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)(eH,{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)(ga,{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)(ga,{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)(pb.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)(pb.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)(pg,{className:"h-fit",children:[(0,ep.jsxs)(pm,{className:"pb-3",children:[(0,ep.jsx)(pv,{className:"text-base",children:"Based On"}),(0,ep.jsxs)(px,{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)(py,{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)(pb.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)(pb.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)(pg,{children:[(0,ep.jsx)(pm,{children:(0,ep.jsx)(pv,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(py,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(ga,{src:E,collapsed:2,theme:"default"})})})]})]}),!_&&!E&&(0,ep.jsx)(pg,{className:"border-dashed",children:(0,ep.jsxs)(py,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(eN,{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)(tK,{memoryId:Y,onClose:()=>G(null)}),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.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)(pN,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Directive"})]}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"icon",onClick:()=>{$(null),K(null)},children:(0,ep.jsx)(eX.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||X.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)(eG,{className:"w-2.5 h-2.5"}),e]},e))})]}),(q?.content||X.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||X.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:X.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)(pw,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Observation"})]}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"icon",onClick:()=>{ee(null),en(null)},children:(0,ep.jsx)(eX.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)(xL,{remarkPlugins:[bn],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)(eG,{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)(bs,{mentalModelId:ea,onClose:()=>eo(null)})]}):(0,ep.jsx)(pg,{className:"border-dashed",children:(0,ep.jsxs)(py,{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-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."})]})})}var bc=e.i(64659);let bu=(0,ej.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function bd(){let e,t,n,r,i,a,o,s,l,c,u,d,h,f,{currentBank:p}=(0,ey.useBank)(),[g,v]=(0,eg.useState)(""),[x,y]=(0,eg.useState)(["world"]),[b,w]=(0,eg.useState)("mid"),[j,N]=(0,eg.useState)(4096),[k,E]=(0,eg.useState)(""),[C,_]=(0,eg.useState)(!1),[S,A]=(0,eg.useState)(!1),[T,O]=(0,eg.useState)(""),[M,P]=(0,eg.useState)("any"),[D,L]=(0,eg.useState)(null),[I,R]=(0,eg.useState)(null),[B,z]=(0,eg.useState)(null),[F,V]=(0,eg.useState)(null),[U,H]=(0,eg.useState)(null),[W,Y]=(0,eg.useState)(!1),[G,X]=(0,eg.useState)("results"),[$,q]=(0,eg.useState)(null),[K,Z]=(0,eg.useState)(new Set),[Q,J]=(0,eg.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=T.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 eP.client.recall(t);L(n.results||[]),R(n.entities||null),z(n.chunks||null),V(n.observations||null),H(n.trace||null),X("results")}catch(e){}finally{Y(!1)}}};return p?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(pg,{children:(0,ep.jsxs)(py,{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)(ew.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eL.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)(eD.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)(pf,{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)(gs,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsxs)(pl.Select,{value:b,onValueChange:e=>w(e),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(pl.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(pl.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)(eL.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)(eH,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eL.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)(pc.Checkbox,{checked:C,onCheckedChange:e=>_(e)}),(0,ep.jsx)(eE.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)(pc.Checkbox,{checked:S,onCheckedChange:e=>A(e)}),(0,ep.jsx)(eC,{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)(eG,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eL.Input,{type:"text",value:T,onChange:e=>O(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(pl.Select,{value:M,onValueChange:e=>P(e),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(pl.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(pl.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(pl.SelectItem,{value:"all_strict",children:"All (strict)"})]})]})]})]})}),W&&(0,ep.jsx)(pg,{children:(0,ep.jsxs)(py,{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:()=>X(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)(pg,{className:"border-orange-500/30 bg-orange-500/5",children:[(0,ep.jsx)(pm,{className:"py-3",children:(0,ep.jsxs)(pv,{className:"text-base flex items-center gap-2",children:[(0,ep.jsx)(ek,{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)(py,{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)(pg,{className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>q(e),children:(0,ep.jsx)(py,{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)(eS.ChevronRight,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"})]})})},t)}):(0,ep.jsx)(pg,{children:(0,ep.jsxs)(py,{className:"flex flex-col items-center justify-center py-12",children:[(0,ep.jsx)(ew.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)(pg,{className:`transition-colors ${a?"border-primary":c.border}`,children:(0,ep.jsxs)(py,{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)(bc.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eS.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)(eI,{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)(bc.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ep.jsx)(eS.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)(bu,{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)(pg,{className:`cursor-pointer transition-colors ${r?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(n),children:(0,ep.jsx)(py,{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)(bc.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eS.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)(bu,{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)(pg,{className:`cursor-pointer transition-colors ${c?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(l),children:(0,ep.jsx)(py,{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)(bc.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eS.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)(bu,{className:"h-4 w-4 text-muted-foreground/50"})})]})),(0,ep.jsx)(pg,{className:"border-primary bg-primary/5",children:(0,ep.jsx)(py,{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)(pg,{children:[(0,ep.jsx)(pm,{children:(0,ep.jsx)(pv,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(py,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(ga,{src:{results:D,...I&&{entities:I},...B&&{chunks:B},...F&&{observations:F},trace:U},collapsed:2,theme:"default"})})})]})]}),!W&&!D&&(0,ep.jsx)(pg,{className:"border-dashed",children:(0,ep.jsxs)(py,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ew.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."})]})}),$&&(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)(tZ,{memory:$,onClose:()=>q(null),inPanel:!0,bankId:p||void 0})})]}):(0,ep.jsx)(pg,{className:"border-dashed",children:(0,ep.jsxs)(py,{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-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 bh=(0,ej.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 bf=e.i(82458),bf=bf,tz=tz;let bp={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 bg({hideReflectFields:e=!1}){let t=(0,em.useRouter)(),{currentBank:n,setCurrentBank:r,loadBanks:i}=(0,ey.useBank)(),{features:a}=(0,eb.useFeatures)();a?.observations;let[o,s]=(0,eg.useState)(null),[l,c]=(0,eg.useState)(null),[u,d]=(0,eg.useState)([]),[h,f]=(0,eg.useState)(0),[p,g]=(0,eg.useState)([]),[v,x]=(0,eg.useState)(0),[y,b]=(0,eg.useState)(!1),[w,j]=(0,eg.useState)(!1),[N,k]=(0,eg.useState)(!1),[E,C]=(0,eg.useState)(!1),[_,S]=(0,eg.useState)(null),[A,T]=(0,eg.useState)(null),[O,M]=(0,eg.useState)(!1),[P,D]=(0,eg.useState)(!1),[L,I]=(0,eg.useState)(!1),[R,B]=(0,eg.useState)(!1),[z,F]=(0,eg.useState)(!1),[V,U]=(0,eg.useState)(!1),[H,W]=(0,eg.useState)(null),[Y]=(0,eg.useState)(10),[G,X]=(0,eg.useState)(0),[$,q]=(0,eg.useState)(null),K=async(e=H,t=G)=>{if(n)try{let r=await eP.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([eP.client.getBankStats(n),eP.client.listDirectives(n),eP.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([eP.client.getBankProfile(n),eP.client.getBankStats(n),eP.client.listDirectives(n),eP.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 eP.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 eP.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&&A){M(!0);try{await eP.client.deleteDirective(n,A.id),g(e=>e.filter(e=>e.id!==A.id)),_?.id===A.id&&S(null),T(null)}catch(e){}finally{M(!1)}}};return((0,eg.useEffect)(()=>{if(n){Z();let e=setInterval(()=>Z(!0),5e3);return()=>clearInterval(e)}},[n]),(0,eg.useEffect)(()=>{let e=e=>{"Escape"===e.key&&S(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),n)?y&&!o?(0,ep.jsx)(pg,{children:(0,ep.jsxs)(py,{className:"text-center py-10",children:[(0,ep.jsx)(eH,{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)(pg,{children:[(0,ep.jsx)(pm,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(pv,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(pw,{className:"w-5 h-5 text-primary"}),"Disposition Profile"]}),(0,ep.jsx)(px,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)(eD.Button,{onClick:()=>j(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(pr,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(py,{children:o&&(0,ep.jsx)("div",{className:"space-y-4",children:Object.keys(bp).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:bp[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:bp[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:bp[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:bp[e].highLabel})]})]},e))})})]}),(0,ep.jsxs)(pg,{children:[(0,ep.jsx)(pm,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(pv,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(bh,{className:"w-5 h-5 text-primary"}),"Mission"]}),(0,ep.jsx)(px,{children:"Affects how observations, reflect, and mental models are created"})]}),(0,ep.jsx)(eD.Button,{onClick:()=>k(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(pr,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(py,{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)(bf.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)(eD.Button,{onClick:()=>C(!0),variant:"outline",size:"sm",className:"h-8",children:[(0,ep.jsx)(fP.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)(pg,{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)(py,{className:"p-3",children:(0,ep.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ep.jsx)(bf.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)(eG,{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)(bf.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)(fU,{open:P,onOpenChange:D,children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Delete Memory Bank"}),(0,ep.jsx)(f9,{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)(f8,{children:[(0,ep.jsx)(pt,{disabled:L,children:"Cancel"}),(0,ep.jsx)(pe,{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)(eV,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pn,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(fU,{open:R,onOpenChange:B,children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Clear Observations"}),(0,ep.jsx)(f9,{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)(f8,{children:[(0,ep.jsx)(pt,{disabled:z,children:"Cancel"}),(0,ep.jsx)(pe,{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)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pn,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})}),(0,ep.jsx)(bx,{open:E,mode:"create",onClose:()=>C(!1),onCreated:e=>{g(t=>[e,...t]),C(!1)}}),(0,ep.jsx)(fU,{open:!!A,onOpenChange:e=>!e&&T(null),children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Delete Directive"}),(0,ep.jsxs)(f9,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',A?.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)(f8,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(pt,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(pe,{onClick:ee,disabled:O,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[O?(0,ep.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),_&&(0,ep.jsx)(by,{directive:_,onClose:()=>S(null),onDelete:()=>T({id:_.id,name:_.name}),onUpdated:e=>{g(t=>t.map(t=>t.id===e.id?e:t)),S(e)}}),w&&o&&(0,ep.jsx)(bm,{disposition:o.disposition,onClose:()=>j(!1),onSaved:async()=>{await Z(),j(!1)}}),N&&o&&(0,ep.jsx)(bv,{mission:o.mission||"",onClose:()=>k(!1),onSaved:async()=>{await Z(),k(!1)}})]}):(0,ep.jsx)(pg,{children:(0,ep.jsxs)(py,{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 bm({disposition:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,eg.useState)(!1),[o,s]=(0,eg.useState)(e),l=async()=>{if(r){a(!0);try{await eP.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)(tV.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Edit Disposition Traits"}),(0,ep.jsx)(tV.DialogDescription,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)("div",{className:"space-y-4 py-4",children:Object.keys(bp).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:bp[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:bp[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:bp[e].lowLabel}),(0,ep.jsx)("span",{children:bp[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)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eV,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function bv({mission:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,eg.useState)(!1),[o,s]=(0,eg.useState)(e),l=async()=>{if(r){a(!0);try{await eP.client.updateBankConfig(r,{reflect_mission:o||null}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tV.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Edit Mission"}),(0,ep.jsx)(tV.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)(pE.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)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eV,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function bx({open:e,mode:t,directive:n,onClose:r,onCreated:i,onSaved:a}){let{currentBank:o}=(0,ey.useBank)(),[s,l]=(0,eg.useState)(!1),[c,u]=(0,eg.useState)({name:"",content:"",tags:""});(0,eg.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 eP.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 eP.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)(tV.Dialog,{open:e,onOpenChange:e=>!e&&h(),children:(0,ep.jsxs)(tV.DialogContent,{className:"sm:max-w-lg",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsxs)(tV.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)(bf.default,{className:"w-5 h-5 text-rose-500"}),"create"===t?"Create":"Edit"," Directive"]}),(0,ep.jsx)(tV.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)(eL.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)(pE.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)(eL.Input,{value:c.tags,onChange:e=>u({...c,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"})]})]}),(0,ep.jsxs)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:h,disabled:s,children:"Cancel"}),(0,ep.jsxs)(eD.Button,{onClick:d,disabled:s||!c.name.trim()||!c.content.trim(),className:"bg-rose-500 hover:bg-rose-600",children:[s?(0,ep.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"create"===t?"Create":"Save"]})]})]})})}function by({directive:e,onClose:t,onDelete:n,onUpdated:r}){let[i,a]=(0,eg.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)(bf.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)(eD.Button,{variant:"ghost",size:"sm",onClick:()=>a(!0),className:"h-7 w-7 p-0",children:(0,ep.jsx)(pr,{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)(eD.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)(pn,{className:"h-4 w-4"})}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,ep.jsx)(eX.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)(xL,{remarkPlugins:[bn],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)(bx,{open:i,mode:"edit",directive:e,onClose:()=>a(!1),onSaved:r})]})}let bb=(0,e3.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"}}),bw=eg.forwardRef(({className:e,variant:t,...n},r)=>(0,ep.jsx)("div",{ref:r,role:"alert",className:(0,eT.cn)(bb({variant:t}),e),...n}));bw.displayName="Alert",eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("h5",{ref:n,className:(0,eT.cn)("mb-1 font-medium leading-none tracking-tight",e),...t})).displayName="AlertTitle";let bj=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eT.cn)("text-sm [&_p]:leading-relaxed",e),...t}));bj.displayName="AlertDescription";var tz=tz;let bN=(0,ej.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"}]]),bk=[{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"}],bE=[{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"}],bC=bk.map(e=>({category:e.value,threshold:"BLOCK_NONE"})),b_=[{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","delete_memory"]},{label:"Documents",tools:["list_documents","get_document","delete_document"]},{label:"Operations",tools:["list_operations","get_operation","cancel_operation"]},{label:"Tags",tools:["list_tags"]}],bS=b_.flatMap(e=>e.tools);function bA(e){return Array.isArray(e)?e:e&&"object"==typeof e&&Array.isArray(e.attributes)?e.attributes:null}function bT(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:bA(e.entity_labels)}}function bO(e){return{retain_default_strategy:e.retain_default_strategy??null,retain_strategies:e.retain_strategies??null}}function bM(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 bP(e){return{mcp_enabled_tools:e.mcp_enabled_tools??null}}function bD(e){return{llm_gemini_safety_settings:e.llm_gemini_safety_settings??null}}let bL={reflect_mission:"",disposition_skepticism:3,disposition_literalism:3,disposition_empathy:3};function bI(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,eb.useFeatures)(),n=t?.bank_config_api??!0,[r,i]=(0,eg.useState)(!0),[a,o]=(0,eg.useState)({}),[s,l]=(0,eg.useState)(bL),[c,u]=(0,eg.useState)(bT({})),[d,h]=(0,eg.useState)(bO({})),[f,p]=(0,eg.useState)(bM({})),[g,v]=(0,eg.useState)(bL),[x,y]=(0,eg.useState)(bP({})),[b,w]=(0,eg.useState)(bD({})),[j,N]=(0,eg.useState)(!1),[k,E]=(0,eg.useState)(!1),[C,_]=(0,eg.useState)(!1),[S,A]=(0,eg.useState)(!1),[T,O]=(0,eg.useState)(!1),[M,P]=(0,eg.useState)(null),[D,L]=(0,eg.useState)(null),[I,R]=(0,eg.useState)(null),[B,z]=(0,eg.useState)(null),[F,V]=(0,eg.useState)(null),U=(0,eg.useMemo)(()=>JSON.stringify(c)!==JSON.stringify(bT(a))||JSON.stringify(d)!==JSON.stringify(bO(a)),[c,d,a]),H=(0,eg.useMemo)(()=>JSON.stringify(f)!==JSON.stringify(bM(a)),[f,a]),W=(0,eg.useMemo)(()=>JSON.stringify(g)!==JSON.stringify(s),[g,s]),Y=(0,eg.useMemo)(()=>JSON.stringify(x)!==JSON.stringify(bP(a)),[x,a]),G=(0,eg.useMemo)(()=>JSON.stringify(b)!==JSON.stringify(bD(a)),[b,a]);(0,eg.useEffect)(()=>{e&&X()},[e]);let X=async()=>{if(e){i(!0);try{let[t,n]=await Promise.all([eP.client.getBankConfig(e),eP.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(bT(r)),h(bO(r)),p(bM(r)),v(i),y(bP(r)),w(bD(r))}catch(e){console.error("Failed to load bank data:",e)}finally{i(!1)}}},$=async()=>{if(e){N(!0),P(null);try{let t={...c,...d};await eP.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 eP.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 eP.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){A(!0),z(null);try{await eP.client.updateBankConfig(e,x),o(e=>({...e,...x}))}catch(e){z(e.message||"Failed to save MCP settings")}finally{A(!1)}}},Q=async()=>{if(e){O(!0),V(null);try{await eP.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)(tz.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)(bH,{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:$,children:[(0,ep.jsx)(bW,{label:"Default strategy",description:"Applied automatically when no strategy is specified on a request.",children:(0,ep.jsxs)(pl.Select,{value:d.retain_default_strategy??"__none__",onValueChange:e=>h(t=>({...t,retain_default_strategy:"__none__"===e?null:e})),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.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)(pl.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(bV,{defaultValues:c,onDefaultChange:e=>u(t=>({...t,...e})),strategies:d.retain_strategies,onStrategiesChange:e=>h(t=>({...t,retain_strategies:e}))})]}),(0,ep.jsxs)(bH,{title:"Observations",description:"Control how facts are synthesized into durable observations",error:D,dirty:H,saving:k,onSave:q,children:[(0,ep.jsx)(bW,{label:"Enable Observations",description:"Enable automatic consolidation of facts into observations",children:(0,ep.jsx)("div",{className:"flex justify-end",children:(0,ep.jsx)(tL.Switch,{checked:f.enable_observations??!1,onCheckedChange:e=>p(t=>({...t,enable_observations:e}))})})}),(0,ep.jsx)(bY,{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)(bW,{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)(eL.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)(bW,{label:"Source Facts Max Tokens",description:"Total token budget for source facts included with observations during consolidation. -1 = unlimited.",children:(0,ep.jsx)(eL.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)(bW,{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)(eL.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)(bW,{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)(eL.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)(bH,{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)(bY,{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)(bG,{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)(bG,{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)(bG,{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)(bH,{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)(bW,{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)(tL.Switch,{checked:null!==x.mcp_enabled_tools,onCheckedChange:e=>y({mcp_enabled_tools:e?[...bS]:null})}),(0,ep.jsx)(e6,{className:"text-xs text-muted-foreground",children:null!==x.mcp_enabled_tools?"Enabled":"Disabled"})]})}),null!==x.mcp_enabled_tools&&(0,ep.jsx)(bU,{selected:x.mcp_enabled_tools,onChange:e=>y({mcp_enabled_tools:e})})]}),(0,ep.jsx)(bH,{title:"Models",description:"Provider-specific model settings",error:F,dirty:G,saving:T,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)(bW,{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)(tL.Switch,{checked:null!==b.llm_gemini_safety_settings,onCheckedChange:e=>w({llm_gemini_safety_settings:e?[...bC]:null})}),(0,ep.jsx)(e6,{className:"text-xs text-muted-foreground",children:null!==b.llm_gemini_safety_settings?"Custom":"Default"})]})}),null!==b.llm_gemini_safety_settings&&(0,ep.jsx)(b$,{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 bR=["concise","verbose","verbatim","chunks","custom"],bB="__inherit__";function bz({values:e,onChange:t,isOverride:n=!1}){let r=e.retain_extraction_mode??(n?bB:""),i="custom"===e.retain_extraction_mode;return(0,ep.jsxs)("div",{className:"divide-y divide-border/40",children:[(0,ep.jsx)(bW,{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)(pl.Select,{value:r,onValueChange:e=>t({retain_extraction_mode:e===bB?null:e||null}),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(pl.SelectValue,{placeholder:n?"Inherited from default":void 0})}),(0,ep.jsxs)(pl.SelectContent,{children:[n&&(0,ep.jsx)(pl.SelectItem,{value:bB,children:(0,ep.jsx)("span",{className:"text-muted-foreground italic",children:"inherited"})}),bR.map(e=>(0,ep.jsx)(pl.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(bW,{label:"Chunk Size",description:"Size of text chunks for processing (characters)",children:(0,ep.jsx)(eL.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)(bY,{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)(bY,{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)(bW,{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)(e6,{className:"text-sm text-muted-foreground cursor-pointer select-none",children:e.entities_allow_free_form??!0?"Enabled":"Disabled"}),(0,ep.jsx)(tL.Switch,{checked:e.entities_allow_free_form??!0,onCheckedChange:e=>t({entities_allow_free_form:e})})]})}),(0,ep.jsx)(bX,{value:e.entity_labels??[],onChange:e=>t({entity_labels:e.length>0?e:null})})]})}function bF(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:bA(t.entity_labels)}})):[]}function bV({defaultValues:e,onDefaultChange:t,strategies:n,onStrategiesChange:r}){let[i,a]=(0,eg.useState)(()=>bF(n)),[o,s]=(0,eg.useState)("default"),[l,c]=(0,eg.useState)(null),u=(0,eg.useRef)(!1),d=JSON.stringify(n);(0,eg.useEffect)(()=>{if(u.current){u.current=!1;return}a(bF(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)(fP.Plus,{className:"h-3.5 w-3.5"}),"Add strategy"]})]}),(0,ep.jsx)("div",{children:"default"===o?(0,ep.jsx)(bz,{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)(eL.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)(bz,{values:p.values,onChange:e=>f(p.id,{values:{...p.values,...e}}),isOverride:!0})]}):null}),(0,ep.jsx)(fU,{open:null!==l,onOpenChange:e=>{e||c(null)},children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsxs)(f7,{children:["Delete strategy “",l?.name||"unnamed","”?"]}),(0,ep.jsx)(f9,{children:"This will remove the strategy and all its overrides. This cannot be undone."})]}),(0,ep.jsxs)(f8,{children:[(0,ep.jsx)(pt,{children:"Cancel"}),(0,ep.jsx)(pe,{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 bU({selected:e,onChange:t}){let n=new Set(e),r=bS.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 ",bS.length," tools enabled"]}),(0,ep.jsx)("button",{type:"button",onClick:()=>{t(r?[]:[...bS])},className:"text-xs text-primary hover:underline",children:r?"Deselect all":"Select all"})]}),(0,ep.jsx)("div",{className:"space-y-4",children:b_.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(bS.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(bS.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 bH({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)(pg,{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)(bw,{variant:"destructive",children:[(0,ep.jsx)(bN,{className:"h-4 w-4"}),(0,ep.jsx)(bj,{children:r})]})}),(0,ep.jsx)("div",{className:"px-6 py-4 flex justify-end border-t border-border/40",children:(0,ep.jsx)(eD.Button,{size:"sm",disabled:!i||a,onClick:o,children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):"Save changes"})})]})]})}function bW({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 bY({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)(pE.Textarea,{value:n,onChange:e=>r(e.target.value),placeholder:i,rows:a??3,className:"font-mono text-sm"})]})})}function bG({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 bX({value:e,onChange:t}){let[n,r]=(0,eg.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)(bc.ChevronDown,{className:"h-4 w-4"}):(0,ep.jsx)(eS.ChevronRight,{className:`h-4 w-4 ${c?"opacity-30":""}`})}),(0,ep.jsx)(eL.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)(eL.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)(pl.Select,{value:o.type,onValueChange:e=>i(s,{type:e,..."text"===e?{values:[]}:{}}),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"h-8 text-xs w-32 shrink-0",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"value",className:"text-xs",children:"Single value"}),(0,ep.jsx)(pl.SelectItem,{value:"multi-values",className:"text-xs",children:"Multi-values"}),(0,ep.jsx)(pl.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)(pc.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)(pn,{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)(eL.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)(eL.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)(pn,{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)(fP.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)(fP.Plus,{className:"h-3.5 w-3.5"}),"Add attribute"]})]})}function b$({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:bk.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)(pl.Select,{value:n(e.value),onValueChange:r=>{var i;return i=e.value,void t(bk.map(e=>({category:e.value,threshold:e.value===i?r:n(e.value)})))},children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-48 h-8 text-xs",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsx)(pl.SelectContent,{children:bE.map(e=>(0,ep.jsx)(pl.SelectItem,{value:e.value,className:"text-xs",children:e.label},e.value))})]})]},e.value))})]})}let bq=(0,ej.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"}]]),bK=(0,ej.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"}]]),bZ=(0,ej.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"}]]);function bQ(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,eb.useFeatures)(),n=t?.observations??!1,[r,i]=(0,eg.useState)(null),[a,o]=(0,eg.useState)(0),[s,l]=(0,eg.useState)(0),[c,u]=(0,eg.useState)(!1),d=async()=>{if(e){u(!0);try{let[t,n,r]=await Promise.all([eP.client.getBankStats(e),eP.client.listMentalModels(e),eP.client.listDirectives(e)]);i(t),o(n.items?.length||0),l(r.items?.length||0)}catch(e){console.error("Error loading bank stats:",e)}finally{u(!1)}}};return((0,eg.useEffect)(()=>{if(e){d();let e=setInterval(d,5e3);return()=>clearInterval(e)}},[e]),c&&!r)?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(eH,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"})}):r?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,ep.jsx)(pg,{className:"bg-gradient-to-br from-blue-500/10 to-blue-600/5 border-blue-500/20",children:(0,ep.jsx)(py,{className:"p-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/20",children:(0,ep.jsx)(ek,{className:"w-5 h-5 text-blue-500"})}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Memories"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-foreground",children:r.total_nodes})]})]})})}),(0,ep.jsx)(pg,{className:"bg-gradient-to-br from-purple-500/10 to-purple-600/5 border-purple-500/20",children:(0,ep.jsx)(py,{className:"p-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/20",children:(0,ep.jsx)(bq,{className:"w-5 h-5 text-purple-500"})}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Links"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-foreground",children:r.total_links})]})]})})}),(0,ep.jsx)(pg,{className:"bg-gradient-to-br from-emerald-500/10 to-emerald-600/5 border-emerald-500/20",children:(0,ep.jsx)(py,{className:"p-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/20",children:(0,ep.jsx)(bK,{className:"w-5 h-5 text-emerald-500"})}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Documents"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-foreground",children:r.total_documents})]})]})})}),(0,ep.jsx)(pg,{className:`bg-gradient-to-br ${r.pending_operations>0?"from-amber-500/10 to-amber-600/5 border-amber-500/20":"from-slate-500/10 to-slate-600/5 border-slate-500/20"}`,children:(0,ep.jsx)(py,{className:"p-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)("div",{className:`p-2 rounded-lg ${r.pending_operations>0?"bg-amber-500/20":"bg-slate-500/20"}`,children:(0,ep.jsx)(bZ,{className:`w-5 h-5 ${r.pending_operations>0?"text-amber-500 animate-pulse":"text-slate-500"}`})}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Pending"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-foreground",children:r.pending_operations})]})]})})})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-5 gap-3",children:[(0,ep.jsxs)("div",{className:"bg-blue-500/10 border border-blue-500/20 rounded-xl p-4 text-center",children:[(0,ep.jsx)("p",{className:"text-xs text-blue-600 dark:text-blue-400 font-semibold uppercase tracking-wide",children:"World Facts"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400 mt-1",children:r.nodes_by_fact_type?.world||0})]}),(0,ep.jsxs)("div",{className:"bg-purple-500/10 border border-purple-500/20 rounded-xl p-4 text-center",children:[(0,ep.jsx)("p",{className:"text-xs text-purple-600 dark:text-purple-400 font-semibold uppercase tracking-wide",children:"Experience"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400 mt-1",children:r.nodes_by_fact_type?.experience||0})]}),(0,ep.jsxs)("div",{className:`rounded-xl p-4 text-center ${n?"bg-amber-500/10 border border-amber-500/20":"bg-muted/50 border border-muted"}`,title:n?void 0:"Observations feature is not enabled",children:[(0,ep.jsxs)("p",{className:`text-xs font-semibold uppercase tracking-wide ${n?"text-amber-600 dark:text-amber-400":"text-muted-foreground"}`,children:["Observations",!n&&(0,ep.jsx)("span",{className:"ml-1 normal-case",children:"(Off)"})]}),(0,ep.jsx)("p",{className:`text-2xl font-bold mt-1 ${n?"text-amber-600 dark:text-amber-400":"text-muted-foreground"}`,children:n?r.total_observations||0:"—"})]}),(0,ep.jsxs)("div",{className:"bg-cyan-500/10 border border-cyan-500/20 rounded-xl p-4 text-center",children:[(0,ep.jsx)("p",{className:"text-xs text-cyan-600 dark:text-cyan-400 font-semibold uppercase tracking-wide",children:"Mental Models"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-cyan-600 dark:text-cyan-400 mt-1",children:a})]}),(0,ep.jsxs)("div",{className:"bg-rose-500/10 border border-rose-500/20 rounded-xl p-4 text-center",children:[(0,ep.jsx)("p",{className:"text-xs text-rose-600 dark:text-rose-400 font-semibold uppercase tracking-wide",children:"Directives"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-rose-600 dark:text-rose-400 mt-1",children:s})]})]})]}):null}var tz=tz;let bJ=(0,ej.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"}]]),b0=[{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 b1(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,eg.useState)([]),[r,i]=(0,eg.useState)(0),[a,o]=(0,eg.useState)(null),[s,l]=(0,eg.useState)(null),[c]=(0,eg.useState)(10),[u,d]=(0,eg.useState)(0),[h,f]=(0,eg.useState)(null),[p,g]=(0,eg.useState)(null),[v,x]=(0,eg.useState)(!1),[y,b]=(0,eg.useState)(null),[w,j]=(0,eg.useState)(!1),[N,k]=(0,eg.useState)(!1),E=(0,eg.useCallback)(async(t=a,r=u,o=s)=>{if(e){x(!0);try{let a=await eP.client.listOperations(e,{status:t||void 0,type:o||void 0,limit:c,offset:r});n(a.operations||[]),i(a.total||0)}catch(e){console.error("Error loading operations:",e)}finally{x(!1)}}},[e,a,u,s,c]),C=e=>{d(e),E(a,e,s)},_=async t=>{if(e){f(t);try{await eP.client.cancelOperation(e,t),await E()}catch(e){}finally{f(null)}}},S=async t=>{if(e){g(t);try{await eP.client.retryOperation(e,t),await E()}catch(e){}finally{g(null)}}},A=async t=>{if(e){k(!0),j(!0);try{let n=await eP.client.getOperationStatus(e,t);b(n)}catch(e){console.error("Error loading operation details:",e),b({error:"Failed to load operation details"})}finally{k(!1)}}};return((0,eg.useEffect)(()=>{if(e){E(a,u,s);let e=setInterval(()=>E(a,u,s),5e3);return()=>clearInterval(e)}},[e,a,u,s]),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:"Background Operations"}),(0,ep.jsx)("button",{onClick:()=>E(),className:"p-1 rounded hover:bg-muted transition-colors",title:"Refresh operations",disabled:v,children:(0,ep.jsx)(eV,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${v?"animate-spin":""}`})})]}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:[r," operation",1!==r?"s":"",a?` (${a})`:""]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsxs)(pl.Select,{value:s??"all",onValueChange:e=>{var t;l(t="all"===e?null:e),d(0),E(a,0,t)},children:[(0,ep.jsx)(pl.SelectTrigger,{className:"h-9 w-[180px] text-sm",children:(0,ep.jsx)(pl.SelectValue,{placeholder:"All types"})}),(0,ep.jsx)(pl.SelectContent,{children:b0.map(e=>(0,ep.jsx)(pl.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:"completed",label:"Completed"},{value:"failed",label:"Failed"}].map(e=>(0,ep.jsx)("button",{onClick:()=>{var t;o(t=e.value),d(0),E(t,0,s)},className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${a===e.value?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e.label},e.value??"all"))})]})]}),(0,ep.jsx)("div",{children:t.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(e$,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eQ,{children:"Type"}),(0,ep.jsx)(eQ,{children:"Created"}),(0,ep.jsx)(eQ,{children:"Status"}),(0,ep.jsx)(eQ,{className:"w-[80px]"})]})}),(0,ep.jsx)(eK,{children:t.map(e=>(0,ep.jsxs)(eZ,{className:`cursor-pointer hover:bg-muted/50 ${"failed"===e.status?"bg-red-500/5":""}`,onClick:()=>A(e.id),children:[(0,ep.jsx)(eJ,{className:"font-mono text-xs text-muted-foreground",children:e.id.substring(0,8)}),(0,ep.jsx)(eJ,{className:"font-medium",children:e.task_type}),(0,ep.jsx)(eJ,{className:"text-sm text-muted-foreground",children:new Date(e.created_at).toLocaleString()}),(0,ep.jsxs)(eJ,{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)(eH,{className:"w-3 h-3"}),"pending"]}),"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)(bN,{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)(eU,{className:"w-3 h-3"}),"completed"]})]}),(0,ep.jsxs)(eJ,{children:["pending"===e.status&&(0,ep.jsxs)(eD.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(),_(e.id)},disabled:h===e.id,children:[h===e.id?(0,ep.jsx)(tz.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(eX.X,{className:"w-3 h-3 mr-1"}),h===e.id?"":"Cancel"]}),"failed"===e.status&&(0,ep.jsxs)(eD.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(),S(e.id)},disabled:p===e.id,children:[p===e.id?(0,ep.jsx)(tz.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(bJ,{className:"w-3 h-3 mr-1"}),p===e.id?"":"Retry"]})]})]},e.id))})]})}),r>c&&(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 ",u+1,"-",Math.min(u+c,r)," of"," ",r]}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>C(Math.max(0,u-c)),disabled:0===u,children:"Previous"}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>C(u+c),disabled:u+c>=r,children:"Next"})]})]})]}):(0,ep.jsxs)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:["No ",a?`${a} `:"","operations"]})}),(0,ep.jsx)(tV.Dialog,{open:w,onOpenChange:j,children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Operation Details"}),(0,ep.jsx)(tV.DialogDescription,{children:y?.operation_id&&(0,ep.jsx)("span",{className:"font-mono text-xs",children:y.operation_id})})]}),N?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)(tz.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):y?(0,ep.jsx)("div",{className:"space-y-4",children:y.error?(0,ep.jsx)("div",{className:"text-red-600 dark:text-red-400",children:y.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"===y.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)(eH,{className:"w-3 h-3"}),"pending"]}),"failed"===y.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)(bN,{className:"w-3 h-3"}),"failed"]}),"completed"===y.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)(eU,{className:"w-3 h-3"}),"completed"]})]})]}),(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:y.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:y.created_at?new Date(y.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:y.updated_at?new Date(y.updated_at).toLocaleString():"N/A"})]}),y.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(y.completed_at).toLocaleString()})]}),y.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:y.result_metadata.items_count})]})]}),y.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:y.error_message})]}),y.child_operations&&y.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 (",y.result_metadata?.num_sub_batches||y.child_operations.length,")"]}),(0,ep.jsx)("div",{className:"rounded-lg border",children:(0,ep.jsxs)(e$,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-[60px]",children:"Index"}),(0,ep.jsx)(eQ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eQ,{className:"w-[80px]",children:"Items"}),(0,ep.jsx)(eQ,{children:"Status"})]})}),(0,ep.jsx)(eK,{children:y.child_operations.map(e=>(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eJ,{className:"text-sm",children:e.sub_batch_index}),(0,ep.jsx)(eJ,{className:"font-mono text-xs text-muted-foreground",children:e.operation_id.substring(0,8)}),(0,ep.jsx)(eJ,{className:"text-sm",children:e.items_count}),(0,ep.jsxs)(eJ,{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)(eH,{className:"w-3 h-3"}),"pending"]}),"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)(bN,{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)(eU,{className:"w-3 h-3"}),"completed"]})]})]},e.operation_id))})]})})]})]})}):null]})})]}):null}var tz=tz;let b2=(0,ej.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"}]]),b5=(0,ej.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 b3=e.i(26330),b4=e.i(3536),b6=e.i(65491),b8=e.i(10772),b7=e.i(53660),b9=e.i(74606),we=e.i(96626),wt=e.i(42727),wn=Symbol("radix.slottable");function wr(e){return eg.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===wn}var wi=e.i(30207),wa=e.i(86312),wo=e.i(85369),ws=["Enter"," "],wl=["ArrowUp","PageDown","End"],wc=["ArrowDown","PageUp","Home",...wl],wu={ltr:[...ws,"ArrowRight"],rtl:[...ws,"ArrowLeft"]},wd={ltr:["ArrowLeft"],rtl:["ArrowRight"]},wh="Menu",[wf,wp,wg]=(0,to.createCollection)(wh),[wm,wv]=(0,te.createContextScope)(wh,[wg,b7.createPopperScope,wt.createRovingFocusGroupScope]),wx=(0,b7.createPopperScope)(),wy=(0,wt.createRovingFocusGroupScope)(),[wb,ww]=wm(wh),[wj,wN]=wm(wh),wk=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=wx(t),[l,c]=eg.useState(null),u=eg.useRef(!1),d=(0,wi.useCallbackRef)(a),h=(0,tn.useDirection)(i);return eg.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,ep.jsx)(b7.Root,{...s,children:(0,ep.jsx)(wb,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,ep.jsx)(wj,{scope:t,onClose:eg.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:o,children:r})})})};wk.displayName=wh;var wE=eg.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=wx(n);return(0,ep.jsx)(b7.Anchor,{...i,...r,ref:t})});wE.displayName="MenuAnchor";var wC="MenuPortal",[w_,wS]=wm(wC,{forceMount:void 0}),wA=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=ww(wC,t);return(0,ep.jsx)(w_,{scope:t,forceMount:n,children:(0,ep.jsx)(we.Presence,{present:n||a.open,children:(0,ep.jsx)(b9.Portal,{asChild:!0,container:i,children:r})})})};wA.displayName=wC;var wT="MenuContent",[wO,wM]=wm(wT),wP=eg.forwardRef((e,t)=>{let n=wS(wT,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ww(wT,e.__scopeMenu),o=wN(wT,e.__scopeMenu);return(0,ep.jsx)(wf.Provider,{scope:e.__scopeMenu,children:(0,ep.jsx)(we.Presence,{present:r||a.open,children:(0,ep.jsx)(wf.Slot,{scope:e.__scopeMenu,children:o.modal?(0,ep.jsx)(wD,{...i,ref:t}):(0,ep.jsx)(wL,{...i,ref:t})})})})}),wD=eg.forwardRef((e,t)=>{let n=ww(wT,e.__scopeMenu),r=eg.useRef(null),i=(0,e9.useComposedRefs)(t,r);return eg.useEffect(()=>{let e=r.current;if(e)return(0,wa.hideOthers)(e)},[]),(0,ep.jsx)(wR,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:(0,e7.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),wL=eg.forwardRef((e,t)=>{let n=ww(wT,e.__scopeMenu);return(0,ep.jsx)(wR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),wI=((o=eg.forwardRef((e,t)=>{let{children:n,...r}=e;if(eg.isValidElement(n)){var i;let e,a,o=(i=n,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...a}:"className"===r&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==eg.Fragment&&(s.ref=t?(0,e9.composeRefs)(t,o):o),eg.cloneElement(n,s)}return eg.Children.count(n)>1?eg.Children.only(null):null})).displayName="MenuContent.ScrollLock.SlotClone",r=o,(i=eg.forwardRef((e,t)=>{let{children:n,...i}=e,a=eg.Children.toArray(n),o=a.find(wr);if(o){let e=o.props.children,n=a.map(t=>t!==o?t:eg.Children.count(e)>1?eg.Children.only(null):eg.isValidElement(e)?e.props.children:null);return(0,ep.jsx)(r,{...i,ref:t,children:eg.isValidElement(e)?eg.cloneElement(e,void 0,n):null})}return(0,ep.jsx)(r,{...i,ref:t,children:n})})).displayName="MenuContent.ScrollLock.Slot",i),wR=eg.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,disableOutsideScroll:p,...g}=e,v=ww(wT,n),x=wN(wT,n),y=wx(n),b=wy(n),w=wp(n),[j,N]=eg.useState(null),k=eg.useRef(null),E=(0,e9.useComposedRefs)(t,k,v.onContentChange),C=eg.useRef(0),_=eg.useRef(""),S=eg.useRef(0),A=eg.useRef(null),T=eg.useRef("right"),O=eg.useRef(0),M=p?wo.RemoveScroll:eg.Fragment;eg.useEffect(()=>()=>window.clearTimeout(C.current),[]),(0,b4.useFocusGuards)();let P=eg.useCallback(e=>{var t,n;return T.current===A.current?.side&&(t=e,!!(n=A.current?.area)&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],l=o.x,c=o.y,u=s.x,d=s.y;c>r!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},n))},[]);return(0,ep.jsx)(wO,{scope:n,searchRef:_,onItemEnter:eg.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:eg.useCallback(e=>{P(e)||(k.current?.focus(),N(null))},[P]),onTriggerLeave:eg.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:S,onPointerGraceIntentChange:eg.useCallback(e=>{A.current=e},[]),children:(0,ep.jsx)(M,{...p?{as:wI,allowPinchZoom:!0}:void 0,children:(0,ep.jsx)(b6.FocusScope,{asChild:!0,trapped:i,onMountAutoFocus:(0,e7.composeEventHandlers)(a,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,ep.jsx)(b3.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,children:(0,ep.jsx)(wt.Root,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:j,onCurrentTabStopIdChange:N,onEntryFocus:(0,e7.composeEventHandlers)(l,e=>{x.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,ep.jsx)(b7.Content,{role:"menu","aria-orientation":"vertical","data-state":w9(v.open),"data-radix-menu-content":"",dir:x.dir,...y,...g,ref:E,style:{outline:"none",...g.style},onKeyDown:(0,e7.composeEventHandlers)(g.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;if(t){var i;let t,a,o,s,l,c;"Tab"===e.key&&e.preventDefault(),!n&&r&&(i=e.key,t=_.current+i,a=w().filter(e=>!e.disabled),o=document.activeElement,s=a.find(e=>e.ref.current===o)?.textValue,l=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=n?e.indexOf(n):-1,o=(r=Math.max(a,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(o=o.filter(e=>e!==n));let s=o.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return s!==n?s:void 0}(a.map(e=>e.textValue),t,s),c=a.find(e=>e.textValue===l)?.ref.current,function e(t){_.current=t,window.clearTimeout(C.current),""!==t&&(C.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let a=k.current;if(e.target!==a||!wc.includes(e.key))return;e.preventDefault();let o=w().filter(e=>!e.disabled).map(e=>e.ref.current);wl.includes(e.key)&&o.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(o)}),onBlur:(0,e7.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(C.current),_.current="")}),onPointerMove:(0,e7.composeEventHandlers)(e.onPointerMove,jn(e=>{let t=e.target,n=O.current!==e.clientX;e.currentTarget.contains(t)&&n&&(T.current=e.clientX>O.current?"right":"left",O.current=e.clientX)}))})})})})})})});wP.displayName=wT;var wB=eg.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(ta.Primitive.div,{role:"group",...r,ref:t})});wB.displayName="MenuGroup";var wz=eg.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(ta.Primitive.div,{...r,ref:t})});wz.displayName="MenuLabel";var wF="MenuItem",wV="menu.itemSelect",wU=eg.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=eg.useRef(null),o=wN(wF,e.__scopeMenu),s=wM(wF,e.__scopeMenu),l=(0,e9.useComposedRefs)(t,a),c=eg.useRef(!1);return(0,ep.jsx)(wH,{...i,ref:l,disabled:n,onClick:(0,e7.composeEventHandlers)(e.onClick,()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(wV,{bubbles:!0,cancelable:!0});e.addEventListener(wV,e=>r?.(e),{once:!0}),(0,ta.dispatchDiscreteCustomEvent)(e,t),t.defaultPrevented?c.current=!1:o.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:(0,e7.composeEventHandlers)(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==s.searchRef.current;n||t&&" "===e.key||ws.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});wU.displayName=wF;var wH=eg.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=wM(wF,n),s=wy(n),l=eg.useRef(null),c=(0,e9.useComposedRefs)(t,l),[u,d]=eg.useState(!1),[h,f]=eg.useState("");return eg.useEffect(()=>{let e=l.current;e&&f((e.textContent??"").trim())},[a.children]),(0,ep.jsx)(wf.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:(0,ep.jsx)(wt.Item,{asChild:!0,...s,focusable:!r,children:(0,ep.jsx)(ta.Primitive.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:c,onPointerMove:(0,e7.composeEventHandlers)(e.onPointerMove,jn(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,e7.composeEventHandlers)(e.onPointerLeave,jn(e=>o.onItemLeave(e))),onFocus:(0,e7.composeEventHandlers)(e.onFocus,()=>d(!0)),onBlur:(0,e7.composeEventHandlers)(e.onBlur,()=>d(!1))})})})}),wW=eg.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,ep.jsx)(wQ,{scope:e.__scopeMenu,checked:n,children:(0,ep.jsx)(wU,{role:"menuitemcheckbox","aria-checked":je(n)?"mixed":n,...i,ref:t,"data-state":jt(n),onSelect:(0,e7.composeEventHandlers)(i.onSelect,()=>r?.(!!je(n)||!n),{checkForDefaultPrevented:!1})})})});wW.displayName="MenuCheckboxItem";var wY="MenuRadioGroup",[wG,wX]=wm(wY,{value:void 0,onValueChange:()=>{}}),w$=eg.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=(0,wi.useCallbackRef)(r);return(0,ep.jsx)(wG,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,ep.jsx)(wB,{...i,ref:t})})});w$.displayName=wY;var wq="MenuRadioItem",wK=eg.forwardRef((e,t)=>{let{value:n,...r}=e,i=wX(wq,e.__scopeMenu),a=n===i.value;return(0,ep.jsx)(wQ,{scope:e.__scopeMenu,checked:a,children:(0,ep.jsx)(wU,{role:"menuitemradio","aria-checked":a,...r,ref:t,"data-state":jt(a),onSelect:(0,e7.composeEventHandlers)(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});wK.displayName=wq;var wZ="MenuItemIndicator",[wQ,wJ]=wm(wZ,{checked:!1}),w0=eg.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=wJ(wZ,n);return(0,ep.jsx)(we.Presence,{present:r||je(a.checked)||!0===a.checked,children:(0,ep.jsx)(ta.Primitive.span,{...i,ref:t,"data-state":jt(a.checked)})})});w0.displayName=wZ;var w1=eg.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(ta.Primitive.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});w1.displayName="MenuSeparator";var w2=eg.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=wx(n);return(0,ep.jsx)(b7.Arrow,{...i,...r,ref:t})});w2.displayName="MenuArrow";var[w5,w3]=wm("MenuSub"),w4="MenuSubTrigger",w6=eg.forwardRef((e,t)=>{let n=ww(w4,e.__scopeMenu),r=wN(w4,e.__scopeMenu),i=w3(w4,e.__scopeMenu),a=wM(w4,e.__scopeMenu),o=eg.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=a,c={__scopeMenu:e.__scopeMenu},u=eg.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return eg.useEffect(()=>u,[u]),eg.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),l(null)}},[s,l]),(0,ep.jsx)(wE,{asChild:!0,...c,children:(0,ep.jsx)(wH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":w9(n.open),...e,ref:(0,e9.composeRefs)(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:(0,e7.composeEventHandlers)(e.onPointerMove,jn(t=>{a.onItemEnter(t),!t.defaultPrevented&&(e.disabled||n.open||o.current||(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100)))})),onPointerLeave:(0,e7.composeEventHandlers)(e.onPointerLeave,jn(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i="right"===r,o=t[i?"left":"right"],l=t[i?"right":"left"];a.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:o,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:o,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,t=>{let i=""!==a.searchRef.current;e.disabled||i&&" "===t.key||wu[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});w6.displayName=w4;var w8="MenuSubContent",w7=eg.forwardRef((e,t)=>{let n=wS(wT,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ww(wT,e.__scopeMenu),o=wN(wT,e.__scopeMenu),s=w3(w8,e.__scopeMenu),l=eg.useRef(null),c=(0,e9.useComposedRefs)(t,l);return(0,ep.jsx)(wf.Provider,{scope:e.__scopeMenu,children:(0,ep.jsx)(we.Presence,{present:r||a.open,children:(0,ep.jsx)(wf.Slot,{scope:e.__scopeMenu,children:(0,ep.jsx)(wR,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:c,align:"start",side:"rtl"===o.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,e7.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:(0,e7.composeEventHandlers)(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=wd[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});function w9(e){return e?"open":"closed"}function je(e){return"indeterminate"===e}function jt(e){return je(e)?"indeterminate":e?"checked":"unchecked"}function jn(e){return t=>"mouse"===t.pointerType?e(t):void 0}w7.displayName=w8;var jr="DropdownMenu",[ji,ja]=(0,te.createContextScope)(jr,[wv]),jo=wv(),[js,jl]=ji(jr),jc=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,l=jo(t),c=eg.useRef(null),[u,d]=(0,tt.useControllableState)({prop:i,defaultProp:a??!1,onChange:o,caller:jr});return(0,ep.jsx)(js,{scope:t,triggerId:(0,b8.useId)(),triggerRef:c,contentId:(0,b8.useId)(),open:u,onOpenChange:d,onOpenToggle:eg.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,ep.jsx)(wk,{...l,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};jc.displayName=jr;var ju="DropdownMenuTrigger",jd=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=jl(ju,n),o=jo(n);return(0,ep.jsx)(wE,{asChild:!0,...o,children:(0,ep.jsx)(ta.Primitive.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:(0,e9.composeRefs)(t,a.triggerRef),onPointerDown:(0,e7.composeEventHandlers)(e.onPointerDown,e=>{!r&&0===e.button&&!1===e.ctrlKey&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,e=>{!r&&(["Enter"," "].includes(e.key)&&a.onOpenToggle(),"ArrowDown"===e.key&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});jd.displayName=ju;var jh=e=>{let{__scopeDropdownMenu:t,...n}=e,r=jo(t);return(0,ep.jsx)(wA,{...r,...n})};jh.displayName="DropdownMenuPortal";var jf="DropdownMenuContent",jp=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jl(jf,n),a=jo(n),o=eg.useRef(!1);return(0,ep.jsx)(wP,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:(0,e7.composeEventHandlers)(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:(0,e7.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});jp.displayName=jf,eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(wB,{...i,...r,ref:t})}).displayName="DropdownMenuGroup";var jg=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(wz,{...i,...r,ref:t})});jg.displayName="DropdownMenuLabel";var jm=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(wU,{...i,...r,ref:t})});jm.displayName="DropdownMenuItem";var jv=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(wW,{...i,...r,ref:t})});jv.displayName="DropdownMenuCheckboxItem",eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(w$,{...i,...r,ref:t})}).displayName="DropdownMenuRadioGroup";var jx=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(wK,{...i,...r,ref:t})});jx.displayName="DropdownMenuRadioItem";var jy=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(w0,{...i,...r,ref:t})});jy.displayName="DropdownMenuItemIndicator";var jb=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(w1,{...i,...r,ref:t})});jb.displayName="DropdownMenuSeparator",eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(w2,{...i,...r,ref:t})}).displayName="DropdownMenuArrow";var jw=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(w6,{...i,...r,ref:t})});jw.displayName="DropdownMenuSubTrigger";var jj=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(w7,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});jj.displayName="DropdownMenuSubContent";let jN=(0,ej.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);eg.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,ep.jsxs)(jw,{ref:i,className:(0,eT.cn)("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,(0,ep.jsx)(eS.ChevronRight,{className:"ml-auto"})]})).displayName=jw.displayName,eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(jj,{ref:n,className:(0,eT.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t})).displayName=jj.displayName;let jk=eg.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,ep.jsx)(jh,{children:(0,ep.jsx)(jp,{ref:r,sideOffset:t,className:(0,eT.cn)("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));jk.displayName=jp.displayName;let jE=eg.forwardRef(({className:e,inset:t,...n},r)=>(0,ep.jsx)(jm,{ref:r,className:(0,eT.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n}));jE.displayName=jm.displayName,eg.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,ep.jsxs)(jv,{ref:i,className:(0,eT.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[(0,ep.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ep.jsx)(jy,{children:(0,ep.jsx)(tB.Check,{className:"h-4 w-4"})})}),t]})).displayName=jv.displayName,eg.forwardRef(({className:e,children:t,...n},r)=>(0,ep.jsxs)(jx,{ref:r,className:(0,eT.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[(0,ep.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ep.jsx)(jy,{children:(0,ep.jsx)(jN,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=jx.displayName,eg.forwardRef(({className:e,inset:t,...n},r)=>(0,ep.jsx)(jg,{ref:r,className:(0,eT.cn)("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n})).displayName=jg.displayName;let jC=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(jb,{ref:n,className:(0,eT.cn)("-mx-1 my-1 h-px bg-muted",e),...t}));jC.displayName=jb.displayName;var tz=tz;function j_({directiveId:e,onClose:t}){let n,{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,eg.useState)(null),[o,s]=(0,eg.useState)(!1),[l,c]=(0,eg.useState)(null);(0,eg.useEffect)(()=>{e&&r&&(async()=>{s(!0),c(null),a(null);try{let t=await eP.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)(tV.Dialog,{open:u,onOpenChange:e=>!e&&t(),children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col p-6",children:[(0,ep.jsx)(go.VisuallyHidden,{children:(0,ep.jsx)(tV.DialogTitle,{children:"Directive Details"})}),o?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)(tz.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)(xL,{remarkPlugins:[bn],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 jS(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,eg.useState)([]),[r,i]=(0,eg.useState)(!1),[a,o]=(0,eg.useState)("dashboard"),[s,l]=(0,eg.useState)(""),[c,u]=(0,eg.useState)(1),[d,h]=(0,eg.useState)(!1),[f,p]=(0,eg.useState)(null),[g,v]=(0,eg.useState)(!1),[x,y]=(0,eg.useState)(null),[b,w]=(0,eg.useState)(null),[j,N]=(0,eg.useState)(!1),k=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)}),E=async()=>{if(e){i(!0);try{let t=await eP.client.listMentalModels(e);n(t.items||[])}catch(e){console.error("Error loading mental models:",e)}finally{i(!1)}}},C=async()=>{if(e&&b){N(!0);try{await eP.client.deleteMentalModel(e,b.id),n(e=>e.filter(e=>e.id!==b.id)),f?.id===b.id&&p(null),w(null)}catch(e){}finally{N(!1)}}};if((0,eg.useEffect)(()=>{e&&E()},[e]),(0,eg.useEffect)(()=>{let e=e=>{"Escape"===e.key&&p(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,eg.useEffect)(()=>{u(1)},[s]),!e)return(0,ep.jsx)(pg,{children:(0,ep.jsx)(py,{className:"p-10 text-center",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to view mental models."})})});let _=Math.ceil(k.length/100),S=(c-1)*100,A=S+100,T=k.slice(S,A);return(0,ep.jsxs)("div",{children:[r?(0,ep.jsxs)("div",{className:"text-center py-12",children:[(0,ep.jsx)(eV,{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.jsx)("div",{className:"mb-4",children:(0,ep.jsx)(eL.Input,{type:"text",value:s,onChange:e=>l(e.target.value),placeholder:"Filter mental models by name, query, or content...",className:"max-w-md"})}),(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?`${k.length} of ${t.length} mental models`:`${t.length} mental model${1!==t.length?"s":""}`}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsxs)(eD.Button,{onClick:()=>h(!0),size:"sm",children:[(0,ep.jsx)(fP.Plus,{className:"w-4 h-4 mr-2"}),"Add Mental Model"]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(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)(b2,{className:"w-4 h-4"}),"Dashboard"]}),(0,ep.jsxs)("button",{onClick:()=>o("table"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"table"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(eY,{className:"w-4 h-4"}),"Table"]})]})]})]}),k.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:T.map(e=>{let t=new Date(e.last_refreshed_at),n=t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1});return(0,ep.jsx)(pg,{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)(py,{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)(eD.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 ml-2 text-muted-foreground hover:text-destructive flex-shrink-0",onClick:t=>{t.stopPropagation(),w({id:e.id,name:e.name})},children:(0,ep.jsx)(pn,{className:"h-4 w-4"})})]}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:e.source_query}),(0,ep.jsx)("div",{className:"text-sm text-foreground mb-3 border-t border-border pt-3",children:e.content.includes("|")||e.content.includes("```")||e.content.includes("\n\n")?(0,ep.jsxs)("div",{className:"line-clamp-3 text-muted-foreground italic",children:[e.content.substring(0,150),"..."," ",(0,ep.jsx)("span",{className:"text-primary",children:"Click to view full content"})]}):(0,ep.jsx)("div",{className:"line-clamp-6 prose prose-sm dark:prose-invert max-w-none",children:(0,ep.jsx)(xL,{remarkPlugins:[bn],children:e.content})})}),(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.jsxs)("div",{className:"text-muted-foreground",children:[n," ",r]})]})]})},e.id)})}),"table"===a&&(0,ep.jsx)("div",{className:"border rounded-lg overflow-hidden",children:(0,ep.jsxs)(e$,{className:"table-fixed",children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{className:"bg-muted/50",children:[(0,ep.jsx)(eQ,{className:"w-[20%]",children:"ID"}),(0,ep.jsx)(eQ,{className:"w-[20%]",children:"Name"}),(0,ep.jsx)(eQ,{className:"w-[35%]",children:"Source Query"}),(0,ep.jsx)(eQ,{className:"w-[15%]",children:"Last Refreshed"}),(0,ep.jsx)(eQ,{className:"w-[10%]"})]})}),(0,ep.jsx)(eK,{children:T.map(e=>{let t=new Date(e.last_refreshed_at),n=t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1});return(0,ep.jsxs)(eZ,{className:`cursor-pointer hover:bg-muted/50 ${f?.id===e.id?"bg-primary/10":""}`,onClick:()=>p(e),children:[(0,ep.jsx)(eJ,{className:"py-2",children:(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground truncate block",children:e.id})}),(0,ep.jsx)(eJ,{className:"py-2",children:(0,ep.jsx)("div",{className:"font-medium text-foreground",children:e.name})}),(0,ep.jsx)(eJ,{className:"py-2",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground truncate",children:e.source_query})}),(0,ep.jsxs)(eJ,{className:"py-2 text-sm text-foreground",children:[(0,ep.jsx)("div",{children:n}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground",children:r})]}),(0,ep.jsx)(eJ,{className:"py-2",children:(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",onClick:t=>{t.stopPropagation(),w({id:e.id,name:e.name})},children:(0,ep.jsx)(pn,{className:"h-4 w-4"})})})]},e.id)})})]})}),_>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:[S+1,"-",Math.min(A,k.length)," of"," ",k.length]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>u(1),disabled:1===c,className:"h-7 w-7 p-0",children:(0,ep.jsx)(ez,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.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)(e_,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",_]}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>u(e=>Math.min(_,e+1)),disabled:c===_,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>u(_),disabled:c===_,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{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)(eN,{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)(jA,{open:d,onClose:()=>h(!1),onCreated:()=>{h(!1),E()}}),(0,ep.jsx)(fU,{open:!!b,onOpenChange:e=>!e&&w(null),children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Delete Mental Model"}),(0,ep.jsxs)(f9,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',b?.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)(f8,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(pt,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(pe,{onClick:C,disabled:j,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[j?(0,ep.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),f&&(0,ep.jsx)(jO,{mentalModel:f,onClose:()=>p(null),onDelete:()=>w({id:f.id,name:f.name}),onEdit:()=>{y(f),v(!0)},onRefreshed:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e)}}),x&&(0,ep.jsx)(jT,{open:g,mentalModel:x,onClose:()=>{v(!1),y(null)},onUpdated:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e),v(!1),y(null)}})]})}function jA({open:e,onClose:t,onCreated:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,eg.useState)(!1),[o,s]=(0,eg.useState)({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:""}),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}await eP.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:{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}}),s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:""}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tV.Dialog,{open:e,onOpenChange:e=>{e||(s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:""}),t())},children:(0,ep.jsxs)(tV.DialogContent,{className:"sm:max-w-lg",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Create Mental Model"}),(0,ep.jsx)(tV.DialogDescription,{children:"Create a mental model by running a query. The content will be auto-generated and can be refreshed later."})]}),(0,ep.jsxs)(tH.Tabs,{defaultValue:"general",className:"py-2",children:[(0,ep.jsxs)(tH.TabsList,{className:"w-full",children:[(0,ep.jsx)(tH.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(tH.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)(tH.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)(eL.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)(eL.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)(eL.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)(eL.Input,{type:"number",value:o.maxTokens,onChange:e=>s({...o,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(tH.TabsContent,{value:"options",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:"Tags"}),(0,ep.jsx)(eL.Input,{value:o.tags,onChange:e=>s({...o,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"})]}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(pc.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-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(pp,{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:"flex items-center space-x-2",children:[(0,ep.jsx)(pc.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)(eL.Input,{value:o.excludeMentalModelIds,onChange:e=>s({...o,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]}),(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)(pl.Select,{value:o.tagsMatch,onValueChange:e=>s({...o,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(pl.SelectTrigger,{children:(0,ep.jsx)(pl.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(pl.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(pl.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(pl.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(pl.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)(pE.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)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:t,disabled:i,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:l,disabled:i||!o.name.trim()||!o.sourceQuery.trim(),children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}),"Generating..."]}):"Create"})]})]})})}function jT({open:e,mentalModel:t,onClose:n,onUpdated:r}){let{currentBank:i}=(0,ey.useBank)(),[a,o]=(0,eg.useState)(!1),[s,l]=(0,eg.useState)({name:t.name,sourceQuery:t.source_query,maxTokens:String(t.max_tokens||2048),tags:t.tags.join(", "),autoRefresh:t.trigger?.refresh_after_consolidation||!1,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):""});(0,eg.useEffect)(()=>{e&&l({name:t.name,sourceQuery:t.source_query,maxTokens:String(t.max_tokens||2048),tags:t.tags.join(", "),autoRefresh:t.trigger?.refresh_after_consolidation||!1,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):""})},[e,t]);let c=async()=>{if(i&&s.name.trim()&&s.sourceQuery.trim()){o(!0);try{let e,a=s.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),o=parseInt(s.maxTokens)||2048,l=s.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(s.tagGroups.trim())try{e=JSON.parse(s.tagGroups.trim())}catch{ev.toast.error("Invalid JSON in Tag Groups field");return}let c=await eP.client.updateMentalModel(i,t.id,{name:s.name.trim(),source_query:s.sourceQuery.trim(),tags:a.length>0?a:void 0,max_tokens:o,trigger:{refresh_after_consolidation:s.autoRefresh,fact_types:s.factTypes.length>0?s.factTypes:void 0,exclude_mental_models:s.excludeMentalModels||void 0,exclude_mental_model_ids:l.length>0?l:void 0,tags_match:s.tagsMatch||void 0,tag_groups:e}});r(c),n()}catch(e){}finally{o(!1)}}};return(0,ep.jsx)(tV.Dialog,{open:e,onOpenChange:e=>!e&&n(),children:(0,ep.jsxs)(tV.DialogContent,{className:"sm:max-w-lg",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Update Mental Model"}),(0,ep.jsx)(tV.DialogDescription,{children:"Update the mental model configuration. Changes will take effect immediately."})]}),(0,ep.jsxs)(tH.Tabs,{defaultValue:"general",className:"py-2",children:[(0,ep.jsxs)(tH.TabsList,{className:"w-full",children:[(0,ep.jsx)(tH.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(tH.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)(tH.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)(eL.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)(eL.Input,{value:s.name,onChange:e=>l({...s,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)(eL.Input,{value:s.sourceQuery,onChange:e=>l({...s,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)(eL.Input,{type:"number",value:s.maxTokens,onChange:e=>l({...s,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(tH.TabsContent,{value:"options",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:"Tags"}),(0,ep.jsx)(eL.Input,{value:s.tags,onChange:e=>l({...s,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"})]}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(pc.Checkbox,{id:"update-auto-refresh",checked:s.autoRefresh,onCheckedChange:e=>l({...s,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-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(pp,{value:s.factTypes,onChange:e=>l({...s,factTypes:e})}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to include all types."})]}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(pc.Checkbox,{id:"update-exclude-mental-models",checked:s.excludeMentalModels,onCheckedChange:e=>l({...s,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)(eL.Input,{value:s.excludeMentalModelIds,onChange:e=>l({...s,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]}),(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)(pl.Select,{value:s.tagsMatch||"default",onValueChange:e=>l({...s,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(pl.SelectTrigger,{children:(0,ep.jsx)(pl.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(pl.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(pl.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(pl.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(pl.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)(pE.Textarea,{value:s.tagGroups,onChange:e=>l({...s,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)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:n,disabled:a,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:c,disabled:a||!s.name.trim()||!s.sourceQuery.trim(),children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}),"Updating..."]}):"Update"})]})]})})}function jO({mentalModel:e,onClose:t,onDelete:n,onEdit:r,onRefreshed:i}){let{currentBank:a}=(0,ey.useBank)(),[o,s]=(0,eg.useState)(!1),[l,c]=(0,eg.useState)(null),[u,d]=(0,eg.useState)(null),[h,f]=(0,eg.useState)(!1),p=async()=>{if(!a)return;s(!0);let t=e.last_refreshed_at;try{await eP.client.refreshMentalModel(a,e.id);let n=0,r=async()=>{n++;try{let o=await eP.client.getMentalModel(a,e.id);if(o.last_refreshed_at!==t){i(o),s(!1);return}if(n>=120){s(!1),ev.toast.error("Refresh timeout",{description:"Refresh is taking longer than expected. Check the operations list for status."});return}setTimeout(r,1e3)}catch(e){console.error("Error polling mental model:",e),s(!1)}};setTimeout(r,1e3)}catch(e){s(!1)}},g=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})}`},v=e.reflect_response?.based_on?Object.entries(e.reflect_response.based_on).filter(([e])=>"observation"!==e).flatMap(([e,t])=>t.map(t=>({...t,factType:e}))):[],x=e.reflect_response?.based_on?.observation||[];return(0,ep.jsxs)("div",{className:"fixed right-0 top-0 h-screen w-1/2 bg-card border-l 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-1 mr-4",children:[(0,ep.jsx)("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)("p",{className:"text-sm text-muted-foreground mt-1",children:e.source_query})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsxs)(jc,{children:[(0,ep.jsx)(jd,{asChild:!0,children:(0,ep.jsxs)(eD.Button,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",disabled:o,children:[o?(0,ep.jsx)(tz.default,{className:"h-4 w-4 animate-spin"}):(0,ep.jsx)(b5,{className:"h-4 w-4"}),(0,ep.jsx)("span",{className:"text-xs",children:"Actions"})]})}),(0,ep.jsxs)(jk,{align:"end",children:[(0,ep.jsxs)(jE,{onClick:r,children:[(0,ep.jsx)(pr,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,ep.jsxs)(jE,{onClick:p,children:[(0,ep.jsx)(eV,{className:"h-4 w-4 mr-2"}),"Refresh"]}),(0,ep.jsxs)(jE,{onClick:()=>f(!0),children:[(0,ep.jsx)(tF,{className:"h-4 w-4 mr-2"}),"View History"]}),(0,ep.jsx)(jC,{}),(0,ep.jsxs)(jE,{onClick:n,className:"text-destructive focus:text-destructive",children:[(0,ep.jsx)(pn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,ep.jsx)(eX.X,{className:"h-4 w-4"})})]})]}),(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"ID"}),(0,ep.jsx)("div",{className:"text-sm text-foreground font-mono",children:e.id})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Name"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:e.name})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Source Query"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:e.source_query})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Max Tokens"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:e.max_tokens})]}),e.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.tags.map(e=>(0,ep.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e},e))})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Auto-refresh"}),(0,ep.jsx)("span",{className:`inline-block text-xs px-2 py-1 rounded-full font-medium ${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"})]}),e.last_refreshed_at&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Last Refreshed"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:g(e.last_refreshed_at)})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Created"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:g(e.created_at)})]})]}),(0,ep.jsxs)("div",{className:"border-t border-border pt-5",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)(xL,{remarkPlugins:[bn],children:e.content})})]}),v.length>0&&(0,ep.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,ep.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:["Based On (",v.length," ",1===v.length?"fact":"facts",")"]}),(0,ep.jsx)("div",{className:"space-y-3",children:v.map((e,t)=>{let n="directives"===e.factType?{label:"directive",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}:"mental-models"===e.factType?{label:"mental model",color:"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}:"world"===e.factType?{label:"world",color:"bg-blue-500/10 text-blue-600 dark:text-blue-400"}:"experience"===e.factType?{label:"experience",color:"bg-green-500/10 text-green-600 dark:text-green-400"}:{label:e.factType,color:"bg-slate-500/10 text-slate-600 dark:text-slate-400"};return(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg border border-border/50",children:[(0,ep.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${n.color}`,children:n.label}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-6 text-xs",onClick:()=>{"directives"===e.factType?d(e.id):c(e.id)},children:"View"})]}),(0,ep.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:e.text})]},e.id||t)})})]}),x.length>0&&(0,ep.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,ep.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:["Observations Used (",x.length,")"]}),(0,ep.jsx)("div",{className:"space-y-3",children:x.map((e,t)=>(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg border border-border/50",children:[(0,ep.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400",children:"observation"}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-6 text-xs",onClick:()=>c(e.id),children:"View"})]}),(0,ep.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:e.text})]},e.id||t))})]}),!e.reflect_response&&(0,ep.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:"Based On"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:'No source data available. Click "Refresh" to regenerate with source tracking.'})]})]})]}),l&&a&&(0,ep.jsx)(tK,{memoryId:l,onClose:()=>c(null)}),u&&a&&(0,ep.jsx)(j_,{directiveId:u,onClose:()=>d(null)}),(0,ep.jsx)(bs,{mentalModelId:h?e.id:null,onClose:()=>f(!1),initialTab:"history"})]})}let jM=(0,ej.default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),jP=(0,ej.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 tz=tz;let jD=["consolidation.completed","retain.completed"],jL={url:"",secret:"",event_types:["consolidation.completed"],enabled:!0,http_config:{method:"POST",timeout_seconds:30,headers:[],params:[]}};function jI(e){return Object.fromEntries(e.filter(e=>e.key.trim()).map(e=>[e.key,e.value]))}function jR(e){return{method:e.method,timeout_seconds:e.timeout_seconds,headers:jI(e.headers),params:jI(e.params)}}function jB({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)(e6,{children:e}),(0,ep.jsxs)(eD.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs px-2",onClick:()=>n([...t,{key:"",value:""}]),children:[(0,ep.jsx)(fP.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)(eL.Input,{placeholder:"Key",value:e.key,onChange:e=>r(i,"key",e.target.value),className:"h-8 text-sm flex-1"}),(0,ep.jsx)(eL.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)(eX.X,{className:"w-4 h-4"})})]},i))})]})}function jz({delivery:e,formatDate:t}){var n;let[r,i]=(0,eg.useState)(!1),a=e.last_response_body||e.last_error;return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)(eZ,{className:a?"cursor-pointer hover:bg-muted/40":void 0,onClick:()=>a&&i(e=>!e),children:[(0,ep.jsx)(eJ,{className:"w-8 pl-3 pr-0",children:a?r?(0,ep.jsx)(bc.ChevronDown,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)(eS.ChevronRight,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)("span",{className:"w-4 h-4 inline-block"})}),(0,ep.jsx)(eJ,{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)(eU,{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)(eH,{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)(bN,{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)(eJ,{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)(eJ,{className:"text-center text-sm",children:e.attempts}),(0,ep.jsx)(eJ,{className:"font-mono text-xs text-muted-foreground",children:e.event_type}),(0,ep.jsx)(eJ,{className:"text-xs text-muted-foreground whitespace-nowrap",children:t(e.created_at)})]}),r&&a&&(0,ep.jsx)(eZ,{className:"bg-muted/20 hover:bg-muted/20",children:(0,ep.jsx)(eJ,{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 jF(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,eg.useState)([]),[r,i]=(0,eg.useState)(!1),[a,o]=(0,eg.useState)(!1),[s,l]=(0,eg.useState)(!1),[c,u]=(0,eg.useState)(null),[d,h]=(0,eg.useState)(null),[f,p]=(0,eg.useState)(!1),[g,v]=(0,eg.useState)(jL),[x,y]=(0,eg.useState)(!1),[b,w]=(0,eg.useState)(null),[j,N]=(0,eg.useState)(jL),[k,E]=(0,eg.useState)(!1),[C,_]=(0,eg.useState)(!1),[S,A]=(0,eg.useState)(!1),[T,O]=(0,eg.useState)(!1),[M,P]=(0,eg.useState)(null),[D,L]=(0,eg.useState)([]),[I,R]=(0,eg.useState)(!1),[B,z]=(0,eg.useState)(null),[F,V]=(0,eg.useState)(!1),U=async()=>{if(e){i(!0);try{let t=await eP.client.listWebhooks(e);n(t.items||[])}catch(e){console.error("Error loading webhooks:",e)}finally{i(!1)}}};(0,eg.useEffect)(()=>{e&&U()},[e]);let H=async()=>{if(e&&g.url){l(!0);try{await eP.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:jR(g.http_config)}),o(!1),v(jL),p(!1),await U()}catch(e){}finally{l(!1)}}},W=async t=>{if(e){u(t),h(null);try{await eP.client.deleteWebhook(e,t),await U()}catch(e){}finally{u(null)}}},Y=async()=>{if(e&&b&&j.url){A(!0);try{let t={url:j.url,event_types:j.event_types,enabled:j.enabled,http_config:jR(j.http_config)};C?t.secret=null:j.secret&&(t.secret=j.secret),await eP.client.updateWebhook(e,b.id,t),y(!1),await U()}catch{}finally{A(!1)}}},G=async t=>{if(e){P(t),O(!0),L([]),z(null),R(!0);try{let n=await eP.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)}}},X=async()=>{if(e&&M&&B){V(!0);try{let t=await eP.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)}}},$=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)(eV,{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)(eD.Button,{size:"sm",onClick:()=>o(!0),children:[(0,ep.jsx)(fP.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)(e$,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{children:"URL"}),(0,ep.jsx)(eQ,{children:"Method"}),(0,ep.jsx)(eQ,{children:"Event Types"}),(0,ep.jsx)(eQ,{children:"Status"}),(0,ep.jsx)(eQ,{children:"Created At"}),(0,ep.jsx)(eQ,{className:"w-[120px]"})]})}),(0,ep.jsx)(eK,{children:t.map(e=>(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eJ,{className:"font-mono text-sm max-w-[300px] truncate",children:(0,ep.jsx)("span",{title:e.url,children:e.url})}),(0,ep.jsx)(eJ,{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)(eJ,{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)(eJ,{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)(eU,{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)(eJ,{className:"text-sm text-muted-foreground",children:$(e.created_at)}),(0,ep.jsx)(eJ,{children:(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsxs)(eD.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>G(e),title:"View deliveries",children:[(0,ep.jsx)(jM,{className:"w-3 h-3 mr-1"}),"Deliveries"]}),(0,ep.jsx)(eD.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)(pr,{className:"w-3 h-3"})}),(0,ep.jsx)(eD.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)(tz.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(pn,{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)(tV.Dialog,{open:a,onOpenChange:e=>{e||(v(jL),p(!1)),o(e)},children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Add Webhook"}),(0,ep.jsx)(tV.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)(e6,{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)(e6,{htmlFor:"webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eL.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)(e6,{children:"Method"}),(0,ep.jsxs)(pl.Select,{value:g.http_config.method,onValueChange:e=>v(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(pl.SelectTrigger,{children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(pl.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e6,{htmlFor:"webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eL.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)(e6,{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)(eL.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)(jP,{className:"w-4 h-4"}):(0,ep.jsx)(jM,{className:"w-4 h-4"})})]})]}),(0,ep.jsx)(jB,{label:"Custom Headers",pairs:g.http_config.headers,onChange:e=>v(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(jB,{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)(e6,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:jD.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(pc.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)(e6,{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)(tL.Switch,{id:"webhook-enabled",checked:g.enabled,onCheckedChange:e=>v(t=>({...t,enabled:e}))}),(0,ep.jsx)(e6,{htmlFor:"webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:()=>o(!1),disabled:s,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:H,disabled:s||!g.url,children:s?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):"Create Webhook"})]})]})}),(0,ep.jsx)(tV.Dialog,{open:x,onOpenChange:e=>{e||(w(null),N(jL),E(!1),_(!1)),y(e)},children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Edit Webhook"}),(0,ep.jsx)(tV.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)(e6,{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)(e6,{htmlFor:"edit-webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eL.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)(e6,{children:"Method"}),(0,ep.jsxs)(pl.Select,{value:j.http_config.method,onValueChange:e=>N(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(pl.SelectTrigger,{children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(pl.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e6,{htmlFor:"edit-webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eL.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)(e6,{htmlFor:"edit-webhook-secret",children:"Secret"}),(0,ep.jsxs)("div",{className:"relative",children:[(0,ep.jsx)(eL.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)(jP,{className:"w-4 h-4"}):(0,ep.jsx)(jM,{className:"w-4 h-4"})})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ep.jsx)(pc.Checkbox,{id:"edit-clear-secret",checked:C,onCheckedChange:e=>{_(!!e),e&&N(e=>({...e,secret:""}))}}),(0,ep.jsx)(e6,{htmlFor:"edit-clear-secret",className:"text-xs text-muted-foreground cursor-pointer",children:"Clear existing secret"})]})]}),(0,ep.jsx)(jB,{label:"Custom Headers",pairs:j.http_config.headers,onChange:e=>N(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(jB,{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)(e6,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:jD.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(pc.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)(e6,{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)(tL.Switch,{id:"edit-webhook-enabled",checked:j.enabled,onCheckedChange:e=>N(t=>({...t,enabled:e}))}),(0,ep.jsx)(e6,{htmlFor:"edit-webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:()=>y(!1),disabled:S,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:Y,disabled:S||!j.url,children:S?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})}),(0,ep.jsx)(tV.Dialog,{open:!!d,onOpenChange:e=>{e||h(null)},children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-md",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Delete Webhook"}),(0,ep.jsx)(tV.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)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),(0,ep.jsx)(eD.Button,{variant:"destructive",onClick:()=>d&&W(d.id),disabled:!!c,children:c?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete Webhook"})]})]})}),(0,ep.jsx)(tV.Dialog,{open:T,onOpenChange:e=>{e||(L([]),z(null)),O(e)},children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Webhook Deliveries"}),M&&(0,ep.jsx)(tV.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)(tz.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)(e$,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-8 pl-3 pr-0"}),(0,ep.jsx)(eQ,{children:"Status"}),(0,ep.jsx)(eQ,{children:"HTTP"}),(0,ep.jsx)(eQ,{className:"text-center",children:"Attempts"}),(0,ep.jsx)(eQ,{children:"Event"}),(0,ep.jsx)(eQ,{children:"Created At"})]})}),(0,ep.jsx)(eK,{children:D.map(e=>(0,ep.jsx)(jz,{delivery:e,formatDate:$},e.id))})]})}),B&&(0,ep.jsx)("div",{className:"flex justify-center pt-2",children:(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",onClick:X,disabled:F,children:[F&&(0,ep.jsx)(tz.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}e.i(34471);var jV=Symbol.for("immer-nothing"),jU=Symbol.for("immer-draftable"),jH=Symbol.for("immer-state");function jW(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var jY=Object,jG=jY.getPrototypeOf,jX="constructor",j$="prototype",jq="configurable",jK="enumerable",jZ="writable",jQ="value",jJ=e=>!!e&&!!e[jH];function j0(e){return!!e&&(j5(e)||j9(e)||!!e[jU]||!!e[jX]?.[jU]||Ne(e)||Nt(e))}var j1=jY[j$][jX].toString(),j2=new WeakMap;function j5(e){if(!e||!Nn(e))return!1;let t=jG(e);if(null===t||t===jY[j$])return!0;let n=jY.hasOwnProperty.call(t,jX)&&t[jX];if(n===Object)return!0;if(!Nr(n))return!1;let r=j2.get(n);return void 0===r&&(r=Function.toString.call(n),j2.set(n,r)),r===j1}function j3(e,t,n=!0){0===j4(e)?(n?Reflect.ownKeys(e):jY.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function j4(e){let t=e[jH];return t?t.type_:j9(e)?1:Ne(e)?2:3*!!Nt(e)}var j6=(e,t,n=j4(e))=>2===n?e.has(t):jY[j$].hasOwnProperty.call(e,t),j8=(e,t,n=j4(e))=>2===n?e.get(t):e[t],j7=(e,t,n,r=j4(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},j9=Array.isArray,Ne=e=>e instanceof Map,Nt=e=>e instanceof Set,Nn=e=>"object"==typeof e,Nr=e=>"function"==typeof e,Ni=e=>e.modified_?e.copy_:e.base_;function Na(e,t){if(Ne(e))return new Map(e);if(Nt(e))return new Set(e);if(j9(e))return Array[j$].slice.call(e);let n=j5(e);if(!0!==t&&("class_only"!==t||n)){let t=jG(e);if(null!==t&&n)return{...e};let r=jY.create(t);return jY.assign(r,e)}{let t=jY.getOwnPropertyDescriptors(e);delete t[jH];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a[jZ]&&(a[jZ]=!0,a[jq]=!0),(a.get||a.set)&&(t[i]={[jq]:!0,[jZ]:!0,[jK]:a[jK],[jQ]:e[i]})}return jY.create(jG(e),t)}}function No(e,t=!1){return Nl(e)||jJ(e)||!j0(e)||(j4(e)>1&&jY.defineProperties(e,{set:Ns,add:Ns,clear:Ns,delete:Ns}),jY.freeze(e),t&&j3(e,(e,t)=>{No(t,!0)},!1)),e}var Ns={[jQ]:function(){jW(2)}};function Nl(e){return!(null!==e&&Nn(e))||jY.isFrozen(e)}var Nc="MapSet",Nu="Patches",Nd="ArrayMethods",Nh={};function Nf(e){let t=Nh[e];return t||jW(0,e),t}var Np=e=>!!Nh[e];function Ng(e,t){t&&(e.patchPlugin_=Nf(Nu),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Nm(e){Nv(e),e.drafts_.forEach(Ny),e.drafts_=null}function Nv(e){e===I&&(I=e.parent_)}var Nx=e=>I={drafts_:[],parent_:I,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Np(Nc)?Nf(Nc):void 0,arrayMethodsPlugin_:Np(Nd)?Nf(Nd):void 0};function Ny(e){let t=e[jH];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Nb(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(void 0!==e&&e!==n){n[jH].modified_&&(Nm(t),jW(4)),j0(e)&&(e=Nw(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[jH].base_,e,t)}else e=Nw(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&No(t,n)}(t,e,!0),Nm(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==jV?e:void 0}function Nw(e,t){if(Nl(t))return t;let n=t[jH];if(!n)return N_(t,e.handledSet_,e);if(!NN(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);NC(n,e)}return n.copy_}function Nj(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var NN=(e,t)=>e.scope_===t,Nk=[];function NE(e,t,n,r){let i=e.copy_||e.base_,a=e.type_;if(void 0!==r&&j8(i,r,a)===t)return void j7(i,r,n,a);if(!e.draftLocations_){let t=e.draftLocations_=new Map;j3(i,(e,n)=>{if(jJ(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}for(let r of e.draftLocations_.get(t)??Nk)j7(i,r,n,a)}function NC(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)}Nj(e)}}function N_(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||jJ(e)||t.has(e)||!j0(e)||Nl(e)||(t.add(e),j3(e,(r,i)=>{if(jJ(i)){let t=i[jH];NN(t,n)&&(j7(e,r,Ni(t),e.type_),Nj(t))}else j0(i)&&N_(i,t,n)})),e}var NS={get(e,t){let n;if(t===jH)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(!j6(a,t,e.type_)){var o;let n;return o=e,(n=NO(a,t))?jQ in n?n[jQ]:n.get?.call(o.draft_):void 0}let s=a[t];if(e.finalized_||!j0(s)||i&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Number.isInteger(n=+t)&&String(n)===t)return s;if(s===NT(e.base_,t)){NP(e);let n=1===e.type_?+t:t,r=ND(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=NO(e.copy_||e.base_,t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=NT(e.copy_||e.base_,t),i=r?.[jH];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||j6(e.base_,t,e.type_)))return!0;NP(e),NM(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(jJ(n)){let i=n[jH];NN(i,r)&&i.callbacks_.push(function(){NP(e),NE(e,n,Ni(i),t)})}else j0(n)&&e.callbacks_.push(function(){let i=e.copy_||e.base_;3===e.type_?i.has(n)&&N_(n,r.handledSet_,r):j8(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&N_(j8(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n),!0)},deleteProperty:(e,t)=>(NP(e),void 0!==NT(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),NM(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?{[jZ]:!0,[jq]:1!==e.type_||"length"!==t,[jK]:r[jK],[jQ]:n[t]}:r},defineProperty(){jW(11)},getPrototypeOf:e=>jG(e.base_),setPrototypeOf(){jW(12)}},NA={};for(let e in NS){let t=NS[e];NA[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function NT(e,t){let n=e[jH];return(n?n.copy_||n.base_:e)[t]}function NO(e,t){if(!(t in e))return;let n=jG(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=jG(n)}}function NM(e){!e.modified_&&(e.modified_=!0,e.parent_&&NM(e.parent_))}function NP(e){e.copy_||(e.assigned_=new Map,e.copy_=Na(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function ND(e,t,n,r){let[i,a]=Ne(t)?Nf(Nc).proxyMap_(t,n):Nt(t)?Nf(Nc).proxySet_(t,n):function(e,t){let n=j9(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=NS;n&&(i=[r],a=NA);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||!NN(a,e))return;e.mapSetPlugin_?.fixSetContents(a);let t=Ni(a);NE(n,a.draft_??a,t,r),NC(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 NL(e){return jJ(e)||jW(10,e),function e(t){let n;if(!j0(t)||Nl(t))return t;let r=t[jH],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=Na(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=Na(t,!0);return j3(n,(t,r)=>{j7(n,t,e(r))},i),r&&(r.finalized_=!1),n}(e)}NA.deleteProperty=function(e,t){return NA.set.call(this,e,t,void 0)},NA.set=function(e,t,n){return NS.set.call(this,e[0],t,n,e[0])};var NI=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{let r;if(Nr(e)&&!Nr(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(Nr(t)||jW(6),void 0===n||Nr(n)||jW(7),j0(e)){let i=Nx(this),a=ND(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Nm(i):Nv(i)}return Ng(i,n),Nb(r,i)}if(e&&Nn(e))jW(1,e);else{if(void 0===(r=t(e))&&(r=e),r===jV&&(r=void 0),this.autoFreeze_&&No(r,!0),n){let t=[],i=[];Nf(Nu).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return Nr(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){j0(e)||jW(8),jJ(e)&&(e=NL(e));let t=Nx(this),n=ND(t,e,void 0);return n[jH].isManual_=!0,Nv(t),n}finishDraft(e,t){let n=e&&e[jH];n&&n.isManual_||jW(9);let{scope_:r}=n;return Ng(r,t),Nb(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=Nf(Nu).applyPatches_;return jJ(e)?r(e,t):this.produce(e,e=>r(e,t))}}().produce,NR=e=>Array.isArray(e)?e:[e],NB=0,Nz=class{revision=NB;_value;_lastValue;_isEqual=NF;constructor(e,t=NF){this._value=this._lastValue=e,this._isEqual=t}get value(){return this._value}set value(e){this.value!==e&&(this._value=e,this.revision=++NB)}};function NF(e,t){return e===t}function NV(e){return e instanceof Nz||console.warn("Not a valid cell! ",e),e.value}var NU=(e,t)=>!1;function NH(){return function(e=NF){return new Nz(null,e)}(NU)}var NW=e=>{let t=e.collectionTag;null===t&&(t=e.collectionTag=NH()),NV(t)};Symbol();var NY=0,NG=Object.getPrototypeOf({}),NX=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy(this,N$);tag=NH();tags={};children={};collectionTag=null;id=NY++},N$={get:(e,t)=>(function(){let{value:n}=e,r=Reflect.get(n,t);if("symbol"==typeof t||t in NG)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 Nq(i):new NX(i)),n.tag&&NV(n.tag),n.proxy}{let n=e.tags[t];return void 0===n&&((n=e.tags[t]=NH()).value=r),NV(n),r}})(),ownKeys:e=>(NW(e),Reflect.ownKeys(e.value)),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e.value,t),has:(e,t)=>Reflect.has(e.value,t)},Nq=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy([this],NK);tag=NH();tags={};children={};collectionTag=null;id=NY++},NK={get:([e],t)=>("length"===t&&NW(e),N$.get(e,t)),ownKeys:([e])=>N$.ownKeys(e),getOwnPropertyDescriptor:([e],t)=>N$.getOwnPropertyDescriptor(e,t),has:([e],t)=>N$.has(e,t)},NZ="u">typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function NQ(){return{s:0,v:void 0,o:null,p:null}}function NJ(e,t={}){let n,r=NQ(),{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=NQ(),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=NQ(),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 NZ(t):t}return l.s=1,l.v=t,t}return o.clearCache=()=>{r=NQ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}var N0=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=NJ,argsMemoizeOptions:d=[],devModeChecks:h={}}={...n,...o},f=NR(c),p=NR(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}(NJ),N1=Object.assign((e,t=N0)=>{!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:()=>N1});function N2(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 N5="function"==typeof Symbol&&Symbol.observable||"@@observable",N3=()=>Math.random().toString(36).substring(7).split("").join("."),N4={INIT:`@@redux/INIT${N3()}`,REPLACE:`@@redux/REPLACE${N3()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${N3()}`};function N6(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 N8(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:N4.INIT}))throw Error(N2(12));if(void 0===t(void 0,{type:N4.PROBE_UNKNOWN_ACTION()}))throw Error(N2(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(N2(14));o[s]=u,a=a||u!==c}return(a=a||i.length!==Object.keys(e).length)?o:e}}function N7(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function N9(e){return N6(e)&&"type"in e&&"string"==typeof e.type}function ke(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var kt=ke(),kn="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!=arguments.length)return"object"==typeof arguments[0]?N7:N7.apply(null,arguments)};function kr(e,t){function n(...r){if(t){let n=t(...r);if(!n)throw Error(kG(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=>N9(t)&&t.type===e,n}"u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var ki=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 ka(e){return j0(e)?NI(e,()=>{}):e}function ko(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var ks="RTK_autoBatch",kl=()=>e=>({payload:e,meta:{[ks]:!0}}),kc=e=>t=>{setTimeout(t,e)},ku=(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:kc(10):"callback"===e.type?e.queueNotification:kc(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?.[ks]))&&!o&&(o=!0,l(c)),r.dispatch(e)}finally{i=!0}}})};function kd(e){let t,n={},r=[],i={addCase(e,t){let r="string"==typeof e?e:e.type;if(!r)throw Error(kG(28));if(r in n)throw Error(kG(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 kh=Symbol.for("rtk-slice-createasyncthunk"),kf=((c=kf||{}).reducer="reducer",c.reducerWithPrepare="reducerWithPrepare",c.asyncThunk="asyncThunk",c),kp=function({creators:e}={}){let t=e?.asyncThunk?.[kh];return function(e){let n,{name:r,reducerPath:i=r}=e;if(!r)throw Error(kG(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(kG(12));if(n in l)throw Error(kG(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?kd(e.extraReducers):[e.extraReducers],i={...t,...l};return function(e,t){let n,[r,i,a]=kd(t);if("function"==typeof e)n=()=>ka(e());else{let t=ka(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(jJ(e)){let r=n(e,t);return void 0===r?e:r}else{if(j0(e))return NI(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(kG(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||kg,pending:s||kg,rejected:l||kg,settled:c||kg})}(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(kG(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?kr(e,o):kr(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=ko(g,r,x)),i}function i(t=f){let r=ko(p,n,()=>new WeakMap);return ko(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,()=>ko(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 kg(){}var km="listener",kv="completed",kx="cancelled",ky=`task-${kx}`,kb=`task-${kv}`,kw=`${km}-${kx}`,kj=`${km}-${kv}`,kN=class{constructor(e){this.code=e,this.message=`task ${kx} (reason: ${e})`}name="TaskAbortError";message},kk=(e,t)=>{if("function"!=typeof e)throw TypeError(kG(32))},kE=()=>{},kC=(e,t=kE)=>(e.catch(t),e),k_=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),kS=e=>{if(e.aborted)throw new kN(e.reason)};function kA(e,t){let n=kE;return new Promise((r,i)=>{let a=()=>i(new kN(e.reason));e.aborted?a():(n=k_(e,a),t.finally(()=>n()).then(r,i))}).finally(()=>{n=kE})}var kT=async(e,t)=>{try{await Promise.resolve();let t=await e();return{status:"ok",value:t}}catch(e){return{status:e instanceof kN?"cancelled":"rejected",error:e}}finally{t?.()}},kO=e=>t=>kC(kA(e,t).then(t=>(kS(e),t))),kM=e=>{let t=kO(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:kP}=Object,kD={},kL="listenerMiddleware",kI=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=kr(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(i);else throw Error(kG(21));return kk(a,"options.listener"),{predicate:i,type:t,effect:a}},kR=kP(e=>{let{type:t,predicate:n,effect:r}=kI(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(kG(22))}}},{withTypes:()=>kR}),kB=(e,t)=>{let{type:n,effect:r,predicate:i}=kI(t);return Array.from(e.values()).find(e=>("string"==typeof n?e.type===n:e.predicate===i)&&e.effect===r)},kz=e=>{e.pending.forEach(e=>{e.abort(kw)})},kF=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},kV=kP(kr(`${kL}/add`),{withTypes:()=>kV}),kU=kr(`${kL}/removeAll`),kH=kP(kr(`${kL}/remove`),{withTypes:()=>kH}),kW=(...e)=>{console.error(`${kL}/error`,...e)},kY=(e={})=>{let t=new Map,n=new Map,{extra:r,onError:i=kW}=e;kk(i,"onError");let a=e=>{var n;return(n=kB(t,e)??kR(e)).unsubscribe=()=>t.delete(n.id),t.set(n.id,n),e=>{n.unsubscribe(),e?.cancelActive&&kz(n)}};kP(a,{withTypes:()=>a});let o=e=>{let n=kB(t,e);return n&&(n.unsubscribe(),e.cancelActive&&kz(n)),!!n};kP(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)=>{kS(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 kA(c,Promise.race(r));return kS(c),e}finally{n()}},(e,t)=>kC(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,kP({},s,{getOriginalState:l,condition:(e,t)=>f(e,t).then(Boolean),take:f,delay:kM(h.signal),pause:kO(h.signal),extra:r,signal:h.signal,fork:(u=h.signal,(e,t)=>{kk(e,"taskExecutor");let n=new AbortController;k_(u,()=>n.abort(u.reason));let r=kT(async()=>{kS(u),kS(n.signal);let t=await e({pause:kO(n.signal),delay:kM(n.signal),signal:n.signal});return kS(n.signal),t},()=>n.abort(kb));return t?.autoJoin&&p.push(r.catch(kE)),{result:kO(u)(r),cancel(){n.abort(ky)}}}),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==h&&(e.abort(kw),n.delete(e))})},cancel:()=>{h.abort(kw),e.pending.delete(h)},throwIfCancelled:()=>{kS(h.signal)}})))}catch(e){e instanceof kN||kF(i,e,{raisedBy:"effect"})}finally{let t;await Promise.all(p),h.abort(kj),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())kz(e);t.clear()};return{middleware:e=>n=>r=>{let c;if(!N9(r))return n(r);if(kV.match(r))return a(r.payload);if(kU.match(r))return void l();if(kH.match(r))return o(r.payload);let u=e.getState(),d=()=>{if(u===kD)throw Error(kG(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,kF(i,e,{raisedBy:"predicate"})}t&&s(a,r,e,d)}}}finally{u=kD}return c},startListening:a,stopListening:o,clearListeners:l}};function kG(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 kX=e.i(92068);function k$(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 kq(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+k$(i)+t:e+t},"")}var kK=e=>0===e?0:e>0?1:-1,kZ=e=>"number"==typeof e&&e!=+e,kQ=e=>"string"==typeof e&&e.indexOf("%")===e.length-1,kJ=e=>("number"==typeof e||e instanceof Number)&&!kZ(e),k0=e=>kJ(e)||"string"==typeof e,k1=0,k2=e=>{var t=++k1;return"".concat(e||"").concat(t)},k5=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(!kJ(e)&&"string"!=typeof e)return r;if(kQ(e)){if(null==t)return r;var a=e.indexOf("%");n=t*parseFloat(e.slice(0,a))/100}else n=+e;return kZ(n)&&(n=r),i&&null!=t&&n>t&&(n=t),n},k3=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 k4(e,t,n){return kJ(e)&&kJ(t)?k$(e+n*(t-e)):t}function k6(e,t,n){if(e&&e.length)return e.find(e=>e&&("function"==typeof t?t(e):(0,kX.default)(e,t))===n)}var k8=e=>null==e?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function k7(e){return null!=e}function k9(){}function Ee(e,t){if(t){var n=Number.parseInt(t,10);if(!kZ(n))return null==e?void 0:e[n]}}var Et=kp({name:"options",initialState:{chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},reducers:{createEventEmitter:e=>{null==e.eventEmitter&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),En=Et.reducer,{createEventEmitter:Er}=Et.actions,Ei=(e.i(13027),{notify(){},get:()=>[]}),Ea="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Eo="u">typeof navigator&&"ReactNative"===navigator.product,Es=Ea||Eo?eg.useLayoutEffect:eg.useEffect;function El(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}var Ec=Symbol.for("react-redux-context"),Eu="u">typeof globalThis?globalThis:{},Ed=function(){if(!eg.createContext)return{};let e=Eu[Ec]??=new Map,t=e.get(eg.createContext);return t||(t=eg.createContext(null),e.set(eg.createContext,t)),t}(),Eh=function(e){let{children:t,context:n,serverState:r,store:i}=e,a=eg.useMemo(()=>{let e=function(e){let t,n=Ei,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=Ei)}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=eg.useMemo(()=>i.getState(),[i]);return Es(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]),eg.createElement((n||Ed).Provider,{value:a},t)};function Ef(e=Ed){return function(){return eg.useContext(e)}}var Ep=Ef(),Eg=Symbol.for("immer-nothing"),Em=Symbol.for("immer-draftable"),Ev=Symbol.for("immer-state");function Ex(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ey=Object.getPrototypeOf;function Eb(e){return!!e&&!!e[Ev]}function Ew(e){return!!e&&(Ek(e)||Array.isArray(e)||!!e[Em]||!!e.constructor?.[Em]||EA(e)||ET(e))}var Ej=Object.prototype.constructor.toString(),EN=new WeakMap;function Ek(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=EN.get(n);return void 0===r&&(r=Function.toString.call(n),EN.set(n,r)),r===Ej}function EE(e,t,n=!0){0===EC(e)?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function EC(e){let t=e[Ev];return t?t.type_:Array.isArray(e)?1:EA(e)?2:3*!!ET(e)}function E_(e,t){return 2===EC(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ES(e,t,n){let r=EC(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function EA(e){return e instanceof Map}function ET(e){return e instanceof Set}function EO(e){return e.copy_||e.base_}function EM(e,t){if(EA(e))return new Map(e);if(ET(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=Ek(e);if(!0!==t&&("class_only"!==t||n)){let t=Ey(e);return null!==t&&n?{...e}:Object.assign(Object.create(t),e)}{let t=Object.getOwnPropertyDescriptors(e);delete t[Ev];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(Ey(e),t)}}function EP(e,t=!1){return EL(e)||Eb(e)||!Ew(e)||(EC(e)>1&&Object.defineProperties(e,{set:ED,add:ED,clear:ED,delete:ED}),Object.freeze(e),t&&Object.values(e).forEach(e=>EP(e,!0))),e}var ED={value:function(){Ex(2)}};function EL(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var EI={};function ER(e){let t=EI[e];return t||Ex(0,e),t}function EB(e,t){t&&(ER("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ez(e){EF(e),e.drafts_.forEach(EU),e.drafts_=null}function EF(e){e===R&&(R=e.parent_)}function EV(e){return R={drafts_:[],parent_:R,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function EU(e){let t=e[Ev];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function EH(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return void 0!==e&&e!==n?(n[Ev].modified_&&(Ez(t),Ex(4)),Ew(e)&&(e=EW(t,e),t.parent_||EG(t,e)),t.patches_&&ER("Patches").generateReplacementPatches_(n[Ev].base_,e,t.patches_,t.inversePatches_)):e=EW(t,n,[]),Ez(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Eg?e:void 0}function EW(e,t,n){if(EL(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[Ev];if(!i)return EE(t,(r,a)=>EY(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return EG(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),EE(a,(r,a)=>EY(e,i,t,r,a,n,o),r),EG(e,t,!1),n&&e.patches_&&ER("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function EY(e,t,n,r,i,a,o){if(null==i||"object"!=typeof i&&!o)return;let s=EL(i);if(!s||o){if(Eb(i)){let o=EW(e,i,a&&t&&3!==t.type_&&!E_(t.assigned_,r)?a.concat(r):void 0);if(ES(n,r,o),!Eb(o))return;e.canAutoFreeze_=!1}else o&&n.add(i);if(Ew(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;EW(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof r&&(EA(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&EG(e,i)}}}function EG(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&EP(t,n)}var EX={get(e,t){if(t===Ev)return e;let n=EO(e);if(!E_(n,t)){var r;let i;return r=e,(i=EK(n,t))?"value"in i?i.value:i.get?.call(r.draft_):void 0}let i=n[t];return e.finalized_||!Ew(i)?i:i===Eq(e.base_,t)?(EQ(e),e.copy_[t]=E0(i,e)):i},has:(e,t)=>t in EO(e),ownKeys:e=>Reflect.ownKeys(EO(e)),set(e,t,n){let r=EK(EO(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=Eq(EO(e),t),i=r?.[Ev];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||E_(e.base_,t)))return!0;EQ(e),EZ(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!==Eq(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,EQ(e),EZ(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=EO(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Ex(11)},getPrototypeOf:e=>Ey(e.base_),setPrototypeOf(){Ex(12)}},E$={};function Eq(e,t){let n=e[Ev];return(n?EO(n):e)[t]}function EK(e,t){if(!(t in e))return;let n=Ey(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Ey(n)}}function EZ(e){!e.modified_&&(e.modified_=!0,e.parent_&&EZ(e.parent_))}function EQ(e){e.copy_||(e.copy_=EM(e.base_,e.scope_.immer_.useStrictShallowCopy_))}EE(EX,(e,t)=>{E$[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),E$.deleteProperty=function(e,t){return E$.set.call(this,e,t,void 0)},E$.set=function(e,t,n){return EX.set.call(this,e[0],t,n,e[0])};var EJ=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&&Ex(6),void 0!==n&&"function"!=typeof n&&Ex(7),Ew(e)){let i=EV(this),a=E0(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Ez(i):EF(i)}return EB(i,n),EH(r,i)}if(e&&"object"==typeof e)Ex(1,e);else{if(void 0===(r=t(e))&&(r=e),r===Eg&&(r=void 0),this.autoFreeze_&&EP(r,!0),n){let t=[],i=[];ER("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;Ew(e)||Ex(8),Eb(e)&&(Eb(t=e)||Ex(10,t),e=function e(t){let n;if(!Ew(t)||EL(t))return t;let r=t[Ev],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=EM(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=EM(t,!0);return EE(n,(t,r)=>{ES(n,t,e(r))},i),r&&(r.finalized_=!1),n}(t));let n=EV(this),r=E0(e,void 0);return r[Ev].isManual_=!0,EF(n),r}finishDraft(e,t){let n=e&&e[Ev];n&&n.isManual_||Ex(9);let{scope_:r}=n;return EB(r,t),EH(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=ER("Patches").applyPatches_;return Eb(e)?r(e,t):this.produce(e,e=>r(e,t))}};function E0(e,t){let n=EA(e)?ER("MapSet").proxyMap_(e,t):ET(e)?ER("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=EX;n&&(i=[r],a=E$);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 EJ().produce;var E1={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},E2=kp({name:"tooltip",initialState:{itemInteraction:{click:E1,hover:E1},axisInteraction:{click:E1,hover:E1},keyboardInteraction:E1,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:kl()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NL(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:kl()},removeTooltipEntrySettings:{reducer(e,t){var n=NL(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:kl()},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:E5,replaceTooltipEntrySettings:E3,removeTooltipEntrySettings:E4,setTooltipSettingsState:E6,setActiveMouseOverItemIndex:E8,mouseLeaveItem:E7,mouseLeaveChart:E9,setActiveClickItemIndex:Ce,setMouseOverAxisIndex:Ct,setMouseClickAxisIndex:Cn,setSyncInteraction:Cr,setKeyboardInteraction:Ci}=E2.actions,Ca=E2.reducer,Co=kp({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:Cs,setDataStartEndIndexes:Cl,setComputedData:Cc}=Co.actions,Cu=Co.reducer,Cd=kp({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:Ch,setLayout:Cf,setChartSize:Cp,setScale:Cg}=Cd.actions,Cm=Cd.reducer,Cv=e.i(30224),Cx=(0,eg.createContext)(null),Cy=e=>e,Cb=()=>{var e=(0,eg.useContext)(Cx);return e?e.store.dispatch:Cy},Cw=()=>{},Cj=()=>Cw,CN=(e,t)=>e===t;function Ck(e){var t=(0,eg.useContext)(Cx);return(0,Cv.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Cj,t?t.store.getState:Cw,t?t.store.getState:Cw,t?e:Cw,CN)}var CE=e.i(42342),CC=e=>e.legend.settings;function C_(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function CS(e){return function(){return e}}function CA(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 CT(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function CO(e,t){return e[t]}function CM(e){let t=[];return t.key=e,t}function CP(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function CD(e){return Number.isFinite(e)}function CL(e){return"number"==typeof e&&e>0&&Number.isFinite(e)}function CI(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 CR(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?CI(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)):CI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function CB(e,t,n){return null==e||null==t?n:k0(t)?(0,kX.default)(e,t,n):"function"==typeof t?t(e):n}N0([e=>e.legend.payload,CC],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?(0,CE.default)(r,n):r}),Array.prototype.slice;var Cz=(e,t)=>"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t,CF={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=kZ(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}CA(e,t)}},none:CA,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}CA(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,CA(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=kZ(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 CV(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=k6(n,"value",i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var l=CB(i,null==o?t.dataKey:o);return null==l?null:t.scale(l)}var CU=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,CH=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,CW=(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,CE.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 CY(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return CR(CR({},t),{},{dataKey:n,payload:r,value:i,name:a})}function CG(e,t){return e?String(e):"string"==typeof t?t:void 0}var CX=e=>e.layout.width,C$=e=>e.layout.height,Cq=e=>e.layout.scale,CK=e=>e.layout.margin,CZ=N0(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),CQ=N0(e=>e.cartesianAxis.yAxis,e=>Object.values(e));function CJ(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 C0(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?CJ(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)):CJ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var C1=N0([CX,C$,CK,e=>e.brush.height,function(e){return CQ(e).reduce((e,t)=>"left"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return CQ(e).reduce((e,t)=>"right"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return CZ(e).reduce((e,t)=>"top"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},function(e){return CZ(e).reduce((e,t)=>"bottom"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},CC,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=C0(C0({},{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&&kJ(e[a]))return CR(CR({},e),{},{[a]:e[a]+(r||0)});if(("horizontal"===s||"vertical"===s&&"center"===a)&&"middle"!==o&&kJ(e[o]))return CR(CR({},e),{},{[o]:e[o]+(i||0)})}return e})(d,l,c)).left-d.right,p=t-d.top-d.bottom;return C0(C0({brushBottom:h},d),{},{width:Math.max(f,0),height:Math.max(p,0)})}),C2=N0(C1,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),C5=N0(CX,C$,(e,t)=>({x:0,y:0,width:e,height:t})),C3=(0,eg.createContext)(null),C4=()=>null!=(0,eg.useContext)(C3),C6=e=>e.brush,C8=N0([C6,C1,CK],(e,t,n)=>({height:e.height,x:kJ(e.x)?e.x:t.left,y:kJ(e.y)?e.y:t.top+t.height+t.brushBottom-((null==n?void 0:n.bottom)||0),width:kJ(e.width)?e.width:t.width})),C7=e.i(7670),C9=e.i(58723),_e=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++]))}},_t=(e,t,n)=>{var{width:r="100%",height:i="100%",aspect:a,maxHeight:o}=n,s=kQ(r)?e:Number(r),l=kQ(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}},_n={width:0,height:0,overflow:"visible"},_r={width:0,overflowX:"visible"},_i={height:0,overflowY:"visible"},_a={};function _o(){return(_o=Object.assign.bind()).apply(null,arguments)}function _s(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 _l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_s(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)):_s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _c=(0,eg.createContext)({width:-1,height:-1});function _u(e){var{children:t,width:n,height:r}=e,i=(0,eg.useMemo)(()=>({width:n,height:r}),[n,r]);return CL(i.width)&&CL(i.height)?eg.createElement(_c.Provider,{value:i},t):null}var _d=()=>(0,eg.useContext)(_c),_h=(0,eg.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,eg.useRef)(null),v=(0,eg.useRef)();v.current=f,(0,eg.useImperativeHandle)(t,()=>g.current);var[x,y]=(0,eg.useState)({containerWidth:r.width,containerHeight:r.height}),b=(0,eg.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,eg.useEffect)(()=>{if(null==g.current||"u"<typeof ResizeObserver)return k9;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,C9.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;_e(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:N,calculatedHeight:k}=_t(w,j,{width:i,height:a,aspect:n,maxHeight:l});return _e(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),eg.createElement("div",{id:d?"".concat(d):void 0,className:(0,C7.clsx)("recharts-responsive-container",h),style:_l(_l({},p),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:g},eg.createElement("div",{style:(e=>{var{width:t,height:n}=e,r=kQ(t),i=kQ(n);return r&&i?_n:r?_r:i?_i:_a})({width:i,height:a})},eg.createElement(_u,{width:N,height:k},c)))}),_f=(0,eg.forwardRef)((e,t)=>{var n=_d();if(CL(n.width)&&CL(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}=_t(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return kJ(a)&&kJ(o)?eg.createElement(_u,{width:a,height:o},e.children):eg.createElement(_h,_o({},e,{width:r,height:i,ref:t}))});function _p(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 _g=()=>{var e,t=C4(),n=Ck(C2),r=Ck(C8),i=null==(e=Ck(C6))?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},_m={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},_v=e=>e.layout.layoutType,_x=e=>{var t=Cb(),n=C4(),{width:r,height:i}=e,a=_d(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,eg.useEffect)(()=>{!n&&CL(o)&&CL(s)&&t(Cp({width:o,height:s}))},[t,n,o,s]),null},_y=e.i(66814);function _b(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function _w(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 _j extends Map{constructor(e,t=_k){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(_N(this,e))}has(e){return super.has(_N(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 _N({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function _k(e){return null!==e&&"object"==typeof e?e.valueOf():e}let _E=Symbol("implicit");function _C(){var e=new _j,t=[],n=[],r=_E;function i(i){let a=e.get(i);if(void 0===a){if(r!==_E)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 _j,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 _C(t,n).unknown(r)},_b.apply(i,arguments),i}function __(){var e,t,n=_C().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 __(r(),[a,o]).round(s).paddingInner(l).paddingOuter(c).align(u)},_b.apply(d(),arguments)}function _S(){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}(__.apply(null,arguments).paddingInner(1))}let _A=Math.sqrt(50),_T=Math.sqrt(10),_O=Math.sqrt(2);function _M(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>=_A?10:l>=_T?5:l>=_O?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)?_M(e,t,2*n):[r,i,a]}function _P(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?_M(t,e,n):_M(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 _D(e,t,n){return _M(e*=1,t*=1,n*=1)[2]}function _L(e,t,n){t*=1,e*=1,n*=1;let r=t<e,i=r?_D(t,e,n):_D(e,t,n);return(r?-1:1)*(i<0?-(1/i):i)}function _I(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function _R(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function _B(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=_I,n=(t,n)=>_I(e(t),n),r=(t,n)=>e(t)-n):(t=e===_I||e===_R?e:_z,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 _z(){return 0}function _F(e){return null===e?NaN:+e}let _V=_B(_I),_U=_V.right;function _H(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _W(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function _Y(){}_V.left,_B(_F).center;var _G="\\s*([+-]?\\d+)\\s*",_X="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_$="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_q=/^#([0-9a-f]{3,8})$/,_K=RegExp(`^rgb\\(${_G},${_G},${_G}\\)$`),_Z=RegExp(`^rgb\\(${_$},${_$},${_$}\\)$`),_Q=RegExp(`^rgba\\(${_G},${_G},${_G},${_X}\\)$`),_J=RegExp(`^rgba\\(${_$},${_$},${_$},${_X}\\)$`),_0=RegExp(`^hsl\\(${_X},${_$},${_$}\\)$`),_1=RegExp(`^hsla\\(${_X},${_$},${_$},${_X}\\)$`),_2={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 _5(){return this.rgb().formatHex()}function _3(){return this.rgb().formatRgb()}function _4(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_q.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?_6(t):3===n?new _9(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?_8(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?_8(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=_K.exec(e))?new _9(t[1],t[2],t[3],1):(t=_Z.exec(e))?new _9(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=_Q.exec(e))?_8(t[1],t[2],t[3],t[4]):(t=_J.exec(e))?_8(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=_0.exec(e))?Sa(t[1],t[2]/100,t[3]/100,1):(t=_1.exec(e))?Sa(t[1],t[2]/100,t[3]/100,t[4]):_2.hasOwnProperty(e)?_6(_2[e]):"transparent"===e?new _9(NaN,NaN,NaN,0):null}function _6(e){return new _9(e>>16&255,e>>8&255,255&e,1)}function _8(e,t,n,r){return r<=0&&(e=t=n=NaN),new _9(e,t,n,r)}function _7(e,t,n,r){var i;return 1==arguments.length?((i=e)instanceof _Y||(i=_4(i)),i)?new _9((i=i.rgb()).r,i.g,i.b,i.opacity):new _9:new _9(e,t,n,null==r?1:r)}function _9(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Se(){return`#${Si(this.r)}${Si(this.g)}${Si(this.b)}`}function St(){let e=Sn(this.opacity);return`${1===e?"rgb(":"rgba("}${Sr(this.r)}, ${Sr(this.g)}, ${Sr(this.b)}${1===e?")":`, ${e})`}`}function Sn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Sr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Si(e){return((e=Sr(e))<16?"0":"")+e.toString(16)}function Sa(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ss(e,t,n,r)}function So(e){if(e instanceof Ss)return new Ss(e.h,e.s,e.l,e.opacity);if(e instanceof _Y||(e=_4(e)),!e)return new Ss;if(e instanceof Ss)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 Ss(o,s,l,e.opacity)}function Ss(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Sl(e){return(e=(e||0)%360)<0?e+360:e}function Sc(e){return Math.max(0,Math.min(1,e||0))}function Su(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 Sd(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}_H(_Y,_4,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:_5,formatHex:_5,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return So(this).formatHsl()},formatRgb:_3,toString:_3}),_H(_9,_7,_W(_Y,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new _9(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new _9(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new _9(Sr(this.r),Sr(this.g),Sr(this.b),Sn(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:Se,formatHex:Se,formatHex8:function(){return`#${Si(this.r)}${Si(this.g)}${Si(this.b)}${Si((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:St,toString:St})),_H(Ss,function(e,t,n,r){return 1==arguments.length?So(e):new Ss(e,t,n,null==r?1:r)},_W(_Y,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new Ss(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Ss(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 _9(Su(e>=240?e-240:e+120,i,r),Su(e,i,r),Su(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ss(Sl(this.h),Sc(this.s),Sc(this.l),Sn(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=Sn(this.opacity);return`${1===e?"hsl(":"hsla("}${Sl(this.h)}, ${100*Sc(this.s)}%, ${100*Sc(this.l)}%${1===e?")":`, ${e})`}`}}));let Sh=e=>()=>e;function Sf(e,t){var n=t-e;return n?function(t){return e+t*n}:Sh(isNaN(e)?t:e)}let Sp=function e(t){var n,r=1==(n=+t)?Sf: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)}):Sh(isNaN(e)?t:e)};function i(e,t){var n=r((e=_7(e)).r,(t=_7(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=Sf(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 Sg(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=_7(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 Sm(e,t){return e*=1,t*=1,function(n){return e*(1-n)+t*n}}Sg(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 Sd((n-r/t)*t,o,i,a,s)}}),Sg(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 Sd((n-r/t)*t,i,a,o,s)}});var Sv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Sx=RegExp(Sv.source,"g");function Sy(e,t){var n,r,i=typeof t;return null==t||"boolean"===i?Sh(t):("number"===i?Sm:"string"===i?(r=_4(t))?(t=r,Sp):function(e,t){var n,r,i,a,o,s=Sv.lastIndex=Sx.lastIndex=0,l=-1,c=[],u=[];for(e+="",t+="";(i=Sv.exec(e))&&(a=Sx.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:Sm(i,a)})),s=Sx.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 _4?Sp: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]=Sy(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]=Sy(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}:Sm: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 Sb(e,t){return e*=1,t*=1,function(n){return Math.round(e*(1-n)+t*n)}}function Sw(e){return+e}var Sj=[0,1];function SN(e){return e}function Sk(e,t){var n;return(t-=e*=1)?function(n){return(n-e)/t}:(n=isNaN(t)?NaN:.5,function(){return n})}function SE(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=Sk(i,r),a=n(o,a)):(r=Sk(r,i),a=n(a,o)),function(e){return a(r(e))}}function SC(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]=Sk(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=_U(e,t,1,r)-1;return a[n](i[n](t))}}function S_(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function SS(){var e,t,n,r,i,a,o=Sj,s=Sj,l=Sy,c=SN;function u(){var e,t,n,l=Math.min(o.length,s.length);return c!==SN&&(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?SC:SE,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),Sm)))(n)))},d.domain=function(e){return arguments.length?(o=Array.from(e,Sw),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=Sb,u()},d.clamp=function(e){return arguments.length?(c=!!e||SN,u()):c!==SN},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 SA(){return SS()(SN,SN)}function ST(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 SO(e){return(e=ST(Math.abs(e)))?e[1]:NaN}var SM=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function SP(e){var t;if(!(t=SM.exec(e)))throw Error("invalid format: "+e);return new SD({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 SD(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 SL(e,t){var n=ST(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")}SP.prototype=SD.prototype,SD.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 SI={"%":(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)=>SL(100*e,t),r:SL,s:function(e,t){var n=ST(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")+ST(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function SR(e){return e}var SB=Array.prototype.map,Sz=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function SF(e,t,n,r){var i,a,o=_L(e,t,n);switch((r=SP(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(SO(s)/3)))-SO(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,SO(Math.abs(Math.max(Math.abs(e),Math.abs(t)))-(i=Math.abs(i=o)))-SO(i))+1)||(r.precision=a-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(a=Math.max(0,-SO(Math.abs(o))))||(r.precision=a-("%"===r.type)*2)}return F(r)}function SV(e){var t=e.domain;return e.ticks=function(e){var n=t();return _P(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return SF(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=_D(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 SU(){var e=SA();return e.copy=function(){return S_(e,SU())},_b.apply(e,arguments),SV(e)}function SH(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,Sw),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return SH(e).unknown(t)},e=arguments.length?Array.from(e,Sw):[0,1],SV(n)}function SW(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 SY(e){return Math.log(e)}function SG(e){return Math.exp(e)}function SX(e){return-Math.log(-e)}function S$(e){return-Math.exp(-e)}function Sq(e){return isFinite(e)?+("1e"+e):e<0?0:e}function SK(e){return(t,n)=>-e(-t,n)}function SZ(e){let t,n,r=e(SY,SG),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)?Sq:s===Math.E?Math.exp:e=>Math.pow(s,e),i()[0]<0?(t=SK(t),n=SK(n),e(SX,S$)):e(SY,SG),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=_P(l,c,f))}else p=_P(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=SP(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(SW(i(),{floor:e=>n(Math.floor(t(e))),ceil:e=>n(Math.ceil(t(e)))})),r}function SQ(){let e=SZ(SS()).domain([1,10]);return e.copy=()=>S_(e,SQ()).base(e.base()),_b.apply(e,arguments),e}function SJ(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function S0(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function S1(e){var t=1,n=e(SJ(1),S0(t));return n.constant=function(n){return arguments.length?e(SJ(t=+n),S0(t)):t},SV(n)}function S2(){var e=S1(SS());return e.copy=function(){return S_(e,S2()).constant(e.constant())},_b.apply(e,arguments)}function S5(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function S3(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function S4(e){return e<0?-e*e:e*e}function S6(e){var t=e(SN,SN),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(SN,SN):.5===n?e(S3,S4):e(S5(n),S5(1/n)):n},SV(t)}function S8(){var e=S6(SS());return e.copy=function(){return S_(e,S8()).exponent(e.exponent())},_b.apply(e,arguments),e}function S7(){return S8.apply(null,arguments).exponent(.5)}function S9(e){return Math.sign(e)*e*e}function Ae(){var e,t=SA(),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(S9(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,Sw)).map(S9)),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 Ae(t.domain(),n).round(r).clamp(t.clamp()).unknown(e)},_b.apply(i,arguments),SV(i)}function At(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 An(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 Ar(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:+(e>t))}function Ai(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Aa(){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=_F){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[_U(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(_I),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 Aa().domain(t).range(n).unknown(e)},_b.apply(a,arguments)}function Ao(){var e,t=0,n=1,r=1,i=[.5],a=[0,1];function o(t){return null!=t&&t<=t?a[_U(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 Ao().domain([t,n]).range(a).unknown(e)},_b.apply(SV(o),arguments)}function As(){var e,t=[.5],n=[0,1],r=1;function i(i){return null!=i&&i<=i?n[_U(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 As().domain(t).range(n).unknown(e)},_b.apply(i,arguments)}F=(z=function(e){var t,n,r,i=void 0===e.grouping||void 0===e.thousands?SR:(t=SB.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?SR:(r=SB.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=SP(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"):SI[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=SI[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?Sz[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=SP(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(SO(t)/3))),i=Math.pow(10,-r),a=Sz[8+r/3];return function(e){return n(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,V=z.formatPrefix;let Al=new Date,Ac=new Date;function Au(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=>Au(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)=>(Al.setTime(+t),Ac.setTime(+r),e(Al),e(Ac),Math.floor(n(Al,Ac))),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 Ad=Au(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());Ad.every=e=>isFinite(e=Math.floor(e))&&e>0?Au(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,Ad.range;let Ah=Au(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());Ah.every=e=>isFinite(e=Math.floor(e))&&e>0?Au(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,Ah.range;let Af=Au(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());Af.range;let Ap=Au(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());Ap.range;function Ag(e){return Au(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 Am=Ag(0),Av=Ag(1),Ax=Ag(2),Ay=Ag(3),Ab=Ag(4),Aw=Ag(5),Aj=Ag(6);function AN(e){return Au(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)}Am.range,Av.range,Ax.range,Ay.range,Ab.range,Aw.range,Aj.range;let Ak=AN(0),AE=AN(1),AC=AN(2),A_=AN(3),AS=AN(4),AA=AN(5),AT=AN(6);Ak.range,AE.range,AC.range,A_.range,AS.range,AA.range,AT.range;let AO=Au(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);AO.range;let AM=Au(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1);AM.range;let AP=Au(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5));AP.range;let AD=Au(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());AD.range;let AL=Au(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours());AL.range;let AI=Au(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getMinutes());AI.range;let AR=Au(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes());AR.range;let AB=Au(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+1e3*t)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds());AB.range;let Az=Au(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);function AF(e,t,n,r,i,a){let o=[[AB,1,1e3],[AB,5,5e3],[AB,15,15e3],[AB,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=_B(([,,e])=>e).right(o,i);if(a===o.length)return e.every(_L(t/31536e6,n/31536e6,r));if(0===a)return Az.every(Math.max(_L(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]}Az.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?Au(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Az:null,Az.range;let[AV,AU]=AF(Ah,Ap,Ak,AP,AL,AR),[AH,AW]=AF(Ad,Af,Am,AO,AD,AI);function AY(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 AG(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 AX(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var A$={"-":"",_:" ",0:"0"},Aq=/^\s*\d+/,AK=/^%/,AZ=/[\\^$*+?|[\]().{}]/g;function AQ(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 AJ(e){return e.replace(AZ,"\\$&")}function A0(e){return RegExp("^(?:"+e.map(AJ).join("|")+")","i")}function A1(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function A2(e,t,n){var r=Aq.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function A5(e,t,n){var r=Aq.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function A3(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function A4(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function A6(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function A8(e,t,n){var r=Aq.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function A7(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function A9(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 Te(e,t,n){var r=Aq.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function Tt(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Tn(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Tr(e,t,n){var r=Aq.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Ti(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Ta(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function To(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Ts(e,t,n){var r=Aq.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Tl(e,t,n){var r=Aq.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Tc(e,t,n){var r=AK.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Tu(e,t,n){var r=Aq.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Td(e,t,n){var r=Aq.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Th(e,t){return AQ(e.getDate(),t,2)}function Tf(e,t){return AQ(e.getHours(),t,2)}function Tp(e,t){return AQ(e.getHours()%12||12,t,2)}function Tg(e,t){return AQ(1+AO.count(Ad(e),e),t,3)}function Tm(e,t){return AQ(e.getMilliseconds(),t,3)}function Tv(e,t){return Tm(e,t)+"000"}function Tx(e,t){return AQ(e.getMonth()+1,t,2)}function Ty(e,t){return AQ(e.getMinutes(),t,2)}function Tb(e,t){return AQ(e.getSeconds(),t,2)}function Tw(e){var t=e.getDay();return 0===t?7:t}function Tj(e,t){return AQ(Am.count(Ad(e)-1,e),t,2)}function TN(e){var t=e.getDay();return t>=4||0===t?Ab(e):Ab.ceil(e)}function Tk(e,t){return e=TN(e),AQ(Ab.count(Ad(e),e)+(4===Ad(e).getDay()),t,2)}function TE(e){return e.getDay()}function TC(e,t){return AQ(Av.count(Ad(e)-1,e),t,2)}function T_(e,t){return AQ(e.getFullYear()%100,t,2)}function TS(e,t){return AQ((e=TN(e)).getFullYear()%100,t,2)}function TA(e,t){return AQ(e.getFullYear()%1e4,t,4)}function TT(e,t){var n=e.getDay();return AQ((e=n>=4||0===n?Ab(e):Ab.ceil(e)).getFullYear()%1e4,t,4)}function TO(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+AQ(t/60|0,"0",2)+AQ(t%60,"0",2)}function TM(e,t){return AQ(e.getUTCDate(),t,2)}function TP(e,t){return AQ(e.getUTCHours(),t,2)}function TD(e,t){return AQ(e.getUTCHours()%12||12,t,2)}function TL(e,t){return AQ(1+AM.count(Ah(e),e),t,3)}function TI(e,t){return AQ(e.getUTCMilliseconds(),t,3)}function TR(e,t){return TI(e,t)+"000"}function TB(e,t){return AQ(e.getUTCMonth()+1,t,2)}function Tz(e,t){return AQ(e.getUTCMinutes(),t,2)}function TF(e,t){return AQ(e.getUTCSeconds(),t,2)}function TV(e){var t=e.getUTCDay();return 0===t?7:t}function TU(e,t){return AQ(Ak.count(Ah(e)-1,e),t,2)}function TH(e){var t=e.getUTCDay();return t>=4||0===t?AS(e):AS.ceil(e)}function TW(e,t){return e=TH(e),AQ(AS.count(Ah(e),e)+(4===Ah(e).getUTCDay()),t,2)}function TY(e){return e.getUTCDay()}function TG(e,t){return AQ(AE.count(Ah(e)-1,e),t,2)}function TX(e,t){return AQ(e.getUTCFullYear()%100,t,2)}function T$(e,t){return AQ((e=TH(e)).getUTCFullYear()%100,t,2)}function Tq(e,t){return AQ(e.getUTCFullYear()%1e4,t,4)}function TK(e,t){var n=e.getUTCDay();return AQ((e=n>=4||0===n?AS(e):AS.ceil(e)).getUTCFullYear()%1e4,t,4)}function TZ(){return"+0000"}function TQ(){return"%"}function TJ(e){return+e}function T0(e){return Math.floor(e/1e3)}function T1(e){return new Date(e)}function T2(e){return e instanceof Date?+e:+new Date(+e)}function T5(e,t,n,r,i,a,o,s,l,c){var u=SA(),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,T2)):h().map(T1)},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(SW(n,e)):u},u.copy=function(){return S_(u,T5(e,t,n,r,i,a,o,s,l,c))},u}function T3(){return _b.apply(T5(AH,AW,Ad,Af,Am,AO,AD,AI,AB,H).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function T4(){return _b.apply(T5(AV,AU,Ah,Ap,Ak,AM,AL,AR,AB,W).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function T6(){var e,t,n,r,i,a=0,o=1,s=SN,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(Sy),c.rangeRound=u(Sb),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 T8(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function T7(){var e=SV(T6()(SN));return e.copy=function(){return T8(e,T7())},_w.apply(e,arguments)}function T9(){var e=SZ(T6()).domain([1,10]);return e.copy=function(){return T8(e,T9()).base(e.base())},_w.apply(e,arguments)}function Oe(){var e=S1(T6());return e.copy=function(){return T8(e,Oe()).constant(e.constant())},_w.apply(e,arguments)}function Ot(){var e=S6(T6());return e.copy=function(){return T8(e,Ot()).exponent(e.exponent())},_w.apply(e,arguments)}function On(){return Ot.apply(null,arguments).exponent(.5)}function Or(){var e=[],t=SN;function n(n){if(null!=n&&!isNaN(n*=1))return t((_U(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(_I),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 An(e);if(t>=1)return At(e);var n,r=(n-1)*t,i=Math.floor(r),a=At((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?Ar:function(e=_I){if(e===_I)return Ar;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(Ai(t,r,n),a(t[i],o)>0&&Ai(t,r,i);s<l;){for(Ai(t,s,l),++s,--l;0>a(t[s],o);)++s;for(;a(t[l],o)>0;)--l}0===a(t[r],o)?Ai(t,r,l):Ai(t,++l,i),l<=n&&(r=l+1),n<=l&&(i=l-1)}return t})(e,i).subarray(0,i+1));return a+(An(e.subarray(i+1))-a)*(r-i)}})(e,r/t))},n.copy=function(){return Or(t).domain(e)},_w.apply(n,arguments)}function Oi(){var e,t,n,r,i,a,o,s=0,l=.5,c=1,u=1,d=SN,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=Sy);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(Sy),f.rangeRound=p(Sb),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 Oa(){var e=SV(Oi()(SN));return e.copy=function(){return T8(e,Oa())},_w.apply(e,arguments)}function Oo(){var e=SZ(Oi()).domain([.1,1,10]);return e.copy=function(){return T8(e,Oo()).base(e.base())},_w.apply(e,arguments)}function Os(){var e=S1(Oi());return e.copy=function(){return T8(e,Os()).constant(e.constant())},_w.apply(e,arguments)}function Ol(){var e=S6(Oi());return e.copy=function(){return T8(e,Ol()).exponent(e.exponent())},_w.apply(e,arguments)}function Oc(){return Ol.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=A0(i),u=A1(i),d=A0(a),h=A1(a),f=A0(o),p=A1(o),g=A0(s),v=A1(s),x=A0(l),y=A1(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:Th,e:Th,f:Tv,g:TS,G:TT,H:Tf,I:Tp,j:Tg,L:Tm,m:Tx,M:Ty,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:TJ,s:T0,S:Tb,u:Tw,U:Tj,V:Tk,w:TE,W:TC,x:null,X:null,y:T_,Y:TA,Z:TO,"%":TQ},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:TM,e:TM,f:TR,g:T$,G:TK,H:TP,I:TD,j:TL,L:TI,m:TB,M:Tz,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:TJ,s:T0,S:TF,u:TV,U:TU,V:TW,w:TY,W:TG,x:null,X:null,y:TX,Y:Tq,Z:TZ,"%":TQ},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:Tn,e:Tn,f:Tl,g:A7,G:A8,H:Ti,I:Ti,j:Tr,L:Ts,m:Tt,M:Ta,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:Te,Q:Tu,s:Td,S:To,u:A5,U:A3,V:A4,w:A2,W:A6,x:function(e,t,r){return E(e,n,t,r)},X:function(e,t,n){return E(e,r,t,n)},y:A7,Y:A8,Z:A9,"%":Tc};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=A$[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=AX(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=AG(AX(a.y,0,1))).getUTCDay())>4||0===i?AE.ceil(r):AE(r),r=AM.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=AY(AX(a.y,0,1))).getDay())>4||0===i?Av.ceil(r):Av(r),r=AO.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?AG(AX(a.y,0,1)).getUTCDay():AY(AX(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,AG(a)):AY(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 A$?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,__,"scaleDiverging",0,Oa,"scaleDivergingLog",0,Oo,"scaleDivergingPow",0,Ol,"scaleDivergingSqrt",0,Oc,"scaleDivergingSymlog",0,Os,"scaleIdentity",0,SH,"scaleImplicit",0,_E,"scaleLinear",0,SU,"scaleLog",0,SQ,"scaleOrdinal",0,_C,"scalePoint",0,_S,"scalePow",0,S8,"scaleQuantile",0,Aa,"scaleQuantize",0,Ao,"scaleRadial",0,Ae,"scaleSequential",0,T7,"scaleSequentialLog",0,T9,"scaleSequentialPow",0,Ot,"scaleSequentialQuantile",0,Or,"scaleSequentialSqrt",0,On,"scaleSequentialSymlog",0,Oe,"scaleSqrt",0,S7,"scaleSymlog",0,S2,"scaleThreshold",0,As,"scaleTime",0,T3,"scaleUtc",0,T4,"tickFormat",0,SF],29061),e.i(29061),e.s(["scaleBand",0,__,"scaleDiverging",0,Oa,"scaleDivergingLog",0,Oo,"scaleDivergingPow",0,Ol,"scaleDivergingSqrt",0,Oc,"scaleDivergingSymlog",0,Os,"scaleIdentity",0,SH,"scaleImplicit",0,_E,"scaleLinear",0,SU,"scaleLog",0,SQ,"scaleOrdinal",0,_C,"scalePoint",0,_S,"scalePow",0,S8,"scaleQuantile",0,Aa,"scaleQuantize",0,Ao,"scaleRadial",0,Ae,"scaleSequential",0,T7,"scaleSequentialLog",0,T9,"scaleSequentialPow",0,Ot,"scaleSequentialQuantile",0,Or,"scaleSequentialSqrt",0,On,"scaleSequentialSymlog",0,Oe,"scaleSqrt",0,S7,"scaleSymlog",0,S2,"scaleThreshold",0,As,"scaleTime",0,T3,"scaleUtc",0,T4,"tickFormat",0,SF],79357);var Ou=e.i(79357),Od=e=>e.chartData,Oh=N0([Od],e=>{var t=null!=e.chartData?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Of=(e,t,n,r)=>r?Oh(e):Od(e);function Op(e){if(Array.isArray(e)&&2===e.length){var[t,n]=e;if(CD(t)&&CD(n))return!0}return!1}function Og(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function Om(e,t){if(t&&"function"!=typeof e&&Array.isArray(e)&&2===e.length){var n,r,[i,a]=e;if(CD(i))n=i;else if("function"==typeof i)return;if(CD(a))r=a;else if("function"==typeof a)return;var o=[n,r];if(Op(o))return o}}var Ov=e.i(51655),Ox=e=>e,Oy={},Ob=e=>function t(){let n;return 0==arguments.length||1==arguments.length&&(n=arguments.length<=0?void 0:arguments[0],n===Oy)?t:e(...arguments)},Ow=(e,t)=>1===e?t:Ob(function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var a=r.filter(e=>e!==Oy).length;return a>=e?t(...r):Ow(e-a,Ob(function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t(...r.map(e=>e===Oy?n.shift():e),...n)}))}),Oj=(e,t)=>{for(var n=[],r=e;r<t;++r)n[r-e]=r;return n},ON=Ow((a=(e,t)=>Array.isArray(t)?t.map(e):Object.keys(t).map(e=>t[e]).map(e)).length,a),Ok=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.length)return Ox;var r=t.reverse(),i=r[0],a=r.slice(1);return function(){return a.reduce((e,t)=>t(e),i(...arguments))}};function OE(e){return 0===e?1:Math.floor(new Ov.default(e).abs().log(10).toNumber())+1}function OC(e,t,n){for(var r=new Ov.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var O_=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},OS=(e,t,n)=>{if(e.lte(0))return new Ov.default(0);var r=OE(e.toNumber()),i=new Ov.default(10).pow(r),a=e.div(i),o=1!==r?.05:.1,s=new Ov.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return new Ov.default(t?s.toNumber():Math.ceil(s.toNumber()))},OA=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 Ov.default(0),tickMin:new Ov.default(0),tickMax:new Ov.default(0)};var o=OS(new Ov.default(t).sub(e).div(n-1),r,a),s=Math.ceil((i=e<=0&&t>=0?new Ov.default(0):(i=new Ov.default(e).add(t).div(2)).sub(new Ov.default(i).mod(o))).sub(e).div(o).toNumber()),l=Math.ceil(new Ov.default(t).sub(i).div(o).toNumber()),c=s+l+1;return c>n?OA(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 Ov.default(s).mul(o)),tickMax:i.add(new Ov.default(l).mul(o))})},OT=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]=O_([t,n]);if(o===-1/0||s===1/0){var l=s===1/0?[o,...Oj(0,r-1).map(()=>1/0)]:[...Oj(0,r-1).map(()=>-1/0),s];return t>n?l.reverse():l}if(o===s){var c=new Ov.default(1),u=new Ov.default(o);if(!u.isint()&&i){var d=Math.abs(o);d<1?(c=new Ov.default(10).pow(OE(o)-1),u=new Ov.default(Math.floor(u.div(c).toNumber())).mul(c)):d>1&&(u=new Ov.default(Math.floor(o)))}else 0===o?u=new Ov.default(Math.floor((r-1)/2)):i||(u=new Ov.default(Math.floor(o)));var h=Math.floor((r-1)/2);return Ok(ON(e=>u.add(new Ov.default(e-h).mul(c)).toNumber()),Oj)(0,r)}var{step:f,tickMin:p,tickMax:g}=OA(o,s,a,i,0),v=OC(p,g.add(new Ov.default(.1).mul(f)),f);return t>n?v.reverse():v},OO=function(e,t){var[n,r]=e,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],[a,o]=O_([n,r]);if(a===-1/0||o===1/0)return[n,r];if(a===o)return[a];var s=Math.max(t,2),l=OS(new Ov.default(o).sub(a).div(s-1),i,0),c=[...OC(new Ov.default(a),new Ov.default(o),l),o];return!1===i&&(c=c.map(e=>Math.round(e))),n>r?c.reverse():c},OM=e=>e.rootProps.stackOffset,OP=e=>e.rootProps.reverseStackOrder,OD=e=>e.options.chartName,OL=e=>e.rootProps.syncId,OI=e=>e.rootProps.syncMethod,OR=e=>e.options.eventEmitter;function OB(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 Oz(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?OB(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)):OB(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var OF=Math.PI/180,OV=(e,t,n,r)=>({x:e+Math.cos(-OF*r)*n,y:t+Math.sin(-OF*r)*n}),OU={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},OH={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:OU.axis},OW={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:OU.axis},OY=(e,t)=>{if(e&&t)return null!=e&&e.reversed?[t[1],t[0]]:t},OG={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:OH.angleAxisId,includeHidden:!1,name:void 0,reversed:OH.reversed,scale:OH.scale,tick:OH.tick,tickCount:void 0,ticks:void 0,type:OH.type,unit:void 0},OX={allowDataOverflow:OW.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:OW.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:OW.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:OW.scale,tick:OW.tick,tickCount:OW.tickCount,ticks:void 0,type:OW.type,unit:void 0},O$={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:OH.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:OH.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:OH.scale,tick:OH.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},Oq={allowDataOverflow:OW.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:OW.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:OW.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:OW.scale,tick:OW.tick,tickCount:OW.tickCount,ticks:void 0,type:"category",unit:void 0},OK=(e,t)=>null!=e.polarAxis.angleAxis[t]?e.polarAxis.angleAxis[t]:"radial"===e.layout.layoutType?O$:OG,OZ=(e,t)=>null!=e.polarAxis.radiusAxis[t]?e.polarAxis.radiusAxis[t]:"radial"===e.layout.layoutType?Oq:OX,OQ=e=>e.polarOptions,OJ=N0([CX,C$,C1],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}),O0=N0([OQ,OJ],(e,t)=>{if(null!=e)return k5(e.innerRadius,t,0)}),O1=N0([OQ,OJ],(e,t)=>{if(null!=e)return k5(e.outerRadius,t,.8*t)}),O2=N0([OQ],e=>{if(null==e)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});N0([OK,O2],OY);var O5=N0([OJ,O0,O1],(e,t,n)=>{if(null!=e&&null!=t&&null!=n)return[t,n]});N0([OZ,O5],OY);var O3=N0([_v,OQ,O0,O1,CX,C$],(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:k5(o,i,i/2),cy:k5(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),O4=(e,t)=>t,O6=(e,t,n)=>n;function O8(e){return null==e?void 0:e.id}function O7(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=O8(e);n.forEach((t,n)=>{var r,l=null==a||i?n:String(CB(t,a,null)),c=CB(t,e.dataKey,0);Object.assign(r=o.has(l)?o.get(l):{},{[s]:c}),o.set(l,r)})}}),Array.from(o.values())}function O9(e){return"stackId"in e&&null!=e.stackId&&null!=e.dataKey}var Me=(e,t)=>e===t||null!=e&&null!=t&&e[0]===t[0]&&e[1]===t[1];function Mt(e,t){return!!(Array.isArray(e)&&Array.isArray(t))&&0===e.length&&0===t.length||e===t}var Mn=e=>{var t=_v(e);return"horizontal"===t?"xAxis":"vertical"===t?"yAxis":"centric"===t?"angleAxis":"radiusAxis"},Mr=e=>e.tooltip.settings.axisId;function Mi(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 Ma(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mi(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)):Mi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Mo=[0,"auto"],Ms={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},Ml=(e,t)=>e.cartesianAxis.xAxis[t],Mc=(e,t)=>{var n=Ml(e,t);return null==n?Ms:n},Mu={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Mo,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},Md=(e,t)=>{var n=e.cartesianAxis.yAxis[t];return null==n?Mu:n},Mh={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:""},Mf=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return null==n?Mh:n},Mp=(e,t,n)=>{switch(t){case"xAxis":return Mc(e,n);case"yAxis":return Md(e,n);case"zAxis":return Mf(e,n);case"angleAxis":return OK(e,n);case"radiusAxis":return OZ(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Mg=(e,t,n)=>{switch(t){case"xAxis":return Mc(e,n);case"yAxis":return Md(e,n);case"angleAxis":return OK(e,n);case"radiusAxis":return OZ(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Mm=e=>e.graphicalItems.cartesianItems.some(e=>"bar"===e.type)||e.graphicalItems.polarItems.some(e=>"radialBar"===e.type);function Mv(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 Mx=e=>e.graphicalItems.cartesianItems,My=N0([O4,O6],Mv),Mb=(e,t,n)=>e.filter(n).filter(e=>(null==t?void 0:t.includeHidden)===!0||!e.hide),Mw=N0([Mx,Mp,My],Mb,{memoizeOptions:{resultEqualityCheck:Mt}}),Mj=N0([Mw],e=>e.filter(e=>"area"===e.type||"bar"===e.type).filter(O9)),MN=e=>e.filter(e=>!("stackId"in e)||void 0===e.stackId),Mk=N0([Mw],MN),ME=e=>e.map(e=>e.data).filter(Boolean).flat(1),MC=N0([Mw],ME,{memoizeOptions:{resultEqualityCheck:Mt}}),M_=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},MS=N0([MC,Of],M_),MA=(e,t,n)=>(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:CB(e,t.dataKey)})):n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:CB(e,t)}))):e.map(e=>({value:e})),MT=N0([MS,Mp,Mw],MA);function MO(e,t){switch(e){case"xAxis":return"x"===t.direction;case"yAxis":return"y"===t.direction;default:return!1}}function MM(e){if(k0(e)||e instanceof Date){var t=Number(e);if(CD(t))return t}}function MP(e){if(Array.isArray(e)){var t=[MM(e[0]),MM(e[1])];return Op(t)?t:void 0}var n=MM(e);if(null!=n)return[n,n]}function MD(e){return e.map(MM).filter(k7)}var ML=e=>{var t=Mn(e),n=Mr(e);return Mg(e,t,n)},MI=N0([ML],e=>null==e?void 0:e.dataKey),MR=N0([Mj,Of,ML],O7),MB=(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(O8);return[s,{stackedData:(a=null!=(i=CF[n])?i:CA,(o=(function(){var e=CS([]),t=CT,n=CA,r=CO;function i(i){var a,o,s=Array.from(e.apply(this,arguments),CM),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=C_(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:CS(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r="function"==typeof e?e:CS(+e),i):r},i.order=function(e){return arguments.length?(t=null==e?CT:"function"==typeof e?e:CS(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=null==e?CA:e,i):n},i})().keys(u).value((e,t)=>Number(CB(e,t,0))).order(CT).offset(a)(e)).forEach((t,n)=>{t.forEach((t,r)=>{var i=CB(e[r],u[n],0);Array.isArray(i)&&2===i.length&&kJ(i[0])&&kJ(i[1])&&(t[0]=i[0],t[1]=i[1])})}),o),graphicalItems:c}]})),Mz=N0([MR,Mj,OM,OP],MB),MF=(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=CP(r,t,n).flat(2).filter(kJ)),Math.max(...i)];return CD(a[0])&&CD(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}},MV=N0([Mp],e=>e.allowDataOverflow),MU=e=>{var t;if(null==e||!("domain"in e))return Mo;if(null!=e.domain)return e.domain;if("ticks"in e&&null!=e.ticks){if("number"===e.type){var n=MD(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:Mo},MH=N0([Mp],MU),MW=N0([MH,MV],Om),MY=N0([Mz,Od,O4,MW],MF,{memoizeOptions:{resultEqualityCheck:Me}}),MG=e=>e.errorBars,MX=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)]}},M$=(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=>MO(i,e)),u=CB(e,null!=(l=t.dataKey)?l:n.dataKey),d=!(!c||"number"!=typeof u||kZ(u))&&c.length?MD(c.flatMap(t=>{var n,r,i=CB(e,t.dataKey);if(Array.isArray(i)?[n,r]=i:n=r=i,CD(n)&&CD(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=MP(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=MP(CB(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]))}),CD(a)&&CD(o))return[a,o]},Mq=N0([MS,Mp,Mk,MG,O4],M$,{memoizeOptions:{resultEqualityCheck:Me}});function MK(e){var{value:t}=e;if(k0(t)||t instanceof Date)return t}var MZ=e=>e.referenceElements.dots,MQ=(e,t,n)=>e.filter(e=>"extendDomain"===e.ifOverflow).filter(e=>"xAxis"===t?e.xAxisId===n:e.yAxisId===n),MJ=N0([MZ,O4,O6],MQ),M0=e=>e.referenceElements.areas,M1=N0([M0,O4,O6],MQ),M2=e=>e.referenceElements.lines,M5=N0([M2,O4,O6],MQ),M3=(e,t)=>{if(null!=e){var n=MD(e.map(e=>"xAxis"===t?e.x:e.y));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},M4=N0(MJ,O4,M3),M6=(e,t)=>{if(null!=e){var n=MD(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)]}},M8=N0([M1,O4],M6),M7=(e,t)=>{if(null!=e){var n=e.flatMap(e=>"xAxis"===t?function(e){if(null!=e.x)return MD([e.x]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.x);return null==n||0===n.length?[]:MD(n)}(e):function(e){if(null!=e.y)return MD([e.y]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.y);return null==n||0===n.length?[]:MD(n)}(e));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},M9=N0([M5,O4],M7),Pe=N0(M4,M9,M8,(e,t,n)=>MX(e,n,t)),Pt=(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(Op(r))return Og(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(kJ(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&&CU.test(o)){var l=CU.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(kJ(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&&CH.test(s)){var u=CH.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(Op(h))return null==t?h:Og(h,t,n)}}}(t,"vertical"===o&&"xAxis"===s||"horizontal"===o&&"yAxis"===s?MX(r,a,i):MX(a,i),e.allowDataOverflow),Pn=N0([Mp,MH,MW,MY,Mq,Pe,_v,O4],Pt,{memoizeOptions:{resultEqualityCheck:Me}}),Pr=[0,1],Pi=(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=Cz(t,a);return d&&null==c?(0,_y.default)(0,null!=(l=null==n?void 0:n.length)?l:0):"category"===u?(s=r.map(MK).filter(e=>null!=e),d&&(null==e.dataKey||e.allowDuplicatedCategory&&k3(s))?(0,_y.default)(0,r.length):e.allowDuplicatedCategory?s:Array.from(new Set(s))):"expand"===i?Pr:o}},Pa=N0([Mp,_v,MS,MT,OM,O4,Pn],Pi),Po=(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(k8(a));return s in Ou?s:"point"}}},Ps=N0([Mp,_v,Mm,OD,O4],Po);function Pl(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 Ou)return Ou[e]();var t="scale".concat(k8(e));if(t in Ou)return Ou[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 Pc=(e,t,n)=>{var r=MU(t);if("auto"===n||"linear"===n){if(null!=t&&t.tickCount&&Array.isArray(r)&&("auto"===r[0]||"auto"===r[1])&&Op(e))return OT(e,t.tickCount,t.allowDecimals);if(null!=t&&t.tickCount&&"number"===t.type&&Op(e))return OO(e,t.tickCount,t.allowDecimals)}},Pu=N0([Pa,Mg,Ps],Pc),Pd=(e,t,n,r)=>"angleAxis"!==r&&(null==e?void 0:e.type)==="number"&&Op(t)&&Array.isArray(n)&&n.length>0?[Math.min(t[0],n[0]),Math.max(t[1],n[n.length-1])]:t,Ph=N0([Mp,Pa,Pu,O4],Pd),Pf=N0(MT,Mp,(e,t)=>{if(t&&"number"===t.type){var n=1/0,r=Array.from(MD(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}}),Pp=N0(Pf,_v,e=>e.rootProps.barCategoryGap,C1,(e,t,n,r,i)=>i,(e,t,n,r,i)=>{if(!CD(e))return 0;var a="vertical"===t?r.height:r.width;if("gap"===i)return e*a/2;if("no-gap"===i){var o=k5(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),Pg=N0(Mc,(e,t,n)=>{var r=Mc(e,t);return null==r||"string"!=typeof r.padding?0:Pp(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}}),Pm=N0(Md,(e,t,n)=>{var r=Md(e,t);return null==r||"string"!=typeof r.padding?0:Pp(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}}),Pv=N0([C1,Pg,C8,C6,(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]}),Px=N0([C1,_v,Pm,C8,C6,(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]}),Py=(e,t,n,r)=>{var i;switch(t){case"xAxis":return Pv(e,n,r);case"yAxis":return Px(e,n,r);case"zAxis":return null==(i=Mf(e,n))?void 0:i.range;case"angleAxis":return O2(e);case"radiusAxis":return O5(e,n);default:return}},Pb=N0([Mp,Py],OY),Pw=N0([Mp,Ps,Ph,Pb],Pl);function Pj(e,t){return e.id<t.id?-1:+(e.id>t.id)}N0([Mw,MG,O4],(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>MO(n,e)));var PN=(e,t)=>t,Pk=(e,t,n)=>n,PE=N0(CZ,PN,Pk,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Pj)),PC=N0(CQ,PN,Pk,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Pj)),P_=(e,t)=>({width:e.width,height:t.height}),PS=N0(C1,Mc,P_),PA=N0(C$,C1,PE,PN,Pk,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s=P_(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}),PT=N0(CX,C1,PC,PN,Pk,(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}),PO=N0([C1,Mc,(e,t)=>{var n=Mc(e,t);if(null!=n)return PA(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}}});N0([C1,Md,(e,t)=>{var n=Md(e,t);if(null!=n)return PT(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}}}),N0(C1,Md,(e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height}));var PM=(e,t,n,r)=>{if(null!=n){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=Cz(e,r),l=t.map(e=>e.value);if(o&&s&&"category"===a&&i&&k3(l))return l}},PP=N0([_v,MT,Mp,O4],PM),PD=(e,t,n,r)=>{if(null!=n&&null!=n.dataKey){var{type:i,scale:a}=n;if(Cz(e,r)&&("number"===i||"auto"!==a))return t.map(e=>e.value)}},PL=N0([_v,MT,Mg,O4],PD);N0([_v,(e,t,n)=>{switch(t){case"xAxis":return Mc(e,n);case"yAxis":return Md(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Ps,Pw,PP,PL,Py,Pu,O4],(e,t,n,r,i,a,o,s,l)=>{if(null!=t){var c=Cz(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}}});var PI=N0([_v,Mg,Ps,Pw,Pu,Py,PP,PL,O4],(e,t,n,r,i,a,o,s,l)=>{if(null!=t&&null!=r){var c=Cz(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*kK(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=>CD(e.coordinate)):c&&s?s.map((e,t)=>({coordinate:r(e)+p,value:e,index:t,offset:p})).filter(e=>CD(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}))}}),PR=N0([_v,Mg,Pw,Py,PP,PL,O4],(e,t,n,r,i,a,o)=>{if(null!=t&&null!=n&&null!=r&&r[0]!==r[1]){var s=Cz(e,o),{tickCount:l}=t,c=0;return(c="angleAxis"===o&&(null==r?void 0:r.length)>=2?2*kK(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}))}}),PB=N0(Mp,Pw,(e,t)=>{if(null!=e&&null!=t)return Ma(Ma({},e),{},{scale:t})}),Pz=N0([Mp,Ps,Pa,Pb],Pl);N0((e,t,n)=>Mf(e,n),Pz,(e,t)=>{if(null!=e&&null!=t)return Ma(Ma({},e),{},{scale:t})});var PF=N0([_v,CZ,CQ],(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}}),PV=e=>e.options.defaultTooltipEventType,PU=e=>e.options.validateTooltipEventTypes;function PH(e,t,n){if(null==e)return t;var r=e?"axis":"item";return null==n?t:n.includes(r)?r:t}function PW(e,t){return PH(t,PV(e),PU(e))}var PY=(e,t)=>{var n,r=Number(t);if(!kZ(r)&&null!=t)return r>=0?null==e||null==(n=e[r])?void 0:n.value:void 0};function PG(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 PX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?PG(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)):PG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var P$=(e,t,n,r)=>{if(null==t)return E1;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 E1;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 PX(PX({},s),{},{active:!0})}else if(null!=r)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return PX(PX({},E1),{},{coordinate:s.coordinate})},Pq=(e,t,n,r)=>{var i=null==e?void 0:e.index;if(null==i)return null;var a=Number(i);if(!CD(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=CB(e,t);return!(null!=r&&Op(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)},PK=(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}}},PZ=(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})},PQ=e=>e.options.tooltipPayloadSearcher,PJ=e=>e.tooltip;function P0(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 P1(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P0(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)):P0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var P2=(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)?CP(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?k6(x,r,i):a(x,t,l,b))?h.forEach(t=>{var n=P1(P1({},g),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(CY({tooltipEntrySettings:n,dataKey:t.dataKey,payload:t.payload,value:CB(t.payload,t.dataKey),name:t.name}))}):e.push(CY({tooltipEntrySettings:g,dataKey:y,payload:h,value:CB(h,y),name:null!=(f=CB(h,b))?f:null==g?void 0:g.name})),e},[])}},P5=N0([ML,_v,Mm,OD,Mn],Po),P3=N0([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),P4=N0([Mn,Mr],Mv),P6=N0([P3,ML,P4],Mb,{memoizeOptions:{resultEqualityCheck:Mt}}),P8=N0([P6],e=>e.filter(O9)),P7=N0([P6],ME,{memoizeOptions:{resultEqualityCheck:Mt}}),P9=N0([P7,Od],M_),De=N0([P8,Od,ML],O7),Dt=N0([P9,ML,P6],MA),Dn=N0([ML],MU),Dr=N0([ML],e=>e.allowDataOverflow),Di=N0([Dn,Dr],Om),Da=N0([P6],e=>e.filter(O9)),Do=N0([De,Da,OM,OP],MB),Ds=N0([Do,Od,Mn,Di],MF),Dl=N0([P6],MN),Dc=N0([P9,ML,Dl,MG,Mn],M$,{memoizeOptions:{resultEqualityCheck:Me}}),Du=N0([MZ,Mn,Mr],MQ),Dd=N0([Du,Mn],M3),Dh=N0([M0,Mn,Mr],MQ),Df=N0([Dh,Mn],M6),Dp=N0([M2,Mn,Mr],MQ),Dg=N0([Dp,Mn],M7),Dm=N0([Dd,Dg,Df],MX),Dv=N0([ML,Dn,Di,Ds,Dc,Dm,_v,Mn],Pt),Dx=N0([ML,_v,P9,Dt,OM,Mn,Dv],Pi),Dy=N0([Dx,ML,P5],Pc),Db=N0([ML,Dx,Dy,Mn],Pd),Dw=e=>{var t=Mn(e),n=Mr(e);return Py(e,t,n,!1)},Dj=N0([ML,Dw],OY),DN=N0([ML,P5,Db,Dj],Pl),Dk=N0([_v,Dt,ML,Mn],PM),DE=N0([_v,Dt,ML,Mn],PD),DC=N0([_v,ML,P5,DN,Dw,Dk,DE,Mn],(e,t,n,r,i,a,o,s)=>{if(t){var{type:l}=t,c=Cz(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*kK(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}))}}}),D_=N0([PV,PU,e=>e.tooltip.settings],(e,t,n)=>PH(n.shared,e,t)),DS=e=>e.tooltip.settings.trigger,DA=e=>e.tooltip.settings.defaultIndex,DT=N0([PJ,D_,DS,DA],P$),DO=N0([DT,P9,MI,Dx],Pq),DM=N0([DC,DO],PY),DP=N0([DT],e=>{if(e)return e.dataKey});N0([DT],e=>{if(e)return e.graphicalItemId});var DD=N0([PJ,D_,DS,DA],PZ),DL=N0([CX,C$,_v,C1,DC,DA,DD,PQ],PK),DI=N0([DT,DL],(e,t)=>null!=e&&e.coordinate?e.coordinate:t),DR=N0([DT],e=>{var t;return null!=(t=null==e?void 0:e.active)&&t}),DB=N0([DD,DO,Od,MI,DM,PQ,D_],P2),Dz=N0([DB],e=>{if(null!=e)return Array.from(new Set(e.map(e=>e.payload).filter(e=>null!=e)))});function DF(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 DV(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?DF(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)):DF(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var DU=(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(kK(l-s)!==kK(c-l)){var d,h,f,p,g,v,x,y=[];if(kK(c-l)===kK(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],A=t[C-1];if(0===C&&null!=S&&e<=(_.coordinate+S.coordinate)/2||C===a-1&&null!=A&&e>(_.coordinate+A.coordinate)/2||C>0&&C<a-1&&null!=A&&null!=S&&e>(_.coordinate+A.coordinate)/2&&e<=(_.coordinate+S.coordinate)/2)return _.index}}return -1},DH=(e,t)=>t,DW=(e,t,n)=>n,DY=(e,t,n,r)=>r,DG=N0(DC,e=>(0,CE.default)(e,e=>e.coordinate)),DX=N0([PJ,DH,DW,DY],P$),D$=N0([DX,P9,MI,Dx],Pq),Dq=N0([PJ,DH,DW,DY],PZ),DK=N0([CX,C$,_v,C1,DC,DY,Dq,PQ],PK),DZ=N0([DX,DK],(e,t)=>{var n;return null!=(n=e.coordinate)?n:t}),DQ=N0([DC,D$],PY),DJ=N0([Dq,D$,Od,MI,DQ,PQ,DH],P2),D0=N0([DX,D$],(e,t)=>({isActive:e.active&&null!=t,activeIndex:t})),D1=N0([(e,t)=>t,_v,O3,Mn,Dj,DC,DG,C1],(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=DU("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?Oz(Oz({},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=DU("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 DV(DV(DV({},r),OV(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:l}=r;return DV(DV(DV({},r),OV(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}}}),D2=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)}},D5=kr("mouseClick"),D3=kY();D3.startListening({actionCreator:D5,effect:(e,t)=>{var n=e.payload,r=D1(t.getState(),D2(n));(null==r?void 0:r.activeIndex)!=null&&t.dispatch(Cn({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var D4=kr("mouseMove"),D6=kY(),D8=null;function D7(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 D9(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 Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D9(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)):D9(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}D6.startListening({actionCreator:D4,effect:(e,t)=>{var n=e.payload;null!==D8&&cancelAnimationFrame(D8);var r=D2(n);D8=requestAnimationFrame(()=>{var e=t.getState();if("axis"===PW(e,e.tooltip.settings.shared)){var n=D1(e,r);(null==n?void 0:n.activeIndex)!=null?t.dispatch(Ct({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate})):t.dispatch(E9())}D8=null})}});var Lt=kp({name:"cartesianAxis",initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:kl()},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:kl()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:kl()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:kl()},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:kl()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:kl()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:kl()},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:kl()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:kl()},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]=Le(Le({},e.yAxis[n]),{},{width:r,widthHistory:o})}}}}),{addXAxis:Ln,replaceXAxis:Lr,removeXAxis:Li,addYAxis:La,replaceYAxis:Lo,removeYAxis:Ls,addZAxis:Ll,replaceZAxis:Lc,removeZAxis:Lu,updateYAxisWidth:Ld}=Lt.actions,Lh=Lt.reducer,Lf=kp({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:kl()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NL(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:kl()},removeCartesianGraphicalItem:{reducer(e,t){var n=NL(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:kl()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:kl()},removePolarGraphicalItem:{reducer(e,t){var n=NL(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:kl()}}}),{addCartesianGraphicalItem:Lp,replaceCartesianGraphicalItem:Lg,removeCartesianGraphicalItem:Lm,addPolarGraphicalItem:Lv,removePolarGraphicalItem:Lx}=Lf.actions,Ly=Lf.reducer,Lb=kp({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=NL(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=NL(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=NL(e).lines.findIndex(e=>e===t.payload);-1!==n&&e.lines.splice(n,1)}}}),{addDot:Lw,removeDot:Lj,addArea:LN,removeArea:Lk,addLine:LE,removeLine:LC}=Lb.actions,L_=Lb.reducer,LS={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},LA=kp({name:"brush",initialState:LS,reducers:{setBrushSettings:(e,t)=>null==t.payload?LS:t.payload}}),{setBrushSettings:LT}=LA.actions,LO=LA.reducer,LM=kp({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:kl()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NL(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:kl()},removeLegendPayload:{reducer(e,t){var n=NL(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:kl()}}}),{setLegendSize:LP,setLegendSettings:LD,addLegendPayload:LL,replaceLegendPayload:LI,removeLegendPayload:LR}=LM.actions,LB=LM.reducer,Lz={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},LF=kp({name:"rootProps",initialState:Lz,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=null!=(n=t.payload.barGap)?n:Lz.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}}}),LV=LF.reducer,{updateOptions:LU}=LF.actions,LH=kp({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:LW,removeRadiusAxis:LY,addAngleAxis:LG,removeAngleAxis:LX}=LH.actions,L$=LH.reducer,Lq=kp({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:LK}=Lq.actions,LZ=Lq.reducer,LQ=kr("keyDown"),LJ=kr("focus"),L0=kY();L0.startListening({actionCreator:LQ,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=Pq(r,P9(n),MI(n),Dx(n)),o=null==a?-1:Number(a);if(Number.isFinite(o)&&!(o<0)){var s=DC(n);if("Enter"===i){var l=DK(n,"axis","hover",String(r.index));t.dispatch(Ci({active:!r.active,activeIndex:r.index,activeCoordinate:l}));return}var c=o+("ArrowRight"===i?1:-1)*("left-to-right"===PF(n)?1:-1);if(null!=s&&!(c>=s.length)&&!(c<0)){var u=DK(n,"axis","hover",String(c));t.dispatch(Ci({active:!0,activeIndex:c.toString(),activeCoordinate:u}))}}}}}),L0.startListening({actionCreator:LJ,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=DK(n,"axis","hover",String("0"));t.dispatch(Ci({active:!0,activeIndex:"0",activeCoordinate:i}))}}}});var L1=kr("externalEvent"),L2=kY(),L5=new Map;L2.startListening({actionCreator:L1,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(null!=n){r.persist();var i=r.type,a=L5.get(i);void 0!==a&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var e=t.getState(),a={activeCoordinate:DI(e),activeDataKey:DP(e),activeIndex:DO(e),activeLabel:DM(e),activeTooltipIndex:DO(e),isTooltipActive:DR(e)};n(a,r)}finally{L5.delete(i)}});L5.set(i,o)}}});var L3=N0([PJ],e=>e.tooltipItemPayloads),L4=N0([L3,PQ,(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)}}),L6=kr("touchMove"),L8=kY();L8.startListening({actionCreator:L6,effect:(e,t)=>{var n=e.payload;if(null!=n.touches&&0!==n.touches.length){var r=t.getState(),i=PW(r,r.tooltip.settings.shared);if("axis"===i){var a=n.touches[0];if(null==a)return;var o=D1(r,D2({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(null==o?void 0:o.activeIndex)!=null&&t.dispatch(Ct({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=P6(r).find(e=>e.id===d);if(null==u||null==h||null==d)return;var{dataKey:f}=h,p=L4(r,u,d);t.dispatch(E8({activeDataKey:f,activeIndex:u,activeCoordinate:p,activeGraphicalItemId:d}))}}}});var L7=kp({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:L9,replaceErrorBar:Ie,removeErrorBar:It}=L7.actions,In=L7.reducer,Ir={devToolsEnabled:!0,isSsr:!("u">typeof window&&window.document&&window.document.createElement&&window.setTimeout)};function Ii(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 Ia(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ii(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)):Ii(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Io={zIndexMap:Object.values(OU).reduce((e,t)=>Ia(Ia({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},Is=new Set(Object.values(OU)),Il=kp({name:"zIndex",initialState:Io,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:kl()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!Is.has(n)&&delete e.zIndexMap[n])},prepare:kl()},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:kl()},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:kl()}}}),{registerZIndexPortal:Ic,unregisterZIndexPortal:Iu,registerZIndexPortalElement:Id,unregisterZIndexPortalElement:Ih}=Il.actions,If=N8({brush:LO,cartesianAxis:Lh,chartData:Cu,errorBars:In,graphicalItems:Ly,layout:Cm,legend:LB,options:En,polarAxis:L$,polarOptions:LZ,referenceElements:L_,rootProps:LV,tooltip:Ca,zIndex:Il.reducer}),Ip=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 ki;return t&&("boolean"==typeof t?a.push(kt):a.push(ke(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(N6(a))t=N8(a);else throw Error(kG(1));n="function"==typeof o?o(i):i();let d=N7;s&&(d=kn({trace:!1,..."object"==typeof s&&s}));let h=(r=function(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(N2(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=N7(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}(...n),function(e){let{autoBatch:t=!0}=e??{},n=new ki(r);return t&&n.push(ku("object"==typeof t?t:void 0)),n});return function e(t,n,r){if("function"!=typeof t)throw Error(N2(2));if("function"==typeof n&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw Error(N2(0));if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw Error(N2(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(N2(3));return a}function h(e){if("function"!=typeof e)throw Error(N2(4));if(c)throw Error(N2(5));let t=!0;u();let n=l++;return s.set(n,e),function(){if(t){if(c)throw Error(N2(6));t=!1,u(),s.delete(n),o=null}}}function f(e){if(!N6(e))throw Error(N2(7));if(void 0===e.type)throw Error(N2(8));if("string"!=typeof e.type)throw Error(N2(17));if(c)throw Error(N2(9));try{c=!0,a=i(a,e)}finally{c=!1}return(o=s).forEach(e=>{e()}),e}return f({type:N4.INIT}),{dispatch:f,subscribe:h,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw Error(N2(10));i=e,f({type:N4.REPLACE})},[N5]:function(){return{subscribe(e){if("object"!=typeof e||null===e)throw Error(N2(11));function t(){e.next&&e.next(d())}return t(),{unsubscribe:h(t)}},[N5](){return this}}}}}(t,c,d(..."function"==typeof u?u(h):h()))}({reducer:If,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([D3.middleware,D6.middleware,L0.middleware,L2.middleware,L8.middleware]),enhancers:e=>{var t=e;return"function"==typeof e&&(t=e()),t.concat(ku({type:"raf"}))},devTools:Ir.devToolsEnabled&&{serialize:{replacer:D7},name:"recharts-".concat(t)}})};function Ig(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=C4(),a=(0,eg.useRef)(null);return i?n:(null==a.current&&(a.current=Ip(t,r)),eg.createElement(Eh,{context:Cx,store:a.current},n))}var Im=e=>{var{chartData:t}=e,n=Cb(),r=C4();return(0,eg.useEffect)(()=>r?()=>{}:(n(Cs(t)),()=>{n(Cs(void 0))}),[t,n,r]),null},Iv=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function Ix(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(Iv.has(n)){if(null==e[n]&&null==t[n])continue;if(!function(e,t){if(El(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])||!El(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 Iy=(0,eg.memo)(function(e){var{layout:t,margin:n}=e,r=Cb(),i=C4();return(0,eg.useEffect)(()=>{i||(r(Cf(t)),r(Ch(n)))},[r,i,t,n]),null},Ix);function Ib(e){var t=Cb();return(0,eg.useEffect)(()=>{t(LU(e))},[t,e]),null}var Iw=()=>{var e;return null==(e=Ck(e=>e.rootProps.accessibilityLayer))||e},Ij=["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 IN(e){return"string"==typeof e&&Ij.includes(e)}var Ik=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 IE(e){return"string"==typeof e&&Ik.has(e)}function IC(e){return"string"==typeof e&&e.startsWith("data-")}function I_(e){if("object"!=typeof e||null===e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IE(n)||IC(n))&&(t[n]=e[n]);return t}function IS(e){return null==e?null:(0,eg.isValidElement)(e)&&"object"==typeof e.props&&null!==e.props?I_(e.props):"object"!=typeof e||Array.isArray(e)?null:I_(e)}function IA(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IE(n)||IC(n)||IN(n))&&(t[n]=e[n]);return t}var IT=["children","width","height","viewBox","className","style","title","desc"];function IO(){return(IO=Object.assign.bind()).apply(null,arguments)}var IM=(0,eg.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,IT),d=a||{width:r,height:i,x:0,y:0},h=(0,C7.clsx)("recharts-surface",o);return eg.createElement("svg",IO({},IA(u),{className:h,width:r,height:i,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height),ref:t}),eg.createElement("title",null,l),eg.createElement("desc",null,c),n)}),IP=N0(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}}),ID=N0(e=>e.zIndex.zIndexMap,e=>Array.from(new Set(Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(OU)))).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 IL(e){var{zIndex:t,isPanorama:n}=e,r=(0,eg.useRef)(null),i=Cb();return(0,eg.useLayoutEffect)(()=>(r.current&&i(Id({zIndex:t,element:r.current,isPanorama:n})),()=>{i(Ih({zIndex:t,isPanorama:n}))}),[i,t,n]),eg.createElement("g",{tabIndex:-1,ref:r})}function II(e){var{children:t,isPanorama:n}=e,r=Ck(ID);if(!r||0===r.length)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return eg.createElement(eg.Fragment,null,i.map(e=>eg.createElement(IL,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>eg.createElement(IL,{key:e,zIndex:e,isPanorama:n})))}var IR=["children"];function IB(){return(IB=Object.assign.bind()).apply(null,arguments)}var Iz={width:"100%",height:"100%",display:"block"},IF=(0,eg.forwardRef)((e,t)=>{var n,r,i=Ck(CX),a=Ck(C$),o=Iw();if(!CL(i)||!CL(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),eg.createElement(IM,IB({},l,{title:c,desc:u,role:r,tabIndex:n,width:i,height:a,style:Iz,ref:t}),s)}),IV=e=>{var{children:t}=e,n=Ck(C8);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return eg.createElement(IM,{width:r,height:i,x:o,y:a},t)},IU=(0,eg.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,IR);return C4()?eg.createElement(IV,null,eg.createElement(II,{isPanorama:!0},n)):eg.createElement(IF,IB({ref:t},r),eg.createElement(II,{isPanorama:!1},n))}),IH=new(e.i(29942)).default,IW="recharts.syncEvent.tooltip",IY="recharts.syncEvent.brush";function IG(e){return e.tooltip.syncInteraction}var IX=["x","y"];function I$(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 Iq(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I$(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)):I$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var IK=(0,eg.createContext)(null),IZ=(0,eg.createContext)(null);function IQ(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(){return(IJ=Object.assign.bind()).apply(null,arguments)}var I0=()=>{var e,t,n,r,i,a,o,s,l,c,u,d;return e=Cb(),(0,eg.useEffect)(()=>{e(Er())},[e]),t=Ck(OL),n=Ck(OR),r=Cb(),i=Ck(OI),a=Ck(DC),o=Ck(_v),s=_g(),l=Ck(e=>e.rootProps.className),(0,eg.useEffect)(()=>{if(null==t)return k9;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,IX),{x:v,y:x,width:y,height:b}=l.payload.sourceViewBox,w=Iq(Iq({},g),{},{x:s.x+(y?(f-v)/y:0)*s.width,y:s.y+(b?(p-x)/b:0)*s.height});r(Iq(Iq({},l),{},{payload:Iq(Iq({},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(Cr({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(Cr({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 IH.on(IW,e),()=>{IH.off(IW,e)}},[l,r,n,t,i,a,o,s]),c=Ck(OL),u=Ck(OR),d=Cb(),(0,eg.useEffect)(()=>{if(null==c)return k9;var e=(e,t,n)=>{u!==n&&c===e&&d(Cl(t))};return IH.on(IY,e),()=>{IH.off(IY,e)}},[d,u,c]),null};function I1(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var I2=(0,eg.forwardRef)((e,t)=>{var n,r,i=(0,eg.useRef)(null),[a,o]=(0,eg.useState)({containerWidth:I1(null==(n=e.style)?void 0:n.width),containerHeight:I1(null==(r=e.style)?void 0:r.height)}),s=(0,eg.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,eg.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,eg.useEffect)(()=>()=>{var e=i.current;null!=e&&e.disconnect()},[s]),eg.createElement(eg.Fragment,null,eg.createElement(_x,{width:a.containerWidth,height:a.containerHeight}),eg.createElement("div",IJ({ref:l},e)))}),I5=(0,eg.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,eg.useState)({containerWidth:I1(n),containerHeight:I1(r)}),o=(0,eg.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,eg.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return eg.createElement(eg.Fragment,null,eg.createElement(_x,{width:i.containerWidth,height:i.containerHeight}),eg.createElement("div",IJ({ref:s},e)))}),I3=(0,eg.forwardRef)((e,t)=>{var{width:n,height:r}=e;return eg.createElement(eg.Fragment,null,eg.createElement(_x,{width:n,height:r}),eg.createElement("div",IJ({ref:t},e)))}),I4=(0,eg.forwardRef)((e,t)=>{var{width:n,height:r}=e;return kQ(n)||kQ(r)?eg.createElement(I5,IJ({},e,{ref:t})):eg.createElement(I3,IJ({},e,{ref:t}))}),I6=(0,eg.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,eg.useRef)(null),j=Cb(),[N,k]=(0,eg.useState)(null),[E,C]=(0,eg.useState)(null),_=function(){var e=Cb(),[t,n]=(0,eg.useState)(null),r=Ck(Cq);return(0,eg.useEffect)(()=>{if(null!=t){var n=t.getBoundingClientRect().width/t.offsetWidth;CD(n)&&n!==r&&e(Cg(n))}},[t,e,r]),n}(),S=_d(),A=(null==S?void 0:S.width)>0?S.width:x,T=(null==S?void 0:S.height)>0?S.height:i,O=(0,eg.useCallback)(e=>{_(e),"function"==typeof t&&t(e),k(e),C(e),null!=e&&(w.current=e)},[_,t,k,C]),M=(0,eg.useCallback)(e=>{j(D5(e)),j(L1({handler:a,reactEvent:e}))},[j,a]),P=(0,eg.useCallback)(e=>{j(D4(e)),j(L1({handler:c,reactEvent:e}))},[j,c]),D=(0,eg.useCallback)(e=>{j(E9()),j(L1({handler:u,reactEvent:e}))},[j,u]),L=(0,eg.useCallback)(e=>{j(D4(e)),j(L1({handler:d,reactEvent:e}))},[j,d]),I=(0,eg.useCallback)(()=>{j(LJ())},[j]),R=(0,eg.useCallback)(e=>{j(LQ(e.key))},[j]),B=(0,eg.useCallback)(e=>{j(L1({handler:o,reactEvent:e}))},[j,o]),z=(0,eg.useCallback)(e=>{j(L1({handler:s,reactEvent:e}))},[j,s]),F=(0,eg.useCallback)(e=>{j(L1({handler:l,reactEvent:e}))},[j,l]),V=(0,eg.useCallback)(e=>{j(L1({handler:h,reactEvent:e}))},[j,h]),U=(0,eg.useCallback)(e=>{j(L1({handler:g,reactEvent:e}))},[j,g]),H=(0,eg.useCallback)(e=>{b&&j(L6(e)),j(L1({handler:p,reactEvent:e}))},[j,b,p]),W=(0,eg.useCallback)(e=>{j(L1({handler:f,reactEvent:e}))},[j,f]);return eg.createElement(IK.Provider,{value:N},eg.createElement(IZ.Provider,{value:E},eg.createElement(!0===y?I2:I4,{width:null!=A?A:null==v?void 0:v.width,height:null!=T?T:null==v?void 0:v.height,className:(0,C7.clsx)("recharts-wrapper",r),style:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?IQ(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)):IQ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({position:"relative",cursor:"default",width:A,height:T},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},eg.createElement(I0,null),n)))}),I8=N0([C1],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),I7=N0([I8,CX,C$],(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)}}),I9=(0,eg.createContext)(void 0),Re=e=>{var{children:t}=e,[n]=(0,eg.useState)("".concat(k2("recharts"),"-clip")),r=Ck(I7);if(null==r)return null;var{x:i,y:a,width:o,height:s}=r;return eg.createElement(I9.Provider,{value:n},eg.createElement("defs",null,eg.createElement("clipPath",{id:n},eg.createElement("rect",{x:i,y:a,height:s,width:o}))),t)},Rt=["width","height","responsive","children","className","style","compact","title","desc"],Rn=(0,eg.forwardRef)((e,t)=>{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:l,title:c,desc:u}=e,d=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,Rt));return l?eg.createElement(eg.Fragment,null,eg.createElement(_x,{width:n,height:r}),eg.createElement(IU,{otherAttributes:d,title:c,desc:u},a)):eg.createElement(I6,{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},eg.createElement(IU,{otherAttributes:d,title:c,desc:u,ref:t},eg.createElement(Re,null,a)))});function Rr(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 Ri(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rr(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)):Rr(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 Ra(){return(Ra=Object.assign.bind()).apply(null,arguments)}var Ro={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"},Rs=(0,eg.forwardRef)(function(e,t){var n,r=Ri(e.categoricalChartProps,Ro),{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,categoricalChartProps:l}=e;return eg.createElement(Ig,{preloadedState:{options:{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,eventEmitter:void 0}},reduxStoreName:null!=(n=l.id)?n:i},eg.createElement(Im,{chartData:l.data}),eg.createElement(Iy,{layout:r.layout,margin:r.margin}),eg.createElement(Ib,{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}),eg.createElement(Rn,Ra({},r,{ref:t})))}),Rl=["axis"],Rc=(0,eg.forwardRef)((e,t)=>eg.createElement(Rs,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Rl,tooltipPayloadSearcher:Ee,categoricalChartProps:e,ref:t})),Ru=eg,Rd=["children","className"];function Rh(){return(Rh=Object.assign.bind()).apply(null,arguments)}var Rf=eg.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,Rd),a=(0,C7.clsx)("recharts-layer",r);return eg.createElement("g",Rh({className:a},IA(i),{ref:t}),n)}),Rp=e.i(4178);function Rg(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 Rm=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rg(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)):Rg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},{cacheSize:2e3,enableCache:!0}),Rv=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}}(Rm.cacheSize),Rx={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},Ry="recharts_measurement_span",Rb=(e,t)=>{try{var n=document.getElementById(Ry);n||((n=document.createElement("span")).setAttribute("id",Ry),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Rx,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch(e){return{width:0,height:0}}},Rw=function(e){var t,n,r,i,a,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||Ir.isSsr)return{width:0,height:0};if(!Rm.enableCache)return Rb(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=Rv.get(l);if(c)return c;var u=Rb(e,s);return Rv.set(l,u),u},Rj=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,RN=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Rk=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,RE=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,RC={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},R_=["cm","mm","pt","pc","in","Q","px"];class RS{static parse(e){var t,[,n,r]=null!=(t=RE.exec(e))?t:[];return null==n?RS.NaN:new RS(parseFloat(n),null!=r?r:"")}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,kZ(e)&&(this.unit=""),""===t||Rk.test(t)||(this.num=NaN,this.unit=""),function(e){return R_.includes(e)}(t)&&(this.num=function(e,t){return e*RC[t]}(e,t),this.unit="px")}add(e){return this.unit!==e.unit?new RS(NaN,""):new RS(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new RS(NaN,""):new RS(this.num-e.num,this.unit)}multiply(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new RS(NaN,""):new RS(this.num*e.num,this.unit||e.unit)}divide(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new RS(NaN,""):new RS(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return kZ(this.num)}}function RA(e){if(null==e||e.includes("NaN"))return"NaN";for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=null!=(n=Rj.exec(t))?n:[],o=RS.parse(null!=r?r:""),s=RS.parse(null!=a?a:""),l="*"===i?o.multiply(s):o.divide(s);if(l.isNaN())return"NaN";t=t.replace(Rj,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var c,[,u,d,h]=null!=(c=RN.exec(t))?c:[],f=RS.parse(null!=u?u:""),p=RS.parse(null!=h?h:""),g="+"===d?f.add(p):f.subtract(p);if(g.isNaN())return"NaN";t=t.replace(RN,g.toString())}return t}u="NaN",d=new RS(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 RS?Object.defineProperty(RS,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):RS[u]=d;var RT=/\(([^()]*)\)/;function RO(e){var t=function(e){try{var t;return t=e.replace(/\s+/g,""),t=function(e){for(var t,n=e;null!=(t=RT.exec(n));){var[,r]=t;n=n.replace(RT,RA(r))}return n}(t),t=RA(t)}catch(e){return"NaN"}}(e.slice(5,-1));return"NaN"===t?"":t}var RM=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],RP=["dx","dy","angle","className","breakAll"];function RD(){return(RD=Object.assign.bind()).apply(null,arguments)}function RL(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 RI=/[ \f\n\r\t\v\u2028\u2029]+/,RR=e=>{var{children:t,breakAll:n,style:r}=e;try{var i=[];null!=t&&(i=n?t.toString().split(""):t.toString().split(RI));var a=i.map(e=>({word:e,width:Rw(e,r).width})),o=n?0:Rw(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch(e){return null}},RB=(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},[]),Rz=e=>e.reduce((e,t)=>e.width>t.width?e:t),RF=(e,t,n,r,i,a,o,s)=>{var l=RR({breakAll:n,style:r,children:e.slice(0,t)+"…"});if(!l)return[!1,[]];var c=RB(l.wordsWithComputedWidth,a,o,s);return[c.length>i||Rz(c).width>Number(a),c]},RV=e=>[{words:null==e?[]:e.toString().split(RI),width:void 0}],RU="#808080",RH={angle:0,breakAll:!1,capHeight:"0.71em",fill:RU,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},RW=(0,eg.forwardRef)((e,t)=>{var n,r=Ri(e,RH),{x:i,y:a,lineHeight:o,capHeight:s,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=r,h=RL(r,RM),f=(0,eg.useMemo)(()=>(e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Ir.isSsr){var s=RR({breakAll:a,children:r,style:i});if(!s)return RV(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=kJ(o),d=String(s),h=RB(t,r,n,i);if(!u||i||!(h.length>o||Rz(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]=RF(d,v-1,c,l,o,r,n,i),[b]=RF(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 RV(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=RL(h,RP);if(!k0(i)||!k0(a)||0===f.length)return null;var w=Number(i)+(kJ(p)?p:0),j=Number(a)+(kJ(g)?g:0);if(!CD(w)||!CD(j))return null;switch(d){case"start":n=RO("calc(".concat(s,")"));break;case"middle":n=RO("calc(".concat((f.length-1)/2," * -").concat(o," + (").concat(s," / 2))"));break;default:n=RO("calc(".concat(f.length-1," * -").concat(o,")"))}var N=[];if(c){var k=f[0].width,{width:E}=h;N.push("scale(".concat(kJ(E)&&kJ(k)?E/k:1,")"))}return v&&N.push("rotate(".concat(v,", ").concat(w,", ").concat(j,")")),N.length&&(b.transform=N.join(" ")),eg.createElement("text",RD({},IA(b),{ref:t,x:w,y:j,className:(0,C7.clsx)("recharts-text",x),textAnchor:u,fill:l.includes("url")?RU:l}),f.map((e,t)=>{var r=e.words.join(y?"":" ");return eg.createElement("tspan",{x:w,dy:0===t?n:o,key:"".concat(r,"-").concat(t)},r)}))});function RY(e){var{zIndex:t,children:n}=e,r=void 0!==Ck(_v)&&void 0!==t&&0!==t,i=C4(),a=Cb();(0,eg.useLayoutEffect)(()=>r?(a(Ic({zIndex:t})),()=>{a(Iu({zIndex:t}))}):k9,[a,t,r]);var o=Ck(e=>IP(e,t,i));return r?o?(0,e0.createPortal)(n,o):null:n}RW.displayName="Text";var RG=["labelRef"],RX=["content"];function R$(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 Rq(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 RK(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rq(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)):Rq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function RZ(){return(RZ=Object.assign.bind()).apply(null,arguments)}var RQ=(0,eg.createContext)(null),RJ=e=>{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,l=(0,eg.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return eg.createElement(RQ.Provider,{value:l},s)},R0=()=>{var e=(0,eg.useContext)(RQ),t=_g();return e||_p(t)},R1=(0,eg.createContext)(null),R2=e=>null!=e&&"function"==typeof e,R5=e=>"cx"in e&&kJ(e.cx),R3={angle:0,offset:5,zIndex:OU.label,position:"middle",textBreakAll:!1};function R4(e){var t,n,r,i,a,o,s=Ri(e,R3),{viewBox:l,position:c,value:u,children:d,content:h,className:f="",textBreakAll:p,labelRef:g}=s,v=(t=(0,eg.useContext)(R1),n=Ck(O3),t||n),x=R0();if(!(i=null==l?"center"===c?x:null!=v?v:x:R5(l)?l:_p(l))||null==u&&null==d&&!(0,eg.isValidElement)(h)&&"function"!=typeof h)return null;var y=RK(RK({},s),{},{viewBox:i});if((0,eg.isValidElement)(h)){var{labelRef:b}=y,w=R$(y,RG);return(0,eg.cloneElement)(h,w)}if("function"==typeof h){var{content:j}=y,N=R$(y,RX);if(a=(0,eg.createElement)(h,N),(0,eg.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=IA(s);if(R5(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=kK(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=OV(c,u,v,a),w=OV(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?k2("recharts-radial-line-"):e.id;return eg.createElement("text",RZ({},r,{dominantBaseline:"central",className:(0,C7.clsx)("recharts-radial-bar-label",l)}),eg.createElement("defs",null,eg.createElement("path",{id:N,d:j})),eg.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}=OV(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}=OV(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||R5(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 RK(RK({},{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 RK(RK({},{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 RK(RK({},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 RK(RK({},k),n?{width:Math.max(n.x+n.width-k.x,0),height:u}:{})}var E=n?{width:f,height:u}:{};return"insideLeft"===a?RK({x:h+b,y:s+u/2,textAnchor:j,verticalAnchor:"middle"},E):"insideRight"===a?RK({x:h+f-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"},E):"insideTop"===a?RK({x:o+l/2,y:s+g,textAnchor:"middle",verticalAnchor:x},E):"insideBottom"===a?RK({x:d+c/2,y:s+u-g,textAnchor:"middle",verticalAnchor:v},E):"insideTopLeft"===a?RK({x:o+b,y:s+g,textAnchor:j,verticalAnchor:x},E):"insideTopRight"===a?RK({x:o+l-b,y:s+g,textAnchor:w,verticalAnchor:x},E):"insideBottomLeft"===a?RK({x:d+b,y:s+u-g,textAnchor:j,verticalAnchor:v},E):"insideBottomRight"===a?RK({x:d+c-b,y:s+u-g,textAnchor:w,verticalAnchor:v},E):a&&"object"==typeof a&&(kJ(a.x)||kQ(a.x))&&(kJ(a.y)||kQ(a.y))?RK({x:o+k5(a.x,f),y:s+k5(a.y,u),textAnchor:"end",verticalAnchor:"end"},E):RK({x:o+l/2,y:s+u/2,textAnchor:"middle",verticalAnchor:"middle"},E)})(s,i);return eg.createElement(RY,{zIndex:s.zIndex},eg.createElement(RW,RZ({ref:g,className:(0,C7.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 R6(e){var{label:t,labelRef:n}=e;return((e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return!0===e?eg.createElement(R4,RZ({key:"label-implicit"},r)):k0(e)?eg.createElement(R4,RZ({key:"label-implicit",value:e},r)):(0,eg.isValidElement)(e)?e.type===R4?(0,eg.cloneElement)(e,RK({key:"label-implicit"},r)):eg.createElement(R4,RZ({key:"label-implicit",content:e},r)):R2(e)?eg.createElement(R4,RZ({key:"label-implicit",content:e},r)):e&&"object"==typeof e?eg.createElement(R4,RZ({},e,{key:"label-implicit"},r)):null})(t,R0(),n)||null}R4.displayName="Label";var R8=["valueAccessor"],R7=["dataKey","clockWise","id","textBreakAll","zIndex"];function R9(){return(R9=Object.assign.bind()).apply(null,arguments)}function Be(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 Bt=e=>Array.isArray(e.value)?(0,Rp.default)(e.value):e.value,Bn=(0,eg.createContext)(void 0),Br=Bn.Provider,Bi=(0,eg.createContext)(void 0);function Ba(e){var{valueAccessor:t=Bt}=e,n=Be(e,R8),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,l=Be(n,R7),c=(0,eg.useContext)(Bn),u=(0,eg.useContext)(Bi),d=c||u;return d&&d.length?eg.createElement(RY,{zIndex:null!=s?s:OU.label},eg.createElement(Rf,{className:"recharts-label-list"},d.map((e,i)=>{var s,c=null==r?t(e,i):CB(e&&e.payload,r),u=null==a?{}:{id:"".concat(a,"-").concat(i)};return eg.createElement(R4,R9({key:"label-".concat(i)},IA(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 Bo(e){var{label:t}=e;return t?!0===t?eg.createElement(Ba,{key:"labelList-implicit"}):eg.isValidElement(t)||R2(t)?eg.createElement(Ba,{key:"labelList-implicit",content:t}):"object"==typeof t?eg.createElement(Ba,R9({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}Bi.Provider,Ba.displayName="LabelList";var Bs=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Bl=(e,t)=>{if(!e||"function"==typeof e||"boolean"==typeof e)return null;var n=e;if((0,eg.isValidElement)(e)&&(n=e.props),"object"!=typeof n&&"function"!=typeof n)return null;var r={};return Object.keys(n).forEach(e=>{IN(e)&&(r[e]=t||(t=>n[e](n,t)))}),r};function Bc(){return(Bc=Object.assign.bind()).apply(null,arguments)}var Bu=e=>{var{cx:t,cy:n,r,className:i}=e,a=(0,C7.clsx)("recharts-dot",i);return kJ(t)&&kJ(n)&&kJ(r)?eg.createElement("circle",Bc({},I_(e),Bl(e),{className:a,cx:t,cy:n,r:r})):null},Bd=(e.i(79684),e=>!e||"object"!=typeof e||!("clipDot"in e)||!!e.clipDot),Bh=["points"];function Bf(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 Bp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bf(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)):Bf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Bg(){return(Bg=Object.assign.bind()).apply(null,arguments)}function Bm(e){var{option:t,dotProps:n,className:r}=e;if((0,eg.isValidElement)(t))return(0,eg.cloneElement)(t,n);if("function"==typeof t)return t(n);var i=(0,C7.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,Bh);return eg.createElement(Bu,Bg({},s,{className:i}))}function Bv(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:a,baseProps:o,needClip:s,clipPathId:l,zIndex:c=OU.scatter}=e;if(null==t||!n&&1!==t.length)return null;var u=Bd(n),d=null==n?null:(0,eg.isValidElement)(n)?IA(n.props):"object"!=typeof n||Array.isArray(n)?null:IA(n),h=t.map((e,r)=>{var s,l,c=Bp(Bp(Bp({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 eg.createElement(Bm,{key:"dot-".concat(r),option:n,dotProps:c,className:i})}),f={};return s&&null!=l&&(f.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(l,")")),eg.createElement(RY,{zIndex:c},eg.createElement(Rf,Bg({className:r},f),h))}function Bx(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 By(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bx(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)):Bx(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Bb=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=By(By(By({},{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}),IS(a)),Bl(a));return t=(0,eg.isValidElement)(a)?(0,eg.cloneElement)(a,l):"function"==typeof a?a(l):eg.createElement(Bu,l),eg.createElement(Rf,{className:"recharts-active-dot",clipPath:s},t)};function Bw(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=OU.activeDot}=e,s=Ck(DO),l=Ck(Dz);if(null==t||null==l)return null;var c=t.find(e=>l.includes(e.payload));return null==c?null:eg.createElement(RY,{zIndex:o},eg.createElement(Bb,{point:c,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}function Bj(e){var{tooltipEntrySettings:t}=e,n=Cb(),r=C4(),i=(0,eg.useRef)(null);return(0,eg.useLayoutEffect)(()=>{r||(null===i.current?n(E5(t)):i.current!==t&&n(E3({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,eg.useLayoutEffect)(()=>()=>{i.current&&(n(E4(i.current)),i.current=null)},[n]),null}var BN=["children"],Bk=(0,eg.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function BE(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,BN);return eg.createElement(Bk.Provider,{value:n},t)}function BC(e,t){var n,r,i=Ck(t=>Mc(t,e)),a=Ck(e=>Md(e,t)),o=null!=(n=null==i?void 0:i.allowDataOverflow)?n:Ms.allowDataOverflow,s=null!=(r=null==a?void 0:a.allowDataOverflow)?r:Mu.allowDataOverflow;return{needClip:o||s,needClipX:o,needClipY:s}}function B_(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=Ck(I7),{needClipX:a,needClipY:o,needClip:s}=BC(t,n);if(!s||!i)return null;var{x:l,y:c,width:u,height:d}=i;return eg.createElement("clipPath",{id:"clipPath-".concat(r)},eg.createElement("rect",{x:a?l:l-u/2,y:o?c:c-d/2,width:a?u:2*u,height:o?d:2*d}))}var BS=(e,t,n,r)=>PB(e,"xAxis",t,r),BA=(e,t,n,r)=>PR(e,"xAxis",t,r),BT=(e,t,n,r)=>PB(e,"yAxis",n,r),BO=(e,t,n,r)=>PR(e,"yAxis",n,r),BM=N0([_v,BS,BT,BA,BO],(e,t,n,r,i)=>Cz(e,"xAxis")?CW(t,r,!1):CW(n,i,!1));function BP(e){return"line"===e.type}var BD=N0([Mx,(e,t,n,r,i)=>i],(e,t)=>e.filter(BP).find(e=>e.id===t)),BL=N0([_v,BS,BT,BA,BO,BD,BM,Of],(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=CB(e,o);if("horizontal"===t)return{x:CV({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=CV({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})}});function BI(e){var{legendPayload:t}=e,n=Cb(),r=C4(),i=(0,eg.useRef)(null);return(0,eg.useLayoutEffect)(()=>{r||(null===i.current?n(LL(t)):i.current!==t&&n(LI({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,eg.useLayoutEffect)(()=>()=>{i.current&&(n(LR(i.current)),i.current=null)},[n]),null}function BR(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",n=(0,eg.useRef)(k2(t)),r=(0,eg.useRef)(e);return r.current!==e&&(n.current=k2(t),r.current=e),n.current}var BB=null!=(Y=eg["useId".toString()])?Y:()=>{var[e]=eg.useState(()=>k2("uid-"));return e},Bz=(0,eg.createContext)(void 0),BF=e=>{var t,n,{id:r,type:i,children:a}=e,o=(t="recharts-".concat(i),n=BB(),r||(t?"".concat(t,"-").concat(n):n));return eg.createElement(Bz.Provider,{value:o},a(o))},BV=(0,eg.memo)(e=>{var t=Cb(),n=(0,eg.useRef)(null);return(0,eg.useLayoutEffect)(()=>{null===n.current?t(Lp(e)):n.current!==e&&t(Lg({prev:n.current,next:e})),n.current=e},[t,e]),(0,eg.useLayoutEffect)(()=>()=>{n.current&&(t(Lm(n.current)),n.current=null)},[t]),null});function BU(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 BH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?BU(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)):BU(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var BW=(e,t,n)=>e.map(e=>"".concat(e.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase()))," ").concat(t,"ms ").concat(n)).join(","),BY=(e,t)=>Object.keys(t).reduce((n,r)=>BH(BH({},n),{},{[r]:e(r,t[r])}),{});function BG(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 BX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?BG(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)):BG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var B$=(e,t,n)=>e+(t-e)*n,Bq=e=>{var{from:t,to:n}=e;return t!==n},BK=(e,t,n)=>{var r=BY((t,n)=>{if(Bq(n)){var[r,i]=e(n.from,n.to,n.velocity);return BX(BX({},n),{},{from:r,velocity:i})}return n},t);return n<1?BY((e,t)=>Bq(t)&&null!=r[e]?BX(BX({},t),{},{velocity:B$(t.velocity,r[e].velocity,n),from:B$(t.from,r[e].from,n)}):t,t):BK(e,r,n-1)},BZ=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],BQ=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),BJ=(e,t)=>n=>BQ(BZ(e,t),n),B0=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]},B1=function(){return((e,t,n,r)=>{var i=BJ(e,n),a=BJ(t,r),o=t=>BQ([...BZ(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})(...B0(...arguments))},B2=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 B5{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 B3=(0,eg.createContext)(function(){var e,t,n,r,i;return e=new B5,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}}),B4={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},B6={t:0},B8={t:1};function B7(e){var t,n,r,i=Ri(e,B4),{isActive:a,canBegin:o,duration:s,easing:l,begin:c,onAnimationEnd:u,onAnimationStart:d,children:h}=i,f="auto"===a?!Ir.isSsr:a,p=(t=i.animationId,n=i.animationManager,r=(0,eg.useContext)(B3),(0,eg.useMemo)(()=>null!=n?n:r(t),[t,n,r])),[g,v]=(0,eg.useState)(f?B6:B8),x=(0,eg.useRef)(null);return(0,eg.useEffect)(()=>{f||v(B8)},[f]),(0,eg.useEffect)(()=>{if(!f||!o)return k9;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(BX(BX({},e),t)),()=>{}):!0===n.isStepper?(s=p.reduce((n,r)=>BX(BX({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),l=null,c=r=>{o||(o=r);var u=(r-o)/n.dt;s=BK(n,s,u),i(BX(BX(BX({},e),t),BY((e,t)=>t.from,s))),o=r,Object.values(s).filter(Bq).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:BX(BX({},n),{},{[r]:[i,a]})},{}),f=o=>{u||(u=o);var s=(o-u)/r,l=BY((e,t)=>B$(...t,n(s)),h);if(i(BX(BX(BX({},e),t),l)),s<1)d=a.setTimeout(f);else{var c=BY((e,t)=>B$(...t,n(1)),h);i(BX(BX(BX({},e),t),c))}},()=>(d=a.setTimeout(f),()=>{var e;null==(e=d)||e()}))})(B6,B8,(e=>{if("string"==typeof e)switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return B1(e);case"spring":return B2();default:if("cubic-bezier"===e.split("(")[0])return B1(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)}var B9=e.i(7328),ze=["radius"],zt=["radius"];function zn(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?zn(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)):zn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zi(){return(zi=Object.assign.bind()).apply(null,arguments)}function za(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 zo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var zs=(e,t,n,r,i)=>{var a,o=k$(n),s=k$(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=kq(G||(G=zo(["M",",",""])),e,t+c*h[0]),h[0]>0&&(a+=kq(X||(X=zo(["A ",",",",0,0,",",",",",""])),h[0],h[0],d,e+u*h[0],t)),a+=kq($||($=zo(["L ",",",""])),e+n-u*h[1],t),h[1]>0&&(a+=kq(q||(q=zo(["A ",",",",0,0,",",\n ",",",""])),h[1],h[1],d,e+n,t+c*h[1])),a+=kq(K||(K=zo(["L ",",",""])),e+n,t+r-c*h[2]),h[2]>0&&(a+=kq(Z||(Z=zo(["A ",",",",0,0,",",\n ",",",""])),h[2],h[2],d,e+n-u*h[2],t+r)),a+=kq(Q||(Q=zo(["L ",",",""])),e+u*h[3],t+r),h[3]>0&&(a+=kq(J||(J=zo(["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=kq(ee||(ee=zo(["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=kq(et||(et=zo(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return a},zl={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},zc=e=>{var t=Ri(e,zl),n=(0,eg.useRef)(null),[r,i]=(0,eg.useState)(-1);(0,eg.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,eg.useRef)(s),x=(0,eg.useRef)(l),y=(0,eg.useRef)(a),b=(0,eg.useRef)(o),w=BR((0,eg.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,C7.clsx)("recharts-rectangle",u);if(!g){var N=IA(t),{radius:k}=N,E=za(N,ze);return eg.createElement("path",zi({},E,{x:k$(a),y:k$(o),width:k$(s),height:k$(l),radius:"number"==typeof c?c:void 0,className:j,d:zs(a,o,s,l,c)}))}var C=v.current,_=x.current,S=y.current,A=b.current,T="0px ".concat(-1===r?1:r,"px"),O="".concat(r,"px 0px"),M=BW(["strokeDasharray"],h,"string"==typeof d?d:zl.animationEasing);return eg.createElement(B7,{animationId:w,key:w,canBegin:r>0,duration:h,easing:d,isActive:g,begin:f},e=>{var r,i=k4(C,s,e),u=k4(_,l,e),d=k4(S,a,e),h=k4(A,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:T}:{strokeDasharray:O};var f=IA(t),{radius:g}=f,w=za(f,zt);return eg.createElement("path",zi({},w,{radius:"number"==typeof c?c:void 0,className:j,d:zs(d,h,i,u,c),ref:n,style:zr(zr({},r),t.style)}))})};function zu(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 zd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zu(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)):zu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zh(){return(zh=Object.assign.bind()).apply(null,arguments)}function zf(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var zp=(e,t,n,r,i)=>{var a=n-r;return kq(en||(en=zf(["M ",",",""])),e,t)+kq(er||(er=zf(["L ",",",""])),e+n,t)+kq(ei||(ei=zf(["L ",",",""])),e+n-a/2,t+i)+kq(ea||(ea=zf(["L ",",",""])),e+n-a/2-r,t+i)+kq(eo||(eo=zf(["L ",","," Z"])),e,t)},zg={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},zm=e=>{var t=Ri(e,zg),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=t,{animationEasing:l,animationDuration:c,animationBegin:u,isUpdateAnimationActive:d}=t,h=(0,eg.useRef)(null),[f,p]=(0,eg.useState)(-1),g=(0,eg.useRef)(i),v=(0,eg.useRef)(a),x=(0,eg.useRef)(o),y=(0,eg.useRef)(n),b=(0,eg.useRef)(r),w=BR(e,"trapezoid-");if((0,eg.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,C7.clsx)("recharts-trapezoid",s);if(!d)return eg.createElement("g",null,eg.createElement("path",zh({},IA(t),{className:j,d:zp(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"),A="".concat(f,"px 0px"),T=BW(["strokeDasharray"],c,l);return eg.createElement(B7,{animationId:w,key:w,canBegin:f>0,duration:c,easing:l,isActive:d,begin:u},e=>{var s=k4(N,i,e),l=k4(k,a,e),c=k4(E,o,e),u=k4(C,n,e),d=k4(_,r,e);h.current&&(g.current=s,v.current=l,x.current=c,y.current=u,b.current=d);var f=e>0?{transition:T,strokeDasharray:A}:{strokeDasharray:S};return eg.createElement("path",zh({},IA(t),{className:j,d:zp(u,d,s,l,c),ref:h,style:zd(zd({},f),t.style)}))})};function zv(){return(zv=Object.assign.bind()).apply(null,arguments)}function zx(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var zy=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)/OF,d=l?i:i+a*u,h=OV(t,n,c,d);return{center:h,circleTangency:OV(t,n,r,d),lineTangency:OV(t,n,c*Math.cos(u*OF),l?i-a*u:i),theta:u}},zb=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,s=kK(o-a)*Math.min(Math.abs(o-a),359.999),l=a+s,c=OV(t,n,i,a),u=OV(t,n,i,l),d=kq(es||(es=zx(["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=OV(t,n,r,a),f=OV(t,n,r,l);d+=kq(el||(el=zx(["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+=kq(ec||(ec=zx(["L ",","," Z"])),t,n);return d},zw={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},zj=e=>{var t,n=Ri(e,zw),{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,C7.clsx)("recharts-sector",h),p=o-a,g=k5(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=kK(c-l),{circleTangency:d,lineTangency:h,theta:f}=zy({cx:t,cy:n,radius:i,angle:l,sign:u,cornerRadius:a,cornerIsExternal:s}),{circleTangency:p,lineTangency:g,theta:v}=zy({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?kq(eu||(eu=zx(["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)):zb({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var y=kq(ed||(ed=zx(["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}=zy({cx:t,cy:n,radius:r,angle:l,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:N,lineTangency:k,theta:E}=zy({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+=kq(eh||(eh=zx(["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+=kq(ef||(ef=zx(["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}):zb({cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:u,endAngle:d}),eg.createElement("path",zv({},IA(n),{className:f,d:t}))};let zN=Math.PI,zk=2*zN,zE=zk-1e-6;function zC(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class z_{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?zC:function(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return zC;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((zN-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%zk+zk),d>zE?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>=zN)},${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 zS(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 z_(t)}z_.prototype;let zA=Math.cos,zT=Math.sin,zO=Math.sqrt,zM=Math.PI,zP=2*zM;zO(3);let zD={draw(e,t){let n=zO(t/zM);e.moveTo(n,0),e.arc(0,0,n,0,zP)}},zL=zO(1/3),zI=2*zL,zR=zT(zM/10)/zT(7*zM/10),zB=zT(zP/10)*zR,zz=-zA(zP/10)*zR,zF=zO(3);zO(3);let zV=zO(3)/2,zU=1/zO(12),zH=(zU/2+1)*3;var zW=["type","size","sizeType"];function zY(){return(zY=Object.assign.bind()).apply(null,arguments)}function zG(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 zX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zG(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)):zG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var z$={symbolCircle:zD,symbolCross:{draw(e,t){let n=zO(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=zO(t/zI),r=n*zL;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},symbolSquare:{draw(e,t){let n=zO(t),r=-n/2;e.rect(r,r,n,n)}},symbolStar:{draw(e,t){let n=zO(.8908130915292852*t),r=zB*n,i=zz*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=zP*t/5,o=zA(a),s=zT(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=-zO(t/(3*zF));e.moveTo(0,2*n),e.lineTo(-zF*n,-n),e.lineTo(zF*n,-n),e.closePath()}},symbolWye:{draw(e,t){let n=zO(t/zH),r=n/2,i=n*zU,a=n*zU+n,o=-r;e.moveTo(r,i),e.lineTo(r,a),e.lineTo(o,a),e.lineTo(-.5*r-zV*i,zV*r+-.5*i),e.lineTo(-.5*r-zV*a,zV*r+-.5*a),e.lineTo(-.5*o-zV*a,zV*o+-.5*a),e.lineTo(-.5*r+zV*i,-.5*i-zV*r),e.lineTo(-.5*r+zV*a,-.5*a-zV*r),e.lineTo(-.5*o+zV*a,-.5*a-zV*o),e.closePath()}}},zq=Math.PI/180,zK=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=zX(zX({},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,zW)),{},{type:t,size:n,sizeType:r}),a="circle";"string"==typeof t&&(a=t);var{className:o,cx:s,cy:l}=i,c=IA(i);return kJ(s)&&kJ(l)&&kJ(n)?eg.createElement("path",zY({},c,{className:(0,C7.clsx)("recharts-symbols",o),transform:"translate(".concat(s,", ").concat(l,")"),d:(()=>{var e,t=(e=a,z$["symbol".concat(k8(e))]||zD),i=(function(e,t){let n=null,r=zS(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:CS(e||zD),t="function"==typeof t?t:CS(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:CS(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:CS(+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*zq;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};function zZ(e){this._context=e}function zQ(e){return new zZ(e)}function zJ(e){return e[0]}function z0(e){return e[1]}function z1(e,t){var n=CS(!0),r=null,i=zQ,a=null,o=zS(s);function s(s){var l,c,u,d=(s=C_(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?zJ:CS(e),t="function"==typeof t?t:void 0===t?z0:CS(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:CS(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:CS(+e),s):t},s.defined=function(e){return arguments.length?(n="function"==typeof e?e:CS(!!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 z2(e,t,n){var r=null,i=CS(!0),a=null,o=zQ,s=null,l=zS(c);function c(c){var u,d,h,f,p,g=(c=C_(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 z1().defined(i).curve(o).context(a)}return e="function"==typeof e?e:void 0===e?zJ:CS(+e),t="function"==typeof t?t:void 0===t?CS(0):CS(+t),n="function"==typeof n?n:void 0===n?z0:CS(+n),c.x=function(t){return arguments.length?(e="function"==typeof t?t:CS(+t),r=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:CS(+t),c):e},c.x1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:CS(+e),c):r},c.y=function(e){return arguments.length?(t="function"==typeof e?e:CS(+e),n=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:CS(+e),c):t},c.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:CS(+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:CS(!!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 z5(){}function z3(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 z4(e){this._context=e}function z6(e){this._context=e}function z8(e){this._context=e}zK.registerSymbol=(e,t)=>{z$["symbol".concat(k8(e))]=t},zZ.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)}}},z4.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:z3(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:z3(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},z6.prototype={areaStart:z5,areaEnd:z5,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:z3(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},z8.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:z3(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};class z7{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 z9(e){this._context=e}z9.prototype={areaStart:z5,areaEnd:z5,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 Fe(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 Ft(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Fn(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 Fr(e){this._context=e}function Fi(e){this._context=new Fa(e)}function Fa(e){this._context=e}function Fo(e){this._context=e}function Fs(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 Fl(e,t){this._context=e,this._t=t}function Fc(){return(Fc=Object.assign.bind()).apply(null,arguments)}function Fu(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 Fd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fu(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)):Fu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Fr.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:Fn(this,this._t0,Ft(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,Fn(this,Ft(this,n=Fe(this,e,t)),n);break;default:Fn(this,this._t0,n=Fe(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(Fi.prototype=Object.create(Fr.prototype)).point=function(e,t){Fr.prototype.point.call(this,t,e)},Fa.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)}},Fo.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=Fs(e),i=Fs(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)}},Fl.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 Fh={curveBasisClosed:function(e){return new z6(e)},curveBasisOpen:function(e){return new z8(e)},curveBasis:function(e){return new z4(e)},curveBumpX:function(e){return new z7(e,!0)},curveBumpY:function(e){return new z7(e,!1)},curveLinearClosed:function(e){return new z9(e)},curveLinear:zQ,curveMonotoneX:function(e){return new Fr(e)},curveMonotoneY:function(e){return new Fi(e)},curveNatural:function(e){return new Fo(e)},curveStep:function(e){return new Fl(e,.5)},curveStepAfter:function(e){return new Fl(e,1)},curveStepBefore:function(e){return new Fl(e,0)}},Ff=e=>CD(e.x)&&CD(e.y),Fp=e=>null!=e.base&&Ff(e.base)&&Ff(e),Fg=e=>e.x,Fm=e=>e.y,Fv=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=Ck(_v);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(k8(e));return("curveMonotone"===n||"curveBump"===n)&&t?Fh["".concat(n).concat("vertical"===t?"Y":"X")]:Fh[n]||zQ})(t,i),s=a?n.filter(Ff):n;if(Array.isArray(r)){var l=n.map((e,t)=>Fd(Fd({},e),{},{base:r[t]}));return("vertical"===i?z2().y(Fm).x1(Fg).x0(e=>e.base.x):z2().x(Fg).y1(Fm).y0(e=>e.base.y)).defined(Fp).curve(o)(a?l.filter(Fp):l)}return("vertical"===i&&kJ(r)?z2().y(Fm).x1(Fg).x0(r):kJ(r)?z2().x(Fg).y1(Fm).y0(r):z1().x(Fg).y(Fm)).defined(Ff).curve(o)(s)})(o):r;return eg.createElement("path",Fc({},I_(e),Bl(e),{className:(0,C7.clsx)("recharts-curve",t),d:null===s?void 0:s,ref:i}))},Fx=["option","shapeType","activeClassName"];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}function Fw(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return eg.createElement(zc,n);case"trapezoid":return eg.createElement(zm,n);case"sector":return eg.createElement(zj,n);case"symbols":if("symbols"===t)return eg.createElement(zK,n);break;case"curve":return eg.createElement(Fv,n);default:return null}}function Fj(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,Fx);if((0,eg.isValidElement)(n))t=(0,eg.cloneElement)(n,Fb(Fb({},a),(0,eg.isValidElement)(n)?n.props:n));else if("function"==typeof n)t=n(a,a.index);else if((0,B9.default)(n)&&"boolean"!=typeof n){var o=Fb(Fb({},a),n);t=eg.createElement(Fw,{shapeType:r,elementProps:o})}else t=eg.createElement(Fw,{shapeType:r,elementProps:a});return a.isActive?eg.createElement(Rf,{className:i},t):t}var FN=["id"],Fk=["type","layout","connectNulls","needClip","shape"],FE=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function FC(){return(FC=Object.assign.bind()).apply(null,arguments)}function F_(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 FS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F_(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)):F_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FA(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 FT=Ru.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:CG(o,t),hide:s,type:c,color:r,unit:l,graphicalItemId:u}};return Ru.createElement(Bj,{tooltipEntrySettings:d})}),FO=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function FM(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,l=I_(FA(r,FN));return Ru.createElement(Bv,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:l,needClip:o,clipPathId:t})}function FP(e){var{showLabels:t,children:n,points:r}=e,i=(0,Ru.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 FS(FS({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[r]);return Ru.createElement(Br,{value:t?i:void 0},n)}function FD(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=FS(FS({},IA(FA(a,Fk))),{},{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 Ru.createElement(Ru.Fragment,null,(null==r?void 0:r.length)>1&&Ru.createElement(Fj,FC({shapeType:"curve",option:u},d,{pathRef:n})),Ru.createElement(FM,{points:r,clipPathId:t,props:a}))}function FL(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=BR(o,"recharts-line-"),b=(0,Ru.useRef)(y),[w,j]=(0,Ru.useState)(!1),N=(0,Ru.useCallback)(()=>{"function"==typeof g&&g(),j(!1)},[g]),k=(0,Ru.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,Ru.useRef)(0);b.current!==y&&(C.current=a.current,b.current=y);var _=C.current;return Ru.createElement(FP,{points:o,showLabels:!w},n.children,Ru.createElement(B7,{animationId:y,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:N,onAnimationStart:k,key:y},e=>{var c,u=Math.min(k4(_,E+_,e),E);if(c=l?s?((e,t,n)=>{var r=n.reduce((e,t)=>e+t);if(!r)return FO(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))):FO(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 FS(FS({},t),{},{x:k4(i.x,t.x,e),y:k4(i.y,t.y,e)})}return h?FS(FS({},t),{},{x:k4(2*f,t.x,e),y:k4(p/2,t.y,e)}):FS(FS({},t),{},{x:t.x,y:t.y})});return i.current=g,Ru.createElement(FD,{props:n,points:g,clipPathId:t,pathRef:r,strokeDasharray:c})}return Ru.createElement(FD,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:c})}),Ru.createElement(Bo,{label:n.label}))}function FI(e){var{clipPathId:t,props:n}=e,r=(0,Ru.useRef)(null),i=(0,Ru.useRef)(0),a=(0,Ru.useRef)(null);return Ru.createElement(FL,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var FR=(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:CB(e.payload,t)}};class FB extends Ru.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,C7.clsx)("recharts-line",r),{r:p,strokeWidth:g}=function(e){var t=IS(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}}(t),v=Bd(t),x=2*p+g,y=d?"url(#clipPath-".concat(v?"":"dots-").concat(u,")"):void 0;return Ru.createElement(RY,{zIndex:h},Ru.createElement(Rf,{className:f},d&&Ru.createElement("defs",null,Ru.createElement(B_,{clipPathId:u,xAxisId:i,yAxisId:a}),!v&&Ru.createElement("clipPath",{id:"clipPath-dots-".concat(u)},Ru.createElement("rect",{x:s-x/2,y:o-x/2,width:l+x,height:c+x}))),Ru.createElement(BE,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:FR,errorBarOffset:0},Ru.createElement(FI,{props:this.props,clipPathId:u}))),Ru.createElement(Bw,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:y}))}}var Fz={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:OU.line,type:"linear"};function FF(e){var t=Ri(e,Fz),{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=FA(t,FE),{needClip:x}=BC(f,p),y=Ck(I7),b=Ck(_v),w=C4(),j=Ck(e=>BL(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 Ru.createElement(FB,FC({},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 FV=Ru.memo(function(e){var t=Ri(e,Fz),n=C4();return Ru.createElement(BF,{id:t.id,type:"line"},e=>Ru.createElement(Ru.Fragment,null,Ru.createElement(BI,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:CG(n,t),payload:e}]})(t)}),Ru.createElement(FT,{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}),Ru.createElement(BV,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),Ru.createElement(FF,FC({},t,{id:e}))))},Ix);FV.displayName="Line";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 FH=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 FW(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 FY(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 FG(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 FX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FG(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)):FG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var F$=["axisLine","width","height","className","hide","ticks","axisType"];function Fq(){return(Fq=Object.assign.bind()).apply(null,arguments)}function FK(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 FZ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FK(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)):FK(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var FQ={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:OU.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=FZ(FZ(FZ({},l),I_(s)),{},{fill:"none"});if("top"===a||"bottom"===a){var u=+("top"===a&&!o||"bottom"===a&&o);c=FZ(FZ({},c),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+("left"===a&&!o||"right"===a&&o);c=FZ(FZ({},c),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return eg.createElement("line",Fq({},c,{className:(0,C7.clsx)("recharts-cartesian-axis-line",(0,kX.default)(s,"className"))}))}function F0(e){var t,{option:n,tickProps:r,value:i}=e,a=(0,C7.clsx)(r.className,"recharts-cartesian-axis-tick-value");if(eg.isValidElement(n))t=eg.cloneElement(n,FZ(FZ({},r),{},{className:a}));else if("function"==typeof n)t=n(FZ(FZ({},r),{},{className:a}));else{var o="recharts-cartesian-axis-tick-value";"boolean"!=typeof n&&(o=(0,C7.clsx)(o,null==n?void 0:n.className)),t=eg.createElement(RW,Fq({},r,{className:o}),i)}return t}var F1=(0,eg.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=function(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(kJ(c)||Ir.isSsr)return null!=(r=FW(a,(kJ(c)?c:0)+1))?r:[];var f="top"===l||"bottom"===l?"width":"height",p=d&&"width"===f?Rw(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=Rw(a,{fontSize:t,letterSpacing:n}),FH({width:i.width+p.width,height:i.height+p.height},h)):Rw(a,{fontSize:t,letterSpacing:n})[f]},v=a.length>=2?kK(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:FW(r,u)};var o=c,h=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=0===c||FY(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||FY(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=FX(FX({},u),{},{tickCoord:h>0?u.coordinate-h*e:u.coordinate}),null!=u.tickCoord&&FY(e,u.tickCoord,()=>d,l,c)&&(c=u.tickCoord-e*(d/2+i),o[s-1]=FX(FX({},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=FX(FX({},a),{},{tickCoord:u<0?a.coordinate-u*e:a.coordinate})}else o[t]=a=FX(FX({},a),{},{tickCoord:a.coordinate});null!=a.tickCoord&&FY(e,a.tickCoord,s,l,c)&&(l=a.tickCoord+e*(s()/2+i),o[t]=FX(FX({},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=FX(FX({},c),{},{tickCoord:d>0?c.coordinate-d*e:c.coordinate})}else a[t]=c=FX(FX({},c),{},{tickCoord:c.coordinate});null!=c.tickCoord&&FY(e,c.tickCoord,u,s,l)&&(l=c.tickCoord-e*(u()/2+i),a[t]=FX(FX({},c),{},{isShow:!0}))},u=o-1;u>=0;u--)c(u);return a}(v,x,g,a,s)).filter(e=>e.isShow)}(FZ(FZ({},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),_=I_(w),S=IS(r),A={};"object"==typeof i&&(A=i);var T=FZ(FZ({},_),{},{fill:"none"},A),O=k.map(e=>FZ({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=kJ(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 eg.createElement(Rf,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},i&&eg.createElement("line",Fq({},T,n,{className:(0,C7.clsx)("recharts-cartesian-axis-tick-line",(0,kX.default)(i,"className"))})))}),P=O.map((e,t)=>{var{entry:n,tick:i}=e,u=FZ(FZ(FZ(FZ({textAnchor:E,verticalAnchor:C},_),{},{stroke:"none",fill:a},S),i),{},{index:t,payload:n,visibleTicksCount:k.length,tickFormatter:o,padding:l},c);return eg.createElement(Rf,Fq({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];IN(i)&&"function"==typeof a&&(r||(r={}),r[i]=e=>(a(t,n,e),null))}),r})(j,n,t)),r&&eg.createElement(F0,{option:r,tickProps:u,value:"".concat("function"==typeof o?o(n.value,t):n.value).concat(s||"")}))});return eg.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(N,"-ticks")},P.length>0&&eg.createElement(RY,{zIndex:OU.label},eg.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(N,"-tick-labels"),ref:t},P)),M.length>0&&eg.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(N,"-tick-lines")},M))}),F2=(0,eg.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,F$),[u,d]=(0,eg.useState)(""),[h,f]=(0,eg.useState)(""),p=(0,eg.useRef)(null);(0,eg.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,eg.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:eg.createElement(RY,{zIndex:e.zIndex},eg.createElement(Rf,{className:(0,C7.clsx)("recharts-cartesian-axis",a)},eg.createElement(FJ,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:I_(e)}),eg.createElement(F1,{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}),eg.createElement(RJ,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},eg.createElement(R6,{label:e.label,labelRef:e.labelRef}),e.children)))}),F5=eg.forwardRef((e,t)=>{var n=Ri(e,FQ);return eg.createElement(F2,Fq({},n,{ref:t}))});F5.displayName="CartesianAxis";var F3=["domain","range"],F4=["domain","range"];function F6(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 F8(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]}var F7=["dangerouslySetInnerHTML","ticks","scale"],F9=["id","scale"];function Ve(){return(Ve=Object.assign.bind()).apply(null,arguments)}function Vt(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 Vn(e){var t=Cb(),n=(0,eg.useRef)(null);return(0,eg.useLayoutEffect)(()=>{null===n.current?t(Ln(e)):n.current!==e&&t(Lr({prev:n.current,next:e})),n.current=e},[e,t]),(0,eg.useLayoutEffect)(()=>()=>{n.current&&(t(Li(n.current)),n.current=null)},[t]),null}var Vr=e=>{var{xAxisId:t,className:n}=e,r=Ck(C5),i=C4(),a="xAxis",o=Ck(e=>PI(e,a,t,i)),s=Ck(e=>PS(e,t)),l=Ck(e=>PO(e,t)),c=Ck(e=>Ml(e,t));if(null==s||null==l||null==c)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:h}=e,f=Vt(e,F7),{id:p,scale:g}=c,v=Vt(c,F9);return eg.createElement(F5,Ve({},f,v,{x:l.x,y:l.y,width:s.width,height:s.height,className:(0,C7.clsx)("recharts-".concat(a," ").concat(a),n),viewBox:r,ticks:o,axisType:a}))},Vi={allowDataOverflow:Ms.allowDataOverflow,allowDecimals:Ms.allowDecimals,allowDuplicatedCategory:Ms.allowDuplicatedCategory,angle:Ms.angle,axisLine:FQ.axisLine,height:Ms.height,hide:!1,includeHidden:Ms.includeHidden,interval:Ms.interval,minTickGap:Ms.minTickGap,mirror:Ms.mirror,orientation:Ms.orientation,padding:Ms.padding,reversed:Ms.reversed,scale:Ms.scale,tick:Ms.tick,tickCount:Ms.tickCount,tickLine:FQ.tickLine,tickSize:FQ.tickSize,type:Ms.type,xAxisId:0},Va=eg.memo(e=>{var t=Ri(e,Vi);return eg.createElement(eg.Fragment,null,eg.createElement(Vn,{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}),eg.createElement(Vr,t))},function(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=F6(e,F3),{domain:a,range:o}=t,s=F6(t,F4);return!!F8(n,a)&&!!F8(r,o)&&Ix(i,s)});function Vo(){return(Vo=Object.assign.bind()).apply(null,arguments)}function Vs(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 Vl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vs(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)):Vs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vc(e){return Array.isArray(e)&&k0(e[0])&&k0(e[1])?e.join(" ~ "):e}Va.displayName="XAxis";var Vu=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=Vl({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),p=Vl({margin:0},i),g=null!=u,v=g?u:"",x=(0,C7.clsx)("recharts-default-tooltip",l),y=(0,C7.clsx)("recharts-tooltip-label",c);return g&&d&&null!=a&&(v=d(u,a)),eg.createElement("div",Vo({className:x,style:f},h?{role:"status","aria-live":"assertive"}:{}),eg.createElement("p",{className:y,style:p},eg.isValidElement(v)?v:"".concat(v)),(()=>{if(a&&a.length){var e=(s?(0,CE.default)(a,s):a).map((e,n)=>{if("none"===e.type)return null;var i=e.formatter||o||Vc,{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=Vl({display:"block",paddingTop:4,paddingBottom:4,color:e.color||"#000"},r);return eg.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(n),style:h},k0(u)?eg.createElement("span",{className:"recharts-tooltip-item-name"},u):null,k0(u)?eg.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,eg.createElement("span",{className:"recharts-tooltip-item-value"},c),eg.createElement("span",{className:"recharts-tooltip-item-unit"},e.unit||""))});return eg.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},e)}return null})())},Vd=eg,Vh="recharts-tooltip-wrapper",Vf={visibility:"hidden"};function Vp(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offsetTopLeft:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:l,viewBoxDimension:c}=e;if(a&&kJ(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 Vg(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 Vm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vg(Object(n),!0).forEach(function(t){Vv(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vv(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 Vx extends Vd.PureComponent{constructor(){super(...arguments),Vv(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),Vv(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=Vp({allowEscapeViewBox:i,coordinate:a,key:"x",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.width,viewBox:d,viewBoxDimension:d.width}),translateY:r=Vp({allowEscapeViewBox:i,coordinate:a,key:"y",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.height,viewBox:d,viewBoxDimension:d.height}),useTranslate3d:u}):Vf,cssClasses:function(e){var{coordinate:t,translateX:n,translateY:r}=e;return(0,C7.clsx)(Vh,{["".concat(Vh,"-right")]:kJ(n)&&t&&kJ(t.x)&&n>=t.x,["".concat(Vh,"-left")]:kJ(n)&&t&&kJ(t.x)&&n<t.x,["".concat(Vh,"-bottom")]:kJ(r)&&t&&kJ(t.y)&&r>=t.y,["".concat(Vh,"-top")]:kJ(r)&&t&&kJ(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?{}:Vm(Vm({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=Vm(Vm({},b),{},{visibility:!this.state.dismissed&&e&&o?"visible":"hidden"},f);return Vd.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:x,style:w,ref:g},i)}}var Vy=e.i(92809),Vb=["x","y","top","left","width","height","className"];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}var VN=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?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}({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,Vb));return kJ(t)&&kJ(n)&&kJ(a)&&kJ(o)&&kJ(r)&&kJ(i)?eg.createElement("path",Vw({},IA(l),{className:(0,C7.clsx)("recharts-cross",s),d:"M".concat(t,",").concat(r,"v").concat(o,"M").concat(i,",").concat(n,"h").concat(a)})):null};function Vk(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[OV(t,n,r,i),OV(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}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}function VC(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}function V_(){return(V_=Object.assign.bind()).apply(null,arguments)}function VS(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?VS(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)):VS(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VT(e){var{cursor:t,cursorComp:n,cursorProps:r}=e;return(0,eg.isValidElement)(t)?(0,eg.cloneElement)(t,r):(0,eg.createElement)(n,r)}function VO(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=VN,a=OU.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=zc,a=OU.cursorRectangle;else if("radial"===d&&Bs(o)){var{cx:g,cy:v,radius:x,startAngle:y,endAngle:b}=Vk(o);r={cx:g,cy:v,startAngle:y,endAngle:b,innerRadius:x,outerRadius:x},i=zj,a=OU.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(Bs(t)){if("centric"===e){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,l=OV(r,i,a,s),c=OV(r,i,o,s);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return Vk(t)}}(d,o,c)},i=Fv,a=OU.cursorLine;var w="object"==typeof h&&"className"in h?h.className:void 0,j=VA(VA(VA(VA({stroke:"#ccc",pointerEvents:"none"},c),r),IS(h)),{},{payload:s,payloadIndex:l,className:(0,C7.clsx)("recharts-tooltip-cursor",w)});return eg.createElement(RY,{zIndex:null!=(n=e.zIndex)?n:a},eg.createElement(VT,{cursor:h,cursorComp:i,cursorProps:j}))}function VM(e){var t,n,r,i,a=(t=Ck(ML),n=Ck(DC),r=Ck(DN),t&&r?CW(VC(VC({},t),{},{scale:r}),n):CW(void 0,n)),o=null!=(i=Ck(C1))?i:_m,s=Ck(_v),l=Ck(OD);return null==a||null==o||null==s||null==l?null:eg.createElement(VO,V_({},e,{offset:o,layout:s,tooltipAxisBandSize:a,chartName:l}))}function VP(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 VD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?VP(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)):VP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VL(e){return e.dataKey}var VI=[],VR={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 VB(e){var t,n,r,i,a,o,s,l,c,u,d,h=Ri(e,VR),{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:A,defaultIndex:T,portal:O,axisId:M}=h,P=Cb(),D="number"==typeof T?String(T):T;(0,eg.useEffect)(()=>{P(E6({shared:S,trigger:A,axisId:M,active:f,defaultIndex:D}))},[P,S,A,M,f,D]);var L=_g(),I=Iw(),R=Ck(e=>PW(e,S)),{activeIndex:B,isActive:z}=null!=(u=Ck(e=>D0(e,R,A,D)))?u:{},F=Ck(e=>DJ(e,R,A,D)),V=Ck(e=>DQ(e,R,A,D)),U=Ck(e=>DZ(e,R,A,D)),H=(0,eg.useContext)(IK),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,eg.useState)({height:0,left:0,top:0,width:0}),r=(0,eg.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]),X="axis"===R?V:void 0;t=Ck(e=>((e,t,n)=>{if(null!=t){var r=PJ(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,A)),n=Ck(OR),r=Ck(OL),i=Ck(OI),o=null==(a=Ck(IG))?void 0:a.active,s=_g(),(0,eg.useEffect)(()=>{if(!o&&null!=r&&null!=n){var e=Cr({active:W,coordinate:U,dataKey:t,index:B,label:"number"==typeof X?String(X):X,sourceViewBox:s,graphicalItemId:void 0});IH.emit(IW,r,e,n)}},[o,U,t,B,X,n,r,i,W,s]);var $=null!=O?O:H;if(null==$||null==L||null==R)return null;var q=null!=F?F:VI;W||(q=VI),y&&q.length&&(l=q.filter(e=>null!=e.value&&(!0!==e.hide||h.includeHidden)),q=!0===j?(0,Vy.default)(l,VL):"function"==typeof j?(0,Vy.default)(l,j):l);var K=q.length>0,Z=eg.createElement(Vx,{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=VD(VD({},h),{},{payload:q,label:X,active:W,activeIndex:B,coordinate:U,accessibilityLayer:I}),eg.isValidElement(x)?eg.cloneElement(x,c):"function"==typeof x?eg.createElement(x,c):eg.createElement(Vu,c)));return eg.createElement(eg.Fragment,null,(0,e0.createPortal)(Z,$),W&&eg.createElement(VM,{cursor:_,tooltipEventType:R,coordinate:U,payload:q,index:B}))}let Vz=[{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"}],VF=[{value:"all",label:"All transports"},{value:"http",label:"HTTP"},{value:"mcp",label:"MCP"},{value:"system",label:"System"}],VV=[{value:"1d",label:"Today"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"}];function VU(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 VH(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 VW({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 VY({bankId:e}){let[t,n]=(0,eg.useState)("7d"),[r,i]=(0,eg.useState)(null),[a,o]=(0,eg.useState)([]),[s,l]=(0,eg.useState)("day"),[c,u]=(0,eg.useState)(!1),d=(0,eg.useCallback)(async(n=t,i=r)=>{u(!0);try{let t=await eP.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,eg.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)("div",{className:"border rounded-md p-4 space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold",children:"Request Volume"}),(0,ep.jsxs)("div",{className:"flex gap-2 ml-auto",children:[(0,ep.jsxs)(pl.Select,{value:r||"all",onValueChange:e=>{let n="all"===e?null:e;i(n),d(t,n)},children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-[160px] h-8 text-xs",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsx)(pl.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:Vz.map(e=>(0,ep.jsx)(pl.SelectItem,{value:e.value,children:e.label},e.value))})]}),VV.map(e=>(0,ep.jsx)(eD.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)("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)(_f,{width:"100%",height:"100%",children:(0,ep.jsxs)(Rc,{data:h,margin:{top:5,right:5,bottom:0,left:5},children:[(0,ep.jsx)(Va,{dataKey:"time",tick:{fontSize:10},axisLine:!1,tickLine:!1,className:"text-muted-foreground"}),(0,ep.jsx)(VB,{contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px",padding:"4px 8px"}}),(0,ep.jsx)(FV,{type:"monotone",dataKey:"total",stroke:"hsl(var(--primary))",strokeWidth:2,dot:!1,activeDot:{r:3}})]})})})]})}function VG(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,eg.useState)([]),[r,i]=(0,eg.useState)(0),[a,o]=(0,eg.useState)(null),[s,l]=(0,eg.useState)(null),[c,u]=(0,eg.useState)("all"),[d]=(0,eg.useState)(20),[h,f]=(0,eg.useState)(0),[p,g]=(0,eg.useState)(!1),[v,x]=(0,eg.useState)(null),[y,b]=(0,eg.useState)(!1),w=(0,eg.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,eg.useCallback)(async(t=a,r=s,o=c,l=h)=>{if(e){g(!0);try{let a=w(o),s=await eP.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,eg.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)(VY,{bankId:e}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,ep.jsxs)(pl.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)(pl.SelectTrigger,{className:"w-[180px]",children:(0,ep.jsx)(pl.SelectValue,{placeholder:"All actions"})}),(0,ep.jsx)(pl.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:Vz.map(e=>(0,ep.jsx)(pl.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(pl.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)(pl.SelectTrigger,{className:"w-[160px]",children:(0,ep.jsx)(pl.SelectValue,{placeholder:"All transports"})}),(0,ep.jsx)(pl.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:VF.map(e=>(0,ep.jsx)(pl.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(pl.Select,{value:c,onValueChange:e=>{u(e),f(0),j(a,s,e,0)},children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-[150px]",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{position:"popper",children:[(0,ep.jsx)(pl.SelectItem,{value:"all",children:"All time"}),(0,ep.jsx)(pl.SelectItem,{value:"1h",children:"Last hour"}),(0,ep.jsx)(pl.SelectItem,{value:"1d",children:"Last 24 hours"}),(0,ep.jsx)(pl.SelectItem,{value:"7d",children:"Last 7 days"}),(0,ep.jsx)(pl.SelectItem,{value:"30d",children:"Last 30 days"})]})]}),(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",onClick:()=>j(a,s,c,h),disabled:p,children:[(0,ep.jsx)(eV,{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.jsx)("div",{className:"border rounded-md",children:(0,ep.jsxs)(e$,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-[200px]",children:"Time"}),(0,ep.jsx)(eQ,{children:"Action"}),(0,ep.jsx)(eQ,{className:"w-[100px]",children:"Transport"}),(0,ep.jsx)(eQ,{className:"w-[100px]",children:"Duration"})]})}),(0,ep.jsx)(eK,{children:0===t.length?(0,ep.jsx)(eZ,{children:(0,ep.jsx)(eJ,{colSpan:4,className:"text-center text-muted-foreground py-8",children:p?"Loading...":"No audit logs found"})}):t.map(e=>(0,ep.jsxs)(eZ,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>{x(e),b(!0)},children:[(0,ep.jsx)(eJ,{className:"text-sm font-mono",children:VH(e.started_at)}),(0,ep.jsx)(eJ,{className:"font-medium",children:e.action}),(0,ep.jsx)(eJ,{children:(0,ep.jsx)(VW,{transport:e.transport})}),(0,ep.jsx)(eJ,{className:"text-sm text-muted-foreground font-mono",children:VU(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)(eD.Button,{variant:"outline",size:"sm",onClick:()=>N(Math.max(0,h-d)),disabled:0===h,children:[(0,ep.jsx)(e_,{className:"w-4 h-4 mr-1"}),"Previous"]}),(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",onClick:()=>N(h+d),disabled:h+d>=r,children:["Next",(0,ep.jsx)(eS.ChevronRight,{className:"w-4 h-4 ml-1"})]})]})]}),(0,ep.jsx)(tV.Dialog,{open:y,onOpenChange:b,children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsx)(tV.DialogHeader,{children:(0,ep.jsxs)(tV.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)(VW,{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:VH(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:VU(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 VX=(0,ej.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 tz=tz;e.s(["default",0,function(){(0,em.useParams)();let e=(0,em.useRouter)(),t=(0,em.useSearchParams)(),{features:n}=(0,eb.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,eg.useState)(!1),[f,p]=(0,eg.useState)(!1),[g,v]=(0,eg.useState)(!1),[x,y]=(0,eg.useState)(!1),[b,w]=(0,eg.useState)(!1),[j,N]=(0,eg.useState)(!1),[k,E]=(0,eg.useState)(!1),[C,_]=(0,eg.useState)(!1),S=t=>{e.push(`/banks/${r}?view=data&subTab=${t}`)},A=t=>{e.push(`/banks/${r}?view=profile&bankConfigTab=${t}`)},T=async()=>{if(r){p(!0);try{await eP.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 eP.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 eP.client.resetBankConfig(r),E(!1)}catch{}finally{_(!1)}}},P=async()=>{if(r){w(!0);try{await eP.client.triggerConsolidation(r)}catch(e){}finally{w(!1)}}},D=async()=>{if(r){N(!0);try{let e=await eP.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)(eM,{currentTab:o,onTabChange:t=>{e.push(`/banks/${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)(jc,{children:[(0,ep.jsx)(jd,{asChild:!0,children:(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",children:["Actions",(0,ep.jsx)(b5,{className:"w-4 h-4 ml-2"})]})}),(0,ep.jsxs)(jk,{align:"end",className:"w-48",children:[(0,ep.jsxs)(jE,{onClick:async()=>{if(r)try{let e=await eP.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)(VX,{className:"w-4 h-4 mr-2"}),"Export Template"]}),(0,ep.jsx)(jC,{}),(0,ep.jsxs)(jE,{onClick:P,disabled:b||!c,title:c?void 0:"Observations feature is not enabled",children:[b?(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(pw,{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)(jE,{onClick:D,disabled:j||!c,title:c?void 0:"Observations feature is not enabled",children:[j?(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(bJ,{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)(jE,{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)(pn,{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)(jC,{}),(0,ep.jsxs)(jE,{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)(bJ,{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)(jC,{}),(0,ep.jsxs)(jE,{onClick:()=>h(!0),className:"text-red-600 dark:text-red-400 focus:text-red-700 dark:focus:text-red-300",children:[(0,ep.jsx)(pn,{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:()=>A("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:()=>A("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:()=>A("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:()=>A("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)(bQ,{}),(0,ep.jsx)(b1,{}),(0,ep.jsx)(bg,{hideReflectFields:!0})]})]}),"configuration"===l&&u&&(0,ep.jsx)("div",{className:"space-y-6",children:(0,ep.jsx)(bI,{})}),"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)(jF,{})]}),"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)(VG,{})]})]})]}),"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)(bd,{})]}),"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)(bl,{})]}),"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)(fD,{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)(fD,{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)(fD,{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)(jS,{},"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)(po,{})]}),"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)(ps,{})]})]})})]}),(0,ep.jsx)(fU,{open:d,onOpenChange:h,children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Delete Memory Bank"}),(0,ep.jsx)(f9,{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)(f8,{children:[(0,ep.jsx)(pt,{disabled:f,children:"Cancel"}),(0,ep.jsx)(pe,{onClick:T,disabled:f,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:f?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pn,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(fU,{open:k,onOpenChange:E,children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Reset Configuration"}),(0,ep.jsx)(f9,{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)(f8,{children:[(0,ep.jsx)(pt,{disabled:C,children:"Cancel"}),(0,ep.jsx)(pe,{onClick:M,disabled:C,children:C?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Resetting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(bJ,{className:"w-4 h-4 mr-2"}),"Reset Configuration"]})})]})]})}),(0,ep.jsx)(fU,{open:g,onOpenChange:v,children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Clear Observations"}),(0,ep.jsx)(f9,{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)(f8,{children:[(0,ep.jsx)(pt,{disabled:x,children:"Cancel"}),(0,ep.jsx)(pe,{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)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pn,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})})]})}],37578)}]);
8
+ ${z.trim()}`:z.trim();await eP.client.updateDirective(d,t.id,{content:e})}else await eP.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=A.split(",").map(e=>e.trim()).filter(e=>e.length>0),t=R.split(",").map(e=>e.trim()).filter(e=>e.length>0),n=await eP.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)(pg,{children:(0,ep.jsxs)(py,{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)(eN,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eL.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)(eD.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)(pl.Select,{value:p,onValueChange:e=>g(e),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(pl.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(pl.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)(eL.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)(pc.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)(pc.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)(eG,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eL.Input,{type:"text",value:A,onChange:e=>T(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(pl.Select,{value:O,onValueChange:e=>M(e),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(pl.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(pl.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(pl.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)(pf,{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)(pc.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)(eL.Input,{type:"text",value:R,onChange:e=>B(e.target.value),placeholder:"model-a, model-b",className:"h-8 w-48"})]})]})]})}),_&&(0,ep.jsx)(pg,{children:(0,ep.jsxs)(py,{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)(pg,{children:[(0,ep.jsx)(pm,{children:(0,ep.jsx)(pv,{children:"Answer"})}),(0,ep.jsx)(py,{children:(0,ep.jsx)("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:(0,ep.jsx)(xL,{remarkPlugins:[bn],children:E.text})})})]}),(0,ep.jsxs)(pg,{className:"border-blue-200 dark:border-blue-800",children:[(0,ep.jsxs)(pm,{className:"py-4",children:[(0,ep.jsxs)(pv,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(pj,{className:"w-4 h-4"}),"Add Directive"]}),(0,ep.jsx)(px,{className:"text-xs",children:"Hard rules injected into prompts that the agent must follow"})]}),(0,ep.jsx)(py,{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)(pE.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)(eD.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)(pg,{className:"border-emerald-200 dark:border-emerald-800",children:[(0,ep.jsxs)(pm,{className:"bg-emerald-50 dark:bg-emerald-950 py-3",children:[(0,ep.jsxs)(pv,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(pw,{className:"w-4 h-4 text-emerald-600"}),"Observations Created (",E.observations_created.length,")"]}),(0,ep.jsx)(px,{className:"text-xs",children:"New observations learned during this reflection"})]}),(0,ep.jsx)(py,{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)(pg,{className:"h-fit",children:[(0,ep.jsxs)(pm,{className:"pb-3",children:[(0,ep.jsx)(pv,{className:"text-base",children:"Execution Trace"}),(0,ep.jsxs)(px,{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)(py,{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)(tB.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)(eH,{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)(pk,{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)(eH,{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)(ga,{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)(ga,{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)(pb.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)(pb.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)(pg,{className:"h-fit",children:[(0,ep.jsxs)(pm,{className:"pb-3",children:[(0,ep.jsx)(pv,{className:"text-base",children:"Based On"}),(0,ep.jsxs)(px,{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)(py,{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)(pb.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)(pb.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)(pg,{children:[(0,ep.jsx)(pm,{children:(0,ep.jsx)(pv,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(py,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(ga,{src:E,collapsed:2,theme:"default"})})})]})]}),!_&&!E&&(0,ep.jsx)(pg,{className:"border-dashed",children:(0,ep.jsxs)(py,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(eN,{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)(tK,{memoryId:Y,onClose:()=>G(null)}),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.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)(pN,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Directive"})]}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"icon",onClick:()=>{$(null),K(null)},children:(0,ep.jsx)(eX.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||X.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)(eG,{className:"w-2.5 h-2.5"}),e]},e))})]}),(q?.content||X.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||X.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:X.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)(pw,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Observation"})]}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"icon",onClick:()=>{ee(null),en(null)},children:(0,ep.jsx)(eX.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)(xL,{remarkPlugins:[bn],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)(eG,{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)(bs,{mentalModelId:ea,onClose:()=>eo(null)})]}):(0,ep.jsx)(pg,{className:"border-dashed",children:(0,ep.jsxs)(py,{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-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."})]})})}var bc=e.i(64659);let bu=(0,ej.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function bd(){let e,t,n,r,i,a,o,s,l,c,u,d,h,f,{currentBank:p}=(0,ey.useBank)(),[g,v]=(0,eg.useState)(""),[x,y]=(0,eg.useState)(["world"]),[b,w]=(0,eg.useState)("mid"),[j,N]=(0,eg.useState)(4096),[k,E]=(0,eg.useState)(""),[C,_]=(0,eg.useState)(!1),[S,A]=(0,eg.useState)(!1),[T,O]=(0,eg.useState)(""),[M,P]=(0,eg.useState)("any"),[D,L]=(0,eg.useState)(null),[I,R]=(0,eg.useState)(null),[B,z]=(0,eg.useState)(null),[F,V]=(0,eg.useState)(null),[U,H]=(0,eg.useState)(null),[W,Y]=(0,eg.useState)(!1),[G,X]=(0,eg.useState)("results"),[$,q]=(0,eg.useState)(null),[K,Z]=(0,eg.useState)(new Set),[Q,J]=(0,eg.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=T.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 eP.client.recall(t);L(n.results||[]),R(n.entities||null),z(n.chunks||null),V(n.observations||null),H(n.trace||null),X("results")}catch(e){}finally{Y(!1)}}};return p?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(pg,{children:(0,ep.jsxs)(py,{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)(ew.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eL.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)(eD.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)(pf,{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)(gs,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsxs)(pl.Select,{value:b,onValueChange:e=>w(e),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(pl.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(pl.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)(eL.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)(eH,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eL.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)(pc.Checkbox,{checked:C,onCheckedChange:e=>_(e)}),(0,ep.jsx)(eE.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)(pc.Checkbox,{checked:S,onCheckedChange:e=>A(e)}),(0,ep.jsx)(eC,{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)(eG,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eL.Input,{type:"text",value:T,onChange:e=>O(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(pl.Select,{value:M,onValueChange:e=>P(e),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(pl.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(pl.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(pl.SelectItem,{value:"all_strict",children:"All (strict)"})]})]})]})]})}),W&&(0,ep.jsx)(pg,{children:(0,ep.jsxs)(py,{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:()=>X(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)(pg,{className:"border-orange-500/30 bg-orange-500/5",children:[(0,ep.jsx)(pm,{className:"py-3",children:(0,ep.jsxs)(pv,{className:"text-base flex items-center gap-2",children:[(0,ep.jsx)(ek,{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)(py,{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)(pg,{className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>q(e),children:(0,ep.jsx)(py,{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)(eS.ChevronRight,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"})]})})},t)}):(0,ep.jsx)(pg,{children:(0,ep.jsxs)(py,{className:"flex flex-col items-center justify-center py-12",children:[(0,ep.jsx)(ew.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)(pg,{className:`transition-colors ${a?"border-primary":c.border}`,children:(0,ep.jsxs)(py,{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)(bc.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eS.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)(eI,{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)(bc.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ep.jsx)(eS.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)(bu,{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)(pg,{className:`cursor-pointer transition-colors ${r?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(n),children:(0,ep.jsx)(py,{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)(bc.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eS.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)(bu,{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)(pg,{className:`cursor-pointer transition-colors ${c?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(l),children:(0,ep.jsx)(py,{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)(bc.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eS.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)(bu,{className:"h-4 w-4 text-muted-foreground/50"})})]})),(0,ep.jsx)(pg,{className:"border-primary bg-primary/5",children:(0,ep.jsx)(py,{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)(pg,{children:[(0,ep.jsx)(pm,{children:(0,ep.jsx)(pv,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(py,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(ga,{src:{results:D,...I&&{entities:I},...B&&{chunks:B},...F&&{observations:F},trace:U},collapsed:2,theme:"default"})})})]})]}),!W&&!D&&(0,ep.jsx)(pg,{className:"border-dashed",children:(0,ep.jsxs)(py,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ew.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."})]})}),$&&(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)(tZ,{memory:$,onClose:()=>q(null),inPanel:!0,bankId:p||void 0})})]}):(0,ep.jsx)(pg,{className:"border-dashed",children:(0,ep.jsxs)(py,{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-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 bh=(0,ej.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 bf=e.i(82458),bf=bf,tz=tz;let bp={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 bg({hideReflectFields:e=!1}){let t=(0,em.useRouter)(),{currentBank:n,setCurrentBank:r,loadBanks:i}=(0,ey.useBank)(),{features:a}=(0,eb.useFeatures)();a?.observations;let[o,s]=(0,eg.useState)(null),[l,c]=(0,eg.useState)(null),[u,d]=(0,eg.useState)([]),[h,f]=(0,eg.useState)(0),[p,g]=(0,eg.useState)([]),[v,x]=(0,eg.useState)(0),[y,b]=(0,eg.useState)(!1),[w,j]=(0,eg.useState)(!1),[N,k]=(0,eg.useState)(!1),[E,C]=(0,eg.useState)(!1),[_,S]=(0,eg.useState)(null),[A,T]=(0,eg.useState)(null),[O,M]=(0,eg.useState)(!1),[P,D]=(0,eg.useState)(!1),[L,I]=(0,eg.useState)(!1),[R,B]=(0,eg.useState)(!1),[z,F]=(0,eg.useState)(!1),[V,U]=(0,eg.useState)(!1),[H,W]=(0,eg.useState)(null),[Y]=(0,eg.useState)(10),[G,X]=(0,eg.useState)(0),[$,q]=(0,eg.useState)(null),K=async(e=H,t=G)=>{if(n)try{let r=await eP.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([eP.client.getBankStats(n),eP.client.listDirectives(n),eP.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([eP.client.getBankProfile(n),eP.client.getBankStats(n),eP.client.listDirectives(n),eP.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 eP.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 eP.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&&A){M(!0);try{await eP.client.deleteDirective(n,A.id),g(e=>e.filter(e=>e.id!==A.id)),_?.id===A.id&&S(null),T(null)}catch(e){}finally{M(!1)}}};return((0,eg.useEffect)(()=>{if(n){Z();let e=setInterval(()=>Z(!0),5e3);return()=>clearInterval(e)}},[n]),(0,eg.useEffect)(()=>{let e=e=>{"Escape"===e.key&&S(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),n)?y&&!o?(0,ep.jsx)(pg,{children:(0,ep.jsxs)(py,{className:"text-center py-10",children:[(0,ep.jsx)(eH,{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)(pg,{children:[(0,ep.jsx)(pm,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(pv,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(pw,{className:"w-5 h-5 text-primary"}),"Disposition Profile"]}),(0,ep.jsx)(px,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)(eD.Button,{onClick:()=>j(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(pr,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(py,{children:o&&(0,ep.jsx)("div",{className:"space-y-4",children:Object.keys(bp).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:bp[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:bp[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:bp[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:bp[e].highLabel})]})]},e))})})]}),(0,ep.jsxs)(pg,{children:[(0,ep.jsx)(pm,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(pv,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(bh,{className:"w-5 h-5 text-primary"}),"Mission"]}),(0,ep.jsx)(px,{children:"Affects how observations, reflect, and mental models are created"})]}),(0,ep.jsx)(eD.Button,{onClick:()=>k(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(pr,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(py,{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)(bf.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)(eD.Button,{onClick:()=>C(!0),variant:"outline",size:"sm",className:"h-8",children:[(0,ep.jsx)(fP.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)(pg,{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)(py,{className:"p-3",children:(0,ep.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ep.jsx)(bf.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)(eG,{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)(bf.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)(fU,{open:P,onOpenChange:D,children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Delete Memory Bank"}),(0,ep.jsx)(f9,{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)(f8,{children:[(0,ep.jsx)(pt,{disabled:L,children:"Cancel"}),(0,ep.jsx)(pe,{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)(eV,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pn,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(fU,{open:R,onOpenChange:B,children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Clear Observations"}),(0,ep.jsx)(f9,{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)(f8,{children:[(0,ep.jsx)(pt,{disabled:z,children:"Cancel"}),(0,ep.jsx)(pe,{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)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pn,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})}),(0,ep.jsx)(bx,{open:E,mode:"create",onClose:()=>C(!1),onCreated:e=>{g(t=>[e,...t]),C(!1)}}),(0,ep.jsx)(fU,{open:!!A,onOpenChange:e=>!e&&T(null),children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Delete Directive"}),(0,ep.jsxs)(f9,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',A?.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)(f8,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(pt,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(pe,{onClick:ee,disabled:O,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[O?(0,ep.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),_&&(0,ep.jsx)(by,{directive:_,onClose:()=>S(null),onDelete:()=>T({id:_.id,name:_.name}),onUpdated:e=>{g(t=>t.map(t=>t.id===e.id?e:t)),S(e)}}),w&&o&&(0,ep.jsx)(bm,{disposition:o.disposition,onClose:()=>j(!1),onSaved:async()=>{await Z(),j(!1)}}),N&&o&&(0,ep.jsx)(bv,{mission:o.mission||"",onClose:()=>k(!1),onSaved:async()=>{await Z(),k(!1)}})]}):(0,ep.jsx)(pg,{children:(0,ep.jsxs)(py,{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 bm({disposition:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,eg.useState)(!1),[o,s]=(0,eg.useState)(e),l=async()=>{if(r){a(!0);try{await eP.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)(tV.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Edit Disposition Traits"}),(0,ep.jsx)(tV.DialogDescription,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)("div",{className:"space-y-4 py-4",children:Object.keys(bp).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:bp[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:bp[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:bp[e].lowLabel}),(0,ep.jsx)("span",{children:bp[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)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eV,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function bv({mission:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,eg.useState)(!1),[o,s]=(0,eg.useState)(e),l=async()=>{if(r){a(!0);try{await eP.client.updateBankConfig(r,{reflect_mission:o||null}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tV.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Edit Mission"}),(0,ep.jsx)(tV.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)(pE.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)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eV,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function bx({open:e,mode:t,directive:n,onClose:r,onCreated:i,onSaved:a}){let{currentBank:o}=(0,ey.useBank)(),[s,l]=(0,eg.useState)(!1),[c,u]=(0,eg.useState)({name:"",content:"",tags:""});(0,eg.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 eP.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 eP.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)(tV.Dialog,{open:e,onOpenChange:e=>!e&&h(),children:(0,ep.jsxs)(tV.DialogContent,{className:"sm:max-w-lg",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsxs)(tV.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)(bf.default,{className:"w-5 h-5 text-rose-500"}),"create"===t?"Create":"Edit"," Directive"]}),(0,ep.jsx)(tV.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)(eL.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)(pE.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)(eL.Input,{value:c.tags,onChange:e=>u({...c,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"})]})]}),(0,ep.jsxs)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:h,disabled:s,children:"Cancel"}),(0,ep.jsxs)(eD.Button,{onClick:d,disabled:s||!c.name.trim()||!c.content.trim(),className:"bg-rose-500 hover:bg-rose-600",children:[s?(0,ep.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"create"===t?"Create":"Save"]})]})]})})}function by({directive:e,onClose:t,onDelete:n,onUpdated:r}){let[i,a]=(0,eg.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)(bf.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)(eD.Button,{variant:"ghost",size:"sm",onClick:()=>a(!0),className:"h-7 w-7 p-0",children:(0,ep.jsx)(pr,{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)(eD.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)(pn,{className:"h-4 w-4"})}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,ep.jsx)(eX.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)(xL,{remarkPlugins:[bn],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)(bx,{open:i,mode:"edit",directive:e,onClose:()=>a(!1),onSaved:r})]})}let bb=(0,e3.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"}}),bw=eg.forwardRef(({className:e,variant:t,...n},r)=>(0,ep.jsx)("div",{ref:r,role:"alert",className:(0,eT.cn)(bb({variant:t}),e),...n}));bw.displayName="Alert",eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("h5",{ref:n,className:(0,eT.cn)("mb-1 font-medium leading-none tracking-tight",e),...t})).displayName="AlertTitle";let bj=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eT.cn)("text-sm [&_p]:leading-relaxed",e),...t}));bj.displayName="AlertDescription";var tz=tz;let bN=(0,ej.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"}]]),bk=[{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"}],bE=[{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"}],bC=bk.map(e=>({category:e.value,threshold:"BLOCK_NONE"})),b_=[{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","delete_memory"]},{label:"Documents",tools:["list_documents","get_document","delete_document"]},{label:"Operations",tools:["list_operations","get_operation","cancel_operation"]},{label:"Tags",tools:["list_tags"]}],bS=b_.flatMap(e=>e.tools);function bA(e){return Array.isArray(e)?e:e&&"object"==typeof e&&Array.isArray(e.attributes)?e.attributes:null}function bT(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:bA(e.entity_labels)}}function bO(e){return{retain_default_strategy:e.retain_default_strategy??null,retain_strategies:e.retain_strategies??null}}function bM(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 bP(e){return{mcp_enabled_tools:e.mcp_enabled_tools??null}}function bD(e){return{llm_gemini_safety_settings:e.llm_gemini_safety_settings??null}}let bL={reflect_mission:"",disposition_skepticism:3,disposition_literalism:3,disposition_empathy:3};function bI(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,eb.useFeatures)(),n=t?.bank_config_api??!0,[r,i]=(0,eg.useState)(!0),[a,o]=(0,eg.useState)({}),[s,l]=(0,eg.useState)(bL),[c,u]=(0,eg.useState)(bT({})),[d,h]=(0,eg.useState)(bO({})),[f,p]=(0,eg.useState)(bM({})),[g,v]=(0,eg.useState)(bL),[x,y]=(0,eg.useState)(bP({})),[b,w]=(0,eg.useState)(bD({})),[j,N]=(0,eg.useState)(!1),[k,E]=(0,eg.useState)(!1),[C,_]=(0,eg.useState)(!1),[S,A]=(0,eg.useState)(!1),[T,O]=(0,eg.useState)(!1),[M,P]=(0,eg.useState)(null),[D,L]=(0,eg.useState)(null),[I,R]=(0,eg.useState)(null),[B,z]=(0,eg.useState)(null),[F,V]=(0,eg.useState)(null),U=(0,eg.useMemo)(()=>JSON.stringify(c)!==JSON.stringify(bT(a))||JSON.stringify(d)!==JSON.stringify(bO(a)),[c,d,a]),H=(0,eg.useMemo)(()=>JSON.stringify(f)!==JSON.stringify(bM(a)),[f,a]),W=(0,eg.useMemo)(()=>JSON.stringify(g)!==JSON.stringify(s),[g,s]),Y=(0,eg.useMemo)(()=>JSON.stringify(x)!==JSON.stringify(bP(a)),[x,a]),G=(0,eg.useMemo)(()=>JSON.stringify(b)!==JSON.stringify(bD(a)),[b,a]);(0,eg.useEffect)(()=>{e&&X()},[e]);let X=async()=>{if(e){i(!0);try{let[t,n]=await Promise.all([eP.client.getBankConfig(e),eP.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(bT(r)),h(bO(r)),p(bM(r)),v(i),y(bP(r)),w(bD(r))}catch(e){console.error("Failed to load bank data:",e)}finally{i(!1)}}},$=async()=>{if(e){N(!0),P(null);try{let t={...c,...d};await eP.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 eP.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 eP.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){A(!0),z(null);try{await eP.client.updateBankConfig(e,x),o(e=>({...e,...x}))}catch(e){z(e.message||"Failed to save MCP settings")}finally{A(!1)}}},Q=async()=>{if(e){O(!0),V(null);try{await eP.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)(tz.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)(bH,{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:$,children:[(0,ep.jsx)(bW,{label:"Default strategy",description:"Applied automatically when no strategy is specified on a request.",children:(0,ep.jsxs)(pl.Select,{value:d.retain_default_strategy??"__none__",onValueChange:e=>h(t=>({...t,retain_default_strategy:"__none__"===e?null:e})),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.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)(pl.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(bV,{defaultValues:c,onDefaultChange:e=>u(t=>({...t,...e})),strategies:d.retain_strategies,onStrategiesChange:e=>h(t=>({...t,retain_strategies:e}))})]}),(0,ep.jsxs)(bH,{title:"Observations",description:"Control how facts are synthesized into durable observations",error:D,dirty:H,saving:k,onSave:q,children:[(0,ep.jsx)(bW,{label:"Enable Observations",description:"Enable automatic consolidation of facts into observations",children:(0,ep.jsx)("div",{className:"flex justify-end",children:(0,ep.jsx)(tL.Switch,{checked:f.enable_observations??!1,onCheckedChange:e=>p(t=>({...t,enable_observations:e}))})})}),(0,ep.jsx)(bY,{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)(bW,{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)(eL.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)(bW,{label:"Source Facts Max Tokens",description:"Total token budget for source facts included with observations during consolidation. -1 = unlimited.",children:(0,ep.jsx)(eL.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)(bW,{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)(eL.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)(bW,{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)(eL.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)(bH,{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)(bY,{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)(bG,{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)(bG,{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)(bG,{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)(bH,{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)(bW,{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)(tL.Switch,{checked:null!==x.mcp_enabled_tools,onCheckedChange:e=>y({mcp_enabled_tools:e?[...bS]:null})}),(0,ep.jsx)(e6,{className:"text-xs text-muted-foreground",children:null!==x.mcp_enabled_tools?"Enabled":"Disabled"})]})}),null!==x.mcp_enabled_tools&&(0,ep.jsx)(bU,{selected:x.mcp_enabled_tools,onChange:e=>y({mcp_enabled_tools:e})})]}),(0,ep.jsx)(bH,{title:"Models",description:"Provider-specific model settings",error:F,dirty:G,saving:T,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)(bW,{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)(tL.Switch,{checked:null!==b.llm_gemini_safety_settings,onCheckedChange:e=>w({llm_gemini_safety_settings:e?[...bC]:null})}),(0,ep.jsx)(e6,{className:"text-xs text-muted-foreground",children:null!==b.llm_gemini_safety_settings?"Custom":"Default"})]})}),null!==b.llm_gemini_safety_settings&&(0,ep.jsx)(b$,{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 bR=["concise","verbose","verbatim","chunks","custom"],bB="__inherit__";function bz({values:e,onChange:t,isOverride:n=!1}){let r=e.retain_extraction_mode??(n?bB:""),i="custom"===e.retain_extraction_mode;return(0,ep.jsxs)("div",{className:"divide-y divide-border/40",children:[(0,ep.jsx)(bW,{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)(pl.Select,{value:r,onValueChange:e=>t({retain_extraction_mode:e===bB?null:e||null}),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(pl.SelectValue,{placeholder:n?"Inherited from default":void 0})}),(0,ep.jsxs)(pl.SelectContent,{children:[n&&(0,ep.jsx)(pl.SelectItem,{value:bB,children:(0,ep.jsx)("span",{className:"text-muted-foreground italic",children:"inherited"})}),bR.map(e=>(0,ep.jsx)(pl.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(bW,{label:"Chunk Size",description:"Size of text chunks for processing (characters)",children:(0,ep.jsx)(eL.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)(bY,{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)(bY,{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)(bW,{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)(e6,{className:"text-sm text-muted-foreground cursor-pointer select-none",children:e.entities_allow_free_form??!0?"Enabled":"Disabled"}),(0,ep.jsx)(tL.Switch,{checked:e.entities_allow_free_form??!0,onCheckedChange:e=>t({entities_allow_free_form:e})})]})}),(0,ep.jsx)(bX,{value:e.entity_labels??[],onChange:e=>t({entity_labels:e.length>0?e:null})})]})}function bF(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:bA(t.entity_labels)}})):[]}function bV({defaultValues:e,onDefaultChange:t,strategies:n,onStrategiesChange:r}){let[i,a]=(0,eg.useState)(()=>bF(n)),[o,s]=(0,eg.useState)("default"),[l,c]=(0,eg.useState)(null),u=(0,eg.useRef)(!1),d=JSON.stringify(n);(0,eg.useEffect)(()=>{if(u.current){u.current=!1;return}a(bF(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)(fP.Plus,{className:"h-3.5 w-3.5"}),"Add strategy"]})]}),(0,ep.jsx)("div",{children:"default"===o?(0,ep.jsx)(bz,{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)(eL.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)(bz,{values:p.values,onChange:e=>f(p.id,{values:{...p.values,...e}}),isOverride:!0})]}):null}),(0,ep.jsx)(fU,{open:null!==l,onOpenChange:e=>{e||c(null)},children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsxs)(f7,{children:["Delete strategy “",l?.name||"unnamed","”?"]}),(0,ep.jsx)(f9,{children:"This will remove the strategy and all its overrides. This cannot be undone."})]}),(0,ep.jsxs)(f8,{children:[(0,ep.jsx)(pt,{children:"Cancel"}),(0,ep.jsx)(pe,{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 bU({selected:e,onChange:t}){let n=new Set(e),r=bS.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 ",bS.length," tools enabled"]}),(0,ep.jsx)("button",{type:"button",onClick:()=>{t(r?[]:[...bS])},className:"text-xs text-primary hover:underline",children:r?"Deselect all":"Select all"})]}),(0,ep.jsx)("div",{className:"space-y-4",children:b_.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(bS.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(bS.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 bH({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)(pg,{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)(bw,{variant:"destructive",children:[(0,ep.jsx)(bN,{className:"h-4 w-4"}),(0,ep.jsx)(bj,{children:r})]})}),(0,ep.jsx)("div",{className:"px-6 py-4 flex justify-end border-t border-border/40",children:(0,ep.jsx)(eD.Button,{size:"sm",disabled:!i||a,onClick:o,children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):"Save changes"})})]})]})}function bW({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 bY({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)(pE.Textarea,{value:n,onChange:e=>r(e.target.value),placeholder:i,rows:a??3,className:"font-mono text-sm"})]})})}function bG({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 bX({value:e,onChange:t}){let[n,r]=(0,eg.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)(bc.ChevronDown,{className:"h-4 w-4"}):(0,ep.jsx)(eS.ChevronRight,{className:`h-4 w-4 ${c?"opacity-30":""}`})}),(0,ep.jsx)(eL.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)(eL.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)(pl.Select,{value:o.type,onValueChange:e=>i(s,{type:e,..."text"===e?{values:[]}:{}}),children:[(0,ep.jsx)(pl.SelectTrigger,{className:"h-8 text-xs w-32 shrink-0",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"value",className:"text-xs",children:"Single value"}),(0,ep.jsx)(pl.SelectItem,{value:"multi-values",className:"text-xs",children:"Multi-values"}),(0,ep.jsx)(pl.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)(pc.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)(pn,{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)(eL.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)(eL.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)(pn,{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)(fP.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)(fP.Plus,{className:"h-3.5 w-3.5"}),"Add attribute"]})]})}function b$({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:bk.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)(pl.Select,{value:n(e.value),onValueChange:r=>{var i;return i=e.value,void t(bk.map(e=>({category:e.value,threshold:e.value===i?r:n(e.value)})))},children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-48 h-8 text-xs",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsx)(pl.SelectContent,{children:bE.map(e=>(0,ep.jsx)(pl.SelectItem,{value:e.value,className:"text-xs",children:e.label},e.value))})]})]},e.value))})]})}let bq=(0,ej.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"}]]),bK=(0,ej.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"}]]),bZ=(0,ej.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"}]]);function bQ(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,eb.useFeatures)(),n=t?.observations??!1,[r,i]=(0,eg.useState)(null),[a,o]=(0,eg.useState)(0),[s,l]=(0,eg.useState)(0),[c,u]=(0,eg.useState)(!1),d=async()=>{if(e){u(!0);try{let[t,n,r]=await Promise.all([eP.client.getBankStats(e),eP.client.listMentalModels(e),eP.client.listDirectives(e)]);i(t),o(n.items?.length||0),l(r.items?.length||0)}catch(e){console.error("Error loading bank stats:",e)}finally{u(!1)}}};return((0,eg.useEffect)(()=>{if(e){d();let e=setInterval(d,5e3);return()=>clearInterval(e)}},[e]),c&&!r)?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(eH,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"})}):r?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,ep.jsx)(pg,{className:"bg-gradient-to-br from-blue-500/10 to-blue-600/5 border-blue-500/20",children:(0,ep.jsx)(py,{className:"p-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/20",children:(0,ep.jsx)(ek,{className:"w-5 h-5 text-blue-500"})}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Memories"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-foreground",children:r.total_nodes})]})]})})}),(0,ep.jsx)(pg,{className:"bg-gradient-to-br from-purple-500/10 to-purple-600/5 border-purple-500/20",children:(0,ep.jsx)(py,{className:"p-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/20",children:(0,ep.jsx)(bq,{className:"w-5 h-5 text-purple-500"})}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Links"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-foreground",children:r.total_links})]})]})})}),(0,ep.jsx)(pg,{className:"bg-gradient-to-br from-emerald-500/10 to-emerald-600/5 border-emerald-500/20",children:(0,ep.jsx)(py,{className:"p-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/20",children:(0,ep.jsx)(bK,{className:"w-5 h-5 text-emerald-500"})}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Documents"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-foreground",children:r.total_documents})]})]})})}),(0,ep.jsx)(pg,{className:`bg-gradient-to-br ${r.pending_operations>0?"from-amber-500/10 to-amber-600/5 border-amber-500/20":"from-slate-500/10 to-slate-600/5 border-slate-500/20"}`,children:(0,ep.jsx)(py,{className:"p-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)("div",{className:`p-2 rounded-lg ${r.pending_operations>0?"bg-amber-500/20":"bg-slate-500/20"}`,children:(0,ep.jsx)(bZ,{className:`w-5 h-5 ${r.pending_operations>0?"text-amber-500 animate-pulse":"text-slate-500"}`})}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Pending"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-foreground",children:r.pending_operations})]})]})})})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-5 gap-3",children:[(0,ep.jsxs)("div",{className:"bg-blue-500/10 border border-blue-500/20 rounded-xl p-4 text-center",children:[(0,ep.jsx)("p",{className:"text-xs text-blue-600 dark:text-blue-400 font-semibold uppercase tracking-wide",children:"World Facts"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400 mt-1",children:r.nodes_by_fact_type?.world||0})]}),(0,ep.jsxs)("div",{className:"bg-purple-500/10 border border-purple-500/20 rounded-xl p-4 text-center",children:[(0,ep.jsx)("p",{className:"text-xs text-purple-600 dark:text-purple-400 font-semibold uppercase tracking-wide",children:"Experience"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400 mt-1",children:r.nodes_by_fact_type?.experience||0})]}),(0,ep.jsxs)("div",{className:`rounded-xl p-4 text-center ${n?"bg-amber-500/10 border border-amber-500/20":"bg-muted/50 border border-muted"}`,title:n?void 0:"Observations feature is not enabled",children:[(0,ep.jsxs)("p",{className:`text-xs font-semibold uppercase tracking-wide ${n?"text-amber-600 dark:text-amber-400":"text-muted-foreground"}`,children:["Observations",!n&&(0,ep.jsx)("span",{className:"ml-1 normal-case",children:"(Off)"})]}),(0,ep.jsx)("p",{className:`text-2xl font-bold mt-1 ${n?"text-amber-600 dark:text-amber-400":"text-muted-foreground"}`,children:n?r.total_observations||0:"—"})]}),(0,ep.jsxs)("div",{className:"bg-cyan-500/10 border border-cyan-500/20 rounded-xl p-4 text-center",children:[(0,ep.jsx)("p",{className:"text-xs text-cyan-600 dark:text-cyan-400 font-semibold uppercase tracking-wide",children:"Mental Models"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-cyan-600 dark:text-cyan-400 mt-1",children:a})]}),(0,ep.jsxs)("div",{className:"bg-rose-500/10 border border-rose-500/20 rounded-xl p-4 text-center",children:[(0,ep.jsx)("p",{className:"text-xs text-rose-600 dark:text-rose-400 font-semibold uppercase tracking-wide",children:"Directives"}),(0,ep.jsx)("p",{className:"text-2xl font-bold text-rose-600 dark:text-rose-400 mt-1",children:s})]})]})]}):null}var tz=tz;let bJ=(0,ej.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"}]]),b0=[{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 b1(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,eg.useState)([]),[r,i]=(0,eg.useState)(0),[a,o]=(0,eg.useState)(null),[s,l]=(0,eg.useState)(null),[c]=(0,eg.useState)(10),[u,d]=(0,eg.useState)(0),[h,f]=(0,eg.useState)(null),[p,g]=(0,eg.useState)(null),[v,x]=(0,eg.useState)(!1),[y,b]=(0,eg.useState)(null),[w,j]=(0,eg.useState)(!1),[N,k]=(0,eg.useState)(!1),E=(0,eg.useCallback)(async(t=a,r=u,o=s)=>{if(e){x(!0);try{let a=await eP.client.listOperations(e,{status:t||void 0,type:o||void 0,limit:c,offset:r});n(a.operations||[]),i(a.total||0)}catch(e){console.error("Error loading operations:",e)}finally{x(!1)}}},[e,a,u,s,c]),C=e=>{d(e),E(a,e,s)},_=async t=>{if(e){f(t);try{await eP.client.cancelOperation(e,t),await E()}catch(e){}finally{f(null)}}},S=async t=>{if(e){g(t);try{await eP.client.retryOperation(e,t),await E()}catch(e){}finally{g(null)}}},A=async t=>{if(e){k(!0),j(!0);try{let n=await eP.client.getOperationStatus(e,t);b(n)}catch(e){console.error("Error loading operation details:",e),b({error:"Failed to load operation details"})}finally{k(!1)}}};return((0,eg.useEffect)(()=>{if(e){E(a,u,s);let e=setInterval(()=>E(a,u,s),5e3);return()=>clearInterval(e)}},[e,a,u,s]),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:"Background Operations"}),(0,ep.jsx)("button",{onClick:()=>E(),className:"p-1 rounded hover:bg-muted transition-colors",title:"Refresh operations",disabled:v,children:(0,ep.jsx)(eV,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${v?"animate-spin":""}`})})]}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:[r," operation",1!==r?"s":"",a?` (${a})`:""]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsxs)(pl.Select,{value:s??"all",onValueChange:e=>{var t;l(t="all"===e?null:e),d(0),E(a,0,t)},children:[(0,ep.jsx)(pl.SelectTrigger,{className:"h-9 w-[180px] text-sm",children:(0,ep.jsx)(pl.SelectValue,{placeholder:"All types"})}),(0,ep.jsx)(pl.SelectContent,{children:b0.map(e=>(0,ep.jsx)(pl.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:"completed",label:"Completed"},{value:"failed",label:"Failed"}].map(e=>(0,ep.jsx)("button",{onClick:()=>{var t;o(t=e.value),d(0),E(t,0,s)},className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${a===e.value?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e.label},e.value??"all"))})]})]}),(0,ep.jsx)("div",{children:t.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(e$,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eQ,{children:"Type"}),(0,ep.jsx)(eQ,{children:"Created"}),(0,ep.jsx)(eQ,{children:"Status"}),(0,ep.jsx)(eQ,{className:"w-[80px]"})]})}),(0,ep.jsx)(eK,{children:t.map(e=>(0,ep.jsxs)(eZ,{className:`cursor-pointer hover:bg-muted/50 ${"failed"===e.status?"bg-red-500/5":""}`,onClick:()=>A(e.id),children:[(0,ep.jsx)(eJ,{className:"font-mono text-xs text-muted-foreground",children:e.id.substring(0,8)}),(0,ep.jsx)(eJ,{className:"font-medium",children:e.task_type}),(0,ep.jsx)(eJ,{className:"text-sm text-muted-foreground",children:new Date(e.created_at).toLocaleString()}),(0,ep.jsxs)(eJ,{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)(eH,{className:"w-3 h-3"}),"pending"]}),"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)(bN,{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)(eU,{className:"w-3 h-3"}),"completed"]})]}),(0,ep.jsxs)(eJ,{children:["pending"===e.status&&(0,ep.jsxs)(eD.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(),_(e.id)},disabled:h===e.id,children:[h===e.id?(0,ep.jsx)(tz.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(eX.X,{className:"w-3 h-3 mr-1"}),h===e.id?"":"Cancel"]}),"failed"===e.status&&(0,ep.jsxs)(eD.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(),S(e.id)},disabled:p===e.id,children:[p===e.id?(0,ep.jsx)(tz.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(bJ,{className:"w-3 h-3 mr-1"}),p===e.id?"":"Retry"]})]})]},e.id))})]})}),r>c&&(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 ",u+1,"-",Math.min(u+c,r)," of"," ",r]}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>C(Math.max(0,u-c)),disabled:0===u,children:"Previous"}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>C(u+c),disabled:u+c>=r,children:"Next"})]})]})]}):(0,ep.jsxs)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:["No ",a?`${a} `:"","operations"]})}),(0,ep.jsx)(tV.Dialog,{open:w,onOpenChange:j,children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Operation Details"}),(0,ep.jsx)(tV.DialogDescription,{children:y?.operation_id&&(0,ep.jsx)("span",{className:"font-mono text-xs",children:y.operation_id})})]}),N?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)(tz.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):y?(0,ep.jsx)("div",{className:"space-y-4",children:y.error?(0,ep.jsx)("div",{className:"text-red-600 dark:text-red-400",children:y.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"===y.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)(eH,{className:"w-3 h-3"}),"pending"]}),"failed"===y.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)(bN,{className:"w-3 h-3"}),"failed"]}),"completed"===y.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)(eU,{className:"w-3 h-3"}),"completed"]})]})]}),(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:y.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:y.created_at?new Date(y.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:y.updated_at?new Date(y.updated_at).toLocaleString():"N/A"})]}),y.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(y.completed_at).toLocaleString()})]}),y.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:y.result_metadata.items_count})]})]}),y.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:y.error_message})]}),y.child_operations&&y.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 (",y.result_metadata?.num_sub_batches||y.child_operations.length,")"]}),(0,ep.jsx)("div",{className:"rounded-lg border",children:(0,ep.jsxs)(e$,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-[60px]",children:"Index"}),(0,ep.jsx)(eQ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eQ,{className:"w-[80px]",children:"Items"}),(0,ep.jsx)(eQ,{children:"Status"})]})}),(0,ep.jsx)(eK,{children:y.child_operations.map(e=>(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eJ,{className:"text-sm",children:e.sub_batch_index}),(0,ep.jsx)(eJ,{className:"font-mono text-xs text-muted-foreground",children:e.operation_id.substring(0,8)}),(0,ep.jsx)(eJ,{className:"text-sm",children:e.items_count}),(0,ep.jsxs)(eJ,{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)(eH,{className:"w-3 h-3"}),"pending"]}),"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)(bN,{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)(eU,{className:"w-3 h-3"}),"completed"]})]})]},e.operation_id))})]})})]})]})}):null]})})]}):null}var tz=tz;let b2=(0,ej.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"}]]),b5=(0,ej.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 b3=e.i(26330),b4=e.i(3536),b6=e.i(65491),b8=e.i(10772),b7=e.i(53660),b9=e.i(74606),we=e.i(96626),wt=e.i(42727),wn=Symbol("radix.slottable");function wr(e){return eg.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===wn}var wi=e.i(30207),wa=e.i(86312),wo=e.i(85369),ws=["Enter"," "],wl=["ArrowUp","PageDown","End"],wc=["ArrowDown","PageUp","Home",...wl],wu={ltr:[...ws,"ArrowRight"],rtl:[...ws,"ArrowLeft"]},wd={ltr:["ArrowLeft"],rtl:["ArrowRight"]},wh="Menu",[wf,wp,wg]=(0,to.createCollection)(wh),[wm,wv]=(0,te.createContextScope)(wh,[wg,b7.createPopperScope,wt.createRovingFocusGroupScope]),wx=(0,b7.createPopperScope)(),wy=(0,wt.createRovingFocusGroupScope)(),[wb,ww]=wm(wh),[wj,wN]=wm(wh),wk=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=wx(t),[l,c]=eg.useState(null),u=eg.useRef(!1),d=(0,wi.useCallbackRef)(a),h=(0,tn.useDirection)(i);return eg.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,ep.jsx)(b7.Root,{...s,children:(0,ep.jsx)(wb,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,ep.jsx)(wj,{scope:t,onClose:eg.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:o,children:r})})})};wk.displayName=wh;var wE=eg.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=wx(n);return(0,ep.jsx)(b7.Anchor,{...i,...r,ref:t})});wE.displayName="MenuAnchor";var wC="MenuPortal",[w_,wS]=wm(wC,{forceMount:void 0}),wA=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=ww(wC,t);return(0,ep.jsx)(w_,{scope:t,forceMount:n,children:(0,ep.jsx)(we.Presence,{present:n||a.open,children:(0,ep.jsx)(b9.Portal,{asChild:!0,container:i,children:r})})})};wA.displayName=wC;var wT="MenuContent",[wO,wM]=wm(wT),wP=eg.forwardRef((e,t)=>{let n=wS(wT,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ww(wT,e.__scopeMenu),o=wN(wT,e.__scopeMenu);return(0,ep.jsx)(wf.Provider,{scope:e.__scopeMenu,children:(0,ep.jsx)(we.Presence,{present:r||a.open,children:(0,ep.jsx)(wf.Slot,{scope:e.__scopeMenu,children:o.modal?(0,ep.jsx)(wD,{...i,ref:t}):(0,ep.jsx)(wL,{...i,ref:t})})})})}),wD=eg.forwardRef((e,t)=>{let n=ww(wT,e.__scopeMenu),r=eg.useRef(null),i=(0,e9.useComposedRefs)(t,r);return eg.useEffect(()=>{let e=r.current;if(e)return(0,wa.hideOthers)(e)},[]),(0,ep.jsx)(wR,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:(0,e7.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),wL=eg.forwardRef((e,t)=>{let n=ww(wT,e.__scopeMenu);return(0,ep.jsx)(wR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),wI=((o=eg.forwardRef((e,t)=>{let{children:n,...r}=e;if(eg.isValidElement(n)){var i;let e,a,o=(i=n,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...a}:"className"===r&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==eg.Fragment&&(s.ref=t?(0,e9.composeRefs)(t,o):o),eg.cloneElement(n,s)}return eg.Children.count(n)>1?eg.Children.only(null):null})).displayName="MenuContent.ScrollLock.SlotClone",r=o,(i=eg.forwardRef((e,t)=>{let{children:n,...i}=e,a=eg.Children.toArray(n),o=a.find(wr);if(o){let e=o.props.children,n=a.map(t=>t!==o?t:eg.Children.count(e)>1?eg.Children.only(null):eg.isValidElement(e)?e.props.children:null);return(0,ep.jsx)(r,{...i,ref:t,children:eg.isValidElement(e)?eg.cloneElement(e,void 0,n):null})}return(0,ep.jsx)(r,{...i,ref:t,children:n})})).displayName="MenuContent.ScrollLock.Slot",i),wR=eg.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,disableOutsideScroll:p,...g}=e,v=ww(wT,n),x=wN(wT,n),y=wx(n),b=wy(n),w=wp(n),[j,N]=eg.useState(null),k=eg.useRef(null),E=(0,e9.useComposedRefs)(t,k,v.onContentChange),C=eg.useRef(0),_=eg.useRef(""),S=eg.useRef(0),A=eg.useRef(null),T=eg.useRef("right"),O=eg.useRef(0),M=p?wo.RemoveScroll:eg.Fragment;eg.useEffect(()=>()=>window.clearTimeout(C.current),[]),(0,b4.useFocusGuards)();let P=eg.useCallback(e=>{var t,n;return T.current===A.current?.side&&(t=e,!!(n=A.current?.area)&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],l=o.x,c=o.y,u=s.x,d=s.y;c>r!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},n))},[]);return(0,ep.jsx)(wO,{scope:n,searchRef:_,onItemEnter:eg.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:eg.useCallback(e=>{P(e)||(k.current?.focus(),N(null))},[P]),onTriggerLeave:eg.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:S,onPointerGraceIntentChange:eg.useCallback(e=>{A.current=e},[]),children:(0,ep.jsx)(M,{...p?{as:wI,allowPinchZoom:!0}:void 0,children:(0,ep.jsx)(b6.FocusScope,{asChild:!0,trapped:i,onMountAutoFocus:(0,e7.composeEventHandlers)(a,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,ep.jsx)(b3.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,children:(0,ep.jsx)(wt.Root,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:j,onCurrentTabStopIdChange:N,onEntryFocus:(0,e7.composeEventHandlers)(l,e=>{x.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,ep.jsx)(b7.Content,{role:"menu","aria-orientation":"vertical","data-state":w9(v.open),"data-radix-menu-content":"",dir:x.dir,...y,...g,ref:E,style:{outline:"none",...g.style},onKeyDown:(0,e7.composeEventHandlers)(g.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;if(t){var i;let t,a,o,s,l,c;"Tab"===e.key&&e.preventDefault(),!n&&r&&(i=e.key,t=_.current+i,a=w().filter(e=>!e.disabled),o=document.activeElement,s=a.find(e=>e.ref.current===o)?.textValue,l=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=n?e.indexOf(n):-1,o=(r=Math.max(a,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(o=o.filter(e=>e!==n));let s=o.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return s!==n?s:void 0}(a.map(e=>e.textValue),t,s),c=a.find(e=>e.textValue===l)?.ref.current,function e(t){_.current=t,window.clearTimeout(C.current),""!==t&&(C.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let a=k.current;if(e.target!==a||!wc.includes(e.key))return;e.preventDefault();let o=w().filter(e=>!e.disabled).map(e=>e.ref.current);wl.includes(e.key)&&o.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(o)}),onBlur:(0,e7.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(C.current),_.current="")}),onPointerMove:(0,e7.composeEventHandlers)(e.onPointerMove,jn(e=>{let t=e.target,n=O.current!==e.clientX;e.currentTarget.contains(t)&&n&&(T.current=e.clientX>O.current?"right":"left",O.current=e.clientX)}))})})})})})})});wP.displayName=wT;var wB=eg.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(ta.Primitive.div,{role:"group",...r,ref:t})});wB.displayName="MenuGroup";var wz=eg.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(ta.Primitive.div,{...r,ref:t})});wz.displayName="MenuLabel";var wF="MenuItem",wV="menu.itemSelect",wU=eg.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=eg.useRef(null),o=wN(wF,e.__scopeMenu),s=wM(wF,e.__scopeMenu),l=(0,e9.useComposedRefs)(t,a),c=eg.useRef(!1);return(0,ep.jsx)(wH,{...i,ref:l,disabled:n,onClick:(0,e7.composeEventHandlers)(e.onClick,()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(wV,{bubbles:!0,cancelable:!0});e.addEventListener(wV,e=>r?.(e),{once:!0}),(0,ta.dispatchDiscreteCustomEvent)(e,t),t.defaultPrevented?c.current=!1:o.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:(0,e7.composeEventHandlers)(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==s.searchRef.current;n||t&&" "===e.key||ws.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});wU.displayName=wF;var wH=eg.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=wM(wF,n),s=wy(n),l=eg.useRef(null),c=(0,e9.useComposedRefs)(t,l),[u,d]=eg.useState(!1),[h,f]=eg.useState("");return eg.useEffect(()=>{let e=l.current;e&&f((e.textContent??"").trim())},[a.children]),(0,ep.jsx)(wf.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:(0,ep.jsx)(wt.Item,{asChild:!0,...s,focusable:!r,children:(0,ep.jsx)(ta.Primitive.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:c,onPointerMove:(0,e7.composeEventHandlers)(e.onPointerMove,jn(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,e7.composeEventHandlers)(e.onPointerLeave,jn(e=>o.onItemLeave(e))),onFocus:(0,e7.composeEventHandlers)(e.onFocus,()=>d(!0)),onBlur:(0,e7.composeEventHandlers)(e.onBlur,()=>d(!1))})})})}),wW=eg.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,ep.jsx)(wQ,{scope:e.__scopeMenu,checked:n,children:(0,ep.jsx)(wU,{role:"menuitemcheckbox","aria-checked":je(n)?"mixed":n,...i,ref:t,"data-state":jt(n),onSelect:(0,e7.composeEventHandlers)(i.onSelect,()=>r?.(!!je(n)||!n),{checkForDefaultPrevented:!1})})})});wW.displayName="MenuCheckboxItem";var wY="MenuRadioGroup",[wG,wX]=wm(wY,{value:void 0,onValueChange:()=>{}}),w$=eg.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=(0,wi.useCallbackRef)(r);return(0,ep.jsx)(wG,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,ep.jsx)(wB,{...i,ref:t})})});w$.displayName=wY;var wq="MenuRadioItem",wK=eg.forwardRef((e,t)=>{let{value:n,...r}=e,i=wX(wq,e.__scopeMenu),a=n===i.value;return(0,ep.jsx)(wQ,{scope:e.__scopeMenu,checked:a,children:(0,ep.jsx)(wU,{role:"menuitemradio","aria-checked":a,...r,ref:t,"data-state":jt(a),onSelect:(0,e7.composeEventHandlers)(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});wK.displayName=wq;var wZ="MenuItemIndicator",[wQ,wJ]=wm(wZ,{checked:!1}),w0=eg.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=wJ(wZ,n);return(0,ep.jsx)(we.Presence,{present:r||je(a.checked)||!0===a.checked,children:(0,ep.jsx)(ta.Primitive.span,{...i,ref:t,"data-state":jt(a.checked)})})});w0.displayName=wZ;var w1=eg.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(ta.Primitive.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});w1.displayName="MenuSeparator";var w2=eg.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=wx(n);return(0,ep.jsx)(b7.Arrow,{...i,...r,ref:t})});w2.displayName="MenuArrow";var[w5,w3]=wm("MenuSub"),w4="MenuSubTrigger",w6=eg.forwardRef((e,t)=>{let n=ww(w4,e.__scopeMenu),r=wN(w4,e.__scopeMenu),i=w3(w4,e.__scopeMenu),a=wM(w4,e.__scopeMenu),o=eg.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=a,c={__scopeMenu:e.__scopeMenu},u=eg.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return eg.useEffect(()=>u,[u]),eg.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),l(null)}},[s,l]),(0,ep.jsx)(wE,{asChild:!0,...c,children:(0,ep.jsx)(wH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":w9(n.open),...e,ref:(0,e9.composeRefs)(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:(0,e7.composeEventHandlers)(e.onPointerMove,jn(t=>{a.onItemEnter(t),!t.defaultPrevented&&(e.disabled||n.open||o.current||(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100)))})),onPointerLeave:(0,e7.composeEventHandlers)(e.onPointerLeave,jn(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i="right"===r,o=t[i?"left":"right"],l=t[i?"right":"left"];a.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:o,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:o,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,t=>{let i=""!==a.searchRef.current;e.disabled||i&&" "===t.key||wu[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});w6.displayName=w4;var w8="MenuSubContent",w7=eg.forwardRef((e,t)=>{let n=wS(wT,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ww(wT,e.__scopeMenu),o=wN(wT,e.__scopeMenu),s=w3(w8,e.__scopeMenu),l=eg.useRef(null),c=(0,e9.useComposedRefs)(t,l);return(0,ep.jsx)(wf.Provider,{scope:e.__scopeMenu,children:(0,ep.jsx)(we.Presence,{present:r||a.open,children:(0,ep.jsx)(wf.Slot,{scope:e.__scopeMenu,children:(0,ep.jsx)(wR,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:c,align:"start",side:"rtl"===o.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,e7.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:(0,e7.composeEventHandlers)(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=wd[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});function w9(e){return e?"open":"closed"}function je(e){return"indeterminate"===e}function jt(e){return je(e)?"indeterminate":e?"checked":"unchecked"}function jn(e){return t=>"mouse"===t.pointerType?e(t):void 0}w7.displayName=w8;var jr="DropdownMenu",[ji,ja]=(0,te.createContextScope)(jr,[wv]),jo=wv(),[js,jl]=ji(jr),jc=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,l=jo(t),c=eg.useRef(null),[u,d]=(0,tt.useControllableState)({prop:i,defaultProp:a??!1,onChange:o,caller:jr});return(0,ep.jsx)(js,{scope:t,triggerId:(0,b8.useId)(),triggerRef:c,contentId:(0,b8.useId)(),open:u,onOpenChange:d,onOpenToggle:eg.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,ep.jsx)(wk,{...l,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};jc.displayName=jr;var ju="DropdownMenuTrigger",jd=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=jl(ju,n),o=jo(n);return(0,ep.jsx)(wE,{asChild:!0,...o,children:(0,ep.jsx)(ta.Primitive.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:(0,e9.composeRefs)(t,a.triggerRef),onPointerDown:(0,e7.composeEventHandlers)(e.onPointerDown,e=>{!r&&0===e.button&&!1===e.ctrlKey&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,e=>{!r&&(["Enter"," "].includes(e.key)&&a.onOpenToggle(),"ArrowDown"===e.key&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});jd.displayName=ju;var jh=e=>{let{__scopeDropdownMenu:t,...n}=e,r=jo(t);return(0,ep.jsx)(wA,{...r,...n})};jh.displayName="DropdownMenuPortal";var jf="DropdownMenuContent",jp=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jl(jf,n),a=jo(n),o=eg.useRef(!1);return(0,ep.jsx)(wP,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:(0,e7.composeEventHandlers)(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:(0,e7.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});jp.displayName=jf,eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(wB,{...i,...r,ref:t})}).displayName="DropdownMenuGroup";var jg=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(wz,{...i,...r,ref:t})});jg.displayName="DropdownMenuLabel";var jm=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(wU,{...i,...r,ref:t})});jm.displayName="DropdownMenuItem";var jv=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(wW,{...i,...r,ref:t})});jv.displayName="DropdownMenuCheckboxItem",eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(w$,{...i,...r,ref:t})}).displayName="DropdownMenuRadioGroup";var jx=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(wK,{...i,...r,ref:t})});jx.displayName="DropdownMenuRadioItem";var jy=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(w0,{...i,...r,ref:t})});jy.displayName="DropdownMenuItemIndicator";var jb=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(w1,{...i,...r,ref:t})});jb.displayName="DropdownMenuSeparator",eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(w2,{...i,...r,ref:t})}).displayName="DropdownMenuArrow";var jw=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(w6,{...i,...r,ref:t})});jw.displayName="DropdownMenuSubTrigger";var jj=eg.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jo(n);return(0,ep.jsx)(w7,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});jj.displayName="DropdownMenuSubContent";let jN=(0,ej.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);eg.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,ep.jsxs)(jw,{ref:i,className:(0,eT.cn)("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,(0,ep.jsx)(eS.ChevronRight,{className:"ml-auto"})]})).displayName=jw.displayName,eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(jj,{ref:n,className:(0,eT.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t})).displayName=jj.displayName;let jk=eg.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,ep.jsx)(jh,{children:(0,ep.jsx)(jp,{ref:r,sideOffset:t,className:(0,eT.cn)("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));jk.displayName=jp.displayName;let jE=eg.forwardRef(({className:e,inset:t,...n},r)=>(0,ep.jsx)(jm,{ref:r,className:(0,eT.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n}));jE.displayName=jm.displayName,eg.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,ep.jsxs)(jv,{ref:i,className:(0,eT.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[(0,ep.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ep.jsx)(jy,{children:(0,ep.jsx)(tB.Check,{className:"h-4 w-4"})})}),t]})).displayName=jv.displayName,eg.forwardRef(({className:e,children:t,...n},r)=>(0,ep.jsxs)(jx,{ref:r,className:(0,eT.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[(0,ep.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ep.jsx)(jy,{children:(0,ep.jsx)(jN,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=jx.displayName,eg.forwardRef(({className:e,inset:t,...n},r)=>(0,ep.jsx)(jg,{ref:r,className:(0,eT.cn)("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n})).displayName=jg.displayName;let jC=eg.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(jb,{ref:n,className:(0,eT.cn)("-mx-1 my-1 h-px bg-muted",e),...t}));jC.displayName=jb.displayName;var tz=tz;function j_({directiveId:e,onClose:t}){let n,{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,eg.useState)(null),[o,s]=(0,eg.useState)(!1),[l,c]=(0,eg.useState)(null);(0,eg.useEffect)(()=>{e&&r&&(async()=>{s(!0),c(null),a(null);try{let t=await eP.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)(tV.Dialog,{open:u,onOpenChange:e=>!e&&t(),children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col p-6",children:[(0,ep.jsx)(go.VisuallyHidden,{children:(0,ep.jsx)(tV.DialogTitle,{children:"Directive Details"})}),o?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)(tz.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)(xL,{remarkPlugins:[bn],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 jS(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,eg.useState)([]),[r,i]=(0,eg.useState)(!1),[a,o]=(0,eg.useState)("dashboard"),[s,l]=(0,eg.useState)(""),[c,u]=(0,eg.useState)(1),[d,h]=(0,eg.useState)(!1),[f,p]=(0,eg.useState)(null),[g,v]=(0,eg.useState)(!1),[x,y]=(0,eg.useState)(null),[b,w]=(0,eg.useState)(null),[j,N]=(0,eg.useState)(!1),k=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)}),E=async()=>{if(e){i(!0);try{let t=await eP.client.listMentalModels(e);n(t.items||[])}catch(e){console.error("Error loading mental models:",e)}finally{i(!1)}}},C=async()=>{if(e&&b){N(!0);try{await eP.client.deleteMentalModel(e,b.id),n(e=>e.filter(e=>e.id!==b.id)),f?.id===b.id&&p(null),w(null)}catch(e){}finally{N(!1)}}};if((0,eg.useEffect)(()=>{e&&E()},[e]),(0,eg.useEffect)(()=>{let e=e=>{"Escape"===e.key&&p(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,eg.useEffect)(()=>{u(1)},[s]),!e)return(0,ep.jsx)(pg,{children:(0,ep.jsx)(py,{className:"p-10 text-center",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to view mental models."})})});let _=Math.ceil(k.length/100),S=(c-1)*100,A=S+100,T=k.slice(S,A);return(0,ep.jsxs)("div",{children:[r?(0,ep.jsxs)("div",{className:"text-center py-12",children:[(0,ep.jsx)(eV,{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.jsx)("div",{className:"mb-4",children:(0,ep.jsx)(eL.Input,{type:"text",value:s,onChange:e=>l(e.target.value),placeholder:"Filter mental models by name, query, or content...",className:"max-w-md"})}),(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?`${k.length} of ${t.length} mental models`:`${t.length} mental model${1!==t.length?"s":""}`}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsxs)(eD.Button,{onClick:()=>h(!0),size:"sm",children:[(0,ep.jsx)(fP.Plus,{className:"w-4 h-4 mr-2"}),"Add Mental Model"]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(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)(b2,{className:"w-4 h-4"}),"Dashboard"]}),(0,ep.jsxs)("button",{onClick:()=>o("table"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"table"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(eY,{className:"w-4 h-4"}),"Table"]})]})]})]}),k.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:T.map(e=>{let t=new Date(e.last_refreshed_at),n=t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1});return(0,ep.jsx)(pg,{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)(py,{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)(eD.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 ml-2 text-muted-foreground hover:text-destructive flex-shrink-0",onClick:t=>{t.stopPropagation(),w({id:e.id,name:e.name})},children:(0,ep.jsx)(pn,{className:"h-4 w-4"})})]}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:e.source_query}),(0,ep.jsx)("div",{className:"text-sm text-foreground mb-3 border-t border-border pt-3",children:e.content.includes("|")||e.content.includes("```")||e.content.includes("\n\n")?(0,ep.jsxs)("div",{className:"line-clamp-3 text-muted-foreground italic",children:[e.content.substring(0,150),"..."," ",(0,ep.jsx)("span",{className:"text-primary",children:"Click to view full content"})]}):(0,ep.jsx)("div",{className:"line-clamp-6 prose prose-sm dark:prose-invert max-w-none",children:(0,ep.jsx)(xL,{remarkPlugins:[bn],children:e.content})})}),(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.jsxs)("div",{className:"text-muted-foreground",children:[n," ",r]})]})]})},e.id)})}),"table"===a&&(0,ep.jsx)("div",{className:"border rounded-lg overflow-hidden",children:(0,ep.jsxs)(e$,{className:"table-fixed",children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{className:"bg-muted/50",children:[(0,ep.jsx)(eQ,{className:"w-[20%]",children:"ID"}),(0,ep.jsx)(eQ,{className:"w-[20%]",children:"Name"}),(0,ep.jsx)(eQ,{className:"w-[35%]",children:"Source Query"}),(0,ep.jsx)(eQ,{className:"w-[15%]",children:"Last Refreshed"}),(0,ep.jsx)(eQ,{className:"w-[10%]"})]})}),(0,ep.jsx)(eK,{children:T.map(e=>{let t=new Date(e.last_refreshed_at),n=t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1});return(0,ep.jsxs)(eZ,{className:`cursor-pointer hover:bg-muted/50 ${f?.id===e.id?"bg-primary/10":""}`,onClick:()=>p(e),children:[(0,ep.jsx)(eJ,{className:"py-2",children:(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground truncate block",children:e.id})}),(0,ep.jsx)(eJ,{className:"py-2",children:(0,ep.jsx)("div",{className:"font-medium text-foreground",children:e.name})}),(0,ep.jsx)(eJ,{className:"py-2",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground truncate",children:e.source_query})}),(0,ep.jsxs)(eJ,{className:"py-2 text-sm text-foreground",children:[(0,ep.jsx)("div",{children:n}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground",children:r})]}),(0,ep.jsx)(eJ,{className:"py-2",children:(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",onClick:t=>{t.stopPropagation(),w({id:e.id,name:e.name})},children:(0,ep.jsx)(pn,{className:"h-4 w-4"})})})]},e.id)})})]})}),_>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:[S+1,"-",Math.min(A,k.length)," of"," ",k.length]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>u(1),disabled:1===c,className:"h-7 w-7 p-0",children:(0,ep.jsx)(ez,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.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)(e_,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",_]}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>u(e=>Math.min(_,e+1)),disabled:c===_,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>u(_),disabled:c===_,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{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)(eN,{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)(jA,{open:d,onClose:()=>h(!1),onCreated:()=>{h(!1),E()}}),(0,ep.jsx)(fU,{open:!!b,onOpenChange:e=>!e&&w(null),children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Delete Mental Model"}),(0,ep.jsxs)(f9,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',b?.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)(f8,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(pt,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(pe,{onClick:C,disabled:j,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[j?(0,ep.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),f&&(0,ep.jsx)(jO,{mentalModel:f,onClose:()=>p(null),onDelete:()=>w({id:f.id,name:f.name}),onEdit:()=>{y(f),v(!0)},onRefreshed:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e)}}),x&&(0,ep.jsx)(jT,{open:g,mentalModel:x,onClose:()=>{v(!1),y(null)},onUpdated:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e),v(!1),y(null)}})]})}function jA({open:e,onClose:t,onCreated:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,eg.useState)(!1),[o,s]=(0,eg.useState)({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:""}),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}await eP.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:{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}}),s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:""}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tV.Dialog,{open:e,onOpenChange:e=>{e||(s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:""}),t())},children:(0,ep.jsxs)(tV.DialogContent,{className:"sm:max-w-lg",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Create Mental Model"}),(0,ep.jsx)(tV.DialogDescription,{children:"Create a mental model by running a query. The content will be auto-generated and can be refreshed later."})]}),(0,ep.jsxs)(tH.Tabs,{defaultValue:"general",className:"py-2",children:[(0,ep.jsxs)(tH.TabsList,{className:"w-full",children:[(0,ep.jsx)(tH.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(tH.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)(tH.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)(eL.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)(eL.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)(eL.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)(eL.Input,{type:"number",value:o.maxTokens,onChange:e=>s({...o,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(tH.TabsContent,{value:"options",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:"Tags"}),(0,ep.jsx)(eL.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:"flex items-center space-x-2",children:[(0,ep.jsx)(pc.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-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(pp,{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:"flex items-center space-x-2",children:[(0,ep.jsx)(pc.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)(eL.Input,{value:o.excludeMentalModelIds,onChange:e=>s({...o,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]}),(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)(pl.Select,{value:o.tagsMatch,onValueChange:e=>s({...o,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(pl.SelectTrigger,{children:(0,ep.jsx)(pl.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(pl.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(pl.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(pl.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(pl.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)(pE.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)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:t,disabled:i,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:l,disabled:i||!o.name.trim()||!o.sourceQuery.trim(),children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}),"Generating..."]}):"Create"})]})]})})}function jT({open:e,mentalModel:t,onClose:n,onUpdated:r}){let{currentBank:i}=(0,ey.useBank)(),[a,o]=(0,eg.useState)(!1),[s,l]=(0,eg.useState)({name:t.name,sourceQuery:t.source_query,maxTokens:String(t.max_tokens||2048),tags:t.tags.join(", "),autoRefresh:t.trigger?.refresh_after_consolidation||!1,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):""});(0,eg.useEffect)(()=>{e&&l({name:t.name,sourceQuery:t.source_query,maxTokens:String(t.max_tokens||2048),tags:t.tags.join(", "),autoRefresh:t.trigger?.refresh_after_consolidation||!1,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):""})},[e,t]);let c=async()=>{if(i&&s.name.trim()&&s.sourceQuery.trim()){o(!0);try{let e,a=s.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),o=parseInt(s.maxTokens)||2048,l=s.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(s.tagGroups.trim())try{e=JSON.parse(s.tagGroups.trim())}catch{ev.toast.error("Invalid JSON in Tag Groups field");return}let c=await eP.client.updateMentalModel(i,t.id,{name:s.name.trim(),source_query:s.sourceQuery.trim(),tags:a.length>0?a:void 0,max_tokens:o,trigger:{refresh_after_consolidation:s.autoRefresh,fact_types:s.factTypes.length>0?s.factTypes:void 0,exclude_mental_models:s.excludeMentalModels||void 0,exclude_mental_model_ids:l.length>0?l:void 0,tags_match:s.tagsMatch||void 0,tag_groups:e}});r(c),n()}catch(e){}finally{o(!1)}}};return(0,ep.jsx)(tV.Dialog,{open:e,onOpenChange:e=>!e&&n(),children:(0,ep.jsxs)(tV.DialogContent,{className:"sm:max-w-lg",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Update Mental Model"}),(0,ep.jsx)(tV.DialogDescription,{children:"Update the mental model configuration. Changes will take effect immediately."})]}),(0,ep.jsxs)(tH.Tabs,{defaultValue:"general",className:"py-2",children:[(0,ep.jsxs)(tH.TabsList,{className:"w-full",children:[(0,ep.jsx)(tH.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(tH.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)(tH.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)(eL.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)(eL.Input,{value:s.name,onChange:e=>l({...s,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)(eL.Input,{value:s.sourceQuery,onChange:e=>l({...s,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)(eL.Input,{type:"number",value:s.maxTokens,onChange:e=>l({...s,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(tH.TabsContent,{value:"options",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:"Tags"}),(0,ep.jsx)(eL.Input,{value:s.tags,onChange:e=>l({...s,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:"flex items-center space-x-2",children:[(0,ep.jsx)(pc.Checkbox,{id:"update-auto-refresh",checked:s.autoRefresh,onCheckedChange:e=>l({...s,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-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(pp,{value:s.factTypes,onChange:e=>l({...s,factTypes:e})}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to include all types."})]}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(pc.Checkbox,{id:"update-exclude-mental-models",checked:s.excludeMentalModels,onCheckedChange:e=>l({...s,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)(eL.Input,{value:s.excludeMentalModelIds,onChange:e=>l({...s,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]}),(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)(pl.Select,{value:s.tagsMatch||"default",onValueChange:e=>l({...s,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(pl.SelectTrigger,{children:(0,ep.jsx)(pl.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(pl.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(pl.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(pl.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(pl.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)(pE.Textarea,{value:s.tagGroups,onChange:e=>l({...s,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)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:n,disabled:a,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:c,disabled:a||!s.name.trim()||!s.sourceQuery.trim(),children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 animate-spin mr-1"}),"Updating..."]}):"Update"})]})]})})}function jO({mentalModel:e,onClose:t,onDelete:n,onEdit:r,onRefreshed:i}){let{currentBank:a}=(0,ey.useBank)(),[o,s]=(0,eg.useState)(!1),[l,c]=(0,eg.useState)(null),[u,d]=(0,eg.useState)(null),[h,f]=(0,eg.useState)(!1),p=async()=>{if(!a)return;s(!0);let t=e.last_refreshed_at;try{await eP.client.refreshMentalModel(a,e.id);let n=0,r=async()=>{n++;try{let o=await eP.client.getMentalModel(a,e.id);if(o.last_refreshed_at!==t){i(o),s(!1);return}if(n>=120){s(!1),ev.toast.error("Refresh timeout",{description:"Refresh is taking longer than expected. Check the operations list for status."});return}setTimeout(r,1e3)}catch(e){console.error("Error polling mental model:",e),s(!1)}};setTimeout(r,1e3)}catch(e){s(!1)}},g=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})}`},v=e.reflect_response?.based_on?Object.entries(e.reflect_response.based_on).filter(([e])=>"observation"!==e).flatMap(([e,t])=>t.map(t=>({...t,factType:e}))):[],x=e.reflect_response?.based_on?.observation||[];return(0,ep.jsxs)("div",{className:"fixed right-0 top-0 h-screen w-1/2 bg-card border-l 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-1 mr-4",children:[(0,ep.jsx)("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)("p",{className:"text-sm text-muted-foreground mt-1",children:e.source_query})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsxs)(jc,{children:[(0,ep.jsx)(jd,{asChild:!0,children:(0,ep.jsxs)(eD.Button,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",disabled:o,children:[o?(0,ep.jsx)(tz.default,{className:"h-4 w-4 animate-spin"}):(0,ep.jsx)(b5,{className:"h-4 w-4"}),(0,ep.jsx)("span",{className:"text-xs",children:"Actions"})]})}),(0,ep.jsxs)(jk,{align:"end",children:[(0,ep.jsxs)(jE,{onClick:r,children:[(0,ep.jsx)(pr,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,ep.jsxs)(jE,{onClick:p,children:[(0,ep.jsx)(eV,{className:"h-4 w-4 mr-2"}),"Refresh"]}),(0,ep.jsxs)(jE,{onClick:()=>f(!0),children:[(0,ep.jsx)(tF,{className:"h-4 w-4 mr-2"}),"View History"]}),(0,ep.jsx)(jC,{}),(0,ep.jsxs)(jE,{onClick:n,className:"text-destructive focus:text-destructive",children:[(0,ep.jsx)(pn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,ep.jsx)(eX.X,{className:"h-4 w-4"})})]})]}),(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"ID"}),(0,ep.jsx)("div",{className:"text-sm text-foreground font-mono",children:e.id})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Name"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:e.name})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Source Query"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:e.source_query})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Max Tokens"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:e.max_tokens})]}),e.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.tags.map(e=>(0,ep.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e},e))})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Auto-refresh"}),(0,ep.jsx)("span",{className:`inline-block text-xs px-2 py-1 rounded-full font-medium ${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"})]}),e.last_refreshed_at&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Last Refreshed"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:g(e.last_refreshed_at)})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Created"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:g(e.created_at)})]})]}),(0,ep.jsxs)("div",{className:"border-t border-border pt-5",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)(xL,{remarkPlugins:[bn],children:e.content})})]}),v.length>0&&(0,ep.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,ep.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:["Based On (",v.length," ",1===v.length?"fact":"facts",")"]}),(0,ep.jsx)("div",{className:"space-y-3",children:v.map((e,t)=>{let n="directives"===e.factType?{label:"directive",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}:"mental-models"===e.factType?{label:"mental model",color:"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}:"world"===e.factType?{label:"world",color:"bg-blue-500/10 text-blue-600 dark:text-blue-400"}:"experience"===e.factType?{label:"experience",color:"bg-green-500/10 text-green-600 dark:text-green-400"}:{label:e.factType,color:"bg-slate-500/10 text-slate-600 dark:text-slate-400"};return(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg border border-border/50",children:[(0,ep.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${n.color}`,children:n.label}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-6 text-xs",onClick:()=>{"directives"===e.factType?d(e.id):c(e.id)},children:"View"})]}),(0,ep.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:e.text})]},e.id||t)})})]}),x.length>0&&(0,ep.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,ep.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:["Observations Used (",x.length,")"]}),(0,ep.jsx)("div",{className:"space-y-3",children:x.map((e,t)=>(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg border border-border/50",children:[(0,ep.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400",children:"observation"}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-6 text-xs",onClick:()=>c(e.id),children:"View"})]}),(0,ep.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:e.text})]},e.id||t))})]}),!e.reflect_response&&(0,ep.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:"Based On"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:'No source data available. Click "Refresh" to regenerate with source tracking.'})]})]})]}),l&&a&&(0,ep.jsx)(tK,{memoryId:l,onClose:()=>c(null)}),u&&a&&(0,ep.jsx)(j_,{directiveId:u,onClose:()=>d(null)}),(0,ep.jsx)(bs,{mentalModelId:h?e.id:null,onClose:()=>f(!1),initialTab:"history"})]})}let jM=(0,ej.default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),jP=(0,ej.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 tz=tz;let jD=["consolidation.completed","retain.completed"],jL={url:"",secret:"",event_types:["consolidation.completed"],enabled:!0,http_config:{method:"POST",timeout_seconds:30,headers:[],params:[]}};function jI(e){return Object.fromEntries(e.filter(e=>e.key.trim()).map(e=>[e.key,e.value]))}function jR(e){return{method:e.method,timeout_seconds:e.timeout_seconds,headers:jI(e.headers),params:jI(e.params)}}function jB({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)(e6,{children:e}),(0,ep.jsxs)(eD.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs px-2",onClick:()=>n([...t,{key:"",value:""}]),children:[(0,ep.jsx)(fP.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)(eL.Input,{placeholder:"Key",value:e.key,onChange:e=>r(i,"key",e.target.value),className:"h-8 text-sm flex-1"}),(0,ep.jsx)(eL.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)(eX.X,{className:"w-4 h-4"})})]},i))})]})}function jz({delivery:e,formatDate:t}){var n;let[r,i]=(0,eg.useState)(!1),a=e.last_response_body||e.last_error;return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)(eZ,{className:a?"cursor-pointer hover:bg-muted/40":void 0,onClick:()=>a&&i(e=>!e),children:[(0,ep.jsx)(eJ,{className:"w-8 pl-3 pr-0",children:a?r?(0,ep.jsx)(bc.ChevronDown,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)(eS.ChevronRight,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)("span",{className:"w-4 h-4 inline-block"})}),(0,ep.jsx)(eJ,{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)(eU,{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)(eH,{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)(bN,{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)(eJ,{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)(eJ,{className:"text-center text-sm",children:e.attempts}),(0,ep.jsx)(eJ,{className:"font-mono text-xs text-muted-foreground",children:e.event_type}),(0,ep.jsx)(eJ,{className:"text-xs text-muted-foreground whitespace-nowrap",children:t(e.created_at)})]}),r&&a&&(0,ep.jsx)(eZ,{className:"bg-muted/20 hover:bg-muted/20",children:(0,ep.jsx)(eJ,{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 jF(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,eg.useState)([]),[r,i]=(0,eg.useState)(!1),[a,o]=(0,eg.useState)(!1),[s,l]=(0,eg.useState)(!1),[c,u]=(0,eg.useState)(null),[d,h]=(0,eg.useState)(null),[f,p]=(0,eg.useState)(!1),[g,v]=(0,eg.useState)(jL),[x,y]=(0,eg.useState)(!1),[b,w]=(0,eg.useState)(null),[j,N]=(0,eg.useState)(jL),[k,E]=(0,eg.useState)(!1),[C,_]=(0,eg.useState)(!1),[S,A]=(0,eg.useState)(!1),[T,O]=(0,eg.useState)(!1),[M,P]=(0,eg.useState)(null),[D,L]=(0,eg.useState)([]),[I,R]=(0,eg.useState)(!1),[B,z]=(0,eg.useState)(null),[F,V]=(0,eg.useState)(!1),U=async()=>{if(e){i(!0);try{let t=await eP.client.listWebhooks(e);n(t.items||[])}catch(e){console.error("Error loading webhooks:",e)}finally{i(!1)}}};(0,eg.useEffect)(()=>{e&&U()},[e]);let H=async()=>{if(e&&g.url){l(!0);try{await eP.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:jR(g.http_config)}),o(!1),v(jL),p(!1),await U()}catch(e){}finally{l(!1)}}},W=async t=>{if(e){u(t),h(null);try{await eP.client.deleteWebhook(e,t),await U()}catch(e){}finally{u(null)}}},Y=async()=>{if(e&&b&&j.url){A(!0);try{let t={url:j.url,event_types:j.event_types,enabled:j.enabled,http_config:jR(j.http_config)};C?t.secret=null:j.secret&&(t.secret=j.secret),await eP.client.updateWebhook(e,b.id,t),y(!1),await U()}catch{}finally{A(!1)}}},G=async t=>{if(e){P(t),O(!0),L([]),z(null),R(!0);try{let n=await eP.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)}}},X=async()=>{if(e&&M&&B){V(!0);try{let t=await eP.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)}}},$=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)(eV,{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)(eD.Button,{size:"sm",onClick:()=>o(!0),children:[(0,ep.jsx)(fP.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)(e$,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{children:"URL"}),(0,ep.jsx)(eQ,{children:"Method"}),(0,ep.jsx)(eQ,{children:"Event Types"}),(0,ep.jsx)(eQ,{children:"Status"}),(0,ep.jsx)(eQ,{children:"Created At"}),(0,ep.jsx)(eQ,{className:"w-[120px]"})]})}),(0,ep.jsx)(eK,{children:t.map(e=>(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eJ,{className:"font-mono text-sm max-w-[300px] truncate",children:(0,ep.jsx)("span",{title:e.url,children:e.url})}),(0,ep.jsx)(eJ,{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)(eJ,{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)(eJ,{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)(eU,{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)(eJ,{className:"text-sm text-muted-foreground",children:$(e.created_at)}),(0,ep.jsx)(eJ,{children:(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsxs)(eD.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>G(e),title:"View deliveries",children:[(0,ep.jsx)(jM,{className:"w-3 h-3 mr-1"}),"Deliveries"]}),(0,ep.jsx)(eD.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)(pr,{className:"w-3 h-3"})}),(0,ep.jsx)(eD.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)(tz.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(pn,{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)(tV.Dialog,{open:a,onOpenChange:e=>{e||(v(jL),p(!1)),o(e)},children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Add Webhook"}),(0,ep.jsx)(tV.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)(e6,{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)(e6,{htmlFor:"webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eL.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)(e6,{children:"Method"}),(0,ep.jsxs)(pl.Select,{value:g.http_config.method,onValueChange:e=>v(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(pl.SelectTrigger,{children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(pl.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e6,{htmlFor:"webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eL.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)(e6,{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)(eL.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)(jP,{className:"w-4 h-4"}):(0,ep.jsx)(jM,{className:"w-4 h-4"})})]})]}),(0,ep.jsx)(jB,{label:"Custom Headers",pairs:g.http_config.headers,onChange:e=>v(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(jB,{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)(e6,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:jD.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(pc.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)(e6,{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)(tL.Switch,{id:"webhook-enabled",checked:g.enabled,onCheckedChange:e=>v(t=>({...t,enabled:e}))}),(0,ep.jsx)(e6,{htmlFor:"webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:()=>o(!1),disabled:s,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:H,disabled:s||!g.url,children:s?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):"Create Webhook"})]})]})}),(0,ep.jsx)(tV.Dialog,{open:x,onOpenChange:e=>{e||(w(null),N(jL),E(!1),_(!1)),y(e)},children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Edit Webhook"}),(0,ep.jsx)(tV.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)(e6,{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)(e6,{htmlFor:"edit-webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eL.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)(e6,{children:"Method"}),(0,ep.jsxs)(pl.Select,{value:j.http_config.method,onValueChange:e=>N(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(pl.SelectTrigger,{children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{children:[(0,ep.jsx)(pl.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(pl.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e6,{htmlFor:"edit-webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eL.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)(e6,{htmlFor:"edit-webhook-secret",children:"Secret"}),(0,ep.jsxs)("div",{className:"relative",children:[(0,ep.jsx)(eL.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)(jP,{className:"w-4 h-4"}):(0,ep.jsx)(jM,{className:"w-4 h-4"})})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ep.jsx)(pc.Checkbox,{id:"edit-clear-secret",checked:C,onCheckedChange:e=>{_(!!e),e&&N(e=>({...e,secret:""}))}}),(0,ep.jsx)(e6,{htmlFor:"edit-clear-secret",className:"text-xs text-muted-foreground cursor-pointer",children:"Clear existing secret"})]})]}),(0,ep.jsx)(jB,{label:"Custom Headers",pairs:j.http_config.headers,onChange:e=>N(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(jB,{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)(e6,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:jD.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(pc.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)(e6,{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)(tL.Switch,{id:"edit-webhook-enabled",checked:j.enabled,onCheckedChange:e=>N(t=>({...t,enabled:e}))}),(0,ep.jsx)(e6,{htmlFor:"edit-webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:()=>y(!1),disabled:S,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:Y,disabled:S||!j.url,children:S?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})}),(0,ep.jsx)(tV.Dialog,{open:!!d,onOpenChange:e=>{e||h(null)},children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-md",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Delete Webhook"}),(0,ep.jsx)(tV.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)(tV.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),(0,ep.jsx)(eD.Button,{variant:"destructive",onClick:()=>d&&W(d.id),disabled:!!c,children:c?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete Webhook"})]})]})}),(0,ep.jsx)(tV.Dialog,{open:T,onOpenChange:e=>{e||(L([]),z(null)),O(e)},children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tV.DialogHeader,{children:[(0,ep.jsx)(tV.DialogTitle,{children:"Webhook Deliveries"}),M&&(0,ep.jsx)(tV.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)(tz.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)(e$,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-8 pl-3 pr-0"}),(0,ep.jsx)(eQ,{children:"Status"}),(0,ep.jsx)(eQ,{children:"HTTP"}),(0,ep.jsx)(eQ,{className:"text-center",children:"Attempts"}),(0,ep.jsx)(eQ,{children:"Event"}),(0,ep.jsx)(eQ,{children:"Created At"})]})}),(0,ep.jsx)(eK,{children:D.map(e=>(0,ep.jsx)(jz,{delivery:e,formatDate:$},e.id))})]})}),B&&(0,ep.jsx)("div",{className:"flex justify-center pt-2",children:(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",onClick:X,disabled:F,children:[F&&(0,ep.jsx)(tz.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}e.i(34471);var jV=Symbol.for("immer-nothing"),jU=Symbol.for("immer-draftable"),jH=Symbol.for("immer-state");function jW(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var jY=Object,jG=jY.getPrototypeOf,jX="constructor",j$="prototype",jq="configurable",jK="enumerable",jZ="writable",jQ="value",jJ=e=>!!e&&!!e[jH];function j0(e){return!!e&&(j5(e)||j9(e)||!!e[jU]||!!e[jX]?.[jU]||Ne(e)||Nt(e))}var j1=jY[j$][jX].toString(),j2=new WeakMap;function j5(e){if(!e||!Nn(e))return!1;let t=jG(e);if(null===t||t===jY[j$])return!0;let n=jY.hasOwnProperty.call(t,jX)&&t[jX];if(n===Object)return!0;if(!Nr(n))return!1;let r=j2.get(n);return void 0===r&&(r=Function.toString.call(n),j2.set(n,r)),r===j1}function j3(e,t,n=!0){0===j4(e)?(n?Reflect.ownKeys(e):jY.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function j4(e){let t=e[jH];return t?t.type_:j9(e)?1:Ne(e)?2:3*!!Nt(e)}var j6=(e,t,n=j4(e))=>2===n?e.has(t):jY[j$].hasOwnProperty.call(e,t),j8=(e,t,n=j4(e))=>2===n?e.get(t):e[t],j7=(e,t,n,r=j4(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},j9=Array.isArray,Ne=e=>e instanceof Map,Nt=e=>e instanceof Set,Nn=e=>"object"==typeof e,Nr=e=>"function"==typeof e,Ni=e=>e.modified_?e.copy_:e.base_;function Na(e,t){if(Ne(e))return new Map(e);if(Nt(e))return new Set(e);if(j9(e))return Array[j$].slice.call(e);let n=j5(e);if(!0!==t&&("class_only"!==t||n)){let t=jG(e);if(null!==t&&n)return{...e};let r=jY.create(t);return jY.assign(r,e)}{let t=jY.getOwnPropertyDescriptors(e);delete t[jH];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a[jZ]&&(a[jZ]=!0,a[jq]=!0),(a.get||a.set)&&(t[i]={[jq]:!0,[jZ]:!0,[jK]:a[jK],[jQ]:e[i]})}return jY.create(jG(e),t)}}function No(e,t=!1){return Nl(e)||jJ(e)||!j0(e)||(j4(e)>1&&jY.defineProperties(e,{set:Ns,add:Ns,clear:Ns,delete:Ns}),jY.freeze(e),t&&j3(e,(e,t)=>{No(t,!0)},!1)),e}var Ns={[jQ]:function(){jW(2)}};function Nl(e){return!(null!==e&&Nn(e))||jY.isFrozen(e)}var Nc="MapSet",Nu="Patches",Nd="ArrayMethods",Nh={};function Nf(e){let t=Nh[e];return t||jW(0,e),t}var Np=e=>!!Nh[e];function Ng(e,t){t&&(e.patchPlugin_=Nf(Nu),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Nm(e){Nv(e),e.drafts_.forEach(Ny),e.drafts_=null}function Nv(e){e===I&&(I=e.parent_)}var Nx=e=>I={drafts_:[],parent_:I,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Np(Nc)?Nf(Nc):void 0,arrayMethodsPlugin_:Np(Nd)?Nf(Nd):void 0};function Ny(e){let t=e[jH];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Nb(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(void 0!==e&&e!==n){n[jH].modified_&&(Nm(t),jW(4)),j0(e)&&(e=Nw(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[jH].base_,e,t)}else e=Nw(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&No(t,n)}(t,e,!0),Nm(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==jV?e:void 0}function Nw(e,t){if(Nl(t))return t;let n=t[jH];if(!n)return N_(t,e.handledSet_,e);if(!NN(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);NC(n,e)}return n.copy_}function Nj(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var NN=(e,t)=>e.scope_===t,Nk=[];function NE(e,t,n,r){let i=e.copy_||e.base_,a=e.type_;if(void 0!==r&&j8(i,r,a)===t)return void j7(i,r,n,a);if(!e.draftLocations_){let t=e.draftLocations_=new Map;j3(i,(e,n)=>{if(jJ(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}for(let r of e.draftLocations_.get(t)??Nk)j7(i,r,n,a)}function NC(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)}Nj(e)}}function N_(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||jJ(e)||t.has(e)||!j0(e)||Nl(e)||(t.add(e),j3(e,(r,i)=>{if(jJ(i)){let t=i[jH];NN(t,n)&&(j7(e,r,Ni(t),e.type_),Nj(t))}else j0(i)&&N_(i,t,n)})),e}var NS={get(e,t){let n;if(t===jH)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(!j6(a,t,e.type_)){var o;let n;return o=e,(n=NO(a,t))?jQ in n?n[jQ]:n.get?.call(o.draft_):void 0}let s=a[t];if(e.finalized_||!j0(s)||i&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Number.isInteger(n=+t)&&String(n)===t)return s;if(s===NT(e.base_,t)){NP(e);let n=1===e.type_?+t:t,r=ND(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=NO(e.copy_||e.base_,t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=NT(e.copy_||e.base_,t),i=r?.[jH];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||j6(e.base_,t,e.type_)))return!0;NP(e),NM(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(jJ(n)){let i=n[jH];NN(i,r)&&i.callbacks_.push(function(){NP(e),NE(e,n,Ni(i),t)})}else j0(n)&&e.callbacks_.push(function(){let i=e.copy_||e.base_;3===e.type_?i.has(n)&&N_(n,r.handledSet_,r):j8(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&N_(j8(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n),!0)},deleteProperty:(e,t)=>(NP(e),void 0!==NT(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),NM(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?{[jZ]:!0,[jq]:1!==e.type_||"length"!==t,[jK]:r[jK],[jQ]:n[t]}:r},defineProperty(){jW(11)},getPrototypeOf:e=>jG(e.base_),setPrototypeOf(){jW(12)}},NA={};for(let e in NS){let t=NS[e];NA[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function NT(e,t){let n=e[jH];return(n?n.copy_||n.base_:e)[t]}function NO(e,t){if(!(t in e))return;let n=jG(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=jG(n)}}function NM(e){!e.modified_&&(e.modified_=!0,e.parent_&&NM(e.parent_))}function NP(e){e.copy_||(e.assigned_=new Map,e.copy_=Na(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function ND(e,t,n,r){let[i,a]=Ne(t)?Nf(Nc).proxyMap_(t,n):Nt(t)?Nf(Nc).proxySet_(t,n):function(e,t){let n=j9(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=NS;n&&(i=[r],a=NA);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||!NN(a,e))return;e.mapSetPlugin_?.fixSetContents(a);let t=Ni(a);NE(n,a.draft_??a,t,r),NC(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 NL(e){return jJ(e)||jW(10,e),function e(t){let n;if(!j0(t)||Nl(t))return t;let r=t[jH],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=Na(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=Na(t,!0);return j3(n,(t,r)=>{j7(n,t,e(r))},i),r&&(r.finalized_=!1),n}(e)}NA.deleteProperty=function(e,t){return NA.set.call(this,e,t,void 0)},NA.set=function(e,t,n){return NS.set.call(this,e[0],t,n,e[0])};var NI=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{let r;if(Nr(e)&&!Nr(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(Nr(t)||jW(6),void 0===n||Nr(n)||jW(7),j0(e)){let i=Nx(this),a=ND(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Nm(i):Nv(i)}return Ng(i,n),Nb(r,i)}if(e&&Nn(e))jW(1,e);else{if(void 0===(r=t(e))&&(r=e),r===jV&&(r=void 0),this.autoFreeze_&&No(r,!0),n){let t=[],i=[];Nf(Nu).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return Nr(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){j0(e)||jW(8),jJ(e)&&(e=NL(e));let t=Nx(this),n=ND(t,e,void 0);return n[jH].isManual_=!0,Nv(t),n}finishDraft(e,t){let n=e&&e[jH];n&&n.isManual_||jW(9);let{scope_:r}=n;return Ng(r,t),Nb(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=Nf(Nu).applyPatches_;return jJ(e)?r(e,t):this.produce(e,e=>r(e,t))}}().produce,NR=e=>Array.isArray(e)?e:[e],NB=0,Nz=class{revision=NB;_value;_lastValue;_isEqual=NF;constructor(e,t=NF){this._value=this._lastValue=e,this._isEqual=t}get value(){return this._value}set value(e){this.value!==e&&(this._value=e,this.revision=++NB)}};function NF(e,t){return e===t}function NV(e){return e instanceof Nz||console.warn("Not a valid cell! ",e),e.value}var NU=(e,t)=>!1;function NH(){return function(e=NF){return new Nz(null,e)}(NU)}var NW=e=>{let t=e.collectionTag;null===t&&(t=e.collectionTag=NH()),NV(t)};Symbol();var NY=0,NG=Object.getPrototypeOf({}),NX=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy(this,N$);tag=NH();tags={};children={};collectionTag=null;id=NY++},N$={get:(e,t)=>(function(){let{value:n}=e,r=Reflect.get(n,t);if("symbol"==typeof t||t in NG)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 Nq(i):new NX(i)),n.tag&&NV(n.tag),n.proxy}{let n=e.tags[t];return void 0===n&&((n=e.tags[t]=NH()).value=r),NV(n),r}})(),ownKeys:e=>(NW(e),Reflect.ownKeys(e.value)),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e.value,t),has:(e,t)=>Reflect.has(e.value,t)},Nq=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy([this],NK);tag=NH();tags={};children={};collectionTag=null;id=NY++},NK={get:([e],t)=>("length"===t&&NW(e),N$.get(e,t)),ownKeys:([e])=>N$.ownKeys(e),getOwnPropertyDescriptor:([e],t)=>N$.getOwnPropertyDescriptor(e,t),has:([e],t)=>N$.has(e,t)},NZ="u">typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function NQ(){return{s:0,v:void 0,o:null,p:null}}function NJ(e,t={}){let n,r=NQ(),{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=NQ(),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=NQ(),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 NZ(t):t}return l.s=1,l.v=t,t}return o.clearCache=()=>{r=NQ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}var N0=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=NJ,argsMemoizeOptions:d=[],devModeChecks:h={}}={...n,...o},f=NR(c),p=NR(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}(NJ),N1=Object.assign((e,t=N0)=>{!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:()=>N1});function N2(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 N5="function"==typeof Symbol&&Symbol.observable||"@@observable",N3=()=>Math.random().toString(36).substring(7).split("").join("."),N4={INIT:`@@redux/INIT${N3()}`,REPLACE:`@@redux/REPLACE${N3()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${N3()}`};function N6(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 N8(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:N4.INIT}))throw Error(N2(12));if(void 0===t(void 0,{type:N4.PROBE_UNKNOWN_ACTION()}))throw Error(N2(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(N2(14));o[s]=u,a=a||u!==c}return(a=a||i.length!==Object.keys(e).length)?o:e}}function N7(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function N9(e){return N6(e)&&"type"in e&&"string"==typeof e.type}function ke(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var kt=ke(),kn="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!=arguments.length)return"object"==typeof arguments[0]?N7:N7.apply(null,arguments)};function kr(e,t){function n(...r){if(t){let n=t(...r);if(!n)throw Error(kG(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=>N9(t)&&t.type===e,n}"u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var ki=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 ka(e){return j0(e)?NI(e,()=>{}):e}function ko(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var ks="RTK_autoBatch",kl=()=>e=>({payload:e,meta:{[ks]:!0}}),kc=e=>t=>{setTimeout(t,e)},ku=(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:kc(10):"callback"===e.type?e.queueNotification:kc(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?.[ks]))&&!o&&(o=!0,l(c)),r.dispatch(e)}finally{i=!0}}})};function kd(e){let t,n={},r=[],i={addCase(e,t){let r="string"==typeof e?e:e.type;if(!r)throw Error(kG(28));if(r in n)throw Error(kG(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 kh=Symbol.for("rtk-slice-createasyncthunk"),kf=((c=kf||{}).reducer="reducer",c.reducerWithPrepare="reducerWithPrepare",c.asyncThunk="asyncThunk",c),kp=function({creators:e}={}){let t=e?.asyncThunk?.[kh];return function(e){let n,{name:r,reducerPath:i=r}=e;if(!r)throw Error(kG(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(kG(12));if(n in l)throw Error(kG(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?kd(e.extraReducers):[e.extraReducers],i={...t,...l};return function(e,t){let n,[r,i,a]=kd(t);if("function"==typeof e)n=()=>ka(e());else{let t=ka(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(jJ(e)){let r=n(e,t);return void 0===r?e:r}else{if(j0(e))return NI(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(kG(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||kg,pending:s||kg,rejected:l||kg,settled:c||kg})}(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(kG(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?kr(e,o):kr(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=ko(g,r,x)),i}function i(t=f){let r=ko(p,n,()=>new WeakMap);return ko(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,()=>ko(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 kg(){}var km="listener",kv="completed",kx="cancelled",ky=`task-${kx}`,kb=`task-${kv}`,kw=`${km}-${kx}`,kj=`${km}-${kv}`,kN=class{constructor(e){this.code=e,this.message=`task ${kx} (reason: ${e})`}name="TaskAbortError";message},kk=(e,t)=>{if("function"!=typeof e)throw TypeError(kG(32))},kE=()=>{},kC=(e,t=kE)=>(e.catch(t),e),k_=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),kS=e=>{if(e.aborted)throw new kN(e.reason)};function kA(e,t){let n=kE;return new Promise((r,i)=>{let a=()=>i(new kN(e.reason));e.aborted?a():(n=k_(e,a),t.finally(()=>n()).then(r,i))}).finally(()=>{n=kE})}var kT=async(e,t)=>{try{await Promise.resolve();let t=await e();return{status:"ok",value:t}}catch(e){return{status:e instanceof kN?"cancelled":"rejected",error:e}}finally{t?.()}},kO=e=>t=>kC(kA(e,t).then(t=>(kS(e),t))),kM=e=>{let t=kO(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:kP}=Object,kD={},kL="listenerMiddleware",kI=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=kr(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(i);else throw Error(kG(21));return kk(a,"options.listener"),{predicate:i,type:t,effect:a}},kR=kP(e=>{let{type:t,predicate:n,effect:r}=kI(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(kG(22))}}},{withTypes:()=>kR}),kB=(e,t)=>{let{type:n,effect:r,predicate:i}=kI(t);return Array.from(e.values()).find(e=>("string"==typeof n?e.type===n:e.predicate===i)&&e.effect===r)},kz=e=>{e.pending.forEach(e=>{e.abort(kw)})},kF=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},kV=kP(kr(`${kL}/add`),{withTypes:()=>kV}),kU=kr(`${kL}/removeAll`),kH=kP(kr(`${kL}/remove`),{withTypes:()=>kH}),kW=(...e)=>{console.error(`${kL}/error`,...e)},kY=(e={})=>{let t=new Map,n=new Map,{extra:r,onError:i=kW}=e;kk(i,"onError");let a=e=>{var n;return(n=kB(t,e)??kR(e)).unsubscribe=()=>t.delete(n.id),t.set(n.id,n),e=>{n.unsubscribe(),e?.cancelActive&&kz(n)}};kP(a,{withTypes:()=>a});let o=e=>{let n=kB(t,e);return n&&(n.unsubscribe(),e.cancelActive&&kz(n)),!!n};kP(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)=>{kS(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 kA(c,Promise.race(r));return kS(c),e}finally{n()}},(e,t)=>kC(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,kP({},s,{getOriginalState:l,condition:(e,t)=>f(e,t).then(Boolean),take:f,delay:kM(h.signal),pause:kO(h.signal),extra:r,signal:h.signal,fork:(u=h.signal,(e,t)=>{kk(e,"taskExecutor");let n=new AbortController;k_(u,()=>n.abort(u.reason));let r=kT(async()=>{kS(u),kS(n.signal);let t=await e({pause:kO(n.signal),delay:kM(n.signal),signal:n.signal});return kS(n.signal),t},()=>n.abort(kb));return t?.autoJoin&&p.push(r.catch(kE)),{result:kO(u)(r),cancel(){n.abort(ky)}}}),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==h&&(e.abort(kw),n.delete(e))})},cancel:()=>{h.abort(kw),e.pending.delete(h)},throwIfCancelled:()=>{kS(h.signal)}})))}catch(e){e instanceof kN||kF(i,e,{raisedBy:"effect"})}finally{let t;await Promise.all(p),h.abort(kj),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())kz(e);t.clear()};return{middleware:e=>n=>r=>{let c;if(!N9(r))return n(r);if(kV.match(r))return a(r.payload);if(kU.match(r))return void l();if(kH.match(r))return o(r.payload);let u=e.getState(),d=()=>{if(u===kD)throw Error(kG(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,kF(i,e,{raisedBy:"predicate"})}t&&s(a,r,e,d)}}}finally{u=kD}return c},startListening:a,stopListening:o,clearListeners:l}};function kG(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 kX=e.i(92068);function k$(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 kq(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+k$(i)+t:e+t},"")}var kK=e=>0===e?0:e>0?1:-1,kZ=e=>"number"==typeof e&&e!=+e,kQ=e=>"string"==typeof e&&e.indexOf("%")===e.length-1,kJ=e=>("number"==typeof e||e instanceof Number)&&!kZ(e),k0=e=>kJ(e)||"string"==typeof e,k1=0,k2=e=>{var t=++k1;return"".concat(e||"").concat(t)},k5=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(!kJ(e)&&"string"!=typeof e)return r;if(kQ(e)){if(null==t)return r;var a=e.indexOf("%");n=t*parseFloat(e.slice(0,a))/100}else n=+e;return kZ(n)&&(n=r),i&&null!=t&&n>t&&(n=t),n},k3=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 k4(e,t,n){return kJ(e)&&kJ(t)?k$(e+n*(t-e)):t}function k6(e,t,n){if(e&&e.length)return e.find(e=>e&&("function"==typeof t?t(e):(0,kX.default)(e,t))===n)}var k8=e=>null==e?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function k7(e){return null!=e}function k9(){}function Ee(e,t){if(t){var n=Number.parseInt(t,10);if(!kZ(n))return null==e?void 0:e[n]}}var Et=kp({name:"options",initialState:{chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},reducers:{createEventEmitter:e=>{null==e.eventEmitter&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),En=Et.reducer,{createEventEmitter:Er}=Et.actions,Ei=(e.i(13027),{notify(){},get:()=>[]}),Ea="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Eo="u">typeof navigator&&"ReactNative"===navigator.product,Es=Ea||Eo?eg.useLayoutEffect:eg.useEffect;function El(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}var Ec=Symbol.for("react-redux-context"),Eu="u">typeof globalThis?globalThis:{},Ed=function(){if(!eg.createContext)return{};let e=Eu[Ec]??=new Map,t=e.get(eg.createContext);return t||(t=eg.createContext(null),e.set(eg.createContext,t)),t}(),Eh=function(e){let{children:t,context:n,serverState:r,store:i}=e,a=eg.useMemo(()=>{let e=function(e){let t,n=Ei,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=Ei)}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=eg.useMemo(()=>i.getState(),[i]);return Es(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]),eg.createElement((n||Ed).Provider,{value:a},t)};function Ef(e=Ed){return function(){return eg.useContext(e)}}var Ep=Ef(),Eg=Symbol.for("immer-nothing"),Em=Symbol.for("immer-draftable"),Ev=Symbol.for("immer-state");function Ex(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ey=Object.getPrototypeOf;function Eb(e){return!!e&&!!e[Ev]}function Ew(e){return!!e&&(Ek(e)||Array.isArray(e)||!!e[Em]||!!e.constructor?.[Em]||EA(e)||ET(e))}var Ej=Object.prototype.constructor.toString(),EN=new WeakMap;function Ek(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=EN.get(n);return void 0===r&&(r=Function.toString.call(n),EN.set(n,r)),r===Ej}function EE(e,t,n=!0){0===EC(e)?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function EC(e){let t=e[Ev];return t?t.type_:Array.isArray(e)?1:EA(e)?2:3*!!ET(e)}function E_(e,t){return 2===EC(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ES(e,t,n){let r=EC(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function EA(e){return e instanceof Map}function ET(e){return e instanceof Set}function EO(e){return e.copy_||e.base_}function EM(e,t){if(EA(e))return new Map(e);if(ET(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=Ek(e);if(!0!==t&&("class_only"!==t||n)){let t=Ey(e);return null!==t&&n?{...e}:Object.assign(Object.create(t),e)}{let t=Object.getOwnPropertyDescriptors(e);delete t[Ev];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(Ey(e),t)}}function EP(e,t=!1){return EL(e)||Eb(e)||!Ew(e)||(EC(e)>1&&Object.defineProperties(e,{set:ED,add:ED,clear:ED,delete:ED}),Object.freeze(e),t&&Object.values(e).forEach(e=>EP(e,!0))),e}var ED={value:function(){Ex(2)}};function EL(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var EI={};function ER(e){let t=EI[e];return t||Ex(0,e),t}function EB(e,t){t&&(ER("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ez(e){EF(e),e.drafts_.forEach(EU),e.drafts_=null}function EF(e){e===R&&(R=e.parent_)}function EV(e){return R={drafts_:[],parent_:R,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function EU(e){let t=e[Ev];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function EH(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return void 0!==e&&e!==n?(n[Ev].modified_&&(Ez(t),Ex(4)),Ew(e)&&(e=EW(t,e),t.parent_||EG(t,e)),t.patches_&&ER("Patches").generateReplacementPatches_(n[Ev].base_,e,t.patches_,t.inversePatches_)):e=EW(t,n,[]),Ez(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Eg?e:void 0}function EW(e,t,n){if(EL(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[Ev];if(!i)return EE(t,(r,a)=>EY(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return EG(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),EE(a,(r,a)=>EY(e,i,t,r,a,n,o),r),EG(e,t,!1),n&&e.patches_&&ER("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function EY(e,t,n,r,i,a,o){if(null==i||"object"!=typeof i&&!o)return;let s=EL(i);if(!s||o){if(Eb(i)){let o=EW(e,i,a&&t&&3!==t.type_&&!E_(t.assigned_,r)?a.concat(r):void 0);if(ES(n,r,o),!Eb(o))return;e.canAutoFreeze_=!1}else o&&n.add(i);if(Ew(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;EW(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof r&&(EA(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&EG(e,i)}}}function EG(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&EP(t,n)}var EX={get(e,t){if(t===Ev)return e;let n=EO(e);if(!E_(n,t)){var r;let i;return r=e,(i=EK(n,t))?"value"in i?i.value:i.get?.call(r.draft_):void 0}let i=n[t];return e.finalized_||!Ew(i)?i:i===Eq(e.base_,t)?(EQ(e),e.copy_[t]=E0(i,e)):i},has:(e,t)=>t in EO(e),ownKeys:e=>Reflect.ownKeys(EO(e)),set(e,t,n){let r=EK(EO(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=Eq(EO(e),t),i=r?.[Ev];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||E_(e.base_,t)))return!0;EQ(e),EZ(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!==Eq(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,EQ(e),EZ(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=EO(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Ex(11)},getPrototypeOf:e=>Ey(e.base_),setPrototypeOf(){Ex(12)}},E$={};function Eq(e,t){let n=e[Ev];return(n?EO(n):e)[t]}function EK(e,t){if(!(t in e))return;let n=Ey(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Ey(n)}}function EZ(e){!e.modified_&&(e.modified_=!0,e.parent_&&EZ(e.parent_))}function EQ(e){e.copy_||(e.copy_=EM(e.base_,e.scope_.immer_.useStrictShallowCopy_))}EE(EX,(e,t)=>{E$[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),E$.deleteProperty=function(e,t){return E$.set.call(this,e,t,void 0)},E$.set=function(e,t,n){return EX.set.call(this,e[0],t,n,e[0])};var EJ=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&&Ex(6),void 0!==n&&"function"!=typeof n&&Ex(7),Ew(e)){let i=EV(this),a=E0(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Ez(i):EF(i)}return EB(i,n),EH(r,i)}if(e&&"object"==typeof e)Ex(1,e);else{if(void 0===(r=t(e))&&(r=e),r===Eg&&(r=void 0),this.autoFreeze_&&EP(r,!0),n){let t=[],i=[];ER("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;Ew(e)||Ex(8),Eb(e)&&(Eb(t=e)||Ex(10,t),e=function e(t){let n;if(!Ew(t)||EL(t))return t;let r=t[Ev],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=EM(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=EM(t,!0);return EE(n,(t,r)=>{ES(n,t,e(r))},i),r&&(r.finalized_=!1),n}(t));let n=EV(this),r=E0(e,void 0);return r[Ev].isManual_=!0,EF(n),r}finishDraft(e,t){let n=e&&e[Ev];n&&n.isManual_||Ex(9);let{scope_:r}=n;return EB(r,t),EH(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=ER("Patches").applyPatches_;return Eb(e)?r(e,t):this.produce(e,e=>r(e,t))}};function E0(e,t){let n=EA(e)?ER("MapSet").proxyMap_(e,t):ET(e)?ER("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=EX;n&&(i=[r],a=E$);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 EJ().produce;var E1={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},E2=kp({name:"tooltip",initialState:{itemInteraction:{click:E1,hover:E1},axisInteraction:{click:E1,hover:E1},keyboardInteraction:E1,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:kl()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NL(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:kl()},removeTooltipEntrySettings:{reducer(e,t){var n=NL(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:kl()},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:E5,replaceTooltipEntrySettings:E3,removeTooltipEntrySettings:E4,setTooltipSettingsState:E6,setActiveMouseOverItemIndex:E8,mouseLeaveItem:E7,mouseLeaveChart:E9,setActiveClickItemIndex:Ce,setMouseOverAxisIndex:Ct,setMouseClickAxisIndex:Cn,setSyncInteraction:Cr,setKeyboardInteraction:Ci}=E2.actions,Ca=E2.reducer,Co=kp({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:Cs,setDataStartEndIndexes:Cl,setComputedData:Cc}=Co.actions,Cu=Co.reducer,Cd=kp({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:Ch,setLayout:Cf,setChartSize:Cp,setScale:Cg}=Cd.actions,Cm=Cd.reducer,Cv=e.i(30224),Cx=(0,eg.createContext)(null),Cy=e=>e,Cb=()=>{var e=(0,eg.useContext)(Cx);return e?e.store.dispatch:Cy},Cw=()=>{},Cj=()=>Cw,CN=(e,t)=>e===t;function Ck(e){var t=(0,eg.useContext)(Cx);return(0,Cv.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Cj,t?t.store.getState:Cw,t?t.store.getState:Cw,t?e:Cw,CN)}var CE=e.i(42342),CC=e=>e.legend.settings;function C_(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function CS(e){return function(){return e}}function CA(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 CT(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function CO(e,t){return e[t]}function CM(e){let t=[];return t.key=e,t}function CP(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function CD(e){return Number.isFinite(e)}function CL(e){return"number"==typeof e&&e>0&&Number.isFinite(e)}function CI(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 CR(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?CI(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)):CI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function CB(e,t,n){return null==e||null==t?n:k0(t)?(0,kX.default)(e,t,n):"function"==typeof t?t(e):n}N0([e=>e.legend.payload,CC],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?(0,CE.default)(r,n):r}),Array.prototype.slice;var Cz=(e,t)=>"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t,CF={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=kZ(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}CA(e,t)}},none:CA,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}CA(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,CA(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=kZ(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 CV(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=k6(n,"value",i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var l=CB(i,null==o?t.dataKey:o);return null==l?null:t.scale(l)}var CU=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,CH=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,CW=(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,CE.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 CY(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return CR(CR({},t),{},{dataKey:n,payload:r,value:i,name:a})}function CG(e,t){return e?String(e):"string"==typeof t?t:void 0}var CX=e=>e.layout.width,C$=e=>e.layout.height,Cq=e=>e.layout.scale,CK=e=>e.layout.margin,CZ=N0(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),CQ=N0(e=>e.cartesianAxis.yAxis,e=>Object.values(e));function CJ(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 C0(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?CJ(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)):CJ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var C1=N0([CX,C$,CK,e=>e.brush.height,function(e){return CQ(e).reduce((e,t)=>"left"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return CQ(e).reduce((e,t)=>"right"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return CZ(e).reduce((e,t)=>"top"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},function(e){return CZ(e).reduce((e,t)=>"bottom"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},CC,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=C0(C0({},{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&&kJ(e[a]))return CR(CR({},e),{},{[a]:e[a]+(r||0)});if(("horizontal"===s||"vertical"===s&&"center"===a)&&"middle"!==o&&kJ(e[o]))return CR(CR({},e),{},{[o]:e[o]+(i||0)})}return e})(d,l,c)).left-d.right,p=t-d.top-d.bottom;return C0(C0({brushBottom:h},d),{},{width:Math.max(f,0),height:Math.max(p,0)})}),C2=N0(C1,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),C5=N0(CX,C$,(e,t)=>({x:0,y:0,width:e,height:t})),C3=(0,eg.createContext)(null),C4=()=>null!=(0,eg.useContext)(C3),C6=e=>e.brush,C8=N0([C6,C1,CK],(e,t,n)=>({height:e.height,x:kJ(e.x)?e.x:t.left,y:kJ(e.y)?e.y:t.top+t.height+t.brushBottom-((null==n?void 0:n.bottom)||0),width:kJ(e.width)?e.width:t.width})),C7=e.i(7670),C9=e.i(58723),_e=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++]))}},_t=(e,t,n)=>{var{width:r="100%",height:i="100%",aspect:a,maxHeight:o}=n,s=kQ(r)?e:Number(r),l=kQ(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}},_n={width:0,height:0,overflow:"visible"},_r={width:0,overflowX:"visible"},_i={height:0,overflowY:"visible"},_a={};function _o(){return(_o=Object.assign.bind()).apply(null,arguments)}function _s(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 _l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_s(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)):_s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _c=(0,eg.createContext)({width:-1,height:-1});function _u(e){var{children:t,width:n,height:r}=e,i=(0,eg.useMemo)(()=>({width:n,height:r}),[n,r]);return CL(i.width)&&CL(i.height)?eg.createElement(_c.Provider,{value:i},t):null}var _d=()=>(0,eg.useContext)(_c),_h=(0,eg.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,eg.useRef)(null),v=(0,eg.useRef)();v.current=f,(0,eg.useImperativeHandle)(t,()=>g.current);var[x,y]=(0,eg.useState)({containerWidth:r.width,containerHeight:r.height}),b=(0,eg.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,eg.useEffect)(()=>{if(null==g.current||"u"<typeof ResizeObserver)return k9;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,C9.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;_e(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:N,calculatedHeight:k}=_t(w,j,{width:i,height:a,aspect:n,maxHeight:l});return _e(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),eg.createElement("div",{id:d?"".concat(d):void 0,className:(0,C7.clsx)("recharts-responsive-container",h),style:_l(_l({},p),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:g},eg.createElement("div",{style:(e=>{var{width:t,height:n}=e,r=kQ(t),i=kQ(n);return r&&i?_n:r?_r:i?_i:_a})({width:i,height:a})},eg.createElement(_u,{width:N,height:k},c)))}),_f=(0,eg.forwardRef)((e,t)=>{var n=_d();if(CL(n.width)&&CL(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}=_t(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return kJ(a)&&kJ(o)?eg.createElement(_u,{width:a,height:o},e.children):eg.createElement(_h,_o({},e,{width:r,height:i,ref:t}))});function _p(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 _g=()=>{var e,t=C4(),n=Ck(C2),r=Ck(C8),i=null==(e=Ck(C6))?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},_m={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},_v=e=>e.layout.layoutType,_x=e=>{var t=Cb(),n=C4(),{width:r,height:i}=e,a=_d(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,eg.useEffect)(()=>{!n&&CL(o)&&CL(s)&&t(Cp({width:o,height:s}))},[t,n,o,s]),null},_y=e.i(66814);function _b(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function _w(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 _j extends Map{constructor(e,t=_k){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(_N(this,e))}has(e){return super.has(_N(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 _N({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function _k(e){return null!==e&&"object"==typeof e?e.valueOf():e}let _E=Symbol("implicit");function _C(){var e=new _j,t=[],n=[],r=_E;function i(i){let a=e.get(i);if(void 0===a){if(r!==_E)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 _j,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 _C(t,n).unknown(r)},_b.apply(i,arguments),i}function __(){var e,t,n=_C().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 __(r(),[a,o]).round(s).paddingInner(l).paddingOuter(c).align(u)},_b.apply(d(),arguments)}function _S(){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}(__.apply(null,arguments).paddingInner(1))}let _A=Math.sqrt(50),_T=Math.sqrt(10),_O=Math.sqrt(2);function _M(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>=_A?10:l>=_T?5:l>=_O?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)?_M(e,t,2*n):[r,i,a]}function _P(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?_M(t,e,n):_M(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 _D(e,t,n){return _M(e*=1,t*=1,n*=1)[2]}function _L(e,t,n){t*=1,e*=1,n*=1;let r=t<e,i=r?_D(t,e,n):_D(e,t,n);return(r?-1:1)*(i<0?-(1/i):i)}function _I(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function _R(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function _B(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=_I,n=(t,n)=>_I(e(t),n),r=(t,n)=>e(t)-n):(t=e===_I||e===_R?e:_z,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 _z(){return 0}function _F(e){return null===e?NaN:+e}let _V=_B(_I),_U=_V.right;function _H(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _W(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function _Y(){}_V.left,_B(_F).center;var _G="\\s*([+-]?\\d+)\\s*",_X="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_$="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_q=/^#([0-9a-f]{3,8})$/,_K=RegExp(`^rgb\\(${_G},${_G},${_G}\\)$`),_Z=RegExp(`^rgb\\(${_$},${_$},${_$}\\)$`),_Q=RegExp(`^rgba\\(${_G},${_G},${_G},${_X}\\)$`),_J=RegExp(`^rgba\\(${_$},${_$},${_$},${_X}\\)$`),_0=RegExp(`^hsl\\(${_X},${_$},${_$}\\)$`),_1=RegExp(`^hsla\\(${_X},${_$},${_$},${_X}\\)$`),_2={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 _5(){return this.rgb().formatHex()}function _3(){return this.rgb().formatRgb()}function _4(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_q.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?_6(t):3===n?new _9(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?_8(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?_8(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=_K.exec(e))?new _9(t[1],t[2],t[3],1):(t=_Z.exec(e))?new _9(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=_Q.exec(e))?_8(t[1],t[2],t[3],t[4]):(t=_J.exec(e))?_8(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=_0.exec(e))?Sa(t[1],t[2]/100,t[3]/100,1):(t=_1.exec(e))?Sa(t[1],t[2]/100,t[3]/100,t[4]):_2.hasOwnProperty(e)?_6(_2[e]):"transparent"===e?new _9(NaN,NaN,NaN,0):null}function _6(e){return new _9(e>>16&255,e>>8&255,255&e,1)}function _8(e,t,n,r){return r<=0&&(e=t=n=NaN),new _9(e,t,n,r)}function _7(e,t,n,r){var i;return 1==arguments.length?((i=e)instanceof _Y||(i=_4(i)),i)?new _9((i=i.rgb()).r,i.g,i.b,i.opacity):new _9:new _9(e,t,n,null==r?1:r)}function _9(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Se(){return`#${Si(this.r)}${Si(this.g)}${Si(this.b)}`}function St(){let e=Sn(this.opacity);return`${1===e?"rgb(":"rgba("}${Sr(this.r)}, ${Sr(this.g)}, ${Sr(this.b)}${1===e?")":`, ${e})`}`}function Sn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Sr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Si(e){return((e=Sr(e))<16?"0":"")+e.toString(16)}function Sa(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ss(e,t,n,r)}function So(e){if(e instanceof Ss)return new Ss(e.h,e.s,e.l,e.opacity);if(e instanceof _Y||(e=_4(e)),!e)return new Ss;if(e instanceof Ss)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 Ss(o,s,l,e.opacity)}function Ss(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Sl(e){return(e=(e||0)%360)<0?e+360:e}function Sc(e){return Math.max(0,Math.min(1,e||0))}function Su(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 Sd(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}_H(_Y,_4,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:_5,formatHex:_5,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return So(this).formatHsl()},formatRgb:_3,toString:_3}),_H(_9,_7,_W(_Y,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new _9(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new _9(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new _9(Sr(this.r),Sr(this.g),Sr(this.b),Sn(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:Se,formatHex:Se,formatHex8:function(){return`#${Si(this.r)}${Si(this.g)}${Si(this.b)}${Si((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:St,toString:St})),_H(Ss,function(e,t,n,r){return 1==arguments.length?So(e):new Ss(e,t,n,null==r?1:r)},_W(_Y,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new Ss(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Ss(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 _9(Su(e>=240?e-240:e+120,i,r),Su(e,i,r),Su(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ss(Sl(this.h),Sc(this.s),Sc(this.l),Sn(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=Sn(this.opacity);return`${1===e?"hsl(":"hsla("}${Sl(this.h)}, ${100*Sc(this.s)}%, ${100*Sc(this.l)}%${1===e?")":`, ${e})`}`}}));let Sh=e=>()=>e;function Sf(e,t){var n=t-e;return n?function(t){return e+t*n}:Sh(isNaN(e)?t:e)}let Sp=function e(t){var n,r=1==(n=+t)?Sf: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)}):Sh(isNaN(e)?t:e)};function i(e,t){var n=r((e=_7(e)).r,(t=_7(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=Sf(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 Sg(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=_7(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 Sm(e,t){return e*=1,t*=1,function(n){return e*(1-n)+t*n}}Sg(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 Sd((n-r/t)*t,o,i,a,s)}}),Sg(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 Sd((n-r/t)*t,i,a,o,s)}});var Sv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Sx=RegExp(Sv.source,"g");function Sy(e,t){var n,r,i=typeof t;return null==t||"boolean"===i?Sh(t):("number"===i?Sm:"string"===i?(r=_4(t))?(t=r,Sp):function(e,t){var n,r,i,a,o,s=Sv.lastIndex=Sx.lastIndex=0,l=-1,c=[],u=[];for(e+="",t+="";(i=Sv.exec(e))&&(a=Sx.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:Sm(i,a)})),s=Sx.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 _4?Sp: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]=Sy(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]=Sy(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}:Sm: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 Sb(e,t){return e*=1,t*=1,function(n){return Math.round(e*(1-n)+t*n)}}function Sw(e){return+e}var Sj=[0,1];function SN(e){return e}function Sk(e,t){var n;return(t-=e*=1)?function(n){return(n-e)/t}:(n=isNaN(t)?NaN:.5,function(){return n})}function SE(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=Sk(i,r),a=n(o,a)):(r=Sk(r,i),a=n(a,o)),function(e){return a(r(e))}}function SC(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]=Sk(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=_U(e,t,1,r)-1;return a[n](i[n](t))}}function S_(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function SS(){var e,t,n,r,i,a,o=Sj,s=Sj,l=Sy,c=SN;function u(){var e,t,n,l=Math.min(o.length,s.length);return c!==SN&&(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?SC:SE,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),Sm)))(n)))},d.domain=function(e){return arguments.length?(o=Array.from(e,Sw),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=Sb,u()},d.clamp=function(e){return arguments.length?(c=!!e||SN,u()):c!==SN},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 SA(){return SS()(SN,SN)}function ST(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 SO(e){return(e=ST(Math.abs(e)))?e[1]:NaN}var SM=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function SP(e){var t;if(!(t=SM.exec(e)))throw Error("invalid format: "+e);return new SD({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 SD(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 SL(e,t){var n=ST(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")}SP.prototype=SD.prototype,SD.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 SI={"%":(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)=>SL(100*e,t),r:SL,s:function(e,t){var n=ST(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")+ST(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function SR(e){return e}var SB=Array.prototype.map,Sz=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function SF(e,t,n,r){var i,a,o=_L(e,t,n);switch((r=SP(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(SO(s)/3)))-SO(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,SO(Math.abs(Math.max(Math.abs(e),Math.abs(t)))-(i=Math.abs(i=o)))-SO(i))+1)||(r.precision=a-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(a=Math.max(0,-SO(Math.abs(o))))||(r.precision=a-("%"===r.type)*2)}return F(r)}function SV(e){var t=e.domain;return e.ticks=function(e){var n=t();return _P(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return SF(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=_D(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 SU(){var e=SA();return e.copy=function(){return S_(e,SU())},_b.apply(e,arguments),SV(e)}function SH(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,Sw),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return SH(e).unknown(t)},e=arguments.length?Array.from(e,Sw):[0,1],SV(n)}function SW(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 SY(e){return Math.log(e)}function SG(e){return Math.exp(e)}function SX(e){return-Math.log(-e)}function S$(e){return-Math.exp(-e)}function Sq(e){return isFinite(e)?+("1e"+e):e<0?0:e}function SK(e){return(t,n)=>-e(-t,n)}function SZ(e){let t,n,r=e(SY,SG),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)?Sq:s===Math.E?Math.exp:e=>Math.pow(s,e),i()[0]<0?(t=SK(t),n=SK(n),e(SX,S$)):e(SY,SG),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=_P(l,c,f))}else p=_P(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=SP(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(SW(i(),{floor:e=>n(Math.floor(t(e))),ceil:e=>n(Math.ceil(t(e)))})),r}function SQ(){let e=SZ(SS()).domain([1,10]);return e.copy=()=>S_(e,SQ()).base(e.base()),_b.apply(e,arguments),e}function SJ(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function S0(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function S1(e){var t=1,n=e(SJ(1),S0(t));return n.constant=function(n){return arguments.length?e(SJ(t=+n),S0(t)):t},SV(n)}function S2(){var e=S1(SS());return e.copy=function(){return S_(e,S2()).constant(e.constant())},_b.apply(e,arguments)}function S5(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function S3(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function S4(e){return e<0?-e*e:e*e}function S6(e){var t=e(SN,SN),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(SN,SN):.5===n?e(S3,S4):e(S5(n),S5(1/n)):n},SV(t)}function S8(){var e=S6(SS());return e.copy=function(){return S_(e,S8()).exponent(e.exponent())},_b.apply(e,arguments),e}function S7(){return S8.apply(null,arguments).exponent(.5)}function S9(e){return Math.sign(e)*e*e}function Ae(){var e,t=SA(),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(S9(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,Sw)).map(S9)),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 Ae(t.domain(),n).round(r).clamp(t.clamp()).unknown(e)},_b.apply(i,arguments),SV(i)}function At(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 An(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 Ar(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:+(e>t))}function Ai(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Aa(){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=_F){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[_U(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(_I),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 Aa().domain(t).range(n).unknown(e)},_b.apply(a,arguments)}function Ao(){var e,t=0,n=1,r=1,i=[.5],a=[0,1];function o(t){return null!=t&&t<=t?a[_U(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 Ao().domain([t,n]).range(a).unknown(e)},_b.apply(SV(o),arguments)}function As(){var e,t=[.5],n=[0,1],r=1;function i(i){return null!=i&&i<=i?n[_U(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 As().domain(t).range(n).unknown(e)},_b.apply(i,arguments)}F=(z=function(e){var t,n,r,i=void 0===e.grouping||void 0===e.thousands?SR:(t=SB.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?SR:(r=SB.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=SP(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"):SI[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=SI[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?Sz[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=SP(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(SO(t)/3))),i=Math.pow(10,-r),a=Sz[8+r/3];return function(e){return n(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,V=z.formatPrefix;let Al=new Date,Ac=new Date;function Au(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=>Au(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)=>(Al.setTime(+t),Ac.setTime(+r),e(Al),e(Ac),Math.floor(n(Al,Ac))),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 Ad=Au(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());Ad.every=e=>isFinite(e=Math.floor(e))&&e>0?Au(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,Ad.range;let Ah=Au(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());Ah.every=e=>isFinite(e=Math.floor(e))&&e>0?Au(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,Ah.range;let Af=Au(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());Af.range;let Ap=Au(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());Ap.range;function Ag(e){return Au(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 Am=Ag(0),Av=Ag(1),Ax=Ag(2),Ay=Ag(3),Ab=Ag(4),Aw=Ag(5),Aj=Ag(6);function AN(e){return Au(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)}Am.range,Av.range,Ax.range,Ay.range,Ab.range,Aw.range,Aj.range;let Ak=AN(0),AE=AN(1),AC=AN(2),A_=AN(3),AS=AN(4),AA=AN(5),AT=AN(6);Ak.range,AE.range,AC.range,A_.range,AS.range,AA.range,AT.range;let AO=Au(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);AO.range;let AM=Au(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1);AM.range;let AP=Au(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5));AP.range;let AD=Au(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());AD.range;let AL=Au(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours());AL.range;let AI=Au(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getMinutes());AI.range;let AR=Au(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes());AR.range;let AB=Au(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+1e3*t)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds());AB.range;let Az=Au(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);function AF(e,t,n,r,i,a){let o=[[AB,1,1e3],[AB,5,5e3],[AB,15,15e3],[AB,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=_B(([,,e])=>e).right(o,i);if(a===o.length)return e.every(_L(t/31536e6,n/31536e6,r));if(0===a)return Az.every(Math.max(_L(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]}Az.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?Au(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Az:null,Az.range;let[AV,AU]=AF(Ah,Ap,Ak,AP,AL,AR),[AH,AW]=AF(Ad,Af,Am,AO,AD,AI);function AY(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 AG(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 AX(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var A$={"-":"",_:" ",0:"0"},Aq=/^\s*\d+/,AK=/^%/,AZ=/[\\^$*+?|[\]().{}]/g;function AQ(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 AJ(e){return e.replace(AZ,"\\$&")}function A0(e){return RegExp("^(?:"+e.map(AJ).join("|")+")","i")}function A1(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function A2(e,t,n){var r=Aq.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function A5(e,t,n){var r=Aq.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function A3(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function A4(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function A6(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function A8(e,t,n){var r=Aq.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function A7(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function A9(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 Te(e,t,n){var r=Aq.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function Tt(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Tn(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Tr(e,t,n){var r=Aq.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Ti(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Ta(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function To(e,t,n){var r=Aq.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Ts(e,t,n){var r=Aq.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Tl(e,t,n){var r=Aq.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Tc(e,t,n){var r=AK.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Tu(e,t,n){var r=Aq.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Td(e,t,n){var r=Aq.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Th(e,t){return AQ(e.getDate(),t,2)}function Tf(e,t){return AQ(e.getHours(),t,2)}function Tp(e,t){return AQ(e.getHours()%12||12,t,2)}function Tg(e,t){return AQ(1+AO.count(Ad(e),e),t,3)}function Tm(e,t){return AQ(e.getMilliseconds(),t,3)}function Tv(e,t){return Tm(e,t)+"000"}function Tx(e,t){return AQ(e.getMonth()+1,t,2)}function Ty(e,t){return AQ(e.getMinutes(),t,2)}function Tb(e,t){return AQ(e.getSeconds(),t,2)}function Tw(e){var t=e.getDay();return 0===t?7:t}function Tj(e,t){return AQ(Am.count(Ad(e)-1,e),t,2)}function TN(e){var t=e.getDay();return t>=4||0===t?Ab(e):Ab.ceil(e)}function Tk(e,t){return e=TN(e),AQ(Ab.count(Ad(e),e)+(4===Ad(e).getDay()),t,2)}function TE(e){return e.getDay()}function TC(e,t){return AQ(Av.count(Ad(e)-1,e),t,2)}function T_(e,t){return AQ(e.getFullYear()%100,t,2)}function TS(e,t){return AQ((e=TN(e)).getFullYear()%100,t,2)}function TA(e,t){return AQ(e.getFullYear()%1e4,t,4)}function TT(e,t){var n=e.getDay();return AQ((e=n>=4||0===n?Ab(e):Ab.ceil(e)).getFullYear()%1e4,t,4)}function TO(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+AQ(t/60|0,"0",2)+AQ(t%60,"0",2)}function TM(e,t){return AQ(e.getUTCDate(),t,2)}function TP(e,t){return AQ(e.getUTCHours(),t,2)}function TD(e,t){return AQ(e.getUTCHours()%12||12,t,2)}function TL(e,t){return AQ(1+AM.count(Ah(e),e),t,3)}function TI(e,t){return AQ(e.getUTCMilliseconds(),t,3)}function TR(e,t){return TI(e,t)+"000"}function TB(e,t){return AQ(e.getUTCMonth()+1,t,2)}function Tz(e,t){return AQ(e.getUTCMinutes(),t,2)}function TF(e,t){return AQ(e.getUTCSeconds(),t,2)}function TV(e){var t=e.getUTCDay();return 0===t?7:t}function TU(e,t){return AQ(Ak.count(Ah(e)-1,e),t,2)}function TH(e){var t=e.getUTCDay();return t>=4||0===t?AS(e):AS.ceil(e)}function TW(e,t){return e=TH(e),AQ(AS.count(Ah(e),e)+(4===Ah(e).getUTCDay()),t,2)}function TY(e){return e.getUTCDay()}function TG(e,t){return AQ(AE.count(Ah(e)-1,e),t,2)}function TX(e,t){return AQ(e.getUTCFullYear()%100,t,2)}function T$(e,t){return AQ((e=TH(e)).getUTCFullYear()%100,t,2)}function Tq(e,t){return AQ(e.getUTCFullYear()%1e4,t,4)}function TK(e,t){var n=e.getUTCDay();return AQ((e=n>=4||0===n?AS(e):AS.ceil(e)).getUTCFullYear()%1e4,t,4)}function TZ(){return"+0000"}function TQ(){return"%"}function TJ(e){return+e}function T0(e){return Math.floor(e/1e3)}function T1(e){return new Date(e)}function T2(e){return e instanceof Date?+e:+new Date(+e)}function T5(e,t,n,r,i,a,o,s,l,c){var u=SA(),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,T2)):h().map(T1)},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(SW(n,e)):u},u.copy=function(){return S_(u,T5(e,t,n,r,i,a,o,s,l,c))},u}function T3(){return _b.apply(T5(AH,AW,Ad,Af,Am,AO,AD,AI,AB,H).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function T4(){return _b.apply(T5(AV,AU,Ah,Ap,Ak,AM,AL,AR,AB,W).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function T6(){var e,t,n,r,i,a=0,o=1,s=SN,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(Sy),c.rangeRound=u(Sb),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 T8(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function T7(){var e=SV(T6()(SN));return e.copy=function(){return T8(e,T7())},_w.apply(e,arguments)}function T9(){var e=SZ(T6()).domain([1,10]);return e.copy=function(){return T8(e,T9()).base(e.base())},_w.apply(e,arguments)}function Oe(){var e=S1(T6());return e.copy=function(){return T8(e,Oe()).constant(e.constant())},_w.apply(e,arguments)}function Ot(){var e=S6(T6());return e.copy=function(){return T8(e,Ot()).exponent(e.exponent())},_w.apply(e,arguments)}function On(){return Ot.apply(null,arguments).exponent(.5)}function Or(){var e=[],t=SN;function n(n){if(null!=n&&!isNaN(n*=1))return t((_U(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(_I),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 An(e);if(t>=1)return At(e);var n,r=(n-1)*t,i=Math.floor(r),a=At((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?Ar:function(e=_I){if(e===_I)return Ar;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(Ai(t,r,n),a(t[i],o)>0&&Ai(t,r,i);s<l;){for(Ai(t,s,l),++s,--l;0>a(t[s],o);)++s;for(;a(t[l],o)>0;)--l}0===a(t[r],o)?Ai(t,r,l):Ai(t,++l,i),l<=n&&(r=l+1),n<=l&&(i=l-1)}return t})(e,i).subarray(0,i+1));return a+(An(e.subarray(i+1))-a)*(r-i)}})(e,r/t))},n.copy=function(){return Or(t).domain(e)},_w.apply(n,arguments)}function Oi(){var e,t,n,r,i,a,o,s=0,l=.5,c=1,u=1,d=SN,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=Sy);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(Sy),f.rangeRound=p(Sb),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 Oa(){var e=SV(Oi()(SN));return e.copy=function(){return T8(e,Oa())},_w.apply(e,arguments)}function Oo(){var e=SZ(Oi()).domain([.1,1,10]);return e.copy=function(){return T8(e,Oo()).base(e.base())},_w.apply(e,arguments)}function Os(){var e=S1(Oi());return e.copy=function(){return T8(e,Os()).constant(e.constant())},_w.apply(e,arguments)}function Ol(){var e=S6(Oi());return e.copy=function(){return T8(e,Ol()).exponent(e.exponent())},_w.apply(e,arguments)}function Oc(){return Ol.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=A0(i),u=A1(i),d=A0(a),h=A1(a),f=A0(o),p=A1(o),g=A0(s),v=A1(s),x=A0(l),y=A1(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:Th,e:Th,f:Tv,g:TS,G:TT,H:Tf,I:Tp,j:Tg,L:Tm,m:Tx,M:Ty,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:TJ,s:T0,S:Tb,u:Tw,U:Tj,V:Tk,w:TE,W:TC,x:null,X:null,y:T_,Y:TA,Z:TO,"%":TQ},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:TM,e:TM,f:TR,g:T$,G:TK,H:TP,I:TD,j:TL,L:TI,m:TB,M:Tz,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:TJ,s:T0,S:TF,u:TV,U:TU,V:TW,w:TY,W:TG,x:null,X:null,y:TX,Y:Tq,Z:TZ,"%":TQ},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:Tn,e:Tn,f:Tl,g:A7,G:A8,H:Ti,I:Ti,j:Tr,L:Ts,m:Tt,M:Ta,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:Te,Q:Tu,s:Td,S:To,u:A5,U:A3,V:A4,w:A2,W:A6,x:function(e,t,r){return E(e,n,t,r)},X:function(e,t,n){return E(e,r,t,n)},y:A7,Y:A8,Z:A9,"%":Tc};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=A$[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=AX(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=AG(AX(a.y,0,1))).getUTCDay())>4||0===i?AE.ceil(r):AE(r),r=AM.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=AY(AX(a.y,0,1))).getDay())>4||0===i?Av.ceil(r):Av(r),r=AO.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?AG(AX(a.y,0,1)).getUTCDay():AY(AX(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,AG(a)):AY(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 A$?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,__,"scaleDiverging",0,Oa,"scaleDivergingLog",0,Oo,"scaleDivergingPow",0,Ol,"scaleDivergingSqrt",0,Oc,"scaleDivergingSymlog",0,Os,"scaleIdentity",0,SH,"scaleImplicit",0,_E,"scaleLinear",0,SU,"scaleLog",0,SQ,"scaleOrdinal",0,_C,"scalePoint",0,_S,"scalePow",0,S8,"scaleQuantile",0,Aa,"scaleQuantize",0,Ao,"scaleRadial",0,Ae,"scaleSequential",0,T7,"scaleSequentialLog",0,T9,"scaleSequentialPow",0,Ot,"scaleSequentialQuantile",0,Or,"scaleSequentialSqrt",0,On,"scaleSequentialSymlog",0,Oe,"scaleSqrt",0,S7,"scaleSymlog",0,S2,"scaleThreshold",0,As,"scaleTime",0,T3,"scaleUtc",0,T4,"tickFormat",0,SF],29061),e.i(29061),e.s(["scaleBand",0,__,"scaleDiverging",0,Oa,"scaleDivergingLog",0,Oo,"scaleDivergingPow",0,Ol,"scaleDivergingSqrt",0,Oc,"scaleDivergingSymlog",0,Os,"scaleIdentity",0,SH,"scaleImplicit",0,_E,"scaleLinear",0,SU,"scaleLog",0,SQ,"scaleOrdinal",0,_C,"scalePoint",0,_S,"scalePow",0,S8,"scaleQuantile",0,Aa,"scaleQuantize",0,Ao,"scaleRadial",0,Ae,"scaleSequential",0,T7,"scaleSequentialLog",0,T9,"scaleSequentialPow",0,Ot,"scaleSequentialQuantile",0,Or,"scaleSequentialSqrt",0,On,"scaleSequentialSymlog",0,Oe,"scaleSqrt",0,S7,"scaleSymlog",0,S2,"scaleThreshold",0,As,"scaleTime",0,T3,"scaleUtc",0,T4,"tickFormat",0,SF],79357);var Ou=e.i(79357),Od=e=>e.chartData,Oh=N0([Od],e=>{var t=null!=e.chartData?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Of=(e,t,n,r)=>r?Oh(e):Od(e);function Op(e){if(Array.isArray(e)&&2===e.length){var[t,n]=e;if(CD(t)&&CD(n))return!0}return!1}function Og(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function Om(e,t){if(t&&"function"!=typeof e&&Array.isArray(e)&&2===e.length){var n,r,[i,a]=e;if(CD(i))n=i;else if("function"==typeof i)return;if(CD(a))r=a;else if("function"==typeof a)return;var o=[n,r];if(Op(o))return o}}var Ov=e.i(51655),Ox=e=>e,Oy={},Ob=e=>function t(){let n;return 0==arguments.length||1==arguments.length&&(n=arguments.length<=0?void 0:arguments[0],n===Oy)?t:e(...arguments)},Ow=(e,t)=>1===e?t:Ob(function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var a=r.filter(e=>e!==Oy).length;return a>=e?t(...r):Ow(e-a,Ob(function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t(...r.map(e=>e===Oy?n.shift():e),...n)}))}),Oj=(e,t)=>{for(var n=[],r=e;r<t;++r)n[r-e]=r;return n},ON=Ow((a=(e,t)=>Array.isArray(t)?t.map(e):Object.keys(t).map(e=>t[e]).map(e)).length,a),Ok=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.length)return Ox;var r=t.reverse(),i=r[0],a=r.slice(1);return function(){return a.reduce((e,t)=>t(e),i(...arguments))}};function OE(e){return 0===e?1:Math.floor(new Ov.default(e).abs().log(10).toNumber())+1}function OC(e,t,n){for(var r=new Ov.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var O_=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},OS=(e,t,n)=>{if(e.lte(0))return new Ov.default(0);var r=OE(e.toNumber()),i=new Ov.default(10).pow(r),a=e.div(i),o=1!==r?.05:.1,s=new Ov.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return new Ov.default(t?s.toNumber():Math.ceil(s.toNumber()))},OA=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 Ov.default(0),tickMin:new Ov.default(0),tickMax:new Ov.default(0)};var o=OS(new Ov.default(t).sub(e).div(n-1),r,a),s=Math.ceil((i=e<=0&&t>=0?new Ov.default(0):(i=new Ov.default(e).add(t).div(2)).sub(new Ov.default(i).mod(o))).sub(e).div(o).toNumber()),l=Math.ceil(new Ov.default(t).sub(i).div(o).toNumber()),c=s+l+1;return c>n?OA(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 Ov.default(s).mul(o)),tickMax:i.add(new Ov.default(l).mul(o))})},OT=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]=O_([t,n]);if(o===-1/0||s===1/0){var l=s===1/0?[o,...Oj(0,r-1).map(()=>1/0)]:[...Oj(0,r-1).map(()=>-1/0),s];return t>n?l.reverse():l}if(o===s){var c=new Ov.default(1),u=new Ov.default(o);if(!u.isint()&&i){var d=Math.abs(o);d<1?(c=new Ov.default(10).pow(OE(o)-1),u=new Ov.default(Math.floor(u.div(c).toNumber())).mul(c)):d>1&&(u=new Ov.default(Math.floor(o)))}else 0===o?u=new Ov.default(Math.floor((r-1)/2)):i||(u=new Ov.default(Math.floor(o)));var h=Math.floor((r-1)/2);return Ok(ON(e=>u.add(new Ov.default(e-h).mul(c)).toNumber()),Oj)(0,r)}var{step:f,tickMin:p,tickMax:g}=OA(o,s,a,i,0),v=OC(p,g.add(new Ov.default(.1).mul(f)),f);return t>n?v.reverse():v},OO=function(e,t){var[n,r]=e,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],[a,o]=O_([n,r]);if(a===-1/0||o===1/0)return[n,r];if(a===o)return[a];var s=Math.max(t,2),l=OS(new Ov.default(o).sub(a).div(s-1),i,0),c=[...OC(new Ov.default(a),new Ov.default(o),l),o];return!1===i&&(c=c.map(e=>Math.round(e))),n>r?c.reverse():c},OM=e=>e.rootProps.stackOffset,OP=e=>e.rootProps.reverseStackOrder,OD=e=>e.options.chartName,OL=e=>e.rootProps.syncId,OI=e=>e.rootProps.syncMethod,OR=e=>e.options.eventEmitter;function OB(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 Oz(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?OB(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)):OB(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var OF=Math.PI/180,OV=(e,t,n,r)=>({x:e+Math.cos(-OF*r)*n,y:t+Math.sin(-OF*r)*n}),OU={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},OH={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:OU.axis},OW={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:OU.axis},OY=(e,t)=>{if(e&&t)return null!=e&&e.reversed?[t[1],t[0]]:t},OG={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:OH.angleAxisId,includeHidden:!1,name:void 0,reversed:OH.reversed,scale:OH.scale,tick:OH.tick,tickCount:void 0,ticks:void 0,type:OH.type,unit:void 0},OX={allowDataOverflow:OW.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:OW.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:OW.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:OW.scale,tick:OW.tick,tickCount:OW.tickCount,ticks:void 0,type:OW.type,unit:void 0},O$={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:OH.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:OH.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:OH.scale,tick:OH.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},Oq={allowDataOverflow:OW.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:OW.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:OW.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:OW.scale,tick:OW.tick,tickCount:OW.tickCount,ticks:void 0,type:"category",unit:void 0},OK=(e,t)=>null!=e.polarAxis.angleAxis[t]?e.polarAxis.angleAxis[t]:"radial"===e.layout.layoutType?O$:OG,OZ=(e,t)=>null!=e.polarAxis.radiusAxis[t]?e.polarAxis.radiusAxis[t]:"radial"===e.layout.layoutType?Oq:OX,OQ=e=>e.polarOptions,OJ=N0([CX,C$,C1],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}),O0=N0([OQ,OJ],(e,t)=>{if(null!=e)return k5(e.innerRadius,t,0)}),O1=N0([OQ,OJ],(e,t)=>{if(null!=e)return k5(e.outerRadius,t,.8*t)}),O2=N0([OQ],e=>{if(null==e)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});N0([OK,O2],OY);var O5=N0([OJ,O0,O1],(e,t,n)=>{if(null!=e&&null!=t&&null!=n)return[t,n]});N0([OZ,O5],OY);var O3=N0([_v,OQ,O0,O1,CX,C$],(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:k5(o,i,i/2),cy:k5(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),O4=(e,t)=>t,O6=(e,t,n)=>n;function O8(e){return null==e?void 0:e.id}function O7(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=O8(e);n.forEach((t,n)=>{var r,l=null==a||i?n:String(CB(t,a,null)),c=CB(t,e.dataKey,0);Object.assign(r=o.has(l)?o.get(l):{},{[s]:c}),o.set(l,r)})}}),Array.from(o.values())}function O9(e){return"stackId"in e&&null!=e.stackId&&null!=e.dataKey}var Me=(e,t)=>e===t||null!=e&&null!=t&&e[0]===t[0]&&e[1]===t[1];function Mt(e,t){return!!(Array.isArray(e)&&Array.isArray(t))&&0===e.length&&0===t.length||e===t}var Mn=e=>{var t=_v(e);return"horizontal"===t?"xAxis":"vertical"===t?"yAxis":"centric"===t?"angleAxis":"radiusAxis"},Mr=e=>e.tooltip.settings.axisId;function Mi(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 Ma(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mi(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)):Mi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Mo=[0,"auto"],Ms={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},Ml=(e,t)=>e.cartesianAxis.xAxis[t],Mc=(e,t)=>{var n=Ml(e,t);return null==n?Ms:n},Mu={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Mo,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},Md=(e,t)=>{var n=e.cartesianAxis.yAxis[t];return null==n?Mu:n},Mh={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:""},Mf=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return null==n?Mh:n},Mp=(e,t,n)=>{switch(t){case"xAxis":return Mc(e,n);case"yAxis":return Md(e,n);case"zAxis":return Mf(e,n);case"angleAxis":return OK(e,n);case"radiusAxis":return OZ(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Mg=(e,t,n)=>{switch(t){case"xAxis":return Mc(e,n);case"yAxis":return Md(e,n);case"angleAxis":return OK(e,n);case"radiusAxis":return OZ(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Mm=e=>e.graphicalItems.cartesianItems.some(e=>"bar"===e.type)||e.graphicalItems.polarItems.some(e=>"radialBar"===e.type);function Mv(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 Mx=e=>e.graphicalItems.cartesianItems,My=N0([O4,O6],Mv),Mb=(e,t,n)=>e.filter(n).filter(e=>(null==t?void 0:t.includeHidden)===!0||!e.hide),Mw=N0([Mx,Mp,My],Mb,{memoizeOptions:{resultEqualityCheck:Mt}}),Mj=N0([Mw],e=>e.filter(e=>"area"===e.type||"bar"===e.type).filter(O9)),MN=e=>e.filter(e=>!("stackId"in e)||void 0===e.stackId),Mk=N0([Mw],MN),ME=e=>e.map(e=>e.data).filter(Boolean).flat(1),MC=N0([Mw],ME,{memoizeOptions:{resultEqualityCheck:Mt}}),M_=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},MS=N0([MC,Of],M_),MA=(e,t,n)=>(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:CB(e,t.dataKey)})):n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:CB(e,t)}))):e.map(e=>({value:e})),MT=N0([MS,Mp,Mw],MA);function MO(e,t){switch(e){case"xAxis":return"x"===t.direction;case"yAxis":return"y"===t.direction;default:return!1}}function MM(e){if(k0(e)||e instanceof Date){var t=Number(e);if(CD(t))return t}}function MP(e){if(Array.isArray(e)){var t=[MM(e[0]),MM(e[1])];return Op(t)?t:void 0}var n=MM(e);if(null!=n)return[n,n]}function MD(e){return e.map(MM).filter(k7)}var ML=e=>{var t=Mn(e),n=Mr(e);return Mg(e,t,n)},MI=N0([ML],e=>null==e?void 0:e.dataKey),MR=N0([Mj,Of,ML],O7),MB=(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(O8);return[s,{stackedData:(a=null!=(i=CF[n])?i:CA,(o=(function(){var e=CS([]),t=CT,n=CA,r=CO;function i(i){var a,o,s=Array.from(e.apply(this,arguments),CM),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=C_(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:CS(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r="function"==typeof e?e:CS(+e),i):r},i.order=function(e){return arguments.length?(t=null==e?CT:"function"==typeof e?e:CS(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=null==e?CA:e,i):n},i})().keys(u).value((e,t)=>Number(CB(e,t,0))).order(CT).offset(a)(e)).forEach((t,n)=>{t.forEach((t,r)=>{var i=CB(e[r],u[n],0);Array.isArray(i)&&2===i.length&&kJ(i[0])&&kJ(i[1])&&(t[0]=i[0],t[1]=i[1])})}),o),graphicalItems:c}]})),Mz=N0([MR,Mj,OM,OP],MB),MF=(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=CP(r,t,n).flat(2).filter(kJ)),Math.max(...i)];return CD(a[0])&&CD(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}},MV=N0([Mp],e=>e.allowDataOverflow),MU=e=>{var t;if(null==e||!("domain"in e))return Mo;if(null!=e.domain)return e.domain;if("ticks"in e&&null!=e.ticks){if("number"===e.type){var n=MD(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:Mo},MH=N0([Mp],MU),MW=N0([MH,MV],Om),MY=N0([Mz,Od,O4,MW],MF,{memoizeOptions:{resultEqualityCheck:Me}}),MG=e=>e.errorBars,MX=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)]}},M$=(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=>MO(i,e)),u=CB(e,null!=(l=t.dataKey)?l:n.dataKey),d=!(!c||"number"!=typeof u||kZ(u))&&c.length?MD(c.flatMap(t=>{var n,r,i=CB(e,t.dataKey);if(Array.isArray(i)?[n,r]=i:n=r=i,CD(n)&&CD(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=MP(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=MP(CB(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]))}),CD(a)&&CD(o))return[a,o]},Mq=N0([MS,Mp,Mk,MG,O4],M$,{memoizeOptions:{resultEqualityCheck:Me}});function MK(e){var{value:t}=e;if(k0(t)||t instanceof Date)return t}var MZ=e=>e.referenceElements.dots,MQ=(e,t,n)=>e.filter(e=>"extendDomain"===e.ifOverflow).filter(e=>"xAxis"===t?e.xAxisId===n:e.yAxisId===n),MJ=N0([MZ,O4,O6],MQ),M0=e=>e.referenceElements.areas,M1=N0([M0,O4,O6],MQ),M2=e=>e.referenceElements.lines,M5=N0([M2,O4,O6],MQ),M3=(e,t)=>{if(null!=e){var n=MD(e.map(e=>"xAxis"===t?e.x:e.y));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},M4=N0(MJ,O4,M3),M6=(e,t)=>{if(null!=e){var n=MD(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)]}},M8=N0([M1,O4],M6),M7=(e,t)=>{if(null!=e){var n=e.flatMap(e=>"xAxis"===t?function(e){if(null!=e.x)return MD([e.x]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.x);return null==n||0===n.length?[]:MD(n)}(e):function(e){if(null!=e.y)return MD([e.y]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.y);return null==n||0===n.length?[]:MD(n)}(e));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},M9=N0([M5,O4],M7),Pe=N0(M4,M9,M8,(e,t,n)=>MX(e,n,t)),Pt=(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(Op(r))return Og(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(kJ(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&&CU.test(o)){var l=CU.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(kJ(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&&CH.test(s)){var u=CH.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(Op(h))return null==t?h:Og(h,t,n)}}}(t,"vertical"===o&&"xAxis"===s||"horizontal"===o&&"yAxis"===s?MX(r,a,i):MX(a,i),e.allowDataOverflow),Pn=N0([Mp,MH,MW,MY,Mq,Pe,_v,O4],Pt,{memoizeOptions:{resultEqualityCheck:Me}}),Pr=[0,1],Pi=(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=Cz(t,a);return d&&null==c?(0,_y.default)(0,null!=(l=null==n?void 0:n.length)?l:0):"category"===u?(s=r.map(MK).filter(e=>null!=e),d&&(null==e.dataKey||e.allowDuplicatedCategory&&k3(s))?(0,_y.default)(0,r.length):e.allowDuplicatedCategory?s:Array.from(new Set(s))):"expand"===i?Pr:o}},Pa=N0([Mp,_v,MS,MT,OM,O4,Pn],Pi),Po=(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(k8(a));return s in Ou?s:"point"}}},Ps=N0([Mp,_v,Mm,OD,O4],Po);function Pl(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 Ou)return Ou[e]();var t="scale".concat(k8(e));if(t in Ou)return Ou[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 Pc=(e,t,n)=>{var r=MU(t);if("auto"===n||"linear"===n){if(null!=t&&t.tickCount&&Array.isArray(r)&&("auto"===r[0]||"auto"===r[1])&&Op(e))return OT(e,t.tickCount,t.allowDecimals);if(null!=t&&t.tickCount&&"number"===t.type&&Op(e))return OO(e,t.tickCount,t.allowDecimals)}},Pu=N0([Pa,Mg,Ps],Pc),Pd=(e,t,n,r)=>"angleAxis"!==r&&(null==e?void 0:e.type)==="number"&&Op(t)&&Array.isArray(n)&&n.length>0?[Math.min(t[0],n[0]),Math.max(t[1],n[n.length-1])]:t,Ph=N0([Mp,Pa,Pu,O4],Pd),Pf=N0(MT,Mp,(e,t)=>{if(t&&"number"===t.type){var n=1/0,r=Array.from(MD(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}}),Pp=N0(Pf,_v,e=>e.rootProps.barCategoryGap,C1,(e,t,n,r,i)=>i,(e,t,n,r,i)=>{if(!CD(e))return 0;var a="vertical"===t?r.height:r.width;if("gap"===i)return e*a/2;if("no-gap"===i){var o=k5(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),Pg=N0(Mc,(e,t,n)=>{var r=Mc(e,t);return null==r||"string"!=typeof r.padding?0:Pp(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}}),Pm=N0(Md,(e,t,n)=>{var r=Md(e,t);return null==r||"string"!=typeof r.padding?0:Pp(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}}),Pv=N0([C1,Pg,C8,C6,(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]}),Px=N0([C1,_v,Pm,C8,C6,(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]}),Py=(e,t,n,r)=>{var i;switch(t){case"xAxis":return Pv(e,n,r);case"yAxis":return Px(e,n,r);case"zAxis":return null==(i=Mf(e,n))?void 0:i.range;case"angleAxis":return O2(e);case"radiusAxis":return O5(e,n);default:return}},Pb=N0([Mp,Py],OY),Pw=N0([Mp,Ps,Ph,Pb],Pl);function Pj(e,t){return e.id<t.id?-1:+(e.id>t.id)}N0([Mw,MG,O4],(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>MO(n,e)));var PN=(e,t)=>t,Pk=(e,t,n)=>n,PE=N0(CZ,PN,Pk,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Pj)),PC=N0(CQ,PN,Pk,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Pj)),P_=(e,t)=>({width:e.width,height:t.height}),PS=N0(C1,Mc,P_),PA=N0(C$,C1,PE,PN,Pk,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s=P_(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}),PT=N0(CX,C1,PC,PN,Pk,(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}),PO=N0([C1,Mc,(e,t)=>{var n=Mc(e,t);if(null!=n)return PA(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}}});N0([C1,Md,(e,t)=>{var n=Md(e,t);if(null!=n)return PT(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}}}),N0(C1,Md,(e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height}));var PM=(e,t,n,r)=>{if(null!=n){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=Cz(e,r),l=t.map(e=>e.value);if(o&&s&&"category"===a&&i&&k3(l))return l}},PP=N0([_v,MT,Mp,O4],PM),PD=(e,t,n,r)=>{if(null!=n&&null!=n.dataKey){var{type:i,scale:a}=n;if(Cz(e,r)&&("number"===i||"auto"!==a))return t.map(e=>e.value)}},PL=N0([_v,MT,Mg,O4],PD);N0([_v,(e,t,n)=>{switch(t){case"xAxis":return Mc(e,n);case"yAxis":return Md(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Ps,Pw,PP,PL,Py,Pu,O4],(e,t,n,r,i,a,o,s,l)=>{if(null!=t){var c=Cz(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}}});var PI=N0([_v,Mg,Ps,Pw,Pu,Py,PP,PL,O4],(e,t,n,r,i,a,o,s,l)=>{if(null!=t&&null!=r){var c=Cz(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*kK(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=>CD(e.coordinate)):c&&s?s.map((e,t)=>({coordinate:r(e)+p,value:e,index:t,offset:p})).filter(e=>CD(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}))}}),PR=N0([_v,Mg,Pw,Py,PP,PL,O4],(e,t,n,r,i,a,o)=>{if(null!=t&&null!=n&&null!=r&&r[0]!==r[1]){var s=Cz(e,o),{tickCount:l}=t,c=0;return(c="angleAxis"===o&&(null==r?void 0:r.length)>=2?2*kK(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}))}}),PB=N0(Mp,Pw,(e,t)=>{if(null!=e&&null!=t)return Ma(Ma({},e),{},{scale:t})}),Pz=N0([Mp,Ps,Pa,Pb],Pl);N0((e,t,n)=>Mf(e,n),Pz,(e,t)=>{if(null!=e&&null!=t)return Ma(Ma({},e),{},{scale:t})});var PF=N0([_v,CZ,CQ],(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}}),PV=e=>e.options.defaultTooltipEventType,PU=e=>e.options.validateTooltipEventTypes;function PH(e,t,n){if(null==e)return t;var r=e?"axis":"item";return null==n?t:n.includes(r)?r:t}function PW(e,t){return PH(t,PV(e),PU(e))}var PY=(e,t)=>{var n,r=Number(t);if(!kZ(r)&&null!=t)return r>=0?null==e||null==(n=e[r])?void 0:n.value:void 0};function PG(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 PX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?PG(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)):PG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var P$=(e,t,n,r)=>{if(null==t)return E1;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 E1;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 PX(PX({},s),{},{active:!0})}else if(null!=r)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return PX(PX({},E1),{},{coordinate:s.coordinate})},Pq=(e,t,n,r)=>{var i=null==e?void 0:e.index;if(null==i)return null;var a=Number(i);if(!CD(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=CB(e,t);return!(null!=r&&Op(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)},PK=(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}}},PZ=(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})},PQ=e=>e.options.tooltipPayloadSearcher,PJ=e=>e.tooltip;function P0(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 P1(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P0(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)):P0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var P2=(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)?CP(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?k6(x,r,i):a(x,t,l,b))?h.forEach(t=>{var n=P1(P1({},g),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(CY({tooltipEntrySettings:n,dataKey:t.dataKey,payload:t.payload,value:CB(t.payload,t.dataKey),name:t.name}))}):e.push(CY({tooltipEntrySettings:g,dataKey:y,payload:h,value:CB(h,y),name:null!=(f=CB(h,b))?f:null==g?void 0:g.name})),e},[])}},P5=N0([ML,_v,Mm,OD,Mn],Po),P3=N0([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),P4=N0([Mn,Mr],Mv),P6=N0([P3,ML,P4],Mb,{memoizeOptions:{resultEqualityCheck:Mt}}),P8=N0([P6],e=>e.filter(O9)),P7=N0([P6],ME,{memoizeOptions:{resultEqualityCheck:Mt}}),P9=N0([P7,Od],M_),De=N0([P8,Od,ML],O7),Dt=N0([P9,ML,P6],MA),Dn=N0([ML],MU),Dr=N0([ML],e=>e.allowDataOverflow),Di=N0([Dn,Dr],Om),Da=N0([P6],e=>e.filter(O9)),Do=N0([De,Da,OM,OP],MB),Ds=N0([Do,Od,Mn,Di],MF),Dl=N0([P6],MN),Dc=N0([P9,ML,Dl,MG,Mn],M$,{memoizeOptions:{resultEqualityCheck:Me}}),Du=N0([MZ,Mn,Mr],MQ),Dd=N0([Du,Mn],M3),Dh=N0([M0,Mn,Mr],MQ),Df=N0([Dh,Mn],M6),Dp=N0([M2,Mn,Mr],MQ),Dg=N0([Dp,Mn],M7),Dm=N0([Dd,Dg,Df],MX),Dv=N0([ML,Dn,Di,Ds,Dc,Dm,_v,Mn],Pt),Dx=N0([ML,_v,P9,Dt,OM,Mn,Dv],Pi),Dy=N0([Dx,ML,P5],Pc),Db=N0([ML,Dx,Dy,Mn],Pd),Dw=e=>{var t=Mn(e),n=Mr(e);return Py(e,t,n,!1)},Dj=N0([ML,Dw],OY),DN=N0([ML,P5,Db,Dj],Pl),Dk=N0([_v,Dt,ML,Mn],PM),DE=N0([_v,Dt,ML,Mn],PD),DC=N0([_v,ML,P5,DN,Dw,Dk,DE,Mn],(e,t,n,r,i,a,o,s)=>{if(t){var{type:l}=t,c=Cz(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*kK(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}))}}}),D_=N0([PV,PU,e=>e.tooltip.settings],(e,t,n)=>PH(n.shared,e,t)),DS=e=>e.tooltip.settings.trigger,DA=e=>e.tooltip.settings.defaultIndex,DT=N0([PJ,D_,DS,DA],P$),DO=N0([DT,P9,MI,Dx],Pq),DM=N0([DC,DO],PY),DP=N0([DT],e=>{if(e)return e.dataKey});N0([DT],e=>{if(e)return e.graphicalItemId});var DD=N0([PJ,D_,DS,DA],PZ),DL=N0([CX,C$,_v,C1,DC,DA,DD,PQ],PK),DI=N0([DT,DL],(e,t)=>null!=e&&e.coordinate?e.coordinate:t),DR=N0([DT],e=>{var t;return null!=(t=null==e?void 0:e.active)&&t}),DB=N0([DD,DO,Od,MI,DM,PQ,D_],P2),Dz=N0([DB],e=>{if(null!=e)return Array.from(new Set(e.map(e=>e.payload).filter(e=>null!=e)))});function DF(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 DV(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?DF(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)):DF(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var DU=(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(kK(l-s)!==kK(c-l)){var d,h,f,p,g,v,x,y=[];if(kK(c-l)===kK(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],A=t[C-1];if(0===C&&null!=S&&e<=(_.coordinate+S.coordinate)/2||C===a-1&&null!=A&&e>(_.coordinate+A.coordinate)/2||C>0&&C<a-1&&null!=A&&null!=S&&e>(_.coordinate+A.coordinate)/2&&e<=(_.coordinate+S.coordinate)/2)return _.index}}return -1},DH=(e,t)=>t,DW=(e,t,n)=>n,DY=(e,t,n,r)=>r,DG=N0(DC,e=>(0,CE.default)(e,e=>e.coordinate)),DX=N0([PJ,DH,DW,DY],P$),D$=N0([DX,P9,MI,Dx],Pq),Dq=N0([PJ,DH,DW,DY],PZ),DK=N0([CX,C$,_v,C1,DC,DY,Dq,PQ],PK),DZ=N0([DX,DK],(e,t)=>{var n;return null!=(n=e.coordinate)?n:t}),DQ=N0([DC,D$],PY),DJ=N0([Dq,D$,Od,MI,DQ,PQ,DH],P2),D0=N0([DX,D$],(e,t)=>({isActive:e.active&&null!=t,activeIndex:t})),D1=N0([(e,t)=>t,_v,O3,Mn,Dj,DC,DG,C1],(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=DU("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?Oz(Oz({},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=DU("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 DV(DV(DV({},r),OV(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:l}=r;return DV(DV(DV({},r),OV(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}}}),D2=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)}},D5=kr("mouseClick"),D3=kY();D3.startListening({actionCreator:D5,effect:(e,t)=>{var n=e.payload,r=D1(t.getState(),D2(n));(null==r?void 0:r.activeIndex)!=null&&t.dispatch(Cn({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var D4=kr("mouseMove"),D6=kY(),D8=null;function D7(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 D9(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 Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D9(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)):D9(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}D6.startListening({actionCreator:D4,effect:(e,t)=>{var n=e.payload;null!==D8&&cancelAnimationFrame(D8);var r=D2(n);D8=requestAnimationFrame(()=>{var e=t.getState();if("axis"===PW(e,e.tooltip.settings.shared)){var n=D1(e,r);(null==n?void 0:n.activeIndex)!=null?t.dispatch(Ct({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate})):t.dispatch(E9())}D8=null})}});var Lt=kp({name:"cartesianAxis",initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:kl()},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:kl()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:kl()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:kl()},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:kl()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:kl()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:kl()},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:kl()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:kl()},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]=Le(Le({},e.yAxis[n]),{},{width:r,widthHistory:o})}}}}),{addXAxis:Ln,replaceXAxis:Lr,removeXAxis:Li,addYAxis:La,replaceYAxis:Lo,removeYAxis:Ls,addZAxis:Ll,replaceZAxis:Lc,removeZAxis:Lu,updateYAxisWidth:Ld}=Lt.actions,Lh=Lt.reducer,Lf=kp({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:kl()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NL(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:kl()},removeCartesianGraphicalItem:{reducer(e,t){var n=NL(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:kl()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:kl()},removePolarGraphicalItem:{reducer(e,t){var n=NL(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:kl()}}}),{addCartesianGraphicalItem:Lp,replaceCartesianGraphicalItem:Lg,removeCartesianGraphicalItem:Lm,addPolarGraphicalItem:Lv,removePolarGraphicalItem:Lx}=Lf.actions,Ly=Lf.reducer,Lb=kp({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=NL(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=NL(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=NL(e).lines.findIndex(e=>e===t.payload);-1!==n&&e.lines.splice(n,1)}}}),{addDot:Lw,removeDot:Lj,addArea:LN,removeArea:Lk,addLine:LE,removeLine:LC}=Lb.actions,L_=Lb.reducer,LS={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},LA=kp({name:"brush",initialState:LS,reducers:{setBrushSettings:(e,t)=>null==t.payload?LS:t.payload}}),{setBrushSettings:LT}=LA.actions,LO=LA.reducer,LM=kp({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:kl()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NL(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:kl()},removeLegendPayload:{reducer(e,t){var n=NL(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:kl()}}}),{setLegendSize:LP,setLegendSettings:LD,addLegendPayload:LL,replaceLegendPayload:LI,removeLegendPayload:LR}=LM.actions,LB=LM.reducer,Lz={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},LF=kp({name:"rootProps",initialState:Lz,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=null!=(n=t.payload.barGap)?n:Lz.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}}}),LV=LF.reducer,{updateOptions:LU}=LF.actions,LH=kp({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:LW,removeRadiusAxis:LY,addAngleAxis:LG,removeAngleAxis:LX}=LH.actions,L$=LH.reducer,Lq=kp({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:LK}=Lq.actions,LZ=Lq.reducer,LQ=kr("keyDown"),LJ=kr("focus"),L0=kY();L0.startListening({actionCreator:LQ,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=Pq(r,P9(n),MI(n),Dx(n)),o=null==a?-1:Number(a);if(Number.isFinite(o)&&!(o<0)){var s=DC(n);if("Enter"===i){var l=DK(n,"axis","hover",String(r.index));t.dispatch(Ci({active:!r.active,activeIndex:r.index,activeCoordinate:l}));return}var c=o+("ArrowRight"===i?1:-1)*("left-to-right"===PF(n)?1:-1);if(null!=s&&!(c>=s.length)&&!(c<0)){var u=DK(n,"axis","hover",String(c));t.dispatch(Ci({active:!0,activeIndex:c.toString(),activeCoordinate:u}))}}}}}),L0.startListening({actionCreator:LJ,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=DK(n,"axis","hover",String("0"));t.dispatch(Ci({active:!0,activeIndex:"0",activeCoordinate:i}))}}}});var L1=kr("externalEvent"),L2=kY(),L5=new Map;L2.startListening({actionCreator:L1,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(null!=n){r.persist();var i=r.type,a=L5.get(i);void 0!==a&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var e=t.getState(),a={activeCoordinate:DI(e),activeDataKey:DP(e),activeIndex:DO(e),activeLabel:DM(e),activeTooltipIndex:DO(e),isTooltipActive:DR(e)};n(a,r)}finally{L5.delete(i)}});L5.set(i,o)}}});var L3=N0([PJ],e=>e.tooltipItemPayloads),L4=N0([L3,PQ,(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)}}),L6=kr("touchMove"),L8=kY();L8.startListening({actionCreator:L6,effect:(e,t)=>{var n=e.payload;if(null!=n.touches&&0!==n.touches.length){var r=t.getState(),i=PW(r,r.tooltip.settings.shared);if("axis"===i){var a=n.touches[0];if(null==a)return;var o=D1(r,D2({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(null==o?void 0:o.activeIndex)!=null&&t.dispatch(Ct({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=P6(r).find(e=>e.id===d);if(null==u||null==h||null==d)return;var{dataKey:f}=h,p=L4(r,u,d);t.dispatch(E8({activeDataKey:f,activeIndex:u,activeCoordinate:p,activeGraphicalItemId:d}))}}}});var L7=kp({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:L9,replaceErrorBar:Ie,removeErrorBar:It}=L7.actions,In=L7.reducer,Ir={devToolsEnabled:!0,isSsr:!("u">typeof window&&window.document&&window.document.createElement&&window.setTimeout)};function Ii(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 Ia(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ii(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)):Ii(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Io={zIndexMap:Object.values(OU).reduce((e,t)=>Ia(Ia({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},Is=new Set(Object.values(OU)),Il=kp({name:"zIndex",initialState:Io,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:kl()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!Is.has(n)&&delete e.zIndexMap[n])},prepare:kl()},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:kl()},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:kl()}}}),{registerZIndexPortal:Ic,unregisterZIndexPortal:Iu,registerZIndexPortalElement:Id,unregisterZIndexPortalElement:Ih}=Il.actions,If=N8({brush:LO,cartesianAxis:Lh,chartData:Cu,errorBars:In,graphicalItems:Ly,layout:Cm,legend:LB,options:En,polarAxis:L$,polarOptions:LZ,referenceElements:L_,rootProps:LV,tooltip:Ca,zIndex:Il.reducer}),Ip=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 ki;return t&&("boolean"==typeof t?a.push(kt):a.push(ke(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(N6(a))t=N8(a);else throw Error(kG(1));n="function"==typeof o?o(i):i();let d=N7;s&&(d=kn({trace:!1,..."object"==typeof s&&s}));let h=(r=function(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(N2(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=N7(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}(...n),function(e){let{autoBatch:t=!0}=e??{},n=new ki(r);return t&&n.push(ku("object"==typeof t?t:void 0)),n});return function e(t,n,r){if("function"!=typeof t)throw Error(N2(2));if("function"==typeof n&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw Error(N2(0));if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw Error(N2(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(N2(3));return a}function h(e){if("function"!=typeof e)throw Error(N2(4));if(c)throw Error(N2(5));let t=!0;u();let n=l++;return s.set(n,e),function(){if(t){if(c)throw Error(N2(6));t=!1,u(),s.delete(n),o=null}}}function f(e){if(!N6(e))throw Error(N2(7));if(void 0===e.type)throw Error(N2(8));if("string"!=typeof e.type)throw Error(N2(17));if(c)throw Error(N2(9));try{c=!0,a=i(a,e)}finally{c=!1}return(o=s).forEach(e=>{e()}),e}return f({type:N4.INIT}),{dispatch:f,subscribe:h,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw Error(N2(10));i=e,f({type:N4.REPLACE})},[N5]:function(){return{subscribe(e){if("object"!=typeof e||null===e)throw Error(N2(11));function t(){e.next&&e.next(d())}return t(),{unsubscribe:h(t)}},[N5](){return this}}}}}(t,c,d(..."function"==typeof u?u(h):h()))}({reducer:If,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([D3.middleware,D6.middleware,L0.middleware,L2.middleware,L8.middleware]),enhancers:e=>{var t=e;return"function"==typeof e&&(t=e()),t.concat(ku({type:"raf"}))},devTools:Ir.devToolsEnabled&&{serialize:{replacer:D7},name:"recharts-".concat(t)}})};function Ig(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=C4(),a=(0,eg.useRef)(null);return i?n:(null==a.current&&(a.current=Ip(t,r)),eg.createElement(Eh,{context:Cx,store:a.current},n))}var Im=e=>{var{chartData:t}=e,n=Cb(),r=C4();return(0,eg.useEffect)(()=>r?()=>{}:(n(Cs(t)),()=>{n(Cs(void 0))}),[t,n,r]),null},Iv=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function Ix(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(Iv.has(n)){if(null==e[n]&&null==t[n])continue;if(!function(e,t){if(El(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])||!El(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 Iy=(0,eg.memo)(function(e){var{layout:t,margin:n}=e,r=Cb(),i=C4();return(0,eg.useEffect)(()=>{i||(r(Cf(t)),r(Ch(n)))},[r,i,t,n]),null},Ix);function Ib(e){var t=Cb();return(0,eg.useEffect)(()=>{t(LU(e))},[t,e]),null}var Iw=()=>{var e;return null==(e=Ck(e=>e.rootProps.accessibilityLayer))||e},Ij=["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 IN(e){return"string"==typeof e&&Ij.includes(e)}var Ik=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 IE(e){return"string"==typeof e&&Ik.has(e)}function IC(e){return"string"==typeof e&&e.startsWith("data-")}function I_(e){if("object"!=typeof e||null===e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IE(n)||IC(n))&&(t[n]=e[n]);return t}function IS(e){return null==e?null:(0,eg.isValidElement)(e)&&"object"==typeof e.props&&null!==e.props?I_(e.props):"object"!=typeof e||Array.isArray(e)?null:I_(e)}function IA(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IE(n)||IC(n)||IN(n))&&(t[n]=e[n]);return t}var IT=["children","width","height","viewBox","className","style","title","desc"];function IO(){return(IO=Object.assign.bind()).apply(null,arguments)}var IM=(0,eg.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,IT),d=a||{width:r,height:i,x:0,y:0},h=(0,C7.clsx)("recharts-surface",o);return eg.createElement("svg",IO({},IA(u),{className:h,width:r,height:i,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height),ref:t}),eg.createElement("title",null,l),eg.createElement("desc",null,c),n)}),IP=N0(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}}),ID=N0(e=>e.zIndex.zIndexMap,e=>Array.from(new Set(Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(OU)))).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 IL(e){var{zIndex:t,isPanorama:n}=e,r=(0,eg.useRef)(null),i=Cb();return(0,eg.useLayoutEffect)(()=>(r.current&&i(Id({zIndex:t,element:r.current,isPanorama:n})),()=>{i(Ih({zIndex:t,isPanorama:n}))}),[i,t,n]),eg.createElement("g",{tabIndex:-1,ref:r})}function II(e){var{children:t,isPanorama:n}=e,r=Ck(ID);if(!r||0===r.length)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return eg.createElement(eg.Fragment,null,i.map(e=>eg.createElement(IL,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>eg.createElement(IL,{key:e,zIndex:e,isPanorama:n})))}var IR=["children"];function IB(){return(IB=Object.assign.bind()).apply(null,arguments)}var Iz={width:"100%",height:"100%",display:"block"},IF=(0,eg.forwardRef)((e,t)=>{var n,r,i=Ck(CX),a=Ck(C$),o=Iw();if(!CL(i)||!CL(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),eg.createElement(IM,IB({},l,{title:c,desc:u,role:r,tabIndex:n,width:i,height:a,style:Iz,ref:t}),s)}),IV=e=>{var{children:t}=e,n=Ck(C8);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return eg.createElement(IM,{width:r,height:i,x:o,y:a},t)},IU=(0,eg.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,IR);return C4()?eg.createElement(IV,null,eg.createElement(II,{isPanorama:!0},n)):eg.createElement(IF,IB({ref:t},r),eg.createElement(II,{isPanorama:!1},n))}),IH=new(e.i(29942)).default,IW="recharts.syncEvent.tooltip",IY="recharts.syncEvent.brush";function IG(e){return e.tooltip.syncInteraction}var IX=["x","y"];function I$(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 Iq(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I$(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)):I$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var IK=(0,eg.createContext)(null),IZ=(0,eg.createContext)(null);function IQ(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(){return(IJ=Object.assign.bind()).apply(null,arguments)}var I0=()=>{var e,t,n,r,i,a,o,s,l,c,u,d;return e=Cb(),(0,eg.useEffect)(()=>{e(Er())},[e]),t=Ck(OL),n=Ck(OR),r=Cb(),i=Ck(OI),a=Ck(DC),o=Ck(_v),s=_g(),l=Ck(e=>e.rootProps.className),(0,eg.useEffect)(()=>{if(null==t)return k9;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,IX),{x:v,y:x,width:y,height:b}=l.payload.sourceViewBox,w=Iq(Iq({},g),{},{x:s.x+(y?(f-v)/y:0)*s.width,y:s.y+(b?(p-x)/b:0)*s.height});r(Iq(Iq({},l),{},{payload:Iq(Iq({},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(Cr({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(Cr({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 IH.on(IW,e),()=>{IH.off(IW,e)}},[l,r,n,t,i,a,o,s]),c=Ck(OL),u=Ck(OR),d=Cb(),(0,eg.useEffect)(()=>{if(null==c)return k9;var e=(e,t,n)=>{u!==n&&c===e&&d(Cl(t))};return IH.on(IY,e),()=>{IH.off(IY,e)}},[d,u,c]),null};function I1(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var I2=(0,eg.forwardRef)((e,t)=>{var n,r,i=(0,eg.useRef)(null),[a,o]=(0,eg.useState)({containerWidth:I1(null==(n=e.style)?void 0:n.width),containerHeight:I1(null==(r=e.style)?void 0:r.height)}),s=(0,eg.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,eg.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,eg.useEffect)(()=>()=>{var e=i.current;null!=e&&e.disconnect()},[s]),eg.createElement(eg.Fragment,null,eg.createElement(_x,{width:a.containerWidth,height:a.containerHeight}),eg.createElement("div",IJ({ref:l},e)))}),I5=(0,eg.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,eg.useState)({containerWidth:I1(n),containerHeight:I1(r)}),o=(0,eg.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,eg.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return eg.createElement(eg.Fragment,null,eg.createElement(_x,{width:i.containerWidth,height:i.containerHeight}),eg.createElement("div",IJ({ref:s},e)))}),I3=(0,eg.forwardRef)((e,t)=>{var{width:n,height:r}=e;return eg.createElement(eg.Fragment,null,eg.createElement(_x,{width:n,height:r}),eg.createElement("div",IJ({ref:t},e)))}),I4=(0,eg.forwardRef)((e,t)=>{var{width:n,height:r}=e;return kQ(n)||kQ(r)?eg.createElement(I5,IJ({},e,{ref:t})):eg.createElement(I3,IJ({},e,{ref:t}))}),I6=(0,eg.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,eg.useRef)(null),j=Cb(),[N,k]=(0,eg.useState)(null),[E,C]=(0,eg.useState)(null),_=function(){var e=Cb(),[t,n]=(0,eg.useState)(null),r=Ck(Cq);return(0,eg.useEffect)(()=>{if(null!=t){var n=t.getBoundingClientRect().width/t.offsetWidth;CD(n)&&n!==r&&e(Cg(n))}},[t,e,r]),n}(),S=_d(),A=(null==S?void 0:S.width)>0?S.width:x,T=(null==S?void 0:S.height)>0?S.height:i,O=(0,eg.useCallback)(e=>{_(e),"function"==typeof t&&t(e),k(e),C(e),null!=e&&(w.current=e)},[_,t,k,C]),M=(0,eg.useCallback)(e=>{j(D5(e)),j(L1({handler:a,reactEvent:e}))},[j,a]),P=(0,eg.useCallback)(e=>{j(D4(e)),j(L1({handler:c,reactEvent:e}))},[j,c]),D=(0,eg.useCallback)(e=>{j(E9()),j(L1({handler:u,reactEvent:e}))},[j,u]),L=(0,eg.useCallback)(e=>{j(D4(e)),j(L1({handler:d,reactEvent:e}))},[j,d]),I=(0,eg.useCallback)(()=>{j(LJ())},[j]),R=(0,eg.useCallback)(e=>{j(LQ(e.key))},[j]),B=(0,eg.useCallback)(e=>{j(L1({handler:o,reactEvent:e}))},[j,o]),z=(0,eg.useCallback)(e=>{j(L1({handler:s,reactEvent:e}))},[j,s]),F=(0,eg.useCallback)(e=>{j(L1({handler:l,reactEvent:e}))},[j,l]),V=(0,eg.useCallback)(e=>{j(L1({handler:h,reactEvent:e}))},[j,h]),U=(0,eg.useCallback)(e=>{j(L1({handler:g,reactEvent:e}))},[j,g]),H=(0,eg.useCallback)(e=>{b&&j(L6(e)),j(L1({handler:p,reactEvent:e}))},[j,b,p]),W=(0,eg.useCallback)(e=>{j(L1({handler:f,reactEvent:e}))},[j,f]);return eg.createElement(IK.Provider,{value:N},eg.createElement(IZ.Provider,{value:E},eg.createElement(!0===y?I2:I4,{width:null!=A?A:null==v?void 0:v.width,height:null!=T?T:null==v?void 0:v.height,className:(0,C7.clsx)("recharts-wrapper",r),style:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?IQ(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)):IQ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({position:"relative",cursor:"default",width:A,height:T},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},eg.createElement(I0,null),n)))}),I8=N0([C1],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),I7=N0([I8,CX,C$],(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)}}),I9=(0,eg.createContext)(void 0),Re=e=>{var{children:t}=e,[n]=(0,eg.useState)("".concat(k2("recharts"),"-clip")),r=Ck(I7);if(null==r)return null;var{x:i,y:a,width:o,height:s}=r;return eg.createElement(I9.Provider,{value:n},eg.createElement("defs",null,eg.createElement("clipPath",{id:n},eg.createElement("rect",{x:i,y:a,height:s,width:o}))),t)},Rt=["width","height","responsive","children","className","style","compact","title","desc"],Rn=(0,eg.forwardRef)((e,t)=>{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:l,title:c,desc:u}=e,d=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,Rt));return l?eg.createElement(eg.Fragment,null,eg.createElement(_x,{width:n,height:r}),eg.createElement(IU,{otherAttributes:d,title:c,desc:u},a)):eg.createElement(I6,{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},eg.createElement(IU,{otherAttributes:d,title:c,desc:u,ref:t},eg.createElement(Re,null,a)))});function Rr(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 Ri(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rr(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)):Rr(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 Ra(){return(Ra=Object.assign.bind()).apply(null,arguments)}var Ro={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"},Rs=(0,eg.forwardRef)(function(e,t){var n,r=Ri(e.categoricalChartProps,Ro),{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,categoricalChartProps:l}=e;return eg.createElement(Ig,{preloadedState:{options:{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,eventEmitter:void 0}},reduxStoreName:null!=(n=l.id)?n:i},eg.createElement(Im,{chartData:l.data}),eg.createElement(Iy,{layout:r.layout,margin:r.margin}),eg.createElement(Ib,{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}),eg.createElement(Rn,Ra({},r,{ref:t})))}),Rl=["axis"],Rc=(0,eg.forwardRef)((e,t)=>eg.createElement(Rs,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Rl,tooltipPayloadSearcher:Ee,categoricalChartProps:e,ref:t})),Ru=eg,Rd=["children","className"];function Rh(){return(Rh=Object.assign.bind()).apply(null,arguments)}var Rf=eg.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,Rd),a=(0,C7.clsx)("recharts-layer",r);return eg.createElement("g",Rh({className:a},IA(i),{ref:t}),n)}),Rp=e.i(4178);function Rg(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 Rm=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rg(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)):Rg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},{cacheSize:2e3,enableCache:!0}),Rv=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}}(Rm.cacheSize),Rx={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},Ry="recharts_measurement_span",Rb=(e,t)=>{try{var n=document.getElementById(Ry);n||((n=document.createElement("span")).setAttribute("id",Ry),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Rx,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch(e){return{width:0,height:0}}},Rw=function(e){var t,n,r,i,a,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||Ir.isSsr)return{width:0,height:0};if(!Rm.enableCache)return Rb(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=Rv.get(l);if(c)return c;var u=Rb(e,s);return Rv.set(l,u),u},Rj=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,RN=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Rk=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,RE=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,RC={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},R_=["cm","mm","pt","pc","in","Q","px"];class RS{static parse(e){var t,[,n,r]=null!=(t=RE.exec(e))?t:[];return null==n?RS.NaN:new RS(parseFloat(n),null!=r?r:"")}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,kZ(e)&&(this.unit=""),""===t||Rk.test(t)||(this.num=NaN,this.unit=""),function(e){return R_.includes(e)}(t)&&(this.num=function(e,t){return e*RC[t]}(e,t),this.unit="px")}add(e){return this.unit!==e.unit?new RS(NaN,""):new RS(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new RS(NaN,""):new RS(this.num-e.num,this.unit)}multiply(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new RS(NaN,""):new RS(this.num*e.num,this.unit||e.unit)}divide(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new RS(NaN,""):new RS(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return kZ(this.num)}}function RA(e){if(null==e||e.includes("NaN"))return"NaN";for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=null!=(n=Rj.exec(t))?n:[],o=RS.parse(null!=r?r:""),s=RS.parse(null!=a?a:""),l="*"===i?o.multiply(s):o.divide(s);if(l.isNaN())return"NaN";t=t.replace(Rj,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var c,[,u,d,h]=null!=(c=RN.exec(t))?c:[],f=RS.parse(null!=u?u:""),p=RS.parse(null!=h?h:""),g="+"===d?f.add(p):f.subtract(p);if(g.isNaN())return"NaN";t=t.replace(RN,g.toString())}return t}u="NaN",d=new RS(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 RS?Object.defineProperty(RS,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):RS[u]=d;var RT=/\(([^()]*)\)/;function RO(e){var t=function(e){try{var t;return t=e.replace(/\s+/g,""),t=function(e){for(var t,n=e;null!=(t=RT.exec(n));){var[,r]=t;n=n.replace(RT,RA(r))}return n}(t),t=RA(t)}catch(e){return"NaN"}}(e.slice(5,-1));return"NaN"===t?"":t}var RM=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],RP=["dx","dy","angle","className","breakAll"];function RD(){return(RD=Object.assign.bind()).apply(null,arguments)}function RL(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 RI=/[ \f\n\r\t\v\u2028\u2029]+/,RR=e=>{var{children:t,breakAll:n,style:r}=e;try{var i=[];null!=t&&(i=n?t.toString().split(""):t.toString().split(RI));var a=i.map(e=>({word:e,width:Rw(e,r).width})),o=n?0:Rw(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch(e){return null}},RB=(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},[]),Rz=e=>e.reduce((e,t)=>e.width>t.width?e:t),RF=(e,t,n,r,i,a,o,s)=>{var l=RR({breakAll:n,style:r,children:e.slice(0,t)+"…"});if(!l)return[!1,[]];var c=RB(l.wordsWithComputedWidth,a,o,s);return[c.length>i||Rz(c).width>Number(a),c]},RV=e=>[{words:null==e?[]:e.toString().split(RI),width:void 0}],RU="#808080",RH={angle:0,breakAll:!1,capHeight:"0.71em",fill:RU,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},RW=(0,eg.forwardRef)((e,t)=>{var n,r=Ri(e,RH),{x:i,y:a,lineHeight:o,capHeight:s,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=r,h=RL(r,RM),f=(0,eg.useMemo)(()=>(e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Ir.isSsr){var s=RR({breakAll:a,children:r,style:i});if(!s)return RV(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=kJ(o),d=String(s),h=RB(t,r,n,i);if(!u||i||!(h.length>o||Rz(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]=RF(d,v-1,c,l,o,r,n,i),[b]=RF(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 RV(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=RL(h,RP);if(!k0(i)||!k0(a)||0===f.length)return null;var w=Number(i)+(kJ(p)?p:0),j=Number(a)+(kJ(g)?g:0);if(!CD(w)||!CD(j))return null;switch(d){case"start":n=RO("calc(".concat(s,")"));break;case"middle":n=RO("calc(".concat((f.length-1)/2," * -").concat(o," + (").concat(s," / 2))"));break;default:n=RO("calc(".concat(f.length-1," * -").concat(o,")"))}var N=[];if(c){var k=f[0].width,{width:E}=h;N.push("scale(".concat(kJ(E)&&kJ(k)?E/k:1,")"))}return v&&N.push("rotate(".concat(v,", ").concat(w,", ").concat(j,")")),N.length&&(b.transform=N.join(" ")),eg.createElement("text",RD({},IA(b),{ref:t,x:w,y:j,className:(0,C7.clsx)("recharts-text",x),textAnchor:u,fill:l.includes("url")?RU:l}),f.map((e,t)=>{var r=e.words.join(y?"":" ");return eg.createElement("tspan",{x:w,dy:0===t?n:o,key:"".concat(r,"-").concat(t)},r)}))});function RY(e){var{zIndex:t,children:n}=e,r=void 0!==Ck(_v)&&void 0!==t&&0!==t,i=C4(),a=Cb();(0,eg.useLayoutEffect)(()=>r?(a(Ic({zIndex:t})),()=>{a(Iu({zIndex:t}))}):k9,[a,t,r]);var o=Ck(e=>IP(e,t,i));return r?o?(0,e0.createPortal)(n,o):null:n}RW.displayName="Text";var RG=["labelRef"],RX=["content"];function R$(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 Rq(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 RK(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rq(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)):Rq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function RZ(){return(RZ=Object.assign.bind()).apply(null,arguments)}var RQ=(0,eg.createContext)(null),RJ=e=>{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,l=(0,eg.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return eg.createElement(RQ.Provider,{value:l},s)},R0=()=>{var e=(0,eg.useContext)(RQ),t=_g();return e||_p(t)},R1=(0,eg.createContext)(null),R2=e=>null!=e&&"function"==typeof e,R5=e=>"cx"in e&&kJ(e.cx),R3={angle:0,offset:5,zIndex:OU.label,position:"middle",textBreakAll:!1};function R4(e){var t,n,r,i,a,o,s=Ri(e,R3),{viewBox:l,position:c,value:u,children:d,content:h,className:f="",textBreakAll:p,labelRef:g}=s,v=(t=(0,eg.useContext)(R1),n=Ck(O3),t||n),x=R0();if(!(i=null==l?"center"===c?x:null!=v?v:x:R5(l)?l:_p(l))||null==u&&null==d&&!(0,eg.isValidElement)(h)&&"function"!=typeof h)return null;var y=RK(RK({},s),{},{viewBox:i});if((0,eg.isValidElement)(h)){var{labelRef:b}=y,w=R$(y,RG);return(0,eg.cloneElement)(h,w)}if("function"==typeof h){var{content:j}=y,N=R$(y,RX);if(a=(0,eg.createElement)(h,N),(0,eg.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=IA(s);if(R5(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=kK(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=OV(c,u,v,a),w=OV(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?k2("recharts-radial-line-"):e.id;return eg.createElement("text",RZ({},r,{dominantBaseline:"central",className:(0,C7.clsx)("recharts-radial-bar-label",l)}),eg.createElement("defs",null,eg.createElement("path",{id:N,d:j})),eg.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}=OV(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}=OV(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||R5(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 RK(RK({},{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 RK(RK({},{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 RK(RK({},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 RK(RK({},k),n?{width:Math.max(n.x+n.width-k.x,0),height:u}:{})}var E=n?{width:f,height:u}:{};return"insideLeft"===a?RK({x:h+b,y:s+u/2,textAnchor:j,verticalAnchor:"middle"},E):"insideRight"===a?RK({x:h+f-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"},E):"insideTop"===a?RK({x:o+l/2,y:s+g,textAnchor:"middle",verticalAnchor:x},E):"insideBottom"===a?RK({x:d+c/2,y:s+u-g,textAnchor:"middle",verticalAnchor:v},E):"insideTopLeft"===a?RK({x:o+b,y:s+g,textAnchor:j,verticalAnchor:x},E):"insideTopRight"===a?RK({x:o+l-b,y:s+g,textAnchor:w,verticalAnchor:x},E):"insideBottomLeft"===a?RK({x:d+b,y:s+u-g,textAnchor:j,verticalAnchor:v},E):"insideBottomRight"===a?RK({x:d+c-b,y:s+u-g,textAnchor:w,verticalAnchor:v},E):a&&"object"==typeof a&&(kJ(a.x)||kQ(a.x))&&(kJ(a.y)||kQ(a.y))?RK({x:o+k5(a.x,f),y:s+k5(a.y,u),textAnchor:"end",verticalAnchor:"end"},E):RK({x:o+l/2,y:s+u/2,textAnchor:"middle",verticalAnchor:"middle"},E)})(s,i);return eg.createElement(RY,{zIndex:s.zIndex},eg.createElement(RW,RZ({ref:g,className:(0,C7.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 R6(e){var{label:t,labelRef:n}=e;return((e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return!0===e?eg.createElement(R4,RZ({key:"label-implicit"},r)):k0(e)?eg.createElement(R4,RZ({key:"label-implicit",value:e},r)):(0,eg.isValidElement)(e)?e.type===R4?(0,eg.cloneElement)(e,RK({key:"label-implicit"},r)):eg.createElement(R4,RZ({key:"label-implicit",content:e},r)):R2(e)?eg.createElement(R4,RZ({key:"label-implicit",content:e},r)):e&&"object"==typeof e?eg.createElement(R4,RZ({},e,{key:"label-implicit"},r)):null})(t,R0(),n)||null}R4.displayName="Label";var R8=["valueAccessor"],R7=["dataKey","clockWise","id","textBreakAll","zIndex"];function R9(){return(R9=Object.assign.bind()).apply(null,arguments)}function Be(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 Bt=e=>Array.isArray(e.value)?(0,Rp.default)(e.value):e.value,Bn=(0,eg.createContext)(void 0),Br=Bn.Provider,Bi=(0,eg.createContext)(void 0);function Ba(e){var{valueAccessor:t=Bt}=e,n=Be(e,R8),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,l=Be(n,R7),c=(0,eg.useContext)(Bn),u=(0,eg.useContext)(Bi),d=c||u;return d&&d.length?eg.createElement(RY,{zIndex:null!=s?s:OU.label},eg.createElement(Rf,{className:"recharts-label-list"},d.map((e,i)=>{var s,c=null==r?t(e,i):CB(e&&e.payload,r),u=null==a?{}:{id:"".concat(a,"-").concat(i)};return eg.createElement(R4,R9({key:"label-".concat(i)},IA(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 Bo(e){var{label:t}=e;return t?!0===t?eg.createElement(Ba,{key:"labelList-implicit"}):eg.isValidElement(t)||R2(t)?eg.createElement(Ba,{key:"labelList-implicit",content:t}):"object"==typeof t?eg.createElement(Ba,R9({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}Bi.Provider,Ba.displayName="LabelList";var Bs=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Bl=(e,t)=>{if(!e||"function"==typeof e||"boolean"==typeof e)return null;var n=e;if((0,eg.isValidElement)(e)&&(n=e.props),"object"!=typeof n&&"function"!=typeof n)return null;var r={};return Object.keys(n).forEach(e=>{IN(e)&&(r[e]=t||(t=>n[e](n,t)))}),r};function Bc(){return(Bc=Object.assign.bind()).apply(null,arguments)}var Bu=e=>{var{cx:t,cy:n,r,className:i}=e,a=(0,C7.clsx)("recharts-dot",i);return kJ(t)&&kJ(n)&&kJ(r)?eg.createElement("circle",Bc({},I_(e),Bl(e),{className:a,cx:t,cy:n,r:r})):null},Bd=(e.i(79684),e=>!e||"object"!=typeof e||!("clipDot"in e)||!!e.clipDot),Bh=["points"];function Bf(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 Bp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bf(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)):Bf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Bg(){return(Bg=Object.assign.bind()).apply(null,arguments)}function Bm(e){var{option:t,dotProps:n,className:r}=e;if((0,eg.isValidElement)(t))return(0,eg.cloneElement)(t,n);if("function"==typeof t)return t(n);var i=(0,C7.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,Bh);return eg.createElement(Bu,Bg({},s,{className:i}))}function Bv(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:a,baseProps:o,needClip:s,clipPathId:l,zIndex:c=OU.scatter}=e;if(null==t||!n&&1!==t.length)return null;var u=Bd(n),d=null==n?null:(0,eg.isValidElement)(n)?IA(n.props):"object"!=typeof n||Array.isArray(n)?null:IA(n),h=t.map((e,r)=>{var s,l,c=Bp(Bp(Bp({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 eg.createElement(Bm,{key:"dot-".concat(r),option:n,dotProps:c,className:i})}),f={};return s&&null!=l&&(f.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(l,")")),eg.createElement(RY,{zIndex:c},eg.createElement(Rf,Bg({className:r},f),h))}function Bx(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 By(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bx(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)):Bx(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Bb=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=By(By(By({},{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}),IS(a)),Bl(a));return t=(0,eg.isValidElement)(a)?(0,eg.cloneElement)(a,l):"function"==typeof a?a(l):eg.createElement(Bu,l),eg.createElement(Rf,{className:"recharts-active-dot",clipPath:s},t)};function Bw(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=OU.activeDot}=e,s=Ck(DO),l=Ck(Dz);if(null==t||null==l)return null;var c=t.find(e=>l.includes(e.payload));return null==c?null:eg.createElement(RY,{zIndex:o},eg.createElement(Bb,{point:c,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}function Bj(e){var{tooltipEntrySettings:t}=e,n=Cb(),r=C4(),i=(0,eg.useRef)(null);return(0,eg.useLayoutEffect)(()=>{r||(null===i.current?n(E5(t)):i.current!==t&&n(E3({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,eg.useLayoutEffect)(()=>()=>{i.current&&(n(E4(i.current)),i.current=null)},[n]),null}var BN=["children"],Bk=(0,eg.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function BE(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,BN);return eg.createElement(Bk.Provider,{value:n},t)}function BC(e,t){var n,r,i=Ck(t=>Mc(t,e)),a=Ck(e=>Md(e,t)),o=null!=(n=null==i?void 0:i.allowDataOverflow)?n:Ms.allowDataOverflow,s=null!=(r=null==a?void 0:a.allowDataOverflow)?r:Mu.allowDataOverflow;return{needClip:o||s,needClipX:o,needClipY:s}}function B_(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=Ck(I7),{needClipX:a,needClipY:o,needClip:s}=BC(t,n);if(!s||!i)return null;var{x:l,y:c,width:u,height:d}=i;return eg.createElement("clipPath",{id:"clipPath-".concat(r)},eg.createElement("rect",{x:a?l:l-u/2,y:o?c:c-d/2,width:a?u:2*u,height:o?d:2*d}))}var BS=(e,t,n,r)=>PB(e,"xAxis",t,r),BA=(e,t,n,r)=>PR(e,"xAxis",t,r),BT=(e,t,n,r)=>PB(e,"yAxis",n,r),BO=(e,t,n,r)=>PR(e,"yAxis",n,r),BM=N0([_v,BS,BT,BA,BO],(e,t,n,r,i)=>Cz(e,"xAxis")?CW(t,r,!1):CW(n,i,!1));function BP(e){return"line"===e.type}var BD=N0([Mx,(e,t,n,r,i)=>i],(e,t)=>e.filter(BP).find(e=>e.id===t)),BL=N0([_v,BS,BT,BA,BO,BD,BM,Of],(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=CB(e,o);if("horizontal"===t)return{x:CV({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=CV({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})}});function BI(e){var{legendPayload:t}=e,n=Cb(),r=C4(),i=(0,eg.useRef)(null);return(0,eg.useLayoutEffect)(()=>{r||(null===i.current?n(LL(t)):i.current!==t&&n(LI({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,eg.useLayoutEffect)(()=>()=>{i.current&&(n(LR(i.current)),i.current=null)},[n]),null}function BR(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",n=(0,eg.useRef)(k2(t)),r=(0,eg.useRef)(e);return r.current!==e&&(n.current=k2(t),r.current=e),n.current}var BB=null!=(Y=eg["useId".toString()])?Y:()=>{var[e]=eg.useState(()=>k2("uid-"));return e},Bz=(0,eg.createContext)(void 0),BF=e=>{var t,n,{id:r,type:i,children:a}=e,o=(t="recharts-".concat(i),n=BB(),r||(t?"".concat(t,"-").concat(n):n));return eg.createElement(Bz.Provider,{value:o},a(o))},BV=(0,eg.memo)(e=>{var t=Cb(),n=(0,eg.useRef)(null);return(0,eg.useLayoutEffect)(()=>{null===n.current?t(Lp(e)):n.current!==e&&t(Lg({prev:n.current,next:e})),n.current=e},[t,e]),(0,eg.useLayoutEffect)(()=>()=>{n.current&&(t(Lm(n.current)),n.current=null)},[t]),null});function BU(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 BH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?BU(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)):BU(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var BW=(e,t,n)=>e.map(e=>"".concat(e.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase()))," ").concat(t,"ms ").concat(n)).join(","),BY=(e,t)=>Object.keys(t).reduce((n,r)=>BH(BH({},n),{},{[r]:e(r,t[r])}),{});function BG(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 BX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?BG(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)):BG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var B$=(e,t,n)=>e+(t-e)*n,Bq=e=>{var{from:t,to:n}=e;return t!==n},BK=(e,t,n)=>{var r=BY((t,n)=>{if(Bq(n)){var[r,i]=e(n.from,n.to,n.velocity);return BX(BX({},n),{},{from:r,velocity:i})}return n},t);return n<1?BY((e,t)=>Bq(t)&&null!=r[e]?BX(BX({},t),{},{velocity:B$(t.velocity,r[e].velocity,n),from:B$(t.from,r[e].from,n)}):t,t):BK(e,r,n-1)},BZ=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],BQ=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),BJ=(e,t)=>n=>BQ(BZ(e,t),n),B0=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]},B1=function(){return((e,t,n,r)=>{var i=BJ(e,n),a=BJ(t,r),o=t=>BQ([...BZ(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})(...B0(...arguments))},B2=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 B5{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 B3=(0,eg.createContext)(function(){var e,t,n,r,i;return e=new B5,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}}),B4={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},B6={t:0},B8={t:1};function B7(e){var t,n,r,i=Ri(e,B4),{isActive:a,canBegin:o,duration:s,easing:l,begin:c,onAnimationEnd:u,onAnimationStart:d,children:h}=i,f="auto"===a?!Ir.isSsr:a,p=(t=i.animationId,n=i.animationManager,r=(0,eg.useContext)(B3),(0,eg.useMemo)(()=>null!=n?n:r(t),[t,n,r])),[g,v]=(0,eg.useState)(f?B6:B8),x=(0,eg.useRef)(null);return(0,eg.useEffect)(()=>{f||v(B8)},[f]),(0,eg.useEffect)(()=>{if(!f||!o)return k9;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(BX(BX({},e),t)),()=>{}):!0===n.isStepper?(s=p.reduce((n,r)=>BX(BX({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),l=null,c=r=>{o||(o=r);var u=(r-o)/n.dt;s=BK(n,s,u),i(BX(BX(BX({},e),t),BY((e,t)=>t.from,s))),o=r,Object.values(s).filter(Bq).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:BX(BX({},n),{},{[r]:[i,a]})},{}),f=o=>{u||(u=o);var s=(o-u)/r,l=BY((e,t)=>B$(...t,n(s)),h);if(i(BX(BX(BX({},e),t),l)),s<1)d=a.setTimeout(f);else{var c=BY((e,t)=>B$(...t,n(1)),h);i(BX(BX(BX({},e),t),c))}},()=>(d=a.setTimeout(f),()=>{var e;null==(e=d)||e()}))})(B6,B8,(e=>{if("string"==typeof e)switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return B1(e);case"spring":return B2();default:if("cubic-bezier"===e.split("(")[0])return B1(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)}var B9=e.i(7328),ze=["radius"],zt=["radius"];function zn(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?zn(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)):zn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zi(){return(zi=Object.assign.bind()).apply(null,arguments)}function za(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 zo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var zs=(e,t,n,r,i)=>{var a,o=k$(n),s=k$(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=kq(G||(G=zo(["M",",",""])),e,t+c*h[0]),h[0]>0&&(a+=kq(X||(X=zo(["A ",",",",0,0,",",",",",""])),h[0],h[0],d,e+u*h[0],t)),a+=kq($||($=zo(["L ",",",""])),e+n-u*h[1],t),h[1]>0&&(a+=kq(q||(q=zo(["A ",",",",0,0,",",\n ",",",""])),h[1],h[1],d,e+n,t+c*h[1])),a+=kq(K||(K=zo(["L ",",",""])),e+n,t+r-c*h[2]),h[2]>0&&(a+=kq(Z||(Z=zo(["A ",",",",0,0,",",\n ",",",""])),h[2],h[2],d,e+n-u*h[2],t+r)),a+=kq(Q||(Q=zo(["L ",",",""])),e+u*h[3],t+r),h[3]>0&&(a+=kq(J||(J=zo(["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=kq(ee||(ee=zo(["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=kq(et||(et=zo(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return a},zl={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},zc=e=>{var t=Ri(e,zl),n=(0,eg.useRef)(null),[r,i]=(0,eg.useState)(-1);(0,eg.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,eg.useRef)(s),x=(0,eg.useRef)(l),y=(0,eg.useRef)(a),b=(0,eg.useRef)(o),w=BR((0,eg.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,C7.clsx)("recharts-rectangle",u);if(!g){var N=IA(t),{radius:k}=N,E=za(N,ze);return eg.createElement("path",zi({},E,{x:k$(a),y:k$(o),width:k$(s),height:k$(l),radius:"number"==typeof c?c:void 0,className:j,d:zs(a,o,s,l,c)}))}var C=v.current,_=x.current,S=y.current,A=b.current,T="0px ".concat(-1===r?1:r,"px"),O="".concat(r,"px 0px"),M=BW(["strokeDasharray"],h,"string"==typeof d?d:zl.animationEasing);return eg.createElement(B7,{animationId:w,key:w,canBegin:r>0,duration:h,easing:d,isActive:g,begin:f},e=>{var r,i=k4(C,s,e),u=k4(_,l,e),d=k4(S,a,e),h=k4(A,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:T}:{strokeDasharray:O};var f=IA(t),{radius:g}=f,w=za(f,zt);return eg.createElement("path",zi({},w,{radius:"number"==typeof c?c:void 0,className:j,d:zs(d,h,i,u,c),ref:n,style:zr(zr({},r),t.style)}))})};function zu(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 zd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zu(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)):zu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zh(){return(zh=Object.assign.bind()).apply(null,arguments)}function zf(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var zp=(e,t,n,r,i)=>{var a=n-r;return kq(en||(en=zf(["M ",",",""])),e,t)+kq(er||(er=zf(["L ",",",""])),e+n,t)+kq(ei||(ei=zf(["L ",",",""])),e+n-a/2,t+i)+kq(ea||(ea=zf(["L ",",",""])),e+n-a/2-r,t+i)+kq(eo||(eo=zf(["L ",","," Z"])),e,t)},zg={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},zm=e=>{var t=Ri(e,zg),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=t,{animationEasing:l,animationDuration:c,animationBegin:u,isUpdateAnimationActive:d}=t,h=(0,eg.useRef)(null),[f,p]=(0,eg.useState)(-1),g=(0,eg.useRef)(i),v=(0,eg.useRef)(a),x=(0,eg.useRef)(o),y=(0,eg.useRef)(n),b=(0,eg.useRef)(r),w=BR(e,"trapezoid-");if((0,eg.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,C7.clsx)("recharts-trapezoid",s);if(!d)return eg.createElement("g",null,eg.createElement("path",zh({},IA(t),{className:j,d:zp(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"),A="".concat(f,"px 0px"),T=BW(["strokeDasharray"],c,l);return eg.createElement(B7,{animationId:w,key:w,canBegin:f>0,duration:c,easing:l,isActive:d,begin:u},e=>{var s=k4(N,i,e),l=k4(k,a,e),c=k4(E,o,e),u=k4(C,n,e),d=k4(_,r,e);h.current&&(g.current=s,v.current=l,x.current=c,y.current=u,b.current=d);var f=e>0?{transition:T,strokeDasharray:A}:{strokeDasharray:S};return eg.createElement("path",zh({},IA(t),{className:j,d:zp(u,d,s,l,c),ref:h,style:zd(zd({},f),t.style)}))})};function zv(){return(zv=Object.assign.bind()).apply(null,arguments)}function zx(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var zy=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)/OF,d=l?i:i+a*u,h=OV(t,n,c,d);return{center:h,circleTangency:OV(t,n,r,d),lineTangency:OV(t,n,c*Math.cos(u*OF),l?i-a*u:i),theta:u}},zb=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,s=kK(o-a)*Math.min(Math.abs(o-a),359.999),l=a+s,c=OV(t,n,i,a),u=OV(t,n,i,l),d=kq(es||(es=zx(["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=OV(t,n,r,a),f=OV(t,n,r,l);d+=kq(el||(el=zx(["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+=kq(ec||(ec=zx(["L ",","," Z"])),t,n);return d},zw={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},zj=e=>{var t,n=Ri(e,zw),{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,C7.clsx)("recharts-sector",h),p=o-a,g=k5(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=kK(c-l),{circleTangency:d,lineTangency:h,theta:f}=zy({cx:t,cy:n,radius:i,angle:l,sign:u,cornerRadius:a,cornerIsExternal:s}),{circleTangency:p,lineTangency:g,theta:v}=zy({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?kq(eu||(eu=zx(["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)):zb({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var y=kq(ed||(ed=zx(["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}=zy({cx:t,cy:n,radius:r,angle:l,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:N,lineTangency:k,theta:E}=zy({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+=kq(eh||(eh=zx(["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+=kq(ef||(ef=zx(["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}):zb({cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:u,endAngle:d}),eg.createElement("path",zv({},IA(n),{className:f,d:t}))};let zN=Math.PI,zk=2*zN,zE=zk-1e-6;function zC(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class z_{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?zC:function(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return zC;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((zN-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%zk+zk),d>zE?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>=zN)},${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 zS(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 z_(t)}z_.prototype;let zA=Math.cos,zT=Math.sin,zO=Math.sqrt,zM=Math.PI,zP=2*zM;zO(3);let zD={draw(e,t){let n=zO(t/zM);e.moveTo(n,0),e.arc(0,0,n,0,zP)}},zL=zO(1/3),zI=2*zL,zR=zT(zM/10)/zT(7*zM/10),zB=zT(zP/10)*zR,zz=-zA(zP/10)*zR,zF=zO(3);zO(3);let zV=zO(3)/2,zU=1/zO(12),zH=(zU/2+1)*3;var zW=["type","size","sizeType"];function zY(){return(zY=Object.assign.bind()).apply(null,arguments)}function zG(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 zX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zG(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)):zG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var z$={symbolCircle:zD,symbolCross:{draw(e,t){let n=zO(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=zO(t/zI),r=n*zL;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},symbolSquare:{draw(e,t){let n=zO(t),r=-n/2;e.rect(r,r,n,n)}},symbolStar:{draw(e,t){let n=zO(.8908130915292852*t),r=zB*n,i=zz*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=zP*t/5,o=zA(a),s=zT(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=-zO(t/(3*zF));e.moveTo(0,2*n),e.lineTo(-zF*n,-n),e.lineTo(zF*n,-n),e.closePath()}},symbolWye:{draw(e,t){let n=zO(t/zH),r=n/2,i=n*zU,a=n*zU+n,o=-r;e.moveTo(r,i),e.lineTo(r,a),e.lineTo(o,a),e.lineTo(-.5*r-zV*i,zV*r+-.5*i),e.lineTo(-.5*r-zV*a,zV*r+-.5*a),e.lineTo(-.5*o-zV*a,zV*o+-.5*a),e.lineTo(-.5*r+zV*i,-.5*i-zV*r),e.lineTo(-.5*r+zV*a,-.5*a-zV*r),e.lineTo(-.5*o+zV*a,-.5*a-zV*o),e.closePath()}}},zq=Math.PI/180,zK=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=zX(zX({},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,zW)),{},{type:t,size:n,sizeType:r}),a="circle";"string"==typeof t&&(a=t);var{className:o,cx:s,cy:l}=i,c=IA(i);return kJ(s)&&kJ(l)&&kJ(n)?eg.createElement("path",zY({},c,{className:(0,C7.clsx)("recharts-symbols",o),transform:"translate(".concat(s,", ").concat(l,")"),d:(()=>{var e,t=(e=a,z$["symbol".concat(k8(e))]||zD),i=(function(e,t){let n=null,r=zS(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:CS(e||zD),t="function"==typeof t?t:CS(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:CS(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:CS(+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*zq;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};function zZ(e){this._context=e}function zQ(e){return new zZ(e)}function zJ(e){return e[0]}function z0(e){return e[1]}function z1(e,t){var n=CS(!0),r=null,i=zQ,a=null,o=zS(s);function s(s){var l,c,u,d=(s=C_(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?zJ:CS(e),t="function"==typeof t?t:void 0===t?z0:CS(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:CS(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:CS(+e),s):t},s.defined=function(e){return arguments.length?(n="function"==typeof e?e:CS(!!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 z2(e,t,n){var r=null,i=CS(!0),a=null,o=zQ,s=null,l=zS(c);function c(c){var u,d,h,f,p,g=(c=C_(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 z1().defined(i).curve(o).context(a)}return e="function"==typeof e?e:void 0===e?zJ:CS(+e),t="function"==typeof t?t:void 0===t?CS(0):CS(+t),n="function"==typeof n?n:void 0===n?z0:CS(+n),c.x=function(t){return arguments.length?(e="function"==typeof t?t:CS(+t),r=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:CS(+t),c):e},c.x1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:CS(+e),c):r},c.y=function(e){return arguments.length?(t="function"==typeof e?e:CS(+e),n=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:CS(+e),c):t},c.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:CS(+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:CS(!!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 z5(){}function z3(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 z4(e){this._context=e}function z6(e){this._context=e}function z8(e){this._context=e}zK.registerSymbol=(e,t)=>{z$["symbol".concat(k8(e))]=t},zZ.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)}}},z4.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:z3(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:z3(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},z6.prototype={areaStart:z5,areaEnd:z5,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:z3(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},z8.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:z3(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};class z7{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 z9(e){this._context=e}z9.prototype={areaStart:z5,areaEnd:z5,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 Fe(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 Ft(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Fn(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 Fr(e){this._context=e}function Fi(e){this._context=new Fa(e)}function Fa(e){this._context=e}function Fo(e){this._context=e}function Fs(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 Fl(e,t){this._context=e,this._t=t}function Fc(){return(Fc=Object.assign.bind()).apply(null,arguments)}function Fu(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 Fd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fu(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)):Fu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Fr.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:Fn(this,this._t0,Ft(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,Fn(this,Ft(this,n=Fe(this,e,t)),n);break;default:Fn(this,this._t0,n=Fe(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(Fi.prototype=Object.create(Fr.prototype)).point=function(e,t){Fr.prototype.point.call(this,t,e)},Fa.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)}},Fo.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=Fs(e),i=Fs(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)}},Fl.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 Fh={curveBasisClosed:function(e){return new z6(e)},curveBasisOpen:function(e){return new z8(e)},curveBasis:function(e){return new z4(e)},curveBumpX:function(e){return new z7(e,!0)},curveBumpY:function(e){return new z7(e,!1)},curveLinearClosed:function(e){return new z9(e)},curveLinear:zQ,curveMonotoneX:function(e){return new Fr(e)},curveMonotoneY:function(e){return new Fi(e)},curveNatural:function(e){return new Fo(e)},curveStep:function(e){return new Fl(e,.5)},curveStepAfter:function(e){return new Fl(e,1)},curveStepBefore:function(e){return new Fl(e,0)}},Ff=e=>CD(e.x)&&CD(e.y),Fp=e=>null!=e.base&&Ff(e.base)&&Ff(e),Fg=e=>e.x,Fm=e=>e.y,Fv=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=Ck(_v);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(k8(e));return("curveMonotone"===n||"curveBump"===n)&&t?Fh["".concat(n).concat("vertical"===t?"Y":"X")]:Fh[n]||zQ})(t,i),s=a?n.filter(Ff):n;if(Array.isArray(r)){var l=n.map((e,t)=>Fd(Fd({},e),{},{base:r[t]}));return("vertical"===i?z2().y(Fm).x1(Fg).x0(e=>e.base.x):z2().x(Fg).y1(Fm).y0(e=>e.base.y)).defined(Fp).curve(o)(a?l.filter(Fp):l)}return("vertical"===i&&kJ(r)?z2().y(Fm).x1(Fg).x0(r):kJ(r)?z2().x(Fg).y1(Fm).y0(r):z1().x(Fg).y(Fm)).defined(Ff).curve(o)(s)})(o):r;return eg.createElement("path",Fc({},I_(e),Bl(e),{className:(0,C7.clsx)("recharts-curve",t),d:null===s?void 0:s,ref:i}))},Fx=["option","shapeType","activeClassName"];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}function Fw(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return eg.createElement(zc,n);case"trapezoid":return eg.createElement(zm,n);case"sector":return eg.createElement(zj,n);case"symbols":if("symbols"===t)return eg.createElement(zK,n);break;case"curve":return eg.createElement(Fv,n);default:return null}}function Fj(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,Fx);if((0,eg.isValidElement)(n))t=(0,eg.cloneElement)(n,Fb(Fb({},a),(0,eg.isValidElement)(n)?n.props:n));else if("function"==typeof n)t=n(a,a.index);else if((0,B9.default)(n)&&"boolean"!=typeof n){var o=Fb(Fb({},a),n);t=eg.createElement(Fw,{shapeType:r,elementProps:o})}else t=eg.createElement(Fw,{shapeType:r,elementProps:a});return a.isActive?eg.createElement(Rf,{className:i},t):t}var FN=["id"],Fk=["type","layout","connectNulls","needClip","shape"],FE=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function FC(){return(FC=Object.assign.bind()).apply(null,arguments)}function F_(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 FS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F_(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)):F_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FA(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 FT=Ru.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:CG(o,t),hide:s,type:c,color:r,unit:l,graphicalItemId:u}};return Ru.createElement(Bj,{tooltipEntrySettings:d})}),FO=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function FM(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,l=I_(FA(r,FN));return Ru.createElement(Bv,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:l,needClip:o,clipPathId:t})}function FP(e){var{showLabels:t,children:n,points:r}=e,i=(0,Ru.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 FS(FS({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[r]);return Ru.createElement(Br,{value:t?i:void 0},n)}function FD(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=FS(FS({},IA(FA(a,Fk))),{},{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 Ru.createElement(Ru.Fragment,null,(null==r?void 0:r.length)>1&&Ru.createElement(Fj,FC({shapeType:"curve",option:u},d,{pathRef:n})),Ru.createElement(FM,{points:r,clipPathId:t,props:a}))}function FL(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=BR(o,"recharts-line-"),b=(0,Ru.useRef)(y),[w,j]=(0,Ru.useState)(!1),N=(0,Ru.useCallback)(()=>{"function"==typeof g&&g(),j(!1)},[g]),k=(0,Ru.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,Ru.useRef)(0);b.current!==y&&(C.current=a.current,b.current=y);var _=C.current;return Ru.createElement(FP,{points:o,showLabels:!w},n.children,Ru.createElement(B7,{animationId:y,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:N,onAnimationStart:k,key:y},e=>{var c,u=Math.min(k4(_,E+_,e),E);if(c=l?s?((e,t,n)=>{var r=n.reduce((e,t)=>e+t);if(!r)return FO(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))):FO(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 FS(FS({},t),{},{x:k4(i.x,t.x,e),y:k4(i.y,t.y,e)})}return h?FS(FS({},t),{},{x:k4(2*f,t.x,e),y:k4(p/2,t.y,e)}):FS(FS({},t),{},{x:t.x,y:t.y})});return i.current=g,Ru.createElement(FD,{props:n,points:g,clipPathId:t,pathRef:r,strokeDasharray:c})}return Ru.createElement(FD,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:c})}),Ru.createElement(Bo,{label:n.label}))}function FI(e){var{clipPathId:t,props:n}=e,r=(0,Ru.useRef)(null),i=(0,Ru.useRef)(0),a=(0,Ru.useRef)(null);return Ru.createElement(FL,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var FR=(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:CB(e.payload,t)}};class FB extends Ru.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,C7.clsx)("recharts-line",r),{r:p,strokeWidth:g}=function(e){var t=IS(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}}(t),v=Bd(t),x=2*p+g,y=d?"url(#clipPath-".concat(v?"":"dots-").concat(u,")"):void 0;return Ru.createElement(RY,{zIndex:h},Ru.createElement(Rf,{className:f},d&&Ru.createElement("defs",null,Ru.createElement(B_,{clipPathId:u,xAxisId:i,yAxisId:a}),!v&&Ru.createElement("clipPath",{id:"clipPath-dots-".concat(u)},Ru.createElement("rect",{x:s-x/2,y:o-x/2,width:l+x,height:c+x}))),Ru.createElement(BE,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:FR,errorBarOffset:0},Ru.createElement(FI,{props:this.props,clipPathId:u}))),Ru.createElement(Bw,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:y}))}}var Fz={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:OU.line,type:"linear"};function FF(e){var t=Ri(e,Fz),{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=FA(t,FE),{needClip:x}=BC(f,p),y=Ck(I7),b=Ck(_v),w=C4(),j=Ck(e=>BL(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 Ru.createElement(FB,FC({},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 FV=Ru.memo(function(e){var t=Ri(e,Fz),n=C4();return Ru.createElement(BF,{id:t.id,type:"line"},e=>Ru.createElement(Ru.Fragment,null,Ru.createElement(BI,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:CG(n,t),payload:e}]})(t)}),Ru.createElement(FT,{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}),Ru.createElement(BV,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),Ru.createElement(FF,FC({},t,{id:e}))))},Ix);FV.displayName="Line";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 FH=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 FW(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 FY(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 FG(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 FX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FG(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)):FG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var F$=["axisLine","width","height","className","hide","ticks","axisType"];function Fq(){return(Fq=Object.assign.bind()).apply(null,arguments)}function FK(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 FZ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FK(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)):FK(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var FQ={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:OU.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=FZ(FZ(FZ({},l),I_(s)),{},{fill:"none"});if("top"===a||"bottom"===a){var u=+("top"===a&&!o||"bottom"===a&&o);c=FZ(FZ({},c),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+("left"===a&&!o||"right"===a&&o);c=FZ(FZ({},c),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return eg.createElement("line",Fq({},c,{className:(0,C7.clsx)("recharts-cartesian-axis-line",(0,kX.default)(s,"className"))}))}function F0(e){var t,{option:n,tickProps:r,value:i}=e,a=(0,C7.clsx)(r.className,"recharts-cartesian-axis-tick-value");if(eg.isValidElement(n))t=eg.cloneElement(n,FZ(FZ({},r),{},{className:a}));else if("function"==typeof n)t=n(FZ(FZ({},r),{},{className:a}));else{var o="recharts-cartesian-axis-tick-value";"boolean"!=typeof n&&(o=(0,C7.clsx)(o,null==n?void 0:n.className)),t=eg.createElement(RW,Fq({},r,{className:o}),i)}return t}var F1=(0,eg.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=function(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(kJ(c)||Ir.isSsr)return null!=(r=FW(a,(kJ(c)?c:0)+1))?r:[];var f="top"===l||"bottom"===l?"width":"height",p=d&&"width"===f?Rw(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=Rw(a,{fontSize:t,letterSpacing:n}),FH({width:i.width+p.width,height:i.height+p.height},h)):Rw(a,{fontSize:t,letterSpacing:n})[f]},v=a.length>=2?kK(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:FW(r,u)};var o=c,h=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=0===c||FY(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||FY(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=FX(FX({},u),{},{tickCoord:h>0?u.coordinate-h*e:u.coordinate}),null!=u.tickCoord&&FY(e,u.tickCoord,()=>d,l,c)&&(c=u.tickCoord-e*(d/2+i),o[s-1]=FX(FX({},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=FX(FX({},a),{},{tickCoord:u<0?a.coordinate-u*e:a.coordinate})}else o[t]=a=FX(FX({},a),{},{tickCoord:a.coordinate});null!=a.tickCoord&&FY(e,a.tickCoord,s,l,c)&&(l=a.tickCoord+e*(s()/2+i),o[t]=FX(FX({},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=FX(FX({},c),{},{tickCoord:d>0?c.coordinate-d*e:c.coordinate})}else a[t]=c=FX(FX({},c),{},{tickCoord:c.coordinate});null!=c.tickCoord&&FY(e,c.tickCoord,u,s,l)&&(l=c.tickCoord-e*(u()/2+i),a[t]=FX(FX({},c),{},{isShow:!0}))},u=o-1;u>=0;u--)c(u);return a}(v,x,g,a,s)).filter(e=>e.isShow)}(FZ(FZ({},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),_=I_(w),S=IS(r),A={};"object"==typeof i&&(A=i);var T=FZ(FZ({},_),{},{fill:"none"},A),O=k.map(e=>FZ({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=kJ(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 eg.createElement(Rf,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},i&&eg.createElement("line",Fq({},T,n,{className:(0,C7.clsx)("recharts-cartesian-axis-tick-line",(0,kX.default)(i,"className"))})))}),P=O.map((e,t)=>{var{entry:n,tick:i}=e,u=FZ(FZ(FZ(FZ({textAnchor:E,verticalAnchor:C},_),{},{stroke:"none",fill:a},S),i),{},{index:t,payload:n,visibleTicksCount:k.length,tickFormatter:o,padding:l},c);return eg.createElement(Rf,Fq({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];IN(i)&&"function"==typeof a&&(r||(r={}),r[i]=e=>(a(t,n,e),null))}),r})(j,n,t)),r&&eg.createElement(F0,{option:r,tickProps:u,value:"".concat("function"==typeof o?o(n.value,t):n.value).concat(s||"")}))});return eg.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(N,"-ticks")},P.length>0&&eg.createElement(RY,{zIndex:OU.label},eg.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(N,"-tick-labels"),ref:t},P)),M.length>0&&eg.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(N,"-tick-lines")},M))}),F2=(0,eg.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,F$),[u,d]=(0,eg.useState)(""),[h,f]=(0,eg.useState)(""),p=(0,eg.useRef)(null);(0,eg.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,eg.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:eg.createElement(RY,{zIndex:e.zIndex},eg.createElement(Rf,{className:(0,C7.clsx)("recharts-cartesian-axis",a)},eg.createElement(FJ,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:I_(e)}),eg.createElement(F1,{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}),eg.createElement(RJ,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},eg.createElement(R6,{label:e.label,labelRef:e.labelRef}),e.children)))}),F5=eg.forwardRef((e,t)=>{var n=Ri(e,FQ);return eg.createElement(F2,Fq({},n,{ref:t}))});F5.displayName="CartesianAxis";var F3=["domain","range"],F4=["domain","range"];function F6(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 F8(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]}var F7=["dangerouslySetInnerHTML","ticks","scale"],F9=["id","scale"];function Ve(){return(Ve=Object.assign.bind()).apply(null,arguments)}function Vt(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 Vn(e){var t=Cb(),n=(0,eg.useRef)(null);return(0,eg.useLayoutEffect)(()=>{null===n.current?t(Ln(e)):n.current!==e&&t(Lr({prev:n.current,next:e})),n.current=e},[e,t]),(0,eg.useLayoutEffect)(()=>()=>{n.current&&(t(Li(n.current)),n.current=null)},[t]),null}var Vr=e=>{var{xAxisId:t,className:n}=e,r=Ck(C5),i=C4(),a="xAxis",o=Ck(e=>PI(e,a,t,i)),s=Ck(e=>PS(e,t)),l=Ck(e=>PO(e,t)),c=Ck(e=>Ml(e,t));if(null==s||null==l||null==c)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:h}=e,f=Vt(e,F7),{id:p,scale:g}=c,v=Vt(c,F9);return eg.createElement(F5,Ve({},f,v,{x:l.x,y:l.y,width:s.width,height:s.height,className:(0,C7.clsx)("recharts-".concat(a," ").concat(a),n),viewBox:r,ticks:o,axisType:a}))},Vi={allowDataOverflow:Ms.allowDataOverflow,allowDecimals:Ms.allowDecimals,allowDuplicatedCategory:Ms.allowDuplicatedCategory,angle:Ms.angle,axisLine:FQ.axisLine,height:Ms.height,hide:!1,includeHidden:Ms.includeHidden,interval:Ms.interval,minTickGap:Ms.minTickGap,mirror:Ms.mirror,orientation:Ms.orientation,padding:Ms.padding,reversed:Ms.reversed,scale:Ms.scale,tick:Ms.tick,tickCount:Ms.tickCount,tickLine:FQ.tickLine,tickSize:FQ.tickSize,type:Ms.type,xAxisId:0},Va=eg.memo(e=>{var t=Ri(e,Vi);return eg.createElement(eg.Fragment,null,eg.createElement(Vn,{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}),eg.createElement(Vr,t))},function(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=F6(e,F3),{domain:a,range:o}=t,s=F6(t,F4);return!!F8(n,a)&&!!F8(r,o)&&Ix(i,s)});function Vo(){return(Vo=Object.assign.bind()).apply(null,arguments)}function Vs(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 Vl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vs(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)):Vs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vc(e){return Array.isArray(e)&&k0(e[0])&&k0(e[1])?e.join(" ~ "):e}Va.displayName="XAxis";var Vu=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=Vl({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),p=Vl({margin:0},i),g=null!=u,v=g?u:"",x=(0,C7.clsx)("recharts-default-tooltip",l),y=(0,C7.clsx)("recharts-tooltip-label",c);return g&&d&&null!=a&&(v=d(u,a)),eg.createElement("div",Vo({className:x,style:f},h?{role:"status","aria-live":"assertive"}:{}),eg.createElement("p",{className:y,style:p},eg.isValidElement(v)?v:"".concat(v)),(()=>{if(a&&a.length){var e=(s?(0,CE.default)(a,s):a).map((e,n)=>{if("none"===e.type)return null;var i=e.formatter||o||Vc,{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=Vl({display:"block",paddingTop:4,paddingBottom:4,color:e.color||"#000"},r);return eg.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(n),style:h},k0(u)?eg.createElement("span",{className:"recharts-tooltip-item-name"},u):null,k0(u)?eg.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,eg.createElement("span",{className:"recharts-tooltip-item-value"},c),eg.createElement("span",{className:"recharts-tooltip-item-unit"},e.unit||""))});return eg.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},e)}return null})())},Vd=eg,Vh="recharts-tooltip-wrapper",Vf={visibility:"hidden"};function Vp(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offsetTopLeft:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:l,viewBoxDimension:c}=e;if(a&&kJ(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 Vg(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 Vm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vg(Object(n),!0).forEach(function(t){Vv(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vv(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 Vx extends Vd.PureComponent{constructor(){super(...arguments),Vv(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),Vv(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=Vp({allowEscapeViewBox:i,coordinate:a,key:"x",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.width,viewBox:d,viewBoxDimension:d.width}),translateY:r=Vp({allowEscapeViewBox:i,coordinate:a,key:"y",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.height,viewBox:d,viewBoxDimension:d.height}),useTranslate3d:u}):Vf,cssClasses:function(e){var{coordinate:t,translateX:n,translateY:r}=e;return(0,C7.clsx)(Vh,{["".concat(Vh,"-right")]:kJ(n)&&t&&kJ(t.x)&&n>=t.x,["".concat(Vh,"-left")]:kJ(n)&&t&&kJ(t.x)&&n<t.x,["".concat(Vh,"-bottom")]:kJ(r)&&t&&kJ(t.y)&&r>=t.y,["".concat(Vh,"-top")]:kJ(r)&&t&&kJ(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?{}:Vm(Vm({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=Vm(Vm({},b),{},{visibility:!this.state.dismissed&&e&&o?"visible":"hidden"},f);return Vd.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:x,style:w,ref:g},i)}}var Vy=e.i(92809),Vb=["x","y","top","left","width","height","className"];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}var VN=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?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}({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,Vb));return kJ(t)&&kJ(n)&&kJ(a)&&kJ(o)&&kJ(r)&&kJ(i)?eg.createElement("path",Vw({},IA(l),{className:(0,C7.clsx)("recharts-cross",s),d:"M".concat(t,",").concat(r,"v").concat(o,"M").concat(i,",").concat(n,"h").concat(a)})):null};function Vk(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[OV(t,n,r,i),OV(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}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}function VC(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}function V_(){return(V_=Object.assign.bind()).apply(null,arguments)}function VS(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?VS(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)):VS(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VT(e){var{cursor:t,cursorComp:n,cursorProps:r}=e;return(0,eg.isValidElement)(t)?(0,eg.cloneElement)(t,r):(0,eg.createElement)(n,r)}function VO(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=VN,a=OU.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=zc,a=OU.cursorRectangle;else if("radial"===d&&Bs(o)){var{cx:g,cy:v,radius:x,startAngle:y,endAngle:b}=Vk(o);r={cx:g,cy:v,startAngle:y,endAngle:b,innerRadius:x,outerRadius:x},i=zj,a=OU.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(Bs(t)){if("centric"===e){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,l=OV(r,i,a,s),c=OV(r,i,o,s);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return Vk(t)}}(d,o,c)},i=Fv,a=OU.cursorLine;var w="object"==typeof h&&"className"in h?h.className:void 0,j=VA(VA(VA(VA({stroke:"#ccc",pointerEvents:"none"},c),r),IS(h)),{},{payload:s,payloadIndex:l,className:(0,C7.clsx)("recharts-tooltip-cursor",w)});return eg.createElement(RY,{zIndex:null!=(n=e.zIndex)?n:a},eg.createElement(VT,{cursor:h,cursorComp:i,cursorProps:j}))}function VM(e){var t,n,r,i,a=(t=Ck(ML),n=Ck(DC),r=Ck(DN),t&&r?CW(VC(VC({},t),{},{scale:r}),n):CW(void 0,n)),o=null!=(i=Ck(C1))?i:_m,s=Ck(_v),l=Ck(OD);return null==a||null==o||null==s||null==l?null:eg.createElement(VO,V_({},e,{offset:o,layout:s,tooltipAxisBandSize:a,chartName:l}))}function VP(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 VD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?VP(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)):VP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VL(e){return e.dataKey}var VI=[],VR={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 VB(e){var t,n,r,i,a,o,s,l,c,u,d,h=Ri(e,VR),{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:A,defaultIndex:T,portal:O,axisId:M}=h,P=Cb(),D="number"==typeof T?String(T):T;(0,eg.useEffect)(()=>{P(E6({shared:S,trigger:A,axisId:M,active:f,defaultIndex:D}))},[P,S,A,M,f,D]);var L=_g(),I=Iw(),R=Ck(e=>PW(e,S)),{activeIndex:B,isActive:z}=null!=(u=Ck(e=>D0(e,R,A,D)))?u:{},F=Ck(e=>DJ(e,R,A,D)),V=Ck(e=>DQ(e,R,A,D)),U=Ck(e=>DZ(e,R,A,D)),H=(0,eg.useContext)(IK),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,eg.useState)({height:0,left:0,top:0,width:0}),r=(0,eg.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]),X="axis"===R?V:void 0;t=Ck(e=>((e,t,n)=>{if(null!=t){var r=PJ(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,A)),n=Ck(OR),r=Ck(OL),i=Ck(OI),o=null==(a=Ck(IG))?void 0:a.active,s=_g(),(0,eg.useEffect)(()=>{if(!o&&null!=r&&null!=n){var e=Cr({active:W,coordinate:U,dataKey:t,index:B,label:"number"==typeof X?String(X):X,sourceViewBox:s,graphicalItemId:void 0});IH.emit(IW,r,e,n)}},[o,U,t,B,X,n,r,i,W,s]);var $=null!=O?O:H;if(null==$||null==L||null==R)return null;var q=null!=F?F:VI;W||(q=VI),y&&q.length&&(l=q.filter(e=>null!=e.value&&(!0!==e.hide||h.includeHidden)),q=!0===j?(0,Vy.default)(l,VL):"function"==typeof j?(0,Vy.default)(l,j):l);var K=q.length>0,Z=eg.createElement(Vx,{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=VD(VD({},h),{},{payload:q,label:X,active:W,activeIndex:B,coordinate:U,accessibilityLayer:I}),eg.isValidElement(x)?eg.cloneElement(x,c):"function"==typeof x?eg.createElement(x,c):eg.createElement(Vu,c)));return eg.createElement(eg.Fragment,null,(0,e0.createPortal)(Z,$),W&&eg.createElement(VM,{cursor:_,tooltipEventType:R,coordinate:U,payload:q,index:B}))}let Vz=[{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"}],VF=[{value:"all",label:"All transports"},{value:"http",label:"HTTP"},{value:"mcp",label:"MCP"},{value:"system",label:"System"}],VV=[{value:"1d",label:"Today"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"}];function VU(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 VH(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 VW({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 VY({bankId:e}){let[t,n]=(0,eg.useState)("7d"),[r,i]=(0,eg.useState)(null),[a,o]=(0,eg.useState)([]),[s,l]=(0,eg.useState)("day"),[c,u]=(0,eg.useState)(!1),d=(0,eg.useCallback)(async(n=t,i=r)=>{u(!0);try{let t=await eP.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,eg.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)("div",{className:"border rounded-md p-4 space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold",children:"Request Volume"}),(0,ep.jsxs)("div",{className:"flex gap-2 ml-auto",children:[(0,ep.jsxs)(pl.Select,{value:r||"all",onValueChange:e=>{let n="all"===e?null:e;i(n),d(t,n)},children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-[160px] h-8 text-xs",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsx)(pl.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:Vz.map(e=>(0,ep.jsx)(pl.SelectItem,{value:e.value,children:e.label},e.value))})]}),VV.map(e=>(0,ep.jsx)(eD.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)("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)(_f,{width:"100%",height:"100%",children:(0,ep.jsxs)(Rc,{data:h,margin:{top:5,right:5,bottom:0,left:5},children:[(0,ep.jsx)(Va,{dataKey:"time",tick:{fontSize:10},axisLine:!1,tickLine:!1,className:"text-muted-foreground"}),(0,ep.jsx)(VB,{contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px",padding:"4px 8px"}}),(0,ep.jsx)(FV,{type:"monotone",dataKey:"total",stroke:"hsl(var(--primary))",strokeWidth:2,dot:!1,activeDot:{r:3}})]})})})]})}function VG(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,eg.useState)([]),[r,i]=(0,eg.useState)(0),[a,o]=(0,eg.useState)(null),[s,l]=(0,eg.useState)(null),[c,u]=(0,eg.useState)("all"),[d]=(0,eg.useState)(20),[h,f]=(0,eg.useState)(0),[p,g]=(0,eg.useState)(!1),[v,x]=(0,eg.useState)(null),[y,b]=(0,eg.useState)(!1),w=(0,eg.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,eg.useCallback)(async(t=a,r=s,o=c,l=h)=>{if(e){g(!0);try{let a=w(o),s=await eP.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,eg.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)(VY,{bankId:e}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,ep.jsxs)(pl.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)(pl.SelectTrigger,{className:"w-[180px]",children:(0,ep.jsx)(pl.SelectValue,{placeholder:"All actions"})}),(0,ep.jsx)(pl.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:Vz.map(e=>(0,ep.jsx)(pl.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(pl.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)(pl.SelectTrigger,{className:"w-[160px]",children:(0,ep.jsx)(pl.SelectValue,{placeholder:"All transports"})}),(0,ep.jsx)(pl.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:VF.map(e=>(0,ep.jsx)(pl.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(pl.Select,{value:c,onValueChange:e=>{u(e),f(0),j(a,s,e,0)},children:[(0,ep.jsx)(pl.SelectTrigger,{className:"w-[150px]",children:(0,ep.jsx)(pl.SelectValue,{})}),(0,ep.jsxs)(pl.SelectContent,{position:"popper",children:[(0,ep.jsx)(pl.SelectItem,{value:"all",children:"All time"}),(0,ep.jsx)(pl.SelectItem,{value:"1h",children:"Last hour"}),(0,ep.jsx)(pl.SelectItem,{value:"1d",children:"Last 24 hours"}),(0,ep.jsx)(pl.SelectItem,{value:"7d",children:"Last 7 days"}),(0,ep.jsx)(pl.SelectItem,{value:"30d",children:"Last 30 days"})]})]}),(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",onClick:()=>j(a,s,c,h),disabled:p,children:[(0,ep.jsx)(eV,{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.jsx)("div",{className:"border rounded-md",children:(0,ep.jsxs)(e$,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-[200px]",children:"Time"}),(0,ep.jsx)(eQ,{children:"Action"}),(0,ep.jsx)(eQ,{className:"w-[100px]",children:"Transport"}),(0,ep.jsx)(eQ,{className:"w-[100px]",children:"Duration"})]})}),(0,ep.jsx)(eK,{children:0===t.length?(0,ep.jsx)(eZ,{children:(0,ep.jsx)(eJ,{colSpan:4,className:"text-center text-muted-foreground py-8",children:p?"Loading...":"No audit logs found"})}):t.map(e=>(0,ep.jsxs)(eZ,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>{x(e),b(!0)},children:[(0,ep.jsx)(eJ,{className:"text-sm font-mono",children:VH(e.started_at)}),(0,ep.jsx)(eJ,{className:"font-medium",children:e.action}),(0,ep.jsx)(eJ,{children:(0,ep.jsx)(VW,{transport:e.transport})}),(0,ep.jsx)(eJ,{className:"text-sm text-muted-foreground font-mono",children:VU(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)(eD.Button,{variant:"outline",size:"sm",onClick:()=>N(Math.max(0,h-d)),disabled:0===h,children:[(0,ep.jsx)(e_,{className:"w-4 h-4 mr-1"}),"Previous"]}),(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",onClick:()=>N(h+d),disabled:h+d>=r,children:["Next",(0,ep.jsx)(eS.ChevronRight,{className:"w-4 h-4 ml-1"})]})]})]}),(0,ep.jsx)(tV.Dialog,{open:y,onOpenChange:b,children:(0,ep.jsxs)(tV.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsx)(tV.DialogHeader,{children:(0,ep.jsxs)(tV.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)(VW,{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:VH(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:VU(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 VX=(0,ej.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 tz=tz;e.s(["default",0,function(){(0,em.useParams)();let e=(0,em.useRouter)(),t=(0,em.useSearchParams)(),{features:n}=(0,eb.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,eg.useState)(!1),[f,p]=(0,eg.useState)(!1),[g,v]=(0,eg.useState)(!1),[x,y]=(0,eg.useState)(!1),[b,w]=(0,eg.useState)(!1),[j,N]=(0,eg.useState)(!1),[k,E]=(0,eg.useState)(!1),[C,_]=(0,eg.useState)(!1),S=t=>{e.push(`/banks/${r}?view=data&subTab=${t}`)},A=t=>{e.push(`/banks/${r}?view=profile&bankConfigTab=${t}`)},T=async()=>{if(r){p(!0);try{await eP.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 eP.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 eP.client.resetBankConfig(r),E(!1)}catch{}finally{_(!1)}}},P=async()=>{if(r){w(!0);try{await eP.client.triggerConsolidation(r)}catch(e){}finally{w(!1)}}},D=async()=>{if(r){N(!0);try{let e=await eP.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)(eM,{currentTab:o,onTabChange:t=>{e.push(`/banks/${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)(jc,{children:[(0,ep.jsx)(jd,{asChild:!0,children:(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",children:["Actions",(0,ep.jsx)(b5,{className:"w-4 h-4 ml-2"})]})}),(0,ep.jsxs)(jk,{align:"end",className:"w-48",children:[(0,ep.jsxs)(jE,{onClick:async()=>{if(r)try{let e=await eP.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)(VX,{className:"w-4 h-4 mr-2"}),"Export Template"]}),(0,ep.jsx)(jC,{}),(0,ep.jsxs)(jE,{onClick:P,disabled:b||!c,title:c?void 0:"Observations feature is not enabled",children:[b?(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(pw,{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)(jE,{onClick:D,disabled:j||!c,title:c?void 0:"Observations feature is not enabled",children:[j?(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(bJ,{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)(jE,{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)(pn,{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)(jC,{}),(0,ep.jsxs)(jE,{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)(bJ,{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)(jC,{}),(0,ep.jsxs)(jE,{onClick:()=>h(!0),className:"text-red-600 dark:text-red-400 focus:text-red-700 dark:focus:text-red-300",children:[(0,ep.jsx)(pn,{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:()=>A("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:()=>A("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:()=>A("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:()=>A("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)(bQ,{}),(0,ep.jsx)(b1,{}),(0,ep.jsx)(bg,{hideReflectFields:!0})]})]}),"configuration"===l&&u&&(0,ep.jsx)("div",{className:"space-y-6",children:(0,ep.jsx)(bI,{})}),"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)(jF,{})]}),"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)(VG,{})]})]})]}),"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)(bd,{})]}),"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)(bl,{})]}),"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)(fD,{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)(fD,{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)(fD,{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)(jS,{},"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)(po,{})]}),"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)(ps,{})]})]})})]}),(0,ep.jsx)(fU,{open:d,onOpenChange:h,children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Delete Memory Bank"}),(0,ep.jsx)(f9,{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)(f8,{children:[(0,ep.jsx)(pt,{disabled:f,children:"Cancel"}),(0,ep.jsx)(pe,{onClick:T,disabled:f,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:f?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pn,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(fU,{open:k,onOpenChange:E,children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Reset Configuration"}),(0,ep.jsx)(f9,{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)(f8,{children:[(0,ep.jsx)(pt,{disabled:C,children:"Cancel"}),(0,ep.jsx)(pe,{onClick:M,disabled:C,children:C?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Resetting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(bJ,{className:"w-4 h-4 mr-2"}),"Reset Configuration"]})})]})]})}),(0,ep.jsx)(fU,{open:g,onOpenChange:v,children:(0,ep.jsxs)(f4,{children:[(0,ep.jsxs)(f6,{children:[(0,ep.jsx)(f7,{children:"Clear Observations"}),(0,ep.jsx)(f9,{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)(f8,{children:[(0,ep.jsx)(pt,{disabled:x,children:"Cancel"}),(0,ep.jsx)(pe,{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)(tz.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(pn,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})})]})}],37578)}]);