import{j as e}from"./jsx-runtime.D_zvdyIk.js";import{E as R,I as E}from"./ErrorBoundary.BDazmPSq.js";import{r as t}from"./index.BIRwh3HZ.js";import{a as V}from"./useMediaQuery.CQ7x5FXM.js";import"./modal.CmyA2O2l.js";import{u as A}from"./useTranslation.Dg7DwAC5.js";import{c as u}from"./utils.BZbvJs_N.js";import{d as S}from"./index.DdUPy29j.js";import"./index.E5Nwsatb.js";import"./_commonjsHelpers.CqkleIqs.js";import"./index.BHh4vvK5.js";import"./index.3whys8t3.js";import"./index.RTTH55m1.js";import"./utils.D6Ui05B2.js";import"./site-config.CgQ_bxrG.js";import"./site.Deo0TYgJ.js";function k({className:r}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",className:r,"aria-hidden":"true",children:e.jsxs("g",{fill:"none",children:[e.jsx("path",{d:"m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z"}),e.jsx("path",{fill:"currentColor",d:"M9.107 5.448c.598-1.75 3.016-1.803 3.725-.159l.06.16l.807 2.36a4 4 0 0 0 2.276 2.411l.217.081l2.36.806c1.75.598 1.803 3.016.16 3.725l-.16.06l-2.36.807a4 4 0 0 0-2.412 2.276l-.081.216l-.806 2.361c-.598 1.75-3.016 1.803-3.724.16l-.062-.16l-.806-2.36a4 4 0 0 0-2.276-2.412l-.216-.081l-2.36-.806c-1.751-.598-1.804-3.016-.16-3.724l.16-.062l2.36-.806A4 4 0 0 0 8.22 8.025l.081-.216zM19 2a1 1 0 0 1 .898.56l.048.117l.35 1.026l1.027.35a1 1 0 0 1 .118 1.845l-.118.048l-1.026.35l-.35 1.027a1 1 0 0 1-1.845.117l-.048-.117l-.35-1.026l-1.027-.35a1 1 0 0 1-.118-1.845l.118-.048l1.026-.35l.35-1.027A1 1 0 0 1 19 2"})]})})}const q=t.memo(({isExpanded:r,summary:s,isTyping:o,textRef:d})=>e.jsx("div",{id:"summary-panel-content",className:"grid transition-[grid-template-rows] duration-300 ease-out",style:{gridTemplateRows:r?"1fr":"0fr"},children:e.jsx("div",{className:"overflow-hidden",children:e.jsxs("div",{className:"rounded-b-lg bg-foreground/5 px-4 py-4 text-muted-foreground text-sm leading-relaxed",children:[e.jsx("span",{className:"sr-only",children:s}),e.jsxs("p",{"aria-hidden":"true",children:[e.jsx("span",{ref:d}),o&&e.jsx("span",{className:"typewriter-cursor"})]})]})})})),F={description:e.jsx(S,{className:"size-4 text-primary"}),ai:e.jsx(k,{className:"size-4 text-primary"}),auto:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"size-4 text-primary","aria-hidden":"true",children:e.jsx("path",{d:"M20 22H4C3.44772 22 3 21.5523 3 21V3C3 2.44772 3.44772 2 4 2H20C20.5523 2 21 2.44772 21 3V21C21 21.5523 20.5523 22 20 22ZM19 20V4H5V20H19ZM7 6H11V10H7V6ZM7 12H17V14H7V12ZM7 16H17V18H7V16ZM13 7H17V9H13V7Z"})})},T={description:"summary.description",ai:"summary.ai",auto:"summary.auto"};function X({summary:r,source:s="ai",typingSpeed:o=25,className:d}){const[n,m]=t.useState(!1),[C,i]=t.useState(!1),[f,p]=t.useState(!1),a=t.useRef(null),x=t.useRef(0),l=t.useRef(null),{t:v}=A(),y=F[s],b=v(T[s]),g=V(),c=t.useCallback(()=>{a.current&&(cancelAnimationFrame(a.current),a.current=null)},[]),h=t.useCallback(()=>{if(!l.current)return;if(g||f){l.current.textContent=r,i(!1),p(!0);return}i(!0),l.current.textContent="",x.current=performance.now();const j=N=>{const M=N-x.current,w=Math.floor(M/o);w<r.length&&l.current?(l.current.textContent=r.slice(0,w+1),a.current=requestAnimationFrame(j)):(l.current&&(l.current.textContent=r),i(!1),p(!0))};a.current=requestAnimationFrame(j)},[r,o,g,f]),H=t.useCallback(()=>{n?(c(),m(!1),i(!1)):(m(!0),h())},[n,c,h]);return t.useEffect(()=>()=>c(),[c]),e.jsx(R,{FallbackComponent:E,children:e.jsxs("div",{className:u("overflow-hidden rounded-lg",d),children:[e.jsxs("button",{type:"button",onClick:H,className:u("flex w-full cursor-pointer items-center justify-between bg-foreground/5 px-4 py-3 transition-all duration-250","hover:bg-foreground/10",n&&"rounded-t-lg bg-foreground/10",!n&&"rounded-lg"),"aria-expanded":n,"aria-controls":"summary-panel-content",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground text-sm",children:[e.jsx("span",{className:u("transition-transform duration-300",n&&s==="ai"&&"rotate-10"),children:y}),b]}),e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:u("size-4 text-muted-foreground transition-transform duration-300",n&&"rotate-180"),"aria-hidden":"true",children:e.jsx("path",{d:"M12 16L6 10H18L12 16Z"})})]}),e.jsx(q,{isExpanded:n,summary:r,isTyping:C,textRef:l})]})})}export{X as default};
