diff --git a/assets/AiDeadlinesView-BROI0ZmS.js b/assets/AiDeadlinesView-BpSthBaV.js similarity index 96% rename from assets/AiDeadlinesView-BROI0ZmS.js rename to assets/AiDeadlinesView-BpSthBaV.js index 5a7a7b9cd487eca87d442484fbafd4118047a8d7..3303485eba0f80581db6d413d226964f09dd506e 100644 --- a/assets/AiDeadlinesView-BROI0ZmS.js +++ b/assets/AiDeadlinesView-BpSthBaV.js @@ -1,3 +1,3 @@ -import{r as x,j as t}from"./index-BrhBTT14.js";import{u as A}from"./useQuery-GhY2LXSI.js";import{c as B}from"./catalog-CkpmYxEk.js";import{S as U}from"./switch-DpBsrlqh.js";import{S as W}from"./skeleton-DHdzoBmM.js";import{A as O,a as V}from"./alert-c1n3ZtEC.js";import{s as z}from"./safeExternalHref-CkBrsh84.js";import{D as P,a as G,b as Y,c as H,d as K}from"./dialog-BhRZv4T5.js";import"./index-WJQaPd7m.js";const b=1e3*60*60*24,S={urgent:"#c0392b",soon:"#b9770e",normal:"#3f7d3f",passed:"var(--ink-faint)"},k=e=>e.split("-").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "),q=new Set(["machine-learning","computer-vision","natural-language-processing","data-mining","robotics","computer-graphics","human-computer-interaction","web-search","signal-processing","representation-learning","reinforcement-learning","optimization-methods","large-language-models","information-retrieval","speech","mathematics"]),Q=e=>e.trim().toLowerCase().replace(/\s+/g,"-"),D=e=>Array.from(new Set((e.tags??[]).map(Q).filter(a=>q.has(a)))),F=e=>new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),I=(e,a)=>{if(!e)return null;const n=new Date(`${e}T00:00:00`),r=a?new Date(`${a}T00:00:00`):null,o=s=>s.toLocaleDateString("en-US",{month:"long",day:"numeric"}),i=n.getFullYear();return r&&r.getTime()!==n.getTime()?n.getMonth()===r.getMonth()?`${o(n).replace(/\d+$/,"").trim()} ${n.getDate()}–${r.getDate()}, ${i}`:`${o(n)} – ${o(r)}, ${i}`:`${o(n)}, ${i}`},M=e=>[...e.deadlines??[]].sort((a,n)=>new Date(a.deadline_at).getTime()-new Date(n.deadline_at).getTime()),T=(e,a)=>M(e).find(n=>new Date(n.deadline_at).getTime()>a)??null,L=e=>{const a=M(e);return a.length?a[a.length-1]:null},J=(e,a)=>{const n=e-a;if(n<=0)return"Deadline passed";const r=Math.floor(n/b);if(r>=1){const s=Math.floor((n-r*b)/36e5);return`in ${r}d ${s}h`}const o=Math.floor(n/(1e3*60*60));return o>=1?`in ${o}h`:`in ${Math.max(1,Math.floor(n/(1e3*60)))}m`},X=(e,a)=>{const n=e-a;if(n<=0)return"Deadline passed";const r=Math.floor(n/b),o=Math.floor(n%b/(1e3*60*60)),i=Math.floor(n%(1e3*60*60)/(1e3*60)),s=Math.floor(n%(1e3*60)/1e3);return`${r}d ${o}h ${i}m ${s}s`},_=(e,a)=>{if(e==null)return S.passed;const n=(e-a)/b;return n<=0?S.passed:n<=7?S.urgent:n<=30?S.soon:S.normal},$={fontFamily:"var(--mono)",fontSize:10,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--ink-faint)"},Z=(e,a)=>{const n=Math.ceil((e-a)/b);return n<=0?"passed":`${n} ${n===1?"day":"days"}`},R=(e,a)=>{const n=I(e.start_date,e.end_date),r=e.venue||[e.city,e.country].filter(Boolean).join(", ");return[`${a.label||a.type||"Deadline"} for ${e.name}`,n?`Dates: ${n}`:null,r?`Location: ${r}`:null,e.url?`Website: ${e.url}`:null].filter(Boolean).join(` +import{r as x,j as t}from"./index-D_-UZEuL.js";import{u as A}from"./useQuery-BZo4MZ3s.js";import{c as B}from"./catalog-CjU2vAfw.js";import{S as U}from"./switch-giaX-T5P.js";import{S as W}from"./skeleton-CCZ1iXls.js";import{A as O,a as V}from"./alert-B2j1kc2o.js";import{s as z}from"./safeExternalHref-CkBrsh84.js";import{D as P,a as G,b as Y,c as H,d as K}from"./dialog-ChaQ5z93.js";import"./index-DlwDDz8H.js";const b=1e3*60*60*24,S={urgent:"#c0392b",soon:"#b9770e",normal:"#3f7d3f",passed:"var(--ink-faint)"},k=e=>e.split("-").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "),q=new Set(["machine-learning","computer-vision","natural-language-processing","data-mining","robotics","computer-graphics","human-computer-interaction","web-search","signal-processing","representation-learning","reinforcement-learning","optimization-methods","large-language-models","information-retrieval","speech","mathematics"]),Q=e=>e.trim().toLowerCase().replace(/\s+/g,"-"),D=e=>Array.from(new Set((e.tags??[]).map(Q).filter(a=>q.has(a)))),F=e=>new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),I=(e,a)=>{if(!e)return null;const n=new Date(`${e}T00:00:00`),r=a?new Date(`${a}T00:00:00`):null,o=s=>s.toLocaleDateString("en-US",{month:"long",day:"numeric"}),i=n.getFullYear();return r&&r.getTime()!==n.getTime()?n.getMonth()===r.getMonth()?`${o(n).replace(/\d+$/,"").trim()} ${n.getDate()}–${r.getDate()}, ${i}`:`${o(n)} – ${o(r)}, ${i}`:`${o(n)}, ${i}`},M=e=>[...e.deadlines??[]].sort((a,n)=>new Date(a.deadline_at).getTime()-new Date(n.deadline_at).getTime()),T=(e,a)=>M(e).find(n=>new Date(n.deadline_at).getTime()>a)??null,L=e=>{const a=M(e);return a.length?a[a.length-1]:null},J=(e,a)=>{const n=e-a;if(n<=0)return"Deadline passed";const r=Math.floor(n/b);if(r>=1){const s=Math.floor((n-r*b)/36e5);return`in ${r}d ${s}h`}const o=Math.floor(n/(1e3*60*60));return o>=1?`in ${o}h`:`in ${Math.max(1,Math.floor(n/(1e3*60)))}m`},X=(e,a)=>{const n=e-a;if(n<=0)return"Deadline passed";const r=Math.floor(n/b),o=Math.floor(n%b/(1e3*60*60)),i=Math.floor(n%(1e3*60*60)/(1e3*60)),s=Math.floor(n%(1e3*60)/1e3);return`${r}d ${o}h ${i}m ${s}s`},_=(e,a)=>{if(e==null)return S.passed;const n=(e-a)/b;return n<=0?S.passed:n<=7?S.urgent:n<=30?S.soon:S.normal},$={fontFamily:"var(--mono)",fontSize:10,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--ink-faint)"},Z=(e,a)=>{const n=Math.ceil((e-a)/b);return n<=0?"passed":`${n} ${n===1?"day":"days"}`},R=(e,a)=>{const n=I(e.start_date,e.end_date),r=e.venue||[e.city,e.country].filter(Boolean).join(", ");return[`${a.label||a.type||"Deadline"} for ${e.name}`,n?`Dates: ${n}`:null,r?`Location: ${r}`:null,e.url?`Website: ${e.url}`:null].filter(Boolean).join(` `)},C=e=>e.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),ee=(e,a)=>{const n=new Date(a.deadline_at),r=new Date(n.getTime()+60*60*1e3),o=`${e.short_name||e.name} ${a.label||a.type||"deadline"}`,i=e.venue||[e.city,e.country].filter(Boolean).join(", "),s=`https://calendar.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(o)}&dates=${C(n)}/${C(r)}&details=${encodeURIComponent(R(e,a))}&location=${encodeURIComponent(i)}`,m=z(s);m&&window.open(m,"_blank","noopener,noreferrer")},te=(e,a)=>{const n=new Date(a.deadline_at),r=new Date(n.getTime()+60*60*1e3),o=`${e.short_name||e.name} ${a.label||a.type||"deadline"}`,i=e.venue||[e.city,e.country].filter(Boolean).join(", "),s=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",e.url?`URL:${e.url}`:null,`DTSTART:${C(n)}`,`DTEND:${C(r)}`,`SUMMARY:${o}`,`DESCRIPTION:${R(e,a).replace(/\n/g,"\\n")}`,i?`LOCATION:${i}`:null,"END:VEVENT","END:VCALENDAR"].filter(Boolean).join(` `),m=new Blob([s],{type:"text/calendar;charset=utf-8"}),c=document.createElement("a");c.href=URL.createObjectURL(m),c.download=`${(e.short_name||e.name).toLowerCase().replace(/\s+/g,"-")}-deadline.ics`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(c.href)},ne=({conf:e,open:a,onOpenChange:n})=>{const[r,o]=x.useState(()=>Date.now());x.useEffect(()=>{if(!a)return;o(Date.now());const d=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(d)},[a]);const i=x.useMemo(()=>e?M(e):[],[e]),s=x.useMemo(()=>e?T(e,r):null,[e,r]),m=e?I(e.start_date,e.end_date):null,c=e?e.venue||[e.city,e.country].filter(Boolean).join(", ")||e.location:null,u=s?new Date(s.deadline_at).getTime():null;return t.jsx(P,{open:a,onOpenChange:n,children:t.jsx(G,{className:"max-w-xl",style:{background:"var(--bg-elevated)",maxHeight:"85vh",overflowY:"auto"},children:e&&t.jsxs(t.Fragment,{children:[t.jsxs(Y,{children:[t.jsx(H,{asChild:!0,children:t.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.01em",margin:0},children:e.short_name?`${e.short_name} ${e.year??""}`.trim():e.name})}),e.short_name&&e.name||e.description?t.jsx(K,{asChild:!0,children:t.jsx("span",{style:{fontFamily:"var(--serif)",fontSize:14,color:"var(--ink-soft)"},children:e.short_name?e.name:e.description})}):null]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,marginTop:4},children:[t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:24},children:[m&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("span",{style:$,children:"Dates"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-soft)"},children:m})]}),c&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("span",{style:$,children:"Venue"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-soft)"},children:c})]})]}),u!=null&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"12px 14px",borderRadius:8,background:"var(--bg-subtle)",border:"1px solid var(--hairline)"},children:[t.jsx("span",{style:$,children:"Next deadline in"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:22,fontWeight:600,color:_(u,r)},children:X(u,r)})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsx("span",{style:$,children:"Important deadlines"}),i.length===0?t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-faint)"},children:"No deadlines listed"}):i.map((d,p)=>{const y=new Date(d.deadline_at).getTime(),l=s!=null&&d.deadline_at===s.deadline_at&&d.type===s.type,h=y<=r;return t.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,padding:"8px 12px",borderRadius:6,background:l?"var(--accent-soft)":"transparent",border:l?"1px solid var(--hairline-strong)":"1px solid var(--hairline)",opacity:h&&!l?.55:1},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsxs("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink)",fontWeight:l?600:400},children:[d.label||k(d.type||"deadline"),l&&t.jsx("span",{style:{...$,marginLeft:8},children:"Next"})]}),t.jsxs("span",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-faint)"},children:[F(d.deadline_at),d.timezone?` · ${d.timezone}`:""]})]}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:12,fontWeight:600,whiteSpace:"nowrap",color:_(h?null:y,r)},children:Z(y,r)})]},`${d.type??"deadline"}-${p}`)})]}),D(e).length>0&&t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:D(e).map(d=>t.jsx("span",{className:"tag-chip",style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:k(d)},d))}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:16,paddingTop:12,borderTop:"1px solid var(--hairline)"},children:[e.url&&t.jsx("a",{href:z(e.url)??void 0,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--accent-text)"},children:"Visit website ↗"}),s&&t.jsxs("div",{style:{display:"flex",gap:12,marginLeft:"auto"},children:[t.jsx("button",{type:"button",className:"tag-chip",onClick:()=>ee(e,s),style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:"+ Google Calendar"}),t.jsx("button",{type:"button",className:"tag-chip",onClick:()=>te(e,s),style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:"+ Apple / .ics"})]})]})]})]})})})},E=({id:e,label:a,checked:n,onChange:r})=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:[t.jsx(U,{id:e,checked:n,onCheckedChange:r}),t.jsx("label",{htmlFor:e,style:{cursor:"pointer"},children:a})]}),ae=({conf:e,now:a,selectedDomains:n,onToggleDomain:r,onOpen:o})=>{const i=T(e,a),s=i??L(e),m=s?new Date(s.deadline_at).getTime():null,c=_(i?m:null,a),u=I(e.start_date,e.end_date),d=[e.city??null,e.country??null].filter(Boolean).join(", ");return t.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(e),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),o(e))},style:{border:"1px solid var(--hairline)",borderRadius:8,padding:20,background:"var(--bg-elevated)",display:"flex",flexDirection:"column",gap:12,cursor:"pointer"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12},children:[t.jsx("h3",{style:{fontFamily:"var(--serif)",fontSize:20,fontWeight:500,letterSpacing:"-0.01em",margin:0},children:e.short_name?`${e.short_name} ${e.year??""}`.trim():e.name}),e.url&&t.jsx("a",{href:z(e.url)??void 0,target:"_blank",rel:"noopener noreferrer",onClick:p=>p.stopPropagation(),style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",whiteSpace:"nowrap"},children:"website ↗"})]}),t.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,paddingBottom:12,borderBottom:"1px solid var(--hairline)"},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)"},children:(s==null?void 0:s.label)||(s==null?void 0:s.type)||"Deadline"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:s?`${F(s.deadline_at)}${s.timezone?` · ${s.timezone}`:""}`:"TBD"})]}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:14,fontWeight:600,color:c,whiteSpace:"nowrap"},children:m!=null?J(m,a):"TBD"})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)"},children:[u&&t.jsx("span",{children:u}),d&&t.jsx("span",{children:d})]}),D(e).length>0&&t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:D(e).map(p=>{const y=n.has(p);return t.jsx("button",{className:"tag-chip",onClick:l=>{l.stopPropagation(),r(p)},style:{background:y?"var(--ink)":"var(--bg-subtle)",color:y?"var(--bg)":"var(--ink-soft)"},children:k(p)},p)})})]})},ue=()=>{const[e,a]=x.useState(!0),[n,r]=x.useState(!1),[o,i]=x.useState(new Set),[s,m]=x.useState(null),c=x.useMemo(()=>Date.now(),[]),u=A({queryKey:["conference-deadlines"],queryFn:()=>B.conferenceDeadlines(),staleTime:10*60*1e3}),d=l=>{i(h=>{const g=new Set(h);return g.has(l)?g.delete(l):g.add(l),g})},p=x.useMemo(()=>{var h;const l=new Map;return(h=u.data)==null||h.results.forEach(g=>{D(g).forEach(j=>l.set(j,(l.get(j)??0)+1))}),Array.from(l.entries()).sort((g,j)=>j[1]-g[1]).map(([g])=>g)},[u.data]),y=x.useMemo(()=>{var j;const h=(((j=u.data)==null?void 0:j.results)??[]).filter(f=>!(e&&f.tier!=="a"||o.size>0&&!D(f).some(v=>o.has(v))||!n&&!T(f,c))),g=f=>{const w=T(f,c);if(w)return{group:0,time:new Date(w.deadline_at).getTime()};const v=L(f);return{group:1,time:-(v?new Date(v.deadline_at).getTime():0)}};return[...h].sort((f,w)=>{const v=g(f),N=g(w);return v.group!==N.group?v.group-N.group:v.time-N.time})},[u.data,e,n,o,c]);return u.error?t.jsx("div",{className:"page",children:t.jsx(O,{variant:"destructive",children:t.jsx(V,{children:"Failed to load conference deadlines. Please try again."})})}):t.jsxs("div",{className:"page",children:[t.jsx("div",{className:"feed-header",children:t.jsxs("div",{children:[t.jsxs("h1",{className:"feed-title",children:["AI Conference ",t.jsx("em",{children:"Deadlines"})]}),t.jsx("div",{className:"feed-subtitle",children:"Upcoming submission deadlines for major AI conferences, counting down."})]})}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:20,padding:"16px 0",borderBottom:"1px solid var(--hairline)",marginBottom:24},children:[t.jsx(E,{id:"top-tier-only",label:"Top tier only",checked:e,onChange:a}),t.jsx(E,{id:"show-past",label:"Show past conferences",checked:n,onChange:r})]}),p.length>0&&t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:24},children:[p.map(l=>{const h=o.has(l);return t.jsx("button",{className:"tag-chip",onClick:()=>d(l),style:{background:h?"var(--ink)":"var(--bg-subtle)",color:h?"var(--bg)":"var(--ink-soft)"},children:k(l)},l)}),o.size>0&&t.jsx("button",{className:"tag-chip",onClick:()=>i(new Set),style:{background:"transparent",color:"var(--ink-faint)"},children:"Clear ✕"})]}),t.jsx("div",{className:"sort-bar",children:t.jsx("div",{className:"results-count",children:u.isLoading?"…":`${y.length} conferences`})}),u.isLoading?t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:16},children:Array.from({length:6}).map((l,h)=>t.jsx(W,{className:"h-44"},h))}):y.length===0?t.jsxs("div",{className:"no-results",children:["No conferences match these filters",n?".":" — try enabling “Show past conferences”."]}):t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:16},children:y.map(l=>t.jsx(ae,{conf:l,now:c,selectedDomains:o,onToggleDomain:d,onOpen:m},l.id))}),t.jsx(ne,{conf:s,open:s!==null,onOpenChange:l=>{l||m(null)}})]})};export{ue as default}; diff --git a/assets/AuthorDetailView-BqQhih_3.js b/assets/AuthorDetailView-B88e4SG9.js similarity index 65% rename from assets/AuthorDetailView-BqQhih_3.js rename to assets/AuthorDetailView-B88e4SG9.js index ee21fe9d0c27db76a834371b3e56ee06d8edbff0..3a6605aa09ce9ed374ce1b051f072a3d16f9c87f 100644 --- a/assets/AuthorDetailView-BqQhih_3.js +++ b/assets/AuthorDetailView-B88e4SG9.js @@ -1 +1 @@ -import{e as m,j as e,L as x}from"./index-BrhBTT14.js";import{u as h}from"./useQuery-GhY2LXSI.js";import{p as d}from"./papers-DBaPliAp.js";import{S as p}from"./skeleton-DHdzoBmM.js";import g from"./NotFound-CksCbtS8.js";const _=()=>{var i,l,n,o,u;const{authorId:a}=m(),r=h({queryKey:["author",a],queryFn:()=>d.getAuthor(a),enabled:!!a}),t=h({queryKey:["author-papers",a],queryFn:()=>d.authorPapers(a,{page:1,page_size:20}),enabled:!!a});return((i=r.error)==null?void 0:i.status)===404?e.jsx(g,{}):e.jsxs("div",{className:"page",children:[e.jsx("p",{className:"sidebar-label",children:"Author"}),e.jsx("h1",{className:"feed-title",children:((l=r.data)==null?void 0:l.full_name)??e.jsx(p,{className:"h-10 w-64 inline-block"})}),((n=r.data)==null?void 0:n.hf_username)&&e.jsxs("a",{href:`https://huggingface.co/${r.data.hf_username}`,target:"_blank",rel:"noopener noreferrer",children:["@",r.data.hf_username," on Hugging Face"]}),e.jsxs("section",{style:{marginTop:40},"aria-labelledby":"author-papers-heading",children:[e.jsx("h2",{id:"author-papers-heading",children:"Research papers"}),t.isLoading&&e.jsx(p,{className:"h-24 w-full mt-4"}),((o=t.data)==null?void 0:o.results.length)===0&&e.jsx("p",{children:"No public papers are available."}),e.jsx("ol",{className:"paper-list",children:(u=t.data)==null?void 0:u.results.map(s=>{const c=s.source==="external"?String(s.id):s.arxiv_id;return e.jsx("li",{children:e.jsx(x,{to:`/paper/${c}`,children:s.title})},s.id)})})]})]})};export{_ as default}; +import{c as m,j as e,L as x}from"./index-D_-UZEuL.js";import{u as h}from"./useQuery-BZo4MZ3s.js";import{p as d}from"./papers-DHqjKX7p.js";import{S as c}from"./skeleton-CCZ1iXls.js";import g from"./NotFound--BkOSvuh.js";const _=()=>{var i,l,n,o,u;const{authorId:a}=m(),r=h({queryKey:["author",a],queryFn:()=>d.getAuthor(a),enabled:!!a}),t=h({queryKey:["author-papers",a],queryFn:()=>d.authorPapers(a,{page:1,page_size:20}),enabled:!!a});return((i=r.error)==null?void 0:i.status)===404?e.jsx(g,{}):e.jsxs("div",{className:"page",children:[e.jsx("p",{className:"sidebar-label",children:"Author"}),e.jsx("h1",{className:"feed-title",children:((l=r.data)==null?void 0:l.full_name)??e.jsx(c,{className:"h-10 w-64 inline-block"})}),((n=r.data)==null?void 0:n.hf_username)&&e.jsxs("a",{href:`https://huggingface.co/${r.data.hf_username}`,target:"_blank",rel:"noopener noreferrer",children:["@",r.data.hf_username," on Hugging Face"]}),e.jsxs("section",{style:{marginTop:40},"aria-labelledby":"author-papers-heading",children:[e.jsx("h2",{id:"author-papers-heading",children:"Research papers"}),t.isLoading&&e.jsx(c,{className:"h-24 w-full mt-4"}),((o=t.data)==null?void 0:o.results.length)===0&&e.jsx("p",{children:"No public papers are available."}),e.jsx("ol",{className:"paper-list",children:(u=t.data)==null?void 0:u.results.map(s=>{const p=s.source==="external"?String(s.id):s.arxiv_id;return e.jsx("li",{children:e.jsx(x,{to:`/paper/${p}`,children:s.title})},s.id)})})]})]})};export{_ as default}; diff --git a/assets/BenchmarkDetailView-Cg86MceH.js b/assets/BenchmarkDetailView-C5SE268J.js similarity index 97% rename from assets/BenchmarkDetailView-Cg86MceH.js rename to assets/BenchmarkDetailView-C5SE268J.js index c2038bcc4aceecde65b6953213b3dda888873338..cbe979079ec071aec018837bfde4abc7bd781c92 100644 --- a/assets/BenchmarkDetailView-Cg86MceH.js +++ b/assets/BenchmarkDetailView-C5SE268J.js @@ -1,2 +1,2 @@ -import{u as jt,r as w,j as n,w as ie,d as _t,e as kt,a as St,l as Ct,L as te}from"./index-BrhBTT14.js";import{u as Y}from"./useQuery-GhY2LXSI.js";import{c as re}from"./catalog-CkpmYxEk.js";import{C as Et,E as Nt,e as Rt}from"./ExternalSourceEvalBadge-CXYkyGiT.js";import{S as be}from"./skeleton-DHdzoBmM.js";import{S as Ze}from"./switch-DpBsrlqh.js";import{A as $t,a as Tt}from"./alert-c1n3ZtEC.js";import{L as we}from"./LatexTitle-BJSVMlZ1.js";import{B as Ft}from"./BenchmarkTrendSparkline-5roKNW3d.js";import{I as Mt}from"./components-74u_bIKK.js";import{s as Lt}from"./safeExternalHref-CkBrsh84.js";import{s as It}from"./slug-BpH-Nkvz.js";import"./papers-DBaPliAp.js";import"./hover-card-BcKGA4Et.js";import"./index-WJQaPd7m.js";import"./katex.min-BSBacQyE.js";import"./transform-Duf4Shfn.js";function At(e,t,r){const s=t?(e??[]).filter(l=>l.task_id===t):e??[],a=s.filter(l=>l.is_open===!1),i=a.reduce((l,c)=>l?(c.best_rank??Number.POSITIVE_INFINITY)<(l.best_rank??Number.POSITIVE_INFINITY)?c:l:c,null);return{visible:r?s.filter(l=>l.is_open!==!1):s,hiddenClosed:a,topHiddenClosed:i}}function et(e){const t=e.length===7?`${e}-01`:e,r=new Date(t).getTime();return Number.isFinite(r)?r:0}const Ee=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ne(e){const t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()}}function Pt(e,t){if(e===t){const{year:u,month:p}=Ne(e);return[{timestamp:new Date(u,p,1).getTime(),key:`${u}-${p}`,label:`${Ee[p]} ${u}`}]}const r=Ne(e),s=Ne(t);if(r.year===s.year){const u=s.month-r.month+1;let p=1;const f=12;u>f&&(p=Math.ceil(u/f));const y=[];for(let x=r.month;x<=s.month;x+=p)y.push({timestamp:new Date(r.year,x,1).getTime(),key:`${r.year}-${x}`,label:u<=3?`${Ee[x]} ${r.year}`:Ee[x]});return y}const a=s.year-r.year+1;let i=1;const l=12;a>l&&(i=Math.ceil(a/l));const c=[];for(let u=r.year;u<=s.year;u+=i)c.push({timestamp:new Date(u,0,1).getTime(),key:String(u),label:String(u)});return c}const Dt=({points:e,metric:t})=>{const r=jt(),[s,a]=w.useState(null),i=880,l=320,c=60,u=30,p=40,f=50,y=e.map(o=>o.value),x=Math.min(...y),U=Math.max(...y)-x||1,le=i-c-u,I=l-p-f,T=e.map(o=>et(o.date)),K=Math.min(...T),A=Math.max(...T),ce=A-K||1,J=o=>K===A?c+le/2:c+(o-K)/ce*le,G=e.map((o,m)=>{const k=J(et(o.date)),v=(o.value-x)/U,F=p+I*(1-v);return{x:k,y:F,data:o,idx:m}}),R=G.filter(o=>o.data.isSota);let q="";if(R.length>=2){q=`M${R[0].x},${R[0].y}`;for(let o=1;o{const m=o.data.modelName||o.data.paperTitle||"";if(!m)return null;const k=m.length>22?m.slice(0,21)+"…":m,v=k.length*V;let F=o.x-v/2,E=o.x+v/2,O="middle";return Fi-u&&(E=i-u,F=E-v,O="end"),{x:O==="start"?c:O==="end"?i-u:o.x,y:o.y-Z,text:k,anchor:O,left:F,right:E}},oe=[],b=R.length>0?B(R[R.length-1]):null;let ke=-1/0;for(let o=0;ob.left-he||(ke=m.right,oe.push({x:m.x,y:m.y,text:m.text,anchor:m.anchor})))}b&&oe.push({x:b.x,y:b.y,text:b.text,anchor:b.anchor});const Q=Pt(K,A),W=5,de=o=>a(m=>m===o?null:m),ue=o=>{o&&r(`/paper/${o}`)},fe=(o,m)=>{const v=`${o.data.modelName||o.data.paperTitle||"Unknown model"}: ${ie(o.data.value)} on ${o.data.dateLabel}`,F=!!o.data.paperRouteId;return n.jsxs("g",{children:[m,n.jsx("circle",{cx:o.x,cy:o.y,r:"10",fill:"transparent",style:{cursor:F?"pointer":"default",outline:"none"},tabIndex:0,role:F?"link":"img","aria-label":v,onMouseEnter:()=>a(o.idx),onMouseLeave:()=>de(o.idx),onFocus:()=>a(o.idx),onBlur:()=>de(o.idx),onClick:()=>ue(o.data.paperRouteId),onKeyDown:E=>{F&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),ue(o.data.paperRouteId))},children:n.jsx("title",{children:v})})]},o.idx)};return n.jsxs("svg",{width:"100%",viewBox:`0 0 ${i} ${l}`,style:{display:"block"},children:[n.jsx("text",{x:c-38,y:p+I/2,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-faint)",textAnchor:"middle",transform:`rotate(-90 ${c-38} ${p+I/2})`,children:t}),Array.from({length:W}).map((o,m)=>{const k=m/(W-1),v=p+I*(1-k),F=x+U*k;return n.jsxs("g",{children:[n.jsx("line",{x1:c,y1:v,x2:i-u,y2:v,stroke:"var(--hairline)",strokeWidth:"1"}),n.jsx("text",{x:c-10,y:v+4,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-faint)",textAnchor:"end",children:ie(F)})]},m)}),Q.map(o=>{const m=J(o.timestamp);return n.jsx("text",{x:m,y:l-f+18,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-soft)",textAnchor:"middle",children:o.label},o.key)}),G.filter(o=>!o.data.isSota).map(o=>{const m=s===o.idx;return fe(o,n.jsx("circle",{cx:o.x,cy:o.y,r:m?3:2,fill:"var(--ink-faint)",opacity:m?1:.45,style:{transition:"r 0.12s ease, opacity 0.12s ease"}}))}),q&&n.jsx("path",{d:q,stroke:"var(--accent)",strokeWidth:"2",fill:"none",strokeLinejoin:"round",strokeLinecap:"round"}),R.map(o=>{const m=s===o.idx;return fe(o,n.jsx("circle",{cx:o.x,cy:o.y,r:m?4.5:3,fill:m?"var(--accent)":"var(--bg-elevated)",stroke:"var(--accent)",strokeWidth:"1.5",style:{transition:"r 0.12s ease, fill 0.12s ease"}}))}),oe.map((o,m)=>n.jsx("text",{x:o.x,y:o.y,fontSize:"9.5",fontFamily:"var(--mono)",fill:"var(--ink-soft)",textAnchor:o.anchor,pointerEvents:"none",style:{paintOrder:"stroke",stroke:"var(--bg-elevated)",strokeWidth:3,strokeLinejoin:"round"},children:o.text},`label-${m}`)),s!==null&&G[s]&&(()=>{const o=G[s],m=o.data.modelName||o.data.paperTitle||"Unknown model",v=`${m.length>40?m.slice(0,39)+"…":m}: ${ie(o.data.value)}`,E=Math.max(120,Math.min(340,v.length*6.6+24)),O=30;let S=o.x-E/2;Si-u&&(S=i-u-E);const j=o.y-O-14>=p?o.y-O-12:o.y+12;return n.jsxs("g",{pointerEvents:"none",children:[n.jsx("rect",{x:S,y:j,width:E,height:O,rx:"6",ry:"6",fill:"var(--bg-elevated)",stroke:"var(--hairline-strong)",strokeWidth:"1",style:{filter:"drop-shadow(0 2px 6px rgba(0,0,0,0.08))"}}),n.jsx("text",{x:S+12,y:j+19,fontSize:"12",fontFamily:"var(--sans)",fill:"var(--ink)",fontWeight:500,children:v})]})})()]})};function Bt(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const r=document.implementation.createHTMLDocument(),s=r.createElement("base"),a=r.createElement("a");return r.head.appendChild(s),r.body.appendChild(a),t&&(s.href=t),a.href=e,a.href}const Ht=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function z(e){const t=[];for(let r=0,s=e.length;rH||e.height>H)&&(e.width>H&&e.height>H?e.width>e.height?(e.height*=H/e.width,e.width=H):(e.width*=H/e.height,e.height=H):e.width>H?(e.height*=H/e.width,e.width=H):(e.width*=H/e.height,e.height=H))}function Wt(e,t={}){return e.toBlob?new Promise(r=>{e.toBlob(r,t.type?t.type:"image/png",t.quality?t.quality:1)}):new Promise(r=>{const s=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(",")[1]),a=s.length,i=new Uint8Array(a);for(let l=0;l{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>t(s))})},s.onerror=r,s.crossOrigin="anonymous",s.decoding="async",s.src=e})}async function zt(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Kt(e,t,r){const s="http://www.w3.org/2000/svg",a=document.createElementNS(s,"svg"),i=document.createElementNS(s,"foreignObject");return a.setAttribute("width",`${t}`),a.setAttribute("height",`${r}`),a.setAttribute("viewBox",`0 0 ${t} ${r}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),a.appendChild(i),i.appendChild(e),zt(a)}const D=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||D(r,t)};function Gt(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Qt(e,t){return ut(t).map(r=>{const s=e.getPropertyValue(r),a=e.getPropertyPriority(r);return`${r}: ${s}${a?" !important":""};`}).join(" ")}function Xt(e,t,r,s){const a=`.${e}:${t}`,i=r.cssText?Gt(r):Qt(r,s);return document.createTextNode(`${a}{${i}}`)}function tt(e,t,r,s){const a=window.getComputedStyle(e,r),i=a.getPropertyValue("content");if(i===""||i==="none")return;const l=Ht();try{t.className=`${t.className} ${l}`}catch{return}const c=document.createElement("style");c.appendChild(Xt(l,r,a,s)),t.appendChild(c)}function Yt(e,t,r){tt(e,t,":before",r),tt(e,t,":after",r)}const rt="application/font-woff",st="image/jpeg",Jt={woff:rt,woff2:rt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:st,jpeg:st,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Zt(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function Fe(e){const t=Zt(e).toLowerCase();return Jt[t]||""}function er(e){return e.split(/,/)[1]}function $e(e){return e.search(/^(data:)/)!==-1}function tr(e,t){return`data:${t};base64,${e}`}async function ht(e,t,r){const s=await fetch(e,t);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const a=await s.blob();return new Promise((i,l)=>{const c=new FileReader;c.onerror=l,c.onloadend=()=>{try{i(r({res:s,result:c.result}))}catch(u){l(u)}},c.readAsDataURL(a)})}const Re={};function rr(e,t,r){let s=e.replace(/\?.*/,"");return r&&(s=e),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),t?`[${t}]${s}`:s}async function Me(e,t,r){const s=rr(e,t,r.includeQueryParams);if(Re[s]!=null)return Re[s];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let a;try{const i=await ht(e,r.fetchRequestInit,({res:l,result:c})=>(t||(t=l.headers.get("Content-Type")||""),er(c)));a=tr(i,t)}catch(i){a=r.imagePlaceholder||"";let l=`Failed to fetch resource: ${e}`;i&&(l=typeof i=="string"?i:i.message),l&&console.warn(l)}return Re[s]=a,a}async function sr(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):je(t)}async function nr(e,t){if(e.currentSrc){const i=document.createElement("canvas"),l=i.getContext("2d");i.width=e.clientWidth,i.height=e.clientHeight,l==null||l.drawImage(e,0,0,i.width,i.height);const c=i.toDataURL();return je(c)}const r=e.poster,s=Fe(r),a=await Me(r,s,t);return je(a)}async function ar(e,t){var r;try{if(!((r=e==null?void 0:e.contentDocument)===null||r===void 0)&&r.body)return await _e(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function ir(e,t){return D(e,HTMLCanvasElement)?sr(e):D(e,HTMLVideoElement)?nr(e,t):D(e,HTMLIFrameElement)?ar(e,t):e.cloneNode(ft(e))}const lr=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",ft=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function cr(e,t,r){var s,a;if(ft(t))return t;let i=[];return lr(e)&&e.assignedNodes?i=z(e.assignedNodes()):D(e,HTMLIFrameElement)&&(!((s=e.contentDocument)===null||s===void 0)&&s.body)?i=z(e.contentDocument.body.childNodes):i=z(((a=e.shadowRoot)!==null&&a!==void 0?a:e).childNodes),i.length===0||D(e,HTMLVideoElement)||await i.reduce((l,c)=>l.then(()=>_e(c,r)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function or(e,t,r){const s=t.style;if(!s)return;const a=window.getComputedStyle(e);a.cssText?(s.cssText=a.cssText,s.transformOrigin=a.transformOrigin):ut(r).forEach(i=>{let l=a.getPropertyValue(i);i==="font-size"&&l.endsWith("px")&&(l=`${Math.floor(parseFloat(l.substring(0,l.length-2)))-.1}px`),D(e,HTMLIFrameElement)&&i==="display"&&l==="inline"&&(l="block"),i==="d"&&t.getAttribute("d")&&(l=`path(${t.getAttribute("d")})`),s.setProperty(i,l,a.getPropertyPriority(i))})}function dr(e,t){D(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),D(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function ur(e,t){if(D(e,HTMLSelectElement)){const r=t,s=Array.from(r.children).find(a=>e.value===a.getAttribute("value"));s&&s.setAttribute("selected","")}}function mr(e,t,r){return D(t,Element)&&(or(e,t,r),Yt(e,t,r),dr(e,t),ur(e,t)),t}async function hr(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const s={};for(let i=0;iir(s,t)).then(s=>cr(e,s,t)).then(s=>mr(e,s,t)).then(s=>hr(s,t))}const pt=/url\((['"]?)([^'"]+?)\1\)/g,fr=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,pr=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function gr(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function xr(e){const t=[];return e.replace(pt,(r,s,a)=>(t.push(a),r)),t.filter(r=>!$e(r))}async function br(e,t,r,s,a){try{const i=r?Bt(t,r):t,l=Fe(t);let c;return a||(c=await Me(i,l,s)),e.replace(gr(t),`$1${c}$3`)}catch{}return e}function yr(e,{preferredFontFormat:t}){return t?e.replace(pr,r=>{for(;;){const[s,,a]=fr.exec(r)||[];if(!a)return"";if(a===t)return`src: ${s};`}}):e}function gt(e){return e.search(pt)!==-1}async function xt(e,t,r){if(!gt(e))return e;const s=yr(e,r);return xr(s).reduce((i,l)=>i.then(c=>br(c,l,t,r)),Promise.resolve(s))}async function ne(e,t,r){var s;const a=(s=t.style)===null||s===void 0?void 0:s.getPropertyValue(e);if(a){const i=await xt(a,null,r);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function wr(e,t){await ne("background",e,t)||await ne("background-image",e,t),await ne("mask",e,t)||await ne("-webkit-mask",e,t)||await ne("mask-image",e,t)||await ne("-webkit-mask-image",e,t)}async function vr(e,t){const r=D(e,HTMLImageElement);if(!(r&&!$e(e.src))&&!(D(e,SVGImageElement)&&!$e(e.href.baseVal)))return;const s=r?e.src:e.href.baseVal,a=await Me(s,Fe(s),t);await new Promise((i,l)=>{e.onload=i,e.onerror=t.onImageErrorHandler?(...u)=>{try{i(t.onImageErrorHandler(...u))}catch(p){l(p)}}:l;const c=e;c.decode&&(c.decode=i),c.loading==="lazy"&&(c.loading="eager"),r?(e.srcset="",e.src=a):e.href.baseVal=a})}async function jr(e,t){const s=z(e.childNodes).map(a=>bt(a,t));await Promise.all(s).then(()=>e)}async function bt(e,t){D(e,Element)&&(await wr(e,t),await vr(e,t),await jr(e,t))}function _r(e,t){const{style:r}=e;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const s=t.style;return s!=null&&Object.keys(s).forEach(a=>{r[a]=s[a]}),e}const nt={};async function at(e){let t=nt[e];if(t!=null)return t;const s=await(await fetch(e)).text();return t={url:e,cssText:s},nt[e]=t,t}async function it(e,t){let r=e.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,i=(r.match(/url\([^)]+\)/g)||[]).map(async l=>{let c=l.replace(s,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),ht(c,t.fetchRequestInit,({result:u})=>(r=r.replace(l,`url(${u})`),[l,u]))});return Promise.all(i).then(()=>r)}function lt(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let s=e.replace(r,"");const a=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const u=a.exec(s);if(u===null)break;t.push(u[0])}s=s.replace(a,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,l="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(l,"gi");for(;;){let u=i.exec(s);if(u===null){if(u=c.exec(s),u===null)break;i.lastIndex=c.lastIndex}else c.lastIndex=i.lastIndex;t.push(u[0])}return t}async function kr(e,t){const r=[],s=[];return e.forEach(a=>{if("cssRules"in a)try{z(a.cssRules||[]).forEach((i,l)=>{if(i.type===CSSRule.IMPORT_RULE){let c=l+1;const u=i.href,p=at(u).then(f=>it(f,t)).then(f=>lt(f).forEach(y=>{try{a.insertRule(y,y.startsWith("@import")?c+=1:a.cssRules.length)}catch(x){console.error("Error inserting rule from remote css",{rule:y,error:x})}})).catch(f=>{console.error("Error loading remote css",f.toString())});s.push(p)}})}catch(i){const l=e.find(c=>c.href==null)||document.styleSheets[0];a.href!=null&&s.push(at(a.href).then(c=>it(c,t)).then(c=>lt(c).forEach(u=>{l.insertRule(u,l.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",i)}}),Promise.all(s).then(()=>(e.forEach(a=>{if("cssRules"in a)try{z(a.cssRules||[]).forEach(i=>{r.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${a.href}`,i)}}),r))}function Sr(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>gt(t.style.getPropertyValue("src")))}async function Cr(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=z(e.ownerDocument.styleSheets),s=await kr(r,t);return Sr(s)}function yt(e){return e.trim().replace(/["']/g,"")}function Er(e){const t=new Set;function r(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(i=>{t.add(yt(i))}),Array.from(s.children).forEach(i=>{i instanceof HTMLElement&&r(i)})}return r(e),t}async function Nr(e,t){const r=await Cr(e,t),s=Er(e);return(await Promise.all(r.filter(i=>s.has(yt(i.style.fontFamily))).map(i=>{const l=i.parentStyleSheet?i.parentStyleSheet.href:null;return xt(i.cssText,l,t)}))).join(` +import{u as jt,r as w,j as n,s as ie,e as _t,c as kt,a as St,f as Ct,L as te}from"./index-D_-UZEuL.js";import{u as Y}from"./useQuery-BZo4MZ3s.js";import{c as re}from"./catalog-CjU2vAfw.js";import{C as Et,E as Nt,e as Rt}from"./ExternalSourceEvalBadge-25ezslre.js";import{S as be}from"./skeleton-CCZ1iXls.js";import{S as Ze}from"./switch-giaX-T5P.js";import{A as $t,a as Tt}from"./alert-B2j1kc2o.js";import{L as we}from"./LatexTitle-B7GPgo8C.js";import{B as Ft}from"./BenchmarkTrendSparkline-XIo_GVud.js";import{I as Mt}from"./components-CmC5jqhM.js";import{s as Lt}from"./safeExternalHref-CkBrsh84.js";import{s as It}from"./slug-BpH-Nkvz.js";import"./papers-DHqjKX7p.js";import"./hover-card-DiJQFgx9.js";import"./index-DlwDDz8H.js";import"./katex.min-BSBacQyE.js";import"./transform-CUuA-koJ.js";function At(e,t,r){const s=t?(e??[]).filter(l=>l.task_id===t):e??[],a=s.filter(l=>l.is_open===!1),i=a.reduce((l,c)=>l?(c.best_rank??Number.POSITIVE_INFINITY)<(l.best_rank??Number.POSITIVE_INFINITY)?c:l:c,null);return{visible:r?s.filter(l=>l.is_open!==!1):s,hiddenClosed:a,topHiddenClosed:i}}function et(e){const t=e.length===7?`${e}-01`:e,r=new Date(t).getTime();return Number.isFinite(r)?r:0}const Ee=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ne(e){const t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()}}function Pt(e,t){if(e===t){const{year:u,month:p}=Ne(e);return[{timestamp:new Date(u,p,1).getTime(),key:`${u}-${p}`,label:`${Ee[p]} ${u}`}]}const r=Ne(e),s=Ne(t);if(r.year===s.year){const u=s.month-r.month+1;let p=1;const f=12;u>f&&(p=Math.ceil(u/f));const y=[];for(let x=r.month;x<=s.month;x+=p)y.push({timestamp:new Date(r.year,x,1).getTime(),key:`${r.year}-${x}`,label:u<=3?`${Ee[x]} ${r.year}`:Ee[x]});return y}const a=s.year-r.year+1;let i=1;const l=12;a>l&&(i=Math.ceil(a/l));const c=[];for(let u=r.year;u<=s.year;u+=i)c.push({timestamp:new Date(u,0,1).getTime(),key:String(u),label:String(u)});return c}const Dt=({points:e,metric:t})=>{const r=jt(),[s,a]=w.useState(null),i=880,l=320,c=60,u=30,p=40,f=50,y=e.map(o=>o.value),x=Math.min(...y),U=Math.max(...y)-x||1,le=i-c-u,I=l-p-f,T=e.map(o=>et(o.date)),K=Math.min(...T),A=Math.max(...T),ce=A-K||1,J=o=>K===A?c+le/2:c+(o-K)/ce*le,G=e.map((o,m)=>{const k=J(et(o.date)),v=(o.value-x)/U,F=p+I*(1-v);return{x:k,y:F,data:o,idx:m}}),R=G.filter(o=>o.data.isSota);let q="";if(R.length>=2){q=`M${R[0].x},${R[0].y}`;for(let o=1;o{const m=o.data.modelName||o.data.paperTitle||"";if(!m)return null;const k=m.length>22?m.slice(0,21)+"…":m,v=k.length*V;let F=o.x-v/2,E=o.x+v/2,O="middle";return Fi-u&&(E=i-u,F=E-v,O="end"),{x:O==="start"?c:O==="end"?i-u:o.x,y:o.y-Z,text:k,anchor:O,left:F,right:E}},oe=[],b=R.length>0?B(R[R.length-1]):null;let ke=-1/0;for(let o=0;ob.left-he||(ke=m.right,oe.push({x:m.x,y:m.y,text:m.text,anchor:m.anchor})))}b&&oe.push({x:b.x,y:b.y,text:b.text,anchor:b.anchor});const Q=Pt(K,A),W=5,de=o=>a(m=>m===o?null:m),ue=o=>{o&&r(`/paper/${o}`)},fe=(o,m)=>{const v=`${o.data.modelName||o.data.paperTitle||"Unknown model"}: ${ie(o.data.value)} on ${o.data.dateLabel}`,F=!!o.data.paperRouteId;return n.jsxs("g",{children:[m,n.jsx("circle",{cx:o.x,cy:o.y,r:"10",fill:"transparent",style:{cursor:F?"pointer":"default",outline:"none"},tabIndex:0,role:F?"link":"img","aria-label":v,onMouseEnter:()=>a(o.idx),onMouseLeave:()=>de(o.idx),onFocus:()=>a(o.idx),onBlur:()=>de(o.idx),onClick:()=>ue(o.data.paperRouteId),onKeyDown:E=>{F&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),ue(o.data.paperRouteId))},children:n.jsx("title",{children:v})})]},o.idx)};return n.jsxs("svg",{width:"100%",viewBox:`0 0 ${i} ${l}`,style:{display:"block"},children:[n.jsx("text",{x:c-38,y:p+I/2,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-faint)",textAnchor:"middle",transform:`rotate(-90 ${c-38} ${p+I/2})`,children:t}),Array.from({length:W}).map((o,m)=>{const k=m/(W-1),v=p+I*(1-k),F=x+U*k;return n.jsxs("g",{children:[n.jsx("line",{x1:c,y1:v,x2:i-u,y2:v,stroke:"var(--hairline)",strokeWidth:"1"}),n.jsx("text",{x:c-10,y:v+4,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-faint)",textAnchor:"end",children:ie(F)})]},m)}),Q.map(o=>{const m=J(o.timestamp);return n.jsx("text",{x:m,y:l-f+18,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-soft)",textAnchor:"middle",children:o.label},o.key)}),G.filter(o=>!o.data.isSota).map(o=>{const m=s===o.idx;return fe(o,n.jsx("circle",{cx:o.x,cy:o.y,r:m?3:2,fill:"var(--ink-faint)",opacity:m?1:.45,style:{transition:"r 0.12s ease, opacity 0.12s ease"}}))}),q&&n.jsx("path",{d:q,stroke:"var(--accent)",strokeWidth:"2",fill:"none",strokeLinejoin:"round",strokeLinecap:"round"}),R.map(o=>{const m=s===o.idx;return fe(o,n.jsx("circle",{cx:o.x,cy:o.y,r:m?4.5:3,fill:m?"var(--accent)":"var(--bg-elevated)",stroke:"var(--accent)",strokeWidth:"1.5",style:{transition:"r 0.12s ease, fill 0.12s ease"}}))}),oe.map((o,m)=>n.jsx("text",{x:o.x,y:o.y,fontSize:"9.5",fontFamily:"var(--mono)",fill:"var(--ink-soft)",textAnchor:o.anchor,pointerEvents:"none",style:{paintOrder:"stroke",stroke:"var(--bg-elevated)",strokeWidth:3,strokeLinejoin:"round"},children:o.text},`label-${m}`)),s!==null&&G[s]&&(()=>{const o=G[s],m=o.data.modelName||o.data.paperTitle||"Unknown model",v=`${m.length>40?m.slice(0,39)+"…":m}: ${ie(o.data.value)}`,E=Math.max(120,Math.min(340,v.length*6.6+24)),O=30;let S=o.x-E/2;Si-u&&(S=i-u-E);const j=o.y-O-14>=p?o.y-O-12:o.y+12;return n.jsxs("g",{pointerEvents:"none",children:[n.jsx("rect",{x:S,y:j,width:E,height:O,rx:"6",ry:"6",fill:"var(--bg-elevated)",stroke:"var(--hairline-strong)",strokeWidth:"1",style:{filter:"drop-shadow(0 2px 6px rgba(0,0,0,0.08))"}}),n.jsx("text",{x:S+12,y:j+19,fontSize:"12",fontFamily:"var(--sans)",fill:"var(--ink)",fontWeight:500,children:v})]})})()]})};function Bt(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const r=document.implementation.createHTMLDocument(),s=r.createElement("base"),a=r.createElement("a");return r.head.appendChild(s),r.body.appendChild(a),t&&(s.href=t),a.href=e,a.href}const Ht=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function z(e){const t=[];for(let r=0,s=e.length;rH||e.height>H)&&(e.width>H&&e.height>H?e.width>e.height?(e.height*=H/e.width,e.width=H):(e.width*=H/e.height,e.height=H):e.width>H?(e.height*=H/e.width,e.width=H):(e.width*=H/e.height,e.height=H))}function Wt(e,t={}){return e.toBlob?new Promise(r=>{e.toBlob(r,t.type?t.type:"image/png",t.quality?t.quality:1)}):new Promise(r=>{const s=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(",")[1]),a=s.length,i=new Uint8Array(a);for(let l=0;l{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>t(s))})},s.onerror=r,s.crossOrigin="anonymous",s.decoding="async",s.src=e})}async function zt(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Kt(e,t,r){const s="http://www.w3.org/2000/svg",a=document.createElementNS(s,"svg"),i=document.createElementNS(s,"foreignObject");return a.setAttribute("width",`${t}`),a.setAttribute("height",`${r}`),a.setAttribute("viewBox",`0 0 ${t} ${r}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),a.appendChild(i),i.appendChild(e),zt(a)}const D=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||D(r,t)};function Gt(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Qt(e,t){return ut(t).map(r=>{const s=e.getPropertyValue(r),a=e.getPropertyPriority(r);return`${r}: ${s}${a?" !important":""};`}).join(" ")}function Xt(e,t,r,s){const a=`.${e}:${t}`,i=r.cssText?Gt(r):Qt(r,s);return document.createTextNode(`${a}{${i}}`)}function tt(e,t,r,s){const a=window.getComputedStyle(e,r),i=a.getPropertyValue("content");if(i===""||i==="none")return;const l=Ht();try{t.className=`${t.className} ${l}`}catch{return}const c=document.createElement("style");c.appendChild(Xt(l,r,a,s)),t.appendChild(c)}function Yt(e,t,r){tt(e,t,":before",r),tt(e,t,":after",r)}const rt="application/font-woff",st="image/jpeg",Jt={woff:rt,woff2:rt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:st,jpeg:st,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Zt(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function Fe(e){const t=Zt(e).toLowerCase();return Jt[t]||""}function er(e){return e.split(/,/)[1]}function $e(e){return e.search(/^(data:)/)!==-1}function tr(e,t){return`data:${t};base64,${e}`}async function ht(e,t,r){const s=await fetch(e,t);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const a=await s.blob();return new Promise((i,l)=>{const c=new FileReader;c.onerror=l,c.onloadend=()=>{try{i(r({res:s,result:c.result}))}catch(u){l(u)}},c.readAsDataURL(a)})}const Re={};function rr(e,t,r){let s=e.replace(/\?.*/,"");return r&&(s=e),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),t?`[${t}]${s}`:s}async function Me(e,t,r){const s=rr(e,t,r.includeQueryParams);if(Re[s]!=null)return Re[s];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let a;try{const i=await ht(e,r.fetchRequestInit,({res:l,result:c})=>(t||(t=l.headers.get("Content-Type")||""),er(c)));a=tr(i,t)}catch(i){a=r.imagePlaceholder||"";let l=`Failed to fetch resource: ${e}`;i&&(l=typeof i=="string"?i:i.message),l&&console.warn(l)}return Re[s]=a,a}async function sr(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):je(t)}async function nr(e,t){if(e.currentSrc){const i=document.createElement("canvas"),l=i.getContext("2d");i.width=e.clientWidth,i.height=e.clientHeight,l==null||l.drawImage(e,0,0,i.width,i.height);const c=i.toDataURL();return je(c)}const r=e.poster,s=Fe(r),a=await Me(r,s,t);return je(a)}async function ar(e,t){var r;try{if(!((r=e==null?void 0:e.contentDocument)===null||r===void 0)&&r.body)return await _e(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function ir(e,t){return D(e,HTMLCanvasElement)?sr(e):D(e,HTMLVideoElement)?nr(e,t):D(e,HTMLIFrameElement)?ar(e,t):e.cloneNode(ft(e))}const lr=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",ft=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function cr(e,t,r){var s,a;if(ft(t))return t;let i=[];return lr(e)&&e.assignedNodes?i=z(e.assignedNodes()):D(e,HTMLIFrameElement)&&(!((s=e.contentDocument)===null||s===void 0)&&s.body)?i=z(e.contentDocument.body.childNodes):i=z(((a=e.shadowRoot)!==null&&a!==void 0?a:e).childNodes),i.length===0||D(e,HTMLVideoElement)||await i.reduce((l,c)=>l.then(()=>_e(c,r)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function or(e,t,r){const s=t.style;if(!s)return;const a=window.getComputedStyle(e);a.cssText?(s.cssText=a.cssText,s.transformOrigin=a.transformOrigin):ut(r).forEach(i=>{let l=a.getPropertyValue(i);i==="font-size"&&l.endsWith("px")&&(l=`${Math.floor(parseFloat(l.substring(0,l.length-2)))-.1}px`),D(e,HTMLIFrameElement)&&i==="display"&&l==="inline"&&(l="block"),i==="d"&&t.getAttribute("d")&&(l=`path(${t.getAttribute("d")})`),s.setProperty(i,l,a.getPropertyPriority(i))})}function dr(e,t){D(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),D(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function ur(e,t){if(D(e,HTMLSelectElement)){const r=t,s=Array.from(r.children).find(a=>e.value===a.getAttribute("value"));s&&s.setAttribute("selected","")}}function mr(e,t,r){return D(t,Element)&&(or(e,t,r),Yt(e,t,r),dr(e,t),ur(e,t)),t}async function hr(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const s={};for(let i=0;iir(s,t)).then(s=>cr(e,s,t)).then(s=>mr(e,s,t)).then(s=>hr(s,t))}const pt=/url\((['"]?)([^'"]+?)\1\)/g,fr=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,pr=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function gr(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function xr(e){const t=[];return e.replace(pt,(r,s,a)=>(t.push(a),r)),t.filter(r=>!$e(r))}async function br(e,t,r,s,a){try{const i=r?Bt(t,r):t,l=Fe(t);let c;return a||(c=await Me(i,l,s)),e.replace(gr(t),`$1${c}$3`)}catch{}return e}function yr(e,{preferredFontFormat:t}){return t?e.replace(pr,r=>{for(;;){const[s,,a]=fr.exec(r)||[];if(!a)return"";if(a===t)return`src: ${s};`}}):e}function gt(e){return e.search(pt)!==-1}async function xt(e,t,r){if(!gt(e))return e;const s=yr(e,r);return xr(s).reduce((i,l)=>i.then(c=>br(c,l,t,r)),Promise.resolve(s))}async function ne(e,t,r){var s;const a=(s=t.style)===null||s===void 0?void 0:s.getPropertyValue(e);if(a){const i=await xt(a,null,r);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function wr(e,t){await ne("background",e,t)||await ne("background-image",e,t),await ne("mask",e,t)||await ne("-webkit-mask",e,t)||await ne("mask-image",e,t)||await ne("-webkit-mask-image",e,t)}async function vr(e,t){const r=D(e,HTMLImageElement);if(!(r&&!$e(e.src))&&!(D(e,SVGImageElement)&&!$e(e.href.baseVal)))return;const s=r?e.src:e.href.baseVal,a=await Me(s,Fe(s),t);await new Promise((i,l)=>{e.onload=i,e.onerror=t.onImageErrorHandler?(...u)=>{try{i(t.onImageErrorHandler(...u))}catch(p){l(p)}}:l;const c=e;c.decode&&(c.decode=i),c.loading==="lazy"&&(c.loading="eager"),r?(e.srcset="",e.src=a):e.href.baseVal=a})}async function jr(e,t){const s=z(e.childNodes).map(a=>bt(a,t));await Promise.all(s).then(()=>e)}async function bt(e,t){D(e,Element)&&(await wr(e,t),await vr(e,t),await jr(e,t))}function _r(e,t){const{style:r}=e;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const s=t.style;return s!=null&&Object.keys(s).forEach(a=>{r[a]=s[a]}),e}const nt={};async function at(e){let t=nt[e];if(t!=null)return t;const s=await(await fetch(e)).text();return t={url:e,cssText:s},nt[e]=t,t}async function it(e,t){let r=e.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,i=(r.match(/url\([^)]+\)/g)||[]).map(async l=>{let c=l.replace(s,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),ht(c,t.fetchRequestInit,({result:u})=>(r=r.replace(l,`url(${u})`),[l,u]))});return Promise.all(i).then(()=>r)}function lt(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let s=e.replace(r,"");const a=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const u=a.exec(s);if(u===null)break;t.push(u[0])}s=s.replace(a,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,l="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(l,"gi");for(;;){let u=i.exec(s);if(u===null){if(u=c.exec(s),u===null)break;i.lastIndex=c.lastIndex}else c.lastIndex=i.lastIndex;t.push(u[0])}return t}async function kr(e,t){const r=[],s=[];return e.forEach(a=>{if("cssRules"in a)try{z(a.cssRules||[]).forEach((i,l)=>{if(i.type===CSSRule.IMPORT_RULE){let c=l+1;const u=i.href,p=at(u).then(f=>it(f,t)).then(f=>lt(f).forEach(y=>{try{a.insertRule(y,y.startsWith("@import")?c+=1:a.cssRules.length)}catch(x){console.error("Error inserting rule from remote css",{rule:y,error:x})}})).catch(f=>{console.error("Error loading remote css",f.toString())});s.push(p)}})}catch(i){const l=e.find(c=>c.href==null)||document.styleSheets[0];a.href!=null&&s.push(at(a.href).then(c=>it(c,t)).then(c=>lt(c).forEach(u=>{l.insertRule(u,l.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",i)}}),Promise.all(s).then(()=>(e.forEach(a=>{if("cssRules"in a)try{z(a.cssRules||[]).forEach(i=>{r.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${a.href}`,i)}}),r))}function Sr(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>gt(t.style.getPropertyValue("src")))}async function Cr(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=z(e.ownerDocument.styleSheets),s=await kr(r,t);return Sr(s)}function yt(e){return e.trim().replace(/["']/g,"")}function Er(e){const t=new Set;function r(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(i=>{t.add(yt(i))}),Array.from(s.children).forEach(i=>{i instanceof HTMLElement&&r(i)})}return r(e),t}async function Nr(e,t){const r=await Cr(e,t),s=Er(e);return(await Promise.all(r.filter(i=>s.has(yt(i.style.fontFamily))).map(i=>{const l=i.parentStyleSheet?i.parentStyleSheet.href:null;return xt(i.cssText,l,t)}))).join(` `)}async function Rr(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Nr(e,t);if(r){const s=document.createElement("style"),a=document.createTextNode(r);s.appendChild(a),e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}}async function $r(e,t={}){const{width:r,height:s}=mt(e,t),a=await _e(e,t,!0);return await Rr(a,t),await bt(a,t),_r(a,t),await Kt(a,r,s)}async function Tr(e,t={}){const{width:r,height:s}=mt(e,t),a=await $r(e,t),i=await je(a),l=document.createElement("canvas"),c=l.getContext("2d"),u=t.pixelRatio||qt(),p=t.canvasWidth||r,f=t.canvasHeight||s;return l.width=p*u,l.height=f*u,t.skipAutoScale||Ut(l),l.style.width=`${p}`,l.style.height=`${f}`,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,l.width,l.height)),c.drawImage(i,0,0,l.width,l.height),l}async function Fr(e,t={}){const r=await Tr(e,t);return await Wt(r)}const Te="#ffffff";function Mr(){return typeof window>"u"?Te:window.getComputedStyle(document.documentElement).getPropertyValue("--bg-elevated").trim()||Te}function Lr(e){if(typeof window>"u")return Te;const t=window.getComputedStyle(e).backgroundColor;return!t||t==="rgba(0, 0, 0, 0)"||t==="transparent"?Mr():t}async function Ir(e){var r,s;if(typeof window>"u"||!((s=(r=window.navigator)==null?void 0:r.clipboard)!=null&&s.write))throw new Error("Clipboard image copy is not supported in this browser.");if(typeof window.ClipboardItem>"u")throw new Error("Clipboard image copy is not supported in this browser.");const t=await Fr(e,{pixelRatio:2,cacheBust:!0,backgroundColor:Lr(e)});if(!t)throw new Error("Failed to render screenshot.");await window.navigator.clipboard.write([new window.ClipboardItem({"image/png":t})])}const ct=({targetRef:e,label:t})=>{const{toast:r}=_t(),[s,a]=w.useState("idle"),i=w.useRef(null);w.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const l=w.useCallback(async()=>{const u=e.current;if(u){a("copying"),u.classList.add("is-capturing"),u.offsetHeight,await new Promise(p=>window.requestAnimationFrame(()=>p()));try{await Ir(u),a("copied"),r({title:"Screenshot copied",description:`Image of the ${t} copied to your clipboard.`}),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>a("idle"),1500)}catch(p){a("idle"),r({title:"Copy failed",description:p instanceof Error&&p.message?p.message:"Could not copy the screenshot to your clipboard.",variant:"destructive"})}finally{u.classList.remove("is-capturing")}}},[e,t,r]),c=s==="copied"?"Copied":s==="copying"?"Copying…":"Copy image";return n.jsxs("button",{type:"button",className:"bm-copy-btn",onClick:l,disabled:s==="copying","aria-label":`Copy ${t} screenshot to clipboard`,title:`Copy ${t} screenshot to clipboard`,children:[n.jsx(Mt,{name:"copy",size:11}),c]})};function ae(e){if(e==null)return null;if(typeof e=="number")return Number.isFinite(e)?e:null;const t=e.includes("±")?e.split("±")[0].trim():e.trim(),r=parseFloat(t);return Number.isFinite(r)?r:null}function Ar(e){return[e.paper_id,e.task_id,e.dataset_id,e.model_name,e.harness??""].join("|")}function Pr(e){const t=new Map;for(const r of e){const s=Ar(r),a=t.get(s);if(!a){t.set(s,{...r,metrics:{...r.metrics||{}},sourceEvaluationIds:[r.id],ranksByMetric:r.best_metric&&r.best_rank!=null?{[r.best_metric]:r.best_rank}:{}});continue}a.metrics={...a.metrics,...r.metrics||{}},a.sourceEvaluationIds.push(r.id),r.best_metric&&r.best_rank!=null&&(a.ranksByMetric[r.best_metric]=r.best_rank)}return Array.from(t.values())}function ot(e,t){return t?e.id===t||e.sourceEvaluationIds.includes(t):!1}function dt(e,t){return e.ranksByMetric[t]??e.best_rank??9999}function Dr(e,t,r){if(e.length===0)return{points:[],sota:0,sotaModel:""};const s=e.map(f=>{var N;const y=ae((N=f.metrics)==null?void 0:N[t]),x=f.paper_published_date||"";return{eval:f,value:y,date:x}}).filter(f=>f.value!==null&&!!f.date).sort((f,y)=>f.date.localeCompare(y.date)),a=[];let i=null;for(const f of s){const y=i==null?!0:r==="↓"?f.valuei;y&&(i=f.value),a.push({value:f.value,date:f.date,dateLabel:f.date.slice(0,7),modelName:f.eval.model_name||"",paperTitle:f.eval.paper_title||"",paperRouteId:f.eval.paper_arxiv_id||f.eval.paper_id||null,isSota:y})}const c=e.map(f=>{var y;return{eval:f,value:ae((y=f.metrics)==null?void 0:y[t])}}).filter(f=>f.value!==null).sort((f,y)=>r==="↓"?f.value-y.value:y.value-f.value)[0],u=(c==null?void 0:c.value)??0,p=(c==null?void 0:c.eval.model_name)||(c==null?void 0:c.eval.paper_title)||"";return{points:a,sota:u,sotaModel:p}}const Br=5;function Hr(e){if(!e)return null;const t=e.trim(),r=t.match(/^https?:\/\/(?:www\.)?arxiv\.org\/(?:abs|pdf)\/([^/?#]+)/i);if(r!=null&&r[1])return r[1].replace(/\.pdf$/i,"");const s=t.match(/^(?:https?:\/\/(?:www\.)?paperswithcode\.co)?\/paper\/([^/?#]+)/i);return(s==null?void 0:s[1])??null}function ye(e,t){return e?n.jsx(we,{title:e}):t||"—"}const ns=()=>{var Ie,Ae,Pe,De,Be,He,Ve,Oe,qe,Ue,We,ze,Ke;const{datasetSlug:e}=kt(),[t]=St(),r=t.get("task")||void 0,s=t.get("eval")||void 0,{preferences:a,setHideClosedSourceEvals:i}=Ct(),[l,c]=w.useState(void 0),u=w.useRef(null),p=w.useRef(!1),f=w.useRef(null),y=w.useRef(null),x=Y({queryKey:["dataset",e,"with-paper",r,a.hide_closed_source_evals?"open":"all"],queryFn:()=>re.getDatasetBySlug(e,{include_paper:!0,task:r,is_open:a.hide_closed_source_evals?!0:void 0}),enabled:!!e,staleTime:10*60*1e3}),N=Y({queryKey:["dataset-evals",(Ie=x.data)==null?void 0:Ie.id],queryFn:()=>Rt.byDataset(x.data.id),enabled:!!((Ae=x.data)!=null&&Ae.id),staleTime:5*60*1e3}),U=Y({queryKey:["dataset-tasks",(Pe=x.data)==null?void 0:Pe.id],queryFn:()=>re.datasetTasks(x.data.id),enabled:!!((De=x.data)!=null&&De.id),staleTime:10*60*1e3}),le=Y({queryKey:["metric-directions"],queryFn:()=>re.metricDirections(),staleTime:60*60*1e3}),I=w.useMemo(()=>{var d;return!s||!((d=N.data)!=null&&d.length)?null:N.data.find(g=>g.id===s)||null},[s,N.data]),T=w.useMemo(()=>{const d=U.data||[];if(d.length===0)return null;if(I!=null&&I.task_id&&d.some(h=>h.id===I.task_id))return I.task_id;if(r){const h=d.find(C=>C.slug===r);if(h)return h.id}if(d.length===1)return d[0].id;const g=N.data||[];if(g.length>0){const h=new Map;for(const _ of g)h.set(_.task_id,(h.get(_.task_id)||0)+1);let C=null,L=-1;for(const _ of d){const P=h.get(_.id)||0;P>L&&(L=P,C=_.id)}if(C)return C}return d[0].id},[U.data,N.data,r,I]),K=Y({queryKey:["task-benchmark-trends",T,a.hide_closed_source_evals?!0:void 0],queryFn:()=>re.trendingBenchmarks(T,{limit:100,min_recent_papers:0,is_open:a.hide_closed_source_evals?!0:void 0}),enabled:!!T&&!!((Be=x.data)!=null&&Be.id),staleTime:10*60*1e3}),A=w.useMemo(()=>{var d;return(((d=K.data)==null?void 0:d.results)||[]).find(g=>{var h;return g.id===((h=x.data)==null?void 0:h.id)})||null},[K.data,(He=x.data)==null?void 0:He.id]),ce=Y({queryKey:["leaderboard-metrics",(Ve=x.data)==null?void 0:Ve.id,T],queryFn:()=>re.leaderboardMetrics(x.data.id,T),enabled:!!((Oe=x.data)!=null&&Oe.id)&&!!T,staleTime:10*60*1e3}),J=w.useMemo(()=>At(N.data,T,a.hide_closed_source_evals),[N.data,T,a.hide_closed_source_evals]),G=J.visible,R=J.hiddenClosed,q=J.topHiddenClosed,V=w.useMemo(()=>Pr(G),[G]),he=w.useMemo(()=>{const d=new Set;return V.forEach(g=>{g.best_metric&&d.add(g.best_metric),Object.keys(g.metrics||{}).forEach(h=>d.add(h))}),Array.from(d)},[V]),Z=w.useMemo(()=>(ce.data||[]).map(d=>d.metric_name),[ce.data]),B=Z.length?Z:he,oe=w.useMemo(()=>{var C,L;if(V.length===0)return B[0]||"";const d=new Map;for(const _ of V){const P=_.best_metric;!P||ae((C=_.metrics)==null?void 0:C[P])===null||Z.length&&!B.includes(P)||d.set(P,(d.get(P)||0)+1)}let g=null,h=0;for(const[_,P]of d)P>h&&(h=P,g=_);return g||B[0]||((L=V[0])==null?void 0:L.best_metric)||""},[V,B,Z]),b=l||(I==null?void 0:I.best_metric)||oe,Q=(((Ue=(qe=le.data)==null?void 0:qe.directions)==null?void 0:Ue[b])||"higher_is_better")==="lower_is_better"?"↓":"↑",W=w.useMemo(()=>!b||!B.includes(b)?B:[b,...B.filter(d=>d!==b)],[B,b]),de=w.useMemo(()=>W.length===0?b?[b]:[]:W.slice(0,Br),[W,b]),{points:ue,sota:fe,sotaModel:o}=w.useMemo(()=>Dr(V,b,Q),[V,b,Q]),m=(We=x.data)==null?void 0:We.leaderboard_summary,k=N.isSuccess&&U.isSuccess&&le.isSuccess&&(!T||ce.isSuccess),v=k?b:m==null?void 0:m.metric,F=k?fe:m==null?void 0:m.value,E=k?o:m==null?void 0:m.model_name,O=!k&&!m;w.useEffect(()=>{if(p.current||!s||!N.data||N.data.length===0)return;const d=u.current;d&&(p.current=!0,d.scrollIntoView({behavior:"smooth",block:"start"}))},[s,N.data]);const S=w.useMemo(()=>{const d=U.data||[];return T?d.find(g=>g.id===T)||d[0]||null:d[0]||null},[U.data,T]),pe=Y({queryKey:["area",S==null?void 0:S.area_id],queryFn:()=>re.getArea(S.area_id),enabled:!!(S!=null&&S.area_id),staleTime:10*60*1e3});if(x.isLoading)return n.jsxs("div",{className:"page",children:[n.jsx(be,{className:"h-12 w-1/2 mb-6"}),n.jsx(be,{className:"h-64 w-full"})]});if(x.error||!x.data)return n.jsx("div",{className:"page",children:n.jsx($t,{variant:"destructive",children:n.jsx(Tt,{children:"Benchmark not found."})})});const j=x.data,ge=V.slice().sort((d,g)=>{var L,_;const h=ae((L=d.metrics)==null?void 0:L[b]),C=ae((_=g.metrics)==null?void 0:_[b]);return h!==null&&C!==null?Q==="↓"?h-C:C-h:h!==null?-1:C!==null?1:dt(d,b)-dt(g,b)}),Le=!!j.supports_harness,$=s&&ge.find(d=>ot(d,s))||null,M=j.introducing_paper??void 0,me=(M==null?void 0:M.arxiv_id)||(M==null?void 0:M.id)||Hr(j.paper_url),X=(M==null?void 0:M.title)||j.introducing_paper_title||null,ee=((ze=M==null?void 0:M.published)==null?void 0:ze.slice(0,4))||j.introduced_year||null,wt=!!me||!!j.paper_url||!!X,vt=M!=null&&M.arxiv_id||(Ke=j.paper_url)!=null&&Ke.match(/^https?:\/\/(?:www\.)?arxiv\.org\//i)?`arXiv:${me}`:`Paper ${me}`;return n.jsx("div",{className:"page",children:n.jsxs("div",{className:"bm-page",children:[n.jsxs("div",{className:"breadcrumb",children:[n.jsx(te,{to:"/tasks",children:"Tasks"}),pe.data&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"sep",children:"/"}),n.jsx(te,{to:`/tasks#area-${It(pe.data.name)}`,children:pe.data.name})]}),S&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"sep",children:"/"}),n.jsx(te,{to:`/tasks/${S.slug||S.id}`,children:S.name})]}),n.jsx("span",{className:"sep",children:"/"}),n.jsx("span",{style:{color:"var(--accent-text)"},children:j.name})]}),n.jsxs("div",{className:"bm-title-row",children:[n.jsx("h1",{className:"bm-title",children:j.name}),A&&n.jsxs("div",{className:"bm-title-trend","aria-label":`${j.name} reporting trend`,children:[n.jsx(Ft,{history:A.history,benchmarkName:A.name}),n.jsxs("span",{className:"bm-title-trend-summary",children:[n.jsx("strong",{children:A.recent_paper_count})," ",A.recent_paper_count===1?"paper":"papers",A.rate_change==null?A.recent_paper_count>0&&n.jsx("span",{className:"benchmark-trend-change is-new",children:"new"}):n.jsxs("span",{className:`benchmark-trend-change ${A.rate_change>=1?"is-up":"is-down"}`,children:[A.rate_change>=1?"↑":"↓"," ",A.rate_change.toFixed(1),"×"]})]})]})]}),n.jsxs("div",{className:"bm-subtitle",children:[O?n.jsx(be,{className:"h-5 w-64 bm-summary-skeleton","aria-label":"Loading benchmark summary"}):n.jsxs("span",{children:[v&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"metric-tag",children:v}),n.jsx("span",{style:{color:"var(--hairline-strong)",margin:"0 8px"},children:"·"})]}),E?n.jsxs("span",{children:["Best: ",n.jsx("span",{className:"best-name",children:ie(F)})," by ",n.jsx("span",{className:"best-name",style:{fontStyle:"normal"},children:E})]}):n.jsxs("span",{children:[ge.length," evaluations"]})]}),j.hf_url&&n.jsxs("a",{className:"bm-action-btn",href:j.hf_url,target:"_blank",rel:"noopener noreferrer",children:[n.jsx("span",{"aria-hidden":"true",children:"🤗"})," View on Hugging Face"]})]}),j.description&&n.jsx("p",{className:"bm-description",children:j.description}),a.hide_closed_source_evals&&R.length>0&&n.jsxs("div",{className:"bm-hidden-closed-notice",children:[n.jsxs("span",{children:[R.length," closed-source ",R.length===1?"row is":"rows are"," hidden",q!=null&&q.model_name?n.jsxs(n.Fragment,{children:[", including ",n.jsx("strong",{children:q.model_name})]}):null,"."]}),n.jsx("button",{type:"button",className:"bm-hidden-closed-action",onClick:()=>{i(!1)},children:"Show closed-source"})]}),wt&&n.jsxs("div",{className:"method-source",style:{marginTop:0,marginBottom:18},children:[n.jsx("span",{className:"method-source-label",children:"Source"}),me?n.jsxs(te,{to:`/paper/${me}`,target:"_blank",rel:"noopener noreferrer",className:"method-source-link",children:[n.jsx("span",{className:"method-source-title",children:X?n.jsx(we,{title:X}):vt}),ee&&n.jsx("span",{className:"method-source-meta",children:ee})]}):j.paper_url?n.jsxs("a",{href:Lt(j.paper_url)??void 0,target:"_blank",rel:"noopener noreferrer",className:"method-source-link",children:[n.jsx("span",{className:"method-source-title",children:X?n.jsx(we,{title:X}):j.paper_url}),ee&&n.jsx("span",{className:"method-source-meta",children:ee})]}):n.jsxs("div",{className:"method-source-link is-static",children:[n.jsx("span",{className:"method-source-title",children:X?n.jsx(we,{title:X}):null}),ee&&n.jsx("span",{className:"method-source-meta",children:ee})]})]}),ue.filter(d=>d.isSota).length>=2&&n.jsxs("div",{className:"bm-card",ref:f,children:[n.jsxs("div",{className:"bm-card-screenshot-header","aria-hidden":"true",children:[n.jsxs("div",{className:"bm-card-screenshot-title",children:[n.jsx("span",{className:"bm-card-screenshot-eyebrow",children:"Benchmark"}),n.jsx("span",{className:"bm-card-screenshot-name",children:j.name})]}),n.jsxs("div",{className:"bm-card-screenshot-brand",children:[n.jsxs("span",{className:"brand",children:[n.jsx("span",{className:"brand-mark"}),n.jsxs("span",{className:"brand-name",children:["Papers ",n.jsx("em",{children:"With Code"})]})]}),n.jsx("span",{className:"bm-card-screenshot-url",children:"paperswithcode.co"})]})]}),n.jsxs("div",{className:"bm-card-head",children:[n.jsx("div",{className:"bm-card-title",children:"SOTA progression"}),n.jsxs("div",{className:"bm-card-actions",children:[B.length>1&&n.jsxs("label",{className:"bm-view-select",children:[n.jsx("span",{className:"bm-view-select-label",children:"View"}),n.jsx("select",{value:b,onChange:d=>c(d.target.value),children:W.map(d=>n.jsx("option",{value:d,children:d},d))})]}),n.jsxs("label",{className:"bm-closed-toggle",title:"Show or hide evaluations of closed-source models",children:[n.jsx(Ze,{className:"bm-closed-toggle-switch",checked:!a.hide_closed_source_evals,onCheckedChange:d=>{i(!d)},"aria-label":"Show closed-source models"}),n.jsx("span",{className:"bm-closed-toggle-label",children:"Closed-source"})]}),n.jsx(ct,{targetRef:f,label:"SOTA chart"})]})]}),n.jsx("div",{className:"bm-chart-wrap",children:n.jsx(Dt,{points:ue,metric:b})}),n.jsxs("div",{className:"bm-chart-foot",children:[n.jsx("span",{className:"legend-dot"}),"All models over time · highlighted dots track the running best · hover for the model · click to open the paper"]})]}),$&&(()=>{var L,_;const d=$.paper_arxiv_id||$.paper_id,g=$.paper_title||($.paper_arxiv_id?`arXiv:${$.paper_arxiv_id}`:null),h=$.best_metric&&((L=$.metrics)==null?void 0:L[$.best_metric])!==void 0?$.best_metric:b,C=(_=$.metrics)==null?void 0:_[h];return n.jsxs("div",{className:"bm-highlight-banner",role:"status",children:[n.jsx("span",{className:"bm-highlight-dot","aria-hidden":"true"}),n.jsxs("div",{className:"bm-highlight-text",children:[n.jsx("span",{className:"bm-highlight-label",children:"Comparing result"}),n.jsxs("span",{className:"bm-highlight-paper",children:[$.model_name||g||"—",$.harness?` · ${$.harness}`:""]}),n.jsxs("span",{className:"bm-highlight-meta",children:[C!==void 0&&h?n.jsxs(n.Fragment,{children:[h,": ",ie(C),g?" · ":""]}):null,d?n.jsx(te,{to:`/paper/${d}`,children:ye($.paper_title,g)}):ye($.paper_title,g)]})]})]})})(),n.jsxs("div",{className:"bm-card",ref:y,children:[n.jsxs("div",{className:"bm-card-screenshot-header","aria-hidden":"true",children:[n.jsxs("div",{className:"bm-card-screenshot-title",children:[n.jsx("span",{className:"bm-card-screenshot-eyebrow",children:"Benchmark"}),n.jsx("span",{className:"bm-card-screenshot-name",children:j.name})]}),n.jsxs("div",{className:"bm-card-screenshot-brand",children:[n.jsxs("span",{className:"brand",children:[n.jsx("span",{className:"brand-mark"}),n.jsxs("span",{className:"brand-name",children:["Papers ",n.jsx("em",{children:"With Code"})]})]}),n.jsx("span",{className:"bm-card-screenshot-url",children:"paperswithcode.co"})]})]}),n.jsxs("div",{className:"bm-card-head",children:[n.jsx("div",{className:"bm-card-title",children:"Leaderboard"}),n.jsxs("div",{className:"bm-card-actions",children:[B.length>1&&n.jsxs("label",{className:"bm-view-select",children:[n.jsx("span",{className:"bm-view-select-label",children:"View"}),n.jsx("select",{value:b,onChange:d=>c(d.target.value),children:W.map(d=>n.jsx("option",{value:d,children:d},d))})]}),n.jsxs("label",{className:"bm-closed-toggle",title:"Show or hide evaluations of closed-source models",children:[n.jsx(Ze,{className:"bm-closed-toggle-switch",checked:!a.hide_closed_source_evals,onCheckedChange:d=>{i(!d)},"aria-label":"Show closed-source models"}),n.jsx("span",{className:"bm-closed-toggle-label",children:"Closed-source"})]}),n.jsx(ct,{targetRef:y,label:"leaderboard"})]})]}),N.isLoading?n.jsx("div",{style:{padding:16},children:Array.from({length:5}).map((d,g)=>n.jsx(be,{className:"h-10 w-full mb-2"},g))}):ge.length===0?n.jsx("div",{className:"no-results",children:"No evaluations submitted yet."}):n.jsx("div",{className:"bm-table-scroll",children:n.jsxs("table",{className:"bm-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{className:"col-rank",children:"Rank"}),n.jsx("th",{className:"col-model",children:"Model"}),Le&&n.jsx("th",{className:"col-harness",children:"Harness"}),de.map(d=>{const g=d===b;return n.jsx("th",{className:`col-value ${g?"is-active":""}`,"aria-sort":g?Q==="↓"?"ascending":"descending":"none",children:n.jsxs("button",{type:"button",className:"bm-metric-header",onClick:()=>c(d),"aria-pressed":g,title:`Sort by ${d}`,children:[d,g?` ${Q}`:""]})},d)}),n.jsx("th",{className:"col-paper",children:"Paper"}),n.jsx("th",{className:"col-year",children:"Year"})]})}),n.jsx("tbody",{children:(()=>{let d=null,g=0;return ge.map((h,C)=>{var Qe,Xe;const L=ae((Qe=h.metrics)==null?void 0:Qe[b]);let _=null;L!==null&&((d===null||L!==d)&&(g=C+1,d=L),_=g);const P=h.paper_arxiv_id||h.paper_id,Ge=h.paper_title||(h.paper_arxiv_id?`arXiv:${h.paper_arxiv_id}`:null),Se=ot(h,s);return n.jsxs("tr",{ref:Se?u:void 0,className:Se?"is-highlighted":void 0,children:[n.jsx("td",{className:"col-rank",children:_??"—"}),n.jsxs("td",{className:"col-model",children:[Se&&n.jsx("span",{className:"bm-row-marker","aria-hidden":"true"}),h.hf_model_url?n.jsx("a",{href:h.hf_model_url,target:"_blank",rel:"noopener noreferrer",className:"bm-model-link",title:`Open ${h.model_name||"model"} on Hugging Face`,children:h.model_name||"—"}):h.model_name||"—",h.is_open===!1&&n.jsx(Et,{}),(h.external??h.is_external)&&n.jsx(Nt,{sourceUrl:h.source_url||h.external_source_url||h.result_url})]}),Le&&n.jsx("td",{className:"col-harness",children:h.harness||"—"}),de.map(Ce=>{var Je;const Ye=Ce===b,xe=(Je=h.metrics)==null?void 0:Je[Ce];return n.jsx("td",{className:`col-value${Ye?" is-active":""}${Ye&&_===1?" is-best":""}`,children:xe!=null&&xe!==""?ie(xe):"—"},Ce)}),n.jsx("td",{className:"col-paper",children:P?n.jsx(te,{to:`/paper/${P}`,children:ye(h.paper_title,Ge)}):ye(h.paper_title,Ge)}),n.jsx("td",{className:"col-year",children:((Xe=h.paper_published_date)==null?void 0:Xe.slice(0,4))||"—"})]},h.id)})})()})]})})]})]})})};export{ns as default}; diff --git a/assets/BenchmarkTrendSparkline-5roKNW3d.js b/assets/BenchmarkTrendSparkline-XIo_GVud.js similarity index 97% rename from assets/BenchmarkTrendSparkline-5roKNW3d.js rename to assets/BenchmarkTrendSparkline-XIo_GVud.js index e0c735586ca3b909dfdd3e12d7489369bac91def..d5942b45cf537c2b3d504c352cf5c3d94a6f4a08 100644 --- a/assets/BenchmarkTrendSparkline-5roKNW3d.js +++ b/assets/BenchmarkTrendSparkline-XIo_GVud.js @@ -1 +1 @@ -import{r as C,j as t}from"./index-BrhBTT14.js";const g=112,p=42,o=5,m=5,b=new Intl.DateTimeFormat("en",{month:"short",timeZone:"UTC"}),y=(e,d)=>{const r=new Date(`${e}T00:00:00Z`),n=new Date(`${d}T00:00:00Z`);return r.getUTCMonth()===n.getUTCMonth()?`${b.format(r)} ${r.getUTCDate()}–${n.getUTCDate()}`:`${b.format(r)} ${r.getUTCDate()}–${b.format(n)} ${n.getUTCDate()}`},I=({history:e,benchmarkName:d,interactive:r=!1})=>{const[n,x]=C.useState(null),h=e.map(s=>s.paper_count),M=Math.max(1,...h),f=g-o*2,T=p-m*2,v=h.length>1?f/(h.length-1):0,a=h.map((s,c)=>({x:o+v*c,y:m+T-s/M*T})),$=a.map(({x:s,y:c})=>`${s},${c}`).join(" "),_=a.length?`${o},${p-m} ${$} ${a[a.length-1].x},${p-m}`:"",D=h.reduce((s,c)=>s+c,0),u=49,N=14,i=n==null?null:a[n],j=i?Math.min(g-o-u,Math.max(o,i.x-u/2)):0,k=i?i.y>p/2?i.y-N-3:i.y+3:0;return t.jsxs("svg",{className:`benchmark-trend-sparkline${r?" is-interactive":""}`,viewBox:`0 0 ${g} ${p}`,role:r?"group":"img","aria-label":`${d}: ${D} reporting papers across the displayed trend history`,children:[t.jsxs("title",{children:[d,": ",D," reporting papers across the displayed trend history"]}),t.jsx("line",{className:"benchmark-trend-axis",x1:o,y1:p-m,x2:g-o,y2:p-m}),t.jsx("line",{className:"benchmark-trend-axis",x1:o,y1:m,x2:o,y2:p-m}),_&&t.jsx("polygon",{className:"benchmark-trend-area",points:_}),$&&t.jsx("polyline",{className:"benchmark-trend-line",points:$}),r?a.map(({x:s,y:c},l)=>t.jsxs("g",{className:"benchmark-trend-point",tabIndex:0,role:"img","aria-label":`${y(e[l].start_date,e[l].end_date)}: ${e[l].paper_count} ${e[l].paper_count===1?"paper":"papers"}`,onMouseEnter:()=>x(l),onMouseLeave:()=>x(null),onFocus:()=>x(l),onBlur:()=>x(null),children:[t.jsx("circle",{className:"benchmark-trend-point-hit",cx:s,cy:c,r:"5"}),t.jsx("circle",{className:"benchmark-trend-point-mark",cx:s,cy:c,r:"1.8"})]},`${e[l].start_date}-${e[l].end_date}`)):a.length>0&&t.jsx("circle",{className:"benchmark-trend-dot",cx:a[a.length-1].x,cy:a[a.length-1].y,r:"2.6"}),i&&n!=null&&t.jsxs("g",{className:"benchmark-trend-tooltip",pointerEvents:"none",children:[t.jsx("rect",{x:j,y:k,width:u,height:N,rx:"2"}),t.jsx("text",{x:j+3,y:k+5.4,children:y(e[n].start_date,e[n].end_date)}),t.jsxs("text",{className:"benchmark-trend-tooltip-value",x:j+3,y:k+11,children:[e[n].paper_count," ",e[n].paper_count===1?"paper":"papers"]})]})]})};export{I as B}; +import{r as C,j as t}from"./index-D_-UZEuL.js";const g=112,p=42,o=5,m=5,b=new Intl.DateTimeFormat("en",{month:"short",timeZone:"UTC"}),y=(e,d)=>{const r=new Date(`${e}T00:00:00Z`),n=new Date(`${d}T00:00:00Z`);return r.getUTCMonth()===n.getUTCMonth()?`${b.format(r)} ${r.getUTCDate()}–${n.getUTCDate()}`:`${b.format(r)} ${r.getUTCDate()}–${b.format(n)} ${n.getUTCDate()}`},I=({history:e,benchmarkName:d,interactive:r=!1})=>{const[n,x]=C.useState(null),h=e.map(s=>s.paper_count),M=Math.max(1,...h),f=g-o*2,T=p-m*2,v=h.length>1?f/(h.length-1):0,a=h.map((s,c)=>({x:o+v*c,y:m+T-s/M*T})),$=a.map(({x:s,y:c})=>`${s},${c}`).join(" "),_=a.length?`${o},${p-m} ${$} ${a[a.length-1].x},${p-m}`:"",D=h.reduce((s,c)=>s+c,0),u=49,N=14,i=n==null?null:a[n],j=i?Math.min(g-o-u,Math.max(o,i.x-u/2)):0,k=i?i.y>p/2?i.y-N-3:i.y+3:0;return t.jsxs("svg",{className:`benchmark-trend-sparkline${r?" is-interactive":""}`,viewBox:`0 0 ${g} ${p}`,role:r?"group":"img","aria-label":`${d}: ${D} reporting papers across the displayed trend history`,children:[t.jsxs("title",{children:[d,": ",D," reporting papers across the displayed trend history"]}),t.jsx("line",{className:"benchmark-trend-axis",x1:o,y1:p-m,x2:g-o,y2:p-m}),t.jsx("line",{className:"benchmark-trend-axis",x1:o,y1:m,x2:o,y2:p-m}),_&&t.jsx("polygon",{className:"benchmark-trend-area",points:_}),$&&t.jsx("polyline",{className:"benchmark-trend-line",points:$}),r?a.map(({x:s,y:c},l)=>t.jsxs("g",{className:"benchmark-trend-point",tabIndex:0,role:"img","aria-label":`${y(e[l].start_date,e[l].end_date)}: ${e[l].paper_count} ${e[l].paper_count===1?"paper":"papers"}`,onMouseEnter:()=>x(l),onMouseLeave:()=>x(null),onFocus:()=>x(l),onBlur:()=>x(null),children:[t.jsx("circle",{className:"benchmark-trend-point-hit",cx:s,cy:c,r:"5"}),t.jsx("circle",{className:"benchmark-trend-point-mark",cx:s,cy:c,r:"1.8"})]},`${e[l].start_date}-${e[l].end_date}`)):a.length>0&&t.jsx("circle",{className:"benchmark-trend-dot",cx:a[a.length-1].x,cy:a[a.length-1].y,r:"2.6"}),i&&n!=null&&t.jsxs("g",{className:"benchmark-trend-tooltip",pointerEvents:"none",children:[t.jsx("rect",{x:j,y:k,width:u,height:N,rx:"2"}),t.jsx("text",{x:j+3,y:k+5.4,children:y(e[n].start_date,e[n].end_date)}),t.jsxs("text",{className:"benchmark-trend-tooltip-value",x:j+3,y:k+11,children:[e[n].paper_count," ",e[n].paper_count===1?"paper":"papers"]})]})]})};export{I as B}; diff --git a/assets/ChatMessage-CKuWDpNc.js b/assets/ChatMessage-DwVcq3Ve.js similarity index 98% rename from assets/ChatMessage-CKuWDpNc.js rename to assets/ChatMessage-DwVcq3Ve.js index a0d7760c33fb772d22fa603f181cd2af9c0ee50a..a7d07611a4c9bdfde6702be9735f65c34e87d27d 100644 --- a/assets/ChatMessage-CKuWDpNc.js +++ b/assets/ChatMessage-DwVcq3Ve.js @@ -1,4 +1,4 @@ -import{c as $,r as I,j as e,R as p,C as ee}from"./index-BrhBTT14.js";import{u as K,a as V,b as Y,M as te,R as ae,W as se,f as O,A as re,F as ne,G as B,H as ie}from"./chatSessions-Dx6Tu-Jq.js";import"./katex.min-BSBacQyE.js";import{H as D,a as q,b as A}from"./hover-card-BcKGA4Et.js";import{u as oe}from"./useQuery-GhY2LXSI.js";import{f as ce,p as le}from"./github-BtTCuUR0.js";import{G as W}from"./github-XgFsJJRC.js";import{r as de,a as ue,P as X}from"./PaperPreviewLink-BCdZ9yj3.js";import{M as he,r as pe,d as me}from"./index-BLqBUiom.js";import{c as z}from"./chat-Ck3hlrgT.js";import{F as ge}from"./file-text-DROKoLCd.js";/** +import{d as $,r as I,j as e,z as p,C as ee}from"./index-D_-UZEuL.js";import{u as K,a as V,b as Y,M as te,R as ae,W as se,d as O,A as re,F as ne,G as B,H as ie}from"./chatSessions-CPPX7pkh.js";import"./katex.min-BSBacQyE.js";import{H as D,a as q,b as A}from"./hover-card-DiJQFgx9.js";import{u as oe}from"./useQuery-BZo4MZ3s.js";import{f as ce,p as le}from"./github-DQuIliTJ.js";import{G as W}from"./github-iFSl-B6V.js";import{r as de,a as ue,P as X}from"./PaperPreviewLink-B25cD-_k.js";import{M as he,r as pe,d as me}from"./index-vCOH2DKd.js";import{c as z}from"./chat-7zW8PrrA.js";import{F as ge}from"./file-text--vrXMvWb.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/ChatView-CdOXetxL.js b/assets/ChatView-CdOXetxL.js deleted file mode 100644 index bc46e91b95d32bb744f415dc8a8bc18d0a736469..0000000000000000000000000000000000000000 --- a/assets/ChatView-CdOXetxL.js +++ /dev/null @@ -1,16 +0,0 @@ -var xt=Object.defineProperty;var Rt=(e,t,n)=>t in e?xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ke=(e,t,n)=>Rt(e,typeof t!="symbol"?t+"":t,n);import{c as St,A as Et,n as Ct,j as r,r as o,X as Tt,d as ft,e as kt,u as Ot,a as It,f as At,g as jt,h as Nt,b as Lt}from"./index-BrhBTT14.js";import{u as Mt}from"./useQuery-GhY2LXSI.js";import{C as Dt,U as rt,A as Pt}from"./ChatMessage-CKuWDpNc.js";import{c as Ge}from"./chat-Ck3hlrgT.js";import{u as Ft,r as Yt,a as Ut,O as qt,b as Bt}from"./openrouter-DzllS15k.js";import{d as Ht,e as mt,g as Wt,T as Vt,f as pt,h as Gt,i as Kt,j as $t,k as Qt,l as nt,t as gt,r as zt,S as Jt,P as Xt,D as Zt,m as en,C as et,n as Je,o as tn,p as Xe,s as Ze,v as nn,w as rn,x as tt,y as sn}from"./chatSessions-Dx6Tu-Jq.js";import{S as an}from"./chatPrompts-CDY3UGU1.js";import"./katex.min-BSBacQyE.js";import"./hover-card-BcKGA4Et.js";import"./github-BtTCuUR0.js";import"./github-XgFsJJRC.js";import"./PaperPreviewLink-BCdZ9yj3.js";import"./index-BLqBUiom.js";import"./papers-DBaPliAp.js";import"./file-text-DROKoLCd.js";import"./chevron-down-CKySK_lE.js";/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const on=St("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),ee=(e,t)=>new Promise(n=>{const a=setTimeout(s,e);function s(){t==null||t.removeEventListener("abort",s),clearTimeout(a),n()}t==null||t.addEventListener("abort",s)}),_e=e=>({arxiv_id:null,source:"arxiv",source_url:null,thumbnail_url:null,authors:[],published:null,conference:null,citation_count:null,tasks:[],methods:[],repositories:[],project_pages:[],...e}),ve={name:"Object Detection",slug:"object-detection"},Oe={name:"Real-Time Object Detection",slug:"real-time-object-detection"},cn={"2502.12524":{route_id:"2502.12524",title:"YOLOv12: Attention-Centric Real-Time Object Detectors",content:"Enhancing the network architecture of the YOLO framework has been crucial for a long time. This work introduces an attention-centric YOLO framework, namely YOLOv12, built around area attention and residual efficient layer aggregation networks (R-ELAN). YOLOv12-N reaches 40.6 mAP at 1.64 ms on a T4 GPU, closing the gap to attention-based detectors without the usual latency penalty and surpassing YOLOv10/YOLOv11 by +1.2–1.6 mAP at matched latency.",content_truncated:!1,metadata:_e({arxiv_id:"2502.12524",authors:[{name:"Y. Tian"},{name:"Q. Ye"},{name:"D. Doermann"}],published:"2025-02-18",citation_count:412,tasks:[ve,Oe],methods:[{name:"Area Attention",slug:"area-attention"}],repositories:[{url:"https://github.com/sunsmarterjie/yolov12",stars:18700}]})},"2407.17140":{route_id:"2407.17140",title:"RT-DETRv2: Improved Baseline with Bag-of-Freebies for Real-Time Detection",content:"RT-DETRv2 improves the real-time DETR baseline with selective multi-scale feature extraction, a discrete sampling operator to ease deployment, and training-only 'bag-of-freebies' that add no inference cost. RT-DETRv2-R18/R50/R101 reach 47.9 / 53.4 / 54.3 mAP on COCO at 217 / 108 / 74 FPS on T4 TensorRT FP16, remaining NMS-free end to end.",content_truncated:!1,metadata:_e({arxiv_id:"2407.17140",authors:[{name:"W. Lv"},{name:"Y. Zhao"},{name:"J. Chang"}],published:"2024-07-24",citation_count:268,tasks:[ve,Oe],methods:[{name:"DETR",slug:"detr"}],repositories:[{url:"https://github.com/lyuwenyu/RT-DETR",stars:9400}]})},"2410.13842":{route_id:"2410.13842",title:"D-FINE: Redefining Regression as Fine-grained Distribution Refinement",content:"D-FINE reformulates bounding-box regression in DETR-style detectors as iterative refinement of probability distributions (FDR) and adds a localization self-distillation scheme (GO-LSD). D-FINE-L reaches 54.0 mAP at ~9 ms and D-FINE-X 55.8 mAP on COCO while staying real-time on modern GPUs, dominating RT-DETRv2 and YOLOv10 on the accuracy–latency Pareto front.",content_truncated:!1,metadata:_e({arxiv_id:"2410.13842",authors:[{name:"Y. Peng"},{name:"H. Li"},{name:"P. Wu"}],published:"2024-10-17",conference:"ICLR 2025",citation_count:187,tasks:[ve,Oe],methods:[{name:"Knowledge Distillation",slug:"knowledge-distillation"}],repositories:[{url:"https://github.com/Peterande/D-FINE",stars:12100}]})},"2406.03459":{route_id:"2406.03459",title:"LW-DETR: A Transformer Replacement to YOLO for Real-Time Detection",content:"LW-DETR pairs a plain ViT encoder with a lightweight DETR decoder and shows the combination outperforms YOLOv8 and YOLO-NAS at comparable latency, arguing transformer detectors are viable even at the fast end of the accuracy–latency curve. Uses multi-level feature aggregation, window-attention interleaving, and IoU-aware classification.",content_truncated:!1,metadata:_e({arxiv_id:"2406.03459",authors:[{name:"Q. Chen"},{name:"X. Su"},{name:"X. Zhang"}],published:"2024-06-05",citation_count:94,tasks:[ve,Oe],methods:[{name:"Vision Transformer",slug:"vision-transformer"}],repositories:[{url:"https://github.com/Atten4Vis/LW-DETR",stars:5200}]})},"2304.08069":{route_id:"2304.08069",title:"DETRs Beat YOLOs on Real-time Object Detection",content:"RT-DETR is the first real-time end-to-end object detector, built on an efficient hybrid encoder that decouples intra-scale interaction and cross-scale fusion, plus IoU-aware query selection. RT-DETR-R50 achieves 53.1 mAP at 108 FPS on COCO, beating comparably sized YOLO detectors in both speed and accuracy while eliminating NMS entirely; its Figure 1 accuracy–latency plot became the reference for later real-time detectors.",content_truncated:!1,metadata:_e({arxiv_id:"2304.08069",authors:[{name:"Y. Zhao"},{name:"W. Lv"},{name:"S. Xu"}],published:"2023-04-17",conference:"CVPR 2024",citation_count:2310,tasks:[ve,Oe],methods:[{name:"DETR",slug:"detr"}],repositories:[{url:"https://github.com/lyuwenyu/RT-DETR",stars:9400}]})},"2405.14458":{route_id:"2405.14458",title:"YOLOv10: Real-Time End-to-End Object Detection",content:"YOLOv10 removes NMS from the YOLO pipeline via consistent dual assignments during training and applies a holistic efficiency–accuracy driven design across the architecture. YOLOv10-S is 1.8x faster than RT-DETR-R18 at similar COCO accuracy; the family spans 46.3–54.4 mAP with substantially lower end-to-end latency than prior YOLOs because post-processing disappears.",content_truncated:!1,metadata:_e({arxiv_id:"2405.14458",authors:[{name:"A. Wang"},{name:"H. Chen"},{name:"L. Liu"}],published:"2024-05-23",conference:"NeurIPS 2024",citation_count:1650,tasks:[ve,Oe],methods:[{name:"NMS-free Training",slug:"nms-free-training"}],repositories:[{url:"https://github.com/THU-MIG/yolov10",stars:44200}]})},"2401.17270":{route_id:"2401.17270",title:"YOLO-World: Real-Time Open-Vocabulary Object Detection",content:"YOLO-World extends the YOLO paradigm to open-vocabulary detection through vision-language modeling with a re-parameterizable vision-language path aggregation network (RepVL-PAN) and region-text contrastive pretraining. It detects categories never seen at training time while running at 35+ FPS, and its prompt-then-detect deployment re-parameterizes text embeddings for zero runtime text-encoder cost.",content_truncated:!1,metadata:_e({arxiv_id:"2401.17270",authors:[{name:"T. Cheng"},{name:"L. Song"},{name:"Y. Ge"}],published:"2024-01-30",conference:"CVPR 2024",citation_count:890,tasks:[{name:"Open-Vocabulary Object Detection",slug:"open-vocabulary-object-detection"},ve],methods:[{name:"Contrastive Learning",slug:"contrastive-learning"}],repositories:[{url:"https://github.com/AILab-CVC/YOLO-World",stars:16800}]})},158342:{route_id:"158342",title:"Ultralytics YOLO: real-time detection framework and model zoo",content:"Official Ultralytics framework release covering YOLO11 and YOLOv12 deployment: pretrained COCO checkpoints from nano to x-large, TensorRT/ONNX/CoreML export paths, and reproducible latency benchmarks on T4, Jetson Orin, and CPU targets. Widely used as the practical baseline for real-time detection deployments.",content_truncated:!1,metadata:_e({source:"external",source_url:"https://docs.ultralytics.com/models/",authors:[{name:"Ultralytics"}],published:"2025-01-02",tasks:[ve,Oe],repositories:[{url:"https://github.com/ultralytics/ultralytics",stars:46e3}],project_pages:[{url:"https://docs.ultralytics.com"}]})}},yt=e=>e.map(t=>cn[t]),st=yt(["2502.12524","2407.17140","2410.13842","2406.03459","2304.08069","2405.14458","2401.17270","158342"]),at=yt(["2410.13842","2502.12524","2407.17140","2405.14458","2304.08069"]),it="The user wants the current state-of-the-art for real-time object detection. That's a moving target split across two lineages — the YOLO family (fast CNN one-stage detectors) and the DETR family (transformer, end-to-end, NMS-free). I should ground the answer in recent papers benchmarked on COCO with reported latency or FPS, not just accuracy. Let me start with a broad hybrid search, see which papers surface, then run a second, narrower query to pin down the head-to-head COCO mAP vs latency trade-offs before I write anything.",ot="Good — both lineages are well represented. YOLOv12, YOLOv10 and RT-DETRv2 / D-FINE keep coming up. To actually rank them I need the accuracy-vs-latency numbers side by side on the same COCO val2017 protocol, so let me narrow the query to the benchmark comparison specifically.",ct=`There isn't a single winner — real-time object detection in 2026 is a two-horse race between the [YOLO family](paper:2502.12524) (fast one-stage CNNs) and the end-to-end [DETR family](paper:2304.08069) (NMS-free transformers). Which one is “SOTA” depends entirely on where you sit on the accuracy-vs-latency curve. - -**At the fast / edge end**, [YOLOv12](paper:2502.12524) is the current leader. Its area-attention design pushes attention into the YOLO backbone without the usual latency hit — YOLOv12-N reaches 40.6 mAP at ~1.6 ms on a T4, roughly +1.5 mAP over [YOLOv10](paper:2405.14458) at matched speed. [YOLOv10](paper:2405.14458) is still very relevant because it made the YOLO head NMS-free, cutting real end-to-end latency. - -**At the high-accuracy end**, the transformer detectors win. [D-FINE](paper:2410.13842) currently holds the accuracy-latency Pareto front, reporting 55.8 mAP by reformulating box regression as fine-grained distribution refinement with self-distillation. It builds on [RT-DETRv2](paper:2407.17140), which hardened the [original RT-DETR](paper:2304.08069) recipe (the paper that first showed DETRs beating YOLOs in real time) with training-only “bag-of-freebies” that add no inference cost. - -**My recommendation:** for edge or high-FPS deployment, start with [YOLOv12](paper:2502.12524) — the [Ultralytics framework](paper:158342) has ready-made checkpoints and export paths. If you have GPU headroom and want maximum accuracy while staying real-time, use [D-FINE](paper:2410.13842) or [RT-DETRv2](paper:2407.17140). And if you need open-vocabulary detection rather than fixed COCO classes, [YOLO-World](paper:2401.17270) is the one to look at.`,ln=["How do these compare on edge devices like Jetson?","Show me open-vocabulary detectors","What about small-object detection?"];async function*un(e,t){const n=()=>(t==null?void 0:t.aborted)===!0,a=e.trim().slice(0,90)||"state-of-the-art real-time object detection";if(yield{type:"stream_start",request_id:"req_mock",session_id:null},await ee(350,t),!n()){yield{type:"reasoning_start"};for(let s=0;s{const t=String("0").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"},dn=()=>!0;class Ne extends Error{constructor(t,n,a,s){super(t),this.code=n,this.status=a,this.retryAfterSeconds=s,this.name="ChatStreamError"}}function hn(e,t){if(Le())try{Ge.reportLatency(e,t).catch(()=>{})}catch{}}function fn(e,t={}){return Le()?pn(e,t.signal):un(e.message,t.signal)}function mn(e,t={}){return gn(e,t.signal)}async function*pn(e,t){const n=await Ge.stream(e,t);yield*bt(n)}async function*gn(e,t){const n=await Ge.resumeStream(e,t);yield*bt(n)}async function*bt(e){if(!e.ok||!e.body){const s=e.ok?null:new Et(e,await e.text());s&&Ct(s);const d=s==null?void 0:s.detail,l=typeof d=="object"&&d!==null?d:null,m=e.status===403&&!d,h=Number(e.headers.get("Retry-After")),x=Number.isFinite(h)&&h>=0?Math.min(300,Math.ceil(h)):void 0;throw new Ne(m?"Chat on staging is limited to approved Hugging Face users. Sign in with an approved account and try again.":(s==null?void 0:s.message)||`Chat stream failed (${e.status})`,l&&"code"in l&&typeof l.code=="string"?l.code:m?"staging_access_required":void 0,e.status,x)}const t=e.body.getReader(),n=new TextDecoder;let a="";try{for(;;){const{done:s,value:d}=await t.read();if(s)break;a+=n.decode(d,{stream:!0});let l;for(;(l=a.indexOf(` - -`))!==-1;){const m=a.slice(0,l);a=a.slice(l+2);const h=m.split(` -`).filter(x=>x.startsWith("data:")).map(x=>x.slice(5).trimStart()).join(` -`);!h||h==="[DONE]"||(yield JSON.parse(h))}}}finally{t.releaseLock()}}const yn="https://huggingface.co/settings/inference-providers",bn="https://paperswithcode.co/chat",lt="pwc.chat.billing-notice-dismissed.v1";function _n({provider:e}){const[t,n]=o.useState(()=>localStorage.getItem(lt)==="1");return!Le()||t||e!=="huggingface"?null:r.jsxs("div",{className:"chat-billing-notice",role:"note",children:[r.jsx("span",{children:"Hugging Face models use the inference permission granted when you start chatting. Included monthly credits are used first, then extra usage requires purchased credits. You can choose organization billing in Settings."}),r.jsxs("div",{className:"chat-billing-notice-actions",children:[r.jsx("a",{href:"/settings",children:"Review billing"}),r.jsx("a",{href:yn,target:"_blank",rel:"noreferrer",children:"Review usage"}),r.jsx("button",{type:"button",className:"chat-billing-notice-dismiss","aria-label":"Dismiss billing notice",title:"Dismiss",onClick:()=>{localStorage.setItem(lt,"1"),n(!0)},children:r.jsx(Tt,{size:15,"aria-hidden":"true"})})]})]})}function vn({enabled:e,fallbackEnabled:t,byokExpected:n}){const a=Ft(e);if(!e||!a.data)return null;const s=a.data,d=Yt(s.resets_at),l=s.unavailable_reason==="staging_funding_disabled",m=s.unavailable_reason==="shared_credits_exhausted"||s.unavailable_reason==="workspace_limit_exhausted"||s.unavailable_reason==="provider_status_unavailable";return r.jsxs("div",{className:"chat-openrouter-usage",role:"status",children:[r.jsx("span",{children:l?r.jsx("strong",{children:"Chat is now live on paperswithcode.co"}):m?r.jsxs(r.Fragment,{children:[r.jsx("strong",{children:"Shared OpenRouter credits unavailable"})," · ",s.remaining_percent,"% of your allowance remains"]}):r.jsxs(r.Fragment,{children:[r.jsxs("strong",{children:[s.remaining_percent,"% left"]})," this month · resets ",d.local]})}),l?r.jsxs("span",{children:[r.jsx("a",{href:s.production_chat_url||bn,children:"Continue on production"}),t&&" · Your connected OpenRouter key remains available on staging."]}):(!s.available||n)&&r.jsx("span",{children:t?"Your connected OpenRouter key will be used on your next explicit send.":r.jsxs(r.Fragment,{children:[r.jsx("a",{href:"/settings#openrouter-byok",children:"Connect your own key in Settings"})," to continue."]})})]})}function ut({variant:e,composerProps:t,provider:n,openRouterFallbackEnabled:a,byokExpected:s,paused:d,suggestions:l=[]}){var h;const m=r.jsxs(r.Fragment,{children:[r.jsx(_n,{provider:n}),r.jsx(vn,{enabled:n==="openrouter",fallbackEnabled:a,byokExpected:s}),d&&r.jsx("div",{id:"chat-paused-description",className:"chat-paused-banner",role:"status",children:"Chat is temporarily disabled. You can keep browsing and editing your conversations. New research runs will return when chat is restored."}),r.jsx(Dt,{...t,...e==="empty"?{autoFocus:!0}:{placeholder:(h=t.draft)!=null&&h.text?"Edit and send again…":"Ask a follow-up…"}}),e==="empty"&&r.jsx("div",{className:"chat-examples",children:l.map(x=>r.jsx("button",{type:"button",className:"chat-example",disabled:d,onClick:()=>t.onSend({text:x,paperMentions:[]}),children:x},x))})]});return e==="empty"?m:r.jsx("div",{className:"chat-composer-wrap",children:r.jsxs("div",{className:"chat-composer-inner",children:[m,r.jsx("div",{className:"chat-composer-foot",children:Le()?r.jsxs(r.Fragment,{children:[n==="openrouter"?r.jsxs("span",{className:"chat-provider-attribution",children:["Powered by ",r.jsx("a",{href:"https://openrouter.ai",target:"_blank",rel:"noreferrer",children:"OpenRouter"}),"."]}):r.jsxs("span",{className:"chat-provider-attribution",children:["Powered by 🤗 ",r.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"}),"."]}),r.jsx("span",{children:"The AI assistant can make mistakes. Double-check responses."})]}):r.jsx(r.Fragment,{children:"Assistant preview — responses are simulated."})})]})})}function wn({messages:e,papers:t,busy:n,queuedDraft:a,paperMentionsEnabled:s,archivePending:d,openRouterFallbackEnabled:l,onToggleBlock:m,onEditAndResend:h,onArchiveOld:x,onArchiveOldest:D}){var g,y;const[_,k]=o.useState(null),H=o.useRef(null),O=o.useRef(null),E=o.useRef(null);o.useEffect(()=>{n?k(null):E.current=null},[n]),o.useLayoutEffect(()=>{const u=H.current;if(u){if(O.current!==null){u.scrollTop=O.current,O.current=null;return}if(E.current){const q=Array.from(u.querySelectorAll("[data-message-id]")).find(C=>C.dataset.messageId===E.current);if(q){const C=u.getBoundingClientRect(),V=q.getBoundingClientRect();u.scrollTop+=V.top-C.top-24;return}}u.scrollTop=u.scrollHeight}},[e]);const S=e.filter(u=>u.role==="user"),F=(g=S[0])==null?void 0:g.id,ne=(y=S.at(-1))==null?void 0:y.id,j=(u,q)=>{var C;O.current=((C=H.current)==null?void 0:C.scrollTop)??null,m(u,q)};return r.jsx("div",{className:"chat-conversation",ref:H,children:r.jsxs("div",{className:"chat-conversation-inner",children:[e.length===0&&(a==null?void 0:a.text)&&r.jsx(rt,{id:"queued-launch-preview",text:a.text,paperMentions:a.paperMentions,isInitial:!0}),e.map(u=>u.role==="user"?r.jsx(rt,{id:u.id,text:u.text??"",paperMentions:u.paperMentions??[],paperMentionsEnabled:s,isInitial:u.id===F,editingAllowed:!n&&!!u.revision,editing:_===u.id,editNotice:u.id===F?"Sending will replace this conversation.":u.id===ne?"Sending will replace the response.":"Sending will replace the response and all messages after it.",onEdit:()=>k(u.id),onCancel:()=>k(null),onResendDraft:q=>{u.id!==F&&(E.current=u.id);const C=h(u.id,q);return C?k(null):E.current=null,C}},u.id):r.jsx(Pt,{msg:u,papers:t,onToggleBlock:j,onArchiveOldChats:x,onArchiveOldestChats:D,archivePending:d,hfBilling:null,openRouterFallbackEnabled:l,feedbackEnabled:!0},u.id))]})})}function xn({retryAt:e,onRetry:t,onCancel:n}){const[a,s]=o.useState(()=>Math.max(0,Math.ceil((e-Date.now())/1e3))),d=o.useRef(null);return o.useEffect(()=>{var x;const l=document.activeElement instanceof HTMLElement?document.activeElement:null;(x=d.current)==null||x.focus();const m=()=>s(Math.max(0,Math.ceil((e-Date.now())/1e3)));m();const h=window.setInterval(m,250);return()=>{window.clearInterval(h),l==null||l.focus()}},[e]),r.jsx("div",{className:"chat-capacity-dialog-backdrop",role:"presentation",children:r.jsxs("div",{className:"chat-capacity-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-capacity-dialog-title","aria-describedby":"chat-capacity-dialog-description",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),n())},children:[r.jsx("h2",{id:"chat-capacity-dialog-title",children:"All research slots are currently in use"}),r.jsx("p",{id:"chat-capacity-dialog-description",children:"Your message was not sent or billed. Try again in a few seconds."}),r.jsx("p",{className:"chat-capacity-countdown","aria-live":"polite",children:a>0?`Try again available in ${a} second${a===1?"":"s"}.`:"You can try again now."}),r.jsxs("div",{className:"chat-capacity-dialog-actions",children:[r.jsx("button",{type:"button",className:"chat-capacity-cancel",ref:d,onClick:n,children:"Cancel"}),r.jsx("button",{type:"button",className:"chat-capacity-retry",disabled:a>0,onClick:t,children:"Try again"})]})]})})}function Rn({onClose:e}){const t=o.useRef(null);return o.useEffect(()=>{var a;const n=document.activeElement instanceof HTMLElement?document.activeElement:null;return(a=t.current)==null||a.focus(),()=>n==null?void 0:n.focus()},[]),r.jsx("div",{className:"chat-capacity-dialog-backdrop",role:"presentation",children:r.jsxs("div",{className:"chat-capacity-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-disabled-title","aria-describedby":"chat-disabled-description",onKeyDown:n=>{n.key==="Escape"&&(n.preventDefault(),e())},children:[r.jsx("h2",{id:"chat-disabled-title",children:"Chat is temporarily disabled"}),r.jsx("p",{id:"chat-disabled-description",children:"We've temporarily paused new research runs. Your message wasn't sent, and your draft is still here. Please try again later."}),r.jsx("div",{className:"chat-capacity-dialog-actions",children:r.jsx("button",{ref:t,type:"button",className:"chat-capacity-cancel",onClick:e,children:"Keep editing"})})]})})}function Sn({url:e,onClose:t}){return e?r.jsx("div",{className:"chat-share-dialog-backdrop",role:"presentation",onMouseDown:t,children:r.jsxs("div",{className:"chat-share-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-share-dialog-title",onMouseDown:n=>n.stopPropagation(),children:[r.jsx("h2",{id:"chat-share-dialog-title",children:"Public link created"}),r.jsx("p",{children:"Anyone with this link can see this conversation. It could not be copied automatically, so copy it manually:"}),r.jsx("input",{readOnly:!0,value:e,"aria-label":"Public conversation link",autoFocus:!0,onFocus:n=>n.currentTarget.select()}),r.jsx("button",{type:"button",onClick:t,children:"Close"})]})}):null}function En({sessions:e,activeSessionId:t,loading:n,error:a,open:s,onClose:d,onNew:l,onNavigate:m,onRename:h,onDelete:x}){const[D,_]=o.useState(null),[k,H]=o.useState(""),[O,E]=o.useState(null);o.useEffect(()=>{if(!O)return;const j=()=>E(null),g=y=>{y.key==="Escape"&&j()};return window.addEventListener("click",j),window.addEventListener("keydown",g),()=>{window.removeEventListener("click",j),window.removeEventListener("keydown",g)}},[O]);const S=j=>{_(j.id),H(j.title)},F=async j=>{const g=k.trim();g&&await h(j,g)&&_(null)},ne=(j,g,y)=>E({id:j,x:g,y});return r.jsxs("aside",{className:`chat-sidebar${s?"":" chat-sidebar-closed"}`,children:[r.jsxs("div",{className:"chat-sidebar-top",children:[r.jsxs("button",{type:"button",className:"chat-new-chat",onClick:l,children:[r.jsx(Ht,{})," New chat"]}),r.jsx("button",{type:"button",className:"icon-btn",onClick:d,title:"Collapse sidebar",children:r.jsx(mt,{})})]}),r.jsxs("nav",{className:"chat-sessions","aria-label":"Chat history",children:[n&&r.jsx("div",{className:"chat-sessions-empty",children:"Loading chats…"}),!n&&a&&r.jsx("div",{className:"chat-sessions-empty",children:a}),!n&&!a&&e.length===0&&r.jsx("div",{className:"chat-sessions-empty",children:"Conversations you start will show up here."}),Wt(e).map(j=>r.jsxs("div",{className:"chat-session-group",children:[r.jsx("div",{className:"chat-session-group-label",children:j.label}),j.items.map(g=>r.jsxs("div",{className:`chat-session${g.id===t?" chat-session-active":""}`,role:"button",tabIndex:0,onClick:()=>m(g.id),onKeyDown:y=>{if(y.key==="Enter"&&m(g.id),y.key==="F2"&&S(g),y.key==="ContextMenu"||y.shiftKey&&y.key==="F10"){y.preventDefault();const u=y.currentTarget.getBoundingClientRect();ne(g.id,u.right-150,u.bottom)}},onContextMenu:y=>{y.preventDefault(),ne(g.id,y.clientX,y.clientY)},children:[D===g.id?r.jsx("input",{className:"chat-session-title-input",value:k,autoFocus:!0,maxLength:80,onClick:y=>y.stopPropagation(),onChange:y=>H(y.target.value),onBlur:()=>void F(g.id),onKeyDown:y=>{y.stopPropagation(),y.key==="Enter"&&F(g.id),y.key==="Escape"&&_(null)}}):r.jsx("span",{className:"chat-session-title",children:g.title}),r.jsx("button",{type:"button",className:"chat-session-menu","aria-label":"Chat actions","aria-haspopup":"menu",title:"Chat actions",onClick:y=>{y.stopPropagation();const u=y.currentTarget.getBoundingClientRect();ne(g.id,u.right-150,u.bottom)},children:"⋯"}),r.jsx("button",{type:"button",className:"chat-session-delete","aria-label":"Delete conversation",onClick:y=>{y.stopPropagation(),x(g.id)},children:r.jsx(Vt,{})})]},g.id))]},j.label))]}),O&&r.jsx("div",{className:"chat-session-context-menu",role:"menu",style:{left:O.x,top:O.y},onClick:j=>j.stopPropagation(),children:r.jsx("button",{type:"button",role:"menuitem",autoFocus:!0,onClick:()=>{const j=e.find(g=>g.id===O.id);j&&S(j),E(null)},children:"Rename chat"})})]})}function Cn({sessionId:e,busy:t,loading:n,onError:a}){const{toast:s}=ft(),[d,l]=o.useState(!1),[m,h]=o.useState(""),x=async()=>{var D;if(!(t||d)){l(!0);try{const _=await Gt(e),k=new URL(_.public_path,window.location.origin).toString();try{if(!((D=navigator.clipboard)!=null&&D.writeText))throw new Error("Clipboard unavailable");await navigator.clipboard.writeText(k),s({className:"chat-share-toast",duration:5e3,title:"Public link copied to your clipboard",description:"Anyone with this link can see this conversation."})}catch{h(k)}}catch(_){const k=_ instanceof Error?_.message:"Could not share this conversation";a(k),s({variant:"destructive",title:"Share failed",description:k})}finally{l(!1)}}};return r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"chat-share-button",onClick:()=>void x(),disabled:t||d||n,"aria-label":"Share conversation",children:[d?r.jsx(pt,{}):r.jsx(on,{"aria-hidden":"true"}),r.jsx("span",{children:"Share"})]}),r.jsx(Sn,{url:m,onClose:()=>h("")})]})}function Tn({messages:e,refreshSessions:t,resetChat:n,restoreDraft:a,clearTitle:s}){const{toast:d}=ft(),[l,m]=o.useState(null),h=()=>{const _=[...e].reverse().find(k=>k.role==="user");n(),a({text:(_==null?void 0:_.text)??"",paperMentions:(_==null?void 0:_.paperMentions)??[]}),s()};return{pending:l,archiveOld:async()=>{if(l===null){m("old");try{const _=await $t();if(await t(),_.archived_count===0){d({title:"No chats were archived",description:"There are no inactive chats older than 30 days."});return}h(),d({title:`${_.archived_count} ${_.archived_count===1?"chat":"chats"} archived`,description:"Your question is ready to send again."})}catch(_){d({variant:"destructive",title:"Could not archive old chats",description:_ instanceof Error?_.message:"Try again."})}finally{m(null)}}},archiveOldest:async()=>{if(l===null){m("oldest");try{const _=await Kt();await t(),h(),d({title:`${_.archived_count} ${_.archived_count===1?"chat":"chats"} archived`,description:"Your question is ready to send again."})}catch(_){d({variant:"destructive",title:"Could not archive chats",description:_ instanceof Error?_.message:"Try again."})}finally{m(null)}}}}}class kn{constructor(t,n=hn){ke(this,"requestId");ke(this,"firstVisibleAt");ke(this,"streamStartReported",!1);ke(this,"firstVisibleReported",!1);ke(this,"terminalReported",!1);ke(this,"semanticReported",new Set);this.submittedAt=t,this.report=n}recordStreamStart(t,n){this.requestId=t,this.streamStartReported||(this.streamStartReported=!0,this.send({submission_to_stream_start_ms:Math.max(0,n-this.submittedAt)})),this.reportFirstVisible()}recordFirstVisible(t){this.firstVisibleAt===void 0&&(this.firstVisibleAt=t,this.reportFirstVisible())}recordSemantic(t,n){if(this.semanticReported.has(t))return;this.semanticReported.add(t);const a=Math.max(0,n-this.submittedAt);this.send(t==="reasoning"?{submission_to_first_reasoning_delta_ms:a}:t==="tool"?{submission_to_first_tool_call_ms:a}:{submission_to_first_answer_delta_ms:a})}recordTerminal(t){this.terminalReported||(this.terminalReported=!0,this.send({terminal_classification:t}))}reportFirstVisible(){!this.requestId||this.firstVisibleAt===void 0||this.firstVisibleReported||(this.firstVisibleReported=!0,this.send({submission_to_first_visible_delta_ms:Math.max(0,this.firstVisibleAt-this.submittedAt)}))}send(t){this.requestId&&this.report(this.requestId,t)}}const _t="Preparing research workspace…",vt={preparing_workspace:"Preparing secure workspace…",starting_agent:"Starting research agent…",connecting_model:"Connecting to model…"},wt=()=>({messages:[],sessionId:null,title:"",phase:"idle"});function dt(e,t){for(let n=e.length-1;n>=0;n-=1)if(t(e[n]))return n;return-1}function Ve(e){if(e.status!==_t&&!Object.values(vt).includes(e.status))return e;const{status:t,...n}=e;return n}function te(e,t){if(!e.length)return e;const n=e.slice();return n[n.length-1]=t(n[n.length-1]),n}function ht(e,t,n){return te(e,a=>{const s=Ve(a),d=s.blocks??[];return{...s,blocks:d.map((l,m)=>t(l,m,d)?n(l):l)}})}function On(e,t){switch(t.type){case"stream_start":return t.session_id?{...e,sessionId:t.session_id}:e;case"sandbox_start":case"sandbox_ready":case"workspace_ready":return e;case"lifecycle":return{...e,messages:te(e.messages,n=>{var a;return n.role==="assistant"&&n.streaming&&(((a=n.blocks)==null?void 0:a.length)??0)===0?{...n,status:vt[t.phase]}:n})};case"session_title_start":return{...e,title:""};case"session_title_delta":return{...e,title:`${e.title}${t.text}`.replace(/\s+/g," ").slice(0,80)};case"session_title_done":return{...e,title:t.title};case"reasoning_start":return{...e,messages:te(e.messages,n=>{const a=Ve(n);return{...a,blocks:[...(a.blocks??[]).map(s=>s.kind==="reasoning"&&s.active?{...s,active:!1,open:!1}:s),{kind:"reasoning",text:"",active:!0,open:!0}]}})};case"reasoning_delta":return{...e,messages:ht(e.messages,(n,a,s)=>n.kind==="reasoning"&&dt(s,d=>d.kind==="reasoning")===a,n=>n.kind==="reasoning"?{...n,text:n.text+t.text}:n)};case"reasoning_end":return{...e,messages:te(e.messages,n=>{const a=n.blocks??[],s=dt(a,m=>m.kind==="reasoning"&&m.active);if(s<0)return n;const d=a[s];if(d.kind!=="reasoning")return n;const l=a[s-1];return(l==null?void 0:l.kind)==="reasoning"&&l.text===d.text?{...n,blocks:a.filter((m,h)=>h!==s)}:{...n,blocks:a.map((m,h)=>h===s?{...d,active:!1,open:!1}:m)}})};case"tool_call":return{...e,messages:te(e.messages,n=>{const a=Ve(n);return{...a,blocks:[...a.blocks??[],{kind:"tool",id:t.id,name:t.name,args:t.args,status:"running",open:!1}]}})};case"tool_result":return{...e,messages:ht(e.messages,n=>n.kind==="tool"&&n.id===t.id,n=>n.kind!=="tool"?n:t.status?{...n,schema_version:2,status:t.status,took_ms:t.took_ms,content:t.content,metadata:t.metadata,open:t.status!=="success"}:{...n,status:"done",hits:t.hits,took_ms:t.took_ms,results:t.results})};case"answer_delta":return{...e,messages:te(e.messages,n=>{const a=Ve(n),s=a.blocks??[],d=s.at(-1);return(d==null?void 0:d.kind)==="answer"&&!d.done?{...a,blocks:[...s.slice(0,-1),{...d,text:d.text+t.text}]}:{...a,blocks:[...s,{kind:"answer",text:t.text,done:!1}]}})};case"done":return{...e,phase:"complete",messages:te(e.messages,n=>({...n,streaming:!1,followups:t.followups,finishReason:t.finish_reason,citations:t.citations,blocks:(n.blocks??[]).map(a=>a.kind==="answer"?{...a,done:!0}:a.kind==="reasoning"&&a.active?{...a,active:!1,open:!1}:a)}))};case"error":return{...e,phase:"failed",messages:te(e.messages,n=>({...n,streaming:!1,error:t.message,errorCode:t.code,blocks:(n.blocks??[]).map(a=>a.kind==="reasoning"&&a.active?{...a,active:!1,open:!1}:a)}))}}}function In(e){return te(e,t=>{if(t.role!=="assistant")return t;const n=(t.blocks??[]).flatMap(a=>a.kind==="tool"&&a.status==="running"?[]:a.kind==="reasoning"&&a.active?a.text?[{...a,active:!1,open:!1}]:[]:a.kind==="answer"?[{...a,done:!0}]:[a]);return{...t,blocks:n,streaming:!1,finishReason:"stopped"}})}function He(e,t){switch(t.type){case"start":return{messages:t.messages,sessionId:t.sessionId,title:"",phase:"streaming"};case"event":return On(e,t.event);case"load":return{messages:t.messages,sessionId:t.sessionId,title:e.title,phase:"idle"};case"workspace_status":return{...e,messages:te(e.messages,n=>{var a;return n.role==="assistant"&&n.streaming&&(((a=n.blocks)==null?void 0:a.length)??0)===0&&!n.error?{...n,status:_t}:n})};case"clear_workspace_status":return{...e,messages:te(e.messages,Ve)};case"settle":return{...e,phase:"idle",messages:te(e.messages,n=>n.streaming?{...n,streaming:!1}:n)};case"stop":return{...e,messages:In(e.messages),phase:"stopped"};case"reset":return wt()}}const we={minDelayMs:5,maxDelayMs:80,minRateCharsPerMs:.3,maxBufferedMs:400,arrivalRateTauMs:1e3,arrivalRateHeadroom:1.1,maxPendingChars:64},An={now:()=>performance.now(),sleep:(e,t)=>new Promise(n=>{if(t!=null&&t.aborted||e<=0){n();return}const a=window.setTimeout(s,e);function s(){t==null||t.removeEventListener("abort",s),window.clearTimeout(a),n()}t==null||t.addEventListener("abort",s,{once:!0})})};function jn(e){return!["stream_start","sandbox_start","sandbox_ready","workspace_ready","session_title_start","session_title_delta","session_title_done"].includes(e.type)}function Nn(e,t=!1,n=we.maxPendingChars){var s;if(!e)return{pieces:[],pending:""};if(t)return{pieces:[e],pending:""};const a=Intl.Segmenter;if(a){const l=[...new a(void 0,{granularity:"word"}).segment(e)].filter(h=>h.isWordLike);let m=0;if(l.length>1&&(m=l.at(-1).index),l.length&&/\s$/u.test(e)&&(m=e.length),m>0){const h=e.slice(0,m),x=[],_=[...new a(void 0,{granularity:"word"}).segment(h)].filter(k=>k.isWordLike);for(let k=0;k<_.length;k+=1){const H=k===0?0:_[k].index,O=((s=_[k+1])==null?void 0:s.index)??h.length;O>H&&x.push(h.slice(H,O))}return _.length||x.push(h),{pieces:x,pending:e.slice(m)}}}else{const d=[...e.matchAll(/\s+/gu)];if(d.length){const l=[];let m=0;for(const h of d){const x=h.index+h[0].length;l.push(e.slice(m,x)),m=x}return{pieces:l,pending:e.slice(m)}}}return e.length>=n?{pieces:[e.slice(0,n)],pending:e.slice(n)}:{pieces:[],pending:e}}function Ln(e,t={}){const n={minDelayMs:t.minDelayMs??we.minDelayMs,maxDelayMs:t.maxDelayMs??we.maxDelayMs,minRateCharsPerMs:t.minRateCharsPerMs??we.minRateCharsPerMs,maxBufferedMs:t.maxBufferedMs??we.maxBufferedMs,arrivalRateTauMs:t.arrivalRateTauMs??we.arrivalRateTauMs,arrivalRateHeadroom:t.arrivalRateHeadroom??we.arrivalRateHeadroom,maxPendingChars:t.maxPendingChars??we.maxPendingChars},a=t.clock??An,s=[];let d="",l=null,m=0,h=!0,x=!1,D=null,_=0,k=a.now();const H=()=>{D==null||D(),D=null},O=(g,y)=>{const u=g.type==="reasoning_delta"||g.type==="answer_delta"?g.text.length:0;s.push({kind:"event",event:g,arrivedAt:y,chars:u}),H()},E=g=>{if(!l||!d)return;const y=Nn(d,g,n.maxPendingChars);for(const u of y.pieces)u&&O({type:l,text:u},m),m=a.now();d=y.pending,d||(l=null)},S=g=>{if(!h)return;const y=a.now();if(g.type==="reasoning_delta"||g.type==="answer_delta"){const u=g.type;if(!g.text)return;l&&l!==u&&E(!0),l||(l=u,m=y),d+=g.text;const q=Math.max(0,y-k);for(_*=Math.exp(-q/n.arrivalRateTauMs),_+=g.text.length,k=y,E(!1);d.length>=n.maxPendingChars;)E(!1);return}jn(g)&&E(!0),O(g,y)},F=(async()=>{var g;try{for await(const y of e)S(y);h&&E(!0)}catch(y){h&&!((g=t.signal)!=null&&g.aborted)&&(E(!0),s.push({kind:"error",error:y,arrivedAt:a.now(),chars:0}))}finally{x=!0,H()}})(),ne=()=>s.length||x?Promise.resolve():new Promise(g=>{D=g});return{events:async function*(){var y,u,q,C;let g=Number.NEGATIVE_INFINITY;try{for(;;){if(await ne(),!s.length){if(x||!h)return;continue}const V=s[0];if(V.kind==="error")throw s.shift(),V.error;if(V.chars&&!((y=t.isHidden)!=null&&y.call(t))){const Y=a.now(),A=s.reduce((J,ge)=>J+ge.chars,0),xe=((u=s.find(J=>J.chars))==null?void 0:u.arrivedAt)??Y,Ie=Math.max(0,n.maxBufferedMs-(Y-xe)),P=_*Math.exp(-Math.max(0,Y-k)/n.arrivalRateTauMs)/n.arrivalRateTauMs,K=Ie>0?A/Ie:Number.POSITIVE_INFINITY,$=Math.max(n.minRateCharsPerMs,P*n.arrivalRateHeadroom,K),he=Math.min(n.maxDelayMs,Math.max(n.minDelayMs,V.chars/$)),ae=Math.max(0,V.arrivedAt+n.maxBufferedMs-Y),Q=Math.max(V.arrivedAt,g+Math.min(he,ae));if(await a.sleep(Math.max(0,Q-a.now()),t.signal),!h||(q=t.signal)!=null&&q.aborted)return}s.shift(),g=a.now(),yield V.event}}finally{h&&(h=!1,H(),await((C=e.return)==null?void 0:C.call(e,void 0))),await F}}(),takeAcceptedForStop(){var y;if(!h)return[];h=!1,l&&d&&(O({type:l,text:d},m),d="",l=null);const g=s.flatMap(u=>u.kind==="event"&&u.event.type!=="done"&&u.event.type!=="error"?[u.event]:[]);return s.length=0,H(),(y=e.return)==null||y.call(e,void 0),g}}}const Mn=750;function Dn(e,t){for(let n=e.length-1;n>=0;n-=1)if(t(e[n]))return n;return-1}function We(e){const t=o.useRef(e);return o.useLayoutEffect(()=>{t.current=e}),o.useCallback((...n)=>t.current(...n),[])}function Pn(e){const[t,n]=o.useState([]),[a,s]=o.useState(!1),[d,l]=o.useState(""),m=o.useRef(!1),h=o.useRef(null),x=o.useRef(null),D=o.useRef(null),_=o.useRef(null),k=o.useRef(!1),H=o.useRef(null),O=o.useRef(null),E=o.useRef("cleared"),S=o.useRef(null),F=o.useRef(null),[ne,j]=o.useState(null),[g,y]=o.useState(null),u=o.useRef([]),q=o.useRef(wt()),C=o.useRef(null),V=o.useRef(null),Y=o.useRef(!1),A=o.useRef(e),xe=o.useRef({text:"",paperMentions:[]}),Ie=o.useRef(0),P=o.useRef(0),K=o.useRef(e.sessionId),$=o.useRef(e.sessionId);$.current!==e.sessionId&&($.current=e.sessionId,K.current!==e.sessionId&&(P.current+=1,S.current=null)),A.current=e,u.current=t,o.useEffect(()=>()=>{var c;O.current!==null&&window.clearTimeout(O.current),(c=h.current)==null||c.abort(),x.current=null,D.current!==null&&cancelAnimationFrame(D.current),_.current!==null&&window.clearTimeout(_.current),F.current=null},[]),o.useEffect(()=>{m.current||(K.current=e.sessionId)},[e.sessionId]),o.useEffect(()=>{const c=m.current&&e.sessionId===K.current?C.current:null;Y.current=c!==null,c&&(n(c),u.current=c)},[e.sessionId]);const he=o.useMemo(()=>{const c={};for(const v of t)for(const R of v.blocks??[])if(R.kind==="tool")for(const p of R.results??[])c[p.route_id]=p;return c},[t]),ae=()=>`m${++Ie.current}_${Date.now().toString(36)}`,Q=(c,v=!0)=>{const R={...q.current,messages:C.current??u.current,sessionId:K.current},p=He(R,c);q.current=p,C.current&&(C.current=p.messages);const b=c.type==="event"&&c.event.type==="stream_start"?c.event.session_id:null;return b?(K.current=b,A.current.onSessionId(b)):p.sessionId&&p.sessionId!==R.sessionId&&(K.current=p.sessionId,A.current.onSessionId(p.sessionId)),p.title!==R.title&&A.current.onTitle(p.title),v&&(u.current=p.messages,n(p.messages)),p},J=()=>V.current===P.current||Y.current,ge=()=>{D.current!==null&&(cancelAnimationFrame(D.current),D.current=null),_.current!==null&&(window.clearTimeout(_.current),_.current=null)},Z=()=>{ge(),document.visibilityState!=="hidden"&&(!Y.current||!C.current||(k.current=!1,u.current=C.current,n(C.current)))},Re=()=>{if(!Y.current||document.visibilityState==="hidden"||D.current!==null||_.current!==null)return;const c=()=>{D.current=null,_.current=null,Z()};typeof requestAnimationFrame=="function"?D.current=requestAnimationFrame(c):_.current=window.setTimeout(c,0)};o.useEffect(()=>{const c=()=>{document.visibilityState==="visible"&&k.current&&Re()};return document.addEventListener("visibilitychange",c),()=>document.removeEventListener("visibilitychange",c)});const ie=c=>{if(h.current!==c||(O.current!==null&&(window.clearTimeout(O.current),O.current=null),E.current==="cleared"))return;const v=E.current==="shown";E.current="cleared",v&&Q({type:"clear_workspace_status"},J())},Ke=(c,v)=>{O.current!==null&&window.clearTimeout(O.current),E.current="armed",O.current=window.setTimeout(()=>{O.current=null,!(E.current!=="armed"||h.current!==c||c.signal.aborted||P.current!==v)&&(E.current="shown",Q({type:"workspace_status"},J()))},Mn)},Me=(c,v)=>{const R=S.current;!R||R.controller!==c||R.tracker.recordStreamStart(v,performance.now())},Se=(c,v)=>{const R=S.current;!R||R.controller!==c||R.tracker.recordTerminal(v)};o.useLayoutEffect(()=>{const c=S.current;if(!c)return;const v=t.at(-1);if((v==null?void 0:v.role)!=="assistant"||!(v.blocks??[]).some(b=>b.kind==="tool"||b.kind==="reasoning"&&!!b.text.trim()||b.kind==="answer"&&!!b.text.trim()))return;const p=performance.now();c.tracker.recordFirstVisible(p);for(const b of v.blocks??[])b.kind==="reasoning"&&b.text.trim()?c.tracker.recordSemantic("reasoning",p):b.kind==="tool"?c.tracker.recordSemantic("tool",p):b.kind==="answer"&&b.text.trim()&&c.tracker.recordSemantic("answer",p)},[t]);const ye=(c,v=!0)=>{Q({type:"event",event:c},v)},De=async(c,v)=>{var b;const R=await nt(c);let p=gt(R);return((b=H.current)==null?void 0:b.sessionId)===c&&(p=H.current.messages,H.current=null),P.current!==v&&!(V.current===v&&Y.current&&A.current.sessionId===c)?null:(n(p),u.current=p,C.current=p,q.current=He(q.current,{type:"load",messages:p,sessionId:c}),p)},Ee=(c,v,R,p,b,M)=>{const N=++P.current;V.current=N,Y.current=!0,m.current=!0;const I=new AbortController;h.current=I;const oe=c.text;return xe.current=c,K.current=v.session_id,l(""),n(R),C.current=R,q.current=He(q.current,{type:"start",messages:R,sessionId:v.session_id}),s(!0),S.current=M?null:{controller:I,tracker:new kn(performance.now())},E.current="cleared",(async()=>{var Ae,Ye,je,Ue;let me=!1,G=!1,se=!1,ce=!1,le=!1,pe=!1;try{const B=M?mn(M,{signal:I.signal}):fn(v,{signal:I.signal}),z=!M&&Le()&&dn(),X=z?Ln(B,{signal:I.signal,isHidden:()=>document.visibilityState==="hidden"}):null;X&&(x.current={controller:I,stream:X});for await(const L of(X==null?void 0:X.events)??B){L.type==="stream_start"&&(me=!0,G=L.provider_execution!==!1,Me(I,L.request_id)),L.type==="sandbox_start"&&Ke(I,N),L.type==="lifecycle"&&ie(I),(L.type==="reasoning_start"||L.type==="reasoning_delta"||L.type==="tool_call"||L.type==="answer_delta"||L.type==="done"||L.type==="error")&&ie(I),(L.type==="done"||L.type==="error")&&(ce=!0,le=L.type==="error",Se(I,L.type==="error"?"error":"complete"),L.type==="error"&&["openrouter_monthly_budget_exhausted","openrouter_unavailable","openrouter_byok_credential_invalid","openrouter_byok_billing_error","openrouter_byok_rate_limit","hf_inference_billing_exhausted"].includes(L.code??"")&&(se=!0,A.current.onInterrupted(c)));const Te=J(),qe=Te&&!(z&&document.visibilityState==="hidden"),Qe=L.type==="reasoning_delta"||L.type==="answer_delta",ze=!["stream_start","sandbox_start","sandbox_ready","workspace_ready","session_title_start","session_title_delta","session_title_done","reasoning_delta","answer_delta"].includes(L.type);z&&ze&&Z(),!I.signal.aborted&&(Te||L.type==="stream_start"||L.type==="session_title_start"||L.type==="session_title_delta"||L.type==="session_title_done")?z&&Qe?(ye(L,!1),k.current=k.current||Te,Re()):(ye(L,qe),z&&Te&&!qe&&(k.current=!0)):I.signal.aborted||ye(L,!1)}}catch(B){if(le=!0,!I.signal.aborted){if(ie(I),B instanceof Ne&&B.code==="chat_temporarily_disabled")pe=!0,y({question:oe,draft:c}),P.current===N&&(n(p),u.current=p,l(""));else if(B instanceof Ne&&B.code==="chat_capacity"){pe=!0;const z=B.retryAfterSeconds??5,X={question:oe,draft:c,request:v,optimistic:R,original:p,edit:b,retryAfterSeconds:z,retryAt:Date.now()+z*1e3};F.current=X,j({question:oe,draft:c,retryAt:X.retryAt,retryAfterSeconds:z}),P.current===N&&(n(p),u.current=p,l(""))}else Se(I,"network_error"),B instanceof Ne&&["paper_context_unavailable","paper_mention_unavailable","paper_mentions_disabled","chat_storage_quota_exceeded"].includes(B.code??"")&&(pe=!0,A.current.onInterrupted(c),P.current===N&&(n(p),u.current=p,l(B.message))),B instanceof Ne&&["openrouter_monthly_budget_exhausted","openrouter_unavailable","openrouter_byok_credential_invalid","openrouter_byok_billing_error","openrouter_byok_rate_limit","hf_inference_billing_exhausted"].includes(B.code??"")&&(se=!0,A.current.onInterrupted(c));!pe&&P.current===N&&ye({type:"error",message:B instanceof Error?B.message:"The assistant stream failed.",code:B instanceof Ne?B.code:void 0})}}finally{if(h.current===I){if(((Ae=x.current)==null?void 0:Ae.controller)===I&&(Z(),x.current=null),ie(I),!ce&&!I.signal.aborted&&Se(I,"network_error"),m.current=!1,s(!1),pe)A.current.onSettled(v.session_id);else if(!I.signal.aborted){(me&&G||se)&&((je=(Ye=A.current).onProviderTerminal)==null||je.call(Ye));const B=K.current;if(b&&!me)P.current===N&&(n(b.snapshot),u.current=b.snapshot,l("Couldn’t resend this message. Your original conversation was restored."));else if(B){P.current===N&&b&&(le||!ce)&&(n(b.snapshot),u.current=b.snapshot);try{const z=await De(B,N);z&&b&&z.some(X=>X.id===b.targetId)&&l("Couldn’t resend this message. Your original conversation was restored.")}catch{P.current===N&&Q({type:"settle"})}}else P.current===N&&Q({type:"settle"});A.current.onSettled(B)}((Ue=S.current)==null?void 0:Ue.controller)===I&&(S.current=null)}}})(),!0},re=We(c=>{const v=typeof c=="string"?{text:c.trim(),paperMentions:[]}:c,R=v.text;if(!R||R.length>8e3||m.current||F.current)return!1;const p=u.current,b=[...p].reverse().find(G=>G.role==="user"),M=b!=null&&b.status&&b.status!=="complete"&&b.revision?{replace_message_id:b.id,prior_revision:b.revision}:null,N={id:ae(),role:"user",text:R,paperMentions:v.paperMentions},I={id:ae(),role:"assistant",streaming:!0,blocks:[]},oe=M&&b?Dn(p,G=>G.id===b.id):-1,me=oe<0?[...p,N,I]:[...p.slice(0,oe),N,I];return Ee(v,{message:R,paper_mentions:v.paperMentions.map(({route_id:G,title:se,start:ce,end:le})=>({route_id:G,title:se,start:ce,end:le})),session_id:A.current.sessionId,client_message_id:crypto.randomUUID(),web_search_enabled:!!A.current.webSearchEnabled,reasoning_effort:A.current.reasoningEffort??"low",...!A.current.sessionId&&A.current.initialModel?{initial_model:A.current.initialModel}:{},...M??{}},me,p)}),be=We((c,v)=>{const R=typeof v=="string"?{text:v.trim(),paperMentions:[]}:v,p=R.text;if(!p||p.length>8e3||m.current||F.current)return!1;const b=u.current.slice(),M=b.findIndex(G=>G.id===c&&G.role==="user");if(M<0)return!1;const N=b[M];if(!A.current.sessionId||!N.revision)return!1;const I={id:N.id,role:"user",text:p,paperMentions:R.paperMentions,revision:N.revision+1,status:"generating"},oe={id:ae(),role:"assistant",streaming:!0,blocks:[]},me=[...b.slice(0,M),I,oe];return Ee(R,{message:p,paper_mentions:R.paperMentions.map(({route_id:G,title:se,start:ce,end:le})=>({route_id:G,title:se,start:ce,end:le})),session_id:A.current.sessionId,client_message_id:crypto.randomUUID(),web_search_enabled:!!A.current.webSearchEnabled,reasoning_effort:A.current.reasoningEffort??"low",replace_message_id:N.id,prior_revision:N.revision},me,b,{targetId:N.id,snapshot:b})}),Pe=o.useCallback(()=>{F.current=null,j(null)},[]),Ce=We(()=>{const c=F.current;return!c||Date.now(){var M,N;if(!h.current)return;const c=h.current;ie(c),Se(c,"stopped"),c.abort();const v=((M=x.current)==null?void 0:M.controller)===c?x.current.stream.takeAcceptedForStop():[];x.current=null;for(const I of v)ye(I,!1);Z(),h.current=null,((N=S.current)==null?void 0:N.controller)===c&&(S.current=null),m.current=!1,s(!1);const R=Q({type:"stop"},!1).messages;C.current=R,u.current=R,n(R),A.current.onInterrupted(xe.current);const p=K.current;p&&(H.current={sessionId:p,messages:R}),p&&Qt(p).catch(()=>{});const b=++P.current;window.setTimeout(()=>{p&&P.current===b?De(p,b).catch(()=>{}).finally(()=>A.current.onSettled(p)):p||A.current.onSettled(null)},450)}),T=o.useCallback((c,v)=>n(R=>R.map(p=>{var b;return p.id!==c?p:{...p,blocks:(b=p.blocks)==null?void 0:b.map((M,N)=>N===v&&(M.kind==="reasoning"||M.kind==="tool")?{...M,open:!M.open}:M)}})),[]),$e=o.useCallback(()=>{var c;P.current+=1,O.current!==null&&(window.clearTimeout(O.current),O.current=null),E.current="cleared",(c=h.current)==null||c.abort(),h.current=null,x.current=null,ge(),k.current=!1,H.current=null,S.current=null,F.current=null,j(null),m.current=!1,K.current=null,C.current=null,q.current=He(q.current,{type:"reset"}),V.current=null,Y.current=!1,n([]),s(!1),l("")},[]),Fe=We((c,v,R=!1)=>{var p;if(P.current+=1,O.current!==null&&(window.clearTimeout(O.current),O.current=null),E.current="cleared",ge(),k.current=!1,S.current=null,F.current=null,j(null),m.current&&v!==void 0&&v===K.current&&C.current){Y.current=!0,n(C.current),u.current=C.current,l("");return}if(Y.current=!1,m.current||((p=h.current)==null||p.abort(),h.current=null,C.current=null,V.current=null,Y.current=!1),R&&v){const b=[...c].reverse().find(M=>M.role==="user");if(b){const M={text:b.text??"",paperMentions:b.paperMentions??[]},N=[...c,{id:`${b.id}-active`,role:"assistant",streaming:!0,blocks:[]}];Ee(M,{message:M.text,session_id:v,client_message_id:"reconnect",web_search_enabled:!!A.current.webSearchEnabled,reasoning_effort:A.current.reasoningEffort??"low"},N,c,void 0,v);return}}n(c),u.current=c,q.current=He(q.current,{type:"load",messages:c,sessionId:v??A.current.sessionId}),m.current||s(!1),l("")});return{messages:t,busy:a,papers:he,sessionError:d,capacityRequest:ne,disabledRequest:g,send:re,editAndResend:be,retryCapacity:Ce,cancelCapacity:Pe,dismissDisabled:()=>y(null),stop:fe,toggleBlock:T,reset:$e,load:Fe}}const de=(e="")=>({text:e,paperMentions:[]}),Fn=()=>{const e=sessionStorage.getItem(et);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.text=="string"&&Array.isArray(t.paperMentions))return t}catch{}return de(e)},rr=()=>{var B,z,X,L,Te,qe,Qe,ze;const{sessionId:e}=kt(),t=Ot(),[n,a]=It(),{user:s,isLoading:d}=At(),l=jt(),m=Lt(),h=Mt({queryKey:["chatAvailability"],queryFn:()=>Ge.getAvailability(),refetchInterval:3e4,retry:!1,enabled:Le()&&!!s}),x=((B=h.data)==null?void 0:B.status)==="paused",[D,_]=o.useState([]),[k,H]=o.useState(!1),[O,E]=o.useState(""),[S,F]=o.useState(()=>e?{id:e,status:"loading"}:null),[ne,j]=o.useState(0),g=o.useRef(zt()),y=o.useRef(n.get("model")||((z=g.current)==null?void 0:z.model)),[u,q]=o.useState(m?Jt:Xt),[C,V]=o.useState(y.current||Zt),Y=((X=u.find(i=>i.id===C))==null?void 0:X.provider)??"huggingface",A=Ut(!!(s&&Y==="openrouter")),xe=o.useRef(Y);xe.current=Y;const[Ie,P]=o.useState(""),[K,$]=o.useState(()=>de()),[he,ae]=o.useState(()=>{var i;return((i=g.current)==null?void 0:i.webSearchEnabled)??!1}),[Q,J]=o.useState(()=>{var i;return((i=g.current)==null?void 0:i.reasoningEffort)??"low"}),ge=!!((L=h.data)!=null&&L.web_search_available),[Z,Re]=o.useState(()=>{var f,w;const i=(f=n.get("q"))==null?void 0:f.trim();return i?de(i):((w=g.current)==null?void 0:w.draft)??de()}),ie=o.useRef(!1),Ke=o.useRef(!1),Me=o.useRef(!1),[Se,ye]=o.useState(()=>typeof window>"u"||window.innerWidth>900),De=o.useRef(new Set),Ee=o.useRef(!1),re=o.useRef(e),be=o.useRef(null),Pe=o.useRef(null),Ce=o.useRef(null);re.current=e;const fe=o.useCallback(async()=>{if(!s)return;const i=!Ee.current;i&&H(!0);try{const f=await en();_(w=>{const U=be.current,W=U?w.find(Be=>Be.id===U):void 0;if(!W)return f;const ue=f.find(Be=>Be.id===U);return[ue?{...ue,title:W.title,is_busy:!0}:W,...f.filter(Be=>Be.id!==U)]}),Ee.current=!0,E("")}catch(f){E(f instanceof Error?f.message:"Could not load chats")}finally{i&&H(!1)}},[s]),T=Pn({sessionId:e??null,initialModel:C,webSearchEnabled:ge&&he,reasoningEffort:Q,onSessionId:i=>{be.current=i;const f=i!==re.current,w=(re.current??null)===Pe.current,U=new Date().toISOString();_(W=>W.some(ue=>ue.id===i)?W.map(ue=>ue.id===i?{...ue,is_busy:!0}:ue):[{id:i,title:"New chat",selected_model:C,created_at:U,updated_at:U,message_count:1,is_busy:!0,web_search_enabled:he,reasoning_effort:Q},...W]),f&&w&&P("New chat"),w&&(Ce.current=i,F({id:i,status:"loaded"}),f&&t(`/chat/${i}`,{replace:!0}))},onTitle:i=>{const f=be.current??re.current;f&&!De.current.has(f)&&(f===re.current&&P(i),_(w=>w.map(U=>U.id===f?{...U,title:i}:U)))},onSettled:i=>{i&&_(f=>f.map(w=>w.id===i?{...w,is_busy:!1}:w)),be.current=null,Pe.current=null,fe()},onProviderTerminal:()=>{xe.current==="openrouter"&&(l.invalidateQueries({queryKey:qt}),l.invalidateQueries({queryKey:Bt}))},onInterrupted:i=>{$(i)}}),$e=T.send;o.useEffect(()=>{T.capacityRequest&&$(T.capacityRequest.draft)},[T.capacityRequest]);const Fe=o.useCallback(i=>{sessionStorage.setItem(et,JSON.stringify(i)),sessionStorage.setItem(Je,C),sessionStorage.setItem(tn,Q),sessionStorage.setItem(Xe,"1"),sessionStorage.setItem(Ze,"1");const f=re.current?`/chat/${re.current}`:"/chat";window.location.href=Nt(f,Y==="huggingface")},[Q,C,Y]),c=o.useCallback((i,f)=>{sessionStorage.setItem(et,JSON.stringify(i)),sessionStorage.setItem(Je,C),sessionStorage.removeItem(Xe),sessionStorage.removeItem(Ze),Re(de()),$(i),E(f)},[C]),v=o.useCallback(async i=>{if(!s){Fe(i);return}if(Y==="huggingface"&&!Ke.current){if(Me.current)return;Me.current=!0;try{if(!(await Ge.getInferenceBilling()).connected){if(sessionStorage.getItem(Ze)==="1"){c(i,"Hugging Face inference authorization was not completed. Your prompt is ready to retry.");return}Fe(i);return}Ke.current=!0}catch(w){c(i,w instanceof Error?w.message:"Could not check Hugging Face authorization.");return}finally{Me.current=!1}}const f=re.current??null;if(sessionStorage.removeItem(Xe),!$e(i)){c(i,"Your prompt was not sent. It is ready to retry.");return}Pe.current=f,be.current=f,sessionStorage.removeItem(et),sessionStorage.removeItem(Je),sessionStorage.removeItem(Ze),nn(),$(de())},[Fe,c,Y,$e,s]);o.useEffect(()=>{if(d||!s)return;const i=sessionStorage.getItem(Je);i&&V(i),fe(),rn().then(U=>{if(q(U.items),!re.current){const W=y.current||i;V(W&&U.items.some(ue=>ue.id===W)?W:U.default_model)}});const f=Fn(),w=sessionStorage.getItem(Xe)==="1";f&&(w?Re(f):$(f))},[d,fe,s]),o.useEffect(()=>{if(!e){Ce.current!==null&&(Ce.current=null,T.reset(),ae(!1),J("low")),F(null);return}if(Ce.current===e||(F(f=>(f==null?void 0:f.id)===e&&f.status==="loading"?f:{id:e,status:"loading"}),d||!s))return;let i=!1;return E(""),nt(e).then(f=>{i||(T.load(gt(f),e,f.is_busy),V(f.selected_model),ae(g.current&&f.messages.length===0?g.current.webSearchEnabled:f.web_search_enabled),J(g.current&&f.messages.length===0?g.current.reasoningEffort:f.reasoning_effort??"high"),P(f.title),Ce.current=e,F({id:e,status:"loaded"}))}).catch(f=>{if(i)return;const w=f instanceof Error?f.message:"Chat not found";T.reset(),E(w),F({id:e,status:"error",error:w})}),()=>{i=!0}},[d,e,s,T.busy,ne]),o.useEffect(()=>{var U;const i=(U=n.get("q"))==null?void 0:U.trim();if(!i)return;ie.current=!1;const f=n.get("model");f&&V(f),Re(de(i));const w=new URLSearchParams(n);w.delete("q"),w.delete("model"),a(w,{replace:!0})},[n,a]),o.useEffect(()=>{if(d||T.busy||!Z.text||ie.current||s&&he&&h.isFetching||e&&(S==null?void 0:S.status)!=="loaded")return;const i=window.setTimeout(()=>{if(ie.current)return;ie.current=!0,v(Z).finally(()=>Re(de()))},0);return()=>window.clearTimeout(i)},[d,h.isFetching,T.busy,Z,e,S==null?void 0:S.status,v,s,he]),o.useEffect(()=>{const i=()=>{!s||T.busy||fe()};return window.addEventListener("focus",i),()=>window.removeEventListener("focus",i)},[T.busy,fe,s]);const R=()=>{be.current=null,T.reset(),$(de()),ae(!1),J("low"),P(""),t("/chat")},p=async(i,f)=>{try{const w=await tt(i,{title:f});return De.current.add(i),i===e&&P(w.title),_(U=>U.map(W=>W.id===i?w:W)),!0}catch(w){return E(w instanceof Error?w.message:"Rename failed"),!1}},b=async i=>{const f=i===e&&T.busy;if(window.confirm(f?"Stop and delete this chat? This cannot be undone.":"Delete this chat? This cannot be undone.")){f&&T.stop();try{if(f){const w=Date.now()+3e3;for(;(await nt(i)).is_busy;){if(Date.now()>=w)throw new Error("Generation is still stopping. The chat was not deleted.");await new Promise(W=>window.setTimeout(W,150))}}await sn(i),i===e&&R(),await fe()}catch(w){E(w instanceof Error?w.message:"Delete failed")}}},M=Tn({messages:T.messages,refreshSessions:fe,resetChat:T.reset,restoreDraft:$,clearTitle:()=>P("")}),N=async i=>{const f=C;if(V(i),!!e)try{const w=await tt(e,{selected_model:i});_(U=>U.map(W=>W.id===e?{...W,selected_model:w.selected_model}:W)),E("")}catch(w){V(f),E(w instanceof Error?w.message:"Model change failed")}},I=async i=>{const f=Q;if(J(i),!!e)try{const w=await tt(e,{reasoning_effort:i});_(U=>U.map(W=>W.id===e?w:W))}catch(w){J(f),E(w instanceof Error?w.message:"Effort change failed")}},[oe,me]=o.useState(60);o.useLayoutEffect(()=>{const i=document.querySelector(".app-header");if(!i)return;const f=()=>me(i.offsetHeight);f();const w=new ResizeObserver(f);return w.observe(i),()=>w.disconnect()},[]);const G=D.find(i=>i.id===e),se=T.messages.length===0,ce=(Te=[...T.messages].reverse().find(i=>i.role==="assistant"&&i.errorCode))==null?void 0:Te.errorCode,le=ce==="openrouter_unavailable"||ce==="openrouter_monthly_budget_exhausted",pe=(S==null?void 0:S.id)===e,Ae=!!(e&&(d||s&&(!pe||(S==null?void 0:S.status)==="loading"))),Ye=pe&&(S==null?void 0:S.status)==="error"?S.error:void 0,je=!!((qe=A.data)!=null&&qe.fallback_enabled),Ue={onSend:v,busy:T.busy,onStop:T.stop,draft:K,onDraftChange:$,models:u,selectedModel:C,onModelChange:i=>void N(i),disabled:x,describedBy:x?"chat-paused-description":void 0,paperMentionsEnabled:!!((Qe=h.data)!=null&&Qe.paper_mentions_enabled),webSearchAvailable:ge,webSearchEnabled:he,onWebSearchChange:ae,reasoningEffort:Q,onReasoningEffortChange:i=>void I(i)};return r.jsxs("div",{className:"chat-page",style:{height:`calc(100dvh - ${oe}px)`},children:[r.jsx(En,{sessions:D,activeSessionId:e,loading:k,error:O,open:Se,onClose:()=>ye(!1),onNew:R,onNavigate:i=>t(`/chat/${i}`),onRename:p,onDelete:i=>void b(i)}),r.jsxs("section",{className:"chat-main",children:[r.jsxs("div",{className:"chat-topbar",children:[!Se&&r.jsx("button",{type:"button",className:"icon-btn",onClick:()=>ye(!0),title:"Open sidebar",children:r.jsx(mt,{})}),r.jsx("span",{className:"chat-topbar-title",children:Ae?(G==null?void 0:G.title)||"":Ie||(G==null?void 0:G.title)||(se?"":"New chat")}),m&&r.jsx("span",{className:"chat-staging-badge",children:"Staging"}),e&&pe&&(S==null?void 0:S.status)==="loaded"&&!se&&r.jsx(Cn,{sessionId:e,busy:T.busy,loading:Ae,onError:E})]}),Ae&&!Z.text?r.jsxs("div",{className:"chat-session-loading",role:"status","aria-live":"polite",children:[r.jsx(pt,{}),r.jsx("span",{children:"Loading conversation…"})]}):Ye?r.jsxs("div",{className:"chat-session-load-error",role:"alert",children:[r.jsx("p",{children:Ye}),r.jsx("button",{type:"button",onClick:()=>{F({id:e,status:"loading"}),j(i=>i+1)},children:"Try again"})]}):se&&!Z.text?r.jsx("div",{className:"chat-empty",children:r.jsxs("div",{className:"chat-empty-inner",children:[r.jsx("div",{className:"chat-empty-eyebrow",children:"AI research assistant"}),r.jsxs("h1",{className:"chat-empty-title",children:["Ask ",r.jsx("em",{children:"Papers With Code"})]}),r.jsx("p",{className:"chat-empty-sub",children:"Answers are grounded in a live hybrid search over papers, tasks, and benchmarks — with citations you can follow."}),m&&r.jsx("p",{className:"chat-staging-access-note",children:"This is a limited staging preview. Only approved Hugging Face users can start chats."}),r.jsx(ut,{variant:"empty",composerProps:Ue,provider:Y,openRouterFallbackEnabled:je,byokExpected:le,paused:x,suggestions:an})]})}):r.jsxs(r.Fragment,{children:[T.sessionError&&r.jsx("div",{className:"chat-session-error",role:"alert",children:T.sessionError}),r.jsx(wn,{messages:T.messages,papers:T.papers,busy:T.busy,queuedDraft:Z.text?Z:void 0,paperMentionsEnabled:!!((ze=h.data)!=null&&ze.paper_mentions_enabled),archivePending:M.pending,openRouterFallbackEnabled:je,onToggleBlock:T.toggleBlock,onEditAndResend:T.editAndResend,onArchiveOld:()=>void M.archiveOld(),onArchiveOldest:()=>void M.archiveOldest()}),r.jsx(ut,{variant:"followup",composerProps:Ue,provider:Y,openRouterFallbackEnabled:je,byokExpected:le,paused:x})]})]}),T.capacityRequest&&r.jsx(xn,{retryAt:T.capacityRequest.retryAt,onCancel:T.cancelCapacity,onRetry:()=>{T.retryCapacity()&&$(de())}}),T.disabledRequest&&r.jsx(Rn,{onClose:()=>{var i;$(((i=T.disabledRequest)==null?void 0:i.draft)??K),T.dismissDisabled(),h.refetch()}})]})};export{xn as ChatCapacityDialog,vn as OpenRouterUsageNotice,rr as default}; diff --git a/assets/ChatView-D5ne7HbB.js b/assets/ChatView-D5ne7HbB.js new file mode 100644 index 0000000000000000000000000000000000000000..99e33b8e77b58aa5382321614713a02c0f773d6d --- /dev/null +++ b/assets/ChatView-D5ne7HbB.js @@ -0,0 +1,16 @@ +var Nt=Object.defineProperty;var Mt=(e,t,n)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Te=(e,t,n)=>Mt(e,typeof t!="symbol"?t+"":t,n);import{d as Dt,A as Pt,V as Ft,j as r,r as o,X as Yt,e as Et,c as Ut,u as qt,a as Bt,y as Ht,g as Vt,W as Wt,L as pt,b as $t}from"./index-D_-UZEuL.js";import{u as Gt}from"./useQuery-BZo4MZ3s.js";import{C as Kt,U as mt,A as Qt}from"./ChatMessage-DwVcq3Ve.js";import{c as Be}from"./chat-7zW8PrrA.js";import{u as zt,r as Jt,a as Xt,O as Zt,b as en}from"./openrouter-DNgcWuY9.js";import{e as tn,f as Ct,h as nn,T as rn,d as kt,i as sn,j as an,k as on,l as cn,m as rt,t as Tt,r as ln,S as un,P as dn,D as hn,n as fn,o as et,s as Je,v as pn,w as Xe,x as Ze,y as mn,z as gn,B as nt,E as yn}from"./chatSessions-CPPX7pkh.js";import{S as bn}from"./chatPrompts-CDY3UGU1.js";import"./katex.min-BSBacQyE.js";import"./hover-card-DiJQFgx9.js";import"./github-DQuIliTJ.js";import"./github-iFSl-B6V.js";import"./PaperPreviewLink-B25cD-_k.js";import"./index-vCOH2DKd.js";import"./papers-DHqjKX7p.js";import"./file-text--vrXMvWb.js";import"./chevron-down-DI19XsBw.js";/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _n=Dt("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),se=(e,t)=>new Promise(n=>{const s=setTimeout(a,e);function a(){t==null||t.removeEventListener("abort",a),clearTimeout(s),n()}t==null||t.addEventListener("abort",a)}),xe=e=>({arxiv_id:null,source:"arxiv",source_url:null,thumbnail_url:null,authors:[],published:null,conference:null,citation_count:null,tasks:[],methods:[],repositories:[],project_pages:[],...e}),Re={name:"Object Detection",slug:"object-detection"},Oe={name:"Real-Time Object Detection",slug:"real-time-object-detection"},vn={"2502.12524":{route_id:"2502.12524",title:"YOLOv12: Attention-Centric Real-Time Object Detectors",content:"Enhancing the network architecture of the YOLO framework has been crucial for a long time. This work introduces an attention-centric YOLO framework, namely YOLOv12, built around area attention and residual efficient layer aggregation networks (R-ELAN). YOLOv12-N reaches 40.6 mAP at 1.64 ms on a T4 GPU, closing the gap to attention-based detectors without the usual latency penalty and surpassing YOLOv10/YOLOv11 by +1.2–1.6 mAP at matched latency.",content_truncated:!1,metadata:xe({arxiv_id:"2502.12524",authors:[{name:"Y. Tian"},{name:"Q. Ye"},{name:"D. Doermann"}],published:"2025-02-18",citation_count:412,tasks:[Re,Oe],methods:[{name:"Area Attention",slug:"area-attention"}],repositories:[{url:"https://github.com/sunsmarterjie/yolov12",stars:18700}]})},"2407.17140":{route_id:"2407.17140",title:"RT-DETRv2: Improved Baseline with Bag-of-Freebies for Real-Time Detection",content:"RT-DETRv2 improves the real-time DETR baseline with selective multi-scale feature extraction, a discrete sampling operator to ease deployment, and training-only 'bag-of-freebies' that add no inference cost. RT-DETRv2-R18/R50/R101 reach 47.9 / 53.4 / 54.3 mAP on COCO at 217 / 108 / 74 FPS on T4 TensorRT FP16, remaining NMS-free end to end.",content_truncated:!1,metadata:xe({arxiv_id:"2407.17140",authors:[{name:"W. Lv"},{name:"Y. Zhao"},{name:"J. Chang"}],published:"2024-07-24",citation_count:268,tasks:[Re,Oe],methods:[{name:"DETR",slug:"detr"}],repositories:[{url:"https://github.com/lyuwenyu/RT-DETR",stars:9400}]})},"2410.13842":{route_id:"2410.13842",title:"D-FINE: Redefining Regression as Fine-grained Distribution Refinement",content:"D-FINE reformulates bounding-box regression in DETR-style detectors as iterative refinement of probability distributions (FDR) and adds a localization self-distillation scheme (GO-LSD). D-FINE-L reaches 54.0 mAP at ~9 ms and D-FINE-X 55.8 mAP on COCO while staying real-time on modern GPUs, dominating RT-DETRv2 and YOLOv10 on the accuracy–latency Pareto front.",content_truncated:!1,metadata:xe({arxiv_id:"2410.13842",authors:[{name:"Y. Peng"},{name:"H. Li"},{name:"P. Wu"}],published:"2024-10-17",conference:"ICLR 2025",citation_count:187,tasks:[Re,Oe],methods:[{name:"Knowledge Distillation",slug:"knowledge-distillation"}],repositories:[{url:"https://github.com/Peterande/D-FINE",stars:12100}]})},"2406.03459":{route_id:"2406.03459",title:"LW-DETR: A Transformer Replacement to YOLO for Real-Time Detection",content:"LW-DETR pairs a plain ViT encoder with a lightweight DETR decoder and shows the combination outperforms YOLOv8 and YOLO-NAS at comparable latency, arguing transformer detectors are viable even at the fast end of the accuracy–latency curve. Uses multi-level feature aggregation, window-attention interleaving, and IoU-aware classification.",content_truncated:!1,metadata:xe({arxiv_id:"2406.03459",authors:[{name:"Q. Chen"},{name:"X. Su"},{name:"X. Zhang"}],published:"2024-06-05",citation_count:94,tasks:[Re,Oe],methods:[{name:"Vision Transformer",slug:"vision-transformer"}],repositories:[{url:"https://github.com/Atten4Vis/LW-DETR",stars:5200}]})},"2304.08069":{route_id:"2304.08069",title:"DETRs Beat YOLOs on Real-time Object Detection",content:"RT-DETR is the first real-time end-to-end object detector, built on an efficient hybrid encoder that decouples intra-scale interaction and cross-scale fusion, plus IoU-aware query selection. RT-DETR-R50 achieves 53.1 mAP at 108 FPS on COCO, beating comparably sized YOLO detectors in both speed and accuracy while eliminating NMS entirely; its Figure 1 accuracy–latency plot became the reference for later real-time detectors.",content_truncated:!1,metadata:xe({arxiv_id:"2304.08069",authors:[{name:"Y. Zhao"},{name:"W. Lv"},{name:"S. Xu"}],published:"2023-04-17",conference:"CVPR 2024",citation_count:2310,tasks:[Re,Oe],methods:[{name:"DETR",slug:"detr"}],repositories:[{url:"https://github.com/lyuwenyu/RT-DETR",stars:9400}]})},"2405.14458":{route_id:"2405.14458",title:"YOLOv10: Real-Time End-to-End Object Detection",content:"YOLOv10 removes NMS from the YOLO pipeline via consistent dual assignments during training and applies a holistic efficiency–accuracy driven design across the architecture. YOLOv10-S is 1.8x faster than RT-DETR-R18 at similar COCO accuracy; the family spans 46.3–54.4 mAP with substantially lower end-to-end latency than prior YOLOs because post-processing disappears.",content_truncated:!1,metadata:xe({arxiv_id:"2405.14458",authors:[{name:"A. Wang"},{name:"H. Chen"},{name:"L. Liu"}],published:"2024-05-23",conference:"NeurIPS 2024",citation_count:1650,tasks:[Re,Oe],methods:[{name:"NMS-free Training",slug:"nms-free-training"}],repositories:[{url:"https://github.com/THU-MIG/yolov10",stars:44200}]})},"2401.17270":{route_id:"2401.17270",title:"YOLO-World: Real-Time Open-Vocabulary Object Detection",content:"YOLO-World extends the YOLO paradigm to open-vocabulary detection through vision-language modeling with a re-parameterizable vision-language path aggregation network (RepVL-PAN) and region-text contrastive pretraining. It detects categories never seen at training time while running at 35+ FPS, and its prompt-then-detect deployment re-parameterizes text embeddings for zero runtime text-encoder cost.",content_truncated:!1,metadata:xe({arxiv_id:"2401.17270",authors:[{name:"T. Cheng"},{name:"L. Song"},{name:"Y. Ge"}],published:"2024-01-30",conference:"CVPR 2024",citation_count:890,tasks:[{name:"Open-Vocabulary Object Detection",slug:"open-vocabulary-object-detection"},Re],methods:[{name:"Contrastive Learning",slug:"contrastive-learning"}],repositories:[{url:"https://github.com/AILab-CVC/YOLO-World",stars:16800}]})},158342:{route_id:"158342",title:"Ultralytics YOLO: real-time detection framework and model zoo",content:"Official Ultralytics framework release covering YOLO11 and YOLOv12 deployment: pretrained COCO checkpoints from nano to x-large, TensorRT/ONNX/CoreML export paths, and reproducible latency benchmarks on T4, Jetson Orin, and CPU targets. Widely used as the practical baseline for real-time detection deployments.",content_truncated:!1,metadata:xe({source:"external",source_url:"https://docs.ultralytics.com/models/",authors:[{name:"Ultralytics"}],published:"2025-01-02",tasks:[Re,Oe],repositories:[{url:"https://github.com/ultralytics/ultralytics",stars:46e3}],project_pages:[{url:"https://docs.ultralytics.com"}]})}},Ot=e=>e.map(t=>vn[t]),gt=Ot(["2502.12524","2407.17140","2410.13842","2406.03459","2304.08069","2405.14458","2401.17270","158342"]),yt=Ot(["2410.13842","2502.12524","2407.17140","2405.14458","2304.08069"]),bt="The user wants the current state-of-the-art for real-time object detection. That's a moving target split across two lineages — the YOLO family (fast CNN one-stage detectors) and the DETR family (transformer, end-to-end, NMS-free). I should ground the answer in recent papers benchmarked on COCO with reported latency or FPS, not just accuracy. Let me start with a broad hybrid search, see which papers surface, then run a second, narrower query to pin down the head-to-head COCO mAP vs latency trade-offs before I write anything.",_t="Good — both lineages are well represented. YOLOv12, YOLOv10 and RT-DETRv2 / D-FINE keep coming up. To actually rank them I need the accuracy-vs-latency numbers side by side on the same COCO val2017 protocol, so let me narrow the query to the benchmark comparison specifically.",vt=`There isn't a single winner — real-time object detection in 2026 is a two-horse race between the [YOLO family](paper:2502.12524) (fast one-stage CNNs) and the end-to-end [DETR family](paper:2304.08069) (NMS-free transformers). Which one is “SOTA” depends entirely on where you sit on the accuracy-vs-latency curve. + +**At the fast / edge end**, [YOLOv12](paper:2502.12524) is the current leader. Its area-attention design pushes attention into the YOLO backbone without the usual latency hit — YOLOv12-N reaches 40.6 mAP at ~1.6 ms on a T4, roughly +1.5 mAP over [YOLOv10](paper:2405.14458) at matched speed. [YOLOv10](paper:2405.14458) is still very relevant because it made the YOLO head NMS-free, cutting real end-to-end latency. + +**At the high-accuracy end**, the transformer detectors win. [D-FINE](paper:2410.13842) currently holds the accuracy-latency Pareto front, reporting 55.8 mAP by reformulating box regression as fine-grained distribution refinement with self-distillation. It builds on [RT-DETRv2](paper:2407.17140), which hardened the [original RT-DETR](paper:2304.08069) recipe (the paper that first showed DETRs beating YOLOs in real time) with training-only “bag-of-freebies” that add no inference cost. + +**My recommendation:** for edge or high-FPS deployment, start with [YOLOv12](paper:2502.12524) — the [Ultralytics framework](paper:158342) has ready-made checkpoints and export paths. If you have GPU headroom and want maximum accuracy while staying real-time, use [D-FINE](paper:2410.13842) or [RT-DETRv2](paper:2407.17140). And if you need open-vocabulary detection rather than fixed COCO classes, [YOLO-World](paper:2401.17270) is the one to look at.`,wn=["How do these compare on edge devices like Jetson?","Show me open-vocabulary detectors","What about small-object detection?"];async function*xn(e,t){const n=()=>(t==null?void 0:t.aborted)===!0,s=e.trim().slice(0,90)||"state-of-the-art real-time object detection";if(yield{type:"stream_start",request_id:"req_mock",session_id:null},await se(350,t),!n()){yield{type:"reasoning_start"};for(let a=0;a{const t=String("0").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"},Rn=()=>!0;class Le extends Error{constructor(t,n,s,a){super(t),this.code=n,this.status=s,this.retryAfterSeconds=a,this.name="ChatStreamError"}}function Sn(e,t){if(Ne())try{Be.reportLatency(e,t).catch(()=>{})}catch{}}function En(e,t={}){return Ne()?kn(e,t.signal):xn(e.message,t.signal)}function Cn(e,t={}){return Tn(e,t.signal)}async function*kn(e,t){const n=await Be.stream(e,t);yield*It(n)}async function*Tn(e,t){const n=await Be.resumeStream(e,t);yield*It(n)}async function*It(e){if(!e.ok||!e.body){const a=e.ok?null:new Pt(e,await e.text());a&&Ft(a);const m=a==null?void 0:a.detail,u=typeof m=="object"&&m!==null?m:null,g=e.status===403&&!m,c=Number(e.headers.get("Retry-After")),C=Number.isFinite(c)&&c>=0?Math.min(300,Math.ceil(c)):void 0;throw new Le(g?"Chat on staging is limited to approved Hugging Face users. Sign in with an approved account and try again.":(a==null?void 0:a.message)||`Chat stream failed (${e.status})`,u&&"code"in u&&typeof u.code=="string"?u.code:g?"staging_access_required":void 0,e.status,C)}const t=e.body.getReader(),n=new TextDecoder;let s="";try{for(;;){const{done:a,value:m}=await t.read();if(a)break;s+=n.decode(m,{stream:!0});let u;for(;(u=s.indexOf(` + +`))!==-1;){const g=s.slice(0,u);s=s.slice(u+2);const c=g.split(` +`).filter(C=>C.startsWith("data:")).map(C=>C.slice(5).trimStart()).join(` +`);!c||c==="[DONE]"||(yield JSON.parse(c))}}}finally{t.releaseLock()}}const On="https://huggingface.co/settings/inference-providers",In="https://paperswithcode.co/chat",wt="pwc.chat.billing-notice-dismissed.v1";function An({provider:e}){const[t,n]=o.useState(()=>localStorage.getItem(wt)==="1");return!Ne()||t||e!=="huggingface"?null:r.jsxs("div",{className:"chat-billing-notice",role:"note",children:[r.jsx("span",{children:"Hugging Face models use the inference permission granted when you start chatting. Included monthly credits are used first, then extra usage requires purchased credits. You can choose organization billing in Settings."}),r.jsxs("div",{className:"chat-billing-notice-actions",children:[r.jsx("a",{href:"/settings",children:"Review billing"}),r.jsx("a",{href:On,target:"_blank",rel:"noreferrer",children:"Review usage"}),r.jsx("button",{type:"button",className:"chat-billing-notice-dismiss","aria-label":"Dismiss billing notice",title:"Dismiss",onClick:()=>{localStorage.setItem(wt,"1"),n(!0)},children:r.jsx(Yt,{size:15,"aria-hidden":"true"})})]})]})}function jn({enabled:e,fallbackEnabled:t,byokExpected:n}){const s=zt(e);if(!e||!s.data)return null;const a=s.data,m=Jt(a.resets_at),u=a.unavailable_reason==="staging_funding_disabled",g=a.unavailable_reason==="shared_credits_exhausted"||a.unavailable_reason==="workspace_limit_exhausted"||a.unavailable_reason==="provider_status_unavailable";return r.jsxs("div",{className:"chat-openrouter-usage",role:"status",children:[r.jsx("span",{children:u?r.jsx("strong",{children:"Chat is now live on paperswithcode.co"}):g?r.jsxs(r.Fragment,{children:[r.jsx("strong",{children:"Shared OpenRouter credits unavailable"})," · ",a.remaining_percent,"% of your allowance remains"]}):r.jsxs(r.Fragment,{children:[r.jsxs("strong",{children:[a.remaining_percent,"% left"]})," this month · resets ",m.local]})}),u?r.jsxs("span",{children:[r.jsx("a",{href:a.production_chat_url||In,children:"Continue on production"}),t&&" · Your connected OpenRouter key remains available on staging."]}):(!a.available||n)&&r.jsx("span",{children:t?"Your connected OpenRouter key will be used on your next explicit send.":r.jsxs(r.Fragment,{children:[r.jsx("a",{href:"/settings#openrouter-byok",children:"Connect your own key in Settings"})," to continue."]})})]})}function xt({variant:e,composerProps:t,provider:n,openRouterFallbackEnabled:s,byokExpected:a,paused:m,suggestions:u=[]}){var c;const g=r.jsxs(r.Fragment,{children:[r.jsx(An,{provider:n}),r.jsx(jn,{enabled:n==="openrouter",fallbackEnabled:s,byokExpected:a}),m&&r.jsx("div",{id:"chat-paused-description",className:"chat-paused-banner",role:"status",children:"Chat is temporarily disabled. You can keep browsing and editing your conversations. New research runs will return when chat is restored."}),r.jsx(Kt,{...t,...e==="empty"?{autoFocus:!0}:{placeholder:(c=t.draft)!=null&&c.text?"Edit and send again…":"Ask a follow-up…"}}),e==="empty"&&r.jsx("div",{className:"chat-examples",children:u.map(C=>r.jsx("button",{type:"button",className:"chat-example",disabled:m,onClick:()=>t.onSend({text:C,paperMentions:[]}),children:C},C))})]});return e==="empty"?g:r.jsx("div",{className:"chat-composer-wrap",children:r.jsxs("div",{className:"chat-composer-inner",children:[g,r.jsx("div",{className:"chat-composer-foot",children:Ne()?r.jsxs(r.Fragment,{children:[n==="openrouter"?r.jsxs("span",{className:"chat-provider-attribution",children:["Powered by ",r.jsx("a",{href:"https://openrouter.ai",target:"_blank",rel:"noreferrer",children:"OpenRouter"}),"."]}):r.jsxs("span",{className:"chat-provider-attribution",children:["Powered by 🤗 ",r.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"}),"."]}),r.jsx("span",{children:"The AI assistant can make mistakes. Double-check responses."})]}):r.jsx(r.Fragment,{children:"Assistant preview — responses are simulated."})})]})})}function Ln({messages:e,papers:t,busy:n,queuedDraft:s,paperMentionsEnabled:a,archivePending:m,openRouterFallbackEnabled:u,onToggleBlock:g,onEditAndResend:c,onArchiveOld:C,onArchiveOldest:L}){var _,b;const[w,x]=o.useState(null),D=o.useRef(null),k=o.useRef(null),N=o.useRef(null);o.useEffect(()=>{n?x(null):N.current=null},[n]),o.useLayoutEffect(()=>{const d=D.current;if(d){if(k.current!==null){d.scrollTop=k.current,k.current=null;return}if(N.current){const A=Array.from(d.querySelectorAll("[data-message-id]")).find(E=>E.dataset.messageId===N.current);if(A){const E=d.getBoundingClientRect(),H=A.getBoundingClientRect();d.scrollTop+=H.top-E.top-24;return}}d.scrollTop=d.scrollHeight}},[e]);const P=e.filter(d=>d.role==="user"),q=(_=P[0])==null?void 0:_.id,ne=(b=P.at(-1))==null?void 0:b.id,O=(d,A)=>{var E;k.current=((E=D.current)==null?void 0:E.scrollTop)??null,g(d,A)};return r.jsx("div",{className:"chat-conversation",ref:D,children:r.jsxs("div",{className:"chat-conversation-inner",children:[e.length===0&&(s==null?void 0:s.text)&&r.jsx(mt,{id:"queued-launch-preview",text:s.text,paperMentions:s.paperMentions,isInitial:!0}),e.map(d=>d.role==="user"?r.jsx(mt,{id:d.id,text:d.text??"",paperMentions:d.paperMentions??[],paperMentionsEnabled:a,isInitial:d.id===q,editingAllowed:!n&&!!d.revision,editing:w===d.id,editNotice:d.id===q?"Sending will replace this conversation.":d.id===ne?"Sending will replace the response.":"Sending will replace the response and all messages after it.",onEdit:()=>x(d.id),onCancel:()=>x(null),onResendDraft:A=>{d.id!==q&&(N.current=d.id);const E=c(d.id,A);return E?x(null):N.current=null,E}},d.id):r.jsx(Qt,{msg:d,papers:t,onToggleBlock:O,onArchiveOldChats:C,onArchiveOldestChats:L,archivePending:m,hfBilling:null,openRouterFallbackEnabled:u,feedbackEnabled:!0},d.id))]})})}function Nn({retryAt:e,onRetry:t,onCancel:n}){const[s,a]=o.useState(()=>Math.max(0,Math.ceil((e-Date.now())/1e3))),m=o.useRef(null);return o.useEffect(()=>{var C;const u=document.activeElement instanceof HTMLElement?document.activeElement:null;(C=m.current)==null||C.focus();const g=()=>a(Math.max(0,Math.ceil((e-Date.now())/1e3)));g();const c=window.setInterval(g,250);return()=>{window.clearInterval(c),u==null||u.focus()}},[e]),r.jsx("div",{className:"chat-capacity-dialog-backdrop",role:"presentation",children:r.jsxs("div",{className:"chat-capacity-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-capacity-dialog-title","aria-describedby":"chat-capacity-dialog-description",onKeyDown:u=>{u.key==="Escape"&&(u.preventDefault(),n())},children:[r.jsx("h2",{id:"chat-capacity-dialog-title",children:"All research slots are currently in use"}),r.jsx("p",{id:"chat-capacity-dialog-description",children:"Your message was not sent or billed. Try again in a few seconds."}),r.jsx("p",{className:"chat-capacity-countdown","aria-live":"polite",children:s>0?`Try again available in ${s} second${s===1?"":"s"}.`:"You can try again now."}),r.jsxs("div",{className:"chat-capacity-dialog-actions",children:[r.jsx("button",{type:"button",className:"chat-capacity-cancel",ref:m,onClick:n,children:"Cancel"}),r.jsx("button",{type:"button",className:"chat-capacity-retry",disabled:s>0,onClick:t,children:"Try again"})]})]})})}function Mn({onClose:e}){const t=o.useRef(null);return o.useEffect(()=>{var s;const n=document.activeElement instanceof HTMLElement?document.activeElement:null;return(s=t.current)==null||s.focus(),()=>n==null?void 0:n.focus()},[]),r.jsx("div",{className:"chat-capacity-dialog-backdrop",role:"presentation",children:r.jsxs("div",{className:"chat-capacity-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-disabled-title","aria-describedby":"chat-disabled-description",onKeyDown:n=>{n.key==="Escape"&&(n.preventDefault(),e())},children:[r.jsx("h2",{id:"chat-disabled-title",children:"Chat is temporarily disabled"}),r.jsx("p",{id:"chat-disabled-description",children:"We've temporarily paused new research runs. Your message wasn't sent, and your draft is still here. Please try again later."}),r.jsx("div",{className:"chat-capacity-dialog-actions",children:r.jsx("button",{ref:t,type:"button",className:"chat-capacity-cancel",onClick:e,children:"Keep editing"})})]})})}function Dn({url:e,onClose:t}){return e?r.jsx("div",{className:"chat-share-dialog-backdrop",role:"presentation",onMouseDown:t,children:r.jsxs("div",{className:"chat-share-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-share-dialog-title",onMouseDown:n=>n.stopPropagation(),children:[r.jsx("h2",{id:"chat-share-dialog-title",children:"Public link created"}),r.jsx("p",{children:"Anyone with this link can see this conversation. It could not be copied automatically, so copy it manually:"}),r.jsx("input",{readOnly:!0,value:e,"aria-label":"Public conversation link",autoFocus:!0,onFocus:n=>n.currentTarget.select()}),r.jsx("button",{type:"button",onClick:t,children:"Close"})]})}):null}function Pn({sessions:e,activeSessionId:t,loading:n,error:s,open:a,onClose:m,onNew:u,onNavigate:g,onRename:c,onDelete:C}){const[L,w]=o.useState(null),[x,D]=o.useState(""),[k,N]=o.useState(null);o.useEffect(()=>{if(!k)return;const O=()=>N(null),_=b=>{b.key==="Escape"&&O()};return window.addEventListener("click",O),window.addEventListener("keydown",_),()=>{window.removeEventListener("click",O),window.removeEventListener("keydown",_)}},[k]);const P=O=>{w(O.id),D(O.title)},q=async O=>{const _=x.trim();_&&await c(O,_)&&w(null)},ne=(O,_,b)=>N({id:O,x:_,y:b});return r.jsxs("aside",{className:`chat-sidebar${a?"":" chat-sidebar-closed"}`,children:[r.jsxs("div",{className:"chat-sidebar-top",children:[r.jsxs("button",{type:"button",className:"chat-new-chat",onClick:u,children:[r.jsx(tn,{})," New chat"]}),r.jsx("button",{type:"button",className:"icon-btn",onClick:m,title:"Collapse sidebar",children:r.jsx(Ct,{})})]}),r.jsxs("nav",{className:"chat-sessions","aria-label":"Chat history",children:[n&&r.jsx("div",{className:"chat-sessions-empty",children:"Loading chats…"}),!n&&s&&r.jsx("div",{className:"chat-sessions-empty",children:s}),!n&&!s&&e.length===0&&r.jsx("div",{className:"chat-sessions-empty",children:"Conversations you start will show up here."}),nn(e).map(O=>r.jsxs("div",{className:"chat-session-group",children:[r.jsx("div",{className:"chat-session-group-label",children:O.label}),O.items.map(_=>r.jsxs("div",{className:`chat-session${_.id===t?" chat-session-active":""}`,role:"button",tabIndex:0,onClick:()=>g(_.id),onKeyDown:b=>{if(b.key==="Enter"&&g(_.id),b.key==="F2"&&P(_),b.key==="ContextMenu"||b.shiftKey&&b.key==="F10"){b.preventDefault();const d=b.currentTarget.getBoundingClientRect();ne(_.id,d.right-150,d.bottom)}},onContextMenu:b=>{b.preventDefault(),ne(_.id,b.clientX,b.clientY)},children:[L===_.id?r.jsx("input",{className:"chat-session-title-input",value:x,autoFocus:!0,maxLength:80,onClick:b=>b.stopPropagation(),onChange:b=>D(b.target.value),onBlur:()=>void q(_.id),onKeyDown:b=>{b.stopPropagation(),b.key==="Enter"&&q(_.id),b.key==="Escape"&&w(null)}}):r.jsx("span",{className:"chat-session-title",children:_.title}),r.jsx("button",{type:"button",className:"chat-session-menu","aria-label":"Chat actions","aria-haspopup":"menu",title:"Chat actions",onClick:b=>{b.stopPropagation();const d=b.currentTarget.getBoundingClientRect();ne(_.id,d.right-150,d.bottom)},children:"⋯"}),r.jsx("button",{type:"button",className:"chat-session-delete","aria-label":"Delete conversation",onClick:b=>{b.stopPropagation(),C(_.id)},children:r.jsx(rn,{})})]},_.id))]},O.label))]}),k&&r.jsx("div",{className:"chat-session-context-menu",role:"menu",style:{left:k.x,top:k.y},onClick:O=>O.stopPropagation(),children:r.jsx("button",{type:"button",role:"menuitem",autoFocus:!0,onClick:()=>{const O=e.find(_=>_.id===k.id);O&&P(O),N(null)},children:"Rename chat"})})]})}function Fn({sessionId:e,busy:t,loading:n,onError:s}){const{toast:a}=Et(),[m,u]=o.useState(!1),[g,c]=o.useState(""),C=async()=>{var L;if(!(t||m)){u(!0);try{const w=await sn(e),x=new URL(w.public_path,window.location.origin).toString();try{if(!((L=navigator.clipboard)!=null&&L.writeText))throw new Error("Clipboard unavailable");await navigator.clipboard.writeText(x),a({className:"chat-share-toast",duration:5e3,title:"Public link copied to your clipboard",description:"Anyone with this link can see this conversation."})}catch{c(x)}}catch(w){const x=w instanceof Error?w.message:"Could not share this conversation";s(x),a({variant:"destructive",title:"Share failed",description:x})}finally{u(!1)}}};return r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"chat-share-button",onClick:()=>void C(),disabled:t||m||n,"aria-label":"Share conversation",children:[m?r.jsx(kt,{}):r.jsx(_n,{"aria-hidden":"true"}),r.jsx("span",{children:"Share"})]}),r.jsx(Dn,{url:g,onClose:()=>c("")})]})}function Yn({messages:e,refreshSessions:t,resetChat:n,restoreDraft:s,clearTitle:a}){const{toast:m}=Et(),[u,g]=o.useState(null),c=()=>{const w=[...e].reverse().find(x=>x.role==="user");n(),s({text:(w==null?void 0:w.text)??"",paperMentions:(w==null?void 0:w.paperMentions)??[]}),a()};return{pending:u,archiveOld:async()=>{if(u===null){g("old");try{const w=await on();if(await t(),w.archived_count===0){m({title:"No chats were archived",description:"There are no inactive chats older than 30 days."});return}c(),m({title:`${w.archived_count} ${w.archived_count===1?"chat":"chats"} archived`,description:"Your question is ready to send again."})}catch(w){m({variant:"destructive",title:"Could not archive old chats",description:w instanceof Error?w.message:"Try again."})}finally{g(null)}}},archiveOldest:async()=>{if(u===null){g("oldest");try{const w=await an();await t(),c(),m({title:`${w.archived_count} ${w.archived_count===1?"chat":"chats"} archived`,description:"Your question is ready to send again."})}catch(w){m({variant:"destructive",title:"Could not archive chats",description:w instanceof Error?w.message:"Try again."})}finally{g(null)}}}}}class Un{constructor(t,n=Sn){Te(this,"requestId");Te(this,"firstVisibleAt");Te(this,"streamStartReported",!1);Te(this,"firstVisibleReported",!1);Te(this,"terminalReported",!1);Te(this,"semanticReported",new Set);this.submittedAt=t,this.report=n}recordStreamStart(t,n){this.requestId=t,this.streamStartReported||(this.streamStartReported=!0,this.send({submission_to_stream_start_ms:Math.max(0,n-this.submittedAt)})),this.reportFirstVisible()}recordFirstVisible(t){this.firstVisibleAt===void 0&&(this.firstVisibleAt=t,this.reportFirstVisible())}recordSemantic(t,n){if(this.semanticReported.has(t))return;this.semanticReported.add(t);const s=Math.max(0,n-this.submittedAt);this.send(t==="reasoning"?{submission_to_first_reasoning_delta_ms:s}:t==="tool"?{submission_to_first_tool_call_ms:s}:{submission_to_first_answer_delta_ms:s})}recordTerminal(t){this.terminalReported||(this.terminalReported=!0,this.send({terminal_classification:t}))}reportFirstVisible(){!this.requestId||this.firstVisibleAt===void 0||this.firstVisibleReported||(this.firstVisibleReported=!0,this.send({submission_to_first_visible_delta_ms:Math.max(0,this.firstVisibleAt-this.submittedAt)}))}send(t){this.requestId&&this.report(this.requestId,t)}}const At="Preparing research workspace…",jt={preparing_workspace:"Preparing secure workspace…",starting_agent:"Starting research agent…",connecting_model:"Connecting to model…"},Lt=()=>({messages:[],sessionId:null,title:"",phase:"idle"});function Rt(e,t){for(let n=e.length-1;n>=0;n-=1)if(t(e[n]))return n;return-1}function qe(e){if(e.status!==At&&!Object.values(jt).includes(e.status))return e;const{status:t,...n}=e;return n}function ae(e,t){if(!e.length)return e;const n=e.slice();return n[n.length-1]=t(n[n.length-1]),n}function St(e,t,n){return ae(e,s=>{const a=qe(s),m=a.blocks??[];return{...a,blocks:m.map((u,g)=>t(u,g,m)?n(u):u)}})}function qn(e,t){switch(t.type){case"stream_start":return t.session_id?{...e,sessionId:t.session_id}:e;case"sandbox_start":case"sandbox_ready":case"workspace_ready":return e;case"lifecycle":return{...e,messages:ae(e.messages,n=>{var s;return n.role==="assistant"&&n.streaming&&(((s=n.blocks)==null?void 0:s.length)??0)===0?{...n,status:jt[t.phase]}:n})};case"session_title_start":return{...e,title:""};case"session_title_delta":return{...e,title:`${e.title}${t.text}`.replace(/\s+/g," ").slice(0,80)};case"session_title_done":return{...e,title:t.title};case"reasoning_start":return{...e,messages:ae(e.messages,n=>{const s=qe(n);return{...s,blocks:[...(s.blocks??[]).map(a=>a.kind==="reasoning"&&a.active?{...a,active:!1,open:!1}:a),{kind:"reasoning",text:"",active:!0,open:!0}]}})};case"reasoning_delta":return{...e,messages:St(e.messages,(n,s,a)=>n.kind==="reasoning"&&Rt(a,m=>m.kind==="reasoning")===s,n=>n.kind==="reasoning"?{...n,text:n.text+t.text}:n)};case"reasoning_end":return{...e,messages:ae(e.messages,n=>{const s=n.blocks??[],a=Rt(s,g=>g.kind==="reasoning"&&g.active);if(a<0)return n;const m=s[a];if(m.kind!=="reasoning")return n;const u=s[a-1];return(u==null?void 0:u.kind)==="reasoning"&&u.text===m.text?{...n,blocks:s.filter((g,c)=>c!==a)}:{...n,blocks:s.map((g,c)=>c===a?{...m,active:!1,open:!1}:g)}})};case"tool_call":return{...e,messages:ae(e.messages,n=>{const s=qe(n);return{...s,blocks:[...s.blocks??[],{kind:"tool",id:t.id,name:t.name,args:t.args,status:"running",open:!1}]}})};case"tool_result":return{...e,messages:St(e.messages,n=>n.kind==="tool"&&n.id===t.id,n=>n.kind!=="tool"?n:t.status?{...n,schema_version:2,status:t.status,took_ms:t.took_ms,content:t.content,metadata:t.metadata,open:t.status!=="success"}:{...n,status:"done",hits:t.hits,took_ms:t.took_ms,results:t.results})};case"answer_delta":return{...e,messages:ae(e.messages,n=>{const s=qe(n),a=s.blocks??[],m=a.at(-1);return(m==null?void 0:m.kind)==="answer"&&!m.done?{...s,blocks:[...a.slice(0,-1),{...m,text:m.text+t.text}]}:{...s,blocks:[...a,{kind:"answer",text:t.text,done:!1}]}})};case"done":return{...e,phase:"complete",messages:ae(e.messages,n=>({...n,streaming:!1,followups:t.followups,finishReason:t.finish_reason,citations:t.citations,blocks:(n.blocks??[]).map(s=>s.kind==="answer"?{...s,done:!0}:s.kind==="reasoning"&&s.active?{...s,active:!1,open:!1}:s)}))};case"error":return{...e,phase:"failed",messages:ae(e.messages,n=>({...n,streaming:!1,error:t.message,errorCode:t.code,blocks:(n.blocks??[]).map(s=>s.kind==="reasoning"&&s.active?{...s,active:!1,open:!1}:s)}))}}}function Bn(e){return ae(e,t=>{if(t.role!=="assistant")return t;const n=(t.blocks??[]).flatMap(s=>s.kind==="tool"&&s.status==="running"?[]:s.kind==="reasoning"&&s.active?s.text?[{...s,active:!1,open:!1}]:[]:s.kind==="answer"?[{...s,done:!0}]:[s]);return{...t,blocks:n,streaming:!1,finishReason:"stopped"}})}function Ye(e,t){switch(t.type){case"start":return{messages:t.messages,sessionId:t.sessionId,title:"",phase:"streaming"};case"event":return qn(e,t.event);case"load":return{messages:t.messages,sessionId:t.sessionId,title:e.title,phase:"idle"};case"workspace_status":return{...e,messages:ae(e.messages,n=>{var s;return n.role==="assistant"&&n.streaming&&(((s=n.blocks)==null?void 0:s.length)??0)===0&&!n.error?{...n,status:At}:n})};case"clear_workspace_status":return{...e,messages:ae(e.messages,qe)};case"settle":return{...e,phase:"idle",messages:ae(e.messages,n=>n.streaming?{...n,streaming:!1}:n)};case"stop":return{...e,messages:Bn(e.messages),phase:"stopped"};case"reset":return Lt()}}const Se={minDelayMs:5,maxDelayMs:80,minRateCharsPerMs:.3,maxBufferedMs:400,arrivalRateTauMs:1e3,arrivalRateHeadroom:1.1,maxPendingChars:64},Hn={now:()=>performance.now(),sleep:(e,t)=>new Promise(n=>{if(t!=null&&t.aborted||e<=0){n();return}const s=window.setTimeout(a,e);function a(){t==null||t.removeEventListener("abort",a),window.clearTimeout(s),n()}t==null||t.addEventListener("abort",a,{once:!0})})};function Vn(e){return!["stream_start","sandbox_start","sandbox_ready","workspace_ready","session_title_start","session_title_delta","session_title_done"].includes(e.type)}function Wn(e,t=!1,n=Se.maxPendingChars){var a;if(!e)return{pieces:[],pending:""};if(t)return{pieces:[e],pending:""};const s=Intl.Segmenter;if(s){const u=[...new s(void 0,{granularity:"word"}).segment(e)].filter(c=>c.isWordLike);let g=0;if(u.length>1&&(g=u.at(-1).index),u.length&&/\s$/u.test(e)&&(g=e.length),g>0){const c=e.slice(0,g),C=[],w=[...new s(void 0,{granularity:"word"}).segment(c)].filter(x=>x.isWordLike);for(let x=0;xD&&C.push(c.slice(D,k))}return w.length||C.push(c),{pieces:C,pending:e.slice(g)}}}else{const m=[...e.matchAll(/\s+/gu)];if(m.length){const u=[];let g=0;for(const c of m){const C=c.index+c[0].length;u.push(e.slice(g,C)),g=C}return{pieces:u,pending:e.slice(g)}}}return e.length>=n?{pieces:[e.slice(0,n)],pending:e.slice(n)}:{pieces:[],pending:e}}function $n(e,t={}){const n={minDelayMs:t.minDelayMs??Se.minDelayMs,maxDelayMs:t.maxDelayMs??Se.maxDelayMs,minRateCharsPerMs:t.minRateCharsPerMs??Se.minRateCharsPerMs,maxBufferedMs:t.maxBufferedMs??Se.maxBufferedMs,arrivalRateTauMs:t.arrivalRateTauMs??Se.arrivalRateTauMs,arrivalRateHeadroom:t.arrivalRateHeadroom??Se.arrivalRateHeadroom,maxPendingChars:t.maxPendingChars??Se.maxPendingChars},s=t.clock??Hn,a=[];let m="",u=null,g=0,c=!0,C=!1,L=null,w=0,x=s.now();const D=()=>{L==null||L(),L=null},k=(_,b)=>{const d=_.type==="reasoning_delta"||_.type==="answer_delta"?_.text.length:0;a.push({kind:"event",event:_,arrivedAt:b,chars:d}),D()},N=_=>{if(!u||!m)return;const b=Wn(m,_,n.maxPendingChars);for(const d of b.pieces)d&&k({type:u,text:d},g),g=s.now();m=b.pending,m||(u=null)},P=_=>{if(!c)return;const b=s.now();if(_.type==="reasoning_delta"||_.type==="answer_delta"){const d=_.type;if(!_.text)return;u&&u!==d&&N(!0),u||(u=d,g=b),m+=_.text;const A=Math.max(0,b-x);for(w*=Math.exp(-A/n.arrivalRateTauMs),w+=_.text.length,x=b,N(!1);m.length>=n.maxPendingChars;)N(!1);return}Vn(_)&&N(!0),k(_,b)},q=(async()=>{var _;try{for await(const b of e)P(b);c&&N(!0)}catch(b){c&&!((_=t.signal)!=null&&_.aborted)&&(N(!0),a.push({kind:"error",error:b,arrivedAt:s.now(),chars:0}))}finally{C=!0,D()}})(),ne=()=>a.length||C?Promise.resolve():new Promise(_=>{L=_});return{events:async function*(){var b,d,A,E;let _=Number.NEGATIVE_INFINITY;try{for(;;){if(await ne(),!a.length){if(C||!c)return;continue}const H=a[0];if(H.kind==="error")throw a.shift(),H.error;if(H.chars&&!((b=t.isHidden)!=null&&b.call(t))){const W=s.now(),T=a.reduce((he,Ce)=>he+Ce.chars,0),J=((d=a.find(he=>he.chars))==null?void 0:d.arrivedAt)??W,Ee=Math.max(0,n.maxBufferedMs-(W-J)),V=w*Math.exp(-Math.max(0,W-x)/n.arrivalRateTauMs)/n.arrivalRateTauMs,G=Ee>0?T/Ee:Number.POSITIVE_INFINITY,Q=Math.max(n.minRateCharsPerMs,V*n.arrivalRateHeadroom,G),ue=Math.min(n.maxDelayMs,Math.max(n.minDelayMs,H.chars/Q)),K=Math.max(0,H.arrivedAt+n.maxBufferedMs-W),de=Math.max(H.arrivedAt,_+Math.min(ue,K));if(await s.sleep(Math.max(0,de-s.now()),t.signal),!c||(A=t.signal)!=null&&A.aborted)return}a.shift(),_=s.now(),yield H.event}}finally{c&&(c=!1,D(),await((E=e.return)==null?void 0:E.call(e,void 0))),await q}}(),takeAcceptedForStop(){var b;if(!c)return[];c=!1,u&&m&&(k({type:u,text:m},g),m="",u=null);const _=a.flatMap(d=>d.kind==="event"&&d.event.type!=="done"&&d.event.type!=="error"?[d.event]:[]);return a.length=0,D(),(b=e.return)==null||b.call(e,void 0),_}}}const Gn=750;function Kn(e,t){for(let n=e.length-1;n>=0;n-=1)if(t(e[n]))return n;return-1}function Ue(e){const t=o.useRef(e);return o.useLayoutEffect(()=>{t.current=e}),o.useCallback((...n)=>t.current(...n),[])}function Qn(e){const[t,n]=o.useState([]),[s,a]=o.useState(!1),[m,u]=o.useState(""),g=o.useRef(!1),c=o.useRef(null),C=o.useRef(null),L=o.useRef(null),w=o.useRef(null),x=o.useRef(!1),D=o.useRef(null),k=o.useRef(null),N=o.useRef("cleared"),P=o.useRef(null),q=o.useRef(null),[ne,O]=o.useState(null),[_,b]=o.useState(null),d=o.useRef([]),A=o.useRef(Lt()),E=o.useRef(null),H=o.useRef(null),W=o.useRef(!1),T=o.useRef(e),J=o.useRef({text:"",paperMentions:[]}),Ee=o.useRef(0),V=o.useRef(0),G=o.useRef(e.sessionId),Q=o.useRef(e.sessionId);Q.current!==e.sessionId&&(Q.current=e.sessionId,G.current!==e.sessionId&&(V.current+=1,P.current=null)),T.current=e,d.current=t,o.useEffect(()=>()=>{var l;k.current!==null&&window.clearTimeout(k.current),(l=c.current)==null||l.abort(),C.current=null,L.current!==null&&cancelAnimationFrame(L.current),w.current!==null&&window.clearTimeout(w.current),q.current=null},[]),o.useEffect(()=>{g.current||(G.current=e.sessionId)},[e.sessionId]),o.useEffect(()=>{const l=g.current&&e.sessionId===G.current?E.current:null;W.current=l!==null,l&&(n(l),d.current=l)},[e.sessionId]);const ue=o.useMemo(()=>{const l={};for(const R of t)for(const S of R.blocks??[])if(S.kind==="tool")for(const h of S.results??[])l[h.route_id]=h;return l},[t]),K=()=>`m${++Ee.current}_${Date.now().toString(36)}`,de=(l,R=!0)=>{const S={...A.current,messages:E.current??d.current,sessionId:G.current},h=Ye(S,l);A.current=h,E.current&&(E.current=h.messages);const y=l.type==="event"&&l.event.type==="stream_start"?l.event.session_id:null;return y?(G.current=y,T.current.onSessionId(y)):h.sessionId&&h.sessionId!==S.sessionId&&(G.current=h.sessionId,T.current.onSessionId(h.sessionId)),h.title!==S.title&&T.current.onTitle(h.title),R&&(d.current=h.messages,n(h.messages)),h},he=()=>H.current===V.current||W.current,Ce=()=>{L.current!==null&&(cancelAnimationFrame(L.current),L.current=null),w.current!==null&&(window.clearTimeout(w.current),w.current=null)},ie=()=>{Ce(),document.visibilityState!=="hidden"&&(!W.current||!E.current||(x.current=!1,d.current=E.current,n(E.current)))},Me=()=>{if(!W.current||document.visibilityState==="hidden"||L.current!==null||w.current!==null)return;const l=()=>{L.current=null,w.current=null,ie()};typeof requestAnimationFrame=="function"?L.current=requestAnimationFrame(l):w.current=window.setTimeout(l,0)};o.useEffect(()=>{const l=()=>{document.visibilityState==="visible"&&x.current&&Me()};return document.addEventListener("visibilitychange",l),()=>document.removeEventListener("visibilitychange",l)});const be=l=>{if(c.current!==l||(k.current!==null&&(window.clearTimeout(k.current),k.current=null),N.current==="cleared"))return;const R=N.current==="shown";N.current="cleared",R&&de({type:"clear_workspace_status"},he())},He=(l,R)=>{k.current!==null&&window.clearTimeout(k.current),N.current="armed",k.current=window.setTimeout(()=>{k.current=null,!(N.current!=="armed"||c.current!==l||l.signal.aborted||V.current!==R)&&(N.current="shown",de({type:"workspace_status"},he()))},Gn)},re=(l,R)=>{const S=P.current;!S||S.controller!==l||S.tracker.recordStreamStart(R,performance.now())},fe=(l,R)=>{const S=P.current;!S||S.controller!==l||S.tracker.recordTerminal(R)};o.useLayoutEffect(()=>{const l=P.current;if(!l)return;const R=t.at(-1);if((R==null?void 0:R.role)!=="assistant"||!(R.blocks??[]).some(y=>y.kind==="tool"||y.kind==="reasoning"&&!!y.text.trim()||y.kind==="answer"&&!!y.text.trim()))return;const h=performance.now();l.tracker.recordFirstVisible(h);for(const y of R.blocks??[])y.kind==="reasoning"&&y.text.trim()?l.tracker.recordSemantic("reasoning",h):y.kind==="tool"?l.tracker.recordSemantic("tool",h):y.kind==="answer"&&y.text.trim()&&l.tracker.recordSemantic("answer",h)},[t]);const pe=(l,R=!0)=>{de({type:"event",event:l},R)},_e=async(l,R)=>{var y;const S=await rt(l);let h=Tt(S);return((y=D.current)==null?void 0:y.sessionId)===l&&(h=D.current.messages,D.current=null),V.current!==R&&!(H.current===R&&W.current&&T.current.sessionId===l)?null:(n(h),d.current=h,E.current=h,A.current=Ye(A.current,{type:"load",messages:h,sessionId:l}),h)},me=(l,R,S,h,y,j)=>{const I=++V.current;H.current=I,W.current=!0,g.current=!0;const f=new AbortController;c.current=f;const oe=l.text;return J.current=l,G.current=R.session_id,u(""),n(S),E.current=S,A.current=Ye(A.current,{type:"start",messages:S,sessionId:R.session_id}),a(!0),P.current=j?null:{controller:f,tracker:new Un(performance.now())},N.current="cleared",(async()=>{var ge,we,Ke,Qe;let ce=!1,X=!1,Z=!1,ee=!1,$=!1,le=!1;try{const B=j?Cn(j,{signal:f.signal}):En(R,{signal:f.signal}),U=!j&&Ne()&&Rn(),z=U?$n(B,{signal:f.signal,isHidden:()=>document.visibilityState==="hidden"}):null;z&&(C.current={controller:f,stream:z});for await(const M of(z==null?void 0:z.events)??B){M.type==="stream_start"&&(ce=!0,X=M.provider_execution!==!1,re(f,M.request_id)),M.type==="sandbox_start"&&He(f,I),M.type==="lifecycle"&&be(f),(M.type==="reasoning_start"||M.type==="reasoning_delta"||M.type==="tool_call"||M.type==="answer_delta"||M.type==="done"||M.type==="error")&&be(f),(M.type==="done"||M.type==="error")&&(ee=!0,$=M.type==="error",fe(f,M.type==="error"?"error":"complete"),M.type==="error"&&["openrouter_monthly_budget_exhausted","openrouter_unavailable","openrouter_byok_credential_invalid","openrouter_byok_billing_error","openrouter_byok_rate_limit","hf_inference_billing_exhausted"].includes(M.code??"")&&(Z=!0,T.current.onInterrupted(l)));const ke=he(),je=ke&&!(U&&document.visibilityState==="hidden"),Pe=M.type==="reasoning_delta"||M.type==="answer_delta",ze=!["stream_start","sandbox_start","sandbox_ready","workspace_ready","session_title_start","session_title_delta","session_title_done","reasoning_delta","answer_delta"].includes(M.type);U&&ze&&ie(),!f.signal.aborted&&(ke||M.type==="stream_start"||M.type==="session_title_start"||M.type==="session_title_delta"||M.type==="session_title_done")?U&&Pe?(pe(M,!1),x.current=x.current||ke,Me()):(pe(M,je),U&&ke&&!je&&(x.current=!0)):f.signal.aborted||pe(M,!1)}}catch(B){if($=!0,!f.signal.aborted){if(be(f),B instanceof Le&&B.code==="chat_temporarily_disabled")le=!0,b({question:oe,draft:l}),V.current===I&&(n(h),d.current=h,u(""));else if(B instanceof Le&&B.code==="chat_capacity"){le=!0;const U=B.retryAfterSeconds??5,z={question:oe,draft:l,request:R,optimistic:S,original:h,edit:y,retryAfterSeconds:U,retryAt:Date.now()+U*1e3};q.current=z,O({question:oe,draft:l,retryAt:z.retryAt,retryAfterSeconds:U}),V.current===I&&(n(h),d.current=h,u(""))}else fe(f,"network_error"),B instanceof Le&&["paper_context_unavailable","paper_mention_unavailable","paper_mentions_disabled","chat_storage_quota_exceeded"].includes(B.code??"")&&(le=!0,T.current.onInterrupted(l),V.current===I&&(n(h),d.current=h,u(B.message))),B instanceof Le&&["openrouter_monthly_budget_exhausted","openrouter_unavailable","openrouter_byok_credential_invalid","openrouter_byok_billing_error","openrouter_byok_rate_limit","hf_inference_billing_exhausted"].includes(B.code??"")&&(Z=!0,T.current.onInterrupted(l));!le&&V.current===I&&pe({type:"error",message:B instanceof Error?B.message:"The assistant stream failed.",code:B instanceof Le?B.code:void 0})}}finally{if(c.current===f){if(((ge=C.current)==null?void 0:ge.controller)===f&&(ie(),C.current=null),be(f),!ee&&!f.signal.aborted&&fe(f,"network_error"),g.current=!1,a(!1),le)T.current.onSettled(R.session_id);else if(!f.signal.aborted){(ce&&X||Z)&&((Ke=(we=T.current).onProviderTerminal)==null||Ke.call(we));const B=G.current;if(y&&!ce)V.current===I&&(n(y.snapshot),d.current=y.snapshot,u("Couldn’t resend this message. Your original conversation was restored."));else if(B){V.current===I&&y&&($||!ee)&&(n(y.snapshot),d.current=y.snapshot);try{const U=await _e(B,I);U&&y&&U.some(z=>z.id===y.targetId)&&u("Couldn’t resend this message. Your original conversation was restored.")}catch{V.current===I&&de({type:"settle"})}}else V.current===I&&de({type:"settle"});T.current.onSettled(B)}((Qe=P.current)==null?void 0:Qe.controller)===f&&(P.current=null)}}})(),!0},Ve=Ue(l=>{var Z,ee;const R=typeof l=="string"?{text:l.trim(),paperMentions:[]}:l,S=R.text;if(!S||S.length>8e3||g.current||q.current)return!1;const h=d.current,y=[...h].reverse().find($=>$.role==="user"),j=y!=null&&y.status&&y.status!=="complete"&&y.revision?{replace_message_id:y.id,prior_revision:y.revision}:null,I={id:K(),role:"user",text:S,paperMentions:R.paperMentions},f={id:K(),role:"assistant",streaming:!0,blocks:[]},oe=j&&y?Kn(h,$=>$.id===y.id):-1,ce=oe<0?[...h,I,f]:[...h.slice(0,oe),I,f],X=(ee=(Z=T.current).viewerContext)==null?void 0:ee.call(Z);return me(R,{message:S,paper_mentions:R.paperMentions.map(({route_id:$,title:le,start:ge,end:we})=>({route_id:$,title:le,start:ge,end:we})),session_id:T.current.sessionId,client_message_id:crypto.randomUUID(),web_search_enabled:!!T.current.webSearchEnabled,reasoning_effort:T.current.reasoningEffort??"low",...T.current.primaryPaperRouteId?{primary_paper_route_id:T.current.primaryPaperRouteId}:{},...X?{viewer_context:X}:{},...!T.current.sessionId&&T.current.initialModel?{initial_model:T.current.initialModel}:{},...j??{}},ce,h)}),ve=Ue((l,R)=>{var Z,ee;const S=typeof R=="string"?{text:R.trim(),paperMentions:[]}:R,h=S.text;if(!h||h.length>8e3||g.current||q.current)return!1;const y=d.current.slice(),j=y.findIndex($=>$.id===l&&$.role==="user");if(j<0)return!1;const I=y[j];if(!T.current.sessionId||!I.revision)return!1;const f={id:I.id,role:"user",text:h,paperMentions:S.paperMentions,revision:I.revision+1,status:"generating"},oe={id:K(),role:"assistant",streaming:!0,blocks:[]},ce=[...y.slice(0,j),f,oe],X=(ee=(Z=T.current).viewerContext)==null?void 0:ee.call(Z);return me(S,{message:h,paper_mentions:S.paperMentions.map(({route_id:$,title:le,start:ge,end:we})=>({route_id:$,title:le,start:ge,end:we})),session_id:T.current.sessionId,client_message_id:crypto.randomUUID(),web_search_enabled:!!T.current.webSearchEnabled,reasoning_effort:T.current.reasoningEffort??"low",...T.current.primaryPaperRouteId?{primary_paper_route_id:T.current.primaryPaperRouteId}:{},...X?{viewer_context:X}:{},replace_message_id:I.id,prior_revision:I.revision},ce,y,{targetId:I.id,snapshot:y})}),Ie=o.useCallback(()=>{q.current=null,O(null)},[]),Ae=Ue(()=>{const l=q.current;return!l||Date.now(){var j,I;if(!c.current)return;const l=c.current;be(l),fe(l,"stopped"),l.abort();const R=((j=C.current)==null?void 0:j.controller)===l?C.current.stream.takeAcceptedForStop():[];C.current=null;for(const f of R)pe(f,!1);ie(),c.current=null,((I=P.current)==null?void 0:I.controller)===l&&(P.current=null),g.current=!1,a(!1);const S=de({type:"stop"},!1).messages;E.current=S,d.current=S,n(S),T.current.onInterrupted(J.current);const h=G.current;h&&(D.current={sessionId:h,messages:S}),h&&cn(h).catch(()=>{});const y=++V.current;window.setTimeout(()=>{h&&V.current===y?_e(h,y).catch(()=>{}).finally(()=>T.current.onSettled(h)):h||T.current.onSettled(null)},450)}),De=o.useCallback((l,R)=>n(S=>S.map(h=>{var y;return h.id!==l?h:{...h,blocks:(y=h.blocks)==null?void 0:y.map((j,I)=>I===R&&(j.kind==="reasoning"||j.kind==="tool")?{...j,open:!j.open}:j)}})),[]),$e=o.useCallback(()=>{var l;V.current+=1,k.current!==null&&(window.clearTimeout(k.current),k.current=null),N.current="cleared",(l=c.current)==null||l.abort(),c.current=null,C.current=null,Ce(),x.current=!1,D.current=null,P.current=null,q.current=null,O(null),g.current=!1,G.current=null,E.current=null,A.current=Ye(A.current,{type:"reset"}),H.current=null,W.current=!1,n([]),a(!1),u("")},[]),Ge=Ue((l,R,S=!1)=>{var h;if(V.current+=1,k.current!==null&&(window.clearTimeout(k.current),k.current=null),N.current="cleared",Ce(),x.current=!1,P.current=null,q.current=null,O(null),g.current&&R!==void 0&&R===G.current&&E.current){W.current=!0,n(E.current),d.current=E.current,u("");return}if(W.current=!1,g.current||((h=c.current)==null||h.abort(),c.current=null,E.current=null,H.current=null,W.current=!1),S&&R){const y=[...l].reverse().find(j=>j.role==="user");if(y){const j={text:y.text??"",paperMentions:y.paperMentions??[]},I=[...l,{id:`${y.id}-active`,role:"assistant",streaming:!0,blocks:[]}];me(j,{message:j.text,session_id:R,client_message_id:"reconnect",web_search_enabled:!!T.current.webSearchEnabled,reasoning_effort:T.current.reasoningEffort??"low"},I,l,void 0,R);return}}n(l),d.current=l,A.current=Ye(A.current,{type:"load",messages:l,sessionId:R??T.current.sessionId}),g.current||a(!1),u("")});return{messages:t,busy:s,papers:ue,sessionError:m,capacityRequest:ne,disabledRequest:_,send:Ve,editAndResend:ve,retryCapacity:Ae,cancelCapacity:Ie,dismissDisabled:()=>b(null),stop:We,toggleBlock:De,reset:$e,load:Ge}}const ye=(e="")=>({text:e,paperMentions:[]}),zn=["Summarize the main contributions","Explain in simple terms","Identify the main limitations"],Jn=()=>{const e=sessionStorage.getItem(et);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.text=="string"&&Array.isArray(t.paperMentions))return t}catch{}return ye(e)},Xn=({mode:e="general",routeSessionId:t,primaryPaper:n,currentPage:s,onSessionId:a,onReaderSubmit:m,onReaderNewChat:u})=>{var at,it,ot,ct,lt,ut,dt,ht,ft;const{sessionId:g}=Ut(),c=t??(e==="general"?g:void 0),C=qt(),[L,w]=Bt(),{user:x,isLoading:D}=Ht(),k=Vt(),N=$t(),P=Gt({queryKey:["chatAvailability"],queryFn:()=>Be.getAvailability(),refetchInterval:3e4,retry:!1,enabled:Ne()&&!!x}),q=((at=P.data)==null?void 0:at.status)==="paused"||e==="paper"&&((it=P.data)==null?void 0:it.paper_reader_chat_enabled)===!1,[ne,O]=o.useState([]),[_,b]=o.useState(!1),[d,A]=o.useState(""),[E,H]=o.useState(()=>c?{id:c,status:"loading"}:null),[W,T]=o.useState(0),J=o.useRef(ln()),Ee=o.useRef(L.get("model")||((ot=J.current)==null?void 0:ot.model)),[V,G]=o.useState(N?un:dn),[Q,ue]=o.useState(Ee.current||hn),K=((ct=V.find(i=>i.id===Q))==null?void 0:ct.provider)??"huggingface",de=Xt(!!(x&&K==="openrouter")),he=o.useRef(K);he.current=K;const[Ce,ie]=o.useState(""),[Me,be]=o.useState(null),[He,re]=o.useState(()=>ye()),[fe,pe]=o.useState(()=>{var i;return((i=J.current)==null?void 0:i.webSearchEnabled)??!1}),[_e,me]=o.useState(()=>{var i;return((i=J.current)==null?void 0:i.reasoningEffort)??"low"}),Ve=!!((lt=P.data)!=null&<.web_search_available),[ve,Ie]=o.useState(()=>{var p,v;const i=(p=L.get("q"))==null?void 0:p.trim();return i?ye(i):((v=J.current)==null?void 0:v.draft)??ye()}),Ae=o.useRef(!1),We=o.useRef(!1),De=o.useRef(!1),[$e,Ge]=o.useState(()=>typeof window>"u"||window.innerWidth>900),l=o.useRef(new Set),R=o.useRef(!1),S=o.useRef(c),h=o.useRef(null),y=o.useRef(null),j=o.useRef(null);S.current=c;const I=o.useCallback(async()=>{if(!x)return;const i=!R.current;i&&b(!0);try{const p=await fn();O(v=>{const F=h.current,Y=F?v.find(Fe=>Fe.id===F):void 0;if(!Y)return p;const te=p.find(Fe=>Fe.id===F);return[te?{...te,title:Y.title,is_busy:!0}:Y,...p.filter(Fe=>Fe.id!==F)]}),R.current=!0,A("")}catch(p){A(p instanceof Error?p.message:"Could not load chats")}finally{i&&b(!1)}},[x]),f=Qn({sessionId:c??null,initialModel:Q,webSearchEnabled:Ve&&fe,reasoningEffort:_e,primaryPaperRouteId:e==="paper"?n==null?void 0:n.routeId:void 0,viewerContext:e==="paper"&&s?()=>({page:Math.max(1,Math.min(1e4,s()))}):void 0,onSessionId:i=>{h.current=i;const p=i!==S.current,v=(S.current??null)===y.current,F=new Date().toISOString();O(Y=>Y.some(te=>te.id===i)?Y.map(te=>te.id===i?{...te,is_busy:!0}:te):[{id:i,title:"New chat",selected_model:Q,created_at:F,updated_at:F,message_count:1,is_busy:!0,web_search_enabled:fe,reasoning_effort:_e},...Y]),p&&v&&ie("New chat"),v&&(j.current=i,H({id:i,status:"loaded"}),p&&(e==="paper"?a==null||a(i):C(`/chat/${i}`,{replace:!0})))},onTitle:i=>{const p=h.current??S.current;p&&!l.current.has(p)&&(p===S.current&&ie(i),O(v=>v.map(F=>F.id===p?{...F,title:i}:F)))},onSettled:i=>{i&&O(p=>p.map(v=>v.id===i?{...v,is_busy:!1}:v)),h.current=null,y.current=null,I()},onProviderTerminal:()=>{he.current==="openrouter"&&(k.invalidateQueries({queryKey:Zt}),k.invalidateQueries({queryKey:en}))},onInterrupted:i=>{re(i)}}),oe=f.send;o.useEffect(()=>{f.capacityRequest&&re(f.capacityRequest.draft)},[f.capacityRequest]);const ce=o.useCallback(i=>{sessionStorage.setItem(et,JSON.stringify(i)),sessionStorage.setItem(Je,Q),sessionStorage.setItem(pn,_e),sessionStorage.setItem(Xe,"1"),sessionStorage.setItem(Ze,"1");const p=e==="paper"&&n?`/pdf/${n.routeId}`:S.current?`/chat/${S.current}`:"/chat";window.location.href=Wt(p,K==="huggingface")},[e,n,_e,Q,K]),X=o.useCallback((i,p)=>{sessionStorage.setItem(et,JSON.stringify(i)),sessionStorage.setItem(Je,Q),sessionStorage.removeItem(Xe),sessionStorage.removeItem(Ze),Ie(ye()),re(i),A(p)},[Q]),Z=o.useCallback(async i=>{if(!x){ce(i);return}if(K==="huggingface"&&!We.current){if(De.current)return;De.current=!0;try{if(!(await Be.getInferenceBilling()).connected){if(sessionStorage.getItem(Ze)==="1"){X(i,"Hugging Face inference authorization was not completed. Your prompt is ready to retry.");return}ce(i);return}We.current=!0}catch(v){X(i,v instanceof Error?v.message:"Could not check Hugging Face authorization.");return}finally{De.current=!1}}const p=S.current??null;if(sessionStorage.removeItem(Xe),!oe(i)){X(i,"Your prompt was not sent. It is ready to retry.");return}y.current=p,h.current=p,sessionStorage.removeItem(et),sessionStorage.removeItem(Je),sessionStorage.removeItem(Ze),mn(),re(ye()),e==="paper"&&(m==null||m())},[ce,e,m,X,K,oe,x]);o.useEffect(()=>{if(D||!x)return;const i=sessionStorage.getItem(Je);i&&ue(i),I(),gn().then(F=>{if(G(F.items),!S.current){const Y=Ee.current||i;ue(Y&&F.items.some(te=>te.id===Y)?Y:F.default_model)}});const p=Jn(),v=sessionStorage.getItem(Xe)==="1";p&&(v?Ie(p):re(p))},[D,I,x]),o.useEffect(()=>{if(!c){j.current!==null&&(j.current=null,f.reset(),pe(!1),me("low")),H(null),be(null);return}if(j.current===c||(be(null),H(p=>(p==null?void 0:p.id)===c&&p.status==="loading"?p:{id:c,status:"loading"}),D||!x))return;let i=!1;return A(""),rt(c).then(p=>{var F,Y;if(i)return;f.load(Tt(p),c,p.is_busy),ue(p.selected_model),pe(J.current&&p.messages.length===0?J.current.webSearchEnabled:p.web_search_enabled),me(J.current&&p.messages.length===0?J.current.reasoningEffort:p.reasoning_effort??"high"),ie(p.title);const v=(Y=(F=[...p.messages].reverse().find(te=>te.role==="user"&&te.viewer_context))==null?void 0:F.viewer_context)==null?void 0:Y.page;be(v??null),j.current=c,H({id:c,status:"loaded"})}).catch(p=>{if(i)return;const v=p instanceof Error?p.message:"Chat not found";f.reset(),A(v),H({id:c,status:"error",error:v})}),()=>{i=!0}},[D,c,x,f.busy,W]),o.useEffect(()=>{var F;const i=(F=L.get("q"))==null?void 0:F.trim();if(!i)return;Ae.current=!1;const p=L.get("model");p&&ue(p),Ie(ye(i));const v=new URLSearchParams(L);v.delete("q"),v.delete("model"),w(v,{replace:!0})},[L,w]),o.useEffect(()=>{if(D||f.busy||!ve.text||Ae.current||x&&fe&&P.isFetching||c&&(E==null?void 0:E.status)!=="loaded")return;const i=window.setTimeout(()=>{if(Ae.current)return;Ae.current=!0,Z(ve).finally(()=>Ie(ye()))},0);return()=>window.clearTimeout(i)},[D,P.isFetching,f.busy,ve,c,E==null?void 0:E.status,Z,x,fe]),o.useEffect(()=>{const i=()=>{!x||f.busy||I()};return window.addEventListener("focus",i),()=>window.removeEventListener("focus",i)},[f.busy,I,x]);const ee=()=>{h.current=null,f.reset(),re(ye()),pe(!1),me("low"),ie(""),e==="paper"?u==null||u():C("/chat")},$=async(i,p)=>{try{const v=await nt(i,{title:p});return l.current.add(i),i===c&&ie(v.title),O(F=>F.map(Y=>Y.id===i?v:Y)),!0}catch(v){return A(v instanceof Error?v.message:"Rename failed"),!1}},le=async i=>{const p=i===c&&f.busy;if(window.confirm(p?"Stop and delete this chat? This cannot be undone.":"Delete this chat? This cannot be undone.")){p&&f.stop();try{if(p){const v=Date.now()+3e3;for(;(await rt(i)).is_busy;){if(Date.now()>=v)throw new Error("Generation is still stopping. The chat was not deleted.");await new Promise(Y=>window.setTimeout(Y,150))}}await yn(i),i===c&&ee(),await I()}catch(v){A(v instanceof Error?v.message:"Delete failed")}}},ge=Yn({messages:f.messages,refreshSessions:I,resetChat:f.reset,restoreDraft:re,clearTitle:()=>ie("")}),we=async i=>{const p=Q;if(ue(i),!!c)try{const v=await nt(c,{selected_model:i});O(F=>F.map(Y=>Y.id===c?{...Y,selected_model:v.selected_model}:Y)),A("")}catch(v){ue(p),A(v instanceof Error?v.message:"Model change failed")}},Ke=async i=>{const p=_e;if(me(i),!!c)try{const v=await nt(c,{reasoning_effort:i});O(F=>F.map(Y=>Y.id===c?v:Y))}catch(v){me(p),A(v instanceof Error?v.message:"Effort change failed")}},[Qe,B]=o.useState(60);o.useLayoutEffect(()=>{const i=document.querySelector(".app-header");if(!i)return;const p=()=>B(i.offsetHeight);p();const v=new ResizeObserver(p);return v.observe(i),()=>v.disconnect()},[]);const U=ne.find(i=>i.id===c),z=f.messages.length===0,M=(ut=[...f.messages].reverse().find(i=>i.role==="assistant"&&i.errorCode))==null?void 0:ut.errorCode,ke=M==="openrouter_unavailable"||M==="openrouter_monthly_budget_exhausted",je=(E==null?void 0:E.id)===c,Pe=!!(c&&(D||x&&(!je||(E==null?void 0:E.status)==="loading"))),ze=je&&(E==null?void 0:E.status)==="error"?E.error:void 0,tt=!!((dt=de.data)!=null&&dt.fallback_enabled),st={onSend:Z,busy:f.busy,onStop:f.stop,draft:He,onDraftChange:re,models:V,selectedModel:Q,onModelChange:i=>void we(i),disabled:q,describedBy:q?"chat-paused-description":void 0,paperMentionsEnabled:!!((ht=P.data)!=null&&ht.paper_mentions_enabled),webSearchAvailable:Ve,webSearchEnabled:fe,onWebSearchChange:pe,reasoningEffort:_e,onReasoningEffortChange:i=>void Ke(i)};return r.jsxs("div",{className:`chat-page${e==="paper"?" chat-page--reader":""}`,style:{height:e==="paper"?"100%":`calc(100dvh - ${Qe}px)`},children:[e==="general"&&r.jsx(Pn,{sessions:ne,activeSessionId:c,loading:_,error:d,open:$e,onClose:()=>Ge(!1),onNew:ee,onNavigate:i=>C(`/chat/${i}`),onRename:$,onDelete:i=>void le(i)}),r.jsxs("section",{className:"chat-main",children:[r.jsxs("div",{className:"chat-topbar",children:[e==="general"&&!$e&&r.jsx("button",{type:"button",className:"icon-btn",onClick:()=>Ge(!0),title:"Open sidebar",children:r.jsx(Ct,{})}),e==="paper"&&r.jsx("button",{type:"button",className:"chat-reader-action",onClick:ee,children:"New chat"}),r.jsx("span",{className:"chat-topbar-title",children:Pe?(U==null?void 0:U.title)||"":Ce||(U==null?void 0:U.title)||(z?"":"New chat")}),N&&r.jsx("span",{className:"chat-staging-badge",children:"Staging"}),e==="paper"&&r.jsx(pt,{className:"chat-reader-action",to:"/chat",children:"All chats"}),e==="general"&&(U==null?void 0:U.primary_paper)&&r.jsx(pt,{className:"chat-reader-action",to:`/pdf/${U.primary_paper.route_id}`,onClick:()=>{const i=U.primary_paper.route_id;sessionStorage.setItem(`pwc:reader:session:${i}`,U.id),Me&&sessionStorage.setItem(`pwc:reader:page:${i}`,String(Me))},children:"Open reader"}),c&&je&&(E==null?void 0:E.status)==="loaded"&&!z&&r.jsx(Fn,{sessionId:c,busy:f.busy,loading:Pe,onError:A})]}),Pe&&!ve.text?r.jsxs("div",{className:"chat-session-loading",role:"status","aria-live":"polite",children:[r.jsx(kt,{}),r.jsx("span",{children:"Loading conversation…"})]}):ze?r.jsxs("div",{className:"chat-session-load-error",role:"alert",children:[r.jsx("p",{children:ze}),r.jsx("button",{type:"button",onClick:()=>{H({id:c,status:"loading"}),T(i=>i+1)},children:"Try again"})]}):z&&!ve.text?r.jsx("div",{className:"chat-empty",children:r.jsxs("div",{className:"chat-empty-inner",children:[r.jsx("div",{className:"chat-empty-eyebrow",children:e==="paper"?"Paper assistant":"AI research assistant"}),r.jsx("h1",{className:"chat-empty-title",children:e==="paper"?"Ask about this paper":r.jsxs(r.Fragment,{children:["Ask ",r.jsx("em",{children:"Papers With Code"})]})}),r.jsx("p",{className:"chat-empty-sub",children:e==="paper"?"Questions are grounded in the open paper. Add up to three other papers with @.":"Answers are grounded in a live hybrid search over papers, tasks, and benchmarks — with citations you can follow."}),N&&r.jsx("p",{className:"chat-staging-access-note",children:"This is a limited staging preview. Only approved Hugging Face users can start chats."}),r.jsx(xt,{variant:"empty",composerProps:st,provider:K,openRouterFallbackEnabled:tt,byokExpected:ke,paused:q,suggestions:e==="paper"?zn:bn})]})}):r.jsxs(r.Fragment,{children:[f.sessionError&&r.jsx("div",{className:"chat-session-error",role:"alert",children:f.sessionError}),r.jsx(Ln,{messages:f.messages,papers:f.papers,busy:f.busy,queuedDraft:ve.text?ve:void 0,paperMentionsEnabled:!!((ft=P.data)!=null&&ft.paper_mentions_enabled),archivePending:ge.pending,openRouterFallbackEnabled:tt,onToggleBlock:f.toggleBlock,onEditAndResend:f.editAndResend,onArchiveOld:()=>void ge.archiveOld(),onArchiveOldest:()=>void ge.archiveOldest()}),r.jsx(xt,{variant:"followup",composerProps:st,provider:K,openRouterFallbackEnabled:tt,byokExpected:ke,paused:q})]})]}),f.capacityRequest&&r.jsx(Nn,{retryAt:f.capacityRequest.retryAt,onCancel:f.cancelCapacity,onRetry:()=>{f.retryCapacity()&&re(ye())}}),f.disabledRequest&&r.jsx(Mn,{onClose:()=>{var i;re(((i=f.disabledRequest)==null?void 0:i.draft)??He),f.dismissDisabled(),P.refetch()}})]})},yr=()=>r.jsx(Xn,{});export{Nn as ChatCapacityDialog,Xn as ChatExperience,jn as OpenRouterUsageNotice,yr as default}; diff --git a/assets/ConferenceDetailView-BF2p7fm_.js b/assets/ConferenceDetailView-Dbc2ENP6.js similarity index 93% rename from assets/ConferenceDetailView-BF2p7fm_.js rename to assets/ConferenceDetailView-Dbc2ENP6.js index ece01e1335e160f20573bd5f82013d9094129f99..4953caf02e6c394c219d8c86d21c9fd3c8d3fb93 100644 --- a/assets/ConferenceDetailView-BF2p7fm_.js +++ b/assets/ConferenceDetailView-Dbc2ENP6.js @@ -1 +1 @@ -import{e as L,r as D,j as e,L as p}from"./index-BrhBTT14.js";import{u as T}from"./useQuery-GhY2LXSI.js";import{M as F}from"./MarkdownText-CNM4Jz9h.js";import{c as A}from"./catalog-CkpmYxEk.js";import{c as B,h as C,d as E}from"./transform-Duf4Shfn.js";import{S as f}from"./skeleton-DHdzoBmM.js";import{A as P,a as z}from"./alert-c1n3ZtEC.js";import{s as M}from"./safeExternalHref-CkBrsh84.js";import"./katex.min-BSBacQyE.js";import"./PaperPreviewLink-BCdZ9yj3.js";import"./index-BLqBUiom.js";import"./hover-card-BcKGA4Et.js";import"./papers-DBaPliAp.js";const R=a=>(a==null?void 0:a.trim().toLowerCase().replace(/[\s_]+/g,"-"))??"",O=(a,t)=>{if(!a)return null;const i=new Date(`${a}T00:00:00`),s=t?new Date(`${t}T00:00:00`):null,c=g=>g.toLocaleDateString("en-US",{month:"long",day:"numeric"}),m=i.getFullYear();return s&&s.getTime()!==i.getTime()?i.getMonth()===s.getMonth()?`${c(i).replace(/\d+$/,"").trim()} ${i.getDate()}–${s.getDate()}, ${m}`:`${c(i)} – ${c(s)}, ${m}`:`${c(i)}, ${m}`},ee=()=>{var k,S,b,_,$,w;const{confSlug:a}=L(),t=T({queryKey:["conference-areas-with-tasks",a],queryFn:()=>A.conferenceAreasWithTasks(a),enabled:!!a,staleTime:10*60*1e3}),i=D.useMemo(()=>{if(!t.data)return[];const n={general:0,vision:1,video:2,language:3,audio:4,other:5},r=o=>n[R(o)]??999;return[...t.data.results].sort((o,l)=>{const d=r(o.name),x=r(l.name);return d!==x?d-x:o.name.localeCompare(l.name)})},[t.data]),s=(k=t.data)==null?void 0:k.conference,c=((S=t.data)==null?void 0:S.total_paper_count)??0,m=((b=t.data)==null?void 0:b.oral_paper_count)??0,g=((_=t.data)==null?void 0:_.spotlight_paper_count)??0,u=(($=t.data)==null?void 0:$.outstanding_paper_count)??0,j=((w=t.data)==null?void 0:w.best_paper_finalist_paper_count)??0,v=i.reduce((n,r)=>n+r.tasks.length,0);if(t.error)return e.jsx("div",{className:"page",children:e.jsx(P,{variant:"destructive",children:e.jsx(z,{children:"Failed to load conference. Please try again."})})});const y=s?O(s.start_date,s.end_date):null,N=s?[s.venue,s.location].filter(Boolean).join(", "):null,h=s==null?void 0:s.name;return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:s!=null&&s.image_url?"task-hero-grid":void 0,children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:"CONFERENCE"}),e.jsx("h1",{className:"feed-title",children:h??e.jsx(f,{className:"h-10 w-64 inline-block"})}),e.jsxs("div",{className:"feed-subtitle",style:{display:"flex",flexDirection:"column",gap:4},children:[y&&e.jsx("span",{children:y}),N&&e.jsx("span",{children:N}),(s==null?void 0:s.url)&&e.jsx("a",{href:M(s.url)??void 0,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-text)"},children:s.url.replace(/^https?:\/\//,"")}),(s==null?void 0:s.hf_url)&&e.jsxs("a",{className:"bm-action-btn",href:s.hf_url,target:"_blank",rel:"noopener noreferrer",style:{alignSelf:"flex-start",marginTop:4},children:[e.jsx("span",{"aria-hidden":"true",children:"🤗"})," View on Hugging Face"]})]}),(s==null?void 0:s.description)&&e.jsx(F,{className:"method-description",text:s.description})]}),(s==null?void 0:s.image_url)&&e.jsxs("figure",{className:"task-figure-card",children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:s.image_url,alt:h?`${h} visual`:"Conference visual",onError:n=>{var r,o;(o=(r=n.currentTarget.parentElement)==null?void 0:r.parentElement)==null||o.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",h??"Conference",s.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(F,{className:"task-image-credit",text:s.image_credit})]})]})]})]}),!t.isLoading&&c>0&&e.jsxs("section",{style:{marginTop:48,marginBottom:48},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},children:"Browse papers"}),e.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",fontSize:13,color:"var(--ink-soft)"},children:"All accepted papers, plus oral, spotlight, outstanding, and best paper finalists."})]}),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[c.toLocaleString()," papers"]})]}),e.jsxs("div",{className:"tag-grid",children:[e.jsxs(p,{to:`/conferences/${a}/all`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"var(--accent)"}}),"All papers"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[c.toLocaleString()," papers"]})})]}),m>0&&e.jsxs(p,{to:`/conferences/${a}/oral`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"#fdbb02"}}),"Oral papers"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[m.toLocaleString()," papers"]})})]}),g>0&&e.jsxs(p,{to:`/conferences/${a}/spotlight`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"#fdbb02"}}),"Spotlight papers"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[g.toLocaleString()," papers"]})})]}),u>0&&e.jsxs(p,{to:`/conferences/${a}/outstanding`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"#c45c26"}}),"Outstanding papers"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[u.toLocaleString()," papers"]})})]}),j>0&&e.jsxs(p,{to:`/conferences/${a}/best-paper-finalists`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"#c9a227"}}),"Best paper finalists"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[j.toLocaleString()," papers"]})})]})]})]}),t.isLoading?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:32},children:Array.from({length:4}).map((n,r)=>e.jsxs("div",{children:[e.jsx(f,{className:"h-8 w-1/3 mb-4"}),e.jsx("div",{className:"tag-grid",children:Array.from({length:6}).map((o,l)=>e.jsx(f,{className:"h-24"},l))})]},r))}):i.map(n=>{const r=n.tasks;if(r.length===0)return null;const o=r.reduce((l,d)=>l+(d.paper_count||0),0);return e.jsxs("section",{style:{marginBottom:48},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},children:n.name}),n.description&&e.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",fontSize:13,color:"var(--ink-soft)"},children:n.description})]}),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[r.length," ",r.length===1?"task":"tasks"," · ",o.toLocaleString()," papers"]})]}),e.jsx("div",{className:"tag-grid",children:r.map(l=>{const d=l.slug||"",x=B(C(d));return e.jsxs(p,{to:`/conferences/${a}/${d}`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:x.dot}}),E(l.name,d)]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[(l.paper_count??0).toLocaleString()," papers"]})})]},l.id)})})]},n.id)}),v>0&&e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",marginTop:24},children:[v," tasks across ",i.filter(n=>n.tasks.length>0).length," areas."]})]})};export{ee as default}; +import{c as L,r as D,j as e,L as p}from"./index-D_-UZEuL.js";import{u as T}from"./useQuery-BZo4MZ3s.js";import{M as F}from"./MarkdownText-QvkQ9FeM.js";import{c as A}from"./catalog-CjU2vAfw.js";import{c as B,h as C,d as E}from"./transform-CUuA-koJ.js";import{S as f}from"./skeleton-CCZ1iXls.js";import{A as P,a as z}from"./alert-B2j1kc2o.js";import{s as M}from"./safeExternalHref-CkBrsh84.js";import"./katex.min-BSBacQyE.js";import"./PaperPreviewLink-B25cD-_k.js";import"./index-vCOH2DKd.js";import"./hover-card-DiJQFgx9.js";import"./papers-DHqjKX7p.js";const R=a=>(a==null?void 0:a.trim().toLowerCase().replace(/[\s_]+/g,"-"))??"",O=(a,t)=>{if(!a)return null;const i=new Date(`${a}T00:00:00`),s=t?new Date(`${t}T00:00:00`):null,c=g=>g.toLocaleDateString("en-US",{month:"long",day:"numeric"}),m=i.getFullYear();return s&&s.getTime()!==i.getTime()?i.getMonth()===s.getMonth()?`${c(i).replace(/\d+$/,"").trim()} ${i.getDate()}–${s.getDate()}, ${m}`:`${c(i)} – ${c(s)}, ${m}`:`${c(i)}, ${m}`},ee=()=>{var k,S,b,_,$,w;const{confSlug:a}=L(),t=T({queryKey:["conference-areas-with-tasks",a],queryFn:()=>A.conferenceAreasWithTasks(a),enabled:!!a,staleTime:10*60*1e3}),i=D.useMemo(()=>{if(!t.data)return[];const n={general:0,vision:1,video:2,language:3,audio:4,other:5},r=o=>n[R(o)]??999;return[...t.data.results].sort((o,l)=>{const d=r(o.name),x=r(l.name);return d!==x?d-x:o.name.localeCompare(l.name)})},[t.data]),s=(k=t.data)==null?void 0:k.conference,c=((S=t.data)==null?void 0:S.total_paper_count)??0,m=((b=t.data)==null?void 0:b.oral_paper_count)??0,g=((_=t.data)==null?void 0:_.spotlight_paper_count)??0,u=(($=t.data)==null?void 0:$.outstanding_paper_count)??0,j=((w=t.data)==null?void 0:w.best_paper_finalist_paper_count)??0,v=i.reduce((n,r)=>n+r.tasks.length,0);if(t.error)return e.jsx("div",{className:"page",children:e.jsx(P,{variant:"destructive",children:e.jsx(z,{children:"Failed to load conference. Please try again."})})});const y=s?O(s.start_date,s.end_date):null,N=s?[s.venue,s.location].filter(Boolean).join(", "):null,h=s==null?void 0:s.name;return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:s!=null&&s.image_url?"task-hero-grid":void 0,children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:"CONFERENCE"}),e.jsx("h1",{className:"feed-title",children:h??e.jsx(f,{className:"h-10 w-64 inline-block"})}),e.jsxs("div",{className:"feed-subtitle",style:{display:"flex",flexDirection:"column",gap:4},children:[y&&e.jsx("span",{children:y}),N&&e.jsx("span",{children:N}),(s==null?void 0:s.url)&&e.jsx("a",{href:M(s.url)??void 0,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-text)"},children:s.url.replace(/^https?:\/\//,"")}),(s==null?void 0:s.hf_url)&&e.jsxs("a",{className:"bm-action-btn",href:s.hf_url,target:"_blank",rel:"noopener noreferrer",style:{alignSelf:"flex-start",marginTop:4},children:[e.jsx("span",{"aria-hidden":"true",children:"🤗"})," View on Hugging Face"]})]}),(s==null?void 0:s.description)&&e.jsx(F,{className:"method-description",text:s.description})]}),(s==null?void 0:s.image_url)&&e.jsxs("figure",{className:"task-figure-card",children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:s.image_url,alt:h?`${h} visual`:"Conference visual",onError:n=>{var r,o;(o=(r=n.currentTarget.parentElement)==null?void 0:r.parentElement)==null||o.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",h??"Conference",s.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(F,{className:"task-image-credit",text:s.image_credit})]})]})]})]}),!t.isLoading&&c>0&&e.jsxs("section",{style:{marginTop:48,marginBottom:48},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},children:"Browse papers"}),e.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",fontSize:13,color:"var(--ink-soft)"},children:"All accepted papers, plus oral, spotlight, outstanding, and best paper finalists."})]}),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[c.toLocaleString()," papers"]})]}),e.jsxs("div",{className:"tag-grid",children:[e.jsxs(p,{to:`/conferences/${a}/all`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"var(--accent)"}}),"All papers"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[c.toLocaleString()," papers"]})})]}),m>0&&e.jsxs(p,{to:`/conferences/${a}/oral`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"#fdbb02"}}),"Oral papers"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[m.toLocaleString()," papers"]})})]}),g>0&&e.jsxs(p,{to:`/conferences/${a}/spotlight`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"#fdbb02"}}),"Spotlight papers"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[g.toLocaleString()," papers"]})})]}),u>0&&e.jsxs(p,{to:`/conferences/${a}/outstanding`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"#c45c26"}}),"Outstanding papers"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[u.toLocaleString()," papers"]})})]}),j>0&&e.jsxs(p,{to:`/conferences/${a}/best-paper-finalists`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:"#c9a227"}}),"Best paper finalists"]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[j.toLocaleString()," papers"]})})]})]})]}),t.isLoading?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:32},children:Array.from({length:4}).map((n,r)=>e.jsxs("div",{children:[e.jsx(f,{className:"h-8 w-1/3 mb-4"}),e.jsx("div",{className:"tag-grid",children:Array.from({length:6}).map((o,l)=>e.jsx(f,{className:"h-24"},l))})]},r))}):i.map(n=>{const r=n.tasks;if(r.length===0)return null;const o=r.reduce((l,d)=>l+(d.paper_count||0),0);return e.jsxs("section",{style:{marginBottom:48},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},children:n.name}),n.description&&e.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",fontSize:13,color:"var(--ink-soft)"},children:n.description})]}),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[r.length," ",r.length===1?"task":"tasks"," · ",o.toLocaleString()," papers"]})]}),e.jsx("div",{className:"tag-grid",children:r.map(l=>{const d=l.slug||"",x=B(C(d));return e.jsxs(p,{to:`/conferences/${a}/${d}`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:x.dot}}),E(l.name,d)]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[(l.paper_count??0).toLocaleString()," papers"]})})]},l.id)})})]},n.id)}),v>0&&e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",marginTop:24},children:[v," tasks across ",i.filter(n=>n.tasks.length>0).length," areas."]})]})};export{ee as default}; diff --git a/assets/ConferenceTaskView-ny-_UWtG.js b/assets/ConferenceTaskView-BAJItIua.js similarity index 82% rename from assets/ConferenceTaskView-ny-_UWtG.js rename to assets/ConferenceTaskView-BAJItIua.js index c96a35fa6f69f14a9dbdf3f912c3a22f2757b7aa..a5bed335df7d36ed185558532205786126600fd9 100644 --- a/assets/ConferenceTaskView-ny-_UWtG.js +++ b/assets/ConferenceTaskView-BAJItIua.js @@ -1 +1 @@ -import{e as $,a as D,r as f,j as e,L as b,R as W}from"./index-BrhBTT14.js";import{u as M}from"./useQuery-GhY2LXSI.js";import{P as G}from"./components-74u_bIKK.js";import{u as J,P as X}from"./useIntersectionObserver-Lj6hnXj6.js";import{M as h}from"./MarkdownText-CNM4Jz9h.js";import{c as z}from"./catalog-CkpmYxEk.js";import{t as Y,d as Z}from"./transform-Duf4Shfn.js";import{c as ee}from"./usePapers-C1lfz0oo.js";import{S as se}from"./skeleton-DHdzoBmM.js";import{A as ae,a as te}from"./alert-c1n3ZtEC.js";import"./LatexTitle-BJSVMlZ1.js";import"./katex.min-BSBacQyE.js";import"./papers-DBaPliAp.js";import"./safeExternalHref-CkBrsh84.js";import"./PaperPreviewLink-BCdZ9yj3.js";import"./index-BLqBUiom.js";import"./hover-card-BcKGA4Et.js";import"./useInfiniteQuery-bETtM5yS.js";const re=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]],ne=a=>a==="trending"||a==="date_published"||a==="citation_count"?a:"trending",ye=()=>{var A,F,L,O,T,B;const{confSlug:a,taskSlug:n}=$(),[c,j]=D(),y=ne(c.get("order_by")),S=c.get("has_code")==="true",w=c.get("has_hf_artifacts")==="true",I=t=>{const s=new URLSearchParams(c);s.set("order_by",t),j(s)},q=t=>{const s=new URLSearchParams(c);t?s.set("has_code","true"):s.delete("has_code"),j(s)},Q=t=>{const s=new URLSearchParams(c);t?s.set("has_hf_artifacts","true"):s.delete("has_hf_artifacts"),j(s)},k=n==="all",P=n==="oral",N=n==="spotlight",l=n==="outstanding",d=n==="best-paper-finalists",u=l||d,p=k||P||N||l||d,K=p?void 0:n,U=P?"oral":N?"spotlight":l?"outstanding":d?"best_paper_finalist":void 0,m=M({queryKey:["conference",a],queryFn:()=>z.getConference(a),enabled:!!a,staleTime:10*60*1e3}),x=M({queryKey:["task",n],queryFn:()=>z.getTask(n),enabled:!!n&&!p,staleTime:10*60*1e3}),i=ee({conferenceSlug:a||"",taskSlug:K,presentation:U,page_size:12,order_by:y,order_dir:"desc",include_resources:!0,has_code:S,has_hf_artifacts:w,enabled:!!a}),{targetRef:V,isIntersecting:R}=J({rootMargin:"200px"});f.useEffect(()=>{R&&i.hasNextPage&&!i.isFetchingNextPage&&i.fetchNextPage()},[R,i.hasNextPage,i.isFetchingNextPage]),f.useEffect(()=>{window.scrollTo(0,0)},[a,n]);const _=f.useMemo(()=>{var s;return(((s=i.data)==null?void 0:s.pages)??[]).flatMap(o=>o.results)},[i.data]),v=f.useMemo(()=>_.map(Y),[_]),g=k?"All papers":P?"Oral papers":N?"Spotlight papers":l?"Outstanding papers":d?"Best paper finalists":Z(((A=x.data)==null?void 0:A.name)||n||"",((F=x.data)==null?void 0:F.slug)||n),C=((O=(L=i.data)==null?void 0:L.pages[0])==null?void 0:O.count)??((T=m.data)==null?void 0:T.paper_count)??0,r=x.data;return m.error||x.error||i.error?e.jsx("div",{className:"page",children:e.jsx(ae,{variant:"destructive",children:e.jsx(te,{children:"Failed to load conference papers. Please try again."})})}):e.jsxs("div",{className:"page",children:[e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(b,{to:"/",children:"Home"}),e.jsx("span",{children:" / "}),e.jsx(b,{to:"/conferences",children:"Conferences"}),e.jsx("span",{children:" / "}),e.jsx(b,{to:`/conferences/${a}`,children:((B=m.data)==null?void 0:B.name)??a}),e.jsx("span",{children:" / "}),e.jsx("span",{children:g})]}),e.jsxs("div",{className:!p&&(r!=null&&r.image_url)?"task-hero-grid":void 0,style:{marginTop:16,marginBottom:28},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:p?"BROWSE PAPERS":"TASK"}),e.jsx("h1",{className:"domain-mega-title",children:g}),l&&a==="iclr-2026"&&e.jsx(h,{className:"task-explainer",text:"ICLR 2026 recognized two Outstanding Papers and one Honorable Mention. [Read the announcement](https://blog.iclr.cc/2026/04/23/announcing-the-iclr-2026-outstanding-papers/)."}),l&&a==="icml-2026"&&e.jsx(h,{className:"task-explainer",text:"ICML 2026 recognized two Outstanding Papers and five Honorable Mentions. [Read the announcement](https://blog.icml.cc/2026/07/05/announcing-the-icml-2026-awards/)."}),d&&a==="cvpr-2026"&&e.jsx(h,{className:"task-explainer",text:"CVPR 2026 recognized fifteen Best Paper Award finalists, including the winners. [Read the announcement](https://x.com/CVPR/status/2062912519522717978)."}),!p&&(r==null?void 0:r.description)&&e.jsx(h,{className:"task-explainer",text:r.description}),m.data&&e.jsxs("div",{className:"task-quickstats",style:{marginTop:12},children:[e.jsxs("span",{children:[e.jsx("span",{className:"num",children:C.toLocaleString()}),"PAPERS"]}),e.jsx("span",{children:m.data.name})]})]}),!p&&(r==null?void 0:r.image_url)&&e.jsxs("figure",{className:"task-figure-card",children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:r.image_url,alt:`${g} schematic`,onError:t=>{var s,o;(o=(s=t.currentTarget.parentElement)==null?void 0:s.parentElement)==null||o.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",g,r.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(h,{className:"task-image-credit",text:r.image_credit})]})]})]})]}),e.jsxs("div",{className:"task-section-head",children:[e.jsx("div",{className:"task-section-eyebrow",children:u?"Award papers":"Conference papers · sort below"}),e.jsxs("div",{className:"task-section-title",children:["Papers ",e.jsxs("span",{className:"meta",children:["[",C.toLocaleString(),"]"]})]})]}),e.jsxs("div",{className:"sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[!u&&e.jsx("div",{className:"sort-options",children:re.map(([t,s])=>e.jsx("button",{className:`sort-btn ${y===t?"active":""}`,onClick:()=>I(t),children:s},t))}),e.jsx(X,{hasCode:S,hasHfArtifacts:w,onHasCodeChange:q,onHasHfArtifactsChange:Q,showDivider:!u})]}),!u&&e.jsxs("div",{className:"results-count",children:[v.length," loaded in ",e.jsx("span",{children:g})]})]}),i.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((t,s)=>e.jsx(se,{className:"h-40 w-full"},s))}):v.length===0?e.jsx("div",{className:"no-results",children:"No papers found for this selection."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:v.map((t,s)=>{var E;const o=(E=_[s])==null?void 0:E.conference_award,H=o==="outstanding"?"Outstanding Paper":o==="honorable_mention"?"Honorable Mention":o==="best_paper_finalist"&&!d?"Best Paper Finalist":null;return e.jsxs(W.Fragment,{children:[H&&e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.08em",marginBottom:8},children:H}),e.jsx(G,{paper:t,rank:s+1})]},t.id)})}),e.jsx("div",{ref:V,style:{height:1}}),i.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]})]})};export{ye as default}; +import{c as $,a as D,r as f,j as e,L as b,z as W}from"./index-D_-UZEuL.js";import{u as M}from"./useQuery-BZo4MZ3s.js";import{P as G}from"./components-CmC5jqhM.js";import{u as J,P as X}from"./useIntersectionObserver-Cq9n7uOQ.js";import{M as h}from"./MarkdownText-QvkQ9FeM.js";import{c as z}from"./catalog-CjU2vAfw.js";import{t as Y,d as Z}from"./transform-CUuA-koJ.js";import{c as ee}from"./usePapers-BCHtBW8G.js";import{S as se}from"./skeleton-CCZ1iXls.js";import{A as ae,a as te}from"./alert-B2j1kc2o.js";import"./LatexTitle-B7GPgo8C.js";import"./katex.min-BSBacQyE.js";import"./papers-DHqjKX7p.js";import"./safeExternalHref-CkBrsh84.js";import"./PaperPreviewLink-B25cD-_k.js";import"./index-vCOH2DKd.js";import"./hover-card-DiJQFgx9.js";import"./useInfiniteQuery-CFUEkcEs.js";const re=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]],ne=a=>a==="trending"||a==="date_published"||a==="citation_count"?a:"trending",ye=()=>{var A,F,L,O,T,B;const{confSlug:a,taskSlug:n}=$(),[c,j]=D(),y=ne(c.get("order_by")),S=c.get("has_code")==="true",w=c.get("has_hf_artifacts")==="true",I=t=>{const s=new URLSearchParams(c);s.set("order_by",t),j(s)},q=t=>{const s=new URLSearchParams(c);t?s.set("has_code","true"):s.delete("has_code"),j(s)},Q=t=>{const s=new URLSearchParams(c);t?s.set("has_hf_artifacts","true"):s.delete("has_hf_artifacts"),j(s)},k=n==="all",P=n==="oral",N=n==="spotlight",l=n==="outstanding",d=n==="best-paper-finalists",u=l||d,p=k||P||N||l||d,K=p?void 0:n,U=P?"oral":N?"spotlight":l?"outstanding":d?"best_paper_finalist":void 0,m=M({queryKey:["conference",a],queryFn:()=>z.getConference(a),enabled:!!a,staleTime:10*60*1e3}),x=M({queryKey:["task",n],queryFn:()=>z.getTask(n),enabled:!!n&&!p,staleTime:10*60*1e3}),i=ee({conferenceSlug:a||"",taskSlug:K,presentation:U,page_size:12,order_by:y,order_dir:"desc",include_resources:!0,has_code:S,has_hf_artifacts:w,enabled:!!a}),{targetRef:V,isIntersecting:C}=J({rootMargin:"200px"});f.useEffect(()=>{C&&i.hasNextPage&&!i.isFetchingNextPage&&i.fetchNextPage()},[C,i.hasNextPage,i.isFetchingNextPage]),f.useEffect(()=>{window.scrollTo(0,0)},[a,n]);const _=f.useMemo(()=>{var s;return(((s=i.data)==null?void 0:s.pages)??[]).flatMap(o=>o.results)},[i.data]),v=f.useMemo(()=>_.map(Y),[_]),g=k?"All papers":P?"Oral papers":N?"Spotlight papers":l?"Outstanding papers":d?"Best paper finalists":Z(((A=x.data)==null?void 0:A.name)||n||"",((F=x.data)==null?void 0:F.slug)||n),R=((O=(L=i.data)==null?void 0:L.pages[0])==null?void 0:O.count)??((T=m.data)==null?void 0:T.paper_count)??0,r=x.data;return m.error||x.error||i.error?e.jsx("div",{className:"page",children:e.jsx(ae,{variant:"destructive",children:e.jsx(te,{children:"Failed to load conference papers. Please try again."})})}):e.jsxs("div",{className:"page",children:[e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(b,{to:"/",children:"Home"}),e.jsx("span",{children:" / "}),e.jsx(b,{to:"/conferences",children:"Conferences"}),e.jsx("span",{children:" / "}),e.jsx(b,{to:`/conferences/${a}`,children:((B=m.data)==null?void 0:B.name)??a}),e.jsx("span",{children:" / "}),e.jsx("span",{children:g})]}),e.jsxs("div",{className:!p&&(r!=null&&r.image_url)?"task-hero-grid":void 0,style:{marginTop:16,marginBottom:28},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:p?"BROWSE PAPERS":"TASK"}),e.jsx("h1",{className:"domain-mega-title",children:g}),l&&a==="iclr-2026"&&e.jsx(h,{className:"task-explainer",text:"ICLR 2026 recognized two Outstanding Papers and one Honorable Mention. [Read the announcement](https://blog.iclr.cc/2026/04/23/announcing-the-iclr-2026-outstanding-papers/)."}),l&&a==="icml-2026"&&e.jsx(h,{className:"task-explainer",text:"ICML 2026 recognized two Outstanding Papers and five Honorable Mentions. [Read the announcement](https://blog.icml.cc/2026/07/05/announcing-the-icml-2026-awards/)."}),d&&a==="cvpr-2026"&&e.jsx(h,{className:"task-explainer",text:"CVPR 2026 recognized fifteen Best Paper Award finalists, including the winners. [Read the announcement](https://x.com/CVPR/status/2062912519522717978)."}),!p&&(r==null?void 0:r.description)&&e.jsx(h,{className:"task-explainer",text:r.description}),m.data&&e.jsxs("div",{className:"task-quickstats",style:{marginTop:12},children:[e.jsxs("span",{children:[e.jsx("span",{className:"num",children:R.toLocaleString()}),"PAPERS"]}),e.jsx("span",{children:m.data.name})]})]}),!p&&(r==null?void 0:r.image_url)&&e.jsxs("figure",{className:"task-figure-card",children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:r.image_url,alt:`${g} schematic`,onError:t=>{var s,o;(o=(s=t.currentTarget.parentElement)==null?void 0:s.parentElement)==null||o.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",g,r.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(h,{className:"task-image-credit",text:r.image_credit})]})]})]})]}),e.jsxs("div",{className:"task-section-head",children:[e.jsx("div",{className:"task-section-eyebrow",children:u?"Award papers":"Conference papers · sort below"}),e.jsxs("div",{className:"task-section-title",children:["Papers ",e.jsxs("span",{className:"meta",children:["[",R.toLocaleString(),"]"]})]})]}),e.jsxs("div",{className:"sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[!u&&e.jsx("div",{className:"sort-options",children:re.map(([t,s])=>e.jsx("button",{className:`sort-btn ${y===t?"active":""}`,onClick:()=>I(t),children:s},t))}),e.jsx(X,{hasCode:S,hasHfArtifacts:w,onHasCodeChange:q,onHasHfArtifactsChange:Q,showDivider:!u})]}),!u&&e.jsxs("div",{className:"results-count",children:[v.length," loaded in ",e.jsx("span",{children:g})]})]}),i.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((t,s)=>e.jsx(se,{className:"h-40 w-full"},s))}):v.length===0?e.jsx("div",{className:"no-results",children:"No papers found for this selection."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:v.map((t,s)=>{var E;const o=(E=_[s])==null?void 0:E.conference_award,H=o==="outstanding"?"Outstanding Paper":o==="honorable_mention"?"Honorable Mention":o==="best_paper_finalist"&&!d?"Best Paper Finalist":null;return e.jsxs(W.Fragment,{children:[H&&e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.08em",marginBottom:8},children:H}),e.jsx(G,{paper:t,rank:s+1})]},t.id)})}),e.jsx("div",{ref:V,style:{height:1}}),i.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]})]})};export{ye as default}; diff --git a/assets/ConferencesIndexView-BYCd9xd-.js b/assets/ConferencesIndexView-CNg__9k_.js similarity index 86% rename from assets/ConferencesIndexView-BYCd9xd-.js rename to assets/ConferencesIndexView-CNg__9k_.js index 9812006e2b19fe8d19eecd63f2c8ad370937bdff..b6ce3116eef420d25cabe467663fd66a3d3a47ab 100644 --- a/assets/ConferencesIndexView-BYCd9xd-.js +++ b/assets/ConferencesIndexView-CNg__9k_.js @@ -1 +1 @@ -import{r as u,j as e,L as d}from"./index-BrhBTT14.js";import{u as p}from"./useQuery-GhY2LXSI.js";import{c as f}from"./catalog-CkpmYxEk.js";import{S as m}from"./skeleton-DHdzoBmM.js";import{A as h,a as g}from"./alert-c1n3ZtEC.js";import{T as x}from"./TaxonomySuggestionTile-BkE17zPJ.js";import"./SignInToEditDialog-Dcu4wTOX.js";import"./button-CusGeqPB.js";import"./textarea-D6mDqvzM.js";import"./dialog-BhRZv4T5.js";import"./useMutation-DqfuSW7Q.js";import"./submissions-C1hG3qlt.js";import"./loader-circle-BqZ1qbXL.js";const j=(r,a)=>{if(!r)return null;const t=new Date(`${r}T00:00:00`),s=a?new Date(`${a}T00:00:00`):null,n=o=>o.toLocaleDateString("en-US",{month:"long",day:"numeric"}),i=t.getFullYear();return s&&s.getTime()!==t.getTime()?t.getMonth()===s.getMonth()?`${n(t).replace(/\d+$/,"").trim()} ${t.getDate()}–${s.getDate()}, ${i}`:`${n(t)} – ${n(s)}, ${i}`:`${n(t)}, ${i}`},v=r=>{var t;if(r.year!=null)return r.year;if(r.start_date)return Number(r.start_date.slice(0,4));const a=(t=r.slug.match(/-(\d{4})$/))==null?void 0:t[1];return a?Number(a):0},y=(r,a)=>{if(r.start_date&&a.start_date){const t=r.start_date.localeCompare(a.start_date);if(t!==0)return t}else{if(r.start_date)return-1;if(a.start_date)return 1}return r.name.localeCompare(a.name)},N={display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},M=()=>{const r=p({queryKey:["conferences"],queryFn:()=>f.conferences(),staleTime:6e5}),a=u.useMemo(()=>{var s;if(!((s=r.data)!=null&&s.results))return null;const t={};return r.data.results.forEach(n=>{const i=v(n);(t[i]||(t[i]=[])).push(n)}),Object.values(t).forEach(n=>n.sort(y)),Object.keys(t).map(Number).sort((n,i)=>i-n).map(n=>({year:n,conferences:t[n]}))},[r.data]);return r.error?e.jsx("div",{className:"page",children:e.jsx(h,{variant:"destructive",children:e.jsx(g,{children:"Failed to load conferences. Please try again."})})}):e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["All ",e.jsx("em",{children:"Conferences"})]}),e.jsx("div",{className:"feed-subtitle",children:"Browse accepted papers from major AI conferences, grouped by research area and task."}),e.jsxs("div",{className:"conference-deadlines-link",children:["Find deadlines for upcoming conferences"," ",e.jsx(d,{to:"/ai-deadlines",className:"underline underline-offset-2 hover:text-foreground",children:"here"}),". Conference information is based on"," ",e.jsx("a",{href:"https://huggingface.co/ai-conferences",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Hugging Face AI Conferences"}),"."]})]})}),r.isLoading?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:32},children:Array.from({length:2}).map((t,s)=>e.jsxs("div",{children:[e.jsx(m,{className:"h-8 w-24 mb-4"}),e.jsx("div",{className:"tag-grid",children:Array.from({length:3}).map((n,i)=>e.jsx(m,{className:"h-32"},i))})]},s))}):a==null?void 0:a.map(({year:t,conferences:s})=>{const n=s.reduce((o,l)=>o+(l.paper_count??0),0),i=t>0?String(t):"Unknown year";return e.jsxs("section",{style:{marginBottom:48},children:[e.jsxs("div",{style:N,children:[e.jsx("div",{children:e.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},children:i})}),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[s.length," ",s.length===1?"conference":"conferences"," ·"," ",n.toLocaleString()," papers"]})]}),e.jsxs("div",{className:"tag-grid",children:[s.map(o=>{const l=j(o.start_date,o.end_date),c=[o.venue,o.location].filter(Boolean).join(", ");return e.jsxs(d,{to:`/conferences/${o.slug}`,className:"tag-cell",children:[e.jsx("div",{className:"name",children:o.name}),e.jsxs("div",{className:"meta",style:{display:"flex",flexDirection:"column",gap:4},children:[l&&e.jsx("span",{children:l}),c&&e.jsx("span",{children:c}),e.jsxs("span",{children:[(o.paper_count??0).toLocaleString()," papers"]})]})]},o.id)}),e.jsx(x,{kind:"conference"})]})]},t)})]})};export{M as default}; +import{r as u,j as e,L as d}from"./index-D_-UZEuL.js";import{u as p}from"./useQuery-BZo4MZ3s.js";import{c as f}from"./catalog-CjU2vAfw.js";import{S as m}from"./skeleton-CCZ1iXls.js";import{A as h,a as g}from"./alert-B2j1kc2o.js";import{T as x}from"./TaxonomySuggestionTile-DgDd6ghr.js";import"./SignInToEditDialog-DZLQNGaN.js";import"./button-Cc8PFtC1.js";import"./textarea-DlQmtN_E.js";import"./dialog-ChaQ5z93.js";import"./useMutation-P0Dg96Vh.js";import"./submissions-BpzsA2lc.js";import"./loader-circle-D1SscQUT.js";const j=(r,a)=>{if(!r)return null;const t=new Date(`${r}T00:00:00`),s=a?new Date(`${a}T00:00:00`):null,n=o=>o.toLocaleDateString("en-US",{month:"long",day:"numeric"}),i=t.getFullYear();return s&&s.getTime()!==t.getTime()?t.getMonth()===s.getMonth()?`${n(t).replace(/\d+$/,"").trim()} ${t.getDate()}–${s.getDate()}, ${i}`:`${n(t)} – ${n(s)}, ${i}`:`${n(t)}, ${i}`},v=r=>{var t;if(r.year!=null)return r.year;if(r.start_date)return Number(r.start_date.slice(0,4));const a=(t=r.slug.match(/-(\d{4})$/))==null?void 0:t[1];return a?Number(a):0},y=(r,a)=>{if(r.start_date&&a.start_date){const t=r.start_date.localeCompare(a.start_date);if(t!==0)return t}else{if(r.start_date)return-1;if(a.start_date)return 1}return r.name.localeCompare(a.name)},N={display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},M=()=>{const r=p({queryKey:["conferences"],queryFn:()=>f.conferences(),staleTime:6e5}),a=u.useMemo(()=>{var s;if(!((s=r.data)!=null&&s.results))return null;const t={};return r.data.results.forEach(n=>{const i=v(n);(t[i]||(t[i]=[])).push(n)}),Object.values(t).forEach(n=>n.sort(y)),Object.keys(t).map(Number).sort((n,i)=>i-n).map(n=>({year:n,conferences:t[n]}))},[r.data]);return r.error?e.jsx("div",{className:"page",children:e.jsx(h,{variant:"destructive",children:e.jsx(g,{children:"Failed to load conferences. Please try again."})})}):e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["All ",e.jsx("em",{children:"Conferences"})]}),e.jsx("div",{className:"feed-subtitle",children:"Browse accepted papers from major AI conferences, grouped by research area and task."}),e.jsxs("div",{className:"conference-deadlines-link",children:["Find deadlines for upcoming conferences"," ",e.jsx(d,{to:"/ai-deadlines",className:"underline underline-offset-2 hover:text-foreground",children:"here"}),". Conference information is based on"," ",e.jsx("a",{href:"https://huggingface.co/ai-conferences",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Hugging Face AI Conferences"}),"."]})]})}),r.isLoading?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:32},children:Array.from({length:2}).map((t,s)=>e.jsxs("div",{children:[e.jsx(m,{className:"h-8 w-24 mb-4"}),e.jsx("div",{className:"tag-grid",children:Array.from({length:3}).map((n,i)=>e.jsx(m,{className:"h-32"},i))})]},s))}):a==null?void 0:a.map(({year:t,conferences:s})=>{const n=s.reduce((o,l)=>o+(l.paper_count??0),0),i=t>0?String(t):"Unknown year";return e.jsxs("section",{style:{marginBottom:48},children:[e.jsxs("div",{style:N,children:[e.jsx("div",{children:e.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},children:i})}),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[s.length," ",s.length===1?"conference":"conferences"," ·"," ",n.toLocaleString()," papers"]})]}),e.jsxs("div",{className:"tag-grid",children:[s.map(o=>{const l=j(o.start_date,o.end_date),c=[o.venue,o.location].filter(Boolean).join(", ");return e.jsxs(d,{to:`/conferences/${o.slug}`,className:"tag-cell",children:[e.jsx("div",{className:"name",children:o.name}),e.jsxs("div",{className:"meta",style:{display:"flex",flexDirection:"column",gap:4},children:[l&&e.jsx("span",{children:l}),c&&e.jsx("span",{children:c}),e.jsxs("span",{children:[(o.paper_count??0).toLocaleString()," papers"]})]})]},o.id)}),e.jsx(x,{kind:"conference"})]})]},t)})]})};export{M as default}; diff --git a/assets/CronDashboard-B0A5D1GB.js b/assets/CronDashboard-BnvHXrkn.js similarity index 95% rename from assets/CronDashboard-B0A5D1GB.js rename to assets/CronDashboard-BnvHXrkn.js index ef282af33e711ae10586bad9238c04543a71db64..3b2db11bd48e38b2d32041d38e35bc490cf76c8a 100644 --- a/assets/CronDashboard-B0A5D1GB.js +++ b/assets/CronDashboard-BnvHXrkn.js @@ -1,4 +1,4 @@ -import{c as C,r as m,j as e,v as y,x as We,o as Be,m as W,O as Ue,y as ze,I as Ke,q as z,P as Ge,t as Qe,z as ue,L as Ve,g as Xe,U as Ye,f as Ze,b as es}from"./index-BrhBTT14.js";import{u as E}from"./useQuery-GhY2LXSI.js";import{B as w,D as ne,f as ss}from"./codexAddEvals-BzRfrE5R.js";import{B as A}from"./button-CusGeqPB.js";import{C as as}from"./chevron-down-CKySK_lE.js";import{F as te}from"./file-text-DROKoLCd.js";import{C as q,R as ie,S as rs}from"./shield-alert-BkQ9lngS.js";import{L as S}from"./loader-circle-BqZ1qbXL.js";import{C as Q}from"./circle-check-DVQOUjVS.js";import{E as pe}from"./external-link-uK7nAEgd.js";import{u as ce}from"./useMutation-DqfuSW7Q.js";import{u as ns}from"./useInfiniteQuery-bETtM5yS.js";import{c as K}from"./catalog-CkpmYxEk.js";import{c as le}from"./chat-Ck3hlrgT.js";/** +import{d as C,r as m,j as e,q as y,t as We,k as Be,h as W,Y as Ue,R as ze,I as Ke,m as z,P as Ge,p as Qe,v as ue,L as Ve,g as Xe,a0 as Ye,y as Ze,b as es}from"./index-D_-UZEuL.js";import{u as E}from"./useQuery-BZo4MZ3s.js";import{B as w,D as ne,f as ss}from"./codexAddEvals-BKeHrC5p.js";import{B as A}from"./button-Cc8PFtC1.js";import{C as as}from"./chevron-down-DI19XsBw.js";import{F as te}from"./file-text--vrXMvWb.js";import{C as q,R as ie,S as rs}from"./shield-alert-Dix0M7Y-.js";import{L as S}from"./loader-circle-D1SscQUT.js";import{C as Q}from"./circle-check-BpugpgkG.js";import{E as pe}from"./external-link-Dm5dHWqK.js";import{u as ce}from"./useMutation-P0Dg96Vh.js";import{u as ns}from"./useInfiniteQuery-CFUEkcEs.js";import{c as K}from"./catalog-CjU2vAfw.js";import{c as le}from"./chat-7zW8PrrA.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. @@ -53,4 +53,4 @@ import{c as C,r as m,j as e,v as y,x as We,o as Be,m as W,O as Ue,y as ze,I as K * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const je=C("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),h=m.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:y("rounded-lg border bg-card text-card-foreground shadow-sm",s),...a}));h.displayName="Card";const v=m.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:y("flex flex-col space-y-1.5 p-6",s),...a}));v.displayName="CardHeader";const N=m.forwardRef(({className:s,...a},r)=>e.jsx("h3",{ref:r,className:y("text-2xl font-semibold leading-none tracking-tight",s),...a}));N.displayName="CardTitle";const k=m.forwardRef(({className:s,...a},r)=>e.jsx("p",{ref:r,className:y("text-sm text-muted-foreground",s),...a}));k.displayName="CardDescription";const u=m.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:y("p-6 pt-0",s),...a}));u.displayName="CardContent";const xs=m.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:y("flex items-center p-6 pt-0",s),...a}));xs.displayName="CardFooter";var B="Tabs",[hs]=Qe(B,[ue]),fe=ue(),[us,V]=hs(B),ve=m.forwardRef((s,a)=>{const{__scopeTabs:r,value:n,onValueChange:c,defaultValue:d,orientation:x="horizontal",dir:o,activationMode:i="automatic",...g}=s,p=We(o),[b,l]=Be({prop:n,onChange:c,defaultProp:d??"",caller:B});return e.jsx(us,{scope:r,baseId:Ue(),value:b,onValueChange:l,orientation:x,dir:p,activationMode:i,children:e.jsx(W.div,{dir:p,"data-orientation":x,...g,ref:a})})});ve.displayName=B;var Ne="TabsList",be=m.forwardRef((s,a)=>{const{__scopeTabs:r,loop:n=!0,...c}=s,d=V(Ne,r),x=fe(r);return e.jsx(ze,{asChild:!0,...x,orientation:d.orientation,dir:d.dir,loop:n,children:e.jsx(W.div,{role:"tablist","aria-orientation":d.orientation,...c,ref:a})})});be.displayName=Ne;var ye="TabsTrigger",_e=m.forwardRef((s,a)=>{const{__scopeTabs:r,value:n,disabled:c=!1,...d}=s,x=V(ye,r),o=fe(r),i=Ce(x.baseId,n),g=Se(x.baseId,n),p=n===x.value;return e.jsx(Ke,{asChild:!0,...o,focusable:!c,active:p,children:e.jsx(W.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":g,"data-state":p?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:i,...d,ref:a,onMouseDown:z(s.onMouseDown,b=>{!c&&b.button===0&&b.ctrlKey===!1?x.onValueChange(n):b.preventDefault()}),onKeyDown:z(s.onKeyDown,b=>{[" ","Enter"].includes(b.key)&&x.onValueChange(n)}),onFocus:z(s.onFocus,()=>{const b=x.activationMode!=="manual";!p&&!c&&b&&x.onValueChange(n)})})})});_e.displayName=ye;var we="TabsContent",ke=m.forwardRef((s,a)=>{const{__scopeTabs:r,value:n,forceMount:c,children:d,...x}=s,o=V(we,r),i=Ce(o.baseId,n),g=Se(o.baseId,n),p=n===o.value,b=m.useRef(p);return m.useEffect(()=>{const l=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(l)},[]),e.jsx(Ge,{present:c||p,children:({present:l})=>e.jsx(W.div,{"data-state":p?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":i,hidden:!l,id:g,tabIndex:0,...x,ref:a,style:{...s.style,animationDuration:b.current?"0s":void 0},children:l&&d})})});ke.displayName=we;function Ce(s,a){return`${s}-trigger-${a}`}function Se(s,a){return`${s}-content-${a}`}var ps=ve,$e=be,Re=_e,Te=ke;const gs=ps,Le=m.forwardRef(({className:s,...a},r)=>e.jsx($e,{ref:r,className:y("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",s),...a}));Le.displayName=$e.displayName;const L=m.forwardRef(({className:s,...a},r)=>e.jsx(Re,{ref:r,className:y("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",s),...a}));L.displayName=Re.displayName;const P=m.forwardRef(({className:s,...a},r)=>e.jsx(Te,{ref:r,className:y("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...a}));P.displayName=Te.displayName;function f(s){if(!s)return"Never";const a=new Date(s);if(Number.isNaN(a.getTime()))return s;const r=Date.now()-a.getTime(),n=Math.floor(r/6e4),c=Math.floor(r/36e5),d=Math.floor(r/864e5);return n<1?"Just now":n<60?`${n}m ago`:c<24?`${c}h ago`:d<7?`${d}d ago`:a.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Pe(s){return s==null?"N/A":s<60?`${s.toFixed(1)}s`:s<3600?`${(s/60).toFixed(1)}m`:`${(s/3600).toFixed(1)}h`}function Fe(s){return s.available?s.status==="completed"?s.conclusion??"completed":s.status??"unknown":"Unavailable"}function X(s){return s.replace(/_/g," ").replace(/\b\w/g,a=>a.toUpperCase())}const js={healthy:Q,degraded:je,broken:q,running:S,stuck:q,unknown:is};function fs({status:s,isRunning:a}){const r=a?"running":s,n=js[r];return e.jsx(n,{className:`cron-status-icon cron-status--${r}${r==="running"?" animate-spin":""}`})}function de({label:s,axis:a}){return e.jsxs(w,{variant:"outline",className:`cron-status--${a.status}`,title:a.reason,children:[s,": ",a.status]})}function me({icon:s,title:a,metrics:r}){return e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(s,{className:"h-4 w-4"}),e.jsx("h4",{children:a})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Object.entries(r).map(([n,c])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:X(n)}),e.jsx("div",{className:"text-lg font-semibold",children:typeof c=="number"?c.toLocaleString():c})]},n))})]})}function vs({workflow:s}){return e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(H,{className:"h-4 w-4"}),e.jsx("h4",{children:"GitHub Actions"})]}),e.jsxs("div",{className:"cron-metric-card space-y-2 text-sm",children:[[["Workflow",s.workflow_file],["Run",s.run_id??"N/A"],["Status",Fe(s)],...s.updated_at?[["Updated",f(s.updated_at)]]:[]].map(([a,r])=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"cron-label",children:a}),e.jsx("span",{className:a==="Workflow"?"font-mono text-xs":void 0,children:r})]},a)),s.failed_jobs&&s.failed_jobs.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cron-label mb-1",children:"Failed jobs"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:s.failed_jobs.map(a=>e.jsx(w,{variant:"outline",className:"cron-status--broken",children:a},a))})]}),s.job_conclusions&&Object.keys(s.job_conclusions).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cron-label mb-1",children:"Job conclusions"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:Object.entries(s.job_conclusions).map(([a,r])=>e.jsxs(w,{variant:"outline",children:[a,": ",r??"running"]},a))})]}),(s.error||s.view_error)&&e.jsx("div",{className:"cron-message cron-message--error",children:s.error??s.view_error})]})]})}function Ns(s){return s==="COMPLETED"?"cron-status--healthy":s==="ERROR"||s==="CANCELED"?"cron-status--broken":s==="RUNNING"?"cron-status--running":"cron-status--unknown"}function bs({job:s}){const a=s.progress,r=a!=null&&a.total_papers?Math.min(100,a.processed_papers/a.total_papers*100):0;return e.jsxs("div",{className:"cron-metric-card space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-semibold",children:[s.mode??"unknown"," · shard ",s.shard_id??"N/A"]}),e.jsx("div",{className:"font-mono text-xs cron-muted truncate",children:s.id})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{variant:"outline",className:Ns(s.stage),children:s.stage.toLowerCase()}),s.url&&e.jsx("a",{href:s.url,target:"_blank",rel:"noreferrer","aria-label":`Open Hugging Face Job ${s.id}`,className:"cron-info-text",children:e.jsx(pe,{className:"h-4 w-4"})})]})]}),a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between gap-3 text-xs cron-muted mb-1",children:[e.jsxs("span",{children:[a.processed_papers.toLocaleString()," / ",a.total_papers.toLocaleString()," papers"]}),e.jsxs("span",{children:[r.toFixed(0),"%"]})]}),e.jsx("div",{className:"cron-progress-track",children:e.jsx("div",{className:"cron-progress-value",style:{width:`${r}%`}})})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-sm",children:[e.jsxs("span",{children:[e.jsx("strong",{children:a.succeeded_papers.toLocaleString()})," succeeded"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.failed_papers.toLocaleString()})," failed"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.already_existed_papers.toLocaleString()})," skipped"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.extracted_images.toLocaleString()})," images"]})]}),a.updated_at&&e.jsxs("div",{className:"text-xs cron-muted",children:["Progress updated ",f(a.updated_at)]}),(a.fatal_error||a.error_samples.length>0)&&e.jsxs("div",{className:"cron-message cron-message--error space-y-1",children:[a.fatal_error&&e.jsx("div",{children:a.fatal_error}),a.error_samples.map(n=>e.jsxs("div",{children:[e.jsx("span",{className:"font-mono",children:n.arxiv_id}),": ",n.error]},`${n.arxiv_id}:${n.error}`))]})]}):e.jsx("div",{className:"text-sm cron-muted",children:"Waiting for the shard progress checkpoint."}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs cron-muted",children:[s.hardware&&e.jsx("span",{children:s.hardware}),s.created_at&&e.jsxs("span",{children:["Created ",f(s.created_at)]}),s.duration_seconds!=null&&e.jsxs("span",{children:["Duration ",Pe(s.duration_seconds)]})]}),s.stage_message&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.stage_message})]})}function ys({monitor:s,loading:a,error:r}){return e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(ds,{className:"h-4 w-4"}),e.jsx("h4",{children:"Hugging Face OCR shards"})]}),a&&e.jsxs("div",{className:"cron-metric-card flex items-center gap-2 text-sm cron-muted",children:[e.jsx(S,{className:"h-4 w-4 animate-spin"})," Loading remote Jobs…"]}),!!r&&e.jsx("div",{className:"cron-message cron-message--error",children:"Could not load Hugging Face Jobs."}),s&&!s.available&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.error??"Hugging Face monitoring is unavailable."}),(s==null?void 0:s.available)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-3",children:Object.entries(s.summary).map(([n,c])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:X(n)}),e.jsx("div",{className:"text-lg font-semibold",children:c.toLocaleString()})]},n))}),s.jobs.length===0?e.jsx("div",{className:"cron-metric-card text-sm cron-muted",children:"No OCR shards have been launched yet."}):e.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:s.jobs.map(n=>e.jsx(bs,{job:n},n.id))})]})]})}function _s({job:s,expanded:a,onToggle:r,paperMarkdownJobs:n,paperMarkdownJobsLoading:c=!1,paperMarkdownJobsError:d=null}){const x=!!(s.work_metrics&&Object.keys(s.work_metrics).length),o=!!(s.db_metrics&&Object.keys(s.db_metrics).length),i=s.job_name==="paper_markdown_backfill";return e.jsxs("div",{className:"cron-job-card",children:[e.jsx("button",{type:"button",className:"cron-job-summary",onClick:r,"aria-expanded":a,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[e.jsx(fs,{status:s.status,isRunning:s.is_running}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("h3",{className:"font-semibold",children:s.display_name}),s.critical&&e.jsx(w,{variant:"outline",className:"text-[10px] uppercase tracking-wide",children:"Critical"}),s.lock_stale&&e.jsx(w,{variant:"outline",className:"cron-status--broken",children:"Held lock"}),e.jsx(de,{label:"Execution",axis:s.execution_health}),e.jsx(de,{label:"Output",axis:s.output_health}),a?e.jsx(ts,{className:"h-4 w-4 cron-muted"}):e.jsx(as,{className:"h-4 w-4 cron-muted"})]}),e.jsx("p",{className:"text-sm cron-muted mb-2",children:s.status_reason}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2 text-sm cron-muted",children:[e.jsxs("span",{className:"cron-fact",children:[e.jsx(ge,{}),"Log: ",f(s.last_run)]}),e.jsxs("span",{className:"cron-fact",children:[e.jsx(ne,{}),"DB: ",f(s.last_db_write)]}),s.recent_write_count!=null&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(ms,{}),"Recent writes: ",s.recent_write_count.toLocaleString()]}),s.duration!=null&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(H,{}),"Duration: ",Pe(s.duration)]}),s.schedule&&e.jsxs("span",{className:"cron-fact md:col-span-2",children:[e.jsx(oe,{}),e.jsx("span",{className:"font-mono text-xs",children:s.schedule})]}),s.log_status&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(te,{}),"Log status: ",s.log_status]}),s.workflow_status&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(H,{}),"Actions: ",Fe(s.workflow_status)]})]}),s.work_summary&&e.jsx("div",{className:"cron-message",children:s.work_summary}),s.error&&e.jsxs("div",{className:"cron-message cron-message--error",children:[e.jsx("strong",{children:"Error: "}),s.error]}),s.diagnostics&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.diagnostics})]})]}),e.jsx(w,{variant:"outline",className:`cron-status--${s.status}`,children:s.status})]})}),a&&!0&&e.jsx("div",{className:"cron-job-details",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(oe,{className:"h-4 w-4"}),e.jsx("h4",{children:"Scheduler evidence"})]}),e.jsx("div",{className:"cron-metric-card space-y-2 text-sm",children:[["Scheduler",s.execution_health.scheduler??"unknown"],["Last expected",f(s.execution_health.last_expected_at??null)],["Last started",f(s.execution_health.last_started_at??null)],["Last completed",f(s.execution_health.last_completed_at??null)],["Next expected",f(s.execution_health.next_expected_at??null)]].map(([p,b])=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"cron-label",children:p}),e.jsx("span",{children:b})]},p))})]}),s.work_metrics&&x&&e.jsx(me,{icon:te,title:"Log Metrics",metrics:s.work_metrics}),s.db_metrics&&o&&e.jsx(me,{icon:ne,title:"Database Metrics",metrics:s.db_metrics}),s.workflow_status&&e.jsx(vs,{workflow:s.workflow_status}),i&&e.jsx(ys,{monitor:n,loading:c,error:d}),s.diagnostic_groups&&Object.values(s.diagnostic_groups).some(p=>p.length>0)&&e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(je,{className:"h-4 w-4"}),e.jsx("h4",{children:"Diagnostics by cause"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.entries(s.diagnostic_groups).filter(([,p])=>p.length>0).map(([p,b])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label mb-1",children:X(p)}),e.jsx("ul",{className:"list-disc pl-4 text-sm space-y-1",children:b.map(l=>e.jsx("li",{children:l},l))})]},p))})]})]})})]})}const Me=m.forwardRef(({className:s,...a},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:y("w-full caption-bottom text-sm",s),...a})}));Me.displayName="Table";const Ae=m.forwardRef(({className:s,...a},r)=>e.jsx("thead",{ref:r,className:y("[&_tr]:border-b",s),...a}));Ae.displayName="TableHeader";const Ee=m.forwardRef(({className:s,...a},r)=>e.jsx("tbody",{ref:r,className:y("[&_tr:last-child]:border-0",s),...a}));Ee.displayName="TableBody";const ws=m.forwardRef(({className:s,...a},r)=>e.jsx("tfoot",{ref:r,className:y("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a}));ws.displayName="TableFooter";const G=m.forwardRef(({className:s,...a},r)=>e.jsx("tr",{ref:r,className:y("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",s),...a}));G.displayName="TableRow";const F=m.forwardRef(({className:s,...a},r)=>e.jsx("th",{ref:r,className:y("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...a}));F.displayName="TableHead";const M=m.forwardRef(({className:s,...a},r)=>e.jsx("td",{ref:r,className:y("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...a}));M.displayName="TableCell";const ks=m.forwardRef(({className:s,...a},r)=>e.jsx("caption",{ref:r,className:y("mt-4 text-sm text-muted-foreground",s),...a}));ks.displayName="TableCaption";const Cs={queued:"cron-status--unknown",dispatching:"cron-status--running",running:"cron-status--running",completed:"cron-status--healthy",failed:"cron-status--broken",canceled:"cron-status--unknown"},Ss={"add-evals":"Add evals","enrich-paper":"Enrich paper"},$s={queued:os,dispatching:S,running:cs,completed:Q,failed:q,canceled:ls};function Rs({status:s}){const a=$s[s];return e.jsxs(w,{variant:"outline",className:Cs[s],children:[e.jsx(a,{className:`mr-1 h-3.5 w-3.5 ${s==="dispatching"?"animate-spin":""}`}),s]})}function Ts(s){return s.error?s.error:s.report?s.report:s.status==="completed"&&s.applied_at?"Changes applied to the paper.":s.status==="completed"?"Completed without a recorded mutation.":null}function Ls({autoRefresh:s,refreshToken:a}){const{data:r,isLoading:n,isFetching:c,error:d}=E({queryKey:["codexPaperJobs",a],queryFn:()=>ss(100),refetchInterval:s?1e4:!1,retry:!1}),x=d&&typeof d=="object"&&"status"in d?d.status:void 0;return e.jsxs(h,{className:"mb-8",children:[e.jsx(v,{children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(N,{className:"text-xl",children:"Codex paper jobs"}),e.jsx(k,{children:"Durable queue and execution history for admin-triggered Hugging Face Jobs"})]}),c&&!n&&e.jsxs("span",{className:"flex items-center gap-2 text-xs cron-muted",children:[e.jsx(S,{className:"h-3.5 w-3.5 animate-spin"})," Syncing with Hugging Face"]})]})}),e.jsxs(u,{children:[n&&e.jsxs("div",{className:"flex items-center justify-center py-10 cron-muted",children:[e.jsx(S,{className:"mr-2 h-5 w-5 animate-spin"})," Loading paper jobs…"]}),d&&x!==404&&e.jsx("div",{className:"cron-message cron-message--error mb-4",children:d instanceof Error?d.message:"Could not load Codex paper jobs."}),x===404&&e.jsx("p",{className:"py-4 text-sm cron-muted",children:"Codex paper jobs are not enabled in this environment."}),r&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-7",children:[["queued","dispatching","running","completed","failed","canceled"].map(o=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label capitalize",children:o}),e.jsx("div",{className:"mt-1 text-xl font-semibold",children:r.summary[o]})]},o)),e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:"Total"}),e.jsx("div",{className:"mt-1 text-xl font-semibold",children:r.summary.total})]})]}),r.jobs.length===0?e.jsx("p",{className:"py-8 text-center text-sm cron-muted",children:"No paper curation jobs have been submitted yet."}):e.jsxs(Me,{children:[e.jsx(Ae,{children:e.jsxs(G,{children:[e.jsx(F,{children:"Status"}),e.jsx(F,{children:"Paper"}),e.jsx(F,{children:"Action"}),e.jsx(F,{children:"Requested"}),e.jsx(F,{children:"Execution"})]})}),e.jsx(Ee,{children:r.jobs.map(o=>{const i=Ts(o);return e.jsxs(G,{children:[e.jsx(M,{className:"align-top",children:e.jsx(Rs,{status:o.status})}),e.jsxs(M,{className:"min-w-[260px] align-top",children:[e.jsx(Ve,{to:`/paper/${encodeURIComponent(o.paper_route)}`,className:"font-medium hover:underline",children:o.paper_title}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Paper #",o.paper_id]})]}),e.jsxs(M,{className:"whitespace-nowrap align-top",children:[Ss[o.kind],o.applied_at&&e.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs cron-status--healthy",children:[e.jsx(Q,{className:"h-3.5 w-3.5"})," Applied"]})]}),e.jsxs(M,{className:"whitespace-nowrap align-top",children:[e.jsx("div",{children:f(o.created_at)}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["@",o.requested_by]})]}),e.jsxs(M,{className:"max-w-[360px] align-top",children:[o.hf_job_url?e.jsxs("a",{href:o.hf_job_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 hover:underline",children:["Hugging Face Job ",e.jsx(pe,{className:"h-3.5 w-3.5"})]}):e.jsx("span",{className:"cron-muted",children:"Waiting to dispatch"}),i&&e.jsx("p",{className:`mt-2 line-clamp-3 text-xs ${o.error?"text-red-700":"cron-muted"}`,title:i,children:i})]})]},o.id)})})]}),e.jsxs("p",{className:"mt-4 text-xs cron-muted",children:["Showing the 100 most recent jobs · Queue totals include full history · Updated ",f(r.timestamp)]})]})]})]})}const Ps=()=>{var d,x,o;const s=Xe(),a=ns({queryKey:["catalog-audit"],queryFn:({pageParam:i})=>K.audit(i),initialPageParam:void 0,getNextPageParam:i=>i.next_cursor??void 0}),r=((d=a.data)==null?void 0:d.pages.flatMap(i=>i.events))??[],n=ce({mutationFn:()=>K.acknowledgeAudit(),onSuccess:()=>s.invalidateQueries({queryKey:["catalog-audit"]})}),c=ce({mutationFn:i=>K.rollbackEvent(i),onSuccess:()=>s.invalidateQueries({queryKey:["catalog-audit"]})});return e.jsx("div",{className:"space-y-4",children:e.jsxs(h,{children:[e.jsxs(v,{className:"flex-row items-center justify-between",children:[e.jsx(N,{children:"Catalog mutation audit"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[((o=(x=a.data)==null?void 0:x.pages[0])==null?void 0:o.unread_contributor_count)??0," unread contributor changes"]}),e.jsx(A,{variant:"outline",size:"sm",onClick:()=>n.mutate(),disabled:n.isPending,children:"Mark read"})]})]}),e.jsxs(u,{className:"space-y-3",children:[a.isLoading&&e.jsx("p",{children:"Loading audit history…"}),a.error&&e.jsx("p",{className:"text-destructive",children:"Audit history unavailable."}),r.map(i=>e.jsxs("article",{className:`rounded-md border p-3 ${i.operation==="delete"||i.rollback_eligible===!1?"border-red-500 bg-red-50/50":""}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("strong",{children:[i.operation," ",i.entity_type," ",i.entity_id]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",i.actor_username??i.actor_role," ·"," ",new Date(i.created_at).toLocaleString()]})]}),e.jsxs("details",{className:"mt-2 text-xs",children:[e.jsx("summary",{children:"Inspect snapshots"}),e.jsx("pre",{className:"mt-2 max-h-80 overflow-auto rounded bg-muted p-3",children:JSON.stringify({before:i.before,after:i.after},null,2)})]}),!i.rollback_of_event_id&&e.jsx(A,{className:"mt-3",variant:"outline",size:"sm",onClick:()=>c.mutate(i.id),disabled:c.isPending||i.rollback_eligible===!1,children:i.rollback_eligible===!1?"Rollback conflict":"Roll back if unchanged"})]},i.id)),a.hasNextPage&&e.jsx(A,{variant:"outline",onClick:()=>a.fetchNextPage(),disabled:a.isFetchingNextPage,children:a.isFetchingNextPage?"Loading…":"Load older events"})]})]})})};class Fs{constructor(a){this.request=a}getCronStatus(a=!1){const r=a?"?force_refresh=true":"";return this.request(`/cron/status${r}`,{cache:"no-store"})}getPaperMarkdownJobs(){return this.request("/cron/paper-markdown-jobs",{cache:"no-store"})}}const xe=new Fs(Ye),he={hourly:"cron-status--running",daily:"cron-status--healthy",weekly:"cron-status--degraded",systemd:"cron-status--running"},_=s=>`$${(s/1e6).toFixed(2)}`,Ms=({data:s,loading:a,error:r})=>{const[n,c]=m.useState("staging-current"),d={"staging-current":"Starter staging · $75 warning / $100 trip / no Environment cap","staging-production-era":"Staging with production · $15 / $20 / $25",production:"Production · $175 / $200 / $225"};if(a)return e.jsxs("div",{className:"flex items-center py-12",children:[e.jsx(S,{className:"h-6 w-6 animate-spin mr-3"}),"Loading chat compute…"]});if(r||!s)return e.jsx(h,{className:"cron-status--broken",children:e.jsx(u,{className:"pt-6",children:"Chat compute accounting is unavailable."})});const x=Math.min(100,s.effective_microusd/s.application_cap_microusd*100),o=s.circuit_state==="tripped"?"Chat disabled":s.circuit_state==="warning"?"Operator warning":"Enabled",i=s.reconciliation_state==="fresh"?"Fresh":s.reconciliation_state==="stale"?"Stale":"Unavailable";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid md:grid-cols-4 gap-4",children:[e.jsxs(h,{className:s.circuit_state==="tripped"?"cron-status--broken":s.circuit_state==="warning"?"cron-status--degraded":"",children:[e.jsx(v,{children:e.jsx(N,{className:"text-sm",children:"Circuit"})}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:o}),e.jsx("p",{className:"text-xs cron-muted",children:s.trip_reason??"Policy armed"})]})]}),e.jsxs(h,{children:[e.jsx(v,{children:e.jsx(N,{className:"text-sm",children:"Month to date"})}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:_(s.effective_microusd)}),e.jsx("div",{role:"progressbar","aria-label":"Application cap used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(x),className:"h-2 rounded bg-muted mt-3",children:e.jsx("div",{className:"h-2 rounded bg-primary",style:{width:`${x}%`}})})]})]}),e.jsxs(h,{children:[e.jsx(v,{children:e.jsx(N,{className:"text-sm",children:"Application headroom"})}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:_(s.remaining_microusd)}),e.jsxs("p",{className:"text-xs cron-muted",children:["Cap ",_(s.application_cap_microusd)]})]})]}),e.jsxs(h,{children:[e.jsx(v,{children:e.jsx(N,{className:"text-sm",children:"Live compute"})}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:s.live_count}),e.jsxs("p",{className:"text-xs cron-muted",children:[s.termination_uncertain_count," termination uncertain"]})]})]})]}),e.jsxs(h,{children:[e.jsxs(v,{children:[e.jsx(N,{children:"Accounting and policy"}),e.jsxs(k,{children:[s.environment," · cycle ",s.billing_cycle]})]}),e.jsxs(u,{className:"grid md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Environment record"}),e.jsx("br",{}),s.environment," · ",s.provider_mode==="starter_workspace"?"Starter Workspace":"Team isolated"]}),e.jsxs("label",{children:[e.jsx("strong",{children:"Policy profile"}),e.jsxs("select",{"aria-label":"Chat compute policy profile",value:n,onChange:g=>c(g.target.value),className:"block mt-1",children:[e.jsx("option",{value:"staging-current",children:"Staging now"}),e.jsx("option",{value:"staging-production-era",children:"Staging with production"}),e.jsx("option",{value:"production",children:"Production"})]}),e.jsxs("span",{className:"text-xs cron-muted",children:[d[n]," · Workspace $250"]})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Conservative estimate"}),e.jsx("br",{}),_(s.estimated_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider-reported floor"}),e.jsx("br",{}),_(s.provider_floor_microusd)," · ",e.jsx(w,{children:i})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider backstops"}),e.jsx("br",{}),s.environment_cap_microusd===null?"Starter: no Environment cap":`Environment ${_(s.environment_cap_microusd)}`," · Workspace ",_(s.workspace_cap_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Active thresholds"}),e.jsx("br",{}),"Warning ",_(s.warning_microusd)," · trip ",_(s.application_cap_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Policy allocation"}),e.jsx("br",{}),"Starter staging $75/$100 with no Environment cap · future Team staging $15/$20/$25 · production $175/$200/$225 · workspace $250"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Cycle end"}),e.jsx("br",{}),f(s.cycle_end_at)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Last metered"}),e.jsx("br",{}),s.last_metered_at?f(s.last_metered_at):"Unavailable"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider reconciliation"}),e.jsx("br",{}),s.last_reconciled_at?f(s.last_reconciled_at):"Unavailable",s.last_reconciliation_attempt_at?` · attempted ${f(s.last_reconciliation_attempt_at)}`:"",s.next_reconciliation_at?` · next ${f(s.next_reconciliation_at)}`:""]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Burn projection"}),e.jsx("br",{}),s.burn_rate_microusd_per_hour===null?"Not enough data":`${_(s.burn_rate_microusd_per_hour)}/hour${s.projected_cap_hit_at?` · cap ${f(s.projected_cap_hit_at)}`:""}`]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Prior cycle"}),e.jsx("br",{}),s.prior_cycle?`${s.prior_cycle.billing_cycle} · ${_(s.prior_cycle.effective_microusd)}`:"Not enough data"]})]})]}),e.jsxs(h,{children:[e.jsx(v,{children:e.jsx(N,{children:"Live lifecycle"})}),e.jsx(u,{className:"text-sm",children:Object.entries(s.live_states).map(([g,p])=>e.jsxs("span",{className:"mr-4",children:[g,": ",p]},g))})]}),e.jsxs(h,{children:[e.jsx(v,{children:e.jsx(N,{children:"Daily spend"})}),e.jsx(u,{children:s.daily_spend.length?e.jsx("ul",{className:"space-y-1 text-sm",children:s.daily_spend.map(g=>e.jsxs("li",{children:[g.date,": blank ",_(g.blank_pool_microusd)," · assigned ",_(g.assigned_microusd)]},g.date))}):e.jsx("p",{className:"cron-muted",children:"No compute recorded in this cycle."})})]}),e.jsxs(h,{children:[e.jsxs(v,{children:[e.jsx(N,{children:"Recent circuit events"}),e.jsx(k,{children:"Runbook: docs/chat-sandbox-spend-runbook.md"})]}),e.jsx(u,{children:s.events.length?e.jsx("ul",{className:"space-y-2 text-sm",children:s.events.map(g=>e.jsxs("li",{children:[e.jsx(w,{children:g.severity})," ",g.type," · ",f(g.created_at)]},g.id))}):e.jsx("p",{className:"cron-muted",children:"No events in this cycle."})})]})]})},As=({data:s,loading:a,error:r})=>{if(a)return e.jsxs("div",{className:"flex items-center py-8",children:[e.jsx(S,{className:"h-5 w-5 animate-spin mr-3"}),"Loading web-search budget…"]});if(r||!s)return e.jsx(h,{className:"cron-status--broken",children:e.jsx(u,{className:"pt-6",children:"Web-search budget accounting is unavailable."})});const n=Math.min(100,s.call_count/s.hard_limit_calls*100);return e.jsxs(h,{className:s.circuit_state==="tripped"?"cron-status--broken":s.circuit_state==="warning"||s.circuit_state==="cooldown"?"cron-status--degraded":"",children:[e.jsxs(v,{children:[e.jsx(N,{children:"Web search"}),e.jsxs(k,{children:[s.environment," · UTC cycle ",s.billing_cycle," · provider details are admin-only"]})]}),e.jsxs(u,{className:"space-y-4",children:[e.jsxs("div",{className:"grid md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Circuit"}),e.jsx("br",{}),s.circuit_state,s.trip_reason?` · ${s.trip_reason}`:""]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Calls"}),e.jsx("br",{}),s.call_count," / ",s.hard_limit_calls," · ",s.success_count," successful"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Remaining"}),e.jsx("br",{}),s.remaining_calls]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Warning"}),e.jsx("br",{}),s.warning_calls," calls"]})]}),e.jsx("div",{role:"progressbar","aria-label":"Web-search monthly budget used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(n),className:"h-2 rounded bg-muted",children:e.jsx("div",{className:"h-2 rounded bg-primary",style:{width:`${n}%`}})}),e.jsxs("p",{className:"text-xs cron-muted",children:["Cycle ends ",f(s.cycle_end_at)," · provider-reported cost $",(s.provider_cost_microusd/1e6).toFixed(4),s.last_latency_ms!==null?` · last ${s.last_latency_ms} ms / ${s.last_result_count??0} results`:"",s.cooldown_until?` · cooldown until ${f(s.cooldown_until)}`:"",s.last_provider_error_class?` · last provider error ${s.last_provider_error_class}`:""]}),s.events.length>0&&e.jsx("ul",{className:"space-y-1 text-sm",children:s.events.map(c=>e.jsxs("li",{children:[c.type," · ",f(c.created_at),c.error_class?` · ${c.error_class}`:""]},c.id))})]})]})},Es=({data:s})=>s!=null&&s.snapshot_stale?e.jsx(h,{className:"mb-6 cron-status--degraded",role:"status",children:e.jsx(u,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[e.jsx(S,{className:"h-4 w-4 animate-spin"}),e.jsxs("span",{children:["Refreshing status… Current snapshot is ",Math.ceil(s.snapshot_age_seconds)," seconds old."]})]})})}):null,qs=(s,a)=>s!=null&&s.snapshot_stale||s!=null&&s.refreshing?1e3:a?3e4:!1,Zs=()=>{const s=es(),[a,r]=m.useState(!0),[n,c]=m.useState(0),[d,x]=m.useState(""),[o,i]=m.useState(""),[g,p]=m.useState(new Set),b=m.useRef(!1),{user:l}=Ze(),{data:j,isLoading:Y,isFetching:Z,error:$,refetch:qe}=E({queryKey:["cronStatus",l==null?void 0:l.username],queryFn:()=>{const t=b.current;return b.current=!1,xe.getCronStatus(t)},enabled:!!(l!=null&&l.is_admin),refetchInterval:t=>qs(t.state.data,a),retry:!1}),D=E({queryKey:["paperMarkdownJobs",l==null?void 0:l.username],queryFn:()=>xe.getPaperMarkdownJobs(),enabled:!!(l!=null&&l.is_admin),refetchInterval:a?3e4:!1,retry:!1}),I=E({queryKey:["chatSandboxSpend",l==null?void 0:l.username,o],queryFn:()=>le.getSandboxSpend(o||void 0),enabled:!!(l!=null&&l.is_admin),refetchInterval:a?3e4:!1,retry:!1}),U=E({queryKey:["chatWebSearchBudget",l==null?void 0:l.username],queryFn:()=>le.getWebSearchBudget(),enabled:!!(l!=null&&l.is_admin)&&s,refetchInterval:a?3e4:!1,retry:!1}),ee=($&&typeof $=="object"&&"status"in $?$.status:void 0)===401?"Unauthorized. Sign in with an allowlisted Hugging Face admin account.":$ instanceof Error?$.message:void 0,De=t=>{p(R=>{const T=new Set(R);return T.has(t)?T.delete(t):T.add(t),T})},se=(j==null?void 0:j.jobs.filter(t=>t.dashboard_group==="leaderboard_sync"))??[],ae=(j==null?void 0:j.jobs.filter(t=>t.category!=="manual"&&t.dashboard_group!=="leaderboard_sync"))??[],Ie=ae.filter(t=>t.critical),Je=ae.filter(t=>!t.critical),re=(j==null?void 0:j.manual_operations)??[],J=Je.reduce((t,R)=>(t[R.category]||(t[R.category]=[]),t[R.category].push(R),t),{}),Oe=Object.keys(J).sort((t,R)=>{const T=["systemd","hourly","daily","weekly","backfill"];return T.indexOf(t)-T.indexOf(R)}),O=t=>e.jsx(_s,{job:t,expanded:g.has(t.job_name),onToggle:()=>De(t.job_name),paperMarkdownJobs:t.job_name==="paper_markdown_backfill"?D.data:void 0,paperMarkdownJobsLoading:t.job_name==="paper_markdown_backfill"?D.isLoading:!1,paperMarkdownJobsError:t.job_name==="paper_markdown_backfill"?D.error:null},t.job_name),He=()=>{c(t=>t+1),b.current=!0,qe(),D.refetch(),I.refetch()};return e.jsx("div",{className:"cron-dashboard","data-shadcn":!0,children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[e.jsx(H,{className:"h-8 w-8 cron-info-text"}),"Admin Dashboard"]}),e.jsx("p",{className:"mt-2 cron-muted",children:"Paper curation queue and operational health for scheduled jobs"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(A,{variant:"outline",size:"sm",onClick:()=>r(!a),className:a?"cron-status--running":"",children:[e.jsx(ie,{className:`h-4 w-4 mr-2 ${a?"animate-spin":""}`}),"Auto-refresh ",a?"ON":"OFF"]}),e.jsxs(A,{variant:"outline",size:"sm",onClick:He,disabled:Z,children:[e.jsx(ie,{className:`h-4 w-4 mr-2 ${Z?"animate-spin":""}`}),"Refresh"]})]})]})}),e.jsx(h,{className:"mb-6",children:e.jsx(u,{className:"pt-6",children:e.jsxs("p",{className:"text-sm cron-muted",children:["Signed in as ",e.jsxs("span",{className:"font-semibold",children:["@",l==null?void 0:l.username]}),". Health checks prefer database freshness over log completion so silent no-work failures surface as degraded or broken."]})})}),e.jsx(Es,{data:j}),e.jsxs(gs,{defaultValue:"critical-jobs",children:[e.jsxs(Le,{className:"grid h-auto w-full grid-cols-2 sm:w-auto sm:grid-cols-5",children:[e.jsx(L,{value:"critical-jobs",children:"Critical Jobs"}),e.jsx(L,{value:"leaderboard-syncs",children:"Leaderboard Syncs"}),e.jsx(L,{value:"codex-paper-jobs",children:"Codex Paper Jobs"}),e.jsx(L,{value:"catalog-audit",children:"Catalog Audit"}),e.jsx(L,{value:"chat-compute",children:"Chat Compute"})]}),e.jsxs(P,{value:"critical-jobs",className:"mt-6",children:[Y&&e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(S,{className:"h-8 w-8 animate-spin cron-info-text"}),e.jsx("span",{className:"ml-3 cron-muted",children:"Loading CRON jobs status..."})]}),$&&e.jsx(h,{className:"cron-status--broken",children:e.jsx(u,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(q,{className:"h-5 w-5"}),e.jsx("p",{children:ee??"Failed to load CRON jobs status. Please try again."})]})})}),j&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6",children:["healthy","degraded","broken","running","stuck","unknown"].map(t=>e.jsxs(h,{children:[e.jsx(v,{className:"pb-2",children:e.jsx(N,{className:"text-sm font-medium cron-muted capitalize",children:t})}),e.jsx(u,{children:e.jsx("div",{className:"text-2xl font-bold",children:j.summary[t]})})]},t))}),j.summary.critical_issues.length>0&&e.jsxs(h,{className:"mb-6 cron-status--broken",children:[e.jsx(v,{children:e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(rs,{className:"h-5 w-5"}),"Critical job issues"]})}),e.jsx(u,{children:e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm",children:j.summary.critical_issues.map(t=>e.jsx("li",{children:t},t))})})]}),e.jsxs(h,{className:"mb-8",children:[e.jsx(v,{children:e.jsx(N,{className:"text-base",children:"What to check next"})}),e.jsxs(u,{children:[e.jsx("p",{className:"text-sm cron-muted",children:j.summary.what_to_check_next}),e.jsxs("p",{className:"mt-2 text-xs cron-muted flex items-center gap-2",children:[e.jsx(ge,{className:"h-4 w-4"}),"Last updated: ",f(j.timestamp)," · Health score:"," ",j.summary.health_score.toFixed(0),"%"]})]})]}),e.jsxs(h,{className:`mb-8 ${j.summary.coverage.coverage_gaps?"cron-status--broken":""}`,children:[e.jsxs(v,{children:[e.jsx(N,{className:"text-base",children:"Coverage"}),e.jsx(k,{children:"Registry and deployed scheduler inventory"})]}),e.jsxs(u,{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Registered"}),e.jsx("div",{className:"text-2xl font-bold",children:j.summary.coverage.registered_scheduled_duties})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Discovered"}),e.jsx("div",{className:"text-2xl font-bold",children:j.summary.coverage.discovered_scheduled_duties})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Monitored"}),e.jsx("div",{className:"text-2xl font-bold",children:j.summary.coverage.monitored_duties})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Gaps"}),e.jsx("div",{className:"text-2xl font-bold",children:j.summary.coverage.coverage_gaps})]})]})]}),e.jsxs(h,{className:"mb-8",children:[e.jsxs(v,{children:[e.jsx(N,{className:"text-xl",children:"Critical jobs"}),e.jsx(k,{children:"Writers whose stale output breaks the live site"})]}),e.jsx(u,{className:"space-y-4",children:Ie.map(O)})]}),e.jsx("div",{className:"space-y-6",children:Oe.map(t=>e.jsxs(h,{children:[e.jsx(v,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(N,{className:"text-xl capitalize flex items-center gap-2",children:[e.jsx(w,{className:he[t]??he.hourly,children:t}),e.jsx("span",{children:"Supporting jobs"})]}),e.jsxs(k,{children:[J[t].length," job",J[t].length!==1?"s":""]})]})}),e.jsx(u,{className:"space-y-4",children:J[t].map(O)})]},t))}),re.length>0&&e.jsxs(h,{className:"mt-6",children:[e.jsxs(v,{children:[e.jsx(N,{className:"text-xl",children:"Manual operations"}),e.jsx(k,{children:"Visible invocation history; excluded from scheduled health and coverage"})]}),e.jsx(u,{className:"space-y-4",children:re.map(O)})]})]})]}),e.jsxs(P,{value:"leaderboard-syncs",className:"mt-6",children:[Y&&e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(S,{className:"h-8 w-8 animate-spin cron-info-text"}),e.jsx("span",{className:"ml-3 cron-muted",children:"Loading leaderboard sync status..."})]}),$&&e.jsx(h,{className:"cron-status--broken",children:e.jsx(u,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(q,{className:"h-5 w-5"}),e.jsx("p",{children:ee??"Failed to load leaderboard sync status. Please try again."})]})})}),j&&e.jsxs(h,{children:[e.jsx(v,{children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(N,{className:"text-xl",children:"Leaderboard syncs"}),e.jsx(k,{children:"Recurring imports from externally maintained benchmark leaderboards"})]}),e.jsxs(w,{children:[se.length," jobs"]})]})}),e.jsx(u,{className:"space-y-4",children:se.map(O)})]})]}),e.jsx(P,{value:"codex-paper-jobs",className:"mt-6",children:e.jsx(Ls,{autoRefresh:a,refreshToken:n})}),e.jsx(P,{value:"catalog-audit",className:"mt-6",children:e.jsx(Ps,{})}),e.jsxs(P,{value:"chat-compute",className:"mt-6",children:[e.jsxs(h,{className:"mb-6",children:[e.jsxs(v,{children:[e.jsx(N,{children:"Environment record"}),e.jsx(k,{children:"Leave blank for live staging, or enter the isolated environment printed by the spend qualification command."})]}),e.jsxs(u,{className:"flex gap-2",children:[e.jsx("input",{"aria-label":"Chat compute environment record",value:d,onChange:t=>x(t.target.value),placeholder:"staging-q-example",className:"flex-1 rounded border px-3 py-2"}),e.jsx(A,{onClick:()=>i(d.trim()),children:"Load"})]})]}),e.jsx(Ms,{data:I.data,loading:I.isLoading,error:I.error}),s&&e.jsx("div",{className:"mt-6",children:e.jsx(As,{data:U.data,loading:U.isLoading,error:U.error})})]})]})]})})};export{Ms as ChatComputePanel,Es as CronSnapshotNotice,As as WebSearchBudgetPanel,qs as cronStatusRefetchInterval,Zs as default}; + */const je=C("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),h=m.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:y("rounded-lg border bg-card text-card-foreground shadow-sm",s),...a}));h.displayName="Card";const v=m.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:y("flex flex-col space-y-1.5 p-6",s),...a}));v.displayName="CardHeader";const N=m.forwardRef(({className:s,...a},r)=>e.jsx("h3",{ref:r,className:y("text-2xl font-semibold leading-none tracking-tight",s),...a}));N.displayName="CardTitle";const k=m.forwardRef(({className:s,...a},r)=>e.jsx("p",{ref:r,className:y("text-sm text-muted-foreground",s),...a}));k.displayName="CardDescription";const u=m.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:y("p-6 pt-0",s),...a}));u.displayName="CardContent";const xs=m.forwardRef(({className:s,...a},r)=>e.jsx("div",{ref:r,className:y("flex items-center p-6 pt-0",s),...a}));xs.displayName="CardFooter";var B="Tabs",[hs]=Qe(B,[ue]),fe=ue(),[us,V]=hs(B),ve=m.forwardRef((s,a)=>{const{__scopeTabs:r,value:n,onValueChange:c,defaultValue:d,orientation:x="horizontal",dir:o,activationMode:i="automatic",...g}=s,p=We(o),[b,l]=Be({prop:n,onChange:c,defaultProp:d??"",caller:B});return e.jsx(us,{scope:r,baseId:Ue(),value:b,onValueChange:l,orientation:x,dir:p,activationMode:i,children:e.jsx(W.div,{dir:p,"data-orientation":x,...g,ref:a})})});ve.displayName=B;var Ne="TabsList",be=m.forwardRef((s,a)=>{const{__scopeTabs:r,loop:n=!0,...c}=s,d=V(Ne,r),x=fe(r);return e.jsx(ze,{asChild:!0,...x,orientation:d.orientation,dir:d.dir,loop:n,children:e.jsx(W.div,{role:"tablist","aria-orientation":d.orientation,...c,ref:a})})});be.displayName=Ne;var ye="TabsTrigger",_e=m.forwardRef((s,a)=>{const{__scopeTabs:r,value:n,disabled:c=!1,...d}=s,x=V(ye,r),o=fe(r),i=Ce(x.baseId,n),g=Se(x.baseId,n),p=n===x.value;return e.jsx(Ke,{asChild:!0,...o,focusable:!c,active:p,children:e.jsx(W.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":g,"data-state":p?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:i,...d,ref:a,onMouseDown:z(s.onMouseDown,b=>{!c&&b.button===0&&b.ctrlKey===!1?x.onValueChange(n):b.preventDefault()}),onKeyDown:z(s.onKeyDown,b=>{[" ","Enter"].includes(b.key)&&x.onValueChange(n)}),onFocus:z(s.onFocus,()=>{const b=x.activationMode!=="manual";!p&&!c&&b&&x.onValueChange(n)})})})});_e.displayName=ye;var we="TabsContent",ke=m.forwardRef((s,a)=>{const{__scopeTabs:r,value:n,forceMount:c,children:d,...x}=s,o=V(we,r),i=Ce(o.baseId,n),g=Se(o.baseId,n),p=n===o.value,b=m.useRef(p);return m.useEffect(()=>{const l=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(l)},[]),e.jsx(Ge,{present:c||p,children:({present:l})=>e.jsx(W.div,{"data-state":p?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":i,hidden:!l,id:g,tabIndex:0,...x,ref:a,style:{...s.style,animationDuration:b.current?"0s":void 0},children:l&&d})})});ke.displayName=we;function Ce(s,a){return`${s}-trigger-${a}`}function Se(s,a){return`${s}-content-${a}`}var ps=ve,Re=be,$e=_e,Te=ke;const gs=ps,Le=m.forwardRef(({className:s,...a},r)=>e.jsx(Re,{ref:r,className:y("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",s),...a}));Le.displayName=Re.displayName;const L=m.forwardRef(({className:s,...a},r)=>e.jsx($e,{ref:r,className:y("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",s),...a}));L.displayName=$e.displayName;const P=m.forwardRef(({className:s,...a},r)=>e.jsx(Te,{ref:r,className:y("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...a}));P.displayName=Te.displayName;function f(s){if(!s)return"Never";const a=new Date(s);if(Number.isNaN(a.getTime()))return s;const r=Date.now()-a.getTime(),n=Math.floor(r/6e4),c=Math.floor(r/36e5),d=Math.floor(r/864e5);return n<1?"Just now":n<60?`${n}m ago`:c<24?`${c}h ago`:d<7?`${d}d ago`:a.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Pe(s){return s==null?"N/A":s<60?`${s.toFixed(1)}s`:s<3600?`${(s/60).toFixed(1)}m`:`${(s/3600).toFixed(1)}h`}function Fe(s){return s.available?s.status==="completed"?s.conclusion??"completed":s.status??"unknown":"Unavailable"}function X(s){return s.replace(/_/g," ").replace(/\b\w/g,a=>a.toUpperCase())}const js={healthy:Q,degraded:je,broken:q,running:S,stuck:q,unknown:is};function fs({status:s,isRunning:a}){const r=a?"running":s,n=js[r];return e.jsx(n,{className:`cron-status-icon cron-status--${r}${r==="running"?" animate-spin":""}`})}function de({label:s,axis:a}){return e.jsxs(w,{variant:"outline",className:`cron-status--${a.status}`,title:a.reason,children:[s,": ",a.status]})}function me({icon:s,title:a,metrics:r}){return e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(s,{className:"h-4 w-4"}),e.jsx("h4",{children:a})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Object.entries(r).map(([n,c])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:X(n)}),e.jsx("div",{className:"text-lg font-semibold",children:typeof c=="number"?c.toLocaleString():c})]},n))})]})}function vs({workflow:s}){return e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(H,{className:"h-4 w-4"}),e.jsx("h4",{children:"GitHub Actions"})]}),e.jsxs("div",{className:"cron-metric-card space-y-2 text-sm",children:[[["Workflow",s.workflow_file],["Run",s.run_id??"N/A"],["Status",Fe(s)],...s.updated_at?[["Updated",f(s.updated_at)]]:[]].map(([a,r])=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"cron-label",children:a}),e.jsx("span",{className:a==="Workflow"?"font-mono text-xs":void 0,children:r})]},a)),s.failed_jobs&&s.failed_jobs.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cron-label mb-1",children:"Failed jobs"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:s.failed_jobs.map(a=>e.jsx(w,{variant:"outline",className:"cron-status--broken",children:a},a))})]}),s.job_conclusions&&Object.keys(s.job_conclusions).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cron-label mb-1",children:"Job conclusions"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:Object.entries(s.job_conclusions).map(([a,r])=>e.jsxs(w,{variant:"outline",children:[a,": ",r??"running"]},a))})]}),(s.error||s.view_error)&&e.jsx("div",{className:"cron-message cron-message--error",children:s.error??s.view_error})]})]})}function Ns(s){return s==="COMPLETED"?"cron-status--healthy":s==="ERROR"||s==="CANCELED"?"cron-status--broken":s==="RUNNING"?"cron-status--running":"cron-status--unknown"}function bs({job:s}){const a=s.progress,r=a!=null&&a.total_papers?Math.min(100,a.processed_papers/a.total_papers*100):0;return e.jsxs("div",{className:"cron-metric-card space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-semibold",children:[s.mode??"unknown"," · shard ",s.shard_id??"N/A"]}),e.jsx("div",{className:"font-mono text-xs cron-muted truncate",children:s.id})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{variant:"outline",className:Ns(s.stage),children:s.stage.toLowerCase()}),s.url&&e.jsx("a",{href:s.url,target:"_blank",rel:"noreferrer","aria-label":`Open Hugging Face Job ${s.id}`,className:"cron-info-text",children:e.jsx(pe,{className:"h-4 w-4"})})]})]}),a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between gap-3 text-xs cron-muted mb-1",children:[e.jsxs("span",{children:[a.processed_papers.toLocaleString()," / ",a.total_papers.toLocaleString()," papers"]}),e.jsxs("span",{children:[r.toFixed(0),"%"]})]}),e.jsx("div",{className:"cron-progress-track",children:e.jsx("div",{className:"cron-progress-value",style:{width:`${r}%`}})})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-sm",children:[e.jsxs("span",{children:[e.jsx("strong",{children:a.succeeded_papers.toLocaleString()})," succeeded"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.failed_papers.toLocaleString()})," failed"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.already_existed_papers.toLocaleString()})," skipped"]}),e.jsxs("span",{children:[e.jsx("strong",{children:a.extracted_images.toLocaleString()})," images"]})]}),a.updated_at&&e.jsxs("div",{className:"text-xs cron-muted",children:["Progress updated ",f(a.updated_at)]}),(a.fatal_error||a.error_samples.length>0)&&e.jsxs("div",{className:"cron-message cron-message--error space-y-1",children:[a.fatal_error&&e.jsx("div",{children:a.fatal_error}),a.error_samples.map(n=>e.jsxs("div",{children:[e.jsx("span",{className:"font-mono",children:n.arxiv_id}),": ",n.error]},`${n.arxiv_id}:${n.error}`))]})]}):e.jsx("div",{className:"text-sm cron-muted",children:"Waiting for the shard progress checkpoint."}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs cron-muted",children:[s.hardware&&e.jsx("span",{children:s.hardware}),s.created_at&&e.jsxs("span",{children:["Created ",f(s.created_at)]}),s.duration_seconds!=null&&e.jsxs("span",{children:["Duration ",Pe(s.duration_seconds)]})]}),s.stage_message&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.stage_message})]})}function ys({monitor:s,loading:a,error:r}){return e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(ds,{className:"h-4 w-4"}),e.jsx("h4",{children:"Hugging Face OCR shards"})]}),a&&e.jsxs("div",{className:"cron-metric-card flex items-center gap-2 text-sm cron-muted",children:[e.jsx(S,{className:"h-4 w-4 animate-spin"})," Loading remote Jobs…"]}),!!r&&e.jsx("div",{className:"cron-message cron-message--error",children:"Could not load Hugging Face Jobs."}),s&&!s.available&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.error??"Hugging Face monitoring is unavailable."}),(s==null?void 0:s.available)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-3",children:Object.entries(s.summary).map(([n,c])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:X(n)}),e.jsx("div",{className:"text-lg font-semibold",children:c.toLocaleString()})]},n))}),s.jobs.length===0?e.jsx("div",{className:"cron-metric-card text-sm cron-muted",children:"No OCR shards have been launched yet."}):e.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:s.jobs.map(n=>e.jsx(bs,{job:n},n.id))})]})]})}function _s({job:s,expanded:a,onToggle:r,paperMarkdownJobs:n,paperMarkdownJobsLoading:c=!1,paperMarkdownJobsError:d=null}){const x=!!(s.work_metrics&&Object.keys(s.work_metrics).length),o=!!(s.db_metrics&&Object.keys(s.db_metrics).length),i=s.job_name==="paper_markdown_backfill";return e.jsxs("div",{className:"cron-job-card",children:[e.jsx("button",{type:"button",className:"cron-job-summary",onClick:r,"aria-expanded":a,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[e.jsx(fs,{status:s.status,isRunning:s.is_running}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("h3",{className:"font-semibold",children:s.display_name}),s.critical&&e.jsx(w,{variant:"outline",className:"text-[10px] uppercase tracking-wide",children:"Critical"}),s.lock_stale&&e.jsx(w,{variant:"outline",className:"cron-status--broken",children:"Held lock"}),e.jsx(de,{label:"Execution",axis:s.execution_health}),e.jsx(de,{label:"Output",axis:s.output_health}),a?e.jsx(ts,{className:"h-4 w-4 cron-muted"}):e.jsx(as,{className:"h-4 w-4 cron-muted"})]}),e.jsx("p",{className:"text-sm cron-muted mb-2",children:s.status_reason}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2 text-sm cron-muted",children:[e.jsxs("span",{className:"cron-fact",children:[e.jsx(ge,{}),"Log: ",f(s.last_run)]}),e.jsxs("span",{className:"cron-fact",children:[e.jsx(ne,{}),"DB: ",f(s.last_db_write)]}),s.recent_write_count!=null&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(ms,{}),"Recent writes: ",s.recent_write_count.toLocaleString()]}),s.duration!=null&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(H,{}),"Duration: ",Pe(s.duration)]}),s.schedule&&e.jsxs("span",{className:"cron-fact md:col-span-2",children:[e.jsx(oe,{}),e.jsx("span",{className:"font-mono text-xs",children:s.schedule})]}),s.log_status&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(te,{}),"Log status: ",s.log_status]}),s.workflow_status&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(H,{}),"Actions: ",Fe(s.workflow_status)]})]}),s.work_summary&&e.jsx("div",{className:"cron-message",children:s.work_summary}),s.error&&e.jsxs("div",{className:"cron-message cron-message--error",children:[e.jsx("strong",{children:"Error: "}),s.error]}),s.diagnostics&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.diagnostics})]})]}),e.jsx(w,{variant:"outline",className:`cron-status--${s.status}`,children:s.status})]})}),a&&!0&&e.jsx("div",{className:"cron-job-details",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(oe,{className:"h-4 w-4"}),e.jsx("h4",{children:"Scheduler evidence"})]}),e.jsx("div",{className:"cron-metric-card space-y-2 text-sm",children:[["Scheduler",s.execution_health.scheduler??"unknown"],["Last expected",f(s.execution_health.last_expected_at??null)],["Last started",f(s.execution_health.last_started_at??null)],["Last completed",f(s.execution_health.last_completed_at??null)],["Next expected",f(s.execution_health.next_expected_at??null)]].map(([p,b])=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"cron-label",children:p}),e.jsx("span",{children:b})]},p))})]}),s.work_metrics&&x&&e.jsx(me,{icon:te,title:"Log Metrics",metrics:s.work_metrics}),s.db_metrics&&o&&e.jsx(me,{icon:ne,title:"Database Metrics",metrics:s.db_metrics}),s.workflow_status&&e.jsx(vs,{workflow:s.workflow_status}),i&&e.jsx(ys,{monitor:n,loading:c,error:d}),s.diagnostic_groups&&Object.values(s.diagnostic_groups).some(p=>p.length>0)&&e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(je,{className:"h-4 w-4"}),e.jsx("h4",{children:"Diagnostics by cause"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.entries(s.diagnostic_groups).filter(([,p])=>p.length>0).map(([p,b])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label mb-1",children:X(p)}),e.jsx("ul",{className:"list-disc pl-4 text-sm space-y-1",children:b.map(l=>e.jsx("li",{children:l},l))})]},p))})]})]})})]})}const Me=m.forwardRef(({className:s,...a},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:y("w-full caption-bottom text-sm",s),...a})}));Me.displayName="Table";const Ae=m.forwardRef(({className:s,...a},r)=>e.jsx("thead",{ref:r,className:y("[&_tr]:border-b",s),...a}));Ae.displayName="TableHeader";const Ee=m.forwardRef(({className:s,...a},r)=>e.jsx("tbody",{ref:r,className:y("[&_tr:last-child]:border-0",s),...a}));Ee.displayName="TableBody";const ws=m.forwardRef(({className:s,...a},r)=>e.jsx("tfoot",{ref:r,className:y("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a}));ws.displayName="TableFooter";const G=m.forwardRef(({className:s,...a},r)=>e.jsx("tr",{ref:r,className:y("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",s),...a}));G.displayName="TableRow";const F=m.forwardRef(({className:s,...a},r)=>e.jsx("th",{ref:r,className:y("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...a}));F.displayName="TableHead";const M=m.forwardRef(({className:s,...a},r)=>e.jsx("td",{ref:r,className:y("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...a}));M.displayName="TableCell";const ks=m.forwardRef(({className:s,...a},r)=>e.jsx("caption",{ref:r,className:y("mt-4 text-sm text-muted-foreground",s),...a}));ks.displayName="TableCaption";const Cs={queued:"cron-status--unknown",dispatching:"cron-status--running",running:"cron-status--running",completed:"cron-status--healthy",failed:"cron-status--broken",canceled:"cron-status--unknown"},Ss={"add-evals":"Add evals","enrich-paper":"Enrich paper"},Rs={queued:os,dispatching:S,running:cs,completed:Q,failed:q,canceled:ls};function $s({status:s}){const a=Rs[s];return e.jsxs(w,{variant:"outline",className:Cs[s],children:[e.jsx(a,{className:`mr-1 h-3.5 w-3.5 ${s==="dispatching"?"animate-spin":""}`}),s]})}function Ts(s){return s.error?s.error:s.report?s.report:s.status==="completed"&&s.applied_at?"Changes applied to the paper.":s.status==="completed"?"Completed without a recorded mutation.":null}function Ls({autoRefresh:s,refreshToken:a}){const{data:r,isLoading:n,isFetching:c,error:d}=E({queryKey:["codexPaperJobs",a],queryFn:()=>ss(100),refetchInterval:s?1e4:!1,retry:!1}),x=d&&typeof d=="object"&&"status"in d?d.status:void 0;return e.jsxs(h,{className:"mb-8",children:[e.jsx(v,{children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(N,{className:"text-xl",children:"Codex paper jobs"}),e.jsx(k,{children:"Durable queue and execution history for admin-triggered Hugging Face Jobs"})]}),c&&!n&&e.jsxs("span",{className:"flex items-center gap-2 text-xs cron-muted",children:[e.jsx(S,{className:"h-3.5 w-3.5 animate-spin"})," Syncing with Hugging Face"]})]})}),e.jsxs(u,{children:[n&&e.jsxs("div",{className:"flex items-center justify-center py-10 cron-muted",children:[e.jsx(S,{className:"mr-2 h-5 w-5 animate-spin"})," Loading paper jobs…"]}),d&&x!==404&&e.jsx("div",{className:"cron-message cron-message--error mb-4",children:d instanceof Error?d.message:"Could not load Codex paper jobs."}),x===404&&e.jsx("p",{className:"py-4 text-sm cron-muted",children:"Codex paper jobs are not enabled in this environment."}),r&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-7",children:[["queued","dispatching","running","completed","failed","canceled"].map(o=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label capitalize",children:o}),e.jsx("div",{className:"mt-1 text-xl font-semibold",children:r.summary[o]})]},o)),e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:"Total"}),e.jsx("div",{className:"mt-1 text-xl font-semibold",children:r.summary.total})]})]}),r.jobs.length===0?e.jsx("p",{className:"py-8 text-center text-sm cron-muted",children:"No paper curation jobs have been submitted yet."}):e.jsxs(Me,{children:[e.jsx(Ae,{children:e.jsxs(G,{children:[e.jsx(F,{children:"Status"}),e.jsx(F,{children:"Paper"}),e.jsx(F,{children:"Action"}),e.jsx(F,{children:"Requested"}),e.jsx(F,{children:"Execution"})]})}),e.jsx(Ee,{children:r.jobs.map(o=>{const i=Ts(o);return e.jsxs(G,{children:[e.jsx(M,{className:"align-top",children:e.jsx($s,{status:o.status})}),e.jsxs(M,{className:"min-w-[260px] align-top",children:[e.jsx(Ve,{to:`/paper/${encodeURIComponent(o.paper_route)}`,className:"font-medium hover:underline",children:o.paper_title}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Paper #",o.paper_id]})]}),e.jsxs(M,{className:"whitespace-nowrap align-top",children:[Ss[o.kind],o.applied_at&&e.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs cron-status--healthy",children:[e.jsx(Q,{className:"h-3.5 w-3.5"})," Applied"]})]}),e.jsxs(M,{className:"whitespace-nowrap align-top",children:[e.jsx("div",{children:f(o.created_at)}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["@",o.requested_by]})]}),e.jsxs(M,{className:"max-w-[360px] align-top",children:[o.hf_job_url?e.jsxs("a",{href:o.hf_job_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 hover:underline",children:["Hugging Face Job ",e.jsx(pe,{className:"h-3.5 w-3.5"})]}):e.jsx("span",{className:"cron-muted",children:"Waiting to dispatch"}),i&&e.jsx("p",{className:`mt-2 line-clamp-3 text-xs ${o.error?"text-red-700":"cron-muted"}`,title:i,children:i})]})]},o.id)})})]}),e.jsxs("p",{className:"mt-4 text-xs cron-muted",children:["Showing the 100 most recent jobs · Queue totals include full history · Updated ",f(r.timestamp)]})]})]})]})}const Ps=()=>{var d,x,o;const s=Xe(),a=ns({queryKey:["catalog-audit"],queryFn:({pageParam:i})=>K.audit(i),initialPageParam:void 0,getNextPageParam:i=>i.next_cursor??void 0}),r=((d=a.data)==null?void 0:d.pages.flatMap(i=>i.events))??[],n=ce({mutationFn:()=>K.acknowledgeAudit(),onSuccess:()=>s.invalidateQueries({queryKey:["catalog-audit"]})}),c=ce({mutationFn:i=>K.rollbackEvent(i),onSuccess:()=>s.invalidateQueries({queryKey:["catalog-audit"]})});return e.jsx("div",{className:"space-y-4",children:e.jsxs(h,{children:[e.jsxs(v,{className:"flex-row items-center justify-between",children:[e.jsx(N,{children:"Catalog mutation audit"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[((o=(x=a.data)==null?void 0:x.pages[0])==null?void 0:o.unread_contributor_count)??0," unread contributor changes"]}),e.jsx(A,{variant:"outline",size:"sm",onClick:()=>n.mutate(),disabled:n.isPending,children:"Mark read"})]})]}),e.jsxs(u,{className:"space-y-3",children:[a.isLoading&&e.jsx("p",{children:"Loading audit history…"}),a.error&&e.jsx("p",{className:"text-destructive",children:"Audit history unavailable."}),r.map(i=>e.jsxs("article",{className:`rounded-md border p-3 ${i.operation==="delete"||i.rollback_eligible===!1?"border-red-500 bg-red-50/50":""}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("strong",{children:[i.operation," ",i.entity_type," ",i.entity_id]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",i.actor_username??i.actor_role," ·"," ",new Date(i.created_at).toLocaleString()]})]}),e.jsxs("details",{className:"mt-2 text-xs",children:[e.jsx("summary",{children:"Inspect snapshots"}),e.jsx("pre",{className:"mt-2 max-h-80 overflow-auto rounded bg-muted p-3",children:JSON.stringify({before:i.before,after:i.after},null,2)})]}),!i.rollback_of_event_id&&e.jsx(A,{className:"mt-3",variant:"outline",size:"sm",onClick:()=>c.mutate(i.id),disabled:c.isPending||i.rollback_eligible===!1,children:i.rollback_eligible===!1?"Rollback conflict":"Roll back if unchanged"})]},i.id)),a.hasNextPage&&e.jsx(A,{variant:"outline",onClick:()=>a.fetchNextPage(),disabled:a.isFetchingNextPage,children:a.isFetchingNextPage?"Loading…":"Load older events"})]})]})})};class Fs{constructor(a){this.request=a}getCronStatus(a=!1){const r=a?"?force_refresh=true":"";return this.request(`/cron/status${r}`,{cache:"no-store"})}getPaperMarkdownJobs(){return this.request("/cron/paper-markdown-jobs",{cache:"no-store"})}}const xe=new Fs(Ye),he={hourly:"cron-status--running",daily:"cron-status--healthy",weekly:"cron-status--degraded",systemd:"cron-status--running"},_=s=>`$${(s/1e6).toFixed(2)}`,Ms=({data:s,loading:a,error:r})=>{const[n,c]=m.useState("staging-current"),d={"staging-current":"Starter staging · $75 warning / $100 trip / no Environment cap","staging-production-era":"Staging with production · $15 / $20 / $25",production:"Production · $175 / $200 / $225"};if(a)return e.jsxs("div",{className:"flex items-center py-12",children:[e.jsx(S,{className:"h-6 w-6 animate-spin mr-3"}),"Loading chat compute…"]});if(r||!s)return e.jsx(h,{className:"cron-status--broken",children:e.jsx(u,{className:"pt-6",children:"Chat compute accounting is unavailable."})});const x=Math.min(100,s.effective_microusd/s.application_cap_microusd*100),o=s.circuit_state==="tripped"?"Chat disabled":s.circuit_state==="warning"?"Operator warning":"Enabled",i=s.reconciliation_state==="fresh"?"Fresh":s.reconciliation_state==="stale"?"Stale":"Unavailable";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid md:grid-cols-4 gap-4",children:[e.jsxs(h,{className:s.circuit_state==="tripped"?"cron-status--broken":s.circuit_state==="warning"?"cron-status--degraded":"",children:[e.jsx(v,{children:e.jsx(N,{className:"text-sm",children:"Circuit"})}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:o}),e.jsx("p",{className:"text-xs cron-muted",children:s.trip_reason??"Policy armed"})]})]}),e.jsxs(h,{children:[e.jsx(v,{children:e.jsx(N,{className:"text-sm",children:"Month to date"})}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:_(s.effective_microusd)}),e.jsx("div",{role:"progressbar","aria-label":"Application cap used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(x),className:"h-2 rounded bg-muted mt-3",children:e.jsx("div",{className:"h-2 rounded bg-primary",style:{width:`${x}%`}})})]})]}),e.jsxs(h,{children:[e.jsx(v,{children:e.jsx(N,{className:"text-sm",children:"Application headroom"})}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:_(s.remaining_microusd)}),e.jsxs("p",{className:"text-xs cron-muted",children:["Cap ",_(s.application_cap_microusd)]})]})]}),e.jsxs(h,{children:[e.jsx(v,{children:e.jsx(N,{className:"text-sm",children:"Live compute"})}),e.jsxs(u,{children:[e.jsx("div",{className:"text-2xl font-bold",children:s.live_count}),e.jsxs("p",{className:"text-xs cron-muted",children:[s.termination_uncertain_count," termination uncertain"]})]})]})]}),e.jsxs(h,{children:[e.jsxs(v,{children:[e.jsx(N,{children:"Accounting and policy"}),e.jsxs(k,{children:[s.environment," · cycle ",s.billing_cycle]})]}),e.jsxs(u,{className:"grid md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Environment record"}),e.jsx("br",{}),s.environment," · ",s.provider_mode==="starter_workspace"?"Starter Workspace":"Team isolated"]}),e.jsxs("label",{children:[e.jsx("strong",{children:"Policy profile"}),e.jsxs("select",{"aria-label":"Chat compute policy profile",value:n,onChange:g=>c(g.target.value),className:"block mt-1",children:[e.jsx("option",{value:"staging-current",children:"Staging now"}),e.jsx("option",{value:"staging-production-era",children:"Staging with production"}),e.jsx("option",{value:"production",children:"Production"})]}),e.jsxs("span",{className:"text-xs cron-muted",children:[d[n]," · Workspace $250"]})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Conservative estimate"}),e.jsx("br",{}),_(s.estimated_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider-reported floor"}),e.jsx("br",{}),_(s.provider_floor_microusd)," · ",e.jsx(w,{children:i})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider backstops"}),e.jsx("br",{}),s.environment_cap_microusd===null?"Starter: no Environment cap":`Environment ${_(s.environment_cap_microusd)}`," · Workspace ",_(s.workspace_cap_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Active thresholds"}),e.jsx("br",{}),"Warning ",_(s.warning_microusd)," · trip ",_(s.application_cap_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Policy allocation"}),e.jsx("br",{}),"Starter staging $75/$100 with no Environment cap · future Team staging $15/$20/$25 · production $175/$200/$225 · workspace $250"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Cycle end"}),e.jsx("br",{}),f(s.cycle_end_at)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Last metered"}),e.jsx("br",{}),s.last_metered_at?f(s.last_metered_at):"Unavailable"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider reconciliation"}),e.jsx("br",{}),s.last_reconciled_at?f(s.last_reconciled_at):"Unavailable",s.last_reconciliation_attempt_at?` · attempted ${f(s.last_reconciliation_attempt_at)}`:"",s.next_reconciliation_at?` · next ${f(s.next_reconciliation_at)}`:""]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Burn projection"}),e.jsx("br",{}),s.burn_rate_microusd_per_hour===null?"Not enough data":`${_(s.burn_rate_microusd_per_hour)}/hour${s.projected_cap_hit_at?` · cap ${f(s.projected_cap_hit_at)}`:""}`]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Prior cycle"}),e.jsx("br",{}),s.prior_cycle?`${s.prior_cycle.billing_cycle} · ${_(s.prior_cycle.effective_microusd)}`:"Not enough data"]})]})]}),e.jsxs(h,{children:[e.jsx(v,{children:e.jsx(N,{children:"Live lifecycle"})}),e.jsx(u,{className:"text-sm",children:Object.entries(s.live_states).map(([g,p])=>e.jsxs("span",{className:"mr-4",children:[g,": ",p]},g))})]}),e.jsxs(h,{children:[e.jsx(v,{children:e.jsx(N,{children:"Daily spend"})}),e.jsx(u,{children:s.daily_spend.length?e.jsx("ul",{className:"space-y-1 text-sm",children:s.daily_spend.map(g=>e.jsxs("li",{children:[g.date,": blank ",_(g.blank_pool_microusd)," · assigned ",_(g.assigned_microusd)]},g.date))}):e.jsx("p",{className:"cron-muted",children:"No compute recorded in this cycle."})})]}),e.jsxs(h,{children:[e.jsxs(v,{children:[e.jsx(N,{children:"Recent circuit events"}),e.jsx(k,{children:"Runbook: docs/chat-sandbox-spend-runbook.md"})]}),e.jsx(u,{children:s.events.length?e.jsx("ul",{className:"space-y-2 text-sm",children:s.events.map(g=>e.jsxs("li",{children:[e.jsx(w,{children:g.severity})," ",g.type," · ",f(g.created_at)]},g.id))}):e.jsx("p",{className:"cron-muted",children:"No events in this cycle."})})]})]})},As=({data:s,loading:a,error:r})=>{if(a)return e.jsxs("div",{className:"flex items-center py-8",children:[e.jsx(S,{className:"h-5 w-5 animate-spin mr-3"}),"Loading web-search budget…"]});if(r||!s)return e.jsx(h,{className:"cron-status--broken",children:e.jsx(u,{className:"pt-6",children:"Web-search budget accounting is unavailable."})});const n=Math.min(100,s.call_count/s.hard_limit_calls*100);return e.jsxs(h,{className:s.circuit_state==="tripped"?"cron-status--broken":s.circuit_state==="warning"||s.circuit_state==="cooldown"?"cron-status--degraded":"",children:[e.jsxs(v,{children:[e.jsx(N,{children:"Web search"}),e.jsxs(k,{children:[s.environment," · UTC cycle ",s.billing_cycle," · provider details are admin-only"]})]}),e.jsxs(u,{className:"space-y-4",children:[e.jsxs("div",{className:"grid md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Circuit"}),e.jsx("br",{}),s.circuit_state,s.trip_reason?` · ${s.trip_reason}`:""]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Calls"}),e.jsx("br",{}),s.call_count," / ",s.hard_limit_calls," · ",s.success_count," successful"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Remaining"}),e.jsx("br",{}),s.remaining_calls]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Warning"}),e.jsx("br",{}),s.warning_calls," calls"]})]}),e.jsx("div",{role:"progressbar","aria-label":"Web-search monthly budget used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(n),className:"h-2 rounded bg-muted",children:e.jsx("div",{className:"h-2 rounded bg-primary",style:{width:`${n}%`}})}),e.jsxs("p",{className:"text-xs cron-muted",children:["Cycle ends ",f(s.cycle_end_at)," · provider-reported cost $",(s.provider_cost_microusd/1e6).toFixed(4),s.last_latency_ms!==null?` · last ${s.last_latency_ms} ms / ${s.last_result_count??0} results`:"",s.cooldown_until?` · cooldown until ${f(s.cooldown_until)}`:"",s.last_provider_error_class?` · last provider error ${s.last_provider_error_class}`:""]}),s.events.length>0&&e.jsx("ul",{className:"space-y-1 text-sm",children:s.events.map(c=>e.jsxs("li",{children:[c.type," · ",f(c.created_at),c.error_class?` · ${c.error_class}`:""]},c.id))})]})]})},Es=({data:s})=>s!=null&&s.snapshot_stale?e.jsx(h,{className:"mb-6 cron-status--degraded",role:"status",children:e.jsx(u,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[e.jsx(S,{className:"h-4 w-4 animate-spin"}),e.jsxs("span",{children:["Refreshing status… Current snapshot is ",Math.ceil(s.snapshot_age_seconds)," seconds old."]})]})})}):null,qs=(s,a)=>s!=null&&s.snapshot_stale||s!=null&&s.refreshing?1e3:a?3e4:!1,Zs=()=>{const s=es(),[a,r]=m.useState(!0),[n,c]=m.useState(0),[d,x]=m.useState(""),[o,i]=m.useState(""),[g,p]=m.useState(new Set),b=m.useRef(!1),{user:l}=Ze(),{data:j,isLoading:Y,isFetching:Z,error:R,refetch:qe}=E({queryKey:["cronStatus",l==null?void 0:l.username],queryFn:()=>{const t=b.current;return b.current=!1,xe.getCronStatus(t)},enabled:!!(l!=null&&l.is_admin),refetchInterval:t=>qs(t.state.data,a),retry:!1}),D=E({queryKey:["paperMarkdownJobs",l==null?void 0:l.username],queryFn:()=>xe.getPaperMarkdownJobs(),enabled:!!(l!=null&&l.is_admin),refetchInterval:a?3e4:!1,retry:!1}),I=E({queryKey:["chatSandboxSpend",l==null?void 0:l.username,o],queryFn:()=>le.getSandboxSpend(o||void 0),enabled:!!(l!=null&&l.is_admin),refetchInterval:a?3e4:!1,retry:!1}),U=E({queryKey:["chatWebSearchBudget",l==null?void 0:l.username],queryFn:()=>le.getWebSearchBudget(),enabled:!!(l!=null&&l.is_admin)&&s,refetchInterval:a?3e4:!1,retry:!1}),ee=(R&&typeof R=="object"&&"status"in R?R.status:void 0)===401?"Unauthorized. Sign in with an allowlisted Hugging Face admin account.":R instanceof Error?R.message:void 0,De=t=>{p($=>{const T=new Set($);return T.has(t)?T.delete(t):T.add(t),T})},se=(j==null?void 0:j.jobs.filter(t=>t.dashboard_group==="leaderboard_sync"))??[],ae=(j==null?void 0:j.jobs.filter(t=>t.category!=="manual"&&t.dashboard_group!=="leaderboard_sync"))??[],Ie=ae.filter(t=>t.critical),Je=ae.filter(t=>!t.critical),re=(j==null?void 0:j.manual_operations)??[],J=Je.reduce((t,$)=>(t[$.category]||(t[$.category]=[]),t[$.category].push($),t),{}),Oe=Object.keys(J).sort((t,$)=>{const T=["systemd","hourly","daily","weekly","backfill"];return T.indexOf(t)-T.indexOf($)}),O=t=>e.jsx(_s,{job:t,expanded:g.has(t.job_name),onToggle:()=>De(t.job_name),paperMarkdownJobs:t.job_name==="paper_markdown_backfill"?D.data:void 0,paperMarkdownJobsLoading:t.job_name==="paper_markdown_backfill"?D.isLoading:!1,paperMarkdownJobsError:t.job_name==="paper_markdown_backfill"?D.error:null},t.job_name),He=()=>{c(t=>t+1),b.current=!0,qe(),D.refetch(),I.refetch()};return e.jsx("div",{className:"cron-dashboard","data-shadcn":!0,children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[e.jsx(H,{className:"h-8 w-8 cron-info-text"}),"Admin Dashboard"]}),e.jsx("p",{className:"mt-2 cron-muted",children:"Paper curation queue and operational health for scheduled jobs"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(A,{variant:"outline",size:"sm",onClick:()=>r(!a),className:a?"cron-status--running":"",children:[e.jsx(ie,{className:`h-4 w-4 mr-2 ${a?"animate-spin":""}`}),"Auto-refresh ",a?"ON":"OFF"]}),e.jsxs(A,{variant:"outline",size:"sm",onClick:He,disabled:Z,children:[e.jsx(ie,{className:`h-4 w-4 mr-2 ${Z?"animate-spin":""}`}),"Refresh"]})]})]})}),e.jsx(h,{className:"mb-6",children:e.jsx(u,{className:"pt-6",children:e.jsxs("p",{className:"text-sm cron-muted",children:["Signed in as ",e.jsxs("span",{className:"font-semibold",children:["@",l==null?void 0:l.username]}),". Health checks prefer database freshness over log completion so silent no-work failures surface as degraded or broken."]})})}),e.jsx(Es,{data:j}),e.jsxs(gs,{defaultValue:"critical-jobs",children:[e.jsxs(Le,{className:"grid h-auto w-full grid-cols-2 sm:w-auto sm:grid-cols-5",children:[e.jsx(L,{value:"critical-jobs",children:"Critical Jobs"}),e.jsx(L,{value:"leaderboard-syncs",children:"Leaderboard Syncs"}),e.jsx(L,{value:"codex-paper-jobs",children:"Codex Paper Jobs"}),e.jsx(L,{value:"catalog-audit",children:"Catalog Audit"}),e.jsx(L,{value:"chat-compute",children:"Chat Compute"})]}),e.jsxs(P,{value:"critical-jobs",className:"mt-6",children:[Y&&e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(S,{className:"h-8 w-8 animate-spin cron-info-text"}),e.jsx("span",{className:"ml-3 cron-muted",children:"Loading CRON jobs status..."})]}),R&&e.jsx(h,{className:"cron-status--broken",children:e.jsx(u,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(q,{className:"h-5 w-5"}),e.jsx("p",{children:ee??"Failed to load CRON jobs status. Please try again."})]})})}),j&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6",children:["healthy","degraded","broken","running","stuck","unknown"].map(t=>e.jsxs(h,{children:[e.jsx(v,{className:"pb-2",children:e.jsx(N,{className:"text-sm font-medium cron-muted capitalize",children:t})}),e.jsx(u,{children:e.jsx("div",{className:"text-2xl font-bold",children:j.summary[t]})})]},t))}),j.summary.critical_issues.length>0&&e.jsxs(h,{className:"mb-6 cron-status--broken",children:[e.jsx(v,{children:e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(rs,{className:"h-5 w-5"}),"Critical job issues"]})}),e.jsx(u,{children:e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm",children:j.summary.critical_issues.map(t=>e.jsx("li",{children:t},t))})})]}),e.jsxs(h,{className:"mb-8",children:[e.jsx(v,{children:e.jsx(N,{className:"text-base",children:"What to check next"})}),e.jsxs(u,{children:[e.jsx("p",{className:"text-sm cron-muted",children:j.summary.what_to_check_next}),e.jsxs("p",{className:"mt-2 text-xs cron-muted flex items-center gap-2",children:[e.jsx(ge,{className:"h-4 w-4"}),"Last updated: ",f(j.timestamp)," · Health score:"," ",j.summary.health_score.toFixed(0),"%"]})]})]}),e.jsxs(h,{className:`mb-8 ${j.summary.coverage.coverage_gaps?"cron-status--broken":""}`,children:[e.jsxs(v,{children:[e.jsx(N,{className:"text-base",children:"Coverage"}),e.jsx(k,{children:"Registry and deployed scheduler inventory"})]}),e.jsxs(u,{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Registered"}),e.jsx("div",{className:"text-2xl font-bold",children:j.summary.coverage.registered_scheduled_duties})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Discovered"}),e.jsx("div",{className:"text-2xl font-bold",children:j.summary.coverage.discovered_scheduled_duties})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Monitored"}),e.jsx("div",{className:"text-2xl font-bold",children:j.summary.coverage.monitored_duties})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Gaps"}),e.jsx("div",{className:"text-2xl font-bold",children:j.summary.coverage.coverage_gaps})]})]})]}),e.jsxs(h,{className:"mb-8",children:[e.jsxs(v,{children:[e.jsx(N,{className:"text-xl",children:"Critical jobs"}),e.jsx(k,{children:"Writers whose stale output breaks the live site"})]}),e.jsx(u,{className:"space-y-4",children:Ie.map(O)})]}),e.jsx("div",{className:"space-y-6",children:Oe.map(t=>e.jsxs(h,{children:[e.jsx(v,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(N,{className:"text-xl capitalize flex items-center gap-2",children:[e.jsx(w,{className:he[t]??he.hourly,children:t}),e.jsx("span",{children:"Supporting jobs"})]}),e.jsxs(k,{children:[J[t].length," job",J[t].length!==1?"s":""]})]})}),e.jsx(u,{className:"space-y-4",children:J[t].map(O)})]},t))}),re.length>0&&e.jsxs(h,{className:"mt-6",children:[e.jsxs(v,{children:[e.jsx(N,{className:"text-xl",children:"Manual operations"}),e.jsx(k,{children:"Visible invocation history; excluded from scheduled health and coverage"})]}),e.jsx(u,{className:"space-y-4",children:re.map(O)})]})]})]}),e.jsxs(P,{value:"leaderboard-syncs",className:"mt-6",children:[Y&&e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(S,{className:"h-8 w-8 animate-spin cron-info-text"}),e.jsx("span",{className:"ml-3 cron-muted",children:"Loading leaderboard sync status..."})]}),R&&e.jsx(h,{className:"cron-status--broken",children:e.jsx(u,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(q,{className:"h-5 w-5"}),e.jsx("p",{children:ee??"Failed to load leaderboard sync status. Please try again."})]})})}),j&&e.jsxs(h,{children:[e.jsx(v,{children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(N,{className:"text-xl",children:"Leaderboard syncs"}),e.jsx(k,{children:"Recurring imports from externally maintained benchmark leaderboards"})]}),e.jsxs(w,{children:[se.length," jobs"]})]})}),e.jsx(u,{className:"space-y-4",children:se.map(O)})]})]}),e.jsx(P,{value:"codex-paper-jobs",className:"mt-6",children:e.jsx(Ls,{autoRefresh:a,refreshToken:n})}),e.jsx(P,{value:"catalog-audit",className:"mt-6",children:e.jsx(Ps,{})}),e.jsxs(P,{value:"chat-compute",className:"mt-6",children:[e.jsxs(h,{className:"mb-6",children:[e.jsxs(v,{children:[e.jsx(N,{children:"Environment record"}),e.jsx(k,{children:"Leave blank for live staging, or enter the isolated environment printed by the spend qualification command."})]}),e.jsxs(u,{className:"flex gap-2",children:[e.jsx("input",{"aria-label":"Chat compute environment record",value:d,onChange:t=>x(t.target.value),placeholder:"staging-q-example",className:"flex-1 rounded border px-3 py-2"}),e.jsx(A,{onClick:()=>i(d.trim()),children:"Load"})]})]}),e.jsx(Ms,{data:I.data,loading:I.isLoading,error:I.error}),s&&e.jsx("div",{className:"mt-6",children:e.jsx(As,{data:U.data,loading:U.isLoading,error:U.error})})]})]})]})})};export{Ms as ChatComputePanel,Es as CronSnapshotNotice,As as WebSearchBudgetPanel,qs as cronStatusRefetchInterval,Zs as default}; diff --git a/assets/ExternalSourceEvalBadge-25ezslre.js b/assets/ExternalSourceEvalBadge-25ezslre.js new file mode 100644 index 0000000000000000000000000000000000000000..b9173f2d8ad2ea160947c9d1f053e367b5609327 --- /dev/null +++ b/assets/ExternalSourceEvalBadge-25ezslre.js @@ -0,0 +1 @@ +import{a as l}from"./papers-DHqjKX7p.js";import{a0 as h,j as a,L as u}from"./index-D_-UZEuL.js";import{H as c,a as d,b as p}from"./hover-card-DiJQFgx9.js";import{s as g}from"./safeExternalHref-CkBrsh84.js";class m{constructor(e){this.request=e}list(e={}){const t=new URLSearchParams(Object.entries(e).filter(s=>s[1]!==void 0).map(([s,n])=>[s,String(n)])).toString();return this.request(`/evaluations/${t?`?${t}`:""}`,{cache:"no-store"})}get(e){return this.request(`/evaluations/${e}`)}async byPaper(e){return this.allPages({paper_id:Number(e),ordering:"-benchmark_popularity"})}async byDataset(e,t){return this.allPages({dataset_id:Number(e),best_metric:t,ordering:"best_rank"})}create(e){return this.request("/evaluations/",{method:"POST",body:JSON.stringify(e)})}update(e,t){return this.request(`/evaluations/${e}`,{method:"PUT",body:JSON.stringify(t)})}delete(e){return this.request(`/evaluations/${e}`,{method:"DELETE"})}primeCurationState(e,t=!1){return l.primeEvaluations(e,t)}batch(e,t){return l.mutateEvaluations(e,t,"/evaluations/batch",{method:"POST",body:JSON.stringify({paper_id:e,operations:t})})}async allPages(e){const s=await this.list({...e,page_size:100}),n=[...s.results];let i=s.next_page;for(;i;){const o=await this.list({...e,page:i,page_size:100});n.push(...o.results),i=o.next_page}return n}}const w=new m(h),S=()=>a.jsxs(c,{openDelay:120,closeDelay:120,children:[a.jsx(d,{asChild:!0,children:a.jsx("button",{type:"button",className:"bm-closed-source-tag","aria-label":"Closed-source model",children:"closed"})}),a.jsxs(p,{side:"top",align:"start",className:"w-auto max-w-[260px] p-3 text-sm leading-snug",children:["This is an evaluation of a closed-source model. You can disable viewing these in your"," ",a.jsx(u,{to:"/settings",className:"closed-eval-tooltip-link",children:"settings"}),"."]})]});function x(r){if(!r)return"Evaluation sourced outside this paper";const e=r.toLowerCase();if(e.includes("open-asr-leaderboard"))return"Open ASR Leaderboard";if(e.includes("arcprize.org"))return"ARC Prize Leaderboard";if(e.includes("frontierswe.com"))return"FrontierSWE";if(e.includes("deepswe.datacurve.ai"))return"DeepSWE";try{const t=new URL(r,"https://paperswithcode.co");return t.pathname.startsWith("/paper/")?"Source paper":t.hostname.replace(/^www\./,"")}catch{return r}}const j=({sourceUrl:r})=>{const e=g(r),t=typeof r=="string"&&r.startsWith("/paper/")?r:null,s=x(r);return a.jsxs(c,{openDelay:120,closeDelay:120,children:[a.jsx(d,{asChild:!0,children:a.jsx("button",{type:"button",className:"bm-external-source-tag","aria-label":`Externally sourced evaluation: ${s}`,children:"External"})}),a.jsxs(p,{side:"top",align:"start",className:"w-auto max-w-[280px] p-3 text-sm leading-snug",children:["This score was sourced outside this paper.",t?a.jsxs(a.Fragment,{children:[" ",a.jsx(u,{to:t,target:"_blank",rel:"noopener noreferrer",className:"external-eval-tooltip-link",children:s}),"."]}):e?a.jsxs(a.Fragment,{children:[" ",a.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"external-eval-tooltip-link",children:s}),"."]}):a.jsxs(a.Fragment,{children:[" ",s,"."]})]})]})};export{S as C,j as E,w as e}; diff --git a/assets/ExternalSourceEvalBadge-CXYkyGiT.js b/assets/ExternalSourceEvalBadge-CXYkyGiT.js deleted file mode 100644 index 841f950741bae435ef766e252f53480cf315ccba..0000000000000000000000000000000000000000 --- a/assets/ExternalSourceEvalBadge-CXYkyGiT.js +++ /dev/null @@ -1 +0,0 @@ -import{a as l}from"./papers-DBaPliAp.js";import{U as h,j as a,L as u}from"./index-BrhBTT14.js";import{H as c,a as d,b as p}from"./hover-card-BcKGA4Et.js";import{s as g}from"./safeExternalHref-CkBrsh84.js";class m{constructor(e){this.request=e}list(e={}){const t=new URLSearchParams(Object.entries(e).filter(s=>s[1]!==void 0).map(([s,n])=>[s,String(n)])).toString();return this.request(`/evaluations/${t?`?${t}`:""}`,{cache:"no-store"})}get(e){return this.request(`/evaluations/${e}`)}async byPaper(e){return this.allPages({paper_id:Number(e),ordering:"-benchmark_popularity"})}async byDataset(e,t){return this.allPages({dataset_id:Number(e),best_metric:t,ordering:"best_rank"})}create(e){return this.request("/evaluations/",{method:"POST",body:JSON.stringify(e)})}update(e,t){return this.request(`/evaluations/${e}`,{method:"PUT",body:JSON.stringify(t)})}delete(e){return this.request(`/evaluations/${e}`,{method:"DELETE"})}primeCurationState(e,t=!1){return l.primeEvaluations(e,t)}batch(e,t){return l.mutateEvaluations(e,t,"/evaluations/batch",{method:"POST",body:JSON.stringify({paper_id:e,operations:t})})}async allPages(e){const s=await this.list({...e,page_size:100}),n=[...s.results];let i=s.next_page;for(;i;){const o=await this.list({...e,page:i,page_size:100});n.push(...o.results),i=o.next_page}return n}}const w=new m(h),S=()=>a.jsxs(c,{openDelay:120,closeDelay:120,children:[a.jsx(d,{asChild:!0,children:a.jsx("button",{type:"button",className:"bm-closed-source-tag","aria-label":"Closed-source model",children:"closed"})}),a.jsxs(p,{side:"top",align:"start",className:"w-auto max-w-[260px] p-3 text-sm leading-snug",children:["This is an evaluation of a closed-source model. You can disable viewing these in your"," ",a.jsx(u,{to:"/settings",className:"closed-eval-tooltip-link",children:"settings"}),"."]})]});function x(r){if(!r)return"Evaluation sourced outside this paper";const e=r.toLowerCase();if(e.includes("open-asr-leaderboard"))return"Open ASR Leaderboard";if(e.includes("arcprize.org"))return"ARC Prize Leaderboard";if(e.includes("frontierswe.com"))return"FrontierSWE";if(e.includes("deepswe.datacurve.ai"))return"DeepSWE";try{const t=new URL(r,"https://paperswithcode.co");return t.pathname.startsWith("/paper/")?"Source paper":t.hostname.replace(/^www\./,"")}catch{return r}}const j=({sourceUrl:r})=>{const e=g(r),t=typeof r=="string"&&r.startsWith("/paper/")?r:null,s=x(r);return a.jsxs(c,{openDelay:120,closeDelay:120,children:[a.jsx(d,{asChild:!0,children:a.jsx("button",{type:"button",className:"bm-external-source-tag","aria-label":`Externally sourced evaluation: ${s}`,children:"External"})}),a.jsxs(p,{side:"top",align:"start",className:"w-auto max-w-[280px] p-3 text-sm leading-snug",children:["This score was sourced outside this paper.",t?a.jsxs(a.Fragment,{children:[" ",a.jsx(u,{to:t,target:"_blank",rel:"noopener noreferrer",className:"external-eval-tooltip-link",children:s}),"."]}):e?a.jsxs(a.Fragment,{children:[" ",a.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"external-eval-tooltip-link",children:s}),"."]}):a.jsxs(a.Fragment,{children:[" ",s,"."]})]})]})};export{S as C,j as E,w as e}; diff --git a/assets/FeedView-L4wL0Zxa.js b/assets/FeedView-CIK3mTNn.js similarity index 91% rename from assets/FeedView-L4wL0Zxa.js rename to assets/FeedView-CIK3mTNn.js index c667330183dc63582d5de717597972120e680a8e..6c772f24163b2eea6df605f3ca6d7abdc34347b4 100644 --- a/assets/FeedView-L4wL0Zxa.js +++ b/assets/FeedView-CIK3mTNn.js @@ -1 +1 @@ -import{u as U,r as d,i as R,j as e,a as B,L as M,b as K}from"./index-BrhBTT14.js";import{P as W}from"./components-74u_bIKK.js";import{u as z,P as G}from"./useIntersectionObserver-Lj6hnXj6.js";import{D as Q,S as V,P as X,u as Y,a as J,M as Z,R as ee,W as se,A as te,b as ae,q as re,c as ie}from"./chatSessions-Dx6Tu-Jq.js";import{c as ne}from"./chat-Ck3hlrgT.js";import{c as I}from"./catalog-CkpmYxEk.js";import{S as w}from"./chatPrompts-CDY3UGU1.js";import{t as oe,d as H}from"./transform-Duf4Shfn.js";import{u as le}from"./usePapers-C1lfz0oo.js";import{P as ce}from"./usePeriodFilter-By9tdCWv.js";import{S as N}from"./skeleton-DHdzoBmM.js";import{A as de,a as me}from"./alert-c1n3ZtEC.js";import{u as D}from"./useQuery-GhY2LXSI.js";import"./LatexTitle-BJSVMlZ1.js";import"./katex.min-BSBacQyE.js";import"./papers-DBaPliAp.js";import"./safeExternalHref-CkBrsh84.js";import"./chevron-down-CKySK_lE.js";import"./useInfiniteQuery-bETtM5yS.js";const he=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]],pe={Today:"today","This Week":"week","This Month":"month","All Time":"all_time"},ue={today:"Today",week:"This Week",month:"This Month",all_time:"All Time"},O=45,fe=1800,ge=25,xe=350,be=i=>{const[h,o]=d.useState(w[0].slice(0,1));return d.useEffect(()=>{var v,_;if(!i)return;if((_=(v=window.matchMedia)==null?void 0:v.call(window,"(prefers-reduced-motion: reduce)"))!=null&&_.matches){o(w[0]);return}let u=0,n=1,f=!1,m;o(w[0].slice(0,n));const l=()=>{const g=w[u];if(!f){if(n+=1,o(g.slice(0,n)),n===g.length){f=!0,m=window.setTimeout(l,fe);return}m=window.setTimeout(l,O);return}if(n-=1,o(g.slice(0,n)),n===0){f=!1,u=(u+1)%w.length,m=window.setTimeout(l,xe);return}m=window.setTimeout(l,ge)};return m=window.setTimeout(l,O),()=>window.clearTimeout(m)},[i]),h},je=i=>i==="trending"||i==="date_published"||i==="citation_count"?i:"trending",ve=i=>i==="today"||i==="week"||i==="month"||i==="all_time"?i:"all_time",_e=()=>{var A,s,a;const i=U(),h=K()?V:X,[o,u]=d.useState({text:"",paperMentions:[]}),n=o.text,[f,m]=d.useState(0),[l,v]=d.useState(Q),_=(A=h.find(t=>t.id===l))==null?void 0:A.provider,[g,E]=d.useState(!1),[x,c]=d.useState("low"),[b,C]=d.useState(!1),k=be(!n),T=d.useRef(null),L=D({queryKey:["chatAvailability"],queryFn:()=>ne.getAvailability(),retry:!1,enabled:R()}),P=!!((s=L.data)!=null&&s.web_search_available),j=R()&&((a=L.data)==null?void 0:a.paper_mentions_enabled)!==!1,r=Y({draft:o,onChange:u,enabled:j,textareaRef:T});d.useLayoutEffect(()=>{const t=T.current;if(!t)return;const p=()=>{if(t.style.height="auto",n){t.style.height=`${Math.min(t.scrollHeight,160)}px`;return}const y=t.placeholder,F=w.reduce((q,$)=>(t.placeholder=$,Math.max(q,t.scrollHeight)),0);t.placeholder=y,t.style.height=`${Math.min(F,160)}px`};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[n]);const S=async(t=o)=>{if(!(!t.text.trim()||b)){C(!0),re(t,l,{webSearchEnabled:P&&g,reasoningEffort:x});try{const y=await ie(l,x);i(`/chat/${y.id}`)}catch{i("/chat")}}};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ask-home-new",children:"Hint: type @ to bring papers into context"}),e.jsxs("div",{className:"ask-home",children:[e.jsxs("div",{className:"ask-home-textarea-wrap",children:[e.jsx(J,{text:o.text,mentions:o.paperMentions,scrollTop:f,variant:"home"}),e.jsx("textarea",{ref:T,rows:1,value:n,placeholder:k,"aria-label":"Ask the assistant",disabled:b,onChange:t=>r.updateText(t.target.value,t.target.selectionStart),onSelect:t=>r.refresh(t.currentTarget.selectionStart),onClick:t=>r.refresh(t.currentTarget.selectionStart),onScroll:t=>m(t.currentTarget.scrollTop),onBlur:t=>{var p,y;(y=(p=t.relatedTarget)==null?void 0:p.closest)!=null&&y.call(p,".chat-paper-picker")||window.setTimeout(r.close,0)},onKeyDown:t=>{r.keyDown(t)||t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),S())},role:j?"combobox":void 0,"aria-expanded":j?r.open:void 0,"aria-controls":r.open?r.pickerId:void 0,"aria-activedescendant":r.open&&r.results.length?`${r.optionIdPrefix}-${r.activeIndex}`:void 0,"aria-autocomplete":j?"list":void 0,"aria-describedby":r.message?"ask-home-paper-mention-message":void 0})]}),r.message&&e.jsx("div",{id:"ask-home-paper-mention-message",className:"chat-paper-mention-message",role:"alert",children:r.message}),e.jsxs("div",{className:"ask-home-foot",children:[e.jsxs("div",{className:"ask-home-provider-tools",children:[e.jsx(Z,{models:h,selectedModel:l,onModelChange:v}),e.jsx(ee,{value:x,onChange:c,disabled:b}),P&&e.jsx(se,{enabled:g,onChange:E,disabled:b}),_!=="openrouter"&&e.jsxs("span",{className:"ask-home-hint",children:["Via 🤗"," ",e.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"})]})]}),e.jsx("button",{type:"button",className:`chat-send${n.trim()?" chat-send-on":""}`,onClick:()=>void S(),disabled:!n.trim()||b,"aria-label":"Ask the assistant",children:e.jsx(te,{})})]}),e.jsx(ae,{open:r.open,query:r.query,results:r.results,activeIndex:r.activeIndex,loading:r.loading,error:r.error,onSelect:r.select,id:r.pickerId,optionIdPrefix:r.optionIdPrefix})]})]})},$e=()=>{var P,j,r,S,A;const[i,h]=B(),o=je(i.get("order_by")),u=ve(i.get("time")),n=i.get("has_code")==="true",f=i.get("has_hf_artifacts")==="true",m=ue[u],l=s=>{const a=new URLSearchParams(i);a.set("order_by",s),h(a)},v=s=>{const a=new URLSearchParams(i);a.set("time",pe[s]),h(a)},_=s=>{const a=new URLSearchParams(i);s?a.set("has_code","true"):a.delete("has_code"),h(a)},g=s=>{const a=new URLSearchParams(i);s?a.set("has_hf_artifacts","true"):a.delete("has_hf_artifacts"),h(a)},E=D({queryKey:["top-tasks-sidebar"],queryFn:()=>I.topTasks(8),staleTime:10*60*1e3}),x=D({queryKey:["trending-tasks-sidebar"],queryFn:()=>I.trendingTasks({limit:8,level:0}),staleTime:10*60*1e3}),c=le({page_size:30,order_by:o,order_dir:"desc",time:u,include_resources:!0,has_code:n,has_hf_artifacts:f}),b=d.useMemo(()=>{var a;return(((a=c.data)==null?void 0:a.pages.flatMap(t=>t.results))||[]).map(oe)},[c.data]),{targetRef:C,isIntersecting:k}=z({rootMargin:"400px"});d.useEffect(()=>{k&&c.hasNextPage&&!c.isFetchingNextPage&&c.fetchNextPage()},[k,c.hasNextPage,c.isFetchingNextPage]);const T=c.isLoading,L=c.error;return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Trending ",e.jsx("em",{children:"Research"})]}),e.jsx("div",{className:"feed-subtitle",children:"Curated daily from arXiv and Hugging Face"})]})}),e.jsxs("div",{className:"layout-with-sidebar",children:[e.jsxs("aside",{className:"sidebar",children:[e.jsxs("div",{className:"sidebar-section",children:[e.jsx("div",{className:"sidebar-label",children:"Top Domains"}),E.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((s,a)=>e.jsx(N,{className:"h-5 w-full"},a))}),(P=E.data)==null?void 0:P.map(s=>e.jsxs(M,{to:`/tasks/${s.slug}`,className:"sidebar-link",children:[H(s.name,s.slug),s.paper_count!=null&&e.jsx("span",{className:"count",children:s.paper_count})]},s.id)),e.jsx(M,{to:"/tasks",className:"sidebar-link",style:{marginTop:8,fontStyle:"italic"},children:"all domains →"})]}),e.jsxs("div",{className:"sidebar-section",children:[e.jsx("div",{className:"sidebar-label",children:"Trending Domains"}),x.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((s,a)=>e.jsx(N,{className:"h-5 w-full"},a))}),((r=(j=x.data)==null?void 0:j.results)==null?void 0:r.length)===0&&!x.isLoading&&e.jsx("div",{style:{fontSize:12,color:"var(--ink-faint)"},children:"No domains gaining momentum right now."}),(A=(S=x.data)==null?void 0:S.results)==null?void 0:A.map(s=>e.jsxs(M,{to:`/tasks/${s.slug}`,className:"sidebar-link",children:[H(s.name,s.slug),e.jsxs("span",{className:"count",children:[s.share_lift.toFixed(1),"x"]})]},s.id))]})]}),e.jsxs("div",{children:[R()&&e.jsx(_e,{}),e.jsxs("div",{className:"sort-bar home-feed-sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:he.map(([s,a])=>e.jsx("button",{className:`sort-btn ${o===s?"active":""}`,onClick:()=>l(s),children:a},s))}),e.jsx(G,{hasCode:n,hasHfArtifacts:f,onHasCodeChange:_,onHasHfArtifactsChange:g})]}),e.jsx("div",{className:"sort-options sort-options-time",children:ce.map(s=>e.jsx("button",{className:`sort-btn sort-btn-time ${m===s?"active":""}`,onClick:()=>v(s),children:s},s))})]}),L&&e.jsx(de,{variant:"destructive",className:"mb-4",children:e.jsx(me,{children:"Failed to load papers. Please try again."})}),T?e.jsx("div",{className:"paper-list",children:Array.from({length:6}).map((s,a)=>e.jsxs("div",{className:"paper-card",children:[e.jsx("div",{className:"paper-thumb-wrap",children:e.jsx(N,{className:"paper-thumb-skeleton"})}),e.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[e.jsx(N,{className:"h-6 w-3/4"}),e.jsx(N,{className:"h-4 w-1/2"}),e.jsx(N,{className:"h-12 w-full"})]})]},a))}):b.length===0?e.jsx("div",{className:"no-results",children:"No papers in this window."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:b.map((s,a)=>e.jsx(W,{paper:s,rank:a+1},s.id))}),e.jsx("div",{ref:C,style:{height:1}}),c.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]})]})]})]})};export{_e as AskAssistant,$e as default}; +import{u as U,r as d,i as R,j as e,a as B,L as M,b as K}from"./index-D_-UZEuL.js";import{P as W}from"./components-CmC5jqhM.js";import{u as z,P as G}from"./useIntersectionObserver-Cq9n7uOQ.js";import{D as Q,S as V,P as X,u as Y,a as J,M as Z,R as ee,W as se,A as te,b as ae,q as re,c as ie}from"./chatSessions-CPPX7pkh.js";import{c as ne}from"./chat-7zW8PrrA.js";import{c as I}from"./catalog-CjU2vAfw.js";import{S as w}from"./chatPrompts-CDY3UGU1.js";import{t as oe,d as H}from"./transform-CUuA-koJ.js";import{u as le}from"./usePapers-BCHtBW8G.js";import{P as ce}from"./usePeriodFilter-fHKAAcyd.js";import{S as N}from"./skeleton-CCZ1iXls.js";import{A as de,a as me}from"./alert-B2j1kc2o.js";import{u as D}from"./useQuery-BZo4MZ3s.js";import"./LatexTitle-B7GPgo8C.js";import"./katex.min-BSBacQyE.js";import"./papers-DHqjKX7p.js";import"./safeExternalHref-CkBrsh84.js";import"./chevron-down-DI19XsBw.js";import"./useInfiniteQuery-CFUEkcEs.js";const he=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]],pe={Today:"today","This Week":"week","This Month":"month","All Time":"all_time"},ue={today:"Today",week:"This Week",month:"This Month",all_time:"All Time"},O=45,fe=1800,ge=25,xe=350,be=i=>{const[h,o]=d.useState(w[0].slice(0,1));return d.useEffect(()=>{var v,_;if(!i)return;if((_=(v=window.matchMedia)==null?void 0:v.call(window,"(prefers-reduced-motion: reduce)"))!=null&&_.matches){o(w[0]);return}let u=0,n=1,f=!1,m;o(w[0].slice(0,n));const l=()=>{const g=w[u];if(!f){if(n+=1,o(g.slice(0,n)),n===g.length){f=!0,m=window.setTimeout(l,fe);return}m=window.setTimeout(l,O);return}if(n-=1,o(g.slice(0,n)),n===0){f=!1,u=(u+1)%w.length,m=window.setTimeout(l,xe);return}m=window.setTimeout(l,ge)};return m=window.setTimeout(l,O),()=>window.clearTimeout(m)},[i]),h},je=i=>i==="trending"||i==="date_published"||i==="citation_count"?i:"trending",ve=i=>i==="today"||i==="week"||i==="month"||i==="all_time"?i:"all_time",_e=()=>{var A,s,a;const i=U(),h=K()?V:X,[o,u]=d.useState({text:"",paperMentions:[]}),n=o.text,[f,m]=d.useState(0),[l,v]=d.useState(Q),_=(A=h.find(t=>t.id===l))==null?void 0:A.provider,[g,E]=d.useState(!1),[x,c]=d.useState("low"),[b,C]=d.useState(!1),k=be(!n),T=d.useRef(null),L=D({queryKey:["chatAvailability"],queryFn:()=>ne.getAvailability(),retry:!1,enabled:R()}),P=!!((s=L.data)!=null&&s.web_search_available),j=R()&&((a=L.data)==null?void 0:a.paper_mentions_enabled)!==!1,r=Y({draft:o,onChange:u,enabled:j,textareaRef:T});d.useLayoutEffect(()=>{const t=T.current;if(!t)return;const p=()=>{if(t.style.height="auto",n){t.style.height=`${Math.min(t.scrollHeight,160)}px`;return}const y=t.placeholder,F=w.reduce((q,$)=>(t.placeholder=$,Math.max(q,t.scrollHeight)),0);t.placeholder=y,t.style.height=`${Math.min(F,160)}px`};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[n]);const S=async(t=o)=>{if(!(!t.text.trim()||b)){C(!0),re(t,l,{webSearchEnabled:P&&g,reasoningEffort:x});try{const y=await ie(l,x);i(`/chat/${y.id}`)}catch{i("/chat")}}};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ask-home-new",children:"Hint: type @ to bring papers into context"}),e.jsxs("div",{className:"ask-home",children:[e.jsxs("div",{className:"ask-home-textarea-wrap",children:[e.jsx(J,{text:o.text,mentions:o.paperMentions,scrollTop:f,variant:"home"}),e.jsx("textarea",{ref:T,rows:1,value:n,placeholder:k,"aria-label":"Ask the assistant",disabled:b,onChange:t=>r.updateText(t.target.value,t.target.selectionStart),onSelect:t=>r.refresh(t.currentTarget.selectionStart),onClick:t=>r.refresh(t.currentTarget.selectionStart),onScroll:t=>m(t.currentTarget.scrollTop),onBlur:t=>{var p,y;(y=(p=t.relatedTarget)==null?void 0:p.closest)!=null&&y.call(p,".chat-paper-picker")||window.setTimeout(r.close,0)},onKeyDown:t=>{r.keyDown(t)||t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),S())},role:j?"combobox":void 0,"aria-expanded":j?r.open:void 0,"aria-controls":r.open?r.pickerId:void 0,"aria-activedescendant":r.open&&r.results.length?`${r.optionIdPrefix}-${r.activeIndex}`:void 0,"aria-autocomplete":j?"list":void 0,"aria-describedby":r.message?"ask-home-paper-mention-message":void 0})]}),r.message&&e.jsx("div",{id:"ask-home-paper-mention-message",className:"chat-paper-mention-message",role:"alert",children:r.message}),e.jsxs("div",{className:"ask-home-foot",children:[e.jsxs("div",{className:"ask-home-provider-tools",children:[e.jsx(Z,{models:h,selectedModel:l,onModelChange:v}),e.jsx(ee,{value:x,onChange:c,disabled:b}),P&&e.jsx(se,{enabled:g,onChange:E,disabled:b}),_!=="openrouter"&&e.jsxs("span",{className:"ask-home-hint",children:["Via 🤗"," ",e.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"})]})]}),e.jsx("button",{type:"button",className:`chat-send${n.trim()?" chat-send-on":""}`,onClick:()=>void S(),disabled:!n.trim()||b,"aria-label":"Ask the assistant",children:e.jsx(te,{})})]}),e.jsx(ae,{open:r.open,query:r.query,results:r.results,activeIndex:r.activeIndex,loading:r.loading,error:r.error,onSelect:r.select,id:r.pickerId,optionIdPrefix:r.optionIdPrefix})]})]})},$e=()=>{var P,j,r,S,A;const[i,h]=B(),o=je(i.get("order_by")),u=ve(i.get("time")),n=i.get("has_code")==="true",f=i.get("has_hf_artifacts")==="true",m=ue[u],l=s=>{const a=new URLSearchParams(i);a.set("order_by",s),h(a)},v=s=>{const a=new URLSearchParams(i);a.set("time",pe[s]),h(a)},_=s=>{const a=new URLSearchParams(i);s?a.set("has_code","true"):a.delete("has_code"),h(a)},g=s=>{const a=new URLSearchParams(i);s?a.set("has_hf_artifacts","true"):a.delete("has_hf_artifacts"),h(a)},E=D({queryKey:["top-tasks-sidebar"],queryFn:()=>I.topTasks(8),staleTime:10*60*1e3}),x=D({queryKey:["trending-tasks-sidebar"],queryFn:()=>I.trendingTasks({limit:8,level:0}),staleTime:10*60*1e3}),c=le({page_size:30,order_by:o,order_dir:"desc",time:u,include_resources:!0,has_code:n,has_hf_artifacts:f}),b=d.useMemo(()=>{var a;return(((a=c.data)==null?void 0:a.pages.flatMap(t=>t.results))||[]).map(oe)},[c.data]),{targetRef:C,isIntersecting:k}=z({rootMargin:"400px"});d.useEffect(()=>{k&&c.hasNextPage&&!c.isFetchingNextPage&&c.fetchNextPage()},[k,c.hasNextPage,c.isFetchingNextPage]);const T=c.isLoading,L=c.error;return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Trending ",e.jsx("em",{children:"Research"})]}),e.jsx("div",{className:"feed-subtitle",children:"Curated daily from arXiv and Hugging Face"})]})}),e.jsxs("div",{className:"layout-with-sidebar",children:[e.jsxs("aside",{className:"sidebar",children:[e.jsxs("div",{className:"sidebar-section",children:[e.jsx("div",{className:"sidebar-label",children:"Top Domains"}),E.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((s,a)=>e.jsx(N,{className:"h-5 w-full"},a))}),(P=E.data)==null?void 0:P.map(s=>e.jsxs(M,{to:`/tasks/${s.slug}`,className:"sidebar-link",children:[H(s.name,s.slug),s.paper_count!=null&&e.jsx("span",{className:"count",children:s.paper_count})]},s.id)),e.jsx(M,{to:"/tasks",className:"sidebar-link",style:{marginTop:8,fontStyle:"italic"},children:"all domains →"})]}),e.jsxs("div",{className:"sidebar-section",children:[e.jsx("div",{className:"sidebar-label",children:"Trending Domains"}),x.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((s,a)=>e.jsx(N,{className:"h-5 w-full"},a))}),((r=(j=x.data)==null?void 0:j.results)==null?void 0:r.length)===0&&!x.isLoading&&e.jsx("div",{style:{fontSize:12,color:"var(--ink-faint)"},children:"No domains gaining momentum right now."}),(A=(S=x.data)==null?void 0:S.results)==null?void 0:A.map(s=>e.jsxs(M,{to:`/tasks/${s.slug}`,className:"sidebar-link",children:[H(s.name,s.slug),e.jsxs("span",{className:"count",children:[s.share_lift.toFixed(1),"x"]})]},s.id))]})]}),e.jsxs("div",{children:[R()&&e.jsx(_e,{}),e.jsxs("div",{className:"sort-bar home-feed-sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:he.map(([s,a])=>e.jsx("button",{className:`sort-btn ${o===s?"active":""}`,onClick:()=>l(s),children:a},s))}),e.jsx(G,{hasCode:n,hasHfArtifacts:f,onHasCodeChange:_,onHasHfArtifactsChange:g})]}),e.jsx("div",{className:"sort-options sort-options-time",children:ce.map(s=>e.jsx("button",{className:`sort-btn sort-btn-time ${m===s?"active":""}`,onClick:()=>v(s),children:s},s))})]}),L&&e.jsx(de,{variant:"destructive",className:"mb-4",children:e.jsx(me,{children:"Failed to load papers. Please try again."})}),T?e.jsx("div",{className:"paper-list",children:Array.from({length:6}).map((s,a)=>e.jsxs("div",{className:"paper-card",children:[e.jsx("div",{className:"paper-thumb-wrap",children:e.jsx(N,{className:"paper-thumb-skeleton"})}),e.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[e.jsx(N,{className:"h-6 w-3/4"}),e.jsx(N,{className:"h-4 w-1/2"}),e.jsx(N,{className:"h-12 w-full"})]})]},a))}):b.length===0?e.jsx("div",{className:"no-results",children:"No papers in this window."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:b.map((s,a)=>e.jsx(W,{paper:s,rank:a+1},s.id))}),e.jsx("div",{ref:C,style:{height:1}}),c.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]})]})]})]})};export{_e as AskAssistant,$e as default}; diff --git a/assets/FrameworksIndexView-I7yKuqQY.js b/assets/FrameworksIndexView-ByziIlRP.js similarity index 92% rename from assets/FrameworksIndexView-I7yKuqQY.js rename to assets/FrameworksIndexView-ByziIlRP.js index 7f9c3f0e7a45eeb05e128da4e6326ebefa6c51df..2a3a7870df309c4394637bc51c81add605860b98 100644 --- a/assets/FrameworksIndexView-I7yKuqQY.js +++ b/assets/FrameworksIndexView-ByziIlRP.js @@ -1 +1 @@ -import{u as d,j as e,L as o,R as m}from"./index-BrhBTT14.js";import{u as p}from"./useQuery-GhY2LXSI.js";import{I as h}from"./components-74u_bIKK.js";import{c as u}from"./catalog-CkpmYxEk.js";import{c as g,h as f}from"./transform-Duf4Shfn.js";import"./LatexTitle-BJSVMlZ1.js";import"./katex.min-BSBacQyE.js";import"./papers-DBaPliAp.js";import"./safeExternalHref-CkBrsh84.js";const x={gpu:"GPU",cpu:"CPU",apple:"Apple silicon"},j={display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},k={fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},_={fontFamily:"var(--serif)",fontStyle:"italic",fontSize:13,color:"var(--ink-soft)"},v={fontFamily:"var(--mono)",fontSize:13,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--ink)",marginBottom:6},b=({platform:r})=>{const n=g(f(r));return e.jsx("span",{className:"framework-platform-chip",style:{background:n.bg,color:n.text},children:x[r]})},w=({framework:r})=>{const n=d(),l=`/papers?framework=${encodeURIComponent(r.slug)}`;return e.jsxs("article",{id:`framework-${r.slug}`,className:"framework-card framework-card-clickable",role:"link",tabIndex:0,"aria-label":`View papers implemented by ${r.name}`,onClick:a=>{a.target.closest("a, button")||n(l)},onKeyDown:a=>{a.target===a.currentTarget&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n(l))},children:[e.jsxs("div",{className:"framework-card-head",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"framework-card-name",children:r.name}),r.organization_name&&e.jsx("div",{className:"framework-card-org",children:r.organization_name})]}),r.platforms&&r.platforms.length>0&&e.jsx("div",{className:"framework-platform-row",children:r.platforms.map(a=>e.jsx(b,{platform:a},a))})]}),e.jsx("p",{className:"framework-card-desc",children:r.description}),r.when_to_use&&e.jsxs("div",{className:"framework-card-when",children:[e.jsx("span",{className:"framework-card-when-label",children:"When to use"}),r.when_to_use]}),(r.github_url||r.docs_url||r.introducing_paper_arxiv_id)&&e.jsxs("div",{className:"framework-card-links",children:[r.introducing_paper_arxiv_id&&e.jsx(o,{to:`/paper/${r.introducing_paper_arxiv_id}`,className:"framework-link",children:"Introducing paper"}),r.github_url&&r.paper_count>0&&e.jsxs(o,{to:l,className:"framework-link",children:["Implements ",r.paper_count," ",r.paper_count===1?"paper":"papers"]}),r.github_url&&r.paper_count===0&&e.jsx("span",{className:"framework-link framework-link-disabled","aria-disabled":"true",children:"Implements 0 papers"}),r.github_url&&e.jsxs("a",{href:r.github_url,target:"_blank",rel:"noopener noreferrer",className:"framework-link",children:[e.jsx(h,{name:"github",size:13}),"GitHub"]}),r.docs_url&&r.docs_url!==r.github_url&&e.jsx("a",{href:r.docs_url,target:"_blank",rel:"noopener noreferrer",className:"framework-link",children:"Docs"})]})]})},E=()=>{var a;const r=p({queryKey:["framework-catalog"],queryFn:()=>u.frameworkCatalog()}),n=((a=r.data)==null?void 0:a.domains)??[],l=n.reduce((i,s)=>i+s.categories.reduce((t,c)=>t+c.frameworks.length,0),0);return m.useEffect(()=>{var s;const i=window.location.hash.slice(1);i&&((s=document.getElementById(i))==null||s.scrollIntoView())},[r.data]),e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["AI ",e.jsx("em",{children:"Frameworks"})]}),e.jsx("div",{className:"feed-subtitle",children:"Curated libraries and tools to run, serve, and train models — pick the right stack for your hardware and workload."})]})}),r.isLoading&&e.jsx("div",{className:"empty",children:"Loading frameworks…"}),r.isError&&e.jsx("div",{className:"empty",children:"Could not load frameworks."}),n.map(i=>e.jsxs("section",{style:{marginBottom:56},children:[e.jsxs("div",{style:j,children:[e.jsxs("div",{children:[e.jsx("h2",{style:k,children:i.name}),e.jsx("div",{style:_,children:i.description})]}),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[i.categories.length," ",i.categories.length===1?"category":"categories"," ·"," ",i.categories.reduce((s,t)=>s+t.frameworks.length,0)," frameworks"]})]}),i.categories.map(s=>e.jsxs("div",{className:"framework-category",children:[e.jsxs("div",{className:"framework-category-head",children:[e.jsxs("div",{children:[e.jsx("h3",{style:v,children:s.name}),s.description&&e.jsx("p",{className:"framework-category-blurb",children:s.description}),s.guide_url&&e.jsxs("a",{href:s.guide_url,target:"_blank",rel:"noopener noreferrer",className:"framework-guide-link",children:[s.guide_label??"Read guide"," →"]})]}),e.jsxs("div",{className:"framework-category-meta",children:[s.frameworks.length," ",s.frameworks.length===1?"framework":"frameworks"]})]}),e.jsx("div",{className:"framework-grid",children:s.frameworks.map(t=>e.jsx(w,{framework:t},t.slug))})]},s.slug))]},i.slug)),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",marginTop:8},children:[l," frameworks across ",n.length," ",n.length===1?"domain":"domains",". More areas coming soon."]})]})};export{w as FrameworkCard,E as default}; +import{u as d,j as e,L as o,z as m}from"./index-D_-UZEuL.js";import{u as p}from"./useQuery-BZo4MZ3s.js";import{I as h}from"./components-CmC5jqhM.js";import{c as u}from"./catalog-CjU2vAfw.js";import{c as g,h as f}from"./transform-CUuA-koJ.js";import"./LatexTitle-B7GPgo8C.js";import"./katex.min-BSBacQyE.js";import"./papers-DHqjKX7p.js";import"./safeExternalHref-CkBrsh84.js";const x={gpu:"GPU",cpu:"CPU",apple:"Apple silicon"},j={display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},k={fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},_={fontFamily:"var(--serif)",fontStyle:"italic",fontSize:13,color:"var(--ink-soft)"},v={fontFamily:"var(--mono)",fontSize:13,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--ink)",marginBottom:6},b=({platform:r})=>{const n=g(f(r));return e.jsx("span",{className:"framework-platform-chip",style:{background:n.bg,color:n.text},children:x[r]})},w=({framework:r})=>{const n=d(),l=`/papers?framework=${encodeURIComponent(r.slug)}`;return e.jsxs("article",{id:`framework-${r.slug}`,className:"framework-card framework-card-clickable",role:"link",tabIndex:0,"aria-label":`View papers implemented by ${r.name}`,onClick:a=>{a.target.closest("a, button")||n(l)},onKeyDown:a=>{a.target===a.currentTarget&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n(l))},children:[e.jsxs("div",{className:"framework-card-head",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"framework-card-name",children:r.name}),r.organization_name&&e.jsx("div",{className:"framework-card-org",children:r.organization_name})]}),r.platforms&&r.platforms.length>0&&e.jsx("div",{className:"framework-platform-row",children:r.platforms.map(a=>e.jsx(b,{platform:a},a))})]}),e.jsx("p",{className:"framework-card-desc",children:r.description}),r.when_to_use&&e.jsxs("div",{className:"framework-card-when",children:[e.jsx("span",{className:"framework-card-when-label",children:"When to use"}),r.when_to_use]}),(r.github_url||r.docs_url||r.introducing_paper_arxiv_id)&&e.jsxs("div",{className:"framework-card-links",children:[r.introducing_paper_arxiv_id&&e.jsx(o,{to:`/paper/${r.introducing_paper_arxiv_id}`,className:"framework-link",children:"Introducing paper"}),r.github_url&&r.paper_count>0&&e.jsxs(o,{to:l,className:"framework-link",children:["Implements ",r.paper_count," ",r.paper_count===1?"paper":"papers"]}),r.github_url&&r.paper_count===0&&e.jsx("span",{className:"framework-link framework-link-disabled","aria-disabled":"true",children:"Implements 0 papers"}),r.github_url&&e.jsxs("a",{href:r.github_url,target:"_blank",rel:"noopener noreferrer",className:"framework-link",children:[e.jsx(h,{name:"github",size:13}),"GitHub"]}),r.docs_url&&r.docs_url!==r.github_url&&e.jsx("a",{href:r.docs_url,target:"_blank",rel:"noopener noreferrer",className:"framework-link",children:"Docs"})]})]})},E=()=>{var a;const r=p({queryKey:["framework-catalog"],queryFn:()=>u.frameworkCatalog()}),n=((a=r.data)==null?void 0:a.domains)??[],l=n.reduce((i,s)=>i+s.categories.reduce((t,c)=>t+c.frameworks.length,0),0);return m.useEffect(()=>{var s;const i=window.location.hash.slice(1);i&&((s=document.getElementById(i))==null||s.scrollIntoView())},[r.data]),e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["AI ",e.jsx("em",{children:"Frameworks"})]}),e.jsx("div",{className:"feed-subtitle",children:"Curated libraries and tools to run, serve, and train models — pick the right stack for your hardware and workload."})]})}),r.isLoading&&e.jsx("div",{className:"empty",children:"Loading frameworks…"}),r.isError&&e.jsx("div",{className:"empty",children:"Could not load frameworks."}),n.map(i=>e.jsxs("section",{style:{marginBottom:56},children:[e.jsxs("div",{style:j,children:[e.jsxs("div",{children:[e.jsx("h2",{style:k,children:i.name}),e.jsx("div",{style:_,children:i.description})]}),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[i.categories.length," ",i.categories.length===1?"category":"categories"," ·"," ",i.categories.reduce((s,t)=>s+t.frameworks.length,0)," frameworks"]})]}),i.categories.map(s=>e.jsxs("div",{className:"framework-category",children:[e.jsxs("div",{className:"framework-category-head",children:[e.jsxs("div",{children:[e.jsx("h3",{style:v,children:s.name}),s.description&&e.jsx("p",{className:"framework-category-blurb",children:s.description}),s.guide_url&&e.jsxs("a",{href:s.guide_url,target:"_blank",rel:"noopener noreferrer",className:"framework-guide-link",children:[s.guide_label??"Read guide"," →"]})]}),e.jsxs("div",{className:"framework-category-meta",children:[s.frameworks.length," ",s.frameworks.length===1?"framework":"frameworks"]})]}),e.jsx("div",{className:"framework-grid",children:s.frameworks.map(t=>e.jsx(w,{framework:t},t.slug))})]},s.slug))]},i.slug)),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",marginTop:8},children:[l," frameworks across ",n.length," ",n.length===1?"domain":"domains",". More areas coming soon."]})]})};export{w as FrameworkCard,E as default}; diff --git a/assets/LatexTitle-BJSVMlZ1.js b/assets/LatexTitle-B7GPgo8C.js similarity index 98% rename from assets/LatexTitle-BJSVMlZ1.js rename to assets/LatexTitle-B7GPgo8C.js index 3ceb4779bb94e0e22e4c4b9df5bc11070c0c9f4c..3ac4c3b01158227fffdaf4a2850596c3d0901f9e 100644 --- a/assets/LatexTitle-BJSVMlZ1.js +++ b/assets/LatexTitle-B7GPgo8C.js @@ -1 +1 @@ -import{j as o,r as g}from"./index-BrhBTT14.js";import{k as T}from"./katex.min-BSBacQyE.js";const j=new Set([",",";",":","!"," ","quad","qquad","enspace","thinspace"]),C={a:"á",e:"é",i:"í",o:"ó",u:"ú",y:"ý",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú",Y:"Ý"},M={a:"à",e:"è",i:"ì",o:"ò",u:"ù",A:"À",E:"È",I:"Ì",O:"Ò",U:"Ù"},_={a:"â",e:"ê",i:"î",o:"ô",u:"û",A:"Â",E:"Ê",I:"Î",O:"Ô",U:"Û"},b={a:"ä",e:"ë",i:"ï",o:"ö",u:"ü",y:"ÿ",A:"Ä",E:"Ë",I:"Ï",O:"Ö",U:"Ü",Y:"Ÿ"},O={"'":C,"`":M,"^":_,'"':b,"~":{n:"ñ",N:"Ñ"}},E={ss:"ß",ae:"æ",AE:"Æ",oe:"œ",OE:"Œ",o:"ø",O:"Ø",l:"ł",L:"Ł"};function S(e,s){var n;return((n=O[e])==null?void 0:n[s])??null}function N(e){const s=[];let n=0,i="";const l=()=>{i&&(s.push({type:"text",content:i}),i="")};for(;n=e.length)return{name:"",end:n};if(!/[a-zA-Z]/.test(e[n]))return{name:e[n],end:n+1};const i=n;for(;n=e.length)return null;if(e[s+1]==="{"){const i=d(e,s+1);return i?{end:i.end}:null}return/[A-Za-z0-9+\-=.]/.test(e[s+1])?{end:s+2}:null}function y(e,s){let n=s;if(e[n]==="\\"){const{name:t,end:a}=$(e,n);if(!t)return null;if(n=a,e[n]==="{"){const f=d(e,n);f&&(n=f.end)}}else if(/[A-Za-z0-9]/.test(e[n])){let t=n+1;for(;t`${s}-${l++}`,a=(f,u)=>f==="strong"?o.jsx("strong",{children:u},t()):o.jsx("em",{children:u},t());for(;ii&&n.push(e.slice(i,u)),i=u}return n}function A({latex:e,display:s}){const n=g.useMemo(()=>{try{return T.renderToString(e.trim(),{displayMode:s,throwOnError:!1})}catch{return null}},[e,s]);return n?o.jsx("span",{className:s?"katex-display":void 0,dangerouslySetInnerHTML:{__html:n}}):o.jsx(o.Fragment,{children:s?`$$${e}$$`:`$${e}$`})}function k(e){const s=N(e),n=[];return s.forEach((i,l)=>{const t=`latex-${l}`;if(i.type==="text"){const a=p(i.content,t);a.length===1?n.push(a[0]):a.length>1&&n.push(o.jsx(g.Fragment,{children:a},t));return}if(i.type==="display"){n.push(o.jsx(A,{latex:i.content,display:!0},t));return}n.push(o.jsx(A,{latex:i.content,display:!1},t))}),n.length===1?n[0]:o.jsx(o.Fragment,{children:n})}const U=({text:e,className:s=""})=>{const n=g.useMemo(()=>k(e),[e]);return o.jsx("span",{className:s,children:n})},X=({title:e,className:s=""})=>o.jsx(U,{text:e,className:s});export{X as L,U as a}; +import{j as o,r as g}from"./index-D_-UZEuL.js";import{k as T}from"./katex.min-BSBacQyE.js";const j=new Set([",",";",":","!"," ","quad","qquad","enspace","thinspace"]),C={a:"á",e:"é",i:"í",o:"ó",u:"ú",y:"ý",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú",Y:"Ý"},M={a:"à",e:"è",i:"ì",o:"ò",u:"ù",A:"À",E:"È",I:"Ì",O:"Ò",U:"Ù"},_={a:"â",e:"ê",i:"î",o:"ô",u:"û",A:"Â",E:"Ê",I:"Î",O:"Ô",U:"Û"},b={a:"ä",e:"ë",i:"ï",o:"ö",u:"ü",y:"ÿ",A:"Ä",E:"Ë",I:"Ï",O:"Ö",U:"Ü",Y:"Ÿ"},O={"'":C,"`":M,"^":_,'"':b,"~":{n:"ñ",N:"Ñ"}},E={ss:"ß",ae:"æ",AE:"Æ",oe:"œ",OE:"Œ",o:"ø",O:"Ø",l:"ł",L:"Ł"};function S(e,s){var n;return((n=O[e])==null?void 0:n[s])??null}function N(e){const s=[];let n=0,i="";const l=()=>{i&&(s.push({type:"text",content:i}),i="")};for(;n=e.length)return{name:"",end:n};if(!/[a-zA-Z]/.test(e[n]))return{name:e[n],end:n+1};const i=n;for(;n=e.length)return null;if(e[s+1]==="{"){const i=d(e,s+1);return i?{end:i.end}:null}return/[A-Za-z0-9+\-=.]/.test(e[s+1])?{end:s+2}:null}function y(e,s){let n=s;if(e[n]==="\\"){const{name:t,end:a}=$(e,n);if(!t)return null;if(n=a,e[n]==="{"){const f=d(e,n);f&&(n=f.end)}}else if(/[A-Za-z0-9]/.test(e[n])){let t=n+1;for(;t`${s}-${l++}`,a=(f,u)=>f==="strong"?o.jsx("strong",{children:u},t()):o.jsx("em",{children:u},t());for(;ii&&n.push(e.slice(i,u)),i=u}return n}function A({latex:e,display:s}){const n=g.useMemo(()=>{try{return T.renderToString(e.trim(),{displayMode:s,throwOnError:!1})}catch{return null}},[e,s]);return n?o.jsx("span",{className:s?"katex-display":void 0,dangerouslySetInnerHTML:{__html:n}}):o.jsx(o.Fragment,{children:s?`$$${e}$$`:`$${e}$`})}function k(e){const s=N(e),n=[];return s.forEach((i,l)=>{const t=`latex-${l}`;if(i.type==="text"){const a=p(i.content,t);a.length===1?n.push(a[0]):a.length>1&&n.push(o.jsx(g.Fragment,{children:a},t));return}if(i.type==="display"){n.push(o.jsx(A,{latex:i.content,display:!0},t));return}n.push(o.jsx(A,{latex:i.content,display:!1},t))}),n.length===1?n[0]:o.jsx(o.Fragment,{children:n})}const U=({text:e,className:s=""})=>{const n=g.useMemo(()=>k(e),[e]);return o.jsx("span",{className:s,children:n})},X=({title:e,className:s=""})=>o.jsx(U,{text:e,className:s});export{X as L,U as a}; diff --git a/assets/MarkdownText-CNM4Jz9h.js b/assets/MarkdownText-QvkQ9FeM.js similarity index 65% rename from assets/MarkdownText-CNM4Jz9h.js rename to assets/MarkdownText-QvkQ9FeM.js index 4ff5b7a537b81ff2e3012be5643aa407f460e657..c8a5c7995659f22dd5480e21b766c97f878448f3 100644 --- a/assets/MarkdownText-CNM4Jz9h.js +++ b/assets/MarkdownText-QvkQ9FeM.js @@ -1 +1 @@ -import{k as l,j as s,L as u}from"./index-BrhBTT14.js";import"./katex.min-BSBacQyE.js";import{r as p,a as m,P as h}from"./PaperPreviewLink-BCdZ9yj3.js";import{M as d,r as w}from"./index-BLqBUiom.js";const x=new Set(["paperswithcode.co","www.paperswithcode.co","localhost","127.0.0.1","167.235.148.241"]),P=["/methods","/paper","/papers","/tasks","/benchmark","/conferences"];function k(n,o=window.location.origin){if(!n)return null;let t;if(n.startsWith("/"))t=n;else try{const r=new URL(n,o);if(!x.has(r.hostname))return null;t=`${r.pathname}${r.search}${r.hash}`}catch{return null}const e=t.split(/[?#]/,1)[0];return P.some(r=>e===r||e.startsWith(`${r}/`))?t:null}function f(n){const t=n.split(/[?#]/,1)[0].match(/^\/papers?\/([^/]+)$/);if(!t||t[1].includes("%"))return null;const e=t[1],r=/^\d{4}[.-]\d{4,5}(?:v\d+)?$/.test(e),a=/^[1-9]\d*$/.test(e);return!r&&!a?null:l(e)}const E=({text:n,className:o=""})=>s.jsx("div",{className:o,children:s.jsx(d,{remarkPlugins:[w,m],rehypePlugins:[p],components:{a:({href:t,children:e,node:r,...a})=>{const i=k(t);if(i){const c=f(i);return c?s.jsx(h,{routeId:c,to:i,...a,children:e}):s.jsx(u,{to:i,...a,children:e})}return s.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",...a,children:e})}},children:n})});export{E as M,k as r}; +import{n as l,j as s,L as u}from"./index-D_-UZEuL.js";import"./katex.min-BSBacQyE.js";import{r as p,a as m,P as h}from"./PaperPreviewLink-B25cD-_k.js";import{M as d,r as w}from"./index-vCOH2DKd.js";const x=new Set(["paperswithcode.co","www.paperswithcode.co","localhost","127.0.0.1","167.235.148.241"]),P=["/methods","/paper","/papers","/tasks","/benchmark","/conferences"];function f(n,o=window.location.origin){if(!n)return null;let t;if(n.startsWith("/"))t=n;else try{const r=new URL(n,o);if(!x.has(r.hostname))return null;t=`${r.pathname}${r.search}${r.hash}`}catch{return null}const e=t.split(/[?#]/,1)[0];return P.some(r=>e===r||e.startsWith(`${r}/`))?t:null}function k(n){const t=n.split(/[?#]/,1)[0].match(/^\/papers?\/([^/]+)$/);if(!t||t[1].includes("%"))return null;const e=t[1],r=/^\d{4}[.-]\d{4,5}(?:v\d+)?$/.test(e),a=/^[1-9]\d*$/.test(e);return!r&&!a?null:l(e)}const E=({text:n,className:o=""})=>s.jsx("div",{className:o,children:s.jsx(d,{remarkPlugins:[w,m],rehypePlugins:[p],components:{a:({href:t,children:e,node:r,...a})=>{const i=f(t);if(i){const c=k(i);return c?s.jsx(h,{routeId:c,to:i,...a,children:e}):s.jsx(u,{to:i,...a,children:e})}return s.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",...a,children:e})}},children:n})});export{E as M,f as r}; diff --git a/assets/MethodDetailView-kXZaPUhq.js b/assets/MethodDetailView-CiYmZ5G6.js similarity index 94% rename from assets/MethodDetailView-kXZaPUhq.js rename to assets/MethodDetailView-CiYmZ5G6.js index 9e041daab33b1e91eee151af37e1a020944d778c..aa111b45011dafe33a077955d02556f47b5c163c 100644 --- a/assets/MethodDetailView-kXZaPUhq.js +++ b/assets/MethodDetailView-CiYmZ5G6.js @@ -1 +1 @@ -import{j as e,r as L,e as W,a as Z,L as C,aa as V}from"./index-BrhBTT14.js";import{u as M}from"./useQuery-GhY2LXSI.js";import{u as X}from"./useInfiniteQuery-bETtM5yS.js";import{M as Y,P as J}from"./components-74u_bIKK.js";import{u as ee,P as te}from"./useIntersectionObserver-Lj6hnXj6.js";import{r as se,M as O}from"./MarkdownText-CNM4Jz9h.js";import{c as b}from"./catalog-CkpmYxEk.js";import{p as ae}from"./papers-DBaPliAp.js";import{s as re}from"./slug-BpH-Nkvz.js";import{t as ne}from"./transform-Duf4Shfn.js";import{S as A}from"./skeleton-DHdzoBmM.js";import{A as ie,a as le}from"./alert-c1n3ZtEC.js";import{s as oe}from"./safeExternalHref-CkBrsh84.js";import"./LatexTitle-BJSVMlZ1.js";import"./katex.min-BSBacQyE.js";import"./PaperPreviewLink-BCdZ9yj3.js";import"./index-BLqBUiom.js";import"./hover-card-BcKGA4Et.js";const s={pink:"#F8D7D9",pinkS:"#D9B0B3",yellow:"#FBEFC2",yellowS:"#C9B97D",orange:"#F8D7B3",orangeS:"#C99466",blue:"#CDE2EE",blueS:"#7FA4BA",purple:"#D4D2EA",purpleS:"#8E8AC0",green:"#CCE2C5",greenS:"#7DA475",ink:"#1A1814",faint:"#8E8678"},j=({x:t,y:n,w:o,h:l,fill:f,stroke:g,label:u,fontSize:c=10,multiline:_})=>e.jsxs("g",{children:[e.jsx("rect",{x:t,y:n,width:o,height:l,rx:"3",ry:"3",fill:f,stroke:g,strokeWidth:"1"}),_?e.jsxs(e.Fragment,{children:[e.jsx("text",{x:t+o/2,y:n+l/2-2,fontSize:c,fontFamily:"var(--sans)",fill:s.ink,textAnchor:"middle",dominantBaseline:"middle",children:_[0]}),e.jsx("text",{x:t+o/2,y:n+l/2+c-1,fontSize:c,fontFamily:"var(--sans)",fill:s.ink,textAnchor:"middle",dominantBaseline:"middle",children:_[1]})]}):e.jsx("text",{x:t+o/2,y:n+l/2,fontSize:c,fontFamily:"var(--sans)",fill:s.ink,textAnchor:"middle",dominantBaseline:"middle",children:u})]}),ce=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.faint,textAnchor:"middle",children:"Scaled Dot-Product Attention"}),e.jsx(j,{x:140,y:40,w:80,h:26,fill:s.yellow,stroke:s.yellowS,label:"MatMul",fontSize:11}),e.jsx("path",{d:"M180 66 L180 80",stroke:s.ink}),e.jsx(j,{x:140,y:80,w:80,h:26,fill:s.green,stroke:s.greenS,label:"SoftMax",fontSize:11}),e.jsx("path",{d:"M180 106 L180 120",stroke:s.ink}),e.jsx(j,{x:140,y:120,w:80,h:26,fill:s.purple,stroke:s.purpleS,label:"Mask (opt.)",fontSize:11}),e.jsx("path",{d:"M180 146 L180 160",stroke:s.ink}),e.jsx(j,{x:140,y:160,w:80,h:26,fill:s.blue,stroke:s.blueS,label:"Scale ÷√dₖ",fontSize:11}),e.jsx("path",{d:"M180 186 L180 200",stroke:s.ink}),e.jsx(j,{x:140,y:200,w:80,h:26,fill:s.yellow,stroke:s.yellowS,label:"MatMul",fontSize:11}),e.jsx("path",{d:"M156 226 L120 270",stroke:s.ink}),e.jsx("path",{d:"M180 226 L180 270",stroke:s.ink}),e.jsx("path",{d:"M204 226 L240 270",stroke:s.ink}),e.jsx(j,{x:100,y:270,w:40,h:24,fill:s.pink,stroke:s.pinkS,label:"Q",fontSize:13}),e.jsx(j,{x:160,y:270,w:40,h:24,fill:s.pink,stroke:s.pinkS,label:"K",fontSize:13}),e.jsx(j,{x:220,y:270,w:40,h:24,fill:s.pink,stroke:s.pinkS,label:"V",fontSize:13}),e.jsxs("text",{x:"180",y:"330",fontSize:"14",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.ink,textAnchor:"middle",children:["softmax(QK",e.jsx("tspan",{fontSize:"9",baselineShift:"super",children:"⊤"})," / √d) V"]})]}),de=[["my-skill/",""],["├── SKILL.md","# Required: metadata + instructions"],["├── scripts/","# Optional: executable code"],["├── references/","# Optional: documentation"],["├── assets/","# Optional: templates, resources"],["└── ...","# Any additional files or directories"]],me=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.faint,textAnchor:"middle",children:"Skill package layout"}),e.jsx("rect",{x:"28",y:"48",width:"304",height:"318",rx:"8",fill:"#FFFDF8",stroke:s.faint,strokeWidth:"1"}),de.map(([t,n],o)=>{const l=92+o*44;return e.jsxs("g",{children:[e.jsx("text",{x:"44",y:l,fontSize:"11",fontFamily:"var(--mono)",fill:s.ink,dominantBaseline:"middle",children:t}),n?e.jsx("text",{x:"138",y:l,fontSize:"8.5",fontFamily:"var(--mono)",fill:s.faint,dominantBaseline:"middle",children:n}):null]},t)})]}),he={attention:ce,"agent-skills":me},pe=({method:t})=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.faint,textAnchor:"middle",children:t.name||"method"}),e.jsx(j,{x:80,y:70,w:200,h:50,fill:s.blue,stroke:s.blueS,label:"Input",fontSize:12}),e.jsx("path",{d:"M180 120 L180 150",stroke:s.ink}),e.jsx(j,{x:80,y:150,w:200,h:70,fill:s.orange,stroke:s.orangeS,label:t.name||"transform",fontSize:13}),e.jsx("path",{d:"M180 220 L180 250",stroke:s.ink}),e.jsx(j,{x:80,y:250,w:200,h:50,fill:s.purple,stroke:s.purpleS,label:"Output",fontSize:12})]}),ue=({method:t})=>{const n=(t.slug||"").toLowerCase(),o=he[n];if(o)return e.jsx("div",{className:"method-figure-svg method-figure-svg--schematic",children:e.jsx(o,{})});if(t.image_url){const l=n==="transformer"||n==="gpt-4"||n==="gpt-4o"||n==="multi-head-attention"?" method-figure-svg--compact":n==="rpn"?" method-figure-svg--scaled-80":"";return e.jsx("div",{className:`method-figure-svg method-figure-svg--image${l}`,children:e.jsx("img",{className:"method-figure-img",src:t.image_url,alt:`${t.name} figure`})})}return e.jsx("div",{className:"method-figure-svg method-figure-svg--schematic",children:e.jsx(pe,{method:t})})},D=720,B=138,x={top:8,right:10,bottom:25,left:36},K=56,xe=new Intl.DateTimeFormat("en",{month:"short",year:"2-digit",timeZone:"UTC"}),ge=new Intl.DateTimeFormat("en",{year:"numeric",timeZone:"UTC"}),E=t=>xe.format(new Date(`${t}T00:00:00Z`)),fe=(t,n)=>{if(t===0)return new Set;const o=t>48?12:t>36?6:t>18?3:2,l=Math.max(1,Math.ceil(K/n)),f=Math.max(o,l),g=t-1,u=new Set([0,g]);for(let c=f;c=K&&u.add(c);return u},Q=t=>{if(t.coverage_status===void 0||["complete","not_applicable"].includes(t.coverage_status))return null;const n=t.processed_paper_count!==void 0&&t.eligible_paper_count!==void 0?`; ${t.processed_paper_count.toLocaleString()} of ${t.eligible_paper_count.toLocaleString()} eligible papers processed`:"";return`Historical tagging ${t.coverage_status==="failed"?"needs retry":"in progress"}${n}`},je=({history:t,methodName:n})=>{const[o,l]=L.useState(null),f=Math.max(1,...t.map(i=>i.paper_count)),g=D-x.left-x.right,u=B-x.top-x.bottom,c=t.length?g/t.length:g,_=Math.max(2,c*.68),h=fe(t.length,c),P=Array.from(new Set([0,Math.ceil(f/2),f])),m=o==null?null:t[o],y=m?Q(m):null;return e.jsxs("div",{className:"method-usage-chart-wrap",children:[e.jsxs("svg",{className:"method-usage-chart",viewBox:`0 0 ${D} ${B}`,role:"group","aria-label":`${n}: papers mentioning this method by publication month`,children:[e.jsxs("title",{children:[n,": papers mentioning this method by publication month"]}),P.map(i=>{const p=x.top+u-i/f*u;return e.jsxs("g",{children:[e.jsx("line",{className:"method-usage-gridline",x1:x.left,x2:D-x.right,y1:p,y2:p}),e.jsx("text",{className:"method-usage-y-label",x:x.left-8,y:p+3,textAnchor:"end",children:i})]},i)}),t.map((i,p)=>{const v=i.paper_count/f*u,w=i.paper_count>0?Math.max(1,v):0,F=x.left+c*p+(c-_)/2,a=x.top+u-w,N=o===p,S=p===t.length-1,k=Q(i);return e.jsxs("g",{className:`method-usage-bar${N?" is-active":""}${S?" is-current":""}`,tabIndex:0,role:"img","aria-label":`${E(i.start_date)}: ${i.paper_count} ${i.paper_count===1?"paper":"papers"}${k?`. ${k}`:""}`,onMouseEnter:()=>l(p),onMouseLeave:()=>l(null),onFocus:()=>l(p),onBlur:()=>l(null),children:[e.jsx("rect",{className:"method-usage-bar-hit",x:x.left+c*p,y:x.top,width:c,height:u}),e.jsx("rect",{className:"method-usage-bar-mark",x:F,y:a,width:_,height:w,rx:"1.5"})]},i.start_date)}),t.map((i,p)=>h.has(p)?e.jsx("text",{className:"method-usage-x-label",x:x.left+c*(p+.5),y:B-11,textAnchor:"middle",children:t.length>48?ge.format(new Date(`${i.start_date}T00:00:00Z`)):E(i.start_date)},i.start_date):null)]}),m&&e.jsxs("div",{className:"method-usage-tooltip",role:"status",children:[e.jsx("strong",{children:E(m.start_date)}),e.jsxs("span",{children:[m.paper_count," ",m.paper_count===1?"paper":"papers",o===t.length-1?" · month to date":""]}),e.jsxs("span",{children:[(m.catalog_share??0).toFixed(2),"% of"," ",(m.catalog_paper_count??0).toLocaleString()," catalog papers"]}),y&&e.jsx("span",{children:y})]})]})},_e=[["trending","trending"],["new","newest"],["cited","most cited"]],U={"on-policy-distillation":["fine-tuning","post-training","rlvr","rlhf","direct-preference-optimization-dpo"],mcp:["agent-skills"],"agent-skills":["mcp"]},ze=()=>{var I,T,z,$,H,R;const{methodSlug:t}=W(),[n,o]=Z(),[l,f]=L.useState("trending"),g=n.get("has_code")==="true",u=n.get("has_hf_artifacts")==="true",c=r=>{const d=new URLSearchParams(n);r?d.set("has_code","true"):d.delete("has_code"),o(d)},_=r=>{const d=new URLSearchParams(n);r?d.set("has_hf_artifacts","true"):d.delete("has_hf_artifacts"),o(d)},h=M({queryKey:["method",t],queryFn:()=>b.getMethod(t),enabled:!!t,staleTime:10*60*1e3}),P=M({queryKey:["areas-all"],queryFn:()=>b.listAreas({page_size:50,ordering:"name"}),enabled:!!((I=h.data)!=null&&I.area_id),staleTime:10*60*1e3}),m=M({queryKey:["method-trend",t],queryFn:()=>b.methodTrend(t),enabled:!!t&&!!h.data,staleTime:10*60*1e3}),y=l==="trending"?"trending":l==="cited"?"citation_count":"date_published",i=X({queryKey:["method-papers-infinite",t,y,g,u],queryFn:({pageParam:r=1})=>ae.forMethod(t,{page:r,page_size:20,order_by:y,order_dir:"desc",include_resources:!0,has_code:g,has_hf_artifacts:u}),getNextPageParam:r=>r.next_page,initialPageParam:1,enabled:!!t,staleTime:5*60*1e3,placeholderData:V}),p=M({queryKey:["related-methods",(T=h.data)==null?void 0:T.slug,(z=h.data)==null?void 0:z.area_id,($=h.data)==null?void 0:$.id],queryFn:async()=>{const r=h.data;if(!r)return[];const d=r.slug?U[r.slug]:void 0;return d?Promise.all(d.map(G=>b.getMethod(G))):r.area_id?(await b.listMethods({area_id:r.area_id,exclude_id:r.id,ordering:"-paper_count",page_size:8})).results:[]},enabled:!!(h.data&&(h.data.slug&&U[h.data.slug]||h.data.area_id)),staleTime:10*60*1e3}),v=L.useMemo(()=>{var d;return(((d=i.data)==null?void 0:d.pages.flatMap(q=>q.results))||[]).map(ne)},[i.data]),{targetRef:w,isIntersecting:F}=ee({rootMargin:"200px"});if(L.useEffect(()=>{F&&i.hasNextPage&&!i.isFetchingNextPage&&i.fetchNextPage()},[F,i.hasNextPage,i.isFetchingNextPage]),h.isLoading)return e.jsxs("div",{className:"page",children:[e.jsx(A,{className:"h-12 w-1/2 mb-4"}),e.jsx(A,{className:"h-64 w-full"})]});if(h.error||!h.data)return e.jsx("div",{className:"page",children:e.jsx(ie,{variant:"destructive",children:e.jsx(le,{children:"Method not found."})})});const a=h.data,N=(H=P.data)==null?void 0:H.results.find(r=>r.id===a.area_id),S=se(a.source_url),k=S?null:oe(a.source_url);return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(C,{to:"/methods",children:"Methods"}),N&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(C,{to:`/methods#area-${re(N.name)}`,children:N.name})]}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--ink)"},children:a.name})]}),e.jsxs("div",{className:`tag-hero method-hero-grid${a.slug==="grokking"||a.slug==="latent-reasoning"||a.slug==="world-action-models"?" method-hero-grid--wide-figure":""}`,children:[e.jsxs("div",{children:[e.jsx("div",{className:"tag-hero-eyebrow",children:"METHOD"}),e.jsx("h1",{className:"tag-hero-title method-hero-title",children:a.name}),a.full_name&&a.full_name!==a.name&&e.jsx("div",{style:{fontFamily:"var(--serif)",fontSize:16,fontStyle:"italic",color:"var(--ink-soft)",marginTop:8},children:a.full_name}),a.description&&e.jsx(O,{className:"method-description",text:a.description}),a.source_url&&a.source_title&&e.jsxs("div",{className:"method-source",children:[e.jsx("span",{className:"method-source-label",children:"Source"}),S?e.jsxs(C,{className:"method-source-link",to:S,target:"_blank",rel:"noopener noreferrer",children:[e.jsx("span",{className:"method-source-title",children:a.source_title}),a.introduced_year&&e.jsx("span",{className:"method-source-meta",children:a.introduced_year})]}):k?e.jsxs("a",{className:"method-source-link",href:k,target:"_blank",rel:"noopener noreferrer",children:[e.jsx("span",{className:"method-source-title",children:a.source_title}),a.introduced_year&&e.jsx("span",{className:"method-source-meta",children:a.introduced_year})]}):e.jsxs("div",{className:"method-source-link is-static",children:[e.jsx("span",{className:"method-source-title",children:a.source_title}),a.introduced_year&&e.jsx("span",{className:"method-source-meta",children:a.introduced_year})]})]}),e.jsxs("div",{className:"tag-hero-meta",children:[e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Papers mentioning"}),e.jsx("span",{className:"value",children:(a.paper_count??0).toLocaleString()})]}),m.data&&e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Recent mentions"}),e.jsx("span",{className:"value",children:m.data.comparison_complete?e.jsxs(e.Fragment,{children:[m.data.trend_score.toFixed(1),e.jsx("small",{children:"/mo"})]}):"Pending"})]}),a.introduced_year!=null&&e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Introduced"}),e.jsx("span",{className:"value",children:a.introduced_year})]})]}),m.isLoading?e.jsx(A,{className:"h-36 w-full method-trend-skeleton"}):m.data?e.jsxs("section",{className:"method-trend-panel method-trend-panel--compact",children:[e.jsxs("div",{className:"method-trend-header",children:[e.jsx("div",{children:e.jsx("div",{className:"method-trend-eyebrow",children:"Usage trend"})}),e.jsxs("div",{className:"method-trend-summary",children:[e.jsx("strong",{children:m.data.recent_paper_count}),e.jsxs("span",{children:["papers / ",m.data.recent_days,"d"]})]})]}),e.jsx(je,{history:m.data.history,methodName:a.name})]}):null]}),e.jsxs("figure",{className:"method-figure-card",children:[e.jsx(ue,{method:a}),a.image_credit&&e.jsx("figcaption",{children:e.jsx(O,{className:"method-image-credit",text:a.image_credit})})]})]}),(((R=p.data)==null?void 0:R.length)??0)>0&&e.jsxs("div",{className:"filter-row",children:[e.jsx("span",{className:"label",children:"Related methods"}),p.data.map(r=>e.jsx(Y,{method:{slug:r.slug,name:r.name}},r.id))]}),e.jsxs("div",{className:"sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:_e.map(([r,d])=>e.jsx("button",{className:`sort-btn ${l===r?"active":""}`,onClick:()=>f(r),children:d},r))}),e.jsx(te,{hasCode:g,hasHfArtifacts:u,onHasCodeChange:c,onHasHfArtifactsChange:_})]}),e.jsxs("div",{className:"results-count",children:[v.length," papers mentioning ",a.name]})]}),i.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((r,d)=>e.jsx(A,{className:"h-40 w-full"},d))}):v.length===0?e.jsx("div",{className:"no-results",children:"No papers tagged with this method yet."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:v.map((r,d)=>e.jsx(J,{paper:r,rank:d+1},r.id))}),e.jsx("div",{ref:w,style:{height:1}}),i.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]})]})};export{ze as default}; +import{j as e,r as L,c as W,a as Z,L as C,ag as V}from"./index-D_-UZEuL.js";import{u as M}from"./useQuery-BZo4MZ3s.js";import{u as X}from"./useInfiniteQuery-CFUEkcEs.js";import{M as Y,P as J}from"./components-CmC5jqhM.js";import{u as ee,P as te}from"./useIntersectionObserver-Cq9n7uOQ.js";import{r as se,M as O}from"./MarkdownText-QvkQ9FeM.js";import{c as b}from"./catalog-CjU2vAfw.js";import{p as ae}from"./papers-DHqjKX7p.js";import{s as re}from"./slug-BpH-Nkvz.js";import{t as ne}from"./transform-CUuA-koJ.js";import{S as A}from"./skeleton-CCZ1iXls.js";import{A as ie,a as le}from"./alert-B2j1kc2o.js";import{s as oe}from"./safeExternalHref-CkBrsh84.js";import"./LatexTitle-B7GPgo8C.js";import"./katex.min-BSBacQyE.js";import"./PaperPreviewLink-B25cD-_k.js";import"./index-vCOH2DKd.js";import"./hover-card-DiJQFgx9.js";const s={pink:"#F8D7D9",pinkS:"#D9B0B3",yellow:"#FBEFC2",yellowS:"#C9B97D",orange:"#F8D7B3",orangeS:"#C99466",blue:"#CDE2EE",blueS:"#7FA4BA",purple:"#D4D2EA",purpleS:"#8E8AC0",green:"#CCE2C5",greenS:"#7DA475",ink:"#1A1814",faint:"#8E8678"},j=({x:t,y:n,w:o,h:l,fill:f,stroke:g,label:u,fontSize:c=10,multiline:_})=>e.jsxs("g",{children:[e.jsx("rect",{x:t,y:n,width:o,height:l,rx:"3",ry:"3",fill:f,stroke:g,strokeWidth:"1"}),_?e.jsxs(e.Fragment,{children:[e.jsx("text",{x:t+o/2,y:n+l/2-2,fontSize:c,fontFamily:"var(--sans)",fill:s.ink,textAnchor:"middle",dominantBaseline:"middle",children:_[0]}),e.jsx("text",{x:t+o/2,y:n+l/2+c-1,fontSize:c,fontFamily:"var(--sans)",fill:s.ink,textAnchor:"middle",dominantBaseline:"middle",children:_[1]})]}):e.jsx("text",{x:t+o/2,y:n+l/2,fontSize:c,fontFamily:"var(--sans)",fill:s.ink,textAnchor:"middle",dominantBaseline:"middle",children:u})]}),ce=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.faint,textAnchor:"middle",children:"Scaled Dot-Product Attention"}),e.jsx(j,{x:140,y:40,w:80,h:26,fill:s.yellow,stroke:s.yellowS,label:"MatMul",fontSize:11}),e.jsx("path",{d:"M180 66 L180 80",stroke:s.ink}),e.jsx(j,{x:140,y:80,w:80,h:26,fill:s.green,stroke:s.greenS,label:"SoftMax",fontSize:11}),e.jsx("path",{d:"M180 106 L180 120",stroke:s.ink}),e.jsx(j,{x:140,y:120,w:80,h:26,fill:s.purple,stroke:s.purpleS,label:"Mask (opt.)",fontSize:11}),e.jsx("path",{d:"M180 146 L180 160",stroke:s.ink}),e.jsx(j,{x:140,y:160,w:80,h:26,fill:s.blue,stroke:s.blueS,label:"Scale ÷√dₖ",fontSize:11}),e.jsx("path",{d:"M180 186 L180 200",stroke:s.ink}),e.jsx(j,{x:140,y:200,w:80,h:26,fill:s.yellow,stroke:s.yellowS,label:"MatMul",fontSize:11}),e.jsx("path",{d:"M156 226 L120 270",stroke:s.ink}),e.jsx("path",{d:"M180 226 L180 270",stroke:s.ink}),e.jsx("path",{d:"M204 226 L240 270",stroke:s.ink}),e.jsx(j,{x:100,y:270,w:40,h:24,fill:s.pink,stroke:s.pinkS,label:"Q",fontSize:13}),e.jsx(j,{x:160,y:270,w:40,h:24,fill:s.pink,stroke:s.pinkS,label:"K",fontSize:13}),e.jsx(j,{x:220,y:270,w:40,h:24,fill:s.pink,stroke:s.pinkS,label:"V",fontSize:13}),e.jsxs("text",{x:"180",y:"330",fontSize:"14",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.ink,textAnchor:"middle",children:["softmax(QK",e.jsx("tspan",{fontSize:"9",baselineShift:"super",children:"⊤"})," / √d) V"]})]}),de=[["my-skill/",""],["├── SKILL.md","# Required: metadata + instructions"],["├── scripts/","# Optional: executable code"],["├── references/","# Optional: documentation"],["├── assets/","# Optional: templates, resources"],["└── ...","# Any additional files or directories"]],me=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.faint,textAnchor:"middle",children:"Skill package layout"}),e.jsx("rect",{x:"28",y:"48",width:"304",height:"318",rx:"8",fill:"#FFFDF8",stroke:s.faint,strokeWidth:"1"}),de.map(([t,n],o)=>{const l=92+o*44;return e.jsxs("g",{children:[e.jsx("text",{x:"44",y:l,fontSize:"11",fontFamily:"var(--mono)",fill:s.ink,dominantBaseline:"middle",children:t}),n?e.jsx("text",{x:"138",y:l,fontSize:"8.5",fontFamily:"var(--mono)",fill:s.faint,dominantBaseline:"middle",children:n}):null]},t)})]}),he={attention:ce,"agent-skills":me},pe=({method:t})=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:s.faint,textAnchor:"middle",children:t.name||"method"}),e.jsx(j,{x:80,y:70,w:200,h:50,fill:s.blue,stroke:s.blueS,label:"Input",fontSize:12}),e.jsx("path",{d:"M180 120 L180 150",stroke:s.ink}),e.jsx(j,{x:80,y:150,w:200,h:70,fill:s.orange,stroke:s.orangeS,label:t.name||"transform",fontSize:13}),e.jsx("path",{d:"M180 220 L180 250",stroke:s.ink}),e.jsx(j,{x:80,y:250,w:200,h:50,fill:s.purple,stroke:s.purpleS,label:"Output",fontSize:12})]}),ue=({method:t})=>{const n=(t.slug||"").toLowerCase(),o=he[n];if(o)return e.jsx("div",{className:"method-figure-svg method-figure-svg--schematic",children:e.jsx(o,{})});if(t.image_url){const l=n==="transformer"||n==="gpt-4"||n==="gpt-4o"||n==="multi-head-attention"?" method-figure-svg--compact":n==="rpn"?" method-figure-svg--scaled-80":"";return e.jsx("div",{className:`method-figure-svg method-figure-svg--image${l}`,children:e.jsx("img",{className:"method-figure-img",src:t.image_url,alt:`${t.name} figure`})})}return e.jsx("div",{className:"method-figure-svg method-figure-svg--schematic",children:e.jsx(pe,{method:t})})},D=720,B=138,x={top:8,right:10,bottom:25,left:36},K=56,xe=new Intl.DateTimeFormat("en",{month:"short",year:"2-digit",timeZone:"UTC"}),ge=new Intl.DateTimeFormat("en",{year:"numeric",timeZone:"UTC"}),E=t=>xe.format(new Date(`${t}T00:00:00Z`)),fe=(t,n)=>{if(t===0)return new Set;const o=t>48?12:t>36?6:t>18?3:2,l=Math.max(1,Math.ceil(K/n)),f=Math.max(o,l),g=t-1,u=new Set([0,g]);for(let c=f;c=K&&u.add(c);return u},Q=t=>{if(t.coverage_status===void 0||["complete","not_applicable"].includes(t.coverage_status))return null;const n=t.processed_paper_count!==void 0&&t.eligible_paper_count!==void 0?`; ${t.processed_paper_count.toLocaleString()} of ${t.eligible_paper_count.toLocaleString()} eligible papers processed`:"";return`Historical tagging ${t.coverage_status==="failed"?"needs retry":"in progress"}${n}`},je=({history:t,methodName:n})=>{const[o,l]=L.useState(null),f=Math.max(1,...t.map(i=>i.paper_count)),g=D-x.left-x.right,u=B-x.top-x.bottom,c=t.length?g/t.length:g,_=Math.max(2,c*.68),h=fe(t.length,c),P=Array.from(new Set([0,Math.ceil(f/2),f])),m=o==null?null:t[o],y=m?Q(m):null;return e.jsxs("div",{className:"method-usage-chart-wrap",children:[e.jsxs("svg",{className:"method-usage-chart",viewBox:`0 0 ${D} ${B}`,role:"group","aria-label":`${n}: papers mentioning this method by publication month`,children:[e.jsxs("title",{children:[n,": papers mentioning this method by publication month"]}),P.map(i=>{const p=x.top+u-i/f*u;return e.jsxs("g",{children:[e.jsx("line",{className:"method-usage-gridline",x1:x.left,x2:D-x.right,y1:p,y2:p}),e.jsx("text",{className:"method-usage-y-label",x:x.left-8,y:p+3,textAnchor:"end",children:i})]},i)}),t.map((i,p)=>{const v=i.paper_count/f*u,w=i.paper_count>0?Math.max(1,v):0,F=x.left+c*p+(c-_)/2,a=x.top+u-w,N=o===p,S=p===t.length-1,k=Q(i);return e.jsxs("g",{className:`method-usage-bar${N?" is-active":""}${S?" is-current":""}`,tabIndex:0,role:"img","aria-label":`${E(i.start_date)}: ${i.paper_count} ${i.paper_count===1?"paper":"papers"}${k?`. ${k}`:""}`,onMouseEnter:()=>l(p),onMouseLeave:()=>l(null),onFocus:()=>l(p),onBlur:()=>l(null),children:[e.jsx("rect",{className:"method-usage-bar-hit",x:x.left+c*p,y:x.top,width:c,height:u}),e.jsx("rect",{className:"method-usage-bar-mark",x:F,y:a,width:_,height:w,rx:"1.5"})]},i.start_date)}),t.map((i,p)=>h.has(p)?e.jsx("text",{className:"method-usage-x-label",x:x.left+c*(p+.5),y:B-11,textAnchor:"middle",children:t.length>48?ge.format(new Date(`${i.start_date}T00:00:00Z`)):E(i.start_date)},i.start_date):null)]}),m&&e.jsxs("div",{className:"method-usage-tooltip",role:"status",children:[e.jsx("strong",{children:E(m.start_date)}),e.jsxs("span",{children:[m.paper_count," ",m.paper_count===1?"paper":"papers",o===t.length-1?" · month to date":""]}),e.jsxs("span",{children:[(m.catalog_share??0).toFixed(2),"% of"," ",(m.catalog_paper_count??0).toLocaleString()," catalog papers"]}),y&&e.jsx("span",{children:y})]})]})},_e=[["trending","trending"],["new","newest"],["cited","most cited"]],U={"on-policy-distillation":["fine-tuning","post-training","rlvr","rlhf","direct-preference-optimization-dpo"],mcp:["agent-skills"],"agent-skills":["mcp"]},ze=()=>{var I,T,z,$,H,R;const{methodSlug:t}=W(),[n,o]=Z(),[l,f]=L.useState("trending"),g=n.get("has_code")==="true",u=n.get("has_hf_artifacts")==="true",c=r=>{const d=new URLSearchParams(n);r?d.set("has_code","true"):d.delete("has_code"),o(d)},_=r=>{const d=new URLSearchParams(n);r?d.set("has_hf_artifacts","true"):d.delete("has_hf_artifacts"),o(d)},h=M({queryKey:["method",t],queryFn:()=>b.getMethod(t),enabled:!!t,staleTime:10*60*1e3}),P=M({queryKey:["areas-all"],queryFn:()=>b.listAreas({page_size:50,ordering:"name"}),enabled:!!((I=h.data)!=null&&I.area_id),staleTime:10*60*1e3}),m=M({queryKey:["method-trend",t],queryFn:()=>b.methodTrend(t),enabled:!!t&&!!h.data,staleTime:10*60*1e3}),y=l==="trending"?"trending":l==="cited"?"citation_count":"date_published",i=X({queryKey:["method-papers-infinite",t,y,g,u],queryFn:({pageParam:r=1})=>ae.forMethod(t,{page:r,page_size:20,order_by:y,order_dir:"desc",include_resources:!0,has_code:g,has_hf_artifacts:u}),getNextPageParam:r=>r.next_page,initialPageParam:1,enabled:!!t,staleTime:5*60*1e3,placeholderData:V}),p=M({queryKey:["related-methods",(T=h.data)==null?void 0:T.slug,(z=h.data)==null?void 0:z.area_id,($=h.data)==null?void 0:$.id],queryFn:async()=>{const r=h.data;if(!r)return[];const d=r.slug?U[r.slug]:void 0;return d?Promise.all(d.map(G=>b.getMethod(G))):r.area_id?(await b.listMethods({area_id:r.area_id,exclude_id:r.id,ordering:"-paper_count",page_size:8})).results:[]},enabled:!!(h.data&&(h.data.slug&&U[h.data.slug]||h.data.area_id)),staleTime:10*60*1e3}),v=L.useMemo(()=>{var d;return(((d=i.data)==null?void 0:d.pages.flatMap(q=>q.results))||[]).map(ne)},[i.data]),{targetRef:w,isIntersecting:F}=ee({rootMargin:"200px"});if(L.useEffect(()=>{F&&i.hasNextPage&&!i.isFetchingNextPage&&i.fetchNextPage()},[F,i.hasNextPage,i.isFetchingNextPage]),h.isLoading)return e.jsxs("div",{className:"page",children:[e.jsx(A,{className:"h-12 w-1/2 mb-4"}),e.jsx(A,{className:"h-64 w-full"})]});if(h.error||!h.data)return e.jsx("div",{className:"page",children:e.jsx(ie,{variant:"destructive",children:e.jsx(le,{children:"Method not found."})})});const a=h.data,N=(H=P.data)==null?void 0:H.results.find(r=>r.id===a.area_id),S=se(a.source_url),k=S?null:oe(a.source_url);return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(C,{to:"/methods",children:"Methods"}),N&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(C,{to:`/methods#area-${re(N.name)}`,children:N.name})]}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--ink)"},children:a.name})]}),e.jsxs("div",{className:`tag-hero method-hero-grid${a.slug==="grokking"||a.slug==="latent-reasoning"||a.slug==="world-action-models"?" method-hero-grid--wide-figure":""}`,children:[e.jsxs("div",{children:[e.jsx("div",{className:"tag-hero-eyebrow",children:"METHOD"}),e.jsx("h1",{className:"tag-hero-title method-hero-title",children:a.name}),a.full_name&&a.full_name!==a.name&&e.jsx("div",{style:{fontFamily:"var(--serif)",fontSize:16,fontStyle:"italic",color:"var(--ink-soft)",marginTop:8},children:a.full_name}),a.description&&e.jsx(O,{className:"method-description",text:a.description}),a.source_url&&a.source_title&&e.jsxs("div",{className:"method-source",children:[e.jsx("span",{className:"method-source-label",children:"Source"}),S?e.jsxs(C,{className:"method-source-link",to:S,target:"_blank",rel:"noopener noreferrer",children:[e.jsx("span",{className:"method-source-title",children:a.source_title}),a.introduced_year&&e.jsx("span",{className:"method-source-meta",children:a.introduced_year})]}):k?e.jsxs("a",{className:"method-source-link",href:k,target:"_blank",rel:"noopener noreferrer",children:[e.jsx("span",{className:"method-source-title",children:a.source_title}),a.introduced_year&&e.jsx("span",{className:"method-source-meta",children:a.introduced_year})]}):e.jsxs("div",{className:"method-source-link is-static",children:[e.jsx("span",{className:"method-source-title",children:a.source_title}),a.introduced_year&&e.jsx("span",{className:"method-source-meta",children:a.introduced_year})]})]}),e.jsxs("div",{className:"tag-hero-meta",children:[e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Papers mentioning"}),e.jsx("span",{className:"value",children:(a.paper_count??0).toLocaleString()})]}),m.data&&e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Recent mentions"}),e.jsx("span",{className:"value",children:m.data.comparison_complete?e.jsxs(e.Fragment,{children:[m.data.trend_score.toFixed(1),e.jsx("small",{children:"/mo"})]}):"Pending"})]}),a.introduced_year!=null&&e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Introduced"}),e.jsx("span",{className:"value",children:a.introduced_year})]})]}),m.isLoading?e.jsx(A,{className:"h-36 w-full method-trend-skeleton"}):m.data?e.jsxs("section",{className:"method-trend-panel method-trend-panel--compact",children:[e.jsxs("div",{className:"method-trend-header",children:[e.jsx("div",{children:e.jsx("div",{className:"method-trend-eyebrow",children:"Usage trend"})}),e.jsxs("div",{className:"method-trend-summary",children:[e.jsx("strong",{children:m.data.recent_paper_count}),e.jsxs("span",{children:["papers / ",m.data.recent_days,"d"]})]})]}),e.jsx(je,{history:m.data.history,methodName:a.name})]}):null]}),e.jsxs("figure",{className:"method-figure-card",children:[e.jsx(ue,{method:a}),a.image_credit&&e.jsx("figcaption",{children:e.jsx(O,{className:"method-image-credit",text:a.image_credit})})]})]}),(((R=p.data)==null?void 0:R.length)??0)>0&&e.jsxs("div",{className:"filter-row",children:[e.jsx("span",{className:"label",children:"Related methods"}),p.data.map(r=>e.jsx(Y,{method:{slug:r.slug,name:r.name}},r.id))]}),e.jsxs("div",{className:"sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:_e.map(([r,d])=>e.jsx("button",{className:`sort-btn ${l===r?"active":""}`,onClick:()=>f(r),children:d},r))}),e.jsx(te,{hasCode:g,hasHfArtifacts:u,onHasCodeChange:c,onHasHfArtifactsChange:_})]}),e.jsxs("div",{className:"results-count",children:[v.length," papers mentioning ",a.name]})]}),i.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((r,d)=>e.jsx(A,{className:"h-40 w-full"},d))}):v.length===0?e.jsx("div",{className:"no-results",children:"No papers tagged with this method yet."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:v.map((r,d)=>e.jsx(J,{paper:r,rank:d+1},r.id))}),e.jsx("div",{ref:w,style:{height:1}}),i.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]})]})};export{ze as default}; diff --git a/assets/MethodsIndexView-ooJqtLOL.js b/assets/MethodsIndexView-geijTR_Z.js similarity index 87% rename from assets/MethodsIndexView-ooJqtLOL.js rename to assets/MethodsIndexView-geijTR_Z.js index 6249d6823e7b543a4d3cea7686e7000b328532da..091a0d14ce1e048d5265da09d5bcf14423bade10 100644 --- a/assets/MethodsIndexView-ooJqtLOL.js +++ b/assets/MethodsIndexView-geijTR_Z.js @@ -1,4 +1,4 @@ -import{c as g,r as d,j as e,L as f}from"./index-BrhBTT14.js";import{u as m}from"./useQuery-GhY2LXSI.js";import{c as h}from"./catalog-CkpmYxEk.js";import{s as j}from"./slug-BpH-Nkvz.js";import{S as p}from"./skeleton-DHdzoBmM.js";import{A as y,a as v}from"./alert-c1n3ZtEC.js";import{T as _}from"./TaxonomySuggestionTile-BkE17zPJ.js";import"./SignInToEditDialog-Dcu4wTOX.js";import"./button-CusGeqPB.js";import"./textarea-D6mDqvzM.js";import"./dialog-BhRZv4T5.js";import"./useMutation-DqfuSW7Q.js";import"./submissions-C1hG3qlt.js";import"./loader-circle-BqZ1qbXL.js";/** +import{d as g,r as d,j as e,L as f}from"./index-D_-UZEuL.js";import{u as m}from"./useQuery-BZo4MZ3s.js";import{c as h}from"./catalog-CjU2vAfw.js";import{s as j}from"./slug-BpH-Nkvz.js";import{S as p}from"./skeleton-CCZ1iXls.js";import{A as y,a as v}from"./alert-B2j1kc2o.js";import{T as _}from"./TaxonomySuggestionTile-DgDd6ghr.js";import"./SignInToEditDialog-DZLQNGaN.js";import"./button-Cc8PFtC1.js";import"./textarea-DlQmtN_E.js";import"./dialog-ChaQ5z93.js";import"./useMutation-P0Dg96Vh.js";import"./submissions-BpzsA2lc.js";import"./loader-circle-D1SscQUT.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/NotFound-CksCbtS8.js b/assets/NotFound--BkOSvuh.js similarity index 89% rename from assets/NotFound-CksCbtS8.js rename to assets/NotFound--BkOSvuh.js index 91fd36c9e9cc0be0c170b8c0134fa1b171296a4e..12ba6c34d65472cd964c6b022aaeffbdec9b59fd 100644 --- a/assets/NotFound-CksCbtS8.js +++ b/assets/NotFound--BkOSvuh.js @@ -1 +1 @@ -import{au as o,r as a,j as t,L as s}from"./index-BrhBTT14.js";const r=()=>{const e=o();return a.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),t.jsxs("div",{className:"page",style:{textAlign:"center",paddingTop:96},children:[t.jsx("h1",{className:"detail-title",style:{fontSize:96,marginBottom:8},children:"404"}),t.jsx("p",{style:{fontFamily:"var(--serif)",fontStyle:"italic",color:"var(--ink-soft)",marginBottom:24},children:"That route isn't on the map."}),t.jsx(s,{to:"/",className:"action-btn",children:"Return home"})]})};export{r as default}; +import{az as o,r as a,j as t,L as s}from"./index-D_-UZEuL.js";const r=()=>{const e=o();return a.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),t.jsxs("div",{className:"page",style:{textAlign:"center",paddingTop:96},children:[t.jsx("h1",{className:"detail-title",style:{fontSize:96,marginBottom:8},children:"404"}),t.jsx("p",{style:{fontFamily:"var(--serif)",fontStyle:"italic",color:"var(--ink-soft)",marginBottom:24},children:"That route isn't on the map."}),t.jsx(s,{to:"/",className:"action-btn",children:"Return home"})]})};export{r as default}; diff --git a/assets/OrganizationContributionGraph-0Wm7L2tv.js b/assets/OrganizationContributionGraph-BroNa3f8.js similarity index 94% rename from assets/OrganizationContributionGraph-0Wm7L2tv.js rename to assets/OrganizationContributionGraph-BroNa3f8.js index 7b9feeffbc0169a0ebd2f1318bbc13abf6c4e2e3..66d2d5411ed4096d50116ddf1b8ccf0a39f3dc66 100644 --- a/assets/OrganizationContributionGraph-0Wm7L2tv.js +++ b/assets/OrganizationContributionGraph-BroNa3f8.js @@ -1 +1 @@ -import{r as b,j as o}from"./index-BrhBTT14.js";import{u as z}from"./useQuery-GhY2LXSI.js";import{S as T}from"./skeleton-DHdzoBmM.js";import{c as w}from"./catalog-CkpmYxEk.js";const x=24*60*60*1e3,f=12,y=3,v=new Map([[1,"Mon"],[3,"Wed"],[5,"Fri"]]),$=n=>new Date(`${n}T00:00:00Z`),N=n=>n.toISOString().slice(0,10),_=(n,r)=>{if(n===0)return 0;const i=r.findIndex(s=>n<=s);return i===-1?4:i+1},D=n=>{const r=$(n.start_date),i=$(n.end_date),s=new Date(r.getTime()-r.getUTCDay()*x),h=new Date(i.getTime()+(6-i.getUTCDay())*x),p=new Map(n.results.map(e=>[e.date,e.paper_count])),u=n.results.map(e=>e.paper_count).sort((e,m)=>e-m),c=[.25,.5,.75].map(e=>u[Math.min(u.length-1,Math.floor(u.length*e))]??1),l=[];for(let e=s.getTime();e<=h.getTime();e+=x){const m=new Date(e),d=N(m),g=e>=r.getTime()&&e<=i.getTime(),C=g?p.get(d)??0:0;l.push({key:d,date:m,count:C,inRange:g,level:_(C,c)})}const t=l.length/7,a=[];let j=-1;for(let e=0;eg.inRange&&(e===0||g.date.getUTCDate()<=7));d&&d.date.getUTCMonth()!==j&&(j=d.date.getUTCMonth(),a.length>0&&e-a[a.length-1].column<3&&a.pop(),a.push({label:d.date.toLocaleString("en",{month:"short",timeZone:"UTC"}),column:e}))}return{days:l,months:a,weekCount:t}},L=({data:n,organizationName:r,title:i="Paper contributions",noun:s="paper"})=>{const h=b.useRef(null),{days:p,months:u,weekCount:c}=b.useMemo(()=>D(n),[n]),l=c*f+(c-1)*y;return b.useEffect(()=>{const t=h.current;t&&(t.scrollLeft=t.scrollWidth)},[c]),o.jsxs("section",{className:"organization-contributions","aria-labelledby":"organization-contributions-title",children:[o.jsxs("div",{className:"organization-contributions-header",children:[o.jsx("h2",{id:"organization-contributions-title",className:"organization-contributions-title",children:i}),o.jsxs("p",{className:"organization-contributions-summary",children:[n.total_count.toLocaleString()," ",n.total_count===1?s:`${s}s`," recorded in the last year"]})]}),o.jsx("div",{className:"organization-contributions-scroll",ref:h,children:o.jsxs("div",{className:"organization-contributions-plot",style:{width:l+34},role:"img","aria-label":`${r} recorded ${n.total_count} ${n.total_count===1?s:`${s}s`} in the last year`,children:[o.jsx("div",{className:"organization-contributions-weekdays","aria-hidden":"true",children:Array.from({length:7}).map((t,a)=>o.jsx("span",{children:v.get(a)??""},a))}),o.jsxs("div",{children:[o.jsx("div",{className:"organization-contributions-months",style:{width:l,gridTemplateColumns:`repeat(${c}, ${f}px)`},"aria-hidden":"true",children:u.map(t=>o.jsx("span",{style:{gridColumnStart:t.column+1},children:t.label},`${t.label}-${t.column}`))}),o.jsx("div",{className:"organization-contributions-grid",style:{width:l,gridTemplateColumns:`repeat(${c}, ${f}px)`},"aria-hidden":"true",children:p.map(t=>o.jsx("span",{className:`organization-contribution-cell ${t.inRange?`level-${t.level}`:"is-outside"}`,title:t.inRange?`${t.count} ${t.count===1?s:`${s}s`} on ${t.date.toLocaleDateString("en",{dateStyle:"long",timeZone:"UTC"})}`:void 0},t.key))})]})]})}),o.jsxs("div",{className:"organization-contributions-legend","aria-hidden":"true",children:[o.jsx("span",{children:"Fewer"}),[0,1,2,3,4].map(t=>o.jsx("span",{className:`organization-contribution-cell level-${t}`},t)),o.jsx("span",{children:"More"})]})]})},A=({organizationSlug:n,organizationName:r})=>{const i=z({queryKey:["organization-contributions",n],queryFn:()=>w.organizationContributions(n),staleTime:6e5});return i.isLoading?o.jsx(T,{className:"organization-contributions-skeleton"}):i.data?o.jsx(L,{data:i.data,organizationName:r}):null};export{L as C,A as O}; +import{r as b,j as o}from"./index-D_-UZEuL.js";import{u as z}from"./useQuery-BZo4MZ3s.js";import{S as T}from"./skeleton-CCZ1iXls.js";import{c as w}from"./catalog-CjU2vAfw.js";const x=24*60*60*1e3,f=12,y=3,v=new Map([[1,"Mon"],[3,"Wed"],[5,"Fri"]]),$=n=>new Date(`${n}T00:00:00Z`),N=n=>n.toISOString().slice(0,10),_=(n,r)=>{if(n===0)return 0;const i=r.findIndex(s=>n<=s);return i===-1?4:i+1},D=n=>{const r=$(n.start_date),i=$(n.end_date),s=new Date(r.getTime()-r.getUTCDay()*x),h=new Date(i.getTime()+(6-i.getUTCDay())*x),p=new Map(n.results.map(e=>[e.date,e.paper_count])),u=n.results.map(e=>e.paper_count).sort((e,m)=>e-m),c=[.25,.5,.75].map(e=>u[Math.min(u.length-1,Math.floor(u.length*e))]??1),l=[];for(let e=s.getTime();e<=h.getTime();e+=x){const m=new Date(e),d=N(m),g=e>=r.getTime()&&e<=i.getTime(),C=g?p.get(d)??0:0;l.push({key:d,date:m,count:C,inRange:g,level:_(C,c)})}const t=l.length/7,a=[];let j=-1;for(let e=0;eg.inRange&&(e===0||g.date.getUTCDate()<=7));d&&d.date.getUTCMonth()!==j&&(j=d.date.getUTCMonth(),a.length>0&&e-a[a.length-1].column<3&&a.pop(),a.push({label:d.date.toLocaleString("en",{month:"short",timeZone:"UTC"}),column:e}))}return{days:l,months:a,weekCount:t}},L=({data:n,organizationName:r,title:i="Paper contributions",noun:s="paper"})=>{const h=b.useRef(null),{days:p,months:u,weekCount:c}=b.useMemo(()=>D(n),[n]),l=c*f+(c-1)*y;return b.useEffect(()=>{const t=h.current;t&&(t.scrollLeft=t.scrollWidth)},[c]),o.jsxs("section",{className:"organization-contributions","aria-labelledby":"organization-contributions-title",children:[o.jsxs("div",{className:"organization-contributions-header",children:[o.jsx("h2",{id:"organization-contributions-title",className:"organization-contributions-title",children:i}),o.jsxs("p",{className:"organization-contributions-summary",children:[n.total_count.toLocaleString()," ",n.total_count===1?s:`${s}s`," recorded in the last year"]})]}),o.jsx("div",{className:"organization-contributions-scroll",ref:h,children:o.jsxs("div",{className:"organization-contributions-plot",style:{width:l+34},role:"img","aria-label":`${r} recorded ${n.total_count} ${n.total_count===1?s:`${s}s`} in the last year`,children:[o.jsx("div",{className:"organization-contributions-weekdays","aria-hidden":"true",children:Array.from({length:7}).map((t,a)=>o.jsx("span",{children:v.get(a)??""},a))}),o.jsxs("div",{children:[o.jsx("div",{className:"organization-contributions-months",style:{width:l,gridTemplateColumns:`repeat(${c}, ${f}px)`},"aria-hidden":"true",children:u.map(t=>o.jsx("span",{style:{gridColumnStart:t.column+1},children:t.label},`${t.label}-${t.column}`))}),o.jsx("div",{className:"organization-contributions-grid",style:{width:l,gridTemplateColumns:`repeat(${c}, ${f}px)`},"aria-hidden":"true",children:p.map(t=>o.jsx("span",{className:`organization-contribution-cell ${t.inRange?`level-${t.level}`:"is-outside"}`,title:t.inRange?`${t.count} ${t.count===1?s:`${s}s`} on ${t.date.toLocaleDateString("en",{dateStyle:"long",timeZone:"UTC"})}`:void 0},t.key))})]})]})}),o.jsxs("div",{className:"organization-contributions-legend","aria-hidden":"true",children:[o.jsx("span",{children:"Fewer"}),[0,1,2,3,4].map(t=>o.jsx("span",{className:`organization-contribution-cell level-${t}`},t)),o.jsx("span",{children:"More"})]})]})},A=({organizationSlug:n,organizationName:r})=>{const i=z({queryKey:["organization-contributions",n],queryFn:()=>w.organizationContributions(n),staleTime:6e5});return i.isLoading?o.jsx(T,{className:"organization-contributions-skeleton"}):i.data?o.jsx(L,{data:i.data,organizationName:r}):null};export{L as C,A as O}; diff --git a/assets/OrganizationDetailView-7XdyiyeW.js b/assets/OrganizationDetailView-7XdyiyeW.js deleted file mode 100644 index 3c98f768905f8931c4e3c6c35e396e20a276f0b5..0000000000000000000000000000000000000000 --- a/assets/OrganizationDetailView-7XdyiyeW.js +++ /dev/null @@ -1 +0,0 @@ -import{e as t,j as r}from"./index-BrhBTT14.js";import{O as i}from"./OrganizationPaperFeed-BFjRG1j0.js";import m from"./NotFound-CksCbtS8.js";import"./useQuery-GhY2LXSI.js";import"./components-74u_bIKK.js";import"./LatexTitle-BJSVMlZ1.js";import"./katex.min-BSBacQyE.js";import"./transform-Duf4Shfn.js";import"./papers-DBaPliAp.js";import"./safeExternalHref-CkBrsh84.js";import"./MarkdownText-CNM4Jz9h.js";import"./PaperPreviewLink-BCdZ9yj3.js";import"./index-BLqBUiom.js";import"./hover-card-BcKGA4Et.js";import"./OrganizationContributionGraph-0Wm7L2tv.js";import"./skeleton-DHdzoBmM.js";import"./catalog-CkpmYxEk.js";import"./useIntersectionObserver-Lj6hnXj6.js";import"./alert-c1n3ZtEC.js";import"./searchable-select-7qMDVvfT.js";import"./button-CusGeqPB.js";import"./dialog-BhRZv4T5.js";import"./loader-circle-BqZ1qbXL.js";import"./usePapers-C1lfz0oo.js";import"./useInfiniteQuery-bETtM5yS.js";const h=()=>{const{orgSlug:o}=t();return o?r.jsx(i,{organizationSlug:o}):r.jsx(m,{})};export{h as default}; diff --git a/assets/OrganizationDetailView-B70eYNbJ.js b/assets/OrganizationDetailView-B70eYNbJ.js new file mode 100644 index 0000000000000000000000000000000000000000..9064f153d41e7950509e0dd2c964c87cacd3ecf5 --- /dev/null +++ b/assets/OrganizationDetailView-B70eYNbJ.js @@ -0,0 +1 @@ +import{c as t,j as r}from"./index-D_-UZEuL.js";import{O as i}from"./OrganizationPaperFeed-F7htGhMz.js";import m from"./NotFound--BkOSvuh.js";import"./useQuery-BZo4MZ3s.js";import"./components-CmC5jqhM.js";import"./LatexTitle-B7GPgo8C.js";import"./katex.min-BSBacQyE.js";import"./transform-CUuA-koJ.js";import"./papers-DHqjKX7p.js";import"./safeExternalHref-CkBrsh84.js";import"./MarkdownText-QvkQ9FeM.js";import"./PaperPreviewLink-B25cD-_k.js";import"./index-vCOH2DKd.js";import"./hover-card-DiJQFgx9.js";import"./OrganizationContributionGraph-BroNa3f8.js";import"./skeleton-CCZ1iXls.js";import"./catalog-CjU2vAfw.js";import"./useIntersectionObserver-Cq9n7uOQ.js";import"./alert-B2j1kc2o.js";import"./searchable-select-Dmf1cwUh.js";import"./button-Cc8PFtC1.js";import"./dialog-ChaQ5z93.js";import"./loader-circle-D1SscQUT.js";import"./usePapers-BCHtBW8G.js";import"./useInfiniteQuery-CFUEkcEs.js";const h=()=>{const{orgSlug:o}=t();return o?r.jsx(i,{organizationSlug:o}):r.jsx(m,{})};export{h as default}; diff --git a/assets/OrganizationPaperFeed-BFjRG1j0.js b/assets/OrganizationPaperFeed-F7htGhMz.js similarity index 89% rename from assets/OrganizationPaperFeed-BFjRG1j0.js rename to assets/OrganizationPaperFeed-F7htGhMz.js index c4b89cf00749bc2f4a8a77ae342c6cfd1c5a236c..29ec4d75f2cc9bc0eb91c581f23d0dc91ceb3507 100644 --- a/assets/OrganizationPaperFeed-BFjRG1j0.js +++ b/assets/OrganizationPaperFeed-F7htGhMz.js @@ -1 +1 @@ -import{u as E,a as Q,r as d,j as e,L as w}from"./index-BrhBTT14.js";import{u as A}from"./useQuery-GhY2LXSI.js";import{P as U}from"./components-74u_bIKK.js";import{M as B}from"./MarkdownText-CNM4Jz9h.js";import{O as G}from"./OrganizationContributionGraph-0Wm7L2tv.js";import{u as K,P as W}from"./useIntersectionObserver-Lj6hnXj6.js";import{A as D,a as Z}from"./alert-c1n3ZtEC.js";import{S as z}from"./searchable-select-7qMDVvfT.js";import{S as C}from"./skeleton-DHdzoBmM.js";import{d as J}from"./usePapers-C1lfz0oo.js";import{c as $}from"./catalog-CkpmYxEk.js";import{d as T,t as V}from"./transform-Duf4Shfn.js";import X from"./NotFound-CksCbtS8.js";const Y=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]],ee=n=>n==="date_published"||n==="citation_count"?n:"trending",ue=({organizationSlug:n,taskSlug:p})=>{var N,y,v,P,L,F,k,O;const I=E(),[l,h]=Q(),[M,m]=d.useState(!1),u=ee(l.get("order_by")),g=l.get("has_code")==="true",f=l.get("has_hf_artifacts")==="true",_=A({queryKey:["organization",n],queryFn:()=>$.getOrganization(n),staleTime:10*60*1e3}),c=A({queryKey:["organization-areas-with-tasks",n],queryFn:()=>$.organizationAreasWithTasks(n),staleTime:10*60*1e3}),i=J({organizationSlug:n,taskSlug:p,page_size:12,order_by:u,order_dir:"desc",include_resources:!0,has_code:g,has_hf_artifacts:f,enabled:!!n}),{targetRef:H,isIntersecting:x}=K({rootMargin:"200px"});d.useEffect(()=>{x&&i.hasNextPage&&!i.isFetchingNextPage&&i.fetchNextPage()},[x,i.hasNextPage,i.isFetchingNextPage]),d.useEffect(()=>{m(!1)},[n,p]);const j=d.useMemo(()=>{var a;return(((a=c.data)==null?void 0:a.results)??[]).flatMap(r=>r.tasks.filter(t=>!!t.slug).map(t=>({...t,slug:t.slug,label:T(t.name,t.slug)})))},[c.data]),o=j.find(a=>a.slug===p),b=d.useMemo(()=>{var a;return(((a=i.data)==null?void 0:a.pages)??[]).flatMap(r=>r.results.map(V))},[i.data]),s=_.data??((N=c.data)==null?void 0:N.organization),R=((v=(y=i.data)==null?void 0:y.pages[0])==null?void 0:v.count)??0;if(((P=_.error)==null?void 0:P.status)===404||((L=c.error)==null?void 0:L.status)===404||((F=i.error)==null?void 0:F.status)===404)return e.jsx(X,{});if(c.error||i.error)return e.jsx("div",{className:"page",children:e.jsx(D,{variant:"destructive",children:e.jsx(Z,{children:"Failed to load organization papers. Please try again."})})});const S=a=>{const r=a.trim().toLocaleLowerCase();return j.filter(t=>`${t.label} ${t.slug}`.toLocaleLowerCase().includes(r)).map(t=>({value:t.slug,label:t.label,description:`${t.paper_count.toLocaleString()} ${t.paper_count===1?"paper":"papers"}`}))},q=a=>{const r=a==="__all__"?`/orgs/${n}`:`/orgs/${n}/${a}`,t=l.toString();I({pathname:r,search:t?`?${t}`:""})};return e.jsxs("div",{className:"page",children:[e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(w,{to:"/",children:"Home"}),e.jsx("span",{children:" / "}),e.jsx(w,{to:"/organizations",children:"Organizations"}),e.jsx("span",{children:" / "}),e.jsx("span",{children:(s==null?void 0:s.name)??n}),o&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:" / "}),e.jsx("span",{children:T(o.name,o.slug)})]})]}),e.jsxs("header",{className:"organization-hero",children:[e.jsxs("div",{className:"organization-hero-profile",children:[e.jsx("div",{className:"organizations-eyebrow",children:"ORGANIZATION"}),e.jsxs("h1",{className:"feed-title organization-hero-title",children:[s!=null&&s.logo_url&&!M?e.jsx("img",{src:s.logo_url,alt:"",width:58,height:58,onError:()=>m(!0)}):s?e.jsx("span",{className:"organization-logo organization-logo--fallback","aria-hidden":"true",children:s.name.slice(0,1).toUpperCase()}):null,(s==null?void 0:s.name)??e.jsx(C,{className:"h-12 w-64"})]}),s&&e.jsxs("div",{className:"feed-subtitle",children:[((k=s.paper_count)==null?void 0:k.toLocaleString())??0," papers",(s.organization_trending_score??0)>0&&s.trending_rank&&e.jsxs(e.Fragment,{children:[" · #",s.trending_rank," trending this month"]})]}),(s==null?void 0:s.description)&&e.jsx(B,{className:"method-description",text:s.description}),s&&e.jsxs("div",{className:"organization-hero-links",children:[s.website_url&&e.jsx("a",{href:s.website_url,target:"_blank",rel:"noreferrer",children:"Website ↗"}),s.hf_url&&e.jsx("a",{href:s.hf_url,target:"_blank",rel:"noreferrer",children:"Hugging Face ↗"}),s.github_url&&e.jsx("a",{href:s.github_url,target:"_blank",rel:"noreferrer",children:"GitHub ↗"})]})]}),s&&e.jsx(G,{organizationSlug:n,organizationName:s.name})]}),e.jsxs("div",{className:"sort-bar",style:{alignItems:"center",gap:16},children:[e.jsx("div",{style:{minWidth:260},children:e.jsx(z,{value:p??"__all__",onChange:q,placeholder:"All tasks",searchPlaceholder:"Search organization tasks...",emptyMessage:"No matching tasks.",ariaLabel:"Filter papers by task",selectedOption:o?{value:o.slug,label:o.label,description:`${o.paper_count.toLocaleString()} ${o.paper_count===1?"paper":"papers"}`}:{value:"__all__",label:"All tasks",description:`${((O=s==null?void 0:s.paper_count)==null?void 0:O.toLocaleString())??0} papers`},queryKey:["organization-task-options",n],queryFn:async a=>{var r;return[{value:"__all__",label:"All tasks",description:`${((r=s==null?void 0:s.paper_count)==null?void 0:r.toLocaleString())??0} papers`},...S(a)]},enabled:!c.isLoading,className:"h-[38px]"})}),e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:Y.map(([a,r])=>e.jsx("button",{type:"button",className:`sort-btn ${u===a?"active":""}`,onClick:()=>{const t=new URLSearchParams(l);a==="trending"?t.delete("order_by"):t.set("order_by",a),h(t)},children:r},a))}),e.jsx(W,{hasCode:g,hasHfArtifacts:f,onHasCodeChange:a=>{const r=new URLSearchParams(l);a?r.set("has_code","true"):r.delete("has_code"),h(r)},onHasHfArtifactsChange:a=>{const r=new URLSearchParams(l);a?r.set("has_hf_artifacts","true"):r.delete("has_hf_artifacts"),h(r)}})]}),e.jsxs("div",{className:"results-count",children:[R.toLocaleString()," papers"]})]}),i.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((a,r)=>e.jsx(C,{className:"h-40 w-full"},r))}):b.length===0?e.jsx("div",{className:"no-results",children:(s==null?void 0:s.paper_count)===0?"No papers indexed yet":"No papers found for this selection."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:b.map((a,r)=>e.jsx(U,{paper:a,rank:r+1,showInstitution:!1},a.id))}),e.jsx("div",{ref:H,style:{height:1}}),i.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center"},children:"Loading more…"})]})]})};export{ue as O}; +import{u as E,a as Q,r as d,j as e,L as w}from"./index-D_-UZEuL.js";import{u as A}from"./useQuery-BZo4MZ3s.js";import{P as U}from"./components-CmC5jqhM.js";import{M as B}from"./MarkdownText-QvkQ9FeM.js";import{O as G}from"./OrganizationContributionGraph-BroNa3f8.js";import{u as K,P as W}from"./useIntersectionObserver-Cq9n7uOQ.js";import{A as D,a as Z}from"./alert-B2j1kc2o.js";import{S as z}from"./searchable-select-Dmf1cwUh.js";import{S as C}from"./skeleton-CCZ1iXls.js";import{d as J}from"./usePapers-BCHtBW8G.js";import{c as $}from"./catalog-CjU2vAfw.js";import{d as T,t as V}from"./transform-CUuA-koJ.js";import X from"./NotFound--BkOSvuh.js";const Y=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]],ee=n=>n==="date_published"||n==="citation_count"?n:"trending",ue=({organizationSlug:n,taskSlug:p})=>{var N,y,v,P,L,F,k,O;const I=E(),[l,h]=Q(),[M,m]=d.useState(!1),u=ee(l.get("order_by")),g=l.get("has_code")==="true",f=l.get("has_hf_artifacts")==="true",_=A({queryKey:["organization",n],queryFn:()=>$.getOrganization(n),staleTime:10*60*1e3}),c=A({queryKey:["organization-areas-with-tasks",n],queryFn:()=>$.organizationAreasWithTasks(n),staleTime:10*60*1e3}),i=J({organizationSlug:n,taskSlug:p,page_size:12,order_by:u,order_dir:"desc",include_resources:!0,has_code:g,has_hf_artifacts:f,enabled:!!n}),{targetRef:H,isIntersecting:x}=K({rootMargin:"200px"});d.useEffect(()=>{x&&i.hasNextPage&&!i.isFetchingNextPage&&i.fetchNextPage()},[x,i.hasNextPage,i.isFetchingNextPage]),d.useEffect(()=>{m(!1)},[n,p]);const j=d.useMemo(()=>{var a;return(((a=c.data)==null?void 0:a.results)??[]).flatMap(r=>r.tasks.filter(t=>!!t.slug).map(t=>({...t,slug:t.slug,label:T(t.name,t.slug)})))},[c.data]),o=j.find(a=>a.slug===p),b=d.useMemo(()=>{var a;return(((a=i.data)==null?void 0:a.pages)??[]).flatMap(r=>r.results.map(V))},[i.data]),s=_.data??((N=c.data)==null?void 0:N.organization),R=((v=(y=i.data)==null?void 0:y.pages[0])==null?void 0:v.count)??0;if(((P=_.error)==null?void 0:P.status)===404||((L=c.error)==null?void 0:L.status)===404||((F=i.error)==null?void 0:F.status)===404)return e.jsx(X,{});if(c.error||i.error)return e.jsx("div",{className:"page",children:e.jsx(D,{variant:"destructive",children:e.jsx(Z,{children:"Failed to load organization papers. Please try again."})})});const S=a=>{const r=a.trim().toLocaleLowerCase();return j.filter(t=>`${t.label} ${t.slug}`.toLocaleLowerCase().includes(r)).map(t=>({value:t.slug,label:t.label,description:`${t.paper_count.toLocaleString()} ${t.paper_count===1?"paper":"papers"}`}))},q=a=>{const r=a==="__all__"?`/orgs/${n}`:`/orgs/${n}/${a}`,t=l.toString();I({pathname:r,search:t?`?${t}`:""})};return e.jsxs("div",{className:"page",children:[e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(w,{to:"/",children:"Home"}),e.jsx("span",{children:" / "}),e.jsx(w,{to:"/organizations",children:"Organizations"}),e.jsx("span",{children:" / "}),e.jsx("span",{children:(s==null?void 0:s.name)??n}),o&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:" / "}),e.jsx("span",{children:T(o.name,o.slug)})]})]}),e.jsxs("header",{className:"organization-hero",children:[e.jsxs("div",{className:"organization-hero-profile",children:[e.jsx("div",{className:"organizations-eyebrow",children:"ORGANIZATION"}),e.jsxs("h1",{className:"feed-title organization-hero-title",children:[s!=null&&s.logo_url&&!M?e.jsx("img",{src:s.logo_url,alt:"",width:58,height:58,onError:()=>m(!0)}):s?e.jsx("span",{className:"organization-logo organization-logo--fallback","aria-hidden":"true",children:s.name.slice(0,1).toUpperCase()}):null,(s==null?void 0:s.name)??e.jsx(C,{className:"h-12 w-64"})]}),s&&e.jsxs("div",{className:"feed-subtitle",children:[((k=s.paper_count)==null?void 0:k.toLocaleString())??0," papers",(s.organization_trending_score??0)>0&&s.trending_rank&&e.jsxs(e.Fragment,{children:[" · #",s.trending_rank," trending this month"]})]}),(s==null?void 0:s.description)&&e.jsx(B,{className:"method-description",text:s.description}),s&&e.jsxs("div",{className:"organization-hero-links",children:[s.website_url&&e.jsx("a",{href:s.website_url,target:"_blank",rel:"noreferrer",children:"Website ↗"}),s.hf_url&&e.jsx("a",{href:s.hf_url,target:"_blank",rel:"noreferrer",children:"Hugging Face ↗"}),s.github_url&&e.jsx("a",{href:s.github_url,target:"_blank",rel:"noreferrer",children:"GitHub ↗"})]})]}),s&&e.jsx(G,{organizationSlug:n,organizationName:s.name})]}),e.jsxs("div",{className:"sort-bar",style:{alignItems:"center",gap:16},children:[e.jsx("div",{style:{minWidth:260},children:e.jsx(z,{value:p??"__all__",onChange:q,placeholder:"All tasks",searchPlaceholder:"Search organization tasks...",emptyMessage:"No matching tasks.",ariaLabel:"Filter papers by task",selectedOption:o?{value:o.slug,label:o.label,description:`${o.paper_count.toLocaleString()} ${o.paper_count===1?"paper":"papers"}`}:{value:"__all__",label:"All tasks",description:`${((O=s==null?void 0:s.paper_count)==null?void 0:O.toLocaleString())??0} papers`},queryKey:["organization-task-options",n],queryFn:async a=>{var r;return[{value:"__all__",label:"All tasks",description:`${((r=s==null?void 0:s.paper_count)==null?void 0:r.toLocaleString())??0} papers`},...S(a)]},enabled:!c.isLoading,className:"h-[38px]"})}),e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:Y.map(([a,r])=>e.jsx("button",{type:"button",className:`sort-btn ${u===a?"active":""}`,onClick:()=>{const t=new URLSearchParams(l);a==="trending"?t.delete("order_by"):t.set("order_by",a),h(t)},children:r},a))}),e.jsx(W,{hasCode:g,hasHfArtifacts:f,onHasCodeChange:a=>{const r=new URLSearchParams(l);a?r.set("has_code","true"):r.delete("has_code"),h(r)},onHasHfArtifactsChange:a=>{const r=new URLSearchParams(l);a?r.set("has_hf_artifacts","true"):r.delete("has_hf_artifacts"),h(r)}})]}),e.jsxs("div",{className:"results-count",children:[R.toLocaleString()," papers"]})]}),i.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((a,r)=>e.jsx(C,{className:"h-40 w-full"},r))}):b.length===0?e.jsx("div",{className:"no-results",children:(s==null?void 0:s.paper_count)===0?"No papers indexed yet":"No papers found for this selection."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:b.map((a,r)=>e.jsx(U,{paper:a,rank:r+1,showInstitution:!1},a.id))}),e.jsx("div",{ref:H,style:{height:1}}),i.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center"},children:"Loading more…"})]})]})};export{ue as O}; diff --git a/assets/OrganizationTaskView-DdRJ05b_.js b/assets/OrganizationTaskView-DdRJ05b_.js new file mode 100644 index 0000000000000000000000000000000000000000..1f516097bd34b393d499f683fce0597e8ddaa2ed --- /dev/null +++ b/assets/OrganizationTaskView-DdRJ05b_.js @@ -0,0 +1 @@ +import{c as i,j as t}from"./index-D_-UZEuL.js";import{O as m}from"./OrganizationPaperFeed-F7htGhMz.js";import p from"./NotFound--BkOSvuh.js";import"./useQuery-BZo4MZ3s.js";import"./components-CmC5jqhM.js";import"./LatexTitle-B7GPgo8C.js";import"./katex.min-BSBacQyE.js";import"./transform-CUuA-koJ.js";import"./papers-DHqjKX7p.js";import"./safeExternalHref-CkBrsh84.js";import"./MarkdownText-QvkQ9FeM.js";import"./PaperPreviewLink-B25cD-_k.js";import"./index-vCOH2DKd.js";import"./hover-card-DiJQFgx9.js";import"./OrganizationContributionGraph-BroNa3f8.js";import"./skeleton-CCZ1iXls.js";import"./catalog-CjU2vAfw.js";import"./useIntersectionObserver-Cq9n7uOQ.js";import"./alert-B2j1kc2o.js";import"./searchable-select-Dmf1cwUh.js";import"./button-Cc8PFtC1.js";import"./dialog-ChaQ5z93.js";import"./loader-circle-D1SscQUT.js";import"./usePapers-BCHtBW8G.js";import"./useInfiniteQuery-CFUEkcEs.js";const h=()=>{const{orgSlug:o,taskSlug:r}=i();return o&&r?t.jsx(m,{organizationSlug:o,taskSlug:r}):t.jsx(p,{})};export{h as default}; diff --git a/assets/OrganizationTaskView-LqFkQbPW.js b/assets/OrganizationTaskView-LqFkQbPW.js deleted file mode 100644 index 344419f22225cb231a9f7d71a272dc66fb8eef49..0000000000000000000000000000000000000000 --- a/assets/OrganizationTaskView-LqFkQbPW.js +++ /dev/null @@ -1 +0,0 @@ -import{e as i,j as t}from"./index-BrhBTT14.js";import{O as m}from"./OrganizationPaperFeed-BFjRG1j0.js";import p from"./NotFound-CksCbtS8.js";import"./useQuery-GhY2LXSI.js";import"./components-74u_bIKK.js";import"./LatexTitle-BJSVMlZ1.js";import"./katex.min-BSBacQyE.js";import"./transform-Duf4Shfn.js";import"./papers-DBaPliAp.js";import"./safeExternalHref-CkBrsh84.js";import"./MarkdownText-CNM4Jz9h.js";import"./PaperPreviewLink-BCdZ9yj3.js";import"./index-BLqBUiom.js";import"./hover-card-BcKGA4Et.js";import"./OrganizationContributionGraph-0Wm7L2tv.js";import"./skeleton-DHdzoBmM.js";import"./catalog-CkpmYxEk.js";import"./useIntersectionObserver-Lj6hnXj6.js";import"./alert-c1n3ZtEC.js";import"./searchable-select-7qMDVvfT.js";import"./button-CusGeqPB.js";import"./dialog-BhRZv4T5.js";import"./loader-circle-BqZ1qbXL.js";import"./usePapers-C1lfz0oo.js";import"./useInfiniteQuery-bETtM5yS.js";const h=()=>{const{orgSlug:o,taskSlug:r}=i();return o&&r?t.jsx(m,{organizationSlug:o,taskSlug:r}):t.jsx(p,{})};export{h as default}; diff --git a/assets/OrganizationsIndexView-CIxnPMcd.js b/assets/OrganizationsIndexView-wDeeuR4B.js similarity index 94% rename from assets/OrganizationsIndexView-CIxnPMcd.js rename to assets/OrganizationsIndexView-wDeeuR4B.js index eddea43328e454d39d991c898738a414233a59db..1fb9e7c3d0976201de6205ca25b0930798197110 100644 --- a/assets/OrganizationsIndexView-CIxnPMcd.js +++ b/assets/OrganizationsIndexView-wDeeuR4B.js @@ -1 +1 @@ -import{a as u,r as g,j as e,L as x}from"./index-BrhBTT14.js";import{u as j}from"./useQuery-GhY2LXSI.js";import{A as y,a as f}from"./alert-c1n3ZtEC.js";import{S as _}from"./skeleton-DHdzoBmM.js";import{c as N}from"./catalog-CkpmYxEk.js";const v=n=>n==="papers"||n==="name"?n:"trending",S=({organization:n})=>{const[d,t]=g.useState(!1);return!n.logo_url||d?e.jsx("span",{className:"organization-logo organization-logo--fallback","aria-hidden":"true",children:n.name.slice(0,1).toUpperCase()}):e.jsx("span",{className:"organization-logo",children:e.jsx("img",{src:n.logo_url,alt:"",width:48,height:48,onError:()=>t(!0)})})},A=()=>{var h;const[n,d]=u(),t=v(n.get("sort")),c=n.get("q")??"",o=j({queryKey:["organizations","featured"],queryFn:()=>N.organizations(!0),staleTime:10*60*1e3}),p=s=>{const a=new URLSearchParams(n),i=s.sort??t,r=s.query??c;i==="trending"?a.delete("sort"):a.set("sort",i),r.trim()?a.set("q",r):a.delete("q"),d(a)},m=g.useMemo(()=>{var i;const s=c.trim().toLocaleLowerCase(),a=(((i=o.data)==null?void 0:i.results)??[]).filter(r=>[r.name,r.slug,r.hf_slug??""].join(" ").toLocaleLowerCase().includes(s));return t==="papers"?[...a].sort((r,l)=>(l.paper_count??0)-(r.paper_count??0)||r.name.localeCompare(l.name)||r.slug.localeCompare(l.slug)):t==="name"?[...a].sort((r,l)=>r.name.localeCompare(l.name)||r.slug.localeCompare(l.slug)):a},[o.data,c,t]);return e.jsxs("div",{className:"page organizations-page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["AI ",e.jsx("em",{children:"Organizations"})]}),e.jsx("div",{className:"feed-subtitle",children:"Explore papers from 21 leading AI organizations, ranked by sustained community momentum over the past 30 days."})]})}),e.jsxs("section",{"aria-labelledby":"organizations-heading",children:[e.jsxs("div",{className:"organizations-section-heading",children:[e.jsxs("h2",{id:"organizations-heading",children:[((h=o.data)==null?void 0:h.count)??21," organizations"]}),e.jsx("span",{children:t==="trending"?"Ranked by 30-day momentum":t==="papers"?"Sorted by linked papers":"Sorted A–Z"})]}),e.jsxs("div",{className:"organizations-controls",children:[e.jsxs("label",{children:[e.jsx("span",{className:"sr-only",children:"Search organizations"}),e.jsx("input",{type:"search",value:c,onChange:s=>p({query:s.target.value}),placeholder:"Search organizations"})]}),e.jsx("div",{className:"organizations-sort","aria-label":"Sort organizations",children:[["trending","Trending"],["papers","Most papers"],["name","A–Z"]].map(([s,a])=>e.jsx("button",{type:"button",className:t===s?"active":"","aria-pressed":t===s,onClick:()=>p({sort:s}),children:a},s))})]}),o.isLoading?e.jsx("div",{className:"organizations-grid","aria-busy":"true",children:Array.from({length:6}).map((s,a)=>e.jsx(_,{className:"organization-card-skeleton"},a))}):o.error?e.jsx(y,{variant:"destructive",children:e.jsxs(f,{children:["Failed to load organizations."," ",e.jsx("button",{type:"button",onClick:()=>o.refetch(),children:"Try again"})]})}):m.length===0?e.jsxs("div",{className:"organizations-empty",children:["No organizations match “",c,"”."]}):e.jsx("div",{className:"organizations-grid",children:m.map(s=>{var r;const a=s.paper_count??0,i=s.first_paper_year&&s.latest_paper_year?s.first_paper_year===s.latest_paper_year?String(s.first_paper_year):`${s.first_paper_year}–${s.latest_paper_year}`:null;return e.jsxs(x,{to:`/orgs/${s.slug}`,className:"organization-card","aria-label":a?`Browse ${a.toLocaleString()} ${s.name} papers`:`Browse ${s.name} papers`,children:[e.jsxs("div",{className:"organization-card-header",children:[e.jsx(S,{organization:s}),e.jsxs("div",{children:[e.jsx("h3",{children:s.name}),e.jsxs("span",{children:["@",s.hf_slug??s.slug]})]})]}),e.jsxs("div",{className:"organization-card-metrics",children:[e.jsx("strong",{children:a.toLocaleString()}),e.jsx("span",{children:a===1?"paper":"papers"}),t==="trending"&&s.trending_rank&&e.jsxs("span",{className:"organization-rank",children:["#",s.trending_rank]})]}),e.jsxs("div",{className:"organization-highlight",children:[e.jsx("span",{children:"Trending paper"}),e.jsx("strong",{children:((r=s.top_trending_paper)==null?void 0:r.title)??"No papers indexed yet"})]}),e.jsxs("div",{className:"organization-card-footer",children:[i?`Publishing ${i}`:"Research archive ready",e.jsx("span",{"aria-hidden":"true",children:"↗"})]})]},s.id)})})]})]})};export{A as default}; +import{a as u,r as g,j as e,L as x}from"./index-D_-UZEuL.js";import{u as j}from"./useQuery-BZo4MZ3s.js";import{A as y,a as f}from"./alert-B2j1kc2o.js";import{S as _}from"./skeleton-CCZ1iXls.js";import{c as N}from"./catalog-CjU2vAfw.js";const v=n=>n==="papers"||n==="name"?n:"trending",S=({organization:n})=>{const[d,t]=g.useState(!1);return!n.logo_url||d?e.jsx("span",{className:"organization-logo organization-logo--fallback","aria-hidden":"true",children:n.name.slice(0,1).toUpperCase()}):e.jsx("span",{className:"organization-logo",children:e.jsx("img",{src:n.logo_url,alt:"",width:48,height:48,onError:()=>t(!0)})})},A=()=>{var h;const[n,d]=u(),t=v(n.get("sort")),c=n.get("q")??"",o=j({queryKey:["organizations","featured"],queryFn:()=>N.organizations(!0),staleTime:10*60*1e3}),p=s=>{const a=new URLSearchParams(n),i=s.sort??t,r=s.query??c;i==="trending"?a.delete("sort"):a.set("sort",i),r.trim()?a.set("q",r):a.delete("q"),d(a)},m=g.useMemo(()=>{var i;const s=c.trim().toLocaleLowerCase(),a=(((i=o.data)==null?void 0:i.results)??[]).filter(r=>[r.name,r.slug,r.hf_slug??""].join(" ").toLocaleLowerCase().includes(s));return t==="papers"?[...a].sort((r,l)=>(l.paper_count??0)-(r.paper_count??0)||r.name.localeCompare(l.name)||r.slug.localeCompare(l.slug)):t==="name"?[...a].sort((r,l)=>r.name.localeCompare(l.name)||r.slug.localeCompare(l.slug)):a},[o.data,c,t]);return e.jsxs("div",{className:"page organizations-page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["AI ",e.jsx("em",{children:"Organizations"})]}),e.jsx("div",{className:"feed-subtitle",children:"Explore papers from 21 leading AI organizations, ranked by sustained community momentum over the past 30 days."})]})}),e.jsxs("section",{"aria-labelledby":"organizations-heading",children:[e.jsxs("div",{className:"organizations-section-heading",children:[e.jsxs("h2",{id:"organizations-heading",children:[((h=o.data)==null?void 0:h.count)??21," organizations"]}),e.jsx("span",{children:t==="trending"?"Ranked by 30-day momentum":t==="papers"?"Sorted by linked papers":"Sorted A–Z"})]}),e.jsxs("div",{className:"organizations-controls",children:[e.jsxs("label",{children:[e.jsx("span",{className:"sr-only",children:"Search organizations"}),e.jsx("input",{type:"search",value:c,onChange:s=>p({query:s.target.value}),placeholder:"Search organizations"})]}),e.jsx("div",{className:"organizations-sort","aria-label":"Sort organizations",children:[["trending","Trending"],["papers","Most papers"],["name","A–Z"]].map(([s,a])=>e.jsx("button",{type:"button",className:t===s?"active":"","aria-pressed":t===s,onClick:()=>p({sort:s}),children:a},s))})]}),o.isLoading?e.jsx("div",{className:"organizations-grid","aria-busy":"true",children:Array.from({length:6}).map((s,a)=>e.jsx(_,{className:"organization-card-skeleton"},a))}):o.error?e.jsx(y,{variant:"destructive",children:e.jsxs(f,{children:["Failed to load organizations."," ",e.jsx("button",{type:"button",onClick:()=>o.refetch(),children:"Try again"})]})}):m.length===0?e.jsxs("div",{className:"organizations-empty",children:["No organizations match “",c,"”."]}):e.jsx("div",{className:"organizations-grid",children:m.map(s=>{var r;const a=s.paper_count??0,i=s.first_paper_year&&s.latest_paper_year?s.first_paper_year===s.latest_paper_year?String(s.first_paper_year):`${s.first_paper_year}–${s.latest_paper_year}`:null;return e.jsxs(x,{to:`/orgs/${s.slug}`,className:"organization-card","aria-label":a?`Browse ${a.toLocaleString()} ${s.name} papers`:`Browse ${s.name} papers`,children:[e.jsxs("div",{className:"organization-card-header",children:[e.jsx(S,{organization:s}),e.jsxs("div",{children:[e.jsx("h3",{children:s.name}),e.jsxs("span",{children:["@",s.hf_slug??s.slug]})]})]}),e.jsxs("div",{className:"organization-card-metrics",children:[e.jsx("strong",{children:a.toLocaleString()}),e.jsx("span",{children:a===1?"paper":"papers"}),t==="trending"&&s.trending_rank&&e.jsxs("span",{className:"organization-rank",children:["#",s.trending_rank]})]}),e.jsxs("div",{className:"organization-highlight",children:[e.jsx("span",{children:"Trending paper"}),e.jsx("strong",{children:((r=s.top_trending_paper)==null?void 0:r.title)??"No papers indexed yet"})]}),e.jsxs("div",{className:"organization-card-footer",children:[i?`Publishing ${i}`:"Research archive ready",e.jsx("span",{"aria-hidden":"true",children:"↗"})]})]},s.id)})})]})]})};export{A as default}; diff --git a/assets/PaperDetailView-DQZWeXKk.js b/assets/PaperDetailView-Dys6fQi8.js similarity index 63% rename from assets/PaperDetailView-DQZWeXKk.js rename to assets/PaperDetailView-Dys6fQi8.js index 69ed9e4539064c988e9e7d39827a71f96de23c32..4fd1bb980dff4fd1fd906219c3c989fe8da027ba 100644 --- a/assets/PaperDetailView-DQZWeXKk.js +++ b/assets/PaperDetailView-Dys6fQi8.js @@ -1,20 +1,20 @@ -import{c as mt,k as Es,u as Dt,d as te,l as Ss,r as p,j as e,g as le,C as me,P as Ht,m as ge,o as Mt,p as Se,q as Ce,s as zt,t as ht,v as Re,X as pt,L as de,w as Ps,x as Is,y as $s,I as As,z as qt,B as Rs,D as Fs,T as Ls,A as nt,f as Le,R as Fe,E as it,F as Kt,G as Ts,e as Us,H as Bs,J as Ds,K as Hs,M as Ms,N as zs}from"./index-BrhBTT14.js";import{I as G,T as qs,M as Ks,S as Os,a as Qs}from"./components-74u_bIKK.js";import{L as Ae,a as Gs}from"./LatexTitle-BJSVMlZ1.js";import{e as Te,C as Vs,E as Js}from"./ExternalSourceEvalBadge-CXYkyGiT.js";import{p as V}from"./papers-DBaPliAp.js";import{u as Z}from"./useQuery-GhY2LXSI.js";import{a as Xs}from"./usePapers-C1lfz0oo.js";import{f as Ws,D as Ys}from"./latexPlainText-DI8YEXVe.js";import{s as be}from"./safeExternalHref-CkBrsh84.js";import{s as Zs}from"./transform-Duf4Shfn.js";import{S as Ne}from"./skeleton-DHdzoBmM.js";import{A as ea,a as ta}from"./alert-c1n3ZtEC.js";import{B as D}from"./button-CusGeqPB.js";import{I as W}from"./textarea-D6mDqvzM.js";import{D as se,a as ae,b as re,c as ne,d as ie,e as oe}from"./dialog-BhRZv4T5.js";import{S as Et,a as Ee}from"./searchable-select-7qMDVvfT.js";import{u as ce}from"./useMutation-DqfuSW7Q.js";import{c as fe}from"./catalog-CkpmYxEk.js";import{s as he}from"./submissions-C1hG3qlt.js";import{P as Ue,S as ft,L as Y,a as sa}from"./SignInToEditDialog-Dcu4wTOX.js";import{L as ee}from"./loader-circle-BqZ1qbXL.js";import{D as aa,B as Ot,c as ra,g as na,s as ia,a as oa,b as la,d as ca,i as da,e as ua}from"./codexAddEvals-BzRfrE5R.js";import{u as Qt}from"./index-WJQaPd7m.js";import{n as Qe,g as St}from"./github-BtTCuUR0.js";import{G as Pt}from"./github-XgFsJJRC.js";import{M as ma,r as ha}from"./index-BLqBUiom.js";import{S as It,s as pa}from"./savedPapersAuth-D0oFR2zr.js";import"./katex.min-BSBacQyE.js";import"./hover-card-BcKGA4Et.js";import"./useInfiniteQuery-bETtM5yS.js";/** +import{d as ht,n as Es,u as Dt,e as te,f as Ss,r as p,j as e,g as ce,C as me,P as Ht,h as ge,k as Mt,l as Se,m as Ce,o as zt,p as pt,q as Re,X as ft,L as le,s as Ps,t as Is,R as $s,I as As,v as qt,w as Rs,x as Fs,T as Ls,A as it,y as Le,z as Fe,B as ot,D as Kt,E as Ts,c as Us,F as Bs,b as Ds,G as Hs,H as Ms,J as zs,K as qs,M as Ks}from"./index-D_-UZEuL.js";import{I as G,T as Os,M as Qs,S as Gs,a as Vs}from"./components-CmC5jqhM.js";import{L as Ae,a as Js}from"./LatexTitle-B7GPgo8C.js";import{e as Te,C as Xs,E as Ws}from"./ExternalSourceEvalBadge-25ezslre.js";import{p as V}from"./papers-DHqjKX7p.js";import{u as Z}from"./useQuery-BZo4MZ3s.js";import{a as Ys}from"./usePapers-BCHtBW8G.js";import{f as Zs,D as ea}from"./latexPlainText-DI8YEXVe.js";import{s as be}from"./safeExternalHref-CkBrsh84.js";import{s as ta}from"./transform-CUuA-koJ.js";import{S as Ne}from"./skeleton-CCZ1iXls.js";import{A as sa,a as aa}from"./alert-B2j1kc2o.js";import{B as D}from"./button-Cc8PFtC1.js";import{I as W}from"./textarea-DlQmtN_E.js";import{D as se,a as ae,b as re,c as ne,d as ie,e as oe}from"./dialog-ChaQ5z93.js";import{S as Et,a as Ee}from"./searchable-select-Dmf1cwUh.js";import{u as de}from"./useMutation-P0Dg96Vh.js";import{c as fe}from"./catalog-CjU2vAfw.js";import{s as he}from"./submissions-BpzsA2lc.js";import{P as Ue,S as gt,L as Y,a as ra}from"./SignInToEditDialog-DZLQNGaN.js";import{L as ee}from"./loader-circle-D1SscQUT.js";import{D as na,B as Ot,c as ia,g as oa,s as la,a as ca,b as da,d as ua,i as ma,e as ha}from"./codexAddEvals-BKeHrC5p.js";import{u as Qt}from"./index-DlwDDz8H.js";import{n as Ge,g as St}from"./github-DQuIliTJ.js";import{G as Pt}from"./github-iFSl-B6V.js";import{M as pa,r as fa}from"./index-vCOH2DKd.js";import{S as It,s as ga}from"./savedPapersAuth-CrQIIpSo.js";import"./katex.min-BSBacQyE.js";import"./hover-card-DiJQFgx9.js";import"./useInfiniteQuery-CFUEkcEs.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $t=mt("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + */const $t=ht("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Gt=mt("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** + */const Gt=ht("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Be=mt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);function fa(t){return t!=null&&t.can_directly_edit_catalog?"direct":"pending"}function ga(t){return(t??[]).filter(s=>!!(s.dataset_slug&&s.task_slug))}function xa(t,s,a="https://paperswithcode.co"){return s.map(r=>{const n=encodeURIComponent(r.evaluation_id),l=`${a}/api/v1/papers/${encodeURIComponent(t)}/leaderboard-badge.svg?eval=${n}&live=1`,i=`${a}/api/v1/papers/${encodeURIComponent(t)}/leaderboard-badge-link?eval=${n}`;return`[![${`Papers with Code: ${r.best_rank===1?"SOTA":`#${r.best_rank}`} on ${r.dataset_name}`}](${l})](${i})`}).join(` -`)}function ba(t,s=!0){return Z({queryKey:["evaluations","paper",t],queryFn:()=>{if(!t)throw new Error("Paper ID is required");return Te.byPaper(t)},enabled:s&&!!t,staleTime:0,refetchOnMount:"always"})}const Vt=t=>t.replace(/v\d+$/,""),ja={models:"https://huggingface.co/",datasets:"https://huggingface.co/datasets/",spaces:"https://huggingface.co/spaces/"},Ge=(t,s)=>{const a=(t[s]||[]).length;return a<100?{count:a,isLimited:!1}:{count:a,isLimited:!0}},Ve=(t,s)=>{const a=t[s];return Array.isArray(a)?a.map(r=>{if(typeof r=="string")return r;if(r&&typeof r=="object"){const n=r;return n.id||n.repoId||null}return null}).filter(r=>!!r).map(r=>`${ja[s]}${r}`):[]},ya=async t=>{try{return(await fetch(`https://huggingface.co/api/papers/${Vt(t)}`)).ok}catch{return!1}},va=async t=>{const s=Vt(t),[a,r]=await Promise.all([fetch(`https://huggingface.co/api/arxiv/${s}/repos`).then(async o=>o.ok?o.json():(console.warn(`Failed to fetch repos for arXiv:${s}, status: ${o.status}`),null)).catch(o=>(console.warn(`Failed to fetch repos for arXiv:${s}:`,o),null)),ya(s)]);if(!a)return{models:0,datasets:0,spaces:0,modelUrls:[],datasetUrls:[],spaceUrls:[],isLimited:!1,paperExists:r};const n=Ge(a,"models"),l=Ge(a,"datasets"),i=Ge(a,"spaces");return{models:n.count,datasets:l.count,spaces:i.count,modelUrls:Ve(a,"models"),datasetUrls:Ve(a,"datasets"),spaceUrls:Ve(a,"spaces"),isLimited:n.isLimited||l.isLimited||i.isLimited,paperExists:r}},ka=t=>Z({queryKey:["huggingface-repos",t],queryFn:()=>va(t),enabled:!!t,staleTime:10*60*1e3,retry:1});function wa(t,s){try{const a=new URL(t),r=a.pathname.replace(/\/$/,"").split("/").filter(Boolean).at(-1);return(r==null?void 0:r.replace(/[-_]+/g," "))||a.hostname.replace(/^www\./,"")}catch{return s}}function Je(t,s,a){return[...new Set([...t,...s??[]])].map(r=>({href:r,label:wa(r,a)}))}function Xe(t,s,a){if(a==null&&t.length===0&&!(s!=null&&s.length))return;const r=new Set([...t,...s??[]]);return Math.max(r.size,a??0)}function We(t){return t[0]??"https://huggingface.co"}function Ye(t,s){return s[0]??t}function _a(t){const s=`${t.title.slice(0,60)}${t.title.length>60?"…":""}`,a=`${t.authors[0]||""}${t.authors.length>1?" et al.":""}`,r=t.authors.join(" and "),n=(t.published||"").slice(0,4)||"—",l=(i,o)=>t.arxiv_id?`@article{${t.arxiv_id.replace(".","")}, + */const Be=ht("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);function xa(t){return t!=null&&t.can_directly_edit_catalog?"direct":"pending"}function ba(t){return(t??[]).filter(s=>!!(s.dataset_slug&&s.task_slug))}function ja(t,s,a="https://paperswithcode.co"){return s.map(r=>{const n=encodeURIComponent(r.evaluation_id),c=`${a}/api/v1/papers/${encodeURIComponent(t)}/leaderboard-badge.svg?eval=${n}&live=1`,i=`${a}/api/v1/papers/${encodeURIComponent(t)}/leaderboard-badge-link?eval=${n}`;return`[![${`Papers with Code: ${r.best_rank===1?"SOTA":`#${r.best_rank}`} on ${r.dataset_name}`}](${c})](${i})`}).join(` +`)}function ya(t,s=!0){return Z({queryKey:["evaluations","paper",t],queryFn:()=>{if(!t)throw new Error("Paper ID is required");return Te.byPaper(t)},enabled:s&&!!t,staleTime:0,refetchOnMount:"always"})}const Vt=t=>t.replace(/v\d+$/,""),va={models:"https://huggingface.co/",datasets:"https://huggingface.co/datasets/",spaces:"https://huggingface.co/spaces/"},Ve=(t,s)=>{const a=(t[s]||[]).length;return a<100?{count:a,isLimited:!1}:{count:a,isLimited:!0}},Je=(t,s)=>{const a=t[s];return Array.isArray(a)?a.map(r=>{if(typeof r=="string")return r;if(r&&typeof r=="object"){const n=r;return n.id||n.repoId||null}return null}).filter(r=>!!r).map(r=>`${va[s]}${r}`):[]},ka=async t=>{try{return(await fetch(`https://huggingface.co/api/papers/${Vt(t)}`)).ok}catch{return!1}},wa=async t=>{const s=Vt(t),[a,r]=await Promise.all([fetch(`https://huggingface.co/api/arxiv/${s}/repos`).then(async o=>o.ok?o.json():(console.warn(`Failed to fetch repos for arXiv:${s}, status: ${o.status}`),null)).catch(o=>(console.warn(`Failed to fetch repos for arXiv:${s}:`,o),null)),ka(s)]);if(!a)return{models:0,datasets:0,spaces:0,modelUrls:[],datasetUrls:[],spaceUrls:[],isLimited:!1,paperExists:r};const n=Ve(a,"models"),c=Ve(a,"datasets"),i=Ve(a,"spaces");return{models:n.count,datasets:c.count,spaces:i.count,modelUrls:Je(a,"models"),datasetUrls:Je(a,"datasets"),spaceUrls:Je(a,"spaces"),isLimited:n.isLimited||c.isLimited||i.isLimited,paperExists:r}},_a=t=>Z({queryKey:["huggingface-repos",t],queryFn:()=>wa(t),enabled:!!t,staleTime:10*60*1e3,retry:1});function Na(t,s){try{const a=new URL(t),r=a.pathname.replace(/\/$/,"").split("/").filter(Boolean).at(-1);return(r==null?void 0:r.replace(/[-_]+/g," "))||a.hostname.replace(/^www\./,"")}catch{return s}}function Xe(t,s,a){return[...new Set([...t,...s??[]])].map(r=>({href:r,label:Na(r,a)}))}function We(t,s,a){if(a==null&&t.length===0&&!(s!=null&&s.length))return;const r=new Set([...t,...s??[]]);return Math.max(r.size,a??0)}function Ye(t){return t[0]??"https://huggingface.co"}function Ze(t,s){return s[0]??t}function Ca(t){const s=`${t.title.slice(0,60)}${t.title.length>60?"…":""}`,a=`${t.authors[0]||""}${t.authors.length>1?" et al.":""}`,r=t.authors.join(" and "),n=(t.published||"").slice(0,4)||"—",c=(i,o)=>t.arxiv_id?`@article{${t.arxiv_id.replace(".","")}, title={{${i}}}, author=${o}, year={{${n}}}, @@ -25,5 +25,5 @@ import{c as mt,k as Es,u as Dt,d as te,l as Ss,r as p,j as e,g as le,C as me,P a author=${o}, year={{${n}}}, url={{${t.source_url||t.url_abs||""}}} -}`;return{citationDisplay:l(s,`{{${a}}}`),citationCopy:l(t.title,`{${r}}`)}}function Na(t,s,a){var m,k,E,v;const r={models:t.hf_models??[],datasets:t.hf_datasets??[],spaces:t.hf_spaces??[]},n={models:Je(r.models,s==null?void 0:s.modelUrls,"Model"),datasets:Je(r.datasets,s==null?void 0:s.datasetUrls,"Dataset"),spaces:Je(r.spaces,s==null?void 0:s.spaceUrls,"Space")},l={models:n.models.map(({href:j})=>j),datasets:n.datasets.map(({href:j})=>j),spaces:n.spaces.map(({href:j})=>j)},i=((m=t.arxiv_id)==null?void 0:m.replace(/v\d+$/,""))??null,o=t.arxiv_id?{isLoading:a,paperHref:`https://huggingface.co/papers/${i}`,rows:[{label:"Models",href:Ye(`https://huggingface.co/models?other=arxiv:${t.arxiv_id}`,r.models),count:Xe(r.models,s==null?void 0:s.modelUrls,s==null?void 0:s.models),isLimited:s==null?void 0:s.isLimited,links:n.models},{label:"Datasets",href:Ye(`https://huggingface.co/datasets?other=arxiv:${t.arxiv_id}`,r.datasets),count:Xe(r.datasets,s==null?void 0:s.datasetUrls,s==null?void 0:s.datasets),isLimited:s==null?void 0:s.isLimited,links:n.datasets},{label:"Spaces",href:Ye(`https://huggingface.co/papers/${i}`,r.spaces),count:Xe(r.spaces,s==null?void 0:s.spaceUrls,s==null?void 0:s.spaces),isLimited:s==null?void 0:s.isLimited,links:n.spaces}],footer:`Cite arxiv.org/abs/${i} in a HF README to link it here.`}:{isLoading:!1,paperHref:null,rows:[{label:"Models",href:We(r.models),count:r.models.length,links:n.models},{label:"Datasets",href:We(r.datasets),count:r.datasets.length,links:n.datasets},{label:"Spaces",href:We(r.spaces),count:r.spaces.length,links:n.spaces}],footer:null},c=(t.methods??[]).filter(({source_paper_id:j})=>j===t.id),g=t.introduced_benchmarks??[],x=t.introduced_frameworks??[],u=[c.length&&(c.length===1?"this method":"these methods"),g.length&&(g.length===1?"this benchmark":"these benchmarks"),x.length&&(x.length===1?"this framework":"these frameworks")].filter(j=>!!j);return{..._a(t),allHfArtifactUrls:l,authorEntries:t.authors.map((j,R)=>{var $,T,N,y;return{name:j,id:((T=($=t.author_links)==null?void 0:$[R])==null?void 0:T.id)??null,hf_username:((y=(N=t.author_links)==null?void 0:N[R])==null?void 0:y.hf_username)??null}}),copyableRanks:ga(t.leaderboard_ranks),hasIntroducedItems:u.length>0,hasLineageItems:!!((k=t.predecessor_papers)!=null&&k.length||(E=t.successor_papers)!=null&&E.length),hfArtifactViewer:o,hfPaperExists:!!(s!=null&&s.paperExists),introducedBenchmarks:g,introducedFrameworks:x,introducedMethods:c,introducedSummary:u.join(" and "),numPages:t.num_pages||null,paperSourceLabel:t.arxiv_id?`arXiv:${t.arxiv_id}`:"External resource",predecessorPapers:t.predecessor_papers??[],projectPages:((v=t.project_pages)==null?void 0:v.filter(({url:j})=>j).map(j=>({...j,safeHref:be(j.url)})))??[],repoSummary:Zs(t.repositories),safeAbstractUrl:be(t.url_abs),safeConferenceUrl:be(t.conference_url_abs),safePdfUrl:be(t.url_pdf),sourceActionLabel:t.source==="external"?"Source page":"arXiv page",successorPapers:t.successor_papers??[]}}const Ca=["tldr","abstract","tasks","methods","results"];function Ea(t){if(!t)return{section:null,resultsTaskSlug:null};const[s,a]=t.split("?",2);if(!Ca.includes(s))return{section:null,resultsTaskSlug:null};const r=s;return r!=="results"||!a?{section:r,resultsTaskSlug:null}:{section:r,resultsTaskSlug:new URLSearchParams(a).get("task")}}const Jt=t=>`results-task-${t}`,Sa=t=>`#results?task=${encodeURIComponent(t)}`;function Pa(t,s){return t&&!!s}function Ia({direct:t,paperId:s,refetchEvaluations:a,refetchPaper:r}){r(),a(),!(!t||!s)&&(V.primeCurationState(s,!0).catch(()=>{}),Te.primeCurationState(s,!0).catch(()=>{}))}function $a(t,s){const a=t?Es(t):"",r=Dt(),{toast:n}=te(),{preferences:l}=Ss(),i=Xs(a,!!a),o=i.data,[c,g]=p.useState(!1);p.useEffect(()=>{!t||t===a||r(`/paper/${a}${window.location.search}${window.location.hash}`,{replace:!0})},[a,r,t]),p.useEffect(()=>{if(o!=null&&o.title)return document.title=Ws(o.title),()=>{document.title=Ys}},[o==null?void 0:o.title]),p.useEffect(()=>{if(g(!1),!(o!=null&&o.id))return;const N=window.setTimeout(()=>g(!0),0);return()=>window.clearTimeout(N)},[o==null?void 0:o.id]);const x=Pa(c,o==null?void 0:o.id),u=ka(c?o==null?void 0:o.arxiv_id:void 0),m=ba(o==null?void 0:o.id,x),k=Z({queryKey:["paper-versions",o==null?void 0:o.arxiv_id],queryFn:()=>V.versions(o.arxiv_id.replace(/v\d+$/,"")),enabled:x&&!!(o!=null&&o.arxiv_id),staleTime:10*60*1e3}),E=Z({queryKey:["related-papers",o==null?void 0:o.id],queryFn:()=>V.related(o.arxiv_id||o.id,4),enabled:x,staleTime:10*60*1e3});p.useEffect(()=>{const N=()=>{Ia({direct:s==="direct",paperId:o==null?void 0:o.id,refetchEvaluations:m.refetch,refetchPaper:i.refetch}),n({title:"This section changed",description:"The latest state has been reloaded. Review your changes before submitting again.",variant:"destructive"})};return window.addEventListener("pwc:catalog-conflict",N),()=>window.removeEventListener("pwc:catalog-conflict",N)},[s,m.refetch,o==null?void 0:o.id,i.refetch,n]);const v=p.useMemo(()=>{const N=m.data;return!N||!l.hide_closed_source_evals?N:N.filter(y=>y.is_open!==!1)},[m.data,l.hide_closed_source_evals]),j=p.useMemo(()=>{if(!v)return[];const N=new Map;for(const y of v){const h=N.get(y.task_id);h?h.rows.push(y):N.set(y.task_id,{taskId:y.task_id,taskName:y.task_name||"—",taskSlug:y.task_slug,rows:[y]})}return[...N.values()]},[v]),R=p.useMemo(()=>j.map(({taskSlug:N})=>N??"").join("|"),[j]),$=p.useMemo(()=>o?Na(o,u.data,u.isLoading):null,[u.data,u.isLoading,o]),T=p.useRef(!1);return p.useEffect(()=>{T.current=!1},[a]),p.useEffect(()=>{let N=0;const y=(f=!1,w=!1)=>{const{section:A,resultsTaskSlug:U}=Ea(window.location.hash.slice(1));if(!A||!o||A==="tldr"&&!o.tldr||A==="results"&&(!x||m.isLoading)||!f&&T.current)return;let H=A==="results"&&U?document.getElementById(Jt(U)):document.getElementById(A);if(!H&&A==="results"&&U){if(j.some(({taskSlug:O})=>O===U))return;H=document.getElementById("results")}H&&(N=window.requestAnimationFrame(()=>{T.current=!0,H.scrollIntoView({block:"start",behavior:w?"smooth":"auto"})}))};y();const h=()=>{T.current=!1,y(!0,!0)};return window.addEventListener("hashchange",h),()=>{window.removeEventListener("hashchange",h),N&&window.cancelAnimationFrame(N)}},[j,m.isLoading,o,R,x]),{arxivId:a,evaluations:m.data,evaluationsByTask:j,evaluationsLoading:m.isLoading,hfLoading:u.isLoading,hfRepos:u.data,paper:o,paperError:i.error,paperLoading:i.isLoading,presentation:$,refetchEvaluations:m.refetch,refetchPaper:i.refetch,relatedQuery:E,versions:k.data??[],visibleEvaluations:v}}const Aa={tasks:"tasks",methods:"methods",evaluations:"results",repositories:"repositories",project_pages:"project-pages",hf_artifacts:"hf-artifacts",organizations:"organizations",source_url:"source-url"};function Ra(t){return Aa[t]??null}function Fa(){const[t,s]=p.useState(null),a=p.useCallback(n=>{s(n)},[]),r=p.useCallback((n,l)=>{s(i=>l?n:i===n?null:i)},[]);return{activeEditor:t,openEditor:a,setEditorOpen:r}}function La(t){const s=t==null?void 0:t.trim();if(!s)return;const a=Number(s);return Number.isFinite(a)?Math.trunc(a):void 0}function At(t){const s=t.trim();if(!s)return null;const a=Number(s);return Number.isFinite(a)&&a>=0?Math.trunc(a):null}function Ze(t){return t.trim()||null}function Ta(t){const s=Number.parseInt(t.task_id,10),a=Number.parseInt(t.dataset_id,10);return Number.isFinite(s)&&Number.isFinite(a)?{taskId:s,datasetId:a}:null}function Ua(t,s){const a=[];for(const r of t){if(r.operation==="delete"&&r.id){a.push({kind:"delete",evaluationId:Number.parseInt(r.id,10)});continue}if(r.operation!=="create"&&r.operation!=="update")continue;const n=Ta(r),l=r.metric_name.trim();if(!n||!l||!r.metric_value.trim())continue;const i=s(r.task_id,r.dataset_id),o={task_id:n.taskId,dataset_id:n.datasetId,metrics:{[l]:r.metric_value},best_metric:l,is_open:r.is_open},c=r.model_name.trim(),g=La(r.best_rank);if(r.operation==="create"){const x=At(r.num_parameters),u=Ze(r.hf_model_url);a.push({kind:"create",data:{...o,...c?{model_name:c}:{},...i&&r.harness.trim()?{harness:r.harness.trim()}:{},...g!==void 0?{best_rank:g}:{},...x!==null?{num_parameters:x}:{},...u!==null?{hf_model_url:u}:{}}});continue}r.id&&a.push({kind:"update",evaluationId:Number.parseInt(r.id,10),data:{...o,...c?{model_name:c}:{},harness:i?Ze(r.harness):null,...g!==void 0?{best_rank:g}:{},num_parameters:At(r.num_parameters),hf_model_url:Ze(r.hf_model_url)}})}return a}function Ba(t,s){return s.map(a=>a.kind==="delete"?{operation:"delete",evaluation_id:a.evaluationId}:{operation:a.kind,...a.kind==="update"?{evaluation_id:a.evaluationId}:{},payload:a.kind==="create"?{paper_id:t,...a.data}:a.data})}function Da(t){return t.map(s=>s.kind==="delete"?{op:"delete",evaluation_id:s.evaluationId}:s.kind==="update"?{op:"update",evaluation_id:s.evaluationId,data:s.data}:{op:"create",data:s.data})}function pe({isAuthor:t=!1}){const s=typeof window<"u"&&window.location.hostname==="staging.paperswithcode.co";return e.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-100",children:[e.jsx("p",{className:"font-medium",children:s?"Test-only: this change stays on staging.":"Your changes will be reviewed by an admin."}),e.jsx("p",{className:"mt-1 leading-snug",children:s?"This exercises staging-local pending behavior and is not queued for production review.":t?"We can see this paper is yours. While we're in early access an admin still reviews each edit; this will become automatic for authors soon.":"Submissions are queued for review and don't change the paper page until an admin approves them."})]})}const et=100;function Ha(t){return(t??[]).some(s=>s.slug==="coding-agents"||s.name.trim().toLowerCase()==="coding agents")}function Ma(t){return t.map(s=>{const a=s.best_metric||Object.keys(s.metrics)[0],r=s.metrics[a];return{id:s.id,task_id:s.task_id,dataset_id:s.dataset_id,model_name:s.model_name||"",harness:s.harness||"",metric_name:a||"",metric_value:String(r||""),best_rank:s.best_rank?String(s.best_rank):"",num_parameters:s.num_parameters!=null?String(s.num_parameters):"",hf_model_url:s.hf_model_url||"",is_open:s.is_open!==!1,operation:"unchanged"}})}function za(t){const s=new Map;return t.forEach(a=>{a.task_id&&a.task_name&&s.set(a.task_id,{id:a.task_id,name:a.task_name,slug:a.task_slug,level:0})}),s}function qa(t){const s=new Map;return t.forEach(a=>{a.dataset_id&&a.dataset_name&&s.set(a.dataset_id,{id:a.dataset_id,name:a.dataset_name,slug:a.dataset_slug})}),s}function Rt(t,s){return`${t}:${s}`}function Ka({open:t,onOpenChange:s,paperId:a,arxivId:r,initialEvaluations:n,paperTasks:l,onSuccess:i,submitMode:o="direct",isAdmin:c=!1,isAuthor:g=!1}){const x=Ha(l),[u,m]=p.useState([]),[k,E]=p.useState(null),[v,j]=p.useState(new Map),[R,$]=p.useState(new Map),T=le(),{toast:N}=te(),y=p.useRef(!1),h=p.useRef(!1);p.useEffect(()=>{if(!t){y.current=!1,h.current=!1;return}y.current||h.current||n.length!==0&&(y.current=!0,m(Ma(n)),j(za(n)),$(qa(n)))},[t,n]);const f=p.useMemo(()=>Array.from(new Set(u.map(b=>b.task_id).filter(b=>b&&b!==""))),[u]),w=p.useMemo(()=>{const b=new Set;return u.forEach(P=>{P.task_id&&P.dataset_id&&b.add(Rt(P.task_id,P.dataset_id))}),Array.from(b)},[u]),A=Z({queryKey:["datasets-by-tasks-for-eval-edit",f,t],queryFn:async()=>{const b={};return await Promise.all(f.map(async P=>{try{const F=await fe.listDatasets({task_id:parseInt(P),page_size:et});b[P]=F.results}catch(F){console.error(`Error fetching datasets for task ${P}:`,F),b[P]=[]}})),b},enabled:t&&f.length>0});p.useEffect(()=>{A.data&&$(b=>{const P=new Map(b);return Object.values(A.data).forEach(F=>{F.forEach(B=>{P.set(B.id,B)})}),P})},[A.data]);const U=Z({queryKey:["leaderboard-metrics-for-eval-edit",w,t],queryFn:async()=>{const b={};return await Promise.all(w.map(async P=>{const[F,B]=P.split(":");try{b[P]=await fe.leaderboardMetrics(B,F)}catch(M){console.error(`Error fetching metrics for leaderboard ${P}:`,M),b[P]=[]}})),b},enabled:t&&w.length>0}),H=async b=>{const P=await fe.listTasks({page_size:et,...b?{q:b}:{}});return j(F=>{const B=new Map(F);return P.results.forEach(M=>B.set(M.id,M)),B}),P.results.map(F=>{var B;return{value:F.id,label:F.name,description:(B=F.description)==null?void 0:B.slice(0,100)}})},O=b=>async P=>{const F=await fe.listDatasets({task_id:parseInt(b),page_size:et,...P?{q:P}:{}});return $(B=>{const M=new Map(B);return F.results.forEach(Q=>M.set(Q.id,Q)),M}),F.results.map(B=>({value:B.id,label:B.name,description:B.full_name}))},J=(b,P)=>{if(!b||!P)return!1;const F=R.get(P);return!!(F!=null&&F.supports_harness)},d=(b,P,F)=>{var Q;if(!b||!P)return[];const M=(((Q=U.data)==null?void 0:Q[Rt(b,P)])||[]).map(z=>({value:z.metric_name,label:z.metric_name,description:z.metric_direction==="higher_is_better"?"Higher is better":"Lower is better"}));return F&&!M.some(z=>z.value===F)&&M.unshift({value:F,label:`${F} (legacy)`}),M},C=ce({mutationFn:async({paperId:b,evaluations:P})=>{const F=Ua(P,J);if(!c&&o==="direct"&&F.length>50)throw new Error("Contributor evaluation batches are limited to 50 operations; contact an admin.");if(F.length===0)return{submitted:!1};const B=Number.parseInt(b,10);return o==="pending"?await he.submit({paper_id:B,edit_type:"evaluations",proposed_payload:{operations:Da(F)}}):await Te.batch(B,Ba(B,F)),{submitted:!0}},onSuccess:b=>{if(o==="pending"){b!=null&&b.submitted?N({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed evaluation changes shortly."}):N({title:"No changes to submit",description:"Your evaluation list matches the existing data."}),i==null||i(),s(!1);return}T.invalidateQueries({queryKey:["paper-arxiv",r]}),T.invalidateQueries({queryKey:["evaluations","paper",a]}),i==null||i(),s(!1)},onError:b=>{var B;const P=b;let F=P.message||(o==="pending"?"Failed to submit your edit. Please try again.":"Failed to update evaluations.");if(P.response)try{const M=JSON.parse(P.response);typeof(M==null?void 0:M.detail)=="string"?F=M.detail:Array.isArray(M==null?void 0:M.detail)&&((B=M.detail[0])!=null&&B.msg)&&(F=M.detail[0].msg)}catch{F=P.response}N({title:o==="pending"?"Could not submit edit":"Could not save evaluations",description:F,variant:"destructive"})}}),I=()=>{h.current=!0,m([...u,{task_id:"",dataset_id:"",model_name:"",harness:"",metric_name:"",metric_value:"",best_rank:"",num_parameters:"",hf_model_url:"",is_open:!0,operation:"create"}])},L=b=>{if(h.current=!0,u[b].id){if(!window.confirm("Delete this evaluation? You will be asked to sign in again if your session is older than 15 minutes."))return;m(u.map((F,B)=>B===b?{...F,operation:"delete"}:F))}else m(u.filter((F,B)=>B!==b))},S=(b,P,F)=>{h.current=!0,m(u.map((B,M)=>{if(M!==b)return B;const Q={...B,[P]:F};return P==="task_id"&&(Q.dataset_id="",Q.metric_name="",Q.harness=""),P==="dataset_id"&&(Q.metric_name="",F&&!J(Q.task_id,F)&&(Q.harness="")),B.operation==="unchanged"&&(Q.operation="update"),Q}))},K=(b,P)=>{h.current=!0,m(u.map((F,B)=>{if(B!==b)return F;const M={...F,is_open:P};return F.operation==="unchanged"&&(M.operation="update"),M}))},X=()=>{const b=u.filter(P=>P.operation!=="delete"||P.id);C.mutate({paperId:a,evaluations:b})};return e.jsxs(se,{open:t,onOpenChange:s,children:[e.jsxs(ae,{className:"max-w-6xl max-h-[800px]",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Evaluation Results"}),e.jsx(ie,{children:"Add, edit, or remove evaluation results for this paper. Each row represents a benchmark result."})]}),o==="pending"&&e.jsx(pe,{isAuthor:g}),e.jsxs("div",{className:"py-4 overflow-y-auto max-h-[600px]",children:[u.filter(b=>b.operation!=="delete").length>0?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border",children:[e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm min-w-[180px]",children:"Task"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm min-w-[180px]",children:"Dataset"}),e.jsx("th",{className:`text-left py-2 px-2 font-medium text-sm ${x?"min-w-[140px]":"min-w-[240px]"}`,children:"Model"}),x&&e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm min-w-[140px]",children:"Harness"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm min-w-[140px]",children:"Metric"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm",children:"Value"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm",children:"Parameters"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm min-w-[200px]",children:"HF model URL"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm w-20",children:"Open source"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm w-16",children:"Action"})]})}),e.jsx("tbody",{children:u.map((b,P)=>{if(b.operation==="delete")return null;const F=v.get(b.task_id),B=R.get(b.dataset_id),M=d(b.task_id,b.dataset_id,b.metric_name),Q=!!(b.task_id&&b.dataset_id)&&U.isFetching;return e.jsxs("tr",{className:"border-b border-border",children:[e.jsx("td",{className:"py-2 px-2",children:e.jsx(Et,{value:b.task_id,onChange:z=>S(P,"task_id",z),placeholder:"Select task",searchPlaceholder:"Search tasks...",emptyMessage:"No tasks found.",selectedOption:F?{value:F.id,label:F.name}:null,queryKey:["eval-edit-task-search"],queryFn:H,enabled:t})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(Et,{value:b.dataset_id,onChange:z=>S(P,"dataset_id",z),placeholder:b.task_id?"Select dataset":"Select task first",searchPlaceholder:"Search datasets...",emptyMessage:b.task_id?"No datasets found for this task.":"Select a task first.",disabled:!b.task_id,selectedOption:B?{value:B.id,label:B.name}:null,queryKey:["eval-edit-dataset-search",b.task_id],queryFn:O(b.task_id),enabled:t&&!!b.task_id})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(W,{type:"text",className:"w-full text-sm",placeholder:"Model name",value:b.model_name,onChange:z=>S(P,"model_name",z.target.value)})}),x&&e.jsx("td",{className:"py-2 px-2",children:J(b.task_id,b.dataset_id)?e.jsx(W,{type:"text",className:"w-full text-sm",placeholder:"Claude Code, Terminus, ...",value:b.harness,onChange:z=>S(P,"harness",z.target.value)}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not supported"})}),e.jsx("td",{className:"py-2 px-2",children:!b.task_id||!b.dataset_id?e.jsx("span",{className:"text-xs text-muted-foreground",children:"Select task + dataset"}):Q?e.jsxs("span",{className:"inline-flex items-center text-xs text-muted-foreground",children:[e.jsx(ee,{className:"mr-1 h-3 w-3 animate-spin"}),"Loading metrics..."]}):M.length>0?e.jsxs("select",{className:"w-full rounded-md border border-border bg-background px-2 py-1 text-sm",value:b.metric_name,onChange:z=>S(P,"metric_name",z.target.value),children:[e.jsx("option",{value:"",children:"Select metric"}),M.map(z=>e.jsx("option",{value:z.value,children:z.label},z.value))]}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"No configured metrics"})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(W,{type:"text",className:"w-full text-sm",placeholder:"44.9",value:b.metric_value,onChange:z=>S(P,"metric_value",z.target.value)})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(W,{type:"number",min:0,step:1,className:"w-full text-sm",placeholder:"e.g. 7000000000",value:b.num_parameters,onChange:z=>S(P,"num_parameters",z.target.value),title:"Raw model parameter count (e.g. 7000000000 for a 7B model). Leave blank if unknown."})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(W,{type:"url",className:"w-full text-sm",placeholder:"https://huggingface.co/org/model",value:b.hf_model_url,onChange:z=>S(P,"hf_model_url",z.target.value),title:"Hugging Face model page for this row (must start with https://huggingface.co/). Leave blank if none."})}),e.jsx("td",{className:"py-2 px-2 text-center",children:e.jsx("input",{type:"checkbox",className:"h-4 w-4 align-middle",checked:b.is_open,onChange:z=>K(P,z.target.checked),title:"Whether the evaluated model is open-source. Uncheck for closed-source models."})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>L(P),className:"h-8 w-8 p-0 text-destructive hover:text-destructive",title:"Delete row",children:e.jsx(Be,{className:"w-4 h-4"})})})]},P)})})]})}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(aa,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"No evaluation results yet"}),e.jsx("p",{className:"text-sm mt-2",children:'Click "Add Row" below to add a new evaluation'})]}),e.jsx("div",{className:"mt-4",children:e.jsxs(D,{variant:"outline",size:"sm",onClick:I,className:"flex items-center space-x-2",children:[e.jsx(Ue,{className:"w-4 h-4"}),e.jsx("span",{children:"Add Row"})]})})]}),e.jsxs(oe,{children:[e.jsxs("div",{className:"flex flex-wrap gap-2 sm:mr-auto",children:[e.jsx(D,{variant:"ghost",onClick:()=>E("benchmark"),children:"Suggest a new benchmark"}),e.jsx(D,{variant:"ghost",onClick:()=>E("metric"),children:"Suggest a new metric"})]}),e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:X,disabled:C.isPending,children:C.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),o==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),o==="pending"?"Submit for review":"Save Changes"]})})]})]}),e.jsx(ft,{open:k!==null,onOpenChange:b=>{b||E(null)},paperId:a,kind:k??"benchmark"})]})}function Oa(t,s,a){if(!t)return t;const r=n=>n.paper_id!==s||n.paper_title===a?n:{...n,paper_title:a};if(Array.isArray(t)){const n=t.map(r);return n.some((i,o)=>i!==t[o])?n:t}if(Array.isArray(t.results)){const n=t.results.map(r);return n.some((i,o)=>i!==t.results[o])?{...t,results:n}:t}return t}function je(t,s,a){new Set([...a,s.id,s.arxiv_id].filter(i=>!!i)).forEach(i=>{t.setQueryData(["paper",i],s),t.setQueryData(["paper-arxiv",i],s)}),t.invalidateQueries({queryKey:["papers"],refetchType:"none"}),t.invalidateQueries({queryKey:["papers-infinite"],refetchType:"none"}),t.invalidateQueries({queryKey:["task-papers-infinite"],refetchType:"none"});const n=String(s.id),l=i=>Oa(i,n,s.title);t.setQueriesData({queryKey:["evaluations"]},l),t.setQueriesData({queryKey:["dataset-evals"]},l),t.invalidateQueries({queryKey:["evaluations"],refetchType:"none"}),t.invalidateQueries({queryKey:["dataset-evals"],refetchType:"none"})}const tt=[{key:"hf_models",label:"Models",placeholder:"https://huggingface.co/org/model"},{key:"hf_datasets",label:"Datasets",placeholder:"https://huggingface.co/datasets/org/data"},{key:"hf_spaces",label:"Spaces",placeholder:"https://huggingface.co/spaces/org/demo"}];function Ft(t){return t.map(s=>s.trim()).filter(Boolean)}function st(t,s){const a=Ft(t).sort(),r=Ft(s).sort();return a.length!==r.length?!1:a.every((n,l)=>n===r[l])}function Qa(t,s){return st(t.hf_models,s.hf_models)&&st(t.hf_datasets,s.hf_datasets)&&st(t.hf_spaces,s.hf_spaces)}function Ga({open:t,onOpenChange:s,paperId:a,arxivId:r,initialArtifacts:n,onSuccess:l,submitMode:i="direct",isAuthor:o=!1}){const[c,g]=p.useState(n),[x,u]=p.useState({hf_models:"",hf_datasets:"",hf_spaces:""}),m=le(),{toast:k}=te(),E=p.useRef(!1);p.useEffect(()=>{if(!t){E.current=!1;return}E.current||(E.current=!0,g(n),u({hf_models:"",hf_datasets:"",hf_spaces:""}))},[t,n]);const v=ce({mutationFn:async({paperId:y,artifacts:h})=>i==="pending"?(await he.submit({paper_id:parseInt(y),edit_type:"hf_artifacts",proposed_payload:h}),null):V.updateHfArtifacts(y,h),onSuccess:y=>{if(i==="pending"){k({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed Hugging Face artifact changes shortly."}),l==null||l(),s(!1),u({hf_models:"",hf_datasets:"",hf_spaces:""});return}y&&je(m,y,[a,r]),l==null||l(),s(!1),u({hf_models:"",hf_datasets:"",hf_spaces:""})},onError:y=>{var w;const h=y;let f=h.message||(i==="pending"?"Failed to submit your edit. Please try again.":"Failed to update Hugging Face artifacts.");if(h.response)try{const A=JSON.parse(h.response);typeof(A==null?void 0:A.detail)=="string"?f=A.detail:Array.isArray(A==null?void 0:A.detail)&&((w=A.detail[0])!=null&&w.msg)&&(f=A.detail[0].msg)}catch{f=h.response}k({title:i==="pending"?"Could not submit edit":"Could not save Hugging Face artifacts",description:f,variant:"destructive"})}}),j=()=>{const y={hf_models:[...c.hf_models],hf_datasets:[...c.hf_datasets],hf_spaces:[...c.hf_spaces]};for(const{key:h}of tt){const f=x[h].trim();if(f){if(y[h].some(w=>w.trim()===f))return alert(`This ${h.replace("hf_","")} URL is already added`),null;y[h]=[...y[h],f]}}return y},R=y=>{const h=x[y].trim();if(h){if(c[y].some(f=>f.trim()===h)){alert(`This ${y.replace("hf_","")} URL is already added`);return}g(f=>({...f,[y]:[...f[y],h]})),u(f=>({...f,[y]:""}))}},$=(y,h)=>{g(f=>({...f,[y]:f[y].filter(w=>w!==h)}))},T=()=>{const y=j();if(y===null)return;const h=Object.keys(n).some(f=>n[f].some(w=>!y[f].includes(w)));i==="direct"&&h&&!window.confirm("Remove one or more Hugging Face artifact links?")||v.mutate({paperId:a,artifacts:y})},N=p.useMemo(()=>{const y={hf_models:[...c.hf_models],hf_datasets:[...c.hf_datasets],hf_spaces:[...c.hf_spaces]};for(const{key:h}of tt){const f=x[h].trim();if(f){if(y[h].some(w=>w.trim()===f))return!1;y[h]=[...y[h],f]}}return!Qa(y,n)},[c,x,n]);return e.jsx(se,{open:t,onOpenChange:s,children:e.jsxs(ae,{className:"max-w-2xl max-h-[700px]",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Hugging Face Artifacts"}),e.jsx(ie,{children:"Add or remove linked Hugging Face models, datasets, and Spaces for this paper."})]}),i==="pending"&&e.jsx(pe,{isAuthor:o}),e.jsx("div",{className:"space-y-6 py-2 overflow-y-auto max-h-[460px]",children:tt.map(({key:y,label:h,placeholder:f})=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:h}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(W,{type:"url",placeholder:f,value:x[y],onChange:w=>u(A=>({...A,[y]:w.target.value})),onKeyPress:w=>{w.key==="Enter"&&(w.preventDefault(),R(y))},className:"flex-1"}),e.jsxs(D,{onClick:()=>R(y),size:"sm",disabled:!x[y].trim(),children:[e.jsx(Ue,{className:"w-4 h-4 mr-1"}),"Add"]})]}),c[y].length>0?e.jsx("div",{className:"space-y-2",children:c[y].map(w=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx("span",{className:"text-sm font-medium text-paper-blue truncate flex-1",children:w}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>$(y,w),className:"h-8 px-2 text-destructive hover:text-destructive",title:`Remove ${h.toLowerCase()} URL`,children:e.jsx(Be,{className:"w-4 h-4"})})]},w))}):e.jsxs("div",{className:"text-xs text-muted-foreground",children:["No ",h.toLowerCase()," linked yet."]})]},y))}),e.jsxs(oe,{children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:T,disabled:v.isPending||!N,children:v.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),i==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),i==="pending"?"Submit for review":"Save Changes"]})})]})]})})}var De="Checkbox",[Va]=ht(De),[Ja,gt]=Va(De);function Xa(t){const{__scopeCheckbox:s,checked:a,children:r,defaultChecked:n,disabled:l,form:i,name:o,onCheckedChange:c,required:g,value:x="on",internal_do_not_use_render:u}=t,[m,k]=Mt({prop:a,defaultProp:n??!1,onChange:c,caller:De}),[E,v]=p.useState(null),[j,R]=p.useState(null),$=p.useRef(!1),T=E?!!i||!!E.closest("form"):!0,N={checked:m,disabled:l,setChecked:k,control:E,setControl:v,name:o,form:i,value:x,hasConsumerStoppedPropagationRef:$,required:g,defaultChecked:ue(n)?!1:n,isFormControl:T,bubbleInput:j,setBubbleInput:R};return e.jsx(Ja,{scope:s,...N,children:Wa(u)?u(N):r})}var Xt="CheckboxTrigger",Wt=p.forwardRef(({__scopeCheckbox:t,onKeyDown:s,onClick:a,...r},n)=>{const{control:l,value:i,disabled:o,checked:c,required:g,setControl:x,setChecked:u,hasConsumerStoppedPropagationRef:m,isFormControl:k,bubbleInput:E}=gt(Xt,t),v=Se(n,x),j=p.useRef(c);return p.useEffect(()=>{const R=l==null?void 0:l.form;if(R){const $=()=>u(j.current);return R.addEventListener("reset",$),()=>R.removeEventListener("reset",$)}},[l,u]),e.jsx(ge.button,{type:"button",role:"checkbox","aria-checked":ue(c)?"mixed":c,"aria-required":g,"data-state":ss(c),"data-disabled":o?"":void 0,disabled:o,value:i,...r,ref:v,onKeyDown:Ce(s,R=>{R.key==="Enter"&&R.preventDefault()}),onClick:Ce(a,R=>{u($=>ue($)?!0:!$),E&&k&&(m.current=R.isPropagationStopped(),m.current||R.stopPropagation())})})});Wt.displayName=Xt;var xt=p.forwardRef((t,s)=>{const{__scopeCheckbox:a,name:r,checked:n,defaultChecked:l,required:i,disabled:o,value:c,onCheckedChange:g,form:x,...u}=t;return e.jsx(Xa,{__scopeCheckbox:a,checked:n,defaultChecked:l,disabled:o,required:i,onCheckedChange:g,name:r,form:x,value:c,internal_do_not_use_render:({isFormControl:m})=>e.jsxs(e.Fragment,{children:[e.jsx(Wt,{...u,ref:s,__scopeCheckbox:a}),m&&e.jsx(ts,{__scopeCheckbox:a})]})})});xt.displayName=De;var Yt="CheckboxIndicator",Zt=p.forwardRef((t,s)=>{const{__scopeCheckbox:a,forceMount:r,...n}=t,l=gt(Yt,a);return e.jsx(Ht,{present:r||ue(l.checked)||l.checked===!0,children:e.jsx(ge.span,{"data-state":ss(l.checked),"data-disabled":l.disabled?"":void 0,...n,ref:s,style:{pointerEvents:"none",...t.style}})})});Zt.displayName=Yt;var es="CheckboxBubbleInput",ts=p.forwardRef(({__scopeCheckbox:t,...s},a)=>{const{control:r,hasConsumerStoppedPropagationRef:n,checked:l,defaultChecked:i,required:o,disabled:c,name:g,value:x,form:u,bubbleInput:m,setBubbleInput:k}=gt(es,t),E=Se(a,k),v=Qt(l),j=zt(r);p.useEffect(()=>{const $=m;if(!$)return;const T=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(T,"checked").set,h=!n.current;if(v!==l&&y){const f=new Event("click",{bubbles:h});$.indeterminate=ue(l),y.call($,ue(l)?!1:l),$.dispatchEvent(f)}},[m,v,l,n]);const R=p.useRef(ue(l)?!1:l);return e.jsx(ge.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??R.current,required:o,disabled:c,name:g,value:x,form:u,...s,tabIndex:-1,ref:E,style:{...s.style,...j,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});ts.displayName=es;function Wa(t){return typeof t=="function"}function ue(t){return t==="indeterminate"}function ss(t){return ue(t)?"indeterminate":t?"checked":"unchecked"}const He=p.forwardRef(({className:t,style:s,...a},r)=>e.jsx(xt,{ref:r,className:Re("peer h-4 w-4 shrink-0 rounded-sm ring-offset-background data-[state=checked]:!bg-black data-[state=checked]:!text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),style:{border:"1px solid #000",...s},...a,children:e.jsx(Zt,{className:Re("flex items-center justify-center text-current"),children:e.jsx(me,{className:"h-4 w-4"})})}));He.displayName=xt.displayName;const Ya=250,Za=100;function er({open:t,onOpenChange:s,paperId:a,arxivId:r,initialMethodIds:n,initialMethods:l,onSuccess:i,submitMode:o="direct",isAuthor:c=!1}){const[g,x]=p.useState(n),[u,m]=p.useState(!1),[k,E]=p.useState(""),[v,j]=p.useState(""),[R,$]=p.useState(new Map),T=le(),{toast:N}=te(),y=p.useRef(!1);p.useEffect(()=>{if(!t){y.current=!1;return}if(y.current)return;y.current=!0,x(n),E(""),j("");const d=new Map;(l||[]).forEach(C=>{const I=parseInt(C.id);Number.isNaN(I)||d.set(I,C)}),$(d)},[t,n,l]),p.useEffect(()=>{const d=window.setTimeout(()=>{j(k.trim())},Ya);return()=>window.clearTimeout(d)},[k]);const{data:h,isFetching:f}=Z({queryKey:["methods-search",v],queryFn:()=>fe.listMethods({page_size:Za,...v?{q:v}:{}}),enabled:t});p.useEffect(()=>{var d;(d=h==null?void 0:h.results)!=null&&d.length&&$(C=>{const I=new Map(C);return h.results.forEach(L=>{const S=parseInt(L.id);Number.isNaN(S)||I.set(S,L)}),I})},[h]);const w=p.useMemo(()=>{const d=(h==null?void 0:h.results)||[],C=new Set,I=[];return g.forEach(L=>{if(C.has(L))return;const S=R.get(L);S&&(I.push(S),C.add(L))}),d.forEach(L=>{const S=parseInt(L.id);Number.isNaN(S)||C.has(S)||(I.push(L),C.add(S))}),I},[h,g,R]),A=ce({mutationFn:async({paperId:d,methodIds:C})=>o==="pending"?(await he.submit({paper_id:parseInt(d),edit_type:"methods",proposed_payload:{method_ids:C}}),null):V.updateMethods(d,C),onSuccess:d=>{if(o==="pending"){N({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed method changes shortly."}),i==null||i(),s(!1);return}d&&je(T,d,[a,r]),N({title:"Methods updated",description:`Saved ${g.length} method${g.length===1?"":"s"} for this paper.`}),i==null||i(),s(!1)},onError:d=>{var L;const C=d;let I=C.message||(o==="pending"?"Failed to submit your edit. Please try again.":"Failed to update paper methods.");if(C.response)try{const S=JSON.parse(C.response);typeof(S==null?void 0:S.detail)=="string"?I=S.detail:Array.isArray(S==null?void 0:S.detail)&&((L=S.detail[0])!=null&&L.msg)&&(I=S.detail[0].msg)}catch{I=C.response}N({title:o==="pending"?"Could not submit edit":"Could not save methods",description:I,variant:"destructive"})}}),U=()=>{o==="direct"&&n.some(d=>!g.includes(d))&&!window.confirm("Remove one or more method links from this paper?")||A.mutate({paperId:a,methodIds:g})},H=p.useMemo(()=>{if(g.length!==n.length)return!0;const d=new Set(n);return g.some(C=>!d.has(C))},[g,n]),O=(d,C)=>{x(I=>C?I.includes(d)?I:[...I,d]:I.filter(L=>L!==d))},J=()=>E("");return e.jsxs(se,{open:t,onOpenChange:s,children:[e.jsxs(ae,{className:"max-w-2xl max-h-[600px]",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Paper Methods"}),e.jsx(ie,{children:"Select the methods and techniques used in this paper. You can select multiple methods."})]}),o==="pending"&&e.jsx(pe,{isAuthor:c}),e.jsxs("div",{className:"relative mb-4",children:[e.jsx(Ee,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(W,{type:"text",placeholder:"Search methods...",value:k,onChange:d=>E(d.target.value),className:"pl-9 pr-9"}),k&&e.jsx("button",{type:"button",onClick:J,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":"Clear search",children:e.jsx(pt,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[400px]",children:w.length>0?e.jsx("div",{className:"space-y-2",children:w.map(d=>{const C=parseInt(d.id),I=g.includes(C);return e.jsxs("div",{className:"flex items-center space-x-2 p-2 hover:bg-muted/50 rounded-md",children:[e.jsx(He,{id:`method-${d.id}`,checked:I,onCheckedChange:L=>O(C,L===!0),className:"!border !border-black data-[state=checked]:!bg-black data-[state=checked]:!text-white"}),e.jsxs("label",{htmlFor:`method-${d.id}`,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer flex-1",children:[d.name,d.full_name&&d.full_name!==d.name&&e.jsx("span",{className:"block text-xs text-muted-foreground font-normal",children:d.full_name}),d.description&&e.jsxs("span",{className:"block text-xs text-muted-foreground font-normal mt-1",children:[d.description.substring(0,100),d.description.length>100?"...":""]})]})]},d.id)})}):f?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ee,{className:"w-8 h-8 mx-auto mb-2 animate-spin"}),e.jsx("p",{children:"Loading methods..."})]}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Ee,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:v?`No methods found matching "${v}"`:"No methods available"})]})}),e.jsxs(oe,{children:[e.jsx(D,{variant:"ghost",className:"sm:mr-auto",onClick:()=>m(!0),children:"Suggest a new method"}),e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:U,disabled:A.isPending||!H,children:A.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),o==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),o==="pending"?"Submit for review":"Save Changes"]})})]})]}),e.jsx(ft,{open:u,onOpenChange:m,paperId:a,kind:"method"})]})}const tr=({open:t,onOpenChange:s,paperId:a,initialOrganizationIds:r,submitMode:n,isAuthor:l})=>{var E;const[i,o]=p.useState(r),[c,g]=p.useState(""),x=le();p.useEffect(()=>{t&&(o(r),g(""))},[r,t]);const u=Z({queryKey:["organizations","curation"],queryFn:()=>fe.organizations(!1),enabled:t}),m=p.useMemo(()=>{var j,R;const v=c.trim().toLocaleLowerCase();return v?(((R=u.data)==null?void 0:R.results)??[]).filter($=>$.name.toLocaleLowerCase().includes(v)):((j=u.data)==null?void 0:j.results)??[]},[(E=u.data)==null?void 0:E.results,c]),k=ce({mutationFn:async()=>{r.some(j=>!i.includes(j))&&!window.confirm("Remove one or more organizations from this paper? Destructive edits may require a fresh sign-in.")||(n==="pending"?await he.submit({paper_id:Number(a),edit_type:"organizations",proposed_payload:{organization_ids:i}}):await V.updateOrganizations(a,i))},onSuccess:()=>{x.invalidateQueries({queryKey:["paper-arxiv"]}),s(!1)}});return e.jsx(se,{open:t,onOpenChange:s,children:e.jsxs(ae,{children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit organizations"}),e.jsx(ie,{children:"Associate existing organizations with this paper. Organization creation remains admin-only."})]}),n==="pending"&&e.jsx(pe,{isAuthor:l}),e.jsxs("div",{className:"relative",children:[e.jsx(Ee,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(W,{type:"search","aria-label":"Search organizations",placeholder:"Search organizations...",value:c,onChange:v=>g(v.target.value),className:"pl-9 pr-9"}),c&&e.jsx("button",{type:"button",onClick:()=>g(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":"Clear organization search",children:e.jsx(pt,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"max-h-80 space-y-2 overflow-auto",children:[m.map(v=>{const j=Number(v.id);return e.jsxs("label",{className:"flex items-center gap-2 rounded border p-2",children:[e.jsx("input",{type:"checkbox",checked:i.includes(j),onChange:R=>o($=>R.target.checked?[...$,j]:$.filter(T=>T!==j))}),v.name]},v.id)}),!u.isLoading&&m.length===0&&e.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:c.trim()?`No organizations found matching "${c.trim()}"`:"No organizations available"})]}),e.jsxs(oe,{children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:()=>k.mutate(),disabled:k.isPending,children:n==="pending"?"Submit test edit":"Save changes"})]})]})})};function sr({open:t,onOpenChange:s,paperId:a,arxivId:r,initialProjectPages:n,onSuccess:l,submitMode:i="direct",isAuthor:o=!1}){const[c,g]=p.useState(n),[x,u]=p.useState(""),m=le(),{toast:k}=te(),E=p.useRef(!1);p.useEffect(()=>{if(!t){E.current=!1;return}E.current||(E.current=!0,g(n),u(""))},[t,n]);const v=ce({mutationFn:async({paperId:h,projectPages:f})=>i==="pending"?(await he.submit({paper_id:parseInt(h),edit_type:"project_pages",proposed_payload:{project_pages:f}}),null):V.updateProjectPages(h,f),onSuccess:h=>{if(i==="pending"){k({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed project page changes shortly."}),l==null||l(),s(!1),u("");return}h&&je(m,h,[a,r]),l==null||l(),s(!1),u("")},onError:h=>{var A;const f=h;let w=f.message||(i==="pending"?"Failed to submit your edit. Please try again.":"Failed to update project pages.");if(f.response)try{const U=JSON.parse(f.response);typeof(U==null?void 0:U.detail)=="string"?w=U.detail:Array.isArray(U==null?void 0:U.detail)&&((A=U.detail[0])!=null&&A.msg)&&(w=U.detail[0].msg)}catch{w=f.response}k({title:i==="pending"?"Could not submit edit":"Could not save project pages",description:w,variant:"destructive"})}}),j=()=>{const h=x.trim();return h?c.some(f=>f.url===h)?(alert("This project page URL is already added"),null):[...c,{url:h,is_official:!1}]:c},R=()=>{const h=j();h!==null&&h.length!==c.length&&(g(h),u(""))},$=h=>{g(c.filter(f=>f.url!==h))},T=h=>{g(c.map(f=>f.url===h?{...f,is_official:!f.is_official}:f))},N=()=>{const h=j();h!==null&&(i==="direct"&&n.some(f=>!h.some(w=>w.url===f.url))&&!window.confirm("Remove one or more project pages from this paper?")||v.mutate({paperId:a,projectPages:h}))},y=p.useMemo(()=>{const h=x.trim(),f=h?[...c,{url:h,is_official:!1}]:c;if(f.length!==n.length)return!0;const w=new Map(n.map(A=>[A.url.trim(),!!A.is_official]));return f.some(A=>{const U=w.get(A.url.trim());return U===void 0||U!==!!A.is_official})},[c,x,n]);return e.jsx(se,{open:t,onOpenChange:s,children:e.jsxs(ae,{className:"max-w-2xl max-h-[600px]",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Paper Project Pages"}),e.jsx(ie,{children:"Add or remove project page URLs (e.g. authors' demo or landing pages) associated with this paper. Mark pages as official if they are created by the paper authors."})]}),i==="pending"&&e.jsx(pe,{isAuthor:o}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Add Project Page URL"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(W,{type:"url",placeholder:"https://example.com/project",value:x,onChange:h=>u(h.target.value),onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),R())},className:"flex-1"}),e.jsxs(D,{onClick:R,size:"sm",disabled:!x.trim(),children:[e.jsx(Ue,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[350px]",children:c.length>0?e.jsx("div",{className:"space-y-2",children:c.map((h,f)=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx($t,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{className:"text-sm font-medium text-paper-blue truncate",children:h.url}),h.is_official&&e.jsx(Ot,{variant:"secondary",className:"text-xs",children:"Official"})]})}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxs(D,{variant:h.is_official?"default":"outline",size:"sm",onClick:()=>T(h.url),className:"h-8 px-2 text-xs",title:h.is_official?"Click to unmark as official (created by paper authors)":"Click to mark as official (created by paper authors)",children:[e.jsx(Gt,{className:`w-3.5 h-3.5 mr-1 ${h.is_official?"fill-current":""}`}),h.is_official?"Official":"Mark official"]}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>$(h.url),className:"h-8 px-2 text-destructive hover:text-destructive",title:"Remove project page",children:e.jsx(Be,{className:"w-4 h-4"})})]})]},f))}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx($t,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No project pages added yet"}),e.jsx("p",{className:"text-xs mt-1",children:"Add a project page URL above to get started"})]})}),e.jsxs(oe,{children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:N,disabled:v.isPending||!y,children:v.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),i==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),i==="pending"?"Submit for review":"Save Changes"]})})]})]})})}function ar({open:t,onOpenChange:s,paperId:a,arxivId:r,initialRepositories:n,onSuccess:l,submitMode:i="direct",isAuthor:o=!1}){const[c,g]=p.useState(n),[x,u]=p.useState(""),m=le(),{toast:k}=te(),E=p.useRef(!1);p.useEffect(()=>{if(!t){E.current=!1;return}E.current||(E.current=!0,g(n),u(""))},[t,n]);const v=ce({mutationFn:async({paperId:f,repositories:w})=>i==="pending"?(await he.submit({paper_id:parseInt(f),edit_type:"repositories",proposed_payload:{repositories:w}}),null):V.updateRepositories(f,w),onSuccess:f=>{if(i==="pending"){k({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed repository changes shortly."}),l==null||l(),s(!1),u("");return}f&&je(m,f,[a,r]),l==null||l(),s(!1),u("")},onError:f=>{var U;const w=f;let A=w.message||(i==="pending"?"Failed to submit your edit. Please try again.":"Failed to update paper repositories.");if(w.response)try{const H=JSON.parse(w.response);typeof(H==null?void 0:H.detail)=="string"?A=H.detail:Array.isArray(H==null?void 0:H.detail)&&((U=H.detail[0])!=null&&U.msg)&&(A=H.detail[0].msg)}catch{A=w.response}k({title:i==="pending"?"Could not submit edit":"Could not save repositories",description:A,variant:"destructive"})}}),j=f=>{const w=[];for(const A of f){const U=w.find(H=>St(H.url,A.url));if(U)U.is_official=U.is_official||A.is_official;else{const H=Qe(A.url);w.push({url:H??A.url.trim(),is_official:A.is_official})}}return w},R=()=>{const f=x.trim(),w=f?[...c,{url:f,is_official:!1}]:c;return f&&c.some(A=>St(A.url,f))?(alert("This repository URL is already added"),null):j(w)},$=()=>{const f=R();f!==null&&f.length!==c.length&&(g(f),u(""))},T=f=>{g(c.filter(w=>w.url!==f))},N=f=>{g(c.map(w=>w.url===f?{...w,is_official:!w.is_official}:w))},y=()=>{const f=R();f!==null&&(i==="direct"&&n.some(w=>!f.some(A=>A.url===w.url))&&!window.confirm("Remove one or more repositories from this paper?")||v.mutate({paperId:a,repositories:f}))},h=p.useMemo(()=>{const f=x.trim(),w=f?[...c,{url:f,is_official:!1}]:c;if(w.length!==n.length)return!0;const A=j(n),U=j(w);if(U.length!==A.length)return!0;const H=new Map(A.map(O=>[Qe(O.url)??O.url.trim(),!!O.is_official]));return U.some(O=>{const J=Qe(O.url)??O.url.trim(),d=H.get(J);return d===void 0||d!==!!O.is_official})},[c,x,n]);return e.jsx(se,{open:t,onOpenChange:s,children:e.jsxs(ae,{className:"max-w-2xl max-h-[600px]",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Paper Repositories"}),e.jsx(ie,{children:"Add or remove GitHub repository URLs associated with this paper. Mark repositories as official if they are created by the paper authors."})]}),i==="pending"&&e.jsx(pe,{isAuthor:o}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Add Repository URL"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(W,{type:"url",placeholder:"https://github.com/owner/repo",value:x,onChange:f=>u(f.target.value),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),$())},className:"flex-1"}),e.jsxs(D,{onClick:$,size:"sm",disabled:!x.trim(),children:[e.jsx(Ue,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[350px]",children:c.length>0?e.jsx("div",{className:"space-y-2",children:c.map((f,w)=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx(Pt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{className:"text-sm font-medium text-paper-blue truncate",children:f.url}),f.is_official&&e.jsx(Ot,{variant:"secondary",className:"text-xs",children:"Official"})]})}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxs(D,{variant:f.is_official?"default":"outline",size:"sm",onClick:()=>N(f.url),className:"h-8 px-2 text-xs",title:f.is_official?"Click to unmark as official (created by paper authors)":"Click to mark as official (created by paper authors)",children:[e.jsx(Gt,{className:`w-3.5 h-3.5 mr-1 ${f.is_official?"fill-current":""}`}),f.is_official?"Official":"Mark official"]}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>T(f.url),className:"h-8 px-2 text-destructive hover:text-destructive",title:"Remove repository",children:e.jsx(Be,{className:"w-4 h-4"})})]})]},w))}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Pt,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No repositories added yet"}),e.jsx("p",{className:"text-xs mt-1",children:"Add a repository URL above to get started"})]})}),e.jsxs(oe,{children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:y,disabled:v.isPending||!h,children:v.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),i==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),i==="pending"?"Submit for review":"Save Changes"]})})]})]})})}function rr({open:t,onOpenChange:s,paperId:a,arxivId:r,initialUrl:n,onSuccess:l,submitMode:i="direct",isAuthor:o=!1}){const[c,g]=p.useState(n),x=le(),{toast:u}=te(),m=p.useRef(!1);p.useEffect(()=>{if(!t){m.current=!1;return}m.current||(m.current=!0,g(n))},[t,n]);const k=ce({mutationFn:async({paperId:$,sourceUrl:T})=>i==="pending"?(await he.submit({paper_id:parseInt($),edit_type:"source_url",proposed_payload:{source_url:T}}),null):V.updateSourceUrl($,T),onSuccess:$=>{if(i==="pending"){u({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed source URL change shortly."}),l==null||l(),s(!1);return}$&&je(x,$,[a,r]),l==null||l(),s(!1)},onError:$=>{var y;const T=$;let N=T.message||(i==="pending"?"Failed to submit your edit. Please try again.":"Failed to update source URL.");if(T.response)try{const h=JSON.parse(T.response);typeof(h==null?void 0:h.detail)=="string"?N=h.detail:Array.isArray(h==null?void 0:h.detail)&&((y=h.detail[0])!=null&&y.msg)&&(N=h.detail[0].msg)}catch{N=T.response}u({title:i==="pending"?"Could not submit edit":"Could not save source URL",description:N,variant:"destructive"})}}),E=c.trim(),v=/^https?:\/\//i.test(E),j=E!==(n||"").trim(),R=()=>{v&&k.mutate({paperId:a,sourceUrl:E})};return e.jsx(se,{open:t,onOpenChange:s,children:e.jsxs(ae,{className:"max-w-2xl",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Source URL"}),e.jsxs(ie,{children:["Update the canonical URL for this external paper. This is the page the ",'"Source page"'," button links to. ArXiv papers cannot edit this field."]})]}),i==="pending"&&e.jsx(pe,{isAuthor:o}),e.jsxs("div",{className:"space-y-2 py-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Source URL"}),e.jsx(W,{type:"url",placeholder:"https://example.com/paper",value:c,onChange:$=>g($.target.value),onKeyPress:$=>{$.key==="Enter"&&v&&j&&($.preventDefault(),R())}}),!v&&E.length>0&&e.jsx("p",{className:"text-xs text-destructive",children:"URL must start with http:// or https://"})]}),e.jsxs(oe,{children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:R,disabled:k.isPending||!v||!j,children:k.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),i==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),i==="pending"?"Submit for review":"Save Changes"]})})]})]})})}const nr=250,ir=100;function or({open:t,onOpenChange:s,paperId:a,arxivId:r,initialTaskIds:n,initialTasks:l,onSuccess:i,submitMode:o="direct",isAuthor:c=!1}){const[g,x]=p.useState(n),[u,m]=p.useState(!1),[k,E]=p.useState(""),[v,j]=p.useState(""),[R,$]=p.useState(new Map),T=le(),{toast:N}=te(),y=p.useRef(!1);p.useEffect(()=>{if(!t){y.current=!1;return}if(y.current)return;y.current=!0,x(n),E(""),j("");const d=new Map;(l||[]).forEach(C=>{const I=parseInt(C.id);Number.isNaN(I)||d.set(I,C)}),$(d)},[t,n,l]),p.useEffect(()=>{const d=window.setTimeout(()=>{j(k.trim())},nr);return()=>window.clearTimeout(d)},[k]);const{data:h,isFetching:f}=Z({queryKey:["tasks-search",v],queryFn:()=>fe.listTasks({page_size:ir,...v?{q:v}:{}}),enabled:t});p.useEffect(()=>{var d;(d=h==null?void 0:h.results)!=null&&d.length&&$(C=>{const I=new Map(C);return h.results.forEach(L=>{const S=parseInt(L.id);Number.isNaN(S)||I.set(S,L)}),I})},[h]);const w=p.useMemo(()=>{const d=(h==null?void 0:h.results)||[],C=new Set,I=[];return g.forEach(L=>{if(C.has(L))return;const S=R.get(L);S&&(I.push(S),C.add(L))}),d.forEach(L=>{const S=parseInt(L.id);Number.isNaN(S)||C.has(S)||(I.push(L),C.add(S))}),I},[h,g,R]),A=ce({mutationFn:async({paperId:d,taskIds:C})=>o==="pending"?(await he.submit({paper_id:parseInt(d),edit_type:"tasks",proposed_payload:{task_ids:C}}),null):V.updateTasks(d,C),onMutate:async({taskIds:d})=>{if(o==="pending")return{snapshots:[]};const C=d.map(S=>R.get(S)).filter(S=>!!S).map(S=>({id:S.id,name:S.name,slug:S.slug})).sort((S,K)=>S.name.localeCompare(K.name)),I=Array.from(new Set([a,r].filter(S=>!!S)));await Promise.all(I.flatMap(S=>[T.cancelQueries({queryKey:["paper",S]}),T.cancelQueries({queryKey:["paper-arxiv",S]})]));const L=[];return I.forEach(S=>{["paper","paper-arxiv"].forEach(K=>{const X=[K,S],b=T.getQueryData(X);L.push({key:X,data:b}),b&&T.setQueryData(X,{...b,tasks:C})})}),N({title:"Tasks updated",description:`Saved ${d.length} task${d.length===1?"":"s"} for this paper.`}),i==null||i(),s(!1),{snapshots:L}},onSuccess:d=>{if(o==="pending"){N({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed task changes shortly."}),i==null||i(),s(!1);return}d&&je(T,d,[a,r])},onError:(d,C,I)=>{var K,X;(K=I==null?void 0:I.snapshots)==null||K.forEach(({key:b,data:P})=>{T.setQueryData(b,P)});const L=d;let S=L.message||(o==="pending"?"Failed to submit your edit. Please try again.":"Failed to update paper tasks.");if(L.response)try{const b=JSON.parse(L.response);typeof(b==null?void 0:b.detail)=="string"?S=b.detail:Array.isArray(b==null?void 0:b.detail)&&((X=b.detail[0])!=null&&X.msg)&&(S=b.detail[0].msg)}catch{S=L.response}N({title:o==="pending"?"Could not submit edit":"Could not save tasks",description:S,variant:"destructive"})}}),U=()=>{o==="direct"&&n.some(d=>!g.includes(d))&&!window.confirm("Remove one or more task links from this paper?")||A.mutate({paperId:a,taskIds:g})},H=p.useMemo(()=>{if(g.length!==n.length)return!0;const d=new Set(n);return g.some(C=>!d.has(C))},[g,n]),O=(d,C)=>{x(I=>C?I.includes(d)?I:[...I,d]:I.filter(L=>L!==d))},J=()=>E("");return e.jsxs(se,{open:t,onOpenChange:s,children:[e.jsxs(ae,{className:"max-w-2xl max-h-[600px]",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Paper Tasks"}),e.jsx(ie,{children:"Select the tasks that this paper addresses. You can select multiple tasks."})]}),o==="pending"&&e.jsx(pe,{isAuthor:c}),e.jsxs("div",{className:"relative mb-4",children:[e.jsx(Ee,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(W,{type:"text",placeholder:"Search tasks...",value:k,onChange:d=>E(d.target.value),className:"pl-9 pr-9"}),k&&e.jsx("button",{type:"button",onClick:J,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":"Clear search",children:e.jsx(pt,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[400px]",children:w.length>0?e.jsx("div",{className:"space-y-2",children:w.map(d=>{const C=parseInt(d.id),I=g.includes(C);return e.jsxs("div",{className:"flex items-center space-x-2 p-2 hover:bg-muted/50 rounded-md",children:[e.jsx(He,{id:`task-${d.id}`,checked:I,onCheckedChange:L=>O(C,L===!0),className:"!border !border-black data-[state=checked]:!bg-black data-[state=checked]:!text-white"}),e.jsxs("label",{htmlFor:`task-${d.id}`,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer flex-1",children:[d.name,d.description&&e.jsxs("span",{className:"block text-xs text-muted-foreground font-normal mt-1",children:[d.description.substring(0,100),d.description.length>100?"...":""]})]})]},d.id)})}):f?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ee,{className:"w-8 h-8 mx-auto mb-2 animate-spin"}),e.jsx("p",{children:"Loading tasks..."})]}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Ee,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:v?`No tasks found matching "${v}"`:"No tasks available"})]})}),e.jsxs(oe,{children:[e.jsx(D,{variant:"ghost",className:"sm:mr-auto",onClick:()=>m(!0),children:"Suggest a new task"}),e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:U,disabled:A.isPending||!H,children:A.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),o==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),o==="pending"?"Submit for review":"Save Changes"]})})]})]}),e.jsx(ft,{open:u,onOpenChange:m,paperId:a,kind:"task"})]})}function lr({activeEditor:t,arxivId:s,editSubmitMode:a,evaluations:r,isAdmin:n,isLinkedAuthor:l,onOpenChange:i,paper:o}){if(!t)return null;const c={open:!0,paperId:o.id,arxivId:s,submitMode:a,isAuthor:l},g=u=>m=>i(u,m);return{tasks:()=>{var u;return e.jsx(or,{...c,onOpenChange:g("tasks"),initialTaskIds:((u=o.tasks)==null?void 0:u.map(m=>Number(m.id)))??[],initialTasks:o.tasks??[]})},methods:()=>{var u;return e.jsx(er,{...c,onOpenChange:g("methods"),initialMethodIds:((u=o.methods)==null?void 0:u.map(m=>Number(m.id)))??[],initialMethods:o.methods??[]})},repositories:()=>{var u;return e.jsx(ar,{...c,onOpenChange:g("repositories"),initialRepositories:((u=o.repositories)==null?void 0:u.map(({url:m,is_official:k})=>({url:m,is_official:!!k})))??[]})},"project-pages":()=>{var u;return e.jsx(sr,{...c,onOpenChange:g("project-pages"),initialProjectPages:((u=o.project_pages)==null?void 0:u.map(({url:m,is_official:k})=>({url:m,is_official:!!k})))??[]})},results:()=>e.jsx(Ka,{...c,onOpenChange:g("results"),initialEvaluations:r,paperTasks:o.tasks??[],isAdmin:n}),"source-url":()=>e.jsx(rr,{...c,onOpenChange:g("source-url"),initialUrl:o.source_url??o.url_abs??""}),"hf-artifacts":()=>e.jsx(Ga,{...c,onOpenChange:g("hf-artifacts"),initialArtifacts:{hf_models:o.hf_models??[],hf_datasets:o.hf_datasets??[],hf_spaces:o.hf_spaces??[]}}),organizations:()=>e.jsx(tr,{open:!0,paperId:o.id,onOpenChange:g("organizations"),initialOrganizationIds:(o.organizations??[]).map(({id:u})=>Number(u)),submitMode:a,isAuthor:l})}[t]()}const cr={"add-evals":{trigger:"add evals",running:"adding evals…",complete:"add evals ✓",title:"Add evaluations with Codex",description:t=>e.jsxs(e.Fragment,{children:["Codex will run the repository’s add-evals skill for “",t,"”. It will import only paper-native results onto existing, metric-compatible leaderboards. Accepted rows are written directly to the live database."]}),notice:"Comparator rows, unknown benchmarks, and unconfigured metrics will be skipped. Jobs run one at a time in submission order.",progress:"Codex is researching the paper and validating results against the configured leaderboards.",action:"Run add-evals",start:ca,get:la,cancel:oa},"enrich-paper":{trigger:"enrich paper",running:"enriching…",complete:"enriched ✓",title:"Enrich paper with Codex",description:t=>e.jsxs(e.Fragment,{children:["Codex will run the repository’s enrich-paper skill for “",t,"”. It will validate official code and project links, merge high-confidence taxonomy tags, and check the paper thumbnail. Accepted changes are written directly to the live database."]}),notice:"Uncertain URLs and missing taxonomy concepts will be reported rather than guessed. Jobs run one at a time in submission order.",progress:"Codex is validating artifacts, taxonomy tags, and thumbnail quality for this paper.",action:"Run enrich-paper",start:ia,get:na,cancel:ra}};function dr({report:t}){return e.jsx("div",{className:"min-w-0 max-h-[50vh] overflow-y-auto overflow-x-hidden rounded-md border bg-muted/40 p-4 text-sm leading-relaxed",children:e.jsx(ma,{remarkPlugins:[ha],components:{a:({children:s,...a})=>e.jsx("a",{...a,className:"break-all underline underline-offset-2",target:"_blank",rel:"noreferrer",children:s}),p:({children:s})=>e.jsx("p",{className:"mb-3 break-words last:mb-0",children:s}),ul:({children:s})=>e.jsx("ul",{className:"mb-3 list-disc space-y-1 pl-5 last:mb-0",children:s}),ol:({children:s})=>e.jsx("ol",{className:"mb-3 list-decimal space-y-1 pl-5 last:mb-0",children:s}),h1:({children:s})=>e.jsx("h3",{className:"mb-2 font-semibold",children:s}),h2:({children:s})=>e.jsx("h3",{className:"mb-2 font-semibold",children:s}),h3:({children:s})=>e.jsx("h3",{className:"mb-2 font-semibold",children:s}),code:({children:s})=>e.jsx("code",{className:"break-all rounded bg-background/80 px-1 py-0.5 font-mono text-xs",children:s}),pre:({children:s})=>e.jsx("pre",{className:"mb-3 max-w-full overflow-x-auto whitespace-pre-wrap break-words rounded bg-background/80 p-3 font-mono text-xs last:mb-0",children:s})},children:t})})}function as({kind:t,paperId:s,paperTitle:a,triggerClassName:r,onComplete:n}){const l=cr[t],[i,o]=p.useState(!1),[c,g]=p.useState(null),[x,u]=p.useState(!1),[m,k]=p.useState(null),E=p.useRef(null),v=(c==null?void 0:c.status)==="queued"||(c==null?void 0:c.status)==="dispatching"||(c==null?void 0:c.status)==="running",j=c==null?void 0:c.id;p.useEffect(()=>{if(!v||!j)return;let N=!1;const y=window.setInterval(async()=>{try{const h=await l.get(j);N||(g(h),k(null))}catch(h){N||k(h instanceof Error?h.message:"Could not check job status.")}},2e3);return()=>{N=!0,window.clearInterval(y)}},[v,l,j]),p.useEffect(()=>{(c==null?void 0:c.status)!=="completed"||E.current===c.id||(E.current=c.id,n())},[c,n]);const R=async()=>{u(!0),k(null);try{g(await l.start(s))}catch(N){k(N instanceof Error?N.message:"Could not start Codex.")}finally{u(!1)}},$=()=>{g(null),k(null),E.current=null},T=async()=>{if(c){k(null);try{g(await l.cancel(c.id))}catch(N){k(N instanceof Error?N.message:"Could not cancel Codex.")}}};return e.jsxs(se,{open:i,onOpenChange:o,children:[e.jsx("button",{type:"button",className:r,onClick:()=>o(!0),children:v?l.running:(c==null?void 0:c.status)==="completed"?l.complete:l.trigger}),e.jsxs(ae,{className:"max-h-[90vh] w-[calc(100vw-2rem)] min-w-0 max-w-2xl overflow-hidden",children:[e.jsxs(re,{className:"min-w-0",children:[e.jsx(ne,{children:l.title}),e.jsx(ie,{children:l.description(a)})]}),c?e.jsxs("div",{className:"min-w-0 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"font-mono text-xs uppercase tracking-wide text-muted-foreground",children:["Status: ",c.status]}),c.hf_job_url&&e.jsx("a",{className:"text-sm underline",href:c.hf_job_url,target:"_blank",rel:"noreferrer",children:"View Hugging Face Job"}),v&&e.jsxs("div",{className:"rounded-md border bg-muted/40 p-3 text-sm",children:[c.status==="queued"?"This job is queued and will start after the current Codex job finishes.":l.progress," ","This can take several minutes; you can close this window and return."]}),c.report&&e.jsx(dr,{report:c.report}),c.error&&e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:c.error})]}):e.jsx("div",{className:"rounded-md border bg-muted/40 p-3 text-sm text-muted-foreground",children:l.notice}),m&&e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:m}),e.jsxs(oe,{children:[e.jsx(D,{variant:"outline",onClick:()=>o(!1),children:v?"Close":"Cancel"}),v&&e.jsx(D,{variant:"outline",onClick:()=>void T(),children:"Cancel job"}),!c&&e.jsx(D,{onClick:R,disabled:x,children:x?"Starting…":l.action}),c&&!v&&e.jsx(D,{variant:"outline",onClick:$,children:"Run again"})]})]})]})}function ur(t){return e.jsx(as,{...t,kind:"add-evals",triggerClassName:"edit-link"})}function we({accent:t,id:s,label:a}){return e.jsxs("div",{className:"section-rule paper-section-anchor",id:s,children:[e.jsx("span",{children:e.jsx("a",{href:`#${s}`,className:"section-anchor-link",children:a})}),t]})}function mr({canCopyBadge:t,canEdit:s,evaluationsByTask:a,evaluationsLoading:r,isAdmin:n,onCopyBadge:l,onEdit:i,onRefresh:o,paper:c,visibleEvaluationCount:g}){return e.jsxs(e.Fragment,{children:[e.jsx(we,{id:"results",label:"Results",accent:e.jsxs("span",{className:"accent",children:[g," benchmarks",t&&e.jsxs("button",{type:"button",className:"edit-link results-badge-copy",onClick:l,title:"Copy live leaderboard badges for your repository README",children:[e.jsx(G,{name:"copy",size:10})," Copy PwC badge"]}),n&&da()&&e.jsx(ur,{paperId:Number(c.id),paperTitle:c.title,onComplete:o}),s&&e.jsx("button",{type:"button",onClick:i,className:"edit-link",children:"edit"})]})}),r?e.jsx(Ne,{className:"h-32 w-full"}):a.length>0?a.map(x=>e.jsxs("div",{className:x.taskSlug?"paper-section-anchor":void 0,id:x.taskSlug?Jt(x.taskSlug):void 0,children:[e.jsxs("div",{className:"section-rule",children:[e.jsx("span",{children:x.taskSlug?e.jsxs(e.Fragment,{children:[e.jsx(de,{to:`/tasks/${x.taskSlug}`,children:x.taskName}),e.jsx("a",{href:Sa(x.taskSlug),className:"section-anchor-link results-task-permalink","aria-label":`Permalink to ${x.taskName} results on this paper`,title:"Link to this task's results",children:"#"})]}):x.taskName}),e.jsxs("span",{className:"accent",children:[x.rows.length," ",x.rows.length===1?"result":"results"]})]}),e.jsxs("table",{className:"results-table",children:[e.jsxs("colgroup",{children:[e.jsx("col",{style:{width:"28%"}}),e.jsx("col",{style:{width:"28%"}}),e.jsx("col",{style:{width:"14%"}}),e.jsx("col",{style:{width:"12%"}}),e.jsx("col",{style:{width:"8%"}}),e.jsx("col",{style:{width:"10%"}})]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Benchmark"}),e.jsx("th",{children:"Model"}),e.jsx("th",{children:"Metric"}),e.jsx("th",{children:"Value"}),e.jsx("th",{children:"Rank"}),e.jsx("th",{children:"Compare"})]})}),e.jsx("tbody",{children:x.rows.map(u=>{var m;return e.jsxs("tr",{children:[e.jsx("td",{className:"benchmark",children:u.dataset_slug?e.jsx(de,{to:`/benchmark/${u.dataset_slug}`,children:u.dataset_name||"—"}):u.dataset_name||"—"}),e.jsxs("td",{className:"model",title:u.model_name||void 0,children:[u.hf_model_url?e.jsx("a",{href:u.hf_model_url,target:"_blank",rel:"noopener noreferrer",className:"model-hf-link",title:`Open ${u.model_name||"model"} on Hugging Face`,children:u.model_name||"—"}):u.model_name||"—",u.is_open===!1&&e.jsx(Vs,{}),(u.external??u.is_external)&&e.jsx(Js,{sourceUrl:u.source_url||u.external_source_url||u.result_url})]}),e.jsx("td",{className:"metric",children:u.best_metric}),e.jsx("td",{className:"value",children:Ps((m=u.metrics)==null?void 0:m[u.best_metric||""])}),e.jsx("td",{className:"rank",children:u.best_rank!=null?`#${u.best_rank}`:"—"}),e.jsx("td",{className:"compare",children:u.dataset_slug&&e.jsx(de,{to:`/benchmark/${u.dataset_slug}?${[u.task_slug?`task=${encodeURIComponent(u.task_slug)}`:"",`eval=${encodeURIComponent(u.id)}`].filter(Boolean).join("&")}`,children:"Compare →"})})]},u.id)})})]})]},x.taskId)):e.jsx("p",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-faint)"},children:"No benchmark results recorded yet."})]})}var bt="Radio",[hr,rs]=ht(bt),[pr,fr]=hr(bt),ns=p.forwardRef((t,s)=>{const{__scopeRadio:a,name:r,checked:n=!1,required:l,disabled:i,value:o="on",onCheck:c,form:g,...x}=t,[u,m]=p.useState(null),k=Se(s,j=>m(j)),E=p.useRef(!1),v=u?g||!!u.closest("form"):!0;return e.jsxs(pr,{scope:a,checked:n,disabled:i,children:[e.jsx(ge.button,{type:"button",role:"radio","aria-checked":n,"data-state":cs(n),"data-disabled":i?"":void 0,disabled:i,value:o,...x,ref:k,onClick:Ce(t.onClick,j=>{n||c==null||c(),v&&(E.current=j.isPropagationStopped(),E.current||j.stopPropagation())})}),v&&e.jsx(ls,{control:u,bubbles:!E.current,name:r,value:o,checked:n,required:l,disabled:i,form:g,style:{transform:"translateX(-100%)"}})]})});ns.displayName=bt;var is="RadioIndicator",os=p.forwardRef((t,s)=>{const{__scopeRadio:a,forceMount:r,...n}=t,l=fr(is,a);return e.jsx(Ht,{present:r||l.checked,children:e.jsx(ge.span,{"data-state":cs(l.checked),"data-disabled":l.disabled?"":void 0,...n,ref:s})})});os.displayName=is;var gr="RadioBubbleInput",ls=p.forwardRef(({__scopeRadio:t,control:s,checked:a,bubbles:r=!0,...n},l)=>{const i=p.useRef(null),o=Se(i,l),c=Qt(a),g=zt(s);return p.useEffect(()=>{const x=i.current;if(!x)return;const u=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(u,"checked").set;if(c!==a&&k){const E=new Event("click",{bubbles:r});k.call(x,a),x.dispatchEvent(E)}},[c,a,r]),e.jsx(ge.input,{type:"radio","aria-hidden":!0,defaultChecked:a,...n,tabIndex:-1,ref:o,style:{...n.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});ls.displayName=gr;function cs(t){return t?"checked":"unchecked"}var xr=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Me="RadioGroup",[br]=ht(Me,[qt,rs]),ds=qt(),us=rs(),[jr,yr]=br(Me),ms=p.forwardRef((t,s)=>{const{__scopeRadioGroup:a,name:r,defaultValue:n,value:l,required:i=!1,disabled:o=!1,orientation:c,dir:g,loop:x=!0,onValueChange:u,...m}=t,k=ds(a),E=Is(g),[v,j]=Mt({prop:l,defaultProp:n??null,onChange:u,caller:Me});return e.jsx(jr,{scope:a,name:r,required:i,disabled:o,value:v,onValueChange:j,children:e.jsx($s,{asChild:!0,...k,orientation:c,dir:E,loop:x,children:e.jsx(ge.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":o?"":void 0,dir:E,...m,ref:s})})})});ms.displayName=Me;var hs="RadioGroupItem",ps=p.forwardRef((t,s)=>{const{__scopeRadioGroup:a,disabled:r,...n}=t,l=yr(hs,a),i=l.disabled||r,o=ds(a),c=us(a),g=p.useRef(null),x=Se(s,g),u=l.value===n.value,m=p.useRef(!1);return p.useEffect(()=>{const k=v=>{xr.includes(v.key)&&(m.current=!0)},E=()=>m.current=!1;return document.addEventListener("keydown",k),document.addEventListener("keyup",E),()=>{document.removeEventListener("keydown",k),document.removeEventListener("keyup",E)}},[]),e.jsx(As,{asChild:!0,...o,focusable:!i,active:u,children:e.jsx(ns,{disabled:i,required:l.required,checked:u,...c,...n,name:l.name,ref:x,onCheck:()=>l.onValueChange(n.value),onKeyDown:Ce(k=>{k.key==="Enter"&&k.preventDefault()}),onFocus:Ce(n.onFocus,()=>{var k;m.current&&((k=g.current)==null||k.click())})})})});ps.displayName=hs;var vr="RadioGroupIndicator",fs=p.forwardRef((t,s)=>{const{__scopeRadioGroup:a,...r}=t,n=us(a);return e.jsx(os,{...n,...r,ref:s})});fs.displayName=vr;var gs=ms,xs=ps,kr=fs;const ot=p.forwardRef(({className:t,...s},a)=>e.jsx(gs,{className:Re("grid gap-2",t),...s,ref:a}));ot.displayName=gs.displayName;const _e=p.forwardRef(({className:t,...s},a)=>e.jsx(xs,{ref:a,className:Re("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(kr,{className:"flex items-center justify-center",children:e.jsx(Rs,{className:"h-2.5 w-2.5 fill-current text-current"})})}));_e.displayName=xs.displayName;const wr={pdf:"PDF",model:"Model",dataset:"Dataset",space:"Space",github:"GitHub"},lt=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,_r=/^[A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*$/,Nr=20,ct="copy_to_bucket";function Cr(t){const s=t.trim();if(!_r.test(s))return null;const[a,r]=s.split("/");return`https://huggingface.co/buckets/${encodeURIComponent(a)}/${encodeURIComponent(r)}`}function dt(t){return`pwc:bucket-copy:${t}`}function Er(t){if(typeof window>"u"||new URL(window.location.href).searchParams.get(ct)!==t)return null;try{const a=window.sessionStorage.getItem(dt(t));if(!a)return null;const r=JSON.parse(a);return r.paperId!==t||typeof r.bucketId!="string"||!["new","existing"].includes(r.destinationMode)||!["public","private"].includes(r.visibility)||!Array.isArray(r.selectedIds)||r.selectedIds.some(n=>typeof n!="string")?null:r}catch{return null}}function Sr(t,s=Nr){if(s<1)throw new Error("Bucket copy batch size must be positive");const a=[];for(let r=0;r!lt.test(c)))return null;const i=l.join("/"),o=s==="model"?"":`${s}s/`;return{id:`${s}:${i}`,kind:s,label:i,url:`https://huggingface.co/${o}${i}`,source:`hf://${o}${i}/`,destination:`${s}s/${i}/`,repoId:i}}catch{return null}}function Pr(t){try{const s=new URL(t);if(s.hostname!=="github.com"&&s.hostname!=="www.github.com")return null;const a=s.pathname.split("/").filter(Boolean);if(a.length<2)return null;const r=a[0],n=a[1].replace(/\.git$/,"");if(!lt.test(r)||!lt.test(n))return null;const l=`${r}/${n}`;return{id:`github:${l}`,kind:"github",label:l,url:`https://github.com/${l}`,source:`https://github.com/${l}.git`,destination:`github/${l}/`}}catch{return null}}function Ir({githubUrls:t,hfModelUrls:s,hfDatasetUrls:a,hfSpaceUrls:r,paperId:n,pdfName:l,pdfUrl:i}){const o=[i?{id:"pdf",kind:"pdf",label:"Paper PDF",url:i,source:i,destination:`paper/${l||n}.pdf`}:null,...s.map(g=>at(g,"model")),...a.map(g=>at(g,"dataset")),...r.map(g=>at(g,"space")),...t.map(Pr)],c=new Set;return o.filter(g=>!g||c.has(g.id)?!1:(c.add(g.id),!0))}function $r(t,s,a){const r=["# Requires the Hugging Face CLI: https://huggingface.co/docs/huggingface_hub/guides/cli",`HF_BUCKET=${Ie(t.trim())}`];a.create&&r.push(`hf buckets create "$HF_BUCKET" --exist-ok${a.isPrivate?" --private":""}`);for(const i of s.filter(o=>o.kind!=="github"&&o.kind!=="pdf"))r.push(`hf cp ${Ie(i.source)} "hf://buckets/$HF_BUCKET/${i.destination}"`);const n=s.find(i=>i.kind==="pdf");n&&r.push('PWC_PDF="$(mktemp)"',`trap 'rm -f "$PWC_PDF"' EXIT`,`curl --fail --location ${Ie(n.source)} --output "$PWC_PDF"`,`hf cp "$PWC_PDF" "hf://buckets/$HF_BUCKET/${n.destination}"`);const l=s.filter(i=>i.kind==="github");if(l.length){r.push('PWC_COPY_DIR="$(mktemp -d)"',`trap 'rm -rf "$PWC_COPY_DIR"' EXIT`);for(const i of l){const o=`$PWC_COPY_DIR/${i.destination.replace(/\/$/,"")}`;r.push(`git clone --depth 1 -- ${Ie(i.source)} "${o}"`,`hf sync "${o}" "hf://buckets/$HF_BUCKET/${i.destination}" --exclude '.git/**'`)}}return r.join(` -`)}function Ar(t){return`${(t.split(/[:|–—]/,1)[0]||t).normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/g,"")||"paper"}-artifacts`}function Rr(t){const{toast:s}=te(),a=p.useMemo(()=>Ir({githubUrls:t.githubUrls,hfDatasetUrls:t.hfDatasetUrls,hfModelUrls:t.hfModelUrls,hfSpaceUrls:t.hfSpaceUrls,paperId:t.paperId,pdfName:t.pdfName,pdfUrl:t.pdfUrl}),[t.githubUrls,t.hfDatasetUrls,t.hfModelUrls,t.hfSpaceUrls,t.paperId,t.pdfName,t.pdfUrl]),r=p.useMemo(()=>Er(t.paperId),[t.paperId]),[n,l]=p.useState(!!r),[i,o]=p.useState((r==null?void 0:r.destinationMode)??"new"),[c,g]=p.useState((r==null?void 0:r.bucketId)??""),[x,u]=p.useState((r==null?void 0:r.visibility)??"public"),[m,k]=p.useState(()=>new Set((r==null?void 0:r.selectedIds)??a.map(d=>d.id))),[E,v]=p.useState(!1),[j,R]=p.useState(null),[$,T]=p.useState(!!r),N=a.filter(d=>m.has(d.id)),y=N.length===a.length,h=Cr(c),f=h!==null,w=$r(c,N,{create:i==="new",isPrivate:x==="private"}),A=(d,C)=>{k(I=>{const L=new Set(I);return C?L.add(d):L.delete(d),L})},U=async()=>{try{await navigator.clipboard.writeText(w),s({title:"Bucket copy commands copied",description:"Run them in a terminal where the Hugging Face CLI is signed in."})}catch{s({title:"Copy failed",description:"Could not access the clipboard. Select and copy the commands manually.",variant:"destructive"})}},H=p.useCallback(()=>{const d=Fs("/api/v1/auth/hf/login"),C=new URL(window.location.href);C.searchParams.set(ct,t.paperId),window.sessionStorage.setItem(dt(t.paperId),JSON.stringify({paperId:t.paperId,bucketId:c.trim(),destinationMode:i,visibility:x,selectedIds:Array.from(m)}));const I=new URLSearchParams({return_to:C.toString(),authorize_bucket:"true"});i==="new"&&I.set("bucket_create","true"),window.location.assign(`${d}?${I.toString()}`)},[c,i,t.paperId,m,x]),O=p.useCallback(async()=>{if(!t.isSignedIn){H();return}v(!0);let d=0,C=0;try{const I=N.filter(K=>K.kind!=="pdf"&&K.kind!=="github"&&!!K.repoId).map(K=>({kind:K.kind,repo_id:K.repoId})),L=Sr(I);L.length||L.push([]);for(const[K,X]of L.entries()){R({current:K+1,total:L.length});const b=await V.copyToBucket(t.paperId,{bucket_id:c.trim(),create:K===0&&i==="new",private:x==="private",include_pdf:K===0&&N.some(P=>P.kind==="pdf"),artifacts:X});d+=b.copied.length,C+=b.errors.length}const S=N.filter(K=>K.kind==="github").length;s({title:C?"Bucket copy partially completed":"Copied to bucket",description:[`${d} item${d===1?"":"s"} copied.`,C?`${C} item${C===1?"":"s"} failed.`:"",S?"Use the generated commands below to copy GitHub repositories.":""].filter(Boolean).join(" "),variant:C?"destructive":void 0,action:h?e.jsx(Ls,{altText:"Open destination bucket",asChild:!0,children:e.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",children:"Open bucket"})}):void 0}),!C&&!S&&l(!1)}catch(I){if(I instanceof nt&&I.code==="bucket_authorization_required"){H();return}s({title:d?"Bucket copy partially completed":"Bucket copy failed",description:d?`${d} item${d===1?"":"s"} copied before the request failed. You can retry or use the CLI commands below.`:I instanceof nt&&typeof I.detail=="string"?I.detail:"Hugging Face could not complete the copy. You can still use the CLI commands below.",variant:"destructive"})}finally{v(!1),R(null)}},[H,c,h,i,t.isSignedIn,t.paperId,N,s,x]);p.useEffect(()=>{if(!$||!t.isSignedIn)return;T(!1),window.sessionStorage.removeItem(dt(t.paperId));const d=new URL(window.location.href);d.searchParams.delete(ct),window.history.replaceState({},"",`${d.pathname}${d.search}${d.hash}`),O()},[O,t.isSignedIn,t.paperId,$]);const J=()=>{k(new Set(a.map(d=>d.id))),!c&&t.suggestedBucketId&&g(t.suggestedBucketId),l(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sidebar-card copy-to-bucket-card",children:[e.jsxs("button",{type:"button",className:"copy-to-bucket-trigger",onClick:J,children:[e.jsx("span",{className:"copy-to-bucket-arrow","aria-hidden":"true",children:"→"}),e.jsx("span",{className:"copy-to-bucket-title",children:"Copy to bucket"}),e.jsx("span",{className:"copy-to-bucket-new",children:"New"})]}),e.jsx("div",{className:"copy-to-bucket-meta",children:a.length?`${a.length} linked artifact${a.length===1?"":"s"}`:"No linked artifacts yet"})]}),e.jsx(se,{open:n,onOpenChange:l,children:e.jsxs(ae,{className:"max-h-[90vh] max-w-2xl grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden",children:[e.jsxs(re,{children:[e.jsxs(ne,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"copy-to-bucket-dialog-arrow","aria-hidden":"true",children:"→"}),"Copy to bucket"]}),e.jsx(ie,{children:"Keep your own copy of this paper's PDF, linked code, and Hugging Face artifacts. Hub repositories use Xet's server-side copy; GitHub repositories use the generated CLI fallback."})]}),e.jsx("div",{className:"-mx-6 min-h-0 overflow-y-auto px-6",children:a.length?e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{children:"Choose your destination"}),e.jsxs(ot,{value:i,onValueChange:d=>o(d),className:"grid grid-cols-2 gap-2",children:[e.jsxs(Y,{className:"bucket-choice",children:[e.jsx(_e,{value:"new"}),"New bucket"]}),e.jsxs(Y,{className:"bucket-choice",children:[e.jsx(_e,{value:"existing"}),"Existing bucket"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"bucket-id",children:"Bucket name"}),e.jsx(W,{id:"bucket-id",value:c,onChange:d=>g(d.target.value),placeholder:t.suggestedBucketId||"username/paper-artifacts","aria-invalid":c.length>0&&!f}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[e.jsx("p",{className:"text-muted-foreground",children:"Use the full Hugging Face bucket ID: namespace/name."}),h&&e.jsxs("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-1 underline underline-offset-4",children:["View bucket",e.jsx(G,{name:"external",size:10})]})]})]}),i==="new"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{children:"Bucket visibility"}),e.jsxs(ot,{value:x,onValueChange:d=>u(d),className:"flex gap-5",children:[e.jsxs(Y,{className:"flex items-center gap-2 font-normal",children:[e.jsx(_e,{value:"public"}),"Public"]}),e.jsxs(Y,{className:"flex items-center gap-2 font-normal",children:[e.jsx(_e,{value:"private"}),"Private"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(Y,{children:"Artifacts"}),e.jsx(D,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>k(y?new Set:new Set(a.map(d=>d.id))),children:y?"Deselect all":"Select all"})]}),e.jsx("div",{className:"bucket-artifact-list",children:a.map(d=>e.jsxs("div",{className:"bucket-artifact-row",children:[e.jsx(He,{id:`bucket-artifact-${d.id}`,checked:m.has(d.id),onCheckedChange:C=>A(d.id,C===!0)}),e.jsxs(Y,{htmlFor:`bucket-artifact-${d.id}`,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[e.jsx("span",{className:"bucket-artifact-kind",children:wr[d.kind]}),e.jsx("span",{className:"bucket-artifact-name",children:d.label})]}),e.jsxs("a",{href:be(d.url)??void 0,target:"_blank",rel:"noopener noreferrer",className:"bucket-artifact-open",children:["Open",e.jsx(G,{name:"external",size:10})]})]},d.id))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The PDF and Hugging Face artifacts can be copied directly. GitHub repositories require the CLI workflow below."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"bucket-copy-commands",children:"CLI fallback"}),e.jsx("pre",{id:"bucket-copy-commands",className:"bucket-copy-commands h-[190px]",children:f?w:"Enter a bucket name above to prepare the copy commands."})]})]}):e.jsx("p",{className:"py-5 text-sm text-muted-foreground",children:"This paper does not have a linked GitHub repository or Hugging Face artifact to copy yet."})}),e.jsxs(oe,{children:[e.jsx("a",{href:"https://huggingface.co/docs/huggingface_hub/en/guides/buckets",target:"_blank",rel:"noopener noreferrer",className:"mr-auto text-sm text-muted-foreground underline underline-offset-4",children:"About Hugging Face Buckets"}),e.jsxs(D,{type:"button",onClick:U,variant:"outline",disabled:!f||N.length===0,children:[e.jsx(G,{name:"copy",size:12}),"Copy commands"]}),e.jsx(D,{type:"button",onClick:O,disabled:E||t.isSignedIn&&(!f||!N.some(d=>d.kind!=="github")),children:E?j&&j.total>1?`Copying ${j.current}/${j.total}…`:"Copying…":t.isSignedIn?"Copy now":"Sign in & copy"})]})]})})]})}function Fr({isLoading:t,papers:s}){return t?e.jsxs("div",{className:"sidebar-card","aria-busy":"true",children:[e.jsx("div",{className:"sidebar-card-title",children:"Related papers"}),e.jsx("div",{className:"related-meta",children:"Finding related work…"})]}):s!=null&&s.length?e.jsxs("div",{className:"sidebar-card",children:[e.jsx("div",{className:"sidebar-card-title",children:"Related papers"}),s.map(a=>e.jsxs(de,{to:`/paper/${a.arxiv_id||a.id}`,target:"_blank",rel:"noopener noreferrer",className:"related-paper",style:{textDecoration:"none",color:"inherit"},children:[e.jsx("div",{className:"related-title",children:e.jsx(Ae,{title:a.title})}),e.jsxs("div",{className:"related-meta",children:[e.jsx("span",{children:a.arxiv_id?`arXiv:${a.arxiv_id}`:"External resource"}),a.citation_count!=null&&e.jsxs("span",{children:[a.citation_count.toLocaleString()," cites"]})]})]},a.id))]}):null}const rt=3,Lt=3;function Lr(t){return t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Tr({allHfArtifactUrls:t,citationCopied:s,citationDisplay:a,hfArtifactViewer:r,onCopyCitation:n,onEditHfArtifacts:l,onEditRepositories:i,paper:o,relatedIsLoading:c,relatedPapers:g,user:x}){var v;const[u,m]=p.useState(!1),k=[...o.repositories??[]].sort((j,R)=>Number(R.is_official)-Number(j.is_official)||(R.num_stars||0)-(j.num_stars||0)),E=(u?k:k.slice(0,rt)).map(j=>({...j,safeHref:be(j.url)}));return e.jsxs("aside",{className:"detail-sidebar",children:[e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[e.jsx("span",{children:"GitHub"}),e.jsxs("span",{className:"badge",children:[k.length," repo",k.length===1?"":"s",e.jsx("button",{type:"button",onClick:i,className:"edit-link",children:"edit"})]})]}),E.filter(({safeHref:j})=>j).map(j=>e.jsxs("a",{href:j.safeHref??void 0,target:"_blank",rel:"noopener noreferrer",className:"code-line",style:{textDecoration:"none"},children:[e.jsxs("span",{className:"code-line-repo",children:[e.jsx(G,{name:"github",size:12}),e.jsxs("span",{className:"code-line-repo-name",children:[j.owner,"/",j.name]}),j.is_official&&e.jsx("span",{className:"code-line-official",children:"· Official"})]}),e.jsxs("span",{className:"code-line-stars",children:["★ ",Lr(j.num_stars)]})]},j.id)),k.length===0&&e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",padding:"6px 0"},children:"No GitHub repositories linked yet."}),k.length>rt&&e.jsx("button",{type:"button",className:"bench-show-more",onClick:()=>m(j=>!j),children:u?"− show top 3":`+ show ${k.length-rt} more repos`})]}),e.jsx(Ur,{viewer:r,onEdit:l}),e.jsx(Rr,{githubUrls:k.map(({url:j})=>j),hfModelUrls:t.models,hfDatasetUrls:t.datasets,hfSpaceUrls:t.spaces,paperId:o.id,pdfName:((v=o.arxiv_id)==null?void 0:v.replace("/","-"))||o.id,pdfUrl:o.url_pdf,isSignedIn:!!x,suggestedBucketId:x?`${x.username}/${Ar(o.title)}`:void 0}),e.jsx(Fr,{isLoading:c,papers:g}),e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[e.jsx("span",{children:"Citation"}),e.jsxs("button",{type:"button",className:"citation-copy-btn",onClick:n,"aria-label":"Copy citation to clipboard",title:"Copy citation to clipboard",children:[e.jsx(G,{name:"copy",size:11}),s?"Copied":"Copy"]})]}),e.jsx("pre",{style:{fontFamily:"var(--mono)",fontSize:10.5,lineHeight:1.5,color:"var(--ink-soft)",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0},children:a})]})]})}function Ur({onEdit:t,viewer:s}){return e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[s.paperHref?e.jsx("a",{href:s.paperHref,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"none"},children:"🤗 Hugging Face"}):e.jsx("span",{children:"🤗 Hugging Face"}),e.jsx("button",{type:"button",onClick:t,className:"edit-link",children:"edit"})]}),s.isLoading?e.jsx(Ne,{className:"h-16 w-full"}):e.jsxs(e.Fragment,{children:[s.rows.map(a=>e.jsx(Br,{...a},a.label)),s.footer&&e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--ink-faint)",marginTop:12},children:s.footer})]})]})}function Br({count:t,href:s,isLimited:a,label:r,links:n}){const[l,i]=p.useState(!1),o=((n==null?void 0:n.length)??0)>Lt,c=l?n:n==null?void 0:n.slice(0,Lt),g=t!=null?`${t}${a?"+":""}`:"—";return e.jsxs("div",{className:"hf-artifact-row",children:[e.jsxs("div",{className:"hf-artifact-row-header",children:[e.jsx("span",{children:r}),t?e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"hf-artifact-count",children:g}):e.jsx("span",{className:"hf-artifact-count hf-artifact-count--empty",children:g})]}),c!=null&&c.length?e.jsxs("div",{className:"hf-artifact-links",children:[c.map(x=>e.jsx("a",{href:x.href,target:"_blank",rel:"noopener noreferrer",children:x.label},x.href)),o&&e.jsx("button",{type:"button",className:"hf-artifact-toggle","aria-expanded":l,onClick:()=>i(x=>!x),children:l?"Show fewer":`View all ${n.length}`})]}):null]})}const Tt=360;function Dr({canEdit:t,onEditMethods:s,onEditTasks:a,paper:r}){var g,x;const[n,l]=p.useState(!1),i=r.abstract||"",o=i.length>Tt,c=n||!o?i:`${i.slice(0,Tt)}…`;return e.jsxs(e.Fragment,{children:[r.tldr&&e.jsxs(e.Fragment,{children:[e.jsx(we,{id:"tldr",label:"TL;DR · AI-generated"}),e.jsx("div",{className:"tldr-box",children:r.tldr})]}),e.jsx(we,{id:"abstract",label:"Abstract"}),e.jsx("p",{className:"abstract-text",style:{marginBottom:8},children:e.jsx(Gs,{text:c})}),o&&e.jsx("button",{type:"button",className:"read-full",onClick:()=>l(u=>!u),children:n?"− collapse abstract":"+ read full abstract"}),e.jsx(we,{id:"tasks",label:"Tasks",accent:e.jsxs("span",{className:"accent",children:[((g=r.tasks)==null?void 0:g.length)||0," tagged",t&&e.jsx("button",{type:"button",onClick:a,className:"edit-link",children:"edit"})]})}),e.jsx("div",{className:"paper-tags",style:{marginBottom:8},children:(r.tasks??[]).map(u=>e.jsx(qs,{slug:u.slug||"",label:u.name},u.id))}),e.jsx(we,{id:"methods",label:"Methods",accent:e.jsxs("span",{className:"accent",children:[((x=r.methods)==null?void 0:x.length)||0," used",t&&e.jsx("button",{type:"button",onClick:s,className:"edit-link",children:"edit"})]})}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:8},children:(r.methods??[]).map(u=>e.jsx(Ks,{method:u},u.id))})]})}const xe=["my-bookmark-ids"],ut="pwc:pending-bookmark";function Hr(t){window.sessionStorage.setItem(ut,JSON.stringify(t)),window.location.assign(pa(!0))}function Mr(){var r,n;const{user:t}=Le(),s=Z({queryKey:xe,queryFn:()=>it.getBookmarkIds(),enabled:!!t,staleTime:60*1e3,refetchOnWindowFocus:!1}),a=Fe.useMemo(()=>{var l;return new Set(((l=s.data)==null?void 0:l.paper_ids)??[])},[(r=s.data)==null?void 0:r.paper_ids]);return{ids:((n=s.data)==null?void 0:n.paper_ids)??[],idSet:a,isLoading:s.isLoading,isError:s.isError}}function zr(){const{user:t}=Le(),s=le(),a=ce({mutationFn:async({paperId:n,isBookmarked:l})=>{l?await it.removeBookmark(n):await it.addBookmark(n)},onMutate:async({paperId:n,isBookmarked:l})=>{await s.cancelQueries({queryKey:xe});const i=s.getQueryData(xe),o=typeof n=="string"?Number(n):n,c=(i==null?void 0:i.paper_ids)??[],g=l?c.filter(x=>x!==o):[o,...c.filter(x=>x!==o)];return s.setQueryData(xe,{paper_ids:g}),{previous:i}},onError:(n,l,i)=>{i!=null&&i.previous&&s.setQueryData(xe,i.previous),n instanceof nt&&n.code==="saved_papers_bucket_authorization_required"&&Hr(l)},onSettled:()=>{s.invalidateQueries({queryKey:xe}),s.invalidateQueries({queryKey:["my-bookmarks"]})}});return Fe.useEffect(()=>{if(!t||a.isPending)return;const n=new URL(window.location.href);if(n.searchParams.get(It)!=="1")return;n.searchParams.delete(It),window.history.replaceState({},"",`${n.pathname}${n.search}${n.hash}`);const l=window.sessionStorage.getItem(ut);if(l){window.sessionStorage.removeItem(ut);try{const i=JSON.parse(l);(typeof i.paperId=="number"||typeof i.paperId=="string")&&typeof i.isBookmarked=="boolean"&&a.mutate(i)}catch{}}},[a,t]),{toggle:Fe.useCallback((n,l)=>{if(!t){if(Kt())return;const i=typeof window<"u"?window.location.pathname+window.location.search:"/";window.location.href=Ts(`/api/v1/auth/hf/login?return_to=${encodeURIComponent(i)}`);return}a.mutate({paperId:n,isBookmarked:l})},[a,t]),isPending:a.isPending}}const qr=({paperId:t})=>{const{user:s}=Le(),{idSet:a}=Mr(),{toggle:r,isPending:n}=zr();if(Kt())return null;const l=Number(t),i=!!s&&a.has(l),o=()=>{Number.isFinite(l)&&r(l,i)},c=s&&i?"Saved":"Save",g=s?i?"Remove from saved papers":"Save this paper":"Sign in with Hugging Face to save this paper";return e.jsxs("button",{type:"button",className:`action-btn${i?" is-saved":""}`,onClick:o,disabled:n,"aria-pressed":i,"aria-label":g,title:g,children:[e.jsx(G,{name:"bookmark",size:12}),c]})};function $e({children:t,showEdit:s=!1,onEdit:a,editAriaLabel:r}){return s?e.jsxs("span",{className:"action-btn-composite",children:[t,e.jsx("button",{type:"button",className:"action-btn-segment action-btn-edit",onClick:a,"aria-label":r,children:"edit"})]}):t}function Kr(t){return e.jsx(as,{...t,kind:"enrich-paper",triggerClassName:"action-btn"})}const Or={tasks:"tasks",methods:"methods",results:"evaluation results",repositories:"GitHub repositories","project-pages":"project pages","hf-artifacts":"Hugging Face artifacts",organizations:"organizations","source-url":"source URL"};function Ut(t){if(!t)return"—";try{return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"—"}}function Qr(t){return t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Bt(t,s){try{const a=new URL(t),n=a.pathname.replace(/\/$/,"").split("/").filter(Boolean).at(-1);return n?n.replace(/[-_]+/g," "):a.hostname.replace(/^www\./,"")}catch{return s}}const _n=()=>{const{arxivId:t}=Us(),s=Dt(),{toast:a}=te(),{user:r}=Le(),n=(r==null?void 0:r.is_admin)??!1,l=!!r,i=fa(r),o=!0,{arxivId:c,evaluations:g,evaluationsByTask:x,evaluationsLoading:u,paper:m,paperError:k,paperLoading:E,presentation:v,refetchEvaluations:j,refetchPaper:R,relatedQuery:$,versions:T,visibleEvaluations:N}=$a(t,i),[y,h]=p.useState(!1),{activeEditor:f,openEditor:w,setEditorOpen:A}=Fa();p.useEffect(()=>{i!=="direct"||!(m!=null&&m.id)||(f&&f!=="results"&&V.primeCurationState(m.id).catch(()=>{}),f==="results"&&Te.primeCurationState(m.id).catch(()=>{}))},[f,i,m==null?void 0:m.id]);const[U,H]=p.useState(null),O=p.useRef(!1);p.useEffect(()=>{if(!r||!m||O.current)return;const _=sessionStorage.getItem("pwc:fresh-auth-edit");if(!_)return;O.current=!0;const q=Ra(_);if(!V.freshAuthMutationDraft()){sessionStorage.removeItem("pwc:fresh-auth-edit"),q&&w(q);return}if(!window.confirm("You signed in again. Apply the saved destructive catalog edit now? The server will recheck the current catalog version before changing anything.")){a({title:"Edit kept locally",description:"Nothing was changed. Reload this paper when you are ready to confirm the saved edit."});return}V.resumeFreshAuthMutation().then(()=>{a({title:"Edit applied",description:"The restored catalog edit was applied."}),window.location.reload()}).catch(Ct=>{a({variant:"destructive",title:"Could not apply the saved edit",description:Ct instanceof Error?Ct.message:"Please reload and review the edit again."})})},[w,m,a,r]);const J=p.useMemo(()=>{if(!r||!(m!=null&&m.author_links))return!1;const _=r.username.toLowerCase();return m.author_links.some(q=>!!q.hf_username&&q.hf_username.toLowerCase()===_)},[r,m==null?void 0:m.author_links]),d=_=>{if(!l){H(_);return}w(_)},[C,I]=p.useState("idle"),[L,S]=p.useState(null),[K,X]=p.useState(null),b=async()=>{if(c){I("indexing"),S(null),X(null);try{await V.indexFromArxiv(c),a({title:"Indexed",description:"Paper added to database."}),setTimeout(()=>R(),1200),I("idle")}catch(_){const q=_;let ke=q.message||"Failed to index paper";if(q.response)try{ke=JSON.parse(q.response).detail||ke}catch{ke=q.response}S(ke),(q.status===429||q.status===503)&&X("Try again later after arXiv has lifted the temporary limit."),I("idle")}}},P=(v==null?void 0:v.citationCopy)??"",F=(v==null?void 0:v.copyableRanks)??[],[B,M]=p.useState(!1),Q=async()=>{if(P)try{await navigator.clipboard.writeText(P),M(!0),a({title:"Citation copied",description:"BibTeX entry copied to clipboard."}),window.setTimeout(()=>M(!1),1500)}catch{a({title:"Copy failed",description:"Could not access the clipboard. Please copy manually.",variant:"destructive"})}},z=async()=>{if(!m)return;const _=m.arxiv_id||m.id,q=xa(_,F);if(q)try{await navigator.clipboard.writeText(q),a({title:"PwC badges copied",description:"Each badge follows its current leaderboard result."})}catch{a({title:"Copy failed",description:"Could not access the clipboard. Please try again.",variant:"destructive"})}};if(E)return e.jsxs("div",{className:"page",children:[e.jsx(Ne,{className:"h-12 w-3/4 mb-4"}),e.jsx(Ne,{className:"h-6 w-1/3 mb-8"}),e.jsx(Ne,{className:"h-64 w-full"})]});if(k||!m)return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(de,{to:"/papers",children:"Papers"}),e.jsx("span",{className:"sep",children:"/"}),e.jsxs("span",{style:{color:"var(--ink)"},children:["arXiv:",c]})]}),e.jsx("h1",{className:"detail-title",children:"Paper not indexed yet"}),e.jsxs("p",{style:{fontFamily:"var(--serif)",color:"var(--ink-soft)",marginTop:16,maxWidth:640},children:["We don't have ",e.jsxs("span",{style:{fontFamily:"var(--mono)"},children:["arXiv:",c]})," in the database. You can index it from arXiv right now."]}),L&&e.jsx(ea,{variant:"destructive",className:"mt-4 max-w-xl",children:e.jsxs(ta,{children:[e.jsx("div",{children:L}),K&&e.jsx("div",{className:"mt-2",children:K})]})}),e.jsxs("div",{className:"action-row",children:[n&&e.jsxs("button",{className:"action-btn",onClick:b,disabled:C==="indexing",children:[e.jsx(G,{name:"sparkle",size:12}),C==="indexing"?"Indexing…":"Index from arXiv"]}),e.jsx(D,{variant:"outline",onClick:()=>s("/papers"),children:"Browse Papers"})]})]});if(!v)return null;const{allHfArtifactUrls:bs,authorEntries:ze,citationDisplay:js,hasIntroducedItems:ys,hasLineageItems:vs,hfArtifactViewer:qe,hfPaperExists:ks,introducedBenchmarks:ws,introducedFrameworks:jt,introducedMethods:_s,introducedSummary:Ns,numPages:yt,paperSourceLabel:vt,predecessorPapers:Ke,projectPages:ye,repoSummary:ve,safeAbstractUrl:kt,safeConferenceUrl:wt,safePdfUrl:_t,sourceActionLabel:Cs,successorPapers:Oe}=v,Pe=12,Nt=y||ze.length<=Pe?ze:ze.slice(0,Pe);return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(de,{to:"/",children:"Trending"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{children:vt})]}),e.jsxs("div",{className:"detail-grid",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"detail-hero",children:[e.jsxs("div",{className:"detail-hero-main",children:[e.jsx("h1",{className:"detail-title",children:e.jsx(Ae,{title:m.title})}),e.jsxs("div",{className:"detail-meta",children:[e.jsx("span",{children:vt}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:["Submitted ",Ut(m.published)]}),yt&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:[yt," pages"]})]}),m.citation_count!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:[m.citation_count.toLocaleString()," citations"]})]}),(m.proceeding||m.conference_slug)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),m.conference_slug?e.jsx("a",{href:`/conferences/${m.conference_slug}`,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-text)"},children:(m.proceeding||m.conference_name||"").replace(/\s+\d{1,2}$/,"")}):e.jsx("span",{children:m.proceeding.replace(/\s+\d{1,2}$/,"")})]}),T.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("select",{className:"version-select",value:m.version,onChange:_=>{const q=_.target.value;m.arxiv_id&&s(`/paper/${m.arxiv_id.replace(/v\d+$/,"")}${q?`?version=${q}`:""}`)},children:T.map(_=>e.jsxs("option",{value:_.version,children:[_.version," — ",Ut(_.published)]},_.version))})]})]}),e.jsxs("div",{className:"detail-authors",children:[Nt.map((_,q)=>e.jsxs(Fe.Fragment,{children:[_.id?e.jsx(de,{to:`/authors/${_.id}`,children:_.name}):_.hf_username?e.jsx("a",{href:`https://huggingface.co/${_.hf_username}`,target:"_blank",rel:"noopener noreferrer",title:`@${_.hf_username} on Hugging Face`,children:_.name}):e.jsx("a",{children:_.name}),qPe&&e.jsx("button",{className:"show-more-authors",onClick:()=>h(_=>!_),style:{marginLeft:8,background:"none",border:"none",cursor:"pointer",color:"var(--accent-text)",fontFamily:"var(--mono)",fontSize:12},children:y?"show fewer":`+${m.authors.length-Pe} more`})]}),e.jsxs("div",{className:"action-row",children:[_t&&e.jsxs("a",{className:"action-btn",href:_t,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(G,{name:"pdf",size:12})," View PDF"]}),kt&&e.jsx($e,{showEdit:m.source==="external"&&o,onEdit:()=>d("source-url"),editAriaLabel:"Edit source URL",children:e.jsxs("a",{className:m.source==="external"&&o?"action-btn-segment action-btn-main":"action-btn",href:kt,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(G,{name:"external",size:12})," ",Cs]})}),qe.paperHref&&ks&&e.jsxs("a",{className:"bm-action-btn",href:qe.paperHref,target:"_blank",rel:"noopener noreferrer","aria-label":"View on Hugging Face",children:["View on ",e.jsx("span",{"aria-hidden":"true",children:"🤗"})]}),ve.githubUrl&&e.jsx($e,{showEdit:o,onEdit:()=>d("repositories"),editAriaLabel:"Edit code repositories",children:e.jsxs("a",{className:"action-btn-segment action-btn-main",href:ve.githubUrl,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(G,{name:"github",size:12})," Code",ve.github!=null&&e.jsxs("span",{style:{opacity:.7,marginLeft:4},children:["· ",Qr(ve.github)," ★"]})]})}),ve.githubUrl?null:e.jsxs("button",{type:"button",className:"action-btn",onClick:()=>d("repositories"),title:"Add GitHub repository",children:[e.jsx(G,{name:"github",size:12})," Add code"]}),ye.length===1?e.jsx($e,{showEdit:o,onEdit:()=>d("project-pages"),editAriaLabel:"Edit project pages",children:e.jsxs("a",{className:"action-btn-segment action-btn-main",href:ye[0].safeHref??void 0,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(G,{name:"globe",size:12})," Project page"]})}):null,ye.length>1?e.jsx($e,{showEdit:o,onEdit:()=>d("project-pages"),editAriaLabel:"Edit project pages",children:e.jsxs(Bs,{children:[e.jsx(Ds,{asChild:!0,children:e.jsxs("button",{type:"button",className:"action-btn-segment action-btn-main",children:[e.jsx(G,{name:"globe",size:12})," Project page"]})}),e.jsx(Hs,{align:"start",className:"project-page-menu",children:ye.map((_,q)=>e.jsx(Ms,{asChild:!0,children:_.safeHref?e.jsx("a",{href:_.safeHref,target:"_blank",rel:"noopener noreferrer",children:Bt(_.url,`Project page ${q+1}`)}):e.jsx("span",{children:Bt(_.url,`Project page ${q+1}`)})},_.url))})]})}):null,ye.length===0&&l?e.jsxs("button",{type:"button",className:"action-btn",onClick:()=>d("project-pages"),title:"Add project page",children:[e.jsx(G,{name:"globe",size:12})," Add project page"]}):null,wt&&e.jsxs("a",{className:"action-btn",href:wt,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(G,{name:"external",size:12})," Conference"]}),(m.organizations||[]).map(_=>e.jsxs(de,{to:`/orgs/${_.slug}`,className:"action-btn",title:_.name,"aria-label":_.name,children:[_.logo_url&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",height:16,width:16,borderRadius:3,overflow:"hidden"},children:e.jsx("img",{src:_.logo_url,alt:"",style:{height:"150%",width:"150%",objectFit:"contain"},onError:q=>{q.currentTarget.style.display="none"}})}),_.name]},_.id)),e.jsx("button",{type:"button",className:"action-btn",onClick:()=>d("organizations"),children:"Edit organizations"}),n&&ua()&&e.jsx(Kr,{paperId:Number(m.id),paperTitle:m.title,onComplete:()=>void R()}),e.jsx(qr,{paperId:m.id})]}),m.leaderboard_ranks&&m.leaderboard_ranks.length>0&&e.jsx(Os,{wrap:!0,paperHref:`/paper/${m.arxiv_id||m.id}`,ranks:m.leaderboard_ranks.filter(_=>_.best_rank>=1&&_.best_rank<=3).map(_=>({name:_.dataset_name,slug:_.dataset_slug||null,rank:_.best_rank}))})]}),e.jsx("div",{className:"detail-hero-thumb detail-thumb-wrap",children:e.jsx(Qs,{paperId:m.arxiv_id||m.id,title:m.title,thumbnailUrl:zs(m.thumbnail_url),priority:!0})})]}),ys&&e.jsxs("div",{className:`introduced-banner${jt.length>0?" introduced-banner--framework":""}`,children:[e.jsx("span",{className:"introduced-label",children:"Introduced"}),e.jsxs("div",{className:"introduced-methods",children:[_s.map(_=>e.jsxs("button",{type:"button",className:"introduced-pill",onClick:()=>s(`/methods/${_.slug||_.id}`),children:[_.name,e.jsx("span",{className:"introduced-arrow",children:"→"})]},`method-${_.id}`)),ws.map(_=>e.jsxs("button",{type:"button",className:"introduced-pill",onClick:()=>s(`/benchmark/${_.slug||_.id}`),children:[_.name,e.jsx("span",{className:"introduced-arrow",children:"→"})]},`benchmark-${_.id}`)),jt.map(_=>e.jsxs("button",{type:"button",className:"introduced-pill",onClick:()=>s(`/frameworks#framework-${_.slug}`),children:[_.name,e.jsx("span",{className:"introduced-arrow",children:"→"})]},`framework-${_.slug}`))]}),e.jsxs("span",{className:"introduced-note",children:["This paper is the canonical source for ",Ns,"."]})]}),vs&&e.jsxs("div",{className:"introduced-banner lineage-banner",children:[Oe.length>0&&e.jsxs("div",{className:"lineage-row",children:[e.jsx("span",{className:"introduced-label lineage-label",children:Oe.length===1?"Follow-up paper":"Follow-up papers"}),e.jsx("div",{className:"introduced-methods",children:Oe.map(_=>e.jsxs("button",{type:"button",className:"introduced-pill lineage-pill",onClick:()=>s(`/paper/${_.route_identifier}`),children:[e.jsx(Ae,{title:_.title}),e.jsx("span",{className:"introduced-arrow",children:"→"})]},`successor-${_.id}`))})]}),Ke.length>0&&e.jsxs("div",{className:"lineage-row",children:[e.jsx("span",{className:"introduced-label lineage-label",children:Ke.length===1?"Predecessor paper":"Predecessor papers"}),e.jsx("div",{className:"introduced-methods",children:Ke.map(_=>e.jsxs("button",{type:"button",className:"introduced-pill lineage-pill",onClick:()=>s(`/paper/${_.route_identifier}`),children:[e.jsx("span",{className:"introduced-arrow lineage-arrow-back",children:"←"}),e.jsx(Ae,{title:_.title})]},`predecessor-${_.id}`))})]})]}),e.jsx(Dr,{canEdit:o,onEditMethods:()=>d("methods"),onEditTasks:()=>d("tasks"),paper:m}),e.jsx(mr,{canCopyBadge:F.length>0,canEdit:o,evaluationsByTask:x,evaluationsLoading:u,isAdmin:n,onCopyBadge:z,onEdit:()=>d("results"),onRefresh:()=>void j(),paper:m,visibleEvaluationCount:(N==null?void 0:N.length)??0})]}),e.jsx(Tr,{allHfArtifactUrls:bs,citationCopied:B,citationDisplay:js,hfArtifactViewer:qe,onCopyCitation:Q,onEditHfArtifacts:()=>d("hf-artifacts"),onEditRepositories:()=>d("repositories"),paper:m,relatedIsLoading:$.isLoading,relatedPapers:$.data,user:r})]}),e.jsx(lr,{activeEditor:f,arxivId:c,editSubmitMode:i,evaluations:g??[],isAdmin:n,isLinkedAuthor:J,onOpenChange:A,paper:m}),e.jsx(sa,{open:U!==null,onOpenChange:_=>{_||H(null)},sectionLabel:U?Or[U]:"this paper",returnTo:typeof window<"u"?window.location.pathname:"/"})]})};export{_n as default}; +}`;return{citationDisplay:c(s,`{{${a}}}`),citationCopy:c(t.title,`{${r}}`)}}function Ea(t,s,a){var m,k,E,v;const r={models:t.hf_models??[],datasets:t.hf_datasets??[],spaces:t.hf_spaces??[]},n={models:Xe(r.models,s==null?void 0:s.modelUrls,"Model"),datasets:Xe(r.datasets,s==null?void 0:s.datasetUrls,"Dataset"),spaces:Xe(r.spaces,s==null?void 0:s.spaceUrls,"Space")},c={models:n.models.map(({href:j})=>j),datasets:n.datasets.map(({href:j})=>j),spaces:n.spaces.map(({href:j})=>j)},i=((m=t.arxiv_id)==null?void 0:m.replace(/v\d+$/,""))??null,o=t.arxiv_id?{isLoading:a,paperHref:`https://huggingface.co/papers/${i}`,rows:[{label:"Models",href:Ze(`https://huggingface.co/models?other=arxiv:${t.arxiv_id}`,r.models),count:We(r.models,s==null?void 0:s.modelUrls,s==null?void 0:s.models),isLimited:s==null?void 0:s.isLimited,links:n.models},{label:"Datasets",href:Ze(`https://huggingface.co/datasets?other=arxiv:${t.arxiv_id}`,r.datasets),count:We(r.datasets,s==null?void 0:s.datasetUrls,s==null?void 0:s.datasets),isLimited:s==null?void 0:s.isLimited,links:n.datasets},{label:"Spaces",href:Ze(`https://huggingface.co/papers/${i}`,r.spaces),count:We(r.spaces,s==null?void 0:s.spaceUrls,s==null?void 0:s.spaces),isLimited:s==null?void 0:s.isLimited,links:n.spaces}],footer:`Cite arxiv.org/abs/${i} in a HF README to link it here.`}:{isLoading:!1,paperHref:null,rows:[{label:"Models",href:Ye(r.models),count:r.models.length,links:n.models},{label:"Datasets",href:Ye(r.datasets),count:r.datasets.length,links:n.datasets},{label:"Spaces",href:Ye(r.spaces),count:r.spaces.length,links:n.spaces}],footer:null},l=(t.methods??[]).filter(({source_paper_id:j})=>j===t.id),g=t.introduced_benchmarks??[],x=t.introduced_frameworks??[],u=[l.length&&(l.length===1?"this method":"these methods"),g.length&&(g.length===1?"this benchmark":"these benchmarks"),x.length&&(x.length===1?"this framework":"these frameworks")].filter(j=>!!j);return{...Ca(t),allHfArtifactUrls:c,authorEntries:t.authors.map((j,R)=>{var $,T,N,y;return{name:j,id:((T=($=t.author_links)==null?void 0:$[R])==null?void 0:T.id)??null,hf_username:((y=(N=t.author_links)==null?void 0:N[R])==null?void 0:y.hf_username)??null}}),copyableRanks:ba(t.leaderboard_ranks),hasIntroducedItems:u.length>0,hasLineageItems:!!((k=t.predecessor_papers)!=null&&k.length||(E=t.successor_papers)!=null&&E.length),hfArtifactViewer:o,hfPaperExists:!!(s!=null&&s.paperExists),introducedBenchmarks:g,introducedFrameworks:x,introducedMethods:l,introducedSummary:u.join(" and "),numPages:t.num_pages||null,paperSourceLabel:t.arxiv_id?`arXiv:${t.arxiv_id}`:"External resource",predecessorPapers:t.predecessor_papers??[],projectPages:((v=t.project_pages)==null?void 0:v.filter(({url:j})=>j).map(j=>({...j,safeHref:be(j.url)})))??[],repoSummary:ta(t.repositories),safeAbstractUrl:be(t.url_abs),safeConferenceUrl:be(t.conference_url_abs),safePdfUrl:be(t.url_pdf),sourceActionLabel:t.source==="external"?"Source page":"arXiv page",successorPapers:t.successor_papers??[]}}const Sa=["tldr","abstract","tasks","methods","results"];function Pa(t){if(!t)return{section:null,resultsTaskSlug:null};const[s,a]=t.split("?",2);if(!Sa.includes(s))return{section:null,resultsTaskSlug:null};const r=s;return r!=="results"||!a?{section:r,resultsTaskSlug:null}:{section:r,resultsTaskSlug:new URLSearchParams(a).get("task")}}const Jt=t=>`results-task-${t}`,Ia=t=>`#results?task=${encodeURIComponent(t)}`;function $a(t,s){return t&&!!s}function Aa({direct:t,paperId:s,refetchEvaluations:a,refetchPaper:r}){r(),a(),!(!t||!s)&&(V.primeCurationState(s,!0).catch(()=>{}),Te.primeCurationState(s,!0).catch(()=>{}))}function Ra(t,s){const a=t?Es(t):"",r=Dt(),{toast:n}=te(),{preferences:c}=Ss(),i=Ys(a,!!a),o=i.data,[l,g]=p.useState(!1);p.useEffect(()=>{!t||t===a||r(`/paper/${a}${window.location.search}${window.location.hash}`,{replace:!0})},[a,r,t]),p.useEffect(()=>{if(o!=null&&o.title)return document.title=Zs(o.title),()=>{document.title=ea}},[o==null?void 0:o.title]),p.useEffect(()=>{if(g(!1),!(o!=null&&o.id))return;const N=window.setTimeout(()=>g(!0),0);return()=>window.clearTimeout(N)},[o==null?void 0:o.id]);const x=$a(l,o==null?void 0:o.id),u=_a(l?o==null?void 0:o.arxiv_id:void 0),m=ya(o==null?void 0:o.id,x),k=Z({queryKey:["paper-versions",o==null?void 0:o.arxiv_id],queryFn:()=>V.versions(o.arxiv_id.replace(/v\d+$/,"")),enabled:x&&!!(o!=null&&o.arxiv_id),staleTime:10*60*1e3}),E=Z({queryKey:["related-papers",o==null?void 0:o.id],queryFn:()=>V.related(o.arxiv_id||o.id,4),enabled:x,staleTime:10*60*1e3});p.useEffect(()=>{const N=()=>{Aa({direct:s==="direct",paperId:o==null?void 0:o.id,refetchEvaluations:m.refetch,refetchPaper:i.refetch}),n({title:"This section changed",description:"The latest state has been reloaded. Review your changes before submitting again.",variant:"destructive"})};return window.addEventListener("pwc:catalog-conflict",N),()=>window.removeEventListener("pwc:catalog-conflict",N)},[s,m.refetch,o==null?void 0:o.id,i.refetch,n]);const v=p.useMemo(()=>{const N=m.data;return!N||!c.hide_closed_source_evals?N:N.filter(y=>y.is_open!==!1)},[m.data,c.hide_closed_source_evals]),j=p.useMemo(()=>{if(!v)return[];const N=new Map;for(const y of v){const h=N.get(y.task_id);h?h.rows.push(y):N.set(y.task_id,{taskId:y.task_id,taskName:y.task_name||"—",taskSlug:y.task_slug,rows:[y]})}return[...N.values()]},[v]),R=p.useMemo(()=>j.map(({taskSlug:N})=>N??"").join("|"),[j]),$=p.useMemo(()=>o?Ea(o,u.data,u.isLoading):null,[u.data,u.isLoading,o]),T=p.useRef(!1);return p.useEffect(()=>{T.current=!1},[a]),p.useEffect(()=>{let N=0;const y=(f=!1,_=!1)=>{const{section:A,resultsTaskSlug:U}=Pa(window.location.hash.slice(1));if(!A||!o||A==="tldr"&&!o.tldr||A==="results"&&(!x||m.isLoading)||!f&&T.current)return;let H=A==="results"&&U?document.getElementById(Jt(U)):document.getElementById(A);if(!H&&A==="results"&&U){if(j.some(({taskSlug:O})=>O===U))return;H=document.getElementById("results")}H&&(N=window.requestAnimationFrame(()=>{T.current=!0,H.scrollIntoView({block:"start",behavior:_?"smooth":"auto"})}))};y();const h=()=>{T.current=!1,y(!0,!0)};return window.addEventListener("hashchange",h),()=>{window.removeEventListener("hashchange",h),N&&window.cancelAnimationFrame(N)}},[j,m.isLoading,o,R,x]),{arxivId:a,evaluations:m.data,evaluationsByTask:j,evaluationsLoading:m.isLoading,hfLoading:u.isLoading,hfRepos:u.data,paper:o,paperError:i.error,paperLoading:i.isLoading,presentation:$,refetchEvaluations:m.refetch,refetchPaper:i.refetch,relatedQuery:E,versions:k.data??[],visibleEvaluations:v}}const Fa={tasks:"tasks",methods:"methods",evaluations:"results",repositories:"repositories",project_pages:"project-pages",hf_artifacts:"hf-artifacts",organizations:"organizations",source_url:"source-url"};function La(t){return Fa[t]??null}function Ta(){const[t,s]=p.useState(null),a=p.useCallback(n=>{s(n)},[]),r=p.useCallback((n,c)=>{s(i=>c?n:i===n?null:i)},[]);return{activeEditor:t,openEditor:a,setEditorOpen:r}}function Ua(t){const s=t==null?void 0:t.trim();if(!s)return;const a=Number(s);return Number.isFinite(a)?Math.trunc(a):void 0}function At(t){const s=t.trim();if(!s)return null;const a=Number(s);return Number.isFinite(a)&&a>=0?Math.trunc(a):null}function et(t){return t.trim()||null}function Ba(t){const s=Number.parseInt(t.task_id,10),a=Number.parseInt(t.dataset_id,10);return Number.isFinite(s)&&Number.isFinite(a)?{taskId:s,datasetId:a}:null}function Da(t,s){const a=[];for(const r of t){if(r.operation==="delete"&&r.id){a.push({kind:"delete",evaluationId:Number.parseInt(r.id,10)});continue}if(r.operation!=="create"&&r.operation!=="update")continue;const n=Ba(r),c=r.metric_name.trim();if(!n||!c||!r.metric_value.trim())continue;const i=s(r.task_id,r.dataset_id),o={task_id:n.taskId,dataset_id:n.datasetId,metrics:{[c]:r.metric_value},best_metric:c,is_open:r.is_open},l=r.model_name.trim(),g=Ua(r.best_rank);if(r.operation==="create"){const x=At(r.num_parameters),u=et(r.hf_model_url);a.push({kind:"create",data:{...o,...l?{model_name:l}:{},...i&&r.harness.trim()?{harness:r.harness.trim()}:{},...g!==void 0?{best_rank:g}:{},...x!==null?{num_parameters:x}:{},...u!==null?{hf_model_url:u}:{}}});continue}r.id&&a.push({kind:"update",evaluationId:Number.parseInt(r.id,10),data:{...o,...l?{model_name:l}:{},harness:i?et(r.harness):null,...g!==void 0?{best_rank:g}:{},num_parameters:At(r.num_parameters),hf_model_url:et(r.hf_model_url)}})}return a}function Ha(t,s){return s.map(a=>a.kind==="delete"?{operation:"delete",evaluation_id:a.evaluationId}:{operation:a.kind,...a.kind==="update"?{evaluation_id:a.evaluationId}:{},payload:a.kind==="create"?{paper_id:t,...a.data}:a.data})}function Ma(t){return t.map(s=>s.kind==="delete"?{op:"delete",evaluation_id:s.evaluationId}:s.kind==="update"?{op:"update",evaluation_id:s.evaluationId,data:s.data}:{op:"create",data:s.data})}function pe({isAuthor:t=!1}){const s=typeof window<"u"&&window.location.hostname==="staging.paperswithcode.co";return e.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-100",children:[e.jsx("p",{className:"font-medium",children:s?"Test-only: this change stays on staging.":"Your changes will be reviewed by an admin."}),e.jsx("p",{className:"mt-1 leading-snug",children:s?"This exercises staging-local pending behavior and is not queued for production review.":t?"We can see this paper is yours. While we're in early access an admin still reviews each edit; this will become automatic for authors soon.":"Submissions are queued for review and don't change the paper page until an admin approves them."})]})}const tt=100;function za(t){return(t??[]).some(s=>s.slug==="coding-agents"||s.name.trim().toLowerCase()==="coding agents")}function qa(t){return t.map(s=>{const a=s.best_metric||Object.keys(s.metrics)[0],r=s.metrics[a];return{id:s.id,task_id:s.task_id,dataset_id:s.dataset_id,model_name:s.model_name||"",harness:s.harness||"",metric_name:a||"",metric_value:String(r||""),best_rank:s.best_rank?String(s.best_rank):"",num_parameters:s.num_parameters!=null?String(s.num_parameters):"",hf_model_url:s.hf_model_url||"",is_open:s.is_open!==!1,operation:"unchanged"}})}function Ka(t){const s=new Map;return t.forEach(a=>{a.task_id&&a.task_name&&s.set(a.task_id,{id:a.task_id,name:a.task_name,slug:a.task_slug,level:0})}),s}function Oa(t){const s=new Map;return t.forEach(a=>{a.dataset_id&&a.dataset_name&&s.set(a.dataset_id,{id:a.dataset_id,name:a.dataset_name,slug:a.dataset_slug})}),s}function Rt(t,s){return`${t}:${s}`}function Qa({open:t,onOpenChange:s,paperId:a,arxivId:r,initialEvaluations:n,paperTasks:c,onSuccess:i,submitMode:o="direct",isAdmin:l=!1,isAuthor:g=!1}){const x=za(c),[u,m]=p.useState([]),[k,E]=p.useState(null),[v,j]=p.useState(new Map),[R,$]=p.useState(new Map),T=ce(),{toast:N}=te(),y=p.useRef(!1),h=p.useRef(!1);p.useEffect(()=>{if(!t){y.current=!1,h.current=!1;return}y.current||h.current||n.length!==0&&(y.current=!0,m(qa(n)),j(Ka(n)),$(Oa(n)))},[t,n]);const f=p.useMemo(()=>Array.from(new Set(u.map(b=>b.task_id).filter(b=>b&&b!==""))),[u]),_=p.useMemo(()=>{const b=new Set;return u.forEach(P=>{P.task_id&&P.dataset_id&&b.add(Rt(P.task_id,P.dataset_id))}),Array.from(b)},[u]),A=Z({queryKey:["datasets-by-tasks-for-eval-edit",f,t],queryFn:async()=>{const b={};return await Promise.all(f.map(async P=>{try{const F=await fe.listDatasets({task_id:parseInt(P),page_size:tt});b[P]=F.results}catch(F){console.error(`Error fetching datasets for task ${P}:`,F),b[P]=[]}})),b},enabled:t&&f.length>0});p.useEffect(()=>{A.data&&$(b=>{const P=new Map(b);return Object.values(A.data).forEach(F=>{F.forEach(B=>{P.set(B.id,B)})}),P})},[A.data]);const U=Z({queryKey:["leaderboard-metrics-for-eval-edit",_,t],queryFn:async()=>{const b={};return await Promise.all(_.map(async P=>{const[F,B]=P.split(":");try{b[P]=await fe.leaderboardMetrics(B,F)}catch(M){console.error(`Error fetching metrics for leaderboard ${P}:`,M),b[P]=[]}})),b},enabled:t&&_.length>0}),H=async b=>{const P=await fe.listTasks({page_size:tt,...b?{q:b}:{}});return j(F=>{const B=new Map(F);return P.results.forEach(M=>B.set(M.id,M)),B}),P.results.map(F=>{var B;return{value:F.id,label:F.name,description:(B=F.description)==null?void 0:B.slice(0,100)}})},O=b=>async P=>{const F=await fe.listDatasets({task_id:parseInt(b),page_size:tt,...P?{q:P}:{}});return $(B=>{const M=new Map(B);return F.results.forEach(Q=>M.set(Q.id,Q)),M}),F.results.map(B=>({value:B.id,label:B.name,description:B.full_name}))},J=(b,P)=>{if(!b||!P)return!1;const F=R.get(P);return!!(F!=null&&F.supports_harness)},d=(b,P,F)=>{var Q;if(!b||!P)return[];const M=(((Q=U.data)==null?void 0:Q[Rt(b,P)])||[]).map(z=>({value:z.metric_name,label:z.metric_name,description:z.metric_direction==="higher_is_better"?"Higher is better":"Lower is better"}));return F&&!M.some(z=>z.value===F)&&M.unshift({value:F,label:`${F} (legacy)`}),M},C=de({mutationFn:async({paperId:b,evaluations:P})=>{const F=Da(P,J);if(!l&&o==="direct"&&F.length>50)throw new Error("Contributor evaluation batches are limited to 50 operations; contact an admin.");if(F.length===0)return{submitted:!1};const B=Number.parseInt(b,10);return o==="pending"?await he.submit({paper_id:B,edit_type:"evaluations",proposed_payload:{operations:Ma(F)}}):await Te.batch(B,Ha(B,F)),{submitted:!0}},onSuccess:b=>{if(o==="pending"){b!=null&&b.submitted?N({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed evaluation changes shortly."}):N({title:"No changes to submit",description:"Your evaluation list matches the existing data."}),i==null||i(),s(!1);return}T.invalidateQueries({queryKey:["paper-arxiv",r]}),T.invalidateQueries({queryKey:["evaluations","paper",a]}),i==null||i(),s(!1)},onError:b=>{var B;const P=b;let F=P.message||(o==="pending"?"Failed to submit your edit. Please try again.":"Failed to update evaluations.");if(P.response)try{const M=JSON.parse(P.response);typeof(M==null?void 0:M.detail)=="string"?F=M.detail:Array.isArray(M==null?void 0:M.detail)&&((B=M.detail[0])!=null&&B.msg)&&(F=M.detail[0].msg)}catch{F=P.response}N({title:o==="pending"?"Could not submit edit":"Could not save evaluations",description:F,variant:"destructive"})}}),I=()=>{h.current=!0,m([...u,{task_id:"",dataset_id:"",model_name:"",harness:"",metric_name:"",metric_value:"",best_rank:"",num_parameters:"",hf_model_url:"",is_open:!0,operation:"create"}])},L=b=>{if(h.current=!0,u[b].id){if(!window.confirm("Delete this evaluation? You will be asked to sign in again if your session is older than 15 minutes."))return;m(u.map((F,B)=>B===b?{...F,operation:"delete"}:F))}else m(u.filter((F,B)=>B!==b))},S=(b,P,F)=>{h.current=!0,m(u.map((B,M)=>{if(M!==b)return B;const Q={...B,[P]:F};return P==="task_id"&&(Q.dataset_id="",Q.metric_name="",Q.harness=""),P==="dataset_id"&&(Q.metric_name="",F&&!J(Q.task_id,F)&&(Q.harness="")),B.operation==="unchanged"&&(Q.operation="update"),Q}))},K=(b,P)=>{h.current=!0,m(u.map((F,B)=>{if(B!==b)return F;const M={...F,is_open:P};return F.operation==="unchanged"&&(M.operation="update"),M}))},X=()=>{const b=u.filter(P=>P.operation!=="delete"||P.id);C.mutate({paperId:a,evaluations:b})};return e.jsxs(se,{open:t,onOpenChange:s,children:[e.jsxs(ae,{className:"max-w-6xl max-h-[800px]",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Evaluation Results"}),e.jsx(ie,{children:"Add, edit, or remove evaluation results for this paper. Each row represents a benchmark result."})]}),o==="pending"&&e.jsx(pe,{isAuthor:g}),e.jsxs("div",{className:"py-4 overflow-y-auto max-h-[600px]",children:[u.filter(b=>b.operation!=="delete").length>0?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border",children:[e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm min-w-[180px]",children:"Task"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm min-w-[180px]",children:"Dataset"}),e.jsx("th",{className:`text-left py-2 px-2 font-medium text-sm ${x?"min-w-[140px]":"min-w-[240px]"}`,children:"Model"}),x&&e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm min-w-[140px]",children:"Harness"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm min-w-[140px]",children:"Metric"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm",children:"Value"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm",children:"Parameters"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm min-w-[200px]",children:"HF model URL"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm w-20",children:"Open source"}),e.jsx("th",{className:"text-left py-2 px-2 font-medium text-sm w-16",children:"Action"})]})}),e.jsx("tbody",{children:u.map((b,P)=>{if(b.operation==="delete")return null;const F=v.get(b.task_id),B=R.get(b.dataset_id),M=d(b.task_id,b.dataset_id,b.metric_name),Q=!!(b.task_id&&b.dataset_id)&&U.isFetching;return e.jsxs("tr",{className:"border-b border-border",children:[e.jsx("td",{className:"py-2 px-2",children:e.jsx(Et,{value:b.task_id,onChange:z=>S(P,"task_id",z),placeholder:"Select task",searchPlaceholder:"Search tasks...",emptyMessage:"No tasks found.",selectedOption:F?{value:F.id,label:F.name}:null,queryKey:["eval-edit-task-search"],queryFn:H,enabled:t})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(Et,{value:b.dataset_id,onChange:z=>S(P,"dataset_id",z),placeholder:b.task_id?"Select dataset":"Select task first",searchPlaceholder:"Search datasets...",emptyMessage:b.task_id?"No datasets found for this task.":"Select a task first.",disabled:!b.task_id,selectedOption:B?{value:B.id,label:B.name}:null,queryKey:["eval-edit-dataset-search",b.task_id],queryFn:O(b.task_id),enabled:t&&!!b.task_id})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(W,{type:"text",className:"w-full text-sm",placeholder:"Model name",value:b.model_name,onChange:z=>S(P,"model_name",z.target.value)})}),x&&e.jsx("td",{className:"py-2 px-2",children:J(b.task_id,b.dataset_id)?e.jsx(W,{type:"text",className:"w-full text-sm",placeholder:"Claude Code, Terminus, ...",value:b.harness,onChange:z=>S(P,"harness",z.target.value)}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not supported"})}),e.jsx("td",{className:"py-2 px-2",children:!b.task_id||!b.dataset_id?e.jsx("span",{className:"text-xs text-muted-foreground",children:"Select task + dataset"}):Q?e.jsxs("span",{className:"inline-flex items-center text-xs text-muted-foreground",children:[e.jsx(ee,{className:"mr-1 h-3 w-3 animate-spin"}),"Loading metrics..."]}):M.length>0?e.jsxs("select",{className:"w-full rounded-md border border-border bg-background px-2 py-1 text-sm",value:b.metric_name,onChange:z=>S(P,"metric_name",z.target.value),children:[e.jsx("option",{value:"",children:"Select metric"}),M.map(z=>e.jsx("option",{value:z.value,children:z.label},z.value))]}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"No configured metrics"})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(W,{type:"text",className:"w-full text-sm",placeholder:"44.9",value:b.metric_value,onChange:z=>S(P,"metric_value",z.target.value)})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(W,{type:"number",min:0,step:1,className:"w-full text-sm",placeholder:"e.g. 7000000000",value:b.num_parameters,onChange:z=>S(P,"num_parameters",z.target.value),title:"Raw model parameter count (e.g. 7000000000 for a 7B model). Leave blank if unknown."})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(W,{type:"url",className:"w-full text-sm",placeholder:"https://huggingface.co/org/model",value:b.hf_model_url,onChange:z=>S(P,"hf_model_url",z.target.value),title:"Hugging Face model page for this row (must start with https://huggingface.co/). Leave blank if none."})}),e.jsx("td",{className:"py-2 px-2 text-center",children:e.jsx("input",{type:"checkbox",className:"h-4 w-4 align-middle",checked:b.is_open,onChange:z=>K(P,z.target.checked),title:"Whether the evaluated model is open-source. Uncheck for closed-source models."})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>L(P),className:"h-8 w-8 p-0 text-destructive hover:text-destructive",title:"Delete row",children:e.jsx(Be,{className:"w-4 h-4"})})})]},P)})})]})}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(na,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"No evaluation results yet"}),e.jsx("p",{className:"text-sm mt-2",children:'Click "Add Row" below to add a new evaluation'})]}),e.jsx("div",{className:"mt-4",children:e.jsxs(D,{variant:"outline",size:"sm",onClick:I,className:"flex items-center space-x-2",children:[e.jsx(Ue,{className:"w-4 h-4"}),e.jsx("span",{children:"Add Row"})]})})]}),e.jsxs(oe,{children:[e.jsxs("div",{className:"flex flex-wrap gap-2 sm:mr-auto",children:[e.jsx(D,{variant:"ghost",onClick:()=>E("benchmark"),children:"Suggest a new benchmark"}),e.jsx(D,{variant:"ghost",onClick:()=>E("metric"),children:"Suggest a new metric"})]}),e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:X,disabled:C.isPending,children:C.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),o==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),o==="pending"?"Submit for review":"Save Changes"]})})]})]}),e.jsx(gt,{open:k!==null,onOpenChange:b=>{b||E(null)},paperId:a,kind:k??"benchmark"})]})}function Ga(t,s,a){if(!t)return t;const r=n=>n.paper_id!==s||n.paper_title===a?n:{...n,paper_title:a};if(Array.isArray(t)){const n=t.map(r);return n.some((i,o)=>i!==t[o])?n:t}if(Array.isArray(t.results)){const n=t.results.map(r);return n.some((i,o)=>i!==t.results[o])?{...t,results:n}:t}return t}function je(t,s,a){new Set([...a,s.id,s.arxiv_id].filter(i=>!!i)).forEach(i=>{t.setQueryData(["paper",i],s),t.setQueryData(["paper-arxiv",i],s)}),t.invalidateQueries({queryKey:["papers"],refetchType:"none"}),t.invalidateQueries({queryKey:["papers-infinite"],refetchType:"none"}),t.invalidateQueries({queryKey:["task-papers-infinite"],refetchType:"none"});const n=String(s.id),c=i=>Ga(i,n,s.title);t.setQueriesData({queryKey:["evaluations"]},c),t.setQueriesData({queryKey:["dataset-evals"]},c),t.invalidateQueries({queryKey:["evaluations"],refetchType:"none"}),t.invalidateQueries({queryKey:["dataset-evals"],refetchType:"none"})}const st=[{key:"hf_models",label:"Models",placeholder:"https://huggingface.co/org/model"},{key:"hf_datasets",label:"Datasets",placeholder:"https://huggingface.co/datasets/org/data"},{key:"hf_spaces",label:"Spaces",placeholder:"https://huggingface.co/spaces/org/demo"}];function Ft(t){return t.map(s=>s.trim()).filter(Boolean)}function at(t,s){const a=Ft(t).sort(),r=Ft(s).sort();return a.length!==r.length?!1:a.every((n,c)=>n===r[c])}function Va(t,s){return at(t.hf_models,s.hf_models)&&at(t.hf_datasets,s.hf_datasets)&&at(t.hf_spaces,s.hf_spaces)}function Ja({open:t,onOpenChange:s,paperId:a,arxivId:r,initialArtifacts:n,onSuccess:c,submitMode:i="direct",isAuthor:o=!1}){const[l,g]=p.useState(n),[x,u]=p.useState({hf_models:"",hf_datasets:"",hf_spaces:""}),m=ce(),{toast:k}=te(),E=p.useRef(!1);p.useEffect(()=>{if(!t){E.current=!1;return}E.current||(E.current=!0,g(n),u({hf_models:"",hf_datasets:"",hf_spaces:""}))},[t,n]);const v=de({mutationFn:async({paperId:y,artifacts:h})=>i==="pending"?(await he.submit({paper_id:parseInt(y),edit_type:"hf_artifacts",proposed_payload:h}),null):V.updateHfArtifacts(y,h),onSuccess:y=>{if(i==="pending"){k({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed Hugging Face artifact changes shortly."}),c==null||c(),s(!1),u({hf_models:"",hf_datasets:"",hf_spaces:""});return}y&&je(m,y,[a,r]),c==null||c(),s(!1),u({hf_models:"",hf_datasets:"",hf_spaces:""})},onError:y=>{var _;const h=y;let f=h.message||(i==="pending"?"Failed to submit your edit. Please try again.":"Failed to update Hugging Face artifacts.");if(h.response)try{const A=JSON.parse(h.response);typeof(A==null?void 0:A.detail)=="string"?f=A.detail:Array.isArray(A==null?void 0:A.detail)&&((_=A.detail[0])!=null&&_.msg)&&(f=A.detail[0].msg)}catch{f=h.response}k({title:i==="pending"?"Could not submit edit":"Could not save Hugging Face artifacts",description:f,variant:"destructive"})}}),j=()=>{const y={hf_models:[...l.hf_models],hf_datasets:[...l.hf_datasets],hf_spaces:[...l.hf_spaces]};for(const{key:h}of st){const f=x[h].trim();if(f){if(y[h].some(_=>_.trim()===f))return alert(`This ${h.replace("hf_","")} URL is already added`),null;y[h]=[...y[h],f]}}return y},R=y=>{const h=x[y].trim();if(h){if(l[y].some(f=>f.trim()===h)){alert(`This ${y.replace("hf_","")} URL is already added`);return}g(f=>({...f,[y]:[...f[y],h]})),u(f=>({...f,[y]:""}))}},$=(y,h)=>{g(f=>({...f,[y]:f[y].filter(_=>_!==h)}))},T=()=>{const y=j();if(y===null)return;const h=Object.keys(n).some(f=>n[f].some(_=>!y[f].includes(_)));i==="direct"&&h&&!window.confirm("Remove one or more Hugging Face artifact links?")||v.mutate({paperId:a,artifacts:y})},N=p.useMemo(()=>{const y={hf_models:[...l.hf_models],hf_datasets:[...l.hf_datasets],hf_spaces:[...l.hf_spaces]};for(const{key:h}of st){const f=x[h].trim();if(f){if(y[h].some(_=>_.trim()===f))return!1;y[h]=[...y[h],f]}}return!Va(y,n)},[l,x,n]);return e.jsx(se,{open:t,onOpenChange:s,children:e.jsxs(ae,{className:"max-w-2xl max-h-[700px]",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Hugging Face Artifacts"}),e.jsx(ie,{children:"Add or remove linked Hugging Face models, datasets, and Spaces for this paper."})]}),i==="pending"&&e.jsx(pe,{isAuthor:o}),e.jsx("div",{className:"space-y-6 py-2 overflow-y-auto max-h-[460px]",children:st.map(({key:y,label:h,placeholder:f})=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:h}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(W,{type:"url",placeholder:f,value:x[y],onChange:_=>u(A=>({...A,[y]:_.target.value})),onKeyPress:_=>{_.key==="Enter"&&(_.preventDefault(),R(y))},className:"flex-1"}),e.jsxs(D,{onClick:()=>R(y),size:"sm",disabled:!x[y].trim(),children:[e.jsx(Ue,{className:"w-4 h-4 mr-1"}),"Add"]})]}),l[y].length>0?e.jsx("div",{className:"space-y-2",children:l[y].map(_=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx("span",{className:"text-sm font-medium text-paper-blue truncate flex-1",children:_}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>$(y,_),className:"h-8 px-2 text-destructive hover:text-destructive",title:`Remove ${h.toLowerCase()} URL`,children:e.jsx(Be,{className:"w-4 h-4"})})]},_))}):e.jsxs("div",{className:"text-xs text-muted-foreground",children:["No ",h.toLowerCase()," linked yet."]})]},y))}),e.jsxs(oe,{children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:T,disabled:v.isPending||!N,children:v.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),i==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),i==="pending"?"Submit for review":"Save Changes"]})})]})]})})}var De="Checkbox",[Xa]=pt(De),[Wa,xt]=Xa(De);function Ya(t){const{__scopeCheckbox:s,checked:a,children:r,defaultChecked:n,disabled:c,form:i,name:o,onCheckedChange:l,required:g,value:x="on",internal_do_not_use_render:u}=t,[m,k]=Mt({prop:a,defaultProp:n??!1,onChange:l,caller:De}),[E,v]=p.useState(null),[j,R]=p.useState(null),$=p.useRef(!1),T=E?!!i||!!E.closest("form"):!0,N={checked:m,disabled:c,setChecked:k,control:E,setControl:v,name:o,form:i,value:x,hasConsumerStoppedPropagationRef:$,required:g,defaultChecked:ue(n)?!1:n,isFormControl:T,bubbleInput:j,setBubbleInput:R};return e.jsx(Wa,{scope:s,...N,children:Za(u)?u(N):r})}var Xt="CheckboxTrigger",Wt=p.forwardRef(({__scopeCheckbox:t,onKeyDown:s,onClick:a,...r},n)=>{const{control:c,value:i,disabled:o,checked:l,required:g,setControl:x,setChecked:u,hasConsumerStoppedPropagationRef:m,isFormControl:k,bubbleInput:E}=xt(Xt,t),v=Se(n,x),j=p.useRef(l);return p.useEffect(()=>{const R=c==null?void 0:c.form;if(R){const $=()=>u(j.current);return R.addEventListener("reset",$),()=>R.removeEventListener("reset",$)}},[c,u]),e.jsx(ge.button,{type:"button",role:"checkbox","aria-checked":ue(l)?"mixed":l,"aria-required":g,"data-state":ss(l),"data-disabled":o?"":void 0,disabled:o,value:i,...r,ref:v,onKeyDown:Ce(s,R=>{R.key==="Enter"&&R.preventDefault()}),onClick:Ce(a,R=>{u($=>ue($)?!0:!$),E&&k&&(m.current=R.isPropagationStopped(),m.current||R.stopPropagation())})})});Wt.displayName=Xt;var bt=p.forwardRef((t,s)=>{const{__scopeCheckbox:a,name:r,checked:n,defaultChecked:c,required:i,disabled:o,value:l,onCheckedChange:g,form:x,...u}=t;return e.jsx(Ya,{__scopeCheckbox:a,checked:n,defaultChecked:c,disabled:o,required:i,onCheckedChange:g,name:r,form:x,value:l,internal_do_not_use_render:({isFormControl:m})=>e.jsxs(e.Fragment,{children:[e.jsx(Wt,{...u,ref:s,__scopeCheckbox:a}),m&&e.jsx(ts,{__scopeCheckbox:a})]})})});bt.displayName=De;var Yt="CheckboxIndicator",Zt=p.forwardRef((t,s)=>{const{__scopeCheckbox:a,forceMount:r,...n}=t,c=xt(Yt,a);return e.jsx(Ht,{present:r||ue(c.checked)||c.checked===!0,children:e.jsx(ge.span,{"data-state":ss(c.checked),"data-disabled":c.disabled?"":void 0,...n,ref:s,style:{pointerEvents:"none",...t.style}})})});Zt.displayName=Yt;var es="CheckboxBubbleInput",ts=p.forwardRef(({__scopeCheckbox:t,...s},a)=>{const{control:r,hasConsumerStoppedPropagationRef:n,checked:c,defaultChecked:i,required:o,disabled:l,name:g,value:x,form:u,bubbleInput:m,setBubbleInput:k}=xt(es,t),E=Se(a,k),v=Qt(c),j=zt(r);p.useEffect(()=>{const $=m;if(!$)return;const T=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(T,"checked").set,h=!n.current;if(v!==c&&y){const f=new Event("click",{bubbles:h});$.indeterminate=ue(c),y.call($,ue(c)?!1:c),$.dispatchEvent(f)}},[m,v,c,n]);const R=p.useRef(ue(c)?!1:c);return e.jsx(ge.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??R.current,required:o,disabled:l,name:g,value:x,form:u,...s,tabIndex:-1,ref:E,style:{...s.style,...j,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});ts.displayName=es;function Za(t){return typeof t=="function"}function ue(t){return t==="indeterminate"}function ss(t){return ue(t)?"indeterminate":t?"checked":"unchecked"}const He=p.forwardRef(({className:t,style:s,...a},r)=>e.jsx(bt,{ref:r,className:Re("peer h-4 w-4 shrink-0 rounded-sm ring-offset-background data-[state=checked]:!bg-black data-[state=checked]:!text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),style:{border:"1px solid #000",...s},...a,children:e.jsx(Zt,{className:Re("flex items-center justify-center text-current"),children:e.jsx(me,{className:"h-4 w-4"})})}));He.displayName=bt.displayName;const er=250,tr=100;function sr({open:t,onOpenChange:s,paperId:a,arxivId:r,initialMethodIds:n,initialMethods:c,onSuccess:i,submitMode:o="direct",isAuthor:l=!1}){const[g,x]=p.useState(n),[u,m]=p.useState(!1),[k,E]=p.useState(""),[v,j]=p.useState(""),[R,$]=p.useState(new Map),T=ce(),{toast:N}=te(),y=p.useRef(!1);p.useEffect(()=>{if(!t){y.current=!1;return}if(y.current)return;y.current=!0,x(n),E(""),j("");const d=new Map;(c||[]).forEach(C=>{const I=parseInt(C.id);Number.isNaN(I)||d.set(I,C)}),$(d)},[t,n,c]),p.useEffect(()=>{const d=window.setTimeout(()=>{j(k.trim())},er);return()=>window.clearTimeout(d)},[k]);const{data:h,isFetching:f}=Z({queryKey:["methods-search",v],queryFn:()=>fe.listMethods({page_size:tr,...v?{q:v}:{}}),enabled:t});p.useEffect(()=>{var d;(d=h==null?void 0:h.results)!=null&&d.length&&$(C=>{const I=new Map(C);return h.results.forEach(L=>{const S=parseInt(L.id);Number.isNaN(S)||I.set(S,L)}),I})},[h]);const _=p.useMemo(()=>{const d=(h==null?void 0:h.results)||[],C=new Set,I=[];return g.forEach(L=>{if(C.has(L))return;const S=R.get(L);S&&(I.push(S),C.add(L))}),d.forEach(L=>{const S=parseInt(L.id);Number.isNaN(S)||C.has(S)||(I.push(L),C.add(S))}),I},[h,g,R]),A=de({mutationFn:async({paperId:d,methodIds:C})=>o==="pending"?(await he.submit({paper_id:parseInt(d),edit_type:"methods",proposed_payload:{method_ids:C}}),null):V.updateMethods(d,C),onSuccess:d=>{if(o==="pending"){N({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed method changes shortly."}),i==null||i(),s(!1);return}d&&je(T,d,[a,r]),N({title:"Methods updated",description:`Saved ${g.length} method${g.length===1?"":"s"} for this paper.`}),i==null||i(),s(!1)},onError:d=>{var L;const C=d;let I=C.message||(o==="pending"?"Failed to submit your edit. Please try again.":"Failed to update paper methods.");if(C.response)try{const S=JSON.parse(C.response);typeof(S==null?void 0:S.detail)=="string"?I=S.detail:Array.isArray(S==null?void 0:S.detail)&&((L=S.detail[0])!=null&&L.msg)&&(I=S.detail[0].msg)}catch{I=C.response}N({title:o==="pending"?"Could not submit edit":"Could not save methods",description:I,variant:"destructive"})}}),U=()=>{o==="direct"&&n.some(d=>!g.includes(d))&&!window.confirm("Remove one or more method links from this paper?")||A.mutate({paperId:a,methodIds:g})},H=p.useMemo(()=>{if(g.length!==n.length)return!0;const d=new Set(n);return g.some(C=>!d.has(C))},[g,n]),O=(d,C)=>{x(I=>C?I.includes(d)?I:[...I,d]:I.filter(L=>L!==d))},J=()=>E("");return e.jsxs(se,{open:t,onOpenChange:s,children:[e.jsxs(ae,{className:"max-w-2xl max-h-[600px]",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Paper Methods"}),e.jsx(ie,{children:"Select the methods and techniques used in this paper. You can select multiple methods."})]}),o==="pending"&&e.jsx(pe,{isAuthor:l}),e.jsxs("div",{className:"relative mb-4",children:[e.jsx(Ee,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(W,{type:"text",placeholder:"Search methods...",value:k,onChange:d=>E(d.target.value),className:"pl-9 pr-9"}),k&&e.jsx("button",{type:"button",onClick:J,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":"Clear search",children:e.jsx(ft,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[400px]",children:_.length>0?e.jsx("div",{className:"space-y-2",children:_.map(d=>{const C=parseInt(d.id),I=g.includes(C);return e.jsxs("div",{className:"flex items-center space-x-2 p-2 hover:bg-muted/50 rounded-md",children:[e.jsx(He,{id:`method-${d.id}`,checked:I,onCheckedChange:L=>O(C,L===!0),className:"!border !border-black data-[state=checked]:!bg-black data-[state=checked]:!text-white"}),e.jsxs("label",{htmlFor:`method-${d.id}`,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer flex-1",children:[d.name,d.full_name&&d.full_name!==d.name&&e.jsx("span",{className:"block text-xs text-muted-foreground font-normal",children:d.full_name}),d.description&&e.jsxs("span",{className:"block text-xs text-muted-foreground font-normal mt-1",children:[d.description.substring(0,100),d.description.length>100?"...":""]})]})]},d.id)})}):f?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ee,{className:"w-8 h-8 mx-auto mb-2 animate-spin"}),e.jsx("p",{children:"Loading methods..."})]}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Ee,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:v?`No methods found matching "${v}"`:"No methods available"})]})}),e.jsxs(oe,{children:[e.jsx(D,{variant:"ghost",className:"sm:mr-auto",onClick:()=>m(!0),children:"Suggest a new method"}),e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:U,disabled:A.isPending||!H,children:A.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),o==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),o==="pending"?"Submit for review":"Save Changes"]})})]})]}),e.jsx(gt,{open:u,onOpenChange:m,paperId:a,kind:"method"})]})}const ar=({open:t,onOpenChange:s,paperId:a,initialOrganizationIds:r,submitMode:n,isAuthor:c})=>{var E;const[i,o]=p.useState(r),[l,g]=p.useState(""),x=ce();p.useEffect(()=>{t&&(o(r),g(""))},[r,t]);const u=Z({queryKey:["organizations","curation"],queryFn:()=>fe.organizations(!1),enabled:t}),m=p.useMemo(()=>{var j,R;const v=l.trim().toLocaleLowerCase();return v?(((R=u.data)==null?void 0:R.results)??[]).filter($=>$.name.toLocaleLowerCase().includes(v)):((j=u.data)==null?void 0:j.results)??[]},[(E=u.data)==null?void 0:E.results,l]),k=de({mutationFn:async()=>{r.some(j=>!i.includes(j))&&!window.confirm("Remove one or more organizations from this paper? Destructive edits may require a fresh sign-in.")||(n==="pending"?await he.submit({paper_id:Number(a),edit_type:"organizations",proposed_payload:{organization_ids:i}}):await V.updateOrganizations(a,i))},onSuccess:()=>{x.invalidateQueries({queryKey:["paper-arxiv"]}),s(!1)}});return e.jsx(se,{open:t,onOpenChange:s,children:e.jsxs(ae,{children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit organizations"}),e.jsx(ie,{children:"Associate existing organizations with this paper. Organization creation remains admin-only."})]}),n==="pending"&&e.jsx(pe,{isAuthor:c}),e.jsxs("div",{className:"relative",children:[e.jsx(Ee,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(W,{type:"search","aria-label":"Search organizations",placeholder:"Search organizations...",value:l,onChange:v=>g(v.target.value),className:"pl-9 pr-9"}),l&&e.jsx("button",{type:"button",onClick:()=>g(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":"Clear organization search",children:e.jsx(ft,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"max-h-80 space-y-2 overflow-auto",children:[m.map(v=>{const j=Number(v.id);return e.jsxs("label",{className:"flex items-center gap-2 rounded border p-2",children:[e.jsx("input",{type:"checkbox",checked:i.includes(j),onChange:R=>o($=>R.target.checked?[...$,j]:$.filter(T=>T!==j))}),v.name]},v.id)}),!u.isLoading&&m.length===0&&e.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:l.trim()?`No organizations found matching "${l.trim()}"`:"No organizations available"})]}),e.jsxs(oe,{children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:()=>k.mutate(),disabled:k.isPending,children:n==="pending"?"Submit test edit":"Save changes"})]})]})})};function rr({open:t,onOpenChange:s,paperId:a,arxivId:r,initialProjectPages:n,onSuccess:c,submitMode:i="direct",isAuthor:o=!1}){const[l,g]=p.useState(n),[x,u]=p.useState(""),m=ce(),{toast:k}=te(),E=p.useRef(!1);p.useEffect(()=>{if(!t){E.current=!1;return}E.current||(E.current=!0,g(n),u(""))},[t,n]);const v=de({mutationFn:async({paperId:h,projectPages:f})=>i==="pending"?(await he.submit({paper_id:parseInt(h),edit_type:"project_pages",proposed_payload:{project_pages:f}}),null):V.updateProjectPages(h,f),onSuccess:h=>{if(i==="pending"){k({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed project page changes shortly."}),c==null||c(),s(!1),u("");return}h&&je(m,h,[a,r]),c==null||c(),s(!1),u("")},onError:h=>{var A;const f=h;let _=f.message||(i==="pending"?"Failed to submit your edit. Please try again.":"Failed to update project pages.");if(f.response)try{const U=JSON.parse(f.response);typeof(U==null?void 0:U.detail)=="string"?_=U.detail:Array.isArray(U==null?void 0:U.detail)&&((A=U.detail[0])!=null&&A.msg)&&(_=U.detail[0].msg)}catch{_=f.response}k({title:i==="pending"?"Could not submit edit":"Could not save project pages",description:_,variant:"destructive"})}}),j=()=>{const h=x.trim();return h?l.some(f=>f.url===h)?(alert("This project page URL is already added"),null):[...l,{url:h,is_official:!1}]:l},R=()=>{const h=j();h!==null&&h.length!==l.length&&(g(h),u(""))},$=h=>{g(l.filter(f=>f.url!==h))},T=h=>{g(l.map(f=>f.url===h?{...f,is_official:!f.is_official}:f))},N=()=>{const h=j();h!==null&&(i==="direct"&&n.some(f=>!h.some(_=>_.url===f.url))&&!window.confirm("Remove one or more project pages from this paper?")||v.mutate({paperId:a,projectPages:h}))},y=p.useMemo(()=>{const h=x.trim(),f=h?[...l,{url:h,is_official:!1}]:l;if(f.length!==n.length)return!0;const _=new Map(n.map(A=>[A.url.trim(),!!A.is_official]));return f.some(A=>{const U=_.get(A.url.trim());return U===void 0||U!==!!A.is_official})},[l,x,n]);return e.jsx(se,{open:t,onOpenChange:s,children:e.jsxs(ae,{className:"max-w-2xl max-h-[600px]",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Paper Project Pages"}),e.jsx(ie,{children:"Add or remove project page URLs (e.g. authors' demo or landing pages) associated with this paper. Mark pages as official if they are created by the paper authors."})]}),i==="pending"&&e.jsx(pe,{isAuthor:o}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Add Project Page URL"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(W,{type:"url",placeholder:"https://example.com/project",value:x,onChange:h=>u(h.target.value),onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),R())},className:"flex-1"}),e.jsxs(D,{onClick:R,size:"sm",disabled:!x.trim(),children:[e.jsx(Ue,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[350px]",children:l.length>0?e.jsx("div",{className:"space-y-2",children:l.map((h,f)=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx($t,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{className:"text-sm font-medium text-paper-blue truncate",children:h.url}),h.is_official&&e.jsx(Ot,{variant:"secondary",className:"text-xs",children:"Official"})]})}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxs(D,{variant:h.is_official?"default":"outline",size:"sm",onClick:()=>T(h.url),className:"h-8 px-2 text-xs",title:h.is_official?"Click to unmark as official (created by paper authors)":"Click to mark as official (created by paper authors)",children:[e.jsx(Gt,{className:`w-3.5 h-3.5 mr-1 ${h.is_official?"fill-current":""}`}),h.is_official?"Official":"Mark official"]}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>$(h.url),className:"h-8 px-2 text-destructive hover:text-destructive",title:"Remove project page",children:e.jsx(Be,{className:"w-4 h-4"})})]})]},f))}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx($t,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No project pages added yet"}),e.jsx("p",{className:"text-xs mt-1",children:"Add a project page URL above to get started"})]})}),e.jsxs(oe,{children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:N,disabled:v.isPending||!y,children:v.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),i==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),i==="pending"?"Submit for review":"Save Changes"]})})]})]})})}function nr({open:t,onOpenChange:s,paperId:a,arxivId:r,initialRepositories:n,onSuccess:c,submitMode:i="direct",isAuthor:o=!1}){const[l,g]=p.useState(n),[x,u]=p.useState(""),m=ce(),{toast:k}=te(),E=p.useRef(!1);p.useEffect(()=>{if(!t){E.current=!1;return}E.current||(E.current=!0,g(n),u(""))},[t,n]);const v=de({mutationFn:async({paperId:f,repositories:_})=>i==="pending"?(await he.submit({paper_id:parseInt(f),edit_type:"repositories",proposed_payload:{repositories:_}}),null):V.updateRepositories(f,_),onSuccess:f=>{if(i==="pending"){k({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed repository changes shortly."}),c==null||c(),s(!1),u("");return}f&&je(m,f,[a,r]),c==null||c(),s(!1),u("")},onError:f=>{var U;const _=f;let A=_.message||(i==="pending"?"Failed to submit your edit. Please try again.":"Failed to update paper repositories.");if(_.response)try{const H=JSON.parse(_.response);typeof(H==null?void 0:H.detail)=="string"?A=H.detail:Array.isArray(H==null?void 0:H.detail)&&((U=H.detail[0])!=null&&U.msg)&&(A=H.detail[0].msg)}catch{A=_.response}k({title:i==="pending"?"Could not submit edit":"Could not save repositories",description:A,variant:"destructive"})}}),j=f=>{const _=[];for(const A of f){const U=_.find(H=>St(H.url,A.url));if(U)U.is_official=U.is_official||A.is_official;else{const H=Ge(A.url);_.push({url:H??A.url.trim(),is_official:A.is_official})}}return _},R=()=>{const f=x.trim(),_=f?[...l,{url:f,is_official:!1}]:l;return f&&l.some(A=>St(A.url,f))?(alert("This repository URL is already added"),null):j(_)},$=()=>{const f=R();f!==null&&f.length!==l.length&&(g(f),u(""))},T=f=>{g(l.filter(_=>_.url!==f))},N=f=>{g(l.map(_=>_.url===f?{..._,is_official:!_.is_official}:_))},y=()=>{const f=R();f!==null&&(i==="direct"&&n.some(_=>!f.some(A=>A.url===_.url))&&!window.confirm("Remove one or more repositories from this paper?")||v.mutate({paperId:a,repositories:f}))},h=p.useMemo(()=>{const f=x.trim(),_=f?[...l,{url:f,is_official:!1}]:l;if(_.length!==n.length)return!0;const A=j(n),U=j(_);if(U.length!==A.length)return!0;const H=new Map(A.map(O=>[Ge(O.url)??O.url.trim(),!!O.is_official]));return U.some(O=>{const J=Ge(O.url)??O.url.trim(),d=H.get(J);return d===void 0||d!==!!O.is_official})},[l,x,n]);return e.jsx(se,{open:t,onOpenChange:s,children:e.jsxs(ae,{className:"max-w-2xl max-h-[600px]",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Paper Repositories"}),e.jsx(ie,{children:"Add or remove GitHub repository URLs associated with this paper. Mark repositories as official if they are created by the paper authors."})]}),i==="pending"&&e.jsx(pe,{isAuthor:o}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Add Repository URL"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(W,{type:"url",placeholder:"https://github.com/owner/repo",value:x,onChange:f=>u(f.target.value),onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),$())},className:"flex-1"}),e.jsxs(D,{onClick:$,size:"sm",disabled:!x.trim(),children:[e.jsx(Ue,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[350px]",children:l.length>0?e.jsx("div",{className:"space-y-2",children:l.map((f,_)=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx(Pt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{className:"text-sm font-medium text-paper-blue truncate",children:f.url}),f.is_official&&e.jsx(Ot,{variant:"secondary",className:"text-xs",children:"Official"})]})}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxs(D,{variant:f.is_official?"default":"outline",size:"sm",onClick:()=>N(f.url),className:"h-8 px-2 text-xs",title:f.is_official?"Click to unmark as official (created by paper authors)":"Click to mark as official (created by paper authors)",children:[e.jsx(Gt,{className:`w-3.5 h-3.5 mr-1 ${f.is_official?"fill-current":""}`}),f.is_official?"Official":"Mark official"]}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>T(f.url),className:"h-8 px-2 text-destructive hover:text-destructive",title:"Remove repository",children:e.jsx(Be,{className:"w-4 h-4"})})]})]},_))}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Pt,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No repositories added yet"}),e.jsx("p",{className:"text-xs mt-1",children:"Add a repository URL above to get started"})]})}),e.jsxs(oe,{children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:y,disabled:v.isPending||!h,children:v.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),i==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),i==="pending"?"Submit for review":"Save Changes"]})})]})]})})}function ir({open:t,onOpenChange:s,paperId:a,arxivId:r,initialUrl:n,onSuccess:c,submitMode:i="direct",isAuthor:o=!1}){const[l,g]=p.useState(n),x=ce(),{toast:u}=te(),m=p.useRef(!1);p.useEffect(()=>{if(!t){m.current=!1;return}m.current||(m.current=!0,g(n))},[t,n]);const k=de({mutationFn:async({paperId:$,sourceUrl:T})=>i==="pending"?(await he.submit({paper_id:parseInt($),edit_type:"source_url",proposed_payload:{source_url:T}}),null):V.updateSourceUrl($,T),onSuccess:$=>{if(i==="pending"){u({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed source URL change shortly."}),c==null||c(),s(!1);return}$&&je(x,$,[a,r]),c==null||c(),s(!1)},onError:$=>{var y;const T=$;let N=T.message||(i==="pending"?"Failed to submit your edit. Please try again.":"Failed to update source URL.");if(T.response)try{const h=JSON.parse(T.response);typeof(h==null?void 0:h.detail)=="string"?N=h.detail:Array.isArray(h==null?void 0:h.detail)&&((y=h.detail[0])!=null&&y.msg)&&(N=h.detail[0].msg)}catch{N=T.response}u({title:i==="pending"?"Could not submit edit":"Could not save source URL",description:N,variant:"destructive"})}}),E=l.trim(),v=/^https?:\/\//i.test(E),j=E!==(n||"").trim(),R=()=>{v&&k.mutate({paperId:a,sourceUrl:E})};return e.jsx(se,{open:t,onOpenChange:s,children:e.jsxs(ae,{className:"max-w-2xl",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Source URL"}),e.jsxs(ie,{children:["Update the canonical URL for this external paper. This is the page the ",'"Source page"'," button links to. ArXiv papers cannot edit this field."]})]}),i==="pending"&&e.jsx(pe,{isAuthor:o}),e.jsxs("div",{className:"space-y-2 py-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Source URL"}),e.jsx(W,{type:"url",placeholder:"https://example.com/paper",value:l,onChange:$=>g($.target.value),onKeyPress:$=>{$.key==="Enter"&&v&&j&&($.preventDefault(),R())}}),!v&&E.length>0&&e.jsx("p",{className:"text-xs text-destructive",children:"URL must start with http:// or https://"})]}),e.jsxs(oe,{children:[e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:R,disabled:k.isPending||!v||!j,children:k.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),i==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),i==="pending"?"Submit for review":"Save Changes"]})})]})]})})}const or=250,lr=100;function cr({open:t,onOpenChange:s,paperId:a,arxivId:r,initialTaskIds:n,initialTasks:c,onSuccess:i,submitMode:o="direct",isAuthor:l=!1}){const[g,x]=p.useState(n),[u,m]=p.useState(!1),[k,E]=p.useState(""),[v,j]=p.useState(""),[R,$]=p.useState(new Map),T=ce(),{toast:N}=te(),y=p.useRef(!1);p.useEffect(()=>{if(!t){y.current=!1;return}if(y.current)return;y.current=!0,x(n),E(""),j("");const d=new Map;(c||[]).forEach(C=>{const I=parseInt(C.id);Number.isNaN(I)||d.set(I,C)}),$(d)},[t,n,c]),p.useEffect(()=>{const d=window.setTimeout(()=>{j(k.trim())},or);return()=>window.clearTimeout(d)},[k]);const{data:h,isFetching:f}=Z({queryKey:["tasks-search",v],queryFn:()=>fe.listTasks({page_size:lr,...v?{q:v}:{}}),enabled:t});p.useEffect(()=>{var d;(d=h==null?void 0:h.results)!=null&&d.length&&$(C=>{const I=new Map(C);return h.results.forEach(L=>{const S=parseInt(L.id);Number.isNaN(S)||I.set(S,L)}),I})},[h]);const _=p.useMemo(()=>{const d=(h==null?void 0:h.results)||[],C=new Set,I=[];return g.forEach(L=>{if(C.has(L))return;const S=R.get(L);S&&(I.push(S),C.add(L))}),d.forEach(L=>{const S=parseInt(L.id);Number.isNaN(S)||C.has(S)||(I.push(L),C.add(S))}),I},[h,g,R]),A=de({mutationFn:async({paperId:d,taskIds:C})=>o==="pending"?(await he.submit({paper_id:parseInt(d),edit_type:"tasks",proposed_payload:{task_ids:C}}),null):V.updateTasks(d,C),onMutate:async({taskIds:d})=>{if(o==="pending")return{snapshots:[]};const C=d.map(S=>R.get(S)).filter(S=>!!S).map(S=>({id:S.id,name:S.name,slug:S.slug})).sort((S,K)=>S.name.localeCompare(K.name)),I=Array.from(new Set([a,r].filter(S=>!!S)));await Promise.all(I.flatMap(S=>[T.cancelQueries({queryKey:["paper",S]}),T.cancelQueries({queryKey:["paper-arxiv",S]})]));const L=[];return I.forEach(S=>{["paper","paper-arxiv"].forEach(K=>{const X=[K,S],b=T.getQueryData(X);L.push({key:X,data:b}),b&&T.setQueryData(X,{...b,tasks:C})})}),N({title:"Tasks updated",description:`Saved ${d.length} task${d.length===1?"":"s"} for this paper.`}),i==null||i(),s(!1),{snapshots:L}},onSuccess:d=>{if(o==="pending"){N({title:"Edit submitted for review",description:"Thanks! An admin will review your proposed task changes shortly."}),i==null||i(),s(!1);return}d&&je(T,d,[a,r])},onError:(d,C,I)=>{var K,X;(K=I==null?void 0:I.snapshots)==null||K.forEach(({key:b,data:P})=>{T.setQueryData(b,P)});const L=d;let S=L.message||(o==="pending"?"Failed to submit your edit. Please try again.":"Failed to update paper tasks.");if(L.response)try{const b=JSON.parse(L.response);typeof(b==null?void 0:b.detail)=="string"?S=b.detail:Array.isArray(b==null?void 0:b.detail)&&((X=b.detail[0])!=null&&X.msg)&&(S=b.detail[0].msg)}catch{S=L.response}N({title:o==="pending"?"Could not submit edit":"Could not save tasks",description:S,variant:"destructive"})}}),U=()=>{o==="direct"&&n.some(d=>!g.includes(d))&&!window.confirm("Remove one or more task links from this paper?")||A.mutate({paperId:a,taskIds:g})},H=p.useMemo(()=>{if(g.length!==n.length)return!0;const d=new Set(n);return g.some(C=>!d.has(C))},[g,n]),O=(d,C)=>{x(I=>C?I.includes(d)?I:[...I,d]:I.filter(L=>L!==d))},J=()=>E("");return e.jsxs(se,{open:t,onOpenChange:s,children:[e.jsxs(ae,{className:"max-w-2xl max-h-[600px]",children:[e.jsxs(re,{children:[e.jsx(ne,{children:"Edit Paper Tasks"}),e.jsx(ie,{children:"Select the tasks that this paper addresses. You can select multiple tasks."})]}),o==="pending"&&e.jsx(pe,{isAuthor:l}),e.jsxs("div",{className:"relative mb-4",children:[e.jsx(Ee,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(W,{type:"text",placeholder:"Search tasks...",value:k,onChange:d=>E(d.target.value),className:"pl-9 pr-9"}),k&&e.jsx("button",{type:"button",onClick:J,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":"Clear search",children:e.jsx(ft,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[400px]",children:_.length>0?e.jsx("div",{className:"space-y-2",children:_.map(d=>{const C=parseInt(d.id),I=g.includes(C);return e.jsxs("div",{className:"flex items-center space-x-2 p-2 hover:bg-muted/50 rounded-md",children:[e.jsx(He,{id:`task-${d.id}`,checked:I,onCheckedChange:L=>O(C,L===!0),className:"!border !border-black data-[state=checked]:!bg-black data-[state=checked]:!text-white"}),e.jsxs("label",{htmlFor:`task-${d.id}`,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer flex-1",children:[d.name,d.description&&e.jsxs("span",{className:"block text-xs text-muted-foreground font-normal mt-1",children:[d.description.substring(0,100),d.description.length>100?"...":""]})]})]},d.id)})}):f?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ee,{className:"w-8 h-8 mx-auto mb-2 animate-spin"}),e.jsx("p",{children:"Loading tasks..."})]}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Ee,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:v?`No tasks found matching "${v}"`:"No tasks available"})]})}),e.jsxs(oe,{children:[e.jsx(D,{variant:"ghost",className:"sm:mr-auto",onClick:()=>m(!0),children:"Suggest a new task"}),e.jsx(D,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(D,{onClick:U,disabled:A.isPending||!H,children:A.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-4 h-4 mr-2 animate-spin"}),o==="pending"?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),o==="pending"?"Submit for review":"Save Changes"]})})]})]}),e.jsx(gt,{open:u,onOpenChange:m,paperId:a,kind:"task"})]})}function dr({activeEditor:t,arxivId:s,editSubmitMode:a,evaluations:r,isAdmin:n,isLinkedAuthor:c,onOpenChange:i,paper:o}){if(!t)return null;const l={open:!0,paperId:o.id,arxivId:s,submitMode:a,isAuthor:c},g=u=>m=>i(u,m);return{tasks:()=>{var u;return e.jsx(cr,{...l,onOpenChange:g("tasks"),initialTaskIds:((u=o.tasks)==null?void 0:u.map(m=>Number(m.id)))??[],initialTasks:o.tasks??[]})},methods:()=>{var u;return e.jsx(sr,{...l,onOpenChange:g("methods"),initialMethodIds:((u=o.methods)==null?void 0:u.map(m=>Number(m.id)))??[],initialMethods:o.methods??[]})},repositories:()=>{var u;return e.jsx(nr,{...l,onOpenChange:g("repositories"),initialRepositories:((u=o.repositories)==null?void 0:u.map(({url:m,is_official:k})=>({url:m,is_official:!!k})))??[]})},"project-pages":()=>{var u;return e.jsx(rr,{...l,onOpenChange:g("project-pages"),initialProjectPages:((u=o.project_pages)==null?void 0:u.map(({url:m,is_official:k})=>({url:m,is_official:!!k})))??[]})},results:()=>e.jsx(Qa,{...l,onOpenChange:g("results"),initialEvaluations:r,paperTasks:o.tasks??[],isAdmin:n}),"source-url":()=>e.jsx(ir,{...l,onOpenChange:g("source-url"),initialUrl:o.source_url??o.url_abs??""}),"hf-artifacts":()=>e.jsx(Ja,{...l,onOpenChange:g("hf-artifacts"),initialArtifacts:{hf_models:o.hf_models??[],hf_datasets:o.hf_datasets??[],hf_spaces:o.hf_spaces??[]}}),organizations:()=>e.jsx(ar,{open:!0,paperId:o.id,onOpenChange:g("organizations"),initialOrganizationIds:(o.organizations??[]).map(({id:u})=>Number(u)),submitMode:a,isAuthor:c})}[t]()}const ur={"add-evals":{trigger:"add evals",running:"adding evals…",complete:"add evals ✓",title:"Add evaluations with Codex",description:t=>e.jsxs(e.Fragment,{children:["Codex will run the repository’s add-evals skill for “",t,"”. It will import only paper-native results onto existing, metric-compatible leaderboards. Accepted rows are written directly to the live database."]}),notice:"Comparator rows, unknown benchmarks, and unconfigured metrics will be skipped. Jobs run one at a time in submission order.",progress:"Codex is researching the paper and validating results against the configured leaderboards.",action:"Run add-evals",start:ua,get:da,cancel:ca},"enrich-paper":{trigger:"enrich paper",running:"enriching…",complete:"enriched ✓",title:"Enrich paper with Codex",description:t=>e.jsxs(e.Fragment,{children:["Codex will run the repository’s enrich-paper skill for “",t,"”. It will validate official code and project links, merge high-confidence taxonomy tags, and check the paper thumbnail. Accepted changes are written directly to the live database."]}),notice:"Uncertain URLs and missing taxonomy concepts will be reported rather than guessed. Jobs run one at a time in submission order.",progress:"Codex is validating artifacts, taxonomy tags, and thumbnail quality for this paper.",action:"Run enrich-paper",start:la,get:oa,cancel:ia}};function mr({report:t}){return e.jsx("div",{className:"min-w-0 max-h-[50vh] overflow-y-auto overflow-x-hidden rounded-md border bg-muted/40 p-4 text-sm leading-relaxed",children:e.jsx(pa,{remarkPlugins:[fa],components:{a:({children:s,...a})=>e.jsx("a",{...a,className:"break-all underline underline-offset-2",target:"_blank",rel:"noreferrer",children:s}),p:({children:s})=>e.jsx("p",{className:"mb-3 break-words last:mb-0",children:s}),ul:({children:s})=>e.jsx("ul",{className:"mb-3 list-disc space-y-1 pl-5 last:mb-0",children:s}),ol:({children:s})=>e.jsx("ol",{className:"mb-3 list-decimal space-y-1 pl-5 last:mb-0",children:s}),h1:({children:s})=>e.jsx("h3",{className:"mb-2 font-semibold",children:s}),h2:({children:s})=>e.jsx("h3",{className:"mb-2 font-semibold",children:s}),h3:({children:s})=>e.jsx("h3",{className:"mb-2 font-semibold",children:s}),code:({children:s})=>e.jsx("code",{className:"break-all rounded bg-background/80 px-1 py-0.5 font-mono text-xs",children:s}),pre:({children:s})=>e.jsx("pre",{className:"mb-3 max-w-full overflow-x-auto whitespace-pre-wrap break-words rounded bg-background/80 p-3 font-mono text-xs last:mb-0",children:s})},children:t})})}function as({kind:t,paperId:s,paperTitle:a,triggerClassName:r,onComplete:n}){const c=ur[t],[i,o]=p.useState(!1),[l,g]=p.useState(null),[x,u]=p.useState(!1),[m,k]=p.useState(null),E=p.useRef(null),v=(l==null?void 0:l.status)==="queued"||(l==null?void 0:l.status)==="dispatching"||(l==null?void 0:l.status)==="running",j=l==null?void 0:l.id;p.useEffect(()=>{if(!v||!j)return;let N=!1;const y=window.setInterval(async()=>{try{const h=await c.get(j);N||(g(h),k(null))}catch(h){N||k(h instanceof Error?h.message:"Could not check job status.")}},2e3);return()=>{N=!0,window.clearInterval(y)}},[v,c,j]),p.useEffect(()=>{(l==null?void 0:l.status)!=="completed"||E.current===l.id||(E.current=l.id,n())},[l,n]);const R=async()=>{u(!0),k(null);try{g(await c.start(s))}catch(N){k(N instanceof Error?N.message:"Could not start Codex.")}finally{u(!1)}},$=()=>{g(null),k(null),E.current=null},T=async()=>{if(l){k(null);try{g(await c.cancel(l.id))}catch(N){k(N instanceof Error?N.message:"Could not cancel Codex.")}}};return e.jsxs(se,{open:i,onOpenChange:o,children:[e.jsx("button",{type:"button",className:r,onClick:()=>o(!0),children:v?c.running:(l==null?void 0:l.status)==="completed"?c.complete:c.trigger}),e.jsxs(ae,{className:"max-h-[90vh] w-[calc(100vw-2rem)] min-w-0 max-w-2xl overflow-hidden",children:[e.jsxs(re,{className:"min-w-0",children:[e.jsx(ne,{children:c.title}),e.jsx(ie,{children:c.description(a)})]}),l?e.jsxs("div",{className:"min-w-0 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"font-mono text-xs uppercase tracking-wide text-muted-foreground",children:["Status: ",l.status]}),l.hf_job_url&&e.jsx("a",{className:"text-sm underline",href:l.hf_job_url,target:"_blank",rel:"noreferrer",children:"View Hugging Face Job"}),v&&e.jsxs("div",{className:"rounded-md border bg-muted/40 p-3 text-sm",children:[l.status==="queued"?"This job is queued and will start after the current Codex job finishes.":c.progress," ","This can take several minutes; you can close this window and return."]}),l.report&&e.jsx(mr,{report:l.report}),l.error&&e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:l.error})]}):e.jsx("div",{className:"rounded-md border bg-muted/40 p-3 text-sm text-muted-foreground",children:c.notice}),m&&e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:m}),e.jsxs(oe,{children:[e.jsx(D,{variant:"outline",onClick:()=>o(!1),children:v?"Close":"Cancel"}),v&&e.jsx(D,{variant:"outline",onClick:()=>void T(),children:"Cancel job"}),!l&&e.jsx(D,{onClick:R,disabled:x,children:x?"Starting…":c.action}),l&&!v&&e.jsx(D,{variant:"outline",onClick:$,children:"Run again"})]})]})]})}function hr(t){return e.jsx(as,{...t,kind:"add-evals",triggerClassName:"edit-link"})}function we({accent:t,id:s,label:a}){return e.jsxs("div",{className:"section-rule paper-section-anchor",id:s,children:[e.jsx("span",{children:e.jsx("a",{href:`#${s}`,className:"section-anchor-link",children:a})}),t]})}function pr({canCopyBadge:t,canEdit:s,evaluationsByTask:a,evaluationsLoading:r,isAdmin:n,onCopyBadge:c,onEdit:i,onRefresh:o,paper:l,visibleEvaluationCount:g}){return e.jsxs(e.Fragment,{children:[e.jsx(we,{id:"results",label:"Results",accent:e.jsxs("span",{className:"accent",children:[g," benchmarks",t&&e.jsxs("button",{type:"button",className:"edit-link results-badge-copy",onClick:c,title:"Copy live leaderboard badges for your repository README",children:[e.jsx(G,{name:"copy",size:10})," Copy PwC badge"]}),n&&ma()&&e.jsx(hr,{paperId:Number(l.id),paperTitle:l.title,onComplete:o}),s&&e.jsx("button",{type:"button",onClick:i,className:"edit-link",children:"edit"})]})}),r?e.jsx(Ne,{className:"h-32 w-full"}):a.length>0?a.map(x=>e.jsxs("div",{className:x.taskSlug?"paper-section-anchor":void 0,id:x.taskSlug?Jt(x.taskSlug):void 0,children:[e.jsxs("div",{className:"section-rule",children:[e.jsx("span",{children:x.taskSlug?e.jsxs(e.Fragment,{children:[e.jsx(le,{to:`/tasks/${x.taskSlug}`,children:x.taskName}),e.jsx("a",{href:Ia(x.taskSlug),className:"section-anchor-link results-task-permalink","aria-label":`Permalink to ${x.taskName} results on this paper`,title:"Link to this task's results",children:"#"})]}):x.taskName}),e.jsxs("span",{className:"accent",children:[x.rows.length," ",x.rows.length===1?"result":"results"]})]}),e.jsxs("table",{className:"results-table",children:[e.jsxs("colgroup",{children:[e.jsx("col",{style:{width:"28%"}}),e.jsx("col",{style:{width:"28%"}}),e.jsx("col",{style:{width:"14%"}}),e.jsx("col",{style:{width:"12%"}}),e.jsx("col",{style:{width:"8%"}}),e.jsx("col",{style:{width:"10%"}})]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Benchmark"}),e.jsx("th",{children:"Model"}),e.jsx("th",{children:"Metric"}),e.jsx("th",{children:"Value"}),e.jsx("th",{children:"Rank"}),e.jsx("th",{children:"Compare"})]})}),e.jsx("tbody",{children:x.rows.map(u=>{var m;return e.jsxs("tr",{children:[e.jsx("td",{className:"benchmark",children:u.dataset_slug?e.jsx(le,{to:`/benchmark/${u.dataset_slug}`,children:u.dataset_name||"—"}):u.dataset_name||"—"}),e.jsxs("td",{className:"model",title:u.model_name||void 0,children:[u.hf_model_url?e.jsx("a",{href:u.hf_model_url,target:"_blank",rel:"noopener noreferrer",className:"model-hf-link",title:`Open ${u.model_name||"model"} on Hugging Face`,children:u.model_name||"—"}):u.model_name||"—",u.is_open===!1&&e.jsx(Xs,{}),(u.external??u.is_external)&&e.jsx(Ws,{sourceUrl:u.source_url||u.external_source_url||u.result_url})]}),e.jsx("td",{className:"metric",children:u.best_metric}),e.jsx("td",{className:"value",children:Ps((m=u.metrics)==null?void 0:m[u.best_metric||""])}),e.jsx("td",{className:"rank",children:u.best_rank!=null?`#${u.best_rank}`:"—"}),e.jsx("td",{className:"compare",children:u.dataset_slug&&e.jsx(le,{to:`/benchmark/${u.dataset_slug}?${[u.task_slug?`task=${encodeURIComponent(u.task_slug)}`:"",`eval=${encodeURIComponent(u.id)}`].filter(Boolean).join("&")}`,children:"Compare →"})})]},u.id)})})]})]},x.taskId)):e.jsx("p",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-faint)"},children:"No benchmark results recorded yet."})]})}var jt="Radio",[fr,rs]=pt(jt),[gr,xr]=fr(jt),ns=p.forwardRef((t,s)=>{const{__scopeRadio:a,name:r,checked:n=!1,required:c,disabled:i,value:o="on",onCheck:l,form:g,...x}=t,[u,m]=p.useState(null),k=Se(s,j=>m(j)),E=p.useRef(!1),v=u?g||!!u.closest("form"):!0;return e.jsxs(gr,{scope:a,checked:n,disabled:i,children:[e.jsx(ge.button,{type:"button",role:"radio","aria-checked":n,"data-state":cs(n),"data-disabled":i?"":void 0,disabled:i,value:o,...x,ref:k,onClick:Ce(t.onClick,j=>{n||l==null||l(),v&&(E.current=j.isPropagationStopped(),E.current||j.stopPropagation())})}),v&&e.jsx(ls,{control:u,bubbles:!E.current,name:r,value:o,checked:n,required:c,disabled:i,form:g,style:{transform:"translateX(-100%)"}})]})});ns.displayName=jt;var is="RadioIndicator",os=p.forwardRef((t,s)=>{const{__scopeRadio:a,forceMount:r,...n}=t,c=xr(is,a);return e.jsx(Ht,{present:r||c.checked,children:e.jsx(ge.span,{"data-state":cs(c.checked),"data-disabled":c.disabled?"":void 0,...n,ref:s})})});os.displayName=is;var br="RadioBubbleInput",ls=p.forwardRef(({__scopeRadio:t,control:s,checked:a,bubbles:r=!0,...n},c)=>{const i=p.useRef(null),o=Se(i,c),l=Qt(a),g=zt(s);return p.useEffect(()=>{const x=i.current;if(!x)return;const u=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(u,"checked").set;if(l!==a&&k){const E=new Event("click",{bubbles:r});k.call(x,a),x.dispatchEvent(E)}},[l,a,r]),e.jsx(ge.input,{type:"radio","aria-hidden":!0,defaultChecked:a,...n,tabIndex:-1,ref:o,style:{...n.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});ls.displayName=br;function cs(t){return t?"checked":"unchecked"}var jr=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Me="RadioGroup",[yr]=pt(Me,[qt,rs]),ds=qt(),us=rs(),[vr,kr]=yr(Me),ms=p.forwardRef((t,s)=>{const{__scopeRadioGroup:a,name:r,defaultValue:n,value:c,required:i=!1,disabled:o=!1,orientation:l,dir:g,loop:x=!0,onValueChange:u,...m}=t,k=ds(a),E=Is(g),[v,j]=Mt({prop:c,defaultProp:n??null,onChange:u,caller:Me});return e.jsx(vr,{scope:a,name:r,required:i,disabled:o,value:v,onValueChange:j,children:e.jsx($s,{asChild:!0,...k,orientation:l,dir:E,loop:x,children:e.jsx(ge.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":o?"":void 0,dir:E,...m,ref:s})})})});ms.displayName=Me;var hs="RadioGroupItem",ps=p.forwardRef((t,s)=>{const{__scopeRadioGroup:a,disabled:r,...n}=t,c=kr(hs,a),i=c.disabled||r,o=ds(a),l=us(a),g=p.useRef(null),x=Se(s,g),u=c.value===n.value,m=p.useRef(!1);return p.useEffect(()=>{const k=v=>{jr.includes(v.key)&&(m.current=!0)},E=()=>m.current=!1;return document.addEventListener("keydown",k),document.addEventListener("keyup",E),()=>{document.removeEventListener("keydown",k),document.removeEventListener("keyup",E)}},[]),e.jsx(As,{asChild:!0,...o,focusable:!i,active:u,children:e.jsx(ns,{disabled:i,required:c.required,checked:u,...l,...n,name:c.name,ref:x,onCheck:()=>c.onValueChange(n.value),onKeyDown:Ce(k=>{k.key==="Enter"&&k.preventDefault()}),onFocus:Ce(n.onFocus,()=>{var k;m.current&&((k=g.current)==null||k.click())})})})});ps.displayName=hs;var wr="RadioGroupIndicator",fs=p.forwardRef((t,s)=>{const{__scopeRadioGroup:a,...r}=t,n=us(a);return e.jsx(os,{...n,...r,ref:s})});fs.displayName=wr;var gs=ms,xs=ps,_r=fs;const lt=p.forwardRef(({className:t,...s},a)=>e.jsx(gs,{className:Re("grid gap-2",t),...s,ref:a}));lt.displayName=gs.displayName;const _e=p.forwardRef(({className:t,...s},a)=>e.jsx(xs,{ref:a,className:Re("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(_r,{className:"flex items-center justify-center",children:e.jsx(Rs,{className:"h-2.5 w-2.5 fill-current text-current"})})}));_e.displayName=xs.displayName;const Nr={pdf:"PDF",model:"Model",dataset:"Dataset",space:"Space",github:"GitHub"},ct=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,Cr=/^[A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*$/,Er=20,dt="copy_to_bucket";function Sr(t){const s=t.trim();if(!Cr.test(s))return null;const[a,r]=s.split("/");return`https://huggingface.co/buckets/${encodeURIComponent(a)}/${encodeURIComponent(r)}`}function ut(t){return`pwc:bucket-copy:${t}`}function Pr(t){if(typeof window>"u"||new URL(window.location.href).searchParams.get(dt)!==t)return null;try{const a=window.sessionStorage.getItem(ut(t));if(!a)return null;const r=JSON.parse(a);return r.paperId!==t||typeof r.bucketId!="string"||!["new","existing"].includes(r.destinationMode)||!["public","private"].includes(r.visibility)||!Array.isArray(r.selectedIds)||r.selectedIds.some(n=>typeof n!="string")?null:r}catch{return null}}function Ir(t,s=Er){if(s<1)throw new Error("Bucket copy batch size must be positive");const a=[];for(let r=0;r!ct.test(l)))return null;const i=c.join("/"),o=s==="model"?"":`${s}s/`;return{id:`${s}:${i}`,kind:s,label:i,url:`https://huggingface.co/${o}${i}`,source:`hf://${o}${i}/`,destination:`${s}s/${i}/`,repoId:i}}catch{return null}}function $r(t){try{const s=new URL(t);if(s.hostname!=="github.com"&&s.hostname!=="www.github.com")return null;const a=s.pathname.split("/").filter(Boolean);if(a.length<2)return null;const r=a[0],n=a[1].replace(/\.git$/,"");if(!ct.test(r)||!ct.test(n))return null;const c=`${r}/${n}`;return{id:`github:${c}`,kind:"github",label:c,url:`https://github.com/${c}`,source:`https://github.com/${c}.git`,destination:`github/${c}/`}}catch{return null}}function Ar({githubUrls:t,hfModelUrls:s,hfDatasetUrls:a,hfSpaceUrls:r,paperId:n,pdfName:c,pdfUrl:i}){const o=[i?{id:"pdf",kind:"pdf",label:"Paper PDF",url:i,source:i,destination:`paper/${c||n}.pdf`}:null,...s.map(g=>rt(g,"model")),...a.map(g=>rt(g,"dataset")),...r.map(g=>rt(g,"space")),...t.map($r)],l=new Set;return o.filter(g=>!g||l.has(g.id)?!1:(l.add(g.id),!0))}function Rr(t,s,a){const r=["# Requires the Hugging Face CLI: https://huggingface.co/docs/huggingface_hub/guides/cli",`HF_BUCKET=${Ie(t.trim())}`];a.create&&r.push(`hf buckets create "$HF_BUCKET" --exist-ok${a.isPrivate?" --private":""}`);for(const i of s.filter(o=>o.kind!=="github"&&o.kind!=="pdf"))r.push(`hf cp ${Ie(i.source)} "hf://buckets/$HF_BUCKET/${i.destination}"`);const n=s.find(i=>i.kind==="pdf");n&&r.push('PWC_PDF="$(mktemp)"',`trap 'rm -f "$PWC_PDF"' EXIT`,`curl --fail --location ${Ie(n.source)} --output "$PWC_PDF"`,`hf cp "$PWC_PDF" "hf://buckets/$HF_BUCKET/${n.destination}"`);const c=s.filter(i=>i.kind==="github");if(c.length){r.push('PWC_COPY_DIR="$(mktemp -d)"',`trap 'rm -rf "$PWC_COPY_DIR"' EXIT`);for(const i of c){const o=`$PWC_COPY_DIR/${i.destination.replace(/\/$/,"")}`;r.push(`git clone --depth 1 -- ${Ie(i.source)} "${o}"`,`hf sync "${o}" "hf://buckets/$HF_BUCKET/${i.destination}" --exclude '.git/**'`)}}return r.join(` +`)}function Fr(t){return`${(t.split(/[:|–—]/,1)[0]||t).normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/g,"")||"paper"}-artifacts`}function Lr(t){const{toast:s}=te(),a=p.useMemo(()=>Ar({githubUrls:t.githubUrls,hfDatasetUrls:t.hfDatasetUrls,hfModelUrls:t.hfModelUrls,hfSpaceUrls:t.hfSpaceUrls,paperId:t.paperId,pdfName:t.pdfName,pdfUrl:t.pdfUrl}),[t.githubUrls,t.hfDatasetUrls,t.hfModelUrls,t.hfSpaceUrls,t.paperId,t.pdfName,t.pdfUrl]),r=p.useMemo(()=>Pr(t.paperId),[t.paperId]),[n,c]=p.useState(!!r),[i,o]=p.useState((r==null?void 0:r.destinationMode)??"new"),[l,g]=p.useState((r==null?void 0:r.bucketId)??""),[x,u]=p.useState((r==null?void 0:r.visibility)??"public"),[m,k]=p.useState(()=>new Set((r==null?void 0:r.selectedIds)??a.map(d=>d.id))),[E,v]=p.useState(!1),[j,R]=p.useState(null),[$,T]=p.useState(!!r),N=a.filter(d=>m.has(d.id)),y=N.length===a.length,h=Sr(l),f=h!==null,_=Rr(l,N,{create:i==="new",isPrivate:x==="private"}),A=(d,C)=>{k(I=>{const L=new Set(I);return C?L.add(d):L.delete(d),L})},U=async()=>{try{await navigator.clipboard.writeText(_),s({title:"Bucket copy commands copied",description:"Run them in a terminal where the Hugging Face CLI is signed in."})}catch{s({title:"Copy failed",description:"Could not access the clipboard. Select and copy the commands manually.",variant:"destructive"})}},H=p.useCallback(()=>{const d=Fs("/api/v1/auth/hf/login"),C=new URL(window.location.href);C.searchParams.set(dt,t.paperId),window.sessionStorage.setItem(ut(t.paperId),JSON.stringify({paperId:t.paperId,bucketId:l.trim(),destinationMode:i,visibility:x,selectedIds:Array.from(m)}));const I=new URLSearchParams({return_to:C.toString(),authorize_bucket:"true"});i==="new"&&I.set("bucket_create","true"),window.location.assign(`${d}?${I.toString()}`)},[l,i,t.paperId,m,x]),O=p.useCallback(async()=>{if(!t.isSignedIn){H();return}v(!0);let d=0,C=0;try{const I=N.filter(K=>K.kind!=="pdf"&&K.kind!=="github"&&!!K.repoId).map(K=>({kind:K.kind,repo_id:K.repoId})),L=Ir(I);L.length||L.push([]);for(const[K,X]of L.entries()){R({current:K+1,total:L.length});const b=await V.copyToBucket(t.paperId,{bucket_id:l.trim(),create:K===0&&i==="new",private:x==="private",include_pdf:K===0&&N.some(P=>P.kind==="pdf"),artifacts:X});d+=b.copied.length,C+=b.errors.length}const S=N.filter(K=>K.kind==="github").length;s({title:C?"Bucket copy partially completed":"Copied to bucket",description:[`${d} item${d===1?"":"s"} copied.`,C?`${C} item${C===1?"":"s"} failed.`:"",S?"Use the generated commands below to copy GitHub repositories.":""].filter(Boolean).join(" "),variant:C?"destructive":void 0,action:h?e.jsx(Ls,{altText:"Open destination bucket",asChild:!0,children:e.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",children:"Open bucket"})}):void 0}),!C&&!S&&c(!1)}catch(I){if(I instanceof it&&I.code==="bucket_authorization_required"){H();return}s({title:d?"Bucket copy partially completed":"Bucket copy failed",description:d?`${d} item${d===1?"":"s"} copied before the request failed. You can retry or use the CLI commands below.`:I instanceof it&&typeof I.detail=="string"?I.detail:"Hugging Face could not complete the copy. You can still use the CLI commands below.",variant:"destructive"})}finally{v(!1),R(null)}},[H,l,h,i,t.isSignedIn,t.paperId,N,s,x]);p.useEffect(()=>{if(!$||!t.isSignedIn)return;T(!1),window.sessionStorage.removeItem(ut(t.paperId));const d=new URL(window.location.href);d.searchParams.delete(dt),window.history.replaceState({},"",`${d.pathname}${d.search}${d.hash}`),O()},[O,t.isSignedIn,t.paperId,$]);const J=()=>{k(new Set(a.map(d=>d.id))),!l&&t.suggestedBucketId&&g(t.suggestedBucketId),c(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sidebar-card copy-to-bucket-card",children:[e.jsxs("button",{type:"button",className:"copy-to-bucket-trigger",onClick:J,children:[e.jsx("span",{className:"copy-to-bucket-arrow","aria-hidden":"true",children:"→"}),e.jsx("span",{className:"copy-to-bucket-title",children:"Copy to bucket"}),e.jsx("span",{className:"copy-to-bucket-new",children:"New"})]}),e.jsx("div",{className:"copy-to-bucket-meta",children:a.length?`${a.length} linked artifact${a.length===1?"":"s"}`:"No linked artifacts yet"})]}),e.jsx(se,{open:n,onOpenChange:c,children:e.jsxs(ae,{className:"max-h-[90vh] max-w-2xl grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden",children:[e.jsxs(re,{children:[e.jsxs(ne,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"copy-to-bucket-dialog-arrow","aria-hidden":"true",children:"→"}),"Copy to bucket"]}),e.jsx(ie,{children:"Keep your own copy of this paper's PDF, linked code, and Hugging Face artifacts. Hub repositories use Xet's server-side copy; GitHub repositories use the generated CLI fallback."})]}),e.jsx("div",{className:"-mx-6 min-h-0 overflow-y-auto px-6",children:a.length?e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{children:"Choose your destination"}),e.jsxs(lt,{value:i,onValueChange:d=>o(d),className:"grid grid-cols-2 gap-2",children:[e.jsxs(Y,{className:"bucket-choice",children:[e.jsx(_e,{value:"new"}),"New bucket"]}),e.jsxs(Y,{className:"bucket-choice",children:[e.jsx(_e,{value:"existing"}),"Existing bucket"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"bucket-id",children:"Bucket name"}),e.jsx(W,{id:"bucket-id",value:l,onChange:d=>g(d.target.value),placeholder:t.suggestedBucketId||"username/paper-artifacts","aria-invalid":l.length>0&&!f}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[e.jsx("p",{className:"text-muted-foreground",children:"Use the full Hugging Face bucket ID: namespace/name."}),h&&e.jsxs("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-1 underline underline-offset-4",children:["View bucket",e.jsx(G,{name:"external",size:10})]})]})]}),i==="new"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{children:"Bucket visibility"}),e.jsxs(lt,{value:x,onValueChange:d=>u(d),className:"flex gap-5",children:[e.jsxs(Y,{className:"flex items-center gap-2 font-normal",children:[e.jsx(_e,{value:"public"}),"Public"]}),e.jsxs(Y,{className:"flex items-center gap-2 font-normal",children:[e.jsx(_e,{value:"private"}),"Private"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(Y,{children:"Artifacts"}),e.jsx(D,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>k(y?new Set:new Set(a.map(d=>d.id))),children:y?"Deselect all":"Select all"})]}),e.jsx("div",{className:"bucket-artifact-list",children:a.map(d=>e.jsxs("div",{className:"bucket-artifact-row",children:[e.jsx(He,{id:`bucket-artifact-${d.id}`,checked:m.has(d.id),onCheckedChange:C=>A(d.id,C===!0)}),e.jsxs(Y,{htmlFor:`bucket-artifact-${d.id}`,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[e.jsx("span",{className:"bucket-artifact-kind",children:Nr[d.kind]}),e.jsx("span",{className:"bucket-artifact-name",children:d.label})]}),e.jsxs("a",{href:be(d.url)??void 0,target:"_blank",rel:"noopener noreferrer",className:"bucket-artifact-open",children:["Open",e.jsx(G,{name:"external",size:10})]})]},d.id))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The PDF and Hugging Face artifacts can be copied directly. GitHub repositories require the CLI workflow below."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"bucket-copy-commands",children:"CLI fallback"}),e.jsx("pre",{id:"bucket-copy-commands",className:"bucket-copy-commands h-[190px]",children:f?_:"Enter a bucket name above to prepare the copy commands."})]})]}):e.jsx("p",{className:"py-5 text-sm text-muted-foreground",children:"This paper does not have a linked GitHub repository or Hugging Face artifact to copy yet."})}),e.jsxs(oe,{children:[e.jsx("a",{href:"https://huggingface.co/docs/huggingface_hub/en/guides/buckets",target:"_blank",rel:"noopener noreferrer",className:"mr-auto text-sm text-muted-foreground underline underline-offset-4",children:"About Hugging Face Buckets"}),e.jsxs(D,{type:"button",onClick:U,variant:"outline",disabled:!f||N.length===0,children:[e.jsx(G,{name:"copy",size:12}),"Copy commands"]}),e.jsx(D,{type:"button",onClick:O,disabled:E||t.isSignedIn&&(!f||!N.some(d=>d.kind!=="github")),children:E?j&&j.total>1?`Copying ${j.current}/${j.total}…`:"Copying…":t.isSignedIn?"Copy now":"Sign in & copy"})]})]})})]})}function Tr({isLoading:t,papers:s}){return t?e.jsxs("div",{className:"sidebar-card","aria-busy":"true",children:[e.jsx("div",{className:"sidebar-card-title",children:"Related papers"}),e.jsx("div",{className:"related-meta",children:"Finding related work…"})]}):s!=null&&s.length?e.jsxs("div",{className:"sidebar-card",children:[e.jsx("div",{className:"sidebar-card-title",children:"Related papers"}),s.map(a=>e.jsxs(le,{to:`/paper/${a.arxiv_id||a.id}`,target:"_blank",rel:"noopener noreferrer",className:"related-paper",style:{textDecoration:"none",color:"inherit"},children:[e.jsx("div",{className:"related-title",children:e.jsx(Ae,{title:a.title})}),e.jsxs("div",{className:"related-meta",children:[e.jsx("span",{children:a.arxiv_id?`arXiv:${a.arxiv_id}`:"External resource"}),a.citation_count!=null&&e.jsxs("span",{children:[a.citation_count.toLocaleString()," cites"]})]})]},a.id))]}):null}const nt=3,Lt=3;function Ur(t){return t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Br({allHfArtifactUrls:t,citationCopied:s,citationDisplay:a,hfArtifactViewer:r,onCopyCitation:n,onEditHfArtifacts:c,onEditRepositories:i,paper:o,relatedIsLoading:l,relatedPapers:g,user:x}){var v;const[u,m]=p.useState(!1),k=[...o.repositories??[]].sort((j,R)=>Number(R.is_official)-Number(j.is_official)||(R.num_stars||0)-(j.num_stars||0)),E=(u?k:k.slice(0,nt)).map(j=>({...j,safeHref:be(j.url)}));return e.jsxs("aside",{className:"detail-sidebar",children:[e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[e.jsx("span",{children:"GitHub"}),e.jsxs("span",{className:"badge",children:[k.length," repo",k.length===1?"":"s",e.jsx("button",{type:"button",onClick:i,className:"edit-link",children:"edit"})]})]}),E.filter(({safeHref:j})=>j).map(j=>e.jsxs("a",{href:j.safeHref??void 0,target:"_blank",rel:"noopener noreferrer",className:"code-line",style:{textDecoration:"none"},children:[e.jsxs("span",{className:"code-line-repo",children:[e.jsx(G,{name:"github",size:12}),e.jsxs("span",{className:"code-line-repo-name",children:[j.owner,"/",j.name]}),j.is_official&&e.jsx("span",{className:"code-line-official",children:"· Official"})]}),e.jsxs("span",{className:"code-line-stars",children:["★ ",Ur(j.num_stars)]})]},j.id)),k.length===0&&e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",padding:"6px 0"},children:"No GitHub repositories linked yet."}),k.length>nt&&e.jsx("button",{type:"button",className:"bench-show-more",onClick:()=>m(j=>!j),children:u?"− show top 3":`+ show ${k.length-nt} more repos`})]}),e.jsx(Dr,{viewer:r,onEdit:c}),e.jsx(Lr,{githubUrls:k.map(({url:j})=>j),hfModelUrls:t.models,hfDatasetUrls:t.datasets,hfSpaceUrls:t.spaces,paperId:o.id,pdfName:((v=o.arxiv_id)==null?void 0:v.replace("/","-"))||o.id,pdfUrl:o.url_pdf,isSignedIn:!!x,suggestedBucketId:x?`${x.username}/${Fr(o.title)}`:void 0}),e.jsx(Tr,{isLoading:l,papers:g}),e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[e.jsx("span",{children:"Citation"}),e.jsxs("button",{type:"button",className:"citation-copy-btn",onClick:n,"aria-label":"Copy citation to clipboard",title:"Copy citation to clipboard",children:[e.jsx(G,{name:"copy",size:11}),s?"Copied":"Copy"]})]}),e.jsx("pre",{style:{fontFamily:"var(--mono)",fontSize:10.5,lineHeight:1.5,color:"var(--ink-soft)",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0},children:a})]})]})}function Dr({onEdit:t,viewer:s}){return e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[s.paperHref?e.jsx("a",{href:s.paperHref,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"none"},children:"🤗 Hugging Face"}):e.jsx("span",{children:"🤗 Hugging Face"}),e.jsx("button",{type:"button",onClick:t,className:"edit-link",children:"edit"})]}),s.isLoading?e.jsx(Ne,{className:"h-16 w-full"}):e.jsxs(e.Fragment,{children:[s.rows.map(a=>e.jsx(Hr,{...a},a.label)),s.footer&&e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--ink-faint)",marginTop:12},children:s.footer})]})]})}function Hr({count:t,href:s,isLimited:a,label:r,links:n}){const[c,i]=p.useState(!1),o=((n==null?void 0:n.length)??0)>Lt,l=c?n:n==null?void 0:n.slice(0,Lt),g=t!=null?`${t}${a?"+":""}`:"—";return e.jsxs("div",{className:"hf-artifact-row",children:[e.jsxs("div",{className:"hf-artifact-row-header",children:[e.jsx("span",{children:r}),t?e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"hf-artifact-count",children:g}):e.jsx("span",{className:"hf-artifact-count hf-artifact-count--empty",children:g})]}),l!=null&&l.length?e.jsxs("div",{className:"hf-artifact-links",children:[l.map(x=>e.jsx("a",{href:x.href,target:"_blank",rel:"noopener noreferrer",children:x.label},x.href)),o&&e.jsx("button",{type:"button",className:"hf-artifact-toggle","aria-expanded":c,onClick:()=>i(x=>!x),children:c?"Show fewer":`View all ${n.length}`})]}):null]})}const Tt=360;function Mr({canEdit:t,onEditMethods:s,onEditTasks:a,paper:r}){var g,x;const[n,c]=p.useState(!1),i=r.abstract||"",o=i.length>Tt,l=n||!o?i:`${i.slice(0,Tt)}…`;return e.jsxs(e.Fragment,{children:[r.tldr&&e.jsxs(e.Fragment,{children:[e.jsx(we,{id:"tldr",label:"TL;DR · AI-generated"}),e.jsx("div",{className:"tldr-box",children:r.tldr})]}),e.jsx(we,{id:"abstract",label:"Abstract"}),e.jsx("p",{className:"abstract-text",style:{marginBottom:8},children:e.jsx(Js,{text:l})}),o&&e.jsx("button",{type:"button",className:"read-full",onClick:()=>c(u=>!u),children:n?"− collapse abstract":"+ read full abstract"}),e.jsx(we,{id:"tasks",label:"Tasks",accent:e.jsxs("span",{className:"accent",children:[((g=r.tasks)==null?void 0:g.length)||0," tagged",t&&e.jsx("button",{type:"button",onClick:a,className:"edit-link",children:"edit"})]})}),e.jsx("div",{className:"paper-tags",style:{marginBottom:8},children:(r.tasks??[]).map(u=>e.jsx(Os,{slug:u.slug||"",label:u.name},u.id))}),e.jsx(we,{id:"methods",label:"Methods",accent:e.jsxs("span",{className:"accent",children:[((x=r.methods)==null?void 0:x.length)||0," used",t&&e.jsx("button",{type:"button",onClick:s,className:"edit-link",children:"edit"})]})}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:8},children:(r.methods??[]).map(u=>e.jsx(Qs,{method:u},u.id))})]})}const xe=["my-bookmark-ids"],mt="pwc:pending-bookmark";function zr(t){window.sessionStorage.setItem(mt,JSON.stringify(t)),window.location.assign(ga(!0))}function qr(){var r,n;const{user:t}=Le(),s=Z({queryKey:xe,queryFn:()=>ot.getBookmarkIds(),enabled:!!t,staleTime:60*1e3,refetchOnWindowFocus:!1}),a=Fe.useMemo(()=>{var c;return new Set(((c=s.data)==null?void 0:c.paper_ids)??[])},[(r=s.data)==null?void 0:r.paper_ids]);return{ids:((n=s.data)==null?void 0:n.paper_ids)??[],idSet:a,isLoading:s.isLoading,isError:s.isError}}function Kr(){const{user:t}=Le(),s=ce(),a=de({mutationFn:async({paperId:n,isBookmarked:c})=>{c?await ot.removeBookmark(n):await ot.addBookmark(n)},onMutate:async({paperId:n,isBookmarked:c})=>{await s.cancelQueries({queryKey:xe});const i=s.getQueryData(xe),o=typeof n=="string"?Number(n):n,l=(i==null?void 0:i.paper_ids)??[],g=c?l.filter(x=>x!==o):[o,...l.filter(x=>x!==o)];return s.setQueryData(xe,{paper_ids:g}),{previous:i}},onError:(n,c,i)=>{i!=null&&i.previous&&s.setQueryData(xe,i.previous),n instanceof it&&n.code==="saved_papers_bucket_authorization_required"&&zr(c)},onSettled:()=>{s.invalidateQueries({queryKey:xe}),s.invalidateQueries({queryKey:["my-bookmarks"]})}});return Fe.useEffect(()=>{if(!t||a.isPending)return;const n=new URL(window.location.href);if(n.searchParams.get(It)!=="1")return;n.searchParams.delete(It),window.history.replaceState({},"",`${n.pathname}${n.search}${n.hash}`);const c=window.sessionStorage.getItem(mt);if(c){window.sessionStorage.removeItem(mt);try{const i=JSON.parse(c);(typeof i.paperId=="number"||typeof i.paperId=="string")&&typeof i.isBookmarked=="boolean"&&a.mutate(i)}catch{}}},[a,t]),{toggle:Fe.useCallback((n,c)=>{if(!t){if(Kt())return;const i=typeof window<"u"?window.location.pathname+window.location.search:"/";window.location.href=Ts(`/api/v1/auth/hf/login?return_to=${encodeURIComponent(i)}`);return}a.mutate({paperId:n,isBookmarked:c})},[a,t]),isPending:a.isPending}}const Or=({paperId:t})=>{const{user:s}=Le(),{idSet:a}=qr(),{toggle:r,isPending:n}=Kr();if(Kt())return null;const c=Number(t),i=!!s&&a.has(c),o=()=>{Number.isFinite(c)&&r(c,i)},l=s&&i?"Saved":"Save",g=s?i?"Remove from saved papers":"Save this paper":"Sign in with Hugging Face to save this paper";return e.jsxs("button",{type:"button",className:`action-btn${i?" is-saved":""}`,onClick:o,disabled:n,"aria-pressed":i,"aria-label":g,title:g,children:[e.jsx(G,{name:"bookmark",size:12}),l]})};function $e({children:t,showEdit:s=!1,onEdit:a,editAriaLabel:r}){return s?e.jsxs("span",{className:"action-btn-composite",children:[t,e.jsx("button",{type:"button",className:"action-btn-segment action-btn-edit",onClick:a,"aria-label":r,children:"edit"})]}):t}function Qr(t){return e.jsx(as,{...t,kind:"enrich-paper",triggerClassName:"action-btn"})}const Gr={tasks:"tasks",methods:"methods",results:"evaluation results",repositories:"GitHub repositories","project-pages":"project pages","hf-artifacts":"Hugging Face artifacts",organizations:"organizations","source-url":"source URL"};function Ut(t){if(!t)return"—";try{return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"—"}}function Vr(t){return t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Bt(t,s){try{const a=new URL(t),n=a.pathname.replace(/\/$/,"").split("/").filter(Boolean).at(-1);return n?n.replace(/[-_]+/g," "):a.hostname.replace(/^www\./,"")}catch{return s}}const Cn=()=>{const{arxivId:t}=Us(),s=Dt(),{toast:a}=te(),{user:r}=Le(),n=(r==null?void 0:r.is_admin)??!1,c=!!r,i=xa(r),o=!0,{arxivId:l,evaluations:g,evaluationsByTask:x,evaluationsLoading:u,paper:m,paperError:k,paperLoading:E,presentation:v,refetchEvaluations:j,refetchPaper:R,relatedQuery:$,versions:T,visibleEvaluations:N}=Ra(t,i),[y,h]=p.useState(!1),{activeEditor:f,openEditor:_,setEditorOpen:A}=Ta();p.useEffect(()=>{i!=="direct"||!(m!=null&&m.id)||(f&&f!=="results"&&V.primeCurationState(m.id).catch(()=>{}),f==="results"&&Te.primeCurationState(m.id).catch(()=>{}))},[f,i,m==null?void 0:m.id]);const[U,H]=p.useState(null),O=p.useRef(!1);p.useEffect(()=>{if(!r||!m||O.current)return;const w=sessionStorage.getItem("pwc:fresh-auth-edit");if(!w)return;O.current=!0;const q=La(w);if(!V.freshAuthMutationDraft()){sessionStorage.removeItem("pwc:fresh-auth-edit"),q&&_(q);return}if(!window.confirm("You signed in again. Apply the saved destructive catalog edit now? The server will recheck the current catalog version before changing anything.")){a({title:"Edit kept locally",description:"Nothing was changed. Reload this paper when you are ready to confirm the saved edit."});return}V.resumeFreshAuthMutation().then(()=>{a({title:"Edit applied",description:"The restored catalog edit was applied."}),window.location.reload()}).catch(Ct=>{a({variant:"destructive",title:"Could not apply the saved edit",description:Ct instanceof Error?Ct.message:"Please reload and review the edit again."})})},[_,m,a,r]);const J=p.useMemo(()=>{if(!r||!(m!=null&&m.author_links))return!1;const w=r.username.toLowerCase();return m.author_links.some(q=>!!q.hf_username&&q.hf_username.toLowerCase()===w)},[r,m==null?void 0:m.author_links]),d=w=>{if(!c){H(w);return}_(w)},[C,I]=p.useState("idle"),[L,S]=p.useState(null),[K,X]=p.useState(null),b=async()=>{if(l){I("indexing"),S(null),X(null);try{await V.indexFromArxiv(l),a({title:"Indexed",description:"Paper added to database."}),setTimeout(()=>R(),1200),I("idle")}catch(w){const q=w;let ke=q.message||"Failed to index paper";if(q.response)try{ke=JSON.parse(q.response).detail||ke}catch{ke=q.response}S(ke),(q.status===429||q.status===503)&&X("Try again later after arXiv has lifted the temporary limit."),I("idle")}}},P=(v==null?void 0:v.citationCopy)??"",F=(v==null?void 0:v.copyableRanks)??[],[B,M]=p.useState(!1),Q=async()=>{if(P)try{await navigator.clipboard.writeText(P),M(!0),a({title:"Citation copied",description:"BibTeX entry copied to clipboard."}),window.setTimeout(()=>M(!1),1500)}catch{a({title:"Copy failed",description:"Could not access the clipboard. Please copy manually.",variant:"destructive"})}},z=async()=>{if(!m)return;const w=m.arxiv_id||m.id,q=ja(w,F);if(q)try{await navigator.clipboard.writeText(q),a({title:"PwC badges copied",description:"Each badge follows its current leaderboard result."})}catch{a({title:"Copy failed",description:"Could not access the clipboard. Please try again.",variant:"destructive"})}};if(E)return e.jsxs("div",{className:"page",children:[e.jsx(Ne,{className:"h-12 w-3/4 mb-4"}),e.jsx(Ne,{className:"h-6 w-1/3 mb-8"}),e.jsx(Ne,{className:"h-64 w-full"})]});if(k||!m)return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(le,{to:"/papers",children:"Papers"}),e.jsx("span",{className:"sep",children:"/"}),e.jsxs("span",{style:{color:"var(--ink)"},children:["arXiv:",l]})]}),e.jsx("h1",{className:"detail-title",children:"Paper not indexed yet"}),e.jsxs("p",{style:{fontFamily:"var(--serif)",color:"var(--ink-soft)",marginTop:16,maxWidth:640},children:["We don't have ",e.jsxs("span",{style:{fontFamily:"var(--mono)"},children:["arXiv:",l]})," in the database. You can index it from arXiv right now."]}),L&&e.jsx(sa,{variant:"destructive",className:"mt-4 max-w-xl",children:e.jsxs(aa,{children:[e.jsx("div",{children:L}),K&&e.jsx("div",{className:"mt-2",children:K})]})}),e.jsxs("div",{className:"action-row",children:[n&&e.jsxs("button",{className:"action-btn",onClick:b,disabled:C==="indexing",children:[e.jsx(G,{name:"sparkle",size:12}),C==="indexing"?"Indexing…":"Index from arXiv"]}),e.jsx(D,{variant:"outline",onClick:()=>s("/papers"),children:"Browse Papers"})]})]});if(!v)return null;const{allHfArtifactUrls:bs,authorEntries:ze,citationDisplay:js,hasIntroducedItems:ys,hasLineageItems:vs,hfArtifactViewer:qe,hfPaperExists:ks,introducedBenchmarks:ws,introducedFrameworks:yt,introducedMethods:_s,introducedSummary:Ns,numPages:vt,paperSourceLabel:kt,predecessorPapers:Ke,projectPages:ye,repoSummary:ve,safeAbstractUrl:wt,safeConferenceUrl:_t,safePdfUrl:Oe,sourceActionLabel:Cs,successorPapers:Qe}=v,Pe=12,Nt=y||ze.length<=Pe?ze:ze.slice(0,Pe);return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(le,{to:"/",children:"Trending"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{children:kt})]}),e.jsxs("div",{className:"detail-grid",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"detail-hero",children:[e.jsxs("div",{className:"detail-hero-main",children:[e.jsx("h1",{className:"detail-title",children:e.jsx(Ae,{title:m.title})}),e.jsxs("div",{className:"detail-meta",children:[e.jsx("span",{children:kt}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:["Submitted ",Ut(m.published)]}),vt&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:[vt," pages"]})]}),m.citation_count!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:[m.citation_count.toLocaleString()," citations"]})]}),(m.proceeding||m.conference_slug)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),m.conference_slug?e.jsx("a",{href:`/conferences/${m.conference_slug}`,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-text)"},children:(m.proceeding||m.conference_name||"").replace(/\s+\d{1,2}$/,"")}):e.jsx("span",{children:m.proceeding.replace(/\s+\d{1,2}$/,"")})]}),T.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("select",{className:"version-select",value:m.version,onChange:w=>{const q=w.target.value;m.arxiv_id&&s(`/paper/${m.arxiv_id.replace(/v\d+$/,"")}${q?`?version=${q}`:""}`)},children:T.map(w=>e.jsxs("option",{value:w.version,children:[w.version," — ",Ut(w.published)]},w.version))})]})]}),e.jsxs("div",{className:"detail-authors",children:[Nt.map((w,q)=>e.jsxs(Fe.Fragment,{children:[w.id?e.jsx(le,{to:`/authors/${w.id}`,children:w.name}):w.hf_username?e.jsx("a",{href:`https://huggingface.co/${w.hf_username}`,target:"_blank",rel:"noopener noreferrer",title:`@${w.hf_username} on Hugging Face`,children:w.name}):e.jsx("a",{children:w.name}),qPe&&e.jsx("button",{className:"show-more-authors",onClick:()=>h(w=>!w),style:{marginLeft:8,background:"none",border:"none",cursor:"pointer",color:"var(--accent-text)",fontFamily:"var(--mono)",fontSize:12},children:y?"show fewer":`+${m.authors.length-Pe} more`})]}),e.jsxs("div",{className:"action-row",children:[Oe&&m.source==="arxiv"&&Bs()&&(!Ds()||r!=null&&r.is_admin)?e.jsxs(le,{className:"action-btn",to:`/pdf/${(m.arxiv_id||l).replace(/v\d+$/i,"")}`,onClick:()=>{const w=(m.arxiv_id||l).replace(/v\d+$/i,"");sessionStorage.removeItem(`pwc:reader:session:${w}`),sessionStorage.removeItem(`pwc:reader:assistant-collapsed:${w}`),sessionStorage.removeItem(`pwc:reader:page:${w}`)},children:[e.jsx(G,{name:"pdf",size:12})," Read paper"]}):Oe?e.jsxs("a",{className:"action-btn",href:Oe,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(G,{name:"pdf",size:12})," View PDF"]}):null,wt&&e.jsx($e,{showEdit:m.source==="external"&&o,onEdit:()=>d("source-url"),editAriaLabel:"Edit source URL",children:e.jsxs("a",{className:m.source==="external"&&o?"action-btn-segment action-btn-main":"action-btn",href:wt,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(G,{name:"external",size:12})," ",Cs]})}),qe.paperHref&&ks&&e.jsxs("a",{className:"bm-action-btn",href:qe.paperHref,target:"_blank",rel:"noopener noreferrer","aria-label":"View on Hugging Face",children:["View on ",e.jsx("span",{"aria-hidden":"true",children:"🤗"})]}),ve.githubUrl&&e.jsx($e,{showEdit:o,onEdit:()=>d("repositories"),editAriaLabel:"Edit code repositories",children:e.jsxs("a",{className:"action-btn-segment action-btn-main",href:ve.githubUrl,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(G,{name:"github",size:12})," Code",ve.github!=null&&e.jsxs("span",{style:{opacity:.7,marginLeft:4},children:["· ",Vr(ve.github)," ★"]})]})}),ve.githubUrl?null:e.jsxs("button",{type:"button",className:"action-btn",onClick:()=>d("repositories"),title:"Add GitHub repository",children:[e.jsx(G,{name:"github",size:12})," Add code"]}),ye.length===1?e.jsx($e,{showEdit:o,onEdit:()=>d("project-pages"),editAriaLabel:"Edit project pages",children:e.jsxs("a",{className:"action-btn-segment action-btn-main",href:ye[0].safeHref??void 0,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(G,{name:"globe",size:12})," Project page"]})}):null,ye.length>1?e.jsx($e,{showEdit:o,onEdit:()=>d("project-pages"),editAriaLabel:"Edit project pages",children:e.jsxs(Hs,{children:[e.jsx(Ms,{asChild:!0,children:e.jsxs("button",{type:"button",className:"action-btn-segment action-btn-main",children:[e.jsx(G,{name:"globe",size:12})," Project page"]})}),e.jsx(zs,{align:"start",className:"project-page-menu",children:ye.map((w,q)=>e.jsx(qs,{asChild:!0,children:w.safeHref?e.jsx("a",{href:w.safeHref,target:"_blank",rel:"noopener noreferrer",children:Bt(w.url,`Project page ${q+1}`)}):e.jsx("span",{children:Bt(w.url,`Project page ${q+1}`)})},w.url))})]})}):null,ye.length===0&&c?e.jsxs("button",{type:"button",className:"action-btn",onClick:()=>d("project-pages"),title:"Add project page",children:[e.jsx(G,{name:"globe",size:12})," Add project page"]}):null,_t&&e.jsxs("a",{className:"action-btn",href:_t,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(G,{name:"external",size:12})," Conference"]}),(m.organizations||[]).map(w=>e.jsxs(le,{to:`/orgs/${w.slug}`,className:"action-btn",title:w.name,"aria-label":w.name,children:[w.logo_url&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",height:16,width:16,borderRadius:3,overflow:"hidden"},children:e.jsx("img",{src:w.logo_url,alt:"",style:{height:"150%",width:"150%",objectFit:"contain"},onError:q=>{q.currentTarget.style.display="none"}})}),w.name]},w.id)),e.jsx("button",{type:"button",className:"action-btn",onClick:()=>d("organizations"),children:"Edit organizations"}),n&&ha()&&e.jsx(Qr,{paperId:Number(m.id),paperTitle:m.title,onComplete:()=>void R()}),e.jsx(Or,{paperId:m.id})]}),m.leaderboard_ranks&&m.leaderboard_ranks.length>0&&e.jsx(Gs,{wrap:!0,paperHref:`/paper/${m.arxiv_id||m.id}`,ranks:m.leaderboard_ranks.filter(w=>w.best_rank>=1&&w.best_rank<=3).map(w=>({name:w.dataset_name,slug:w.dataset_slug||null,rank:w.best_rank}))})]}),e.jsx("div",{className:"detail-hero-thumb detail-thumb-wrap",children:e.jsx(Vs,{paperId:m.arxiv_id||m.id,title:m.title,thumbnailUrl:Ks(m.thumbnail_url),priority:!0})})]}),ys&&e.jsxs("div",{className:`introduced-banner${yt.length>0?" introduced-banner--framework":""}`,children:[e.jsx("span",{className:"introduced-label",children:"Introduced"}),e.jsxs("div",{className:"introduced-methods",children:[_s.map(w=>e.jsxs("button",{type:"button",className:"introduced-pill",onClick:()=>s(`/methods/${w.slug||w.id}`),children:[w.name,e.jsx("span",{className:"introduced-arrow",children:"→"})]},`method-${w.id}`)),ws.map(w=>e.jsxs("button",{type:"button",className:"introduced-pill",onClick:()=>s(`/benchmark/${w.slug||w.id}`),children:[w.name,e.jsx("span",{className:"introduced-arrow",children:"→"})]},`benchmark-${w.id}`)),yt.map(w=>e.jsxs("button",{type:"button",className:"introduced-pill",onClick:()=>s(`/frameworks#framework-${w.slug}`),children:[w.name,e.jsx("span",{className:"introduced-arrow",children:"→"})]},`framework-${w.slug}`))]}),e.jsxs("span",{className:"introduced-note",children:["This paper is the canonical source for ",Ns,"."]})]}),vs&&e.jsxs("div",{className:"introduced-banner lineage-banner",children:[Qe.length>0&&e.jsxs("div",{className:"lineage-row",children:[e.jsx("span",{className:"introduced-label lineage-label",children:Qe.length===1?"Follow-up paper":"Follow-up papers"}),e.jsx("div",{className:"introduced-methods",children:Qe.map(w=>e.jsxs("button",{type:"button",className:"introduced-pill lineage-pill",onClick:()=>s(`/paper/${w.route_identifier}`),children:[e.jsx(Ae,{title:w.title}),e.jsx("span",{className:"introduced-arrow",children:"→"})]},`successor-${w.id}`))})]}),Ke.length>0&&e.jsxs("div",{className:"lineage-row",children:[e.jsx("span",{className:"introduced-label lineage-label",children:Ke.length===1?"Predecessor paper":"Predecessor papers"}),e.jsx("div",{className:"introduced-methods",children:Ke.map(w=>e.jsxs("button",{type:"button",className:"introduced-pill lineage-pill",onClick:()=>s(`/paper/${w.route_identifier}`),children:[e.jsx("span",{className:"introduced-arrow lineage-arrow-back",children:"←"}),e.jsx(Ae,{title:w.title})]},`predecessor-${w.id}`))})]})]}),e.jsx(Mr,{canEdit:o,onEditMethods:()=>d("methods"),onEditTasks:()=>d("tasks"),paper:m}),e.jsx(pr,{canCopyBadge:F.length>0,canEdit:o,evaluationsByTask:x,evaluationsLoading:u,isAdmin:n,onCopyBadge:z,onEdit:()=>d("results"),onRefresh:()=>void j(),paper:m,visibleEvaluationCount:(N==null?void 0:N.length)??0})]}),e.jsx(Br,{allHfArtifactUrls:bs,citationCopied:B,citationDisplay:js,hfArtifactViewer:qe,onCopyCitation:Q,onEditHfArtifacts:()=>d("hf-artifacts"),onEditRepositories:()=>d("repositories"),paper:m,relatedIsLoading:$.isLoading,relatedPapers:$.data,user:r})]}),e.jsx(dr,{activeEditor:f,arxivId:l,editSubmitMode:i,evaluations:g??[],isAdmin:n,isLinkedAuthor:J,onOpenChange:A,paper:m}),e.jsx(ra,{open:U!==null,onOpenChange:w=>{w||H(null)},sectionLabel:U?Gr[U]:"this paper",returnTo:typeof window<"u"?window.location.pathname:"/"})]})};export{Cn as default}; diff --git a/assets/PaperPreviewLink-BCdZ9yj3.js b/assets/PaperPreviewLink-B25cD-_k.js similarity index 95% rename from assets/PaperPreviewLink-BCdZ9yj3.js rename to assets/PaperPreviewLink-B25cD-_k.js index 295af0fcbec121d9b36ea7bc1bfc8bea460560c0..4902335cb8e5f689f2f3c72b47ad0f1459134a71 100644 --- a/assets/PaperPreviewLink-BCdZ9yj3.js +++ b/assets/PaperPreviewLink-B25cD-_k.js @@ -1,7 +1,7 @@ -import{o as F,l as ne,f as v,m as b,a as re,p as I,b as $,n as L,h as ie,s as ae,c as oe,v as se,S as le}from"./index-BLqBUiom.js";import{k as z}from"./katex.min-BSBacQyE.js";import{j as f,R as T,N as ce,k as ue,L as he}from"./index-BrhBTT14.js";import{u as pe}from"./useQuery-GhY2LXSI.js";import{H as me,a as fe,b as de}from"./hover-card-BcKGA4Et.js";import{p as ge}from"./papers-DBaPliAp.js";function xe(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:o},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:l,mathText:s,mathTextData:l}};function e(a){const u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},a)}function t(){this.buffer()}function n(){const a=this.resume(),u=this.stack[this.stack.length-1];F(u.type==="math"),u.meta=a}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(a){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),p=this.stack[this.stack.length-1];F(p.type==="math"),this.exit(a),p.value=u;const m=p.data.hChildren[0];F(m.type==="element"),F(m.tagName==="code"),m.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function o(a){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},a),this.buffer()}function s(a){const u=this.resume(),p=this.stack[this.stack.length-1];F(p.type==="inlineMath"),this.exit(a),p.value=u,p.data.hChildren.push({type:"text",value:u})}function l(a){this.config.enter.data.call(this,a),this.config.exit.data.call(this,a)}}function ye(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),r.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +import{o as F,l as ne,f as v,m as b,a as re,p as I,b as $,n as z,h as ie,s as ae,c as oe,v as se,S as le}from"./index-vCOH2DKd.js";import{k as L}from"./katex.min-BSBacQyE.js";import{j as f,z as T,M as ce,n as ue,L as he}from"./index-D_-UZEuL.js";import{u as pe}from"./useQuery-BZo4MZ3s.js";import{H as me,a as fe,b as de}from"./hover-card-DiJQFgx9.js";import{p as ge}from"./papers-DHqjKX7p.js";function xe(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:o},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:l,mathText:s,mathTextData:l}};function e(a){const u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},a)}function t(){this.buffer()}function n(){const a=this.resume(),u=this.stack[this.stack.length-1];F(u.type==="math"),u.meta=a}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(a){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),p=this.stack[this.stack.length-1];F(p.type==="math"),this.exit(a),p.value=u;const m=p.data.hChildren[0];F(m.type==="element"),F(m.tagName==="code"),m.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function o(a){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},a),this.buffer()}function s(a){const u=this.resume(),p=this.stack[this.stack.length-1];F(p.type==="inlineMath"),this.exit(a),p.value=u,p.data.hChildren.push({type:"text",value:u})}function l(a){this.config.enter.data.call(this,a),this.config.exit.data.call(this,a)}}function ye(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),r.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` `,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(o,s,l,a){const u=o.value||"",p=l.createTracker(a),m="$".repeat(Math.max(ne(u,"$")+1,2)),g=l.enter("mathFlow");let x=p.move(m);if(o.meta){const d=l.enter("mathFlowMeta");x+=p.move(l.safe(o.meta,{after:` `,before:x,encode:["$"],...p.current()})),d()}return x+=p.move(` `),u&&(x+=p.move(u+` -`)),x+=p.move(m),g(),x}function r(o,s,l){let a=o.value||"",u=1;for(t||u++;new RegExp("(^|[^$])"+"\\$".repeat(u)+"([^$]|$)").test(a);)u++;const p="$".repeat(u);/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^\$|\$$/.test(a))&&(a=" "+a+" ");let m=-1;for(;++mu&&(u=p):p&&(u!==void 0&&u>-1&&a.push(` +`)),x+=p.move(m),g(),x}function r(o,s,l){let a=o.value||"",u=1;for(t||u++;new RegExp("(^|[^$])"+"\\$".repeat(u)+"([^$]|$)").test(a);)u++;const p="$".repeat(u);/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^\$|\$$/.test(a))&&(a=" "+a+" ");let m=-1;for(;++mu&&(u=p):p&&(u!==void 0&&u>-1&&a.push(` `.repeat(u)||" "),u=-1,a.push(p))}return a.join("")}function Q(e,t,n){return e.type==="element"?Qe(e,t,n):e.type==="text"?n.whitespace==="normal"?Y(e,n):Ye(e):[]}function Qe(e,t,n){const r=J(e,n),i=e.children||[];let o=-1,s=[];if(Xe(e))return s;let l,a;for(j(e)||H(e)&&B(t,e,H)?a=` -`:Ke(e)?(l=2,a=2):W(e)&&(l=1,a=1);++o({name:n.name,slug:n.slug??""}))}}function at(e){if(!e.authors.length)return"";const t=e.authors.slice(0,3).join(", ");return e.authors.length>3?`${t}, et al.`:t}function ot(e){var n;if(e.conference)return e.conference;const t=(n=e.published)==null?void 0:n.slice(0,4);if(e.arxivId)return t?`arXiv ${t}`:"arXiv";if(e.sourceUrl)try{return new URL(e.sourceUrl).hostname.replace(/^www\./,"")}catch{}return t??"external"}const st=({seed:e=0})=>f.jsxs("div",{className:"paper-preview-thumb","aria-hidden":"true","data-testid":"faux-paper-thumb",children:[f.jsxs("div",{className:"paper-preview-thumb-title",children:[f.jsx("span",{}),f.jsx("span",{})]}),f.jsx("div",{className:"paper-preview-thumb-auth"}),f.jsxs("div",{className:"paper-preview-thumb-cols",children:[f.jsx("div",{className:"paper-preview-thumb-col"}),f.jsx("div",{className:"paper-preview-thumb-col"})]}),f.jsx("div",{className:"paper-preview-thumb-fig",style:{top:62+e%3*8}})]}),lt=({thumbnailUrl:e,seed:t})=>{const[n,r]=T.useState(!1),i=ce(e);return T.useEffect(()=>r(!1),[i]),!i||n?f.jsx(st,{seed:t}):f.jsx("div",{className:"paper-preview-thumb paper-preview-thumb-real",children:f.jsx("img",{"data-testid":"paper-preview-image",src:i,alt:"",loading:"lazy",decoding:"async",onError:()=>r(!0)})})},ct=({data:e})=>{const t=e.routeId.split("").reduce((r,i)=>r+i.charCodeAt(0),0),n=at(e);return f.jsxs("div",{className:"paper-preview-inner",children:[f.jsx(lt,{thumbnailUrl:e.thumbnailUrl,seed:t}),f.jsxs("div",{className:"paper-preview-meta",children:[f.jsx("div",{className:"paper-preview-title",children:e.title}),n&&f.jsx("div",{className:"paper-preview-auth",children:n}),f.jsxs("div",{className:"paper-preview-venue",children:[ot(e),e.arxivId&&f.jsxs(f.Fragment,{children:[" · arXiv:",e.arxivId]}),e.citationCount!=null&&f.jsxs(f.Fragment,{children:[" · ↑ ",e.citationCount.toLocaleString()]})]}),e.tasks.length>0&&f.jsx("div",{className:"paper-preview-tags",children:e.tasks.map(r=>f.jsx("span",{className:"paper-preview-tag",children:r.name},r.slug||r.name))})]})]})},ut=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,wt=({routeId:e,to:t,initialData:n,className:r,children:i,target:o,title:s})=>{const l=ue(e),[a,u]=T.useState(!1),p=!!(n!=null&&n.title.trim()),m=pe({queryKey:["paper-preview",l],queryFn:()=>ge.get(l,!1),enabled:a&&!p,staleTime:5*60*1e3,gcTime:30*60*1e3,retry:!1}),g=n??(m.data?it(m.data,l):void 0),x=f.jsx(he,{className:r,to:t??`/paper/${l}`,target:o,title:s,rel:o==="_blank"?"noopener noreferrer":void 0,children:i});return f.jsxs(me,{open:a,onOpenChange:d=>{(!d||!ut())&&u(d)},openDelay:150,closeDelay:100,children:[f.jsx(fe,{asChild:!0,children:x}),f.jsx(de,{className:"paper-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:g?f.jsx(ct,{data:g}):m.isError?f.jsx("div",{className:"paper-preview-status",children:"Preview unavailable"}):f.jsx("div",{className:"paper-preview-status","aria-live":"polite",children:"Loading preview…"})})]})};export{wt as P,xt as a,yt as r}; +`:Ke(e)?(l=2,a=2):W(e)&&(l=1,a=1);++o({name:n.name,slug:n.slug??""}))}}function at(e){if(!e.authors.length)return"";const t=e.authors.slice(0,3).join(", ");return e.authors.length>3?`${t}, et al.`:t}function ot(e){var n;if(e.conference)return e.conference;const t=(n=e.published)==null?void 0:n.slice(0,4);if(e.arxivId)return t?`arXiv ${t}`:"arXiv";if(e.sourceUrl)try{return new URL(e.sourceUrl).hostname.replace(/^www\./,"")}catch{}return t??"external"}const st=({seed:e=0})=>f.jsxs("div",{className:"paper-preview-thumb","aria-hidden":"true","data-testid":"faux-paper-thumb",children:[f.jsxs("div",{className:"paper-preview-thumb-title",children:[f.jsx("span",{}),f.jsx("span",{})]}),f.jsx("div",{className:"paper-preview-thumb-auth"}),f.jsxs("div",{className:"paper-preview-thumb-cols",children:[f.jsx("div",{className:"paper-preview-thumb-col"}),f.jsx("div",{className:"paper-preview-thumb-col"})]}),f.jsx("div",{className:"paper-preview-thumb-fig",style:{top:62+e%3*8}})]}),lt=({thumbnailUrl:e,seed:t})=>{const[n,r]=T.useState(!1),i=ce(e);return T.useEffect(()=>r(!1),[i]),!i||n?f.jsx(st,{seed:t}):f.jsx("div",{className:"paper-preview-thumb paper-preview-thumb-real",children:f.jsx("img",{"data-testid":"paper-preview-image",src:i,alt:"",loading:"lazy",decoding:"async",onError:()=>r(!0)})})},ct=({data:e})=>{const t=e.routeId.split("").reduce((r,i)=>r+i.charCodeAt(0),0),n=at(e);return f.jsxs("div",{className:"paper-preview-inner",children:[f.jsx(lt,{thumbnailUrl:e.thumbnailUrl,seed:t}),f.jsxs("div",{className:"paper-preview-meta",children:[f.jsx("div",{className:"paper-preview-title",children:e.title}),n&&f.jsx("div",{className:"paper-preview-auth",children:n}),f.jsxs("div",{className:"paper-preview-venue",children:[ot(e),e.arxivId&&f.jsxs(f.Fragment,{children:[" · arXiv:",e.arxivId]}),e.citationCount!=null&&f.jsxs(f.Fragment,{children:[" · ↑ ",e.citationCount.toLocaleString()]})]}),e.tasks.length>0&&f.jsx("div",{className:"paper-preview-tags",children:e.tasks.map(r=>f.jsx("span",{className:"paper-preview-tag",children:r.name},r.slug||r.name))})]})]})},ut=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,wt=({routeId:e,to:t,initialData:n,className:r,children:i,target:o,title:s})=>{const l=ue(e),[a,u]=T.useState(!1),p=!!(n!=null&&n.title.trim()),m=pe({queryKey:["paper-preview",l],queryFn:()=>ge.get(l,!1),enabled:a&&!p,staleTime:5*60*1e3,gcTime:30*60*1e3,retry:!1}),g=n??(m.data?it(m.data,l):void 0),x=f.jsx(he,{className:r,to:t??`/paper/${l}`,target:o,title:s,rel:o==="_blank"?"noopener noreferrer":void 0,children:i});return f.jsxs(me,{open:a,onOpenChange:d=>{(!d||!ut())&&u(d)},openDelay:150,closeDelay:100,children:[f.jsx(fe,{asChild:!0,children:x}),f.jsx(de,{className:"paper-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:g?f.jsx(ct,{data:g}):m.isError?f.jsx("div",{className:"paper-preview-status",children:"Preview unavailable"}):f.jsx("div",{className:"paper-preview-status","aria-live":"polite",children:"Loading preview…"})})]})};export{wt as P,xt as a,yt as r}; diff --git a/assets/PaperReaderView-Lr_OJaUk.css b/assets/PaperReaderView-Lr_OJaUk.css new file mode 100644 index 0000000000000000000000000000000000000000..2f419234e7c61731d825f2cb89c05b697da3948f --- /dev/null +++ b/assets/PaperReaderView-Lr_OJaUk.css @@ -0,0 +1 @@ +:root{--react-pdf-text-layer: 1;--highlight-bg-color: rgba(180, 0, 170, 1);--highlight-selected-bg-color: rgba(0, 100, 0, 1)}@media screen and (forced-colors: active){:root{--highlight-bg-color: Highlight;--highlight-selected-bg-color: ButtonText}}[data-main-rotation="90"]{transform:rotate(90deg) translateY(-100%)}[data-main-rotation="180"]{transform:rotate(180deg) translate(-100%,-100%)}[data-main-rotation="270"]{transform:rotate(270deg) translate(-100%)}.textLayer{position:absolute;text-align:initial;top:0;right:0;bottom:0;left:0;overflow:hidden;line-height:1;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;text-size-adjust:none;forced-color-adjust:none;transform-origin:0 0;z-index:2}.textLayer :is(span,br){color:transparent;position:absolute;white-space:pre;cursor:text;margin:0;transform-origin:0 0}.textLayer span.markedContent{top:0;height:0}.textLayer .highlight{margin:-1px;padding:1px;background-color:var(--highlight-bg-color);border-radius:4px}.textLayer .highlight.appended{position:initial}.textLayer .highlight.begin{border-radius:4px 0 0 4px}.textLayer .highlight.end{border-radius:0 4px 4px 0}.textLayer .highlight.middle{border-radius:0}.textLayer .highlight.selected{background-color:var(--highlight-selected-bg-color)}.textLayer br::-moz-selection{background:transparent}.textLayer br::selection{background:transparent}.textLayer .endOfContent{display:block;position:absolute;top:100%;right:0;bottom:0;left:0;z-index:-1;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}.textLayer.selecting .endOfContent{top:0}.hiddenCanvasElement{position:absolute;top:0;left:0;width:0;height:0;display:none}:root{--react-pdf-annotation-layer: 1;--annotation-unfocused-field-background: url("data:image/svg+xml;charset=UTF-8,");--input-focus-border-color: Highlight;--input-focus-outline: 1px solid Canvas;--input-unfocused-border-color: transparent;--input-disabled-border-color: transparent;--input-hover-border-color: black;--link-outline: none}@media screen and (forced-colors: active){:root{--input-focus-border-color: CanvasText;--input-unfocused-border-color: ActiveText;--input-disabled-border-color: GrayText;--input-hover-border-color: Highlight;--link-outline: 1.5px solid LinkText}.annotationLayer .textWidgetAnnotation :is(input,textarea):required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required{outline:1.5px solid selectedItem}.annotationLayer .linkAnnotation:hover{-webkit-backdrop-filter:invert(100%);backdrop-filter:invert(100%)}}.annotationLayer{position:absolute;top:0;left:0;pointer-events:none;transform-origin:0 0;z-index:3}.annotationLayer[data-main-rotation="90"] .norotate{transform:rotate(270deg) translate(-100%)}.annotationLayer[data-main-rotation="180"] .norotate{transform:rotate(180deg) translate(-100%,-100%)}.annotationLayer[data-main-rotation="270"] .norotate{transform:rotate(90deg) translateY(-100%)}.annotationLayer canvas{position:absolute;width:100%;height:100%}.annotationLayer section{position:absolute;text-align:initial;pointer-events:auto;box-sizing:border-box;margin:0;transform-origin:0 0}.annotationLayer .linkAnnotation{outline:var(--link-outline)}.textLayer.selecting~.annotationLayer section{pointer-events:none}.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton)>a{position:absolute;font-size:1em;top:0;left:0;width:100%;height:100%}.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton)>a:hover{opacity:.2;background:#ff0;box-shadow:0 2px 10px #ff0}.annotationLayer .textAnnotation img{position:absolute;cursor:pointer;width:100%;height:100%;top:0;left:0}.annotationLayer .textWidgetAnnotation :is(input,textarea),.annotationLayer .choiceWidgetAnnotation select,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input{background-image:var(--annotation-unfocused-field-background);border:2px solid var(--input-unfocused-border-color);box-sizing:border-box;font:calc(9px * var(--scale-factor)) sans-serif;height:100%;margin:0;vertical-align:top;width:100%}.annotationLayer .textWidgetAnnotation :is(input,textarea):required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required{outline:1.5px solid red}.annotationLayer .choiceWidgetAnnotation select option{padding:0}.annotationLayer .buttonWidgetAnnotation.radioButton input{border-radius:50%}.annotationLayer .textWidgetAnnotation textarea{resize:none}.annotationLayer .textWidgetAnnotation :is(input,textarea)[disabled],.annotationLayer .choiceWidgetAnnotation select[disabled],.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input[disabled]{background:none;border:2px solid var(--input-disabled-border-color);cursor:not-allowed}.annotationLayer .textWidgetAnnotation :is(input,textarea):hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:hover{border:2px solid var(--input-hover-border-color)}.annotationLayer .textWidgetAnnotation :is(input,textarea):hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .buttonWidgetAnnotation.checkBox input:hover{border-radius:2px}.annotationLayer .textWidgetAnnotation :is(input,textarea):focus,.annotationLayer .choiceWidgetAnnotation select:focus{background:none;border:2px solid var(--input-focus-border-color);border-radius:2px;outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) :focus{background-image:none;background-color:transparent}.annotationLayer .buttonWidgetAnnotation.checkBox :focus{border:2px solid var(--input-focus-border-color);border-radius:2px;outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation.radioButton :focus{border:2px solid var(--input-focus-border-color);outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after,.annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{background-color:CanvasText;content:"";display:block;position:absolute}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after{height:80%;left:45%;width:1px}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before{transform:rotate(45deg)}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after{transform:rotate(-45deg)}.annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{border-radius:50%;height:50%;left:30%;top:20%;width:50%}.annotationLayer .textWidgetAnnotation input.comb{font-family:monospace;padding-left:2px;padding-right:0}.annotationLayer .textWidgetAnnotation input.comb:focus{width:103%}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input{-webkit-appearance:none;-moz-appearance:none;appearance:none}.annotationLayer .popupTriggerArea{height:100%;width:100%}.annotationLayer .fileAttachmentAnnotation .popupTriggerArea{position:absolute}.annotationLayer .popupWrapper{position:absolute;font-size:calc(9px * var(--scale-factor));width:100%;min-width:calc(180px * var(--scale-factor));pointer-events:none}.annotationLayer .popup{position:absolute;max-width:calc(180px * var(--scale-factor));background-color:#ff9;box-shadow:0 calc(2px * var(--scale-factor)) calc(5px * var(--scale-factor)) #888;border-radius:calc(2px * var(--scale-factor));padding:calc(6px * var(--scale-factor));margin-left:calc(5px * var(--scale-factor));cursor:pointer;font:message-box;white-space:normal;word-wrap:break-word;pointer-events:auto}.annotationLayer .popup>*{font-size:calc(9px * var(--scale-factor))}.annotationLayer .popup h1{display:inline-block}.annotationLayer .popupDate{display:inline-block;margin-left:calc(5px * var(--scale-factor))}.annotationLayer .popupContent{border-top:1px solid rgba(51,51,51,1);margin-top:calc(2px * var(--scale-factor));padding-top:calc(2px * var(--scale-factor))}.annotationLayer .richText>*{white-space:pre-wrap;font-size:calc(9px * var(--scale-factor))}.annotationLayer .highlightAnnotation,.annotationLayer .underlineAnnotation,.annotationLayer .squigglyAnnotation,.annotationLayer .strikeoutAnnotation,.annotationLayer .freeTextAnnotation,.annotationLayer .lineAnnotation svg line,.annotationLayer .squareAnnotation svg rect,.annotationLayer .circleAnnotation svg ellipse,.annotationLayer .polylineAnnotation svg polyline,.annotationLayer .polygonAnnotation svg polygon,.annotationLayer .caretAnnotation,.annotationLayer .inkAnnotation svg polyline,.annotationLayer .stampAnnotation,.annotationLayer .fileAttachmentAnnotation{cursor:pointer}.annotationLayer section svg{position:absolute;width:100%;height:100%;top:0;left:0}.annotationLayer .annotationTextContent{position:absolute;width:100%;height:100%;opacity:0;color:transparent;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}.annotationLayer .annotationTextContent span{width:100%;display:inline-block} diff --git a/assets/PaperReaderView-fLXDbLBc.js b/assets/PaperReaderView-fLXDbLBc.js new file mode 100644 index 0000000000000000000000000000000000000000..d6f3a416e2989632aa542330f7fec3472f61431f --- /dev/null +++ b/assets/PaperReaderView-fLXDbLBc.js @@ -0,0 +1,12 @@ +var Lp=Object.defineProperty;var xd=c=>{throw TypeError(c)};var Mp=(c,t,e)=>t in c?Lp(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var Y=(c,t,e)=>Mp(c,typeof t!="symbol"?t+"":t,e),Mh=(c,t,e)=>t.has(c)||xd("Cannot "+e);var r=(c,t,e)=>(Mh(c,t,"read from private field"),e?e.call(c):t.get(c)),b=(c,t,e)=>t.has(c)?xd("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(c):t.set(c,e),p=(c,t,e,s)=>(Mh(c,t,"write to private field"),s?s.call(c,e):t.set(c,e),e),m=(c,t,e)=>(Mh(c,t,"access private method"),e);var he=(c,t,e,s)=>({set _(i){p(c,t,i,e)},get _(){return r(c,t,s)}});import{_ as fl,N as Ip,r as R,j as k,O as Ah,c as Fp,n as Dp,u as Op,y as Np,Q as Hp,L as rr,U as Bp,S as jp}from"./index-D_-UZEuL.js";import{u as $p}from"./useQuery-BZo4MZ3s.js";import{a as zp}from"./usePapers-BCHtBW8G.js";import{c as Gp}from"./chat-7zW8PrrA.js";import{s as Up}from"./safeExternalHref-CkBrsh84.js";import{ChatExperience as Wp}from"./ChatView-D5ne7HbB.js";import"./useInfiniteQuery-CFUEkcEs.js";import"./papers-DHqjKX7p.js";import"./ChatMessage-DwVcq3Ve.js";import"./chatSessions-CPPX7pkh.js";import"./chevron-down-DI19XsBw.js";import"./katex.min-BSBacQyE.js";import"./hover-card-DiJQFgx9.js";import"./github-DQuIliTJ.js";import"./github-iFSl-B6V.js";import"./PaperPreviewLink-B25cD-_k.js";import"./index-vCOH2DKd.js";import"./file-text--vrXMvWb.js";import"./openrouter-DNgcWuY9.js";import"./chatPrompts-CDY3UGU1.js";var ja={};ja.d=(c,t)=>{for(var e in t)ja.o(t,e)&&!ja.o(c,e)&&Object.defineProperty(c,e,{enumerable:!0,get:t[e]})};ja.o=(c,t)=>Object.prototype.hasOwnProperty.call(c,t);var Q=globalThis.pdfjsLib={};ja.d(Q,{AbortException:()=>er,AnnotationEditorLayer:()=>Jc,AnnotationEditorParamsType:()=>K,AnnotationEditorType:()=>tt,AnnotationEditorUIManager:()=>Yn,AnnotationLayer:()=>Gm,AnnotationMode:()=>di,ColorPicker:()=>Zl,DOMSVGFactory:()=>vd,DrawLayer:()=>sd,FeatureTest:()=>fe,GlobalWorkerOptions:()=>ii,ImageKind:()=>vl,InvalidPDFException:()=>iu,MissingPDFException:()=>tr,OPS:()=>Xe,OutputScale:()=>Wh,PDFDataRangeTransport:()=>Zu,PDFDateString:()=>fd,PDFWorker:()=>mr,PasswordResponses:()=>Yp,PermissionFlag:()=>Xp,PixelsPerInch:()=>Bi,RenderingCancelledException:()=>dd,TextLayer:()=>yc,UnexpectedResponseException:()=>_h,Util:()=>j,VerbosityLevel:()=>yh,XfaLayer:()=>ef,build:()=>Em,createValidAbsoluteUrl:()=>Zp,fetchData:()=>Sh,getDocument:()=>pm,getFilenameFromUrl:()=>lg,getPdfFilenameFromUrl:()=>hg,getXfaPageViewport:()=>cg,isDataScheme:()=>xh,isPdfFile:()=>ud,noContextMenu:()=>Ve,normalizeUnicode:()=>rg,setLayerDimensions:()=>Xn,shadow:()=>ot,version:()=>_m});const le=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),su=[1,0,0,1,0,0],$h=[.001,0,0,.001,0,0],Vp=1e7,Ih=1.35,Fe={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},di={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},qp="pdfjs_internal_editor_",tt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},K={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},Xp={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},ee={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},vl={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Ot={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,WIDGET:20},wa={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},yh={ERRORS:0,WARNINGS:1,INFOS:5},Xe={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},Yp={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let vh=yh.WARNINGS;function Kp(c){Number.isInteger(c)&&(vh=c)}function Qp(){return vh}function wh(c){vh>=yh.INFOS&&console.log(`Info: ${c}`)}function st(c){vh>=yh.WARNINGS&&console.log(`Warning: ${c}`)}function wt(c){throw new Error(c)}function jt(c,t){c||wt(t)}function Jp(c){switch(c==null?void 0:c.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Zp(c,t=null,e=null){if(!c)return null;try{if(e&&typeof c=="string"){if(e.addDefaultProtocol&&c.startsWith("www.")){const i=c.match(/\./g);(i==null?void 0:i.length)>=2&&(c=`http://${c}`)}if(e.tryConvertEncoding)try{c=ng(c)}catch{}}const s=t?new URL(c,t):new URL(c);if(Jp(s))return s}catch{}return null}function ot(c,t,e,s=!1){return Object.defineProperty(c,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const Gi=function(){function t(e,s){this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t}();class zh extends Gi{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Gh extends Gi{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class iu extends Gi{constructor(t){super(t,"InvalidPDFException")}}class tr extends Gi{constructor(t){super(t,"MissingPDFException")}}class _h extends Gi{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class tg extends Gi{constructor(t){super(t,"FormatError")}}class er extends Gi{constructor(t){super(t,"AbortException")}}function nu(c){(typeof c!="object"||(c==null?void 0:c.length)===void 0)&&wt("Invalid argument for bytesToString");const t=c.length,e=8192;if(t>24&255,c>>16&255,c>>8&255,c&255)}function hd(c){const t=Object.create(null);for(const[e,s]of c)t[e]=s;return t}function sg(){const c=new Uint8Array(4);return c[0]=1,new Uint32Array(c.buffer,0,1)[0]===1}function ig(){try{return new Function(""),!0}catch{return!1}}class fe{static get isLittleEndian(){return ot(this,"isLittleEndian",sg())}static get isEvalSupported(){return ot(this,"isEvalSupported",ig())}static get isOffscreenCanvasSupported(){return ot(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?ot(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof(navigator==null?void 0:navigator.userAgent)=="string"&&navigator.userAgent.includes("Firefox")}):ot(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var t,e;return ot(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const Fh=Array.from(Array(256).keys(),c=>c.toString(16).padStart(2,"0"));var ri,wl,Uh;class j{static makeHexColor(t,e,s){return`#${Fh[t]}${Fh[e]}${Fh[s]}`}static scaleMinMax(t,e){let s;t[0]?(t[0]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[3],e[3]*=t[3]):(s=e[0],e[0]=e[1],e[1]=s,s=e[2],e[2]=e[3],e[3]=s,t[1]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){const s=t[0]*e[0]+t[1]*e[2]+e[4],i=t[0]*e[1]+t[1]*e[3]+e[5];return[s,i]}static applyInverseTransform(t,e){const s=e[0]*e[3]-e[1]*e[2],i=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/s,n=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/s;return[i,n]}static getAxialAlignedBoundingBox(t,e){const s=this.applyTransform(t,e),i=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),a=this.applyTransform([t[2],t[1]],e);return[Math.min(s[0],i[0],n[0],a[0]),Math.min(s[1],i[1],n[1],a[1]),Math.max(s[0],i[0],n[0],a[0]),Math.max(s[1],i[1],n[1],a[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],s=t[0]*e[0]+t[1]*e[2],i=t[0]*e[1]+t[1]*e[3],n=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],o=(s+a)/2,l=Math.sqrt((s+a)**2-4*(s*a-n*i))/2,h=o+l||1,d=o-l||1;return[Math.sqrt(h),Math.sqrt(d)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;const n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>a?null:[s,n,i,a]}static bezierBoundingBox(t,e,s,i,n,a,o,l,h){return h?(h[0]=Math.min(h[0],t,o),h[1]=Math.min(h[1],e,l),h[2]=Math.max(h[2],t,o),h[3]=Math.max(h[3],e,l)):h=[Math.min(t,o),Math.min(e,l),Math.max(t,o),Math.max(e,l)],m(this,ri,Uh).call(this,t,s,n,o,e,i,a,l,3*(-t+3*(s-n)+o),6*(t-2*s+n),3*(s-t),h),m(this,ri,Uh).call(this,t,s,n,o,e,i,a,l,3*(-e+3*(i-a)+l),6*(e-2*i+a),3*(i-e),h),h}}ri=new WeakSet,wl=function(t,e,s,i,n,a,o,l,h,d){if(h<=0||h>=1)return;const u=1-h,f=h*h,g=f*h,A=u*(u*(u*t+3*h*e)+3*f*s)+g*i,y=u*(u*(u*n+3*h*a)+3*f*o)+g*l;d[0]=Math.min(d[0],A),d[1]=Math.min(d[1],y),d[2]=Math.max(d[2],A),d[3]=Math.max(d[3],y)},Uh=function(t,e,s,i,n,a,o,l,h,d,u,f){if(Math.abs(h)<1e-12){Math.abs(d)>=1e-12&&m(this,ri,wl).call(this,t,e,s,i,n,a,o,l,-u/d,f);return}const g=d**2-4*u*h;if(g<0)return;const A=Math.sqrt(g),y=2*h;m(this,ri,wl).call(this,t,e,s,i,n,a,o,l,(-d+A)/y,f),m(this,ri,wl).call(this,t,e,s,i,n,a,o,l,(-d-A)/y,f)},b(j,ri);function ng(c){return decodeURIComponent(escape(c))}let Dh=null,Cd=null;function rg(c){return Dh||(Dh=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,Cd=new Map([["ſt","ſt"]])),c.replaceAll(Dh,(t,e,s)=>e?e.normalize("NFKC"):Cd.get(s))}function ag(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const c=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(c);else for(let t=0;t<32;t++)c[t]=Math.floor(Math.random()*255);return nu(c)}const cd="pdfjs_internal_id_",Rs={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};function og(c){return Uint8Array.prototype.toBase64?c.toBase64():btoa(nu(c))}const ks="http://www.w3.org/2000/svg",Yi=class Yi{};Y(Yi,"CSS",96),Y(Yi,"PDF",72),Y(Yi,"PDF_TO_CSS_UNITS",Yi.CSS/Yi.PDF);let Bi=Yi;async function Sh(c,t="text"){if(Sa(c,document.baseURI)){const e=await fetch(c);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,s)=>{const i=new XMLHttpRequest;i.open("GET",c,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(i.response);return}e(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}class al{constructor({viewBox:t,scale:e,rotation:s,offsetX:i=0,offsetY:n=0,dontFlip:a=!1}){this.viewBox=t,this.scale=e,this.rotation=s,this.offsetX=i,this.offsetY=n;const o=(t[2]+t[0])/2,l=(t[3]+t[1])/2;let h,d,u,f;switch(s%=360,s<0&&(s+=360),s){case 180:h=-1,d=0,u=0,f=1;break;case 90:h=0,d=1,u=1,f=0;break;case 270:h=0,d=-1,u=-1,f=0;break;case 0:h=1,d=0,u=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(u=-u,f=-f);let g,A,y,w;h===0?(g=Math.abs(l-t[1])*e+i,A=Math.abs(o-t[0])*e+n,y=(t[3]-t[1])*e,w=(t[2]-t[0])*e):(g=Math.abs(o-t[0])*e+i,A=Math.abs(l-t[1])*e+n,y=(t[2]-t[0])*e,w=(t[3]-t[1])*e),this.transform=[h*e,d*e,u*e,f*e,g-h*e*o-u*e*l,A-d*e*o-f*e*l],this.width=y,this.height=w}get rawDims(){const{viewBox:t}=this;return ot(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new al({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(t,e){return j.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=j.applyTransform([t[0],t[1]],this.transform),s=j.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){return j.applyInverseTransform([t,e],this.transform)}}class dd extends Gi{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function xh(c){const t=c.length;let e=0;for(;e=1&&i<=12?i-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const h=e[7]||"Z";let d=parseInt(e[8],10);d=d>=0&&d<=23?d:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,h==="-"?(a+=d,o+=u):h==="+"&&(a-=d,o-=u),new Date(Date.UTC(s,i,n,a,o,l))}}Ua=new WeakMap,b(fd,Ua);function cg(c,{scale:t=1,rotation:e=0}){const{width:s,height:i}=c.attributes.style,n=[0,0,parseInt(s),parseInt(i)];return new al({viewBox:n,scale:t,rotation:e})}function pd(c){if(c.startsWith("#")){const t=parseInt(c.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return c.startsWith("rgb(")?c.slice(4,-1).split(",").map(t=>parseInt(t)):c.startsWith("rgba(")?c.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(st(`Not a valid color format: "${c}"`),[0,0,0])}function dg(c){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const e of c.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;c.set(e,pd(s))}t.remove()}function Tt(c){const{a:t,b:e,c:s,d:i,e:n,f:a}=c.getTransform();return[t,e,s,i,n,a]}function Ps(c){const{a:t,b:e,c:s,d:i,e:n,f:a}=c.getTransform().invertSelf();return[t,e,s,i,n,a]}function Xn(c,t,e=!1,s=!0){if(t instanceof al){const{pageWidth:i,pageHeight:n}=t.rawDims,{style:a}=c,o=fe.isCSSRoundSupported,l=`var(--scale-factor) * ${i}px`,h=`var(--scale-factor) * ${n}px`,d=o?`round(down, ${l}, var(--scale-round-x, 1px))`:`calc(${l})`,u=o?`round(down, ${h}, var(--scale-round-y, 1px))`:`calc(${h})`;!e||t.rotation%180===0?(a.width=d,a.height=u):(a.width=u,a.height=d)}s&&c.setAttribute("data-main-rotation",t.rotation)}class Wh{constructor(){const t=window.devicePixelRatio||1;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}}var ui,Qi,Ye,Ji,Wa,Va,eh,ru,pe,au,ou,_l,lu,qh;const Ls=class Ls{constructor(t){b(this,pe);b(this,ui,null);b(this,Qi,null);b(this,Ye);b(this,Ji,null);b(this,Wa,null);p(this,Ye,t),r(Ls,Va)||p(Ls,Va,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const t=p(this,ui,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=r(this,Ye)._uiManager._signal;t.addEventListener("contextmenu",Ve,{signal:e}),t.addEventListener("pointerdown",m(Ls,eh,ru),{signal:e});const s=p(this,Ji,document.createElement("div"));s.className="buttons",t.append(s);const i=r(this,Ye).toolbarPosition;if(i){const{style:n}=t,a=r(this,Ye)._uiManager.direction==="ltr"?1-i[0]:i[0];n.insetInlineEnd=`${100*a}%`,n.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return m(this,pe,lu).call(this),t}get div(){return r(this,ui)}hide(){var t;r(this,ui).classList.add("hidden"),(t=r(this,Qi))==null||t.hideDropdown()}show(){var t;r(this,ui).classList.remove("hidden"),(t=r(this,Wa))==null||t.shown()}async addAltText(t){const e=await t.render();m(this,pe,_l).call(this,e),r(this,Ji).prepend(e,r(this,pe,qh)),p(this,Wa,t)}addColorPicker(t){p(this,Qi,t);const e=t.renderButton();m(this,pe,_l).call(this,e),r(this,Ji).prepend(e,r(this,pe,qh))}remove(){var t;r(this,ui).remove(),(t=r(this,Qi))==null||t.destroy(),p(this,Qi,null)}};ui=new WeakMap,Qi=new WeakMap,Ye=new WeakMap,Ji=new WeakMap,Wa=new WeakMap,Va=new WeakMap,eh=new WeakSet,ru=function(t){t.stopPropagation()},pe=new WeakSet,au=function(t){r(this,Ye)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()},ou=function(t){r(this,Ye)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()},_l=function(t){const e=r(this,Ye)._uiManager._signal;t.addEventListener("focusin",m(this,pe,au).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",m(this,pe,ou).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Ve,{signal:e})},lu=function(){const{editorType:t,_uiManager:e}=r(this,Ye),s=document.createElement("button");s.className="delete",s.tabIndex=0,s.setAttribute("data-l10n-id",r(Ls,Va)[t]),m(this,pe,_l).call(this,s),s.addEventListener("click",i=>{e.delete()},{signal:e._signal}),r(this,Ji).append(s)},qh=function(){const t=document.createElement("div");return t.className="divider",t},b(Ls,eh),b(Ls,Va,null);let Vh=Ls;var qa,Zi,tn,$i,hu,cu,du;class ug{constructor(t){b(this,$i);b(this,qa,null);b(this,Zi,null);b(this,tn);p(this,tn,t)}show(t,e,s){const[i,n]=m(this,$i,cu).call(this,e,s),{style:a}=r(this,Zi)||p(this,Zi,m(this,$i,hu).call(this));t.append(r(this,Zi)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){r(this,Zi).remove()}}qa=new WeakMap,Zi=new WeakMap,tn=new WeakMap,$i=new WeakSet,hu=function(){const t=p(this,Zi,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Ve,{signal:r(this,tn)._signal});const e=p(this,qa,document.createElement("div"));return e.className="buttons",t.append(e),m(this,$i,du).call(this),t},cu=function(t,e){let s=0,i=0;for(const n of t){const a=n.y+n.height;if(as){i=o,s=a;continue}e?o>i&&(i=o):o{r(this,tn).highlightSelection("floating_button")},{signal:s}),r(this,qa).append(t)};function Kl(c,t,e){for(const s of e)t.addEventListener(s,c[s].bind(c))}function fg(c){return Math.round(Math.min(255,Math.max(1,255*c))).toString(16).padStart(2,"0")}var sh;class pg{constructor(){b(this,sh,0)}get id(){return`${qp}${he(this,sh)._++}`}}sh=new WeakMap;var yr,Xa,ie,vr,El;const _d=class _d{constructor(){b(this,vr);b(this,yr,ag());b(this,Xa,0);b(this,ie,null)}static get _isSVGFittingCanvas(){const t='data:image/svg+xml;charset=UTF-8,',s=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=t;const n=i.decode().then(()=>(s.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(s.getImageData(0,0,1,1).data.buffer)[0]===0));return ot(this,"_isSVGFittingCanvas",n)}async getFromFile(t){const{lastModified:e,name:s,size:i,type:n}=t;return m(this,vr,El).call(this,`${e}_${s}_${i}_${n}`,t)}async getFromUrl(t){return m(this,vr,El).call(this,t,t)}async getFromBlob(t,e){const s=await e;return m(this,vr,El).call(this,t,s)}async getFromId(t){r(this,ie)||p(this,ie,new Map);const e=r(this,ie).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:s}=e;return delete e.blobPromise,this.getFromBlob(e.id,s)}return this.getFromUrl(e.url)}getFromCanvas(t,e){r(this,ie)||p(this,ie,new Map);let s=r(this,ie).get(t);if(s!=null&&s.bitmap)return s.refCounter+=1,s;const i=new OffscreenCanvas(e.width,e.height);return i.getContext("2d").drawImage(e,0,0),s={bitmap:i.transferToImageBitmap(),id:`image_${r(this,yr)}_${he(this,Xa)._++}`,refCounter:1,isSvg:!1},r(this,ie).set(t,s),r(this,ie).set(s.id,s),s}getSvgUrl(t){const e=r(this,ie).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){var i;r(this,ie)||p(this,ie,new Map);const e=r(this,ie).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;const{bitmap:s}=e;if(!e.url&&!e.file){const n=new OffscreenCanvas(s.width,s.height);n.getContext("bitmaprenderer").transferFromImageBitmap(s),e.blobPromise=n.convertToBlob()}(i=s.close)==null||i.call(s),e.bitmap=null}isValidId(t){return t.startsWith(`image_${r(this,yr)}_`)}};yr=new WeakMap,Xa=new WeakMap,ie=new WeakMap,vr=new WeakSet,El=async function(t,e){r(this,ie)||p(this,ie,new Map);let s=r(this,ie).get(t);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${r(this,yr)}_${he(this,Xa)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(s.url=e,i=await Sh(e,"blob")):e instanceof File?i=s.file=e:e instanceof Blob&&(i=e),i.type==="image/svg+xml"){const n=_d._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((h,d)=>{o.onload=()=>{s.bitmap=o,s.isSvg=!0,h()},a.onload=async()=>{const u=s.svgUrl=a.result;o.src=await n?`${u}#svgView(preserveAspectRatio(none))`:u},o.onerror=a.onerror=d});a.readAsDataURL(i),await l}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){console.error(i),s=null}return r(this,ie).set(t,s),s&&r(this,ie).set(s.id,s),s};let Xh=_d;var Ut,fi,Ya,Wt;class gg{constructor(t=128){b(this,Ut,[]);b(this,fi,!1);b(this,Ya);b(this,Wt,-1);p(this,Ya,t)}add({cmd:t,undo:e,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(i&&t(),r(this,fi))return;const l={cmd:t,undo:e,post:s,type:n};if(r(this,Wt)===-1){r(this,Ut).length>0&&(r(this,Ut).length=0),p(this,Wt,0),r(this,Ut).push(l);return}if(a&&r(this,Ut)[r(this,Wt)].type===n){o&&(l.undo=r(this,Ut)[r(this,Wt)].undo),r(this,Ut)[r(this,Wt)]=l;return}const h=r(this,Wt)+1;h===r(this,Ya)?r(this,Ut).splice(0,1):(p(this,Wt,h),hn===e[a]))return nh._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?j.makeHexColor(...e):t}};Y(nh,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let Yh=nh;var wr,Ce,Nt,Kt,_r,Is,Er,Ke,pi,Sr,en,cs,Qe,sn,Ka,Qa,xr,Ja,ds,gi,Cr,mi,us,rh,bi,Za,Ai,nn,to,eo,Vt,ut,Fs,rn,so,io,yi,fs,Ds,no,He,D,Sl,Kh,fu,pu,xl,gu,mu,bu,Qh,Au,Jh,Zh,yu,ce,hi,vu,wu,tc,_u,xa,ec;const pr=class pr{constructor(t,e,s,i,n,a,o,l,h,d,u){b(this,D);b(this,wr,new AbortController);b(this,Ce,null);b(this,Nt,new Map);b(this,Kt,new Map);b(this,_r,null);b(this,Is,null);b(this,Er,null);b(this,Ke,new gg);b(this,pi,null);b(this,Sr,0);b(this,en,new Set);b(this,cs,null);b(this,Qe,null);b(this,sn,new Set);b(this,Ka,!1);b(this,Qa,!1);b(this,xr,!1);b(this,Ja,null);b(this,ds,null);b(this,gi,null);b(this,Cr,null);b(this,mi,!1);b(this,us,null);b(this,rh,new pg);b(this,bi,!1);b(this,Za,!1);b(this,Ai,null);b(this,nn,null);b(this,to,null);b(this,eo,null);b(this,Vt,tt.NONE);b(this,ut,new Set);b(this,Fs,null);b(this,rn,null);b(this,so,null);b(this,io,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});b(this,yi,[0,0]);b(this,fs,null);b(this,Ds,null);b(this,no,null);b(this,He,null);const f=this._signal=r(this,wr).signal;p(this,Ds,t),p(this,no,e),p(this,_r,s),this._eventBus=i,i._on("editingaction",this.onEditingAction.bind(this),{signal:f}),i._on("pagechanging",this.onPageChanging.bind(this),{signal:f}),i._on("scalechanging",this.onScaleChanging.bind(this),{signal:f}),i._on("rotationchanging",this.onRotationChanging.bind(this),{signal:f}),i._on("setpreference",this.onSetPreference.bind(this),{signal:f}),i._on("switchannotationeditorparams",g=>this.updateParams(g.type,g.value),{signal:f}),m(this,D,gu).call(this),m(this,D,yu).call(this),m(this,D,Qh).call(this),p(this,Is,n.annotationStorage),p(this,Ja,n.filterFactory),p(this,rn,a),p(this,Cr,o||null),p(this,Ka,l),p(this,Qa,h),p(this,xr,d),p(this,eo,u||null),this.viewParameters={realScale:Bi.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const t=pr.prototype,e=a=>r(a,Ds).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),s=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return ot(this,"_keyboardManager",new ol([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],t.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:s}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,Ds).contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,Ds).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}destroy(){var t,e,s,i;(t=r(this,He))==null||t.resolve(),p(this,He,null),(e=r(this,wr))==null||e.abort(),p(this,wr,null),this._signal=null;for(const n of r(this,Kt).values())n.destroy();r(this,Kt).clear(),r(this,Nt).clear(),r(this,sn).clear(),p(this,Ce,null),r(this,ut).clear(),r(this,Ke).destroy(),(s=r(this,_r))==null||s.destroy(),(i=r(this,us))==null||i.hide(),p(this,us,null),r(this,ds)&&(clearTimeout(r(this,ds)),p(this,ds,null)),r(this,fs)&&(clearTimeout(r(this,fs)),p(this,fs,null))}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return r(this,eo)}get useNewAltTextFlow(){return r(this,Qa)}get useNewAltTextWhenAddingImage(){return r(this,xr)}get hcmFilter(){return ot(this,"hcmFilter",r(this,rn)?r(this,Ja).addHCMFilter(r(this,rn).foreground,r(this,rn).background):"none")}get direction(){return ot(this,"direction",getComputedStyle(r(this,Ds)).direction)}get highlightColors(){return ot(this,"highlightColors",r(this,Cr)?new Map(r(this,Cr).split(",").map(t=>t.split("=").map(e=>e.trim()))):null)}get highlightColorNames(){return ot(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){p(this,to,t)}editAltText(t,e=!1){var s;(s=r(this,_r))==null||s.editAltText(this,t,e)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){switch(t){case"enableNewAltTextWhenAddingImage":p(this,xr,e);break}}onPageChanging({pageNumber:t}){p(this,Sr,t-1)}focusMainContainer(){r(this,Ds).focus()}findParent(t,e){for(const s of r(this,Kt).values()){const{x:i,y:n,width:a,height:o}=s.div.getBoundingClientRect();if(t>=i&&t<=i+a&&e>=n&&e<=n+o)return s}return null}disableUserSelect(t=!1){r(this,no).classList.toggle("noUserSelect",t)}addShouldRescale(t){r(this,sn).add(t)}removeShouldRescale(t){r(this,sn).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Bi.PDF_TO_CSS_UNITS;for(const e of r(this,sn))e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t=""){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:a}=e,o=e.toString(),h=m(this,D,Sl).call(this,e).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;e.empty();const u=m(this,D,Kh).call(this,h),f=r(this,Vt)===tt.NONE,g=()=>{u==null||u.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:a,text:o}),f&&this.showAllEditors("highlight",!0,!0)};if(f){this.switchToMode(tt.HIGHLIGHT,g);return}g()}addToAnnotationStorage(t){!t.isEmpty()&&r(this,Is)&&!r(this,Is).has(t.id)&&r(this,Is).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,r(this,mi)&&(p(this,mi,!1),m(this,D,xl).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of r(this,ut))if(e.div.contains(t)){p(this,nn,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!r(this,nn))return;const[t,e]=r(this,nn);p(this,nn,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){m(this,D,Qh).call(this),m(this,D,Jh).call(this)}removeEditListeners(){m(this,D,Au).call(this),m(this,D,Zh).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const s of r(this,Qe))if(s.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const e of t.dataTransfer.items)for(const s of r(this,Qe))if(s.isHandlingMimeForPasting(e.type)){s.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var s;if(t.preventDefault(),(s=r(this,Ce))==null||s.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of r(this,ut)){const n=i.serialize(!0);n&&e.push(n)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const n of e.items)for(const a of r(this,Qe))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){st(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const n=[];for(const l of s){const h=await i.deserialize(l);if(!h)return;n.push(h)}const a=()=>{for(const l of n)m(this,D,tc).call(this,l);m(this,D,ec).call(this,n)},o=()=>{for(const l of n)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(n){st(`paste: "${n.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),r(this,Vt)!==tt.NONE&&!this.isEditorHandlingKeyboard&&pr._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,r(this,mi)&&(p(this,mi,!1),m(this,D,xl).call(this,"main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(t){t?(m(this,D,mu).call(this),m(this,D,Jh).call(this),m(this,D,ce).call(this,{isEditing:r(this,Vt)!==tt.NONE,isEmpty:m(this,D,xa).call(this),hasSomethingToUndo:r(this,Ke).hasSomethingToUndo(),hasSomethingToRedo:r(this,Ke).hasSomethingToRedo(),hasSelectedEditor:!1})):(m(this,D,bu).call(this),m(this,D,Zh).call(this),m(this,D,ce).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!r(this,Qe)){p(this,Qe,t);for(const e of r(this,Qe))m(this,D,hi).call(this,e.defaultPropertiesToUpdate)}}getId(){return r(this,rh).id}get currentLayer(){return r(this,Kt).get(r(this,Sr))}getLayer(t){return r(this,Kt).get(t)}get currentPageIndex(){return r(this,Sr)}addLayer(t){r(this,Kt).set(t.pageIndex,t),r(this,bi)?t.enable():t.disable()}removeLayer(t){r(this,Kt).delete(t.pageIndex)}async updateMode(t,e=null,s=!1){if(r(this,Vt)!==t&&!(r(this,He)&&(await r(this,He).promise,!r(this,He)))){if(p(this,He,Promise.withResolvers()),p(this,Vt,t),t===tt.NONE){this.setEditingState(!1),m(this,D,wu).call(this),r(this,He).resolve();return}this.setEditingState(!0),await m(this,D,vu).call(this),this.unselectAll();for(const i of r(this,Kt).values())i.updateMode(t);if(!e){s&&this.addNewEditorFromKeyboard(),r(this,He).resolve();return}for(const i of r(this,Nt).values())i.annotationElementId===e?(this.setSelected(i),i.enterInEditMode()):i.unselect();r(this,He).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==r(this,Vt)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var s;if(r(this,Qe)){switch(t){case K.CREATE:this.currentLayer.addNewEditor();return;case K.HIGHLIGHT_DEFAULT_COLOR:(s=r(this,to))==null||s.updateColor(e);break;case K.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(r(this,so)||p(this,so,new Map)).set(t,e),this.showAllEditors("highlight",e);break}for(const i of r(this,ut))i.updateParams(t,e);for(const i of r(this,Qe))i.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){var n;for(const a of r(this,Nt).values())a.editorType===t&&a.show(e);(((n=r(this,so))==null?void 0:n.get(K.HIGHLIGHT_SHOW_ALL))??!0)!==e&&m(this,D,hi).call(this,[[K.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(r(this,Za)!==t){p(this,Za,t);for(const e of r(this,Kt).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const s of r(this,Nt).values())s.pageIndex===t&&e.push(s);return e}getEditor(t){return r(this,Nt).get(t)}addEditor(t){r(this,Nt).set(t.id,t)}removeEditor(t){var e;t.div.contains(document.activeElement)&&(r(this,ds)&&clearTimeout(r(this,ds)),p(this,ds,setTimeout(()=>{this.focusMainContainer(),p(this,ds,null)},0))),r(this,Nt).delete(t.id),this.unselect(t),(!t.annotationElementId||!r(this,en).has(t.annotationElementId))&&((e=r(this,Is))==null||e.remove(t.id))}addDeletedAnnotationElement(t){r(this,en).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return r(this,en).has(t)}removeDeletedAnnotationElement(t){r(this,en).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){r(this,Ce)!==t&&(p(this,Ce,t),t&&m(this,D,hi).call(this,t.propertiesToUpdate))}updateUI(t){r(this,D,_u)===t&&m(this,D,hi).call(this,t.propertiesToUpdate)}toggleSelected(t){if(r(this,ut).has(t)){r(this,ut).delete(t),t.unselect(),m(this,D,ce).call(this,{hasSelectedEditor:this.hasSelection});return}r(this,ut).add(t),t.select(),m(this,D,hi).call(this,t.propertiesToUpdate),m(this,D,ce).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of r(this,ut))e!==t&&e.unselect();r(this,ut).clear(),r(this,ut).add(t),t.select(),m(this,D,hi).call(this,t.propertiesToUpdate),m(this,D,ce).call(this,{hasSelectedEditor:!0})}isSelected(t){return r(this,ut).has(t)}get firstSelectedEditor(){return r(this,ut).values().next().value}unselect(t){t.unselect(),r(this,ut).delete(t),m(this,D,ce).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return r(this,ut).size!==0}get isEnterHandled(){return r(this,ut).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){r(this,Ke).undo(),m(this,D,ce).call(this,{hasSomethingToUndo:r(this,Ke).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:m(this,D,xa).call(this)})}redo(){r(this,Ke).redo(),m(this,D,ce).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:r(this,Ke).hasSomethingToRedo(),isEmpty:m(this,D,xa).call(this)})}addCommands(t){r(this,Ke).add(t),m(this,D,ce).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:m(this,D,xa).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...r(this,ut)],e=()=>{for(const i of t)i.remove()},s=()=>{for(const i of t)m(this,D,tc).call(this,i)};this.addCommands({cmd:e,undo:s,mustExec:!0})}commitOrRemove(){var t;(t=r(this,Ce))==null||t.commitOrRemove()}hasSomethingToControl(){return r(this,Ce)||this.hasSelection}selectAll(){for(const t of r(this,ut))t.commit();m(this,D,ec).call(this,r(this,Nt).values())}unselectAll(){if(!(r(this,Ce)&&(r(this,Ce).commitOrRemove(),r(this,Vt)!==tt.NONE))&&this.hasSelection){for(const t of r(this,ut))t.unselect();r(this,ut).clear(),m(this,D,ce).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;r(this,yi)[0]+=t,r(this,yi)[1]+=e;const[i,n]=r(this,yi),a=[...r(this,ut)],o=1e3;r(this,fs)&&clearTimeout(r(this,fs)),p(this,fs,setTimeout(()=>{p(this,fs,null),r(this,yi)[0]=r(this,yi)[1]=0,this.addCommands({cmd:()=>{for(const l of a)r(this,Nt).has(l.id)&&l.translateInPage(i,n)},undo:()=>{for(const l of a)r(this,Nt).has(l.id)&&l.translateInPage(-i,-n)},mustExec:!1})},o));for(const l of a)l.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),p(this,cs,new Map);for(const t of r(this,ut))r(this,cs).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!r(this,cs))return!1;this.disableUserSelect(!1);const t=r(this,cs);p(this,cs,null);let e=!1;for(const[{x:i,y:n,pageIndex:a},o]of t)o.newX=i,o.newY=n,o.newPageIndex=a,e||(e=i!==o.savedX||n!==o.savedY||a!==o.savedPageIndex);if(!e)return!1;const s=(i,n,a,o)=>{if(r(this,Nt).has(i.id)){const l=r(this,Kt).get(o);l?i._setParentAndPosition(l,n,a):(i.pageIndex=o,i.x=n,i.y=a)}};return this.addCommands({cmd:()=>{for(const[i,{newX:n,newY:a,newPageIndex:o}]of t)s(i,n,a,o)},undo:()=>{for(const[i,{savedX:n,savedY:a,savedPageIndex:o}]of t)s(i,n,a,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(r(this,cs))for(const s of r(this,cs).keys())s.drag(t,e)}rebuild(t){if(t.parent===null){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return((t=this.getActive())==null?void 0:t.shouldGetKeyboardEvents())||r(this,ut).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return r(this,Ce)===t}getActive(){return r(this,Ce)}getMode(){return r(this,Vt)}get imageManager(){return ot(this,"imageManager",new Xh)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let h=0,d=e.rangeCount;h({x:(d-i)/a,y:1-(h+u-s)/n,width:f/a,height:u/n});break;case"180":o=(h,d,u,f)=>({x:1-(h+u-s)/n,y:1-(d+f-i)/a,width:u/n,height:f/a});break;case"270":o=(h,d,u,f)=>({x:1-(d+f-i)/a,y:(h-s)/n,width:f/a,height:u/n});break;default:o=(h,d,u,f)=>({x:(h-s)/n,y:(d-i)/a,width:u/n,height:f/a});break}const l=[];for(let h=0,d=e.rangeCount;h{f.type==="pointerup"&&f.button!==0||(h.abort(),l==null||l.toggleDrawing(!0),f.type==="pointerup"&&m(this,D,xl).call(this,"main_toolbar"))};window.addEventListener("pointerup",u,{signal:d}),window.addEventListener("blur",u,{signal:d})}},xl=function(t=""){r(this,Vt)===tt.HIGHLIGHT?this.highlightSelection(t):r(this,Ka)&&m(this,D,fu).call(this)},gu=function(){document.addEventListener("selectionchange",m(this,D,pu).bind(this),{signal:this._signal})},mu=function(){if(r(this,gi))return;p(this,gi,new AbortController);const t=this.combinedSignal(r(this,gi));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},bu=function(){var t;(t=r(this,gi))==null||t.abort(),p(this,gi,null)},Qh=function(){if(r(this,Ai))return;p(this,Ai,new AbortController);const t=this.combinedSignal(r(this,Ai));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},Au=function(){var t;(t=r(this,Ai))==null||t.abort(),p(this,Ai,null)},Jh=function(){if(r(this,pi))return;p(this,pi,new AbortController);const t=this.combinedSignal(r(this,pi));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},Zh=function(){var t;(t=r(this,pi))==null||t.abort(),p(this,pi,null)},yu=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},ce=function(t){Object.entries(t).some(([s,i])=>r(this,io)[s]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(r(this,io),t)}),r(this,Vt)===tt.HIGHLIGHT&&t.hasSelectedEditor===!1&&m(this,D,hi).call(this,[[K.HIGHLIGHT_FREE,!0]]))},hi=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},vu=async function(){if(!r(this,bi)){p(this,bi,!0);const t=[];for(const e of r(this,Kt).values())t.push(e.enable());await Promise.all(t);for(const e of r(this,Nt).values())e.enable()}},wu=function(){if(this.unselectAll(),r(this,bi)){p(this,bi,!1);for(const t of r(this,Kt).values())t.disable();for(const t of r(this,Nt).values())t.disable()}},tc=function(t){const e=r(this,Kt).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},_u=function(){let t=null;for(t of r(this,ut));return t},xa=function(){if(r(this,Nt).size===0)return!0;if(r(this,Nt).size===1)for(const t of r(this,Nt).values())return t.isEmpty();return!1},ec=function(t){for(const e of r(this,ut))e.unselect();r(this,ut).clear();for(const e of t)e.isEmpty()||(r(this,ut).add(e),e.select());m(this,D,ce).call(this,{hasSelectedEditor:this.hasSelection})},Y(pr,"TRANSLATE_SMALL",1),Y(pr,"TRANSLATE_BIG",10);let Yn=pr;var qt,ps,Je,Tr,gs,Te,Rr,ms,ve,Os,an,bs,vi,ls,Ca,Cl;const de=class de{constructor(t){b(this,ls);b(this,qt,null);b(this,ps,!1);b(this,Je,null);b(this,Tr,null);b(this,gs,null);b(this,Te,null);b(this,Rr,!1);b(this,ms,null);b(this,ve,null);b(this,Os,null);b(this,an,null);b(this,bs,!1);p(this,ve,t),p(this,bs,t._uiManager.useNewAltTextFlow),r(de,vi)||p(de,vi,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){de._l10n??(de._l10n=t)}async render(){const t=p(this,Je,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=p(this,Tr,document.createElement("span"));t.append(e),r(this,bs)?(t.classList.add("new"),t.setAttribute("data-l10n-id",r(de,vi).missing),e.setAttribute("data-l10n-id",r(de,vi)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=r(this,ve)._uiManager._signal;t.addEventListener("contextmenu",Ve,{signal:s}),t.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),r(this,ve)._uiManager.editAltText(r(this,ve)),r(this,bs)&&r(this,ve)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:r(this,ls,Ca)}})};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",n=>{n.target===t&&n.key==="Enter"&&(p(this,Rr,!0),i(n))},{signal:s}),await m(this,ls,Cl).call(this),t}finish(){r(this,Je)&&(r(this,Je).focus({focusVisible:r(this,Rr)}),p(this,Rr,!1))}isEmpty(){return r(this,bs)?r(this,qt)===null:!r(this,qt)&&!r(this,ps)}hasData(){return r(this,bs)?r(this,qt)!==null||!!r(this,Os):this.isEmpty()}get guessedText(){return r(this,Os)}async setGuessedText(t){r(this,qt)===null&&(p(this,Os,t),p(this,an,await de._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),m(this,ls,Cl).call(this))}toggleAltTextBadge(t=!1){var e;if(!r(this,bs)||r(this,qt)){(e=r(this,ms))==null||e.remove(),p(this,ms,null);return}if(!r(this,ms)){const s=p(this,ms,document.createElement("div"));s.className="noAltTextBadge",r(this,ve).div.append(s)}r(this,ms).classList.toggle("hidden",!t)}serialize(t){let e=r(this,qt);return!t&&r(this,Os)===e&&(e=r(this,an)),{altText:e,decorative:r(this,ps),guessedText:r(this,Os),textWithDisclaimer:r(this,an)}}get data(){return{altText:r(this,qt),decorative:r(this,ps)}}set data({altText:t,decorative:e,guessedText:s,textWithDisclaimer:i,cancel:n=!1}){s&&(p(this,Os,s),p(this,an,i)),!(r(this,qt)===t&&r(this,ps)===e)&&(n||(p(this,qt,t),p(this,ps,e)),m(this,ls,Cl).call(this))}toggle(t=!1){r(this,Je)&&(!t&&r(this,Te)&&(clearTimeout(r(this,Te)),p(this,Te,null)),r(this,Je).disabled=!t)}shown(){r(this,ve)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:r(this,ls,Ca)}})}destroy(){var t,e;(t=r(this,Je))==null||t.remove(),p(this,Je,null),p(this,Tr,null),p(this,gs,null),(e=r(this,ms))==null||e.remove(),p(this,ms,null)}};qt=new WeakMap,ps=new WeakMap,Je=new WeakMap,Tr=new WeakMap,gs=new WeakMap,Te=new WeakMap,Rr=new WeakMap,ms=new WeakMap,ve=new WeakMap,Os=new WeakMap,an=new WeakMap,bs=new WeakMap,vi=new WeakMap,ls=new WeakSet,Ca=function(){return r(this,qt)&&"added"||r(this,qt)===null&&this.guessedText&&"review"||"missing"},Cl=async function(){var i,n,a;const t=r(this,Je);if(!t)return;if(r(this,bs)){if(t.classList.toggle("done",!!r(this,qt)),t.setAttribute("data-l10n-id",r(de,vi)[r(this,ls,Ca)]),(i=r(this,Tr))==null||i.setAttribute("data-l10n-id",r(de,vi)[`${r(this,ls,Ca)}-label`]),!r(this,qt)){(n=r(this,gs))==null||n.remove();return}}else{if(!r(this,qt)&&!r(this,ps)){t.classList.remove("done"),(a=r(this,gs))==null||a.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=r(this,gs);if(!e){p(this,gs,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${r(this,ve).id}`;const o=100,l=r(this,ve)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(r(this,Te)),p(this,Te,null)},{once:!0}),t.addEventListener("mouseenter",()=>{p(this,Te,setTimeout(()=>{p(this,Te,null),r(this,gs).classList.add("show"),r(this,ve)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),t.addEventListener("mouseleave",()=>{var h;r(this,Te)&&(clearTimeout(r(this,Te)),p(this,Te,null)),(h=r(this,gs))==null||h.classList.remove("show")},{signal:l})}r(this,ps)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=r(this,qt)),e.parentNode||t.append(e);const s=r(this,ve).getImageForAltText();s==null||s.setAttribute("aria-describedby",e.id)},b(de,vi,null),Y(de,"_l10n",null);let Ql=de;var on,Ze,xt,Pr,ln,Qt,hn,wi,ro,cn,_i,ao,dn,Ns,As,kr,Lr,Be,oo,ah,et,sc,lo,ic,nc,Eu,Su,rc,ac,oc,xu,lc,Cu,Tu,Ru,hc,Ta;const ct=class ct{constructor(t){b(this,et);b(this,on,null);b(this,Ze,null);b(this,xt,null);b(this,Pr,!1);b(this,ln,!1);b(this,Qt,null);b(this,hn,null);b(this,wi,null);b(this,ro,"");b(this,cn,!1);b(this,_i,null);b(this,ao,!1);b(this,dn,!1);b(this,Ns,!1);b(this,As,null);b(this,kr,0);b(this,Lr,0);b(this,Be,null);Y(this,"_editToolbar",null);Y(this,"_initialOptions",Object.create(null));Y(this,"_initialData",null);Y(this,"_isVisible",!0);Y(this,"_uiManager",null);Y(this,"_focusEventsAllowed",!0);b(this,oo,!1);b(this,ah,ct._zIndex++);this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,a];const[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=ct.prototype._resizeWithKeyboard,e=Yn.TRANSLATE_SMALL,s=Yn.TRANSLATE_BIG;return ot(this,"_resizerKeyboardManager",new ol([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-s,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[s,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-s]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,s]}],[["Escape","mac+Escape"],ct.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return ot(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new mg({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(ct._l10n??(ct._l10n=t),ct._l10nResizer||(ct._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),ct._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);ct._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){wt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return r(this,oo)}set _isDraggable(t){var e;p(this,oo,t),(e=this.div)==null||e.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=r(this,ah)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):m(this,et,Ta).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(r(this,cn)?p(this,cn,!1):this.parent.setSelected(this))}focusout(t){var s;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const e=t.relatedTarget;e!=null&&e.closest(`#${this.id}`)||(t.preventDefault(),(s=this.parent)!=null&&s.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,s,i){const[n,a]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/n,this.y=(e+i)/a,this.fixAndSetPosition()}translate(t,e){m(this,et,sc).call(this,this.parentDimensions,t,e)}translateInPage(t,e){r(this,_i)||p(this,_i,[this.x,this.y]),m(this,et,sc).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){r(this,_i)||p(this,_i,[this.x,this.y]);const[s,i]=this.parentDimensions;if(this.x+=t/s,this.y+=e/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:h,y:d}=this.div.getBoundingClientRect();this.parent.findNewParent(this,h,d)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:n,y:a}=this;const[o,l]=this.getBaseTranslation();n+=o,a+=l,this.div.style.left=`${(100*n).toFixed(2)}%`,this.div.style.top=`${(100*a).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!r(this,_i)&&(r(this,_i)[0]!==this.x||r(this,_i)[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:s}=ct,i=s/t,n=s/e;switch(this.rotation){case 90:return[-i,n];case 180:return[i,n];case 270:return[i,-n];default:return[-i,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[e,s]=this.pageDimensions;let{x:i,y:n,width:a,height:o}=this;if(a*=e,o*=s,i*=e,n*=s,this._mustFixPosition)switch(t){case 0:i=Math.max(0,Math.min(e-a,i)),n=Math.max(0,Math.min(s-o,n));break;case 90:i=Math.max(0,Math.min(e-o,i)),n=Math.min(s,Math.max(a,n));break;case 180:i=Math.min(e,Math.max(a,i)),n=Math.min(s,Math.max(o,n));break;case 270:i=Math.min(e,Math.max(o,i)),n=Math.max(0,Math.min(s-a,n));break}this.x=i/=e,this.y=n/=s;const[l,h]=this.getBaseTranslation();i+=l,n+=h;const{style:d}=this.div;d.left=`${(100*i).toFixed(2)}%`,d.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var s;return m(s=ct,lo,ic).call(s,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var s;return m(s=ct,lo,ic).call(s,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,s]}=this;return[e*t,s*t]}setDims(t,e){const[s,i]=this.parentDimensions;this.div.style.width=`${(100*t/s).toFixed(2)}%`,r(this,ln)||(this.div.style.height=`${(100*e/i).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:s}=t,i=s.endsWith("%"),n=!r(this,ln)&&e.endsWith("%");if(i&&n)return;const[a,o]=this.parentDimensions;i||(t.width=`${(100*parseFloat(s)/a).toFixed(2)}%`),!r(this,ln)&&!n&&(t.height=`${(100*parseFloat(e)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var t;(t=r(this,xt))==null||t.finish()}async addEditToolbar(){return this._editToolbar||r(this,dn)?this._editToolbar:(this._editToolbar=new Vh(this),this.div.append(this._editToolbar.render()),r(this,xt)&&await this._editToolbar.addAltText(r(this,xt)),this._editToolbar)}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(t=r(this,xt))==null||t.destroy())}addContainer(t){var s;const e=(s=this._editToolbar)==null?void 0:s.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){r(this,xt)||(Ql.initialize(ct._l10n),p(this,xt,new Ql(this)),r(this,on)&&(r(this,xt).data=r(this,on),p(this,on,null)),await this.addEditToolbar())}get altTextData(){var t;return(t=r(this,xt))==null?void 0:t.data}set altTextData(t){r(this,xt)&&(r(this,xt).data=t)}get guessedAltText(){var t;return(t=r(this,xt))==null?void 0:t.guessedText}async setGuessedAltText(t){var e;await((e=r(this,xt))==null?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return(e=r(this,xt))==null?void 0:e.serialize(t)}hasAltText(){return!!r(this,xt)&&!r(this,xt).isEmpty()}hasAltTextData(){var t;return((t=r(this,xt))==null?void 0:t.hasData())??!1}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=r(this,Pr)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),m(this,et,lc).call(this);const[t,e]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);const[s,i]=this.getInitialTranslation();return this.translate(s,i),Kl(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=fe.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(p(this,cn,!0),this._isDraggable){m(this,et,xu).call(this,t);return}m(this,et,oc).call(this,t)}get isSelected(){return this._uiManager.isSelected(this)}moveInDOM(){r(this,As)&&clearTimeout(r(this,As)),p(this,As,setTimeout(()=>{var t;p(this,As,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition()}getRect(t,e,s=this.rotation){const i=this.parentScale,[n,a]=this.pageDimensions,[o,l]=this.pageTranslation,h=t/i,d=e/i,u=this.x*n,f=this.y*a,g=this.width*n,A=this.height*a;switch(s){case 0:return[u+h+o,a-f-d-A+l,u+h+g+o,a-f-d+l];case 90:return[u+d+o,a-f+h+l,u+d+A+o,a-f+h+g+l];case 180:return[u-h-g+o,a-f+d+l,u-h+o,a-f+d+A+l];case 270:return[u-d-A+o,a-f-h-g+l,u-d+o,a-f-h+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,i,n,a]=t,o=n-s,l=a-i;switch(this.rotation){case 0:return[s,e-a,o,l];case 90:return[s,e-i,l,o];case 180:return[n,e-i,o,l];case 270:return[n,e-a,l,o];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){p(this,dn,!0)}disableEditMode(){p(this,dn,!1)}isInEditMode(){return r(this,dn)}shouldGetKeyboardEvents(){return r(this,Ns)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){m(this,et,lc).call(this)}rotate(t){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((t=this._initialData)==null?void 0:t.popupRef)||""}}serialize(t=!1,e=null){wt("An editor must be serializable")}static async deserialize(t,e,s){const i=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:s});i.rotation=t.rotation,p(i,on,t.accessibilityData);const[n,a]=i.pageDimensions,[o,l,h,d]=i.getRectInCurrentCoords(t.rect,a);return i.x=o/n,i.y=l/a,i.width=h/n,i.height=d/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var t;if((t=r(this,wi))==null||t.abort(),p(this,wi,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),r(this,As)&&(clearTimeout(r(this,As)),p(this,As,null)),m(this,et,Ta).call(this),this.removeEditToolbar(),r(this,Be)){for(const e of r(this,Be).values())clearTimeout(e);p(this,Be,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(m(this,et,Eu).call(this),r(this,Qt).classList.remove("hidden"),Kl(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),p(this,hn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=r(this,Qt).children;if(!r(this,Ze)){p(this,Ze,Array.from(e));const a=m(this,et,Cu).bind(this),o=m(this,et,Tu).bind(this),l=this._uiManager._signal;for(const h of r(this,Ze)){const d=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",a,{signal:l}),h.addEventListener("blur",o,{signal:l}),h.addEventListener("focus",m(this,et,Ru).bind(this,d),{signal:l}),h.setAttribute("data-l10n-id",ct._l10nResizer[d])}}const s=r(this,Ze)[0];let i=0;for(const a of e){if(a===s)break;i++}const n=(360-this.rotation+this.parentRotation)%360/90*(r(this,Ze).length/4);if(n!==i){if(ni)for(let o=0;o{var i,n;(i=this.div)!=null&&i.classList.contains("selectedEditor")&&((n=this._editToolbar)==null||n.show())});return}(e=this._editToolbar)==null||e.show(),(s=r(this,xt))==null||s.toggleAltTextBadge(!1)}unselect(){var t,e,s,i,n;(t=r(this,Qt))==null||t.classList.add("hidden"),(e=this.div)==null||e.classList.remove("selectedEditor"),(s=this.div)!=null&&s.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(i=this._editToolbar)==null||i.hide(),(n=r(this,xt))==null||n.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return r(this,ao)}set isEditing(t){p(this,ao,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){p(this,ln,!0);const s=t/e,{style:i}=this.div;i.aspectRatio=s,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){r(this,Be)||p(this,Be,new Map);const{action:s}=t;let i=r(this,Be).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),r(this,Be).delete(s),r(this,Be).size===0&&p(this,Be,null)},ct._telemetryTimeout),r(this,Be).set(s,i);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),p(this,Pr,!1)}disable(){this.div&&(this.div.tabIndex=-1),p(this,Pr,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){const s=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),s.before(e)}return e}resetAnnotationElement(t){const{firstChild:e}=t.container;(e==null?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};on=new WeakMap,Ze=new WeakMap,xt=new WeakMap,Pr=new WeakMap,ln=new WeakMap,Qt=new WeakMap,hn=new WeakMap,wi=new WeakMap,ro=new WeakMap,cn=new WeakMap,_i=new WeakMap,ao=new WeakMap,dn=new WeakMap,Ns=new WeakMap,As=new WeakMap,kr=new WeakMap,Lr=new WeakMap,Be=new WeakMap,oo=new WeakMap,ah=new WeakMap,et=new WeakSet,sc=function([t,e],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/t,this.y+=i/e,this.fixAndSetPosition()},lo=new WeakSet,ic=function(t,e,s){switch(s){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},nc=function(t){switch(t){case 90:{const[e,s]=this.pageDimensions;return[0,-e/s,s/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,s]=this.pageDimensions;return[0,e/s,-s/e,0]}default:return[1,0,0,1]}},Eu=function(){if(r(this,Qt))return;p(this,Qt,document.createElement("div")),r(this,Qt).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const s of t){const i=document.createElement("div");r(this,Qt).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",m(this,et,Su).bind(this,s),{signal:e}),i.addEventListener("contextmenu",Ve,{signal:e}),i.tabIndex=-1}this.div.prepend(r(this,Qt))},Su=function(t,e){var A;e.preventDefault();const{isMac:s}=fe.platform;if(e.button!==0||e.ctrlKey&&s)return;(A=r(this,xt))==null||A.toggle(!1);const i=this._isDraggable;this._isDraggable=!1;const n=new AbortController,a=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",m(this,et,ac).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("contextmenu",Ve,{signal:a});const o=this.x,l=this.y,h=this.width,d=this.height,u=this.parent.div.style.cursor,f=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const g=()=>{var y;n.abort(),this.parent.togglePointerEvents(!0),(y=r(this,xt))==null||y.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=u,this.div.style.cursor=f,m(this,et,rc).call(this,o,l,h,d)};window.addEventListener("pointerup",g,{signal:a}),window.addEventListener("blur",g,{signal:a})},rc=function(t,e,s,i){const n=this.x,a=this.y,o=this.width,l=this.height;n===t&&a===e&&o===s&&l===i||this.addCommands({cmd:()=>{this.width=o,this.height=l,this.x=n,this.y=a;const[h,d]=this.parentDimensions;this.setDims(h*o,d*l),this.fixAndSetPosition()},undo:()=>{this.width=s,this.height=i,this.x=t,this.y=e;const[h,d]=this.parentDimensions;this.setDims(h*s,d*i),this.fixAndSetPosition()},mustExec:!0})},ac=function(t,e){const[s,i]=this.parentDimensions,n=this.x,a=this.y,o=this.width,l=this.height,h=ct.MIN_SIZE/s,d=ct.MIN_SIZE/i,u=H=>Math.round(H*1e4)/1e4,f=m(this,et,nc).call(this,this.rotation),g=(H,$)=>[f[0]*H+f[2]*$,f[1]*H+f[3]*$],A=m(this,et,nc).call(this,360-this.rotation),y=(H,$)=>[A[0]*H+A[2]*$,A[1]*H+A[3]*$];let w,v,_=!1,S=!1;switch(t){case"topLeft":_=!0,w=(H,$)=>[0,0],v=(H,$)=>[H,$];break;case"topMiddle":w=(H,$)=>[H/2,0],v=(H,$)=>[H/2,$];break;case"topRight":_=!0,w=(H,$)=>[H,0],v=(H,$)=>[0,$];break;case"middleRight":S=!0,w=(H,$)=>[H,$/2],v=(H,$)=>[0,$/2];break;case"bottomRight":_=!0,w=(H,$)=>[H,$],v=(H,$)=>[0,0];break;case"bottomMiddle":w=(H,$)=>[H/2,$],v=(H,$)=>[H/2,0];break;case"bottomLeft":_=!0,w=(H,$)=>[0,$],v=(H,$)=>[H,0];break;case"middleLeft":S=!0,w=(H,$)=>[0,$/2],v=(H,$)=>[H,$/2];break}const E=w(o,l),C=v(o,l);let x=g(...C);const T=u(n+x[0]),P=u(a+x[1]);let L=1,O=1,[F,J]=this.screenToPageTranslation(e.movementX,e.movementY);if([F,J]=y(F/s,J/i),_){const H=Math.hypot(o,l);L=O=Math.max(Math.min(Math.hypot(C[0]-E[0]-F,C[1]-E[1]-J)/H,1/o,1/l),h/o,d/l)}else S?L=Math.max(h,Math.min(1,Math.abs(C[0]-E[0]-F)))/o:O=Math.max(d,Math.min(1,Math.abs(C[1]-E[1]-J)))/l;const U=u(o*L),z=u(l*O);x=g(...v(U,z));const X=T-x[0],q=P-x[1];this.width=U,this.height=z,this.x=X,this.y=q,this.setDims(s*U,i*z),this.fixAndSetPosition()},oc=function(t){const{isMac:e}=fe.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},xu=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();const s=new AbortController,i=this._uiManager.combinedSignal(s);if(e){this.div.classList.add("moving"),p(this,kr,t.clientX),p(this,Lr,t.clientY);const a=o=>{const{clientX:l,clientY:h}=o,[d,u]=this.screenToPageTranslation(l-r(this,kr),h-r(this,Lr));p(this,kr,l),p(this,Lr,h),this._uiManager.dragSelectedEditors(d,u)};window.addEventListener("pointermove",a,{passive:!0,capture:!0,signal:i})}const n=()=>{s.abort(),e&&this.div.classList.remove("moving"),p(this,cn,!1),this._uiManager.endDragSession()||m(this,et,oc).call(this,t)};window.addEventListener("pointerup",n,{signal:i}),window.addEventListener("blur",n,{signal:i})},lc=function(){if(r(this,wi)||!this.div)return;p(this,wi,new AbortController);const t=this._uiManager.combinedSignal(r(this,wi));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},Cu=function(t){ct._resizerKeyboardManager.exec(this,t)},Tu=function(t){var e;r(this,Ns)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==r(this,Qt)&&m(this,et,Ta).call(this)},Ru=function(t){p(this,ro,r(this,Ns)?t:"")},hc=function(t){if(r(this,Ze))for(const e of r(this,Ze))e.tabIndex=t},Ta=function(){if(p(this,Ns,!1),m(this,et,hc).call(this,-1),r(this,hn)){const{savedX:t,savedY:e,savedWidth:s,savedHeight:i}=r(this,hn);m(this,et,rc).call(this,t,e,s,i),p(this,hn,null)}},b(ct,lo),Y(ct,"_l10n",null),Y(ct,"_l10nResizer",null),Y(ct,"_borderLineWidth",-1),Y(ct,"_colorManager",new Yh),Y(ct,"_zIndex",1),Y(ct,"_telemetryTimeout",1e3);let pt=ct;class mg extends pt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Pd=3285377520,Ne=4294901760,hs=65535;class Pu{constructor(t){this.h1=t?t&4294967295:Pd,this.h2=t?t&4294967295:Pd}update(t){let e,s;if(typeof t=="string"){e=new Uint8Array(t.length*2),s=0;for(let y=0,w=t.length;y>>8,e[s++]=v&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),s=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const i=s>>2,n=s-i*4,a=new Uint32Array(e.buffer,0,i);let o=0,l=0,h=this.h1,d=this.h2;const u=3432918353,f=461845907,g=u&hs,A=f&hs;for(let y=0;y>>17,o=o*f&Ne|o*A&hs,h^=o,h=h<<13|h>>>19,h=h*5+3864292196):(l=a[y],l=l*u&Ne|l*g&hs,l=l<<15|l>>>17,l=l*f&Ne|l*A&hs,d^=l,d=d<<13|d>>>19,d=d*5+3864292196);switch(o=0,n){case 3:o^=e[i*4+2]<<16;case 2:o^=e[i*4+1]<<8;case 1:o^=e[i*4],o=o*u&Ne|o*g&hs,o=o<<15|o>>>17,o=o*f&Ne|o*A&hs,i&1?h^=o:d^=o}this.h1=h,this.h2=d}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&Ne|t*36045&hs,e=e*4283543511&Ne|((e<<16|t>>>16)*2950163797&Ne)>>>16,t^=e>>>1,t=t*444984403&Ne|t*60499&hs,e=e*3301882366&Ne|((e<<16|t>>>16)*3120437893&Ne)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const cc=Object.freeze({map:null,hash:"",transfer:void 0});var un,fn,Xt,oh,ku;class gd{constructor(){b(this,oh);b(this,un,!1);b(this,fn,null);b(this,Xt,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const s=r(this,Xt).get(t);return s===void 0?e:Object.assign(e,s)}getRawValue(t){return r(this,Xt).get(t)}remove(t){if(r(this,Xt).delete(t),r(this,Xt).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const e of r(this,Xt).values())if(e instanceof pt)return;this.onAnnotationEditor(null)}}setValue(t,e){const s=r(this,Xt).get(t);let i=!1;if(s!==void 0)for(const[n,a]of Object.entries(e))s[n]!==a&&(i=!0,s[n]=a);else i=!0,r(this,Xt).set(t,e);i&&m(this,oh,ku).call(this),e instanceof pt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(t){return r(this,Xt).has(t)}getAll(){return r(this,Xt).size>0?hd(r(this,Xt)):null}setAll(t){for(const[e,s]of Object.entries(t))this.setValue(e,s)}get size(){return r(this,Xt).size}resetModified(){r(this,un)&&(p(this,un,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Lu(this)}get serializable(){if(r(this,Xt).size===0)return cc;const t=new Map,e=new Pu,s=[],i=Object.create(null);let n=!1;for(const[a,o]of r(this,Xt)){const l=o instanceof pt?o.serialize(!1,i):o;l&&(t.set(a,l),e.update(`${a}:${JSON.stringify(l)}`),n||(n=!!l.bitmap))}if(n)for(const a of t.values())a.bitmap&&s.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:cc}get editorStats(){let t=null;const e=new Map;for(const s of r(this,Xt).values()){if(!(s instanceof pt))continue;const i=s.telemetryFinalData;if(!i)continue;const{type:n}=i;e.has(n)||e.set(n,Object.getPrototypeOf(s).constructor),t||(t=Object.create(null));const a=t[n]||(t[n]=new Map);for(const[o,l]of Object.entries(i)){if(o==="type")continue;let h=a.get(o);h||(h=new Map,a.set(o,h));const d=h.get(l)??0;h.set(l,d+1)}}for(const[s,i]of e)t[s]=i.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){p(this,fn,null)}get modifiedIds(){if(r(this,fn))return r(this,fn);const t=[];for(const e of r(this,Xt).values())!(e instanceof pt)||!e.annotationElementId||!e.serialize()||t.push(e.annotationElementId);return p(this,fn,{ids:new Set(t),hash:t.join(",")})}}un=new WeakMap,fn=new WeakMap,Xt=new WeakMap,oh=new WeakSet,ku=function(){r(this,un)||(p(this,un,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var ho;class Lu extends gd{constructor(e){super();b(this,ho);const{map:s,hash:i,transfer:n}=e.serializable,a=structuredClone(s,n?{transfer:n}:null);p(this,ho,{map:a,hash:i,transfer:n})}get print(){wt("Should not call PrintAnnotationStorage.print")}get serializable(){return r(this,ho)}get modifiedIds(){return ot(this,"modifiedIds",{ids:new Set,hash:""})}}ho=new WeakMap;var Mr;class bg{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){b(this,Mr,new Set);this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),r(this,Mr).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}){if(!(!t||r(this,Mr).has(t.loadedName))){if(jt(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:i,style:n}=t,a=new FontFace(s,i,n);this.addNativeFontFace(a);try{await a.load(),r(this,Mr).add(s),e==null||e(t)}catch{st(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}wt("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){const s=t.createNativeFontFace();if(s){this.addNativeFontFace(s);try{await s.loaded}catch(i){throw st(`Failed to load font '${s.family}': '${i}'.`),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(s=>{const i=this._queueLoadingCallback(s);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var e;const t=!!((e=this._document)!=null&&e.fonts);return ot(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(le||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),ot(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function e(){for(jt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;s.length>0&&s[0].done;){const n=s.shift();setTimeout(n.callback,0)}}const{loadingRequests:s}=this,i={done:!1,complete:e,callback:t};return s.push(i),i}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return ot(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function s(E,C){return E.charCodeAt(C)<<24|E.charCodeAt(C+1)<<16|E.charCodeAt(C+2)<<8|E.charCodeAt(C+3)&255}function i(E,C,x,T){const P=E.substring(0,C),L=E.substring(C+x);return P+T+L}let n,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let h=0;function d(E,C){if(++h>30){st("Load test font never loaded."),C();return}if(l.font="30px "+E,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){C();return}setTimeout(d.bind(null,E,C))}const u=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=i(f,976,u.length,u);const A=16,y=1482184792;let w=s(f,A);for(n=0,a=u.length-3;n{S.remove(),e.complete()})}}Mr=new WeakMap;class Ag{constructor(t,{disableFontFace:e=!1,inspectFont:s=null}){this.compiledGlyphs=Object.create(null);for(const i in t)this[i]=t[i];this.disableFontFace=e===!0,this._inspectFont=s}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const s={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(s.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,s)}return(e=this._inspectFont)==null||e.call(this,this),t}createFontFaceRule(){var s;if(!this.data||this.disableFontFace)return null;const t=`url(data:${this.mimetype};base64,${og(this.data)});`;let e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${t}}`}return(s=this._inspectFont)==null||s.call(this,this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let s;try{s=t.get(this.loadedName+"_path_"+e)}catch(n){st(`getPathGenerator - ignoring character: "${n}".`)}if(!Array.isArray(s)||s.length===0)return this.compiledGlyphs[e]=function(n,a){};const i=[];for(let n=0,a=s.length;ng.bezierCurveTo(o,l,h,d,u,f)),n+=6}break;case Rs.MOVE_TO:{const[o,l]=s.slice(n,n+2);i.push(h=>h.moveTo(o,l)),n+=2}break;case Rs.LINE_TO:{const[o,l]=s.slice(n,n+2);i.push(h=>h.lineTo(o,l)),n+=2}break;case Rs.QUADRATIC_CURVE_TO:{const[o,l,h,d]=s.slice(n,n+4);i.push(u=>u.quadraticCurveTo(o,l,h,d)),n+=4}break;case Rs.RESTORE:i.push(o=>o.restore());break;case Rs.SAVE:i.push(o=>o.save());break;case Rs.SCALE:jt(i.length===2,"Scale command is only valid at the third position.");break;case Rs.TRANSFORM:{const[o,l,h,d,u,f]=s.slice(n,n+6);i.push(g=>g.transform(o,l,h,d,u,f)),n+=6}break;case Rs.TRANSLATE:{const[o,l]=s.slice(n,n+2);i.push(h=>h.translate(o,l)),n+=2}break}return this.compiledGlyphs[e]=function(a,o){i[0](a),i[1](a),a.scale(o,-o);for(let l=2,h=i.length;l({cMapData:s,isCompressed:this.isCompressed})).catch(s=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}async _fetch(t){wt("Abstract method `_fetch` called.")}}class Fu extends Iu{async _fetch(t){const e=await Sh(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Eh(e)}}class Du{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,s,i,n){return"none"}destroy(t=!1){}}var pn,gn,ys,Hs,ne,lh,mn,N,se,ar,or,Tl,lr,Ou,dc,hr,Ra,Pa,uc,ka;class vg extends Du{constructor({docId:e,ownerDocument:s=globalThis.document}){super();b(this,N);b(this,pn);b(this,gn);b(this,ys);b(this,Hs);b(this,ne);b(this,lh);b(this,mn,0);p(this,Hs,e),p(this,ne,s)}addFilter(e){if(!e)return"none";let s=r(this,N,se).get(e);if(s)return s;const[i,n,a]=m(this,N,Tl).call(this,e),o=e.length===1?i:`${i}${n}${a}`;if(s=r(this,N,se).get(o),s)return r(this,N,se).set(e,s),s;const l=`g_${r(this,Hs)}_transfer_map_${he(this,mn)._++}`,h=m(this,N,lr).call(this,l);r(this,N,se).set(e,h),r(this,N,se).set(o,h);const d=m(this,N,hr).call(this,l);return m(this,N,Pa).call(this,i,n,a,d),h}addHCMFilter(e,s){var A;const i=`${e}-${s}`,n="base";let a=r(this,N,ar).get(n);if((a==null?void 0:a.key)===i||(a?((A=a.filter)==null||A.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},r(this,N,ar).set(n,a)),!e||!s))return a.url;const o=m(this,N,ka).call(this,e);e=j.makeHexColor(...o);const l=m(this,N,ka).call(this,s);if(s=j.makeHexColor(...l),r(this,N,or).style.color="",e==="#000000"&&s==="#ffffff"||e===s)return a.url;const h=new Array(256);for(let y=0;y<=255;y++){const w=y/255;h[y]=w<=.03928?w/12.92:((w+.055)/1.055)**2.4}const d=h.join(","),u=`g_${r(this,Hs)}_hcm_filter`,f=a.filter=m(this,N,hr).call(this,u);m(this,N,Pa).call(this,d,d,d,f),m(this,N,dc).call(this,f);const g=(y,w)=>{const v=o[y]/255,_=l[y]/255,S=new Array(w+1);for(let E=0;E<=w;E++)S[E]=v+E/w*(_-v);return S.join(",")};return m(this,N,Pa).call(this,g(0,5),g(1,5),g(2,5),f),a.url=m(this,N,lr).call(this,u),a.url}addAlphaFilter(e){let s=r(this,N,se).get(e);if(s)return s;const[i]=m(this,N,Tl).call(this,[e]),n=`alpha_${i}`;if(s=r(this,N,se).get(n),s)return r(this,N,se).set(e,s),s;const a=`g_${r(this,Hs)}_alpha_map_${he(this,mn)._++}`,o=m(this,N,lr).call(this,a);r(this,N,se).set(e,o),r(this,N,se).set(n,o);const l=m(this,N,hr).call(this,a);return m(this,N,uc).call(this,i,l),o}addLuminosityFilter(e){let s=r(this,N,se).get(e||"luminosity");if(s)return s;let i,n;if(e?([i]=m(this,N,Tl).call(this,[e]),n=`luminosity_${i}`):n="luminosity",s=r(this,N,se).get(n),s)return r(this,N,se).set(e,s),s;const a=`g_${r(this,Hs)}_luminosity_map_${he(this,mn)._++}`,o=m(this,N,lr).call(this,a);r(this,N,se).set(e,o),r(this,N,se).set(n,o);const l=m(this,N,hr).call(this,a);return m(this,N,Ou).call(this,l),e&&m(this,N,uc).call(this,i,l),o}addHighlightHCMFilter(e,s,i,n,a){var _;const o=`${s}-${i}-${n}-${a}`;let l=r(this,N,ar).get(e);if((l==null?void 0:l.key)===o||(l?((_=l.filter)==null||_.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},r(this,N,ar).set(e,l)),!s||!i))return l.url;const[h,d]=[s,i].map(m(this,N,ka).bind(this));let u=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),f=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[g,A]=[n,a].map(m(this,N,ka).bind(this));f{const x=new Array(256),T=(f-u)/C,P=S/255,L=(E-S)/(255*C);let O=0;for(let F=0;F<=C;F++){const J=Math.round(u+F*T),U=P+F*L;for(let z=O;z<=J;z++)x[z]=U;O=J+1}for(let F=O;F<256;F++)x[F]=x[O-1];return x.join(",")},w=`g_${r(this,Hs)}_hcm_${e}_filter`,v=l.filter=m(this,N,hr).call(this,w);return m(this,N,dc).call(this,v),m(this,N,Pa).call(this,y(g[0],A[0],5),y(g[1],A[1],5),y(g[2],A[2],5),v),l.url=m(this,N,lr).call(this,w),l.url}destroy(e=!1){e&&r(this,N,ar).size!==0||(r(this,ys)&&(r(this,ys).parentNode.parentNode.remove(),p(this,ys,null)),r(this,gn)&&(r(this,gn).clear(),p(this,gn,null)),p(this,mn,0))}}pn=new WeakMap,gn=new WeakMap,ys=new WeakMap,Hs=new WeakMap,ne=new WeakMap,lh=new WeakMap,mn=new WeakMap,N=new WeakSet,se=function(){return r(this,gn)||p(this,gn,new Map)},ar=function(){return r(this,lh)||p(this,lh,new Map)},or=function(){if(!r(this,ys)){const e=r(this,ne).createElement("div"),{style:s}=e;s.visibility="hidden",s.contain="strict",s.width=s.height=0,s.position="absolute",s.top=s.left=0,s.zIndex=-1;const i=r(this,ne).createElementNS(ks,"svg");i.setAttribute("width",0),i.setAttribute("height",0),p(this,ys,r(this,ne).createElementNS(ks,"defs")),e.append(i),i.append(r(this,ys)),r(this,ne).body.append(e)}return r(this,ys)},Tl=function(e){if(e.length===1){const h=e[0],d=new Array(256);for(let f=0;f<256;f++)d[f]=h[f]/255;const u=d.join(",");return[u,u,u]}const[s,i,n]=e,a=new Array(256),o=new Array(256),l=new Array(256);for(let h=0;h<256;h++)a[h]=s[h]/255,o[h]=i[h]/255,l[h]=n[h]/255;return[a.join(","),o.join(","),l.join(",")]},lr=function(e){if(r(this,pn)===void 0){p(this,pn,"");const s=r(this,ne).URL;s!==r(this,ne).baseURI&&(xh(s)?st('#createUrl: ignore "data:"-URL for performance reasons.'):p(this,pn,s.split("#",1)[0]))}return`url(${r(this,pn)}#${e})`},Ou=function(e){const s=r(this,ne).createElementNS(ks,"feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(s)},dc=function(e){const s=r(this,ne).createElementNS(ks,"feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(s)},hr=function(e){const s=r(this,ne).createElementNS(ks,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",e),r(this,N,or).append(s),s},Ra=function(e,s,i){const n=r(this,ne).createElementNS(ks,s);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)},Pa=function(e,s,i,n){const a=r(this,ne).createElementNS(ks,"feComponentTransfer");n.append(a),m(this,N,Ra).call(this,a,"feFuncR",e),m(this,N,Ra).call(this,a,"feFuncG",s),m(this,N,Ra).call(this,a,"feFuncB",i)},uc=function(e,s){const i=r(this,ne).createElementNS(ks,"feComponentTransfer");s.append(i),m(this,N,Ra).call(this,i,"feFuncA",e)},ka=function(e){return r(this,N,or).style.color=e,pd(getComputedStyle(r(this,N,or)).getPropertyValue("color"))};class Nu{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw new Error("Font filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(s=>{throw new Error(`Unable to load font data at: ${e}`)})}async _fetch(t){wt("Abstract method `_fetch` called.")}}class Hu extends Nu{async _fetch(t){const e=await Sh(t,"arraybuffer");return new Uint8Array(e)}}if(le){var fc=Promise.withResolvers(),$a=null;(async()=>{const t=await fl(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),e=await fl(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),s=await fl(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),i=await fl(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]);let n,a;return new Map(Object.entries({fs:t,http:e,https:s,url:i,canvas:n,path2d:a}))})().then(t=>{$a=t,fc.resolve()},t=>{st(`loadPackages: ${t}`),$a=new Map,fc.resolve()})}class ji{static get promise(){return fc.promise}static get(t){return $a==null?void 0:$a.get(t)}}async function Bu(c){const e=await ji.get("fs").promises.readFile(c);return new Uint8Array(e)}class wg extends Du{}class _g extends Mu{_createCanvas(t,e){return ji.get("canvas").createCanvas(t,e)}}class Eg extends Iu{async _fetch(t){return Bu(t)}}class Sg extends Nu{async _fetch(t){return Bu(t)}}const ue={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function pc(c,t){if(!t)return;const e=t[2]-t[0],s=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],e,s),c.clip(i)}class md{getPattern(){wt("Abstract method `getPattern` called.")}}class xg extends md{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;this._type==="axial"?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const s of this._colorStops)e.addColorStop(s[0],s[1]);return e}getPattern(t,e,s,i){let n;if(i===ue.STROKE||i===ue.FILL){const a=e.current.getClippedPathBoundingBox(i,Tt(t))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,l=Math.ceil(a[3]-a[1])||1,h=e.cachedCanvases.getCanvas("pattern",o,l),d=h.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-a[0],-a[1]),s=j.transform(s,[1,0,0,1,a[0],a[1]]),d.transform(...e.baseTransform),this.matrix&&d.transform(...this.matrix),pc(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),n=t.createPattern(h.canvas,"no-repeat");const u=new DOMMatrix(s);n.setTransform(u)}else pc(t,this._bbox),n=this._createGradient(t);return n}}function Oh(c,t,e,s,i,n,a,o){const l=t.coords,h=t.colors,d=c.data,u=c.width*4;let f;l[e+1]>l[s+1]&&(f=e,e=s,s=f,f=n,n=a,a=f),l[s+1]>l[i+1]&&(f=s,s=i,i=f,f=a,a=o,o=f),l[e+1]>l[s+1]&&(f=e,e=s,s=f,f=n,n=a,a=f);const g=(l[e]+t.offsetX)*t.scaleX,A=(l[e+1]+t.offsetY)*t.scaleY,y=(l[s]+t.offsetX)*t.scaleX,w=(l[s+1]+t.offsetY)*t.scaleY,v=(l[i]+t.offsetX)*t.scaleX,_=(l[i+1]+t.offsetY)*t.scaleY;if(A>=_)return;const S=h[n],E=h[n+1],C=h[n+2],x=h[a],T=h[a+1],P=h[a+2],L=h[o],O=h[o+1],F=h[o+2],J=Math.round(A),U=Math.round(_);let z,X,q,H,$,B,V,rt;for(let M=J;M<=U;M++){if(M_?nt=1:w===_?nt=0:nt=(w-M)/(w-_),z=y-(y-v)*nt,X=x-(x-L)*nt,q=T-(T-O)*nt,H=P-(P-F)*nt}let W;M_?W=1:W=(A-M)/(A-_),$=g-(g-v)*W,B=S-(S-L)*W,V=E-(E-O)*W,rt=C-(C-F)*W;const lt=Math.round(Math.min(z,$)),gt=Math.round(Math.max(z,$));let dt=u*M+lt*4;for(let nt=lt;nt<=gt;nt++)W=(z-nt)/(z-$),W<0?W=0:W>1&&(W=1),d[dt++]=X-(X-B)*W|0,d[dt++]=q-(q-V)*W|0,d[dt++]=H-(H-rt)*W|0,d[dt++]=255}}function Cg(c,t,e){const s=t.coords,i=t.colors;let n,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(s.length/o)-1,h=o-1;for(n=0;n=O?E=l:x=!0,L>=F?C=h:T=!0;const J=this.getSizeAndScale(E,this.ctx.canvas.width,_),U=this.getSizeAndScale(C,this.ctx.canvas.height,S),z=t.cachedCanvases.getCanvas("pattern",J.size,U.size),X=z.context,q=o.createCanvasGraphics(X);if(q.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(q,i,a),X.translate(-J.scale*d,-U.scale*u),q.transform(J.scale,0,0,U.scale,0,0),X.save(),this.clipBbox(q,d,u,f,g),q.baseTransform=Tt(q.ctx),q.executeOperatorList(s),q.endDrawing(),X.restore(),x||T){const H=z.canvas;x&&(E=l),T&&(C=h);const $=this.getSizeAndScale(E,this.ctx.canvas.width,_),B=this.getSizeAndScale(C,this.ctx.canvas.height,S),V=$.size,rt=B.size,M=t.cachedCanvases.getCanvas("pattern-workaround",V,rt),W=M.context,lt=x?Math.floor(A/l):0,gt=T?Math.floor(y/h):0;for(let dt=0;dt<=lt;dt++)for(let nt=0;nt<=gt;nt++)W.drawImage(H,V*dt,rt*nt,V,rt,0,0,V,rt);return{canvas:M.canvas,scaleX:$.scale,scaleY:B.scale,offsetX:d,offsetY:u}}return{canvas:z.canvas,scaleX:J.scale,scaleY:U.scale,offsetX:d,offsetY:u}}getSizeAndScale(t,e,s){const i=Math.max(hh.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*s);return n>=i?n=i:s=n/t,{scale:s,size:n}}clipBbox(t,e,s,i,n){const a=i-e,o=n-s;t.ctx.rect(e,s,a,o),t.current.updateRectMinMax(Tt(t.ctx),[e,s,i,n]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,s){const i=t.ctx,n=t.current;switch(e){case kd.COLORED:const a=this.ctx;i.fillStyle=a.fillStyle,i.strokeStyle=a.strokeStyle,n.fillColor=a.fillStyle,n.strokeColor=a.strokeStyle;break;case kd.UNCOLORED:const o=j.makeHexColor(s[0],s[1],s[2]);i.fillStyle=o,i.strokeStyle=o,n.fillColor=o,n.strokeColor=o;break;default:throw new tg(`Unsupported paint type: ${e}`)}}getPattern(t,e,s,i){let n=s;i!==ue.SHADING&&(n=j.transform(n,e.baseTransform),this.matrix&&(n=j.transform(n,this.matrix)));const a=this.createPatternCanvas(e);let o=new DOMMatrix(n);o=o.translate(a.offsetX,a.offsetY),o=o.scale(1/a.scaleX,1/a.scaleY);const l=t.createPattern(a.canvas,"repeat");return l.setTransform(o),l}};Y(hh,"MAX_PATTERN_SIZE",3e3);let gc=hh;function kg({src:c,srcPos:t=0,dest:e,width:s,height:i,nonBlackColor:n=4294967295,inverseDecode:a=!1}){const o=fe.isLittleEndian?4278190080:255,[l,h]=a?[n,o]:[o,n],d=s>>3,u=s&7,f=c.length;e=new Uint32Array(e.buffer);let g=0;for(let A=0;A{c.save=c.__originalSave,c.restore=c.__originalRestore,c.rotate=c.__originalRotate,c.scale=c.__originalScale,c.translate=c.__originalTranslate,c.transform=c.__originalTransform,c.setTransform=c.__originalSetTransform,c.resetTransform=c.__originalResetTransform,c.clip=c.__originalClip,c.moveTo=c.__originalMoveTo,c.lineTo=c.__originalLineTo,c.bezierCurveTo=c.__originalBezierCurveTo,c.rect=c.__originalRect,c.closePath=c.__originalClosePath,c.beginPath=c.__originalBeginPath,delete c._removeMirroring},c.save=function(){t.save(),this.__originalSave()},c.restore=function(){t.restore(),this.__originalRestore()},c.translate=function(s,i){t.translate(s,i),this.__originalTranslate(s,i)},c.scale=function(s,i){t.scale(s,i),this.__originalScale(s,i)},c.transform=function(s,i,n,a,o,l){t.transform(s,i,n,a,o,l),this.__originalTransform(s,i,n,a,o,l)},c.setTransform=function(s,i,n,a,o,l){t.setTransform(s,i,n,a,o,l),this.__originalSetTransform(s,i,n,a,o,l)},c.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},c.rotate=function(s){t.rotate(s),this.__originalRotate(s)},c.clip=function(s){t.clip(s),this.__originalClip(s)},c.moveTo=function(e,s){t.moveTo(e,s),this.__originalMoveTo(e,s)},c.lineTo=function(e,s){t.lineTo(e,s),this.__originalLineTo(e,s)},c.bezierCurveTo=function(e,s,i,n,a,o){t.bezierCurveTo(e,s,i,n,a,o),this.__originalBezierCurveTo(e,s,i,n,a,o)},c.rect=function(e,s,i,n){t.rect(e,s,i,n),this.__originalRect(e,s,i,n)},c.closePath=function(){t.closePath(),this.__originalClosePath()},c.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class Ig{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,s){let i;return this.cache[t]!==void 0?(i=this.cache[t],this.canvasFactory.reset(i,e,s)):(i=this.canvasFactory.create(e,s),this.cache[t]=i),i}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function pl(c,t,e,s,i,n,a,o,l,h){const[d,u,f,g,A,y]=Tt(c);if(u===0&&f===0){const _=a*d+A,S=Math.round(_),E=o*g+y,C=Math.round(E),x=(a+l)*d+A,T=Math.abs(Math.round(x)-S)||1,P=(o+h)*g+y,L=Math.abs(Math.round(P)-C)||1;return c.setTransform(Math.sign(d),0,0,Math.sign(g),S,C),c.drawImage(t,e,s,i,n,0,0,T,L),c.setTransform(d,u,f,g,A,y),[T,L]}if(d===0&&g===0){const _=o*f+A,S=Math.round(_),E=a*u+y,C=Math.round(E),x=(o+h)*f+A,T=Math.abs(Math.round(x)-S)||1,P=(a+l)*u+y,L=Math.abs(Math.round(P)-C)||1;return c.setTransform(0,Math.sign(u),Math.sign(f),0,S,C),c.drawImage(t,e,s,i,n,0,0,L,T),c.setTransform(d,u,f,g,A,y),[L,T]}c.drawImage(t,e,s,i,n,a,o,l,h);const w=Math.hypot(d,u),v=Math.hypot(f,g);return[w*l,v*h]}function Fg(c){const{width:t,height:e}=c;if(t>Fd||e>Fd)return null;const s=1e3,i=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),n=t+1;let a=new Uint8Array(n*(e+1)),o,l,h;const d=t+7&-8;let u=new Uint8Array(d*e),f=0;for(const v of c.data){let _=128;for(;_>0;)u[f++]=v&_?0:255,_>>=1}let g=0;for(f=0,u[f]!==0&&(a[0]=1,++g),l=1;l>2)+(u[f+1]?4:0)+(u[f-d+1]?8:0),i[v]&&(a[h+l]=i[v],++g),f++;if(u[f-d]!==u[f]&&(a[h+l]=u[f]?2:4,++g),g>s)return null}for(f=d*(e-1),h=o*n,u[f]!==0&&(a[h]=8,++g),l=1;ls)return null;const A=new Int32Array([0,n,-1,0,-n,0,0,0,1]),y=new Path2D;for(o=0;g&&o<=e;o++){let v=o*n;const _=v+t;for(;v<_&&!a[v];)v++;if(v===_)continue;y.moveTo(v%n,o);const S=v;let E=a[v];do{const C=A[E];do v+=C;while(!a[v]);const x=a[v];x!==5&&x!==10?(E=x,a[v]=0):(E=x&51*E>>4,a[v]&=E>>2|E<<2),y.lineTo(v%n,v/n|0),a[v]||--g}while(S!==v);--o}return u=null,a=null,function(v){v.save(),v.scale(1/t,-1/e),v.translate(0,-e),v.fill(y),v.beginPath(),v.restore()}}class Dd{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=su,this.textMatrixScale=1,this.fontMatrix=$h,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=ee.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,s){[e,s]=j.applyTransform([e,s],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,s),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,s)}updateRectMinMax(t,e){const s=j.applyTransform(e,t),i=j.applyTransform(e.slice(2),t),n=j.applyTransform([e[0],e[3]],t),a=j.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,s[0],i[0],n[0],a[0]),this.minY=Math.min(this.minY,s[1],i[1],n[1],a[1]),this.maxX=Math.max(this.maxX,s[0],i[0],n[0],a[0]),this.maxY=Math.max(this.maxY,s[1],i[1],n[1],a[1])}updateScalingPathMinMax(t,e){j.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,s,i,n,a,o,l,h,d){const u=j.bezierBoundingBox(e,s,i,n,a,o,l,h,d);d||this.updateRectMinMax(t,u)}getPathBoundingBox(t=ue.FILL,e=null){const s=[this.minX,this.minY,this.maxX,this.maxY];if(t===ue.STROKE){e||wt("Stroke bounding box must include transform.");const i=j.singularValueDecompose2dScale(e),n=i[0]*this.lineWidth/2,a=i[1]*this.lineWidth/2;s[0]-=n,s[1]-=a,s[2]+=n,s[3]+=a}return s}updateClipFromPath(){const t=j.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=ue.FILL,e=null){return j.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function Od(c,t){if(typeof ImageData<"u"&&t instanceof ImageData){c.putImageData(t,0,0);return}const e=t.height,s=t.width,i=e%Ee,n=(e-i)/Ee,a=i===0?n:n+1,o=c.createImageData(s,Ee);let l=0,h;const d=t.data,u=o.data;let f,g,A,y;if(t.kind===vl.GRAYSCALE_1BPP){const w=d.byteLength,v=new Uint32Array(u.buffer,0,u.byteLength>>2),_=v.length,S=s+7>>3,E=4294967295,C=fe.isLittleEndian?4278190080:255;for(f=0;fS?s:x*8-7,L=P&-8;let O=0,F=0;for(;T>=1}for(;h<_;)v[h++]=0;c.putImageData(o,0,f*Ee)}}else if(t.kind===vl.RGBA_32BPP){for(g=0,y=s*Ee*4,f=0;f=n&&(A=i,y=s*A),h=0,g=y;g--;)u[h++]=d[l++],u[h++]=d[l++],u[h++]=d[l++],u[h++]=255;c.putImageData(o,0,f*Ee)}else throw new Error(`bad image kind: ${t.kind}`)}function Nd(c,t){if(t.bitmap){c.drawImage(t.bitmap,0,0);return}const e=t.height,s=t.width,i=e%Ee,n=(e-i)/Ee,a=i===0?n:n+1,o=c.createImageData(s,Ee);let l=0;const h=t.data,d=o.data;for(let u=0;uId&&typeof s=="function",d=h?Date.now()+Lg:0;let u=0;const f=this.commonObjs,g=this.objs;let A;for(;;){if(i!==void 0&&o===i.nextBreakPoint)return i.breakIt(o,s),o;if(A=a[o],A!==Xe.dependency)this[A].apply(this,n[o]);else for(const y of n[o]){const w=y.startsWith("g_")?f:g;if(!w.has(y))return w.get(y,s),o}if(o++,o===l)return o;if(h&&++u>Id){if(Date.now()>d)return s(),o;u=0}}}endDrawing(){m(this,zi,mc).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),m(this,zi,bc).call(this)}_scaleImage(t,e){const s=t.width??t.displayWidth,i=t.height??t.displayHeight;let n=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),o=s,l=i,h="prescale1",d,u;for(;n>2&&o>1||a>2&&l>1;){let f=o,g=l;n>2&&o>1&&(f=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),n/=o/f),a>2&&l>1&&(g=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,a/=l/g),d=this.cachedCanvases.getCanvas(h,f,g),u=d.context,u.clearRect(0,0,f,g),u.drawImage(t,0,0,o,l,0,0,f,g),t=d.canvas,o=f,l=g,h=h==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:o,paintHeight:l}}_createMaskCanvas(t){const e=this.ctx,{width:s,height:i}=t,n=this.current.fillColor,a=this.current.patternFill,o=Tt(e);let l,h,d,u;if((t.bitmap||t.data)&&t.count>1){const P=t.bitmap||t.data.buffer;h=JSON.stringify(a?o:[o.slice(0,4),n]),l=this._cachedBitmapsMap.get(P),l||(l=new Map,this._cachedBitmapsMap.set(P,l));const L=l.get(h);if(L&&!a){const O=Math.round(Math.min(o[0],o[2])+o[4]),F=Math.round(Math.min(o[1],o[3])+o[5]);return{canvas:L,offsetX:O,offsetY:F}}d=L}d||(u=this.cachedCanvases.getCanvas("maskCanvas",s,i),Nd(u.context,t));let f=j.transform(o,[1/s,0,0,-1/i,0,0]);f=j.transform(f,[1,0,0,1,0,-i]);const[g,A,y,w]=j.getAxialAlignedBoundingBox([0,0,s,i],f),v=Math.round(y-g)||1,_=Math.round(w-A)||1,S=this.cachedCanvases.getCanvas("fillCanvas",v,_),E=S.context,C=g,x=A;E.translate(-C,-x),E.transform(...f),d||(d=this._scaleImage(u.canvas,Ps(E)),d=d.img,l&&a&&l.set(h,d)),E.imageSmoothingEnabled=Hd(Tt(E),t.interpolate),pl(E,d,0,0,d.width,d.height,0,0,s,i),E.globalCompositeOperation="source-in";const T=j.transform(Ps(E),[1,0,0,1,-C,-x]);return E.fillStyle=a?n.getPattern(e,this,T,ue.FILL):n,E.fillRect(0,0,s,i),l&&!a&&(this.cachedCanvases.delete("fillCanvas"),l.set(h,S.canvas)),{canvas:S.canvas,offsetX:Math.round(C),offsetY:Math.round(x)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=Dg[t]}setLineJoin(t){this.ctx.lineJoin=Og[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const s=this.ctx;s.setLineDash!==void 0&&(s.setLineDash(t),s.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,s]of t)switch(e){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s[0],s[1]);break;case"CA":this.current.strokeAlpha=s;break;case"ca":this.current.fillAlpha=s,this.ctx.globalAlpha=s;break;case"BM":this.ctx.globalCompositeOperation=s;break;case"SMask":this.current.activeSMask=s?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,s="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(s,t,e);this.suspendedCtx=this.ctx,this.ctx=i.context;const n=this.ctx;n.setTransform(...Tt(this.suspendedCtx)),_a(this.suspendedCtx,n),Mg(n,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),_a(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,s=this.suspendedCtx;this.composeSMask(s,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,s,i){const n=i[0],a=i[1],o=i[2]-n,l=i[3]-a;o===0||l===0||(this.genericComposeSMask(e.context,s,o,l,e.subtype,e.backdrop,e.transferMap,n,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(s.canvas,0,0),t.restore())}genericComposeSMask(t,e,s,i,n,a,o,l,h,d,u){let f=t.canvas,g=l-d,A=h-u;if(a){const w=j.makeHexColor(...a);if(g<0||A<0||g+s>f.width||A+i>f.height){const v=this.cachedCanvases.getCanvas("maskExtension",s,i),_=v.context;_.drawImage(f,-g,-A),_.globalCompositeOperation="destination-atop",_.fillStyle=w,_.fillRect(0,0,s,i),_.globalCompositeOperation="source-over",f=v.canvas,g=A=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const v=new Path2D;v.rect(g,A,s,i),t.clip(v),t.globalCompositeOperation="destination-atop",t.fillStyle=w,t.fillRect(g,A,s,i),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),n==="Alpha"&&o?e.filter=this.filterFactory.addAlphaFilter(o):n==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(o));const y=new Path2D;y.rect(l,h,s,i),e.clip(y),e.globalCompositeOperation="destination-in",e.drawImage(f,g,A,s,i,l,h,s,i),e.restore()}save(){this.inSMaskMode?(_a(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),_a(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,s,i,n,a){this.ctx.transform(t,e,s,i,n,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s){const i=this.ctx,n=this.current;let a=n.x,o=n.y,l,h;const d=Tt(i),u=d[0]===0&&d[3]===0||d[1]===0&&d[2]===0,f=u?s.slice(0):null;for(let g=0,A=0,y=t.length;gMd&&(h=Md),this.current.fontSizeScale=e/h,this.ctx.font=`${l} ${o} ${h}px ${a}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,s,i,n,a){this.current.textMatrix=[t,e,s,i,n,a],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,s,i){const n=this.ctx,a=this.current,o=a.font,l=a.textRenderingMode,h=a.fontSize/a.fontSizeScale,d=l&ee.FILL_STROKE_MASK,u=!!(l&ee.ADD_TO_PATH_FLAG),f=a.patternFill&&!o.missingFile;let g;(o.disableFontFace||u||f)&&(g=o.getPathGenerator(this.commonObjs,t)),o.disableFontFace||f?(n.save(),n.translate(e,s),n.beginPath(),g(n,h),i&&n.setTransform(...i),(d===ee.FILL||d===ee.FILL_STROKE)&&n.fill(),(d===ee.STROKE||d===ee.FILL_STROKE)&&n.stroke(),n.restore()):((d===ee.FILL||d===ee.FILL_STROKE)&&n.fillText(t,e,s),(d===ee.STROKE||d===ee.FILL_STROKE)&&n.strokeText(t,e,s)),u&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Tt(n),x:e,y:s,fontSize:h,addToPath:g})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let s=!1;for(let i=3;i0&&e[i]<255){s=!0;break}return ot(this,"isFontSubpixelAAEnabled",s)}showText(t){const e=this.current,s=e.font;if(s.isType3Font)return this.showType3Text(t);const i=e.fontSize;if(i===0)return;const n=this.ctx,a=e.fontSizeScale,o=e.charSpacing,l=e.wordSpacing,h=e.fontDirection,d=e.textHScale*h,u=t.length,f=s.vertical,g=f?1:-1,A=s.defaultVMetrics,y=i*e.fontMatrix[0],w=e.textRenderingMode===ee.FILL&&!s.disableFontFace&&!e.patternFill;n.save(),n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),h>0?n.scale(d,-1):n.scale(d,1);let v;if(e.patternFill){n.save();const x=e.fillColor.getPattern(n,this,Ps(n),ue.FILL);v=Tt(n),n.restore(),n.fillStyle=x}let _=e.lineWidth;const S=e.textMatrixScale;if(S===0||_===0){const x=e.textRenderingMode&ee.FILL_STROKE_MASK;(x===ee.STROKE||x===ee.FILL_STROKE)&&(_=this.getSinglePixelWidth())}else _/=S;if(a!==1&&(n.scale(a,a),_/=a),n.lineWidth=_,s.isInvalidPDFjsFont){const x=[];let T=0;for(const P of t)x.push(P.unicode),T+=P.width;n.fillText(x.join(""),0,0),e.x+=T*y*d,n.restore(),this.compose();return}let E=0,C;for(C=0;C0){const X=n.measureText(L).width*1e3/i*a;if(Unew Ed(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new gc(t,s,this.ctx,n,i)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,s){this.ctx.strokeStyle=this.current.strokeColor=j.makeHexColor(t,e,s)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(t,e,s){this.ctx.fillStyle=this.current.fillColor=j.makeHexColor(t,e,s),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e=null){let s;return this.cachedPatterns.has(t)?s=this.cachedPatterns.get(t):(s=Pg(this.getObject(t)),this.cachedPatterns.set(t,s)),e&&(s.matrix=e),s}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const s=this._getPattern(t);e.fillStyle=s.getPattern(e,this,Ps(e),ue.SHADING);const i=Ps(e);if(i){const{width:n,height:a}=e.canvas,[o,l,h,d]=j.getAxialAlignedBoundingBox([0,0,n,a],i);this.ctx.fillRect(o,l,h-o,d-l)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){wt("Should not call beginInlineImage")}beginImageData(){wt("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=Tt(this.ctx),e)){const s=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],s,i),this.current.updateRectMinMax(Tt(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||wh("TODO: Support non-isolated groups."),t.knockout&&st("Knockout groups not supported.");const s=Tt(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let i=j.getAxialAlignedBoundingBox(t.bbox,Tt(e));const n=[0,0,e.canvas.width,e.canvas.height];i=j.intersect(i,n)||[0,0,0,0];const a=Math.floor(i[0]),o=Math.floor(i[1]),l=Math.max(Math.ceil(i[2])-a,1),h=Math.max(Math.ceil(i[3])-o,1);this.current.startNewPathAndClipBox([0,0,l,h]);let d="groupAt"+this.groupLevel;t.smask&&(d+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(d,l,h),f=u.context;f.translate(-a,-o),f.transform(...s),t.smask?this.smaskStack.push({canvas:u.canvas,context:f,offsetX:a,offsetY:o,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(a,o),e.save()),_a(e,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const i=Tt(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...i);const n=j.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],i);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(t,e,s,i,n){if(m(this,zi,mc).call(this),gl(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const a=e[2]-e[0],o=e[3]-e[1];if(n&&this.annotationCanvasMap){s=s.slice(),s[4]-=e[0],s[5]-=e[1],e=e.slice(),e[0]=e[1]=0,e[2]=a,e[3]=o;const[l,h]=j.singularValueDecompose2dScale(Tt(this.ctx)),{viewportScale:d}=this,u=Math.ceil(a*this.outputScaleX*d),f=Math.ceil(o*this.outputScaleY*d);this.annotationCanvas=this.canvasFactory.create(u,f);const{canvas:g,context:A}=this.annotationCanvas;this.annotationCanvasMap.set(t,g),this.annotationCanvas.savedCtx=this.ctx,this.ctx=A,this.ctx.save(),this.ctx.setTransform(l,0,0,-h,0,o*h),gl(this.ctx)}else gl(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],a,o),this.ctx.clip(),this.ctx.beginPath()}this.current=new Dd(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...s),this.transform(...i)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),m(this,zi,bc).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;t=this.getObject(t.data,t),t.count=e;const s=this.ctx,i=this.processingType3;if(i&&(i.compiled===void 0&&(i.compiled=Fg(t)),i.compiled)){i.compiled(s);return}const n=this._createMaskCanvas(t),a=n.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(a,n.offsetX,n.offsetY),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,s=0,i=0,n,a){if(!this.contentVisible)return;t=this.getObject(t.data,t);const o=this.ctx;o.save();const l=Tt(o);o.transform(e,s,i,n,0,0);const h=this._createMaskCanvas(t);o.setTransform(1,0,0,1,h.offsetX-l[4],h.offsetY-l[5]);for(let d=0,u=a.length;du?d/u:1,o=h>u?h/u:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:s}=this.current,[i,n]=this.getScaleForStroking();if(e.lineWidth=s||1,i===1&&n===1){e.stroke();return}const a=e.getLineDash();if(t&&e.save(),e.scale(i,n),a.length>0){const o=Math.max(i,n);e.setLineDash(a.map(l=>l/o)),e.lineDashOffset/=o}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};zi=new WeakSet,mc=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)},bc=function(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}};let gr=Ed;for(const c in Xe)gr.prototype[c]!==void 0&&(gr.prototype[Xe[c]]=gr.prototype[c]);var uo,fo;class ii{static get workerPort(){return r(this,uo)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");p(this,uo,t)}static get workerSrc(){return r(this,fo)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");p(this,fo,t)}}uo=new WeakMap,fo=new WeakMap,b(ii,uo,null),b(ii,fo,"");const ml={DATA:1,ERROR:2},It={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function xe(c){switch(c instanceof Error||typeof c=="object"&&c!==null||wt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),c.name){case"AbortException":return new er(c.message);case"MissingPDFException":return new tr(c.message);case"PasswordException":return new zh(c.message,c.code);case"UnexpectedResponseException":return new _h(c.message,c.status);case"UnknownErrorException":return new Gh(c.message,c.details);default:return new Gh(c.message,c.toString())}}var Ir,We,ju,$u,zu,Rl;class La{constructor(t,e,s){b(this,We);b(this,Ir,new AbortController);this.sourceName=t,this.targetName=e,this.comObj=s,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),s.addEventListener("message",m(this,We,ju).bind(this),{signal:r(this,Ir).signal})}on(t,e){const s=this.actionHandler;if(s[t])throw new Error(`There is already an actionName called "${t}"`);s[t]=e}send(t,e,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},s)}sendWithPromise(t,e,s){const i=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[i]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},s)}catch(a){n.reject(a)}return n.promise}sendWithStream(t,e,s,i){const n=this.streamId++,a=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:h=>{const d=Promise.withResolvers();return this.streamControllers[n]={controller:h,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:a,targetName:o,action:t,streamId:n,data:e,desiredSize:h.desiredSize},i),d.promise},pull:h=>{const d=Promise.withResolvers();return this.streamControllers[n].pullCall=d,l.postMessage({sourceName:a,targetName:o,stream:It.PULL,streamId:n,desiredSize:h.desiredSize}),d.promise},cancel:h=>{jt(h instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[n].cancelCall=d,this.streamControllers[n].isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:It.CANCEL,streamId:n,reason:xe(h)}),d.promise}},s)}destroy(){var t;(t=r(this,Ir))==null||t.abort(),p(this,Ir,null)}}Ir=new WeakMap,We=new WeakSet,ju=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){m(this,We,zu).call(this,t);return}if(t.callback){const s=t.callbackId,i=this.callbackCapabilities[s];if(!i)throw new Error(`Cannot resolve callback ${s}`);if(delete this.callbackCapabilities[s],t.callback===ml.DATA)i.resolve(t.data);else if(t.callback===ml.ERROR)i.reject(xe(t.reason));else throw new Error("Unexpected callback case");return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const s=this.sourceName,i=t.sourceName,n=this.comObj;new Promise(function(a){a(e(t.data))}).then(function(a){n.postMessage({sourceName:s,targetName:i,callback:ml.DATA,callbackId:t.callbackId,data:a})},function(a){n.postMessage({sourceName:s,targetName:i,callback:ml.ERROR,callbackId:t.callbackId,reason:xe(a)})});return}if(t.streamId){m(this,We,$u).call(this,t);return}e(t.data)},$u=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,a=this,o=this.actionHandler[t.action],l={enqueue(h,d=1,u){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=d,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:s,targetName:i,stream:It.ENQUEUE,streamId:e,chunk:h},u)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:It.CLOSE,streamId:e}),delete a.streamSinks[e])},error(h){jt(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:It.ERROR,streamId:e,reason:xe(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[e]=l,new Promise(function(h){h(o(t.data,l))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:It.START_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:It.START_COMPLETE,streamId:e,reason:xe(h)})})},zu=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,a=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case It.START_COMPLETE:t.success?a.startCall.resolve():a.startCall.reject(xe(t.reason));break;case It.PULL_COMPLETE:t.success?a.pullCall.resolve():a.pullCall.reject(xe(t.reason));break;case It.PULL:if(!o){n.postMessage({sourceName:s,targetName:i,stream:It.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,new Promise(function(l){var h;l((h=o.onPull)==null?void 0:h.call(o))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:It.PULL_COMPLETE,streamId:e,success:!0})},function(l){n.postMessage({sourceName:s,targetName:i,stream:It.PULL_COMPLETE,streamId:e,reason:xe(l)})});break;case It.ENQUEUE:if(jt(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case It.CLOSE:if(jt(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),m(this,We,Rl).call(this,a,e);break;case It.ERROR:jt(a,"error should have stream controller"),a.controller.error(xe(t.reason)),m(this,We,Rl).call(this,a,e);break;case It.CANCEL_COMPLETE:t.success?a.cancelCall.resolve():a.cancelCall.reject(xe(t.reason)),m(this,We,Rl).call(this,a,e);break;case It.CANCEL:if(!o)break;new Promise(function(l){var h;l((h=o.onCancel)==null?void 0:h.call(o,xe(t.reason)))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:It.CANCEL_COMPLETE,streamId:e,success:!0})},function(l){n.postMessage({sourceName:s,targetName:i,stream:It.CANCEL_COMPLETE,streamId:e,reason:xe(l)})}),o.sinkCapability.reject(xe(t.reason)),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},Rl=async function(t,e){var s,i,n;await Promise.allSettled([(s=t.startCall)==null?void 0:s.promise,(i=t.pullCall)==null?void 0:i.promise,(n=t.cancelCall)==null?void 0:n.promise]),delete this.streamControllers[e]};var bn,po;class Hg{constructor({parsedData:t,rawData:e}){b(this,bn);b(this,po);p(this,bn,t),p(this,po,e)}getRaw(){return r(this,po)}get(t){return r(this,bn).get(t)??null}getAll(){return hd(r(this,bn))}has(t){return r(this,bn).has(t)}}bn=new WeakMap,po=new WeakMap;const cr=Symbol("INTERNAL");var go,mo,bo,Fr;class Bg{constructor(t,{name:e,intent:s,usage:i,rbGroups:n}){b(this,go,!1);b(this,mo,!1);b(this,bo,!1);b(this,Fr,!0);p(this,go,!!(t&Fe.DISPLAY)),p(this,mo,!!(t&Fe.PRINT)),this.name=e,this.intent=s,this.usage=i,this.rbGroups=n}get visible(){if(r(this,bo))return r(this,Fr);if(!r(this,Fr))return!1;const{print:t,view:e}=this.usage;return r(this,go)?(e==null?void 0:e.viewState)!=="OFF":r(this,mo)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,s=!1){t!==cr&&wt("Internal method `_setVisible` called."),p(this,bo,s),p(this,Fr,e)}}go=new WeakMap,mo=new WeakMap,bo=new WeakMap,Fr=new WeakMap;var Ei,ft,Dr,Or,Ao,Ac;class jg{constructor(t,e=Fe.DISPLAY){b(this,Ao);b(this,Ei,null);b(this,ft,new Map);b(this,Dr,null);b(this,Or,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,p(this,Or,t.order);for(const s of t.groups)r(this,ft).set(s.id,new Bg(e,s));if(t.baseState==="OFF")for(const s of r(this,ft).values())s._setVisible(cr,!1);for(const s of t.on)r(this,ft).get(s)._setVisible(cr,!0);for(const s of t.off)r(this,ft).get(s)._setVisible(cr,!1);p(this,Dr,this.getHash())}}isVisible(t){if(r(this,ft).size===0)return!0;if(!t)return wh("Optional content group not defined."),!0;if(t.type==="OCG")return r(this,ft).has(t.id)?r(this,ft).get(t.id).visible:(st(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return m(this,Ao,Ac).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!r(this,ft).has(e))return st(`Optional content group not found: ${e}`),!0;if(r(this,ft).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!r(this,ft).has(e))return st(`Optional content group not found: ${e}`),!0;if(!r(this,ft).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!r(this,ft).has(e))return st(`Optional content group not found: ${e}`),!0;if(!r(this,ft).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!r(this,ft).has(e))return st(`Optional content group not found: ${e}`),!0;if(r(this,ft).get(e).visible)return!1}return!0}return st(`Unknown optional content policy ${t.policy}.`),!0}return st(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,s=!0){var n;const i=r(this,ft).get(t);if(!i){st(`Optional content group not found: ${t}`);return}if(s&&e&&i.rbGroups.length)for(const a of i.rbGroups)for(const o of a)o!==t&&((n=r(this,ft).get(o))==null||n._setVisible(cr,!1,!0));i._setVisible(cr,!!e,!0),p(this,Ei,null)}setOCGState({state:t,preserveRB:e}){let s;for(const i of t){switch(i){case"ON":case"OFF":case"Toggle":s=i;continue}const n=r(this,ft).get(i);if(n)switch(s){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!n.visible,e);break}}p(this,Ei,null)}get hasInitialVisibility(){return r(this,Dr)===null||this.getHash()===r(this,Dr)}getOrder(){return r(this,ft).size?r(this,Or)?r(this,Or).slice():[...r(this,ft).keys()]:null}getGroups(){return r(this,ft).size>0?hd(r(this,ft)):null}getGroup(t){return r(this,ft).get(t)||null}getHash(){if(r(this,Ei)!==null)return r(this,Ei);const t=new Pu;for(const[e,s]of r(this,ft))t.update(`${e}:${s.visible}`);return p(this,Ei,t.hexdigest())}}Ei=new WeakMap,ft=new WeakMap,Dr=new WeakMap,Or=new WeakMap,Ao=new WeakSet,Ac=function(t){const e=t.length;if(e<2)return!0;const s=t[0];for(let i=1;i0){const l=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!e,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((l,h)=>{this._onReceiveData({begin:l,chunk:h})}),t.addProgressListener((l,h)=>{this._onProgress({loaded:l,total:h})}),t.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){const s=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s);else{const i=this._rangeReaders.some(function(n){return n._begin!==t?!1:(n._enqueue(s),!0)});jt(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}_onProgress(t){var e,s,i,n;t.total===void 0?(s=(e=this._rangeReaders[0])==null?void 0:e.onProgress)==null||s.call(e,{loaded:t.loaded}):(n=(i=this._fullRequestReader)==null?void 0:i.onProgress)==null||n.call(i,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;(t=this._fullRequestReader)==null||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){jt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new zg(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new Gg(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeReaders.slice(0))s.cancel(t);this._pdfDataRangeTransport.abort()}}class zg{constructor(t,e,s=!1,i=null){this._stream=t,this._done=s||!1,this._filename=ud(i)?i:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Gg{constructor(t,e,s){this._stream=t,this._begin=e,this._end=s,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Ug(c){let t=!0,e=s("filename\\*","i").exec(c);if(e){e=e[1];let d=o(e);return d=unescape(d),d=l(d),d=h(d),n(d)}if(e=a(c),e){const d=h(e);return n(d)}if(e=s("filename","i").exec(c),e){e=e[1];let d=o(e);return d=h(d),n(d)}function s(d,u){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function i(d,u){if(d){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const f=new TextDecoder(d,{fatal:!0}),g=Eh(u);u=f.decode(g),t=!1}catch{}}return u}function n(d){return t&&/[\x80-\xff]/.test(d)&&(d=i("utf-8",d),t&&(d=i("iso-8859-1",d))),d}function a(d){const u=[];let f;const g=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=g.exec(d))!==null;){let[,y,w,v]=f;if(y=parseInt(y,10),y in u){if(y===0)break;continue}u[y]=[w,v]}const A=[];for(let y=0;y{if(!Gu(n.status))throw Ch(n.status,i);this._reader=n.body.getReader(),this._headersCapability.resolve();const a=n.headers,{allowRangeRequests:o,suggestedLength:l}=Ad({responseHeaders:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=yd(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new er("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;await this._headersCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:Wu(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class Vg{constructor(t,e,s){this._stream=t,this._reader=null,this._loaded=0;const i=t.source;this._withCredentials=i.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!i.disableStream,this._abortController=new AbortController;const n=new Headers(t.headers);n.append("Range",`bytes=${e}-${s-1}`);const a=i.url;fetch(a,Uu(n,this._withCredentials,this._abortController)).then(o=>{if(!Gu(o.status))throw Ch(o.status,a);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:Wu(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}const Nh=200,Hh=206;function qg(c){const t=c.response;return typeof t!="string"?t:Eh(t).buffer}class Xg{constructor({url:t,httpHeaders:e,withCredentials:s}){this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=bd(this.isHttp,e),this.withCredentials=s||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,s){const i={begin:t,end:e};for(const n in s)i[n]=s[n];return this.request(i)}requestFull(t){return this.request(t)}request(t){const e=new XMLHttpRequest,s=this.currXhrId++,i=this.pendingRequests[s]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[n,a]of this.headers)e.setRequestHeader(n,a);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.expectedStatus=Hh):i.expectedStatus=Nh,e.responseType="arraybuffer",t.onError&&(e.onerror=function(n){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,s),e.onprogress=this.onProgress.bind(this,s),i.onHeadersReceived=t.onHeadersReceived,i.onDone=t.onDone,i.onError=t.onError,i.onProgress=t.onProgress,e.send(null),s}onProgress(t,e){var i;const s=this.pendingRequests[t];s&&((i=s.onProgress)==null||i.call(s,e))}onStateChange(t,e){var l,h,d;const s=this.pendingRequests[t];if(!s)return;const i=s.xhr;if(i.readyState>=2&&s.onHeadersReceived&&(s.onHeadersReceived(),delete s.onHeadersReceived),i.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],i.status===0&&this.isHttp){(l=s.onError)==null||l.call(s,i.status);return}const n=i.status||Nh;if(!(n===Nh&&s.expectedStatus===Hh)&&n!==s.expectedStatus){(h=s.onError)==null||h.call(s,i.status);return}const o=qg(i);if(n===Hh){const u=i.getResponseHeader("Content-Range"),f=/bytes (\d+)-(\d+)\/(\d+)/.exec(u);s.onDone({begin:parseInt(f[1],10),chunk:o})}else o?s.onDone({begin:0,chunk:o}):(d=s.onError)==null||d.call(s,i.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class Yg{constructor(t){this._source=t,this._manager=new Xg(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return jt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Kg(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const s=new Qg(this._manager,t,e);return s.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class Kg{constructor(t,e){this._manager=t;const s={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(s),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t),s=new Headers(e.getAllResponseHeaders().trim().split(/[\r\n]+/).map(a=>{const[o,...l]=a.split(": ");return[o,l.join(": ")]})),{allowRangeRequests:i,suggestedLength:n}=Ad({responseHeaders:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=yd(s),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=Ch(t,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;(e=this.onProgress)==null||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Qg{constructor(t,e,s){this._manager=t;const i={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,s,i),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var t;(t=this.onClosed)==null||t.call(this,this)}_onDone(t){const e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0;for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=Ch(t,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(e=this.onProgress)==null||e.call(this,{loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Jg=/^[a-z][a-z0-9\-+.]+:/i;function Zg(c){if(Jg.test(c))return new URL(c);const t=ji.get("url");return new URL(t.pathToFileURL(c))}function Vu(c,t,e){return c.protocol==="http:"?ji.get("http").request(c,{headers:t},e):ji.get("https").request(c,{headers:t},e)}class tm{constructor(t){this.source=t,this.url=Zg(t.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.headers=bd(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return jt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new im(this):new em(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=this.isFsUrl?new nm(this,t,e):new sm(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class qu{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new er("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Xu{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const e=t.source;this._isStreamingSupported=!e.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}}class em extends qu{constructor(t){super(t);const e=Object.fromEntries(t.headers),s=i=>{if(i.statusCode===404){const l=new tr(`Missing PDF "${this._url}".`);this._storedError=l,this._headersCapability.reject(l);return}this._headersCapability.resolve(),this._setReadableStream(i);const n=new Headers(this._readableStream.headers),{allowRangeRequests:a,suggestedLength:o}=Ad({responseHeaders:n,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=o||this._contentLength,this._filename=yd(n)};this._request=Vu(this._url,e,s),this._request.on("error",i=>{this._storedError=i,this._headersCapability.reject(i)}),this._request.end()}}class sm extends Xu{constructor(t,e,s){super(t);const i=Object.fromEntries(t.headers);i.Range=`bytes=${e}-${s-1}`;const n=a=>{if(a.statusCode===404){const o=new tr(`Missing PDF "${this._url}".`);this._storedError=o;return}this._setReadableStream(a)};this._request=Vu(this._url,i,n),this._request.on("error",a=>{this._storedError=a}),this._request.end()}}class im extends qu{constructor(t){super(t);const e=ji.get("fs");e.promises.lstat(this._url).then(s=>{this._contentLength=s.size,this._setReadableStream(e.createReadStream(this._url)),this._headersCapability.resolve()},s=>{s.code==="ENOENT"&&(s=new tr(`Missing PDF "${this._url}".`)),this._storedError=s,this._headersCapability.reject(s)})}}class nm extends Xu{constructor(t,e,s){super(t);const i=ji.get("fs");this._setReadableStream(i.createReadStream(this._url,{start:e,end:s-1}))}}const rm=1e5,Ae=30,am=.8;var tu,Si,we,yo,vo,An,Bs,wo,_o,yn,Nr,Hr,xi,Br,Eo,jr,vn,So,xo,Pt,wn,_n,Co,Ci,$r,oi,Yu,Ku,vc,Oe,Pl,wc,Qu,Ju;let yc=(Pt=class{constructor({textContentSource:t,container:e,viewport:s}){b(this,oi);b(this,Si,Promise.withResolvers());b(this,we,null);b(this,yo,!1);b(this,vo,!!((tu=globalThis.FontInspector)!=null&&tu.enabled));b(this,An,null);b(this,Bs,null);b(this,wo,0);b(this,_o,0);b(this,yn,null);b(this,Nr,null);b(this,Hr,0);b(this,xi,0);b(this,Br,Object.create(null));b(this,Eo,[]);b(this,jr,null);b(this,vn,[]);b(this,So,new WeakMap);b(this,xo,null);var l;if(t instanceof ReadableStream)p(this,jr,t);else if(typeof t=="object")p(this,jr,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');p(this,we,p(this,Nr,e)),p(this,xi,s.scale*(globalThis.devicePixelRatio||1)),p(this,Hr,s.rotation),p(this,Bs,{div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:n,pageX:a,pageY:o}=s.rawDims;p(this,xo,[1,0,0,-1,-a,o+n]),p(this,_o,i),p(this,wo,n),m(l=Pt,Oe,Qu).call(l),Xn(e,s),r(this,Si).promise.finally(()=>{r(Pt,$r).delete(this),p(this,Bs,null),p(this,Br,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=fe.platform;return ot(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){const t=()=>{r(this,yn).read().then(({value:e,done:s})=>{if(s){r(this,Si).resolve();return}r(this,An)??p(this,An,e.lang),Object.assign(r(this,Br),e.styles),m(this,oi,Yu).call(this,e.items),t()},r(this,Si).reject)};return p(this,yn,r(this,jr).getReader()),r(Pt,$r).add(this),t(),r(this,Si).promise}update({viewport:t,onBefore:e=null}){var n;const s=t.scale*(globalThis.devicePixelRatio||1),i=t.rotation;if(i!==r(this,Hr)&&(e==null||e(),p(this,Hr,i),Xn(r(this,Nr),{rotation:i})),s!==r(this,xi)){e==null||e(),p(this,xi,s);const a={div:null,properties:null,ctx:m(n=Pt,Oe,Pl).call(n,r(this,An))};for(const o of r(this,vn))a.properties=r(this,So).get(o),a.div=o,m(this,oi,vc).call(this,a)}}cancel(){var e;const t=new er("TextLayer task cancelled.");(e=r(this,yn))==null||e.cancel(t).catch(()=>{}),p(this,yn,null),r(this,Si).reject(t)}get textDivs(){return r(this,vn)}get textContentItemsStr(){return r(this,Eo)}static cleanup(){if(!(r(this,$r).size>0)){r(this,wn).clear();for(const{canvas:t}of r(this,_n).values())t.remove();r(this,_n).clear()}}},Si=new WeakMap,we=new WeakMap,yo=new WeakMap,vo=new WeakMap,An=new WeakMap,Bs=new WeakMap,wo=new WeakMap,_o=new WeakMap,yn=new WeakMap,Nr=new WeakMap,Hr=new WeakMap,xi=new WeakMap,Br=new WeakMap,Eo=new WeakMap,jr=new WeakMap,vn=new WeakMap,So=new WeakMap,xo=new WeakMap,wn=new WeakMap,_n=new WeakMap,Co=new WeakMap,Ci=new WeakMap,$r=new WeakMap,oi=new WeakSet,Yu=function(t){var i,n;if(r(this,yo))return;(n=r(this,Bs)).ctx??(n.ctx=m(i=Pt,Oe,Pl).call(i,r(this,An)));const e=r(this,vn),s=r(this,Eo);for(const a of t){if(e.length>rm){st("Ignoring additional textDivs for performance reasons."),p(this,yo,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=r(this,we);p(this,we,document.createElement("span")),r(this,we).classList.add("markedContent"),a.id!==null&&r(this,we).setAttribute("id",`${a.id}`),o.append(r(this,we))}else a.type==="endMarkedContent"&&p(this,we,r(this,we).parentNode);continue}s.push(a.str),m(this,oi,Ku).call(this,a)}},Ku=function(t){var y;const e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};r(this,vn).push(e);const i=j.transform(r(this,xo),t.transform);let n=Math.atan2(i[1],i[0]);const a=r(this,Br)[t.fontName];a.vertical&&(n+=Math.PI/2);let o=r(this,vo)&&a.fontSubstitution||a.fontFamily;o=Pt.fontFamilyMap.get(o)||o;const l=Math.hypot(i[2],i[3]),h=l*m(y=Pt,Oe,Ju).call(y,o,r(this,An));let d,u;n===0?(d=i[4],u=i[5]-h):(d=i[4]+h*Math.sin(n),u=i[5]-h*Math.cos(n));const f="calc(var(--scale-factor)*",g=e.style;r(this,we)===r(this,Nr)?(g.left=`${(100*d/r(this,_o)).toFixed(2)}%`,g.top=`${(100*u/r(this,wo)).toFixed(2)}%`):(g.left=`${f}${d.toFixed(2)}px)`,g.top=`${f}${u.toFixed(2)}px)`),g.fontSize=`${f}${(r(Pt,Ci)*l).toFixed(2)}px)`,g.fontFamily=o,s.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,r(this,vo)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),n!==0&&(s.angle=n*(180/Math.PI));let A=!1;if(t.str.length>1)A=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const w=Math.abs(t.transform[0]),v=Math.abs(t.transform[3]);w!==v&&Math.max(w,v)/Math.min(w,v)>1.5&&(A=!0)}if(A&&(s.canvasWidth=a.vertical?t.height:t.width),r(this,So).set(e,s),r(this,Bs).div=e,r(this,Bs).properties=s,m(this,oi,vc).call(this,r(this,Bs)),s.hasText&&r(this,we).append(e),s.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),r(this,we).append(w)}},vc=function(t){var o;const{div:e,properties:s,ctx:i}=t,{style:n}=e;let a="";if(r(Pt,Ci)>1&&(a=`scale(${1/r(Pt,Ci)})`),s.canvasWidth!==0&&s.hasText){const{fontFamily:l}=n,{canvasWidth:h,fontSize:d}=s;m(o=Pt,Oe,wc).call(o,i,d*r(this,xi),l);const{width:u}=i.measureText(e.textContent);u>0&&(a=`scaleX(${h*r(this,xi)/u}) ${a}`)}s.angle!==0&&(a=`rotate(${s.angle}deg) ${a}`),a.length>0&&(n.transform=a)},Oe=new WeakSet,Pl=function(t=null){let e=r(this,_n).get(t||(t=""));if(!e){const s=document.createElement("canvas");s.className="hiddenCanvasElement",s.lang=t,document.body.append(s),e=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),r(this,_n).set(t,e),r(this,Co).set(e,{size:0,family:""})}return e},wc=function(t,e,s){const i=r(this,Co).get(t);e===i.size&&s===i.family||(t.font=`${e}px ${s}`,i.size=e,i.family=s)},Qu=function(){if(r(this,Ci)!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),p(this,Ci,t.getBoundingClientRect().height),t.remove()},Ju=function(t,e){const s=r(this,wn).get(t);if(s)return s;const i=m(this,Oe,Pl).call(this,e);i.canvas.width=i.canvas.height=Ae,m(this,Oe,wc).call(this,i,Ae,t);const n=i.measureText("");let a=n.fontBoundingBoxAscent,o=Math.abs(n.fontBoundingBoxDescent);if(a){const d=a/(a+o);return r(this,wn).set(t,d),i.canvas.width=i.canvas.height=0,d}i.strokeStyle="red",i.clearRect(0,0,Ae,Ae),i.strokeText("g",0,0);let l=i.getImageData(0,0,Ae,Ae).data;o=0;for(let d=l.length-1-3;d>=0;d-=4)if(l[d]>0){o=Math.ceil(d/4/Ae);break}i.clearRect(0,0,Ae,Ae),i.strokeText("A",0,Ae),l=i.getImageData(0,0,Ae,Ae).data,a=0;for(let d=0,u=l.length;d0){a=Ae-Math.floor(d/4/Ae);break}i.canvas.width=i.canvas.height=0;const h=a?a/(a+o):am;return r(this,wn).set(t,h),h},b(Pt,Oe),b(Pt,wn,new Map),b(Pt,_n,new Map),b(Pt,Co,new WeakMap),b(Pt,Ci,null),b(Pt,$r,new Set),Pt);class Ga{static textContent(t){const e=[],s={items:e,styles:Object.create(null)};function i(n){var l;if(!n)return;let a=null;const o=n.name;if(o==="#text")a=n.value;else if(Ga.shouldBuildText(o))(l=n==null?void 0:n.attributes)!=null&&l.textContent?a=n.attributes.textContent:n.value&&(a=n.value);else return;if(a!==null&&e.push({str:a}),!!n.children)for(const h of n.children)i(h)}return i(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const om=65536,lm=100,hm=5e3,cm=le?_g:yg,dm=le?Eg:Fu,um=le?wg:vg,fm=le?Sg:Hu;function pm(c={}){typeof c=="string"||c instanceof URL?c={url:c}:(c instanceof ArrayBuffer||ArrayBuffer.isView(c))&&(c={data:c});const t=new _c,{docId:e}=t,s=c.url?gm(c.url):null,i=c.data?mm(c.data):null,n=c.httpHeaders||null,a=c.withCredentials===!0,o=c.password??null,l=c.range instanceof Zu?c.range:null,h=Number.isInteger(c.rangeChunkSize)&&c.rangeChunkSize>0?c.rangeChunkSize:om;let d=c.worker instanceof mr?c.worker:null;const u=c.verbosity,f=typeof c.docBaseUrl=="string"&&!xh(c.docBaseUrl)?c.docBaseUrl:null,g=typeof c.cMapUrl=="string"?c.cMapUrl:null,A=c.cMapPacked!==!1,y=c.CMapReaderFactory||dm,w=typeof c.standardFontDataUrl=="string"?c.standardFontDataUrl:null,v=c.StandardFontDataFactory||fm,_=c.stopAtErrors!==!0,S=Number.isInteger(c.maxImageSize)&&c.maxImageSize>-1?c.maxImageSize:-1,E=c.isEvalSupported!==!1,C=typeof c.isOffscreenCanvasSupported=="boolean"?c.isOffscreenCanvasSupported:!le,x=typeof c.isChrome=="boolean"?c.isChrome:!fe.platform.isFirefox&&typeof window<"u"&&!!(window!=null&&window.chrome),T=Number.isInteger(c.canvasMaxAreaInBytes)?c.canvasMaxAreaInBytes:-1,P=typeof c.disableFontFace=="boolean"?c.disableFontFace:le,L=c.fontExtraProperties===!0,O=c.enableXfa===!0,F=c.ownerDocument||globalThis.document,J=c.disableRange===!0,U=c.disableStream===!0,z=c.disableAutoFetch===!0,X=c.pdfBug===!0,q=c.CanvasFactory||cm,H=c.FilterFactory||um,$=c.enableHWA===!0,B=l?l.length:c.length??NaN,V=typeof c.useSystemFonts=="boolean"?c.useSystemFonts:!le&&!P,rt=typeof c.useWorkerFetch=="boolean"?c.useWorkerFetch:y===Fu&&v===Hu&&g&&w&&Sa(g,document.baseURI)&&Sa(w,document.baseURI);c.canvasFactory&&Rd("`canvasFactory`-instance option, please use `CanvasFactory` instead."),c.filterFactory&&Rd("`filterFactory`-instance option, please use `FilterFactory` instead.");const M=null;Kp(u);const W={canvasFactory:new q({ownerDocument:F,enableHWA:$}),filterFactory:new H({docId:e,ownerDocument:F}),cMapReaderFactory:rt?null:new y({baseUrl:g,isCompressed:A}),standardFontDataFactory:rt?null:new v({baseUrl:w})};if(!d){const dt={verbosity:u,port:ii.workerPort};d=dt.port?mr.fromPort(dt):new mr(dt),t._worker=d}const lt={docId:e,apiVersion:"4.8.69",data:i,password:o,disableAutoFetch:z,rangeChunkSize:h,length:B,docBaseUrl:f,enableXfa:O,evaluatorOptions:{maxImageSize:S,disableFontFace:P,ignoreErrors:_,isEvalSupported:E,isOffscreenCanvasSupported:C,isChrome:x,canvasMaxAreaInBytes:T,fontExtraProperties:L,useSystemFonts:V,cMapUrl:rt?g:null,standardFontDataUrl:rt?w:null}},gt={disableFontFace:P,fontExtraProperties:L,ownerDocument:F,pdfBug:X,styleElement:M,loadingParams:{disableAutoFetch:z,enableXfa:O}};return d.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const dt=d.messageHandler.sendWithPromise("GetDocRequest",lt,i?[i.buffer]:null);let nt;if(l)nt=new $g(l,{disableRange:J,disableStream:U});else if(!i){if(!s)throw new Error("getDocument - no `url` parameter provided.");let me;le?me=typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype&&Sa(s)?jd:tm:me=Sa(s)?jd:Yg,nt=new me({url:s,length:B,httpHeaders:n,withCredentials:a,rangeChunkSize:h,disableRange:J,disableStream:U})}return dt.then(me=>{if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const be=new La(e,me,d.port),_t=new vm(be,t,nt,gt,W);t._transport=_t,be.send("Ready",null)})}).catch(t._capability.reject),t}function gm(c){if(c instanceof URL)return c.href;try{return new URL(c,window.location).href}catch{if(le&&typeof c=="string")return c}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function mm(c){if(le&&typeof Buffer<"u"&&c instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(c instanceof Uint8Array&&c.byteLength===c.buffer.byteLength)return c;if(typeof c=="string")return Eh(c);if(c instanceof ArrayBuffer||ArrayBuffer.isView(c)||typeof c=="object"&&!isNaN(c==null?void 0:c.length))return new Uint8Array(c);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function $d(c){return typeof c=="object"&&Number.isInteger(c==null?void 0:c.num)&&c.num>=0&&Number.isInteger(c==null?void 0:c.gen)&&c.gen>=0}var ch;const dh=class dh{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${he(dh,ch)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var t,e,s;this.destroyed=!0;try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await((e=this._transport)==null?void 0:e.destroy())}catch(i){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,i}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};ch=new WeakMap,b(dh,ch,0);let _c=dh,Zu=class{constructor(t,e,s=!1,i=null){this.length=t,this.initialData=e,this.progressiveDone=s,this.contentDispositionFilename=i,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const s of this._rangeListeners)s(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(const s of this._progressListeners)s(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){wt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class bm{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return ot(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Ti,js,Ge,dr,kl;class Am{constructor(t,e,s,i=!1){b(this,Ge);b(this,Ti,null);b(this,js,!1);this._pageIndex=t,this._pageInfo=e,this._transport=s,this._stats=i?new Td:null,this._pdfBug=i,this.commonObjs=s.commonObjs,this.objs=new tf,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:n=!1}={}){return new al({viewBox:this.view,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}getAnnotations({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return ot(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return((t=this._transport._htmlForXfa)==null?void 0:t.children[this._pageIndex])||null}render({canvasContext:t,viewport:e,intent:s="display",annotationMode:i=di.ENABLE,transform:n=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:h=null,printAnnotationStorage:d=null,isEditing:u=!1}){var E,C;(E=this._stats)==null||E.time("Overall");const f=this._transport.getRenderingIntent(s,i,d,u),{renderingIntent:g,cacheKey:A}=f;p(this,js,!1),m(this,Ge,kl).call(this),o||(o=this._transport.getOptionalContentConfig(g));let y=this._intentStates.get(A);y||(y=Object.create(null),this._intentStates.set(A,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);const w=!!(g&Fe.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(C=this._stats)==null||C.time("Page Request"),this._pumpOperatorList(f));const v=x=>{var T;y.renderTasks.delete(_),(this._maybeCleanupAfterRender||w)&&p(this,js,!0),m(this,Ge,dr).call(this,!w),x?(_.capability.reject(x),this._abortOperatorList({intentState:y,reason:x instanceof Error?x:new Error(x)})):_.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(T=globalThis.Stats)!=null&&T.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},_=new Sc({callback:v,params:{canvasContext:t,viewport:e,transform:n,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!w,pdfBug:this._pdfBug,pageColors:h});(y.renderTasks||(y.renderTasks=new Set)).add(_);const S=_.task;return Promise.all([y.displayReadyCapability.promise,o]).then(([x,T])=>{var P;if(this.destroyed){v();return}if((P=this._stats)==null||P.time("Rendering"),!(T.renderingIntent&g))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");_.initializeGraphics({transparency:x,optionalContentConfig:T}),_.operatorListChanged()}).catch(v),S}getOperatorList({intent:t="display",annotationMode:e=di.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){var h;function n(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(t,e,s,i,!0);let o=this._intentStates.get(a.cacheKey);o||(o=Object.create(null),this._intentStates.set(a.cacheKey,o));let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=n,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(i){return i.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>Ga.textContent(s));const e=this.streamTextContent(t);return new Promise(function(s,i){function n(){a.read().then(function({value:l,done:h}){if(h){s(o);return}o.lang??(o.lang=l.lang),Object.assign(o.styles,l.styles),o.items.push(...l.items),n()},i)}const a=e.getReader(),o={items:[],styles:Object.create(null),lang:null};n()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const s of e.renderTasks)t.push(s.completed),s.cancel();return this.objs.clear(),p(this,js,!1),m(this,Ge,kl).call(this),Promise.all(t)}cleanup(t=!1){p(this,js,!0);const e=m(this,Ge,dr).call(this,!1);return t&&e&&this._stats&&(this._stats=new Td),e}_startRenderPage(t,e){var i,n;const s=this._intentStates.get(e);s&&((i=this._stats)==null||i.timeEnd("Page Request"),(n=s.displayReadyCapability)==null||n.resolve(t))}_renderPageChunk(t,e){for(let s=0,i=t.length;s{l.read().then(({value:u,done:f})=>{if(f){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(u,h),d())},u=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const f of h.renderTasks)f.operatorListChanged();m(this,Ge,dr).call(this,!0)}if(h.displayReadyCapability)h.displayReadyCapability.reject(u);else if(h.opListReadCapability)h.opListReadCapability.reject(u);else throw u}})};d()}_abortOperatorList({intentState:t,reason:e,force:s=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!s){if(t.renderTasks.size>0)return;if(e instanceof dd){let i=lm;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new er(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[i,n]of this._intentStates)if(n===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}}Ti=new WeakMap,js=new WeakMap,Ge=new WeakSet,dr=function(t=!1){if(m(this,Ge,kl).call(this),!r(this,js)||this.destroyed)return!1;if(t)return p(this,Ti,setTimeout(()=>{p(this,Ti,null),m(this,Ge,dr).call(this,!1)},hm)),!1;for(const{renderTasks:e,operatorList:s}of this._intentStates.values())if(e.size>0||!s.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),p(this,js,!1),!0},kl=function(){r(this,Ti)&&(clearTimeout(r(this,Ti)),p(this,Ti,null))};var $s,uh;class ym{constructor(){b(this,$s,new Map);b(this,uh,Promise.resolve())}postMessage(t,e){const s={data:structuredClone(t,e?{transfer:e}:null)};r(this,uh).then(()=>{for(const[i]of r(this,$s))i.call(this,s)})}addEventListener(t,e,s=null){let i=null;if((s==null?void 0:s.signal)instanceof AbortSignal){const{signal:n}=s;if(n.aborted){st("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(t,e);i=()=>n.removeEventListener("abort",a),n.addEventListener("abort",a)}r(this,$s).set(e,i)}removeEventListener(t,e){const s=r(this,$s).get(e);s==null||s(),r(this,$s).delete(e)}terminate(){for(const[,t]of r(this,$s))t==null||t();r(this,$s).clear()}}$s=new WeakMap,uh=new WeakMap;var fh,En,Sn,zr,Ll,Gr,Ml;const Et=class Et{constructor({name:t=null,port:e=null,verbosity:s=Qp()}={}){b(this,zr);var i;if(this.name=t,this.destroyed=!1,this.verbosity=s,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if((i=r(Et,Sn))!=null&&i.has(e))throw new Error("Cannot use more than one PDFWorker per port.");(r(Et,Sn)||p(Et,Sn,new WeakMap)).set(e,this),this._initializeFromPort(e);return}this._initialize()}get promise(){return le?Promise.all([ji.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new La("main","worker",t),this._messageHandler.on("ready",function(){}),m(this,zr,Ll).call(this)}_initialize(){if(r(Et,En)||r(Et,Gr,Ml)){this._setupFakeWorker();return}let{workerSrc:t}=Et;try{Et._isSameOrigin(window.location.href,t)||(t=Et._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),s=new La("main","worker",e),i=()=>{n.abort(),s.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;e.addEventListener("error",()=>{this._webWorker||i()},{signal:n.signal}),s.on("test",o=>{if(n.abort(),this.destroyed||!o){i();return}this._messageHandler=s,this._port=e,this._webWorker=e,m(this,zr,Ll).call(this)}),s.on("ready",o=>{if(n.abort(),this.destroyed){i();return}try{a()}catch{this._setupFakeWorker()}});const a=()=>{const o=new Uint8Array;s.send("test",o,[o.buffer])};a();return}catch{wh("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){r(Et,En)||(st("Setting up fake worker."),p(Et,En,!0)),Et._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const e=new ym;this._port=e;const s=`fake${he(Et,fh)._++}`,i=new La(s+"_worker",s,e);t.setup(i,e),this._messageHandler=new La(s,s+"_worker",e),m(this,zr,Ll).call(this)}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){var t;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(t=r(Et,Sn))==null||t.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){var s;if(!(t!=null&&t.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const e=(s=r(this,Sn))==null?void 0:s.get(t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new Et(t)}static get workerSrc(){if(ii.workerSrc)return ii.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return ot(this,"_setupFakeWorkerGlobal",(async()=>r(this,Gr,Ml)?r(this,Gr,Ml):(await import(this.workerSrc)).WorkerMessageHandler)())}};fh=new WeakMap,En=new WeakMap,Sn=new WeakMap,zr=new WeakSet,Ll=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},Gr=new WeakSet,Ml=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},b(Et,Gr),b(Et,fh,0),b(Et,En,!1),b(Et,Sn),le&&(p(Et,En,!0),ii.workerSrc||(ii.workerSrc="./pdf.worker.mjs")),Et._isSameOrigin=(t,e)=>{let s;try{if(s=new URL(t),!s.origin||s.origin==="null")return!1}catch{return!1}const i=new URL(e,s);return s.origin===i.origin},Et._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};let mr=Et;var zs,vs,Ur,Wr,ws,xn,Ma;class vm{constructor(t,e,s,i,n){b(this,xn);b(this,zs,new Map);b(this,vs,new Map);b(this,Ur,new Map);b(this,Wr,new Map);b(this,ws,null);this.messageHandler=t,this.loadingTask=e,this.commonObjs=new tf,this.fontLoader=new bg({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return ot(this,"annotationStorage",new gd)}getRenderingIntent(t,e=di.ENABLE,s=null,i=!1,n=!1){let a=Fe.DISPLAY,o=cc;switch(t){case"any":a=Fe.ANY;break;case"display":break;case"print":a=Fe.PRINT;break;default:st(`getRenderingIntent - invalid intent: ${t}`)}const l=a&Fe.PRINT&&s instanceof Lu?s:this.annotationStorage;switch(e){case di.DISABLE:a+=Fe.ANNOTATIONS_DISABLE;break;case di.ENABLE:break;case di.ENABLE_FORMS:a+=Fe.ANNOTATIONS_FORMS;break;case di.ENABLE_STORAGE:a+=Fe.ANNOTATIONS_STORAGE,o=l.serializable;break;default:st(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(a+=Fe.IS_EDITING),n&&(a+=Fe.OPLIST);const{ids:h,hash:d}=l.modifiedIds,u=[a,o.hash,d];return{renderingIntent:a,cacheKey:u.join("_"),annotationStorageSerializable:o,modifiedIds:h}}destroy(){var s;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(s=r(this,ws))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of r(this,vs).values())t.push(i._destroy());r(this,vs).clear(),r(this,Ur).clear(),r(this,Wr).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var i;this.commonObjs.clear(),this.fontLoader.clear(),r(this,zs).clear(),this.filterFactory.destroy(),yc.cleanup(),(i=this._networkStream)==null||i.cancelAllRequests(new er("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(s,i)=>{jt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=n=>{this._lastProgress={loaded:n.loaded,total:n.total}},i.onPull=()=>{this._fullReader.read().then(function({value:n,done:a}){if(a){i.close();return}jt(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{i.error(n)})},i.onCancel=n=>{this._fullReader.cancel(n),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("ReaderHeadersReady",async s=>{var o;await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:a}=this._fullReader;return(!i||!n)&&(this._lastProgress&&((o=e.onProgress)==null||o.call(e,this._lastProgress)),this._fullReader.onProgress=l=>{var h;(h=e.onProgress)==null||h.call(e,{loaded:l.loaded,total:l.total})}),{isStreamingSupported:i,isRangeSupported:n,contentLength:a}}),t.on("GetRangeReader",(s,i)=>{jt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(s.begin,s.end);if(!n){i.close();return}i.onPull=()=>{n.read().then(function({value:a,done:o}){if(o){i.close();return}jt(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{n.cancel(a),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("GetDoc",({pdfInfo:s})=>{this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,e._capability.resolve(new bm(s,this))}),t.on("DocException",function(s){let i;switch(s.name){case"PasswordException":i=new zh(s.message,s.code);break;case"InvalidPDFException":i=new iu(s.message);break;case"MissingPDFException":i=new tr(s.message);break;case"UnexpectedResponseException":i=new _h(s.message,s.status);break;case"UnknownErrorException":i=new Gh(s.message,s.details);break;default:wt("DocException - expected a valid Error.")}e._capability.reject(i)}),t.on("PasswordRequest",s=>{if(p(this,ws,Promise.withResolvers()),e.onPassword){const i=n=>{n instanceof Error?r(this,ws).reject(n):r(this,ws).resolve({password:n})};try{e.onPassword(i,s.code)}catch(n){r(this,ws).reject(n)}}else r(this,ws).reject(new zh(s.message,s.code));return r(this,ws).promise}),t.on("DataLoaded",s=>{var i;(i=e.onProgress)==null||i.call(e,{loaded:s.length,total:s.length}),this.downloadInfoCapability.resolve(s)}),t.on("StartRenderPage",s=>{if(this.destroyed)return;r(this,vs).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),t.on("commonobj",([s,i,n])=>{var a;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":const{disableFontFace:o,fontExtraProperties:l,pdfBug:h}=this._params;if("error"in n){const g=n.error;st(`Error during font loading: ${g}`),this.commonObjs.resolve(s,g);break}const d=h&&((a=globalThis.FontInspector)!=null&&a.enabled)?(g,A)=>globalThis.FontInspector.fontAdded(g,A):null,u=new Ag(n,{disableFontFace:o,inspectFont:d});this.fontLoader.bind(u).catch(()=>t.sendWithPromise("FontFallback",{id:s})).finally(()=>{!l&&u.data&&(u.data=null),this.commonObjs.resolve(s,u)});break;case"CopyLocalImage":const{imageRef:f}=n;jt(f,"The imageRef must be defined.");for(const g of r(this,vs).values())for(const[,A]of g.objs)if((A==null?void 0:A.ref)===f)return A.dataLen?(this.commonObjs.resolve(s,structuredClone(A)),A.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,n);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([s,i,n,a])=>{var l;if(this.destroyed)return;const o=r(this,vs).get(i);if(!o.objs.has(s)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(n){case"Image":o.objs.resolve(s,a),(a==null?void 0:a.dataLen)>Vp&&(o._maybeCleanupAfterRender=!0);break;case"Pattern":o.objs.resolve(s,a);break;default:throw new Error(`Got unknown object type ${n}`)}}}),t.on("DocProgress",s=>{var i;this.destroyed||(i=e.onProgress)==null||i.call(e,{loaded:s.loaded,total:s.total})}),t.on("FetchBuiltInCMap",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(s)}),t.on("FetchStandardFontData",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(s)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var s;this.annotationStorage.size<=0&&st("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:((s=this._fullReader)==null?void 0:s.filename)??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,s=r(this,Ur).get(e);if(s)return s;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&r(this,Wr).set(n.refStr,t);const a=new Am(e,n,this,this._params.pdfBug);return r(this,vs).set(e,a),a});return r(this,Ur).set(e,i),i}getPageIndex(t){return $d(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return m(this,xn,Ma).call(this,"GetFieldObjects")}hasJSActions(){return m(this,xn,Ma).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return m(this,xn,Ma).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return m(this,xn,Ma).call(this,"GetOptionalContentConfig").then(e=>new jg(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=r(this,zs).get(t);if(e)return e;const s=this.messageHandler.sendWithPromise(t,null).then(i=>{var n,a;return{info:i[0],metadata:i[1]?new Hg(i[1]):null,contentDispositionFilename:((n=this._fullReader)==null?void 0:n.filename)??null,contentLength:((a=this._fullReader)==null?void 0:a.contentLength)??null}});return r(this,zs).set(t,s),s}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of r(this,vs).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),r(this,zs).clear(),this.filterFactory.destroy(!0),yc.cleanup()}}cachedPageNumber(t){if(!$d(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return r(this,Wr).get(e)??null}}zs=new WeakMap,vs=new WeakMap,Ur=new WeakMap,Wr=new WeakMap,ws=new WeakMap,xn=new WeakSet,Ma=function(t,e=null){const s=r(this,zs).get(t);if(s)return s;const i=this.messageHandler.sendWithPromise(t,e);return r(this,zs).set(t,i),i};const bl=Symbol("INITIAL_DATA");var ts,To,Ec;class tf{constructor(){b(this,To);b(this,ts,Object.create(null))}get(t,e=null){if(e){const i=m(this,To,Ec).call(this,t);return i.promise.then(()=>e(i.data)),null}const s=r(this,ts)[t];if(!s||s.data===bl)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=r(this,ts)[t];return!!e&&e.data!==bl}resolve(t,e=null){const s=m(this,To,Ec).call(this,t);s.data=e,s.resolve()}clear(){var t;for(const e in r(this,ts)){const{data:s}=r(this,ts)[e];(t=s==null?void 0:s.bitmap)==null||t.close()}p(this,ts,Object.create(null))}*[Symbol.iterator](){for(const t in r(this,ts)){const{data:e}=r(this,ts)[t];e!==bl&&(yield[t,e])}}}ts=new WeakMap,To=new WeakSet,Ec=function(t){var e;return(e=r(this,ts))[t]||(e[t]={...Promise.withResolvers(),data:bl})};var Ri;class wm{constructor(t){b(this,Ri,null);p(this,Ri,t),this.onContinue=null}get promise(){return r(this,Ri).capability.promise}cancel(t=0){r(this,Ri).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=r(this,Ri).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=r(this,Ri);return t.form||t.canvas&&(e==null?void 0:e.size)>0}}Ri=new WeakMap;var Pi,Cn;const Ki=class Ki{constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:d=!1,pdfBug:u=!1,pageColors:f=null}){b(this,Pi,null);this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=u,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new wm(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){var o,l;if(this.cancelled)return;if(this._canvas){if(r(Ki,Cn).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");r(Ki,Cn).add(this._canvas)}this._pdfBug&&((o=globalThis.StepperManager)!=null&&o.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:s,viewport:i,transform:n,background:a}=this.params;this.gfx=new gr(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,viewport:i,transparency:t,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,(l=this.graphicsReadyCallback)==null||l.call(this)}cancel(t=null,e=0){var s;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),r(this,Pi)&&(window.cancelAnimationFrame(r(this,Pi)),p(this,Pi,null)),r(Ki,Cn).delete(this._canvas),this.callback(t||new dd(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){var t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(t=this.stepper)==null||t.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?p(this,Pi,window.requestAnimationFrame(()=>{p(this,Pi,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),r(Ki,Cn).delete(this._canvas),this.callback())))}};Pi=new WeakMap,Cn=new WeakMap,b(Ki,Cn,new WeakSet);let Sc=Ki;const _m="4.8.69",Em="3634dab10";function zd(c){return Math.floor(Math.max(0,Math.min(1,c))*255).toString(16).padStart(2,"0")}function Ea(c){return Math.max(0,Math.min(255,255*c))}class Gd{static CMYK_G([t,e,s,i]){return["G",1-Math.min(1,.3*t+.59*s+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=Ea(t),[t,t,t]}static G_HTML([t]){const e=zd(t);return`#${e}${e}${e}`}static RGB_G([t,e,s]){return["G",.3*t+.59*e+.11*s]}static RGB_rgb(t){return t.map(Ea)}static RGB_HTML(t){return`#${t.map(zd).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,s,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,s+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,s,i]){return[Ea(1-Math.min(1,t+i)),Ea(1-Math.min(1,s+i)),Ea(1-Math.min(1,e+i))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,s]){const i=1-t,n=1-e,a=1-s,o=Math.min(i,n,a);return["CMYK",i,n,a,o]}}class Sm{create(t,e,s=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){wt("Abstract method `_createSVG` called.")}}class vd extends Sm{_createSVG(t){return document.createElementNS(ks,t)}}class ef{static setupStorage(t,e,s,i,n){const a=i.getValue(e,{value:null});switch(s.name){case"textarea":if(a.value!==null&&(t.textContent=a.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(a.value===s.attributes.xfaOn?t.setAttribute("checked",!0):a.value===s.attributes.xfaOff&&t.removeAttribute("checked"),n==="print")break;t.addEventListener("change",o=>{i.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&t.setAttribute("value",a.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})})}break;case"select":if(a.value!==null){t.setAttribute("value",a.value);for(const o of s.children)o.attributes.value===a.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{const l=o.target.options,h=l.selectedIndex===-1?"":l[l.selectedIndex].value;i.setValue(e,{value:h})});break}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:n}){const{attributes:a}=e,o=t instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(const[l,h]of Object.entries(a))if(h!=null)switch(l){case"class":h.length&&t.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!o||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,h)}o&&n.addLinkAttributes(t,a.href,a.newWindow),s&&a.dataId&&this.setupStorage(t,a.dataId,e,s)}static render(t){var u,f;const e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,n=t.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:n,linkService:s});const o=n!=="richText",l=t.div;if(l.append(a),t.viewport){const g=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=g}o&&l.setAttribute("class","xfaLayer xfaFont");const h=[];if(i.children.length===0){if(i.value){const g=document.createTextNode(i.value);a.append(g),o&&Ga.shouldBuildText(i.name)&&h.push(g)}return{textDivs:h}}const d=[[i,-1,a]];for(;d.length>0;){const[g,A,y]=d.at(-1);if(A+1===g.children.length){d.pop();continue}const w=g.children[++d.at(-1)[1]];if(w===null)continue;const{name:v}=w;if(v==="#text"){const S=document.createTextNode(w.value);h.push(S),y.append(S);continue}const _=(u=w==null?void 0:w.attributes)!=null&&u.xmlns?document.createElementNS(w.attributes.xmlns,v):document.createElement(v);if(y.append(_),w.attributes&&this.setAttributes({html:_,element:w,storage:e,intent:n,linkService:s}),((f=w.children)==null?void 0:f.length)>0)d.push([w,-1,_]);else if(w.value){const S=document.createTextNode(w.value);o&&Ga.shouldBuildText(v)&&h.push(S),_.append(S)}}for(const g of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))g.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const ll=1e3,xm=9,Kn=new WeakSet;function ni(c){return{width:c[2]-c[0],height:c[3]-c[1]}}class Cm{static create(t){switch(t.data.annotationType){case Ot.LINK:return new sf(t);case Ot.TEXT:return new Tm(t);case Ot.WIDGET:switch(t.data.fieldType){case"Tx":return new Rm(t);case"Btn":return t.data.radioButton?new af(t):t.data.checkBox?new km(t):new Lm(t);case"Ch":return new Mm(t);case"Sig":return new Pm(t)}return new sr(t);case Ot.POPUP:return new Cc(t);case Ot.FREETEXT:return new df(t);case Ot.LINE:return new Fm(t);case Ot.SQUARE:return new Dm(t);case Ot.CIRCLE:return new Om(t);case Ot.POLYLINE:return new uf(t);case Ot.CARET:return new Hm(t);case Ot.INK:return new wd(t);case Ot.POLYGON:return new Nm(t);case Ot.HIGHLIGHT:return new ff(t);case Ot.UNDERLINE:return new Bm(t);case Ot.SQUIGGLY:return new jm(t);case Ot.STRIKEOUT:return new $m(t);case Ot.STAMP:return new pf(t);case Ot.FILEATTACHMENT:return new zm(t);default:return new Lt(t)}}}var Tn,Vr,qr,Ro,xc;const Sd=class Sd{constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){b(this,Ro);b(this,Tn,null);b(this,Vr,!1);b(this,qr,null);this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(s)),i&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:e,richText:s}){return!!(t!=null&&t.str||e!=null&&e.str||s!=null&&s.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Sd._hasPopupData(this.data)}updateEdited(t){var s;if(!this.container)return;r(this,Tn)||p(this,Tn,{rect:this.data.rect.slice(0)});const{rect:e}=t;e&&m(this,Ro,xc).call(this,e),(s=r(this,qr))==null||s.popup.updateEdited(t)}resetEdited(){var t;r(this,Tn)&&(m(this,Ro,xc).call(this,r(this,Tn).rect),(t=r(this,qr))==null||t.popup.resetEdited(),p(this,Tn,null))}_createContainer(t){const{data:e,parent:{page:s,viewport:i}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),this instanceof sr||(n.tabIndex=ll);const{style:a}=n;if(a.zIndex=this.parent.zIndex++,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof Cc){const{rotation:y}=e;return!e.hasOwnCanvas&&y!==0&&this.setRotation(y,n),n}const{width:o,height:l}=ni(e.rect);if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;const y=e.borderStyle.horizontalCornerRadius,w=e.borderStyle.verticalCornerRadius;if(y>0||w>0){const _=`calc(${y}px * var(--scale-factor)) / calc(${w}px * var(--scale-factor))`;a.borderRadius=_}else if(this instanceof af){const _=`calc(${o}px * var(--scale-factor)) / calc(${l}px * var(--scale-factor))`;a.borderRadius=_}switch(e.borderStyle.style){case wa.SOLID:a.borderStyle="solid";break;case wa.DASHED:a.borderStyle="dashed";break;case wa.BEVELED:st("Unimplemented border style: beveled");break;case wa.INSET:st("Unimplemented border style: inset");break;case wa.UNDERLINE:a.borderBottomStyle="solid";break}const v=e.borderColor||null;v?(p(this,Vr,!0),a.borderColor=j.makeHexColor(v[0]|0,v[1]|0,v[2]|0)):a.borderWidth=0}const h=j.normalizeRect([e.rect[0],s.view[3]-e.rect[1]+s.view[1],e.rect[2],s.view[3]-e.rect[3]+s.view[1]]),{pageWidth:d,pageHeight:u,pageX:f,pageY:g}=i.rawDims;a.left=`${100*(h[0]-f)/d}%`,a.top=`${100*(h[1]-g)/u}%`;const{rotation:A}=e;return e.hasOwnCanvas||A===0?(a.width=`${100*o/d}%`,a.height=`${100*l/u}%`):this.setRotation(A,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims,{width:n,height:a}=ni(this.data.rect);let o,l;t%180===0?(o=100*n/s,l=100*a/i):(o=100*a/s,l=100*n/i),e.style.width=`${o}%`,e.style.height=`${l}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,s,i)=>{const n=i.detail[e],a=n[0],o=n.slice(1);i.target.style[s]=Gd[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[s]:Gd[`${a}_rgb`](o)})};return ot(this,"_commonActions",{display:e=>{const{display:s}=e.detail,i=s%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:s===1||s===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:s}=e.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{const s=e.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(t,e){const s=this._commonActions;for(const i of Object.keys(e.detail)){const n=t[i]||s[i];n==null||n(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const s=this._commonActions;for(const[i,n]of Object.entries(e)){const a=s[i];if(a){const o={detail:{[i]:n},target:t};a(o),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,s,i,n]=this.data.rect.map(y=>Math.fround(y));if(t.length===8){const[y,w,v,_]=t.subarray(2,6);if(i===y&&n===w&&e===v&&s===_)return}const{style:a}=this.container;let o;if(r(this,Vr)){const{borderColor:y,borderWidth:w}=a;a.borderWidth=0,o=["url('data:image/svg+xml;utf8,",'',``],this.container.classList.add("hasBorder")}const l=i-e,h=n-s,{svgFactory:d}=this,u=d.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0);const f=d.createElement("defs");u.append(f);const g=d.createElement("clipPath"),A=`clippath_${this.data.id}`;g.setAttribute("id",A),g.setAttribute("clipPathUnits","objectBoundingBox"),f.append(g);for(let y=2,w=t.length;y`)}r(this,Vr)&&(o.push("')"),a.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath=`url(#${A})`}_createPopup(){const{data:t}=this,e=p(this,qr,new Cc({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(e.render())}render(){wt("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects[t];if(i)for(const{page:n,id:a,exportValues:o}of i){if(n===-1||a===e)continue;const l=typeof o=="string"?o:null,h=document.querySelector(`[data-element-id="${a}"]`);if(h&&!Kn.has(h)){st(`_getElementsByName - element not allowed: ${a}`);continue}s.push({id:a,exportValue:l,domElement:h})}return s}for(const i of document.getElementsByName(t)){const{exportValue:n}=i,a=i.getAttribute("data-element-id");a!==e&&Kn.has(i)&&s.push({id:a,exportValue:n,domElement:i})}return s}show(){var t;this.container&&(this.container.hidden=!1),(t=this.popup)==null||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),(t=this.popup)==null||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})})}};Tn=new WeakMap,Vr=new WeakMap,qr=new WeakMap,Ro=new WeakSet,xc=function(t){const{container:{style:e},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}}}=this;s==null||s.splice(0,4,...t);const{width:h,height:d}=ni(t);e.left=`${100*(t[0]-o)/n}%`,e.top=`${100*(a-t[3]+l)/a}%`,i===0?(e.width=`${100*h/n}%`,e.height=`${100*d/a}%`):this.setRotation(i)};let Lt=Sd;var De,Wi,nf,rf;class sf extends Lt{constructor(e,s=null){super(e,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});b(this,De);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:s}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let n=!1;return e.url?(s.addLinkAttributes(i,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(i,e.action),n=!0):e.attachment?(m(this,De,nf).call(this,i,e.attachment,e.attachmentDest),n=!0):e.setOCGState?(m(this,De,rf).call(this,i,e.setOCGState),n=!0):e.dest?(this._bindLink(i,e.dest),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),n=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}_bindLink(e,s){e.href=this.linkService.getDestinationHash(s),e.onclick=()=>(s&&this.linkService.goToDestination(s),!1),(s||s==="")&&m(this,De,Wi).call(this)}_bindNamedAction(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(s),!1),m(this,De,Wi).call(this)}_bindJSAction(e,s){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(s.actions)){const a=i.get(n);a&&(e[a]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s.id,name:n}}),!1})}e.onclick||(e.onclick=()=>!1),m(this,De,Wi).call(this)}_bindResetFormAction(e,s){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),m(this,De,Wi).call(this),!this._fieldObjects){st('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(e.onclick=()=>!1);return}e.onclick=()=>{var u;i==null||i();const{fields:n,refs:a,include:o}=s,l=[];if(n.length!==0||a.length!==0){const f=new Set(a);for(const g of n){const A=this._fieldObjects[g]||[];for(const{id:y}of A)f.add(y)}for(const g of Object.values(this._fieldObjects))for(const A of g)f.has(A.id)===o&&l.push(A)}else for(const f of Object.values(this._fieldObjects))l.push(...f);const h=this.annotationStorage,d=[];for(const f of l){const{id:g}=f;switch(d.push(g),f.type){case"text":{const y=f.defaultValue||"";h.setValue(g,{value:y});break}case"checkbox":case"radiobutton":{const y=f.defaultValue===f.exportValues;h.setValue(g,{value:y});break}case"combobox":case"listbox":{const y=f.defaultValue||"";h.setValue(g,{value:y});break}default:continue}const A=document.querySelector(`[data-element-id="${g}"]`);if(A){if(!Kn.has(A)){st(`_bindResetFormAction - element not allowed: ${g}`);continue}}else continue;A.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}De=new WeakSet,Wi=function(){this.container.setAttribute("data-internal-link","")},nf=function(e,s,i=null){e.href=this.linkService.getAnchorUrl(""),s.description&&(e.title=s.description),e.onclick=()=>{var n;return(n=this.downloadManager)==null||n.openOrDownloadData(s.content,s.filename,i),!1},m(this,De,Wi).call(this)},rf=function(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(s),!1),m(this,De,Wi).call(this)};class Tm extends Lt{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class sr extends Lt{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&(((e=t.previousSibling)==null?void 0:e.nodeName)==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return fe.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,i,n){s.includes("mouse")?t.addEventListener(s,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):t.addEventListener(s,a=>{var o;if(s==="blur"){if(!e.focused||!a.relatedTarget)return;e.focused=!1}else if(s==="focus"){if(e.focused)return;e.focused=!0}n&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a)}}))})}_setEventListeners(t,e,s,i){var n,a,o;for(const[l,h]of s)(h==="Action"||(n=this.data.actions)!=null&&n[h])&&((h==="Focus"||h==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,l,h,i),h==="Focus"&&!((a=this.data.actions)!=null&&a.Blur)?this._setEventListener(t,e,"blur","Blur",null):h==="Blur"&&!((o=this.data.actions)!=null&&o.Focus)&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":j.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||xm,n=t.style;let a;const o=2,l=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o),d=Math.round(h/(Ih*i))||1,u=h/d;a=Math.min(i,l(u/Ih))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(i,l(h/Ih))}n.fontSize=`calc(${a}px * var(--scale-factor))`,n.color=j.makeHexColor(s[0],s[1],s[2]),this.data.textAlignment!==null&&(n.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Rm extends sr{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,s,i){const n=this.annotationStorage;for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=s),n.setValue(a.id,{[i]:s})}render(){var i,n;const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const a=t.getValue(e,{value:this.data.fieldValue});let o=a.value||"";const l=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let h=a.formattedValue||((i=this.data.textContent)==null?void 0:i.join(` +`))||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const d={userValue:o,formattedValue:h,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=h??o,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type="text",s.setAttribute("value",h??o),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),Kn.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=ll,this._setRequired(s,this.data.required),l&&(s.maxLength=l),s.addEventListener("input",f=>{t.setValue(e,{value:f.target.value}),this.setPropertyOnSiblings(s,"value",f.target.value,"value"),d.formattedValue=null}),s.addEventListener("resetform",f=>{const g=this.data.defaultFieldValue??"";s.value=d.userValue=g,d.formattedValue=null});let u=f=>{const{formattedValue:g}=d;g!=null&&(f.target.value=g),f.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",g=>{var y;if(d.focused)return;const{target:A}=g;d.userValue&&(A.value=d.userValue),d.lastCommittedValue=A.value,d.commitKey=1,(y=this.data.actions)!=null&&y.Focus||(d.focused=!0)}),s.addEventListener("updatefromsandbox",g=>{this.showElementAndHideCanvas(g.target);const A={value(y){d.userValue=y.detail.value??"",t.setValue(e,{value:d.userValue.toString()}),y.target.value=d.userValue},formattedValue(y){const{formattedValue:w}=y.detail;d.formattedValue=w,w!=null&&y.target!==document.activeElement&&(y.target.value=w),t.setValue(e,{formattedValue:w})},selRange(y){y.target.setSelectionRange(...y.detail.selRange)},charLimit:y=>{var S;const{charLimit:w}=y.detail,{target:v}=y;if(w===0){v.removeAttribute("maxLength");return}v.setAttribute("maxLength",w);let _=d.userValue;!_||_.length<=w||(_=_.slice(0,w),v.value=d.userValue=_,t.setValue(e,{value:_}),(S=this.linkService.eventBus)==null||S.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,willCommit:!0,commitKey:1,selStart:v.selectionStart,selEnd:v.selectionEnd}}))}};this._dispatchEventFromSandbox(A,g)}),s.addEventListener("keydown",g=>{var w;d.commitKey=1;let A=-1;if(g.key==="Escape"?A=0:g.key==="Enter"&&!this.data.multiLine?A=2:g.key==="Tab"&&(d.commitKey=3),A===-1)return;const{value:y}=g.target;d.lastCommittedValue!==y&&(d.lastCommittedValue=y,d.userValue=y,(w=this.linkService.eventBus)==null||w.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:y,willCommit:!0,commitKey:A,selStart:g.target.selectionStart,selEnd:g.target.selectionEnd}}))});const f=u;u=null,s.addEventListener("blur",g=>{var y,w;if(!d.focused||!g.relatedTarget)return;(y=this.data.actions)!=null&&y.Blur||(d.focused=!1);const{value:A}=g.target;d.userValue=A,d.lastCommittedValue!==A&&((w=this.linkService.eventBus)==null||w.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:A,willCommit:!0,commitKey:d.commitKey,selStart:g.target.selectionStart,selEnd:g.target.selectionEnd}})),f(g)}),(n=this.data.actions)!=null&&n.Keystroke&&s.addEventListener("beforeinput",g=>{var C;d.lastCommittedValue=null;const{data:A,target:y}=g,{value:w,selectionStart:v,selectionEnd:_}=y;let S=v,E=_;switch(g.inputType){case"deleteWordBackward":{const x=w.substring(0,v).match(/\w*[^\w]*$/);x&&(S-=x[0].length);break}case"deleteWordForward":{const x=w.substring(v).match(/^[^\w]*\w*/);x&&(E+=x[0].length);break}case"deleteContentBackward":v===_&&(S-=1);break;case"deleteContentForward":v===_&&(E+=1);break}g.preventDefault(),(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:w,change:A||"",willCommit:!1,selStart:S,selEnd:E}})}),this._setEventListeners(s,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],g=>g.target.value)}if(u&&s.addEventListener("blur",u),this.data.comb){const g=(this.data.rect[2]-this.data.rect[0])/l;s.classList.add("comb"),s.style.letterSpacing=`calc(${g}px * var(--scale-factor) - 1ch)`}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Pm extends sr{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class km extends sr{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.exportValue===e.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",t.setValue(s,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return Kn.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=ll,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s)){const d=l&&h.exportValue===e.exportValue;h.domElement&&(h.domElement.checked=d),t.setValue(h.id,{value:d})}t.setValue(s,{value:l})}),n.addEventListener("resetform",a=>{const o=e.defaultFieldValue||"Off";a.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",a=>{const o={value(l){l.target.checked=l.detail.value!=="Off",t.setValue(s,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class af extends sr{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.fieldValue===e.buttonValue}).value;if(typeof i=="string"&&(i=i!==e.buttonValue,t.setValue(s,{value:i})),i)for(const a of this._getElementsByName(e.fieldName,s))t.setValue(a.id,{value:!1});const n=document.createElement("input");if(Kn.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.tabIndex=ll,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s))t.setValue(h.id,{value:!1});t.setValue(s,{value:l})}),n.addEventListener("resetform",a=>{const o=e.defaultFieldValue;a.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){const a=e.buttonValue;n.addEventListener("updatefromsandbox",o=>{const l={value:h=>{const d=a===h.detail.value;for(const u of this._getElementsByName(h.target.name)){const f=d&&u.id===s;u.domElement&&(u.domElement.checked=f),t.setValue(u.id,{value:f})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Lm extends sf{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({},s)})),t}}class Mm extends sr{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,s=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");Kn.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=ll;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",d=>{const u=this.data.defaultFieldValue;for(const f of i.options)f.selected=f.value===u});for(const d of this.data.options){const u=document.createElement("option");u.textContent=d.displayValue,u.value=d.exportValue,s.value.includes(d.exportValue)&&(u.setAttribute("selected",!0),n=!1),i.append(u)}let a=null;if(n){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),i.prepend(d),a=()=>{d.remove(),i.removeEventListener("input",a),a=null},i.addEventListener("input",a)}const o=d=>{const u=d?"value":"textContent",{options:f,multiple:g}=i;return g?Array.prototype.filter.call(f,A=>A.selected).map(A=>A[u]):f.selectedIndex===-1?null:f[f.selectedIndex][u]};let l=o(!1);const h=d=>{const u=d.target.options;return Array.prototype.map.call(u,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",d=>{const u={value(f){a==null||a();const g=f.detail.value,A=new Set(Array.isArray(g)?g:[g]);for(const y of i.options)y.selected=A.has(y.value);t.setValue(e,{value:o(!0)}),l=o(!1)},multipleSelection(f){i.multiple=!0},remove(f){const g=i.options,A=f.detail.remove;g[A].selected=!1,i.remove(A),g.length>0&&Array.prototype.findIndex.call(g,w=>w.selected)===-1&&(g[0].selected=!0),t.setValue(e,{value:o(!0),items:h(f)}),l=o(!1)},clear(f){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),l=o(!1)},insert(f){const{index:g,displayValue:A,exportValue:y}=f.detail.insert,w=i.children[g],v=document.createElement("option");v.textContent=A,v.value=y,w?w.before(v):i.append(v),t.setValue(e,{value:o(!0),items:h(f)}),l=o(!1)},items(f){const{items:g}=f.detail;for(;i.length!==0;)i.remove(0);for(const A of g){const{displayValue:y,exportValue:w}=A,v=document.createElement("option");v.textContent=y,v.value=w,i.append(v)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:o(!0),items:h(f)}),l=o(!1)},indices(f){const g=new Set(f.detail.indices);for(const A of f.target.options)A.selected=g.has(A.index);t.setValue(e,{value:o(!0)}),l=o(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(u,d)}),i.addEventListener("input",d=>{var g;const u=o(!0),f=o(!1);t.setValue(e,{value:u}),d.preventDefault(),(g=this.linkService.eventBus)==null||g.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:l,change:f,changeEx:u,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):i.addEventListener("input",function(d){t.setValue(e,{value:o(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Cc extends Lt{constructor(t){const{data:e,elements:s}=t;super(t,{isRenderable:Lt._hasPopupData(e)}),this.elements=s,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new Im({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),e=[];for(const s of this.elements)s.popup=t,s.container.ariaHasPopup="dialog",e.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",e.map(s=>`${cd}${s}`).join(",")),this.container}}var Xr,ph,gh,Yr,Rn,Rt,Gs,Kr,Po,ko,Qr,Us,es,Ws,Lo,Vs,Mo,Pn,kn,bt,Il,Tc,of,lf,hf,cf,Fl,Dl,Rc;class Im{constructor({container:t,color:e,elements:s,titleObj:i,modificationDate:n,contentsObj:a,richText:o,parent:l,rect:h,parentRect:d,open:u}){b(this,bt);b(this,Xr,m(this,bt,hf).bind(this));b(this,ph,m(this,bt,Rc).bind(this));b(this,gh,m(this,bt,Dl).bind(this));b(this,Yr,m(this,bt,Fl).bind(this));b(this,Rn,null);b(this,Rt,null);b(this,Gs,null);b(this,Kr,null);b(this,Po,null);b(this,ko,null);b(this,Qr,null);b(this,Us,!1);b(this,es,null);b(this,Ws,null);b(this,Lo,null);b(this,Vs,null);b(this,Mo,null);b(this,Pn,null);b(this,kn,!1);var f;p(this,Rt,t),p(this,Mo,i),p(this,Gs,a),p(this,Vs,o),p(this,ko,l),p(this,Rn,e),p(this,Lo,h),p(this,Qr,d),p(this,Po,s),p(this,Kr,fd.toDateObject(n)),this.trigger=s.flatMap(g=>g.getElementsToTriggerPopup());for(const g of this.trigger)g.addEventListener("click",r(this,Yr)),g.addEventListener("mouseenter",r(this,gh)),g.addEventListener("mouseleave",r(this,ph)),g.classList.add("popupTriggerArea");for(const g of s)(f=g.container)==null||f.addEventListener("keydown",r(this,Xr));r(this,Rt).hidden=!0,u&&m(this,bt,Fl).call(this)}render(){if(r(this,es))return;const t=p(this,es,document.createElement("div"));if(t.className="popup",r(this,Rn)){const n=t.style.outlineColor=j.makeHexColor(...r(this,Rn));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`:t.style.backgroundColor=j.makeHexColor(...r(this,Rn).map(o=>Math.floor(.7*(255-o)+o)))}const e=document.createElement("span");e.className="header";const s=document.createElement("h1");if(e.append(s),{dir:s.dir,str:s.textContent}=r(this,Mo),t.append(e),r(this,Kr)){const n=document.createElement("span");n.classList.add("popupDate"),n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:r(this,Kr).valueOf()})),e.append(n)}const i=r(this,bt,Il);if(i)ef.render({xfaHtml:i,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const n=this._formatContents(r(this,Gs));t.append(n)}r(this,Rt).append(t)}_formatContents({str:t,dir:e}){const s=document.createElement("p");s.classList.add("popupContent"),s.dir=e;const i=t.split(/(?:\r\n?|\n)/);for(let n=0,a=i.length;n{a.key==="Enter"&&(n?a.metaKey:a.ctrlKey)&&m(this,Bo,Pc).call(this)}),!s.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return r(this,Ho)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ho=new WeakMap,Bo=new WeakSet,Pc=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var jo,Ln,Mn,$o,Jn,gf,kc,eu;let Gm=(eu=class{constructor({div:t,accessibilityManager:e,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:a,structTreeLayer:o}){b(this,Jn);b(this,jo,null);b(this,Ln,null);b(this,Mn,new Map);b(this,$o,null);this.div=t,p(this,jo,e),p(this,Ln,s),p(this,$o,o||null),this.page=n,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=i}hasEditableAnnotations(){return r(this,Mn).size>0}async render(t){var a;const{annotations:e}=t,s=this.div;Xn(s,this.viewport);const i=new Map,n={data:null,layer:s,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new vd,annotationStorage:t.annotationStorage||new gd,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const o of e){if(o.noHTML)continue;const l=o.annotationType===Ot.POPUP;if(l){const u=i.get(o.id);if(!u)continue;n.elements=u}else{const{width:u,height:f}=ni(o.rect);if(u<=0||f<=0)continue}n.data=o;const h=Cm.create(n);if(!h.isRenderable)continue;if(!l&&o.popupRef){const u=i.get(o.popupRef);u?u.push(h):i.set(o.popupRef,[h])}const d=h.render();o.hidden&&(d.style.visibility="hidden"),await m(this,Jn,gf).call(this,d,o.id),h._isEditable&&(r(this,Mn).set(h.data.id,h),(a=this._annotationEditorUIManager)==null||a.renderAnnotationElement(h))}m(this,Jn,kc).call(this)}update({viewport:t}){const e=this.div;this.viewport=t,Xn(e,{rotation:t.rotation}),m(this,Jn,kc).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(r(this,Mn).values())}getEditableAnnotation(t){return r(this,Mn).get(t)}},jo=new WeakMap,Ln=new WeakMap,Mn=new WeakMap,$o=new WeakMap,Jn=new WeakSet,gf=async function(t,e){var a,o;const s=t.firstChild||t,i=s.id=`${cd}${e}`,n=await((a=r(this,$o))==null?void 0:a.getAriaAttributes(i));if(n)for(const[l,h]of n)s.setAttribute(l,h);this.div.append(t),(o=r(this,jo))==null||o.moveElementInDOM(this.div,t,s,!1)},kc=function(){if(!r(this,Ln))return;const t=this.div;for(const[e,s]of r(this,Ln)){const i=t.querySelector(`[data-annotation-id="${e}"]`);if(!i)continue;s.className="annotationContent";const{firstChild:n}=i;n?n.nodeName==="CANVAS"?n.replaceWith(s):n.classList.contains("annotationContent")?n.after(s):n.before(s):i.append(s)}r(this,Ln).clear()},eu);const Al=/\r\n?|\n/g;var ss,Re,zo,In,Pe,Dt,mf,bf,Af,Ol,ai,Nl,Hl,yf,Mc,vf;const vt=class vt extends pt{constructor(e){super({...e,name:"freeTextEditor"});b(this,Dt);b(this,ss);b(this,Re,"");b(this,zo,`${this.id}-editor`);b(this,In,null);b(this,Pe);p(this,ss,e.color||vt._defaultColor||pt._defaultLineColor),p(this,Pe,e.fontSize||vt._defaultFontSize)}static get _keyboardManager(){const e=vt.prototype,s=a=>a.isEmpty(),i=Yn.TRANSLATE_SMALL,n=Yn.TRANSLATE_BIG;return ot(this,"_keyboardManager",new ol([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:s}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:s}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[n,0],checker:s}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:s}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,n],checker:s}]]))}static initialize(e,s){pt.initialize(e,s);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,s){switch(e){case K.FREETEXT_SIZE:vt._defaultFontSize=s;break;case K.FREETEXT_COLOR:vt._defaultColor=s;break}}updateParams(e,s){switch(e){case K.FREETEXT_SIZE:m(this,Dt,mf).call(this,s);break;case K.FREETEXT_COLOR:m(this,Dt,bf).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[K.FREETEXT_SIZE,vt._defaultFontSize],[K.FREETEXT_COLOR,vt._defaultColor||pt._defaultLineColor]]}get propertiesToUpdate(){return[[K.FREETEXT_SIZE,r(this,Pe)],[K.FREETEXT_COLOR,r(this,ss)]]}_translateEmpty(e,s){this._uiManager.translateSelectedEditors(e,s,!0)}getInitialTranslation(){const e=this.parentScale;return[-vt._internalPadding*e,-(vt._internalPadding+r(this,Pe))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(tt.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),p(this,In,new AbortController);const e=this._uiManager.combinedSignal(r(this,In));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e})}disableEditMode(){var e;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",r(this,zo)),this._isDraggable=!0,(e=r(this,In))==null||e.abort(),p(this,In,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var e;this.width||(this.enableEditMode(),this.editorDiv.focus(),(e=this._initialOptions)!=null&&e.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=r(this,Re),s=p(this,Re,m(this,Dt,Af).call(this).trimEnd());if(e===s)return;const i=n=>{if(p(this,Re,n),!n){this.remove();return}m(this,Dt,Hl).call(this),this._uiManager.rebuild(this),m(this,Dt,Ol).call(this)};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(e)},mustExec:!1}),m(this,Dt,Ol).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){vt._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,s;this.width&&(e=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",r(this,zo)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${r(this,Pe)}px * var(--scale-factor))`,i.color=r(this,ss),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),Kl(this,this.div,["dblclick","keydown"]),this.width){const[n,a]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,h]=this.getInitialTranslation();[l,h]=this.pageTranslationToScreen(l,h);const[d,u]=this.pageDimensions,[f,g]=this.pageTranslation;let A,y;switch(this.rotation){case 0:A=e+(o[0]-f)/d,y=s+this.height-(o[1]-g)/u;break;case 90:A=e+(o[0]-f)/d,y=s-(o[1]-g)/u,[l,h]=[h,-l];break;case 180:A=e-this.width+(o[0]-f)/d,y=s-(o[1]-g)/u,[l,h]=[-l,-h];break;case 270:A=e+(o[0]-f-this.height*u)/d,y=s+(o[1]-g-this.width*d)/u,[l,h]=[-h,l];break}this.setAt(A*n,y*a,l,h)}else this.setAt(e*n,s*a,this.width*n,this.height*a);m(this,Dt,Hl).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var A,y,w;const s=e.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();const n=m(A=vt,ai,Mc).call(A,s.getData("text")||"").replaceAll(Al,` +`);if(!n)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!n.includes(` +`)){o.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:l,startOffset:h}=o,d=[],u=[];if(l.nodeType===Node.TEXT_NODE){const v=l.parentElement;if(u.push(l.nodeValue.slice(h).replaceAll(Al,"")),v!==this.editorDiv){let _=d;for(const S of this.editorDiv.childNodes){if(S===v){_=u;continue}_.push(m(y=vt,ai,Nl).call(y,S))}}d.push(l.nodeValue.slice(0,h).replaceAll(Al,""))}else if(l===this.editorDiv){let v=d,_=0;for(const S of this.editorDiv.childNodes)_++===h&&(v=u),v.push(m(w=vt,ai,Nl).call(w,S))}p(this,Re,`${d.join(` +`)}${n}${u.join(` +`)}`),m(this,Dt,Hl).call(this);const f=new Range;let g=d.reduce((v,_)=>v+_.length,0);for(const{firstChild:v}of this.editorDiv.childNodes)if(v.nodeType===Node.TEXT_NODE){const _=v.nodeValue.length;if(g<=_){f.setStart(v,g),f.setEnd(v,g);break}g-=_}a.removeAllRanges(),a.addRange(f)}get contentDiv(){return this.editorDiv}static async deserialize(e,s,i){var o;let n=null;if(e instanceof df){const{data:{defaultAppearanceData:{fontSize:l,fontColor:h},rect:d,rotation:u,id:f,popupRef:g},textContent:A,textPosition:y,parent:{page:{pageNumber:w}}}=e;if(!A||A.length===0)return null;n=e={annotationType:tt.FREETEXT,color:Array.from(h),fontSize:l,value:A.join(` +`),position:y,pageIndex:w-1,rect:d.slice(0),rotation:u,id:f,deleted:!1,popupRef:g}}const a=await super.deserialize(e,s,i);return p(a,Pe,e.fontSize),p(a,ss,j.makeHexColor(...e.color)),p(a,Re,m(o=vt,ai,Mc).call(o,e.value)),a.annotationElementId=e.id||null,a._initialData=n,a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=vt._internalPadding*this.parentScale,i=this.getRect(s,s),n=pt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:r(this,ss)),a={annotationType:tt.FREETEXT,color:n,fontSize:r(this,Pe),value:m(this,Dt,yf).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?a:this.annotationElementId&&!m(this,Dt,vf).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(e){const s=super.renderAnnotationElement(e);if(this.deleted)return s;const{style:i}=s;i.fontSize=`calc(${r(this,Pe)}px * var(--scale-factor))`,i.color=r(this,ss),s.replaceChildren();for(const a of r(this,Re).split(` +`)){const o=document.createElement("div");o.append(a?document.createTextNode(a):document.createElement("br")),s.append(o)}const n=vt._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(n,n),popupContent:r(this,Re)}),s}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};ss=new WeakMap,Re=new WeakMap,zo=new WeakMap,In=new WeakMap,Pe=new WeakMap,Dt=new WeakSet,mf=function(e){const s=n=>{this.editorDiv.style.fontSize=`calc(${n}px * var(--scale-factor))`,this.translate(0,-(n-r(this,Pe))*this.parentScale),p(this,Pe,n),m(this,Dt,Ol).call(this)},i=r(this,Pe);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},bf=function(e){const s=n=>{p(this,ss,this.editorDiv.style.color=n)},i=r(this,ss);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Af=function(){var i;const e=[];this.editorDiv.normalize();let s=null;for(const n of this.editorDiv.childNodes)(s==null?void 0:s.nodeType)===Node.TEXT_NODE&&n.nodeName==="BR"||(e.push(m(i=vt,ai,Nl).call(i,n)),s=n);return e.join(` +`)},Ol=function(){const[e,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:n,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",n.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=i.width/e,this.height=i.height/s):(this.width=i.height/e,this.height=i.width/s),this.fixAndSetPosition()},ai=new WeakSet,Nl=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Al,"")},Hl=function(){if(this.editorDiv.replaceChildren(),!!r(this,Re))for(const e of r(this,Re).split(` +`)){const s=document.createElement("div");s.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(s)}},yf=function(){return r(this,Re).replaceAll(" "," ")},Mc=function(e){return e.replaceAll(" "," ")},vf=function(e){const{value:s,fontSize:i,color:n,pageIndex:a}=this._initialData;return this._hasBeenMoved||e.value!==s||e.fontSize!==i||e.color.some((o,l)=>o!==n[l])||e.pageIndex!==a},b(vt,ai),Y(vt,"_freeTextDefaultContent",""),Y(vt,"_internalPadding",0),Y(vt,"_defaultColor",null),Y(vt,"_defaultFontSize",10),Y(vt,"_type","freetext"),Y(vt,"_editorType",tt.FREETEXT);let Lc=vt;class wf{toSVGPath(){wt("Abstract method `toSVGPath` must be implemented.")}get box(){wt("Abstract getter `box` must be implemented.")}serialize(t,e){wt("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){wt("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){wt("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}var ke,is,Jr,Zr,_s,it,Fn,Dn,Go,Uo,ta,ea,ki,Wo,mh,bh,$t,Ia,_f,Ef,Sf,xf,Cf,Tf;const Ms=class Ms{constructor({x:t,y:e},s,i,n,a,o=0){b(this,$t);b(this,ke);b(this,is,[]);b(this,Jr);b(this,Zr);b(this,_s,[]);b(this,it,new Float64Array(18));b(this,Fn);b(this,Dn);b(this,Go);b(this,Uo);b(this,ta);b(this,ea);b(this,ki,[]);p(this,ke,s),p(this,ea,n*i),p(this,Zr,a),r(this,it).set([NaN,NaN,NaN,NaN,t,e],6),p(this,Jr,o),p(this,Uo,r(Ms,Wo)*i),p(this,Go,r(Ms,bh)*i),p(this,ta,i),r(this,ki).push(t,e)}isEmpty(){return isNaN(r(this,it)[8])}add({x:t,y:e}){var L;p(this,Fn,t),p(this,Dn,e);const[s,i,n,a]=r(this,ke);let[o,l,h,d]=r(this,it).subarray(8,12);const u=t-h,f=e-d,g=Math.hypot(u,f);if(g=6;i-=6)isNaN(e[i])?s.push(`L${e[i+4]} ${e[i+5]}`):s.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);return m(this,$t,Ef).call(this,s),s.join(" ")}newFreeDrawOutline(t,e,s,i,n,a){return new Rf(t,e,s,i,n,a)}getOutlines(){var u;const t=r(this,_s),e=r(this,is),s=r(this,it),[i,n,a,o]=r(this,ke),l=new Float64Array((((u=r(this,ki))==null?void 0:u.length)??0)+2);for(let f=0,g=l.length-2;f=6;f-=6)for(let g=0;g<6;g+=2){if(isNaN(e[f+g])){h[d]=h[d+1]=NaN,d+=2;continue}h[d]=e[f+g],h[d+1]=e[f+g+1],d+=2}return m(this,$t,Cf).call(this,h,d),this.newFreeDrawOutline(h,l,r(this,ke),r(this,ta),r(this,Jr),r(this,Zr))}};ke=new WeakMap,is=new WeakMap,Jr=new WeakMap,Zr=new WeakMap,_s=new WeakMap,it=new WeakMap,Fn=new WeakMap,Dn=new WeakMap,Go=new WeakMap,Uo=new WeakMap,ta=new WeakMap,ea=new WeakMap,ki=new WeakMap,Wo=new WeakMap,mh=new WeakMap,bh=new WeakMap,$t=new WeakSet,Ia=function(){const t=r(this,it).subarray(4,6),e=r(this,it).subarray(16,18),[s,i,n,a]=r(this,ke);return[(r(this,Fn)+(t[0]-e[0])/2-s)/n,(r(this,Dn)+(t[1]-e[1])/2-i)/a,(r(this,Fn)+(e[0]-t[0])/2-s)/n,(r(this,Dn)+(e[1]-t[1])/2-i)/a]},_f=function(){const[t,e,s,i]=r(this,ke),[n,a,o,l]=m(this,$t,Ia).call(this);return`M${(r(this,it)[2]-t)/s} ${(r(this,it)[3]-e)/i} L${(r(this,it)[4]-t)/s} ${(r(this,it)[5]-e)/i} L${n} ${a} L${o} ${l} L${(r(this,it)[16]-t)/s} ${(r(this,it)[17]-e)/i} L${(r(this,it)[14]-t)/s} ${(r(this,it)[15]-e)/i} Z`},Ef=function(t){const e=r(this,is);t.push(`L${e[4]} ${e[5]} Z`)},Sf=function(t){const[e,s,i,n]=r(this,ke),a=r(this,it).subarray(4,6),o=r(this,it).subarray(16,18),[l,h,d,u]=m(this,$t,Ia).call(this);t.push(`L${(a[0]-e)/i} ${(a[1]-s)/n} L${l} ${h} L${d} ${u} L${(o[0]-e)/i} ${(o[1]-s)/n}`)},xf=function(t){const e=r(this,it),[s,i,n,a]=r(this,ke),[o,l,h,d]=m(this,$t,Ia).call(this),u=new Float64Array(36);return u.set([NaN,NaN,NaN,NaN,(e[2]-s)/n,(e[3]-i)/a,NaN,NaN,NaN,NaN,(e[4]-s)/n,(e[5]-i)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(e[16]-s)/n,(e[17]-i)/a,NaN,NaN,NaN,NaN,(e[14]-s)/n,(e[15]-i)/a],0),this.newFreeDrawOutline(u,t,r(this,ke),r(this,ta),r(this,Jr),r(this,Zr))},Cf=function(t,e){const s=r(this,is);return t.set([NaN,NaN,NaN,NaN,s[4],s[5]],e),e+=6},Tf=function(t,e){const s=r(this,it).subarray(4,6),i=r(this,it).subarray(16,18),[n,a,o,l]=r(this,ke),[h,d,u,f]=m(this,$t,Ia).call(this);return t.set([NaN,NaN,NaN,NaN,(s[0]-n)/o,(s[1]-a)/l,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,u,f,NaN,NaN,NaN,NaN,(i[0]-n)/o,(i[1]-a)/l],e),e+=24},b(Ms,Wo,8),b(Ms,mh,2),b(Ms,bh,r(Ms,Wo)+r(Ms,mh));let Jl=Ms;var sa,On,qs,Vo,Le,qo,kt,Se,Fa,Da,Pf;class Rf extends wf{constructor(e,s,i,n,a,o){super();b(this,Se);b(this,sa);b(this,On,null);b(this,qs);b(this,Vo);b(this,Le);b(this,qo);b(this,kt);p(this,kt,e),p(this,Le,s),p(this,sa,i),p(this,qo,n),p(this,qs,a),p(this,Vo,o),m(this,Se,Pf).call(this,o);const{x:l,y:h,width:d,height:u}=r(this,On);for(let f=0,g=e.length;fe[0]-s[0]||e[1]-s[1]||e[2]-s[2]);const t=[];for(const e of r(this,Li))e[3]?(t.push(...m(this,ge,Ic).call(this,e)),m(this,ge,Lf).call(this,e)):(m(this,ge,Mf).call(this,e),t.push(...m(this,ge,Ic).call(this,e)));return m(this,ge,kf).call(this,t)}}Xo=new WeakMap,Li=new WeakMap,ns=new WeakMap,ge=new WeakSet,kf=function(t){const e=[],s=new Set;for(const a of t){const[o,l,h]=a;e.push([o,l,a],[o,h,a])}e.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=e.length;a0;){const a=s.values().next().value;let[o,l,h,d,u]=a;s.delete(a);let f=o,g=l;for(n=[o,h],i.push(n);;){let A;if(s.has(d))A=d;else if(s.has(u))A=u;else break;s.delete(A),[o,l,h,d,u]=A,f!==o&&(n.push(f,g,o,g===l?l:h),f=o),g=g===l?h:l}n.push(f,g)}return new Um(i,r(this,Xo))},Bl=function(t){const e=r(this,ns);let s=0,i=e.length-1;for(;s<=i;){const n=s+i>>1,a=e[n][0];if(a===t)return n;a=0;i--){const[n,a]=r(this,ns)[i];if(n!==t)break;if(n===t&&a===e){r(this,ns).splice(i,1);return}}},Ic=function(t){const[e,s,i]=t,n=[[e,s,i]],a=m(this,ge,Bl).call(this,i);for(let o=0;o=l){if(g>h)n[d][1]=h;else{if(u===1)return[];n.splice(d,1),d--,u--}continue}n[d][2]=l,g>h&&n.push([e,h,g])}}}return n};var Yo,ia;class Um extends wf{constructor(e,s){super();b(this,Yo);b(this,ia);p(this,ia,e),p(this,Yo,s)}toSVGPath(){const e=[];for(const s of r(this,ia)){let[i,n]=s;e.push(`M${i} ${n}`);for(let a=2;a-1?(p(this,_e,!0),m(this,Z,jl).call(this,e),m(this,Z,qi).call(this)):r(this,Xs)&&(p(this,oa,e.anchorNode),p(this,tl,e.anchorOffset),p(this,el,e.focusNode),p(this,sl,e.focusOffset),m(this,Z,Hc).call(this),m(this,Z,qi).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const e=ht.prototype;return ot(this,"_keyboardManager",new ol([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:r(this,_e)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:r(this,$e),methodOfCreation:r(this,il)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,s){var i;pt.initialize(e,s),ht._defaultColor||(ht._defaultColor=((i=s.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(e,s){switch(e){case K.HIGHLIGHT_DEFAULT_COLOR:ht._defaultColor=s;break;case K.HIGHLIGHT_THICKNESS:ht._defaultThickness=s;break}}translateInPage(e,s){}get toolbarPosition(){return r(this,ha)}updateParams(e,s){switch(e){case K.HIGHLIGHT_COLOR:m(this,Z,Ff).call(this,s);break;case K.HIGHLIGHT_THICKNESS:m(this,Z,Df).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[K.HIGHLIGHT_DEFAULT_COLOR,ht._defaultColor],[K.HIGHLIGHT_THICKNESS,ht._defaultThickness]]}get propertiesToUpdate(){return[[K.HIGHLIGHT_COLOR,this.color||ht._defaultColor],[K.HIGHLIGHT_THICKNESS,r(this,$e)||ht._defaultThickness],[K.HIGHLIGHT_FREE,r(this,_e)]]}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(p(this,la,new Zl({editor:this})),e.addColorPicker(r(this,la))),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(m(this,Z,Oa).call(this))}getBaseTranslation(){return[0,0]}getRect(e,s){return super.getRect(e,s,m(this,Z,Oa).call(this))}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){m(this,Z,Bc).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(m(this,Z,qi).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let s=!1;this.parent&&!e?m(this,Z,Bc).call(this):e&&(m(this,Z,qi).call(this,e),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(e),this.show(this._isVisible),s&&this.select()}rotate(e){var n,a,o;const{drawLayer:s}=this.parent;let i;r(this,_e)?(e=(e-this.rotation+360)%360,i=m(n=ht,Ue,ur).call(n,r(this,os).box,e)):i=m(a=ht,Ue,ur).call(a,this,e),s.rotate(r(this,re),e),s.rotate(r(this,Bt),e),s.updateBox(r(this,re),i),s.updateBox(r(this,Bt),m(o=ht,Ue,ur).call(o,r(this,je).box,e))}render(){if(this.div)return this.div;const e=super.render();r(this,ca)&&(e.setAttribute("aria-label",r(this,ca)),e.setAttribute("role","mark")),r(this,_e)?e.classList.add("free"):this.div.addEventListener("keydown",m(this,Z,Nf).bind(this),{signal:this._uiManager._signal});const s=p(this,Bn,document.createElement("div"));e.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",s.style.clipPath=r(this,Hn);const[i,n]=this.parentDimensions;return this.setDims(this.width*i,this.height*n),Kl(this,r(this,Bn),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent.drawLayer.addClass(r(this,Bt),"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(r(this,Bt),"hovered")}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:m(this,Z,$l).call(this,!0);break;case 1:case 3:m(this,Z,$l).call(this,!1);break}}select(){var e,s;super.select(),r(this,Bt)&&((e=this.parent)==null||e.drawLayer.removeClass(r(this,Bt),"hovered"),(s=this.parent)==null||s.drawLayer.addClass(r(this,Bt),"selected"))}unselect(){var e;super.unselect(),r(this,Bt)&&((e=this.parent)==null||e.drawLayer.removeClass(r(this,Bt),"selected"),r(this,_e)||m(this,Z,$l).call(this,!1))}get _mustFixPosition(){return!r(this,_e)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.show(r(this,re),e),this.parent.drawLayer.show(r(this,Bt),e))}static startHighlighting(e,s,{target:i,x:n,y:a}){const{x:o,y:l,width:h,height:d}=i.getBoundingClientRect(),u=new AbortController,f=e.combinedSignal(u),g=y=>{y.preventDefault(),y.stopPropagation()},A=y=>{u.abort(),m(this,Ue,$f).call(this,e,y)};window.addEventListener("blur",A,{signal:f}),window.addEventListener("pointerup",A,{signal:f}),window.addEventListener("pointerdown",g,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Ve,{signal:f}),i.addEventListener("pointermove",m(this,Ue,jf).bind(this,e),{signal:f}),this._freeHighlight=new Fc({x:n,y:a},[o,l,h,d],e.scale,this._defaultThickness/2,s,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static async deserialize(e,s,i){var y,w,v,_;let n=null;if(e instanceof ff){const{data:{quadPoints:S,rect:E,rotation:C,id:x,color:T,opacity:P,popupRef:L},parent:{page:{pageNumber:O}}}=e;n=e={annotationType:tt.HIGHLIGHT,color:Array.from(T),opacity:P,quadPoints:S,boxes:null,pageIndex:O-1,rect:E.slice(0),rotation:C,id:x,deleted:!1,popupRef:L}}else if(e instanceof wd){const{data:{inkLists:S,rect:E,rotation:C,id:x,color:T,borderStyle:{rawWidth:P},popupRef:L},parent:{page:{pageNumber:O}}}=e;n=e={annotationType:tt.HIGHLIGHT,color:Array.from(T),thickness:P,inkLists:S,boxes:null,pageIndex:O-1,rect:E.slice(0),rotation:C,id:x,deleted:!1,popupRef:L}}const{color:a,quadPoints:o,inkLists:l,opacity:h}=e,d=await super.deserialize(e,s,i);d.color=j.makeHexColor(...a),p(d,Ys,h||1),l&&p(d,$e,e.thickness),d.annotationElementId=e.id||null,d._initialData=n;const[u,f]=d.pageDimensions,[g,A]=d.pageTranslation;if(o){const S=p(d,Xs,[]);for(let E=0;E=0)p(this,re,s),p(this,Hn,i),this.parent.drawLayer.finalizeLine(s,e),p(this,Bt,this.parent.drawLayer.drawOutline(r(this,je)));else if(this.parent){const g=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(r(this,re),e),this.parent.drawLayer.updateBox(r(this,re),m(u=ht,Ue,ur).call(u,r(this,os).box,(g-this.rotation+360)%360)),this.parent.drawLayer.updateLine(r(this,Bt),r(this,je)),this.parent.drawLayer.updateBox(r(this,Bt),m(f=ht,Ue,ur).call(f,r(this,je).box,g))}const{x:a,y:o,width:l,height:h}=e.box;switch(this.rotation){case 0:this.x=a,this.y=o,this.width=l,this.height=h;break;case 90:{const[g,A]=this.parentDimensions;this.x=o,this.y=1-a,this.width=l*A/g,this.height=h*g/A;break}case 180:this.x=1-a,this.y=1-o,this.width=l,this.height=h;break;case 270:{const[g,A]=this.parentDimensions;this.x=1-o,this.y=a,this.width=l*A/g,this.height=h*g/A;break}}const{lastPoint:d}=r(this,je).box;p(this,ha,[(d[0]-a)/l,(d[1]-o)/h])},Ff=function(e){const s=(a,o)=>{var l,h,d;this.color=a,(l=this.parent)==null||l.drawLayer.changeColor(r(this,re),a),(h=r(this,la))==null||h.updateColor(a),p(this,Ys,o),(d=this.parent)==null||d.drawLayer.changeOpacity(r(this,re),o)},i=this.color,n=r(this,Ys);this.addCommands({cmd:s.bind(this,e,ht._defaultOpacity),undo:s.bind(this,i,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)},Df=function(e){const s=r(this,$e),i=n=>{p(this,$e,n),m(this,Z,Of).call(this,n)};this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},Of=function(e){if(!r(this,_e))return;m(this,Z,jl).call(this,{highlightOutlines:r(this,os).getNewOutline(e/2)}),this.fixAndSetPosition();const[s,i]=this.parentDimensions;this.setDims(this.width*s,this.height*i)},Bc=function(){r(this,re)===null||!this.parent||(this.parent.drawLayer.remove(r(this,re)),p(this,re,null),this.parent.drawLayer.remove(r(this,Bt)),p(this,Bt,null))},qi=function(e=this.parent){r(this,re)===null&&({id:he(this,re)._,clipPathId:he(this,Hn)._}=e.drawLayer.draw(r(this,os),this.color,r(this,Ys)),p(this,Bt,e.drawLayer.drawOutline(r(this,je))),r(this,Bn)&&(r(this,Bn).style.clipPath=r(this,Hn)))},Ue=new WeakSet,ur=function({x:e,y:s,width:i,height:n},a){switch(a){case 90:return{x:1-s-n,y:e,width:n,height:i};case 180:return{x:1-e-i,y:1-s-n,width:i,height:n};case 270:return{x:s,y:1-e-i,width:n,height:i}}return{x:e,y:s,width:i,height:n}},Nf=function(e){ht._keyboardManager.exec(this,e)},$l=function(e){if(!r(this,oa))return;const s=window.getSelection();e?s.setPosition(r(this,oa),r(this,tl)):s.setPosition(r(this,el),r(this,sl))},Oa=function(){return r(this,_e)?this.rotation:0},Hf=function(){if(r(this,_e))return null;const[e,s]=this.pageDimensions,[i,n]=this.pageTranslation,a=r(this,Xs),o=new Float32Array(a.length*8);let l=0;for(const{x:h,y:d,width:u,height:f}of a){const g=h*e+i,A=(1-d-f)*s+n;o[l]=o[l+4]=g,o[l+1]=o[l+3]=A,o[l+2]=o[l+6]=g+u*e,o[l+5]=o[l+7]=A+f*s,l+=8}return o},Bf=function(e){return r(this,os).serialize(e,m(this,Z,Oa).call(this))},jf=function(e,s){this._freeHighlight.add(s)&&e.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},$f=function(e,s){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(s,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},zf=function(e){const{color:s}=this._initialData;return e.color.some((i,n)=>i!==s[n])},b(ht,Ue),Y(ht,"_defaultColor",null),Y(ht,"_defaultOpacity",1),Y(ht,"_defaultThickness",12),Y(ht,"_type","highlight"),Y(ht,"_editorType",tt.HIGHLIGHT),Y(ht,"_freeHighlightId",-1),Y(ht,"_freeHighlight",null),Y(ht,"_freeHighlightClipId","");let th=ht;var jn,$n,Es,Ks,ze,zn,Gn,Un,Qs,da,Wn,Vn,Ii,I,Gf,Uf,Wf,Vf,$c,qf,zc,Xf,Yf,Kf,Qf,Jf,Xi,Gc,Uc,Wc,zl,Gl,fr,Vc,Ul,li,Zf,qc,tp,ep,Xc,Wl,Na;const St=class St extends pt{constructor(e){super({...e,name:"inkEditor"});b(this,I);b(this,jn,0);b(this,$n,0);b(this,Es,null);b(this,Ks,new Path2D);b(this,ze,!1);b(this,zn,null);b(this,Gn,!1);b(this,Un,!1);b(this,Qs,null);b(this,da,null);b(this,Wn,0);b(this,Vn,0);b(this,Ii,null);this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(e,s){pt.initialize(e,s)}static updateDefaultParams(e,s){switch(e){case K.INK_THICKNESS:St._defaultThickness=s;break;case K.INK_COLOR:St._defaultColor=s;break;case K.INK_OPACITY:St._defaultOpacity=s/100;break}}updateParams(e,s){switch(e){case K.INK_THICKNESS:m(this,I,Gf).call(this,s);break;case K.INK_COLOR:m(this,I,Uf).call(this,s);break;case K.INK_OPACITY:m(this,I,Wf).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[K.INK_THICKNESS,St._defaultThickness],[K.INK_COLOR,St._defaultColor||pt._defaultLineColor],[K.INK_OPACITY,Math.round(St._defaultOpacity*100)]]}get propertiesToUpdate(){return[[K.INK_THICKNESS,this.thickness||St._defaultThickness],[K.INK_COLOR,this.color||St._defaultColor||pt._defaultLineColor],[K.INK_OPACITY,Math.round(100*(this.opacity??St._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(m(this,I,zl).call(this),m(this,I,Gl).call(this)),this.isAttachedToDOM||(this.parent.add(this),m(this,I,fr).call(this)),m(this,I,Na).call(this)))}remove(){var e;this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,r(this,Es)&&(clearTimeout(r(this,Es)),p(this,Es,null)),(e=r(this,Qs))==null||e.disconnect(),p(this,Qs,null),super.remove())}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&e===null&&this._uiManager.addShouldRescale(this),super.setParent(e)}onScaleChanging(){const[e,s]=this.parentDimensions,i=this.width*e,n=this.height*s;this.setDimensions(i,n)}enableEditMode(){r(this,ze)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,m(this,I,Gc).call(this))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),m(this,I,Uc).call(this))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){r(this,ze)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),p(this,ze,!0),this.div.classList.add("disabled"),m(this,I,Na).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}canvasPointerdown(e){e.button!==0||!this.isInEditMode()||r(this,ze)||(this.setInForeground(),e.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),m(this,I,qf).call(this,e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),m(this,I,zc).call(this,e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),m(this,I,Wc).call(this,e)}canvasPointerleave(e){m(this,I,Wc).call(this,e)}get isResizable(){return!this.isEmpty()&&r(this,ze)}render(){if(this.div)return this.div;let e,s;this.width&&(e=this.x,s=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[i,n,a,o]=m(this,I,Vf).call(this);if(this.setAt(i,n,0,0),this.setDims(a,o),m(this,I,zl).call(this),this.width){const[l,h]=this.parentDimensions;this.setAspectRatio(this.width*l,this.height*h),this.setAt(e*l,s*h,this.width*l,this.height*h),p(this,Un,!0),m(this,I,fr).call(this),this.setDims(this.width*l,this.height*h),m(this,I,Xi).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return m(this,I,Gl).call(this),this.div}setDimensions(e,s){const i=Math.round(e),n=Math.round(s);if(r(this,Wn)===i&&r(this,Vn)===n)return;p(this,Wn,i),p(this,Vn,n),this.canvas.style.visibility="hidden";const[a,o]=this.parentDimensions;this.width=e/a,this.height=s/o,this.fixAndSetPosition(),r(this,ze)&&m(this,I,Vc).call(this,e,s),m(this,I,fr).call(this),m(this,I,Xi).call(this),this.canvas.style.visibility="visible",this.fixDims()}static async deserialize(e,s,i){var w,v,_;if(e instanceof wd)return null;const n=await super.deserialize(e,s,i);n.thickness=e.thickness,n.color=j.makeHexColor(...e.color),n.opacity=e.opacity;const[a,o]=n.pageDimensions,l=n.width*a,h=n.height*o,d=n.parentScale,u=e.thickness/2;p(n,ze,!0),p(n,Wn,Math.round(l)),p(n,Vn,Math.round(h));const{paths:f,rect:g,rotation:A}=e;for(let{bezier:S}of f){S=m(w=St,li,tp).call(w,S,g,A);const E=[];n.paths.push(E);let C=d*(S[0]-u),x=d*(S[1]-u);for(let P=2,L=S.length;P{this.thickness=n,m(this,I,Na).call(this)},i=this.thickness;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},Uf=function(e){const s=n=>{this.color=n,m(this,I,Xi).call(this)},i=this.color;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Wf=function(e){const s=n=>{this.opacity=n,m(this,I,Xi).call(this)};e/=100;const i=this.opacity;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},Vf=function(){const{parentRotation:e,parentDimensions:[s,i]}=this;switch(e){case 90:return[0,i,i,s];case 180:return[s,i,s,i];case 270:return[s,0,i,s];default:return[0,0,s,i]}},$c=function(){const{ctx:e,color:s,opacity:i,thickness:n,parentScale:a,scaleFactor:o}=this;e.lineWidth=n*a/o,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${s}${fg(i)}`},qf=function(e,s){this.canvas.addEventListener("contextmenu",Ve,{signal:this._uiManager._signal}),m(this,I,Uc).call(this),p(this,zn,new AbortController);const i=this._uiManager.combinedSignal(r(this,zn));this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:i}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:i}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:i}),this.isEditing=!0,r(this,Un)||(p(this,Un,!0),m(this,I,fr).call(this),this.thickness||(this.thickness=St._defaultThickness),this.color||(this.color=St._defaultColor||pt._defaultLineColor),this.opacity??(this.opacity=St._defaultOpacity)),this.currentPath.push([e,s]),p(this,Gn,!1),m(this,I,$c).call(this),p(this,Ii,()=>{m(this,I,Kf).call(this),r(this,Ii)&&window.requestAnimationFrame(r(this,Ii))}),window.requestAnimationFrame(r(this,Ii))},zc=function(e,s){const[i,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===i&&s===n)return;const a=this.currentPath;let o=r(this,Ks);if(a.push([e,s]),p(this,Gn,!0),a.length<=2){o.moveTo(...a[0]),o.lineTo(e,s);return}a.length===3&&(p(this,Ks,o=new Path2D),o.moveTo(...a[0])),m(this,I,Qf).call(this,o,...a.at(-3),...a.at(-2),e,s)},Xf=function(){if(this.currentPath.length===0)return;const e=this.currentPath.at(-1);r(this,Ks).lineTo(...e)},Yf=function(e,s){p(this,Ii,null),e=Math.min(Math.max(e,0),this.canvas.width),s=Math.min(Math.max(s,0),this.canvas.height),m(this,I,zc).call(this,e,s),m(this,I,Xf).call(this);let i;if(this.currentPath.length!==1)i=m(this,I,Jf).call(this);else{const h=[e,s];i=[[h,h.slice(),h.slice(),h]]}const n=r(this,Ks),a=this.currentPath;this.currentPath=[],p(this,Ks,new Path2D);const o=()=>{this.allRawPaths.push(a),this.paths.push(i),this.bezierPath2D.push(n),this._uiManager.rebuild(this)},l=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(m(this,I,zl).call(this),m(this,I,Gl).call(this)),m(this,I,Na).call(this))};this.addCommands({cmd:o,undo:l,mustExec:!0})},Kf=function(){if(!r(this,Gn))return;p(this,Gn,!1);const e=Math.ceil(this.thickness*this.parentScale),s=this.currentPath.slice(-3),i=s.map(o=>o[0]),n=s.map(o=>o[1]);Math.min(...i)-e,Math.max(...i)+e,Math.min(...n)-e,Math.max(...n)+e;const{ctx:a}=this;a.save(),a.clearRect(0,0,this.canvas.width,this.canvas.height);for(const o of this.bezierPath2D)a.stroke(o);a.stroke(r(this,Ks)),a.restore()},Qf=function(e,s,i,n,a,o,l){const h=(s+n)/2,d=(i+a)/2,u=(n+o)/2,f=(a+l)/2;e.bezierCurveTo(h+2*(n-h)/3,d+2*(a-d)/3,u+2*(n-u)/3,f+2*(a-f)/3,u,f)},Jf=function(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const s=[];let i,[n,a]=e[0];for(i=1;i{p(this,Es,null),this.canvas.removeEventListener("contextmenu",Ve)},10)),m(this,I,Yf).call(this,e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()},zl=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},Gl=function(){p(this,Qs,new ResizeObserver(e=>{const s=e[0].contentRect;s.width&&s.height&&this.setDimensions(s.width,s.height)})),r(this,Qs).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var e;(e=r(this,Qs))==null||e.disconnect(),p(this,Qs,null)},{once:!0})},fr=function(){if(!r(this,Un))return;const[e,s]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*s),m(this,I,Ul).call(this)},Vc=function(e,s){const i=m(this,I,Wl).call(this),n=(e-i)/r(this,$n),a=(s-i)/r(this,jn);this.scaleFactor=Math.min(n,a)},Ul=function(){const e=m(this,I,Wl).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)},li=new WeakSet,Zf=function(e){const s=new Path2D;for(let i=0,n=e.length;i`image/${s}`))}static get supportedTypesStr(){return ot(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,s){s.pasteEditor(tt.STAMP,{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var e;return{type:"stamp",hasAltText:!!((e=this.altTextData)!=null&&e.altText)}}static computeTelemetryFinalData(e){const s=e.get("hasAltText");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}async mlGuessAltText(e=null,s=!0){if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:a,height:o}=e||this.copyCanvas(null,null,!0).imageData,l=await i.guess({name:"altText",request:{data:n,width:a,height:o,channels:n.length/(a*o)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const h=l.output;return await this.setGuessedAltText(h),s&&!this.hasAltTextData()&&(this.altTextData={alt:h,decorative:!1}),h}remove(){var e,s;r(this,Jt)&&(p(this,Ct,null),this._uiManager.imageManager.deleteId(r(this,Jt)),(e=r(this,Ss))==null||e.remove(),p(this,Ss,null),(s=r(this,Zs))==null||s.disconnect(),p(this,Zs,null),r(this,xs)&&(clearTimeout(r(this,xs)),p(this,xs,null))),super.remove()}rebuild(){if(!this.parent){r(this,Jt)&&m(this,at,Vl).call(this);return}super.rebuild(),this.div!==null&&(r(this,Jt)&&r(this,Ss)===null&&m(this,at,Vl).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(r(this,Fi)||r(this,Ct)||r(this,Js)||r(this,Di)||r(this,Jt))}get isResizable(){return!0}render(){if(this.div)return this.div;let e,s;if(this.width&&(e=this.x,s=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),r(this,Ct)?m(this,at,Kc).call(this):m(this,at,Vl).call(this),this.width&&!this.annotationElementId){const[i,n]=this.parentDimensions;this.setAt(e*i,s*n,this.width*i,this.height*n)}return this.div}copyCanvas(e,s,i=!1){var g;e||(e=224);const{width:n,height:a}=r(this,Ct),o=new Wh;let l=r(this,Ct),h=n,d=a,u=null;if(s){if(n>s||a>s){const P=Math.min(s/n,s/a);h=Math.floor(n*P),d=Math.floor(a*P)}u=document.createElement("canvas");const A=u.width=Math.ceil(h*o.sx),y=u.height=Math.ceil(d*o.sy);r(this,Me)||(l=m(this,at,ql).call(this,A,y));const w=u.getContext("2d");w.filter=this._uiManager.hcmFilter;let v="white",_="#cfcfd8";this._uiManager.hcmFilter!=="none"?_="black":(g=window.matchMedia)!=null&&g.call(window,"(prefers-color-scheme: dark)").matches&&(v="#8f8f9d",_="#42414d");const S=15,E=S*o.sx,C=S*o.sy,x=new OffscreenCanvas(E*2,C*2),T=x.getContext("2d");T.fillStyle=v,T.fillRect(0,0,E*2,C*2),T.fillStyle=_,T.fillRect(0,0,E,C),T.fillRect(E,C,E,C),w.fillStyle=w.createPattern(x,"repeat"),w.fillRect(0,0,A,y),w.drawImage(l,0,0,l.width,l.height,0,0,A,y)}let f=null;if(i){let A,y;if(o.symmetric&&l.widthe||a>e){const _=Math.min(e/n,e/a);A=Math.floor(n*_),y=Math.floor(a*_),r(this,Me)||(l=m(this,at,ql).call(this,A,y))}const v=new OffscreenCanvas(A,y).getContext("2d",{willReadFrequently:!0});v.drawImage(l,0,0,l.width,l.height,0,0,A,y),f={width:A,height:y,data:v.getImageData(0,0,A,y).data}}return{canvas:u,width:h,height:d,imageData:f}}getImageForAltText(){return r(this,Ss)}static async deserialize(e,s,i){var y;let n=null;if(e instanceof pf){const{data:{rect:w,rotation:v,id:_,structParent:S,popupRef:E},container:C,parent:{page:{pageNumber:x}}}=e,T=C.querySelector("canvas"),P=i.imageManager.getFromCanvas(C.id,T);T.remove();const L=((y=await s._structTree.getAriaAttributes(`${cd}${_}`))==null?void 0:y.get("aria-label"))||"";n=e={annotationType:tt.STAMP,bitmapId:P.id,bitmap:P.bitmap,pageIndex:x-1,rect:w.slice(0),rotation:v,id:_,deleted:!1,accessibilityData:{decorative:!1,altText:L},isSvg:!1,structParent:S,popupRef:E}}const a=await super.deserialize(e,s,i),{rect:o,bitmap:l,bitmapUrl:h,bitmapId:d,isSvg:u,accessibilityData:f}=e;d&&i.imageManager.isValidId(d)?(p(a,Jt,d),l&&p(a,Ct,l)):p(a,Js,h),p(a,Me,u);const[g,A]=a.pageDimensions;return a.width=(o[2]-o[0])/g,a.height=(o[3]-o[1])/A,a.annotationElementId=e.id||null,f&&(a.altTextData=f),a._initialData=n,p(a,fa,!!n),a}serialize(e=!1,s=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i={annotationType:tt.STAMP,bitmapId:r(this,Jt),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:r(this,Me),structTreeParentId:this._structTreeParentId};if(e)return i.bitmapUrl=m(this,at,Xl).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i;const{decorative:n,altText:a}=this.serializeAltText(!1);if(!n&&a&&(i.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const l=m(this,at,np).call(this,i);if(l.isSame)return null;l.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1}if(i.id=this.annotationElementId,s===null)return i;s.stamps||(s.stamps=new Map);const o=r(this,Me)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!s.stamps.has(r(this,Jt)))s.stamps.set(r(this,Jt),{area:o,serialized:i}),i.bitmap=m(this,at,Xl).call(this,!1);else if(r(this,Me)){const l=s.stamps.get(r(this,Jt));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=m(this,at,Xl).call(this,!1))}return i}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}};Ct=new WeakMap,Jt=new WeakMap,Fi=new WeakMap,Js=new WeakMap,Di=new WeakMap,ua=new WeakMap,Ss=new WeakMap,Zs=new WeakMap,xs=new WeakMap,Me=new WeakMap,fa=new WeakMap,at=new WeakSet,Ha=function(e,s=!1){if(!e){this.remove();return}p(this,Ct,e.bitmap),s||(p(this,Jt,e.id),p(this,Me,e.isSvg)),e.file&&p(this,ua,e.file.name),m(this,at,Kc).call(this)},Ba=function(){if(p(this,Fi,null),this._uiManager.enableWaiting(!1),!!r(this,Ss)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Ct)){this._editToolbar.hide(),this._uiManager.editAltText(this,!0);return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Ct)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},Vl=function(){if(r(this,Jt)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(r(this,Jt)).then(i=>m(this,at,Ha).call(this,i,!0)).finally(()=>m(this,at,Ba).call(this));return}if(r(this,Js)){const i=r(this,Js);p(this,Js,null),this._uiManager.enableWaiting(!0),p(this,Fi,this._uiManager.imageManager.getFromUrl(i).then(n=>m(this,at,Ha).call(this,n)).finally(()=>m(this,at,Ba).call(this)));return}if(r(this,Di)){const i=r(this,Di);p(this,Di,null),this._uiManager.enableWaiting(!0),p(this,Fi,this._uiManager.imageManager.getFromFile(i).then(n=>m(this,at,Ha).call(this,n)).finally(()=>m(this,at,Ba).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=za.supportedTypesStr;const s=this._uiManager._signal;p(this,Fi,new Promise(i=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const n=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),m(this,at,Ha).call(this,n)}i()},{signal:s}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:s})}).finally(()=>m(this,at,Ba).call(this))),e.click()},Kc=function(){const{div:e}=this;let{width:s,height:i}=r(this,Ct);const[n,a]=this.pageDimensions,o=.75;if(this.width)s=this.width*n,i=this.height*a;else if(s>o*n||i>o*a){const u=Math.min(o*n/s,o*a/i);s*=u,i*=u}const[l,h]=this.parentDimensions;this.setDims(s*l/n,i*h/a),this._uiManager.enableWaiting(!1);const d=p(this,Ss,document.createElement("canvas"));d.setAttribute("role","img"),this.addContainer(d),(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),m(this,at,Qc).call(this,s,i),m(this,at,ip).call(this),r(this,fa)||(this.parent.addUndoableEditor(this),p(this,fa,!0)),this._reportTelemetry({action:"inserted_image"}),r(this,ua)&&d.setAttribute("aria-label",r(this,ua))},sp=function(e,s){var o;const[i,n]=this.parentDimensions;this.width=e/i,this.height=s/n,(o=this._initialOptions)!=null&&o.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,r(this,xs)!==null&&clearTimeout(r(this,xs)),p(this,xs,setTimeout(()=>{p(this,xs,null),m(this,at,Qc).call(this,e,s)},200))},ql=function(e,s){const{width:i,height:n}=r(this,Ct);let a=i,o=n,l=r(this,Ct);for(;a>2*e||o>2*s;){const h=a,d=o;a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*s&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const u=new OffscreenCanvas(a,o);u.getContext("2d").drawImage(l,0,0,h,d,0,0,a,o),l=u.transferToImageBitmap()}return l},Qc=function(e,s){const i=new Wh,n=Math.ceil(e*i.sx),a=Math.ceil(s*i.sy),o=r(this,Ss);if(!o||o.width===n&&o.height===a)return;o.width=n,o.height=a;const l=r(this,Me)?r(this,Ct):m(this,at,ql).call(this,n,a),h=o.getContext("2d");h.filter=this._uiManager.hcmFilter,h.drawImage(l,0,0,l.width,l.height,0,0,n,a)},Xl=function(e){if(e){if(r(this,Me)){const n=this._uiManager.imageManager.getSvgUrl(r(this,Jt));if(n)return n}const s=document.createElement("canvas");return{width:s.width,height:s.height}=r(this,Ct),s.getContext("2d").drawImage(r(this,Ct),0,0),s.toDataURL()}if(r(this,Me)){const[s,i]=this.pageDimensions,n=Math.round(this.width*s*Bi.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*Bi.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(n,a);return o.getContext("2d").drawImage(r(this,Ct),0,0,r(this,Ct).width,r(this,Ct).height,0,0,n,a),o.transferToImageBitmap()}return structuredClone(r(this,Ct))},ip=function(){this._uiManager._signal&&(p(this,Zs,new ResizeObserver(e=>{const s=e[0].contentRect;s.width&&s.height&&m(this,at,sp).call(this,s.width,s.height)})),r(this,Zs).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var e;(e=r(this,Zs))==null||e.disconnect(),p(this,Zs,null)},{once:!0}))},np=function(e){var h;const{rect:s,pageIndex:i,accessibilityData:{altText:n}}=this._initialData,a=e.rect.every((d,u)=>Math.abs(d-s[u])<1),o=e.pageIndex===i,l=(((h=e.accessibilityData)==null?void 0:h.alt)||"")===n;return{isSame:a&&o&&l,isSameAltText:l}},Y(za,"_type","stamp"),Y(za,"_editorType",tt.STAMP);let Yc=za;var qn,pa,Cs,Oi,ti,Ie,Ni,ga,ma,ae,ei,G,Hi,Zt,rp,Zc,td,ed,Yl;const qe=class qe{constructor({uiManager:t,pageIndex:e,div:s,structTreeLayer:i,accessibilityManager:n,annotationLayer:a,drawLayer:o,textLayer:l,viewport:h,l10n:d}){b(this,Zt);b(this,qn);b(this,pa,!1);b(this,Cs,null);b(this,Oi,null);b(this,ti,null);b(this,Ie,new Map);b(this,Ni,!1);b(this,ga,!1);b(this,ma,!1);b(this,ae,null);b(this,ei,null);b(this,G);const u=[...r(qe,Hi).values()];if(!qe._initialized){qe._initialized=!0;for(const f of u)f.initialize(d,t)}t.registerEditorTypes(u),p(this,G,t),this.pageIndex=e,this.div=s,p(this,qn,n),p(this,Cs,a),this.viewport=h,p(this,ae,l),this.drawLayer=o,this._structTree=i,r(this,G).addLayer(this)}get isEmpty(){return r(this,Ie).size===0}get isInvisible(){return this.isEmpty&&r(this,G).getMode()===tt.NONE}updateToolbar(t){r(this,G).updateToolbar(t)}updateMode(t=r(this,G).getMode()){switch(m(this,Zt,Yl).call(this),t){case tt.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case tt.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case tt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;for(const s of r(qe,Hi).values())e.toggle(`${s._type}Editing`,t===s._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=r(this,ae))==null?void 0:e.div)}addInkEditorIfNeeded(t){if(r(this,G).getMode()!==tt.INK)return;if(!t){for(const s of r(this,Ie).values())if(s.isEmpty()){s.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(t){r(this,G).setEditingState(t)}addCommands(t){r(this,G).addCommands(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){var e;(e=r(this,Cs))==null||e.div.classList.toggle("disabled",!t)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const s of r(this,Ie).values())s.enableEditing(),s.show(!0),s.annotationElementId&&(r(this,G).removeChangedExistingAnnotation(s),t.add(s.annotationElementId));if(!r(this,Cs))return;const e=r(this,Cs).getEditableAnnotations();for(const s of e){if(s.hide(),r(this,G).isDeletedAnnotationElement(s.data.id)||t.has(s.data.id))continue;const i=await this.deserialize(s);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){var i;p(this,ma,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const n of r(this,Ie).values())if(n.disableEditing(),!!n.annotationElementId){if(n.serialize()!==null){t.set(n.annotationElementId,n);continue}else e.set(n.annotationElementId,n);(i=this.getEditableAnnotation(n.annotationElementId))==null||i.show(),n.remove()}if(r(this,Cs)){const n=r(this,Cs).getEditableAnnotations();for(const a of n){const{id:o}=a.data;if(r(this,G).isDeletedAnnotationElement(o))continue;let l=e.get(o);if(l){l.resetAnnotationElement(a),l.show(!1),a.show();continue}l=t.get(o),l&&(r(this,G).addChangedExistingAnnotation(l),l.renderAnnotationElement(a)&&l.show(!1)),a.show()}}m(this,Zt,Yl).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of r(qe,Hi).values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),p(this,ma,!1)}getEditableAnnotation(t){var e;return((e=r(this,Cs))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){r(this,G).getActive()!==t&&r(this,G).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(t=r(this,ae))!=null&&t.div&&!r(this,ei)){p(this,ei,new AbortController);const e=r(this,G).combinedSignal(r(this,ei));r(this,ae).div.addEventListener("pointerdown",m(this,Zt,rp).bind(this),{signal:e}),r(this,ae).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(t=r(this,ae))!=null&&t.div&&r(this,ei)&&(r(this,ei).abort(),p(this,ei,null),r(this,ae).div.classList.remove("highlighting"))}enableClick(){if(r(this,Oi))return;p(this,Oi,new AbortController);const t=r(this,G).combinedSignal(r(this,Oi));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:t})}disableClick(){var t;(t=r(this,Oi))==null||t.abort(),p(this,Oi,null)}attach(t){r(this,Ie).set(t.id,t);const{annotationElementId:e}=t;e&&r(this,G).isDeletedAnnotationElement(e)&&r(this,G).removeDeletedAnnotationElement(t)}detach(t){var e;r(this,Ie).delete(t.id),(e=r(this,qn))==null||e.removePointerInTextLayer(t.contentDiv),!r(this,ma)&&t.annotationElementId&&r(this,G).addDeletedAnnotationElement(t)}remove(t){this.detach(t),r(this,G).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,r(this,ga)||this.addInkEditorIfNeeded(!1)}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(r(this,G).addDeletedAnnotationElement(t.annotationElementId),pt.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),(e=t.parent)==null||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),r(this,G).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),r(this,G).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var s;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!r(this,ti)&&(t._focusEventsAllowed=!1,p(this,ti,setTimeout(()=>{p(this,ti,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:r(this,G)._signal}),e.focus())},0))),t._structTreeParentId=(s=r(this,qn))==null?void 0:s.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){const e=()=>t._uiManager.rebuild(t),s=()=>{t.remove()};this.addCommands({cmd:e,undo:s,mustExec:!1})}getNextId(){return r(this,G).getId()}combinedSignal(t){return r(this,G).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return(t=r(this,Zt,Zc))==null?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){r(this,G).updateToolbar(t),r(this,G).updateMode(t);const{offsetX:s,offsetY:i}=m(this,Zt,ed).call(this),n=this.getNextId(),a=m(this,Zt,td).call(this,{parent:this,id:n,x:s,y:i,uiManager:r(this,G),isCentered:!0,...e});a&&this.add(a)}async deserialize(t){var e;return await((e=r(qe,Hi).get(t.annotationType??t.annotationEditorType))==null?void 0:e.deserialize(t,this,r(this,G)))||null}createAndAddNewEditor(t,e,s={}){const i=this.getNextId(),n=m(this,Zt,td).call(this,{parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:r(this,G),isCentered:e,...s});return n&&this.add(n),n}addNewEditor(){this.createAndAddNewEditor(m(this,Zt,ed).call(this),!0)}setSelected(t){r(this,G).setSelected(t)}toggleSelected(t){r(this,G).toggleSelected(t)}unselect(t){r(this,G).unselect(t)}pointerup(t){const{isMac:e}=fe.platform;if(!(t.button!==0||t.ctrlKey&&e)&&t.target===this.div&&r(this,Ni)){if(p(this,Ni,!1),!r(this,pa)){p(this,pa,!0);return}if(r(this,G).getMode()===tt.STAMP){r(this,G).unselectAll();return}this.createAndAddNewEditor(t,!1)}}pointerdown(t){if(r(this,G).getMode()===tt.HIGHLIGHT&&this.enableTextSelection(),r(this,Ni)){p(this,Ni,!1);return}const{isMac:e}=fe.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;p(this,Ni,!0);const s=r(this,G).getActive();p(this,pa,!s||s.isEmpty())}findNewParent(t,e,s){const i=r(this,G).findParent(e,s);return i===null||i===this?!1:(i.changeParent(t),!0)}destroy(){var t,e;((t=r(this,G).getActive())==null?void 0:t.parent)===this&&(r(this,G).commitOrRemove(),r(this,G).setActiveEditor(null)),r(this,ti)&&(clearTimeout(r(this,ti)),p(this,ti,null));for(const s of r(this,Ie).values())(e=r(this,qn))==null||e.removePointerInTextLayer(s.contentDiv),s.setParent(null),s.isAttachedToDOM=!1,s.div.remove();this.div=null,r(this,Ie).clear(),r(this,G).removeLayer(this)}render({viewport:t}){this.viewport=t,Xn(this.div,t);for(const e of r(this,G).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){r(this,G).commitOrRemove(),m(this,Zt,Yl).call(this);const e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,Xn(this.div,{rotation:s}),e!==s)for(const i of r(this,Ie).values())i.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return r(this,G).viewParameters.realScale}};qn=new WeakMap,pa=new WeakMap,Cs=new WeakMap,Oi=new WeakMap,ti=new WeakMap,Ie=new WeakMap,Ni=new WeakMap,ga=new WeakMap,ma=new WeakMap,ae=new WeakMap,ei=new WeakMap,G=new WeakMap,Hi=new WeakMap,Zt=new WeakSet,rp=function(t){r(this,G).unselectAll();const{target:e}=t;if(e===r(this,ae).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&r(this,ae).div.contains(e)){const{isMac:s}=fe.platform;if(t.button!==0||t.ctrlKey&&s)return;r(this,G).showAllEditors("highlight",!0,!0),r(this,ae).div.classList.add("free"),this.toggleDrawing(),th.startHighlighting(this,r(this,G).direction==="ltr",{target:r(this,ae).div,x:t.x,y:t.y}),r(this,ae).div.addEventListener("pointerup",()=>{r(this,ae).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:r(this,G)._signal}),t.preventDefault()}},Zc=function(){return r(qe,Hi).get(r(this,G).getMode())},td=function(t){const e=r(this,Zt,Zc);return e?new e.prototype.constructor(t):null},ed=function(){const{x:t,y:e,width:s,height:i}=this.div.getBoundingClientRect(),n=Math.max(0,t),a=Math.max(0,e),o=Math.min(window.innerWidth,t+s),l=Math.min(window.innerHeight,e+i),h=(n+o)/2-t,d=(a+l)/2-e,[u,f]=this.viewport.rotation%180===0?[h,d]:[d,h];return{offsetX:u,offsetY:f}},Yl=function(){p(this,ga,!0);for(const t of r(this,Ie).values())t.isEmpty()&&t.remove();p(this,ga,!1)},Y(qe,"_initialized",!1),b(qe,Hi,new Map([Lc,jc,Yc,th].map(t=>[t._editorType,t])));let Jc=qe;var Ts,nl,Ft,si,rl,id,Zn,nd,ap;const Yt=class Yt{constructor({pageIndex:t}){b(this,Zn);b(this,Ts,null);b(this,nl,0);b(this,Ft,new Map);b(this,si,new Map);this.pageIndex=t}setParent(t){if(!r(this,Ts)){p(this,Ts,t);return}if(r(this,Ts)!==t){if(r(this,Ft).size>0)for(const e of r(this,Ft).values())e.remove(),t.append(e);p(this,Ts,t)}}static get _svgFactory(){return ot(this,"_svgFactory",new vd)}draw(t,e,s,i=!1){const n=he(this,nl)._++,a=m(this,Zn,nd).call(this,t.box);a.classList.add(...t.classNamesForDrawing);const o=Yt._svgFactory.createElement("defs");a.append(o);const l=Yt._svgFactory.createElement("path");o.append(l);const h=`path_p${this.pageIndex}_${n}`;l.setAttribute("id",h),l.setAttribute("d",t.toSVGPath()),i&&r(this,si).set(n,l);const d=m(this,Zn,ap).call(this,o,h),u=Yt._svgFactory.createElement("use");return a.append(u),a.setAttribute("fill",e),a.setAttribute("fill-opacity",s),u.setAttribute("href",`#${h}`),r(this,Ft).set(n,a),{id:n,clipPathId:`url(#${d})`}}drawOutline(t){const e=he(this,nl)._++,s=m(this,Zn,nd).call(this,t.box);s.classList.add(...t.classNamesForOutlining);const i=Yt._svgFactory.createElement("defs");s.append(i);const n=Yt._svgFactory.createElement("path");i.append(n);const a=`path_p${this.pageIndex}_${e}`;n.setAttribute("id",a),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke");let o;if(t.mustRemoveSelfIntersections){const d=Yt._svgFactory.createElement("mask");i.append(d),o=`mask_p${this.pageIndex}_${e}`,d.setAttribute("id",o),d.setAttribute("maskUnits","objectBoundingBox");const u=Yt._svgFactory.createElement("rect");d.append(u),u.setAttribute("width","1"),u.setAttribute("height","1"),u.setAttribute("fill","white");const f=Yt._svgFactory.createElement("use");d.append(f),f.setAttribute("href",`#${a}`),f.setAttribute("stroke","none"),f.setAttribute("fill","black"),f.setAttribute("fill-rule","nonzero"),f.classList.add("mask")}const l=Yt._svgFactory.createElement("use");s.append(l),l.setAttribute("href",`#${a}`),o&&l.setAttribute("mask",`url(#${o})`);const h=l.cloneNode();return s.append(h),l.classList.add("mainOutline"),h.classList.add("secondaryOutline"),r(this,Ft).set(e,s),e}finalizeLine(t,e){const s=r(this,si).get(t);r(this,si).delete(t),this.updateBox(t,e.box),s.setAttribute("d",e.toSVGPath())}updateLine(t,e){r(this,Ft).get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}updatePath(t,e){r(this,si).get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){var s;m(s=Yt,rl,id).call(s,r(this,Ft).get(t),e)}show(t,e){r(this,Ft).get(t).classList.toggle("hidden",!e)}rotate(t,e){r(this,Ft).get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){r(this,Ft).get(t).setAttribute("fill",e)}changeOpacity(t,e){r(this,Ft).get(t).setAttribute("fill-opacity",e)}addClass(t,e){r(this,Ft).get(t).classList.add(e)}removeClass(t,e){r(this,Ft).get(t).classList.remove(e)}getSVGRoot(t){return r(this,Ft).get(t)}remove(t){r(this,si).delete(t),r(this,Ts)!==null&&(r(this,Ft).get(t).remove(),r(this,Ft).delete(t))}destroy(){p(this,Ts,null);for(const t of r(this,Ft).values())t.remove();r(this,Ft).clear(),r(this,si).clear()}};Ts=new WeakMap,nl=new WeakMap,Ft=new WeakMap,si=new WeakMap,rl=new WeakSet,id=function(t,{x:e=0,y:s=0,width:i=1,height:n=1}={}){const{style:a}=t;a.top=`${100*s}%`,a.left=`${100*e}%`,a.width=`${100*i}%`,a.height=`${100*n}%`},Zn=new WeakSet,nd=function(t){var s;const e=Yt._svgFactory.create(1,1,!0);return r(this,Ts).append(e),e.setAttribute("aria-hidden",!0),m(s=Yt,rl,id).call(s,e,t),e},ap=function(t,e){const s=Yt._svgFactory.createElement("clipPath");t.append(s);const i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=Yt._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),i},b(Yt,rl);let sd=Yt;Q.AbortException;Q.AnnotationEditorLayer;Q.AnnotationEditorParamsType;Q.AnnotationEditorType;Q.AnnotationEditorUIManager;var op=Q.AnnotationLayer,lp=Q.AnnotationMode;Q.ColorPicker;Q.DOMSVGFactory;Q.DrawLayer;Q.FeatureTest;var Th=Q.GlobalWorkerOptions;Q.ImageKind;Q.InvalidPDFException;Q.MissingPDFException;Q.OPS;Q.OutputScale;var Vm=Q.PDFDataRangeTransport;Q.PDFDateString;Q.PDFWorker;Q.PasswordResponses;Q.PermissionFlag;Q.PixelsPerInch;Q.RenderingCancelledException;var hp=Q.TextLayer;Q.UnexpectedResponseException;Q.Util;Q.VerbosityLevel;Q.XfaLayer;Q.build;Q.createValidAbsoluteUrl;Q.fetchData;var cp=Q.getDocument;Q.getFilenameFromUrl;Q.getPdfFilenameFromUrl;Q.getXfaPageViewport;Q.isDataScheme;Q.isPdfFile;Q.noContextMenu;Q.normalizeUnicode;Q.setLayerDimensions;Q.shadow;var rd=Q.version;const qm=Object.freeze(Object.defineProperty({__proto__:null,AnnotationLayer:op,AnnotationMode:lp,GlobalWorkerOptions:Th,PDFDataRangeTransport:Vm,TextLayer:hp,getDocument:cp,version:rd},Symbol.toStringTag,{value:"Module"}));var Gt=function(c,t,e){if(e||arguments.length===2)for(var s=0,i=t.length,n;s{At(this.pdfDocument),At(t),typeof t=="string"?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(e=>{At(Array.isArray(e));const s=e[0];new Promise(i=>{At(this.pdfDocument),s instanceof Object?this.pdfDocument.getPageIndex(s).then(n=>{i(n)}).catch(()=>{At(!1)}):typeof s=="number"?i(s):At(!1)}).then(i=>{const n=i+1;At(this.pdfViewer),At(n>=1&&n<=this.pagesCount),this.pdfViewer.scrollPageIntoView({dest:e,pageIndex:i,pageNumber:n})})})}navigateTo(t){this.goToDestination(t)}goToPage(t){const e=t-1;At(this.pdfViewer),At(t>=1&&t<=this.pagesCount),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}addLinkAttributes(t,e,s){t.href=e,t.rel=this.externalLinkRel||mb,t.target=s?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const qd={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Rh=typeof window<"u",fp=Rh&&window.location.protocol==="file:";function Ab(c){return typeof c<"u"}function Ui(c){return Ab(c)&&c!==null}function yb(c){return typeof c=="string"}function vb(c){return c instanceof ArrayBuffer}function wb(c){return At(Rh),c instanceof Blob}function ad(c){return yb(c)&&/^data:/.test(c)}function Xd(c){At(ad(c));const[t="",e=""]=c.split(",");return t.split(";").indexOf("base64")!==-1?atob(e):unescape(e)}function _b(){return Rh&&window.devicePixelRatio||1}const pp="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Yd(){oe(!fp,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${pp}`)}function Eb(){oe(!fp,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${pp}`)}function Qn(c){c!=null&&c.cancel&&c.cancel()}function od(c,t){return Object.defineProperty(c,"width",{get(){return this.view[2]*t},configurable:!0}),Object.defineProperty(c,"height",{get(){return this.view[3]*t},configurable:!0}),Object.defineProperty(c,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(c,"originalHeight",{get(){return this.view[3]},configurable:!0}),c}function Sb(c){return c.name==="RenderingCancelledException"}function xb(c){return new Promise((t,e)=>{const s=new FileReader;s.onload=()=>{if(!s.result)return e(new Error("Error while reading a file."));t(s.result)},s.onerror=i=>{if(!i.target)return e(new Error("Error while reading a file."));const{error:n}=i.target;if(!n)return e(new Error("Error while reading a file."));switch(n.code){case n.NOT_FOUND_ERR:return e(new Error("Error while reading a file: File not found."));case n.SECURITY_ERR:return e(new Error("Error while reading a file: Security error."));case n.ABORT_ERR:return e(new Error("Error while reading a file: Aborted."));default:return e(new Error("Error while reading a file."))}},s.readAsArrayBuffer(c)})}function Cb(c,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return c}}function ba(){return R.useReducer(Cb,{value:void 0,error:void 0})}var Tb=function(c,t,e,s){function i(n){return n instanceof e?n:new e(function(a){a(n)})}return new(e||(e=Promise))(function(n,a){function o(d){try{h(s.next(d))}catch(u){a(u)}}function l(d){try{h(s.throw(d))}catch(u){a(u)}}function h(d){d.done?n(d.value):i(d.value).then(o,l)}h((s=s.apply(c,t||[])).next())})},Kd=function(c,t){var e={};for(var s in c)Object.prototype.hasOwnProperty.call(c,s)&&t.indexOf(s)<0&&(e[s]=c[s]);if(c!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(c);i{switch(t){case qd.NEED_PASSWORD:{const e=prompt("Enter the password to open this PDF file.");c(e);break}case qd.INCORRECT_PASSWORD:{const e=prompt("Invalid password. Please try again.");c(e);break}}};function Qd(c){return typeof c=="object"&&c!==null&&("data"in c||"range"in c||"url"in c)}const kb=R.forwardRef(function(t,e){var{children:s,className:i,error:n="Failed to load PDF file.",externalLinkRel:a,externalLinkTarget:o,file:l,inputRef:h,imageResourcesPath:d,loading:u="Loading PDF…",noData:f="No PDF file specified.",onItemClick:g,onLoadError:A,onLoadProgress:y,onLoadSuccess:w,onPassword:v=Pb,onSourceError:_,onSourceSuccess:S,options:E,renderMode:C,rotate:x}=t,T=Kd(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[P,L]=ba(),{value:O,error:F}=P,[J,U]=ba(),{value:z,error:X}=J,q=R.useRef(new bb),H=R.useRef([]),$=R.useRef(void 0),B=R.useRef(void 0);l&&l!==$.current&&Qd(l)&&(oe(!br(l,$.current),`File prop passed to changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),$.current=l),E&&E!==B.current&&(oe(!br(E,B.current),`Options prop passed to changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),B.current=E);const V=R.useRef({scrollPageIntoView:yt=>{const{dest:Mt,pageNumber:te,pageIndex:zt=te-1}=yt;if(g){g({dest:Mt,pageIndex:zt,pageNumber:te});return}const ir=H.current[zt];if(ir){ir.scrollIntoView();return}oe(!1,`An internal link leading to page ${te} was clicked, but neither was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to and handle navigating by yourself or ensure that all pages are rendered within .`)}});R.useImperativeHandle(e,()=>({linkService:q,pages:H,viewer:V}),[]);function rt(){S&&S()}function M(){F&&(oe(!1,F.toString()),_&&_(F))}function W(){L({type:"RESET"})}R.useEffect(W,[l,L]);const lt=R.useCallback(()=>Tb(this,void 0,void 0,function*(){if(!l)return null;if(typeof l=="string")return ad(l)?{data:Xd(l)}:(Yd(),{url:l});if(l instanceof Rb)return{range:l};if(vb(l))return{data:l};if(Rh&&wb(l))return{data:yield xb(l)};if(At(typeof l=="object"),At(Qd(l)),"url"in l&&typeof l.url=="string"){if(ad(l.url)){const{url:yt}=l,Mt=Kd(l,["url"]),te=Xd(yt);return Object.assign({data:te},Mt)}Yd()}return l}),[l]);R.useEffect(()=>{const yt=hl(lt());return yt.promise.then(Mt=>{L({type:"RESOLVE",value:Mt})}).catch(Mt=>{L({type:"REJECT",error:Mt})}),()=>{Qn(yt)}},[lt,L]),R.useEffect(()=>{if(!(typeof O>"u")){if(O===!1){M();return}rt()}},[O]);function gt(){z&&(w&&w(z),H.current=new Array(z.numPages),q.current.setDocument(z))}function dt(){X&&(oe(!1,X.toString()),A&&A(X))}R.useEffect(function(){U({type:"RESET"})},[U,O]),R.useEffect(function(){if(!O)return;const Mt=E?Object.assign(Object.assign({},O),E):O,te=cp(Mt);y&&(te.onProgress=y),v&&(te.onPassword=v);const zt=te,ir=zt.promise.then(va=>{U({type:"RESOLVE",value:va})}).catch(va=>{zt.destroyed||U({type:"REJECT",error:va})});return()=>{ir.finally(()=>zt.destroy())}},[E,U,O]),R.useEffect(()=>{if(!(typeof z>"u")){if(z===!1){dt();return}gt()}},[z]),R.useEffect(function(){q.current.setViewer(V.current),q.current.setExternalLinkRel(a),q.current.setExternalLinkTarget(o)},[a,o]);const nt=R.useCallback((yt,Mt)=>{H.current[yt]=Mt},[]),me=R.useCallback(yt=>{delete H.current[yt]},[]),be=R.useMemo(()=>({imageResourcesPath:d,linkService:q.current,onItemClick:g,pdf:z,registerPage:nt,renderMode:C,rotate:x,unregisterPage:me}),[d,g,z,nt,C,x,me]),_t=R.useMemo(()=>dp(T,()=>z),[T,z]);function Aa(){return k.jsx(up.Provider,{value:be,children:s})}function ya(){return l?z==null?k.jsx(Ar,{type:"loading",children:typeof u=="function"?u():u}):z===!1?k.jsx(Ar,{type:"error",children:typeof n=="function"?n():n}):Aa():k.jsx(Ar,{type:"no-data",children:typeof f=="function"?f():f})}return k.jsx("div",Object.assign({className:Ah("react-pdf__Document",i),ref:h,style:{"--scale-factor":"1"}},_t,{children:ya()}))});function gp(){return R.useContext(up)}function mp(){for(var c=[],t=0;tFb(t),[t]),s=R.useMemo(()=>!Ph(t)||yp(t)?null:t.children.map((i,n)=>k.jsx(wp,{node:i},n)),[t]);return k.jsx("span",Object.assign({className:c},e,{children:s}))}function kh(){return R.useContext(bp)}function Db(){const c=kh();At(c);const{onGetStructTreeError:t,onGetStructTreeSuccess:e}=c,[s,i]=ba(),{value:n,error:a}=s,{customTextRenderer:o,page:l}=c;function h(){n&&e&&e(n)}function d(){a&&(oe(!1,a.toString()),t&&t(a))}return R.useEffect(function(){i({type:"RESET"})},[i,l]),R.useEffect(function(){if(o||!l)return;const f=hl(l.getStructTree()),g=f;return f.promise.then(A=>{i({type:"RESOLVE",value:A})}).catch(A=>{i({type:"REJECT",error:A})}),()=>Qn(g)},[o,l,i]),R.useEffect(()=>{if(n!==void 0){if(n===!1){d();return}h()}},[n]),n?k.jsx(wp,{className:"react-pdf__Page__structTree structTree",node:n}):null}const Jd=lp;function Ob(c){const t=kh();At(t);const e=Object.assign(Object.assign({},t),c),{_className:s,canvasBackground:i,devicePixelRatio:n=_b(),onRenderError:a,onRenderSuccess:o,page:l,renderForms:h,renderTextLayer:d,rotate:u,scale:f}=e,{canvasRef:g}=c;At(l);const A=R.useRef(null);function y(){l&&o&&o(od(l,f))}function w(E){Sb(E)||(oe(!1,E.toString()),a&&a(E))}const v=R.useMemo(()=>l.getViewport({scale:f*n,rotation:u}),[n,l,u,f]),_=R.useMemo(()=>l.getViewport({scale:f,rotation:u}),[l,u,f]);R.useEffect(function(){if(!l)return;l.cleanup();const{current:C}=A;if(!C)return;C.width=v.width,C.height=v.height,C.style.width=`${Math.floor(_.width)}px`,C.style.height=`${Math.floor(_.height)}px`,C.style.visibility="hidden";const x={annotationMode:h?Jd.ENABLE_FORMS:Jd.ENABLE,canvasContext:C.getContext("2d",{alpha:!1}),viewport:v};i&&(x.background=i);const T=l.render(x),P=T;return T.promise.then(()=>{C.style.visibility="",y()}).catch(w),()=>Qn(P)},[i,l,h,v,_]);const S=R.useCallback(()=>{const{current:E}=A;E&&(E.width=0,E.height=0)},[]);return R.useEffect(()=>S,[S]),k.jsx("canvas",{className:`${s}__canvas`,dir:"ltr",ref:mp(g,A),style:{display:"block",userSelect:"none"},children:d?k.jsx(Db,{}):null})}function Nb(c){return"str"in c}function Hb(){const c=kh();At(c);const{customTextRenderer:t,onGetTextError:e,onGetTextSuccess:s,onRenderTextLayerError:i,onRenderTextLayerSuccess:n,page:a,pageIndex:o,pageNumber:l,rotate:h,scale:d}=c;At(a);const[u,f]=ba(),{value:g,error:A}=u,y=R.useRef(null);oe(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function w(){g&&s&&s(g)}function v(){A&&(oe(!1,A.toString()),e&&e(A))}R.useEffect(function(){f({type:"RESET"})},[a,f]),R.useEffect(function(){if(!a)return;const P=hl(a.getTextContent()),L=P;return P.promise.then(O=>{f({type:"RESOLVE",value:O})}).catch(O=>{f({type:"REJECT",error:O})}),()=>Qn(L)},[a,f]),R.useEffect(()=>{if(g!==void 0){if(g===!1){v();return}w()}},[g]);const _=R.useCallback(()=>{n&&n()},[n]),S=R.useCallback(T=>{oe(!1,T.toString()),i&&i(T)},[i]);function E(){const T=y.current;T&&T.classList.add("selecting")}function C(){const T=y.current;T&&T.classList.remove("selecting")}const x=R.useMemo(()=>a.getViewport({scale:d,rotation:h}),[a,h,d]);return R.useLayoutEffect(function(){if(!a||!g)return;const{current:P}=y;if(!P)return;P.innerHTML="";const L=a.streamTextContent({includeMarkedContent:!0}),O={container:P,textContentSource:L,viewport:x},F=new hp(O),J=F;return F.render().then(()=>{const U=document.createElement("div");U.className="endOfContent",P.append(U);const z=P.querySelectorAll('[role="presentation"]');if(t){let X=0;g.items.forEach((q,H)=>{if(!Nb(q))return;const $=z[X];if(!$)return;const B=t(Object.assign({pageIndex:o,pageNumber:l,itemIndex:H},q));$.innerHTML=B,X+=q.str&&q.hasEOL?2:1})}_()}).catch(S),()=>Qn(J)},[t,S,_,a,o,l,g,x]),k.jsx("div",{className:Ah("react-pdf__Page__textContent","textLayer"),onMouseUp:C,onMouseDown:E,ref:y})}function Bb(){const c=gp(),t=kh();At(t);const e=Object.assign(Object.assign({},c),t),{imageResourcesPath:s,linkService:i,onGetAnnotationsError:n,onGetAnnotationsSuccess:a,onRenderAnnotationLayerError:o,onRenderAnnotationLayerSuccess:l,page:h,pdf:d,renderForms:u,rotate:f,scale:g=1}=e;At(d),At(h),At(i);const[A,y]=ba(),{value:w,error:v}=A,_=R.useRef(null);oe(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function S(){w&&a&&a(w)}function E(){v&&(oe(!1,v.toString()),n&&n(v))}R.useEffect(function(){y({type:"RESET"})},[y,h]),R.useEffect(function(){if(!h)return;const L=hl(h.getAnnotations()),O=L;return L.promise.then(F=>{y({type:"RESOLVE",value:F})}).catch(F=>{y({type:"REJECT",error:F})}),()=>{Qn(O)}},[y,h]),R.useEffect(()=>{if(w!==void 0){if(w===!1){E();return}S()}},[w]);function C(){l&&l()}function x(P){oe(!1,`${P}`),o&&o(P)}const T=R.useMemo(()=>h.getViewport({scale:g,rotation:f}),[h,f,g]);return R.useEffect(function(){if(!d||!h||!i||!w)return;const{current:L}=_;if(!L)return;const O=T.clone({dontFlip:!0}),F={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:L,l10n:null,page:h,structTreeLayer:null,viewport:O},J={annotations:w,annotationStorage:d.annotationStorage,div:L,imageResourcesPath:s,linkService:i,page:h,renderForms:u,viewport:O};L.innerHTML="";try{new op(F).render(J),C()}catch(U){x(U)}return()=>{}},[w,s,i,h,d,u,T]),k.jsx("div",{className:Ah("react-pdf__Page__annotations","annotationLayer"),ref:_})}var jb=function(c,t){var e={};for(var s in c)Object.prototype.hasOwnProperty.call(c,s)&&t.indexOf(s)<0&&(e[s]=c[s]);if(c!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(c);i{if(!_t)return null;let nr=1;const dl=lt??Zd;if(dt||g){const ul=_t.getViewport({scale:1,rotation:te});dt?nr=dt/ul.width:g&&(nr=g/ul.height)}return dl*nr},[g,_t,te,lt,dt]);R.useEffect(function(){return()=>{Ui(yt)&&i&>&>(yt)}},[i,H,yt,gt]);function ir(){if(P){if(!_t||!zt)return;P(od(_t,zt))}if(i&&$){if(!Ui(yt)||!ya.current)return;$(yt,ya.current)}}function va(){Aa&&(oe(!1,Aa.toString()),T&&T(Aa))}R.useEffect(function(){be({type:"RESET"})},[be,H,yt]),R.useEffect(function(){if(!H||!Mt)return;const dl=hl(H.getPage(Mt)),ul=dl;return dl.promise.then(Lh=>{be({type:"RESOLVE",value:Lh})}).catch(Lh=>{be({type:"REJECT",error:Lh})}),()=>Qn(ul)},[be,H,Mt]),R.useEffect(()=>{if(_t!==void 0){if(_t===!1){va();return}ir()}},[_t,zt]);const Sp=R.useMemo(()=>_t&&Ui(yt)&&Mt&&Ui(te)&&Ui(zt)?{_className:s,canvasBackground:n,customTextRenderer:d,devicePixelRatio:u,onGetAnnotationsError:v,onGetAnnotationsSuccess:_,onGetStructTreeError:S,onGetStructTreeSuccess:E,onGetTextError:C,onGetTextSuccess:x,onRenderAnnotationLayerError:L,onRenderAnnotationLayerSuccess:O,onRenderError:F,onRenderSuccess:J,onRenderTextLayerError:U,onRenderTextLayerSuccess:z,page:_t,pageIndex:yt,pageNumber:Mt,renderForms:V,renderTextLayer:M,rotate:te,scale:zt}:null,[s,n,d,u,v,_,S,E,C,x,L,O,F,J,U,z,_t,yt,Mt,V,M,te,zt]),xp=R.useMemo(()=>dp(nt,()=>_t&&(zt?od(_t,zt):void 0)),[nt,_t,zt]),cl=`${yt}@${zt}/${te}`;function Cp(){switch(rt){case"custom":return At(h),k.jsx(h,{},`${cl}_custom`);case"none":return null;case"canvas":default:return k.jsx(Ob,{canvasRef:a},`${cl}_canvas`)}}function Tp(){return M?k.jsx(Hb,{},`${cl}_text`):null}function Rp(){return B?k.jsx(Bb,{},`${cl}_annotations`):null}function Pp(){return k.jsxs(bp.Provider,{value:Sp,children:[Cp(),Tp(),Rp(),o]})}function kp(){return Mt?H===null||_t===void 0||_t===null?k.jsx(Ar,{type:"loading",children:typeof y=="function"?y():y}):H===!1||_t===!1?k.jsx(Ar,{type:"error",children:typeof f=="function"?f():f}):Pp():k.jsx(Ar,{type:"no-data",children:typeof w=="function"?w():w})}return k.jsx("div",Object.assign({className:Ah(s,l),"data-page-number":Mt,ref:mp(A,ya),style:{"--scale-factor":`${zt}`,backgroundColor:n||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},xp,{children:kp()}))}Eb();Th.workerSrc="pdf.worker.mjs";const zb="/assets/pdf.worker.min-GB3t0DcA.mjs";Th.workerSrc=zb;function Gb(){if(!Th.workerSrc)throw new Error("The bundled PDF worker is not configured.");if(rd!=="4.8.69")throw new Error(`PDF runtime version mismatch (${rd}).`)}function Ub({page:c,pages:t,zoomPercent:e,searchOpen:s,searchQuery:i,searchMatch:n,searchCount:a,searching:o,originalUrl:l,onPage:h,onZoomIn:d,onZoomOut:u,onFitWidth:f,onToggleSearch:g,onSearchQuery:A,onSearch:y}){const w=v=>{v.preventDefault();const _=Number(new FormData(v.currentTarget).get("page"));Number.isInteger(_)&&h(_)};return k.jsxs("div",{className:"pdf-toolbar","aria-label":"PDF controls",children:[k.jsxs("div",{className:"pdf-toolbar-group",children:[k.jsx("button",{type:"button",onClick:()=>h(c-1),disabled:c<=1,"aria-label":"Previous page",children:"←"}),k.jsxs("form",{onSubmit:w,className:"pdf-page-form",children:[k.jsx("label",{className:"sr-only",htmlFor:"pdf-current-page",children:"Current page"}),k.jsx("input",{id:"pdf-current-page",name:"page",type:"number",min:1,max:t||1,defaultValue:c,"aria-label":`Page ${c} of ${t||"unknown"}`},c),k.jsxs("span",{"aria-hidden":"true",children:["/ ",t||"—"]})]}),k.jsx("button",{type:"button",onClick:()=>h(c+1),disabled:!t||c>=t,"aria-label":"Next page",children:"→"})]}),k.jsxs("div",{className:"pdf-toolbar-group",children:[k.jsx("button",{type:"button",onClick:u,"aria-label":"Zoom out",children:"−"}),k.jsxs("span",{className:"pdf-zoom-value","aria-live":"polite",children:[e,"%"]}),k.jsx("button",{type:"button",onClick:d,"aria-label":"Zoom in",children:"+"}),k.jsx("button",{type:"button",onClick:f,children:"Fit width"}),k.jsx("button",{type:"button",onClick:g,"aria-expanded":s,"aria-controls":"pdf-search-controls",children:"Search"}),k.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",download:!0,children:"Open original"})]}),s&&k.jsxs("div",{id:"pdf-search-controls",className:"pdf-search-controls",children:[k.jsx("label",{className:"sr-only",htmlFor:"pdf-search-input",children:"Search document"}),k.jsx("input",{id:"pdf-search-input",autoFocus:!0,value:i,onChange:v=>A(v.target.value),placeholder:"Search document"}),k.jsx("span",{role:"status",children:o?"Searching…":i?`${a?n+1:0} of ${a}`:""}),k.jsx("button",{type:"button",onClick:()=>y(-1),disabled:!a,"aria-label":"Previous match",children:"↑"}),k.jsx("button",{type:"button",onClick:()=>y(1),disabled:!a,"aria-label":"Next match",children:"↓"})]})]})}function Wb(c){const t=c.message.toLowerCase();return t.includes("password")?"This PDF is encrypted and cannot be opened in the reader.":t.includes("worker")?"The PDF renderer could not start.":t.includes("invalid")||t.includes("format")?"The source returned an invalid or unsupported PDF.":t.includes("cors")||t.includes("fetch")||t.includes("network")?"The PDF source could not be loaded in this browser.":"The PDF could not be loaded from its source."}function Vb({page:c,width:t}){const e=R.useRef(null),[s,i]=R.useState(c<=2);return R.useEffect(()=>{const n=e.current;if(!n)return;const a=new IntersectionObserver(([o])=>i(o.isIntersecting),{rootMargin:"120% 0px"});return a.observe(n),()=>a.disconnect()},[]),k.jsx("div",{ref:e,className:"pdf-page","data-page":c,style:{minHeight:Math.round(t*1.35)},children:s&&k.jsx($b,{pageNumber:c,width:t,devicePixelRatio:Math.min(window.devicePixelRatio||1,2),renderTextLayer:!0,renderAnnotationLayer:!0,loading:null})})}function qb({url:c,paperKey:t,initialPage:e=1,onPageChange:s}){const i=R.useRef(null),n=R.useRef(null),a=R.useRef(null),o=R.useRef(0),[l,h]=R.useState(0),[d,u]=R.useState(0),[f,g]=R.useState(e),[A,y]=R.useState(700),[w,v]=R.useState(1),[_,S]=R.useState(""),[E,C]=R.useState(!1),[x,T]=R.useState(""),[P,L]=R.useState(!1),[O,F]=R.useState([]),[J,U]=R.useState(0),z=Math.max(240,Math.round(A*w));R.useEffect(()=>{Gb()},[]),R.useEffect(()=>{u(0),g(e),v(1),S(""),T(""),F([])},[e,t,l]),R.useEffect(()=>{const B=n.current;if(!B)return;const V=()=>y(Math.max(240,B.clientWidth-10));V();const rt=new ResizeObserver(V);return rt.observe(B),()=>rt.disconnect()},[]);const X=R.useCallback(B=>{const V=Math.max(1,Math.min(d||1,B));g(V),s==null||s(V)},[s,d]);R.useEffect(()=>{const B=n.current;if(!B||!d)return;let V=0;const rt=()=>{cancelAnimationFrame(V),V=requestAnimationFrame(()=>{const M=B.getBoundingClientRect().top+B.clientHeight/2;let W=f,lt=Number.POSITIVE_INFINITY;B.querySelectorAll("[data-page]").forEach(gt=>{const dt=gt.getBoundingClientRect(),nt=M>=dt.top&&M<=dt.bottom?0:Math.min(Math.abs(M-dt.top),Math.abs(M-dt.bottom));nt{B.removeEventListener("scroll",rt),cancelAnimationFrame(V)}},[f,z,d,X]),R.useEffect(()=>{const B=V=>{(V.ctrlKey||V.metaKey)&&V.key.toLowerCase()==="f"&&(V.preventDefault(),C(!0))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[]),R.useEffect(()=>{const B=a.current,V=x.trim().toLocaleLowerCase(),rt=++o.current;if(!B||!V){F([]),U(0),L(!1);return}L(!0);const M=window.setTimeout(()=>void(async()=>{const W=[];for(let lt=1;lt<=B.numPages;lt+=1){if(o.current!==rt)return;const nt=(await(await B.getPage(lt)).getTextContent()).items.map(be=>"str"in be?be.str:"").join(" ").toLocaleLowerCase();let me=0;for(;(me=nt.indexOf(V,me))>=0;)W.push(lt),me+=Math.max(1,V.length)}o.current===rt&&(F(W),U(0),L(!1),W[0]&&q(W[0]))})().catch(()=>{o.current===rt&&L(!1)}),180);return()=>window.clearTimeout(M)},[x,d]);const q=B=>{var rt,M;const V=Math.max(1,Math.min(d||1,B));(M=(rt=n.current)==null?void 0:rt.querySelector(`[data-page="${V}"]`))==null||M.scrollIntoView({block:"start"}),X(V)},H=B=>{if(!O.length)return;const V=(J+B+O.length)%O.length;U(V),q(O[V])},$=R.useMemo(()=>Array.from({length:d},(B,V)=>V+1),[d]);return k.jsxs("div",{ref:i,className:"pdf-viewer",children:[k.jsx(Ub,{page:f,pages:d,zoomPercent:Math.round(w*100),searchOpen:E,searchQuery:x,searchMatch:J,searchCount:O.length,searching:P,originalUrl:c,onPage:q,onZoomIn:()=>v(B=>Math.min(3,B+.15)),onZoomOut:()=>v(B=>Math.max(.5,B-.15)),onFitWidth:()=>v(1),onToggleSearch:()=>C(B=>!B),onSearchQuery:T,onSearch:H}),k.jsx("div",{ref:n,className:"pdf-scroll",role:"region","aria-label":"Paper PDF",children:_?k.jsxs("div",{className:"pdf-error",role:"alert",children:[k.jsx("p",{children:_}),k.jsxs("div",{children:[k.jsx("button",{type:"button",onClick:()=>h(B=>B+1),children:"Retry"})," ",k.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",children:"Open original PDF"})]})]}):k.jsx(kb,{file:c,loading:k.jsx("div",{className:"pdf-loading",role:"status",children:"Loading paper…"}),onLoadSuccess:B=>{a.current=B,u(B.numPages),S("");const V=Math.max(1,Math.min(B.numPages,e));V>1&&requestAnimationFrame(()=>requestAnimationFrame(()=>{var rt,M;(M=(rt=n.current)==null?void 0:rt.querySelector(`[data-page="${V}"]`))==null||M.scrollIntoView({block:"start"}),g(V),s==null||s(V)}))},onLoadError:B=>S(Wb(B)),externalLinkTarget:"_blank",children:k.jsx("div",{className:"pdf-pages",children:$.map(B=>k.jsx(Vb,{page:B,width:z},B))})},`${t}-${l}`)})]})}const ld=66,_p="pwc:reader:split-ratio",yl=c=>`pwc:reader:session:${c}`,Bh=c=>`pwc:reader:assistant-collapsed:${c}`,Ep=c=>`pwc:reader:page:${c}`;function jh(c){const t=Number(sessionStorage.getItem(Ep(c)));return Number.isInteger(t)&&t>0?t:1}function Xb(){const c=Number(localStorage.getItem(_p));return Number.isFinite(c)&&c>=45&&c<=75?c:ld}function AA(){var B,V,rt;const{arxivId:c}=Fp(),t=Dp(c??"").replace(/v\d+$/i,""),e=Op(),{user:s,logout:i}=Np(),n=zp(t,!!t),a=$p({queryKey:["chatAvailability"],queryFn:()=>Gp.getAvailability(),refetchInterval:3e4,retry:!1}),o=n.data,l=Up(o==null?void 0:o.url_pdf),h=((B=o==null?void 0:o.arxiv_id)==null?void 0:B.replace(/v\d+$/i,""))||t,[d,u]=R.useState(()=>sessionStorage.getItem(yl(t))||void 0),[f,g]=R.useState(Xb),[A,y]=R.useState(()=>sessionStorage.getItem(Bh(t))==="1"),[w,v]=R.useState("paper"),[_,S]=R.useState(()=>jh(t)),[E,C]=R.useState(0),x=R.useRef(null),T=R.useRef(!1),P=R.useRef(jh(t)),L=E>900&&E>=840;R.useEffect(()=>{c&&c!==t&&e(`/pdf/${t}`,{replace:!0})},[e,c,t]),R.useEffect(()=>{const M=sessionStorage.getItem(yl(t));u(M||void 0),y(sessionStorage.getItem(Bh(t))==="1"),v("paper");const W=jh(t);P.current=W,S(W)},[t]),R.useLayoutEffect(()=>{const M=x.current;if(!M)return;const W=()=>C(M.clientWidth);W();const lt=new ResizeObserver(W);return lt.observe(M),()=>lt.disconnect()},[]),R.useEffect(()=>{if(!o)return;document.title=`${o.title} — Papers With Code reader`;let M=document.querySelector('meta[name="robots"]');const W=!M;M||(M=document.createElement("meta"),M.name="robots",document.head.appendChild(M));const lt=M.content;M.content="noindex, nofollow";let gt=document.querySelector('link[rel="canonical"]');const dt=!gt;gt||(gt=document.createElement("link"),gt.rel="canonical",document.head.appendChild(gt));const nt=gt.href;return gt.href=`${window.location.origin}/paper/${h}`,()=>{document.title="Papers With Code",W?M==null||M.remove():M&&(M.content=lt),dt?gt==null||gt.remove():gt&&(gt.href=nt)}},[h,o]);const O=R.useCallback(M=>{if(!E)return Math.max(45,Math.min(75,M));const W=480/E*100,lt=100-360/E*100;return Math.max(W,Math.min(lt,M))},[E]);R.useEffect(()=>g(M=>O(M)),[O]);const F=M=>{const W=O(M);g(W),localStorage.setItem(_p,String(W))},J=M=>{var lt;const W=(lt=x.current)==null?void 0:lt.getBoundingClientRect();W&&F((M-W.left)/W.width*100)},U=M=>{T.current=!0,M.currentTarget.setPointerCapture(M.pointerId),J(M.clientX)},z=M=>{y(M),sessionStorage.setItem(Bh(t),M?"1":"0")},X=M=>{u(M),sessionStorage.setItem(yl(t),M)},q=()=>{u(void 0),sessionStorage.removeItem(yl(t))},H=Hp()&&((V=a.data)==null?void 0:V.paper_reader_chat_enabled)!==!1,$=o&&H?k.jsx(Wp,{mode:"paper",routeSessionId:d,primaryPaper:{id:o.id,routeId:h,title:o.title},currentPage:()=>P.current,onSessionId:X,onReaderSubmit:()=>v("assistant"),onReaderNewChat:q}):k.jsx("div",{className:"reader-chat-unavailable",children:"Assistant is not enabled for this preview."});return n.isLoading?k.jsx("div",{className:"reader-status",role:"status",children:"Loading paper…"}):n.error||!o?k.jsxs("div",{className:"reader-status",role:"alert",children:[k.jsx("p",{children:"Paper not found."}),k.jsx(rr,{to:"/papers",children:"Browse papers"})]}):((rt=a.data)==null?void 0:rt.native_pdf_reader_enabled)===!1?k.jsxs("div",{className:"reader-status",role:"alert",children:[k.jsx("p",{children:"The native reader is currently unavailable."}),k.jsx(rr,{to:`/paper/${h}`,children:"Back to paper"})]}):o.source!=="arxiv"||!l?k.jsxs("div",{className:"reader-status",role:"alert",children:[k.jsx("p",{children:"Native reading is unavailable for this resource."}),k.jsx(rr,{to:`/paper/${h}`,children:"Back to paper"})]}):k.jsxs("div",{className:"paper-reader-shell",children:[k.jsxs("header",{className:"reader-header",children:[k.jsx(rr,{to:`/paper/${h}`,className:"reader-back","aria-label":"Back to paper page",children:"← Back"}),k.jsxs(rr,{to:"/",className:"reader-brand",children:["Papers ",k.jsx("em",{children:"With Code"})]}),k.jsx("div",{className:"reader-header-spacer"}),s?k.jsx(Bp,{user:s,onLogout:i}):k.jsx(jp,{compact:!0,returnTo:`/pdf/${h}`})]}),!L&&k.jsxs("div",{className:"reader-tabs",role:"tablist","aria-label":"Reader panels",children:[k.jsx("button",{type:"button",role:"tab","aria-selected":w==="paper",onClick:()=>v("paper"),children:"Paper"}),k.jsx("button",{type:"button",role:"tab","aria-selected":w==="assistant",onClick:()=>v("assistant"),children:"Assistant"})]}),k.jsxs("div",{ref:x,className:`reader-workspace${L?" is-desktop":" is-tabs"}${A?" is-assistant-collapsed":""}`,children:[k.jsxs("section",{className:`reader-paper-pane${!L&&w!=="paper"?" is-hidden":""}`,style:L?{width:A?"100%":`${f}%`}:void 0,role:"tabpanel","aria-label":"Paper","aria-hidden":!L&&w!=="paper",children:[k.jsxs("div",{className:"reader-paper-titlebar",children:[k.jsx(rr,{to:`/paper/${h}`,title:o.title,"aria-label":`${o.title} — open paper page`,children:o.title}),k.jsxs("span",{children:["arXiv:",h]})]}),k.jsx(qb,{url:l,paperKey:h,initialPage:_,onPageChange:M=>{P.current=M,sessionStorage.setItem(Ep(t),String(M))}})]}),L&&!A&&k.jsx("div",{className:"reader-resize-handle",role:"separator","aria-label":"Resize paper and Assistant panels","aria-orientation":"vertical","aria-valuemin":45,"aria-valuemax":75,"aria-valuenow":Math.round(f),tabIndex:0,onPointerDown:U,onPointerMove:M=>{T.current&&J(M.clientX)},onPointerUp:()=>{T.current=!1},onPointerCancel:()=>{T.current=!1},onDoubleClick:()=>F(ld),onKeyDown:M=>{(M.key==="ArrowLeft"||M.key==="ArrowRight")&&(M.preventDefault(),F(f+(M.key==="ArrowRight"?2:-2))),M.key==="Home"&&F(45),M.key==="End"&&F(75)},children:k.jsx("button",{type:"button",onClick:()=>F(ld),title:"Reset panel sizes","aria-label":"Reset panel sizes",children:"·"})}),k.jsx("aside",{className:`reader-assistant-pane${!L&&w!=="assistant"||A?" is-hidden":""}`,style:L?{width:A?0:`${100-f}%`}:void 0,role:"tabpanel","aria-label":"Assistant","aria-hidden":!L&&w!=="assistant"||A,children:$}),L&&k.jsx("button",{type:"button",className:"reader-collapse-assistant",onClick:()=>z(!A),children:A?"Assistant":"Hide Assistant"})]})]})}export{AA as default}; diff --git a/assets/PapersListView-BYepbpX4.js b/assets/PapersListView-DTuy4U-C.js similarity index 89% rename from assets/PapersListView-BYepbpX4.js rename to assets/PapersListView-DTuy4U-C.js index 0c0b6c25559db0f791438c18e24d9d4213bd7420..b4791586aa566b8f7d5a8287307846225a177bee 100644 --- a/assets/PapersListView-BYepbpX4.js +++ b/assets/PapersListView-DTuy4U-C.js @@ -1 +1 @@ -import{a as q,r as m,A as z,j as e,L as x}from"./index-BrhBTT14.js";import{I as E,T as G,P as Q}from"./components-74u_bIKK.js";import{c as U}from"./catalog-CkpmYxEk.js";import{t as W,d as K}from"./transform-Duf4Shfn.js";import{u as V}from"./usePapers-C1lfz0oo.js";import{u as J}from"./useDebounce-DzNGzmqr.js";import{P as X}from"./usePeriodFilter-By9tdCWv.js";import{u as Y,P as Z}from"./useIntersectionObserver-Lj6hnXj6.js";import{S as p}from"./skeleton-DHdzoBmM.js";import{A as ee,a as se}from"./alert-c1n3ZtEC.js";import{u as ae}from"./useQuery-GhY2LXSI.js";import"./LatexTitle-BJSVMlZ1.js";import"./katex.min-BSBacQyE.js";import"./papers-DBaPliAp.js";import"./safeExternalHref-CkBrsh84.js";import"./useInfiniteQuery-bETtM5yS.js";const re=[["trending","trending"],["new","newest"],["cited","most cited"]],te=r=>new Intl.NumberFormat("en",{notation:r>=1e3?"compact":"standard",maximumFractionDigits:1}).format(r),be=()=>{var T,A,C,I,L,R,H;const[r,_]=q(),h=r.get("framework")||void 0,g=r.get("repository")||void 0,n=!!(h||g),u=r.get("search")||"",[b,k]=m.useState(u),d=J(b,300);m.useEffect(()=>k(u),[u]),m.useEffect(()=>{if(d===u)return;const s=new URLSearchParams(r);d?s.set("search",d):s.delete("search"),_(s,{replace:!0})},[d]);const j=r.get("order_by"),N=j==="citation_count"?"cited":j==="trending"||!j&&n?"trending":"new",o=r.get("time"),$=o==="today"?"Today":o==="week"?"This Week":o==="month"?"This Month":"All Time",y=r.get("has_hf_artifacts")==="true",w=!n&&r.get("has_code")==="true",f=(s,i)=>{const l=new URLSearchParams(r);i?l.set(s,i):l.delete(s),_(l)},B=s=>{f("time",s==="Today"?"today":s==="This Week"?"week":s==="This Month"?"month":void 0)},D=s=>{f("order_by",s==="cited"?"citation_count":s==="new"?"date_published":"trending")},t=V({page_size:20,order_by:N==="trending"?"trending":N==="cited"?"citation_count":"date_published",order_dir:"desc",search:d||void 0,time:o==="today"||o==="week"||o==="month"?o:"all_time",include_resources:!0,published_after:r.get("published_after")||void 0,published_before:r.get("published_before")||void 0,conference:r.get("conference")||void 0,latest_only:r.get("latest_only")!=="false",has_code:w,has_hf_artifacts:y,framework:h,repository:g}),P=ae({queryKey:["top-tasks-sidebar"],queryFn:()=>U.topTasks(8),enabled:!n,staleTime:10*60*1e3}),v=m.useMemo(()=>{var i;return(((i=t.data)==null?void 0:i.pages.flatMap(l=>l.results))||[]).map(W)},[t.data]),{targetRef:O,isIntersecting:F}=Y({rootMargin:"200px"});m.useEffect(()=>{F&&t.hasNextPage&&!t.isFetchingNextPage&&t.fetchNextPage()},[F,t.hasNextPage,t.isFetchingNextPage]);const c=((C=(A=(T=t.data)==null?void 0:T.pages)==null?void 0:A[0])==null?void 0:C.count)??0,a=(R=(L=(I=t.data)==null?void 0:I.pages)==null?void 0:L[0])==null?void 0:R.scope,S=h&&t.error instanceof z&&t.error.status===404,M=(a==null?void 0:a.kind)==="framework"?a.framework_name:a==null?void 0:a.repository;return e.jsxs("div",{className:"page",children:[(a==null?void 0:a.kind)==="framework"&&e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(x,{to:"/",children:"Papers"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx(x,{to:"/frameworks",children:"Frameworks"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--ink)"},children:a.framework_name})]}),e.jsxs("div",{className:"feed-header",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"feed-title",children:n?e.jsxs(e.Fragment,{children:["Papers implemented by ",e.jsx("em",{children:M||h||g})]}):e.jsxs(e.Fragment,{children:["All ",e.jsx("em",{children:"Papers"})]})}),e.jsx("div",{className:"feed-subtitle",children:n?(a==null?void 0:a.kind)==="framework"?c>0&&`${c.toLocaleString()} papers.`:a!=null&&a.repository?e.jsxs(e.Fragment,{children:["GitHub repository ",e.jsx("strong",{children:a.repository}),". ",c>0&&`${c.toLocaleString()} papers.`]}):"Repository-scoped paper feed.":e.jsxs(e.Fragment,{children:["Search the full corpus. ",c>0&&`${c.toLocaleString()} papers indexed.`]})}),n&&a&&e.jsxs("div",{className:"paper-feed-scope-links",children:[e.jsxs("div",{className:"paper-feed-primary-links",children:[a.github_url&&e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:a.kind==="framework"?"task-framework-link":"framework-link",children:[e.jsx(E,{name:"github",size:13}),a.kind==="framework"?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:a.repository||"GitHub"}),a.num_stars!=null&&e.jsxs("span",{className:"task-framework-link-stars",children:["★ ",te(a.num_stars)]})]}):"GitHub"]}),a.kind==="framework"&&a.introducing_paper_arxiv_id&&e.jsx(x,{to:`/paper/${a.introducing_paper_arxiv_id}`,className:"framework-link",children:"Introducing paper"})]}),a.kind==="framework"&&a.recommended_tasks&&a.recommended_tasks.length>0&&e.jsx("div",{className:"paper-feed-task-tags",children:a.recommended_tasks.map(s=>s.slug?e.jsx(G,{slug:s.slug,label:s.name},s.id):null)})]})]}),e.jsx("div",{className:"period-switch",children:X.map(s=>e.jsx("button",{className:`period-btn ${$===s?"active":""}`,onClick:()=>B(s),children:s},s))})]}),e.jsx("div",{className:"papers-search-row",children:e.jsxs("div",{className:"papers-search-input-wrap",children:[e.jsx(E,{name:"search",size:14}),e.jsx("input",{className:"papers-search-input",placeholder:"Search title or abstract…",value:b,onChange:s=>k(s.target.value)})]})}),e.jsxs("div",{className:n?"papers-feed-layout-scoped":"layout-with-sidebar",children:[!n&&e.jsx("aside",{className:"sidebar",children:e.jsxs("div",{className:"sidebar-section",children:[e.jsx("div",{className:"sidebar-label",children:"Top Domains"}),P.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((s,i)=>e.jsx(p,{className:"h-5 w-full"},i))}),(H=P.data)==null?void 0:H.map(s=>e.jsxs(x,{to:`/tasks/${s.slug}`,className:"sidebar-link",children:[K(s.name,s.slug),s.paper_count!=null&&e.jsx("span",{className:"count",children:s.paper_count})]},s.id))]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:re.map(([s,i])=>e.jsx("button",{className:`sort-btn ${N===s?"active":""}`,onClick:()=>D(s),children:i},s))}),e.jsx(Z,{hasCode:w,hasHfArtifacts:y,onHasCodeChange:s=>f("has_code",s?"true":void 0),onHasHfArtifactsChange:s=>f("has_hf_artifacts",s?"true":void 0),showHasCode:!n})]}),e.jsxs("div",{className:"results-count",children:[v.length," loaded"]})]}),S?e.jsx("div",{className:"no-results",children:"Framework not found."}):t.error&&e.jsx(ee,{variant:"destructive",className:"mb-4",children:e.jsx(se,{children:"Failed to load papers. Please try again."})}),!S&&(t.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:6}).map((s,i)=>e.jsxs("div",{className:"paper-card",children:[e.jsx(p,{className:"h-[220px] w-[160px]"}),e.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[e.jsx(p,{className:"h-6 w-3/4"}),e.jsx(p,{className:"h-4 w-1/2"}),e.jsx(p,{className:"h-12 w-full"})]})]},i))}):v.length===0?e.jsx("div",{className:"no-results",children:"No matching papers."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:v.map((s,i)=>e.jsx(Q,{paper:s,rank:i+1},s.id))}),e.jsx("div",{ref:O,style:{height:1}}),t.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]}))]})]})]})};export{be as default}; +import{a as q,r as m,A as z,j as e,L as x}from"./index-D_-UZEuL.js";import{I as E,T as G,P as Q}from"./components-CmC5jqhM.js";import{c as U}from"./catalog-CjU2vAfw.js";import{t as W,d as K}from"./transform-CUuA-koJ.js";import{u as V}from"./usePapers-BCHtBW8G.js";import{u as J}from"./useDebounce-iJszRYwl.js";import{P as X}from"./usePeriodFilter-fHKAAcyd.js";import{u as Y,P as Z}from"./useIntersectionObserver-Cq9n7uOQ.js";import{S as p}from"./skeleton-CCZ1iXls.js";import{A as ee,a as se}from"./alert-B2j1kc2o.js";import{u as ae}from"./useQuery-BZo4MZ3s.js";import"./LatexTitle-B7GPgo8C.js";import"./katex.min-BSBacQyE.js";import"./papers-DHqjKX7p.js";import"./safeExternalHref-CkBrsh84.js";import"./useInfiniteQuery-CFUEkcEs.js";const re=[["trending","trending"],["new","newest"],["cited","most cited"]],te=r=>new Intl.NumberFormat("en",{notation:r>=1e3?"compact":"standard",maximumFractionDigits:1}).format(r),be=()=>{var T,A,C,I,L,R,H;const[r,_]=q(),h=r.get("framework")||void 0,g=r.get("repository")||void 0,n=!!(h||g),u=r.get("search")||"",[b,k]=m.useState(u),d=J(b,300);m.useEffect(()=>k(u),[u]),m.useEffect(()=>{if(d===u)return;const s=new URLSearchParams(r);d?s.set("search",d):s.delete("search"),_(s,{replace:!0})},[d]);const j=r.get("order_by"),N=j==="citation_count"?"cited":j==="trending"||!j&&n?"trending":"new",o=r.get("time"),$=o==="today"?"Today":o==="week"?"This Week":o==="month"?"This Month":"All Time",y=r.get("has_hf_artifacts")==="true",w=!n&&r.get("has_code")==="true",f=(s,i)=>{const l=new URLSearchParams(r);i?l.set(s,i):l.delete(s),_(l)},B=s=>{f("time",s==="Today"?"today":s==="This Week"?"week":s==="This Month"?"month":void 0)},D=s=>{f("order_by",s==="cited"?"citation_count":s==="new"?"date_published":"trending")},t=V({page_size:20,order_by:N==="trending"?"trending":N==="cited"?"citation_count":"date_published",order_dir:"desc",search:d||void 0,time:o==="today"||o==="week"||o==="month"?o:"all_time",include_resources:!0,published_after:r.get("published_after")||void 0,published_before:r.get("published_before")||void 0,conference:r.get("conference")||void 0,latest_only:r.get("latest_only")!=="false",has_code:w,has_hf_artifacts:y,framework:h,repository:g}),P=ae({queryKey:["top-tasks-sidebar"],queryFn:()=>U.topTasks(8),enabled:!n,staleTime:10*60*1e3}),v=m.useMemo(()=>{var i;return(((i=t.data)==null?void 0:i.pages.flatMap(l=>l.results))||[]).map(W)},[t.data]),{targetRef:O,isIntersecting:F}=Y({rootMargin:"200px"});m.useEffect(()=>{F&&t.hasNextPage&&!t.isFetchingNextPage&&t.fetchNextPage()},[F,t.hasNextPage,t.isFetchingNextPage]);const c=((C=(A=(T=t.data)==null?void 0:T.pages)==null?void 0:A[0])==null?void 0:C.count)??0,a=(R=(L=(I=t.data)==null?void 0:I.pages)==null?void 0:L[0])==null?void 0:R.scope,S=h&&t.error instanceof z&&t.error.status===404,M=(a==null?void 0:a.kind)==="framework"?a.framework_name:a==null?void 0:a.repository;return e.jsxs("div",{className:"page",children:[(a==null?void 0:a.kind)==="framework"&&e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(x,{to:"/",children:"Papers"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx(x,{to:"/frameworks",children:"Frameworks"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--ink)"},children:a.framework_name})]}),e.jsxs("div",{className:"feed-header",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"feed-title",children:n?e.jsxs(e.Fragment,{children:["Papers implemented by ",e.jsx("em",{children:M||h||g})]}):e.jsxs(e.Fragment,{children:["All ",e.jsx("em",{children:"Papers"})]})}),e.jsx("div",{className:"feed-subtitle",children:n?(a==null?void 0:a.kind)==="framework"?c>0&&`${c.toLocaleString()} papers.`:a!=null&&a.repository?e.jsxs(e.Fragment,{children:["GitHub repository ",e.jsx("strong",{children:a.repository}),". ",c>0&&`${c.toLocaleString()} papers.`]}):"Repository-scoped paper feed.":e.jsxs(e.Fragment,{children:["Search the full corpus. ",c>0&&`${c.toLocaleString()} papers indexed.`]})}),n&&a&&e.jsxs("div",{className:"paper-feed-scope-links",children:[e.jsxs("div",{className:"paper-feed-primary-links",children:[a.github_url&&e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:a.kind==="framework"?"task-framework-link":"framework-link",children:[e.jsx(E,{name:"github",size:13}),a.kind==="framework"?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:a.repository||"GitHub"}),a.num_stars!=null&&e.jsxs("span",{className:"task-framework-link-stars",children:["★ ",te(a.num_stars)]})]}):"GitHub"]}),a.kind==="framework"&&a.introducing_paper_arxiv_id&&e.jsx(x,{to:`/paper/${a.introducing_paper_arxiv_id}`,className:"framework-link",children:"Introducing paper"})]}),a.kind==="framework"&&a.recommended_tasks&&a.recommended_tasks.length>0&&e.jsx("div",{className:"paper-feed-task-tags",children:a.recommended_tasks.map(s=>s.slug?e.jsx(G,{slug:s.slug,label:s.name},s.id):null)})]})]}),e.jsx("div",{className:"period-switch",children:X.map(s=>e.jsx("button",{className:`period-btn ${$===s?"active":""}`,onClick:()=>B(s),children:s},s))})]}),e.jsx("div",{className:"papers-search-row",children:e.jsxs("div",{className:"papers-search-input-wrap",children:[e.jsx(E,{name:"search",size:14}),e.jsx("input",{className:"papers-search-input",placeholder:"Search title or abstract…",value:b,onChange:s=>k(s.target.value)})]})}),e.jsxs("div",{className:n?"papers-feed-layout-scoped":"layout-with-sidebar",children:[!n&&e.jsx("aside",{className:"sidebar",children:e.jsxs("div",{className:"sidebar-section",children:[e.jsx("div",{className:"sidebar-label",children:"Top Domains"}),P.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((s,i)=>e.jsx(p,{className:"h-5 w-full"},i))}),(H=P.data)==null?void 0:H.map(s=>e.jsxs(x,{to:`/tasks/${s.slug}`,className:"sidebar-link",children:[K(s.name,s.slug),s.paper_count!=null&&e.jsx("span",{className:"count",children:s.paper_count})]},s.id))]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:re.map(([s,i])=>e.jsx("button",{className:`sort-btn ${N===s?"active":""}`,onClick:()=>D(s),children:i},s))}),e.jsx(Z,{hasCode:w,hasHfArtifacts:y,onHasCodeChange:s=>f("has_code",s?"true":void 0),onHasHfArtifactsChange:s=>f("has_hf_artifacts",s?"true":void 0),showHasCode:!n})]}),e.jsxs("div",{className:"results-count",children:[v.length," loaded"]})]}),S?e.jsx("div",{className:"no-results",children:"Framework not found."}):t.error&&e.jsx(ee,{variant:"destructive",className:"mb-4",children:e.jsx(se,{children:"Failed to load papers. Please try again."})}),!S&&(t.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:6}).map((s,i)=>e.jsxs("div",{className:"paper-card",children:[e.jsx(p,{className:"h-[220px] w-[160px]"}),e.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[e.jsx(p,{className:"h-6 w-3/4"}),e.jsx(p,{className:"h-4 w-1/2"}),e.jsx(p,{className:"h-12 w-full"})]})]},i))}):v.length===0?e.jsx("div",{className:"no-results",children:"No matching papers."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:v.map((s,i)=>e.jsx(Q,{paper:s,rank:i+1},s.id))}),e.jsx("div",{ref:O,style:{height:1}}),t.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]}))]})]})]})};export{be as default}; diff --git a/assets/PrivacyView-CcXQdpRo.js b/assets/PrivacyView-BKFNJZvc.js similarity index 99% rename from assets/PrivacyView-CcXQdpRo.js rename to assets/PrivacyView-BKFNJZvc.js index a7d064cdf354d2148bca4dc64c750ce48e6fd8cc..856298ae318bf655076145be76a8f9ed01a0afc9 100644 --- a/assets/PrivacyView-CcXQdpRo.js +++ b/assets/PrivacyView-BKFNJZvc.js @@ -1 +1 @@ -import{R as s,j as e}from"./index-BrhBTT14.js";import{f as i,D as r}from"./latexPlainText-DI8YEXVe.js";const n=()=>(s.useEffect(()=>(document.title=i("Privacy Policy"),()=>{document.title=r}),[]),e.jsxs("article",{className:"page legal-page",children:[e.jsxs("header",{className:"legal-header",children:[e.jsx("p",{className:"legal-kicker",children:"Legal"}),e.jsx("h1",{children:"Privacy Policy"}),e.jsx("p",{className:"legal-effective-date",children:"Effective August 11, 2026"})]}),e.jsx("p",{children:"This Privacy Policy explains how Hugging Face, Inc. (“Hugging Face,” “we,” or “us”) collects, uses, and shares information when you use Papers With Code, including its website, research assistant, APIs, and related services (the “Service”)."}),e.jsxs("section",{children:[e.jsx("h2",{children:"1. Information we collect"}),e.jsx("h3",{children:"Information you provide"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Account information."})," If you sign in with Hugging Face, we receive account identifiers and profile details needed to authenticate you, such as your user ID, username, and avatar. If you request contributor access, we also receive and retain the verified email address associated with your Hugging Face account so we can review and communicate about your request."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Contributions and preferences."})," We collect information you submit or save, such as paper submissions and edits, bookmarks, display preferences, feedback, and communications with us. Material you submit to a public research page may be publicly visible."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Research assistant content."})," We collect your questions, conversation history, generated answers, citations, tool calls and results, and feedback about answers. Chats are private to your account unless you choose to create a share link; anyone with that link may be able to view the shared chat."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Provider and billing information."})," If you enable a model provider, we process the authorization or API credentials needed to make requests on your behalf. Hugging Face or another provider processes its own billing information under its terms. Papers With Code does not collect your payment-card details."]})]}),e.jsx("h3",{children:"Information collected automatically"}),e.jsx("p",{children:"We collect technical and usage information such as IP address, browser and device type, operating system, pages or features used, dates and times, referring pages, request identifiers, cookies, logs, and diagnostic data. For research-assistant requests, this may include the selected model, token and cost details, latency, errors, and other operational metadata."}),e.jsx("h3",{children:"Research assistant tracing"}),e.jsxs("p",{children:["To evaluate, debug, secure, and improve the research assistant, we use Langfuse to record traces. A trace may contain the complete text of your question and the assistant's answer, as well as tool inputs, tool outputs, retrieved research material, model details, usage data, and related operational metadata.",e.jsx("strong",{children:" This trace content is not redacted before it is sent to Langfuse."})]}),e.jsx("p",{children:"Papers With Code is designed for questions about research literature. Do not put passwords, API keys, confidential information, health or financial data, or other sensitive personal information in research-assistant prompts."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"2. How we use information"}),e.jsx("p",{children:"We use information to:"}),e.jsxs("ul",{children:[e.jsx("li",{children:"provide, personalize, maintain, and operate the Service;"}),e.jsx("li",{children:"authenticate users and keep accounts and the Service secure;"}),e.jsx("li",{children:"run research-assistant requests and preserve conversation history;"}),e.jsx("li",{children:"measure performance, troubleshoot failures, and improve quality;"}),e.jsx("li",{children:"review contributions, prevent abuse, and enforce applicable terms;"}),e.jsx("li",{children:"communicate with you and respond to requests; and"}),e.jsx("li",{children:"comply with law and protect users, Hugging Face, and the public."})]})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"3. How we share information"}),e.jsx("p",{children:"We may share information in these circumstances:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Service providers."})," Vendors process information for hosting, authentication, analytics, observability, security, and support. These include Hugging Face services, Langfuse for research-assistant tracing, Plausible for website analytics, and infrastructure providers."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Model providers."})," Research-assistant content is sent to the model provider you use, such as Hugging Face Inference Providers or OpenRouter, so it can generate a response. That provider's privacy terms also apply to its processing."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Public and shared content."})," Contributions intended for public pages are public. A chat is disclosed through the Service when you create and distribute a share link."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Legal, safety, and corporate events."})," We may disclose information when reasonably necessary to comply with law, protect rights and safety, investigate abuse, or complete a merger, acquisition, financing, or transfer of assets."]})]}),e.jsx("p",{children:"We do not sell your personal information."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"4. Cookies and analytics"}),e.jsx("p",{children:"We use cookies and similar storage when needed for sign-in, security, preferences, and operation of the Service. We also use Plausible to understand aggregate website usage. You can control cookies through your browser, but disabling necessary cookies may prevent account features from working."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"5. Legal bases"}),e.jsx("p",{children:"Where applicable law requires a legal basis, we process information as needed to perform our agreement with you, with your consent, to comply with legal obligations, and for legitimate interests such as operating, securing, and improving the Service. You may withdraw consent where consent is the basis for processing, without affecting earlier processing."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"6. Retention and deletion"}),e.jsx("p",{children:"Private chats are retained until you delete them, subject to limits of 100 active chats and 100 MB of chat data per user. Archiving hides a chat and frees active-chat quota but does not delete it. You may deliberately share an unlisted snapshot; deleting its private chat removes the durable transcript, workspace reference, and share link after deletion is verified. No dedicated private-chat export format is currently offered."}),e.jsx("p",{children:"We keep information for as long as reasonably needed for the purposes described here, including providing the Service, maintaining security and audit records, resolving disputes, and meeting legal obligations. Retention periods vary by data type and service provider. You can delete individual chats in the Service. Deletion may not immediately remove information from backups, security logs, or third-party systems where limited retention is required."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"7. Security and international transfers"}),e.jsx("p",{children:"We use reasonable administrative, technical, and organizational safeguards, but no internet service can guarantee absolute security. We and our service providers may process information in the United States and other countries, which may have different data-protection laws from your country. Where required, we use appropriate safeguards for international transfers."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"8. Your privacy rights"}),e.jsx("p",{children:"Depending on where you live, you may have rights to access, correct, delete, or receive a copy of your personal information; object to or restrict processing; withdraw consent; or appeal a decision about a request. You may also have the right to complain to a data-protection authority. We may need to verify your identity before fulfilling a request."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"9. Children"}),e.jsx("p",{children:"The Service is not directed to children under 13, and we do not knowingly collect personal information from children under 13. If you believe a child has provided personal information, please contact us."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"10. Changes to this policy"}),e.jsx("p",{children:"We may update this policy as the Service changes. We will post the revised policy here and update its effective date. If a change is material, we will provide additional notice when appropriate."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"11. Contact us"}),e.jsxs("p",{children:["For questions or privacy requests, contact"," ",e.jsx("a",{href:"mailto:privacy@huggingface.co",children:"privacy@huggingface.co"}),". Please do not include passwords, API keys, or other sensitive credentials in your message."]})]})]}));export{n as default}; +import{z as s,j as e}from"./index-D_-UZEuL.js";import{f as i,D as r}from"./latexPlainText-DI8YEXVe.js";const n=()=>(s.useEffect(()=>(document.title=i("Privacy Policy"),()=>{document.title=r}),[]),e.jsxs("article",{className:"page legal-page",children:[e.jsxs("header",{className:"legal-header",children:[e.jsx("p",{className:"legal-kicker",children:"Legal"}),e.jsx("h1",{children:"Privacy Policy"}),e.jsx("p",{className:"legal-effective-date",children:"Effective August 11, 2026"})]}),e.jsx("p",{children:"This Privacy Policy explains how Hugging Face, Inc. (“Hugging Face,” “we,” or “us”) collects, uses, and shares information when you use Papers With Code, including its website, research assistant, APIs, and related services (the “Service”)."}),e.jsxs("section",{children:[e.jsx("h2",{children:"1. Information we collect"}),e.jsx("h3",{children:"Information you provide"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Account information."})," If you sign in with Hugging Face, we receive account identifiers and profile details needed to authenticate you, such as your user ID, username, and avatar. If you request contributor access, we also receive and retain the verified email address associated with your Hugging Face account so we can review and communicate about your request."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Contributions and preferences."})," We collect information you submit or save, such as paper submissions and edits, bookmarks, display preferences, feedback, and communications with us. Material you submit to a public research page may be publicly visible."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Research assistant content."})," We collect your questions, conversation history, generated answers, citations, tool calls and results, and feedback about answers. Chats are private to your account unless you choose to create a share link; anyone with that link may be able to view the shared chat."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Provider and billing information."})," If you enable a model provider, we process the authorization or API credentials needed to make requests on your behalf. Hugging Face or another provider processes its own billing information under its terms. Papers With Code does not collect your payment-card details."]})]}),e.jsx("h3",{children:"Information collected automatically"}),e.jsx("p",{children:"We collect technical and usage information such as IP address, browser and device type, operating system, pages or features used, dates and times, referring pages, request identifiers, cookies, logs, and diagnostic data. For research-assistant requests, this may include the selected model, token and cost details, latency, errors, and other operational metadata."}),e.jsx("h3",{children:"Research assistant tracing"}),e.jsxs("p",{children:["To evaluate, debug, secure, and improve the research assistant, we use Langfuse to record traces. A trace may contain the complete text of your question and the assistant's answer, as well as tool inputs, tool outputs, retrieved research material, model details, usage data, and related operational metadata.",e.jsx("strong",{children:" This trace content is not redacted before it is sent to Langfuse."})]}),e.jsx("p",{children:"Papers With Code is designed for questions about research literature. Do not put passwords, API keys, confidential information, health or financial data, or other sensitive personal information in research-assistant prompts."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"2. How we use information"}),e.jsx("p",{children:"We use information to:"}),e.jsxs("ul",{children:[e.jsx("li",{children:"provide, personalize, maintain, and operate the Service;"}),e.jsx("li",{children:"authenticate users and keep accounts and the Service secure;"}),e.jsx("li",{children:"run research-assistant requests and preserve conversation history;"}),e.jsx("li",{children:"measure performance, troubleshoot failures, and improve quality;"}),e.jsx("li",{children:"review contributions, prevent abuse, and enforce applicable terms;"}),e.jsx("li",{children:"communicate with you and respond to requests; and"}),e.jsx("li",{children:"comply with law and protect users, Hugging Face, and the public."})]})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"3. How we share information"}),e.jsx("p",{children:"We may share information in these circumstances:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Service providers."})," Vendors process information for hosting, authentication, analytics, observability, security, and support. These include Hugging Face services, Langfuse for research-assistant tracing, Plausible for website analytics, and infrastructure providers."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Model providers."})," Research-assistant content is sent to the model provider you use, such as Hugging Face Inference Providers or OpenRouter, so it can generate a response. That provider's privacy terms also apply to its processing."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Public and shared content."})," Contributions intended for public pages are public. A chat is disclosed through the Service when you create and distribute a share link."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Legal, safety, and corporate events."})," We may disclose information when reasonably necessary to comply with law, protect rights and safety, investigate abuse, or complete a merger, acquisition, financing, or transfer of assets."]})]}),e.jsx("p",{children:"We do not sell your personal information."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"4. Cookies and analytics"}),e.jsx("p",{children:"We use cookies and similar storage when needed for sign-in, security, preferences, and operation of the Service. We also use Plausible to understand aggregate website usage. You can control cookies through your browser, but disabling necessary cookies may prevent account features from working."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"5. Legal bases"}),e.jsx("p",{children:"Where applicable law requires a legal basis, we process information as needed to perform our agreement with you, with your consent, to comply with legal obligations, and for legitimate interests such as operating, securing, and improving the Service. You may withdraw consent where consent is the basis for processing, without affecting earlier processing."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"6. Retention and deletion"}),e.jsx("p",{children:"Private chats are retained until you delete them, subject to limits of 100 active chats and 100 MB of chat data per user. Archiving hides a chat and frees active-chat quota but does not delete it. You may deliberately share an unlisted snapshot; deleting its private chat removes the durable transcript, workspace reference, and share link after deletion is verified. No dedicated private-chat export format is currently offered."}),e.jsx("p",{children:"We keep information for as long as reasonably needed for the purposes described here, including providing the Service, maintaining security and audit records, resolving disputes, and meeting legal obligations. Retention periods vary by data type and service provider. You can delete individual chats in the Service. Deletion may not immediately remove information from backups, security logs, or third-party systems where limited retention is required."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"7. Security and international transfers"}),e.jsx("p",{children:"We use reasonable administrative, technical, and organizational safeguards, but no internet service can guarantee absolute security. We and our service providers may process information in the United States and other countries, which may have different data-protection laws from your country. Where required, we use appropriate safeguards for international transfers."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"8. Your privacy rights"}),e.jsx("p",{children:"Depending on where you live, you may have rights to access, correct, delete, or receive a copy of your personal information; object to or restrict processing; withdraw consent; or appeal a decision about a request. You may also have the right to complain to a data-protection authority. We may need to verify your identity before fulfilling a request."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"9. Children"}),e.jsx("p",{children:"The Service is not directed to children under 13, and we do not knowingly collect personal information from children under 13. If you believe a child has provided personal information, please contact us."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"10. Changes to this policy"}),e.jsx("p",{children:"We may update this policy as the Service changes. We will post the revised policy here and update its effective date. If a change is material, we will provide additional notice when appropriate."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"11. Contact us"}),e.jsxs("p",{children:["For questions or privacy requests, contact"," ",e.jsx("a",{href:"mailto:privacy@huggingface.co",children:"privacy@huggingface.co"}),". Please do not include passwords, API keys, or other sensitive credentials in your message."]})]})]}));export{n as default}; diff --git a/assets/RateLimitsView-BcVoE98a.js b/assets/RateLimitsView-DckIJRFx.js similarity index 87% rename from assets/RateLimitsView-BcVoE98a.js rename to assets/RateLimitsView-DckIJRFx.js index d61844ebf64bb26d357590fa16b70b18cabd4c84..e505f3768cf3d4c440bbdcc87d8120376c592eaf 100644 --- a/assets/RateLimitsView-BcVoE98a.js +++ b/assets/RateLimitsView-DckIJRFx.js @@ -1 +1 @@ -import{j as e,E as t}from"./index-BrhBTT14.js";import{u as s}from"./useQuery-GhY2LXSI.js";const n=()=>{const i=s({queryKey:["submission-rate-limit-policy"],queryFn:()=>t.getRateLimitPolicy()}).data;return e.jsxs("div",{className:"page",style:{maxWidth:760},children:[e.jsx("h1",{children:"Submission and rate-limit policy"}),i?e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Each account may have up to ",i.active_pending," active submissions."]}),e.jsxs("p",{children:["New submissions are limited to ",i.subject_per_hour," per account and ",i.ip_per_hour," per source network in a rolling hour."]})]}):e.jsx("p",{children:"Loading current limits…"}),e.jsx("p",{children:"Duplicate, no-op, and idempotently replayed requests do not consume creation quota."}),e.jsx("p",{children:"Rate-limited responses use HTTP 429 with Retry-After, RateLimit, and RateLimit-Policy headers."}),e.jsx("p",{children:"Good-faith contributors who are blocked should contact the Papers with Code maintainers with their Hugging Face username."})]})};export{n as default}; +import{j as e,B as t}from"./index-D_-UZEuL.js";import{u as s}from"./useQuery-BZo4MZ3s.js";const n=()=>{const i=s({queryKey:["submission-rate-limit-policy"],queryFn:()=>t.getRateLimitPolicy()}).data;return e.jsxs("div",{className:"page",style:{maxWidth:760},children:[e.jsx("h1",{children:"Submission and rate-limit policy"}),i?e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Each account may have up to ",i.active_pending," active submissions."]}),e.jsxs("p",{children:["New submissions are limited to ",i.subject_per_hour," per account and ",i.ip_per_hour," per source network in a rolling hour."]})]}):e.jsx("p",{children:"Loading current limits…"}),e.jsx("p",{children:"Duplicate, no-op, and idempotently replayed requests do not consume creation quota."}),e.jsx("p",{children:"Rate-limited responses use HTTP 429 with Retry-After, RateLimit, and RateLimit-Policy headers."}),e.jsx("p",{children:"Good-faith contributors who are blocked should contact the Papers with Code maintainers with their Hugging Face username."})]})};export{n as default}; diff --git a/assets/SavedPapersView-DhFWb_wi.js b/assets/SavedPapersView-Czyc5GTN.js similarity index 85% rename from assets/SavedPapersView-DhFWb_wi.js rename to assets/SavedPapersView-Czyc5GTN.js index 2551ba239b799f4b4e6816b6a31a9b61b27d7776..41f2ff6a22922636cac1c548e1b2f584f774d37a 100644 --- a/assets/SavedPapersView-DhFWb_wi.js +++ b/assets/SavedPapersView-Czyc5GTN.js @@ -1 +1 @@ -import{f as h,A as g,j as e,Y as v,L as x,E as j}from"./index-BrhBTT14.js";import{u as f}from"./useQuery-GhY2LXSI.js";import{T as N,P as b}from"./components-74u_bIKK.js";import{S as r}from"./skeleton-DHdzoBmM.js";import{A as k,a as y}from"./alert-c1n3ZtEC.js";import{t as w}from"./transform-Duf4Shfn.js";import{s as A}from"./savedPapersAuth-D0oFR2zr.js";import"./LatexTitle-BJSVMlZ1.js";import"./katex.min-BSBacQyE.js";import"./papers-DBaPliAp.js";import"./safeExternalHref-CkBrsh84.js";const z=()=>{var d,o;const{user:t,isLoading:u}=h(),a=f({queryKey:["my-bookmarks"],queryFn:()=>j.getBookmarks(),enabled:!!t,staleTime:30*1e3,refetchOnWindowFocus:!1}),n=a.error instanceof g&&a.error.code==="saved_papers_bucket_authorization_required",m=!!a.data&&!a.data.bucket_connected,c=()=>{window.location.assign(A())};return u?e.jsxs("div",{className:"page",children:[e.jsx(r,{className:"h-10 w-1/3 mb-4"}),e.jsx(r,{className:"h-6 w-1/2 mb-8"})]}):t?e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Saved ",e.jsx("em",{children:"Papers"})]}),e.jsxs("div",{className:"feed-subtitle",children:[(d=a.data)!=null&&d.count?`${a.data.count.toLocaleString()} saved · grouped by domain`:"Your bookmarked papers, grouped by domain.",(o=a.data)!=null&&o.bucket_connected?e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:`https://huggingface.co/buckets/${t.username}/pwc-saved-papers`,target:"_blank",rel:"noopener noreferrer",children:"Open your Hugging Face Bucket"})]}):null]})]})}),n?e.jsxs("div",{className:"saved-bucket-migration",children:[e.jsx("p",{children:"Your saved papers are still safe in Papers With Code. Approve Bucket access to copy them into a private Hugging Face Bucket that belongs to you."}),e.jsx("button",{type:"button",className:"hf-signin-btn",onClick:c,children:"Approve and migrate saved papers"})]}):a.error?e.jsx(k,{variant:"destructive",className:"mb-4",children:e.jsx(y,{children:"Failed to load your saved papers. Please try again."})}):null,m?e.jsxs("div",{className:"saved-bucket-migration",children:[e.jsxs("p",{children:[a.data.count?`Your ${a.data.count.toLocaleString()} saved ${a.data.count===1?"paper is":"papers are"} still available below. `:"When you save your first paper, ","Approve Bucket access to copy saved papers into a private Hugging Face Bucket that belongs to you. The existing data is kept until the copy is verified."]}),e.jsx("button",{type:"button",className:"hf-signin-btn",onClick:c,children:a.data.count?"Approve and migrate saved papers":"Use a Hugging Face Bucket"})]}):null,n||a.error?null:a.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((i,s)=>e.jsxs("div",{className:"paper-card",children:[e.jsx(r,{className:"h-[220px] w-[160px]"}),e.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[e.jsx(r,{className:"h-6 w-3/4"}),e.jsx(r,{className:"h-4 w-1/2"}),e.jsx(r,{className:"h-12 w-full"})]})]},s))}):!a.data||a.data.count===0?e.jsxs("div",{className:"no-results",children:["No saved papers yet."," ",e.jsx(x,{to:"/papers",className:"sidebar-link",style:{display:"inline"},children:"Browse papers →"})]}):a.data.areas.map(i=>e.jsxs("section",{className:"saved-area-section",children:[e.jsx("h2",{className:"saved-area-heading",children:i.name}),i.tasks.map(s=>{const l=s.papers.length;return e.jsxs("div",{className:"saved-task-block",children:[e.jsxs("div",{className:"saved-task-row",children:[s.slug?e.jsx(N,{slug:s.slug,label:s.name}):e.jsx("span",{className:"tag-chip",style:{background:"var(--surface)"},children:s.name}),e.jsxs("span",{className:"saved-task-count",children:[l," ",l===1?"paper":"papers"]})]}),e.jsx("div",{className:"paper-list",children:s.papers.map(p=>e.jsx(b,{paper:w(p),rank:1},p.id))})]},`task-${i.id??"other"}-${s.id??"untagged"}`)})]},`area-${i.id??"other"}`))]}):e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Saved ",e.jsx("em",{children:"Papers"})]}),e.jsx("div",{className:"feed-subtitle",children:"Sign in with Hugging Face to save papers and revisit them later."})]})}),e.jsx("div",{className:"saved-signin-panel",children:e.jsx(v,{returnTo:"/saved"})})]})};export{z as default}; +import{y as h,A as g,j as e,S as v,L as x,B as j}from"./index-D_-UZEuL.js";import{u as N}from"./useQuery-BZo4MZ3s.js";import{T as b,P as f}from"./components-CmC5jqhM.js";import{S as r}from"./skeleton-CCZ1iXls.js";import{A as k,a as y}from"./alert-B2j1kc2o.js";import{t as w}from"./transform-CUuA-koJ.js";import{s as A}from"./savedPapersAuth-CrQIIpSo.js";import"./LatexTitle-B7GPgo8C.js";import"./katex.min-BSBacQyE.js";import"./papers-DHqjKX7p.js";import"./safeExternalHref-CkBrsh84.js";const z=()=>{var d,o;const{user:t,isLoading:u}=h(),a=N({queryKey:["my-bookmarks"],queryFn:()=>j.getBookmarks(),enabled:!!t,staleTime:30*1e3,refetchOnWindowFocus:!1}),n=a.error instanceof g&&a.error.code==="saved_papers_bucket_authorization_required",m=!!a.data&&!a.data.bucket_connected,c=()=>{window.location.assign(A())};return u?e.jsxs("div",{className:"page",children:[e.jsx(r,{className:"h-10 w-1/3 mb-4"}),e.jsx(r,{className:"h-6 w-1/2 mb-8"})]}):t?e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Saved ",e.jsx("em",{children:"Papers"})]}),e.jsxs("div",{className:"feed-subtitle",children:[(d=a.data)!=null&&d.count?`${a.data.count.toLocaleString()} saved · grouped by domain`:"Your bookmarked papers, grouped by domain.",(o=a.data)!=null&&o.bucket_connected?e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:`https://huggingface.co/buckets/${t.username}/pwc-saved-papers`,target:"_blank",rel:"noopener noreferrer",children:"Open your Hugging Face Bucket"})]}):null]})]})}),n?e.jsxs("div",{className:"saved-bucket-migration",children:[e.jsx("p",{children:"Your saved papers are still safe in Papers With Code. Approve Bucket access to copy them into a private Hugging Face Bucket that belongs to you."}),e.jsx("button",{type:"button",className:"hf-signin-btn",onClick:c,children:"Approve and migrate saved papers"})]}):a.error?e.jsx(k,{variant:"destructive",className:"mb-4",children:e.jsx(y,{children:"Failed to load your saved papers. Please try again."})}):null,m?e.jsxs("div",{className:"saved-bucket-migration",children:[e.jsxs("p",{children:[a.data.count?`Your ${a.data.count.toLocaleString()} saved ${a.data.count===1?"paper is":"papers are"} still available below. `:"When you save your first paper, ","Approve Bucket access to copy saved papers into a private Hugging Face Bucket that belongs to you. The existing data is kept until the copy is verified."]}),e.jsx("button",{type:"button",className:"hf-signin-btn",onClick:c,children:a.data.count?"Approve and migrate saved papers":"Use a Hugging Face Bucket"})]}):null,n||a.error?null:a.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((i,s)=>e.jsxs("div",{className:"paper-card",children:[e.jsx(r,{className:"h-[220px] w-[160px]"}),e.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[e.jsx(r,{className:"h-6 w-3/4"}),e.jsx(r,{className:"h-4 w-1/2"}),e.jsx(r,{className:"h-12 w-full"})]})]},s))}):!a.data||a.data.count===0?e.jsxs("div",{className:"no-results",children:["No saved papers yet."," ",e.jsx(x,{to:"/papers",className:"sidebar-link",style:{display:"inline"},children:"Browse papers →"})]}):a.data.areas.map(i=>e.jsxs("section",{className:"saved-area-section",children:[e.jsx("h2",{className:"saved-area-heading",children:i.name}),i.tasks.map(s=>{const l=s.papers.length;return e.jsxs("div",{className:"saved-task-block",children:[e.jsxs("div",{className:"saved-task-row",children:[s.slug?e.jsx(b,{slug:s.slug,label:s.name}):e.jsx("span",{className:"tag-chip",style:{background:"var(--surface)"},children:s.name}),e.jsxs("span",{className:"saved-task-count",children:[l," ",l===1?"paper":"papers"]})]}),e.jsx("div",{className:"paper-list",children:s.papers.map(p=>e.jsx(f,{paper:w(p),rank:1},p.id))})]},`task-${i.id??"other"}-${s.id??"untagged"}`)})]},`area-${i.id??"other"}`))]}):e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Saved ",e.jsx("em",{children:"Papers"})]}),e.jsx("div",{className:"feed-subtitle",children:"Sign in with Hugging Face to save papers and revisit them later."})]})}),e.jsx("div",{className:"saved-signin-panel",children:e.jsx(v,{returnTo:"/saved"})})]})};export{z as default}; diff --git a/assets/SearchOverlay-BRKHPZ6C.js b/assets/SearchOverlay-C4cuTRdQ.js similarity index 90% rename from assets/SearchOverlay-BRKHPZ6C.js rename to assets/SearchOverlay-C4cuTRdQ.js index 6b42950008c326bcb30f9d68989d878b719c7aea..71adf86633f22bc89d222b82178b5cb15e03478d 100644 --- a/assets/SearchOverlay-BRKHPZ6C.js +++ b/assets/SearchOverlay-C4cuTRdQ.js @@ -1 +1 @@ -import{r as C,u as K,R as T,i as L,j as s}from"./index-BrhBTT14.js";import{u as m}from"./useQuery-GhY2LXSI.js";import{L as $}from"./LatexTitle-BJSVMlZ1.js";import{c as j}from"./catalog-CkpmYxEk.js";import{p as D}from"./papers-DBaPliAp.js";import{u as z}from"./useDebounce-DzNGzmqr.js";import{c as M,h as B,d as I}from"./transform-Duf4Shfn.js";import"./katex.min-BSBacQyE.js";const X=10,Y=({open:n,onClose:l})=>{var f,_,F,q,E,P;const v=C.useRef(null),w=K(),[c,R]=T.useState(""),[h,p]=T.useState(1),a=z(c,200),g=L();C.useEffect(()=>{var r;if(!n)return;(r=v.current)==null||r.focus();const e=A=>{A.key==="Escape"&&l()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n,l]);const t=m({queryKey:["search-papers",a,h],queryFn:()=>D.search(a,h,X),enabled:n&&a.length>=2,staleTime:6e4}),k=m({queryKey:["search-tasks",a],queryFn:()=>j.listTasks({q:a,page_size:6}),enabled:n&&a.length>=2,staleTime:6e4}),y=m({queryKey:["search-methods",a],queryFn:()=>j.listMethods({q:a,page_size:6}),enabled:n&&a.length>=2,staleTime:6e4}),N=m({queryKey:["search-benchmarks",a],queryFn:()=>j.listDatasets({q:a,page_size:6}),enabled:n&&a.length>=2,staleTime:6e4});if(!n)return null;const o=((f=k.data)==null?void 0:f.results)||[],d=((_=y.data)==null?void 0:_.results)||[],u=((F=N.data)==null?void 0:F.results)||[],x=((q=t.data)==null?void 0:q.results)||[],Q=t.isFetching||k.isFetching||y.isFetching||N.isFetching,S=o.length||x.length||d.length||u.length,i=e=>{l(),w(e)},b=()=>{const e=c.trim();e&&i(`/chat?q=${encodeURIComponent(e)}`)};return s.jsx("div",{className:"search-overlay",onClick:l,children:s.jsxs("div",{className:"search-modal",onClick:e=>e.stopPropagation(),children:[s.jsx("input",{ref:v,className:"search-modal-input",placeholder:"Search papers, tasks, methods, or benchmarks…",value:c,onChange:e=>{R(e.target.value),p(1)},onKeyDown:e=>{g&&e.key==="Enter"&&(e.preventDefault(),b())}}),s.jsxs("div",{className:"search-results",children:[g&&c.trim()&&s.jsxs("button",{type:"button",className:"search-ask-row",onClick:b,children:[s.jsx("span",{className:"search-ask-chip",children:"assistant"}),s.jsxs("span",{className:"search-ask-text",children:["Ask: “",c.trim(),"”"]}),s.jsx("kbd",{children:"↵"})]}),!a&&s.jsxs("div",{className:"search-empty",children:["Try “diffusion”, “object detection”, or an arXiv id.",g&&s.jsx("span",{className:"search-empty-sub",children:"Press Enter to ask the assistant"})]}),a&&!Q&&!S&&s.jsxs("div",{className:"search-empty",children:['No matches for "',c,'"']}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"search-section-label",children:["Tasks · ",o.length]}),o.map(e=>{const r=M(B(e.slug||""));return s.jsxs("div",{className:"search-result-tag",onClick:()=>i(`/tasks/${e.slug}`),children:[s.jsx("span",{className:"dot",style:{width:6,height:6,borderRadius:"50%",background:r.dot}}),s.jsx("span",{className:"name",children:I(e.name,e.slug)}),e.paper_count!=null&&s.jsxs("span",{className:"count",children:[e.paper_count," papers"]})]},e.id)})]}),d.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"search-section-label",children:["Methods · ",d.length]}),d.map(e=>s.jsxs("div",{className:"search-result-tag",onClick:()=>i(`/methods/${e.slug||e.id}`),children:[s.jsx("span",{style:{fontFamily:"var(--mono)",fontWeight:600},children:e.name}),e.paper_count!=null&&s.jsxs("span",{className:"count",children:[e.paper_count," papers"]})]},e.id))]}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"search-section-label",children:["Benchmarks · ",u.length]}),u.map(e=>s.jsxs("div",{className:"search-result-tag",onClick:()=>i(`/benchmark/${e.slug||e.id}`),children:[s.jsx("span",{className:"name",children:e.name}),e.paper_count!=null&&e.paper_count>0&&s.jsxs("span",{className:"count",children:[e.paper_count," entries"]})]},e.id))]}),x.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"search-section-label",children:["Papers · page ",h]}),x.map(e=>{var r;return s.jsxs("div",{className:"search-result",onClick:()=>i(`/paper/${e.arxiv_id||e.id}`),children:[s.jsx("div",{className:"search-result-title",children:s.jsx($,{title:e.title})}),s.jsxs("div",{className:"search-result-meta",children:[s.jsx("span",{children:e.arxiv_id?`arXiv:${e.arxiv_id}`:"External resource"}),((r=e.authors)==null?void 0:r[0])&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"·"}),s.jsxs("span",{children:[e.authors[0],e.authors.length>1?" et al.":""]})]}),e.citation_count!=null&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"·"}),s.jsxs("span",{children:["↑ ",e.citation_count.toLocaleString()]})]})]})]},e.id)}),(((E=t.data)==null?void 0:E.previous_page)||((P=t.data)==null?void 0:P.next_page))&&s.jsxs("div",{className:"search-paper-pagination",children:[s.jsx("button",{type:"button",disabled:!t.data.previous_page||t.isFetching,onClick:()=>{var e;return p(((e=t.data)==null?void 0:e.previous_page)||1)},children:"Previous"}),s.jsxs("span",{children:["Page ",h]}),s.jsx("button",{type:"button",disabled:!t.data.next_page||t.isFetching,onClick:()=>{var e;(e=t.data)!=null&&e.next_page&&p(t.data.next_page)},children:"Next"})]})]})]})]})})};export{Y as default}; +import{r as C,u as K,z as T,i as L,j as s}from"./index-D_-UZEuL.js";import{u as m}from"./useQuery-BZo4MZ3s.js";import{L as $}from"./LatexTitle-B7GPgo8C.js";import{c as j}from"./catalog-CjU2vAfw.js";import{p as z}from"./papers-DHqjKX7p.js";import{u as D}from"./useDebounce-iJszRYwl.js";import{c as M,h as B,d as I}from"./transform-CUuA-koJ.js";import"./katex.min-BSBacQyE.js";const X=10,Y=({open:n,onClose:l})=>{var f,_,F,q,E,P;const v=C.useRef(null),w=K(),[c,R]=T.useState(""),[h,p]=T.useState(1),a=D(c,200),g=L();C.useEffect(()=>{var r;if(!n)return;(r=v.current)==null||r.focus();const e=A=>{A.key==="Escape"&&l()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n,l]);const t=m({queryKey:["search-papers",a,h],queryFn:()=>z.search(a,h,X),enabled:n&&a.length>=2,staleTime:6e4}),k=m({queryKey:["search-tasks",a],queryFn:()=>j.listTasks({q:a,page_size:6}),enabled:n&&a.length>=2,staleTime:6e4}),y=m({queryKey:["search-methods",a],queryFn:()=>j.listMethods({q:a,page_size:6}),enabled:n&&a.length>=2,staleTime:6e4}),N=m({queryKey:["search-benchmarks",a],queryFn:()=>j.listDatasets({q:a,page_size:6}),enabled:n&&a.length>=2,staleTime:6e4});if(!n)return null;const o=((f=k.data)==null?void 0:f.results)||[],d=((_=y.data)==null?void 0:_.results)||[],u=((F=N.data)==null?void 0:F.results)||[],x=((q=t.data)==null?void 0:q.results)||[],Q=t.isFetching||k.isFetching||y.isFetching||N.isFetching,S=o.length||x.length||d.length||u.length,i=e=>{l(),w(e)},b=()=>{const e=c.trim();e&&i(`/chat?q=${encodeURIComponent(e)}`)};return s.jsx("div",{className:"search-overlay",onClick:l,children:s.jsxs("div",{className:"search-modal",onClick:e=>e.stopPropagation(),children:[s.jsx("input",{ref:v,className:"search-modal-input",placeholder:"Search papers, tasks, methods, or benchmarks…",value:c,onChange:e=>{R(e.target.value),p(1)},onKeyDown:e=>{g&&e.key==="Enter"&&(e.preventDefault(),b())}}),s.jsxs("div",{className:"search-results",children:[g&&c.trim()&&s.jsxs("button",{type:"button",className:"search-ask-row",onClick:b,children:[s.jsx("span",{className:"search-ask-chip",children:"assistant"}),s.jsxs("span",{className:"search-ask-text",children:["Ask: “",c.trim(),"”"]}),s.jsx("kbd",{children:"↵"})]}),!a&&s.jsxs("div",{className:"search-empty",children:["Try “diffusion”, “object detection”, or an arXiv id.",g&&s.jsx("span",{className:"search-empty-sub",children:"Press Enter to ask the assistant"})]}),a&&!Q&&!S&&s.jsxs("div",{className:"search-empty",children:['No matches for "',c,'"']}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"search-section-label",children:["Tasks · ",o.length]}),o.map(e=>{const r=M(B(e.slug||""));return s.jsxs("div",{className:"search-result-tag",onClick:()=>i(`/tasks/${e.slug}`),children:[s.jsx("span",{className:"dot",style:{width:6,height:6,borderRadius:"50%",background:r.dot}}),s.jsx("span",{className:"name",children:I(e.name,e.slug)}),e.paper_count!=null&&s.jsxs("span",{className:"count",children:[e.paper_count," papers"]})]},e.id)})]}),d.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"search-section-label",children:["Methods · ",d.length]}),d.map(e=>s.jsxs("div",{className:"search-result-tag",onClick:()=>i(`/methods/${e.slug||e.id}`),children:[s.jsx("span",{style:{fontFamily:"var(--mono)",fontWeight:600},children:e.name}),e.paper_count!=null&&s.jsxs("span",{className:"count",children:[e.paper_count," papers"]})]},e.id))]}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"search-section-label",children:["Benchmarks · ",u.length]}),u.map(e=>s.jsxs("div",{className:"search-result-tag",onClick:()=>i(`/benchmark/${e.slug||e.id}`),children:[s.jsx("span",{className:"name",children:e.name}),e.paper_count!=null&&e.paper_count>0&&s.jsxs("span",{className:"count",children:[e.paper_count," entries"]})]},e.id))]}),x.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"search-section-label",children:["Papers · page ",h]}),x.map(e=>{var r;return s.jsxs("div",{className:"search-result",onClick:()=>i(`/paper/${e.arxiv_id||e.id}`),children:[s.jsx("div",{className:"search-result-title",children:s.jsx($,{title:e.title})}),s.jsxs("div",{className:"search-result-meta",children:[s.jsx("span",{children:e.arxiv_id?`arXiv:${e.arxiv_id}`:"External resource"}),((r=e.authors)==null?void 0:r[0])&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"·"}),s.jsxs("span",{children:[e.authors[0],e.authors.length>1?" et al.":""]})]}),e.citation_count!=null&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"·"}),s.jsxs("span",{children:["↑ ",e.citation_count.toLocaleString()]})]})]})]},e.id)}),(((E=t.data)==null?void 0:E.previous_page)||((P=t.data)==null?void 0:P.next_page))&&s.jsxs("div",{className:"search-paper-pagination",children:[s.jsx("button",{type:"button",disabled:!t.data.previous_page||t.isFetching,onClick:()=>{var e;return p(((e=t.data)==null?void 0:e.previous_page)||1)},children:"Previous"}),s.jsxs("span",{children:["Page ",h]}),s.jsx("button",{type:"button",disabled:!t.data.next_page||t.isFetching,onClick:()=>{var e;(e=t.data)!=null&&e.next_page&&p(t.data.next_page)},children:"Next"})]})]})]})]})})};export{Y as default}; diff --git a/assets/SettingsView-BGS_66Ni.js b/assets/SettingsView-CbC3PqlO.js similarity index 93% rename from assets/SettingsView-BGS_66Ni.js rename to assets/SettingsView-CbC3PqlO.js index 84262800527ddfda5ffc5000d4d25a6d12aa0273..9a6e2c9831ef31c5652ec0201677020479c1024e 100644 --- a/assets/SettingsView-BGS_66Ni.js +++ b/assets/SettingsView-CbC3PqlO.js @@ -1,9 +1,9 @@ -import{c as j,f as Y,l as q,ad as F,i as U,R as u,g as $,j as e,Y as x,A as O}from"./index-BrhBTT14.js";import{u as y}from"./useMutation-DqfuSW7Q.js";import{S as _}from"./switch-DpBsrlqh.js";import{c as v}from"./chat-Ck3hlrgT.js";import{f as Q,D as W}from"./latexPlainText-DI8YEXVe.js";import{u as B,a as H,r as K,b}from"./openrouter-DzllS15k.js";import{E as L}from"./external-link-uK7nAEgd.js";import"./index-WJQaPd7m.js";import"./useQuery-GhY2LXSI.js";/** +import{d as j,y as q,f as F,ai as Y,i as U,z as u,g as $,j as e,S as x,A as O}from"./index-D_-UZEuL.js";import{u as y}from"./useMutation-P0Dg96Vh.js";import{S as _}from"./switch-giaX-T5P.js";import{c as v}from"./chat-7zW8PrrA.js";import{f as Q,D as W}from"./latexPlainText-DI8YEXVe.js";import{u as B,a as H,r as K,b}from"./openrouter-DNgcWuY9.js";import{E as z}from"./external-link-Dm5dHWqK.js";import"./index-DlwDDz8H.js";import"./useQuery-BZo4MZ3s.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const z=j("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** + */const L=j("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. @@ -13,4 +13,4 @@ import{c as j,f as Y,l as q,ad as F,i as U,R as u,g as $,j as e,Y as x,A as O}fr * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const G=j("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),X="https://openrouter.ai/settings/keys";function Z(t,o){if(t instanceof O){if(typeof t.detail=="string")return t.detail;if(typeof t.detail=="object"&&t.detail!==null&&"message"in t.detail&&typeof t.detail.message=="string")return t.detail.message}return t instanceof Error&&!t.message.startsWith("API request failed:")?t.message:o}const le=()=>{const{user:t,isLoading:o}=Y(),{preferences:S,setHideClosedSourceEvals:P,canPersist:M}=q(),{theme:A,setTheme:T}=F(),I=A??"system",r=U(),[f,l]=u.useState(""),[k,c]=u.useState(""),[d,N]=u.useState(""),h=$(),R=B(r&&!!t),D=H(r&&!!t),n=R.data,i=D.data,a=n?K(n.resets_at):null,m=(s,g)=>{l(Z(s,g)),c(s instanceof O?s.code??"":"")},p=y({mutationFn:s=>v.connectOpenRouterCredential(s),onSuccess:s=>{h.setQueryData(b,s),N(""),l(""),c("")},onError:s=>m(s,"Could not connect the OpenRouter key.")}),w=y({mutationFn:s=>v.setOpenRouterFallback(s),onSuccess:s=>{h.setQueryData(b,s),l(""),c("")},onError:s=>m(s,"Could not change paid fallback.")}),C=y({mutationFn:()=>v.disconnectOpenRouterCredential(),onSuccess:()=>{h.setQueryData(b,{connected:!1,verified_at:null,fallback_enabled:!1}),l(""),c("")},onError:s=>m(s,"Could not disconnect the OpenRouter key.")});return u.useEffect(()=>(document.title=Q("Settings"),()=>{document.title=W}),[]),e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsx("h1",{className:"feed-title",children:e.jsx("em",{children:"Settings"})}),e.jsx("div",{className:"feed-subtitle",children:"Control how papers and benchmarks are displayed across the site."})]})}),t&&e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Catalog access"}),e.jsx("div",{className:"settings-note settings-note-flush",children:e.jsxs("span",{children:["Role: ",e.jsx("strong",{children:t.role??"community member"}),"."," ",t.can_directly_edit_catalog?"You can apply catalog edits directly. Destructive changes require a recent sign-in.":"Your catalog suggestions are sent to the submissions queue for review.",t.is_admin?" You can also review submissions and use administrative maintenance tools.":" Submission review and maintenance tools remain admin-only."]})})]}),r&&e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Chat usage & billing"}),o&&!t?e.jsx("div",{className:"settings-billing-loading",role:"status","aria-live":"polite",children:"Checking account…"}):t?e.jsx("div",{className:"settings-provider-grid",children:e.jsxs("section",{className:"settings-provider-card",id:"openrouter-byok","aria-labelledby":"openrouter-heading",children:[e.jsxs("div",{className:"settings-provider-heading",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"openrouter-heading",children:"OpenRouter"}),e.jsx("p",{children:"Papers With Code-funded allowance and optional fallback"})]}),(i==null?void 0:i.connected)&&e.jsx("span",{className:"settings-connected-badge",children:"Key connected"})]}),e.jsx("p",{className:"settings-row-desc",children:"Papers With Code pays for these OpenRouter requests and provides free but limited monthly usage. Your own key is available as an optional fallback."}),n?e.jsxs("div",{className:"settings-usage-row",children:[e.jsxs("div",{className:"settings-usage-heading",children:[e.jsxs("div",{children:[e.jsx("div",{className:"settings-row-label",children:"Monthly OpenRouter usage"}),e.jsxs("div",{className:"settings-row-desc",children:["Resets ",a==null?void 0:a.local," ",e.jsxs("span",{"aria-label":"UTC reset time",children:["(",a==null?void 0:a.utc,")"]})]})]}),e.jsx("strong",{children:n.available?`${n.remaining_percent}% left`:"Unavailable"})]}),e.jsx("div",{className:"settings-usage-track",role:"progressbar","aria-label":`${n.remaining_percent}% remaining; resets ${a==null?void 0:a.local}; ${a==null?void 0:a.utc}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n.remaining_percent,children:e.jsx("span",{style:{width:`${n.remaining_percent}%`}})}),!n.available&&e.jsxs("p",{className:"settings-limit-note",children:[n.unavailable_reason==="personal_allowance_exhausted"?"Your free monthly allowance is depleted.":`The shared OpenRouter credits are currently unavailable. ${n.remaining_percent}% of your personal allowance remains.`," DeepSeek V4 Flash is temporarily unavailable unless you enable your own key below."]})]}):e.jsx("div",{className:"settings-billing-loading",children:R.isError||n?"OpenRouter usage is currently unavailable.":"Checking OpenRouter usage…"}),e.jsxs("div",{className:"settings-byok-controls",children:[e.jsx("div",{className:"settings-row-label",children:"Provide your own OpenRouter API key"}),i!=null&&i.connected?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"settings-row-desc",children:["Connected",i.verified_at?` · Last verified ${new Date(i.verified_at).toLocaleString()}`:"",". Your API key is stored securely using AES-256 encryption. It is never shown again."]}),e.jsxs("label",{className:"settings-fallback-control",children:[e.jsx(_,{checked:i.fallback_enabled,disabled:w.isPending,onCheckedChange:s=>w.mutate(!!s)}),e.jsxs("span",{children:[e.jsx("strong",{children:"Use my OpenRouter key when Papers With Code-funded OpenRouter access is unavailable"}),e.jsx("small",{children:"OpenRouter bills this usage to your own account. It is not covered by Papers With Code."})]})]}),e.jsx("p",{className:"settings-billing-help",children:"Disconnecting prevents new requests but cannot cancel a request already sent to OpenRouter."}),e.jsxs("div",{className:"settings-billing-actions",children:[e.jsx("button",{className:"button",type:"button",disabled:C.isPending,onClick:()=>C.mutate(),children:"Disconnect"}),e.jsxs("a",{className:"button",href:X,target:"_blank",rel:"noreferrer",children:["Revoke or rotate at OpenRouter ",e.jsx(L,{"aria-hidden":"true"})]})]})]}):e.jsxs("form",{onSubmit:s=>{s.preventDefault(),d.trim()&&p.mutate(d.trim())},children:[e.jsx("label",{className:"settings-token-label",htmlFor:"openrouter-api-key",children:"OpenRouter API key"}),e.jsx("input",{id:"openrouter-api-key",type:"password",autoComplete:"off",value:d,onChange:s=>N(s.target.value),placeholder:"sk-or-…"}),e.jsx("p",{className:"settings-billing-help",children:"Connecting stores the key but does not authorize paid fallback. Enable billing separately after it is verified."}),e.jsx("div",{className:"settings-billing-actions",children:e.jsx("button",{className:"button button-primary",type:"submit",disabled:!d.trim()||p.isPending,children:p.isPending?"Verifying…":"Connect key"})})]}),f&&e.jsxs("div",{className:"settings-token-error",children:[e.jsx("p",{children:k==="fresh_auth_required"?"Your account is signed in, but adding or enabling an API key requires a Hugging Face sign-in from the last 15 minutes.":f}),k==="fresh_auth_required"&&e.jsx("div",{className:"settings-billing-actions",children:e.jsx(x,{returnTo:"/settings#openrouter-byok",label:"Re-authenticate with Hugging Face"})})]})]})]})}):e.jsxs("div",{className:"settings-note settings-note-flush",children:[e.jsx("span",{children:"Sign in to use the Papers With Code-funded OpenRouter allowance for research chat."}),e.jsx("div",{className:"settings-note-action",children:e.jsx(x,{returnTo:"/settings"})})]})]}),r&&e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Chat privacy & retention"}),e.jsx("div",{className:"settings-note settings-note-flush",children:e.jsx("span",{children:"Chats are private and retained until you delete them. You can keep up to 100 active chats and 100 MB of chat data. Archiving removes chats from the active list and frees active-chat quota, but does not delete them. Deleting a chat permanently removes its durable transcript, workspace reference, and any public share link after deletion is verified. You can deliberately share an unlisted snapshot, but no dedicated private-chat export format is currently offered."})})]}),e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Appearance"}),e.jsx("div",{className:"theme-options","aria-label":"Color theme",children:[{value:"system",label:"System",description:"Match your device",icon:z},{value:"light",label:"Light",description:"Always use light mode",icon:G},{value:"dark",label:"Dark",description:"Always use dark mode",icon:V}].map(s=>{const g=s.icon,E=I===s.value;return e.jsxs("button",{type:"button",className:`theme-option ${E?"is-selected":""}`,"aria-pressed":E,onClick:()=>T(s.value),children:[e.jsx(g,{"aria-hidden":"true"}),e.jsxs("span",{className:"theme-option-copy",children:[e.jsx("span",{className:"theme-option-label",children:s.label}),e.jsx("span",{className:"theme-option-desc",children:s.description})]})]},s.value)})})]}),e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Evaluations"}),e.jsxs("div",{className:"settings-row",children:[e.jsxs("label",{className:"settings-row-text",htmlFor:"hide-closed-source-evals",children:[e.jsx("span",{className:"settings-row-label",children:"Hide closed-source models"}),e.jsx("span",{className:"settings-row-desc",children:"When enabled, evaluations of closed-source models (proprietary APIs and unreleased flagship models) are hidden from benchmark leaderboards and paper result tables."})]}),e.jsx(_,{id:"hide-closed-source-evals",checked:S.hide_closed_source_evals,onCheckedChange:s=>{P(!!s)}})]}),!o&&!M&&!t&&e.jsxs("div",{className:"settings-note",children:[e.jsx("span",{children:"You are browsing as a guest, so this choice only applies to the current session. Sign in to save it to your account."}),e.jsx("div",{className:"settings-note-action",children:e.jsx(x,{returnTo:"/settings"})})]})]})]})};export{le as default}; + */const G=j("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),X="https://openrouter.ai/settings/keys";function Z(t,o){if(t instanceof O){if(typeof t.detail=="string")return t.detail;if(typeof t.detail=="object"&&t.detail!==null&&"message"in t.detail&&typeof t.detail.message=="string")return t.detail.message}return t instanceof Error&&!t.message.startsWith("API request failed:")?t.message:o}const le=()=>{const{user:t,isLoading:o}=q(),{preferences:S,setHideClosedSourceEvals:P,canPersist:M}=F(),{theme:A,setTheme:T}=Y(),I=A??"system",r=U(),[f,l]=u.useState(""),[k,c]=u.useState(""),[d,N]=u.useState(""),h=$(),R=B(r&&!!t),D=H(r&&!!t),n=R.data,i=D.data,a=n?K(n.resets_at):null,m=(s,g)=>{l(Z(s,g)),c(s instanceof O?s.code??"":"")},p=y({mutationFn:s=>v.connectOpenRouterCredential(s),onSuccess:s=>{h.setQueryData(b,s),N(""),l(""),c("")},onError:s=>m(s,"Could not connect the OpenRouter key.")}),w=y({mutationFn:s=>v.setOpenRouterFallback(s),onSuccess:s=>{h.setQueryData(b,s),l(""),c("")},onError:s=>m(s,"Could not change paid fallback.")}),C=y({mutationFn:()=>v.disconnectOpenRouterCredential(),onSuccess:()=>{h.setQueryData(b,{connected:!1,verified_at:null,fallback_enabled:!1}),l(""),c("")},onError:s=>m(s,"Could not disconnect the OpenRouter key.")});return u.useEffect(()=>(document.title=Q("Settings"),()=>{document.title=W}),[]),e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsx("h1",{className:"feed-title",children:e.jsx("em",{children:"Settings"})}),e.jsx("div",{className:"feed-subtitle",children:"Control how papers and benchmarks are displayed across the site."})]})}),t&&e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Catalog access"}),e.jsx("div",{className:"settings-note settings-note-flush",children:e.jsxs("span",{children:["Role: ",e.jsx("strong",{children:t.role??"community member"}),"."," ",t.can_directly_edit_catalog?"You can apply catalog edits directly. Destructive changes require a recent sign-in.":"Your catalog suggestions are sent to the submissions queue for review.",t.is_admin?" You can also review submissions and use administrative maintenance tools.":" Submission review and maintenance tools remain admin-only."]})})]}),r&&e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Chat usage & billing"}),o&&!t?e.jsx("div",{className:"settings-billing-loading",role:"status","aria-live":"polite",children:"Checking account…"}):t?e.jsx("div",{className:"settings-provider-grid",children:e.jsxs("section",{className:"settings-provider-card",id:"openrouter-byok","aria-labelledby":"openrouter-heading",children:[e.jsxs("div",{className:"settings-provider-heading",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"openrouter-heading",children:"OpenRouter"}),e.jsx("p",{children:"Papers With Code-funded allowance and optional fallback"})]}),(i==null?void 0:i.connected)&&e.jsx("span",{className:"settings-connected-badge",children:"Key connected"})]}),e.jsx("p",{className:"settings-row-desc",children:"Papers With Code pays for these OpenRouter requests and provides free but limited monthly usage. Your own key is available as an optional fallback."}),n?e.jsxs("div",{className:"settings-usage-row",children:[e.jsxs("div",{className:"settings-usage-heading",children:[e.jsxs("div",{children:[e.jsx("div",{className:"settings-row-label",children:"Monthly OpenRouter usage"}),e.jsxs("div",{className:"settings-row-desc",children:["Resets ",a==null?void 0:a.local," ",e.jsxs("span",{"aria-label":"UTC reset time",children:["(",a==null?void 0:a.utc,")"]})]})]}),e.jsx("strong",{children:n.available?`${n.remaining_percent}% left`:"Unavailable"})]}),e.jsx("div",{className:"settings-usage-track",role:"progressbar","aria-label":`${n.remaining_percent}% remaining; resets ${a==null?void 0:a.local}; ${a==null?void 0:a.utc}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n.remaining_percent,children:e.jsx("span",{style:{width:`${n.remaining_percent}%`}})}),!n.available&&e.jsxs("p",{className:"settings-limit-note",children:[n.unavailable_reason==="personal_allowance_exhausted"?"Your free monthly allowance is depleted.":`The shared OpenRouter credits are currently unavailable. ${n.remaining_percent}% of your personal allowance remains.`," DeepSeek V4 Flash is temporarily unavailable unless you enable your own key below."]})]}):e.jsx("div",{className:"settings-billing-loading",children:R.isError||n?"OpenRouter usage is currently unavailable.":"Checking OpenRouter usage…"}),e.jsxs("div",{className:"settings-byok-controls",children:[e.jsx("div",{className:"settings-row-label",children:"Provide your own OpenRouter API key"}),i!=null&&i.connected?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"settings-row-desc",children:["Connected",i.verified_at?` · Last verified ${new Date(i.verified_at).toLocaleString()}`:"",". Your API key is stored securely using AES-256 encryption. It is never shown again."]}),e.jsxs("label",{className:"settings-fallback-control",children:[e.jsx(_,{checked:i.fallback_enabled,disabled:w.isPending,onCheckedChange:s=>w.mutate(!!s)}),e.jsxs("span",{children:[e.jsx("strong",{children:"Use my OpenRouter key when Papers With Code-funded OpenRouter access is unavailable"}),e.jsx("small",{children:"OpenRouter bills this usage to your own account. It is not covered by Papers With Code."})]})]}),e.jsx("p",{className:"settings-billing-help",children:"Disconnecting prevents new requests but cannot cancel a request already sent to OpenRouter."}),e.jsxs("div",{className:"settings-billing-actions",children:[e.jsx("button",{className:"button",type:"button",disabled:C.isPending,onClick:()=>C.mutate(),children:"Disconnect"}),e.jsxs("a",{className:"button",href:X,target:"_blank",rel:"noreferrer",children:["Revoke or rotate at OpenRouter ",e.jsx(z,{"aria-hidden":"true"})]})]})]}):e.jsxs("form",{onSubmit:s=>{s.preventDefault(),d.trim()&&p.mutate(d.trim())},children:[e.jsx("label",{className:"settings-token-label",htmlFor:"openrouter-api-key",children:"OpenRouter API key"}),e.jsx("input",{id:"openrouter-api-key",type:"password",autoComplete:"off",value:d,onChange:s=>N(s.target.value),placeholder:"sk-or-…"}),e.jsx("p",{className:"settings-billing-help",children:"Connecting stores the key but does not authorize paid fallback. Enable billing separately after it is verified."}),e.jsx("div",{className:"settings-billing-actions",children:e.jsx("button",{className:"button button-primary",type:"submit",disabled:!d.trim()||p.isPending,children:p.isPending?"Verifying…":"Connect key"})})]}),f&&e.jsxs("div",{className:"settings-token-error",children:[e.jsx("p",{children:k==="fresh_auth_required"?"Your account is signed in, but adding or enabling an API key requires a Hugging Face sign-in from the last 15 minutes.":f}),k==="fresh_auth_required"&&e.jsx("div",{className:"settings-billing-actions",children:e.jsx(x,{returnTo:"/settings#openrouter-byok",label:"Re-authenticate with Hugging Face"})})]})]})]})}):e.jsxs("div",{className:"settings-note settings-note-flush",children:[e.jsx("span",{children:"Sign in to use the Papers With Code-funded OpenRouter allowance for research chat."}),e.jsx("div",{className:"settings-note-action",children:e.jsx(x,{returnTo:"/settings"})})]})]}),r&&e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Chat privacy & retention"}),e.jsx("div",{className:"settings-note settings-note-flush",children:e.jsx("span",{children:"Chats are private and retained until you delete them. You can keep up to 100 active chats and 100 MB of chat data. Archiving removes chats from the active list and frees active-chat quota, but does not delete them. Deleting a chat permanently removes its durable transcript, workspace reference, and any public share link after deletion is verified. You can deliberately share an unlisted snapshot, but no dedicated private-chat export format is currently offered."})})]}),e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Appearance"}),e.jsx("div",{className:"theme-options","aria-label":"Color theme",children:[{value:"system",label:"System",description:"Match your device",icon:L},{value:"light",label:"Light",description:"Always use light mode",icon:G},{value:"dark",label:"Dark",description:"Always use dark mode",icon:V}].map(s=>{const g=s.icon,E=I===s.value;return e.jsxs("button",{type:"button",className:`theme-option ${E?"is-selected":""}`,"aria-pressed":E,onClick:()=>T(s.value),children:[e.jsx(g,{"aria-hidden":"true"}),e.jsxs("span",{className:"theme-option-copy",children:[e.jsx("span",{className:"theme-option-label",children:s.label}),e.jsx("span",{className:"theme-option-desc",children:s.description})]})]},s.value)})})]}),e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Evaluations"}),e.jsxs("div",{className:"settings-row",children:[e.jsxs("label",{className:"settings-row-text",htmlFor:"hide-closed-source-evals",children:[e.jsx("span",{className:"settings-row-label",children:"Hide closed-source models"}),e.jsx("span",{className:"settings-row-desc",children:"When enabled, evaluations of closed-source models (proprietary APIs and unreleased flagship models) are hidden from benchmark leaderboards and paper result tables."})]}),e.jsx(_,{id:"hide-closed-source-evals",checked:S.hide_closed_source_evals,onCheckedChange:s=>{P(!!s)}})]}),!o&&!M&&!t&&e.jsxs("div",{className:"settings-note",children:[e.jsx("span",{children:"You are browsing as a guest, so this choice only applies to the current session. Sign in to save it to your account."}),e.jsx("div",{className:"settings-note-action",children:e.jsx(x,{returnTo:"/settings"})})]})]})]})};export{le as default}; diff --git a/assets/SharedChatView-CZGxCKbv.js b/assets/SharedChatView-gssSniE9.js similarity index 79% rename from assets/SharedChatView-CZGxCKbv.js rename to assets/SharedChatView-gssSniE9.js index ea2519c009ada9ee884ce3ec1487e6b6d166e872..5548613458c91747804ac14de20f665a96b33497 100644 --- a/assets/SharedChatView-CZGxCKbv.js +++ b/assets/SharedChatView-gssSniE9.js @@ -1 +1 @@ -import{e as x,u as f,r as u,j as e,b as g}from"./index-BrhBTT14.js";import{u as j}from"./useQuery-GhY2LXSI.js";import{C as v,U as b,A as y}from"./ChatMessage-CKuWDpNc.js";import{z as p,f as S,B as N,q as k,E as w}from"./chatSessions-Dx6Tu-Jq.js";import"./katex.min-BSBacQyE.js";import"./hover-card-BcKGA4Et.js";import"./github-BtTCuUR0.js";import"./github-XgFsJJRC.js";import"./PaperPreviewLink-BCdZ9yj3.js";import"./index-BLqBUiom.js";import"./papers-DBaPliAp.js";import"./chat-Ck3hlrgT.js";import"./file-text-DROKoLCd.js";import"./chevron-down-CKySK_lE.js";const C=({detail:c})=>{const[i,h]=u.useState(()=>N(c)),s=u.useMemo(()=>{const r={};for(const a of i)for(const t of a.blocks??[])if(t.kind==="tool")for(const n of t.results??[])r[n.route_id]=n;return r},[i]),l=(r,a)=>{h(t=>t.map(n=>{var o;return n.id!==r?n:{...n,blocks:(o=n.blocks)==null?void 0:o.map((d,m)=>m===a&&(d.kind==="reasoning"||d.kind==="tool")?{...d,open:!d.open}:d)}}))};return e.jsx("div",{className:"shared-chat-transcript",children:i.map(r=>r.role==="user"?e.jsx(b,{id:r.id,text:r.text??"",paperMentions:r.paperMentions??[]},r.id):e.jsx(y,{msg:r,papers:s,onToggleBlock:l},r.id))})},G=()=>{const{shareId:c=""}=x(),i=f(),h=g(),s=j({queryKey:["shared-chat",c],queryFn:()=>w(c),retry:(a,t)=>!(t instanceof p&&t.status===404)&&a<1});u.useEffect(()=>{const a=document.title,t=document.head.querySelector('meta[name="robots"]'),n=t==null?void 0:t.content,o=t??document.createElement("meta");return o.name="robots",o.content="noindex,nofollow",t||document.head.appendChild(o),document.title="Shared conversation",()=>{document.title=a,t?t.content=n??"":o.remove()}},[]);const l=a=>{k(a,void 0,{autoSend:!1}),i("/chat")},r=s.error instanceof p&&s.error.status===404;return s.isLoading?e.jsxs("div",{className:"shared-chat-state",role:"status",children:[e.jsx(S,{})," Loading shared conversation…"]}):r?e.jsxs("div",{className:"shared-chat-state shared-chat-not-found",children:[e.jsx("h1",{children:"Shared conversation not found"}),e.jsx("p",{children:"This link is invalid or is no longer available."})]}):s.isError||!s.data?e.jsxs("div",{className:"shared-chat-state",role:"alert",children:[e.jsx("h1",{children:"Couldn’t load this conversation"}),e.jsx("p",{children:"Please check your connection and try again."}),e.jsx("button",{type:"button",onClick:()=>void s.refetch(),children:"Try again"})]}):e.jsxs("div",{className:"shared-chat-page",children:[e.jsxs("div",{className:"shared-chat-heading",children:[e.jsx("h1",{children:"Shared conversation"}),h&&e.jsx("span",{className:"chat-staging-badge",children:"Staging"})]}),e.jsxs("div",{className:"shared-chat-content",children:[e.jsx(C,{detail:s.data},s.data.updated_at),s.data.model_label&&e.jsxs("div",{className:"shared-chat-attribution",children:[e.jsxs("span",{children:["Generated with ",s.data.model_label]}),s.data.model_provider==="huggingface"&&e.jsxs("span",{children:["Powered by ",e.jsx("span",{"aria-hidden":"true",children:"🤗"})," ",e.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"})]}),s.data.model_provider==="openrouter"&&e.jsxs("span",{children:["Powered by ",e.jsx("a",{href:"https://openrouter.ai/",target:"_blank",rel:"noreferrer",children:"OpenRouter"})]})]}),e.jsxs("section",{className:"shared-chat-fresh","aria-labelledby":"shared-chat-fresh-title",children:[e.jsx("h2",{id:"shared-chat-fresh-title",children:"Start a new conversation"}),e.jsx("p",{children:"Your new question starts with an empty context."}),h&&e.jsxs("div",{className:"shared-chat-access-note",role:"note",children:[e.jsx("strong",{children:"Limited staging preview."})," Starting a chat is available only to approved Hugging Face users."]}),e.jsx(v,{onSend:a=>l(a.text),placeholder:"Ask a new research question…"})]})]})]})};export{G as default}; +import{c as x,u as f,r as u,j as e,b as g}from"./index-D_-UZEuL.js";import{u as j}from"./useQuery-BZo4MZ3s.js";import{C as v,U as b,A as y}from"./ChatMessage-DwVcq3Ve.js";import{C as p,d as S,p as N,q as k,g as C}from"./chatSessions-CPPX7pkh.js";import"./katex.min-BSBacQyE.js";import"./hover-card-DiJQFgx9.js";import"./github-DQuIliTJ.js";import"./github-iFSl-B6V.js";import"./PaperPreviewLink-B25cD-_k.js";import"./index-vCOH2DKd.js";import"./papers-DHqjKX7p.js";import"./chat-7zW8PrrA.js";import"./file-text--vrXMvWb.js";import"./chevron-down-DI19XsBw.js";const w=({detail:c})=>{const[i,h]=u.useState(()=>N(c)),s=u.useMemo(()=>{const r={};for(const a of i)for(const t of a.blocks??[])if(t.kind==="tool")for(const n of t.results??[])r[n.route_id]=n;return r},[i]),l=(r,a)=>{h(t=>t.map(n=>{var o;return n.id!==r?n:{...n,blocks:(o=n.blocks)==null?void 0:o.map((d,m)=>m===a&&(d.kind==="reasoning"||d.kind==="tool")?{...d,open:!d.open}:d)}}))};return e.jsx("div",{className:"shared-chat-transcript",children:i.map(r=>r.role==="user"?e.jsx(b,{id:r.id,text:r.text??"",paperMentions:r.paperMentions??[]},r.id):e.jsx(y,{msg:r,papers:s,onToggleBlock:l},r.id))})},H=()=>{const{shareId:c=""}=x(),i=f(),h=g(),s=j({queryKey:["shared-chat",c],queryFn:()=>C(c),retry:(a,t)=>!(t instanceof p&&t.status===404)&&a<1});u.useEffect(()=>{const a=document.title,t=document.head.querySelector('meta[name="robots"]'),n=t==null?void 0:t.content,o=t??document.createElement("meta");return o.name="robots",o.content="noindex,nofollow",t||document.head.appendChild(o),document.title="Shared conversation",()=>{document.title=a,t?t.content=n??"":o.remove()}},[]);const l=a=>{k(a,void 0,{autoSend:!1}),i("/chat")},r=s.error instanceof p&&s.error.status===404;return s.isLoading?e.jsxs("div",{className:"shared-chat-state",role:"status",children:[e.jsx(S,{})," Loading shared conversation…"]}):r?e.jsxs("div",{className:"shared-chat-state shared-chat-not-found",children:[e.jsx("h1",{children:"Shared conversation not found"}),e.jsx("p",{children:"This link is invalid or is no longer available."})]}):s.isError||!s.data?e.jsxs("div",{className:"shared-chat-state",role:"alert",children:[e.jsx("h1",{children:"Couldn’t load this conversation"}),e.jsx("p",{children:"Please check your connection and try again."}),e.jsx("button",{type:"button",onClick:()=>void s.refetch(),children:"Try again"})]}):e.jsxs("div",{className:"shared-chat-page",children:[e.jsxs("div",{className:"shared-chat-heading",children:[e.jsx("h1",{children:"Shared conversation"}),h&&e.jsx("span",{className:"chat-staging-badge",children:"Staging"})]}),e.jsxs("div",{className:"shared-chat-content",children:[e.jsx(w,{detail:s.data},s.data.updated_at),s.data.model_label&&e.jsxs("div",{className:"shared-chat-attribution",children:[e.jsxs("span",{children:["Generated with ",s.data.model_label]}),s.data.model_provider==="huggingface"&&e.jsxs("span",{children:["Powered by ",e.jsx("span",{"aria-hidden":"true",children:"🤗"})," ",e.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"})]}),s.data.model_provider==="openrouter"&&e.jsxs("span",{children:["Powered by ",e.jsx("a",{href:"https://openrouter.ai/",target:"_blank",rel:"noreferrer",children:"OpenRouter"})]})]}),e.jsxs("section",{className:"shared-chat-fresh","aria-labelledby":"shared-chat-fresh-title",children:[e.jsx("h2",{id:"shared-chat-fresh-title",children:"Start a new conversation"}),e.jsx("p",{children:"Your new question starts with an empty context."}),h&&e.jsxs("div",{className:"shared-chat-access-note",role:"note",children:[e.jsx("strong",{children:"Limited staging preview."})," Starting a chat is available only to approved Hugging Face users."]}),e.jsx(v,{onSend:a=>l(a.text),placeholder:"Ask a new research question…"})]})]})]})};export{H as default}; diff --git a/assets/SignInToEditDialog-Dcu4wTOX.js b/assets/SignInToEditDialog-DZLQNGaN.js similarity index 85% rename from assets/SignInToEditDialog-Dcu4wTOX.js rename to assets/SignInToEditDialog-DZLQNGaN.js index f6498ab99ff98e5105ad6f3a7d04796589bf7866..f9da034eb25eda908db042c2075410e52f35fb03 100644 --- a/assets/SignInToEditDialog-Dcu4wTOX.js +++ b/assets/SignInToEditDialog-DZLQNGaN.js @@ -1,4 +1,4 @@ -import{c as ne,r as a,j as e,V as ve,v as be,W as fe,d as je,X as ye,C as Ne,Y as we}from"./index-BrhBTT14.js";import{B as L}from"./button-CusGeqPB.js";import{I as d,T as Ie}from"./textarea-D6mDqvzM.js";import{D as oe,a as le,b as ce,c as de,d as me,e as Se}from"./dialog-BhRZv4T5.js";import{u as _e}from"./useMutation-DqfuSW7Q.js";import{s as v,p as b}from"./submissions-C1hG3qlt.js";import{L as De}from"./loader-circle-BqZ1qbXL.js";/** +import{d as ne,r as a,j as e,a1 as ve,q as be,a2 as fe,e as je,X as ye,C as Ne,S as we}from"./index-D_-UZEuL.js";import{B as L}from"./button-Cc8PFtC1.js";import{I as d,T as Se}from"./textarea-DlQmtN_E.js";import{D as oe,a as le,b as ce,c as de,d as me,e as Ie}from"./dialog-ChaQ5z93.js";import{u as _e}from"./useMutation-P0Dg96Vh.js";import{s as v,p as b}from"./submissions-BpzsA2lc.js";import{L as De}from"./loader-circle-D1SscQUT.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. @@ -8,4 +8,4 @@ import{c as ne,r as a,j as e,V as ve,v as be,W as fe,d as je,X as ye,C as Ne,Y a * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ye=ne("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var Ee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ke=Ee.reduce((n,o)=>{const l=ve(`Primitive.${o}`),s=a.forwardRef((i,f)=>{const{asChild:g,...j}=i,p=g?l:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(p,{...j,ref:f})});return s.displayName=`Primitive.${o}`,{...n,[o]:s}},{}),Pe="Label",ue=a.forwardRef((n,o)=>e.jsx(ke.label,{...n,ref:o,onMouseDown:l=>{var i;l.target.closest("button, input, select, textarea")||((i=n.onMouseDown)==null||i.call(n,l),!l.defaultPrevented&&l.detail>1&&l.preventDefault())}}));ue.displayName=Pe;var ge=ue;const Me=fe("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),m=a.forwardRef(({className:n,...o},l)=>e.jsx(ge,{ref:l,className:be(Me(),n),...o}));m.displayName=ge.displayName;const Le=200,Ae=2e3,Fe=300,Re=500,re=1e3,Be=2*1024*1024,ie=["image/jpeg","image/png","image/webp","image/gif"],Te={task:"e.g. Long-context Retrieval",method:"e.g. Rotary Position Embedding",benchmark:"e.g. ImageNet (ReaL)",metric:"e.g. Top-5 Accuracy",conference:"e.g. International Conference on Machine Learning 2026"},Ge={task:"Briefly describe this task and what it covers.",method:"Briefly describe this method and what it covers.",benchmark:"Briefly describe this benchmark, the task it belongs to, and where it comes from.",metric:"Briefly describe this metric and whether higher or lower is better.",conference:"Briefly describe this conference, including its research focus and edition."};function ze({open:n,onOpenChange:o,paperId:l,kind:s}){const[i,f]=a.useState(""),[g,j]=a.useState(""),[p,A]=a.useState(""),[F,R]=a.useState(""),[B,T]=a.useState(""),[G,H]=a.useState(""),[w,U]=a.useState(""),[x,I]=a.useState(null),[S,V]=a.useState(""),[_,X]=a.useState(""),[$,O]=a.useState(""),[D,K]=a.useState(""),[C,Y]=a.useState(""),[E,z]=a.useState(""),[k,J]=a.useState(""),[P,W]=a.useState(""),[q,Q]=a.useState("higher_is_better"),[Z,h]=a.useState(""),y=a.useRef(null),{toast:ee}=je(),N=s,he=s==="task"||s==="method";a.useEffect(()=>{n||(f(""),j(""),A(""),R(""),T(""),H(""),U(""),I(null),V(""),X(""),O(""),K(""),Y(""),z(""),J(""),W(""),Q("higher_is_better"),h(""))},[n]);const te=t=>{if(!t)return;if(h(""),!ie.includes(t.type)){h("Choose a JPEG, PNG, WebP, or GIF image.");return}if(t.size>Be){h("Image must be 2 MB or smaller.");return}const r=new FileReader;r.onload=()=>{if(typeof r.result!="string"){h("Could not read that image.");return}I({file_name:t.name,mime_type:t.type,data_url:r.result})},r.onerror=()=>h("Could not read that image."),r.readAsDataURL(t)},pe=t=>{t.preventDefault(),te(t.dataTransfer.files[0])},M=_e({mutationFn:async()=>{const t=l?parseInt(l):null,r=g.trim()||void 0;switch(s){case"task":return v.submit(b(t,"new_task",{name:i.trim(),description:r,image:x??void 0,image_credit:S.trim()||void 0,keywords:$.trim()||void 0,parent_id:D?Number(D):void 0,area_id:C?Number(C):void 0}));case"method":return v.submit(b(t,"new_method",{name:i.trim(),description:r,image:x??void 0,image_credit:S.trim()||void 0,source_url:_.trim()||void 0}));case"benchmark":return v.submit(b(t,"new_benchmark",{name:i.trim(),description:g.trim(),task_ids:E.split(",").map(u=>Number(u.trim())).filter(u=>Number.isInteger(u)&&u>0)}));case"metric":return v.submit(b(t,"new_metric",{name:i.trim(),description:g.trim(),direction:q==="lower_is_better"?"lower_is_better":"higher_is_better",task_id:Number(k),dataset_id:Number(P)}));case"conference":return v.submit(b(t,"new_conference",{name:i.trim(),description:r,year:Number(p),start_date:F||void 0,end_date:B||void 0,venue:G.trim()||void 0,url:w.trim()}))}},onSuccess:()=>{ee({title:"Suggestion submitted for review",description:`Thanks! An admin will review your suggested ${N} shortly.`}),o(!1)},onError:t=>{var se,ae;const r=t;let u=r.message||`Failed to submit your ${N} suggestion.`;if(r.response)try{const c=JSON.parse(r.response);typeof(c==null?void 0:c.detail)=="string"?u=c.detail:(se=c==null?void 0:c.detail)!=null&&se.message?u=`${c.detail.message} See ${c.detail.help||"/rate-limits"} for help.`:Array.isArray(c==null?void 0:c.detail)&&((ae=c.detail[0])!=null&&ae.msg)&&(u=c.detail[0].msg)}catch{u=r.response}ee({title:"Could not submit suggestion",description:u,variant:"destructive"})}}),xe=i.trim().length>0&&(s==="task"||s==="method"&&!!_.trim()||s==="conference"&&!!p&&!!w.trim()||s==="benchmark"&&!!E.trim()&&!!g.trim()||s==="metric"&&!!k&&!!P&&!!g.trim());return e.jsx(oe,{open:n,onOpenChange:o,children:e.jsxs(le,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(ce,{children:[e.jsxs(de,{children:["Suggest a new ",N]}),e.jsxs(me,{children:["Propose a ",N," that isn't in the list yet. An admin will review your suggestion before it's added."]})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-name",children:"Name"}),e.jsx(d,{id:"suggest-name",value:i,maxLength:Le,placeholder:Te[s],onChange:t=>f(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(m,{htmlFor:"suggest-description",children:["Description",s==="task"||s==="method"||s==="conference"?" (optional)":""]}),e.jsx(Ie,{id:"suggest-description",value:g,maxLength:Ae,placeholder:Ge[s],onChange:t=>j(t.target.value)})]}),s==="task"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-keywords",children:"Keywords (optional)"}),e.jsx(d,{id:"suggest-keywords",value:$,onChange:t=>O(t.target.value),placeholder:"comma-separated matching terms"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(d,{type:"number",min:"1",value:D,onChange:t=>K(t.target.value),placeholder:"Parent task ID (optional)"}),e.jsx(d,{type:"number",min:"1",value:C,onChange:t=>Y(t.target.value),placeholder:"Area ID (optional)"})]})]}),s==="benchmark"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-task-ids",children:"Intended task IDs"}),e.jsx(d,{id:"suggest-task-ids",value:E,onChange:t=>z(t.target.value),placeholder:"e.g. 9, 14"})]}),s==="metric"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(m,{children:"Intended leaderboard"}),e.jsxs("select",{className:"w-full rounded-md border bg-background p-2",value:q,onChange:t=>Q(t.target.value),children:[e.jsx("option",{value:"higher_is_better",children:"Higher is better"}),e.jsx("option",{value:"lower_is_better",children:"Lower is better"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(d,{type:"number",min:"1",value:k,onChange:t=>J(t.target.value),placeholder:"Task ID"}),e.jsx(d,{type:"number",min:"1",value:P,onChange:t=>W(t.target.value),placeholder:"Benchmark ID"})]})]}),he&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:"Image (optional)"}),e.jsx("input",{ref:y,className:"sr-only",type:"file",accept:ie.join(","),onChange:t=>{var r;return te((r=t.target.files)==null?void 0:r[0])}}),x?e.jsxs("div",{className:"relative overflow-hidden rounded-md border border-border bg-muted/30",children:[e.jsx("img",{src:x.data_url,alt:"Selected suggestion",className:"max-h-48 w-full object-contain"}),e.jsxs(L,{type:"button",variant:"secondary",size:"sm",className:"absolute right-2 top-2 h-8 px-2",onClick:()=>{I(null),y.current&&(y.current.value="")},children:[e.jsx(ye,{className:"mr-1 h-4 w-4"}),"Remove"]}),e.jsx("div",{className:"truncate border-t border-border px-3 py-2 text-xs text-muted-foreground",children:x.file_name})]}):e.jsxs("button",{type:"button",className:"flex w-full flex-col items-center justify-center rounded-md border border-dashed border-border px-4 py-6 text-center text-sm text-muted-foreground transition-colors hover:border-foreground/50 hover:text-foreground",onClick:()=>{var t;return(t=y.current)==null?void 0:t.click()},onDragOver:t=>t.preventDefault(),onDrop:pe,children:[e.jsx(Ce,{className:"mb-2 h-6 w-6"}),e.jsx("span",{children:"Drop an image here, or click to choose one"}),e.jsx("span",{className:"mt-1 text-xs",children:"JPEG, PNG, WebP, or GIF · max 2 MB"})]}),Z&&e.jsx("p",{className:"text-sm text-destructive",role:"alert",children:Z})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-image-source",children:"Image source (optional)"}),e.jsx(d,{id:"suggest-image-source",value:S,maxLength:re,placeholder:"Creator, publication, or source URL",onChange:t=>V(t.target.value)})]}),s==="method"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-method-source",children:"Source URL (optional)"}),e.jsx(d,{id:"suggest-method-source",value:_,maxLength:re,placeholder:"https://arxiv.org/abs/...",onChange:t=>X(t.target.value)})]})]}),s==="conference"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-year",children:"Edition year"}),e.jsx(d,{id:"suggest-year",type:"number",min:"1900",max:"2200",value:p,placeholder:"2026",onChange:t=>A(t.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"suggest-start-date",children:"Start date (optional)"}),e.jsx(d,{id:"suggest-start-date",type:"date",value:F,onChange:t=>R(t.target.value)})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"suggest-end-date",children:"End date (optional)"}),e.jsx(d,{id:"suggest-end-date",type:"date",value:B,onChange:t=>T(t.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-venue",children:"Venue (optional)"}),e.jsx(d,{id:"suggest-venue",value:G,maxLength:Fe,placeholder:"e.g. Vancouver Convention Centre, Canada",onChange:t=>H(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-url",children:"URL (optional)"}),e.jsx(d,{id:"suggest-url",type:"url",inputMode:"url",value:w,maxLength:Re,placeholder:"https://example.org/conference",onChange:t=>U(t.target.value)})]})]})]}),e.jsxs(Se,{children:[e.jsx(L,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),e.jsx(L,{onClick:()=>M.mutate(),disabled:M.isPending||!xe,children:M.isPending?e.jsxs(e.Fragment,{children:[e.jsx(De,{className:"w-4 h-4 mr-2 animate-spin"}),"Submitting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"w-4 h-4 mr-2"}),"Submit suggestion"]})})]})]})})}function Je({open:n,onOpenChange:o,sectionLabel:l,returnTo:s,taxonomySuggestion:i=!1}){return e.jsx(oe,{open:n,onOpenChange:o,children:e.jsxs(le,{className:"max-w-md",children:[e.jsxs(ce,{children:[e.jsxs(de,{children:["Sign in to ",i?"suggest":"edit"," ",l]}),e.jsx(me,{children:i?"Sign in with your Hugging Face account so an admin can review your suggestion.":"Anyone can suggest edits to a paper page. Sign in with your Hugging Face account first so an admin can review your submission."})]}),e.jsx("div",{className:"flex justify-center pt-2",children:e.jsx(we,{returnTo:s})})]})})}export{m as L,Ye as P,ze as S,Je as a}; + */const ze=ne("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var Ee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ke=Ee.reduce((n,o)=>{const l=ve(`Primitive.${o}`),s=a.forwardRef((i,f)=>{const{asChild:g,...j}=i,p=g?l:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(p,{...j,ref:f})});return s.displayName=`Primitive.${o}`,{...n,[o]:s}},{}),Pe="Label",ue=a.forwardRef((n,o)=>e.jsx(ke.label,{...n,ref:o,onMouseDown:l=>{var i;l.target.closest("button, input, select, textarea")||((i=n.onMouseDown)==null||i.call(n,l),!l.defaultPrevented&&l.detail>1&&l.preventDefault())}}));ue.displayName=Pe;var ge=ue;const Me=fe("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),m=a.forwardRef(({className:n,...o},l)=>e.jsx(ge,{ref:l,className:be(Me(),n),...o}));m.displayName=ge.displayName;const Le=200,Ae=2e3,Fe=300,Re=500,re=1e3,Be=2*1024*1024,ie=["image/jpeg","image/png","image/webp","image/gif"],Te={task:"e.g. Long-context Retrieval",method:"e.g. Rotary Position Embedding",benchmark:"e.g. ImageNet (ReaL)",metric:"e.g. Top-5 Accuracy",conference:"e.g. International Conference on Machine Learning 2026"},Ge={task:"Briefly describe this task and what it covers.",method:"Briefly describe this method and what it covers.",benchmark:"Briefly describe this benchmark, the task it belongs to, and where it comes from.",metric:"Briefly describe this metric and whether higher or lower is better.",conference:"Briefly describe this conference, including its research focus and edition."};function Je({open:n,onOpenChange:o,paperId:l,kind:s}){const[i,f]=a.useState(""),[g,j]=a.useState(""),[p,A]=a.useState(""),[F,R]=a.useState(""),[B,T]=a.useState(""),[G,H]=a.useState(""),[w,U]=a.useState(""),[x,S]=a.useState(null),[I,V]=a.useState(""),[_,X]=a.useState(""),[$,O]=a.useState(""),[D,K]=a.useState(""),[C,z]=a.useState(""),[E,J]=a.useState(""),[k,Y]=a.useState(""),[P,W]=a.useState(""),[q,Q]=a.useState("higher_is_better"),[Z,h]=a.useState(""),y=a.useRef(null),{toast:ee}=je(),N=s,he=s==="task"||s==="method";a.useEffect(()=>{n||(f(""),j(""),A(""),R(""),T(""),H(""),U(""),S(null),V(""),X(""),O(""),K(""),z(""),J(""),Y(""),W(""),Q("higher_is_better"),h(""))},[n]);const te=t=>{if(!t)return;if(h(""),!ie.includes(t.type)){h("Choose a JPEG, PNG, WebP, or GIF image.");return}if(t.size>Be){h("Image must be 2 MB or smaller.");return}const r=new FileReader;r.onload=()=>{if(typeof r.result!="string"){h("Could not read that image.");return}S({file_name:t.name,mime_type:t.type,data_url:r.result})},r.onerror=()=>h("Could not read that image."),r.readAsDataURL(t)},pe=t=>{t.preventDefault(),te(t.dataTransfer.files[0])},M=_e({mutationFn:async()=>{const t=l?parseInt(l):null,r=g.trim()||void 0;switch(s){case"task":return v.submit(b(t,"new_task",{name:i.trim(),description:r,image:x??void 0,image_credit:I.trim()||void 0,keywords:$.trim()||void 0,parent_id:D?Number(D):void 0,area_id:C?Number(C):void 0}));case"method":return v.submit(b(t,"new_method",{name:i.trim(),description:r,image:x??void 0,image_credit:I.trim()||void 0,source_url:_.trim()||void 0}));case"benchmark":return v.submit(b(t,"new_benchmark",{name:i.trim(),description:g.trim(),task_ids:E.split(",").map(u=>Number(u.trim())).filter(u=>Number.isInteger(u)&&u>0)}));case"metric":return v.submit(b(t,"new_metric",{name:i.trim(),description:g.trim(),direction:q==="lower_is_better"?"lower_is_better":"higher_is_better",task_id:Number(k),dataset_id:Number(P)}));case"conference":return v.submit(b(t,"new_conference",{name:i.trim(),description:r,year:Number(p),start_date:F||void 0,end_date:B||void 0,venue:G.trim()||void 0,url:w.trim()}))}},onSuccess:()=>{ee({title:"Suggestion submitted for review",description:`Thanks! An admin will review your suggested ${N} shortly.`}),o(!1)},onError:t=>{var se,ae;const r=t;let u=r.message||`Failed to submit your ${N} suggestion.`;if(r.response)try{const c=JSON.parse(r.response);typeof(c==null?void 0:c.detail)=="string"?u=c.detail:(se=c==null?void 0:c.detail)!=null&&se.message?u=`${c.detail.message} See ${c.detail.help||"/rate-limits"} for help.`:Array.isArray(c==null?void 0:c.detail)&&((ae=c.detail[0])!=null&&ae.msg)&&(u=c.detail[0].msg)}catch{u=r.response}ee({title:"Could not submit suggestion",description:u,variant:"destructive"})}}),xe=i.trim().length>0&&(s==="task"||s==="method"&&!!_.trim()||s==="conference"&&!!p&&!!w.trim()||s==="benchmark"&&!!E.trim()&&!!g.trim()||s==="metric"&&!!k&&!!P&&!!g.trim());return e.jsx(oe,{open:n,onOpenChange:o,children:e.jsxs(le,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(ce,{children:[e.jsxs(de,{children:["Suggest a new ",N]}),e.jsxs(me,{children:["Propose a ",N," that isn't in the list yet. An admin will review your suggestion before it's added."]})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-name",children:"Name"}),e.jsx(d,{id:"suggest-name",value:i,maxLength:Le,placeholder:Te[s],onChange:t=>f(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(m,{htmlFor:"suggest-description",children:["Description",s==="task"||s==="method"||s==="conference"?" (optional)":""]}),e.jsx(Se,{id:"suggest-description",value:g,maxLength:Ae,placeholder:Ge[s],onChange:t=>j(t.target.value)})]}),s==="task"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-keywords",children:"Keywords (optional)"}),e.jsx(d,{id:"suggest-keywords",value:$,onChange:t=>O(t.target.value),placeholder:"comma-separated matching terms"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(d,{type:"number",min:"1",value:D,onChange:t=>K(t.target.value),placeholder:"Parent task ID (optional)"}),e.jsx(d,{type:"number",min:"1",value:C,onChange:t=>z(t.target.value),placeholder:"Area ID (optional)"})]})]}),s==="benchmark"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-task-ids",children:"Intended task IDs"}),e.jsx(d,{id:"suggest-task-ids",value:E,onChange:t=>J(t.target.value),placeholder:"e.g. 9, 14"})]}),s==="metric"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(m,{children:"Intended leaderboard"}),e.jsxs("select",{className:"w-full rounded-md border bg-background p-2",value:q,onChange:t=>Q(t.target.value),children:[e.jsx("option",{value:"higher_is_better",children:"Higher is better"}),e.jsx("option",{value:"lower_is_better",children:"Lower is better"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(d,{type:"number",min:"1",value:k,onChange:t=>Y(t.target.value),placeholder:"Task ID"}),e.jsx(d,{type:"number",min:"1",value:P,onChange:t=>W(t.target.value),placeholder:"Benchmark ID"})]})]}),he&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:"Image (optional)"}),e.jsx("input",{ref:y,className:"sr-only",type:"file",accept:ie.join(","),onChange:t=>{var r;return te((r=t.target.files)==null?void 0:r[0])}}),x?e.jsxs("div",{className:"relative overflow-hidden rounded-md border border-border bg-muted/30",children:[e.jsx("img",{src:x.data_url,alt:"Selected suggestion",className:"max-h-48 w-full object-contain"}),e.jsxs(L,{type:"button",variant:"secondary",size:"sm",className:"absolute right-2 top-2 h-8 px-2",onClick:()=>{S(null),y.current&&(y.current.value="")},children:[e.jsx(ye,{className:"mr-1 h-4 w-4"}),"Remove"]}),e.jsx("div",{className:"truncate border-t border-border px-3 py-2 text-xs text-muted-foreground",children:x.file_name})]}):e.jsxs("button",{type:"button",className:"flex w-full flex-col items-center justify-center rounded-md border border-dashed border-border px-4 py-6 text-center text-sm text-muted-foreground transition-colors hover:border-foreground/50 hover:text-foreground",onClick:()=>{var t;return(t=y.current)==null?void 0:t.click()},onDragOver:t=>t.preventDefault(),onDrop:pe,children:[e.jsx(Ce,{className:"mb-2 h-6 w-6"}),e.jsx("span",{children:"Drop an image here, or click to choose one"}),e.jsx("span",{className:"mt-1 text-xs",children:"JPEG, PNG, WebP, or GIF · max 2 MB"})]}),Z&&e.jsx("p",{className:"text-sm text-destructive",role:"alert",children:Z})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-image-source",children:"Image source (optional)"}),e.jsx(d,{id:"suggest-image-source",value:I,maxLength:re,placeholder:"Creator, publication, or source URL",onChange:t=>V(t.target.value)})]}),s==="method"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-method-source",children:"Source URL (optional)"}),e.jsx(d,{id:"suggest-method-source",value:_,maxLength:re,placeholder:"https://arxiv.org/abs/...",onChange:t=>X(t.target.value)})]})]}),s==="conference"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-year",children:"Edition year"}),e.jsx(d,{id:"suggest-year",type:"number",min:"1900",max:"2200",value:p,placeholder:"2026",onChange:t=>A(t.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"suggest-start-date",children:"Start date (optional)"}),e.jsx(d,{id:"suggest-start-date",type:"date",value:F,onChange:t=>R(t.target.value)})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"suggest-end-date",children:"End date (optional)"}),e.jsx(d,{id:"suggest-end-date",type:"date",value:B,onChange:t=>T(t.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-venue",children:"Venue (optional)"}),e.jsx(d,{id:"suggest-venue",value:G,maxLength:Fe,placeholder:"e.g. Vancouver Convention Centre, Canada",onChange:t=>H(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"suggest-url",children:"URL (optional)"}),e.jsx(d,{id:"suggest-url",type:"url",inputMode:"url",value:w,maxLength:Re,placeholder:"https://example.org/conference",onChange:t=>U(t.target.value)})]})]})]}),e.jsxs(Ie,{children:[e.jsx(L,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),e.jsx(L,{onClick:()=>M.mutate(),disabled:M.isPending||!xe,children:M.isPending?e.jsxs(e.Fragment,{children:[e.jsx(De,{className:"w-4 h-4 mr-2 animate-spin"}),"Submitting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"w-4 h-4 mr-2"}),"Submit suggestion"]})})]})]})})}function Ye({open:n,onOpenChange:o,sectionLabel:l,returnTo:s,taxonomySuggestion:i=!1}){return e.jsx(oe,{open:n,onOpenChange:o,children:e.jsxs(le,{className:"max-w-md",children:[e.jsxs(ce,{children:[e.jsxs(de,{children:["Sign in to ",i?"suggest":"edit"," ",l]}),e.jsx(me,{children:i?"Sign in with your Hugging Face account so an admin can review your suggestion.":"Anyone can suggest edits to a paper page. Sign in with your Hugging Face account first so an admin can review your submission."})]}),e.jsx("div",{className:"flex justify-center pt-2",children:e.jsx(we,{returnTo:s})})]})})}export{m as L,ze as P,Je as S,Ye as a}; diff --git a/assets/StagingAccessRequestView-CAvxF8g0.js b/assets/StagingAccessRequestView-BS5zzPgR.js similarity index 95% rename from assets/StagingAccessRequestView-CAvxF8g0.js rename to assets/StagingAccessRequestView-BS5zzPgR.js index 4b363117520545b20306b5254a9c7396978ba0b5..82f64512a88055d0d4d4b24bbc19bd7c750b6380 100644 --- a/assets/StagingAccessRequestView-CAvxF8g0.js +++ b/assets/StagingAccessRequestView-BS5zzPgR.js @@ -1 +1 @@ -import{f as m,R as a,j as e,Y as g,aF as p}from"./index-BrhBTT14.js";import{C as j}from"./circle-check-DVQOUjVS.js";const f=()=>{const{user:s,isLoading:u}=m(),[l,d]=a.useState(!1),[r,t]=a.useState(!1),[c,i]=a.useState(null),o=async h=>{h.preventDefault(),t(!0),i(null);try{await p.requestStagingAccess(),d(!0)}catch(n){i(n instanceof Error?n.message:"Could not submit your request.")}finally{t(!1)}};return e.jsx("main",{className:"access-request-page",children:e.jsxs("section",{className:"access-request-card","aria-labelledby":"access-request-title",children:[e.jsxs("a",{className:"access-request-brand",href:"https://paperswithcode.co",children:[e.jsx("span",{className:"brand-mark","aria-hidden":"true"}),e.jsxs("span",{className:"brand-name",children:["Papers ",e.jsx("em",{children:"with"})," Code"]})]}),l?e.jsxs("div",{className:"access-request-success",role:"status",children:[e.jsx(j,{size:34,strokeWidth:1.6,"aria-hidden":"true"}),e.jsx("h1",{id:"access-request-title",children:"Request received"}),e.jsxs("p",{children:["Thanks, @",s==null?void 0:s.username,". We’ll review your contributor access request."]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"access-request-heading",children:[e.jsx("p",{className:"access-request-eyebrow",children:"Staging preview"}),e.jsx("h1",{id:"access-request-title",children:"Request access"}),e.jsx("p",{children:"This preview is limited to project contributors. Send us your verified Hugging Face username and email address to request access."})]}),u?e.jsx("p",{className:"access-request-status",role:"status",children:"Checking your Hugging Face account…"}):s?e.jsxs("form",{className:"access-request-form",onSubmit:o,children:[e.jsx("label",{htmlFor:"hf-username",children:"Hugging Face username"}),e.jsxs("div",{className:"access-request-input-wrap",children:[e.jsx("span",{"aria-hidden":"true",children:"@"}),e.jsx("input",{id:"hf-username",name:"hf_username",value:s.username,readOnly:!0,autoComplete:"username"})]}),e.jsxs("p",{className:"access-request-verified",children:["Username and email verified through Hugging Face sign-in. See our"," ",e.jsx("a",{href:"https://paperswithcode.co/privacy",children:"Privacy Policy"}),"."]}),c&&e.jsx("p",{className:"access-request-error",role:"alert",children:c}),e.jsx("button",{className:"access-request-submit",type:"submit",disabled:r,children:r?"Sending…":"Request access"})]}):e.jsxs("div",{className:"access-request-signin",children:[e.jsx("p",{children:"Sign in first so we can verify the account you’re requesting access for."}),e.jsx(g,{returnTo:"/request-access",label:"Sign in with Hugging Face",collectEmail:!0})]})]})]})})};export{f as default}; +import{y as m,z as a,j as e,S as g,aK as p}from"./index-D_-UZEuL.js";import{C as j}from"./circle-check-BpugpgkG.js";const f=()=>{const{user:s,isLoading:u}=m(),[l,d]=a.useState(!1),[r,t]=a.useState(!1),[c,i]=a.useState(null),o=async h=>{h.preventDefault(),t(!0),i(null);try{await p.requestStagingAccess(),d(!0)}catch(n){i(n instanceof Error?n.message:"Could not submit your request.")}finally{t(!1)}};return e.jsx("main",{className:"access-request-page",children:e.jsxs("section",{className:"access-request-card","aria-labelledby":"access-request-title",children:[e.jsxs("a",{className:"access-request-brand",href:"https://paperswithcode.co",children:[e.jsx("span",{className:"brand-mark","aria-hidden":"true"}),e.jsxs("span",{className:"brand-name",children:["Papers ",e.jsx("em",{children:"with"})," Code"]})]}),l?e.jsxs("div",{className:"access-request-success",role:"status",children:[e.jsx(j,{size:34,strokeWidth:1.6,"aria-hidden":"true"}),e.jsx("h1",{id:"access-request-title",children:"Request received"}),e.jsxs("p",{children:["Thanks, @",s==null?void 0:s.username,". We’ll review your contributor access request."]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"access-request-heading",children:[e.jsx("p",{className:"access-request-eyebrow",children:"Staging preview"}),e.jsx("h1",{id:"access-request-title",children:"Request access"}),e.jsx("p",{children:"This preview is limited to project contributors. Send us your verified Hugging Face username and email address to request access."})]}),u?e.jsx("p",{className:"access-request-status",role:"status",children:"Checking your Hugging Face account…"}):s?e.jsxs("form",{className:"access-request-form",onSubmit:o,children:[e.jsx("label",{htmlFor:"hf-username",children:"Hugging Face username"}),e.jsxs("div",{className:"access-request-input-wrap",children:[e.jsx("span",{"aria-hidden":"true",children:"@"}),e.jsx("input",{id:"hf-username",name:"hf_username",value:s.username,readOnly:!0,autoComplete:"username"})]}),e.jsxs("p",{className:"access-request-verified",children:["Username and email verified through Hugging Face sign-in. See our"," ",e.jsx("a",{href:"https://paperswithcode.co/privacy",children:"Privacy Policy"}),"."]}),c&&e.jsx("p",{className:"access-request-error",role:"alert",children:c}),e.jsx("button",{className:"access-request-submit",type:"submit",disabled:r,children:r?"Sending…":"Request access"})]}):e.jsxs("div",{className:"access-request-signin",children:[e.jsx("p",{children:"Sign in first so we can verify the account you’re requesting access for."}),e.jsx(g,{returnTo:"/request-access",label:"Sign in with Hugging Face",collectEmail:!0})]})]})]})})};export{f as default}; diff --git a/assets/SubmissionsDashboard-Fm_NO7Rs.js b/assets/SubmissionsDashboard-DxR4REQK.js similarity index 65% rename from assets/SubmissionsDashboard-Fm_NO7Rs.js rename to assets/SubmissionsDashboard-DxR4REQK.js index 890e7687bc0a774804b39f31a0f60a9eaf5a534d..01c5235e15ad0684b078ac7b55ba24b5a08b994b 100644 --- a/assets/SubmissionsDashboard-Fm_NO7Rs.js +++ b/assets/SubmissionsDashboard-DxR4REQK.js @@ -1,6 +1,6 @@ -var be=s=>{throw TypeError(s)};var ee=(s,t,i)=>t.has(s)||be("Cannot "+i);var f=(s,t,i)=>(ee(s,t,"read from private field"),i?i.call(s):t.get(s)),C=(s,t,i)=>t.has(s)?be("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,i),k=(s,t,i,n)=>(ee(s,t,"write to private field"),n?n.call(s,i):t.set(s,i),i),R=(s,t,i)=>(ee(s,t,"access private method"),i);import{ai as Ce,aj as te,ak as Re,al as Oe,g as Ne,r as $,am as Me,c as Ae,j as e,N as Te,R as w,v as q,f as qe,d as ke,an as Fe,ao as Ie,ap as Qe}from"./index-BrhBTT14.js";import{Q as we,b as Le,c as Ue,e as De,d as $e,f as ze,s as xe,g as Be,h as He,u as ie}from"./useQuery-GhY2LXSI.js";import{u as ge}from"./useMutation-DqfuSW7Q.js";import{c as I}from"./catalog-CkpmYxEk.js";import{s as D}from"./safeExternalHref-CkBrsh84.js";import{p as Je}from"./papers-DBaPliAp.js";import{s as B}from"./submissions-C1hG3qlt.js";import{R as Ke,S as Pe,C as Ge}from"./shield-alert-BkQ9lngS.js";import{L as H}from"./loader-circle-BqZ1qbXL.js";import{C as We}from"./circle-check-DVQOUjVS.js";function je(s,t){const i=new Set(t);return s.filter(n=>!i.has(n))}function Ye(s,t,i){const n=s.slice(0);return n[t]=i,n}var L,S,U,Q,E,T,J,K,P,G,N,ne,re,Se,ae,oe,le,_e,Ve=(_e=class extends Ce{constructor(t,i,n){super();C(this,N);C(this,L);C(this,S);C(this,U);C(this,Q);C(this,E);C(this,T);C(this,J);C(this,K);C(this,P);C(this,G,[]);k(this,L,t),k(this,Q,n),k(this,U,[]),k(this,E,[]),k(this,S,[]),this.setQueries(i)}onSubscribe(){this.listeners.size===1&&f(this,E).forEach(t=>{t.subscribe(i=>{R(this,N,oe).call(this,t,i)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,f(this,E).forEach(t=>{t.destroy()})}setQueries(t,i){k(this,U,t),k(this,Q,i),te.batch(()=>{const n=f(this,E),a=R(this,N,ae).call(this,f(this,U));a.forEach(r=>r.observer.setOptions(r.defaultedQueryOptions));const l=a.map(r=>r.observer),o=l.map(r=>r.getCurrentResult()),d=n.length!==l.length,p=l.some((r,m)=>r!==n[m]),b=d||p,j=b?!0:o.some((r,m)=>{const c=f(this,S)[m];return!c||!Re(r,c)});!b&&!j||(b&&(k(this,G,a),k(this,E,l)),k(this,S,o),this.hasListeners()&&(b&&(je(n,l).forEach(r=>{r.destroy()}),je(l,n).forEach(r=>{r.subscribe(m=>{R(this,N,oe).call(this,r,m)})})),R(this,N,le).call(this)))})}getCurrentResult(){return f(this,S)}getQueries(){return f(this,E).map(t=>t.getCurrentQuery())}getObservers(){return f(this,E)}getOptimisticResult(t,i){const n=R(this,N,ae).call(this,t),a=n.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),l=n.map(o=>o.defaultedQueryOptions.queryHash);return[a,o=>R(this,N,re).call(this,o??a,i,l),()=>R(this,N,ne).call(this,a,n)]}},L=new WeakMap,S=new WeakMap,U=new WeakMap,Q=new WeakMap,E=new WeakMap,T=new WeakMap,J=new WeakMap,K=new WeakMap,P=new WeakMap,G=new WeakMap,N=new WeakSet,ne=function(t,i){return i.map((n,a)=>{const l=t[a];return n.defaultedQueryOptions.notifyOnChangeProps?l:n.observer.trackResult(l,o=>{i.forEach(d=>{d.observer.trackProp(o)})})})},re=function(t,i,n){if(i){const a=f(this,P),l=n!==void 0&&a!==void 0&&(a.length!==n.length||n.some((o,d)=>o!==a[d]));return(!f(this,T)||f(this,S)!==f(this,K)||l||i!==f(this,J))&&(k(this,J,i),k(this,K,f(this,S)),n!==void 0&&k(this,P,n),k(this,T,Oe(f(this,T),i(t)))),f(this,T)}return t},Se=function(){var t;return((t=f(this,Q))==null?void 0:t.combine)!==void 0&&f(this,E).some((i,n)=>{var a;return i.options.suspense&&((a=f(this,S)[n])==null?void 0:a.data)===void 0})},ae=function(t){const i=new Map;f(this,E).forEach(a=>{const l=a.options.queryHash;if(!l)return;const o=i.get(l);o?o.push(a):i.set(l,[a])});const n=[];return t.forEach(a=>{var p;const l=f(this,L).defaultQueryOptions(a),d=((p=i.get(l.queryHash))==null?void 0:p.shift())??new we(f(this,L),l);n.push({defaultedQueryOptions:l,observer:d})}),n},oe=function(t,i){const n=f(this,E).indexOf(t);n!==-1&&(k(this,S,Ye(f(this,S),n,i)),R(this,N,le).call(this))},le=function(){var t;if(this.hasListeners()){const i=R(this,N,ne).call(this,f(this,S),f(this,G)),n=R(this,N,Se).call(this),a=f(this,T),l=n?a:R(this,N,re).call(this,i,(t=f(this,Q))==null?void 0:t.combine);(n||a!==l)&&te.batch(()=>{this.listeners.forEach(o=>{o(f(this,S))})})}},_e);function V({queries:s,...t},i){const n=Ne(),a=Le(),l=Ue(),o=$.useMemo(()=>s.map(u=>{const v=n.defaultQueryOptions(u);return v._optimisticResults=a?"isRestoring":"optimistic",v}),[s,n,a]);o.forEach(u=>{De(u);const v=n.getQueryCache().get(u.queryHash);$e(u,l,v)}),ze(l);const[d]=$.useState(()=>new Ve(n,o,t)),[p,b,j]=d.getOptimisticResult(o,t.combine),r=!a&&t.subscribed!==!1;$.useSyncExternalStore($.useCallback(u=>r?d.subscribe(te.batchCalls(u)):Me,[d,r]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),$.useEffect(()=>{d.setQueries(o,t)},[o,t,d]);const c=p.some((u,v)=>xe(o[v],u))?p.flatMap((u,v)=>{const g=o[v];if(g&&xe(g,u)){const F=new we(n,g);return Be(g,F,l)}return[]}):[];if(c.length>0)throw Promise.all(c);const h=p.find((u,v)=>{const g=o[v];return g&&He({result:u,errorResetBoundary:l,throwOnError:g.throwOnError,query:n.getQueryCache().get(g.queryHash),suspense:g.suspense})});if(h!=null&&h.error)throw h.error;return b(j())}/** +var be=s=>{throw TypeError(s)};var ee=(s,t,i)=>t.has(s)||be("Cannot "+i);var f=(s,t,i)=>(ee(s,t,"read from private field"),i?i.call(s):t.get(s)),C=(s,t,i)=>t.has(s)?be("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,i),k=(s,t,i,r)=>(ee(s,t,"write to private field"),r?r.call(s,i):t.set(s,i),i),R=(s,t,i)=>(ee(s,t,"access private method"),i);import{an as Ce,ao as te,ap as Re,aq as Oe,g as Ne,r as $,ar as Me,d as qe,j as e,M as Ae,z as w,q as T,y as Te,e as ke,as as Fe,at as Ie,au as Qe}from"./index-D_-UZEuL.js";import{Q as we,b as Le,c as Ue,e as De,d as $e,f as ze,s as xe,g as Be,h as He,u as ie}from"./useQuery-BZo4MZ3s.js";import{u as ge}from"./useMutation-P0Dg96Vh.js";import{c as I}from"./catalog-CjU2vAfw.js";import{s as D}from"./safeExternalHref-CkBrsh84.js";import{p as Je}from"./papers-DHqjKX7p.js";import{s as B}from"./submissions-BpzsA2lc.js";import{R as Ke,S as Pe,C as Ge}from"./shield-alert-Dix0M7Y-.js";import{L as H}from"./loader-circle-D1SscQUT.js";import{C as We}from"./circle-check-BpugpgkG.js";function je(s,t){const i=new Set(t);return s.filter(r=>!i.has(r))}function Ye(s,t,i){const r=s.slice(0);return r[t]=i,r}var L,S,U,Q,E,A,J,K,P,G,N,re,ne,Se,ae,oe,le,_e,Ve=(_e=class extends Ce{constructor(t,i,r){super();C(this,N);C(this,L);C(this,S);C(this,U);C(this,Q);C(this,E);C(this,A);C(this,J);C(this,K);C(this,P);C(this,G,[]);k(this,L,t),k(this,Q,r),k(this,U,[]),k(this,E,[]),k(this,S,[]),this.setQueries(i)}onSubscribe(){this.listeners.size===1&&f(this,E).forEach(t=>{t.subscribe(i=>{R(this,N,oe).call(this,t,i)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,f(this,E).forEach(t=>{t.destroy()})}setQueries(t,i){k(this,U,t),k(this,Q,i),te.batch(()=>{const r=f(this,E),a=R(this,N,ae).call(this,f(this,U));a.forEach(n=>n.observer.setOptions(n.defaultedQueryOptions));const l=a.map(n=>n.observer),o=l.map(n=>n.getCurrentResult()),d=r.length!==l.length,p=l.some((n,m)=>n!==r[m]),b=d||p,j=b?!0:o.some((n,m)=>{const c=f(this,S)[m];return!c||!Re(n,c)});!b&&!j||(b&&(k(this,G,a),k(this,E,l)),k(this,S,o),this.hasListeners()&&(b&&(je(r,l).forEach(n=>{n.destroy()}),je(l,r).forEach(n=>{n.subscribe(m=>{R(this,N,oe).call(this,n,m)})})),R(this,N,le).call(this)))})}getCurrentResult(){return f(this,S)}getQueries(){return f(this,E).map(t=>t.getCurrentQuery())}getObservers(){return f(this,E)}getOptimisticResult(t,i){const r=R(this,N,ae).call(this,t),a=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),l=r.map(o=>o.defaultedQueryOptions.queryHash);return[a,o=>R(this,N,ne).call(this,o??a,i,l),()=>R(this,N,re).call(this,a,r)]}},L=new WeakMap,S=new WeakMap,U=new WeakMap,Q=new WeakMap,E=new WeakMap,A=new WeakMap,J=new WeakMap,K=new WeakMap,P=new WeakMap,G=new WeakMap,N=new WeakSet,re=function(t,i){return i.map((r,a)=>{const l=t[a];return r.defaultedQueryOptions.notifyOnChangeProps?l:r.observer.trackResult(l,o=>{i.forEach(d=>{d.observer.trackProp(o)})})})},ne=function(t,i,r){if(i){const a=f(this,P),l=r!==void 0&&a!==void 0&&(a.length!==r.length||r.some((o,d)=>o!==a[d]));return(!f(this,A)||f(this,S)!==f(this,K)||l||i!==f(this,J))&&(k(this,J,i),k(this,K,f(this,S)),r!==void 0&&k(this,P,r),k(this,A,Oe(f(this,A),i(t)))),f(this,A)}return t},Se=function(){var t;return((t=f(this,Q))==null?void 0:t.combine)!==void 0&&f(this,E).some((i,r)=>{var a;return i.options.suspense&&((a=f(this,S)[r])==null?void 0:a.data)===void 0})},ae=function(t){const i=new Map;f(this,E).forEach(a=>{const l=a.options.queryHash;if(!l)return;const o=i.get(l);o?o.push(a):i.set(l,[a])});const r=[];return t.forEach(a=>{var p;const l=f(this,L).defaultQueryOptions(a),d=((p=i.get(l.queryHash))==null?void 0:p.shift())??new we(f(this,L),l);r.push({defaultedQueryOptions:l,observer:d})}),r},oe=function(t,i){const r=f(this,E).indexOf(t);r!==-1&&(k(this,S,Ye(f(this,S),r,i)),R(this,N,le).call(this))},le=function(){var t;if(this.hasListeners()){const i=R(this,N,re).call(this,f(this,S),f(this,G)),r=R(this,N,Se).call(this),a=f(this,A),l=r?a:R(this,N,ne).call(this,i,(t=f(this,Q))==null?void 0:t.combine);(r||a!==l)&&te.batch(()=>{this.listeners.forEach(o=>{o(f(this,S))})})}},_e);function V({queries:s,...t},i){const r=Ne(),a=Le(),l=Ue(),o=$.useMemo(()=>s.map(u=>{const v=r.defaultQueryOptions(u);return v._optimisticResults=a?"isRestoring":"optimistic",v}),[s,r,a]);o.forEach(u=>{De(u);const v=r.getQueryCache().get(u.queryHash);$e(u,l,v)}),ze(l);const[d]=$.useState(()=>new Ve(r,o,t)),[p,b,j]=d.getOptimisticResult(o,t.combine),n=!a&&t.subscribed!==!1;$.useSyncExternalStore($.useCallback(u=>n?d.subscribe(te.batchCalls(u)):Me,[d,n]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),$.useEffect(()=>{d.setQueries(o,t)},[o,t,d]);const c=p.some((u,v)=>xe(o[v],u))?p.flatMap((u,v)=>{const g=o[v];if(g&&xe(g,u)){const F=new we(r,g);return Be(g,F,l)}return[]}):[];if(c.length>0)throw Promise.all(c);const h=p.find((u,v)=>{const g=o[v];return g&&He({result:u,errorResetBoundary:l,throwOnError:g.throwOnError,query:r.getQueryCache().get(g.queryHash),suspense:g.suspense})});if(h!=null&&h.error)throw h.error;return b(j())}/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ve=Ae("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);function Xe({currentPayload:s,proposedPayload:t}){const[i,n]=w.useState(!1);return e.jsxs("div",{className:"submission-raw-toggle",children:[e.jsx("button",{type:"button",className:"raw-json-btn",onClick:()=>n(a=>!a),children:i?"Hide raw JSON":"Show raw JSON"}),i&&e.jsxs("div",{className:"submission-json-grid",children:[e.jsx(ce,{title:"Current payload",value:s??{}}),e.jsx(ce,{title:"Proposed payload",value:t})]})]})}function ce({title:s,value:t}){return e.jsxs("div",{className:"submission-json-block",children:[e.jsx("div",{className:"submission-diff-label",children:s}),e.jsx("pre",{children:JSON.stringify(t,null,2)})]})}function de({currentItems:s,proposedIds:t,queryPrefix:i,fetchEntity:n,knownNames:a}){const l=w.useMemo(()=>Array.from(new Set([...s.map(c=>c.id),...t])).sort((c,h)=>c-h),[s,t]),o=V({queries:n?l.map(c=>({queryKey:[i,String(c)],queryFn:()=>n(String(c)),staleTime:5*60*1e3})):[]}),d=w.useMemo(()=>{const c=new Map;return s.forEach(h=>c.set(h.id,h.name)),a==null||a.forEach((h,u)=>c.set(u,h)),o.forEach(h=>{const u=h.data;if(!u)return;const v=Number(u.id);Number.isFinite(v)&&c.set(v,u.name)}),c},[s,o,a]),p=new Set(s.map(c=>c.id)),b=new Set(t),j=l.filter(c=>p.has(c)&&!b.has(c)),r=l.filter(c=>!p.has(c)&&b.has(c)),m=(c,h)=>{const u=h==="current"&&j.includes(c),v=h==="proposed"&&r.includes(c);return e.jsx("span",{className:q("submission-diff-pill",u&&"removed",v&&"added"),children:d.get(c)??`#${c}`},c)};return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(y,{title:"Currently tagged",children:s.length>0?s.map(c=>m(c.id,"current")):e.jsx(_,{children:"No current tags"})}),e.jsx(y,{title:"Will be tagged",children:t.length>0?t.map(c=>m(c,"proposed")):e.jsx(_,{children:"No proposed tags"})})]})}function Ze({currentItems:s,proposedIds:t}){var l;const i=ie({queryKey:["organizations","submission-diff"],queryFn:()=>I.organizations(),staleTime:3e5}),n=new Map(s.map(o=>[o.id,o.name]));(l=i.data)==null||l.results.forEach(o=>{const d=Number(o.id);Number.isFinite(d)&&n.set(d,o.name)});const a=s.map(o=>({...o,name:n.get(o.id)??o.name}));return e.jsx(de,{currentItems:a,proposedIds:t,queryPrefix:"organization",knownNames:n})}function ue({label:s,currentItems:t,proposedItems:i}){const n=new Map(t.map(o=>[o.url,o])),a=new Map(i.map(o=>[o.url,o])),l=Array.from(new Set([...n.keys(),...a.keys()])).sort();return l.length===0?e.jsxs(_,{children:["No ",s," in this submission."]}):e.jsx("div",{className:"submission-url-list",children:l.map(o=>{var m;const d=n.get(o),p=a.get(o),b=!d&&p,j=d&&!p,r=d&&p&&d.is_official!==p.is_official;return e.jsx("div",{className:q("submission-url-row",b&&"added",j&&"removed",r&&"changed"),children:e.jsxs("div",{className:"submission-url-content",children:[e.jsx("a",{href:D(o)??void 0,target:"_blank",rel:"noopener noreferrer",className:q("submission-url-link",j&&"removed"),children:o}),b&&e.jsx("span",{className:"submission-pill status approved",children:"Added"}),j&&e.jsx("span",{className:"submission-pill status rejected",children:"Removed"}),r&&e.jsxs("span",{className:"submission-pill changed",children:["Official: ",String(d.is_official)," ","->"," ",String(p.is_official)]}),((m=p??d)==null?void 0:m.is_official)&&e.jsx("span",{className:"submission-pill",children:"Official"})]})},o)})})}function es({currentPayload:s,proposedPayload:t}){const i=w.useMemo(()=>(s==null?void 0:s.evaluations)??[],[s]),n=t.operations,a=w.useMemo(()=>{const r=new Set;return i.forEach(m=>{m.task_id&&r.add(Number(m.task_id))}),n.forEach(m=>{const c=m.data;c!=null&&c.task_id&&r.add(Number(c.task_id))}),Array.from(r).filter(m=>Number.isFinite(m))},[i,n]),l=w.useMemo(()=>{const r=new Set;return i.forEach(m=>{m.dataset_id&&r.add(Number(m.dataset_id))}),n.forEach(m=>{const c=m.data;c!=null&&c.dataset_id&&r.add(Number(c.dataset_id))}),Array.from(r).filter(m=>Number.isFinite(m))},[i,n]),o=V({queries:a.map(r=>({queryKey:["task",String(r)],queryFn:()=>I.getTask(String(r)),staleTime:5*60*1e3}))}),d=V({queries:l.map(r=>({queryKey:["dataset",String(r)],queryFn:()=>I.getDataset(String(r)),staleTime:5*60*1e3}))}),p=w.useMemo(()=>{const r=new Map;return o.forEach(m=>{const c=m.data;if(!c)return;const h=Number(c.id);Number.isFinite(h)&&r.set(h,c.name)}),r},[o]),b=w.useMemo(()=>{const r=new Map;return d.forEach(m=>{const c=m.data;if(!c)return;const h=Number(c.id);Number.isFinite(h)&&r.set(h,c.name)}),r},[d]),j=new Map(i.filter(r=>r.id!=null).map(r=>[Number(r.id),r]));return n.length===0?e.jsx(_,{children:"No evaluation operations in this payload."}):e.jsx("div",{className:"submission-eval-list",children:n.map((r,m)=>{const c=r.evaluation_id?j.get(r.evaluation_id):void 0,u=(r.op==="update"?{...c,...r.data}:r.data??c)??{};return e.jsxs("div",{className:"submission-eval-op",children:[e.jsxs("div",{className:"submission-eval-op-header",children:[e.jsx("span",{className:q("submission-pill status",r.op==="create"&&"approved",r.op==="update"&&"changed",r.op==="delete"&&"rejected"),children:r.op??"unknown"}),r.evaluation_id&&e.jsxs("span",{className:"submission-meta",children:["Evaluation #",r.evaluation_id]})]}),r.op&&["create","update","delete"].includes(r.op)?e.jsx(ss,{evaluation:u,taskNames:p,datasetNames:b}):e.jsx(ce,{title:"Unsupported operation",value:r})]},`${r.op}-${r.evaluation_id??m}`)})})}function ss({evaluation:s,taskNames:t,datasetNames:i}){const n=s.task_id?Number(s.task_id):void 0,a=s.dataset_id?Number(s.dataset_id):void 0,l=s.metrics??{};return e.jsxs("div",{className:"submission-eval-fields",children:[e.jsx(A,{label:"Task",value:n?t.get(n)??`#${n}`:null}),e.jsx(A,{label:"Dataset",value:a?i.get(a)??`#${a}`:null}),e.jsx(A,{label:"Model",value:s.model_name||null}),e.jsx(A,{label:"Harness",value:s.harness||null}),e.jsx(A,{label:"Best rank",value:s.best_rank??null}),e.jsx(A,{label:"Parameters",value:s.num_parameters??null}),e.jsx(A,{label:"HF model URL",value:s.hf_model_url||null}),e.jsx(A,{label:"Open source",value:s.is_open===void 0?null:s.is_open?"Yes":"No"}),e.jsxs("div",{className:"submission-eval-metrics",children:[e.jsx("div",{className:"submission-diff-label",children:"Metrics"}),Object.keys(l).length>0?e.jsx("div",{className:"submission-metric-list",children:Object.entries(l).map(([o,d])=>e.jsxs("span",{className:"submission-metric-pill",children:[o,": ",String(d)]},o))}):e.jsx(_,{children:"No metrics"})]})]})}function A({label:s,value:t}){return e.jsxs("div",{children:[e.jsx("div",{className:"submission-diff-label",children:s}),e.jsx("div",{className:"submission-field-value",children:t??e.jsx("span",{className:"submission-muted",children:"Not set"})})]})}function ts({currentPayload:s,proposedPayload:t}){const i=s==null?void 0:s.source_url,n=t.source_url;return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(y,{title:"Current source URL",children:typeof i=="string"&&i?e.jsx("a",{className:"submission-url-link",href:D(i)??void 0,target:"_blank",rel:"noopener noreferrer",children:i}):e.jsx(_,{children:"No current URL"})}),e.jsx(y,{title:"Proposed source URL",children:typeof n=="string"&&n?e.jsx("a",{className:"submission-url-link",href:D(n)??void 0,target:"_blank",rel:"noopener noreferrer",children:n}):e.jsx(_,{children:"No proposed URL"})})]})}function is({proposedPayload:s}){const{title:t,source_url:i,abstract:n="",date_published:a,authors:l}=s;return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(y,{title:"Title",children:t?e.jsx("span",{className:"submission-field-value",children:t}):e.jsx(_,{children:"No title provided"})}),e.jsx(y,{title:"Publication date",children:a||e.jsx(_,{children:"No publication date provided"})}),e.jsx(y,{title:"Authors",children:l.length>0?l.map((o,d)=>e.jsx("span",{className:"submission-diff-pill added",children:o},`${o}-${d}`)):e.jsx(_,{children:"No authors provided"})}),e.jsx(y,{title:"Source URL",children:i?e.jsx("a",{className:"submission-url-link",href:D(i)??void 0,target:"_blank",rel:"noopener noreferrer",children:i}):e.jsx(_,{children:"No source URL provided"})}),e.jsx(y,{title:"Abstract",children:n?e.jsx("span",{className:"submission-field-value",children:n}):e.jsx(_,{children:"No abstract provided"})})]})}function z({kind:s,proposedPayload:t}){const i=typeof t.name=="string"?t.name:"",n=typeof t.description=="string"?t.description:"",a=typeof t.year=="number"?t.year:null,l=typeof t.start_date=="string"?t.start_date:"",o=typeof t.end_date=="string"?t.end_date:"",d=typeof t.venue=="string"?t.venue:"",p=typeof t.url=="string"?t.url:"",b=t.image??{},j=typeof b.data_url=="string"&&b.data_url.startsWith("data:image/")?b.data_url:"",r=typeof b.url=="string"?Te(b.url)??"":j,m=typeof b.file_name=="string"?b.file_name:"Suggested image",c=typeof t.image_credit=="string"?t.image_credit:"",h=typeof t.source_url=="string"?t.source_url:"";return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(y,{title:`Suggested ${s} name`,children:i?e.jsx("span",{className:"submission-diff-pill added",children:i}):e.jsx(_,{children:"No name provided"})}),e.jsx(y,{title:"Description",children:n?e.jsx("span",{className:"submission-field-value",children:n}):e.jsx(_,{children:"No description provided"})}),(s==="task"||s==="method")&&e.jsxs(e.Fragment,{children:[e.jsx(y,{title:"Image",children:r?e.jsx("img",{src:r,alt:m,className:"max-h-64 max-w-full rounded-md border border-border object-contain"}):e.jsx(_,{children:"No image provided"})}),e.jsx(y,{title:"Image source",children:c||e.jsx(_,{children:"No image source provided"})})]}),s==="task"&&e.jsx(y,{title:"Placement and keywords",children:e.jsx("span",{className:"submission-field-value",children:JSON.stringify({parent_id:t.parent_id??null,area_id:t.area_id??null,keywords:t.keywords??null})})}),s==="benchmark"&&e.jsx(y,{title:"Intended task IDs",children:e.jsx("span",{className:"submission-field-value",children:JSON.stringify(t.task_ids??[])})}),s==="metric"&&e.jsx(y,{title:"Metric and leaderboard definition",children:e.jsx("span",{className:"submission-field-value",children:JSON.stringify({direction:t.direction,scale:t.scale,task_id:t.task_id,dataset_id:t.dataset_id})})}),s==="method"&&e.jsx(y,{title:"Source",children:h?h.startsWith("http://")||h.startsWith("https://")?e.jsx("a",{className:"submission-url-link",href:D(h)??void 0,target:"_blank",rel:"noopener noreferrer",children:h}):e.jsx("span",{className:"submission-field-value",children:h}):e.jsx(_,{children:"No source provided"})}),s==="conference"&&e.jsxs(e.Fragment,{children:[e.jsx(y,{title:"Edition and dates",children:a?`${a}${l?` · ${l}${o?` – ${o}`:""}`:""}`:e.jsx(_,{children:"No edition provided"})}),e.jsx(y,{title:"Venue",children:d||e.jsx(_,{children:"No venue provided"})}),e.jsx(y,{title:"URL",children:p?e.jsx("a",{className:"submission-url-link",href:D(p)??void 0,target:"_blank",rel:"noopener noreferrer",children:p}):e.jsx(_,{children:"No URL provided"})})]})]})}function y({title:s,children:t}){return e.jsxs("div",{className:"submission-diff-column",children:[e.jsx("div",{className:"submission-diff-label",children:s}),e.jsx("div",{className:"submission-diff-pills",children:t})]})}function _({children:s}){return e.jsx("span",{className:"submission-muted",children:s})}function ns({currentPayload:s,proposedPayload:t}){const i=s,n=[{key:"hf_models",label:"Models"},{key:"hf_datasets",label:"Datasets"},{key:"hf_spaces",label:"Spaces"}];return e.jsx("div",{className:"submission-hf-artifacts-diff",children:n.map(({key:a,label:l})=>{const o=(i==null?void 0:i[a])??[],d=t[a];return e.jsxs("div",{className:"submission-hf-artifacts-section",children:[e.jsx("div",{className:"submission-diff-label",children:l}),e.jsx(ue,{label:l.toLowerCase(),currentItems:o.map(p=>({url:p,is_official:!1})),proposedItems:d.map(p=>({url:p,is_official:!1}))})]},a)})})}function rs(s){throw new Error(`Unhandled pending edit: ${JSON.stringify(s)}`)}function as({edit:s}){var i,n,a,l,o;let t;switch(s.edit_type){case"tasks":t=e.jsx(de,{currentItems:((i=s.current_payload)==null?void 0:i.tasks)??[],proposedIds:s.proposed_payload.task_ids,queryPrefix:"task",fetchEntity:I.getTask.bind(I)});break;case"methods":t=e.jsx(de,{currentItems:((n=s.current_payload)==null?void 0:n.methods)??[],proposedIds:s.proposed_payload.method_ids,queryPrefix:"method",fetchEntity:I.getMethod.bind(I)});break;case"organizations":t=e.jsx(Ze,{currentItems:((a=s.current_payload)==null?void 0:a.organizations)??[],proposedIds:s.proposed_payload.organization_ids});break;case"repositories":t=e.jsx(ue,{label:"repositories",currentItems:((l=s.current_payload)==null?void 0:l.repositories)??[],proposedItems:s.proposed_payload.repositories});break;case"project_pages":t=e.jsx(ue,{label:"project pages",currentItems:((o=s.current_payload)==null?void 0:o.project_pages)??[],proposedItems:s.proposed_payload.project_pages});break;case"evaluations":t=e.jsx(es,{currentPayload:s.current_payload,proposedPayload:s.proposed_payload});break;case"source_url":t=e.jsx(ts,{currentPayload:s.current_payload,proposedPayload:s.proposed_payload});break;case"hf_artifacts":t=e.jsx(ns,{currentPayload:s.current_payload,proposedPayload:s.proposed_payload});break;case"new_task":t=e.jsx(z,{kind:"task",proposedPayload:s.proposed_payload});break;case"new_method":t=e.jsx(z,{kind:"method",proposedPayload:s.proposed_payload});break;case"new_benchmark":t=e.jsx(z,{kind:"benchmark",proposedPayload:s.proposed_payload});break;case"new_metric":t=e.jsx(z,{kind:"metric",proposedPayload:s.proposed_payload});break;case"new_conference":t=e.jsx(z,{kind:"conference",proposedPayload:s.proposed_payload});break;case"new_external_paper":t=e.jsx(is,{proposedPayload:s.proposed_payload});break;default:rs(s)}return e.jsxs("div",{className:"submission-diff-body",children:[t,e.jsx(Xe,{currentPayload:s.current_payload,proposedPayload:s.proposed_payload})]})}const se=25,os=["pending","approved","rejected","all"],ls=["all","tasks","methods","evaluations","repositories","project_pages","source_url","new_task","new_method","new_benchmark","new_metric","new_conference","new_external_paper"],me=["pending","approved","rejected"];function cs(s){return s.slice(0,2).toUpperCase()}function Y(s){return s.replace(/_/g," ")}function ds(s){return s==="new_external_paper"?"external paper":Y(s)}const us={new_task:{title:"New task",subtitle:"Task suggestion"},new_method:{title:"New method",subtitle:"Method suggestion"},new_benchmark:{title:"New benchmark",subtitle:"Benchmark suggestion"},new_metric:{title:"New metric",subtitle:"Metric suggestion"},new_conference:{title:"New conference",subtitle:"Conference suggestion"},new_external_paper:{title:"External paper",subtitle:"External paper submission"}};function ye(s){if(!s)return"unknown time";const t=new Date(s);if(Number.isNaN(t.getTime()))return s;const i=Date.now()-t.getTime(),n=Math.floor(i/6e4),a=Math.floor(i/36e5),l=Math.floor(i/864e5);return n<1?"just now":n<60?`${n}m ago`:a<24?`${a}h ago`:l<14?`${l}d ago`:t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function X(s,t){var n;const i=s;if(i.response)try{const a=JSON.parse(i.response);if(typeof(a==null?void 0:a.detail)=="string")return a.detail;if(Array.isArray(a==null?void 0:a.detail)&&((n=a.detail[0])!=null&&n.msg))return a.detail[0].msg}catch{return i.response}return i.message||t}function ms(s){return s==="approved"?"approved":s==="rejected"?"rejected":"pending"}function ps(s,t){return(s==null?void 0:s.arxiv_id)||(s==null?void 0:s.id)||String(t)}function hs(s){return[...s].sort((t,i)=>new Date(i.created_at).getTime()-new Date(t.created_at).getTime())}async function fs(s,t,i){const n=t==="all"?void 0:t;if(s!=="all")return B.list({status:s,edit_type:n,limit:i,offset:0});const a=await Promise.all(me.map(l=>B.list({status:l,edit_type:n,limit:i,offset:0})));return{count:a.reduce((l,o)=>l+o.count,0),results:hs(a.flatMap(l=>l.results)).slice(0,i)}}function bs(){return e.jsx("div",{className:"page",children:e.jsxs("div",{className:"submission-empty submission-empty-warn",children:[e.jsx(Pe,{size:22}),e.jsx("h1",{children:"Admin access required"}),e.jsx("p",{children:"Sign in with an allowlisted Hugging Face admin account to review paper edit submissions."})]})})}function xs(){return e.jsx("div",{className:"page",children:e.jsxs("div",{className:"submission-loading",children:[e.jsx(H,{className:"spin",size:18}),e.jsx("span",{children:"Checking admin session..."})]})})}function gs({submission:s,paper:t}){const i=Ne(),{toast:n}=ke(),a=s.paper_id,l=a===null,o=us[s.edit_type]??{title:"Taxonomy directory",subtitle:"Directory suggestion"},d=l?null:ps(t,a),p=l?o.title:(t==null?void 0:t.title)||`Paper #${a}`,b=`https://huggingface.co/${encodeURIComponent(s.hf_username)}/avatar`,j=s.status==="pending",r=w.useCallback(g=>{i.invalidateQueries({queryKey:["pendingPaperEdits"]}),i.invalidateQueries({queryKey:["pendingPaperEdit",g.id]}),g.paper_id!=null&&(i.invalidateQueries({queryKey:["paper",String(g.paper_id)]}),i.invalidateQueries({queryKey:["paper-summary",String(g.paper_id)]})),t!=null&&t.arxiv_id&&i.invalidateQueries({queryKey:["paper-arxiv",t.arxiv_id]}),g.edit_type==="evaluations"&&g.paper_id!=null&&i.invalidateQueries({queryKey:["evaluations","paper",String(g.paper_id)]})},[t==null?void 0:t.arxiv_id,i]),m=ge({mutationFn:()=>B.approve(s.id),onSuccess:g=>{r(g),n({title:"Submission approved",description:`Applied ${Y(s.edit_type)} changes for ${p}.`})},onError:g=>{n({title:"Could not approve submission",description:X(g,"Approval failed. Please try again."),variant:"destructive"})}}),c=ge({mutationFn:()=>B.reject(s.id),onSuccess:g=>{r(g),n({title:"Submission rejected",description:`Rejected ${Y(s.edit_type)} changes for ${p}.`})},onError:g=>{n({title:"Could not reject submission",description:X(g,"Rejection failed. Please try again."),variant:"destructive"})}}),h=m.isPending,u=c.isPending,v=h||u;return e.jsxs("article",{id:`submission-${s.id}`,className:"submission-card",children:[e.jsxs("header",{className:"submission-card-header",children:[e.jsxs("div",{className:"submission-card-top",children:[e.jsxs("div",{children:[d?e.jsx("a",{href:`/paper/${encodeURIComponent(d)}`,target:"_blank",rel:"noopener noreferrer",className:"submission-title",children:p}):e.jsx("div",{className:"submission-title",children:p}),e.jsxs("div",{className:"submission-meta",children:[e.jsxs("span",{children:["#",s.id]}),e.jsx("span",{children:l?o.subtitle:`Paper #${s.paper_id}`}),e.jsx("span",{children:ye(s.created_at)})]})]}),e.jsxs("div",{className:"submission-badges",children:[e.jsx("span",{className:"submission-pill",children:Y(s.edit_type)}),s.is_author&&e.jsx("span",{className:"submission-pill author",children:"Linked author"}),e.jsx("span",{className:q("submission-pill status",ms(s.status)),children:s.status})]})]}),e.jsxs("a",{href:`https://huggingface.co/${encodeURIComponent(s.hf_username)}`,target:"_blank",rel:"noopener noreferrer",className:"submission-user",children:[e.jsxs(Fe,{className:"h-6 w-6",children:[e.jsx(Ie,{src:b,alt:s.hf_username}),e.jsx(Qe,{className:"text-[10px]",children:cs(s.hf_username)})]}),e.jsxs("span",{children:["@",s.hf_username]})]})]}),e.jsx("div",{className:"submission-diff",children:e.jsx(as,{edit:s})}),s.conflict_payload&&e.jsxs("div",{className:"submission-empty submission-empty-warn",children:["Canonical state changed after this submission. Review the conflict before deciding.",e.jsx("pre",{children:JSON.stringify(s.conflict_payload,null,2)})]}),s.review_evidence&&e.jsxs("details",{className:"submission-diff",open:!0,children:[e.jsx("summary",{children:"Codex review artifact"}),e.jsx("pre",{children:JSON.stringify(s.review_evidence,null,2)})]}),e.jsx("footer",{className:"submission-actions",children:j?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"submission-action-buttons",children:[e.jsxs("button",{type:"button",onClick:()=>c.mutate(),disabled:v,className:"submission-action-btn reject",children:[u?e.jsx(H,{className:"spin",size:14}):e.jsx(Ge,{size:14}),"Reject"]}),e.jsxs("button",{type:"button",onClick:()=>m.mutate(),disabled:v,className:"submission-action-btn approve",children:[h?e.jsx(H,{className:"spin",size:14}):e.jsx(We,{size:14}),"Approve"]})]})}):e.jsxs("div",{className:"submission-reviewed",children:[e.jsxs("span",{children:["Reviewed by ",e.jsx("strong",{children:s.reviewed_by||"unknown"}),s.reviewed_at?` ${ye(s.reviewed_at)}`:""]}),s.admin_note&&e.jsxs("span",{children:["Admin note: ",e.jsx("strong",{children:s.admin_note})]}),s.user_review_reason&&e.jsxs("span",{children:["Submitter-visible reason: ",e.jsx("strong",{children:s.user_review_reason})]}),s.applied_payload&&e.jsxs("details",{children:[e.jsx("summary",{children:"Applied payload"}),e.jsx("pre",{children:JSON.stringify(s.applied_payload,null,2)})]}),s.result_entity_type&&e.jsxs("span",{children:["Created/applied: ",e.jsxs("strong",{children:[s.result_entity_type," #",s.result_entity_id]})]})]})})]})}function Os(){var pe,he,fe;const{user:s,isLoading:t}=qe(),{toast:i}=ke(),[n,a]=w.useState("pending"),[l,o]=w.useState("all"),[d,p]=w.useState(se),b=!!(s!=null&&s.is_admin);w.useEffect(()=>{p(se)},[n,l]);const j=ie({queryKey:["pendingPaperEdits","counts",l],queryFn:async()=>{const x=l==="all"?void 0:l,O=await Promise.all(me.map(M=>B.list({status:M,edit_type:x,limit:1,offset:0})));return Object.fromEntries(O.map((M,W)=>[me[W],M.count]))},enabled:b,staleTime:30*1e3}),r=ie({queryKey:["pendingPaperEdits",{status:n,editType:l,visibleLimit:d}],queryFn:()=>fs(n,l,d),enabled:b,retry:!1}),m=w.useMemo(()=>{var x;return Array.from(new Set((((x=r.data)==null?void 0:x.results)??[]).map(O=>O.paper_id).filter(O=>O!=null))).sort((O,M)=>O-M)},[(pe=r.data)==null?void 0:pe.results]),c=V({queries:m.map(x=>({queryKey:["paper-summary",String(x)],queryFn:()=>Je.get(String(x),!1),enabled:b,staleTime:5*60*1e3}))}),h=w.useMemo(()=>{const x=new Map;return c.forEach(O=>{const M=O.data;if(!M)return;const W=Number(M.id);Number.isFinite(W)&&x.set(W,M)}),x},[c]);if(w.useEffect(()=>{r.error&&i({title:"Could not load submissions",description:X(r.error,"Failed to load pending paper edits."),variant:"destructive"})},[r.error,i]),t)return e.jsx(xs,{});if(!b)return e.jsx(bs,{});const u=j.data,v=u?u.pending+u.approved+u.rejected:void 0,g={pending:u==null?void 0:u.pending,approved:u==null?void 0:u.approved,rejected:u==null?void 0:u.rejected,all:v},F=((he=r.data)==null?void 0:he.results)??[],Z=((fe=r.data)==null?void 0:fe.count)??0,Ee=F.length{j.refetch(),r.refetch()},disabled:r.isFetching||j.isFetching,children:[e.jsx(Ke,{className:q((r.isFetching||j.isFetching)&&"spin"),size:14}),"Refresh"]})]}),e.jsxs("div",{className:"submissions-filter-panel",children:[e.jsxs("div",{className:"submission-filter-block",children:[e.jsx("div",{className:"sidebar-label",children:"Status"}),e.jsx("div",{className:"period-switch",children:os.map(x=>e.jsxs("button",{type:"button",className:q("period-btn",n===x&&"active"),onClick:()=>a(x),children:[x,g[x]!=null&&e.jsx("span",{className:"submission-count",children:g[x]})]},x))})]}),e.jsxs("div",{className:"submission-filter-block",children:[e.jsx("div",{className:"sidebar-label",children:"Edit Type"}),e.jsx("div",{className:"sort-options submissions-type-options",children:ls.map(x=>e.jsx("button",{type:"button",className:q("sort-btn",l===x&&"active"),onClick:()=>o(x),children:ds(x)},x))})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"sort-bar submissions-sort-bar",children:e.jsx("div",{children:e.jsx("div",{className:"sort-options",children:e.jsx("span",{className:"results-count",children:r.isFetching?"refreshing":`${Z} submissions`})})})}),r.isLoading?e.jsxs("div",{className:"submission-loading",children:[e.jsx(H,{className:"spin",size:18}),e.jsx("span",{children:"Loading submissions..."})]}):r.isError?e.jsxs("div",{className:"submission-empty submission-empty-warn",role:"alert",children:[e.jsx(ve,{size:28}),e.jsx("h2",{children:"Could not display submissions."}),e.jsx("p",{children:X(r.error,"The submissions response was invalid.")})]}):F.length===0?e.jsxs("div",{className:"submission-empty",children:[e.jsx(ve,{size:28}),e.jsx("h2",{children:"No pending submissions."}),e.jsxs("p",{children:["The SQL and curl fallback is still documented in"," ",e.jsx("a",{href:"https://github.com/huggingface/paperswithcode/blob/main/docs/operations.md",target:"_blank",rel:"noopener noreferrer",children:"operations.md"}),"."]})]}):e.jsx("div",{className:"submission-list",children:F.map(x=>e.jsx(gs,{submission:x,paper:x.paper_id==null?void 0:h.get(x.paper_id)},x.id))}),F.length>0&&e.jsxs("div",{className:"submission-pagination",children:[e.jsxs("p",{children:["Showing ",F.length," of ",Z," submissions"]}),Ee&&e.jsxs("button",{type:"button",className:"feedback-link",onClick:()=>p(x=>x+se),disabled:r.isFetching,children:[r.isFetching&&e.jsx(H,{className:"spin",size:14}),"Load more"]})]})]})]})}export{Os as default}; + */const ve=qe("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);function Xe({currentPayload:s,proposedPayload:t}){const[i,r]=w.useState(!1);return e.jsxs("div",{className:"submission-raw-toggle",children:[e.jsx("button",{type:"button",className:"raw-json-btn",onClick:()=>r(a=>!a),children:i?"Hide raw JSON":"Show raw JSON"}),i&&e.jsxs("div",{className:"submission-json-grid",children:[e.jsx(ce,{title:"Current payload",value:s??{}}),e.jsx(ce,{title:"Proposed payload",value:t})]})]})}function ce({title:s,value:t}){return e.jsxs("div",{className:"submission-json-block",children:[e.jsx("div",{className:"submission-diff-label",children:s}),e.jsx("pre",{children:JSON.stringify(t,null,2)})]})}function de({currentItems:s,proposedIds:t,queryPrefix:i,fetchEntity:r,knownNames:a}){const l=w.useMemo(()=>Array.from(new Set([...s.map(c=>c.id),...t])).sort((c,h)=>c-h),[s,t]),o=V({queries:r?l.map(c=>({queryKey:[i,String(c)],queryFn:()=>r(String(c)),staleTime:5*60*1e3})):[]}),d=w.useMemo(()=>{const c=new Map;return s.forEach(h=>c.set(h.id,h.name)),a==null||a.forEach((h,u)=>c.set(u,h)),o.forEach(h=>{const u=h.data;if(!u)return;const v=Number(u.id);Number.isFinite(v)&&c.set(v,u.name)}),c},[s,o,a]),p=new Set(s.map(c=>c.id)),b=new Set(t),j=l.filter(c=>p.has(c)&&!b.has(c)),n=l.filter(c=>!p.has(c)&&b.has(c)),m=(c,h)=>{const u=h==="current"&&j.includes(c),v=h==="proposed"&&n.includes(c);return e.jsx("span",{className:T("submission-diff-pill",u&&"removed",v&&"added"),children:d.get(c)??`#${c}`},c)};return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(y,{title:"Currently tagged",children:s.length>0?s.map(c=>m(c.id,"current")):e.jsx(_,{children:"No current tags"})}),e.jsx(y,{title:"Will be tagged",children:t.length>0?t.map(c=>m(c,"proposed")):e.jsx(_,{children:"No proposed tags"})})]})}function Ze({currentItems:s,proposedIds:t}){var l;const i=ie({queryKey:["organizations","submission-diff"],queryFn:()=>I.organizations(),staleTime:3e5}),r=new Map(s.map(o=>[o.id,o.name]));(l=i.data)==null||l.results.forEach(o=>{const d=Number(o.id);Number.isFinite(d)&&r.set(d,o.name)});const a=s.map(o=>({...o,name:r.get(o.id)??o.name}));return e.jsx(de,{currentItems:a,proposedIds:t,queryPrefix:"organization",knownNames:r})}function ue({label:s,currentItems:t,proposedItems:i}){const r=new Map(t.map(o=>[o.url,o])),a=new Map(i.map(o=>[o.url,o])),l=Array.from(new Set([...r.keys(),...a.keys()])).sort();return l.length===0?e.jsxs(_,{children:["No ",s," in this submission."]}):e.jsx("div",{className:"submission-url-list",children:l.map(o=>{var m;const d=r.get(o),p=a.get(o),b=!d&&p,j=d&&!p,n=d&&p&&d.is_official!==p.is_official;return e.jsx("div",{className:T("submission-url-row",b&&"added",j&&"removed",n&&"changed"),children:e.jsxs("div",{className:"submission-url-content",children:[e.jsx("a",{href:D(o)??void 0,target:"_blank",rel:"noopener noreferrer",className:T("submission-url-link",j&&"removed"),children:o}),b&&e.jsx("span",{className:"submission-pill status approved",children:"Added"}),j&&e.jsx("span",{className:"submission-pill status rejected",children:"Removed"}),n&&e.jsxs("span",{className:"submission-pill changed",children:["Official: ",String(d.is_official)," ","->"," ",String(p.is_official)]}),((m=p??d)==null?void 0:m.is_official)&&e.jsx("span",{className:"submission-pill",children:"Official"})]})},o)})})}function es({currentPayload:s,proposedPayload:t}){const i=w.useMemo(()=>(s==null?void 0:s.evaluations)??[],[s]),r=t.operations,a=w.useMemo(()=>{const n=new Set;return i.forEach(m=>{m.task_id&&n.add(Number(m.task_id))}),r.forEach(m=>{const c=m.data;c!=null&&c.task_id&&n.add(Number(c.task_id))}),Array.from(n).filter(m=>Number.isFinite(m))},[i,r]),l=w.useMemo(()=>{const n=new Set;return i.forEach(m=>{m.dataset_id&&n.add(Number(m.dataset_id))}),r.forEach(m=>{const c=m.data;c!=null&&c.dataset_id&&n.add(Number(c.dataset_id))}),Array.from(n).filter(m=>Number.isFinite(m))},[i,r]),o=V({queries:a.map(n=>({queryKey:["task",String(n)],queryFn:()=>I.getTask(String(n)),staleTime:5*60*1e3}))}),d=V({queries:l.map(n=>({queryKey:["dataset",String(n)],queryFn:()=>I.getDataset(String(n)),staleTime:5*60*1e3}))}),p=w.useMemo(()=>{const n=new Map;return o.forEach(m=>{const c=m.data;if(!c)return;const h=Number(c.id);Number.isFinite(h)&&n.set(h,c.name)}),n},[o]),b=w.useMemo(()=>{const n=new Map;return d.forEach(m=>{const c=m.data;if(!c)return;const h=Number(c.id);Number.isFinite(h)&&n.set(h,c.name)}),n},[d]),j=new Map(i.filter(n=>n.id!=null).map(n=>[Number(n.id),n]));return r.length===0?e.jsx(_,{children:"No evaluation operations in this payload."}):e.jsx("div",{className:"submission-eval-list",children:r.map((n,m)=>{const c=n.evaluation_id?j.get(n.evaluation_id):void 0,u=(n.op==="update"?{...c,...n.data}:n.data??c)??{};return e.jsxs("div",{className:"submission-eval-op",children:[e.jsxs("div",{className:"submission-eval-op-header",children:[e.jsx("span",{className:T("submission-pill status",n.op==="create"&&"approved",n.op==="update"&&"changed",n.op==="delete"&&"rejected"),children:n.op??"unknown"}),n.evaluation_id&&e.jsxs("span",{className:"submission-meta",children:["Evaluation #",n.evaluation_id]})]}),n.op&&["create","update","delete"].includes(n.op)?e.jsx(ss,{evaluation:u,taskNames:p,datasetNames:b}):e.jsx(ce,{title:"Unsupported operation",value:n})]},`${n.op}-${n.evaluation_id??m}`)})})}function ss({evaluation:s,taskNames:t,datasetNames:i}){const r=s.task_id?Number(s.task_id):void 0,a=s.dataset_id?Number(s.dataset_id):void 0,l=s.metrics??{};return e.jsxs("div",{className:"submission-eval-fields",children:[e.jsx(q,{label:"Task",value:r?t.get(r)??`#${r}`:null}),e.jsx(q,{label:"Dataset",value:a?i.get(a)??`#${a}`:null}),e.jsx(q,{label:"Model",value:s.model_name||null}),e.jsx(q,{label:"Harness",value:s.harness||null}),e.jsx(q,{label:"Best rank",value:s.best_rank??null}),e.jsx(q,{label:"Parameters",value:s.num_parameters??null}),e.jsx(q,{label:"HF model URL",value:s.hf_model_url||null}),e.jsx(q,{label:"Open source",value:s.is_open===void 0?null:s.is_open?"Yes":"No"}),e.jsxs("div",{className:"submission-eval-metrics",children:[e.jsx("div",{className:"submission-diff-label",children:"Metrics"}),Object.keys(l).length>0?e.jsx("div",{className:"submission-metric-list",children:Object.entries(l).map(([o,d])=>e.jsxs("span",{className:"submission-metric-pill",children:[o,": ",String(d)]},o))}):e.jsx(_,{children:"No metrics"})]})]})}function q({label:s,value:t}){return e.jsxs("div",{children:[e.jsx("div",{className:"submission-diff-label",children:s}),e.jsx("div",{className:"submission-field-value",children:t??e.jsx("span",{className:"submission-muted",children:"Not set"})})]})}function ts({currentPayload:s,proposedPayload:t}){const i=s==null?void 0:s.source_url,r=t.source_url;return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(y,{title:"Current source URL",children:typeof i=="string"&&i?e.jsx("a",{className:"submission-url-link",href:D(i)??void 0,target:"_blank",rel:"noopener noreferrer",children:i}):e.jsx(_,{children:"No current URL"})}),e.jsx(y,{title:"Proposed source URL",children:typeof r=="string"&&r?e.jsx("a",{className:"submission-url-link",href:D(r)??void 0,target:"_blank",rel:"noopener noreferrer",children:r}):e.jsx(_,{children:"No proposed URL"})})]})}function is({proposedPayload:s}){const{title:t,source_url:i,abstract:r="",date_published:a,authors:l}=s;return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(y,{title:"Title",children:t?e.jsx("span",{className:"submission-field-value",children:t}):e.jsx(_,{children:"No title provided"})}),e.jsx(y,{title:"Publication date",children:a||e.jsx(_,{children:"No publication date provided"})}),e.jsx(y,{title:"Authors",children:l.length>0?l.map((o,d)=>e.jsx("span",{className:"submission-diff-pill added",children:o},`${o}-${d}`)):e.jsx(_,{children:"No authors provided"})}),e.jsx(y,{title:"Source URL",children:i?e.jsx("a",{className:"submission-url-link",href:D(i)??void 0,target:"_blank",rel:"noopener noreferrer",children:i}):e.jsx(_,{children:"No source URL provided"})}),e.jsx(y,{title:"Abstract",children:r?e.jsx("span",{className:"submission-field-value",children:r}):e.jsx(_,{children:"No abstract provided"})})]})}function z({kind:s,proposedPayload:t}){const i=typeof t.name=="string"?t.name:"",r=typeof t.description=="string"?t.description:"",a=typeof t.year=="number"?t.year:null,l=typeof t.start_date=="string"?t.start_date:"",o=typeof t.end_date=="string"?t.end_date:"",d=typeof t.venue=="string"?t.venue:"",p=typeof t.url=="string"?t.url:"",b=t.image??{},j=typeof b.data_url=="string"&&b.data_url.startsWith("data:image/")?b.data_url:"",n=typeof b.url=="string"?Ae(b.url)??"":j,m=typeof b.file_name=="string"?b.file_name:"Suggested image",c=typeof t.image_credit=="string"?t.image_credit:"",h=typeof t.source_url=="string"?t.source_url:"";return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(y,{title:`Suggested ${s} name`,children:i?e.jsx("span",{className:"submission-diff-pill added",children:i}):e.jsx(_,{children:"No name provided"})}),e.jsx(y,{title:"Description",children:r?e.jsx("span",{className:"submission-field-value",children:r}):e.jsx(_,{children:"No description provided"})}),(s==="task"||s==="method")&&e.jsxs(e.Fragment,{children:[e.jsx(y,{title:"Image",children:n?e.jsx("img",{src:n,alt:m,className:"max-h-64 max-w-full rounded-md border border-border object-contain"}):e.jsx(_,{children:"No image provided"})}),e.jsx(y,{title:"Image source",children:c||e.jsx(_,{children:"No image source provided"})})]}),s==="task"&&e.jsx(y,{title:"Placement and keywords",children:e.jsx("span",{className:"submission-field-value",children:JSON.stringify({parent_id:t.parent_id??null,area_id:t.area_id??null,keywords:t.keywords??null})})}),s==="benchmark"&&e.jsx(y,{title:"Intended task IDs",children:e.jsx("span",{className:"submission-field-value",children:JSON.stringify(t.task_ids??[])})}),s==="metric"&&e.jsx(y,{title:"Metric and leaderboard definition",children:e.jsx("span",{className:"submission-field-value",children:JSON.stringify({direction:t.direction,scale:t.scale,task_id:t.task_id,dataset_id:t.dataset_id})})}),s==="method"&&e.jsx(y,{title:"Source",children:h?h.startsWith("http://")||h.startsWith("https://")?e.jsx("a",{className:"submission-url-link",href:D(h)??void 0,target:"_blank",rel:"noopener noreferrer",children:h}):e.jsx("span",{className:"submission-field-value",children:h}):e.jsx(_,{children:"No source provided"})}),s==="conference"&&e.jsxs(e.Fragment,{children:[e.jsx(y,{title:"Edition and dates",children:a?`${a}${l?` · ${l}${o?` – ${o}`:""}`:""}`:e.jsx(_,{children:"No edition provided"})}),e.jsx(y,{title:"Venue",children:d||e.jsx(_,{children:"No venue provided"})}),e.jsx(y,{title:"URL",children:p?e.jsx("a",{className:"submission-url-link",href:D(p)??void 0,target:"_blank",rel:"noopener noreferrer",children:p}):e.jsx(_,{children:"No URL provided"})})]})]})}function y({title:s,children:t}){return e.jsxs("div",{className:"submission-diff-column",children:[e.jsx("div",{className:"submission-diff-label",children:s}),e.jsx("div",{className:"submission-diff-pills",children:t})]})}function _({children:s}){return e.jsx("span",{className:"submission-muted",children:s})}function rs({currentPayload:s,proposedPayload:t}){const i=s,r=[{key:"hf_models",label:"Models"},{key:"hf_datasets",label:"Datasets"},{key:"hf_spaces",label:"Spaces"}];return e.jsx("div",{className:"submission-hf-artifacts-diff",children:r.map(({key:a,label:l})=>{const o=(i==null?void 0:i[a])??[],d=t[a];return e.jsxs("div",{className:"submission-hf-artifacts-section",children:[e.jsx("div",{className:"submission-diff-label",children:l}),e.jsx(ue,{label:l.toLowerCase(),currentItems:o.map(p=>({url:p,is_official:!1})),proposedItems:d.map(p=>({url:p,is_official:!1}))})]},a)})})}function ns(s){throw new Error(`Unhandled pending edit: ${JSON.stringify(s)}`)}function as({edit:s}){var i,r,a,l,o;let t;switch(s.edit_type){case"tasks":t=e.jsx(de,{currentItems:((i=s.current_payload)==null?void 0:i.tasks)??[],proposedIds:s.proposed_payload.task_ids,queryPrefix:"task",fetchEntity:I.getTask.bind(I)});break;case"methods":t=e.jsx(de,{currentItems:((r=s.current_payload)==null?void 0:r.methods)??[],proposedIds:s.proposed_payload.method_ids,queryPrefix:"method",fetchEntity:I.getMethod.bind(I)});break;case"organizations":t=e.jsx(Ze,{currentItems:((a=s.current_payload)==null?void 0:a.organizations)??[],proposedIds:s.proposed_payload.organization_ids});break;case"repositories":t=e.jsx(ue,{label:"repositories",currentItems:((l=s.current_payload)==null?void 0:l.repositories)??[],proposedItems:s.proposed_payload.repositories});break;case"project_pages":t=e.jsx(ue,{label:"project pages",currentItems:((o=s.current_payload)==null?void 0:o.project_pages)??[],proposedItems:s.proposed_payload.project_pages});break;case"evaluations":t=e.jsx(es,{currentPayload:s.current_payload,proposedPayload:s.proposed_payload});break;case"source_url":t=e.jsx(ts,{currentPayload:s.current_payload,proposedPayload:s.proposed_payload});break;case"hf_artifacts":t=e.jsx(rs,{currentPayload:s.current_payload,proposedPayload:s.proposed_payload});break;case"new_task":t=e.jsx(z,{kind:"task",proposedPayload:s.proposed_payload});break;case"new_method":t=e.jsx(z,{kind:"method",proposedPayload:s.proposed_payload});break;case"new_benchmark":t=e.jsx(z,{kind:"benchmark",proposedPayload:s.proposed_payload});break;case"new_metric":t=e.jsx(z,{kind:"metric",proposedPayload:s.proposed_payload});break;case"new_conference":t=e.jsx(z,{kind:"conference",proposedPayload:s.proposed_payload});break;case"new_external_paper":t=e.jsx(is,{proposedPayload:s.proposed_payload});break;default:ns(s)}return e.jsxs("div",{className:"submission-diff-body",children:[t,e.jsx(Xe,{currentPayload:s.current_payload,proposedPayload:s.proposed_payload})]})}const se=25,os=["pending","approved","rejected","all"],ls=["all","tasks","methods","evaluations","repositories","project_pages","source_url","new_task","new_method","new_benchmark","new_metric","new_conference","new_external_paper"],me=["pending","approved","rejected"];function cs(s){return s.slice(0,2).toUpperCase()}function Y(s){return s.replace(/_/g," ")}function ds(s){return s==="new_external_paper"?"external paper":Y(s)}const us={new_task:{title:"New task",subtitle:"Task suggestion"},new_method:{title:"New method",subtitle:"Method suggestion"},new_benchmark:{title:"New benchmark",subtitle:"Benchmark suggestion"},new_metric:{title:"New metric",subtitle:"Metric suggestion"},new_conference:{title:"New conference",subtitle:"Conference suggestion"},new_external_paper:{title:"External paper",subtitle:"External paper submission"}};function ye(s){if(!s)return"unknown time";const t=new Date(s);if(Number.isNaN(t.getTime()))return s;const i=Date.now()-t.getTime(),r=Math.floor(i/6e4),a=Math.floor(i/36e5),l=Math.floor(i/864e5);return r<1?"just now":r<60?`${r}m ago`:a<24?`${a}h ago`:l<14?`${l}d ago`:t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function X(s,t){var r;const i=s;if(i.response)try{const a=JSON.parse(i.response);if(typeof(a==null?void 0:a.detail)=="string")return a.detail;if(Array.isArray(a==null?void 0:a.detail)&&((r=a.detail[0])!=null&&r.msg))return a.detail[0].msg}catch{return i.response}return i.message||t}function ms(s){return s==="approved"?"approved":s==="rejected"?"rejected":"pending"}function ps(s,t){return(s==null?void 0:s.arxiv_id)||(s==null?void 0:s.id)||String(t)}function hs(s){return[...s].sort((t,i)=>new Date(i.created_at).getTime()-new Date(t.created_at).getTime())}async function fs(s,t,i){const r=t==="all"?void 0:t;if(s!=="all")return B.list({status:s,edit_type:r,limit:i,offset:0});const a=await Promise.all(me.map(l=>B.list({status:l,edit_type:r,limit:i,offset:0})));return{count:a.reduce((l,o)=>l+o.count,0),results:hs(a.flatMap(l=>l.results)).slice(0,i)}}function bs(){return e.jsx("div",{className:"page",children:e.jsxs("div",{className:"submission-empty submission-empty-warn",children:[e.jsx(Pe,{size:22}),e.jsx("h1",{children:"Admin access required"}),e.jsx("p",{children:"Sign in with an allowlisted Hugging Face admin account to review paper edit submissions."})]})})}function xs(){return e.jsx("div",{className:"page",children:e.jsxs("div",{className:"submission-loading",children:[e.jsx(H,{className:"spin",size:18}),e.jsx("span",{children:"Checking admin session..."})]})})}function gs({submission:s,paper:t}){const i=Ne(),{toast:r}=ke(),a=s.paper_id,l=a===null,o=us[s.edit_type]??{title:"Taxonomy directory",subtitle:"Directory suggestion"},d=l?null:ps(t,a),p=l?o.title:(t==null?void 0:t.title)||`Paper #${a}`,b=`https://huggingface.co/${encodeURIComponent(s.hf_username)}/avatar`,j=s.status==="pending",n=w.useCallback(g=>{i.invalidateQueries({queryKey:["pendingPaperEdits"]}),i.invalidateQueries({queryKey:["pendingPaperEdit",g.id]}),g.paper_id!=null&&(i.invalidateQueries({queryKey:["paper",String(g.paper_id)]}),i.invalidateQueries({queryKey:["paper-summary",String(g.paper_id)]})),t!=null&&t.arxiv_id&&i.invalidateQueries({queryKey:["paper-arxiv",t.arxiv_id]}),g.edit_type==="evaluations"&&g.paper_id!=null&&i.invalidateQueries({queryKey:["evaluations","paper",String(g.paper_id)]})},[t==null?void 0:t.arxiv_id,i]),m=ge({mutationFn:()=>B.approve(s.id),onSuccess:g=>{n(g),r({title:"Submission approved",description:`Applied ${Y(s.edit_type)} changes for ${p}.`})},onError:g=>{r({title:"Could not approve submission",description:X(g,"Approval failed. Please try again."),variant:"destructive"})}}),c=ge({mutationFn:()=>B.reject(s.id),onSuccess:g=>{n(g),r({title:"Submission rejected",description:`Rejected ${Y(s.edit_type)} changes for ${p}.`})},onError:g=>{r({title:"Could not reject submission",description:X(g,"Rejection failed. Please try again."),variant:"destructive"})}}),h=m.isPending,u=c.isPending,v=h||u;return e.jsxs("article",{id:`submission-${s.id}`,className:"submission-card",children:[e.jsxs("header",{className:"submission-card-header",children:[e.jsxs("div",{className:"submission-card-top",children:[e.jsxs("div",{children:[d?e.jsx("a",{href:`/paper/${encodeURIComponent(d)}`,target:"_blank",rel:"noopener noreferrer",className:"submission-title",children:p}):e.jsx("div",{className:"submission-title",children:p}),e.jsxs("div",{className:"submission-meta",children:[e.jsxs("span",{children:["#",s.id]}),e.jsx("span",{children:l?o.subtitle:`Paper #${s.paper_id}`}),e.jsx("span",{children:ye(s.created_at)})]})]}),e.jsxs("div",{className:"submission-badges",children:[e.jsx("span",{className:"submission-pill",children:Y(s.edit_type)}),s.is_author&&e.jsx("span",{className:"submission-pill author",children:"Linked author"}),e.jsx("span",{className:T("submission-pill status",ms(s.status)),children:s.status})]})]}),e.jsxs("a",{href:`https://huggingface.co/${encodeURIComponent(s.hf_username)}`,target:"_blank",rel:"noopener noreferrer",className:"submission-user",children:[e.jsxs(Fe,{className:"h-6 w-6",children:[e.jsx(Ie,{src:b,alt:s.hf_username}),e.jsx(Qe,{className:"text-[10px]",children:cs(s.hf_username)})]}),e.jsxs("span",{children:["@",s.hf_username]})]})]}),e.jsx("div",{className:"submission-diff",children:e.jsx(as,{edit:s})}),s.conflict_payload&&e.jsxs("div",{className:"submission-empty submission-empty-warn",children:["Canonical state changed after this submission. Review the conflict before deciding.",e.jsx("pre",{children:JSON.stringify(s.conflict_payload,null,2)})]}),s.review_evidence&&e.jsxs("details",{className:"submission-diff",open:!0,children:[e.jsx("summary",{children:"Codex review artifact"}),e.jsx("pre",{children:JSON.stringify(s.review_evidence,null,2)})]}),e.jsx("footer",{className:"submission-actions",children:j?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"submission-action-buttons",children:[e.jsxs("button",{type:"button",onClick:()=>c.mutate(),disabled:v,className:"submission-action-btn reject",children:[u?e.jsx(H,{className:"spin",size:14}):e.jsx(Ge,{size:14}),"Reject"]}),e.jsxs("button",{type:"button",onClick:()=>m.mutate(),disabled:v,className:"submission-action-btn approve",children:[h?e.jsx(H,{className:"spin",size:14}):e.jsx(We,{size:14}),"Approve"]})]})}):e.jsxs("div",{className:"submission-reviewed",children:[e.jsxs("span",{children:["Reviewed by ",e.jsx("strong",{children:s.reviewed_by||"unknown"}),s.reviewed_at?` ${ye(s.reviewed_at)}`:""]}),s.admin_note&&e.jsxs("span",{children:["Admin note: ",e.jsx("strong",{children:s.admin_note})]}),s.user_review_reason&&e.jsxs("span",{children:["Submitter-visible reason: ",e.jsx("strong",{children:s.user_review_reason})]}),s.applied_payload&&e.jsxs("details",{children:[e.jsx("summary",{children:"Applied payload"}),e.jsx("pre",{children:JSON.stringify(s.applied_payload,null,2)})]}),s.result_entity_type&&e.jsxs("span",{children:["Created/applied: ",e.jsxs("strong",{children:[s.result_entity_type," #",s.result_entity_id]})]})]})})]})}function Os(){var pe,he,fe;const{user:s,isLoading:t}=Te(),{toast:i}=ke(),[r,a]=w.useState("pending"),[l,o]=w.useState("all"),[d,p]=w.useState(se),b=!!(s!=null&&s.is_admin);w.useEffect(()=>{p(se)},[r,l]);const j=ie({queryKey:["pendingPaperEdits","counts",l],queryFn:async()=>{const x=l==="all"?void 0:l,O=await Promise.all(me.map(M=>B.list({status:M,edit_type:x,limit:1,offset:0})));return Object.fromEntries(O.map((M,W)=>[me[W],M.count]))},enabled:b,staleTime:30*1e3}),n=ie({queryKey:["pendingPaperEdits",{status:r,editType:l,visibleLimit:d}],queryFn:()=>fs(r,l,d),enabled:b,retry:!1}),m=w.useMemo(()=>{var x;return Array.from(new Set((((x=n.data)==null?void 0:x.results)??[]).map(O=>O.paper_id).filter(O=>O!=null))).sort((O,M)=>O-M)},[(pe=n.data)==null?void 0:pe.results]),c=V({queries:m.map(x=>({queryKey:["paper-summary",String(x)],queryFn:()=>Je.get(String(x),!1),enabled:b,staleTime:5*60*1e3}))}),h=w.useMemo(()=>{const x=new Map;return c.forEach(O=>{const M=O.data;if(!M)return;const W=Number(M.id);Number.isFinite(W)&&x.set(W,M)}),x},[c]);if(w.useEffect(()=>{n.error&&i({title:"Could not load submissions",description:X(n.error,"Failed to load pending paper edits."),variant:"destructive"})},[n.error,i]),t)return e.jsx(xs,{});if(!b)return e.jsx(bs,{});const u=j.data,v=u?u.pending+u.approved+u.rejected:void 0,g={pending:u==null?void 0:u.pending,approved:u==null?void 0:u.approved,rejected:u==null?void 0:u.rejected,all:v},F=((he=n.data)==null?void 0:he.results)??[],Z=((fe=n.data)==null?void 0:fe.count)??0,Ee=F.length{j.refetch(),n.refetch()},disabled:n.isFetching||j.isFetching,children:[e.jsx(Ke,{className:T((n.isFetching||j.isFetching)&&"spin"),size:14}),"Refresh"]})]}),e.jsxs("div",{className:"submissions-filter-panel",children:[e.jsxs("div",{className:"submission-filter-block",children:[e.jsx("div",{className:"sidebar-label",children:"Status"}),e.jsx("div",{className:"period-switch",children:os.map(x=>e.jsxs("button",{type:"button",className:T("period-btn",r===x&&"active"),onClick:()=>a(x),children:[x,g[x]!=null&&e.jsx("span",{className:"submission-count",children:g[x]})]},x))})]}),e.jsxs("div",{className:"submission-filter-block",children:[e.jsx("div",{className:"sidebar-label",children:"Edit Type"}),e.jsx("div",{className:"sort-options submissions-type-options",children:ls.map(x=>e.jsx("button",{type:"button",className:T("sort-btn",l===x&&"active"),onClick:()=>o(x),children:ds(x)},x))})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"sort-bar submissions-sort-bar",children:e.jsx("div",{children:e.jsx("div",{className:"sort-options",children:e.jsx("span",{className:"results-count",children:n.isFetching?"refreshing":`${Z} submissions`})})})}),n.isLoading?e.jsxs("div",{className:"submission-loading",children:[e.jsx(H,{className:"spin",size:18}),e.jsx("span",{children:"Loading submissions..."})]}):n.isError?e.jsxs("div",{className:"submission-empty submission-empty-warn",role:"alert",children:[e.jsx(ve,{size:28}),e.jsx("h2",{children:"Could not display submissions."}),e.jsx("p",{children:X(n.error,"The submissions response was invalid.")})]}):F.length===0?e.jsxs("div",{className:"submission-empty",children:[e.jsx(ve,{size:28}),e.jsx("h2",{children:"No pending submissions."}),e.jsxs("p",{children:["The SQL and curl fallback is still documented in"," ",e.jsx("a",{href:"https://github.com/huggingface/paperswithcode/blob/main/docs/operations.md",target:"_blank",rel:"noopener noreferrer",children:"operations.md"}),"."]})]}):e.jsx("div",{className:"submission-list",children:F.map(x=>e.jsx(gs,{submission:x,paper:x.paper_id==null?void 0:h.get(x.paper_id)},x.id))}),F.length>0&&e.jsxs("div",{className:"submission-pagination",children:[e.jsxs("p",{children:["Showing ",F.length," of ",Z," submissions"]}),Ee&&e.jsxs("button",{type:"button",className:"feedback-link",onClick:()=>p(x=>x+se),disabled:n.isFetching,children:[n.isFetching&&e.jsx(H,{className:"spin",size:14}),"Load more"]})]})]})]})}export{Os as default}; diff --git a/assets/SubmitView-Bq6nl10o.js b/assets/SubmitView-Bt-NFHA_.js similarity index 85% rename from assets/SubmitView-Bq6nl10o.js rename to assets/SubmitView-Bt-NFHA_.js index 2a96ec8e499e9a74be62c5909b84faf671e6f2f3..b2773a6aea4ff03a6073cb822938ffcf6f5c8521 100644 --- a/assets/SubmitView-Bq6nl10o.js +++ b/assets/SubmitView-Bt-NFHA_.js @@ -1 +1 @@ -import{u as P,g as k,d as C,f as E,R as d,j as e,D as L}from"./index-BrhBTT14.js";import{u as z}from"./useMutation-DqfuSW7Q.js";import{A as F,a as X}from"./alert-c1n3ZtEC.js";import{B as _}from"./button-CusGeqPB.js";import{I as g,T as q}from"./textarea-D6mDqvzM.js";import{p as N}from"./papers-DBaPliAp.js";const v="pwc:paper-submit-draft",U=/^\d{4}\.\d{4,5}(v\d+)?$/i,$=/^[a-z-]+(\.[A-Z]{2})?\/\d{7}$/,O=/^https?:\/\/(?:www\.)?arxiv\.org\//i;function A(n){const i=n.trim();return i?U.test(i)||$.test(i)||O.test(i)?"arxiv":/^https?:\/\//i.test(i)?"external":"arxiv":"empty"}function B(n,i){const a=n.trim();if(A(a)==="arxiv")return/^https?:\/\//i.test(a)?{source_url:a}:{arxiv_id:a};const o={source_url:a},l=i.title.trim();l&&(o.title=l);const p=i.abstract.trim();p&&(o.abstract=p);const u=i.authors.split(/[,\n]/).map(m=>m.trim()).filter(Boolean);return u.length>0&&(o.authors=u),i.datePublished&&(o.date_published=i.datePublished),o}function J(n){var a;const i=n;if(!i)return"Submission failed";if(i.response)try{const s=JSON.parse(i.response);if(typeof s.detail=="string")return s.detail;if((a=s.detail)!=null&&a.message)return`${s.detail.message} See ${s.detail.help||"/rate-limits"} for help.`}catch{return i.response}return i.message||"Submission failed"}const Y=()=>{const n=P(),i=k(),{toast:a}=C(),{user:s,isLoading:o}=E(),[l,p]=d.useState(""),[u,m]=d.useState(""),[f,S]=d.useState(""),[x,j]=d.useState(""),[b,w]=d.useState(""),[I,y]=d.useState(null);d.useEffect(()=>{const t=sessionStorage.getItem(v);if(t){sessionStorage.removeItem(v);try{const r=JSON.parse(t);p(r.input??""),m(r.title??""),S(r.abstract??""),j(r.authors??""),w(r.datePublished??"")}catch{}}},[]);const h=A(l),R=h==="external",c=z({mutationFn:t=>N.submit(t),onSuccess:t=>{if(t.pending_review){a({title:"Submission queued for review",description:"No source page was fetched and no catalog row was changed."}),c.reset();return}i.invalidateQueries({queryKey:["papers"],refetchType:"none"}),i.invalidateQueries({queryKey:["papers-infinite"],refetchType:"none"}),i.invalidateQueries({queryKey:["trending-papers"],refetchType:"none"});const r=t.refreshed&&t.created&&t.latest_version;a({title:r?`Paper updated to ${t.latest_version}`:t.created?"Paper submitted":"Paper already indexed",description:r?"Opening the updated paper page…":t.created?"Opening the paper page…":"Opening the existing paper page…"}),t.route_identifier&&n(`/paper/${t.route_identifier}`)},onError:t=>{y(J(t))}}),T=t=>{if(t.preventDefault(),y(null),h==="empty"){y("Enter an arXiv ID or a paper URL to submit.");return}if(!s){sessionStorage.setItem(v,JSON.stringify({input:l,title:u,abstract:f,authors:x,datePublished:b}));const D=L("/api/v1/auth/hf/login");window.location.assign(`${D}?return_to=${encodeURIComponent(window.location.href)}`);return}const r=B(l,{title:u,abstract:f,authors:x,datePublished:b});c.mutate(r)};return e.jsxs("div",{className:"page",style:{maxWidth:720},children:[e.jsx("h1",{className:"detail-title",children:"Submit a paper"}),e.jsxs("p",{style:{fontFamily:"var(--serif)",color:"var(--ink-soft)",marginTop:12,lineHeight:1.55},children:["Index an arXiv paper or propose a non-arXiv paper (blog post, technical report, model release page). External papers enter the submission queue and appear only after review."," ",e.jsx("a",{href:"/rate-limits",children:"Read the submission and rate-limit policy."})]}),e.jsxs("form",{onSubmit:T,style:{marginTop:28,display:"grid",gap:20},children:[e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-input",style:{fontWeight:600,fontSize:14},children:"arXiv ID or paper URL"}),e.jsx(g,{id:"submit-input",value:l,onChange:t=>p(t.target.value),placeholder:"2501.12345 · https://arxiv.org/abs/2501.12345 · https://blog.example.com/release",autoFocus:!0,required:!0}),e.jsx("div",{style:{fontSize:12,color:"var(--ink-soft)",minHeight:18},children:h==="arxiv"?"Detected: arXiv paper — metadata will be fetched automatically.":h==="external"?"Detected: external URL — we'll extract metadata and you can override below.":"Paste an arXiv ID like 2501.12345 or any paper/blog URL."})]}),R&&e.jsxs("fieldset",{style:{border:"1px solid var(--rule)",borderRadius:8,padding:"16px 20px 20px",display:"grid",gap:16},children:[e.jsx("legend",{style:{padding:"0 8px",fontSize:12,color:"var(--ink-soft)",textTransform:"uppercase",letterSpacing:.5},children:"External paper details (optional)"}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-title",style:{fontSize:13},children:"Title"}),e.jsx(g,{id:"submit-title",value:u,onChange:t=>m(t.target.value),placeholder:"Leave blank to extract automatically"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-abstract",style:{fontSize:13},children:"Abstract or summary"}),e.jsx(q,{id:"submit-abstract",value:f,onChange:t=>S(t.target.value),rows:4,placeholder:"Leave blank to extract automatically"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-authors",style:{fontSize:13},children:"Authors (comma-separated)"}),e.jsx(g,{id:"submit-authors",value:x,onChange:t=>j(t.target.value),placeholder:"Jane Smith, John Doe"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-date",style:{fontSize:13},children:"Publication date"}),e.jsx(g,{id:"submit-date",type:"date",value:b,onChange:t=>w(t.target.value),style:{maxWidth:220}}),e.jsx("div",{style:{fontSize:12,color:"var(--ink-soft)"},children:"Required only if we cannot infer a date from the page."})]})]}),I&&e.jsx(F,{variant:"destructive",children:e.jsx(X,{children:I})}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[e.jsx(_,{type:"submit",disabled:c.isPending||o,children:o?"Checking sign-in…":c.isPending?"Submitting…":s?"Submit paper":"Sign in to submit"}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>n(-1),disabled:c.isPending,children:"Cancel"})]})]})]})};export{Y as default}; +import{u as D,g as k,e as C,y as E,z as d,j as e,x as z}from"./index-D_-UZEuL.js";import{u as L}from"./useMutation-P0Dg96Vh.js";import{A as F,a as X}from"./alert-B2j1kc2o.js";import{B as _}from"./button-Cc8PFtC1.js";import{I as g,T as q}from"./textarea-DlQmtN_E.js";import{p as N}from"./papers-DHqjKX7p.js";const v="pwc:paper-submit-draft",U=/^\d{4}\.\d{4,5}(v\d+)?$/i,$=/^[a-z-]+(\.[A-Z]{2})?\/\d{7}$/,O=/^https?:\/\/(?:www\.)?arxiv\.org\//i;function A(n){const i=n.trim();return i?U.test(i)||$.test(i)||O.test(i)?"arxiv":/^https?:\/\//i.test(i)?"external":"arxiv":"empty"}function B(n,i){const a=n.trim();if(A(a)==="arxiv")return/^https?:\/\//i.test(a)?{source_url:a}:{arxiv_id:a};const o={source_url:a},l=i.title.trim();l&&(o.title=l);const p=i.abstract.trim();p&&(o.abstract=p);const u=i.authors.split(/[,\n]/).map(m=>m.trim()).filter(Boolean);return u.length>0&&(o.authors=u),i.datePublished&&(o.date_published=i.datePublished),o}function J(n){var a;const i=n;if(!i)return"Submission failed";if(i.response)try{const s=JSON.parse(i.response);if(typeof s.detail=="string")return s.detail;if((a=s.detail)!=null&&a.message)return`${s.detail.message} See ${s.detail.help||"/rate-limits"} for help.`}catch{return i.response}return i.message||"Submission failed"}const Y=()=>{const n=D(),i=k(),{toast:a}=C(),{user:s,isLoading:o}=E(),[l,p]=d.useState(""),[u,m]=d.useState(""),[f,S]=d.useState(""),[x,j]=d.useState(""),[y,w]=d.useState(""),[I,b]=d.useState(null);d.useEffect(()=>{const t=sessionStorage.getItem(v);if(t){sessionStorage.removeItem(v);try{const r=JSON.parse(t);p(r.input??""),m(r.title??""),S(r.abstract??""),j(r.authors??""),w(r.datePublished??"")}catch{}}},[]);const h=A(l),R=h==="external",c=L({mutationFn:t=>N.submit(t),onSuccess:t=>{if(t.pending_review){a({title:"Submission queued for review",description:"No source page was fetched and no catalog row was changed."}),c.reset();return}i.invalidateQueries({queryKey:["papers"],refetchType:"none"}),i.invalidateQueries({queryKey:["papers-infinite"],refetchType:"none"}),i.invalidateQueries({queryKey:["trending-papers"],refetchType:"none"});const r=t.refreshed&&t.created&&t.latest_version;a({title:r?`Paper updated to ${t.latest_version}`:t.created?"Paper submitted":"Paper already indexed",description:r?"Opening the updated paper page…":t.created?"Opening the paper page…":"Opening the existing paper page…"}),t.route_identifier&&n(`/paper/${t.route_identifier}`)},onError:t=>{b(J(t))}}),T=t=>{if(t.preventDefault(),b(null),h==="empty"){b("Enter an arXiv ID or a paper URL to submit.");return}if(!s){sessionStorage.setItem(v,JSON.stringify({input:l,title:u,abstract:f,authors:x,datePublished:y}));const P=z("/api/v1/auth/hf/login");window.location.assign(`${P}?return_to=${encodeURIComponent(window.location.href)}`);return}const r=B(l,{title:u,abstract:f,authors:x,datePublished:y});c.mutate(r)};return e.jsxs("div",{className:"page",style:{maxWidth:720},children:[e.jsx("h1",{className:"detail-title",children:"Submit a paper"}),e.jsxs("p",{style:{fontFamily:"var(--serif)",color:"var(--ink-soft)",marginTop:12,lineHeight:1.55},children:["Index an arXiv paper or propose a non-arXiv paper (blog post, technical report, model release page). External papers enter the submission queue and appear only after review."," ",e.jsx("a",{href:"/rate-limits",children:"Read the submission and rate-limit policy."})]}),e.jsxs("form",{onSubmit:T,style:{marginTop:28,display:"grid",gap:20},children:[e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-input",style:{fontWeight:600,fontSize:14},children:"arXiv ID or paper URL"}),e.jsx(g,{id:"submit-input",value:l,onChange:t=>p(t.target.value),placeholder:"2501.12345 · https://arxiv.org/abs/2501.12345 · https://blog.example.com/release",autoFocus:!0,required:!0}),e.jsx("div",{style:{fontSize:12,color:"var(--ink-soft)",minHeight:18},children:h==="arxiv"?"Detected: arXiv paper — metadata will be fetched automatically.":h==="external"?"Detected: external URL — we'll extract metadata and you can override below.":"Paste an arXiv ID like 2501.12345 or any paper/blog URL."})]}),R&&e.jsxs("fieldset",{style:{border:"1px solid var(--rule)",borderRadius:8,padding:"16px 20px 20px",display:"grid",gap:16},children:[e.jsx("legend",{style:{padding:"0 8px",fontSize:12,color:"var(--ink-soft)",textTransform:"uppercase",letterSpacing:.5},children:"External paper details (optional)"}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-title",style:{fontSize:13},children:"Title"}),e.jsx(g,{id:"submit-title",value:u,onChange:t=>m(t.target.value),placeholder:"Leave blank to extract automatically"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-abstract",style:{fontSize:13},children:"Abstract or summary"}),e.jsx(q,{id:"submit-abstract",value:f,onChange:t=>S(t.target.value),rows:4,placeholder:"Leave blank to extract automatically"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-authors",style:{fontSize:13},children:"Authors (comma-separated)"}),e.jsx(g,{id:"submit-authors",value:x,onChange:t=>j(t.target.value),placeholder:"Jane Smith, John Doe"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-date",style:{fontSize:13},children:"Publication date"}),e.jsx(g,{id:"submit-date",type:"date",value:y,onChange:t=>w(t.target.value),style:{maxWidth:220}}),e.jsx("div",{style:{fontSize:12,color:"var(--ink-soft)"},children:"Required only if we cannot infer a date from the page."})]})]}),I&&e.jsx(F,{variant:"destructive",children:e.jsx(X,{children:I})}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[e.jsx(_,{type:"submit",disabled:c.isPending||o,children:o?"Checking sign-in…":c.isPending?"Submitting…":s?"Submit paper":"Sign in to submit"}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>n(-1),disabled:c.isPending,children:"Cancel"})]})]})]})};export{Y as default}; diff --git a/assets/TagBrowseView-B6A9Mvnz.js b/assets/TagBrowseView-Dw0_Dir3.js similarity index 90% rename from assets/TagBrowseView-B6A9Mvnz.js rename to assets/TagBrowseView-Dw0_Dir3.js index 0e043ca309bb8fb6adf4d5c3dcd7532815af22a0..0e5c9c12c503c30ce472d23f8a625a4be23f4947 100644 --- a/assets/TagBrowseView-B6A9Mvnz.js +++ b/assets/TagBrowseView-Dw0_Dir3.js @@ -1,4 +1,4 @@ -import{c as be,r as h,o as Z,j as e,m as F,O as je,q as _e,P as Xe,t as ve,p as Ne,Q as es,R as _,S as ss,x as as,v as J,L as A,e as ts,u as ns,a as rs,l as os,N as cs}from"./index-BrhBTT14.js";import{u as ge}from"./useQuery-GhY2LXSI.js";import{P as is,M as ls}from"./components-74u_bIKK.js";import{B as ds}from"./BenchmarkTrendSparkline-5roKNW3d.js";import{u as ms,P as ps}from"./useIntersectionObserver-Lj6hnXj6.js";import{M as Q}from"./MarkdownText-CNM4Jz9h.js";import{c as fe}from"./catalog-CkpmYxEk.js";import{s as hs}from"./slug-BpH-Nkvz.js";import{d as D,t as us}from"./transform-Duf4Shfn.js";import{b as xs}from"./usePapers-C1lfz0oo.js";import{S as q}from"./skeleton-DHdzoBmM.js";import{A as gs,a as fs}from"./alert-c1n3ZtEC.js";import{C as bs}from"./chevron-down-CKySK_lE.js";import{G as js}from"./github-XgFsJJRC.js";import"./LatexTitle-BJSVMlZ1.js";import"./katex.min-BSBacQyE.js";import"./papers-DBaPliAp.js";import"./safeExternalHref-CkBrsh84.js";import"./PaperPreviewLink-BCdZ9yj3.js";import"./index-BLqBUiom.js";import"./hover-card-BcKGA4Et.js";import"./useInfiniteQuery-bETtM5yS.js";/** +import{d as be,r as h,k as Z,j as e,h as F,Y as je,m as _e,P as Xe,p as ve,l as Ne,Z as es,z as _,$ as ss,t as as,q as J,L as A,c as ts,u as ns,a as rs,f as os,M as cs}from"./index-D_-UZEuL.js";import{u as ge}from"./useQuery-BZo4MZ3s.js";import{P as is,M as ls}from"./components-CmC5jqhM.js";import{B as ds}from"./BenchmarkTrendSparkline-XIo_GVud.js";import{u as ms,P as ps}from"./useIntersectionObserver-Cq9n7uOQ.js";import{M as Q}from"./MarkdownText-QvkQ9FeM.js";import{c as fe}from"./catalog-CjU2vAfw.js";import{s as hs}from"./slug-BpH-Nkvz.js";import{d as D,t as us}from"./transform-CUuA-koJ.js";import{b as xs}from"./usePapers-BCHtBW8G.js";import{S as q}from"./skeleton-CCZ1iXls.js";import{A as gs,a as fs}from"./alert-B2j1kc2o.js";import{C as bs}from"./chevron-down-DI19XsBw.js";import{G as js}from"./github-iFSl-B6V.js";import"./LatexTitle-B7GPgo8C.js";import"./katex.min-BSBacQyE.js";import"./papers-DHqjKX7p.js";import"./safeExternalHref-CkBrsh84.js";import"./PaperPreviewLink-B25cD-_k.js";import"./index-vCOH2DKd.js";import"./hover-card-DiJQFgx9.js";import"./useInfiniteQuery-CFUEkcEs.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. @@ -8,4 +8,4 @@ import{c as be,r as h,o as Z,j as e,m as F,O as je,q as _e,P as Xe,t as ve,p as * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vs=be("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);var K="Collapsible",[Ns,ke]=ve(K),[ks,X]=Ns(K),we=h.forwardRef((a,o)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:c,onOpenChange:m,...u}=a,[g,f]=Z({prop:r,defaultProp:i??!1,onChange:m,caller:K});return e.jsx(ks,{scope:n,disabled:c,contentId:je(),open:g,onOpenToggle:h.useCallback(()=>f(j=>!j),[f]),children:e.jsx(F.div,{"data-state":se(g),"data-disabled":c?"":void 0,...u,ref:o})})});we.displayName=K;var Ce="CollapsibleTrigger",ye=h.forwardRef((a,o)=>{const{__scopeCollapsible:n,...r}=a,i=X(Ce,n);return e.jsx(F.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":se(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:o,onClick:_e(a.onClick,i.onOpenToggle)})});ye.displayName=Ce;var ee="CollapsibleContent",Ae=h.forwardRef((a,o)=>{const{forceMount:n,...r}=a,i=X(ee,a.__scopeCollapsible);return e.jsx(Xe,{present:n||i.open,children:({present:c})=>e.jsx(ws,{...r,ref:o,present:c})})});Ae.displayName=ee;var ws=h.forwardRef((a,o)=>{const{__scopeCollapsible:n,present:r,children:i,...c}=a,m=X(ee,n),[u,g]=h.useState(r),f=h.useRef(null),j=Ne(o,f),v=h.useRef(0),R=v.current,S=h.useRef(0),T=S.current,k=m.open||u,N=h.useRef(k),d=h.useRef(void 0);return h.useEffect(()=>{const p=requestAnimationFrame(()=>N.current=!1);return()=>cancelAnimationFrame(p)},[]),es(()=>{const p=f.current;if(p){d.current=d.current||{transitionDuration:p.style.transitionDuration,animationName:p.style.animationName},p.style.transitionDuration="0s",p.style.animationName="none";const w=p.getBoundingClientRect();v.current=w.height,S.current=w.width,N.current||(p.style.transitionDuration=d.current.transitionDuration,p.style.animationName=d.current.animationName),g(r)}},[m.open,r]),e.jsx(F.div,{"data-state":se(m.open),"data-disabled":m.disabled?"":void 0,id:m.contentId,hidden:!k,...c,ref:j,style:{"--radix-collapsible-content-height":R?`${R}px`:void 0,"--radix-collapsible-content-width":T?`${T}px`:void 0,...a.style},children:k&&i})});function se(a){return a?"open":"closed"}var Cs=we,ys=ye,As=Ae,C="Accordion",Ss=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ae,Ps,Rs]=ss(C),[z]=ve(C,[Rs,ke]),te=ke(),Se=_.forwardRef((a,o)=>{const{type:n,...r}=a,i=r,c=r;return e.jsx(ae.Provider,{scope:a.__scopeAccordion,children:n==="multiple"?e.jsx(Ms,{...c,ref:o}):e.jsx(Ts,{...i,ref:o})})});Se.displayName=C;var[Pe,Is]=z(C),[Re,Es]=z(C,{collapsible:!1}),Ts=_.forwardRef((a,o)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:c=!1,...m}=a,[u,g]=Z({prop:n,defaultProp:r??"",onChange:i,caller:C});return e.jsx(Pe,{scope:a.__scopeAccordion,value:_.useMemo(()=>u?[u]:[],[u]),onItemOpen:g,onItemClose:_.useCallback(()=>c&&g(""),[c,g]),children:e.jsx(Re,{scope:a.__scopeAccordion,collapsible:c,children:e.jsx(Ie,{...m,ref:o})})})}),Ms=_.forwardRef((a,o)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...c}=a,[m,u]=Z({prop:n,defaultProp:r??[],onChange:i,caller:C}),g=_.useCallback(j=>u((v=[])=>[...v,j]),[u]),f=_.useCallback(j=>u((v=[])=>v.filter(R=>R!==j)),[u]);return e.jsx(Pe,{scope:a.__scopeAccordion,value:m,onItemOpen:g,onItemClose:f,children:e.jsx(Re,{scope:a.__scopeAccordion,collapsible:!0,children:e.jsx(Ie,{...c,ref:o})})})}),[$s,G]=z(C),Ie=_.forwardRef((a,o)=>{const{__scopeAccordion:n,disabled:r,dir:i,orientation:c="vertical",...m}=a,u=_.useRef(null),g=Ne(u,o),f=Ps(n),v=as(i)==="ltr",R=_e(a.onKeyDown,S=>{var L;if(!Ss.includes(S.key))return;const T=S.target,k=f().filter(M=>{var x;return!((x=M.ref.current)!=null&&x.disabled)}),N=k.findIndex(M=>M.ref.current===T),d=k.length;if(N===-1)return;S.preventDefault();let p=N;const w=0,I=d-1,b=()=>{p=N+1,p>I&&(p=w)},E=()=>{p=N-1,p{const{__scopeAccordion:n,value:r,...i}=a,c=G(U,n),m=Is(U,n),u=te(n),g=je(),f=r&&m.value.includes(r)||!1,j=c.disabled||a.disabled;return e.jsx(Os,{scope:n,open:f,disabled:j,triggerId:g,children:e.jsx(Cs,{"data-orientation":c.orientation,"data-state":De(f),...u,...i,ref:o,disabled:j,open:f,onOpenChange:v=>{v?m.onItemOpen(r):m.onItemClose(r)}})})});Ee.displayName=U;var Te="AccordionHeader",Me=_.forwardRef((a,o)=>{const{__scopeAccordion:n,...r}=a,i=G(C,n),c=ne(Te,n);return e.jsx(F.h3,{"data-orientation":i.orientation,"data-state":De(c.open),"data-disabled":c.disabled?"":void 0,...r,ref:o})});Me.displayName=Te;var Y="AccordionTrigger",$e=_.forwardRef((a,o)=>{const{__scopeAccordion:n,...r}=a,i=G(C,n),c=ne(Y,n),m=Es(Y,n),u=te(n);return e.jsx(ae.ItemSlot,{scope:n,children:e.jsx(ys,{"aria-disabled":c.open&&!m.collapsible||void 0,"data-orientation":i.orientation,id:c.triggerId,...u,...r,ref:o})})});$e.displayName=Y;var Oe="AccordionContent",Be=_.forwardRef((a,o)=>{const{__scopeAccordion:n,...r}=a,i=G(C,n),c=ne(Oe,n),m=te(n);return e.jsx(As,{role:"region","aria-labelledby":c.triggerId,"data-orientation":i.orientation,...m,...r,ref:o,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...a.style}})});Be.displayName=Oe;function De(a){return a?"open":"closed"}var Bs=Se,Ds=Ee,Fs=Me,Fe=$e,Le=Be;const Ls=Bs,He=h.forwardRef(({className:a,...o},n)=>e.jsx(Ds,{ref:n,className:J("border-b",a),...o}));He.displayName="AccordionItem";const Ve=h.forwardRef(({className:a,children:o,...n},r)=>e.jsx(Fs,{className:"flex",children:e.jsxs(Fe,{ref:r,className:J("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",a),...n,children:[o,e.jsx(bs,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Ve.displayName=Fe.displayName;const qe=h.forwardRef(({className:a,children:o,...n},r)=>e.jsx(Le,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:e.jsx("div",{className:J("pb-4 pt-0",a),children:o})}));qe.displayName=Le.displayName;const Hs=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]],Vs=a=>a==="trending"||a==="date_published"||a==="citation_count"?a:"trending",W=3,qs=a=>new Intl.NumberFormat("en",{notation:a>=1e3?"compact":"standard",maximumFractionDigits:1}).format(a),Us=({frameworks:a})=>a.length===0?null:e.jsxs("div",{className:"task-framework-links",children:[e.jsx("span",{className:"task-framework-links-label",children:"Recommended frameworks"}),a.map(o=>e.jsxs(A,{to:`/papers?framework=${encodeURIComponent(o.framework_slug)}`,className:"task-framework-link",children:[e.jsx("span",{children:o.framework_name}),e.jsxs("span",{className:"task-framework-link-stars",children:["★ ",qs(o.num_stars)]})]},o.framework_id))]}),Ks=({task:a,area:o,parents:n})=>e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(A,{to:"/tasks",children:"Tasks"}),o&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(A,{to:`/tasks#area-${hs(o.name)}`,children:o.name})]}),[...n].reverse().map(r=>e.jsxs(_.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(A,{to:`/tasks/${r.slug||r.id}`,children:D(r.name,r.slug)})]},r.id)),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--accent-text)"},children:D(a.name,a.slug)})]}),zs=a=>[...a].sort((o,n)=>{const r=o.slug==="classic-language-modeling",i=n.slug==="classic-language-modeling";return r!==i?r?1:-1:0}),xa=()=>{var le,de,me,pe,he,ue,xe;const{taskSlug:a}=ts(),o=ns(),[n,r]=rs(),i=Vs(n.get("order_by")),c=n.get("has_code")==="true",m=n.get("has_hf_artifacts")==="true",u=s=>{const t=new URLSearchParams(n);t.set("order_by",s),r(t)},g=s=>{const t=new URLSearchParams(n);s?t.set("has_code","true"):t.delete("has_code"),r(t)},f=s=>{const t=new URLSearchParams(n);s?t.set("has_hf_artifacts","true"):t.delete("has_hf_artifacts"),r(t)},[j,v]=h.useState(!1),[R,S]=h.useState(()=>new Set),{preferences:T}=os(),k=(s,t)=>{const l=s||"";return t?`/benchmark/${l}?task=${encodeURIComponent(t)}`:`/benchmark/${l}`},N=T.hide_closed_source_evals?!0:void 0,d=ge({queryKey:["task-page",a,N],queryFn:()=>fe.taskPage(a,{is_open:N}),enabled:!!a,staleTime:10*60*1e3});h.useEffect(()=>{var l;const s=(l=d.data)==null?void 0:l.task.slug;if(!a||!s||s===a)return;const t=n.toString();o(`/tasks/${s}${t?`?${t}`:""}`,{replace:!0})},[o,(le=d.data)==null?void 0:le.task.slug,n,a]);const p=ge({queryKey:["task-benchmark-trends",a,N],queryFn:()=>fe.trendingBenchmarks(a,{limit:100,min_recent_papers:0,is_open:N}),enabled:!!a,staleTime:10*60*1e3}),w=h.useMemo(()=>{var s;return zs(((s=d.data)==null?void 0:s.children)||[])},[d.data]),I=h.useMemo(()=>{var t;const s=new Map;return(((t=d.data)==null?void 0:t.subtask_benchmarks)||[]).forEach(l=>{s.set(l.subtask_id,l.benchmarks||[])}),s},[d.data]),b=xs({taskId:((me=(de=d.data)==null?void 0:de.task)==null?void 0:me.id)||"",page_size:20,order_by:i,order_dir:"desc",include_resources:!0,has_code:c,has_hf_artifacts:m,enabled:!!((he=(pe=d.data)==null?void 0:pe.task)!=null&&he.id)}),E=h.useMemo(()=>{var t;return(((t=b.data)==null?void 0:t.pages.flatMap(l=>l.results))||[]).map(us)},[b.data]),B=h.useMemo(()=>{var t;const s={};return(t=b.data)==null||t.pages.forEach(l=>l.results.forEach(O=>(O.methods||[]).forEach(P=>{const y=P.slug||P.id;s[y]||(s[y]={id:P.id,name:P.name,slug:P.slug||"",count:0}),s[y].count++}))),Object.values(s).sort((l,O)=>O.count-l.count).slice(0,8)},[b.data]),{targetRef:L,isIntersecting:M}=ms({rootMargin:"200px"});if(h.useEffect(()=>{M&&b.hasNextPage&&!b.isFetchingNextPage&&b.fetchNextPage()},[M,b.hasNextPage,b.isFetchingNextPage]),d.isLoading)return e.jsxs("div",{className:"page",children:[e.jsx(q,{className:"h-12 w-1/2 mb-4"}),e.jsx(q,{className:"h-6 w-1/3 mb-8"}),e.jsx(q,{className:"h-64 w-full"})]});if(d.error||!d.data)return e.jsx("div",{className:"page",children:e.jsx(gs,{variant:"destructive",children:e.jsx(fs,{children:"Task not found."})})});const x=d.data.task,Ue=d.data.parents||[],H=D(x.name,x.slug),re=(d.data.sisters||[]).filter(s=>s.id!==x.id),Ke=d.data.recommended_frameworks||[],V=d.data.benchmarks||[],ze=new Map(V.map(s=>[s.id,s])),Ge=new Set(V.map(s=>s.id)),oe=(((ue=p.data)==null?void 0:ue.results)||[]).filter(s=>Ge.has(s.id)).map(s=>{const t=ze.get(s.id);return{...s,best_model_name:(t==null?void 0:t.best_model_name)??s.best_model_name,best_paper_route:t==null?void 0:t.best_paper_route,best_paper_title:t==null?void 0:t.best_paper_title,best_code_url:t==null?void 0:t.best_code_url}}),$=oe.length?oe:V.map(s=>({id:s.id,name:s.name,slug:s.slug,full_name:s.full_name,recent_paper_count:0,baseline_paper_count:0,all_time_paper_count:s.paper_count||0,trend_score:0,support_weighted_score:0,rate_change:null,latest_reported_on:null,best_model_name:s.best_model_name,best_paper_route:s.best_paper_route,best_paper_title:s.best_paper_title,best_code_url:s.best_code_url,history:[]})),ce=((xe=p.data)==null?void 0:xe.recent_days)||90,Qe=w.some(s=>(I.get(s.id)||[]).length>0),We=w.length>0,ie=$.length>0,Ye=(()=>{const s=new Set;return V.forEach(t=>s.add(t.id)),I.forEach(t=>t.forEach(l=>s.add(l.id))),s.size})(),Ze=s=>{S(t=>{const l=new Set(t);return l.has(s)?l.delete(s):l.add(s),l})};return e.jsxs("div",{className:"page",children:[e.jsx(Ks,{task:x,area:d.data.area,parents:Ue}),e.jsxs("div",{className:x.image_url?"task-hero-grid":void 0,children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:"TASK"}),e.jsx("h1",{className:"domain-mega-title",children:H}),x.description&&e.jsx(Q,{className:"task-explainer",text:x.description}),x.research_trends&&x.research_trends.length>0&&e.jsx(Ls,{className:"task-research-trends",type:"single",collapsible:!0,children:e.jsxs(He,{className:"task-research-trends-item",value:"key-trends",children:[e.jsx(Ve,{className:"task-research-trends-trigger",children:e.jsx("span",{className:"task-research-trends-title",children:"Key trends"})}),e.jsx(qe,{className:"task-research-trends-content",children:e.jsx("ul",{children:x.research_trends.map((s,t)=>e.jsx("li",{children:e.jsx(Q,{text:s})},t))})})]})}),e.jsxs("div",{className:"task-quickstats",children:[e.jsxs("span",{children:[e.jsx("span",{className:"num",children:(x.paper_count??0).toLocaleString()}),"PAPERS"]}),e.jsxs("span",{children:[e.jsx("span",{className:"num",children:Ye}),"BENCHMARKS"]}),e.jsxs("span",{children:[e.jsxs("span",{className:"num",children:[B.length,"+"]}),"METHODS USED"]})]}),e.jsx(Us,{frameworks:Ke})]}),x.image_url&&e.jsxs("figure",{className:`task-figure-card${x.slug==="omni-models"?" task-figure-card--compact":""}`,children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:cs(x.image_url)??void 0,alt:`${H} schematic`,onError:s=>{var t,l;(l=(t=s.currentTarget.parentElement)==null?void 0:t.parentElement)==null||l.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",H,x.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(Q,{className:"task-image-credit",text:x.image_credit})]})]})]})]}),e.jsxs("div",{className:"task-page-grid",style:{marginTop:28},children:[e.jsxs("div",{children:[ie&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"task-section-head",children:[e.jsxs("div",{className:"task-section-eyebrow",children:[ce,"-day reporting activity · select a benchmark"]}),e.jsxs("div",{className:"task-section-title",children:["Benchmarks ",e.jsxs("span",{className:"meta",children:["[",$.length,"]"]})]})]}),e.jsxs("div",{className:"benchmark-trend-table",role:"table","aria-label":"Trending benchmarks",children:[e.jsxs("div",{className:"benchmark-trend-head",role:"row",children:[e.jsx("span",{role:"columnheader",children:"Trend"}),e.jsx("span",{role:"columnheader",children:"Benchmark"}),e.jsx("span",{role:"columnheader",children:"Best model"}),e.jsx("span",{role:"columnheader",children:"Paper title"}),e.jsx("span",{role:"columnheader",children:"Code"}),e.jsx("span",{role:"columnheader",children:"Compare"})]}),(j?$:$.slice(0,5)).map(s=>e.jsxs("div",{className:"benchmark-trend-row",role:"row",children:[e.jsxs("div",{className:"benchmark-trend-cell",role:"cell",children:[e.jsx(ds,{history:s.history,benchmarkName:s.name}),e.jsxs("div",{className:"benchmark-trend-meta",children:[e.jsxs("span",{children:[e.jsx("strong",{children:s.recent_paper_count})," ",s.recent_paper_count===1?"paper":"papers"," /"," ",ce,"d"]}),s.rate_change==null?s.recent_paper_count>0&&e.jsx("span",{className:"benchmark-trend-change is-new",children:"new"}):e.jsxs("span",{className:`benchmark-trend-change ${s.rate_change>=1?"is-up":"is-down"}`,children:[s.rate_change>=1?"↑":"↓"," ",s.rate_change.toFixed(1),"×"]})]})]}),e.jsxs("div",{className:"benchmark-trend-benchmark",role:"cell",children:[e.jsx(A,{className:"bench-row-name",to:k(s.slug||s.id,a),children:s.name}),e.jsx("div",{className:"bench-row-sub",children:e.jsxs("span",{children:[e.jsx("strong",{children:s.all_time_paper_count})," reporting papers"]})})]}),e.jsx("div",{className:"bench-row-best",role:"cell",children:s.best_model_name?e.jsxs(e.Fragment,{children:[e.jsx(vs,{size:13,className:"bench-row-best-icon"}),e.jsx("span",{className:"bench-row-best-name",children:s.best_model_name})]}):e.jsx("span",{className:"bench-row-best-empty",children:"—"})}),e.jsx("div",{className:"bench-row-paper",role:"cell",children:s.best_paper_route&&s.best_paper_title?e.jsx(A,{to:`/paper/${encodeURIComponent(s.best_paper_route)}`,children:s.best_paper_title}):e.jsx("span",{className:"bench-row-best-empty",children:"—"})}),e.jsx("div",{className:"bench-row-code",role:"cell",children:s.best_code_url?e.jsx("a",{href:s.best_code_url,target:"_blank",rel:"noopener noreferrer","aria-label":`Code for ${s.best_paper_title||s.best_model_name}`,children:e.jsx(js,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}):e.jsx("span",{className:"bench-row-best-empty",children:"—"})}),e.jsx("div",{className:"bench-row-compare",role:"cell",children:e.jsxs(A,{to:k(s.slug||s.id,a),"aria-label":`Compare ${s.best_model_name||"the best model"} with all results on ${s.name}`,children:[e.jsx("span",{children:"See all"}),e.jsx(_s,{size:11,strokeWidth:2,"aria-hidden":"true"})]})})]},s.id))]}),$.length>5&&e.jsx("button",{type:"button",className:"bench-show-more",onClick:()=>v(s=>!s),children:j?"− show top 5":`+ show ${$.length-5} more benchmarks`})]}),We&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"task-section-head",style:ie?{marginTop:36}:void 0,children:[e.jsx("div",{className:"task-section-eyebrow",children:Qe?"Benchmarks by capability":"Task hierarchy"}),e.jsxs("div",{className:"task-section-title",children:["Subtasks ",e.jsxs("span",{className:"meta",children:["[",w.length,"]"]})]})]}),e.jsx("div",{className:"subtask-grid",children:w.map(s=>{const t=I.get(s.id)||[],l=R.has(s.id),O=l?t:t.slice(0,W),P=t.length-W;return e.jsxs("div",{className:"subtask-section",children:[e.jsxs("div",{className:"subtask-head",children:[e.jsx(A,{to:`/tasks/${s.slug||s.id}`,className:"subtask-head-name",children:D(s.name,s.slug)}),e.jsx("span",{className:"subtask-head-meta",children:t.length>0?`[${t.length} benchmark${t.length===1?"":"s"}]`:`[${(s.paper_count??0).toLocaleString()} papers]`})]}),O.length>0?O.map((y,Je)=>e.jsxs("div",{className:"bench-row",onClick:()=>o(k(y.slug||y.id,s.slug||s.id)),children:[e.jsx("div",{className:"bench-row-num",children:String(Je+1).padStart(2,"0")}),e.jsxs("div",{className:"bench-row-main",children:[e.jsx("div",{className:"bench-row-name",children:y.name}),e.jsx("div",{className:"bench-row-sub",children:y.paper_count!=null&&e.jsxs("span",{children:[e.jsx("strong",{children:y.paper_count})," ENTRIES"]})})]}),e.jsx("div",{className:"bench-row-arrow",children:"→"})]},y.id)):e.jsxs(A,{to:`/tasks/${s.slug||s.id}`,className:"subtask-summary",children:[e.jsxs("span",{children:[(s.paper_count??0).toLocaleString()," papers"]}),s.description&&e.jsx("span",{className:"subtask-summary-desc",children:s.description})]}),P>0&&e.jsx("button",{type:"button",className:"bench-show-more",onClick:()=>Ze(s.id),children:l?`− show top ${W}`:`+ show ${P} more benchmark${P===1?"":"s"}`})]},s.id)})})]}),e.jsxs("div",{className:"task-section-head",style:{marginTop:36},children:[e.jsx("div",{className:"task-section-eyebrow",children:"Top trending · sort below"}),e.jsxs("div",{className:"task-section-title",children:["Papers ",e.jsxs("span",{className:"meta",children:["[",(x.paper_count??0).toLocaleString(),"]"]})]})]}),e.jsxs("div",{className:"sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:Hs.map(([s,t])=>e.jsx("button",{className:`sort-btn ${i===s?"active":""}`,onClick:()=>u(s),children:t},s))}),e.jsx(ps,{hasCode:c,hasHfArtifacts:m,onHasCodeChange:g,onHasHfArtifactsChange:f})]}),e.jsxs("div",{className:"results-count",children:[E.length," loaded in ",e.jsx("span",{children:H})]})]}),b.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((s,t)=>e.jsx(q,{className:"h-40 w-full"},t))}):E.length===0?e.jsx("div",{className:"no-results",children:"No papers in this task yet."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:E.map((s,t)=>e.jsx(is,{paper:s,rank:t+1},s.id))}),e.jsx("div",{ref:L,style:{height:1}}),b.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]})]}),e.jsxs("aside",{className:"task-side",children:[re.length>0&&e.jsxs("div",{className:"side-block",children:[e.jsx("div",{className:"side-block-num",children:"01/"}),e.jsx("div",{className:"side-block-label",children:"Sister Tasks"}),re.slice(0,8).map(s=>e.jsxs(A,{to:`/tasks/${s.slug||s.id}`,className:"side-link-row",children:[e.jsx("span",{children:D(s.name,s.slug)}),s.paper_count!=null&&e.jsx("span",{className:"count",children:s.paper_count.toLocaleString()})]},s.id))]}),B.length>0&&e.jsxs("div",{className:"side-block",children:[e.jsx("div",{className:"side-block-num",children:"02/"}),e.jsx("div",{className:"side-block-label",children:"Common Methods"}),B.map(s=>e.jsxs("div",{className:"side-method-row",children:[e.jsx(ls,{method:{slug:s.slug,name:s.name}}),e.jsxs("span",{className:"num",children:["·",s.count]})]},s.id))]})]})]})]})};export{Us as RecommendedFrameworkLinks,Ks as TaskBreadcrumb,xa as default}; + */const vs=be("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);var z="Collapsible",[Ns,ke]=ve(z),[ks,X]=Ns(z),we=h.forwardRef((a,o)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:c,onOpenChange:m,...u}=a,[g,f]=Z({prop:r,defaultProp:i??!1,onChange:m,caller:z});return e.jsx(ks,{scope:n,disabled:c,contentId:je(),open:g,onOpenToggle:h.useCallback(()=>f(j=>!j),[f]),children:e.jsx(F.div,{"data-state":se(g),"data-disabled":c?"":void 0,...u,ref:o})})});we.displayName=z;var Ce="CollapsibleTrigger",ye=h.forwardRef((a,o)=>{const{__scopeCollapsible:n,...r}=a,i=X(Ce,n);return e.jsx(F.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":se(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:o,onClick:_e(a.onClick,i.onOpenToggle)})});ye.displayName=Ce;var ee="CollapsibleContent",Ae=h.forwardRef((a,o)=>{const{forceMount:n,...r}=a,i=X(ee,a.__scopeCollapsible);return e.jsx(Xe,{present:n||i.open,children:({present:c})=>e.jsx(ws,{...r,ref:o,present:c})})});Ae.displayName=ee;var ws=h.forwardRef((a,o)=>{const{__scopeCollapsible:n,present:r,children:i,...c}=a,m=X(ee,n),[u,g]=h.useState(r),f=h.useRef(null),j=Ne(o,f),v=h.useRef(0),R=v.current,S=h.useRef(0),T=S.current,k=m.open||u,N=h.useRef(k),d=h.useRef(void 0);return h.useEffect(()=>{const p=requestAnimationFrame(()=>N.current=!1);return()=>cancelAnimationFrame(p)},[]),es(()=>{const p=f.current;if(p){d.current=d.current||{transitionDuration:p.style.transitionDuration,animationName:p.style.animationName},p.style.transitionDuration="0s",p.style.animationName="none";const w=p.getBoundingClientRect();v.current=w.height,S.current=w.width,N.current||(p.style.transitionDuration=d.current.transitionDuration,p.style.animationName=d.current.animationName),g(r)}},[m.open,r]),e.jsx(F.div,{"data-state":se(m.open),"data-disabled":m.disabled?"":void 0,id:m.contentId,hidden:!k,...c,ref:j,style:{"--radix-collapsible-content-height":R?`${R}px`:void 0,"--radix-collapsible-content-width":T?`${T}px`:void 0,...a.style},children:k&&i})});function se(a){return a?"open":"closed"}var Cs=we,ys=ye,As=Ae,C="Accordion",Ss=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ae,Ps,Rs]=ss(C),[K]=ve(C,[Rs,ke]),te=ke(),Se=_.forwardRef((a,o)=>{const{type:n,...r}=a,i=r,c=r;return e.jsx(ae.Provider,{scope:a.__scopeAccordion,children:n==="multiple"?e.jsx(Ms,{...c,ref:o}):e.jsx(Ts,{...i,ref:o})})});Se.displayName=C;var[Pe,Is]=K(C),[Re,Es]=K(C,{collapsible:!1}),Ts=_.forwardRef((a,o)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:c=!1,...m}=a,[u,g]=Z({prop:n,defaultProp:r??"",onChange:i,caller:C});return e.jsx(Pe,{scope:a.__scopeAccordion,value:_.useMemo(()=>u?[u]:[],[u]),onItemOpen:g,onItemClose:_.useCallback(()=>c&&g(""),[c,g]),children:e.jsx(Re,{scope:a.__scopeAccordion,collapsible:c,children:e.jsx(Ie,{...m,ref:o})})})}),Ms=_.forwardRef((a,o)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...c}=a,[m,u]=Z({prop:n,defaultProp:r??[],onChange:i,caller:C}),g=_.useCallback(j=>u((v=[])=>[...v,j]),[u]),f=_.useCallback(j=>u((v=[])=>v.filter(R=>R!==j)),[u]);return e.jsx(Pe,{scope:a.__scopeAccordion,value:m,onItemOpen:g,onItemClose:f,children:e.jsx(Re,{scope:a.__scopeAccordion,collapsible:!0,children:e.jsx(Ie,{...c,ref:o})})})}),[$s,G]=K(C),Ie=_.forwardRef((a,o)=>{const{__scopeAccordion:n,disabled:r,dir:i,orientation:c="vertical",...m}=a,u=_.useRef(null),g=Ne(u,o),f=Ps(n),v=as(i)==="ltr",R=_e(a.onKeyDown,S=>{var L;if(!Ss.includes(S.key))return;const T=S.target,k=f().filter(M=>{var x;return!((x=M.ref.current)!=null&&x.disabled)}),N=k.findIndex(M=>M.ref.current===T),d=k.length;if(N===-1)return;S.preventDefault();let p=N;const w=0,I=d-1,b=()=>{p=N+1,p>I&&(p=w)},E=()=>{p=N-1,p{const{__scopeAccordion:n,value:r,...i}=a,c=G(U,n),m=Is(U,n),u=te(n),g=je(),f=r&&m.value.includes(r)||!1,j=c.disabled||a.disabled;return e.jsx(Os,{scope:n,open:f,disabled:j,triggerId:g,children:e.jsx(Cs,{"data-orientation":c.orientation,"data-state":De(f),...u,...i,ref:o,disabled:j,open:f,onOpenChange:v=>{v?m.onItemOpen(r):m.onItemClose(r)}})})});Ee.displayName=U;var Te="AccordionHeader",Me=_.forwardRef((a,o)=>{const{__scopeAccordion:n,...r}=a,i=G(C,n),c=ne(Te,n);return e.jsx(F.h3,{"data-orientation":i.orientation,"data-state":De(c.open),"data-disabled":c.disabled?"":void 0,...r,ref:o})});Me.displayName=Te;var Y="AccordionTrigger",$e=_.forwardRef((a,o)=>{const{__scopeAccordion:n,...r}=a,i=G(C,n),c=ne(Y,n),m=Es(Y,n),u=te(n);return e.jsx(ae.ItemSlot,{scope:n,children:e.jsx(ys,{"aria-disabled":c.open&&!m.collapsible||void 0,"data-orientation":i.orientation,id:c.triggerId,...u,...r,ref:o})})});$e.displayName=Y;var Oe="AccordionContent",Be=_.forwardRef((a,o)=>{const{__scopeAccordion:n,...r}=a,i=G(C,n),c=ne(Oe,n),m=te(n);return e.jsx(As,{role:"region","aria-labelledby":c.triggerId,"data-orientation":i.orientation,...m,...r,ref:o,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...a.style}})});Be.displayName=Oe;function De(a){return a?"open":"closed"}var Bs=Se,Ds=Ee,Fs=Me,Fe=$e,Le=Be;const Ls=Bs,He=h.forwardRef(({className:a,...o},n)=>e.jsx(Ds,{ref:n,className:J("border-b",a),...o}));He.displayName="AccordionItem";const Ve=h.forwardRef(({className:a,children:o,...n},r)=>e.jsx(Fs,{className:"flex",children:e.jsxs(Fe,{ref:r,className:J("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",a),...n,children:[o,e.jsx(bs,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Ve.displayName=Fe.displayName;const qe=h.forwardRef(({className:a,children:o,...n},r)=>e.jsx(Le,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:e.jsx("div",{className:J("pb-4 pt-0",a),children:o})}));qe.displayName=Le.displayName;const Hs=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]],Vs=a=>a==="trending"||a==="date_published"||a==="citation_count"?a:"trending",W=3,qs=a=>new Intl.NumberFormat("en",{notation:a>=1e3?"compact":"standard",maximumFractionDigits:1}).format(a),Us=({frameworks:a})=>a.length===0?null:e.jsxs("div",{className:"task-framework-links",children:[e.jsx("span",{className:"task-framework-links-label",children:"Recommended frameworks"}),a.map(o=>e.jsxs(A,{to:`/papers?framework=${encodeURIComponent(o.framework_slug)}`,className:"task-framework-link",children:[e.jsx("span",{children:o.framework_name}),e.jsxs("span",{className:"task-framework-link-stars",children:["★ ",qs(o.num_stars)]})]},o.framework_id))]}),zs=({task:a,area:o,parents:n})=>e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(A,{to:"/tasks",children:"Tasks"}),o&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(A,{to:`/tasks#area-${hs(o.name)}`,children:o.name})]}),[...n].reverse().map(r=>e.jsxs(_.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(A,{to:`/tasks/${r.slug||r.id}`,children:D(r.name,r.slug)})]},r.id)),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--accent-text)"},children:D(a.name,a.slug)})]}),Ks=a=>[...a].sort((o,n)=>{const r=o.slug==="classic-language-modeling",i=n.slug==="classic-language-modeling";return r!==i?r?1:-1:0}),xa=()=>{var le,de,me,pe,he,ue,xe;const{taskSlug:a}=ts(),o=ns(),[n,r]=rs(),i=Vs(n.get("order_by")),c=n.get("has_code")==="true",m=n.get("has_hf_artifacts")==="true",u=s=>{const t=new URLSearchParams(n);t.set("order_by",s),r(t)},g=s=>{const t=new URLSearchParams(n);s?t.set("has_code","true"):t.delete("has_code"),r(t)},f=s=>{const t=new URLSearchParams(n);s?t.set("has_hf_artifacts","true"):t.delete("has_hf_artifacts"),r(t)},[j,v]=h.useState(!1),[R,S]=h.useState(()=>new Set),{preferences:T}=os(),k=(s,t)=>{const l=s||"";return t?`/benchmark/${l}?task=${encodeURIComponent(t)}`:`/benchmark/${l}`},N=T.hide_closed_source_evals?!0:void 0,d=ge({queryKey:["task-page",a,N],queryFn:()=>fe.taskPage(a,{is_open:N}),enabled:!!a,staleTime:10*60*1e3});h.useEffect(()=>{var l;const s=(l=d.data)==null?void 0:l.task.slug;if(!a||!s||s===a)return;const t=n.toString();o(`/tasks/${s}${t?`?${t}`:""}`,{replace:!0})},[o,(le=d.data)==null?void 0:le.task.slug,n,a]);const p=ge({queryKey:["task-benchmark-trends",a,N],queryFn:()=>fe.trendingBenchmarks(a,{limit:100,min_recent_papers:0,is_open:N}),enabled:!!a,staleTime:10*60*1e3}),w=h.useMemo(()=>{var s;return Ks(((s=d.data)==null?void 0:s.children)||[])},[d.data]),I=h.useMemo(()=>{var t;const s=new Map;return(((t=d.data)==null?void 0:t.subtask_benchmarks)||[]).forEach(l=>{s.set(l.subtask_id,l.benchmarks||[])}),s},[d.data]),b=xs({taskId:((me=(de=d.data)==null?void 0:de.task)==null?void 0:me.id)||"",page_size:20,order_by:i,order_dir:"desc",include_resources:!0,has_code:c,has_hf_artifacts:m,enabled:!!((he=(pe=d.data)==null?void 0:pe.task)!=null&&he.id)}),E=h.useMemo(()=>{var t;return(((t=b.data)==null?void 0:t.pages.flatMap(l=>l.results))||[]).map(us)},[b.data]),B=h.useMemo(()=>{var t;const s={};return(t=b.data)==null||t.pages.forEach(l=>l.results.forEach(O=>(O.methods||[]).forEach(P=>{const y=P.slug||P.id;s[y]||(s[y]={id:P.id,name:P.name,slug:P.slug||"",count:0}),s[y].count++}))),Object.values(s).sort((l,O)=>O.count-l.count).slice(0,8)},[b.data]),{targetRef:L,isIntersecting:M}=ms({rootMargin:"200px"});if(h.useEffect(()=>{M&&b.hasNextPage&&!b.isFetchingNextPage&&b.fetchNextPage()},[M,b.hasNextPage,b.isFetchingNextPage]),d.isLoading)return e.jsxs("div",{className:"page",children:[e.jsx(q,{className:"h-12 w-1/2 mb-4"}),e.jsx(q,{className:"h-6 w-1/3 mb-8"}),e.jsx(q,{className:"h-64 w-full"})]});if(d.error||!d.data)return e.jsx("div",{className:"page",children:e.jsx(gs,{variant:"destructive",children:e.jsx(fs,{children:"Task not found."})})});const x=d.data.task,Ue=d.data.parents||[],H=D(x.name,x.slug),re=(d.data.sisters||[]).filter(s=>s.id!==x.id),ze=d.data.recommended_frameworks||[],V=d.data.benchmarks||[],Ke=new Map(V.map(s=>[s.id,s])),Ge=new Set(V.map(s=>s.id)),oe=(((ue=p.data)==null?void 0:ue.results)||[]).filter(s=>Ge.has(s.id)).map(s=>{const t=Ke.get(s.id);return{...s,best_model_name:(t==null?void 0:t.best_model_name)??s.best_model_name,best_paper_route:t==null?void 0:t.best_paper_route,best_paper_title:t==null?void 0:t.best_paper_title,best_code_url:t==null?void 0:t.best_code_url}}),$=oe.length?oe:V.map(s=>({id:s.id,name:s.name,slug:s.slug,full_name:s.full_name,recent_paper_count:0,baseline_paper_count:0,all_time_paper_count:s.paper_count||0,trend_score:0,support_weighted_score:0,rate_change:null,latest_reported_on:null,best_model_name:s.best_model_name,best_paper_route:s.best_paper_route,best_paper_title:s.best_paper_title,best_code_url:s.best_code_url,history:[]})),ce=((xe=p.data)==null?void 0:xe.recent_days)||90,Qe=w.some(s=>(I.get(s.id)||[]).length>0),We=w.length>0,ie=$.length>0,Ye=(()=>{const s=new Set;return V.forEach(t=>s.add(t.id)),I.forEach(t=>t.forEach(l=>s.add(l.id))),s.size})(),Ze=s=>{S(t=>{const l=new Set(t);return l.has(s)?l.delete(s):l.add(s),l})};return e.jsxs("div",{className:"page",children:[e.jsx(zs,{task:x,area:d.data.area,parents:Ue}),e.jsxs("div",{className:x.image_url?"task-hero-grid":void 0,children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:"TASK"}),e.jsx("h1",{className:"domain-mega-title",children:H}),x.description&&e.jsx(Q,{className:"task-explainer",text:x.description}),x.research_trends&&x.research_trends.length>0&&e.jsx(Ls,{className:"task-research-trends",type:"single",collapsible:!0,children:e.jsxs(He,{className:"task-research-trends-item",value:"key-trends",children:[e.jsx(Ve,{className:"task-research-trends-trigger",children:e.jsx("span",{className:"task-research-trends-title",children:"Key trends"})}),e.jsx(qe,{className:"task-research-trends-content",children:e.jsx("ul",{children:x.research_trends.map((s,t)=>e.jsx("li",{children:e.jsx(Q,{text:s})},t))})})]})}),e.jsxs("div",{className:"task-quickstats",children:[e.jsxs("span",{children:[e.jsx("span",{className:"num",children:(x.paper_count??0).toLocaleString()}),"PAPERS"]}),e.jsxs("span",{children:[e.jsx("span",{className:"num",children:Ye}),"BENCHMARKS"]}),e.jsxs("span",{children:[e.jsxs("span",{className:"num",children:[B.length,"+"]}),"METHODS USED"]})]}),e.jsx(Us,{frameworks:ze})]}),x.image_url&&e.jsxs("figure",{className:`task-figure-card${x.slug==="omni-models"?" task-figure-card--compact":""}`,children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:cs(x.image_url)??void 0,alt:`${H} schematic`,onError:s=>{var t,l;(l=(t=s.currentTarget.parentElement)==null?void 0:t.parentElement)==null||l.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",H,x.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(Q,{className:"task-image-credit",text:x.image_credit})]})]})]})]}),e.jsxs("div",{className:"task-page-grid",style:{marginTop:28},children:[e.jsxs("div",{children:[ie&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"task-section-head",children:[e.jsxs("div",{className:"task-section-eyebrow",children:[ce,"-day reporting activity · select a benchmark"]}),e.jsxs("div",{className:"task-section-title",children:["Benchmarks ",e.jsxs("span",{className:"meta",children:["[",$.length,"]"]})]})]}),e.jsxs("div",{className:"benchmark-trend-table",role:"table","aria-label":"Trending benchmarks",children:[e.jsxs("div",{className:"benchmark-trend-head",role:"row",children:[e.jsx("span",{role:"columnheader",children:"Trend"}),e.jsx("span",{role:"columnheader",children:"Benchmark"}),e.jsx("span",{role:"columnheader",children:"Best model"}),e.jsx("span",{role:"columnheader",children:"Paper title"}),e.jsx("span",{role:"columnheader",children:"Code"}),e.jsx("span",{role:"columnheader",children:"Compare"})]}),(j?$:$.slice(0,5)).map(s=>e.jsxs("div",{className:"benchmark-trend-row",role:"row",children:[e.jsxs("div",{className:"benchmark-trend-cell",role:"cell",children:[e.jsx(ds,{history:s.history,benchmarkName:s.name}),e.jsxs("div",{className:"benchmark-trend-meta",children:[e.jsxs("span",{children:[e.jsx("strong",{children:s.recent_paper_count})," ",s.recent_paper_count===1?"paper":"papers"," /"," ",ce,"d"]}),s.rate_change==null?s.recent_paper_count>0&&e.jsx("span",{className:"benchmark-trend-change is-new",children:"new"}):e.jsxs("span",{className:`benchmark-trend-change ${s.rate_change>=1?"is-up":"is-down"}`,children:[s.rate_change>=1?"↑":"↓"," ",s.rate_change.toFixed(1),"×"]})]})]}),e.jsxs("div",{className:"benchmark-trend-benchmark",role:"cell",children:[e.jsx(A,{className:"bench-row-name",to:k(s.slug||s.id,a),children:s.name}),e.jsx("div",{className:"bench-row-sub",children:e.jsxs("span",{children:[e.jsx("strong",{children:s.all_time_paper_count})," reporting papers"]})})]}),e.jsx("div",{className:"bench-row-best",role:"cell",children:s.best_model_name?e.jsxs(e.Fragment,{children:[e.jsx(vs,{size:13,className:"bench-row-best-icon"}),e.jsx("span",{className:"bench-row-best-name",children:s.best_model_name})]}):e.jsx("span",{className:"bench-row-best-empty",children:"—"})}),e.jsx("div",{className:"bench-row-paper",role:"cell",children:s.best_paper_route&&s.best_paper_title?e.jsx(A,{to:`/paper/${encodeURIComponent(s.best_paper_route)}`,children:s.best_paper_title}):e.jsx("span",{className:"bench-row-best-empty",children:"—"})}),e.jsx("div",{className:"bench-row-code",role:"cell",children:s.best_code_url?e.jsx("a",{href:s.best_code_url,target:"_blank",rel:"noopener noreferrer","aria-label":`Code for ${s.best_paper_title||s.best_model_name}`,children:e.jsx(js,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}):e.jsx("span",{className:"bench-row-best-empty",children:"—"})}),e.jsx("div",{className:"bench-row-compare",role:"cell",children:e.jsxs(A,{to:k(s.slug||s.id,a),"aria-label":`Compare ${s.best_model_name||"the best model"} with all results on ${s.name}`,children:[e.jsx("span",{children:"See all"}),e.jsx(_s,{size:11,strokeWidth:2,"aria-hidden":"true"})]})})]},s.id))]}),$.length>5&&e.jsx("button",{type:"button",className:"bench-show-more",onClick:()=>v(s=>!s),children:j?"− show top 5":`+ show ${$.length-5} more benchmarks`})]}),We&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"task-section-head",style:ie?{marginTop:36}:void 0,children:[e.jsx("div",{className:"task-section-eyebrow",children:Qe?"Benchmarks by capability":"Task hierarchy"}),e.jsxs("div",{className:"task-section-title",children:["Subtasks ",e.jsxs("span",{className:"meta",children:["[",w.length,"]"]})]})]}),e.jsx("div",{className:"subtask-grid",children:w.map(s=>{const t=I.get(s.id)||[],l=R.has(s.id),O=l?t:t.slice(0,W),P=t.length-W;return e.jsxs("div",{className:"subtask-section",children:[e.jsxs("div",{className:"subtask-head",children:[e.jsx(A,{to:`/tasks/${s.slug||s.id}`,className:"subtask-head-name",children:D(s.name,s.slug)}),e.jsx("span",{className:"subtask-head-meta",children:t.length>0?`[${t.length} benchmark${t.length===1?"":"s"}]`:`[${(s.paper_count??0).toLocaleString()} papers]`})]}),O.length>0?O.map((y,Je)=>e.jsxs("div",{className:"bench-row",onClick:()=>o(k(y.slug||y.id,s.slug||s.id)),children:[e.jsx("div",{className:"bench-row-num",children:String(Je+1).padStart(2,"0")}),e.jsxs("div",{className:"bench-row-main",children:[e.jsx("div",{className:"bench-row-name",children:y.name}),e.jsx("div",{className:"bench-row-sub",children:y.paper_count!=null&&e.jsxs("span",{children:[e.jsx("strong",{children:y.paper_count})," ENTRIES"]})})]}),e.jsx("div",{className:"bench-row-arrow",children:"→"})]},y.id)):e.jsxs(A,{to:`/tasks/${s.slug||s.id}`,className:"subtask-summary",children:[e.jsxs("span",{children:[(s.paper_count??0).toLocaleString()," papers"]}),s.description&&e.jsx("span",{className:"subtask-summary-desc",children:s.description})]}),P>0&&e.jsx("button",{type:"button",className:"bench-show-more",onClick:()=>Ze(s.id),children:l?`− show top ${W}`:`+ show ${P} more benchmark${P===1?"":"s"}`})]},s.id)})})]}),e.jsxs("div",{className:"task-section-head",style:{marginTop:36},children:[e.jsx("div",{className:"task-section-eyebrow",children:"Top trending · sort below"}),e.jsxs("div",{className:"task-section-title",children:["Papers ",e.jsxs("span",{className:"meta",children:["[",(x.paper_count??0).toLocaleString(),"]"]})]})]}),e.jsxs("div",{className:"sort-bar",children:[e.jsxs("div",{className:"paper-feed-toolbar-controls",children:[e.jsx("div",{className:"sort-options",children:Hs.map(([s,t])=>e.jsx("button",{className:`sort-btn ${i===s?"active":""}`,onClick:()=>u(s),children:t},s))}),e.jsx(ps,{hasCode:c,hasHfArtifacts:m,onHasCodeChange:g,onHasHfArtifactsChange:f})]}),e.jsxs("div",{className:"results-count",children:[E.length," loaded in ",e.jsx("span",{children:H})]})]}),b.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((s,t)=>e.jsx(q,{className:"h-40 w-full"},t))}):E.length===0?e.jsx("div",{className:"no-results",children:"No papers in this task yet."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"paper-list",children:E.map((s,t)=>e.jsx(is,{paper:s,rank:t+1},s.id))}),e.jsx("div",{ref:L,style:{height:1}}),b.isFetchingNextPage&&e.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"})]})]}),e.jsxs("aside",{className:"task-side",children:[re.length>0&&e.jsxs("div",{className:"side-block",children:[e.jsx("div",{className:"side-block-num",children:"01/"}),e.jsx("div",{className:"side-block-label",children:"Sister Tasks"}),re.slice(0,8).map(s=>e.jsxs(A,{to:`/tasks/${s.slug||s.id}`,className:"side-link-row",children:[e.jsx("span",{children:D(s.name,s.slug)}),s.paper_count!=null&&e.jsx("span",{className:"count",children:s.paper_count.toLocaleString()})]},s.id))]}),B.length>0&&e.jsxs("div",{className:"side-block",children:[e.jsx("div",{className:"side-block-num",children:"02/"}),e.jsx("div",{className:"side-block-label",children:"Common Methods"}),B.map(s=>e.jsxs("div",{className:"side-method-row",children:[e.jsx(ls,{method:{slug:s.slug,name:s.name}}),e.jsxs("span",{className:"num",children:["·",s.count]})]},s.id))]})]})]})]})};export{Us as RecommendedFrameworkLinks,zs as TaskBreadcrumb,xa as default}; diff --git a/assets/TagsIndexView-DZXTETvq.js b/assets/TagsIndexView-Zr6z-Y-4.js similarity index 82% rename from assets/TagsIndexView-DZXTETvq.js rename to assets/TagsIndexView-Zr6z-Y-4.js index e65cd48ff7404be5be7b226dda95ac8806589605..60525630305ffa89e706aa33536a7abc6f07578b 100644 --- a/assets/TagsIndexView-DZXTETvq.js +++ b/assets/TagsIndexView-Zr6z-Y-4.js @@ -1 +1 @@ -import{r as m,j as s,L as p}from"./index-BrhBTT14.js";import{u as h}from"./useQuery-GhY2LXSI.js";import{c as g}from"./catalog-CkpmYxEk.js";import{c as x,h as f,d as u}from"./transform-Duf4Shfn.js";import{s as j}from"./slug-BpH-Nkvz.js";import{S as d}from"./skeleton-DHdzoBmM.js";import{A as y,a as k}from"./alert-c1n3ZtEC.js";import{T as v}from"./TaxonomySuggestionTile-BkE17zPJ.js";import"./SignInToEditDialog-Dcu4wTOX.js";import"./button-CusGeqPB.js";import"./textarea-D6mDqvzM.js";import"./dialog-BhRZv4T5.js";import"./useMutation-DqfuSW7Q.js";import"./submissions-C1hG3qlt.js";import"./loader-circle-BqZ1qbXL.js";const N=r=>(r==null?void 0:r.trim().toLowerCase().replace(/[\s_]+/g,"-"))??"",I=()=>{const r=h({queryKey:["areas-with-tasks"],queryFn:()=>g.areasWithTasks(),staleTime:6e5}),o=m.useMemo(()=>{if(!r.data)return[];const e={general:0,vision:1,video:2,language:3,audio:4,other:5},a=n=>e[N(n)]??999;return[...r.data.results].sort((n,t)=>{const i=a(n.name),l=a(t.name);return i!==l?i-l:n.name.localeCompare(t.name)})},[r.data]),c=m.useMemo(()=>o.reduce((e,a)=>e+a.tasks.length,0),[o]);return r.error?s.jsx("div",{className:"page",children:s.jsx(y,{variant:"destructive",children:s.jsx(k,{children:"Failed to load taxonomy. Please try again."})})}):s.jsxs("div",{className:"page",children:[s.jsx("div",{className:"feed-header",children:s.jsxs("div",{children:[s.jsxs("h1",{className:"feed-title",children:["All ",s.jsx("em",{children:"Domains"})]}),s.jsx("div",{className:"feed-subtitle",children:"Browse research by area. Click any task to see trending work."})]})}),r.isLoading?s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:32},children:Array.from({length:4}).map((e,a)=>s.jsxs("div",{children:[s.jsx(d,{className:"h-8 w-1/3 mb-4"}),s.jsx("div",{className:"tag-grid",children:Array.from({length:6}).map((n,t)=>s.jsx(d,{className:"h-24"},t))})]},a))}):o.map(e=>{const a=e.tasks;if(a.length===0)return null;const n=a.reduce((t,i)=>t+(i.paper_count||0),0);return s.jsxs("section",{id:`area-${j(e.name)}`,style:{marginBottom:48},children:[s.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},children:[s.jsxs("div",{children:[s.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},children:e.name}),e.description&&s.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",fontSize:13,color:"var(--ink-soft)"},children:e.description})]}),s.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[a.length," ",a.length===1?"task":"tasks"," · ",n.toLocaleString()," papers"]})]}),s.jsxs("div",{className:"tag-grid",children:[a.map(t=>{const i=t.slug||"",l=x(f(i));return s.jsxs(p,{to:`/tasks/${i}`,className:"tag-cell",children:[s.jsxs("div",{className:"name",children:[s.jsx("span",{className:"dot",style:{background:l.dot}}),u(t.name,i)]}),s.jsx("div",{className:"meta",children:s.jsxs("span",{children:[(t.paper_count??0).toLocaleString()," papers"]})})]},t.id)}),s.jsx(v,{kind:"task"})]})]},e.id)}),c>0&&s.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",marginTop:24},children:[c," tasks across ",o.filter(e=>e.tasks.length>0).length," areas."]})]})};export{I as default}; +import{r as m,j as s,L as p}from"./index-D_-UZEuL.js";import{u as h}from"./useQuery-BZo4MZ3s.js";import{c as g}from"./catalog-CjU2vAfw.js";import{c as x,h as f,d as u}from"./transform-CUuA-koJ.js";import{s as j}from"./slug-BpH-Nkvz.js";import{S as d}from"./skeleton-CCZ1iXls.js";import{A as y,a as k}from"./alert-B2j1kc2o.js";import{T as v}from"./TaxonomySuggestionTile-DgDd6ghr.js";import"./SignInToEditDialog-DZLQNGaN.js";import"./button-Cc8PFtC1.js";import"./textarea-DlQmtN_E.js";import"./dialog-ChaQ5z93.js";import"./useMutation-P0Dg96Vh.js";import"./submissions-BpzsA2lc.js";import"./loader-circle-D1SscQUT.js";const N=r=>(r==null?void 0:r.trim().toLowerCase().replace(/[\s_]+/g,"-"))??"",I=()=>{const r=h({queryKey:["areas-with-tasks"],queryFn:()=>g.areasWithTasks(),staleTime:6e5}),o=m.useMemo(()=>{if(!r.data)return[];const e={general:0,vision:1,video:2,language:3,audio:4,other:5},a=n=>e[N(n)]??999;return[...r.data.results].sort((n,t)=>{const i=a(n.name),l=a(t.name);return i!==l?i-l:n.name.localeCompare(t.name)})},[r.data]),c=m.useMemo(()=>o.reduce((e,a)=>e+a.tasks.length,0),[o]);return r.error?s.jsx("div",{className:"page",children:s.jsx(y,{variant:"destructive",children:s.jsx(k,{children:"Failed to load taxonomy. Please try again."})})}):s.jsxs("div",{className:"page",children:[s.jsx("div",{className:"feed-header",children:s.jsxs("div",{children:[s.jsxs("h1",{className:"feed-title",children:["All ",s.jsx("em",{children:"Domains"})]}),s.jsx("div",{className:"feed-subtitle",children:"Browse research by area. Click any task to see trending work."})]})}),r.isLoading?s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:32},children:Array.from({length:4}).map((e,a)=>s.jsxs("div",{children:[s.jsx(d,{className:"h-8 w-1/3 mb-4"}),s.jsx("div",{className:"tag-grid",children:Array.from({length:6}).map((n,t)=>s.jsx(d,{className:"h-24"},t))})]},a))}):o.map(e=>{const a=e.tasks;if(a.length===0)return null;const n=a.reduce((t,i)=>t+(i.paper_count||0),0);return s.jsxs("section",{id:`area-${j(e.name)}`,style:{marginBottom:48},children:[s.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:24,paddingBottom:12,borderBottom:"1px solid var(--hairline-strong)"},children:[s.jsxs("div",{children:[s.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.02em",marginBottom:4},children:e.name}),e.description&&s.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",fontSize:13,color:"var(--ink-soft)"},children:e.description})]}),s.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",whiteSpace:"nowrap"},children:[a.length," ",a.length===1?"task":"tasks"," · ",n.toLocaleString()," papers"]})]}),s.jsxs("div",{className:"tag-grid",children:[a.map(t=>{const i=t.slug||"",l=x(f(i));return s.jsxs(p,{to:`/tasks/${i}`,className:"tag-cell",children:[s.jsxs("div",{className:"name",children:[s.jsx("span",{className:"dot",style:{background:l.dot}}),u(t.name,i)]}),s.jsx("div",{className:"meta",children:s.jsxs("span",{children:[(t.paper_count??0).toLocaleString()," papers"]})})]},t.id)}),s.jsx(v,{kind:"task"})]})]},e.id)}),c>0&&s.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",marginTop:24},children:[c," tasks across ",o.filter(e=>e.tasks.length>0).length," areas."]})]})};export{I as default}; diff --git a/assets/TaxonomySuggestionTile-BkE17zPJ.js b/assets/TaxonomySuggestionTile-DgDd6ghr.js similarity index 83% rename from assets/TaxonomySuggestionTile-BkE17zPJ.js rename to assets/TaxonomySuggestionTile-DgDd6ghr.js index 565adcae7ea8acf03f99e410f8d4a83d63f93bf9..14d8cde080f63f663cdd45c1267b2d788189aeb4 100644 --- a/assets/TaxonomySuggestionTile-BkE17zPJ.js +++ b/assets/TaxonomySuggestionTile-DgDd6ghr.js @@ -1 +1 @@ -import{f as u,r as o,j as e}from"./index-BrhBTT14.js";import{P as c,S as m,a as p}from"./SignInToEditDialog-Dcu4wTOX.js";function h({kind:s}){const{user:a}=u(),[i,n]=o.useState(!1),[l,t]=o.useState(!1),r=`Suggest a new ${s}...`,g=()=>{a?n(!0):t(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"tag-cell taxonomy-suggestion-cell",onClick:g,children:[e.jsxs("div",{className:"name",children:[e.jsx(c,{className:"taxonomy-suggestion-icon","aria-hidden":"true"}),r]}),e.jsx("div",{className:"meta",children:e.jsx("span",{children:"Propose an addition"})})]}),e.jsx(m,{open:i,onOpenChange:n,kind:s}),e.jsx(p,{open:l,onOpenChange:t,sectionLabel:`${s}s`,returnTo:typeof window<"u"?window.location.pathname:`/${s}s`,taxonomySuggestion:!0})]})}export{h as T}; +import{y as u,r as o,j as e}from"./index-D_-UZEuL.js";import{P as c,S as m,a as p}from"./SignInToEditDialog-DZLQNGaN.js";function h({kind:s}){const{user:a}=u(),[i,n]=o.useState(!1),[l,t]=o.useState(!1),r=`Suggest a new ${s}...`,g=()=>{a?n(!0):t(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"tag-cell taxonomy-suggestion-cell",onClick:g,children:[e.jsxs("div",{className:"name",children:[e.jsx(c,{className:"taxonomy-suggestion-icon","aria-hidden":"true"}),r]}),e.jsx("div",{className:"meta",children:e.jsx("span",{children:"Propose an addition"})})]}),e.jsx(m,{open:i,onOpenChange:n,kind:s}),e.jsx(p,{open:l,onOpenChange:t,sectionLabel:`${s}s`,returnTo:typeof window<"u"?window.location.pathname:`/${s}s`,taxonomySuggestion:!0})]})}export{h as T}; diff --git a/assets/TrendsView-BvtNL0dp.js b/assets/TrendsView-BvtNL0dp.js deleted file mode 100644 index f7ca0e5712376f568bea54c8d4516ceda9542904..0000000000000000000000000000000000000000 --- a/assets/TrendsView-BvtNL0dp.js +++ /dev/null @@ -1 +0,0 @@ -import{U as I,R as X,j as e}from"./index-BrhBTT14.js";import{u as G}from"./useQuery-GhY2LXSI.js";import{A as J,a as E}from"./alert-c1n3ZtEC.js";import{S as P}from"./skeleton-DHdzoBmM.js";class Q{constructor(r){this.request=r}trends(){return this.request("/stats/trends")}}const V=new Q(I),m=t=>{const r=/^(\d{4})-(0[1-9]|1[0-2])$/.exec(t);if(!r)return t;const[,s,l]=r;return`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][Number(l)-1]} '${s.slice(2)}`},Y=()=>V.trends(),f=980,j=400,x=62,R=26,g=30,K=58,u=f-x-R,A=j-g-K,v=g+A,U=t=>{if(t.length<3)return t.map((s,l)=>`${l?"L":"M"}${s[0]} ${s[1]}`).join(" ");let r=`M${t[0][0]} ${t[0][1]}`;for(let s=0;s{const[a,y]=X.useState(null),i=r.length,b=l[l.length-1],d=n=>x+u*(i===1?0:n/(i-1)),p=n=>g+A*(1-n/b);if(i===0)return null;const B=r.map((n,h)=>[d(h),p(n.percent)]),F=U(B),_=`${F} L ${d(i-1)} ${v} L ${x} ${v} Z`,w=i<=12?1:Math.ceil(i/8),O=n=>{const h=n.currentTarget.getBoundingClientRect(),S=(n.clientX-h.left)/h.width*f,k=i>1?u/(i-1):u,q=Math.max(0,Math.min(i-1,Math.round((S-x)/k)));y(q)},H=`trend-gradient-${t}`;return e.jsxs("figure",{className:"trend-chart",children:[e.jsxs("div",{className:"trend-chart-visual",children:[e.jsxs("svg",{viewBox:`0 0 ${f} ${j}`,width:"100%",role:"img","aria-label":`${c} by ${o.toLowerCase()}, from ${m(r[0].month)} (${r[0].percent}%) to ${m(r[i-1].month)} (${r[i-1].percent}%)`,style:{display:"block",overflow:"visible",cursor:"crosshair"},onPointerMove:O,onPointerLeave:()=>y(null),children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:H,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",style:{stopColor:s,stopOpacity:.26}}),e.jsx("stop",{offset:"100%",style:{stopColor:s,stopOpacity:.02}})]})}),l.map(n=>e.jsxs("g",{children:[e.jsx("line",{x1:x,x2:f-R,y1:p(n),y2:p(n),stroke:"var(--hairline)",strokeWidth:1}),e.jsxs("text",{x:x-14,y:p(n)+4,textAnchor:"end",style:W,children:[n,"%"]})]},n)),e.jsx("path",{d:_,fill:`url(#${H})`}),e.jsx("path",{d:F,fill:"none",stroke:s,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}),r.map((n,h)=>{const S=h===i-1,k=h%w===0&&i-1-h>=w/2;return!S&&!k?null:e.jsx("text",{x:d(h),y:v+24,textAnchor:"middle",style:W,children:m(n.month)},n.month)}),e.jsx("text",{x:x+u/2,y:j-4,textAnchor:"middle",style:z,children:o}),e.jsx("text",{transform:`translate(16 ${g+A/2}) rotate(-90)`,textAnchor:"middle",style:z,children:c}),a!=null&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:d(a),x2:d(a),y1:g,y2:v,stroke:s,strokeWidth:1,strokeDasharray:"3 4",opacity:.5}),e.jsx("circle",{cx:d(a),cy:p(r[a].percent),r:5,fill:"var(--bg)",stroke:s,strokeWidth:2})]})]}),a!=null&&e.jsxs("div",{style:{position:"absolute",left:`${d(a)/f*100}%`,top:`${p(r[a].percent)/j*100}%`,transform:"translate(-50%, calc(-100% - 14px))",background:"var(--bg-elevated)",border:"1px solid var(--hairline)",borderRadius:6,boxShadow:"0 8px 26px rgba(0,0,0,.13)",padding:"7px 12px",pointerEvents:"none",whiteSpace:"nowrap",zIndex:3},children:[e.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",color:"var(--ink-faint)",fontSize:13,marginBottom:2},children:m(r[a].month)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,fontFamily:"var(--mono)",fontWeight:600,fontSize:15,color:"var(--ink)"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:2,background:s,display:"inline-block"}}),r[a].percent,"%"]})]})]}),e.jsxs("details",{className:"trend-chart-table",children:[e.jsx("summary",{style:{fontFamily:"var(--mono)",fontSize:11,letterSpacing:"0.04em",color:"var(--ink-faint)",cursor:"pointer"},children:"View data table"}),e.jsxs("table",{style:{marginTop:8,borderCollapse:"collapse",fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",padding:"3px 18px 3px 0"},children:o}),e.jsx("th",{style:{textAlign:"right",padding:"3px 0"},children:c})]})}),e.jsx("tbody",{children:r.map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 18px 2px 0"},children:m(n.month)}),e.jsxs("td",{style:{textAlign:"right",padding:"2px 0"},children:[n.percent,"%"]})]},n.month))})]})]})]})},$={maxWidth:960,padding:"48px 0 8px",borderTop:"1px solid var(--hairline)",marginTop:48},T={fontFamily:"var(--serif)",fontSize:34,fontWeight:500,letterSpacing:"-0.02em",margin:"0 0 10px",color:"var(--ink)"},M={fontFamily:"var(--serif)",fontSize:18,lineHeight:1.55,color:"var(--ink-soft)",maxWidth:620,margin:"0 0 8px"},C={fontFamily:"var(--mono)",fontSize:12,fontWeight:600,letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--ink-faint)",marginBottom:8},N={fontFamily:"var(--serif)",fontSize:17,lineHeight:1.6,color:"var(--ink-soft)",margin:0},D={height:320,marginTop:26},re=()=>{const t=G({queryKey:["research-trends"],queryFn:Y,staleTime:36e5});return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Research ",e.jsx("em",{children:"Trends"})]}),e.jsx("div",{className:"feed-subtitle",children:"How open science is changing across machine learning — tracked over time from arXiv and the Hugging Face Hub."})]})}),t.error&&e.jsx(J,{variant:"destructive",children:e.jsx(E,{children:"Failed to load research trends. Please try again."})}),e.jsxs("section",{style:$,children:[e.jsx("h2",{style:T,children:"Code Availability"}),e.jsx("p",{style:M,children:"The percentage of published papers that have at least one official code implementation on GitHub."}),e.jsx("div",{style:{marginTop:26},children:t.data?e.jsx(L,{id:"code",data:t.data.code_availability,color:"var(--trend-code)",yTicks:[0,20,40,60,80],yLabel:"Code Availability",xLabel:"Paper Publication Date"}):!t.error&&e.jsx(P,{style:D})})]}),e.jsxs("section",{style:$,children:[e.jsx("h2",{style:T,children:"Papers with Hugging Face artifacts"}),e.jsx("p",{style:M,children:"The percentage of published papers linked to at least one Hugging Face artifact — a model, dataset or Space — making the work directly runnable and reusable."}),e.jsx("div",{style:{marginTop:26},children:t.data?e.jsx(L,{id:"hf",data:t.data.hf_artifacts,color:"var(--trend-hf)",yTicks:[0,10,20,30,40,50],yLabel:"HF Artifact Coverage",xLabel:"Paper Publication Date"}):!t.error&&e.jsx(P,{style:D})})]}),e.jsxs("section",{style:{...$,paddingBottom:72},children:[e.jsx("h2",{style:{...T,fontSize:27},children:"How the data is collected"}),e.jsxs("div",{style:{display:"grid",gap:24,maxWidth:680},children:[e.jsxs("div",{children:[e.jsx("div",{style:C,children:"Code Availability"}),e.jsx("p",{style:N,children:"For every open-access machine learning paper, we check whether an official code implementation is linked on GitHub. The date axis is the paper's publication date."})]}),e.jsxs("div",{children:[e.jsx("div",{style:C,children:"Hugging Face artifacts"}),e.jsx("p",{style:N,children:"We resolve links between papers and the Hugging Face Hub, counting a paper as covered when it references at least one model, dataset or Space. The date axis is the paper's publication date."})]}),e.jsx("p",{style:{fontFamily:"var(--mono)",fontSize:12,lineHeight:1.6,color:"var(--ink-faint)",margin:"8px 0 0",letterSpacing:"0.02em"},children:"Figures use complete publication months. Historical Hugging Face coverage reflects artifacts currently linked in the catalog."})]})]})]})};export{re as default}; diff --git a/assets/TrendsView-Gyl495vi.js b/assets/TrendsView-Gyl495vi.js new file mode 100644 index 0000000000000000000000000000000000000000..e0e44dafdcb423c91921383e4b3d4075192f613a --- /dev/null +++ b/assets/TrendsView-Gyl495vi.js @@ -0,0 +1 @@ +import{a0 as I,z as X,j as e}from"./index-D_-UZEuL.js";import{u as G}from"./useQuery-BZo4MZ3s.js";import{A as J,a as E}from"./alert-B2j1kc2o.js";import{S as P}from"./skeleton-CCZ1iXls.js";class Q{constructor(r){this.request=r}trends(){return this.request("/stats/trends")}}const V=new Q(I),m=t=>{const r=/^(\d{4})-(0[1-9]|1[0-2])$/.exec(t);if(!r)return t;const[,s,l]=r;return`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][Number(l)-1]} '${s.slice(2)}`},Y=()=>V.trends(),f=980,j=400,x=62,B=26,g=30,K=58,u=f-x-B,A=j-g-K,v=g+A,Z=t=>{if(t.length<3)return t.map((s,l)=>`${l?"L":"M"}${s[0]} ${s[1]}`).join(" ");let r=`M${t[0][0]} ${t[0][1]}`;for(let s=0;s{const[a,y]=X.useState(null),i=r.length,b=l[l.length-1],d=n=>x+u*(i===1?0:n/(i-1)),p=n=>g+A*(1-n/b);if(i===0)return null;const R=r.map((n,h)=>[d(h),p(n.percent)]),F=Z(R),_=`${F} L ${d(i-1)} ${v} L ${x} ${v} Z`,w=i<=12?1:Math.ceil(i/8),O=n=>{const h=n.currentTarget.getBoundingClientRect(),S=(n.clientX-h.left)/h.width*f,k=i>1?u/(i-1):u,q=Math.max(0,Math.min(i-1,Math.round((S-x)/k)));y(q)},H=`trend-gradient-${t}`;return e.jsxs("figure",{className:"trend-chart",children:[e.jsxs("div",{className:"trend-chart-visual",children:[e.jsxs("svg",{viewBox:`0 0 ${f} ${j}`,width:"100%",role:"img","aria-label":`${c} by ${o.toLowerCase()}, from ${m(r[0].month)} (${r[0].percent}%) to ${m(r[i-1].month)} (${r[i-1].percent}%)`,style:{display:"block",overflow:"visible",cursor:"crosshair"},onPointerMove:O,onPointerLeave:()=>y(null),children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:H,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",style:{stopColor:s,stopOpacity:.26}}),e.jsx("stop",{offset:"100%",style:{stopColor:s,stopOpacity:.02}})]})}),l.map(n=>e.jsxs("g",{children:[e.jsx("line",{x1:x,x2:f-B,y1:p(n),y2:p(n),stroke:"var(--hairline)",strokeWidth:1}),e.jsxs("text",{x:x-14,y:p(n)+4,textAnchor:"end",style:z,children:[n,"%"]})]},n)),e.jsx("path",{d:_,fill:`url(#${H})`}),e.jsx("path",{d:F,fill:"none",stroke:s,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}),r.map((n,h)=>{const S=h===i-1,k=h%w===0&&i-1-h>=w/2;return!S&&!k?null:e.jsx("text",{x:d(h),y:v+24,textAnchor:"middle",style:z,children:m(n.month)},n.month)}),e.jsx("text",{x:x+u/2,y:j-4,textAnchor:"middle",style:W,children:o}),e.jsx("text",{transform:`translate(16 ${g+A/2}) rotate(-90)`,textAnchor:"middle",style:W,children:c}),a!=null&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:d(a),x2:d(a),y1:g,y2:v,stroke:s,strokeWidth:1,strokeDasharray:"3 4",opacity:.5}),e.jsx("circle",{cx:d(a),cy:p(r[a].percent),r:5,fill:"var(--bg)",stroke:s,strokeWidth:2})]})]}),a!=null&&e.jsxs("div",{style:{position:"absolute",left:`${d(a)/f*100}%`,top:`${p(r[a].percent)/j*100}%`,transform:"translate(-50%, calc(-100% - 14px))",background:"var(--bg-elevated)",border:"1px solid var(--hairline)",borderRadius:6,boxShadow:"0 8px 26px rgba(0,0,0,.13)",padding:"7px 12px",pointerEvents:"none",whiteSpace:"nowrap",zIndex:3},children:[e.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",color:"var(--ink-faint)",fontSize:13,marginBottom:2},children:m(r[a].month)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,fontFamily:"var(--mono)",fontWeight:600,fontSize:15,color:"var(--ink)"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:2,background:s,display:"inline-block"}}),r[a].percent,"%"]})]})]}),e.jsxs("details",{className:"trend-chart-table",children:[e.jsx("summary",{style:{fontFamily:"var(--mono)",fontSize:11,letterSpacing:"0.04em",color:"var(--ink-faint)",cursor:"pointer"},children:"View data table"}),e.jsxs("table",{style:{marginTop:8,borderCollapse:"collapse",fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",padding:"3px 18px 3px 0"},children:o}),e.jsx("th",{style:{textAlign:"right",padding:"3px 0"},children:c})]})}),e.jsx("tbody",{children:r.map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 18px 2px 0"},children:m(n.month)}),e.jsxs("td",{style:{textAlign:"right",padding:"2px 0"},children:[n.percent,"%"]})]},n.month))})]})]})]})},$={maxWidth:960,padding:"48px 0 8px",borderTop:"1px solid var(--hairline)",marginTop:48},T={fontFamily:"var(--serif)",fontSize:34,fontWeight:500,letterSpacing:"-0.02em",margin:"0 0 10px",color:"var(--ink)"},M={fontFamily:"var(--serif)",fontSize:18,lineHeight:1.55,color:"var(--ink-soft)",maxWidth:620,margin:"0 0 8px"},C={fontFamily:"var(--mono)",fontSize:12,fontWeight:600,letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--ink-faint)",marginBottom:8},N={fontFamily:"var(--serif)",fontSize:17,lineHeight:1.6,color:"var(--ink-soft)",margin:0},D={height:320,marginTop:26},re=()=>{const t=G({queryKey:["research-trends"],queryFn:Y,staleTime:36e5});return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Research ",e.jsx("em",{children:"Trends"})]}),e.jsx("div",{className:"feed-subtitle",children:"How open science is changing across machine learning — tracked over time from arXiv and the Hugging Face Hub."})]})}),t.error&&e.jsx(J,{variant:"destructive",children:e.jsx(E,{children:"Failed to load research trends. Please try again."})}),e.jsxs("section",{style:$,children:[e.jsx("h2",{style:T,children:"Code Availability"}),e.jsx("p",{style:M,children:"The percentage of published papers that have at least one official code implementation on GitHub."}),e.jsx("div",{style:{marginTop:26},children:t.data?e.jsx(L,{id:"code",data:t.data.code_availability,color:"var(--trend-code)",yTicks:[0,20,40,60,80],yLabel:"Code Availability",xLabel:"Paper Publication Date"}):!t.error&&e.jsx(P,{style:D})})]}),e.jsxs("section",{style:$,children:[e.jsx("h2",{style:T,children:"Papers with Hugging Face artifacts"}),e.jsx("p",{style:M,children:"The percentage of published papers linked to at least one Hugging Face artifact — a model, dataset or Space — making the work directly runnable and reusable."}),e.jsx("div",{style:{marginTop:26},children:t.data?e.jsx(L,{id:"hf",data:t.data.hf_artifacts,color:"var(--trend-hf)",yTicks:[0,10,20,30,40,50],yLabel:"HF Artifact Coverage",xLabel:"Paper Publication Date"}):!t.error&&e.jsx(P,{style:D})})]}),e.jsxs("section",{style:{...$,paddingBottom:72},children:[e.jsx("h2",{style:{...T,fontSize:27},children:"How the data is collected"}),e.jsxs("div",{style:{display:"grid",gap:24,maxWidth:680},children:[e.jsxs("div",{children:[e.jsx("div",{style:C,children:"Code Availability"}),e.jsx("p",{style:N,children:"For every open-access machine learning paper, we check whether an official code implementation is linked on GitHub. The date axis is the paper's publication date."})]}),e.jsxs("div",{children:[e.jsx("div",{style:C,children:"Hugging Face artifacts"}),e.jsx("p",{style:N,children:"We resolve links between papers and the Hugging Face Hub, counting a paper as covered when it references at least one model, dataset or Space. The date axis is the paper's publication date."})]}),e.jsx("p",{style:{fontFamily:"var(--mono)",fontSize:12,lineHeight:1.6,color:"var(--ink-faint)",margin:"8px 0 0",letterSpacing:"0.02em"},children:"Figures use complete publication months. Historical Hugging Face coverage reflects artifacts currently linked in the catalog."})]})]})]})};export{re as default}; diff --git a/assets/UserProfileView-CRGhrhTR.js b/assets/UserProfileView-flvwm70w.js similarity index 87% rename from assets/UserProfileView-CRGhrhTR.js rename to assets/UserProfileView-flvwm70w.js index 10e747bf6048957d1dc55cdff14530daa23c9444..2b453dfdfde1f2e745e587575adc79f292dda817 100644 --- a/assets/UserProfileView-CRGhrhTR.js +++ b/assets/UserProfileView-flvwm70w.js @@ -1 +1 @@ -import{ag as i,A as n,e as o,j as e,at as d}from"./index-BrhBTT14.js";import{u as l}from"./useQuery-GhY2LXSI.js";import{C as c}from"./OrganizationContributionGraph-0Wm7L2tv.js";import"./skeleton-DHdzoBmM.js";import"./catalog-CkpmYxEk.js";const p={async get(t){const a=await i(`/profiles/${encodeURIComponent(t)}`);if(!a.ok)throw new n(a,await a.text());const r=await a.json();if(!a.redirected)return r;const s=decodeURIComponent(new URL(a.url).pathname.split("/").pop()||r.username);return{...r,username:s,redirected_from_alias:!0}}},f=()=>{const{username:t=""}=o(),a=l({queryKey:["user-profile",t.toLowerCase()],queryFn:()=>p.get(t)});return a.isLoading?e.jsx("div",{className:"page",children:"Loading profile…"}):a.data?a.data.redirected_from_alias?e.jsx(d,{to:`/${a.data.username}`,replace:!0}):e.jsxs("div",{className:"page",style:{maxWidth:960},children:[e.jsxs("h1",{children:["@",a.data.username]}),e.jsx("p",{children:"Canonical Papers with Code contributions"}),e.jsx(c,{data:a.data.calendar,organizationName:`@${a.data.username}`,title:"Canonical contributions",noun:"contribution"}),a.data.is_owner&&e.jsxs("section",{className:"mt-10",children:[e.jsx("h2",{children:"Your submissions"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Limits and duplicate behavior are documented on ",e.jsx("a",{href:"/rate-limits",children:"the policy page"}),"."]}),e.jsx("div",{className:"mt-4 space-y-3",children:a.data.submissions.map(r=>e.jsxs("article",{className:"rounded-md border p-4",children:[e.jsx("strong",{children:r.edit_type})," · ",r.status,e.jsxs("details",{className:"mt-2 text-xs",children:[e.jsx("summary",{children:"Original and applied payload"}),e.jsx("pre",{children:JSON.stringify({proposed:r.proposed_payload,applied:r.applied_payload},null,2)})]}),r.review_reason&&e.jsx("p",{children:r.review_reason})]},r.id))})]})]}):e.jsx("div",{className:"page",children:e.jsx("h1",{children:"Profile not found"})})};export{f as default}; +import{al as i,A as n,c as o,j as e,ay as d}from"./index-D_-UZEuL.js";import{u as l}from"./useQuery-BZo4MZ3s.js";import{C as c}from"./OrganizationContributionGraph-BroNa3f8.js";import"./skeleton-CCZ1iXls.js";import"./catalog-CjU2vAfw.js";const p={async get(t){const a=await i(`/profiles/${encodeURIComponent(t)}`);if(!a.ok)throw new n(a,await a.text());const r=await a.json();if(!a.redirected)return r;const s=decodeURIComponent(new URL(a.url).pathname.split("/").pop()||r.username);return{...r,username:s,redirected_from_alias:!0}}},f=()=>{const{username:t=""}=o(),a=l({queryKey:["user-profile",t.toLowerCase()],queryFn:()=>p.get(t)});return a.isLoading?e.jsx("div",{className:"page",children:"Loading profile…"}):a.data?a.data.redirected_from_alias?e.jsx(d,{to:`/${a.data.username}`,replace:!0}):e.jsxs("div",{className:"page",style:{maxWidth:960},children:[e.jsxs("h1",{children:["@",a.data.username]}),e.jsx("p",{children:"Canonical Papers with Code contributions"}),e.jsx(c,{data:a.data.calendar,organizationName:`@${a.data.username}`,title:"Canonical contributions",noun:"contribution"}),a.data.is_owner&&e.jsxs("section",{className:"mt-10",children:[e.jsx("h2",{children:"Your submissions"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Limits and duplicate behavior are documented on ",e.jsx("a",{href:"/rate-limits",children:"the policy page"}),"."]}),e.jsx("div",{className:"mt-4 space-y-3",children:a.data.submissions.map(r=>e.jsxs("article",{className:"rounded-md border p-4",children:[e.jsx("strong",{children:r.edit_type})," · ",r.status,e.jsxs("details",{className:"mt-2 text-xs",children:[e.jsx("summary",{children:"Original and applied payload"}),e.jsx("pre",{children:JSON.stringify({proposed:r.proposed_payload,applied:r.applied_payload},null,2)})]}),r.review_reason&&e.jsx("p",{children:r.review_reason})]},r.id))})]})]}):e.jsx("div",{className:"page",children:e.jsx("h1",{children:"Profile not found"})})};export{f as default}; diff --git a/assets/__vite-browser-external-BIHI7g3E.js b/assets/__vite-browser-external-BIHI7g3E.js new file mode 100644 index 0000000000000000000000000000000000000000..b480ffe6ce7040f68468da9d453d371cbc190177 --- /dev/null +++ b/assets/__vite-browser-external-BIHI7g3E.js @@ -0,0 +1 @@ +const e={};export{e as default}; diff --git a/assets/alert-B2j1kc2o.js b/assets/alert-B2j1kc2o.js new file mode 100644 index 0000000000000000000000000000000000000000..47929b26103196d569903ee7aec8ba8572508979 --- /dev/null +++ b/assets/alert-B2j1kc2o.js @@ -0,0 +1 @@ +import{r as a,j as s,q as l,a2 as i}from"./index-D_-UZEuL.js";const o=i("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),n=a.forwardRef(({className:e,variant:t,...r},d)=>s.jsx("div",{ref:d,role:"alert",className:l(o({variant:t}),e),...r}));n.displayName="Alert";const v=a.forwardRef(({className:e,...t},r)=>s.jsx("h5",{ref:r,className:l("mb-1 font-medium leading-none tracking-tight",e),...t}));v.displayName="AlertTitle";const c=a.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:l("text-sm [&_p]:leading-relaxed",e),...t}));c.displayName="AlertDescription";export{n as A,c as a}; diff --git a/assets/alert-c1n3ZtEC.js b/assets/alert-c1n3ZtEC.js deleted file mode 100644 index 83c412a07511445b841f4abd51357101d8a0057e..0000000000000000000000000000000000000000 --- a/assets/alert-c1n3ZtEC.js +++ /dev/null @@ -1 +0,0 @@ -import{r as a,j as s,v as l,W as i}from"./index-BrhBTT14.js";const o=i("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),n=a.forwardRef(({className:e,variant:t,...r},d)=>s.jsx("div",{ref:d,role:"alert",className:l(o({variant:t}),e),...r}));n.displayName="Alert";const v=a.forwardRef(({className:e,...t},r)=>s.jsx("h5",{ref:r,className:l("mb-1 font-medium leading-none tracking-tight",e),...t}));v.displayName="AlertTitle";const c=a.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:l("text-sm [&_p]:leading-relaxed",e),...t}));c.displayName="AlertDescription";export{n as A,c as a}; diff --git a/assets/button-Cc8PFtC1.js b/assets/button-Cc8PFtC1.js new file mode 100644 index 0000000000000000000000000000000000000000..14832a640c825a57d47e9bfbf299f6e787798c39 --- /dev/null +++ b/assets/button-Cc8PFtC1.js @@ -0,0 +1 @@ +import{r as a,j as d,am as u,q as c,a2 as f}from"./index-D_-UZEuL.js";const g=f("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),v=a.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},s)=>{const i=n?u:"button";return d.jsx(i,{className:c(g({variant:t,size:r,className:e})),ref:s,...o})});v.displayName="Button";export{v as B}; diff --git a/assets/button-CusGeqPB.js b/assets/button-CusGeqPB.js deleted file mode 100644 index 1debe414122578abc82b3fe306d26a38b2d5046c..0000000000000000000000000000000000000000 --- a/assets/button-CusGeqPB.js +++ /dev/null @@ -1 +0,0 @@ -import{r as a,j as d,ah as u,v as c,W as f}from"./index-BrhBTT14.js";const g=f("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),v=a.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},s)=>{const i=n?u:"button";return d.jsx(i,{className:c(g({variant:t,size:r,className:e})),ref:s,...o})});v.displayName="Button";export{v as B}; diff --git a/assets/catalog-CjU2vAfw.js b/assets/catalog-CjU2vAfw.js new file mode 100644 index 0000000000000000000000000000000000000000..fc575455f90fcb316ba96f724365c5d8fcf493a8 --- /dev/null +++ b/assets/catalog-CjU2vAfw.js @@ -0,0 +1 @@ +import{a0 as o}from"./index-D_-UZEuL.js";function s(n,t){const e=new URLSearchParams;for(const[i,a]of Object.entries(t??{}))a!==void 0&&a!==""&&e.set(i,String(a));const r=e.toString();return`${n}${r?`?${r}`:""}`}class u{constructor(t){this.request=t}listAreas(t){return this.request(s("/areas/",t))}getArea(t){return this.request(`/areas/${t}`)}areasWithTasks(){return this.request("/areas/with-tasks/")}listTasks(t){return this.request(s("/tasks/",t))}getTask(t){return this.request(`/tasks/${t}`)}topTasks(t){return this.request(s("/tasks/top",{limit:t}))}trendingTasks(t){return this.request(s("/tasks/trending",t))}taskChildren(t,e){return this.request(s(`/tasks/${t}/children`,e))}taskParents(t){return this.request(`/tasks/${t}/parents`)}taskPage(t,e){return this.request(s(`/tasks/${t}/page`,e))}trendingBenchmarks(t,e){return this.request(s(`/tasks/${encodeURIComponent(t)}/trending-benchmarks`,e))}frameworkCatalog(){return this.request("/frameworks/")}listMethods(t){return this.request(s("/methods/",t))}getMethod(t){return this.request(`/methods/${encodeURIComponent(t)}`)}methodTrend(t,e){return this.request(s(`/methods/${encodeURIComponent(t)}/trend`,e))}listDatasets(t){const{task_id:e,...r}=t??{};return this.request(s("/datasets/",{...r,task:r.task??e}))}getDataset(t){return this.request(`/datasets/${t}`)}getDatasetBySlug(t,e){return this.request(s(`/datasets/${t}`,e))}async datasetTasks(t){return(await this.request(`/datasets/${t}/tasks/`)).results}async leaderboardMetrics(t,e){return(await this.request(`/datasets/${t}/tasks/${e}/metrics`)).metrics}metricDirections(){return this.request("/metrics/directions")}conferences(){return this.request("/conferences/")}conferenceDeadlines(){return this.request("/conferences/deadlines")}getConference(t){return this.request(`/conferences/${t}`)}conferenceAreasWithTasks(t){return this.request(`/conferences/${t}/areas-with-tasks`)}organizations(t=!1){return this.request(`/organizations/${t?"?featured_only=true":""}`)}getOrganization(t){return this.request(`/organizations/${t}`)}organizationContributions(t){return this.request(`/organizations/${t}/contributions`)}organizationAreasWithTasks(t){return this.request(`/organizations/${t}/areas-with-tasks`)}audit(t){return this.request(s("/admin/catalog-audit",{cursor:t}))}acknowledgeAudit(){return this.request("/admin/catalog-audit/acknowledge",{method:"POST"})}rollbackEvent(t){return this.request(`/admin/catalog-audit/${t}/rollback`,{method:"POST"})}}const h=new u(o);export{h as c}; diff --git a/assets/catalog-CkpmYxEk.js b/assets/catalog-CkpmYxEk.js deleted file mode 100644 index 57edbb2795992e6889f1f81806db00972a0a7bd7..0000000000000000000000000000000000000000 --- a/assets/catalog-CkpmYxEk.js +++ /dev/null @@ -1 +0,0 @@ -import{U as o}from"./index-BrhBTT14.js";function s(n,t){const e=new URLSearchParams;for(const[i,a]of Object.entries(t??{}))a!==void 0&&a!==""&&e.set(i,String(a));const r=e.toString();return`${n}${r?`?${r}`:""}`}class u{constructor(t){this.request=t}listAreas(t){return this.request(s("/areas/",t))}getArea(t){return this.request(`/areas/${t}`)}areasWithTasks(){return this.request("/areas/with-tasks/")}listTasks(t){return this.request(s("/tasks/",t))}getTask(t){return this.request(`/tasks/${t}`)}topTasks(t){return this.request(s("/tasks/top",{limit:t}))}trendingTasks(t){return this.request(s("/tasks/trending",t))}taskChildren(t,e){return this.request(s(`/tasks/${t}/children`,e))}taskParents(t){return this.request(`/tasks/${t}/parents`)}taskPage(t,e){return this.request(s(`/tasks/${t}/page`,e))}trendingBenchmarks(t,e){return this.request(s(`/tasks/${encodeURIComponent(t)}/trending-benchmarks`,e))}frameworkCatalog(){return this.request("/frameworks/")}listMethods(t){return this.request(s("/methods/",t))}getMethod(t){return this.request(`/methods/${encodeURIComponent(t)}`)}methodTrend(t,e){return this.request(s(`/methods/${encodeURIComponent(t)}/trend`,e))}listDatasets(t){const{task_id:e,...r}=t??{};return this.request(s("/datasets/",{...r,task:r.task??e}))}getDataset(t){return this.request(`/datasets/${t}`)}getDatasetBySlug(t,e){return this.request(s(`/datasets/${t}`,e))}async datasetTasks(t){return(await this.request(`/datasets/${t}/tasks/`)).results}async leaderboardMetrics(t,e){return(await this.request(`/datasets/${t}/tasks/${e}/metrics`)).metrics}metricDirections(){return this.request("/metrics/directions")}conferences(){return this.request("/conferences/")}conferenceDeadlines(){return this.request("/conferences/deadlines")}getConference(t){return this.request(`/conferences/${t}`)}conferenceAreasWithTasks(t){return this.request(`/conferences/${t}/areas-with-tasks`)}organizations(t=!1){return this.request(`/organizations/${t?"?featured_only=true":""}`)}getOrganization(t){return this.request(`/organizations/${t}`)}organizationContributions(t){return this.request(`/organizations/${t}/contributions`)}organizationAreasWithTasks(t){return this.request(`/organizations/${t}/areas-with-tasks`)}audit(t){return this.request(s("/admin/catalog-audit",{cursor:t}))}acknowledgeAudit(){return this.request("/admin/catalog-audit/acknowledge",{method:"POST"})}rollbackEvent(t){return this.request(`/admin/catalog-audit/${t}/rollback`,{method:"POST"})}}const h=new u(o);export{h as c}; diff --git a/assets/chat-7zW8PrrA.js b/assets/chat-7zW8PrrA.js new file mode 100644 index 0000000000000000000000000000000000000000..6473fb861c2b1ef774bcd6fe1f8fc1c5e532be4a --- /dev/null +++ b/assets/chat-7zW8PrrA.js @@ -0,0 +1 @@ +import{a0 as n,al as s}from"./index-D_-UZEuL.js";class o{constructor(e){this.request=e}listSessions(e){const t=new URLSearchParams({limit:"50"});return e&&t.set("cursor",e),this.request(`/chat/sessions?${t.toString()}`)}createSession(e,t="low"){return this.request("/chat/sessions",{method:"POST",body:JSON.stringify({selected_model:e||null,reasoning_effort:t})})}getSession(e){return this.request(`/chat/sessions/${e}`)}updateSession(e,t){return this.request(`/chat/sessions/${e}`,{method:"PATCH",body:JSON.stringify(t)})}removeSession(e){return this.request(`/chat/sessions/${e}`,{method:"DELETE"})}archiveOldChats(){return this.request("/chat/sessions/archive-old",{method:"POST"})}archiveOldestChats(){return this.request("/chat/sessions/archive-oldest",{method:"POST"})}cancelSession(e){return this.request(`/chat/sessions/${e}/cancel`,{method:"POST"})}createOrRefreshShare(e){return this.request(`/chat/sessions/${e}/share`,{method:"POST"})}getSharedChat(e){return this.request(`/chat/shares/${encodeURIComponent(e)}`,{credentials:"omit"})}getModels(){return this.request("/chat/models")}getUsage(){return this.request("/chat/usage",{cache:"no-store"})}getAvailability(){return this.request("/chat/availability",{cache:"no-store"})}getInferenceBilling(){return this.request("/me/inference-billing",{cache:"no-store"})}prewarmPaperContext(e){return this.request("/chat/paper-context/prewarm",{method:"POST",body:JSON.stringify({route_id:e}),credentials:"omit",cache:"no-store"})}getSandboxSpend(e){const t=e?`?environment=${encodeURIComponent(e)}`:"";return this.request(`/chat/admin/sandbox-spend${t}`,{cache:"no-store"})}getWebSearchBudget(){return this.request("/chat/admin/web-search-budget",{cache:"no-store"})}getOpenRouterCredential(){return this.request("/chat/openrouter-key",{cache:"no-store"})}connectOpenRouterCredential(e){return this.request("/chat/openrouter-key",{method:"PUT",body:JSON.stringify({api_key:e})})}setOpenRouterFallback(e){return this.request("/chat/openrouter-key",{method:"PATCH",body:JSON.stringify({enabled:e})})}disconnectOpenRouterCredential(){return this.request("/chat/openrouter-key",{method:"DELETE"})}reportLatency(e,t){return s(`/chat/latency/${encodeURIComponent(e)}`,{method:"POST",keepalive:!0,body:JSON.stringify(t)})}reportFeedback(e,t,r){return this.request(`/chat/messages/${encodeURIComponent(e)}/feedback`,{method:"POST",body:JSON.stringify({value:t,...r?{comment:r}:{}})})}stream(e,t){return s("/chat/stream",{method:"POST",headers:{Accept:"text/event-stream"},body:JSON.stringify(e),signal:t})}resumeStream(e,t){return s(`/chat/sessions/${encodeURIComponent(e)}/stream`,{method:"GET",headers:{Accept:"text/event-stream"},signal:t})}}const h=new o(n);export{h as c}; diff --git a/assets/chat-Ck3hlrgT.js b/assets/chat-Ck3hlrgT.js deleted file mode 100644 index 42bfb57eda15ae914388f98c8a57453499590869..0000000000000000000000000000000000000000 --- a/assets/chat-Ck3hlrgT.js +++ /dev/null @@ -1 +0,0 @@ -import{U as n,ag as s}from"./index-BrhBTT14.js";class o{constructor(e){this.request=e}listSessions(e){const t=new URLSearchParams({limit:"50"});return e&&t.set("cursor",e),this.request(`/chat/sessions?${t.toString()}`)}createSession(e,t="low"){return this.request("/chat/sessions",{method:"POST",body:JSON.stringify({selected_model:e||null,reasoning_effort:t})})}getSession(e){return this.request(`/chat/sessions/${e}`)}updateSession(e,t){return this.request(`/chat/sessions/${e}`,{method:"PATCH",body:JSON.stringify(t)})}removeSession(e){return this.request(`/chat/sessions/${e}`,{method:"DELETE"})}archiveOldChats(){return this.request("/chat/sessions/archive-old",{method:"POST"})}archiveOldestChats(){return this.request("/chat/sessions/archive-oldest",{method:"POST"})}cancelSession(e){return this.request(`/chat/sessions/${e}/cancel`,{method:"POST"})}createOrRefreshShare(e){return this.request(`/chat/sessions/${e}/share`,{method:"POST"})}getSharedChat(e){return this.request(`/chat/shares/${encodeURIComponent(e)}`,{credentials:"omit"})}getModels(){return this.request("/chat/models")}getUsage(){return this.request("/chat/usage",{cache:"no-store"})}getAvailability(){return this.request("/chat/availability",{cache:"no-store"})}getInferenceBilling(){return this.request("/me/inference-billing",{cache:"no-store"})}prewarmPaperContext(e){return this.request("/chat/paper-context/prewarm",{method:"POST",body:JSON.stringify({route_id:e}),credentials:"omit",cache:"no-store"})}getSandboxSpend(e){const t=e?`?environment=${encodeURIComponent(e)}`:"";return this.request(`/chat/admin/sandbox-spend${t}`,{cache:"no-store"})}getWebSearchBudget(){return this.request("/chat/admin/web-search-budget",{cache:"no-store"})}getOpenRouterCredential(){return this.request("/chat/openrouter-key",{cache:"no-store"})}connectOpenRouterCredential(e){return this.request("/chat/openrouter-key",{method:"PUT",body:JSON.stringify({api_key:e})})}setOpenRouterFallback(e){return this.request("/chat/openrouter-key",{method:"PATCH",body:JSON.stringify({enabled:e})})}disconnectOpenRouterCredential(){return this.request("/chat/openrouter-key",{method:"DELETE"})}reportLatency(e,t){return s(`/chat/latency/${encodeURIComponent(e)}`,{method:"POST",keepalive:!0,body:JSON.stringify(t)})}reportFeedback(e,t,r){return this.request(`/chat/messages/${encodeURIComponent(e)}/feedback`,{method:"POST",body:JSON.stringify({value:t,...r?{comment:r}:{}})})}stream(e,t){return s("/chat/stream",{method:"POST",headers:{Accept:"text/event-stream"},body:JSON.stringify(e),signal:t})}resumeStream(e,t){return s(`/chat/sessions/${encodeURIComponent(e)}/stream`,{method:"GET",headers:{Accept:"text/event-stream"},signal:t})}}const h=new o(n);export{h as c}; diff --git a/assets/chatSessions-Dx6Tu-Jq.js b/assets/chatSessions-CPPX7pkh.js similarity index 93% rename from assets/chatSessions-Dx6Tu-Jq.js rename to assets/chatSessions-CPPX7pkh.js index 7b4050184eeb602c97ff4c0f9e02bfa39caacf4c..e35ac449fe9a6e9a67cc353bb7b8cd7f77bd0a65 100644 --- a/assets/chatSessions-Dx6Tu-Jq.js +++ b/assets/chatSessions-CPPX7pkh.js @@ -1,7 +1,7 @@ -import{c as z,j as a,r as C,C as G,R as d,A as Q}from"./index-BrhBTT14.js";import{C as J}from"./chevron-down-CKySK_lE.js";import{u as X}from"./useQuery-GhY2LXSI.js";import{c as g}from"./chat-Ck3hlrgT.js";import{p as Z}from"./papers-DBaPliAp.js";/** +import{d as z,j as a,r as C,C as G,z as d,A as Q}from"./index-D_-UZEuL.js";import{C as J}from"./chevron-down-DI19XsBw.js";import{u as X}from"./useQuery-BZo4MZ3s.js";import{c as g}from"./chat-7zW8PrrA.js";import{p as Z}from"./papers-DHqjKX7p.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ee=z("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),he=({light:e})=>a.jsx("span",{className:`chat-spinner${e?" chat-spinner-light":""}`}),de=({open:e})=>a.jsx("svg",{className:`chat-chev${e?" chat-chev-open":""}`,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"m6 9 6 6 6-6"})}),pe=()=>a.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("path",{d:"m9 12 2 2 4-4"})]}),fe=({size:e=14})=>a.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"11",cy:"11",r:"7"}),a.jsx("path",{d:"m21 21-4.3-4.3"})]}),ge=()=>a.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",children:a.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})}),me=()=>a.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M12 5v14M5 12h14"})}),ye=()=>a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),a.jsx("path",{d:"M9 4v16"})]}),ve=()=>a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M6 6l1 14a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-14"})}),te=[{provider:"huggingface",label:"Inference Providers"},{provider:"openrouter",label:"OpenRouter"}],xe=({models:e,selectedModel:r,onModelChange:t,disabled:s})=>{var i,o;const n=((i=e.find(u=>u.id===r))==null?void 0:i.label)??`${r} (unavailable)`,l=e.filter(u=>!u.provider);return e.length===1&&((o=e[0])==null?void 0:o.id)===r?a.jsx("span",{className:"chat-model-label","aria-label":"Research model",children:n}):a.jsxs("span",{className:`chat-model-picker${s?" is-disabled":""}`,children:[a.jsx("span",{className:"chat-model-picker-sizer","aria-hidden":"true",children:n}),a.jsxs("select",{className:"chat-model-select",value:r,disabled:s,onChange:u=>t(u.target.value),"aria-label":"Research model",children:[!e.some(u=>u.id===r)&&a.jsx("option",{value:r,disabled:!0,children:n}),l.map(u=>a.jsx("option",{value:u.id,children:u.label},u.id)),te.map(({provider:u,label:y})=>{const h=e.filter(p=>p.provider===u);return h.length===0?null:a.jsx("optgroup",{label:y,children:h.map(p=>a.jsx("option",{value:p.id,children:p.label},p.id))},u)})]}),a.jsx("svg",{className:"chat-model-picker-chevron",viewBox:"0 0 12 8","aria-hidden":"true",children:a.jsx("path",{d:"m1 1 5 5 5-5"})})]})},N=[{value:"low",label:"Low",description:"Faster and more concise"},{value:"high",label:"High",description:"More thorough"},{value:"max",label:"Max",description:"Deepest and slowest"}],we=({value:e,onChange:r,disabled:t=!1})=>{const[s,n]=C.useState(!1),l=C.useRef(null),i=N.find(o=>o.value===e)??N[0];return C.useEffect(()=>{if(!s)return;const o=y=>{var h;(h=l.current)!=null&&h.contains(y.target)||n(!1)},u=y=>{y.key==="Escape"&&n(!1)};return document.addEventListener("mousedown",o),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",u)}},[s]),C.useEffect(()=>{t&&n(!1)},[t]),a.jsxs("div",{className:"chat-effort-picker",ref:l,children:[a.jsxs("button",{type:"button",className:"chat-effort-trigger","aria-label":`Reasoning effort: ${i.label}`,"aria-haspopup":"listbox","aria-expanded":s,disabled:t,onClick:()=>n(o=>!o),children:[a.jsx("span",{children:i.label}),a.jsx(J,{size:13,"aria-hidden":"true"})]}),s&&a.jsxs("div",{className:"chat-effort-menu",role:"listbox","aria-label":"Reasoning effort",children:[a.jsx("div",{className:"chat-effort-menu-label","aria-hidden":"true",children:"Reasoning effort"}),N.map(o=>a.jsxs("button",{type:"button",className:`chat-effort-option${o.value===e?" is-selected":""}`,role:"option","aria-selected":o.value===e,onClick:()=>{r(o.value),n(!1)},children:[a.jsxs("span",{className:"chat-effort-option-copy",children:[a.jsx("strong",{children:o.label}),a.jsx("small",{children:o.description})]}),o.value===e&&a.jsx(G,{size:15,"aria-hidden":"true"})]},o.value))]})]})},_e=({text:e,mentions:r,scrollTop:t=0,variant:s="composer"})=>{const n=[];let l=0;for(const i of[...r].sort((o,u)=>o.start-u.start)){const o=e.slice(i.start,i.end),u=o===i.title||o===`@${i.title}`;i.starte.length||!u||(n.push(e.slice(l,i.start)),n.push(a.jsx("span",{className:`chat-paper-inline-highlight${i.unavailable?" is-unavailable":""}`,"data-paper-route-id":i.route_id,children:o},i.key)),l=i.end)}return n.push(e.slice(l)),e.endsWith(` -`)&&n.push("​"),a.jsx("div",{"aria-hidden":"true",className:`chat-paper-highlight-layer chat-paper-highlight-layer-${s}`,children:a.jsx("div",{style:{transform:`translateY(-${t}px)`},children:n})})},be=({open:e,query:r,results:t,activeIndex:s,loading:n,error:l,onSelect:i,id:o="chat-paper-picker",optionIdPrefix:u="chat-paper-option"})=>{if(!e)return null;const y=r.trim()?n?"Searching papers…":l?"Paper search is unavailable":t.length?`${t.length} paper${t.length===1?"":"s"} found`:"No papers found":"Type to search papers";return a.jsxs("div",{className:"chat-paper-picker",id:o,role:"listbox","aria-label":"Paper results",children:[a.jsx("div",{className:"chat-paper-picker-status",role:"status","aria-live":"polite",children:y}),t.map((h,p)=>{const O=h.arxiv_id||h.id,S=h.arxiv_id||(()=>{try{return h.source_url?new URL(h.source_url).hostname:"External resource"}catch{return"External resource"}})();return a.jsxs("button",{type:"button",id:`${u}-${p}`,role:"option","aria-selected":p===s,className:`chat-paper-option${p===s?" is-active":""}`,onMouseDown:j=>{j.preventDefault(),i(h)},children:[a.jsx("span",{className:"chat-paper-option-title",children:h.title}),a.jsx("span",{className:"chat-paper-option-meta",children:S})]},O)})]})},re=10,se=3;function q(e,r){const s=e.slice(0,r).lastIndexOf("@");if(s<0)return null;const n=s>0?e[s-1]:"";if(n&&/[\p{L}\p{M}\p{N}_@]/u.test(n))return null;const l=e.slice(s+1,r);return/[\n\r@]/.test(l)?null:{start:s,end:r,query:l}}function B(e,r,t){let s=0;for(;so.end<=s?[o]:o.start>=l?[{...o,start:o.start+i,end:o.end+i}]:[])}function Se({draft:e,onChange:r,enabled:t,textareaRef:s}){var L;const n=`chat-paper-picker-${d.useId().replace(/:/g,"")}`,l=`${n}-option`,[i,o]=d.useState(null),[u,y]=d.useState(""),[h,p]=d.useState(0),[O,S]=d.useState(""),j=d.useRef(new Set);d.useEffect(()=>{t||o(null)},[t]),d.useEffect(()=>{const c=window.setTimeout(()=>y((i==null?void 0:i.query.trim())??""),150);return()=>window.clearTimeout(c)},[i==null?void 0:i.query]);const w=X({queryKey:["chat-paper-mention-search",u.toLowerCase()],queryFn:({signal:c})=>Z.search(u,1,10,"hybrid",c),enabled:t&&!!i&&u.length>=1,staleTime:3e4,refetchOnWindowFocus:!1,retry:!1}),m=d.useMemo(()=>{var c;return((c=w.data)==null?void 0:c.results)??[]},[(L=w.data)==null?void 0:L.results]);d.useEffect(()=>p(0),[u]),d.useEffect(()=>{var c;(c=document.getElementById(`${l}-${h}`))==null||c.scrollIntoView({block:"nearest"})},[h,l]);const Y=d.useCallback(c=>{var v;if(!t){o(null);return}const f=c??((v=s.current)==null?void 0:v.selectionStart)??e.text.length;if(e.paperMentions.some(_=>f>_.start&&f<=_.end)){o(null);return}o(q(e.text,f))},[e.paperMentions,e.text,t,s]),U=d.useCallback((c,f)=>{var k;const v=B(e.text,c,e.paperMentions);r({text:c,paperMentions:v});const x=f??((k=s.current)==null?void 0:k.selectionStart)??c.length;t&&!v.some(E=>x>E.start&&x<=E.end)?o(q(c,x)):o(null)},[e,t,r,s]),R=d.useCallback(c=>{if(!i)return!1;const f=c.arxiv_id||c.id,v=new Set(e.paperMentions.map(b=>b.route_id));if(e.paperMentions.length>=re)return S("A message can contain at most 10 paper mentions."),!1;if(!v.has(f)&&v.size>=se)return S("A message can attach at most 3 distinct papers."),!1;const _=c.title,x=e.text.slice(i.end),k=x.length===0,E=e.text.slice(0,i.start)+_+(k?" ":"")+x,V=B(e.text,E,e.paperMentions),$={key:crypto.randomUUID(),route_id:f,title:c.title,source:c.source==="external"?"external":"arxiv",start:i.start,end:i.start+_.length};return r({text:E,paperMentions:[...V,$].sort((b,M)=>b.start-M.start)}),o(null),S(""),window.requestAnimationFrame(()=>{var M,F;const b=$.end+(k||x.startsWith(" ")?1:0);(M=s.current)==null||M.focus(),(F=s.current)==null||F.setSelectionRange(b,b)}),j.current.has(f)||(j.current.add(f),g.prewarmPaperContext(f).catch(()=>{})),!0},[i,e,r,s]),K=d.useCallback(c=>!i||c.nativeEvent.isComposing?!1:c.key==="Tab"?(o(null),!1):c.key==="Escape"?(c.preventDefault(),o(null),!0):c.key==="ArrowDown"||c.key==="ArrowUp"?(c.preventDefault(),m.length&&p(f=>c.key==="ArrowDown"?(f+1)%m.length:(f-1+m.length)%m.length),!0):c.key==="Home"&&m.length?(c.preventDefault(),p(0),!0):c.key==="End"&&m.length?(c.preventDefault(),p(m.length-1),!0):c.key==="Enter"&&!c.shiftKey?(c.preventDefault(),m[h]?R(m[h]):w.isFetching||o(null),!0):!1,[i,h,m,w.isFetching,R]);return{open:!!i,query:(i==null?void 0:i.query)??"",results:m,activeIndex:h,loading:w.isFetching,error:w.isError,message:O,pickerId:n,optionIdPrefix:l,updateText:U,refresh:Y,select:R,keyDown:K,close:()=>o(null)}}const ke=({enabled:e,onChange:r,disabled:t=!1})=>a.jsxs("button",{type:"button",className:`chat-web-search-toggle${e?" is-enabled":""}`,role:"switch","aria-checked":e,"aria-label":"Web search",title:"Allow public-web search when useful; enabled search queries are processed by Exa",disabled:t,onClick:()=>r(!e),children:[a.jsx(ee,{size:15,"aria-hidden":"true"}),a.jsx("span",{children:"Web"})]}),H="pwc:chat-oauth-draft",I="pwc:chat-oauth-model",A="pwc:chat-oauth-auto-send",ne="pwc:chat-oauth-attempted",T="pwc:chat-web-search-enabled",D="pwc:chat-reasoning-effort";function Ee(e,r,t={}){const s=typeof e=="string"?e:e.text,n=s.length-s.trimStart().length,l=s.trim();if(!l)return;const i=n+l.length,o={text:l,paperMentions:typeof e=="string"?[]:e.paperMentions.filter(u=>u.start>=n&&u.end<=i).map(u=>({...u,start:u.start-n,end:u.end-n}))};sessionStorage.setItem(H,o.paperMentions.length?JSON.stringify(o):l),t.autoSend===!1?sessionStorage.removeItem(A):sessionStorage.setItem(A,"1"),r?sessionStorage.setItem(I,r):sessionStorage.removeItem(I),t.webSearchEnabled?sessionStorage.setItem(T,"1"):sessionStorage.removeItem(T),sessionStorage.setItem(D,t.reasoningEffort??"low")}function je(){var s;if(typeof window>"u"||sessionStorage.getItem(A)!=="1")return null;const e=(s=sessionStorage.getItem(H))==null?void 0:s.trim();if(!e)return null;let r={text:e,paperMentions:[]};try{const n=JSON.parse(e);typeof n.text=="string"&&Array.isArray(n.paperMentions)&&(r=n)}catch{}const t=r.text.trim();return t?{prompt:t,draft:{...r,text:t},model:sessionStorage.getItem(I),webSearchEnabled:sessionStorage.getItem(T)==="1",reasoningEffort:["low","high","max"].includes(sessionStorage.getItem(D)??"")?sessionStorage.getItem(D):"low"}:null}function Me(){sessionStorage.removeItem(H),sessionStorage.removeItem(I),sessionStorage.removeItem(A),sessionStorage.removeItem(ne),sessionStorage.removeItem(T),sessionStorage.removeItem(D)}const W="deepseek-ai/DeepSeek-V4-Flash-0731",Ce=[{id:W,label:"DeepSeek V4 Flash",provider:"openrouter"}],Ie=[{id:W,label:"DeepSeek V4 Flash",provider:"openrouter"}];class ae extends Error{constructor(r,t){super(r),this.status=t}}async function Ae(){const e=[];let r=null;do{const t=await g.listSessions(r);e.push(...t.items),r=t.next_cursor}while(r&&e.length<100);return e}function Te(e,r="low"){return g.createSession(e,r)}function De(e){return g.getSession(e)}function Oe(e,r){return g.updateSession(e,r)}function Re(e){return g.removeSession(e)}function Ne(){return g.archiveOldChats()}function Pe(){return g.archiveOldestChats()}function He(e){return g.cancelSession(e)}function Le(e){return g.createOrRefreshShare(e)}async function $e(e){try{return await g.getSharedChat(e)}catch(r){throw r instanceof Q?new ae(r.message,r.status):r}}async function Fe(){return g.getModels()}function P(e,r){const t=e.map(s=>s.kind==="reasoning"?{...s,active:!1,open:!1}:s.kind==="tool"?{...s,status:s.status==="running"?"error":s.status,open:r&&(s.status==="error"||s.status==="denied"||s.status==="running")}:{...s,done:!0});return t.filter((s,n)=>{const l=t[n-1];return!(s.kind==="reasoning"&&(l==null?void 0:l.kind)==="reasoning"&&s.text===l.text)})}function qe(e){const r=t=>t==="hf_inference_billing_exhausted"?"Hugging Face could not bill this request. Your included credits may be exhausted; enable or review pay-as-you-go billing in Settings.":t==="hf_inference_credential_expired"?"Your Hugging Face Inference Providers authorization is missing or expired. Re-sign in with Hugging Face to continue.":t==="provider_rate_limit"?"The selected model is temporarily rate-limited. Try again shortly.":t==="provider_timeout"?"The model provider timed out. Try again shortly.":t==="openrouter_monthly_budget_exhausted"?"The remaining shared Papers With Code OpenRouter allowance was not enough to continue this response.":t==="openrouter_staging_funding_disabled"?"Shared staging credits have ended because chat is now live on paperswithcode.co. Continue there with your included monthly allowance.":t==="openrouter_unavailable"?"OpenRouter is currently unavailable. However, you can still bring your own key in Settings.":t==="openrouter_byok_credential_invalid"?"Your OpenRouter API key is no longer valid. Reconnect it in Settings, then try again.":t==="openrouter_byok_billing_error"?"Your OpenRouter key is connected, but OpenRouter rejected billing for the account behind it. A key spending limit is not an account credit balance. Add credits or enable pay-as-you-go in OpenRouter, then try again.":t==="openrouter_byok_rate_limit"?"Your OpenRouter API key is temporarily rate-limited.":["provider_error","provider_unavailable"].includes(t??"")?"The model provider failed before completing the response. You can edit and retry your question.":t==="persistence_error"?"The response could not be saved. You can edit and retry your question.":t==="transcript_mirror_error"?"The conversation could not be saved. Please try again in a new chat.":"The response did not complete. You can edit and retry your question.";return e.messages.flatMap(t=>{if(t.role==="assistant")return[{id:t.id,role:"assistant",blocks:P(t.display_blocks,!0),followups:t.followups,citations:t.citations,finishReason:t.finish_reason??void 0,streaming:!1}];const s={id:t.id,role:"user",text:t.content,paperMentions:(t.paper_mentions??[]).map(l=>({...l,key:l.occurrence_id})),revision:t.revision,status:t.status,error:t.status==="complete"?void 0:t.error_code||t.status};if(!["error","interrupted"].includes(t.status))return[s];const n=t.status==="interrupted";return[s,{id:`${t.id}-${n?"interrupted":"error"}`,role:"assistant",blocks:P(t.display_blocks,!0),streaming:!1,finishReason:n?"stopped":void 0,error:n?void 0:r(t.error_code),errorCode:n?void 0:t.error_code??void 0}]})}function Be(e){return e.messages.map(r=>r.role==="user"?{id:r.id,role:"user",text:r.content,paperMentions:(r.paper_mentions??[]).map(t=>({...t,key:t.occurrence_id}))}:{id:r.id,role:"assistant",blocks:P(r.display_blocks,!1),citations:r.citations,finishReason:r.finish_reason??void 0,error:r.error??void 0,streaming:!1})}function We(e){const r=Date.now(),t=new Date().setHours(0,0,0,0),s=[{label:"Today",items:[]},{label:"Previous 7 Days",items:[]},{label:"Previous 30 Days",items:[]},{label:"Older",items:[]}];for(const n of[...e].sort((l,i)=>Date.parse(i.updated_at)-Date.parse(l.updated_at))){const l=Date.parse(n.updated_at),i=r-l;l>=t?s[0].items.push(n):i<7*864e5?s[1].items.push(n):i<30*864e5?s[2].items.push(n):s[3].items.push(n)}return s.filter(n=>n.items.length>0)}export{ge as A,Be as B,H as C,W as D,$e as E,pe as F,de as G,fe as H,xe as M,Ce as P,we as R,Ie as S,ve as T,ke as W,_e as a,be as b,Te as c,me as d,ye as e,he as f,We as g,Le as h,Pe as i,Ne as j,He as k,De as l,Ae as m,I as n,D as o,A as p,Ee as q,je as r,ne as s,qe as t,Se as u,Me as v,Fe as w,Oe as x,Re as y,ae as z}; + */const ee=z("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),he=({light:e})=>a.jsx("span",{className:`chat-spinner${e?" chat-spinner-light":""}`}),de=({open:e})=>a.jsx("svg",{className:`chat-chev${e?" chat-chev-open":""}`,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"m6 9 6 6 6-6"})}),pe=()=>a.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("path",{d:"m9 12 2 2 4-4"})]}),fe=({size:e=14})=>a.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"11",cy:"11",r:"7"}),a.jsx("path",{d:"m21 21-4.3-4.3"})]}),ge=()=>a.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",children:a.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})}),me=()=>a.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M12 5v14M5 12h14"})}),ye=()=>a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),a.jsx("path",{d:"M9 4v16"})]}),ve=()=>a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M6 6l1 14a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-14"})}),te=[{provider:"huggingface",label:"Inference Providers"},{provider:"openrouter",label:"OpenRouter"}],xe=({models:e,selectedModel:r,onModelChange:t,disabled:s})=>{var i,o;const n=((i=e.find(u=>u.id===r))==null?void 0:i.label)??`${r} (unavailable)`,l=e.filter(u=>!u.provider);return e.length===1&&((o=e[0])==null?void 0:o.id)===r?a.jsx("span",{className:"chat-model-label","aria-label":"Research model",children:n}):a.jsxs("span",{className:`chat-model-picker${s?" is-disabled":""}`,children:[a.jsx("span",{className:"chat-model-picker-sizer","aria-hidden":"true",children:n}),a.jsxs("select",{className:"chat-model-select",value:r,disabled:s,onChange:u=>t(u.target.value),"aria-label":"Research model",children:[!e.some(u=>u.id===r)&&a.jsx("option",{value:r,disabled:!0,children:n}),l.map(u=>a.jsx("option",{value:u.id,children:u.label},u.id)),te.map(({provider:u,label:y})=>{const h=e.filter(p=>p.provider===u);return h.length===0?null:a.jsx("optgroup",{label:y,children:h.map(p=>a.jsx("option",{value:p.id,children:p.label},p.id))},u)})]}),a.jsx("svg",{className:"chat-model-picker-chevron",viewBox:"0 0 12 8","aria-hidden":"true",children:a.jsx("path",{d:"m1 1 5 5 5-5"})})]})},R=[{value:"low",label:"Low",description:"Faster and more concise"},{value:"high",label:"High",description:"More thorough"},{value:"max",label:"Max",description:"Deepest and slowest"}],we=({value:e,onChange:r,disabled:t=!1})=>{const[s,n]=C.useState(!1),l=C.useRef(null),i=R.find(o=>o.value===e)??R[0];return C.useEffect(()=>{if(!s)return;const o=y=>{var h;(h=l.current)!=null&&h.contains(y.target)||n(!1)},u=y=>{y.key==="Escape"&&n(!1)};return document.addEventListener("mousedown",o),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",u)}},[s]),C.useEffect(()=>{t&&n(!1)},[t]),a.jsxs("div",{className:"chat-effort-picker",ref:l,children:[a.jsxs("button",{type:"button",className:"chat-effort-trigger","aria-label":`Reasoning effort: ${i.label}`,"aria-haspopup":"listbox","aria-expanded":s,disabled:t,onClick:()=>n(o=>!o),children:[a.jsx("span",{children:i.label}),a.jsx(J,{size:13,"aria-hidden":"true"})]}),s&&a.jsxs("div",{className:"chat-effort-menu",role:"listbox","aria-label":"Reasoning effort",children:[a.jsx("div",{className:"chat-effort-menu-label","aria-hidden":"true",children:"Reasoning effort"}),R.map(o=>a.jsxs("button",{type:"button",className:`chat-effort-option${o.value===e?" is-selected":""}`,role:"option","aria-selected":o.value===e,onClick:()=>{r(o.value),n(!1)},children:[a.jsxs("span",{className:"chat-effort-option-copy",children:[a.jsx("strong",{children:o.label}),a.jsx("small",{children:o.description})]}),o.value===e&&a.jsx(G,{size:15,"aria-hidden":"true"})]},o.value))]})]})},_e=({text:e,mentions:r,scrollTop:t=0,variant:s="composer"})=>{const n=[];let l=0;for(const i of[...r].sort((o,u)=>o.start-u.start)){const o=e.slice(i.start,i.end),u=o===i.title||o===`@${i.title}`;i.starte.length||!u||(n.push(e.slice(l,i.start)),n.push(a.jsx("span",{className:`chat-paper-inline-highlight${i.unavailable?" is-unavailable":""}`,"data-paper-route-id":i.route_id,children:o},i.key)),l=i.end)}return n.push(e.slice(l)),e.endsWith(` +`)&&n.push("​"),a.jsx("div",{"aria-hidden":"true",className:`chat-paper-highlight-layer chat-paper-highlight-layer-${s}`,children:a.jsx("div",{style:{transform:`translateY(-${t}px)`},children:n})})},be=({open:e,query:r,results:t,activeIndex:s,loading:n,error:l,onSelect:i,id:o="chat-paper-picker",optionIdPrefix:u="chat-paper-option"})=>{if(!e)return null;const y=r.trim()?n?"Searching papers…":l?"Paper search is unavailable":t.length?`${t.length} paper${t.length===1?"":"s"} found`:"No papers found":"Type to search papers";return a.jsxs("div",{className:"chat-paper-picker",id:o,role:"listbox","aria-label":"Paper results",children:[a.jsx("div",{className:"chat-paper-picker-status",role:"status","aria-live":"polite",children:y}),t.map((h,p)=>{const O=h.arxiv_id||h.id,S=h.arxiv_id||(()=>{try{return h.source_url?new URL(h.source_url).hostname:"External resource"}catch{return"External resource"}})();return a.jsxs("button",{type:"button",id:`${u}-${p}`,role:"option","aria-selected":p===s,className:`chat-paper-option${p===s?" is-active":""}`,onMouseDown:j=>{j.preventDefault(),i(h)},children:[a.jsx("span",{className:"chat-paper-option-title",children:h.title}),a.jsx("span",{className:"chat-paper-option-meta",children:S})]},O)})]})},re=10,se=3;function q(e,r){const s=e.slice(0,r).lastIndexOf("@");if(s<0)return null;const n=s>0?e[s-1]:"";if(n&&/[\p{L}\p{M}\p{N}_@]/u.test(n))return null;const l=e.slice(s+1,r);return/[\n\r@]/.test(l)?null:{start:s,end:r,query:l}}function B(e,r,t){let s=0;for(;so.end<=s?[o]:o.start>=l?[{...o,start:o.start+i,end:o.end+i}]:[])}function Se({draft:e,onChange:r,enabled:t,textareaRef:s}){var L;const n=`chat-paper-picker-${d.useId().replace(/:/g,"")}`,l=`${n}-option`,[i,o]=d.useState(null),[u,y]=d.useState(""),[h,p]=d.useState(0),[O,S]=d.useState(""),j=d.useRef(new Set);d.useEffect(()=>{t||o(null)},[t]),d.useEffect(()=>{const c=window.setTimeout(()=>y((i==null?void 0:i.query.trim())??""),150);return()=>window.clearTimeout(c)},[i==null?void 0:i.query]);const w=X({queryKey:["chat-paper-mention-search",u.toLowerCase()],queryFn:({signal:c})=>Z.search(u,1,10,"hybrid",c),enabled:t&&!!i&&u.length>=1,staleTime:3e4,refetchOnWindowFocus:!1,retry:!1}),m=d.useMemo(()=>{var c;return((c=w.data)==null?void 0:c.results)??[]},[(L=w.data)==null?void 0:L.results]);d.useEffect(()=>p(0),[u]),d.useEffect(()=>{var c;(c=document.getElementById(`${l}-${h}`))==null||c.scrollIntoView({block:"nearest"})},[h,l]);const Y=d.useCallback(c=>{var v;if(!t){o(null);return}const f=c??((v=s.current)==null?void 0:v.selectionStart)??e.text.length;if(e.paperMentions.some(_=>f>_.start&&f<=_.end)){o(null);return}o(q(e.text,f))},[e.paperMentions,e.text,t,s]),U=d.useCallback((c,f)=>{var k;const v=B(e.text,c,e.paperMentions);r({text:c,paperMentions:v});const x=f??((k=s.current)==null?void 0:k.selectionStart)??c.length;t&&!v.some(E=>x>E.start&&x<=E.end)?o(q(c,x)):o(null)},[e,t,r,s]),N=d.useCallback(c=>{if(!i)return!1;const f=c.arxiv_id||c.id,v=new Set(e.paperMentions.map(b=>b.route_id));if(e.paperMentions.length>=re)return S("A message can contain at most 10 paper mentions."),!1;if(!v.has(f)&&v.size>=se)return S("A message can attach at most 3 distinct papers."),!1;const _=c.title,x=e.text.slice(i.end),k=x.length===0,E=e.text.slice(0,i.start)+_+(k?" ":"")+x,V=B(e.text,E,e.paperMentions),$={key:crypto.randomUUID(),route_id:f,title:c.title,source:c.source==="external"?"external":"arxiv",start:i.start,end:i.start+_.length};return r({text:E,paperMentions:[...V,$].sort((b,M)=>b.start-M.start)}),o(null),S(""),window.requestAnimationFrame(()=>{var M,F;const b=$.end+(k||x.startsWith(" ")?1:0);(M=s.current)==null||M.focus(),(F=s.current)==null||F.setSelectionRange(b,b)}),j.current.has(f)||(j.current.add(f),g.prewarmPaperContext(f).catch(()=>{})),!0},[i,e,r,s]),K=d.useCallback(c=>!i||c.nativeEvent.isComposing?!1:c.key==="Tab"?(o(null),!1):c.key==="Escape"?(c.preventDefault(),o(null),!0):c.key==="ArrowDown"||c.key==="ArrowUp"?(c.preventDefault(),m.length&&p(f=>c.key==="ArrowDown"?(f+1)%m.length:(f-1+m.length)%m.length),!0):c.key==="Home"&&m.length?(c.preventDefault(),p(0),!0):c.key==="End"&&m.length?(c.preventDefault(),p(m.length-1),!0):c.key==="Enter"&&!c.shiftKey?(c.preventDefault(),m[h]?N(m[h]):w.isFetching||o(null),!0):!1,[i,h,m,w.isFetching,N]);return{open:!!i,query:(i==null?void 0:i.query)??"",results:m,activeIndex:h,loading:w.isFetching,error:w.isError,message:O,pickerId:n,optionIdPrefix:l,updateText:U,refresh:Y,select:N,keyDown:K,close:()=>o(null)}}const ke=({enabled:e,onChange:r,disabled:t=!1})=>a.jsxs("button",{type:"button",className:`chat-web-search-toggle${e?" is-enabled":""}`,role:"switch","aria-checked":e,"aria-label":"Web search",title:"Allow public-web search when useful; enabled search queries are processed by Exa",disabled:t,onClick:()=>r(!e),children:[a.jsx(ee,{size:15,"aria-hidden":"true"}),a.jsx("span",{children:"Web"})]}),H="pwc:chat-oauth-draft",I="pwc:chat-oauth-model",A="pwc:chat-oauth-auto-send",ne="pwc:chat-oauth-attempted",T="pwc:chat-web-search-enabled",D="pwc:chat-reasoning-effort";function Ee(e,r,t={}){const s=typeof e=="string"?e:e.text,n=s.length-s.trimStart().length,l=s.trim();if(!l)return;const i=n+l.length,o={text:l,paperMentions:typeof e=="string"?[]:e.paperMentions.filter(u=>u.start>=n&&u.end<=i).map(u=>({...u,start:u.start-n,end:u.end-n}))};sessionStorage.setItem(H,o.paperMentions.length?JSON.stringify(o):l),t.autoSend===!1?sessionStorage.removeItem(A):sessionStorage.setItem(A,"1"),r?sessionStorage.setItem(I,r):sessionStorage.removeItem(I),t.webSearchEnabled?sessionStorage.setItem(T,"1"):sessionStorage.removeItem(T),sessionStorage.setItem(D,t.reasoningEffort??"low")}function je(){var s;if(typeof window>"u"||sessionStorage.getItem(A)!=="1")return null;const e=(s=sessionStorage.getItem(H))==null?void 0:s.trim();if(!e)return null;let r={text:e,paperMentions:[]};try{const n=JSON.parse(e);typeof n.text=="string"&&Array.isArray(n.paperMentions)&&(r=n)}catch{}const t=r.text.trim();return t?{prompt:t,draft:{...r,text:t},model:sessionStorage.getItem(I),webSearchEnabled:sessionStorage.getItem(T)==="1",reasoningEffort:["low","high","max"].includes(sessionStorage.getItem(D)??"")?sessionStorage.getItem(D):"low"}:null}function Me(){sessionStorage.removeItem(H),sessionStorage.removeItem(I),sessionStorage.removeItem(A),sessionStorage.removeItem(ne),sessionStorage.removeItem(T),sessionStorage.removeItem(D)}const W="deepseek-ai/DeepSeek-V4-Flash-0731",Ce=[{id:W,label:"DeepSeek V4 Flash",provider:"openrouter"}],Ie=[{id:W,label:"DeepSeek V4 Flash",provider:"openrouter"}];class ae extends Error{constructor(r,t){super(r),this.status=t}}async function Ae(){const e=[];let r=null;do{const t=await g.listSessions(r);e.push(...t.items),r=t.next_cursor}while(r&&e.length<100);return e}function Te(e,r="low"){return g.createSession(e,r)}function De(e){return g.getSession(e)}function Oe(e,r){return g.updateSession(e,r)}function Ne(e){return g.removeSession(e)}function Re(){return g.archiveOldChats()}function Pe(){return g.archiveOldestChats()}function He(e){return g.cancelSession(e)}function Le(e){return g.createOrRefreshShare(e)}async function $e(e){try{return await g.getSharedChat(e)}catch(r){throw r instanceof Q?new ae(r.message,r.status):r}}async function Fe(){return g.getModels()}function P(e,r){const t=e.map(s=>s.kind==="reasoning"?{...s,active:!1,open:!1}:s.kind==="tool"?{...s,status:s.status==="running"?"error":s.status,open:r&&(s.status==="error"||s.status==="denied"||s.status==="running")}:{...s,done:!0});return t.filter((s,n)=>{const l=t[n-1];return!(s.kind==="reasoning"&&(l==null?void 0:l.kind)==="reasoning"&&s.text===l.text)})}function qe(e){const r=t=>t==="hf_inference_billing_exhausted"?"Hugging Face could not bill this request. Your included credits may be exhausted; enable or review pay-as-you-go billing in Settings.":t==="hf_inference_credential_expired"?"Your Hugging Face Inference Providers authorization is missing or expired. Re-sign in with Hugging Face to continue.":t==="provider_rate_limit"?"The selected model is temporarily rate-limited. Try again shortly.":t==="provider_timeout"?"The model provider timed out. Try again shortly.":t==="openrouter_monthly_budget_exhausted"?"The remaining shared Papers With Code OpenRouter allowance was not enough to continue this response.":t==="openrouter_staging_funding_disabled"?"Shared staging credits have ended because chat is now live on paperswithcode.co. Continue there with your included monthly allowance.":t==="openrouter_unavailable"?"OpenRouter is currently unavailable. However, you can still bring your own key in Settings.":t==="openrouter_byok_credential_invalid"?"Your OpenRouter API key is no longer valid. Reconnect it in Settings, then try again.":t==="openrouter_byok_billing_error"?"Your OpenRouter key is connected, but OpenRouter rejected billing for the account behind it. A key spending limit is not an account credit balance. Add credits or enable pay-as-you-go in OpenRouter, then try again.":t==="openrouter_byok_rate_limit"?"Your OpenRouter API key is temporarily rate-limited.":["provider_error","provider_unavailable"].includes(t??"")?"The model provider failed before completing the response. You can edit and retry your question.":t==="persistence_error"?"The response could not be saved. You can edit and retry your question.":t==="transcript_mirror_error"?"The conversation could not be saved. Please try again in a new chat.":"The response did not complete. You can edit and retry your question.";return e.messages.flatMap(t=>{if(t.role==="assistant")return[{id:t.id,role:"assistant",blocks:P(t.display_blocks,!0),followups:t.followups,citations:t.citations,finishReason:t.finish_reason??void 0,streaming:!1}];const s={id:t.id,role:"user",text:t.content,paperMentions:(t.paper_mentions??[]).map(l=>({...l,key:l.occurrence_id})),revision:t.revision,status:t.status,error:t.status==="complete"?void 0:t.error_code||t.status};if(!["error","interrupted"].includes(t.status))return[s];const n=t.status==="interrupted";return[s,{id:`${t.id}-${n?"interrupted":"error"}`,role:"assistant",blocks:P(t.display_blocks,!0),streaming:!1,finishReason:n?"stopped":void 0,error:n?void 0:r(t.error_code),errorCode:n?void 0:t.error_code??void 0}]})}function Be(e){return e.messages.map(r=>r.role==="user"?{id:r.id,role:"user",text:r.content,paperMentions:(r.paper_mentions??[]).map(t=>({...t,key:t.occurrence_id}))}:{id:r.id,role:"assistant",blocks:P(r.display_blocks,!1),citations:r.citations,finishReason:r.finish_reason??void 0,error:r.error??void 0,streaming:!1})}function We(e){const r=Date.now(),t=new Date().setHours(0,0,0,0),s=[{label:"Today",items:[]},{label:"Previous 7 Days",items:[]},{label:"Previous 30 Days",items:[]},{label:"Older",items:[]}];for(const n of[...e].sort((l,i)=>Date.parse(i.updated_at)-Date.parse(l.updated_at))){const l=Date.parse(n.updated_at),i=r-l;l>=t?s[0].items.push(n):i<7*864e5?s[1].items.push(n):i<30*864e5?s[2].items.push(n):s[3].items.push(n)}return s.filter(n=>n.items.length>0)}export{ge as A,Oe as B,ae as C,W as D,Ne as E,pe as F,de as G,fe as H,xe as M,Ce as P,we as R,Ie as S,ve as T,ke as W,_e as a,be as b,Te as c,he as d,me as e,ye as f,$e as g,We as h,Le as i,Pe as j,Re as k,He as l,De as m,Ae as n,H as o,Be as p,Ee as q,je as r,I as s,qe as t,Se as u,D as v,A as w,ne as x,Me as y,Fe as z}; diff --git a/assets/chevron-down-CKySK_lE.js b/assets/chevron-down-DI19XsBw.js similarity index 85% rename from assets/chevron-down-CKySK_lE.js rename to assets/chevron-down-DI19XsBw.js index df4dfb6076fb4126c4969e8cd12ad2d2229ce1fc..f4914000ff0899ac4659fb8bbe7443df567a5e45 100644 --- a/assets/chevron-down-CKySK_lE.js +++ b/assets/chevron-down-DI19XsBw.js @@ -1,4 +1,4 @@ -import{c as o}from"./index-BrhBTT14.js";/** +import{d as o}from"./index-D_-UZEuL.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/circle-check-DVQOUjVS.js b/assets/circle-check-BpugpgkG.js similarity index 87% rename from assets/circle-check-DVQOUjVS.js rename to assets/circle-check-BpugpgkG.js index 100794b8c25e2878a521273e89c2181c05e38208..c43069e9dd9448fa9d5bc38ab3f3a42da9921f21 100644 --- a/assets/circle-check-DVQOUjVS.js +++ b/assets/circle-check-BpugpgkG.js @@ -1,4 +1,4 @@ -import{c}from"./index-BrhBTT14.js";/** +import{d as c}from"./index-D_-UZEuL.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/codexAddEvals-BzRfrE5R.js b/assets/codexAddEvals-BKeHrC5p.js similarity index 90% rename from assets/codexAddEvals-BzRfrE5R.js rename to assets/codexAddEvals-BKeHrC5p.js index ae8229d411cc126d28834f32d2daadafd62eb58e..5fdd7cfa9ed8d360c1acaf2617d5db6a63ea0439 100644 --- a/assets/codexAddEvals-BzRfrE5R.js +++ b/assets/codexAddEvals-BKeHrC5p.js @@ -1,6 +1,6 @@ -import{c as o,j as i,v as c,W as d,G as n}from"./index-BrhBTT14.js";/** +import{d as o,j as i,q as c,a2 as d,E as n}from"./index-D_-UZEuL.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const p=o("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),u=d("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function f({className:e,variant:a,...t}){return i.jsx("div",{className:c(u({variant:a}),e),...t})}function x(){const e="0".toLowerCase();return e==="1"||e==="true"||e==="yes"}function b(){const e="0".toLowerCase();return e==="1"||e==="true"||e==="yes"}async function r(e){var s;if(e.ok)return await e.json();const a=await e.json().catch(()=>null),t=((s=a==null?void 0:a.detail)==null?void 0:s.message)??(a==null?void 0:a.detail);throw new Error(typeof t=="string"?t:"Could not run Codex.")}async function v(e){const a=await fetch(n("/api/v1/admin/codex-add-evals/jobs"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({paper_id:e})});return r(a)}async function h(e){const a=await fetch(n(`/api/v1/admin/codex-add-evals/jobs/${e}`),{credentials:"include"});return r(a)}async function g(e){return r(await fetch(n(`/api/v1/admin/codex-add-evals/jobs/${e}`),{method:"DELETE",credentials:"include"}))}async function y(e){const a=await fetch(n("/api/v1/admin/codex-enrich-paper/jobs"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({paper_id:e})});return r(a)}async function m(e){const a=await fetch(n(`/api/v1/admin/codex-enrich-paper/jobs/${e}`),{credentials:"include"});return r(a)}async function E(e){return r(await fetch(n(`/api/v1/admin/codex-enrich-paper/jobs/${e}`),{method:"DELETE",credentials:"include"}))}async function w(e=100){const a=await fetch(n(`/api/v1/admin/codex-curation/jobs?limit=${e}`),{credentials:"include",cache:"no-store"});if(a.ok)return await a.json();const t=new Error(`Could not load Codex jobs (${a.status}).`);throw Object.assign(t,{status:a.status}),t}export{f as B,p as D,g as a,h as b,E as c,v as d,b as e,w as f,m as g,x as i,y as s}; + */const p=o("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),u=d("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function f({className:e,variant:a,...t}){return i.jsx("div",{className:c(u({variant:a}),e),...t})}function x(){const e="0".toLowerCase();return e==="1"||e==="true"||e==="yes"}function b(){const e="0".toLowerCase();return e==="1"||e==="true"||e==="yes"}async function r(e){var s;if(e.ok)return await e.json();const a=await e.json().catch(()=>null),t=((s=a==null?void 0:a.detail)==null?void 0:s.message)??(a==null?void 0:a.detail);throw new Error(typeof t=="string"?t:"Could not run Codex.")}async function h(e){const a=await fetch(n("/api/v1/admin/codex-add-evals/jobs"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({paper_id:e})});return r(a)}async function v(e){const a=await fetch(n(`/api/v1/admin/codex-add-evals/jobs/${e}`),{credentials:"include"});return r(a)}async function g(e){return r(await fetch(n(`/api/v1/admin/codex-add-evals/jobs/${e}`),{method:"DELETE",credentials:"include"}))}async function y(e){const a=await fetch(n("/api/v1/admin/codex-enrich-paper/jobs"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({paper_id:e})});return r(a)}async function m(e){const a=await fetch(n(`/api/v1/admin/codex-enrich-paper/jobs/${e}`),{credentials:"include"});return r(a)}async function E(e){return r(await fetch(n(`/api/v1/admin/codex-enrich-paper/jobs/${e}`),{method:"DELETE",credentials:"include"}))}async function w(e=100){const a=await fetch(n(`/api/v1/admin/codex-curation/jobs?limit=${e}`),{credentials:"include",cache:"no-store"});if(a.ok)return await a.json();const t=new Error(`Could not load Codex jobs (${a.status}).`);throw Object.assign(t,{status:a.status}),t}export{f as B,p as D,g as a,v as b,E as c,h as d,b as e,w as f,m as g,x as i,y as s}; diff --git a/assets/components-74u_bIKK.js b/assets/components-CmC5jqhM.js similarity index 97% rename from assets/components-74u_bIKK.js rename to assets/components-CmC5jqhM.js index 95257777c3b6680712f4cdc9d298f663ed507693..06de77e843e5896f9129aa8c30ab7477d3bf4696 100644 --- a/assets/components-74u_bIKK.js +++ b/assets/components-CmC5jqhM.js @@ -1 +1 @@ -import{g as R,R as p,j as e,L,u as S}from"./index-BrhBTT14.js";import{L as E,a as T}from"./LatexTitle-BJSVMlZ1.js";import{h as P,d as Z,a as H,c as B}from"./transform-Duf4Shfn.js";import{p as D}from"./papers-DBaPliAp.js";import{s as C}from"./safeExternalHref-CkBrsh84.js";const G=({slug:t,label:s,onClick:r})=>{const a=S(),x=P(t),n=B(x),i=c=>{if(c.stopPropagation(),r){r(t);return}a(`/tasks/${t}`)};return e.jsxs("span",{className:"tag-chip",style:{background:n.bg,color:n.text},onClick:i,children:[e.jsx("span",{className:"dot",style:{background:n.dot}}),Z(s||H(t),t)]})},O=({method:t,onClick:s})=>{const r=S(),a=t.slug||t.id||"";if(!a)return null;const x=n=>{if(n.stopPropagation(),s){s(a);return}r(`/methods/${a}`)};return e.jsx("span",{className:"method-chip",onClick:x,children:t.name})},$={1:"SOTA 🏆",2:"#2",3:"#3"},F=({units:t,paperHref:s})=>{const r=p.useRef(null),a=p.useRef(null),[x,n]=p.useState(t.length);if(p.useLayoutEffect(()=>{const o=r.current,h=a.current;if(!o||!h||t.length===0)return;const l=f=>(h.textContent=f,h.scrollWidth),M=()=>{const f=o.clientWidth;if(f<=0)return;let d=0,u=0;for(const N of t){const m=l(N.measureText);if(d+m<=f)d+=m,u+=1;else break}if(u0&&d+l(` · +${t.length-u} more`)>f;)u-=1,d-=l(t[u].measureText);u===0&&(u=1)}n(u)};M();const g=new ResizeObserver(M);return g.observe(o),()=>g.disconnect()},[t]),t.length===0)return null;const i=t.slice(0,Math.max(1,Math.min(x,t.length))),c=t.length-i.length;return e.jsxs("div",{className:"paper-sota",ref:r,children:[e.jsx("span",{ref:a,className:"paper-sota-measure","aria-hidden":"true"}),i.map((o,h)=>e.jsxs(p.Fragment,{children:[o.isGroupStart?e.jsxs(e.Fragment,{children:[h>0&&e.jsx("span",{className:"paper-sota-sep",children:" · "}),e.jsx("span",{className:`paper-sota-label${o.rank===1?" paper-sota-label--sota":""}`,children:$[o.rank]}),e.jsx("span",{className:"paper-sota-on",children:" on "})]}):e.jsx("span",{className:"paper-sota-sep",children:", "}),o.slug?e.jsx(L,{to:`/benchmark/${o.slug}`,className:"paper-sota-name",onClick:l=>l.stopPropagation(),children:o.name}):e.jsx("span",{className:"paper-sota-name",children:o.name})]},`${o.slug||o.name}-${h}`)),c>0&&e.jsxs(L,{to:`${s}#results`,className:"paper-sota-more",onClick:o=>o.stopPropagation(),children:[" · +",c," more"]})]})},I=({ranks:t,paperHref:s,wrap:r=!1})=>{const a=p.useMemo(()=>{const n=[];let i=!0;for(const c of[1,2,3]){const o=t.filter(h=>h.rank===c);o.forEach((h,l)=>{const M=l===0,g=M?`${i?"":" · "}${$[c]} on `:", ";n.push({name:h.name,slug:h.slug,rank:c,isGroupStart:M,measureText:g+h.name})}),o.length>0&&(i=!1)}return n},[t]),x=p.useMemo(()=>[1,2,3].map(n=>t.filter(c=>c.rank===n).map((c,o)=>({name:c.name,slug:c.slug,rank:n,isGroupStart:o===0,measureText:(o===0?`${$[n]} on `:", ")+c.name}))).filter(n=>n.length>0),[t]);return r?x.length===0?null:e.jsx("div",{className:"paper-sota-stack",children:x.map(n=>e.jsx(F,{units:n,paperHref:s},n[0].rank))}):a.length===0?null:e.jsx(F,{units:a,paperHref:s})},K=({name:t,size:s=14})=>{const r={search:e.jsx("path",{d:"M11 11l3 3M7 12.5a5.5 5.5 0 110-11 5.5 5.5 0 010 11z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),arrowUp:e.jsx("path",{d:"M8 3l5 6H3l5-6z",fill:"currentColor"}),arrowLeft:e.jsx("path",{d:"M9 3l-4 5 4 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),arrowRight:e.jsx("path",{d:"M7 3l4 5-4 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),external:e.jsx("path",{d:"M5 3h-2v8h8v-2M9 3h3v3M7 9l5-5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),github:e.jsx("path",{d:"M8 1a7 7 0 00-2.21 13.64c.35.06.48-.15.48-.34v-1.2c-1.95.42-2.36-.94-2.36-.94-.32-.81-.78-1.03-.78-1.03-.64-.43.05-.43.05-.43.7.05 1.07.72 1.07.72.62 1.07 1.64.76 2.04.58.06-.45.24-.76.44-.94-1.55-.18-3.18-.78-3.18-3.46 0-.76.27-1.39.72-1.88-.07-.18-.31-.89.07-1.86 0 0 .59-.19 1.92.72.56-.15 1.16-.23 1.75-.24.59 0 1.19.08 1.75.24 1.33-.9 1.92-.72 1.92-.72.38.97.14 1.68.07 1.86.45.49.72 1.12.72 1.88 0 2.69-1.64 3.28-3.19 3.45.25.22.48.65.48 1.32v1.95c0 .19.13.41.49.34A7 7 0 008 1z",fill:"currentColor"}),citation:e.jsx("path",{d:"M3 4h3v3H3zM4 7v1.5a1.5 1.5 0 01-1.5 1.5M9 4h3v3H9zM10 7v1.5a1.5 1.5 0 01-1.5 1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),bookmark:e.jsx("path",{d:"M4 2h8v12l-4-3-4 3V2z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),chart:e.jsx("path",{d:"M2 13h12M3 11l3-4 3 2 4-5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),chat:e.jsx("path",{d:"M3 3h10v7H7l-3 3v-3H3V3z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),pdf:e.jsx("path",{d:"M5 2h5l3 3v9H5V2z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),copy:e.jsx("path",{d:"M5 5h7v8H5V5zM3 3h7v2M3 3v8h2",stroke:"currentColor",strokeWidth:"1.2",fill:"none",strokeLinejoin:"round"}),sparkle:e.jsx("path",{d:"M8 2l1.2 3.8L13 7l-3.8 1.2L8 12l-1.2-3.8L3 7l3.8-1.2L8 2z",fill:"currentColor"}),user:e.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM2 14c0-3 2.5-5 6-5s6 2 6 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),globe:e.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM1.5 8h13M8 1.5c1.7 1.9 2.6 4.2 2.6 6.5s-.9 4.6-2.6 6.5M8 1.5C6.3 3.4 5.4 5.7 5.4 8s.9 4.6 2.6 6.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none",strokeLinecap:"round"}),menu:e.jsx("path",{d:"M2 4h12M2 8h12M2 12h12",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),close:e.jsx("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})};return e.jsx("svg",{className:s===11?"icon-sm":"icon",viewBox:"0 0 16 16",width:s,height:s,children:r[t]})},U=({size:t=16})=>e.jsxs("svg",{className:"hf-logo",width:t,height:t,viewBox:"0 0 95 88",fill:"none","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{fill:"#FFD21E",d:"M47.21 76.5a34.75 34.75 0 1 0 0-69.5 34.75 34.75 0 0 0 0 69.5Z"}),e.jsx("path",{fill:"#FF9D0B",d:"M81.96 41.75a34.75 34.75 0 1 0-69.5 0 34.75 34.75 0 0 0 69.5 0Zm-73.5 0a38.75 38.75 0 1 1 77.5 0 38.75 38.75 0 0 1-77.5 0Z"}),e.jsx("path",{fill:"#3A3B45",d:"M58.5 32.3c1.28.44 1.78 3.06 3.07 2.38a5 5 0 1 0-6.76-2.07c.61 1.15 2.55-.72 3.7-.32ZM34.95 32.3c-1.28.44-1.79 3.06-3.07 2.38a5 5 0 1 1 6.76-2.07c-.61 1.15-2.56-.72-3.7-.32Z"}),e.jsx("path",{fill:"#FF323D",d:"M46.96 56.29c9.83 0 13-8.76 13-13.26 0-2.34-1.57-1.6-4.09-.36-2.33 1.15-5.46 2.74-8.9 2.74-7.19 0-13-6.88-13-2.38s3.16 13.26 13 13.26Z"}),e.jsx("path",{fill:"#3A3B45",fillRule:"evenodd",clipRule:"evenodd",d:"M39.43 54a8.7 8.7 0 0 1 5.3-4.49c.4-.12.81.57 1.24 1.28.4.68.82 1.37 1.24 1.37.45 0 .9-.68 1.33-1.35.45-.7.89-1.38 1.32-1.25a8.61 8.61 0 0 1 5 4.17c3.73-2.94 5.1-7.74 5.1-10.7 0-2.34-1.57-1.6-4.09-.36l-.14.07c-2.31 1.15-5.39 2.67-8.77 2.67s-6.45-1.52-8.77-2.67c-2.6-1.29-4.23-2.1-4.23.29 0 3.05 1.46 8.06 5.47 10.97Z"}),e.jsx("path",{fill:"#FF9D0B",d:"M70.71 37a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5ZM24.21 37a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5ZM17.52 48c-1.62 0-3.06.66-4.07 1.87a5.97 5.97 0 0 0-1.33 3.76 7.1 7.1 0 0 0-1.94-.3c-1.55 0-2.95.59-3.94 1.66a5.8 5.8 0 0 0-.8 7 5.3 5.3 0 0 0-1.79 2.82c-.24.9-.48 2.8.8 4.74a5.22 5.22 0 0 0-.37 5.02c1.02 2.32 3.57 4.14 8.52 6.1 3.07 1.22 5.89 2 5.91 2.01a44.33 44.33 0 0 0 10.93 1.6c5.86 0 10.05-1.8 12.46-5.34 3.88-5.69 3.33-10.9-1.7-15.92-2.77-2.78-4.62-6.87-5-7.77-.78-2.66-2.84-5.62-6.25-5.62a5.7 5.7 0 0 0-4.6 2.46c-1-1.26-1.98-2.25-2.86-2.82A7.4 7.4 0 0 0 17.52 48Zm0 4c.51 0 1.14.22 1.82.65 2.14 1.36 6.25 8.43 7.76 11.18.5.92 1.37 1.31 2.14 1.31 1.55 0 2.75-1.53.15-3.48-3.92-2.93-2.55-7.72-.68-8.01.08-.02.17-.02.24-.02 1.7 0 2.45 2.93 2.45 2.93s2.2 5.52 5.98 9.3c3.77 3.77 3.97 6.8 1.22 10.83-1.88 2.75-5.47 3.58-9.16 3.58-3.81 0-7.73-.9-9.92-1.46-.11-.03-13.45-3.8-11.76-7 .28-.54.75-.76 1.34-.76 2.38 0 6.7 3.54 8.57 3.54.41 0 .7-.17.83-.6.79-2.85-12.06-4.05-10.98-8.17.2-.73.71-1.02 1.44-1.02 3.14 0 10.2 5.53 11.68 5.53.11 0 .2-.03.24-.1.74-1.2.33-2.04-4.9-5.2-5.21-3.16-8.88-5.06-6.8-7.33.24-.26.58-.38 1-.38 3.17 0 10.66 6.82 10.66 6.82s2.02 2.1 3.25 2.1c.28 0 .52-.1.68-.38.86-1.46-8.06-8.22-8.56-11.01-.34-1.9.24-2.85 1.31-2.85Z"}),e.jsx("path",{fill:"#FFD21E",d:"M38.6 76.69c2.75-4.04 2.55-7.07-1.22-10.84-3.78-3.77-5.98-9.3-5.98-9.3s-.82-3.2-2.69-2.9c-1.87.3-3.24 5.08.68 8.01 3.91 2.93-.78 4.92-2.29 2.17-1.5-2.75-5.62-9.82-7.76-11.18-2.13-1.35-3.63-.6-3.13 2.2.5 2.79 9.43 9.55 8.56 11-.87 1.47-3.93-1.71-3.93-1.71s-9.57-8.71-11.66-6.44c-2.08 2.27 1.59 4.17 6.8 7.33 5.23 3.16 5.64 4 4.9 5.2-.75 1.2-12.28-8.53-13.36-4.4-1.08 4.11 11.77 5.3 10.98 8.15-.8 2.85-9.06-5.38-10.74-2.18-1.7 3.21 11.65 6.98 11.76 7.01 4.3 1.12 15.25 3.49 19.08-2.12Z"}),e.jsx("path",{fill:"#FF9D0B",d:"M77.4 48c1.62 0 3.07.66 4.07 1.87a5.97 5.97 0 0 1 1.33 3.76 7.1 7.1 0 0 1 1.95-.3c1.55 0 2.95.59 3.94 1.66a5.8 5.8 0 0 1 .8 7 5.3 5.3 0 0 1 1.78 2.82c.24.9.48 2.8-.8 4.74a5.22 5.22 0 0 1 .37 5.02c-1.02 2.32-3.57 4.14-8.51 6.1-3.08 1.22-5.9 2-5.92 2.01a44.33 44.33 0 0 1-10.93 1.6c-5.86 0-10.05-1.8-12.46-5.34-3.88-5.69-3.33-10.9 1.7-15.92 2.78-2.78 4.63-6.87 5.01-7.77.78-2.66 2.83-5.62 6.24-5.62a5.7 5.7 0 0 1 4.6 2.46c1-1.26 1.98-2.25 2.87-2.82A7.4 7.4 0 0 1 77.4 48Zm0 4c-.51 0-1.13.22-1.82.65-2.13 1.36-6.25 8.43-7.76 11.18a2.43 2.43 0 0 1-2.14 1.31c-1.54 0-2.75-1.53-.14-3.48 3.91-2.93 2.54-7.72.67-8.01a1.54 1.54 0 0 0-.24-.02c-1.7 0-2.45 2.93-2.45 2.93s-2.2 5.52-5.97 9.3c-3.78 3.77-3.98 6.8-1.22 10.83 1.87 2.75 5.47 3.58 9.15 3.58 3.82 0 7.73-.9 9.93-1.46.1-.03 13.45-3.8 11.76-7-.29-.54-.75-.76-1.34-.76-2.38 0-6.71 3.54-8.57 3.54-.42 0-.71-.17-.83-.6-.8-2.85 12.05-4.05 10.97-8.17-.19-.73-.7-1.02-1.44-1.02-3.14 0-10.2 5.53-11.68 5.53-.1 0-.19-.03-.23-.1-.74-1.2-.34-2.04 4.88-5.2 5.23-3.16 8.9-5.06 6.8-7.33-.23-.26-.57-.38-.98-.38-3.18 0-10.67 6.82-10.67 6.82s-2.02 2.1-3.24 2.1a.74.74 0 0 1-.68-.38c-.87-1.46 8.05-8.22 8.55-11.01.34-1.9-.24-2.85-1.31-2.85Z"}),e.jsx("path",{fill:"#FFD21E",d:"M56.33 76.69c-2.75-4.04-2.56-7.07 1.22-10.84 3.77-3.77 5.97-9.3 5.97-9.3s.82-3.2 2.7-2.9c1.86.3 3.23 5.08-.68 8.01-3.92 2.93.78 4.92 2.28 2.17 1.51-2.75 5.63-9.82 7.76-11.18 2.13-1.35 3.64-.6 3.13 2.2-.5 2.79-9.42 9.55-8.55 11 .86 1.47 3.92-1.71 3.92-1.71s9.58-8.71 11.66-6.44c2.08 2.27-1.58 4.17-6.8 7.33-5.23 3.16-5.63 4-4.9 5.2.75 1.2 12.28-8.53 13.36-4.4 1.08 4.11-11.76 5.3-10.97 8.15.8 2.85 9.05-5.38 10.74-2.18 1.69 3.21-11.65 6.98-11.76 7.01-4.31 1.12-15.26 3.49-19.08-2.12Z"})]}),_=t=>{let s=2166136261;for(let r=0;r(s=Math.imul(s^s>>>15,2246822507),s=Math.imul(s^s>>>13,3266489909),s^=s>>>16,(s>>>0)%1e4/1e4)},V=({paperId:t})=>{const s=_(t),r=160,a=220,x=[.85+s()*.1,.55+s()*.25],n=.45+s()*.3,i=[],c=9+Math.floor(s()*3);for(let k=0;k.3,h=Math.floor(s()*3),l=[],M=6+Math.floor(s()*3);for(let k=0;ke.jsx("rect",{x:d+(r-d*2)*(1-k)/2,y:z+v*2.4,width:(r-d*2)*k,height:1.4,fill:f,rx:.3},`t${v}`)),e.jsx("rect",{x:d+(r-d*2)*(1-n)/2,y:A,width:(r-d*2)*n,height:.9,fill:g,opacity:.7,rx:.2}),e.jsx("rect",{x:d,y:W,width:6,height:1,fill:f,opacity:.6}),i.map((k,v)=>{const y=j+v*2.1;return y>a-d-1?null:e.jsx("rect",{x:N,y,width:u*k,height:.8,fill:g,opacity:.55,rx:.2},`l${v}`)}),o&&e.jsxs("g",{children:[e.jsx("rect",{x:m,y:j,width:u,height:14,fill:"#F0EBE0",stroke:g,strokeWidth:.3,opacity:.9}),h===0&&e.jsx("g",{stroke:f,strokeWidth:.4,fill:"none",opacity:.6,children:e.jsx("polyline",{points:`${m+2},${j+11} ${m+6},${j+8} ${m+10},${j+9} ${m+14},${j+5} ${m+18},${j+6} ${m+22},${j+3}`})}),h===1&&e.jsxs("g",{opacity:.55,children:[e.jsx("circle",{cx:m+u/2,cy:j+7,r:3.5,fill:f}),e.jsx("rect",{x:m+2,y:j+11,width:u-4,height:1.5,fill:g})]}),h===2&&e.jsxs("g",{opacity:.55,children:[e.jsx("rect",{x:m+3,y:j+5,width:u-6,height:1,fill:f}),e.jsx("rect",{x:m+6,y:j+8,width:u-12,height:.8,fill:f})]})]}),l.map((k,v)=>{const y=j+(o?16:0)+v*2.1;return y>a-d-1?null:e.jsx("rect",{x:m,y,width:u*k,height:.8,fill:g,opacity:.55,rx:.2},`r${v}`)})]})})},q=({paperId:t,title:s,thumbnailUrl:r,priority:a=!1})=>{const[x,n]=p.useState(!1),[i,c]=p.useState(0),[o,h]=p.useState(a),l=p.useRef(null);p.useEffect(()=>{n(!1),c(0)},[r]);const M=p.useMemo(()=>{if(!r)return null;if(i===0)return r;const g=r.includes("?")?"&":"?";return`${r}${g}retry=${i}`},[r,i]);return p.useEffect(()=>{if(a||o)return;const g=l.current;if(!g)return;const f=new IntersectionObserver(([d])=>{d.isIntersecting&&(h(!0),f.disconnect())},{rootMargin:"250px"});return f.observe(g),()=>f.disconnect()},[a,o]),r&&!x?e.jsx("div",{ref:l,style:{width:160,height:220,background:"#FDFCF9",border:"1px solid var(--hairline-strong)",borderRadius:2,boxShadow:"0 1px 0 rgba(0,0,0,0.04), 0 4px 8px -4px rgba(0,0,0,0.08)",flexShrink:0,overflow:"hidden",position:"relative"},children:(a||o)&&M&&e.jsx("img",{src:M,alt:`Thumbnail for ${s}`,loading:a?"eager":"lazy",decoding:"async",fetchPriority:a?"high":"auto",style:{width:"100%",height:"100%",objectFit:"contain",display:"block"},onError:()=>{if(i<1){c(g=>g+1);return}n(!0)}},M)}):e.jsx(V,{paperId:t})},Y="language-modeling";function w(t){return t?t.toLowerCase().replace(/\(.*?\)/g," ").replace(/[^a-z]+/g," ").replace(/\bllm\b/g," ").replace(/\s+/g," ").trim().replace(/s$/,""):""}function Q(t){return w(t.slug)==="large language model"||w(t.name)==="large language model"}function J(t){return t.tags.includes(Y)?t.methods.filter(s=>!Q(s)):t.methods}const X=({name:t,slug:s,logoUrl:r})=>{const[a,x]=p.useState(!1);return!r||a?null:e.jsx(L,{to:`/orgs/${s}`,className:"paper-organization-logo","aria-label":`View ${t} organization`,title:t,children:e.jsx("img",{src:r,alt:"",onError:()=>x(!0)})})},ae=({paper:t,rank:s,showInstitution:r=!0,onClickTag:a})=>{const x=R(),n=`/paper/${t.id}`,i=p.useCallback(()=>{x.prefetchQuery({queryKey:["paper-arxiv",t.id],queryFn:()=>D.getByArxivId(t.id,!0),staleTime:10*60*1e3})},[t.id,x]),c=t.authors.slice(0,3).join(", "),o=t.authors.length,h=J(t);return e.jsxs("article",{className:"paper-card",children:[s!=null&&e.jsx(L,{to:n,className:"paper-thumb-wrap",onFocus:i,onMouseEnter:i,children:e.jsx(q,{paperId:t.id,title:t.title,thumbnailUrl:t.thumbnailUrl,priority:s<=3})}),e.jsxs("div",{className:"paper-body",children:[e.jsxs("div",{className:"paper-body-main",children:[e.jsxs("h3",{className:"paper-title",children:[e.jsx(L,{to:n,onFocus:i,onMouseEnter:i,children:e.jsx(E,{title:t.title})}),r&&t.organizations.length>0&&e.jsx("span",{className:"paper-organization-logos",children:t.organizations.map(l=>e.jsx(X,{...l},l.slug))})]}),e.jsxs("div",{className:"paper-authors",children:[c,o>3&&e.jsxs("span",{children:[", ","+",o-3," authors"]}),t.date&&e.jsxs(e.Fragment,{children:[o>0?" · ":"",e.jsx("span",{children:t.date})]}),t.citations>0&&e.jsxs(e.Fragment,{children:[o>0||t.date?" · ":"",e.jsxs("span",{children:[t.citations.toLocaleString()," citations"]})]})]}),t.abstract&&e.jsx("p",{className:"paper-abstract",children:e.jsx(T,{text:t.abstract})}),t.sotaRanks.length>0&&e.jsx(I,{ranks:t.sotaRanks,paperHref:n}),(t.tags.length>0||h.length>0)&&e.jsxs("div",{className:"paper-tags paper-tags--clamped",children:[t.tags.map(l=>e.jsx(G,{slug:l,onClick:a},l)),h.map(l=>e.jsx(O,{method:l},l.id||l.slug||l.name))]})]}),(t.githubUrl||t.hfUrl)&&e.jsxs("div",{className:"paper-resources",children:[C(t.githubUrl)&&e.jsxs("a",{className:"paper-resource is-link",href:C(t.githubUrl)??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":"Open GitHub repository",onClick:l=>l.stopPropagation(),children:[e.jsx(K,{name:"github",size:20}),t.velocity24h!=null&&t.velocity24h>0&&e.jsxs("span",{className:"resource-stat",children:[e.jsxs("span",{className:"resource-value",children:[e.jsx("span",{className:"gh-rate-arrow",children:"↑"}),ee(t.velocity24h)]}),e.jsx("span",{className:"resource-label",children:"stars / hr"})]})]}),C(t.hfUrl)&&t.hfKind&&e.jsxs("a",{className:"paper-resource is-link",href:C(t.hfUrl)??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open Hugging Face ${t.hfKind}`,onClick:l=>l.stopPropagation(),children:[e.jsx(U,{size:20}),e.jsxs("span",{className:"resource-stat",children:[e.jsx("span",{className:"resource-value",children:t.hfCount}),e.jsx("span",{className:"resource-label",children:t.hfKind})]})]})]})]})]})};function ee(t){return t.toFixed(1)}export{K as I,O as M,ae as P,I as S,G as T,q as a}; +import{g as E,z as p,j as e,L,u as S}from"./index-D_-UZEuL.js";import{L as R,a as T}from"./LatexTitle-B7GPgo8C.js";import{h as P,d as Z,a as H,c as B}from"./transform-CUuA-koJ.js";import{p as D}from"./papers-DHqjKX7p.js";import{s as C}from"./safeExternalHref-CkBrsh84.js";const G=({slug:t,label:s,onClick:r})=>{const a=S(),x=P(t),n=B(x),i=c=>{if(c.stopPropagation(),r){r(t);return}a(`/tasks/${t}`)};return e.jsxs("span",{className:"tag-chip",style:{background:n.bg,color:n.text},onClick:i,children:[e.jsx("span",{className:"dot",style:{background:n.dot}}),Z(s||H(t),t)]})},O=({method:t,onClick:s})=>{const r=S(),a=t.slug||t.id||"";if(!a)return null;const x=n=>{if(n.stopPropagation(),s){s(a);return}r(`/methods/${a}`)};return e.jsx("span",{className:"method-chip",onClick:x,children:t.name})},$={1:"SOTA 🏆",2:"#2",3:"#3"},F=({units:t,paperHref:s})=>{const r=p.useRef(null),a=p.useRef(null),[x,n]=p.useState(t.length);if(p.useLayoutEffect(()=>{const o=r.current,h=a.current;if(!o||!h||t.length===0)return;const l=f=>(h.textContent=f,h.scrollWidth),M=()=>{const f=o.clientWidth;if(f<=0)return;let d=0,u=0;for(const N of t){const m=l(N.measureText);if(d+m<=f)d+=m,u+=1;else break}if(u0&&d+l(` · +${t.length-u} more`)>f;)u-=1,d-=l(t[u].measureText);u===0&&(u=1)}n(u)};M();const g=new ResizeObserver(M);return g.observe(o),()=>g.disconnect()},[t]),t.length===0)return null;const i=t.slice(0,Math.max(1,Math.min(x,t.length))),c=t.length-i.length;return e.jsxs("div",{className:"paper-sota",ref:r,children:[e.jsx("span",{ref:a,className:"paper-sota-measure","aria-hidden":"true"}),i.map((o,h)=>e.jsxs(p.Fragment,{children:[o.isGroupStart?e.jsxs(e.Fragment,{children:[h>0&&e.jsx("span",{className:"paper-sota-sep",children:" · "}),e.jsx("span",{className:`paper-sota-label${o.rank===1?" paper-sota-label--sota":""}`,children:$[o.rank]}),e.jsx("span",{className:"paper-sota-on",children:" on "})]}):e.jsx("span",{className:"paper-sota-sep",children:", "}),o.slug?e.jsx(L,{to:`/benchmark/${o.slug}`,className:"paper-sota-name",onClick:l=>l.stopPropagation(),children:o.name}):e.jsx("span",{className:"paper-sota-name",children:o.name})]},`${o.slug||o.name}-${h}`)),c>0&&e.jsxs(L,{to:`${s}#results`,className:"paper-sota-more",onClick:o=>o.stopPropagation(),children:[" · +",c," more"]})]})},I=({ranks:t,paperHref:s,wrap:r=!1})=>{const a=p.useMemo(()=>{const n=[];let i=!0;for(const c of[1,2,3]){const o=t.filter(h=>h.rank===c);o.forEach((h,l)=>{const M=l===0,g=M?`${i?"":" · "}${$[c]} on `:", ";n.push({name:h.name,slug:h.slug,rank:c,isGroupStart:M,measureText:g+h.name})}),o.length>0&&(i=!1)}return n},[t]),x=p.useMemo(()=>[1,2,3].map(n=>t.filter(c=>c.rank===n).map((c,o)=>({name:c.name,slug:c.slug,rank:n,isGroupStart:o===0,measureText:(o===0?`${$[n]} on `:", ")+c.name}))).filter(n=>n.length>0),[t]);return r?x.length===0?null:e.jsx("div",{className:"paper-sota-stack",children:x.map(n=>e.jsx(F,{units:n,paperHref:s},n[0].rank))}):a.length===0?null:e.jsx(F,{units:a,paperHref:s})},K=({name:t,size:s=14})=>{const r={search:e.jsx("path",{d:"M11 11l3 3M7 12.5a5.5 5.5 0 110-11 5.5 5.5 0 010 11z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),arrowUp:e.jsx("path",{d:"M8 3l5 6H3l5-6z",fill:"currentColor"}),arrowLeft:e.jsx("path",{d:"M9 3l-4 5 4 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),arrowRight:e.jsx("path",{d:"M7 3l4 5-4 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),external:e.jsx("path",{d:"M5 3h-2v8h8v-2M9 3h3v3M7 9l5-5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),github:e.jsx("path",{d:"M8 1a7 7 0 00-2.21 13.64c.35.06.48-.15.48-.34v-1.2c-1.95.42-2.36-.94-2.36-.94-.32-.81-.78-1.03-.78-1.03-.64-.43.05-.43.05-.43.7.05 1.07.72 1.07.72.62 1.07 1.64.76 2.04.58.06-.45.24-.76.44-.94-1.55-.18-3.18-.78-3.18-3.46 0-.76.27-1.39.72-1.88-.07-.18-.31-.89.07-1.86 0 0 .59-.19 1.92.72.56-.15 1.16-.23 1.75-.24.59 0 1.19.08 1.75.24 1.33-.9 1.92-.72 1.92-.72.38.97.14 1.68.07 1.86.45.49.72 1.12.72 1.88 0 2.69-1.64 3.28-3.19 3.45.25.22.48.65.48 1.32v1.95c0 .19.13.41.49.34A7 7 0 008 1z",fill:"currentColor"}),citation:e.jsx("path",{d:"M3 4h3v3H3zM4 7v1.5a1.5 1.5 0 01-1.5 1.5M9 4h3v3H9zM10 7v1.5a1.5 1.5 0 01-1.5 1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),bookmark:e.jsx("path",{d:"M4 2h8v12l-4-3-4 3V2z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),chart:e.jsx("path",{d:"M2 13h12M3 11l3-4 3 2 4-5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),chat:e.jsx("path",{d:"M3 3h10v7H7l-3 3v-3H3V3z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),pdf:e.jsx("path",{d:"M5 2h5l3 3v9H5V2z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),copy:e.jsx("path",{d:"M5 5h7v8H5V5zM3 3h7v2M3 3v8h2",stroke:"currentColor",strokeWidth:"1.2",fill:"none",strokeLinejoin:"round"}),sparkle:e.jsx("path",{d:"M8 2l1.2 3.8L13 7l-3.8 1.2L8 12l-1.2-3.8L3 7l3.8-1.2L8 2z",fill:"currentColor"}),user:e.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM2 14c0-3 2.5-5 6-5s6 2 6 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),globe:e.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM1.5 8h13M8 1.5c1.7 1.9 2.6 4.2 2.6 6.5s-.9 4.6-2.6 6.5M8 1.5C6.3 3.4 5.4 5.7 5.4 8s.9 4.6 2.6 6.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none",strokeLinecap:"round"}),menu:e.jsx("path",{d:"M2 4h12M2 8h12M2 12h12",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),close:e.jsx("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})};return e.jsx("svg",{className:s===11?"icon-sm":"icon",viewBox:"0 0 16 16",width:s,height:s,children:r[t]})},U=({size:t=16})=>e.jsxs("svg",{className:"hf-logo",width:t,height:t,viewBox:"0 0 95 88",fill:"none","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{fill:"#FFD21E",d:"M47.21 76.5a34.75 34.75 0 1 0 0-69.5 34.75 34.75 0 0 0 0 69.5Z"}),e.jsx("path",{fill:"#FF9D0B",d:"M81.96 41.75a34.75 34.75 0 1 0-69.5 0 34.75 34.75 0 0 0 69.5 0Zm-73.5 0a38.75 38.75 0 1 1 77.5 0 38.75 38.75 0 0 1-77.5 0Z"}),e.jsx("path",{fill:"#3A3B45",d:"M58.5 32.3c1.28.44 1.78 3.06 3.07 2.38a5 5 0 1 0-6.76-2.07c.61 1.15 2.55-.72 3.7-.32ZM34.95 32.3c-1.28.44-1.79 3.06-3.07 2.38a5 5 0 1 1 6.76-2.07c-.61 1.15-2.56-.72-3.7-.32Z"}),e.jsx("path",{fill:"#FF323D",d:"M46.96 56.29c9.83 0 13-8.76 13-13.26 0-2.34-1.57-1.6-4.09-.36-2.33 1.15-5.46 2.74-8.9 2.74-7.19 0-13-6.88-13-2.38s3.16 13.26 13 13.26Z"}),e.jsx("path",{fill:"#3A3B45",fillRule:"evenodd",clipRule:"evenodd",d:"M39.43 54a8.7 8.7 0 0 1 5.3-4.49c.4-.12.81.57 1.24 1.28.4.68.82 1.37 1.24 1.37.45 0 .9-.68 1.33-1.35.45-.7.89-1.38 1.32-1.25a8.61 8.61 0 0 1 5 4.17c3.73-2.94 5.1-7.74 5.1-10.7 0-2.34-1.57-1.6-4.09-.36l-.14.07c-2.31 1.15-5.39 2.67-8.77 2.67s-6.45-1.52-8.77-2.67c-2.6-1.29-4.23-2.1-4.23.29 0 3.05 1.46 8.06 5.47 10.97Z"}),e.jsx("path",{fill:"#FF9D0B",d:"M70.71 37a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5ZM24.21 37a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5ZM17.52 48c-1.62 0-3.06.66-4.07 1.87a5.97 5.97 0 0 0-1.33 3.76 7.1 7.1 0 0 0-1.94-.3c-1.55 0-2.95.59-3.94 1.66a5.8 5.8 0 0 0-.8 7 5.3 5.3 0 0 0-1.79 2.82c-.24.9-.48 2.8.8 4.74a5.22 5.22 0 0 0-.37 5.02c1.02 2.32 3.57 4.14 8.52 6.1 3.07 1.22 5.89 2 5.91 2.01a44.33 44.33 0 0 0 10.93 1.6c5.86 0 10.05-1.8 12.46-5.34 3.88-5.69 3.33-10.9-1.7-15.92-2.77-2.78-4.62-6.87-5-7.77-.78-2.66-2.84-5.62-6.25-5.62a5.7 5.7 0 0 0-4.6 2.46c-1-1.26-1.98-2.25-2.86-2.82A7.4 7.4 0 0 0 17.52 48Zm0 4c.51 0 1.14.22 1.82.65 2.14 1.36 6.25 8.43 7.76 11.18.5.92 1.37 1.31 2.14 1.31 1.55 0 2.75-1.53.15-3.48-3.92-2.93-2.55-7.72-.68-8.01.08-.02.17-.02.24-.02 1.7 0 2.45 2.93 2.45 2.93s2.2 5.52 5.98 9.3c3.77 3.77 3.97 6.8 1.22 10.83-1.88 2.75-5.47 3.58-9.16 3.58-3.81 0-7.73-.9-9.92-1.46-.11-.03-13.45-3.8-11.76-7 .28-.54.75-.76 1.34-.76 2.38 0 6.7 3.54 8.57 3.54.41 0 .7-.17.83-.6.79-2.85-12.06-4.05-10.98-8.17.2-.73.71-1.02 1.44-1.02 3.14 0 10.2 5.53 11.68 5.53.11 0 .2-.03.24-.1.74-1.2.33-2.04-4.9-5.2-5.21-3.16-8.88-5.06-6.8-7.33.24-.26.58-.38 1-.38 3.17 0 10.66 6.82 10.66 6.82s2.02 2.1 3.25 2.1c.28 0 .52-.1.68-.38.86-1.46-8.06-8.22-8.56-11.01-.34-1.9.24-2.85 1.31-2.85Z"}),e.jsx("path",{fill:"#FFD21E",d:"M38.6 76.69c2.75-4.04 2.55-7.07-1.22-10.84-3.78-3.77-5.98-9.3-5.98-9.3s-.82-3.2-2.69-2.9c-1.87.3-3.24 5.08.68 8.01 3.91 2.93-.78 4.92-2.29 2.17-1.5-2.75-5.62-9.82-7.76-11.18-2.13-1.35-3.63-.6-3.13 2.2.5 2.79 9.43 9.55 8.56 11-.87 1.47-3.93-1.71-3.93-1.71s-9.57-8.71-11.66-6.44c-2.08 2.27 1.59 4.17 6.8 7.33 5.23 3.16 5.64 4 4.9 5.2-.75 1.2-12.28-8.53-13.36-4.4-1.08 4.11 11.77 5.3 10.98 8.15-.8 2.85-9.06-5.38-10.74-2.18-1.7 3.21 11.65 6.98 11.76 7.01 4.3 1.12 15.25 3.49 19.08-2.12Z"}),e.jsx("path",{fill:"#FF9D0B",d:"M77.4 48c1.62 0 3.07.66 4.07 1.87a5.97 5.97 0 0 1 1.33 3.76 7.1 7.1 0 0 1 1.95-.3c1.55 0 2.95.59 3.94 1.66a5.8 5.8 0 0 1 .8 7 5.3 5.3 0 0 1 1.78 2.82c.24.9.48 2.8-.8 4.74a5.22 5.22 0 0 1 .37 5.02c-1.02 2.32-3.57 4.14-8.51 6.1-3.08 1.22-5.9 2-5.92 2.01a44.33 44.33 0 0 1-10.93 1.6c-5.86 0-10.05-1.8-12.46-5.34-3.88-5.69-3.33-10.9 1.7-15.92 2.78-2.78 4.63-6.87 5.01-7.77.78-2.66 2.83-5.62 6.24-5.62a5.7 5.7 0 0 1 4.6 2.46c1-1.26 1.98-2.25 2.87-2.82A7.4 7.4 0 0 1 77.4 48Zm0 4c-.51 0-1.13.22-1.82.65-2.13 1.36-6.25 8.43-7.76 11.18a2.43 2.43 0 0 1-2.14 1.31c-1.54 0-2.75-1.53-.14-3.48 3.91-2.93 2.54-7.72.67-8.01a1.54 1.54 0 0 0-.24-.02c-1.7 0-2.45 2.93-2.45 2.93s-2.2 5.52-5.97 9.3c-3.78 3.77-3.98 6.8-1.22 10.83 1.87 2.75 5.47 3.58 9.15 3.58 3.82 0 7.73-.9 9.93-1.46.1-.03 13.45-3.8 11.76-7-.29-.54-.75-.76-1.34-.76-2.38 0-6.71 3.54-8.57 3.54-.42 0-.71-.17-.83-.6-.8-2.85 12.05-4.05 10.97-8.17-.19-.73-.7-1.02-1.44-1.02-3.14 0-10.2 5.53-11.68 5.53-.1 0-.19-.03-.23-.1-.74-1.2-.34-2.04 4.88-5.2 5.23-3.16 8.9-5.06 6.8-7.33-.23-.26-.57-.38-.98-.38-3.18 0-10.67 6.82-10.67 6.82s-2.02 2.1-3.24 2.1a.74.74 0 0 1-.68-.38c-.87-1.46 8.05-8.22 8.55-11.01.34-1.9-.24-2.85-1.31-2.85Z"}),e.jsx("path",{fill:"#FFD21E",d:"M56.33 76.69c-2.75-4.04-2.56-7.07 1.22-10.84 3.77-3.77 5.97-9.3 5.97-9.3s.82-3.2 2.7-2.9c1.86.3 3.23 5.08-.68 8.01-3.92 2.93.78 4.92 2.28 2.17 1.51-2.75 5.63-9.82 7.76-11.18 2.13-1.35 3.64-.6 3.13 2.2-.5 2.79-9.42 9.55-8.55 11 .86 1.47 3.92-1.71 3.92-1.71s9.58-8.71 11.66-6.44c2.08 2.27-1.58 4.17-6.8 7.33-5.23 3.16-5.63 4-4.9 5.2.75 1.2 12.28-8.53 13.36-4.4 1.08 4.11-11.76 5.3-10.97 8.15.8 2.85 9.05-5.38 10.74-2.18 1.69 3.21-11.65 6.98-11.76 7.01-4.31 1.12-15.26 3.49-19.08-2.12Z"})]}),_=t=>{let s=2166136261;for(let r=0;r(s=Math.imul(s^s>>>15,2246822507),s=Math.imul(s^s>>>13,3266489909),s^=s>>>16,(s>>>0)%1e4/1e4)},V=({paperId:t})=>{const s=_(t),r=160,a=220,x=[.85+s()*.1,.55+s()*.25],n=.45+s()*.3,i=[],c=9+Math.floor(s()*3);for(let k=0;k.3,h=Math.floor(s()*3),l=[],M=6+Math.floor(s()*3);for(let k=0;ke.jsx("rect",{x:d+(r-d*2)*(1-k)/2,y:z+v*2.4,width:(r-d*2)*k,height:1.4,fill:f,rx:.3},`t${v}`)),e.jsx("rect",{x:d+(r-d*2)*(1-n)/2,y:A,width:(r-d*2)*n,height:.9,fill:g,opacity:.7,rx:.2}),e.jsx("rect",{x:d,y:W,width:6,height:1,fill:f,opacity:.6}),i.map((k,v)=>{const y=j+v*2.1;return y>a-d-1?null:e.jsx("rect",{x:N,y,width:u*k,height:.8,fill:g,opacity:.55,rx:.2},`l${v}`)}),o&&e.jsxs("g",{children:[e.jsx("rect",{x:m,y:j,width:u,height:14,fill:"#F0EBE0",stroke:g,strokeWidth:.3,opacity:.9}),h===0&&e.jsx("g",{stroke:f,strokeWidth:.4,fill:"none",opacity:.6,children:e.jsx("polyline",{points:`${m+2},${j+11} ${m+6},${j+8} ${m+10},${j+9} ${m+14},${j+5} ${m+18},${j+6} ${m+22},${j+3}`})}),h===1&&e.jsxs("g",{opacity:.55,children:[e.jsx("circle",{cx:m+u/2,cy:j+7,r:3.5,fill:f}),e.jsx("rect",{x:m+2,y:j+11,width:u-4,height:1.5,fill:g})]}),h===2&&e.jsxs("g",{opacity:.55,children:[e.jsx("rect",{x:m+3,y:j+5,width:u-6,height:1,fill:f}),e.jsx("rect",{x:m+6,y:j+8,width:u-12,height:.8,fill:f})]})]}),l.map((k,v)=>{const y=j+(o?16:0)+v*2.1;return y>a-d-1?null:e.jsx("rect",{x:m,y,width:u*k,height:.8,fill:g,opacity:.55,rx:.2},`r${v}`)})]})})},q=({paperId:t,title:s,thumbnailUrl:r,priority:a=!1})=>{const[x,n]=p.useState(!1),[i,c]=p.useState(0),[o,h]=p.useState(a),l=p.useRef(null);p.useEffect(()=>{n(!1),c(0)},[r]);const M=p.useMemo(()=>{if(!r)return null;if(i===0)return r;const g=r.includes("?")?"&":"?";return`${r}${g}retry=${i}`},[r,i]);return p.useEffect(()=>{if(a||o)return;const g=l.current;if(!g)return;const f=new IntersectionObserver(([d])=>{d.isIntersecting&&(h(!0),f.disconnect())},{rootMargin:"250px"});return f.observe(g),()=>f.disconnect()},[a,o]),r&&!x?e.jsx("div",{ref:l,style:{width:160,height:220,background:"#FDFCF9",border:"1px solid var(--hairline-strong)",borderRadius:2,boxShadow:"0 1px 0 rgba(0,0,0,0.04), 0 4px 8px -4px rgba(0,0,0,0.08)",flexShrink:0,overflow:"hidden",position:"relative"},children:(a||o)&&M&&e.jsx("img",{src:M,alt:`Thumbnail for ${s}`,loading:a?"eager":"lazy",decoding:"async",fetchPriority:a?"high":"auto",style:{width:"100%",height:"100%",objectFit:"contain",display:"block"},onError:()=>{if(i<1){c(g=>g+1);return}n(!0)}},M)}):e.jsx(V,{paperId:t})},Y="language-modeling";function w(t){return t?t.toLowerCase().replace(/\(.*?\)/g," ").replace(/[^a-z]+/g," ").replace(/\bllm\b/g," ").replace(/\s+/g," ").trim().replace(/s$/,""):""}function Q(t){return w(t.slug)==="large language model"||w(t.name)==="large language model"}function J(t){return t.tags.includes(Y)?t.methods.filter(s=>!Q(s)):t.methods}const X=({name:t,slug:s,logoUrl:r})=>{const[a,x]=p.useState(!1);return!r||a?null:e.jsx(L,{to:`/orgs/${s}`,className:"paper-organization-logo","aria-label":`View ${t} organization`,title:t,children:e.jsx("img",{src:r,alt:"",onError:()=>x(!0)})})},ae=({paper:t,rank:s,showInstitution:r=!0,onClickTag:a})=>{const x=E(),n=`/paper/${t.id}`,i=p.useCallback(()=>{x.prefetchQuery({queryKey:["paper-arxiv",t.id],queryFn:()=>D.getByArxivId(t.id,!0),staleTime:10*60*1e3})},[t.id,x]),c=t.authors.slice(0,3).join(", "),o=t.authors.length,h=J(t);return e.jsxs("article",{className:"paper-card",children:[s!=null&&e.jsx(L,{to:n,className:"paper-thumb-wrap",onFocus:i,onMouseEnter:i,children:e.jsx(q,{paperId:t.id,title:t.title,thumbnailUrl:t.thumbnailUrl,priority:s<=3})}),e.jsxs("div",{className:"paper-body",children:[e.jsxs("div",{className:"paper-body-main",children:[e.jsxs("h3",{className:"paper-title",children:[e.jsx(L,{to:n,onFocus:i,onMouseEnter:i,children:e.jsx(R,{title:t.title})}),r&&t.organizations.length>0&&e.jsx("span",{className:"paper-organization-logos",children:t.organizations.map(l=>e.jsx(X,{...l},l.slug))})]}),e.jsxs("div",{className:"paper-authors",children:[c,o>3&&e.jsxs("span",{children:[", ","+",o-3," authors"]}),t.date&&e.jsxs(e.Fragment,{children:[o>0?" · ":"",e.jsx("span",{children:t.date})]}),t.citations>0&&e.jsxs(e.Fragment,{children:[o>0||t.date?" · ":"",e.jsxs("span",{children:[t.citations.toLocaleString()," citations"]})]})]}),t.abstract&&e.jsx("p",{className:"paper-abstract",children:e.jsx(T,{text:t.abstract})}),t.sotaRanks.length>0&&e.jsx(I,{ranks:t.sotaRanks,paperHref:n}),(t.tags.length>0||h.length>0)&&e.jsxs("div",{className:"paper-tags paper-tags--clamped",children:[t.tags.map(l=>e.jsx(G,{slug:l,onClick:a},l)),h.map(l=>e.jsx(O,{method:l},l.id||l.slug||l.name))]})]}),(t.githubUrl||t.hfUrl)&&e.jsxs("div",{className:"paper-resources",children:[C(t.githubUrl)&&e.jsxs("a",{className:"paper-resource is-link",href:C(t.githubUrl)??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":"Open GitHub repository",onClick:l=>l.stopPropagation(),children:[e.jsx(K,{name:"github",size:20}),t.velocity24h!=null&&t.velocity24h>0&&e.jsxs("span",{className:"resource-stat",children:[e.jsxs("span",{className:"resource-value",children:[e.jsx("span",{className:"gh-rate-arrow",children:"↑"}),ee(t.velocity24h)]}),e.jsx("span",{className:"resource-label",children:"stars / hr"})]})]}),C(t.hfUrl)&&t.hfKind&&e.jsxs("a",{className:"paper-resource is-link",href:C(t.hfUrl)??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open Hugging Face ${t.hfKind}`,onClick:l=>l.stopPropagation(),children:[e.jsx(U,{size:20}),e.jsxs("span",{className:"resource-stat",children:[e.jsx("span",{className:"resource-value",children:t.hfCount}),e.jsx("span",{className:"resource-label",children:t.hfKind})]})]})]})]})]})};function ee(t){return t.toFixed(1)}export{K as I,O as M,ae as P,I as S,G as T,q as a}; diff --git a/assets/dialog-BhRZv4T5.js b/assets/dialog-BhRZv4T5.js deleted file mode 100644 index 09fa346821f560c5b81a1f7c6b6668520cf8c4a4..0000000000000000000000000000000000000000 --- a/assets/dialog-BhRZv4T5.js +++ /dev/null @@ -1,5 +0,0 @@ -import{r as s,j as i,Z as q,o as K,O as R,P as N,a1 as U,m as D,q as x,t as X,p as h,a2 as Y,a3 as J,a4 as Q,a5 as ee,a6 as te,a9 as oe,X as ne,v as p}from"./index-BrhBTT14.js";function ae(e){const t=re(e),o=s.forwardRef((a,n)=>{const{children:r,...l}=a,c=s.Children.toArray(r),d=c.find(ie);if(d){const u=d.props.children,m=c.map(v=>v===d?s.Children.count(u)>1?s.Children.only(null):s.isValidElement(u)?u.props.children:null:v);return i.jsx(t,{...l,ref:n,children:s.isValidElement(u)?s.cloneElement(u,void 0,m):null})}return i.jsx(t,{...l,ref:n,children:r})});return o.displayName=`${e}.Slot`,o}function re(e){const t=s.forwardRef((o,a)=>{const{children:n,...r}=o;if(s.isValidElement(n)){const l=ce(n),c=le(r,n.props);return n.type!==s.Fragment&&(c.ref=a?q(a,l):l),s.cloneElement(n,c)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var se=Symbol("radix.slottable");function ie(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===se}function le(e,t){const o={...t};for(const a in t){const n=e[a],r=t[a];/^on[A-Z]/.test(a)?n&&r?o[a]=(...c)=>{const d=r(...c);return n(...c),d}:n&&(o[a]=n):a==="style"?o[a]={...n,...r}:a==="className"&&(o[a]=[n,r].filter(Boolean).join(" "))}return{...e,...o}}function ce(e){var a,n;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,o=t&&"isReactWarning"in t&&t.isReactWarning;return o?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,o=t&&"isReactWarning"in t&&t.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var C="Dialog",[b]=X(C),[de,f]=b(C),O=e=>{const{__scopeDialog:t,children:o,open:a,defaultOpen:n,onOpenChange:r,modal:l=!0}=e,c=s.useRef(null),d=s.useRef(null),[u,m]=K({prop:a,defaultProp:n??!1,onChange:r,caller:C});return i.jsx(de,{scope:t,triggerRef:c,contentRef:d,contentId:R(),titleId:R(),descriptionId:R(),open:u,onOpenChange:m,onOpenToggle:s.useCallback(()=>m(v=>!v),[m]),modal:l,children:o})};O.displayName=C;var P="DialogTrigger",ue=s.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,n=f(P,o),r=h(t,n.triggerRef);return i.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":j(n.open),...a,ref:r,onClick:x(e.onClick,n.onOpenToggle)})});ue.displayName=P;var E="DialogPortal",[fe,I]=b(E,{forceMount:void 0}),w=e=>{const{__scopeDialog:t,forceMount:o,children:a,container:n}=e,r=f(E,t);return i.jsx(fe,{scope:t,forceMount:o,children:s.Children.map(a,l=>i.jsx(N,{present:o||r.open,children:i.jsx(U,{asChild:!0,container:n,children:l})}))})};w.displayName=E;var y="DialogOverlay",A=s.forwardRef((e,t)=>{const o=I(y,e.__scopeDialog),{forceMount:a=o.forceMount,...n}=e,r=f(y,e.__scopeDialog);return r.modal?i.jsx(N,{present:a||r.open,children:i.jsx(pe,{...n,ref:t})}):null});A.displayName=y;var ge=ae("DialogOverlay.RemoveScroll"),pe=s.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,n=f(y,o);return i.jsx(J,{as:ge,allowPinchZoom:!0,shards:[n.contentRef],children:i.jsx(D.div,{"data-state":j(n.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),g="DialogContent",T=s.forwardRef((e,t)=>{const o=I(g,e.__scopeDialog),{forceMount:a=o.forceMount,...n}=e,r=f(g,e.__scopeDialog);return i.jsx(N,{present:a||r.open,children:r.modal?i.jsx(me,{...n,ref:t}):i.jsx(xe,{...n,ref:t})})});T.displayName=g;var me=s.forwardRef((e,t)=>{const o=f(g,e.__scopeDialog),a=s.useRef(null),n=h(t,o.contentRef,a);return s.useEffect(()=>{const r=a.current;if(r)return Y(r)},[]),i.jsx(S,{...e,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:x(e.onCloseAutoFocus,r=>{var l;r.preventDefault(),(l=o.triggerRef.current)==null||l.focus()}),onPointerDownOutside:x(e.onPointerDownOutside,r=>{const l=r.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&r.preventDefault()}),onFocusOutside:x(e.onFocusOutside,r=>r.preventDefault())})}),xe=s.forwardRef((e,t)=>{const o=f(g,e.__scopeDialog),a=s.useRef(!1),n=s.useRef(!1);return i.jsx(S,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,r),r.defaultPrevented||(a.current||(c=o.triggerRef.current)==null||c.focus(),r.preventDefault()),a.current=!1,n.current=!1},onInteractOutside:r=>{var d,u;(d=e.onInteractOutside)==null||d.call(e,r),r.defaultPrevented||(a.current=!0,r.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const l=r.target;((u=o.triggerRef.current)==null?void 0:u.contains(l))&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&n.current&&r.preventDefault()}})}),S=s.forwardRef((e,t)=>{const{__scopeDialog:o,trapFocus:a,onOpenAutoFocus:n,onCloseAutoFocus:r,...l}=e,c=f(g,o),d=s.useRef(null),u=h(t,d);return Q(),i.jsxs(i.Fragment,{children:[i.jsx(ee,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:n,onUnmountAutoFocus:r,children:i.jsx(te,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":j(c.open),...l,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(De,{titleId:c.titleId}),i.jsx(ye,{contentRef:d,descriptionId:c.descriptionId})]})]})}),_="DialogTitle",F=s.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,n=f(_,o);return i.jsx(D.h2,{id:n.titleId,...a,ref:t})});F.displayName=_;var M="DialogDescription",W=s.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,n=f(M,o);return i.jsx(D.p,{id:n.descriptionId,...a,ref:t})});W.displayName=M;var $="DialogClose",k=s.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,n=f($,o);return i.jsx(D.button,{type:"button",...a,ref:t,onClick:x(e.onClick,()=>n.onOpenChange(!1))})});k.displayName=$;function j(e){return e?"open":"closed"}var L="DialogTitleWarning",[Ie,G]=oe(L,{contentName:g,titleName:_,docsSlug:"dialog"}),De=({titleId:e})=>{const t=G(L),o=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return s.useEffect(()=>{e&&(document.getElementById(e)||console.error(o))},[o,e]),null},ve="DialogDescriptionWarning",ye=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${G(ve).contentName}}.`;return s.useEffect(()=>{var r;const n=(r=e.current)==null?void 0:r.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},Ce=O,Re=w,V=A,H=T,B=F,z=W,Ne=k;const we=Ce,he=Re,Z=s.forwardRef(({className:e,...t},o)=>i.jsx(V,{ref:o,className:p("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}));Z.displayName=V.displayName;const Ee=s.forwardRef(({className:e,children:t,...o},a)=>i.jsxs(he,{children:[i.jsx(Z,{}),i.jsxs(H,{ref:a,className:p("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),...o,children:[t,i.jsxs(Ne,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[i.jsx(ne,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ee.displayName=H.displayName;const _e=({className:e,...t})=>i.jsx("div",{className:p("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});_e.displayName="DialogHeader";const je=({className:e,...t})=>i.jsx("div",{className:p("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});je.displayName="DialogFooter";const be=s.forwardRef(({className:e,...t},o)=>i.jsx(B,{ref:o,className:p("text-lg font-semibold leading-none tracking-tight",e),...t}));be.displayName=B.displayName;const Oe=s.forwardRef(({className:e,...t},o)=>i.jsx(z,{ref:o,className:p("text-sm text-muted-foreground",e),...t}));Oe.displayName=z.displayName;export{H as C,we as D,V as O,Re as P,Ce as R,Ee as a,_e as b,be as c,Oe as d,je as e}; diff --git a/assets/dialog-ChaQ5z93.js b/assets/dialog-ChaQ5z93.js new file mode 100644 index 0000000000000000000000000000000000000000..80c61af29403c0ef549d432c882bbdce9d904e12 --- /dev/null +++ b/assets/dialog-ChaQ5z93.js @@ -0,0 +1,5 @@ +import{r as s,j as i,a3 as Y,k as Z,Y as R,P as h,a7 as K,h as D,m as x,p as U,l as N,a8 as X,a9 as J,aa as Q,ab as ee,ac as te,af as oe,X as ne,q as p}from"./index-D_-UZEuL.js";function ae(e){const t=re(e),o=s.forwardRef((a,n)=>{const{children:r,...l}=a,c=s.Children.toArray(r),d=c.find(ie);if(d){const u=d.props.children,m=c.map(v=>v===d?s.Children.count(u)>1?s.Children.only(null):s.isValidElement(u)?u.props.children:null:v);return i.jsx(t,{...l,ref:n,children:s.isValidElement(u)?s.cloneElement(u,void 0,m):null})}return i.jsx(t,{...l,ref:n,children:r})});return o.displayName=`${e}.Slot`,o}function re(e){const t=s.forwardRef((o,a)=>{const{children:n,...r}=o;if(s.isValidElement(n)){const l=ce(n),c=le(r,n.props);return n.type!==s.Fragment&&(c.ref=a?Y(a,l):l),s.cloneElement(n,c)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var se=Symbol("radix.slottable");function ie(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===se}function le(e,t){const o={...t};for(const a in t){const n=e[a],r=t[a];/^on[A-Z]/.test(a)?n&&r?o[a]=(...c)=>{const d=r(...c);return n(...c),d}:n&&(o[a]=n):a==="style"?o[a]={...n,...r}:a==="className"&&(o[a]=[n,r].filter(Boolean).join(" "))}return{...e,...o}}function ce(e){var a,n;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,o=t&&"isReactWarning"in t&&t.isReactWarning;return o?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,o=t&&"isReactWarning"in t&&t.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var C="Dialog",[b]=U(C),[de,f]=b(C),P=e=>{const{__scopeDialog:t,children:o,open:a,defaultOpen:n,onOpenChange:r,modal:l=!0}=e,c=s.useRef(null),d=s.useRef(null),[u,m]=Z({prop:a,defaultProp:n??!1,onChange:r,caller:C});return i.jsx(de,{scope:t,triggerRef:c,contentRef:d,contentId:R(),titleId:R(),descriptionId:R(),open:u,onOpenChange:m,onOpenToggle:s.useCallback(()=>m(v=>!v),[m]),modal:l,children:o})};P.displayName=C;var O="DialogTrigger",ue=s.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,n=f(O,o),r=N(t,n.triggerRef);return i.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":j(n.open),...a,ref:r,onClick:x(e.onClick,n.onOpenToggle)})});ue.displayName=O;var E="DialogPortal",[fe,I]=b(E,{forceMount:void 0}),w=e=>{const{__scopeDialog:t,forceMount:o,children:a,container:n}=e,r=f(E,t);return i.jsx(fe,{scope:t,forceMount:o,children:s.Children.map(a,l=>i.jsx(h,{present:o||r.open,children:i.jsx(K,{asChild:!0,container:n,children:l})}))})};w.displayName=E;var y="DialogOverlay",A=s.forwardRef((e,t)=>{const o=I(y,e.__scopeDialog),{forceMount:a=o.forceMount,...n}=e,r=f(y,e.__scopeDialog);return r.modal?i.jsx(h,{present:a||r.open,children:i.jsx(pe,{...n,ref:t})}):null});A.displayName=y;var ge=ae("DialogOverlay.RemoveScroll"),pe=s.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,n=f(y,o);return i.jsx(J,{as:ge,allowPinchZoom:!0,shards:[n.contentRef],children:i.jsx(D.div,{"data-state":j(n.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),g="DialogContent",T=s.forwardRef((e,t)=>{const o=I(g,e.__scopeDialog),{forceMount:a=o.forceMount,...n}=e,r=f(g,e.__scopeDialog);return i.jsx(h,{present:a||r.open,children:r.modal?i.jsx(me,{...n,ref:t}):i.jsx(xe,{...n,ref:t})})});T.displayName=g;var me=s.forwardRef((e,t)=>{const o=f(g,e.__scopeDialog),a=s.useRef(null),n=N(t,o.contentRef,a);return s.useEffect(()=>{const r=a.current;if(r)return X(r)},[]),i.jsx(S,{...e,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:x(e.onCloseAutoFocus,r=>{var l;r.preventDefault(),(l=o.triggerRef.current)==null||l.focus()}),onPointerDownOutside:x(e.onPointerDownOutside,r=>{const l=r.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&r.preventDefault()}),onFocusOutside:x(e.onFocusOutside,r=>r.preventDefault())})}),xe=s.forwardRef((e,t)=>{const o=f(g,e.__scopeDialog),a=s.useRef(!1),n=s.useRef(!1);return i.jsx(S,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,r),r.defaultPrevented||(a.current||(c=o.triggerRef.current)==null||c.focus(),r.preventDefault()),a.current=!1,n.current=!1},onInteractOutside:r=>{var d,u;(d=e.onInteractOutside)==null||d.call(e,r),r.defaultPrevented||(a.current=!0,r.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const l=r.target;((u=o.triggerRef.current)==null?void 0:u.contains(l))&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&n.current&&r.preventDefault()}})}),S=s.forwardRef((e,t)=>{const{__scopeDialog:o,trapFocus:a,onOpenAutoFocus:n,onCloseAutoFocus:r,...l}=e,c=f(g,o),d=s.useRef(null),u=N(t,d);return Q(),i.jsxs(i.Fragment,{children:[i.jsx(ee,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:n,onUnmountAutoFocus:r,children:i.jsx(te,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":j(c.open),...l,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(De,{titleId:c.titleId}),i.jsx(ye,{contentRef:d,descriptionId:c.descriptionId})]})]})}),_="DialogTitle",F=s.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,n=f(_,o);return i.jsx(D.h2,{id:n.titleId,...a,ref:t})});F.displayName=_;var M="DialogDescription",W=s.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,n=f(M,o);return i.jsx(D.p,{id:n.descriptionId,...a,ref:t})});W.displayName=M;var $="DialogClose",k=s.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,n=f($,o);return i.jsx(D.button,{type:"button",...a,ref:t,onClick:x(e.onClick,()=>n.onOpenChange(!1))})});k.displayName=$;function j(e){return e?"open":"closed"}var L="DialogTitleWarning",[Ie,G]=oe(L,{contentName:g,titleName:_,docsSlug:"dialog"}),De=({titleId:e})=>{const t=G(L),o=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return s.useEffect(()=>{e&&(document.getElementById(e)||console.error(o))},[o,e]),null},ve="DialogDescriptionWarning",ye=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${G(ve).contentName}}.`;return s.useEffect(()=>{var r;const n=(r=e.current)==null?void 0:r.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},Ce=P,Re=w,V=A,H=T,B=F,z=W,he=k;const we=Ce,Ne=Re,q=s.forwardRef(({className:e,...t},o)=>i.jsx(V,{ref:o,className:p("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}));q.displayName=V.displayName;const Ee=s.forwardRef(({className:e,children:t,...o},a)=>i.jsxs(Ne,{children:[i.jsx(q,{}),i.jsxs(H,{ref:a,className:p("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),...o,children:[t,i.jsxs(he,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[i.jsx(ne,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ee.displayName=H.displayName;const _e=({className:e,...t})=>i.jsx("div",{className:p("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});_e.displayName="DialogHeader";const je=({className:e,...t})=>i.jsx("div",{className:p("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});je.displayName="DialogFooter";const be=s.forwardRef(({className:e,...t},o)=>i.jsx(B,{ref:o,className:p("text-lg font-semibold leading-none tracking-tight",e),...t}));be.displayName=B.displayName;const Pe=s.forwardRef(({className:e,...t},o)=>i.jsx(z,{ref:o,className:p("text-sm text-muted-foreground",e),...t}));Pe.displayName=z.displayName;export{H as C,we as D,V as O,Re as P,Ce as R,Ee as a,_e as b,be as c,Pe as d,je as e}; diff --git a/assets/external-link-uK7nAEgd.js b/assets/external-link-Dm5dHWqK.js similarity index 89% rename from assets/external-link-uK7nAEgd.js rename to assets/external-link-Dm5dHWqK.js index 005e7b9b9424f424a1c11278c6fdbbf5a89c2b67..206a9c625db3115dbb65ce25e85fda56aafbfc38 100644 --- a/assets/external-link-uK7nAEgd.js +++ b/assets/external-link-Dm5dHWqK.js @@ -1,4 +1,4 @@ -import{c as a}from"./index-BrhBTT14.js";/** +import{d as a}from"./index-D_-UZEuL.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/file-text-DROKoLCd.js b/assets/file-text--vrXMvWb.js similarity index 91% rename from assets/file-text-DROKoLCd.js rename to assets/file-text--vrXMvWb.js index 6f392c5ebb84e6a9ead6966a73d504da536bf96d..2cd3ed53b0f6f3386af5bf35cd2c8885c47623a0 100644 --- a/assets/file-text-DROKoLCd.js +++ b/assets/file-text--vrXMvWb.js @@ -1,4 +1,4 @@ -import{c as e}from"./index-BrhBTT14.js";/** +import{d as e}from"./index-D_-UZEuL.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/github-BtTCuUR0.js b/assets/github-DQuIliTJ.js similarity index 96% rename from assets/github-BtTCuUR0.js rename to assets/github-DQuIliTJ.js index 1d1574b88599c2336d4eb592c09457cc33f81592..4e1518993da30ffacdd5a3743ad2c48d23f3ac2d 100644 --- a/assets/github-BtTCuUR0.js +++ b/assets/github-DQuIliTJ.js @@ -1 +1 @@ -import{G as l}from"./index-BrhBTT14.js";const u=new Set(["github.com","www.github.com"]);function c(o){let n;try{n=new URL(o)}catch{return null}if(n.protocol!=="https:"||!u.has(n.hostname))return null;const r=n.pathname.split("/").filter(Boolean);if(r.length!==2)return null;let e,t;try{e=decodeURIComponent(r[0]),t=decodeURIComponent(r[1]).replace(/\.git$/,"")}catch{return null}if(!/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38})$/.test(e)||!/^[a-zA-Z0-9._-]{1,100}$/.test(t))return null;const i=`${e}/${t}`,s=[e,t].map(encodeURIComponent).join("/");return{owner:e,repository:t,repoId:i,url:`https://github.com/${s}`}}async function h(o,n){const r=[o.owner,o.repository].map(encodeURIComponent).join("/"),e=await fetch(l(`/api/v1/github/repositories/${r}/preview`),{signal:n});if(!e.ok)throw new Error(`GitHub repository lookup failed: ${e.status}`);const t=await e.json();return{description:typeof t.description=="string"?t.description:null,stars:typeof t.stars=="number"?t.stars:0,forks:typeof t.forks=="number"?t.forks:0,language:typeof t.language=="string"?t.language:null,archived:t.archived===!0,avatarUrl:typeof t.avatar_url=="string"?t.avatar_url:""}}function a(o){const n=o.trim();if(!n)return null;let r=n;!r.startsWith("http://")&&!r.startsWith("https://")&&(r=`https://${r}`);try{const e=new URL(r);if(e.hostname.toLowerCase()!=="github.com")return null;const t=e.pathname.split("/").filter(Boolean);if(t.length<2)return null;const i=t[0].toLowerCase();let s=t[1].toLowerCase();return s.endsWith(".git")&&(s=s.slice(0,-4)),`https://github.com/${i}/${s}`}catch{return null}}function f(o,n){const r=a(o),e=a(n);return r&&e?r===e:o.trim()===n.trim()}export{h as f,f as g,a as n,c as p}; +import{E as l}from"./index-D_-UZEuL.js";const u=new Set(["github.com","www.github.com"]);function c(o){let n;try{n=new URL(o)}catch{return null}if(n.protocol!=="https:"||!u.has(n.hostname))return null;const r=n.pathname.split("/").filter(Boolean);if(r.length!==2)return null;let e,t;try{e=decodeURIComponent(r[0]),t=decodeURIComponent(r[1]).replace(/\.git$/,"")}catch{return null}if(!/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38})$/.test(e)||!/^[a-zA-Z0-9._-]{1,100}$/.test(t))return null;const i=`${e}/${t}`,s=[e,t].map(encodeURIComponent).join("/");return{owner:e,repository:t,repoId:i,url:`https://github.com/${s}`}}async function h(o,n){const r=[o.owner,o.repository].map(encodeURIComponent).join("/"),e=await fetch(l(`/api/v1/github/repositories/${r}/preview`),{signal:n});if(!e.ok)throw new Error(`GitHub repository lookup failed: ${e.status}`);const t=await e.json();return{description:typeof t.description=="string"?t.description:null,stars:typeof t.stars=="number"?t.stars:0,forks:typeof t.forks=="number"?t.forks:0,language:typeof t.language=="string"?t.language:null,archived:t.archived===!0,avatarUrl:typeof t.avatar_url=="string"?t.avatar_url:""}}function a(o){const n=o.trim();if(!n)return null;let r=n;!r.startsWith("http://")&&!r.startsWith("https://")&&(r=`https://${r}`);try{const e=new URL(r);if(e.hostname.toLowerCase()!=="github.com")return null;const t=e.pathname.split("/").filter(Boolean);if(t.length<2)return null;const i=t[0].toLowerCase();let s=t[1].toLowerCase();return s.endsWith(".git")&&(s=s.slice(0,-4)),`https://github.com/${i}/${s}`}catch{return null}}function f(o,n){const r=a(o),e=a(n);return r&&e?r===e:o.trim()===n.trim()}export{h as f,f as g,a as n,c as p}; diff --git a/assets/github-XgFsJJRC.js b/assets/github-iFSl-B6V.js similarity index 92% rename from assets/github-XgFsJJRC.js rename to assets/github-iFSl-B6V.js index 14ee6e67b6eb0b96afb01c0c43014e078d1aea45..03e0a3e228746cd07bf40cc496babe2afb029aca 100644 --- a/assets/github-XgFsJJRC.js +++ b/assets/github-iFSl-B6V.js @@ -1,4 +1,4 @@ -import{c}from"./index-BrhBTT14.js";/** +import{d as c}from"./index-D_-UZEuL.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/hover-card-BcKGA4Et.js b/assets/hover-card-BcKGA4Et.js deleted file mode 100644 index 16aa9249d16902ddaaf3c55d7283a234857f8401..0000000000000000000000000000000000000000 --- a/assets/hover-card-BcKGA4Et.js +++ /dev/null @@ -1 +0,0 @@ -import{r as n,o as k,j as c,_ as F,$ as I,m as U,q as l,a0 as T,P as O,a1 as $,t as W,p as z,a6 as B,a7 as G,a8 as K,v as q}from"./index-BrhBTT14.js";var E,g="HoverCard",[y]=W(g,[T]),w=T(),[V,S]=y(g),N=e=>{const{__scopeHoverCard:o,children:r,open:s,defaultOpen:a,onOpenChange:i,openDelay:f=700,closeDelay:v=300}=e,d=w(o),C=n.useRef(0),u=n.useRef(0),h=n.useRef(!1),p=n.useRef(!1),[m,t]=k({prop:s,defaultProp:a??!1,onChange:i,caller:g}),x=n.useCallback(()=>{clearTimeout(u.current),C.current=window.setTimeout(()=>t(!0),f)},[f,t]),P=n.useCallback(()=>{clearTimeout(C.current),!h.current&&!p.current&&(u.current=window.setTimeout(()=>t(!1),v))},[v,t]),M=n.useCallback(()=>t(!1),[t]);return n.useEffect(()=>()=>{clearTimeout(C.current),clearTimeout(u.current)},[]),c.jsx(V,{scope:o,open:m,onOpenChange:t,onOpen:x,onClose:P,onDismiss:M,hasSelectionRef:h,isPointerDownOnContentRef:p,children:c.jsx(F,{...d,children:r})})};N.displayName=g;var _="HoverCardTrigger",D=n.forwardRef((e,o)=>{const{__scopeHoverCard:r,...s}=e,a=S(_,r),i=w(r);return c.jsx(I,{asChild:!0,...i,children:c.jsx(U.a,{"data-state":a.open?"open":"closed",...s,ref:o,onPointerEnter:l(e.onPointerEnter,b(a.onOpen)),onPointerLeave:l(e.onPointerLeave,b(a.onClose)),onFocus:l(e.onFocus,a.onOpen),onBlur:l(e.onBlur,a.onClose),onTouchStart:l(e.onTouchStart,f=>f.preventDefault())})})});D.displayName=_;var H="HoverCardPortal",[J,Q]=y(H,{forceMount:void 0}),j=e=>{const{__scopeHoverCard:o,forceMount:r,children:s,container:a}=e,i=S(H,o);return c.jsx(J,{scope:o,forceMount:r,children:c.jsx(O,{present:r||i.open,children:c.jsx($,{asChild:!0,container:a,children:s})})})};j.displayName=H;var R="HoverCardContent",A=n.forwardRef((e,o)=>{const r=Q(R,e.__scopeHoverCard),{forceMount:s=r.forceMount,...a}=e,i=S(R,e.__scopeHoverCard);return c.jsx(O,{present:s||i.open,children:c.jsx(X,{"data-state":i.open?"open":"closed",...a,onPointerEnter:l(e.onPointerEnter,b(i.onOpen)),onPointerLeave:l(e.onPointerLeave,b(i.onClose)),ref:o})})});A.displayName=R;var X=n.forwardRef((e,o)=>{const{__scopeHoverCard:r,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:f,...v}=e,d=S(R,r),C=w(r),u=n.useRef(null),h=z(o,u),[p,m]=n.useState(!1);return n.useEffect(()=>{if(p){const t=document.body;return E=t.style.userSelect||t.style.webkitUserSelect,t.style.userSelect="none",t.style.webkitUserSelect="none",()=>{t.style.userSelect=E,t.style.webkitUserSelect=E}}},[p]),n.useEffect(()=>{if(u.current){const t=()=>{m(!1),d.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var P;((P=document.getSelection())==null?void 0:P.toString())!==""&&(d.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",t),()=>{document.removeEventListener("pointerup",t),d.hasSelectionRef.current=!1,d.isPointerDownOnContentRef.current=!1}}},[d.isPointerDownOnContentRef,d.hasSelectionRef]),n.useEffect(()=>{u.current&&ee(u.current).forEach(x=>x.setAttribute("tabindex","-1"))}),c.jsx(B,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l(i,t=>{t.preventDefault()}),onDismiss:d.onDismiss,children:c.jsx(G,{...C,...v,onPointerDown:l(v.onPointerDown,t=>{t.currentTarget.contains(t.target)&&m(!0),d.hasSelectionRef.current=!1,d.isPointerDownOnContentRef.current=!0}),ref:h,style:{...v.style,userSelect:p?"text":void 0,WebkitUserSelect:p?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),Y="HoverCardArrow",Z=n.forwardRef((e,o)=>{const{__scopeHoverCard:r,...s}=e,a=w(r);return c.jsx(K,{...a,...s,ref:o})});Z.displayName=Y;function b(e){return o=>o.pointerType==="touch"?void 0:e()}function ee(e){const o=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;r.nextNode();)o.push(r.currentNode);return o}var te=N,oe=D,re=j,L=A;const se=te,ce=oe,ne=n.forwardRef(({className:e,align:o="center",sideOffset:r=4,...s},a)=>c.jsx(re,{children:c.jsx(L,{ref:a,align:o,sideOffset:r,className:q("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...s})}));ne.displayName=L.displayName;export{se as H,ce as a,ne as b}; diff --git a/assets/hover-card-DiJQFgx9.js b/assets/hover-card-DiJQFgx9.js new file mode 100644 index 0000000000000000000000000000000000000000..d069a99ce4b1426085b28937ff5fb344eb2dfb81 --- /dev/null +++ b/assets/hover-card-DiJQFgx9.js @@ -0,0 +1 @@ +import{r as n,k as M,j as c,a4 as F,a5 as I,h as U,m as l,a6 as T,P as O,a7 as $,p as W,l as z,ac as B,ad as G,ae as K,q}from"./index-D_-UZEuL.js";var E,g="HoverCard",[y]=W(g,[T]),w=T(),[V,S]=y(g),N=e=>{const{__scopeHoverCard:o,children:r,open:s,defaultOpen:a,onOpenChange:i,openDelay:f=700,closeDelay:v=300}=e,d=w(o),C=n.useRef(0),u=n.useRef(0),h=n.useRef(!1),p=n.useRef(!1),[m,t]=M({prop:s,defaultProp:a??!1,onChange:i,caller:g}),x=n.useCallback(()=>{clearTimeout(u.current),C.current=window.setTimeout(()=>t(!0),f)},[f,t]),P=n.useCallback(()=>{clearTimeout(C.current),!h.current&&!p.current&&(u.current=window.setTimeout(()=>t(!1),v))},[v,t]),k=n.useCallback(()=>t(!1),[t]);return n.useEffect(()=>()=>{clearTimeout(C.current),clearTimeout(u.current)},[]),c.jsx(V,{scope:o,open:m,onOpenChange:t,onOpen:x,onClose:P,onDismiss:k,hasSelectionRef:h,isPointerDownOnContentRef:p,children:c.jsx(F,{...d,children:r})})};N.displayName=g;var _="HoverCardTrigger",D=n.forwardRef((e,o)=>{const{__scopeHoverCard:r,...s}=e,a=S(_,r),i=w(r);return c.jsx(I,{asChild:!0,...i,children:c.jsx(U.a,{"data-state":a.open?"open":"closed",...s,ref:o,onPointerEnter:l(e.onPointerEnter,b(a.onOpen)),onPointerLeave:l(e.onPointerLeave,b(a.onClose)),onFocus:l(e.onFocus,a.onOpen),onBlur:l(e.onBlur,a.onClose),onTouchStart:l(e.onTouchStart,f=>f.preventDefault())})})});D.displayName=_;var H="HoverCardPortal",[J,Q]=y(H,{forceMount:void 0}),j=e=>{const{__scopeHoverCard:o,forceMount:r,children:s,container:a}=e,i=S(H,o);return c.jsx(J,{scope:o,forceMount:r,children:c.jsx(O,{present:r||i.open,children:c.jsx($,{asChild:!0,container:a,children:s})})})};j.displayName=H;var R="HoverCardContent",A=n.forwardRef((e,o)=>{const r=Q(R,e.__scopeHoverCard),{forceMount:s=r.forceMount,...a}=e,i=S(R,e.__scopeHoverCard);return c.jsx(O,{present:s||i.open,children:c.jsx(X,{"data-state":i.open?"open":"closed",...a,onPointerEnter:l(e.onPointerEnter,b(i.onOpen)),onPointerLeave:l(e.onPointerLeave,b(i.onClose)),ref:o})})});A.displayName=R;var X=n.forwardRef((e,o)=>{const{__scopeHoverCard:r,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:f,...v}=e,d=S(R,r),C=w(r),u=n.useRef(null),h=z(o,u),[p,m]=n.useState(!1);return n.useEffect(()=>{if(p){const t=document.body;return E=t.style.userSelect||t.style.webkitUserSelect,t.style.userSelect="none",t.style.webkitUserSelect="none",()=>{t.style.userSelect=E,t.style.webkitUserSelect=E}}},[p]),n.useEffect(()=>{if(u.current){const t=()=>{m(!1),d.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var P;((P=document.getSelection())==null?void 0:P.toString())!==""&&(d.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",t),()=>{document.removeEventListener("pointerup",t),d.hasSelectionRef.current=!1,d.isPointerDownOnContentRef.current=!1}}},[d.isPointerDownOnContentRef,d.hasSelectionRef]),n.useEffect(()=>{u.current&&ee(u.current).forEach(x=>x.setAttribute("tabindex","-1"))}),c.jsx(B,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l(i,t=>{t.preventDefault()}),onDismiss:d.onDismiss,children:c.jsx(G,{...C,...v,onPointerDown:l(v.onPointerDown,t=>{t.currentTarget.contains(t.target)&&m(!0),d.hasSelectionRef.current=!1,d.isPointerDownOnContentRef.current=!0}),ref:h,style:{...v.style,userSelect:p?"text":void 0,WebkitUserSelect:p?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),Y="HoverCardArrow",Z=n.forwardRef((e,o)=>{const{__scopeHoverCard:r,...s}=e,a=w(r);return c.jsx(K,{...a,...s,ref:o})});Z.displayName=Y;function b(e){return o=>o.pointerType==="touch"?void 0:e()}function ee(e){const o=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;r.nextNode();)o.push(r.currentNode);return o}var te=N,oe=D,re=j,L=A;const se=te,ce=oe,ne=n.forwardRef(({className:e,align:o="center",sideOffset:r=4,...s},a)=>c.jsx(re,{children:c.jsx(L,{ref:a,align:o,sideOffset:r,className:q("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...s})}));ne.displayName=L.displayName;export{se as H,ce as a,ne as b}; diff --git a/assets/index-BrhBTT14.js b/assets/index-D_-UZEuL.js similarity index 50% rename from assets/index-BrhBTT14.js rename to assets/index-D_-UZEuL.js index 89d0681aaec3962974926041e77573fcf0b48d66..81de6d65961587efef00dcc7763e3c68239e912b 100644 --- a/assets/index-BrhBTT14.js +++ b/assets/index-D_-UZEuL.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FeedView-L4wL0Zxa.js","assets/components-74u_bIKK.js","assets/LatexTitle-BJSVMlZ1.js","assets/katex.min-BSBacQyE.js","assets/katex-wklAmtGL.css","assets/transform-Duf4Shfn.js","assets/papers-DBaPliAp.js","assets/safeExternalHref-CkBrsh84.js","assets/useIntersectionObserver-Lj6hnXj6.js","assets/chatSessions-Dx6Tu-Jq.js","assets/chevron-down-CKySK_lE.js","assets/useQuery-GhY2LXSI.js","assets/chat-Ck3hlrgT.js","assets/catalog-CkpmYxEk.js","assets/chatPrompts-CDY3UGU1.js","assets/usePapers-C1lfz0oo.js","assets/useInfiniteQuery-bETtM5yS.js","assets/usePeriodFilter-By9tdCWv.js","assets/skeleton-DHdzoBmM.js","assets/alert-c1n3ZtEC.js","assets/ChatView-CdOXetxL.js","assets/ChatMessage-CKuWDpNc.js","assets/hover-card-BcKGA4Et.js","assets/github-BtTCuUR0.js","assets/github-XgFsJJRC.js","assets/PaperPreviewLink-BCdZ9yj3.js","assets/index-BLqBUiom.js","assets/file-text-DROKoLCd.js","assets/openrouter-DzllS15k.js","assets/SharedChatView-CZGxCKbv.js","assets/PapersListView-BYepbpX4.js","assets/useDebounce-DzNGzmqr.js","assets/PaperDetailView-DQZWeXKk.js","assets/ExternalSourceEvalBadge-CXYkyGiT.js","assets/ExternalSourceEvalBadge-DXfuqNnO.css","assets/latexPlainText-DI8YEXVe.js","assets/button-CusGeqPB.js","assets/textarea-D6mDqvzM.js","assets/dialog-BhRZv4T5.js","assets/searchable-select-7qMDVvfT.js","assets/loader-circle-BqZ1qbXL.js","assets/useMutation-DqfuSW7Q.js","assets/submissions-C1hG3qlt.js","assets/SignInToEditDialog-Dcu4wTOX.js","assets/codexAddEvals-BzRfrE5R.js","assets/index-WJQaPd7m.js","assets/savedPapersAuth-D0oFR2zr.js","assets/PaperDetailView-BZHxkTed.css","assets/TagsIndexView-DZXTETvq.js","assets/slug-BpH-Nkvz.js","assets/TaxonomySuggestionTile-BkE17zPJ.js","assets/TagBrowseView-B6A9Mvnz.js","assets/BenchmarkTrendSparkline-5roKNW3d.js","assets/MarkdownText-CNM4Jz9h.js","assets/MethodsIndexView-ooJqtLOL.js","assets/FrameworksIndexView-I7yKuqQY.js","assets/TrendsView-BvtNL0dp.js","assets/ConferencesIndexView-BYCd9xd-.js","assets/AiDeadlinesView-BROI0ZmS.js","assets/switch-DpBsrlqh.js","assets/ConferenceDetailView-BF2p7fm_.js","assets/ConferenceTaskView-ny-_UWtG.js","assets/OrganizationsIndexView-CIxnPMcd.js","assets/OrganizationsIndexView-dniuSNch.css","assets/OrganizationDetailView-7XdyiyeW.js","assets/OrganizationPaperFeed-BFjRG1j0.js","assets/OrganizationContributionGraph-0Wm7L2tv.js","assets/NotFound-CksCbtS8.js","assets/OrganizationTaskView-LqFkQbPW.js","assets/AuthorDetailView-BqQhih_3.js","assets/MethodDetailView-kXZaPUhq.js","assets/BenchmarkDetailView-Cg86MceH.js","assets/BenchmarkDetailView-DS2Mrskn.css","assets/SavedPapersView-DhFWb_wi.js","assets/SettingsView-BGS_66Ni.js","assets/external-link-uK7nAEgd.js","assets/PrivacyView-CcXQdpRo.js","assets/SubmitView-Bq6nl10o.js","assets/CronDashboard-B0A5D1GB.js","assets/shield-alert-BkQ9lngS.js","assets/circle-check-DVQOUjVS.js","assets/CronDashboard-DwChfW9h.css","assets/SubmissionsDashboard-Fm_NO7Rs.js","assets/SubmissionsDashboard-2iSRk_ue.css","assets/UserProfileView-CRGhrhTR.js","assets/RateLimitsView-BcVoE98a.js","assets/SearchOverlay-BRKHPZ6C.js","assets/StagingAccessRequestView-CAvxF8g0.js"])))=>i.map(i=>d[i]); -var E0=Object.defineProperty;var sf=e=>{throw TypeError(e)};var C0=(e,t,n)=>t in e?E0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var tr=(e,t,n)=>C0(e,typeof t!="symbol"?t+"":t,n),pl=(e,t,n)=>t.has(e)||sf("Cannot "+n);var _=(e,t,n)=>(pl(e,t,"read from private field"),n?n.call(e):t.get(e)),J=(e,t,n)=>t.has(e)?sf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),B=(e,t,n,r)=>(pl(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ne=(e,t,n)=>(pl(e,t,"access private method"),n);var Js=(e,t,n,r)=>({set _(o){B(e,t,o,n)},get _(){return _(e,t,r)}});function b0(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();var ZN=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jh={exports:{}},ka={},Ih={exports:{}},Z={};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FeedView-CIK3mTNn.js","assets/components-CmC5jqhM.js","assets/LatexTitle-B7GPgo8C.js","assets/katex.min-BSBacQyE.js","assets/katex-wklAmtGL.css","assets/transform-CUuA-koJ.js","assets/papers-DHqjKX7p.js","assets/safeExternalHref-CkBrsh84.js","assets/useIntersectionObserver-Cq9n7uOQ.js","assets/chatSessions-CPPX7pkh.js","assets/chevron-down-DI19XsBw.js","assets/useQuery-BZo4MZ3s.js","assets/chat-7zW8PrrA.js","assets/catalog-CjU2vAfw.js","assets/chatPrompts-CDY3UGU1.js","assets/usePapers-BCHtBW8G.js","assets/useInfiniteQuery-CFUEkcEs.js","assets/usePeriodFilter-fHKAAcyd.js","assets/skeleton-CCZ1iXls.js","assets/alert-B2j1kc2o.js","assets/ChatView-D5ne7HbB.js","assets/ChatMessage-DwVcq3Ve.js","assets/hover-card-DiJQFgx9.js","assets/github-DQuIliTJ.js","assets/github-iFSl-B6V.js","assets/PaperPreviewLink-B25cD-_k.js","assets/index-vCOH2DKd.js","assets/file-text--vrXMvWb.js","assets/openrouter-DNgcWuY9.js","assets/SharedChatView-gssSniE9.js","assets/PapersListView-DTuy4U-C.js","assets/useDebounce-iJszRYwl.js","assets/PaperDetailView-Dys6fQi8.js","assets/ExternalSourceEvalBadge-25ezslre.js","assets/ExternalSourceEvalBadge-DXfuqNnO.css","assets/latexPlainText-DI8YEXVe.js","assets/button-Cc8PFtC1.js","assets/textarea-DlQmtN_E.js","assets/dialog-ChaQ5z93.js","assets/searchable-select-Dmf1cwUh.js","assets/loader-circle-D1SscQUT.js","assets/useMutation-P0Dg96Vh.js","assets/submissions-BpzsA2lc.js","assets/SignInToEditDialog-DZLQNGaN.js","assets/codexAddEvals-BKeHrC5p.js","assets/index-DlwDDz8H.js","assets/savedPapersAuth-CrQIIpSo.js","assets/PaperDetailView-BZHxkTed.css","assets/PaperReaderView-fLXDbLBc.js","assets/PaperReaderView-Lr_OJaUk.css","assets/TagsIndexView-Zr6z-Y-4.js","assets/slug-BpH-Nkvz.js","assets/TaxonomySuggestionTile-DgDd6ghr.js","assets/TagBrowseView-Dw0_Dir3.js","assets/BenchmarkTrendSparkline-XIo_GVud.js","assets/MarkdownText-QvkQ9FeM.js","assets/MethodsIndexView-geijTR_Z.js","assets/FrameworksIndexView-ByziIlRP.js","assets/TrendsView-Gyl495vi.js","assets/ConferencesIndexView-CNg__9k_.js","assets/AiDeadlinesView-BpSthBaV.js","assets/switch-giaX-T5P.js","assets/ConferenceDetailView-Dbc2ENP6.js","assets/ConferenceTaskView-BAJItIua.js","assets/OrganizationsIndexView-wDeeuR4B.js","assets/OrganizationsIndexView-dniuSNch.css","assets/OrganizationDetailView-B70eYNbJ.js","assets/OrganizationPaperFeed-F7htGhMz.js","assets/OrganizationContributionGraph-BroNa3f8.js","assets/NotFound--BkOSvuh.js","assets/OrganizationTaskView-DdRJ05b_.js","assets/AuthorDetailView-B88e4SG9.js","assets/MethodDetailView-CiYmZ5G6.js","assets/BenchmarkDetailView-C5SE268J.js","assets/BenchmarkDetailView-DS2Mrskn.css","assets/SavedPapersView-Czyc5GTN.js","assets/SettingsView-CbC3PqlO.js","assets/external-link-Dm5dHWqK.js","assets/PrivacyView-BKFNJZvc.js","assets/SubmitView-Bt-NFHA_.js","assets/CronDashboard-BnvHXrkn.js","assets/shield-alert-Dix0M7Y-.js","assets/circle-check-BpugpgkG.js","assets/CronDashboard-DwChfW9h.css","assets/SubmissionsDashboard-DxR4REQK.js","assets/SubmissionsDashboard-2iSRk_ue.css","assets/UserProfileView-flvwm70w.js","assets/RateLimitsView-DckIJRFx.js","assets/SearchOverlay-C4cuTRdQ.js","assets/StagingAccessRequestView-BS5zzPgR.js"])))=>i.map(i=>d[i]); +var b0=Object.defineProperty;var lf=e=>{throw TypeError(e)};var P0=(e,t,n)=>t in e?b0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var tr=(e,t,n)=>P0(e,typeof t!="symbol"?t+"":t,n),pl=(e,t,n)=>t.has(e)||lf("Cannot "+n);var _=(e,t,n)=>(pl(e,t,"read from private field"),n?n.call(e):t.get(e)),J=(e,t,n)=>t.has(e)?lf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),B=(e,t,n,r)=>(pl(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ne=(e,t,n)=>(pl(e,t,"access private method"),n);var ei=(e,t,n,r)=>({set _(o){B(e,t,o,n)},get _(){return _(e,t,r)}});function k0(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();var tA=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ih={exports:{}},ka={},Lh={exports:{}},Z={};/** * @license React * react.production.min.js * @@ -7,7 +7,7 @@ var E0=Object.defineProperty;var sf=e=>{throw TypeError(e)};var C0=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Fs=Symbol.for("react.element"),P0=Symbol.for("react.portal"),k0=Symbol.for("react.fragment"),T0=Symbol.for("react.strict_mode"),R0=Symbol.for("react.profiler"),_0=Symbol.for("react.provider"),N0=Symbol.for("react.context"),A0=Symbol.for("react.forward_ref"),M0=Symbol.for("react.suspense"),O0=Symbol.for("react.memo"),j0=Symbol.for("react.lazy"),af=Symbol.iterator;function I0(e){return e===null||typeof e!="object"?null:(e=af&&e[af]||e["@@iterator"],typeof e=="function"?e:null)}var Lh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Dh=Object.assign,Fh={};function _o(e,t,n){this.props=e,this.context=t,this.refs=Fh,this.updater=n||Lh}_o.prototype.isReactComponent={};_o.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};_o.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function $h(){}$h.prototype=_o.prototype;function Cc(e,t,n){this.props=e,this.context=t,this.refs=Fh,this.updater=n||Lh}var bc=Cc.prototype=new $h;bc.constructor=Cc;Dh(bc,_o.prototype);bc.isPureReactComponent=!0;var lf=Array.isArray,zh=Object.prototype.hasOwnProperty,Pc={current:null},Uh={key:!0,ref:!0,__self:!0,__source:!0};function Vh(e,t,n){var r,o={},s=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(s=""+t.key),t)zh.call(t,r)&&!Uh.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1{throw TypeError(e)};var C0=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var z0=f,U0=Symbol.for("react.element"),V0=Symbol.for("react.fragment"),B0=Object.prototype.hasOwnProperty,W0=z0.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,H0={key:!0,ref:!0,__self:!0,__source:!0};function Wh(e,t,n){var r,o={},s=null,i=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)B0.call(t,r)&&!H0.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:U0,type:e,key:s,ref:i,props:o,_owner:W0.current}}ka.Fragment=V0;ka.jsx=Wh;ka.jsxs=Wh;jh.exports=ka;var m=jh.exports,Hh={exports:{}},st={},Kh={exports:{}},Gh={};/** + */var V0=f,B0=Symbol.for("react.element"),W0=Symbol.for("react.fragment"),H0=Object.prototype.hasOwnProperty,K0=V0.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,G0={key:!0,ref:!0,__self:!0,__source:!0};function Hh(e,t,n){var r,o={},s=null,i=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)H0.call(t,r)&&!G0.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:B0,type:e,key:s,ref:i,props:o,_owner:K0.current}}ka.Fragment=W0;ka.jsx=Hh;ka.jsxs=Hh;Ih.exports=ka;var h=Ih.exports,Kh={exports:{}},st={},Gh={exports:{}},Qh={};/** * @license React * scheduler.production.min.js * @@ -23,7 +23,7 @@ var E0=Object.defineProperty;var sf=e=>{throw TypeError(e)};var C0=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(N,k){var j=N.length;N.push(k);e:for(;0>>1,F=N[U];if(0>>1;Uo(de,j))geo(q,de)?(N[U]=q,N[ge]=j,U=ge):(N[U]=de,N[X]=j,U=X);else if(geo(q,j))N[U]=q,N[ge]=j,U=ge;else break e}}return k}function o(N,k){var j=N.sortIndex-k.sortIndex;return j!==0?j:N.id-k.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var l=[],u=[],c=1,d=null,h=3,p=!1,E=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(N){for(var k=n(u);k!==null;){if(k.callback===null)r(u);else if(k.startTime<=N)r(u),k.sortIndex=k.expirationTime,t(l,k);else break;k=n(u)}}function S(N){if(y=!1,w(N),!E)if(n(l)!==null)E=!0,z(C);else{var k=n(u);k!==null&&W(S,k.startTime-N)}}function C(N,k){E=!1,y&&(y=!1,g(R),R=-1),p=!0;var j=h;try{for(w(k),d=n(l);d!==null&&(!(d.expirationTime>k)||N&&!$());){var U=d.callback;if(typeof U=="function"){d.callback=null,h=d.priorityLevel;var F=U(d.expirationTime<=k);k=e.unstable_now(),typeof F=="function"?d.callback=F:d===n(l)&&r(l),w(k)}else r(l);d=n(l)}if(d!==null)var G=!0;else{var X=n(u);X!==null&&W(S,X.startTime-k),G=!1}return G}finally{d=null,h=j,p=!1}}var b=!1,P=null,R=-1,O=5,M=-1;function $(){return!(e.unstable_now()-MN||125U?(N.sortIndex=j,t(u,N),n(l)===null&&N===n(u)&&(y?(g(R),R=-1):y=!0,W(S,j-U))):(N.sortIndex=F,t(l,N),E||p||(E=!0,z(C))),N},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(N){var k=h;return function(){var j=h;h=k;try{return N.apply(this,arguments)}finally{h=j}}}})(Gh);Kh.exports=Gh;var K0=Kh.exports;/** + */(function(e){function t(N,k){var j=N.length;N.push(k);e:for(;0>>1,F=N[U];if(0>>1;Uo(de,j))geo(q,de)?(N[U]=q,N[ge]=j,U=ge):(N[U]=de,N[X]=j,U=X);else if(geo(q,j))N[U]=q,N[ge]=j,U=ge;else break e}}return k}function o(N,k){var j=N.sortIndex-k.sortIndex;return j!==0?j:N.id-k.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var l=[],u=[],c=1,d=null,m=3,p=!1,E=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(N){for(var k=n(u);k!==null;){if(k.callback===null)r(u);else if(k.startTime<=N)r(u),k.sortIndex=k.expirationTime,t(l,k);else break;k=n(u)}}function S(N){if(y=!1,w(N),!E)if(n(l)!==null)E=!0,z(C);else{var k=n(u);k!==null&&W(S,k.startTime-N)}}function C(N,k){E=!1,y&&(y=!1,g(R),R=-1),p=!0;var j=m;try{for(w(k),d=n(l);d!==null&&(!(d.expirationTime>k)||N&&!$());){var U=d.callback;if(typeof U=="function"){d.callback=null,m=d.priorityLevel;var F=U(d.expirationTime<=k);k=e.unstable_now(),typeof F=="function"?d.callback=F:d===n(l)&&r(l),w(k)}else r(l);d=n(l)}if(d!==null)var G=!0;else{var X=n(u);X!==null&&W(S,X.startTime-k),G=!1}return G}finally{d=null,m=j,p=!1}}var b=!1,P=null,R=-1,O=5,M=-1;function $(){return!(e.unstable_now()-MN||125U?(N.sortIndex=j,t(u,N),n(l)===null&&N===n(u)&&(y?(g(R),R=-1):y=!0,W(S,j-U))):(N.sortIndex=F,t(l,N),E||p||(E=!0,z(C))),N},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(N){var k=m;return function(){var j=m;m=k;try{return N.apply(this,arguments)}finally{m=j}}}})(Qh);Gh.exports=Qh;var Q0=Gh.exports;/** * @license React * react-dom.production.min.js * @@ -31,14 +31,14 @@ var E0=Object.defineProperty;var sf=e=>{throw TypeError(e)};var C0=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var G0=f,ot=K0;function A(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),su=Object.prototype.hasOwnProperty,Q0=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,cf={},df={};function Y0(e){return su.call(df,e)?!0:su.call(cf,e)?!1:Q0.test(e)?df[e]=!0:(cf[e]=!0,!1)}function X0(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function q0(e,t,n,r){if(t===null||typeof t>"u"||X0(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Be(e,t,n,r,o,s,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=i}var Oe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Oe[e]=new Be(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Oe[t]=new Be(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Oe[e]=new Be(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Oe[e]=new Be(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Oe[e]=new Be(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Oe[e]=new Be(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Oe[e]=new Be(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Oe[e]=new Be(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Oe[e]=new Be(e,5,!1,e.toLowerCase(),null,!1,!1)});var Tc=/[\-:]([a-z])/g;function Rc(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Tc,Rc);Oe[t]=new Be(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Tc,Rc);Oe[t]=new Be(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Tc,Rc);Oe[t]=new Be(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Oe[e]=new Be(e,1,!1,e.toLowerCase(),null,!1,!1)});Oe.xlinkHref=new Be("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Oe[e]=new Be(e,1,!1,e.toLowerCase(),null,!0,!0)});function _c(e,t,n,r){var o=Oe.hasOwnProperty(t)?Oe[t]:null;(o!==null?o.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),au=Object.prototype.hasOwnProperty,X0=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ff={},pf={};function q0(e){return au.call(pf,e)?!0:au.call(ff,e)?!1:X0.test(e)?pf[e]=!0:(ff[e]=!0,!1)}function Z0(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function J0(e,t,n,r){if(t===null||typeof t>"u"||Z0(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Be(e,t,n,r,o,s,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=i}var Oe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Oe[e]=new Be(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Oe[t]=new Be(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Oe[e]=new Be(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Oe[e]=new Be(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Oe[e]=new Be(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Oe[e]=new Be(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Oe[e]=new Be(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Oe[e]=new Be(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Oe[e]=new Be(e,5,!1,e.toLowerCase(),null,!1,!1)});var _c=/[\-:]([a-z])/g;function Nc(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(_c,Nc);Oe[t]=new Be(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(_c,Nc);Oe[t]=new Be(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(_c,Nc);Oe[t]=new Be(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Oe[e]=new Be(e,1,!1,e.toLowerCase(),null,!1,!1)});Oe.xlinkHref=new Be("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Oe[e]=new Be(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ac(e,t,n,r){var o=Oe.hasOwnProperty(t)?Oe[t]:null;(o!==null?o.type!==0:r||!(2a||o[i]!==s[a]){var l=` -`+o[i].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=i&&0<=a);break}}}finally{vl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Yo(e):""}function Z0(e){switch(e.tag){case 5:return Yo(e.type);case 16:return Yo("Lazy");case 13:return Yo("Suspense");case 19:return Yo("SuspenseList");case 0:case 2:case 15:return e=gl(e.type,!1),e;case 11:return e=gl(e.type.render,!1),e;case 1:return e=gl(e.type,!0),e;default:return""}}function uu(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ur:return"Fragment";case zr:return"Portal";case iu:return"Profiler";case Nc:return"StrictMode";case au:return"Suspense";case lu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Xh:return(e.displayName||"Context")+".Consumer";case Yh:return(e._context.displayName||"Context")+".Provider";case Ac:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Mc:return t=e.displayName||null,t!==null?t:uu(e.type)||"Memo";case bn:t=e._payload,e=e._init;try{return uu(e(t))}catch{}}return null}function J0(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return uu(t);case 8:return t===Nc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Kn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Zh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ex(e){var t=Zh(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(i){r=""+i,s.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ni(e){e._valueTracker||(e._valueTracker=ex(e))}function Jh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Zh(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Bi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function cu(e,t){var n=t.checked;return me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function pf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Kn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function em(e,t){t=t.checked,t!=null&&_c(e,"checked",t,!1)}function du(e,t){em(e,t);var n=Kn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?fu(e,t.type,n):t.hasOwnProperty("defaultValue")&&fu(e,t.type,Kn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function hf(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function fu(e,t,n){(t!=="number"||Bi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Xo=Array.isArray;function Zr(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=ri.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ds(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var es={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tx=["Webkit","ms","Moz","O"];Object.keys(es).forEach(function(e){tx.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),es[t]=es[e]})});function om(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||es.hasOwnProperty(e)&&es[e]?(""+t).trim():t+"px"}function sm(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=om(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var nx=me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function mu(e,t){if(t){if(nx[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(A(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(A(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(A(61))}if(t.style!=null&&typeof t.style!="object")throw Error(A(62))}}function vu(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gu=null;function Oc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var yu=null,Jr=null,eo=null;function gf(e){if(e=Us(e)){if(typeof yu!="function")throw Error(A(280));var t=e.stateNode;t&&(t=Ma(t),yu(e.stateNode,e.type,t))}}function im(e){Jr?eo?eo.push(e):eo=[e]:Jr=e}function am(){if(Jr){var e=Jr,t=eo;if(eo=Jr=null,gf(e),t)for(e=0;e>>=0,e===0?32:31-(px(e)/hx|0)|0}var oi=64,si=4194304;function qo(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Gi(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,s=e.pingedLanes,i=n&268435455;if(i!==0){var a=i&~o;a!==0?r=qo(a):(s&=i,s!==0&&(r=qo(s)))}else i=n&~o,i!==0?r=qo(i):s!==0&&(r=qo(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,s=t&-t,o>=s||o===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function $s(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tt(t),e[t]=n}function yx(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=ns),kf=" ",Tf=!1;function Tm(e,t){switch(e){case"keyup":return Kx.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Vr=!1;function Qx(e,t){switch(e){case"compositionend":return Rm(t);case"keypress":return t.which!==32?null:(Tf=!0,kf);case"textInput":return e=t.data,e===kf&&Tf?null:e;default:return null}}function Yx(e,t){if(Vr)return e==="compositionend"||!Uc&&Tm(e,t)?(e=Pm(),_i=Fc=jn=null,Vr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Af(n)}}function Mm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Om(){for(var e=window,t=Bi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Bi(e.document)}return t}function Vc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function o1(e){var t=Om(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Mm(n.ownerDocument.documentElement,n)){if(r!==null&&Vc(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,s=Math.min(r.start,o);r=r.end===void 0?s:Math.min(r.end,o),!e.extend&&s>r&&(o=r,r=s,s=o),o=Mf(n,s);var i=Mf(n,r);o&&i&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Br=null,bu=null,os=null,Pu=!1;function Of(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pu||Br==null||Br!==Bi(r)||(r=Br,"selectionStart"in r&&Vc(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),os&&gs(os,r)||(os=r,r=Xi(bu,"onSelect"),0Kr||(e.current=Au[Kr],Au[Kr]=null,Kr--)}function se(e,t){Kr++,Au[Kr]=e.current,e.current=t}var Gn={},Fe=qn(Gn),Qe=qn(!1),gr=Gn;function yo(e,t){var n=e.type.contextTypes;if(!n)return Gn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},s;for(s in n)o[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Ye(e){return e=e.childContextTypes,e!=null}function Zi(){le(Qe),le(Fe)}function zf(e,t,n){if(Fe.current!==Gn)throw Error(A(168));se(Fe,t),se(Qe,n)}function Vm(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(A(108,J0(e)||"Unknown",o));return me({},n,r)}function Ji(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Gn,gr=Fe.current,se(Fe,e),se(Qe,Qe.current),!0}function Uf(e,t,n){var r=e.stateNode;if(!r)throw Error(A(169));n?(e=Vm(e,t,gr),r.__reactInternalMemoizedMergedChildContext=e,le(Qe),le(Fe),se(Fe,e)):le(Qe),se(Qe,n)}var Zt=null,Oa=!1,Al=!1;function Bm(e){Zt===null?Zt=[e]:Zt.push(e)}function v1(e){Oa=!0,Bm(e)}function Zn(){if(!Al&&Zt!==null){Al=!0;var e=0,t=re;try{var n=Zt;for(re=1;e>=i,o-=i,en=1<<32-Tt(t)+o|n<R?(O=P,P=null):O=P.sibling;var M=h(g,P,w[R],S);if(M===null){P===null&&(P=O);break}e&&P&&M.alternate===null&&t(g,P),v=s(M,v,R),b===null?C=M:b.sibling=M,b=M,P=O}if(R===w.length)return n(g,P),ce&&or(g,R),C;if(P===null){for(;RR?(O=P,P=null):O=P.sibling;var $=h(g,P,M.value,S);if($===null){P===null&&(P=O);break}e&&P&&$.alternate===null&&t(g,P),v=s($,v,R),b===null?C=$:b.sibling=$,b=$,P=O}if(M.done)return n(g,P),ce&&or(g,R),C;if(P===null){for(;!M.done;R++,M=w.next())M=d(g,M.value,S),M!==null&&(v=s(M,v,R),b===null?C=M:b.sibling=M,b=M);return ce&&or(g,R),C}for(P=r(g,P);!M.done;R++,M=w.next())M=p(P,g,R,M.value,S),M!==null&&(e&&M.alternate!==null&&P.delete(M.key===null?R:M.key),v=s(M,v,R),b===null?C=M:b.sibling=M,b=M);return e&&P.forEach(function(L){return t(g,L)}),ce&&or(g,R),C}function x(g,v,w,S){if(typeof w=="object"&&w!==null&&w.type===Ur&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case ti:e:{for(var C=w.key,b=v;b!==null;){if(b.key===C){if(C=w.type,C===Ur){if(b.tag===7){n(g,b.sibling),v=o(b,w.props.children),v.return=g,g=v;break e}}else if(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===bn&&Wf(C)===b.type){n(g,b.sibling),v=o(b,w.props),v.ref=Bo(g,b,w),v.return=g,g=v;break e}n(g,b);break}else t(g,b);b=b.sibling}w.type===Ur?(v=vr(w.props.children,g.mode,S,w.key),v.return=g,g=v):(S=Di(w.type,w.key,w.props,null,g.mode,S),S.ref=Bo(g,v,w),S.return=g,g=S)}return i(g);case zr:e:{for(b=w.key;v!==null;){if(v.key===b)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(g,v.sibling),v=o(v,w.children||[]),v.return=g,g=v;break e}else{n(g,v);break}else t(g,v);v=v.sibling}v=$l(w,g.mode,S),v.return=g,g=v}return i(g);case bn:return b=w._init,x(g,v,b(w._payload),S)}if(Xo(w))return E(g,v,w,S);if(Fo(w))return y(g,v,w,S);fi(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(g,v.sibling),v=o(v,w),v.return=g,g=v):(n(g,v),v=Fl(w,g.mode,S),v.return=g,g=v),i(g)):n(g,v)}return x}var xo=Gm(!0),Qm=Gm(!1),na=qn(null),ra=null,Yr=null,Kc=null;function Gc(){Kc=Yr=ra=null}function Qc(e){var t=na.current;le(na),e._currentValue=t}function ju(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function no(e,t){ra=e,Kc=Yr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ge=!0),e.firstContext=null)}function ht(e){var t=e._currentValue;if(Kc!==e)if(e={context:e,memoizedValue:t,next:null},Yr===null){if(ra===null)throw Error(A(308));Yr=e,ra.dependencies={lanes:0,firstContext:e}}else Yr=Yr.next=e;return t}var ar=null;function Yc(e){ar===null?ar=[e]:ar.push(e)}function Ym(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Yc(t)):(n.next=o.next,o.next=n),t.interleaved=n,sn(e,r)}function sn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Pn=!1;function Xc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xm(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function nn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Un(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,te&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,sn(e,n)}return o=r.interleaved,o===null?(t.next=t,Yc(r)):(t.next=o.next,o.next=t),r.interleaved=t,sn(e,n)}function Ai(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ic(e,n)}}function Hf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?o=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?o=s=t:s=s.next=t}else o=s=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function oa(e,t,n,r){var o=e.updateQueue;Pn=!1;var s=o.firstBaseUpdate,i=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,u=l.next;l.next=null,i===null?s=u:i.next=u,i=l;var c=e.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==i&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(s!==null){var d=o.baseState;i=0,c=u=l=null,a=s;do{var h=a.lane,p=a.eventTime;if((r&h)===h){c!==null&&(c=c.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var E=e,y=a;switch(h=t,p=n,y.tag){case 1:if(E=y.payload,typeof E=="function"){d=E.call(p,d,h);break e}d=E;break e;case 3:E.flags=E.flags&-65537|128;case 0:if(E=y.payload,h=typeof E=="function"?E.call(p,d,h):E,h==null)break e;d=me({},d,h);break e;case 2:Pn=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=o.effects,h===null?o.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=p,l=d):c=c.next=p,i|=h;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;h=a,a=h.next,h.next=null,o.lastBaseUpdate=h,o.shared.pending=null}}while(!0);if(c===null&&(l=d),o.baseState=l,o.firstBaseUpdate=u,o.lastBaseUpdate=c,t=o.shared.interleaved,t!==null){o=t;do i|=o.lane,o=o.next;while(o!==t)}else s===null&&(o.shared.lanes=0);xr|=i,e.lanes=i,e.memoizedState=d}}function Kf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ol.transition;Ol.transition={};try{e(!1),t()}finally{re=n,Ol.transition=r}}function pv(){return mt().memoizedState}function x1(e,t,n){var r=Bn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},hv(e))mv(t,n);else if(n=Ym(e,t,n,r),n!==null){var o=Ue();Rt(n,e,r,o),vv(n,t,r)}}function S1(e,t,n){var r=Bn(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(hv(e))mv(t,o);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var i=t.lastRenderedState,a=s(i,n);if(o.hasEagerState=!0,o.eagerState=a,_t(a,i)){var l=t.interleaved;l===null?(o.next=o,Yc(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=Ym(e,t,o,r),n!==null&&(o=Ue(),Rt(n,e,r,o),vv(n,t,r))}}function hv(e){var t=e.alternate;return e===pe||t!==null&&t===pe}function mv(e,t){ss=ia=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function vv(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ic(e,n)}}var aa={readContext:ht,useCallback:je,useContext:je,useEffect:je,useImperativeHandle:je,useInsertionEffect:je,useLayoutEffect:je,useMemo:je,useReducer:je,useRef:je,useState:je,useDebugValue:je,useDeferredValue:je,useTransition:je,useMutableSource:je,useSyncExternalStore:je,useId:je,unstable_isNewReconciler:!1},E1={readContext:ht,useCallback:function(e,t){return Lt().memoizedState=[e,t===void 0?null:t],e},useContext:ht,useEffect:Qf,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Oi(4194308,4,lv.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Oi(4194308,4,e,t)},useInsertionEffect:function(e,t){return Oi(4,2,e,t)},useMemo:function(e,t){var n=Lt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Lt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=x1.bind(null,pe,e),[r.memoizedState,e]},useRef:function(e){var t=Lt();return e={current:e},t.memoizedState=e},useState:Gf,useDebugValue:od,useDeferredValue:function(e){return Lt().memoizedState=e},useTransition:function(){var e=Gf(!1),t=e[0];return e=w1.bind(null,e[1]),Lt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=pe,o=Lt();if(ce){if(n===void 0)throw Error(A(407));n=n()}else{if(n=t(),Te===null)throw Error(A(349));wr&30||ev(r,t,n)}o.memoizedState=n;var s={value:n,getSnapshot:t};return o.queue=s,Qf(nv.bind(null,r,s,e),[e]),r.flags|=2048,Ps(9,tv.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Lt(),t=Te.identifierPrefix;if(ce){var n=tn,r=en;n=(r&~(1<<32-Tt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Cs++,0")&&(l=l.replace("",e.displayName)),l}while(1<=i&&0<=a);break}}}finally{vl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Yo(e):""}function ex(e){switch(e.tag){case 5:return Yo(e.type);case 16:return Yo("Lazy");case 13:return Yo("Suspense");case 19:return Yo("SuspenseList");case 0:case 2:case 15:return e=gl(e.type,!1),e;case 11:return e=gl(e.type.render,!1),e;case 1:return e=gl(e.type,!0),e;default:return""}}function du(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ur:return"Fragment";case zr:return"Portal";case lu:return"Profiler";case Mc:return"StrictMode";case uu:return"Suspense";case cu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case qh:return(e.displayName||"Context")+".Consumer";case Xh:return(e._context.displayName||"Context")+".Provider";case Oc:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case jc:return t=e.displayName||null,t!==null?t:du(e.type)||"Memo";case bn:t=e._payload,e=e._init;try{return du(e(t))}catch{}}return null}function tx(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return du(t);case 8:return t===Mc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Kn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Jh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function nx(e){var t=Jh(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(i){r=""+i,s.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ri(e){e._valueTracker||(e._valueTracker=nx(e))}function em(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Jh(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Wi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function fu(e,t){var n=t.checked;return me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function mf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Kn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function tm(e,t){t=t.checked,t!=null&&Ac(e,"checked",t,!1)}function pu(e,t){tm(e,t);var n=Kn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?hu(e,t.type,n):t.hasOwnProperty("defaultValue")&&hu(e,t.type,Kn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function vf(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function hu(e,t,n){(t!=="number"||Wi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Xo=Array.isArray;function Zr(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=oi.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ds(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var es={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rx=["Webkit","ms","Moz","O"];Object.keys(es).forEach(function(e){rx.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),es[t]=es[e]})});function sm(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||es.hasOwnProperty(e)&&es[e]?(""+t).trim():t+"px"}function im(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=sm(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var ox=me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function gu(e,t){if(t){if(ox[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(A(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(A(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(A(61))}if(t.style!=null&&typeof t.style!="object")throw Error(A(62))}}function yu(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wu=null;function Ic(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xu=null,Jr=null,eo=null;function wf(e){if(e=Vs(e)){if(typeof xu!="function")throw Error(A(280));var t=e.stateNode;t&&(t=Ma(t),xu(e.stateNode,e.type,t))}}function am(e){Jr?eo?eo.push(e):eo=[e]:Jr=e}function lm(){if(Jr){var e=Jr,t=eo;if(eo=Jr=null,wf(e),t)for(e=0;e>>=0,e===0?32:31-(mx(e)/vx|0)|0}var si=64,ii=4194304;function qo(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Qi(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,s=e.pingedLanes,i=n&268435455;if(i!==0){var a=i&~o;a!==0?r=qo(a):(s&=i,s!==0&&(r=qo(s)))}else i=n&~o,i!==0?r=qo(i):s!==0&&(r=qo(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,s=t&-t,o>=s||o===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function zs(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tt(t),e[t]=n}function xx(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=ns),Rf=" ",_f=!1;function Rm(e,t){switch(e){case"keyup":return Qx.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _m(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Vr=!1;function Xx(e,t){switch(e){case"compositionend":return _m(t);case"keypress":return t.which!==32?null:(_f=!0,Rf);case"textInput":return e=t.data,e===Rf&&_f?null:e;default:return null}}function qx(e,t){if(Vr)return e==="compositionend"||!Bc&&Rm(e,t)?(e=km(),Ni=zc=jn=null,Vr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Of(n)}}function Om(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Om(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jm(){for(var e=window,t=Wi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Wi(e.document)}return t}function Wc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function i1(e){var t=jm(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Om(n.ownerDocument.documentElement,n)){if(r!==null&&Wc(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,s=Math.min(r.start,o);r=r.end===void 0?s:Math.min(r.end,o),!e.extend&&s>r&&(o=r,r=s,s=o),o=jf(n,s);var i=jf(n,r);o&&i&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Br=null,ku=null,os=null,Tu=!1;function If(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Tu||Br==null||Br!==Wi(r)||(r=Br,"selectionStart"in r&&Wc(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),os&&gs(os,r)||(os=r,r=qi(ku,"onSelect"),0Kr||(e.current=Ou[Kr],Ou[Kr]=null,Kr--)}function se(e,t){Kr++,Ou[Kr]=e.current,e.current=t}var Gn={},Fe=qn(Gn),Qe=qn(!1),gr=Gn;function yo(e,t){var n=e.type.contextTypes;if(!n)return Gn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},s;for(s in n)o[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Ye(e){return e=e.childContextTypes,e!=null}function Ji(){le(Qe),le(Fe)}function Vf(e,t,n){if(Fe.current!==Gn)throw Error(A(168));se(Fe,t),se(Qe,n)}function Bm(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(A(108,tx(e)||"Unknown",o));return me({},n,r)}function ea(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Gn,gr=Fe.current,se(Fe,e),se(Qe,Qe.current),!0}function Bf(e,t,n){var r=e.stateNode;if(!r)throw Error(A(169));n?(e=Bm(e,t,gr),r.__reactInternalMemoizedMergedChildContext=e,le(Qe),le(Fe),se(Fe,e)):le(Qe),se(Qe,n)}var Zt=null,Oa=!1,Al=!1;function Wm(e){Zt===null?Zt=[e]:Zt.push(e)}function y1(e){Oa=!0,Wm(e)}function Zn(){if(!Al&&Zt!==null){Al=!0;var e=0,t=re;try{var n=Zt;for(re=1;e>=i,o-=i,en=1<<32-Tt(t)+o|n<R?(O=P,P=null):O=P.sibling;var M=m(g,P,w[R],S);if(M===null){P===null&&(P=O);break}e&&P&&M.alternate===null&&t(g,P),v=s(M,v,R),b===null?C=M:b.sibling=M,b=M,P=O}if(R===w.length)return n(g,P),ce&&or(g,R),C;if(P===null){for(;RR?(O=P,P=null):O=P.sibling;var $=m(g,P,M.value,S);if($===null){P===null&&(P=O);break}e&&P&&$.alternate===null&&t(g,P),v=s($,v,R),b===null?C=$:b.sibling=$,b=$,P=O}if(M.done)return n(g,P),ce&&or(g,R),C;if(P===null){for(;!M.done;R++,M=w.next())M=d(g,M.value,S),M!==null&&(v=s(M,v,R),b===null?C=M:b.sibling=M,b=M);return ce&&or(g,R),C}for(P=r(g,P);!M.done;R++,M=w.next())M=p(P,g,R,M.value,S),M!==null&&(e&&M.alternate!==null&&P.delete(M.key===null?R:M.key),v=s(M,v,R),b===null?C=M:b.sibling=M,b=M);return e&&P.forEach(function(L){return t(g,L)}),ce&&or(g,R),C}function x(g,v,w,S){if(typeof w=="object"&&w!==null&&w.type===Ur&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case ni:e:{for(var C=w.key,b=v;b!==null;){if(b.key===C){if(C=w.type,C===Ur){if(b.tag===7){n(g,b.sibling),v=o(b,w.props.children),v.return=g,g=v;break e}}else if(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===bn&&Kf(C)===b.type){n(g,b.sibling),v=o(b,w.props),v.ref=Bo(g,b,w),v.return=g,g=v;break e}n(g,b);break}else t(g,b);b=b.sibling}w.type===Ur?(v=vr(w.props.children,g.mode,S,w.key),v.return=g,g=v):(S=Fi(w.type,w.key,w.props,null,g.mode,S),S.ref=Bo(g,v,w),S.return=g,g=S)}return i(g);case zr:e:{for(b=w.key;v!==null;){if(v.key===b)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(g,v.sibling),v=o(v,w.children||[]),v.return=g,g=v;break e}else{n(g,v);break}else t(g,v);v=v.sibling}v=$l(w,g.mode,S),v.return=g,g=v}return i(g);case bn:return b=w._init,x(g,v,b(w._payload),S)}if(Xo(w))return E(g,v,w,S);if(Fo(w))return y(g,v,w,S);pi(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(g,v.sibling),v=o(v,w),v.return=g,g=v):(n(g,v),v=Fl(w,g.mode,S),v.return=g,g=v),i(g)):n(g,v)}return x}var xo=Qm(!0),Ym=Qm(!1),ra=qn(null),oa=null,Yr=null,Qc=null;function Yc(){Qc=Yr=oa=null}function Xc(e){var t=ra.current;le(ra),e._currentValue=t}function Lu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function no(e,t){oa=e,Qc=Yr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ge=!0),e.firstContext=null)}function ht(e){var t=e._currentValue;if(Qc!==e)if(e={context:e,memoizedValue:t,next:null},Yr===null){if(oa===null)throw Error(A(308));Yr=e,oa.dependencies={lanes:0,firstContext:e}}else Yr=Yr.next=e;return t}var ar=null;function qc(e){ar===null?ar=[e]:ar.push(e)}function Xm(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,qc(t)):(n.next=o.next,o.next=n),t.interleaved=n,sn(e,r)}function sn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Pn=!1;function Zc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function qm(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function nn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Un(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,te&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,sn(e,n)}return o=r.interleaved,o===null?(t.next=t,qc(r)):(t.next=o.next,o.next=t),r.interleaved=t,sn(e,n)}function Mi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Dc(e,n)}}function Gf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?o=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?o=s=t:s=s.next=t}else o=s=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function sa(e,t,n,r){var o=e.updateQueue;Pn=!1;var s=o.firstBaseUpdate,i=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,u=l.next;l.next=null,i===null?s=u:i.next=u,i=l;var c=e.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==i&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(s!==null){var d=o.baseState;i=0,c=u=l=null,a=s;do{var m=a.lane,p=a.eventTime;if((r&m)===m){c!==null&&(c=c.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var E=e,y=a;switch(m=t,p=n,y.tag){case 1:if(E=y.payload,typeof E=="function"){d=E.call(p,d,m);break e}d=E;break e;case 3:E.flags=E.flags&-65537|128;case 0:if(E=y.payload,m=typeof E=="function"?E.call(p,d,m):E,m==null)break e;d=me({},d,m);break e;case 2:Pn=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,m=o.effects,m===null?o.effects=[a]:m.push(a))}else p={eventTime:p,lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=p,l=d):c=c.next=p,i|=m;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;m=a,a=m.next,m.next=null,o.lastBaseUpdate=m,o.shared.pending=null}}while(!0);if(c===null&&(l=d),o.baseState=l,o.firstBaseUpdate=u,o.lastBaseUpdate=c,t=o.shared.interleaved,t!==null){o=t;do i|=o.lane,o=o.next;while(o!==t)}else s===null&&(o.shared.lanes=0);xr|=i,e.lanes=i,e.memoizedState=d}}function Qf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ol.transition;Ol.transition={};try{e(!1),t()}finally{re=n,Ol.transition=r}}function hv(){return mt().memoizedState}function E1(e,t,n){var r=Bn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},mv(e))vv(t,n);else if(n=Xm(e,t,n,r),n!==null){var o=Ue();Rt(n,e,r,o),gv(n,t,r)}}function C1(e,t,n){var r=Bn(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(mv(e))vv(t,o);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var i=t.lastRenderedState,a=s(i,n);if(o.hasEagerState=!0,o.eagerState=a,_t(a,i)){var l=t.interleaved;l===null?(o.next=o,qc(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=Xm(e,t,o,r),n!==null&&(o=Ue(),Rt(n,e,r,o),gv(n,t,r))}}function mv(e){var t=e.alternate;return e===pe||t!==null&&t===pe}function vv(e,t){ss=aa=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gv(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Dc(e,n)}}var la={readContext:ht,useCallback:je,useContext:je,useEffect:je,useImperativeHandle:je,useInsertionEffect:je,useLayoutEffect:je,useMemo:je,useReducer:je,useRef:je,useState:je,useDebugValue:je,useDeferredValue:je,useTransition:je,useMutableSource:je,useSyncExternalStore:je,useId:je,unstable_isNewReconciler:!1},b1={readContext:ht,useCallback:function(e,t){return Lt().memoizedState=[e,t===void 0?null:t],e},useContext:ht,useEffect:Xf,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ji(4194308,4,uv.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ji(4194308,4,e,t)},useInsertionEffect:function(e,t){return ji(4,2,e,t)},useMemo:function(e,t){var n=Lt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Lt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=E1.bind(null,pe,e),[r.memoizedState,e]},useRef:function(e){var t=Lt();return e={current:e},t.memoizedState=e},useState:Yf,useDebugValue:id,useDeferredValue:function(e){return Lt().memoizedState=e},useTransition:function(){var e=Yf(!1),t=e[0];return e=S1.bind(null,e[1]),Lt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=pe,o=Lt();if(ce){if(n===void 0)throw Error(A(407));n=n()}else{if(n=t(),Te===null)throw Error(A(349));wr&30||tv(r,t,n)}o.memoizedState=n;var s={value:n,getSnapshot:t};return o.queue=s,Xf(rv.bind(null,r,s,e),[e]),r.flags|=2048,Ps(9,nv.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Lt(),t=Te.identifierPrefix;if(ce){var n=tn,r=en;n=(r&~(1<<32-Tt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Cs++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[zt]=t,e[xs]=r,kv(e,t,!1,!1),t.stateNode=e;e:{switch(i=vu(n,r),n){case"dialog":ae("cancel",e),ae("close",e),o=r;break;case"iframe":case"object":case"embed":ae("load",e),o=r;break;case"video":case"audio":for(o=0;oCo&&(t.flags|=128,r=!0,Wo(s,!1),t.lanes=4194304)}else{if(!r)if(e=sa(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Wo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!ce)return Ie(t),null}else 2*xe()-s.renderingStartTime>Co&&n!==1073741824&&(t.flags|=128,r=!0,Wo(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(n=s.last,n!==null?n.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=xe(),t.sibling=null,n=fe.current,se(fe,r?n&1|2:n&1),t):(Ie(t),null);case 22:case 23:return cd(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ze&1073741824&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),null;case 24:return null;case 25:return null}throw Error(A(156,t.tag))}function N1(e,t){switch(Wc(t),t.tag){case 1:return Ye(t.type)&&Zi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return So(),le(Qe),le(Fe),Jc(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Zc(t),null;case 13:if(le(fe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(A(340));wo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return le(fe),null;case 4:return So(),null;case 10:return Qc(t.type._context),null;case 22:case 23:return cd(),null;case 24:return null;default:return null}}var hi=!1,De=!1,A1=typeof WeakSet=="function"?WeakSet:Set,D=null;function Xr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){we(e,t,r)}else n.current=null}function Bu(e,t,n){try{n()}catch(r){we(e,t,r)}}var sp=!1;function M1(e,t){if(ku=Qi,e=Om(),Vc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var i=0,a=-1,l=-1,u=0,c=0,d=e,h=null;t:for(;;){for(var p;d!==n||o!==0&&d.nodeType!==3||(a=i+o),d!==s||r!==0&&d.nodeType!==3||(l=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(p=d.firstChild)!==null;)h=d,d=p;for(;;){if(d===e)break t;if(h===n&&++u===o&&(a=i),h===s&&++c===r&&(l=i),(p=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Tu={focusedElem:e,selectionRange:n},Qi=!1,D=t;D!==null;)if(t=D,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,D=e;else for(;D!==null;){t=D;try{var E=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(E!==null){var y=E.memoizedProps,x=E.memoizedState,g=t.stateNode,v=g.getSnapshotBeforeUpdate(t.elementType===t.type?y:Et(t.type,y),x);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(A(163))}}catch(S){we(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,D=e;break}D=t.return}return E=sp,sp=!1,E}function is(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var s=o.destroy;o.destroy=void 0,s!==void 0&&Bu(t,n,s)}o=o.next}while(o!==r)}}function La(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Wu(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function _v(e){var t=e.alternate;t!==null&&(e.alternate=null,_v(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[zt],delete t[xs],delete t[Nu],delete t[h1],delete t[m1])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Nv(e){return e.tag===5||e.tag===3||e.tag===4}function ip(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Nv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Hu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=qi));else if(r!==4&&(e=e.child,e!==null))for(Hu(e,t,n),e=e.sibling;e!==null;)Hu(e,t,n),e=e.sibling}function Ku(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ku(e,t,n),e=e.sibling;e!==null;)Ku(e,t,n),e=e.sibling}var Ae=null,Pt=!1;function wn(e,t,n){for(n=n.child;n!==null;)Av(e,t,n),n=n.sibling}function Av(e,t,n){if(Bt&&typeof Bt.onCommitFiberUnmount=="function")try{Bt.onCommitFiberUnmount(Ra,n)}catch{}switch(n.tag){case 5:De||Xr(n,t);case 6:var r=Ae,o=Pt;Ae=null,wn(e,t,n),Ae=r,Pt=o,Ae!==null&&(Pt?(e=Ae,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ae.removeChild(n.stateNode));break;case 18:Ae!==null&&(Pt?(e=Ae,n=n.stateNode,e.nodeType===8?Nl(e.parentNode,n):e.nodeType===1&&Nl(e,n),ms(e)):Nl(Ae,n.stateNode));break;case 4:r=Ae,o=Pt,Ae=n.stateNode.containerInfo,Pt=!0,wn(e,t,n),Ae=r,Pt=o;break;case 0:case 11:case 14:case 15:if(!De&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var s=o,i=s.destroy;s=s.tag,i!==void 0&&(s&2||s&4)&&Bu(n,t,i),o=o.next}while(o!==r)}wn(e,t,n);break;case 1:if(!De&&(Xr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){we(n,t,a)}wn(e,t,n);break;case 21:wn(e,t,n);break;case 22:n.mode&1?(De=(r=De)||n.memoizedState!==null,wn(e,t,n),De=r):wn(e,t,n);break;default:wn(e,t,n)}}function ap(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new A1),t.forEach(function(r){var o=U1.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function xt(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=i),r&=~s}if(r=o,r=xe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*j1(r/1960))-r,10e?16:e,In===null)var r=!1;else{if(e=In,In=null,ca=0,te&6)throw Error(A(331));var o=te;for(te|=4,D=e.current;D!==null;){var s=D,i=s.child;if(D.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lxe()-ld?mr(e,0):ad|=n),Xe(e,t)}function $v(e,t){t===0&&(e.mode&1?(t=si,si<<=1,!(si&130023424)&&(si=4194304)):t=1);var n=Ue();e=sn(e,t),e!==null&&($s(e,t,n),Xe(e,n))}function z1(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),$v(e,n)}function U1(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(A(314))}r!==null&&r.delete(t),$v(e,n)}var zv;zv=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qe.current)Ge=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ge=!1,R1(e,t,n);Ge=!!(e.flags&131072)}else Ge=!1,ce&&t.flags&1048576&&Wm(t,ta,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ji(e,t),e=t.pendingProps;var o=yo(t,Fe.current);no(t,n),o=td(null,t,r,e,o,n);var s=nd();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ye(r)?(s=!0,Ji(t)):s=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Xc(t),o.updater=Ia,t.stateNode=o,o._reactInternals=t,Lu(t,r,e,n),t=$u(null,t,r,!0,s,n)):(t.tag=0,ce&&s&&Bc(t),$e(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ji(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=B1(r),e=Et(r,e),o){case 0:t=Fu(null,t,r,e,n);break e;case 1:t=np(null,t,r,e,n);break e;case 11:t=ep(null,t,r,e,n);break e;case 14:t=tp(null,t,r,Et(r.type,e),n);break e}throw Error(A(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Et(r,o),Fu(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Et(r,o),np(e,t,r,o,n);case 3:e:{if(Cv(t),e===null)throw Error(A(387));r=t.pendingProps,s=t.memoizedState,o=s.element,Xm(e,t),oa(t,r,null,n);var i=t.memoizedState;if(r=i.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){o=Eo(Error(A(423)),t),t=rp(e,t,r,n,o);break e}else if(r!==o){o=Eo(Error(A(424)),t),t=rp(e,t,r,n,o);break e}else for(tt=zn(t.stateNode.containerInfo.firstChild),nt=t,ce=!0,kt=null,n=Qm(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(wo(),r===o){t=an(e,t,n);break e}$e(e,t,r,n)}t=t.child}return t;case 5:return qm(t),e===null&&Ou(t),r=t.type,o=t.pendingProps,s=e!==null?e.memoizedProps:null,i=o.children,Ru(r,o)?i=null:s!==null&&Ru(r,s)&&(t.flags|=32),Ev(e,t),$e(e,t,i,n),t.child;case 6:return e===null&&Ou(t),null;case 13:return bv(e,t,n);case 4:return qc(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=xo(t,null,r,n):$e(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Et(r,o),ep(e,t,r,o,n);case 7:return $e(e,t,t.pendingProps,n),t.child;case 8:return $e(e,t,t.pendingProps.children,n),t.child;case 12:return $e(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,s=t.memoizedProps,i=o.value,se(na,r._currentValue),r._currentValue=i,s!==null)if(_t(s.value,i)){if(s.children===o.children&&!Qe.current){t=an(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){i=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=nn(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),ju(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)i=s.type===t.type?null:s.child;else if(s.tag===18){if(i=s.return,i===null)throw Error(A(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),ju(i,n,t),i=s.sibling}else i=s.child;if(i!==null)i.return=s;else for(i=s;i!==null;){if(i===t){i=null;break}if(s=i.sibling,s!==null){s.return=i.return,i=s;break}i=i.return}s=i}$e(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,no(t,n),o=ht(o),r=r(o),t.flags|=1,$e(e,t,r,n),t.child;case 14:return r=t.type,o=Et(r,t.pendingProps),o=Et(r.type,o),tp(e,t,r,o,n);case 15:return xv(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Et(r,o),ji(e,t),t.tag=1,Ye(r)?(e=!0,Ji(t)):e=!1,no(t,n),gv(t,r,o),Lu(t,r,o,n),$u(null,t,r,!0,e,n);case 19:return Pv(e,t,n);case 22:return Sv(e,t,n)}throw Error(A(156,t.tag))};function Uv(e,t){return hm(e,t)}function V1(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dt(e,t,n,r){return new V1(e,t,n,r)}function fd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function B1(e){if(typeof e=="function")return fd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ac)return 11;if(e===Mc)return 14}return 2}function Wn(e,t){var n=e.alternate;return n===null?(n=dt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Di(e,t,n,r,o,s){var i=2;if(r=e,typeof e=="function")fd(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Ur:return vr(n.children,o,s,t);case Nc:i=8,o|=8;break;case iu:return e=dt(12,n,t,o|2),e.elementType=iu,e.lanes=s,e;case au:return e=dt(13,n,t,o),e.elementType=au,e.lanes=s,e;case lu:return e=dt(19,n,t,o),e.elementType=lu,e.lanes=s,e;case qh:return Fa(n,o,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Yh:i=10;break e;case Xh:i=9;break e;case Ac:i=11;break e;case Mc:i=14;break e;case bn:i=16,r=null;break e}throw Error(A(130,e==null?e:typeof e,""))}return t=dt(i,n,t,o),t.elementType=e,t.type=r,t.lanes=s,t}function vr(e,t,n,r){return e=dt(7,e,r,t),e.lanes=n,e}function Fa(e,t,n,r){return e=dt(22,e,r,t),e.elementType=qh,e.lanes=n,e.stateNode={isHidden:!1},e}function Fl(e,t,n){return e=dt(6,e,null,t),e.lanes=n,e}function $l(e,t,n){return t=dt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function W1(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=wl(0),this.expirationTimes=wl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wl(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function pd(e,t,n,r,o,s,i,a,l){return e=new W1(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=dt(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xc(s),e}function H1(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Hv)}catch(e){console.error(e)}}Hv(),Hh.exports=st;var Bs=Hh.exports;const Kv=Oh(Bs);var Gv,mp=Bs;Gv=mp.createRoot,mp.hydrateRoot;var pa=["light","dark"],gd="(prefers-color-scheme: dark)",X1=typeof window>"u",yd=f.createContext(void 0),q1={setTheme:e=>{},themes:[]},Z1=()=>{var e;return(e=f.useContext(yd))!=null?e:q1},J1=e=>f.useContext(yd)?e.children:f.createElement(tS,{...e}),eS=["light","dark"],tS=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:o="theme",themes:s=eS,defaultTheme:i=n?"system":"light",attribute:a="data-theme",value:l,children:u,nonce:c})=>{let[d,h]=f.useState(()=>vp(o,i)),[p,E]=f.useState(()=>vp(o)),y=l?Object.values(l):s,x=f.useCallback(S=>{let C=S;if(!C)return;S==="system"&&n&&(C=gp());let b=l?l[C]:C,P=t?rS():null,R=document.documentElement;if(a==="class"?(R.classList.remove(...y),b&&R.classList.add(b)):b?R.setAttribute(a,b):R.removeAttribute(a),r){let O=pa.includes(i)?i:null,M=pa.includes(C)?C:O;R.style.colorScheme=M}P==null||P()},[]),g=f.useCallback(S=>{let C=typeof S=="function"?S(S):S;h(C);try{localStorage.setItem(o,C)}catch{}},[e]),v=f.useCallback(S=>{let C=gp(S);E(C),d==="system"&&n&&!e&&x("system")},[d,e]);f.useEffect(()=>{let S=window.matchMedia(gd);return S.addListener(v),v(S),()=>S.removeListener(v)},[v]),f.useEffect(()=>{let S=C=>{if(C.key!==o)return;let b=C.newValue||i;g(b)};return window.addEventListener("storage",S),()=>window.removeEventListener("storage",S)},[g]),f.useEffect(()=>{x(e??d)},[e,d]);let w=f.useMemo(()=>({theme:d,setTheme:g,forcedTheme:e,resolvedTheme:d==="system"?p:d,themes:n?[...s,"system"]:s,systemTheme:n?p:void 0}),[d,g,e,p,n,s]);return f.createElement(yd.Provider,{value:w},f.createElement(nS,{forcedTheme:e,disableTransitionOnChange:t,enableSystem:n,enableColorScheme:r,storageKey:o,themes:s,defaultTheme:i,attribute:a,value:l,children:u,attrs:y,nonce:c}),u)},nS=f.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:o,defaultTheme:s,value:i,attrs:a,nonce:l})=>{let u=s==="system",c=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${a.map(E=>`'${E}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,d=o?pa.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(E,y=!1,x=!0)=>{let g=i?i[E]:E,v=y?E+"|| ''":`'${g}'`,w="";return o&&x&&!y&&pa.includes(E)&&(w+=`d.style.colorScheme = '${E}';`),n==="class"?y||g?w+=`c.add(${v})`:w+="null":g&&(w+=`d[s](n,${v})`),w},p=e?`!function(){${c}${h(e)}}()`:r?`!function(){try{${c}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${gd}',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${i?`var x=${JSON.stringify(i)};`:""}${h(i?"x[e]":"e",!0)}}${u?"":"else{"+h(s,!1,!1)+"}"}${d}}catch(e){}}()`:`!function(){try{${c}var e=localStorage.getItem('${t}');if(e){${i?`var x=${JSON.stringify(i)};`:""}${h(i?"x[e]":"e",!0)}}else{${h(s,!1,!1)};}${d}}catch(t){}}();`;return f.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:p}})}),vp=(e,t)=>{if(X1)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},rS=()=>{let e=document.createElement("style");return e.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(e)},1)}},gp=e=>(e||(e=window.matchMedia(gd)),e.matches?"dark":"light");class oS extends T.Component{constructor(){super(...arguments);tr(this,"state",{failed:!1})}static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(n){console.error("The application could not render",n)}render(){return this.state.failed?m.jsx("main",{children:m.jsxs("div",{className:"page",role:"alert",children:[m.jsx("h1",{children:"This page could not load"}),m.jsx("p",{children:"The site may have been updated while this tab was open."}),m.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>window.location.reload(),children:"Reload page"})]})}):this.props.children}}const zl="pwc:chunk-reload-at",Qv=6e4;function sS(e,t){if(!e)return!0;const n=Number(e);return!Number.isFinite(n)||t-n>=Qv}function iS(){if(typeof window>"u")return()=>{};const e=n=>{const r=Date.now();sS(sessionStorage.getItem(zl),r)&&(n.preventDefault(),sessionStorage.setItem(zl,String(r)),window.location.reload())};window.addEventListener("vite:preloadError",e);const t=window.setTimeout(()=>sessionStorage.removeItem(zl),Qv);return()=>{window.removeEventListener("vite:preloadError",e),window.clearTimeout(t)}}const aS="modulepreload",lS=function(e){return"/"+e},yp={},ne=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=Promise.allSettled(n.map(l=>{if(l=lS(l),l in yp)return;yp[l]=!0;const u=l.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${c}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":aS,u||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),u)return new Promise((h,p)=>{d.addEventListener("load",h),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return o.then(i=>{for(const a of i||[])a.status==="rejected"&&s(a.reason);return t().catch(s)})};/** +`+s.stack}return{value:e,source:t,stack:o,digest:null}}function Ll(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function $u(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var T1=typeof WeakMap=="function"?WeakMap:Map;function wv(e,t,n){n=nn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ca||(ca=!0,Yu=r),$u(e,t)},n}function xv(e,t,n){n=nn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){$u(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){$u(e,t),typeof r!="function"&&(Vn===null?Vn=new Set([this]):Vn.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function Jf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new T1;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=U1.bind(null,e,t,n),t.then(e,e))}function ep(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function tp(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=nn(-1,1),t.tag=2,Un(n,t,1))),n.lanes|=1),e)}var R1=cn.ReactCurrentOwner,Ge=!1;function $e(e,t,n,r){t.child=e===null?Ym(t,null,n,r):xo(t,e.child,n,r)}function np(e,t,n,r,o){n=n.render;var s=t.ref;return no(t,o),r=rd(e,t,n,r,s,o),n=od(),e!==null&&!Ge?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,an(e,t,o)):(ce&&n&&Hc(t),t.flags|=1,$e(e,t,r,o),t.child)}function rp(e,t,n,r,o){if(e===null){var s=n.type;return typeof s=="function"&&!hd(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,Sv(e,t,s,r,o)):(e=Fi(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&o)){var i=s.memoizedProps;if(n=n.compare,n=n!==null?n:gs,n(i,r)&&e.ref===t.ref)return an(e,t,o)}return t.flags|=1,e=Wn(s,r),e.ref=t.ref,e.return=t,t.child=e}function Sv(e,t,n,r,o){if(e!==null){var s=e.memoizedProps;if(gs(s,r)&&e.ref===t.ref)if(Ge=!1,t.pendingProps=r=s,(e.lanes&o)!==0)e.flags&131072&&(Ge=!0);else return t.lanes=e.lanes,an(e,t,o)}return zu(e,t,n,r,o)}function Ev(e,t,n){var r=t.pendingProps,o=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},se(qr,Ze),Ze|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,se(qr,Ze),Ze|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,se(qr,Ze),Ze|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,se(qr,Ze),Ze|=r;return $e(e,t,o,n),t.child}function Cv(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function zu(e,t,n,r,o){var s=Ye(n)?gr:Fe.current;return s=yo(t,s),no(t,o),n=rd(e,t,n,r,s,o),r=od(),e!==null&&!Ge?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,an(e,t,o)):(ce&&r&&Hc(t),t.flags|=1,$e(e,t,n,o),t.child)}function op(e,t,n,r,o){if(Ye(n)){var s=!0;ea(t)}else s=!1;if(no(t,o),t.stateNode===null)Ii(e,t),yv(t,n,r),Fu(t,n,r,o),r=!0;else if(e===null){var i=t.stateNode,a=t.memoizedProps;i.props=a;var l=i.context,u=n.contextType;typeof u=="object"&&u!==null?u=ht(u):(u=Ye(n)?gr:Fe.current,u=yo(t,u));var c=n.getDerivedStateFromProps,d=typeof c=="function"||typeof i.getSnapshotBeforeUpdate=="function";d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==r||l!==u)&&Zf(t,i,r,u),Pn=!1;var m=t.memoizedState;i.state=m,sa(t,r,i,o),l=t.memoizedState,a!==r||m!==l||Qe.current||Pn?(typeof c=="function"&&(Du(t,n,c,r),l=t.memoizedState),(a=Pn||qf(t,n,a,r,m,l,u))?(d||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),i.props=r,i.state=l,i.context=u,r=a):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,qm(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Et(t.type,a),i.props=u,d=t.pendingProps,m=i.context,l=n.contextType,typeof l=="object"&&l!==null?l=ht(l):(l=Ye(n)?gr:Fe.current,l=yo(t,l));var p=n.getDerivedStateFromProps;(c=typeof p=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==d||m!==l)&&Zf(t,i,r,l),Pn=!1,m=t.memoizedState,i.state=m,sa(t,r,i,o);var E=t.memoizedState;a!==d||m!==E||Qe.current||Pn?(typeof p=="function"&&(Du(t,n,p,r),E=t.memoizedState),(u=Pn||qf(t,n,u,r,m,E,l)||!1)?(c||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,E,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,E,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=E),i.props=r,i.state=E,i.context=l,r=u):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return Uu(e,t,n,r,s,o)}function Uu(e,t,n,r,o,s){Cv(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return o&&Bf(t,n,!1),an(e,t,s);r=t.stateNode,R1.current=t;var a=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=xo(t,e.child,null,s),t.child=xo(t,null,a,s)):$e(e,t,a,s),t.memoizedState=r.state,o&&Bf(t,n,!0),t.child}function bv(e){var t=e.stateNode;t.pendingContext?Vf(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Vf(e,t.context,!1),Jc(e,t.containerInfo)}function sp(e,t,n,r,o){return wo(),Gc(o),t.flags|=256,$e(e,t,n,r),t.child}var Vu={dehydrated:null,treeContext:null,retryLane:0};function Bu(e){return{baseLanes:e,cachePool:null,transitions:null}}function Pv(e,t,n){var r=t.pendingProps,o=fe.current,s=!1,i=(t.flags&128)!==0,a;if((a=i)||(a=e!==null&&e.memoizedState===null?!1:(o&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),se(fe,o&1),e===null)return Iu(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=r.children,e=r.fallback,s?(r=t.mode,s=t.child,i={mode:"hidden",children:i},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=i):s=Fa(i,r,0,null),e=vr(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Bu(n),t.memoizedState=Vu,e):ad(t,i));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return _1(e,t,i,r,a,o,n);if(s){s=r.fallback,i=t.mode,o=e.child,a=o.sibling;var l={mode:"hidden",children:r.children};return!(i&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Wn(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?s=Wn(a,s):(s=vr(s,i,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,i=e.child.memoizedState,i=i===null?Bu(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},s.memoizedState=i,s.childLanes=e.childLanes&~n,t.memoizedState=Vu,r}return s=e.child,e=s.sibling,r=Wn(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function ad(e,t){return t=Fa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function hi(e,t,n,r){return r!==null&&Gc(r),xo(t,e.child,null,n),e=ad(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _1(e,t,n,r,o,s,i){if(n)return t.flags&256?(t.flags&=-257,r=Ll(Error(A(422))),hi(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,o=t.mode,r=Fa({mode:"visible",children:r.children},o,0,null),s=vr(s,o,i,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&xo(t,e.child,null,i),t.child.memoizedState=Bu(i),t.memoizedState=Vu,s);if(!(t.mode&1))return hi(e,t,i,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(A(419)),r=Ll(s,r,void 0),hi(e,t,i,r)}if(a=(i&e.childLanes)!==0,Ge||a){if(r=Te,r!==null){switch(i&-i){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|i)?0:o,o!==0&&o!==s.retryLane&&(s.retryLane=o,sn(e,o),Rt(r,e,o,-1))}return pd(),r=Ll(Error(A(421))),hi(e,t,i,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=V1.bind(null,e),o._reactRetry=t,null):(e=s.treeContext,tt=zn(o.nextSibling),nt=t,ce=!0,kt=null,e!==null&&(ut[ct++]=en,ut[ct++]=tn,ut[ct++]=yr,en=e.id,tn=e.overflow,yr=t),t=ad(t,r.children),t.flags|=4096,t)}function ip(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Lu(e.return,t,n)}function Dl(e,t,n,r,o){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=o)}function kv(e,t,n){var r=t.pendingProps,o=r.revealOrder,s=r.tail;if($e(e,t,r.children,n),r=fe.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ip(e,n,t);else if(e.tag===19)ip(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(se(fe,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&ia(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Dl(t,!1,o,n,s);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&ia(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Dl(t,!0,n,null,s);break;case"together":Dl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ii(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function an(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),xr|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(A(153));if(t.child!==null){for(e=t.child,n=Wn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Wn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function N1(e,t,n){switch(t.tag){case 3:bv(t),wo();break;case 5:Zm(t);break;case 1:Ye(t.type)&&ea(t);break;case 4:Jc(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;se(ra,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(se(fe,fe.current&1),t.flags|=128,null):n&t.child.childLanes?Pv(e,t,n):(se(fe,fe.current&1),e=an(e,t,n),e!==null?e.sibling:null);se(fe,fe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return kv(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),se(fe,fe.current),r)break;return null;case 22:case 23:return t.lanes=0,Ev(e,t,n)}return an(e,t,n)}var Tv,Wu,Rv,_v;Tv=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Wu=function(){};Rv=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,lr(Wt.current);var s=null;switch(n){case"input":o=fu(e,o),r=fu(e,r),s=[];break;case"select":o=me({},o,{value:void 0}),r=me({},r,{value:void 0}),s=[];break;case"textarea":o=mu(e,o),r=mu(e,r),s=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Zi)}gu(n,r);var i;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var a=o[u];for(i in a)a.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(cs.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(a=o!=null?o[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(i in a)!a.hasOwnProperty(i)||l&&l.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in l)l.hasOwnProperty(i)&&a[i]!==l[i]&&(n||(n={}),n[i]=l[i])}else n||(s||(s=[]),s.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(cs.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&ae("scroll",e),s||a===l||(s=[])):(s=s||[]).push(u,l))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}};_v=function(e,t,n,r){n!==r&&(t.flags|=4)};function Wo(e,t){if(!ce)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ie(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function A1(e,t,n){var r=t.pendingProps;switch(Kc(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(t),null;case 1:return Ye(t.type)&&Ji(),Ie(t),null;case 3:return r=t.stateNode,So(),le(Qe),le(Fe),td(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(fi(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,kt!==null&&(Zu(kt),kt=null))),Wu(e,t),Ie(t),null;case 5:ed(t);var o=lr(Es.current);if(n=t.type,e!==null&&t.stateNode!=null)Rv(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(A(166));return Ie(t),null}if(e=lr(Wt.current),fi(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[zt]=t,r[xs]=s,e=(t.mode&1)!==0,n){case"dialog":ae("cancel",r),ae("close",r);break;case"iframe":case"object":case"embed":ae("load",r);break;case"video":case"audio":for(o=0;o<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[zt]=t,e[xs]=r,Tv(e,t,!1,!1),t.stateNode=e;e:{switch(i=yu(n,r),n){case"dialog":ae("cancel",e),ae("close",e),o=r;break;case"iframe":case"object":case"embed":ae("load",e),o=r;break;case"video":case"audio":for(o=0;oCo&&(t.flags|=128,r=!0,Wo(s,!1),t.lanes=4194304)}else{if(!r)if(e=ia(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Wo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!ce)return Ie(t),null}else 2*xe()-s.renderingStartTime>Co&&n!==1073741824&&(t.flags|=128,r=!0,Wo(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(n=s.last,n!==null?n.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=xe(),t.sibling=null,n=fe.current,se(fe,r?n&1|2:n&1),t):(Ie(t),null);case 22:case 23:return fd(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ze&1073741824&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),null;case 24:return null;case 25:return null}throw Error(A(156,t.tag))}function M1(e,t){switch(Kc(t),t.tag){case 1:return Ye(t.type)&&Ji(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return So(),le(Qe),le(Fe),td(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ed(t),null;case 13:if(le(fe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(A(340));wo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return le(fe),null;case 4:return So(),null;case 10:return Xc(t.type._context),null;case 22:case 23:return fd(),null;case 24:return null;default:return null}}var mi=!1,De=!1,O1=typeof WeakSet=="function"?WeakSet:Set,D=null;function Xr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){we(e,t,r)}else n.current=null}function Hu(e,t,n){try{n()}catch(r){we(e,t,r)}}var ap=!1;function j1(e,t){if(Ru=Yi,e=jm(),Wc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var i=0,a=-1,l=-1,u=0,c=0,d=e,m=null;t:for(;;){for(var p;d!==n||o!==0&&d.nodeType!==3||(a=i+o),d!==s||r!==0&&d.nodeType!==3||(l=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(p=d.firstChild)!==null;)m=d,d=p;for(;;){if(d===e)break t;if(m===n&&++u===o&&(a=i),m===s&&++c===r&&(l=i),(p=d.nextSibling)!==null)break;d=m,m=d.parentNode}d=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(_u={focusedElem:e,selectionRange:n},Yi=!1,D=t;D!==null;)if(t=D,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,D=e;else for(;D!==null;){t=D;try{var E=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(E!==null){var y=E.memoizedProps,x=E.memoizedState,g=t.stateNode,v=g.getSnapshotBeforeUpdate(t.elementType===t.type?y:Et(t.type,y),x);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(A(163))}}catch(S){we(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,D=e;break}D=t.return}return E=ap,ap=!1,E}function is(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var s=o.destroy;o.destroy=void 0,s!==void 0&&Hu(t,n,s)}o=o.next}while(o!==r)}}function La(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ku(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Nv(e){var t=e.alternate;t!==null&&(e.alternate=null,Nv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[zt],delete t[xs],delete t[Mu],delete t[v1],delete t[g1])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Av(e){return e.tag===5||e.tag===3||e.tag===4}function lp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Av(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Zi));else if(r!==4&&(e=e.child,e!==null))for(Gu(e,t,n),e=e.sibling;e!==null;)Gu(e,t,n),e=e.sibling}function Qu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Qu(e,t,n),e=e.sibling;e!==null;)Qu(e,t,n),e=e.sibling}var Ae=null,Pt=!1;function wn(e,t,n){for(n=n.child;n!==null;)Mv(e,t,n),n=n.sibling}function Mv(e,t,n){if(Bt&&typeof Bt.onCommitFiberUnmount=="function")try{Bt.onCommitFiberUnmount(Ra,n)}catch{}switch(n.tag){case 5:De||Xr(n,t);case 6:var r=Ae,o=Pt;Ae=null,wn(e,t,n),Ae=r,Pt=o,Ae!==null&&(Pt?(e=Ae,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ae.removeChild(n.stateNode));break;case 18:Ae!==null&&(Pt?(e=Ae,n=n.stateNode,e.nodeType===8?Nl(e.parentNode,n):e.nodeType===1&&Nl(e,n),ms(e)):Nl(Ae,n.stateNode));break;case 4:r=Ae,o=Pt,Ae=n.stateNode.containerInfo,Pt=!0,wn(e,t,n),Ae=r,Pt=o;break;case 0:case 11:case 14:case 15:if(!De&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var s=o,i=s.destroy;s=s.tag,i!==void 0&&(s&2||s&4)&&Hu(n,t,i),o=o.next}while(o!==r)}wn(e,t,n);break;case 1:if(!De&&(Xr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){we(n,t,a)}wn(e,t,n);break;case 21:wn(e,t,n);break;case 22:n.mode&1?(De=(r=De)||n.memoizedState!==null,wn(e,t,n),De=r):wn(e,t,n);break;default:wn(e,t,n)}}function up(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new O1),t.forEach(function(r){var o=B1.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function xt(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=i),r&=~s}if(r=o,r=xe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*L1(r/1960))-r,10e?16:e,In===null)var r=!1;else{if(e=In,In=null,da=0,te&6)throw Error(A(331));var o=te;for(te|=4,D=e.current;D!==null;){var s=D,i=s.child;if(D.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lxe()-cd?mr(e,0):ud|=n),Xe(e,t)}function zv(e,t){t===0&&(e.mode&1?(t=ii,ii<<=1,!(ii&130023424)&&(ii=4194304)):t=1);var n=Ue();e=sn(e,t),e!==null&&(zs(e,t,n),Xe(e,n))}function V1(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),zv(e,n)}function B1(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(A(314))}r!==null&&r.delete(t),zv(e,n)}var Uv;Uv=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qe.current)Ge=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ge=!1,N1(e,t,n);Ge=!!(e.flags&131072)}else Ge=!1,ce&&t.flags&1048576&&Hm(t,na,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ii(e,t),e=t.pendingProps;var o=yo(t,Fe.current);no(t,n),o=rd(null,t,r,e,o,n);var s=od();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ye(r)?(s=!0,ea(t)):s=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Zc(t),o.updater=Ia,t.stateNode=o,o._reactInternals=t,Fu(t,r,e,n),t=Uu(null,t,r,!0,s,n)):(t.tag=0,ce&&s&&Hc(t),$e(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ii(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=H1(r),e=Et(r,e),o){case 0:t=zu(null,t,r,e,n);break e;case 1:t=op(null,t,r,e,n);break e;case 11:t=np(null,t,r,e,n);break e;case 14:t=rp(null,t,r,Et(r.type,e),n);break e}throw Error(A(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Et(r,o),zu(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Et(r,o),op(e,t,r,o,n);case 3:e:{if(bv(t),e===null)throw Error(A(387));r=t.pendingProps,s=t.memoizedState,o=s.element,qm(e,t),sa(t,r,null,n);var i=t.memoizedState;if(r=i.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){o=Eo(Error(A(423)),t),t=sp(e,t,r,n,o);break e}else if(r!==o){o=Eo(Error(A(424)),t),t=sp(e,t,r,n,o);break e}else for(tt=zn(t.stateNode.containerInfo.firstChild),nt=t,ce=!0,kt=null,n=Ym(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(wo(),r===o){t=an(e,t,n);break e}$e(e,t,r,n)}t=t.child}return t;case 5:return Zm(t),e===null&&Iu(t),r=t.type,o=t.pendingProps,s=e!==null?e.memoizedProps:null,i=o.children,Nu(r,o)?i=null:s!==null&&Nu(r,s)&&(t.flags|=32),Cv(e,t),$e(e,t,i,n),t.child;case 6:return e===null&&Iu(t),null;case 13:return Pv(e,t,n);case 4:return Jc(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=xo(t,null,r,n):$e(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Et(r,o),np(e,t,r,o,n);case 7:return $e(e,t,t.pendingProps,n),t.child;case 8:return $e(e,t,t.pendingProps.children,n),t.child;case 12:return $e(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,s=t.memoizedProps,i=o.value,se(ra,r._currentValue),r._currentValue=i,s!==null)if(_t(s.value,i)){if(s.children===o.children&&!Qe.current){t=an(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){i=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=nn(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Lu(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)i=s.type===t.type?null:s.child;else if(s.tag===18){if(i=s.return,i===null)throw Error(A(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Lu(i,n,t),i=s.sibling}else i=s.child;if(i!==null)i.return=s;else for(i=s;i!==null;){if(i===t){i=null;break}if(s=i.sibling,s!==null){s.return=i.return,i=s;break}i=i.return}s=i}$e(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,no(t,n),o=ht(o),r=r(o),t.flags|=1,$e(e,t,r,n),t.child;case 14:return r=t.type,o=Et(r,t.pendingProps),o=Et(r.type,o),rp(e,t,r,o,n);case 15:return Sv(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Et(r,o),Ii(e,t),t.tag=1,Ye(r)?(e=!0,ea(t)):e=!1,no(t,n),yv(t,r,o),Fu(t,r,o,n),Uu(null,t,r,!0,e,n);case 19:return kv(e,t,n);case 22:return Ev(e,t,n)}throw Error(A(156,t.tag))};function Vv(e,t){return mm(e,t)}function W1(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dt(e,t,n,r){return new W1(e,t,n,r)}function hd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function H1(e){if(typeof e=="function")return hd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Oc)return 11;if(e===jc)return 14}return 2}function Wn(e,t){var n=e.alternate;return n===null?(n=dt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Fi(e,t,n,r,o,s){var i=2;if(r=e,typeof e=="function")hd(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Ur:return vr(n.children,o,s,t);case Mc:i=8,o|=8;break;case lu:return e=dt(12,n,t,o|2),e.elementType=lu,e.lanes=s,e;case uu:return e=dt(13,n,t,o),e.elementType=uu,e.lanes=s,e;case cu:return e=dt(19,n,t,o),e.elementType=cu,e.lanes=s,e;case Zh:return Fa(n,o,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Xh:i=10;break e;case qh:i=9;break e;case Oc:i=11;break e;case jc:i=14;break e;case bn:i=16,r=null;break e}throw Error(A(130,e==null?e:typeof e,""))}return t=dt(i,n,t,o),t.elementType=e,t.type=r,t.lanes=s,t}function vr(e,t,n,r){return e=dt(7,e,r,t),e.lanes=n,e}function Fa(e,t,n,r){return e=dt(22,e,r,t),e.elementType=Zh,e.lanes=n,e.stateNode={isHidden:!1},e}function Fl(e,t,n){return e=dt(6,e,null,t),e.lanes=n,e}function $l(e,t,n){return t=dt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function K1(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=wl(0),this.expirationTimes=wl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wl(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function md(e,t,n,r,o,s,i,a,l){return e=new K1(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=dt(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zc(s),e}function G1(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Kv)}catch(e){console.error(e)}}Kv(),Kh.exports=st;var Ws=Kh.exports;const Gv=jh(Ws);var Qv,gp=Ws;Qv=gp.createRoot,gp.hydrateRoot;var ha=["light","dark"],wd="(prefers-color-scheme: dark)",Z1=typeof window>"u",xd=f.createContext(void 0),J1={setTheme:e=>{},themes:[]},eS=()=>{var e;return(e=f.useContext(xd))!=null?e:J1},tS=e=>f.useContext(xd)?e.children:f.createElement(rS,{...e}),nS=["light","dark"],rS=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:o="theme",themes:s=nS,defaultTheme:i=n?"system":"light",attribute:a="data-theme",value:l,children:u,nonce:c})=>{let[d,m]=f.useState(()=>yp(o,i)),[p,E]=f.useState(()=>yp(o)),y=l?Object.values(l):s,x=f.useCallback(S=>{let C=S;if(!C)return;S==="system"&&n&&(C=wp());let b=l?l[C]:C,P=t?sS():null,R=document.documentElement;if(a==="class"?(R.classList.remove(...y),b&&R.classList.add(b)):b?R.setAttribute(a,b):R.removeAttribute(a),r){let O=ha.includes(i)?i:null,M=ha.includes(C)?C:O;R.style.colorScheme=M}P==null||P()},[]),g=f.useCallback(S=>{let C=typeof S=="function"?S(S):S;m(C);try{localStorage.setItem(o,C)}catch{}},[e]),v=f.useCallback(S=>{let C=wp(S);E(C),d==="system"&&n&&!e&&x("system")},[d,e]);f.useEffect(()=>{let S=window.matchMedia(wd);return S.addListener(v),v(S),()=>S.removeListener(v)},[v]),f.useEffect(()=>{let S=C=>{if(C.key!==o)return;let b=C.newValue||i;g(b)};return window.addEventListener("storage",S),()=>window.removeEventListener("storage",S)},[g]),f.useEffect(()=>{x(e??d)},[e,d]);let w=f.useMemo(()=>({theme:d,setTheme:g,forcedTheme:e,resolvedTheme:d==="system"?p:d,themes:n?[...s,"system"]:s,systemTheme:n?p:void 0}),[d,g,e,p,n,s]);return f.createElement(xd.Provider,{value:w},f.createElement(oS,{forcedTheme:e,disableTransitionOnChange:t,enableSystem:n,enableColorScheme:r,storageKey:o,themes:s,defaultTheme:i,attribute:a,value:l,children:u,attrs:y,nonce:c}),u)},oS=f.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:o,defaultTheme:s,value:i,attrs:a,nonce:l})=>{let u=s==="system",c=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${a.map(E=>`'${E}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,d=o?ha.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",m=(E,y=!1,x=!0)=>{let g=i?i[E]:E,v=y?E+"|| ''":`'${g}'`,w="";return o&&x&&!y&&ha.includes(E)&&(w+=`d.style.colorScheme = '${E}';`),n==="class"?y||g?w+=`c.add(${v})`:w+="null":g&&(w+=`d[s](n,${v})`),w},p=e?`!function(){${c}${m(e)}}()`:r?`!function(){try{${c}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${wd}',m=window.matchMedia(t);if(m.media!==t||m.matches){${m("dark")}}else{${m("light")}}}else if(e){${i?`var x=${JSON.stringify(i)};`:""}${m(i?"x[e]":"e",!0)}}${u?"":"else{"+m(s,!1,!1)+"}"}${d}}catch(e){}}()`:`!function(){try{${c}var e=localStorage.getItem('${t}');if(e){${i?`var x=${JSON.stringify(i)};`:""}${m(i?"x[e]":"e",!0)}}else{${m(s,!1,!1)};}${d}}catch(t){}}();`;return f.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:p}})}),yp=(e,t)=>{if(Z1)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},sS=()=>{let e=document.createElement("style");return e.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(e)},1)}},wp=e=>(e||(e=window.matchMedia(wd)),e.matches?"dark":"light");class iS extends T.Component{constructor(){super(...arguments);tr(this,"state",{failed:!1})}static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(n){console.error("The application could not render",n)}render(){return this.state.failed?h.jsx("main",{children:h.jsxs("div",{className:"page",role:"alert",children:[h.jsx("h1",{children:"This page could not load"}),h.jsx("p",{children:"The site may have been updated while this tab was open."}),h.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>window.location.reload(),children:"Reload page"})]})}):this.props.children}}const zl="pwc:chunk-reload-at",Yv=6e4;function aS(e,t){if(!e)return!0;const n=Number(e);return!Number.isFinite(n)||t-n>=Yv}function lS(){if(typeof window>"u")return()=>{};const e=n=>{const r=Date.now();aS(sessionStorage.getItem(zl),r)&&(n.preventDefault(),sessionStorage.setItem(zl,String(r)),window.location.reload())};window.addEventListener("vite:preloadError",e);const t=window.setTimeout(()=>sessionStorage.removeItem(zl),Yv);return()=>{window.removeEventListener("vite:preloadError",e),window.clearTimeout(t)}}const uS="modulepreload",cS=function(e){return"/"+e},xp={},ne=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=Promise.allSettled(n.map(l=>{if(l=cS(l),l in xp)return;xp[l]=!0;const u=l.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${c}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":uS,u||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),u)return new Promise((m,p)=>{d.addEventListener("load",m),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return o.then(i=>{for(const a of i||[])a.status==="rejected"&&s(a.reason);return t().catch(s)})};/** * @remix-run/router v1.23.2 * * Copyright (c) Remix Software Inc. @@ -47,7 +47,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Ts(){return Ts=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Ba(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function dS(){return Math.random().toString(36).substr(2,8)}function xp(e,t){return{usr:e.state,key:e.key,idx:t}}function ha(e,t,n,r){return n===void 0&&(n=null),Ts({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Pr(t):t,{state:n,key:t&&t.key||r||dS()})}function Rs(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Pr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Yv(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:s=!1}=r,i=o.history,a=Ln.Pop,l=null,u=c();u==null&&(u=0,i.replaceState(Ts({},i.state,{idx:u}),""));function c(){return(i.state||{idx:null}).idx}function d(){a=Ln.Pop;let x=c(),g=x==null?null:x-u;u=x,l&&l({action:a,location:y.location,delta:g})}function h(x,g){a=Ln.Push;let v=ha(y.location,x,g);n&&n(v,x),u=c()+1;let w=xp(v,u),S=y.createHref(v);try{i.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;o.location.assign(S)}s&&l&&l({action:a,location:y.location,delta:1})}function p(x,g){a=Ln.Replace;let v=ha(y.location,x,g);n&&n(v,x),u=c();let w=xp(v,u),S=y.createHref(v);i.replaceState(w,"",S),s&&l&&l({action:a,location:y.location,delta:0})}function E(x){let g=o.location.origin!=="null"?o.location.origin:o.location.href,v=typeof x=="string"?x:Rs(x);return v=v.replace(/ $/,"%20"),he(g,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,g)}let y={get action(){return a},get location(){return e(o,i)},listen(x){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(wp,d),l=x,()=>{o.removeEventListener(wp,d),l=null}},createHref(x){return t(o,x)},createURL:E,encodeLocation(x){let g=E(x);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:h,replace:p,go(x){return i.go(x)}};return y}var Sp;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Sp||(Sp={}));function fS(e,t,n){return n===void 0&&(n="/"),pS(e,t,n)}function pS(e,t,n,r){let o=typeof t=="string"?Pr(t):t,s=bo(o.pathname||"/",n);if(s==null)return null;let i=Xv(e);hS(i);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:i,route:s};l.relativePath.startsWith("/")&&(he(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Hn([r,l.relativePath]),c=n.concat(l);s.children&&s.children.length>0&&(he(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Xv(s.children,t,c,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:SS(u,s.index),routesMeta:c})};return e.forEach((s,i)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))o(s,i);else for(let l of qv(s.path))o(s,i,l)}),t}function qv(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return o?[s,""]:[s];let i=qv(r.join("/")),a=[];return a.push(...i.map(l=>l===""?s:[s,l].join("/"))),o&&a.push(...i),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function hS(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:ES(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const mS=/^:[\w-]+$/,vS=3,gS=2,yS=1,wS=10,xS=-2,Ep=e=>e==="*";function SS(e,t){let n=e.split("/"),r=n.length;return n.some(Ep)&&(r+=xS),t&&(r+=gS),n.filter(o=>!Ep(o)).reduce((o,s)=>o+(mS.test(s)?vS:s===""?yS:wS),r)}function ES(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function CS(e,t,n){let{routesMeta:r}=e,o={},s="/",i=[];for(let a=0;a{let{paramName:h,isOptional:p}=c;if(h==="*"){let y=a[d]||"";i=s.slice(0,s.length-y.length).replace(/(.)\/+$/,"$1")}const E=a[d];return p&&!E?u[h]=void 0:u[h]=(E||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:i,pattern:e}}function bS(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Ba(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function PS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ba(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function bo(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const kS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,TS=e=>kS.test(e);function RS(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?Pr(e):e,s;if(n)if(TS(n))s=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),Ba(!1,"Pathnames cannot have embedded double slashes - normalizing "+(i+" -> "+n))}n.startsWith("/")?s=Cp(n.substring(1),"/"):s=Cp(n,t)}else s=t;return{pathname:s,search:AS(r),hash:MS(o)}}function Cp(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function Ul(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function _S(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function wd(e,t){let n=_S(e);return t?n.map((r,o)=>o===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function xd(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=Pr(e):(o=Ts({},e),he(!o.pathname||!o.pathname.includes("?"),Ul("?","pathname","search",o)),he(!o.pathname||!o.pathname.includes("#"),Ul("#","pathname","hash",o)),he(!o.search||!o.search.includes("#"),Ul("#","search","hash",o)));let s=e===""||o.pathname==="",i=s?"/":o.pathname,a;if(i==null)a=n;else{let d=t.length-1;if(!r&&i.startsWith("..")){let h=i.split("/");for(;h[0]==="..";)h.shift(),d-=1;o.pathname=h.join("/")}a=d>=0?t[d]:"/"}let l=RS(o,a),u=i&&i!=="/"&&i.endsWith("/"),c=(s||i===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const Hn=e=>e.join("/").replace(/\/\/+/g,"/"),NS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),AS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,MS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function OS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Zv=["post","put","patch","delete"];new Set(Zv);const jS=["get",...Zv];new Set(jS);/** + */function Ts(){return Ts=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Ba(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function pS(){return Math.random().toString(36).substr(2,8)}function Ep(e,t){return{usr:e.state,key:e.key,idx:t}}function ma(e,t,n,r){return n===void 0&&(n=null),Ts({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Pr(t):t,{state:n,key:t&&t.key||r||pS()})}function Rs(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Pr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Xv(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:s=!1}=r,i=o.history,a=Ln.Pop,l=null,u=c();u==null&&(u=0,i.replaceState(Ts({},i.state,{idx:u}),""));function c(){return(i.state||{idx:null}).idx}function d(){a=Ln.Pop;let x=c(),g=x==null?null:x-u;u=x,l&&l({action:a,location:y.location,delta:g})}function m(x,g){a=Ln.Push;let v=ma(y.location,x,g);n&&n(v,x),u=c()+1;let w=Ep(v,u),S=y.createHref(v);try{i.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;o.location.assign(S)}s&&l&&l({action:a,location:y.location,delta:1})}function p(x,g){a=Ln.Replace;let v=ma(y.location,x,g);n&&n(v,x),u=c();let w=Ep(v,u),S=y.createHref(v);i.replaceState(w,"",S),s&&l&&l({action:a,location:y.location,delta:0})}function E(x){let g=o.location.origin!=="null"?o.location.origin:o.location.href,v=typeof x=="string"?x:Rs(x);return v=v.replace(/ $/,"%20"),he(g,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,g)}let y={get action(){return a},get location(){return e(o,i)},listen(x){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(Sp,d),l=x,()=>{o.removeEventListener(Sp,d),l=null}},createHref(x){return t(o,x)},createURL:E,encodeLocation(x){let g=E(x);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:m,replace:p,go(x){return i.go(x)}};return y}var Cp;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Cp||(Cp={}));function hS(e,t,n){return n===void 0&&(n="/"),mS(e,t,n)}function mS(e,t,n,r){let o=typeof t=="string"?Pr(t):t,s=bo(o.pathname||"/",n);if(s==null)return null;let i=qv(e);vS(i);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:i,route:s};l.relativePath.startsWith("/")&&(he(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Hn([r,l.relativePath]),c=n.concat(l);s.children&&s.children.length>0&&(he(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),qv(s.children,t,c,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:CS(u,s.index),routesMeta:c})};return e.forEach((s,i)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))o(s,i);else for(let l of Zv(s.path))o(s,i,l)}),t}function Zv(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return o?[s,""]:[s];let i=Zv(r.join("/")),a=[];return a.push(...i.map(l=>l===""?s:[s,l].join("/"))),o&&a.push(...i),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function vS(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:bS(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const gS=/^:[\w-]+$/,yS=3,wS=2,xS=1,SS=10,ES=-2,bp=e=>e==="*";function CS(e,t){let n=e.split("/"),r=n.length;return n.some(bp)&&(r+=ES),t&&(r+=wS),n.filter(o=>!bp(o)).reduce((o,s)=>o+(gS.test(s)?yS:s===""?xS:SS),r)}function bS(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function PS(e,t,n){let{routesMeta:r}=e,o={},s="/",i=[];for(let a=0;a{let{paramName:m,isOptional:p}=c;if(m==="*"){let y=a[d]||"";i=s.slice(0,s.length-y.length).replace(/(.)\/+$/,"$1")}const E=a[d];return p&&!E?u[m]=void 0:u[m]=(E||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:i,pattern:e}}function kS(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Ba(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function TS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ba(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function bo(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const RS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_S=e=>RS.test(e);function NS(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?Pr(e):e,s;if(n)if(_S(n))s=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),Ba(!1,"Pathnames cannot have embedded double slashes - normalizing "+(i+" -> "+n))}n.startsWith("/")?s=Pp(n.substring(1),"/"):s=Pp(n,t)}else s=t;return{pathname:s,search:OS(r),hash:jS(o)}}function Pp(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function Ul(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function AS(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Sd(e,t){let n=AS(e);return t?n.map((r,o)=>o===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Ed(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=Pr(e):(o=Ts({},e),he(!o.pathname||!o.pathname.includes("?"),Ul("?","pathname","search",o)),he(!o.pathname||!o.pathname.includes("#"),Ul("#","pathname","hash",o)),he(!o.search||!o.search.includes("#"),Ul("#","search","hash",o)));let s=e===""||o.pathname==="",i=s?"/":o.pathname,a;if(i==null)a=n;else{let d=t.length-1;if(!r&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),d-=1;o.pathname=m.join("/")}a=d>=0?t[d]:"/"}let l=NS(o,a),u=i&&i!=="/"&&i.endsWith("/"),c=(s||i===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const Hn=e=>e.join("/").replace(/\/\/+/g,"/"),MS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),OS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,jS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function IS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Jv=["post","put","patch","delete"];new Set(Jv);const LS=["get",...Jv];new Set(LS);/** * React Router v6.30.3 * * Copyright (c) Remix Software Inc. @@ -56,7 +56,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function _s(){return _s=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),f.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let d=xd(u,JSON.parse(i),s,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Hn([t,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[t,r,i,s,e])}function ng(){let{matches:e}=f.useContext(fn),t=e[e.length-1];return t?t.params:{}}function Ka(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=f.useContext(dn),{matches:o}=f.useContext(fn),{pathname:s}=Mt(),i=JSON.stringify(wd(o,r.v7_relativeSplatPath));return f.useMemo(()=>xd(e,JSON.parse(i),s,n==="path"),[e,i,s,n])}function DS(e,t){return FS(e,t)}function FS(e,t,n,r){Mo()||he(!1);let{navigator:o}=f.useContext(dn),{matches:s}=f.useContext(fn),i=s[s.length-1],a=i?i.params:{};i&&i.pathname;let l=i?i.pathnameBase:"/";i&&i.route;let u=Mt(),c;if(t){var d;let x=typeof t=="string"?Pr(t):t;l==="/"||(d=x.pathname)!=null&&d.startsWith(l)||he(!1),c=x}else c=u;let h=c.pathname||"/",p=h;if(l!=="/"){let x=l.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(x.length).join("/")}let E=fS(e,{pathname:p}),y=BS(E&&E.map(x=>Object.assign({},x,{params:Object.assign({},a,x.params),pathname:Hn([l,o.encodeLocation?o.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?l:Hn([l,o.encodeLocation?o.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),s,n,r);return t&&y?f.createElement(Ha.Provider,{value:{location:_s({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Ln.Pop}},y):y}function $S(){let e=GS(),t=OS(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),n?f.createElement("pre",{style:o},n):null,null)}const zS=f.createElement($S,null);class US extends f.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?f.createElement(fn.Provider,{value:this.props.routeContext},f.createElement(eg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function VS(e){let{routeContext:t,match:n,children:r}=e,o=f.useContext(Wa);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),f.createElement(fn.Provider,{value:t},r)}function BS(e,t,n,r){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let i=e,a=(o=n)==null?void 0:o.errors;if(a!=null){let c=i.findIndex(d=>d.route.id&&(a==null?void 0:a[d.route.id])!==void 0);c>=0||he(!1),i=i.slice(0,Math.min(i.length,c+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c=0?i=i.slice(0,u+1):i=[i[0]];break}}}return i.reduceRight((c,d,h)=>{let p,E=!1,y=null,x=null;n&&(p=a&&d.route.id?a[d.route.id]:void 0,y=d.route.errorElement||zS,l&&(u<0&&h===0?(YS("route-fallback"),E=!0,x=null):u===h&&(E=!0,x=d.route.hydrateFallbackElement||null)));let g=t.concat(i.slice(0,h+1)),v=()=>{let w;return p?w=y:E?w=x:d.route.Component?w=f.createElement(d.route.Component,null):d.route.element?w=d.route.element:w=c,f.createElement(VS,{match:d,routeContext:{outlet:c,matches:g,isDataRoute:n!=null},children:w})};return n&&(d.route.ErrorBoundary||d.route.errorElement||h===0)?f.createElement(US,{location:n.location,revalidation:n.revalidation,component:y,error:p,children:v(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):v()},null)}var rg=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(rg||{}),og=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(og||{});function WS(e){let t=f.useContext(Wa);return t||he(!1),t}function HS(e){let t=f.useContext(Jv);return t||he(!1),t}function KS(e){let t=f.useContext(fn);return t||he(!1),t}function sg(e){let t=KS(),n=t.matches[t.matches.length-1];return n.route.id||he(!1),n.route.id}function GS(){var e;let t=f.useContext(eg),n=HS(),r=sg();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function QS(){let{router:e}=WS(rg.UseNavigateStable),t=sg(og.UseNavigateStable),n=f.useRef(!1);return tg(()=>{n.current=!0}),f.useCallback(function(o,s){s===void 0&&(s={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,_s({fromRouteId:t},s)))},[e,t])}const bp={};function YS(e,t,n){bp[e]||(bp[e]=!0)}function ig(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Po(e){let{to:t,replace:n,state:r,relative:o}=e;Mo()||he(!1);let{future:s,static:i}=f.useContext(dn),{matches:a}=f.useContext(fn),{pathname:l}=Mt(),u=Sd(),c=xd(t,wd(a,s.v7_relativeSplatPath),l,o==="path"),d=JSON.stringify(c);return f.useEffect(()=>u(JSON.parse(d),{replace:n,state:r,relative:o}),[u,d,o,n,r]),null}function ee(e){he(!1)}function ag(e){let{basename:t="/",children:n=null,location:r,navigationType:o=Ln.Pop,navigator:s,static:i=!1,future:a}=e;Mo()&&he(!1);let l=t.replace(/^\/*/,"/"),u=f.useMemo(()=>({basename:l,navigator:s,static:i,future:_s({v7_relativeSplatPath:!1},a)}),[l,a,s,i]);typeof r=="string"&&(r=Pr(r));let{pathname:c="/",search:d="",hash:h="",state:p=null,key:E="default"}=r,y=f.useMemo(()=>{let x=bo(c,l);return x==null?null:{location:{pathname:x,search:d,hash:h,state:p,key:E},navigationType:o}},[l,c,d,h,p,E,o]);return y==null?null:f.createElement(dn.Provider,{value:u},f.createElement(Ha.Provider,{children:n,value:y}))}function XS(e){let{children:t,location:n}=e;return DS(Zu(t),n)}new Promise(()=>{});function Zu(e,t){t===void 0&&(t=[]);let n=[];return f.Children.forEach(e,(r,o)=>{if(!f.isValidElement(r))return;let s=[...t,o];if(r.type===f.Fragment){n.push.apply(n,Zu(r.props.children,s));return}r.type!==ee&&he(!1),!r.props.index||!r.props.children||he(!1);let i={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=Zu(r.props.children,s)),n.push(i)}),n}/** + */function _s(){return _s=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),f.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let d=Ed(u,JSON.parse(i),s,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Hn([t,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[t,r,i,s,e])}function rg(){let{matches:e}=f.useContext(fn),t=e[e.length-1];return t?t.params:{}}function Ka(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=f.useContext(dn),{matches:o}=f.useContext(fn),{pathname:s}=Mt(),i=JSON.stringify(Sd(o,r.v7_relativeSplatPath));return f.useMemo(()=>Ed(e,JSON.parse(i),s,n==="path"),[e,i,s,n])}function $S(e,t){return zS(e,t)}function zS(e,t,n,r){Mo()||he(!1);let{navigator:o}=f.useContext(dn),{matches:s}=f.useContext(fn),i=s[s.length-1],a=i?i.params:{};i&&i.pathname;let l=i?i.pathnameBase:"/";i&&i.route;let u=Mt(),c;if(t){var d;let x=typeof t=="string"?Pr(t):t;l==="/"||(d=x.pathname)!=null&&d.startsWith(l)||he(!1),c=x}else c=u;let m=c.pathname||"/",p=m;if(l!=="/"){let x=l.replace(/^\//,"").split("/");p="/"+m.replace(/^\//,"").split("/").slice(x.length).join("/")}let E=hS(e,{pathname:p}),y=HS(E&&E.map(x=>Object.assign({},x,{params:Object.assign({},a,x.params),pathname:Hn([l,o.encodeLocation?o.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?l:Hn([l,o.encodeLocation?o.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),s,n,r);return t&&y?f.createElement(Ha.Provider,{value:{location:_s({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Ln.Pop}},y):y}function US(){let e=YS(),t=IS(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),n?f.createElement("pre",{style:o},n):null,null)}const VS=f.createElement(US,null);class BS extends f.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?f.createElement(fn.Provider,{value:this.props.routeContext},f.createElement(tg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function WS(e){let{routeContext:t,match:n,children:r}=e,o=f.useContext(Wa);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),f.createElement(fn.Provider,{value:t},r)}function HS(e,t,n,r){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let i=e,a=(o=n)==null?void 0:o.errors;if(a!=null){let c=i.findIndex(d=>d.route.id&&(a==null?void 0:a[d.route.id])!==void 0);c>=0||he(!1),i=i.slice(0,Math.min(i.length,c+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c=0?i=i.slice(0,u+1):i=[i[0]];break}}}return i.reduceRight((c,d,m)=>{let p,E=!1,y=null,x=null;n&&(p=a&&d.route.id?a[d.route.id]:void 0,y=d.route.errorElement||VS,l&&(u<0&&m===0?(qS("route-fallback"),E=!0,x=null):u===m&&(E=!0,x=d.route.hydrateFallbackElement||null)));let g=t.concat(i.slice(0,m+1)),v=()=>{let w;return p?w=y:E?w=x:d.route.Component?w=f.createElement(d.route.Component,null):d.route.element?w=d.route.element:w=c,f.createElement(WS,{match:d,routeContext:{outlet:c,matches:g,isDataRoute:n!=null},children:w})};return n&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?f.createElement(BS,{location:n.location,revalidation:n.revalidation,component:y,error:p,children:v(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):v()},null)}var og=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(og||{}),sg=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(sg||{});function KS(e){let t=f.useContext(Wa);return t||he(!1),t}function GS(e){let t=f.useContext(eg);return t||he(!1),t}function QS(e){let t=f.useContext(fn);return t||he(!1),t}function ig(e){let t=QS(),n=t.matches[t.matches.length-1];return n.route.id||he(!1),n.route.id}function YS(){var e;let t=f.useContext(tg),n=GS(),r=ig();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function XS(){let{router:e}=KS(og.UseNavigateStable),t=ig(sg.UseNavigateStable),n=f.useRef(!1);return ng(()=>{n.current=!0}),f.useCallback(function(o,s){s===void 0&&(s={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,_s({fromRouteId:t},s)))},[e,t])}const kp={};function qS(e,t,n){kp[e]||(kp[e]=!0)}function ag(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Po(e){let{to:t,replace:n,state:r,relative:o}=e;Mo()||he(!1);let{future:s,static:i}=f.useContext(dn),{matches:a}=f.useContext(fn),{pathname:l}=Mt(),u=Cd(),c=Ed(t,Sd(a,s.v7_relativeSplatPath),l,o==="path"),d=JSON.stringify(c);return f.useEffect(()=>u(JSON.parse(d),{replace:n,state:r,relative:o}),[u,d,o,n,r]),null}function ee(e){he(!1)}function lg(e){let{basename:t="/",children:n=null,location:r,navigationType:o=Ln.Pop,navigator:s,static:i=!1,future:a}=e;Mo()&&he(!1);let l=t.replace(/^\/*/,"/"),u=f.useMemo(()=>({basename:l,navigator:s,static:i,future:_s({v7_relativeSplatPath:!1},a)}),[l,a,s,i]);typeof r=="string"&&(r=Pr(r));let{pathname:c="/",search:d="",hash:m="",state:p=null,key:E="default"}=r,y=f.useMemo(()=>{let x=bo(c,l);return x==null?null:{location:{pathname:x,search:d,hash:m,state:p,key:E},navigationType:o}},[l,c,d,m,p,E,o]);return y==null?null:f.createElement(dn.Provider,{value:u},f.createElement(Ha.Provider,{children:n,value:y}))}function Tp(e){let{children:t,location:n}=e;return $S(ec(t),n)}new Promise(()=>{});function ec(e,t){t===void 0&&(t=[]);let n=[];return f.Children.forEach(e,(r,o)=>{if(!f.isValidElement(r))return;let s=[...t,o];if(r.type===f.Fragment){n.push.apply(n,ec(r.props.children,s));return}r.type!==ee&&he(!1),!r.props.index||!r.props.children||he(!1);let i={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=ec(r.props.children,s)),n.push(i)}),n}/** * React Router DOM v6.30.3 * * Copyright (c) Remix Software Inc. @@ -65,7 +65,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function ma(){return ma=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[o]=e[o]);return n}function qS(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ZS(e,t){return e.button===0&&(!t||t==="_self")&&!qS(e)}function Ju(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function JS(e,t){let n=Ju(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(s=>{n.append(o,s)})}),n}const eE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],tE=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],nE="6";try{window.__reactRouterVersion=nE}catch{}const rE=f.createContext({isTransitioning:!1}),oE="startTransition",va=Ta[oE];function sE(e){let{basename:t,children:n,future:r,window:o}=e,s=f.useRef();s.current==null&&(s.current=uS({window:o,v5Compat:!0}));let i=s.current,[a,l]=f.useState({action:i.action,location:i.location}),{v7_startTransition:u}=r||{},c=f.useCallback(d=>{u&&va?va(()=>l(d)):l(d)},[l,u]);return f.useLayoutEffect(()=>i.listen(c),[i,c]),f.useEffect(()=>ig(r),[r]),f.createElement(ag,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:i,future:r})}function iE(e){let{basename:t,children:n,future:r,window:o}=e,s=f.useRef();s.current==null&&(s.current=cS({window:o,v5Compat:!0}));let i=s.current,[a,l]=f.useState({action:i.action,location:i.location}),{v7_startTransition:u}=r||{},c=f.useCallback(d=>{u&&va?va(()=>l(d)):l(d)},[l,u]);return f.useLayoutEffect(()=>i.listen(c),[i,c]),f.useEffect(()=>ig(r),[r]),f.createElement(ag,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:i,future:r})}const aE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",lE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,qt=f.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:s,replace:i,state:a,target:l,to:u,preventScrollReset:c,viewTransition:d}=t,h=lg(t,eE),{basename:p}=f.useContext(dn),E,y=!1;if(typeof u=="string"&&lE.test(u)&&(E=u,aE))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=bo(S.pathname,p);S.origin===w.origin&&C!=null?u=C+S.search+S.hash:y=!0}catch{}let x=IS(u,{relative:o}),g=cE(u,{replace:i,state:a,target:l,preventScrollReset:c,relative:o,viewTransition:d});function v(w){r&&r(w),w.defaultPrevented||g(w)}return f.createElement("a",ma({},h,{href:E||x,onClick:y||s?r:v,ref:n,target:l}))}),nr=f.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:o=!1,className:s="",end:i=!1,style:a,to:l,viewTransition:u,children:c}=t,d=lg(t,tE),h=Ka(l,{relative:d.relative}),p=Mt(),E=f.useContext(Jv),{navigator:y,basename:x}=f.useContext(dn),g=E!=null&&dE(h)&&u===!0,v=y.encodeLocation?y.encodeLocation(h).pathname:h.pathname,w=p.pathname,S=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;o||(w=w.toLowerCase(),S=S?S.toLowerCase():null,v=v.toLowerCase()),S&&x&&(S=bo(S,x)||S);const C=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let b=w===v||!i&&w.startsWith(v)&&w.charAt(C)==="/",P=S!=null&&(S===v||!i&&S.startsWith(v)&&S.charAt(v.length)==="/"),R={isActive:b,isPending:P,isTransitioning:g},O=b?r:void 0,M;typeof s=="function"?M=s(R):M=[s,b?"active":null,P?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let $=typeof a=="function"?a(R):a;return f.createElement(qt,ma({},d,{"aria-current":O,className:M,ref:n,style:$,to:l,viewTransition:u}),typeof c=="function"?c(R):c)});var ec;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ec||(ec={}));var Pp;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Pp||(Pp={}));function uE(e){let t=f.useContext(Wa);return t||he(!1),t}function cE(e,t){let{target:n,replace:r,state:o,preventScrollReset:s,relative:i,viewTransition:a}=t===void 0?{}:t,l=Sd(),u=Mt(),c=Ka(e,{relative:i});return f.useCallback(d=>{if(ZS(d,n)){d.preventDefault();let h=r!==void 0?r:Rs(u)===Rs(c);l(e,{replace:h,state:o,preventScrollReset:s,relative:i,viewTransition:a})}},[u,l,c,r,o,n,e,s,i,a])}function JN(e){let t=f.useRef(Ju(e)),n=f.useRef(!1),r=Mt(),o=f.useMemo(()=>JS(r.search,n.current?null:t.current),[r.search]),s=Sd(),i=f.useCallback((a,l)=>{const u=Ju(typeof a=="function"?a(o):a);n.current=!0,s("?"+u,l)},[s,o]);return[o,i]}function dE(e,t){t===void 0&&(t={});let n=f.useContext(rE);n==null&&he(!1);let{basename:r}=uE(ec.useViewTransitionState),o=Ka(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=bo(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=bo(n.nextLocation.pathname,r)||n.nextLocation.pathname;return qu(o.pathname,i)!=null||qu(o.pathname,s)!=null}var Ga=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ur,Rn,ao,bh,fE=(bh=class extends Ga{constructor(){super();J(this,ur);J(this,Rn);J(this,ao);B(this,ao,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,Rn)||this.setEventListener(_(this,ao))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Rn))==null||t.call(this),B(this,Rn,void 0))}setEventListener(t){var n;B(this,ao,t),(n=_(this,Rn))==null||n.call(this),B(this,Rn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,ur)!==t&&(B(this,ur,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,ur)=="boolean"?_(this,ur):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ur=new WeakMap,Rn=new WeakMap,ao=new WeakMap,bh),ug=new fE,pE={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_n,Ec,Ph,hE=(Ph=class{constructor(){J(this,_n,pE);J(this,Ec,!1)}setTimeoutProvider(e){B(this,_n,e)}setTimeout(e,t){return _(this,_n).setTimeout(e,t)}clearTimeout(e){_(this,_n).clearTimeout(e)}setInterval(e,t){return _(this,_n).setInterval(e,t)}clearInterval(e){_(this,_n).clearInterval(e)}},_n=new WeakMap,Ec=new WeakMap,Ph),tc=new hE;function mE(e){setTimeout(e,0)}var vE=typeof window>"u"||"Deno"in globalThis;function Ct(){}function gE(e,t){return typeof e=="function"?e(t):e}function yE(e){return typeof e=="number"&&e>=0&&e!==1/0}function wE(e,t){return Math.max(e+(t||0)-Date.now(),0)}function nc(e,t){return typeof e=="function"?e(t):e}function xE(e,t){return typeof e=="function"?e(t):e}function kp(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:s,queryKey:i,stale:a}=e;if(i){if(r){if(t.queryHash!==Ed(i,t.options))return!1}else if(!As(t.queryKey,i))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||s&&!s(t))}function Tp(e,t){const{exact:n,status:r,predicate:o,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(Ns(t.options.mutationKey)!==Ns(s))return!1}else if(!As(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Ed(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ns)(e)}function Ns(e){return JSON.stringify(e,(t,n)=>rc(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function As(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>As(e[n],t[n])):!1}var SE=Object.prototype.hasOwnProperty;function cg(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Rp(e)&&Rp(t);if(!r&&!(rc(e)&&rc(t)))return t;const s=(r?e:Object.keys(e)).length,i=r?t:Object.keys(t),a=i.length,l=r?new Array(a):{};let u=0;for(let c=0;c{tc.setTimeout(t,e)})}function CE(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?cg(e,t):t}function tA(e){return e}function bE(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function PE(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Cd=Symbol();function dg(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Cd?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function nA(e,t){return typeof e=="function"?e(...t):!!e}function kE(e,t,n){let r=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=t()),r||(r=!0,o.aborted?n():o.addEventListener("abort",n,{once:!0})),o)}),e}var fg=(()=>{let e=()=>vE;return{isServer(){return e()},setIsServer(t){e=t}}})();function TE(){let e,t;const n=new Promise((o,s)=>{e=o,t=s});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}var RE=mE;function _E(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=RE;const s=a=>{t?e.push(a):o(()=>{n(a)})},i=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||i()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var ze=_E(),lo,Nn,uo,kh,NE=(kh=class extends Ga{constructor(){super();J(this,lo,!0);J(this,Nn);J(this,uo);B(this,uo,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){_(this,Nn)||this.setEventListener(_(this,uo))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Nn))==null||t.call(this),B(this,Nn,void 0))}setEventListener(t){var n;B(this,uo,t),(n=_(this,Nn))==null||n.call(this),B(this,Nn,t(this.setOnline.bind(this)))}setOnline(t){_(this,lo)!==t&&(B(this,lo,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,lo)}},lo=new WeakMap,Nn=new WeakMap,uo=new WeakMap,kh),ga=new NE;function AE(e){return Math.min(1e3*2**e,3e4)}function pg(e){return(e??"online")==="online"?ga.isOnline():!0}var oc=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function hg(e){let t=!1,n=0,r;const o=TE(),s=()=>o.status!=="pending",i=y=>{var x;if(!s()){const g=new oc(y);h(g),(x=e.onCancel)==null||x.call(e,g)}},a=()=>{t=!0},l=()=>{t=!1},u=()=>ug.isFocused()&&(e.networkMode==="always"||ga.isOnline())&&e.canRun(),c=()=>pg(e.networkMode)&&e.canRun(),d=y=>{s()||(r==null||r(),o.resolve(y))},h=y=>{s()||(r==null||r(),o.reject(y))},p=()=>new Promise(y=>{var x;r=g=>{(s()||u())&&y(g)},(x=e.onPause)==null||x.call(e)}).then(()=>{var y;r=void 0,s()||(y=e.onContinue)==null||y.call(e)}),E=()=>{if(s())return;let y;const x=n===0?e.initialPromise:void 0;try{y=x??e.fn()}catch(g){y=Promise.reject(g)}Promise.resolve(y).then(d).catch(g=>{var b;if(s())return;const v=e.retry??(fg.isServer()?0:3),w=e.retryDelay??AE,S=typeof w=="function"?w(n,g):w,C=v===!0||typeof v=="number"&&nu()?void 0:p()).then(()=>{t?h(g):E()})})};return{promise:o,status:()=>o.status,cancel:i,continue:()=>(r==null||r(),o),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?E():p().then(E),o)}}var cr,Th,mg=(Th=class{constructor(){J(this,cr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),yE(this.gcTime)&&B(this,cr,tc.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(fg.isServer()?1/0:5*60*1e3))}clearGcTimeout(){_(this,cr)!==void 0&&(tc.clearTimeout(_(this,cr)),B(this,cr,void 0))}},cr=new WeakMap,Th);function ME(e){return{onFetch:(t,n)=>{var c,d,h,p,E;const r=t.options,o=(h=(d=(c=t.fetchOptions)==null?void 0:c.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,s=((p=t.state.data)==null?void 0:p.pages)||[],i=((E=t.state.data)==null?void 0:E.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let y=!1;const x=w=>{kE(w,()=>t.signal,()=>y=!0)},g=dg(t.options,t.fetchOptions),v=async(w,S,C)=>{if(y)return Promise.reject(t.signal.reason);if(S==null&&w.pages.length)return Promise.resolve(w);const P=(()=>{const $={client:t.client,queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};return x($),$})(),R=await g(P),{maxPages:O}=t.options,M=C?PE:bE;return{pages:M(w.pages,R,O),pageParams:M(w.pageParams,S,O)}};if(o&&s.length){const w=o==="backward",S=w?vg:sc,C={pages:s,pageParams:i},b=S(r,C);a=await v(C,b,w)}else{const w=e??s.length;do{const S=l===0?i[0]??r.initialPageParam:sc(r,a);if(l>0&&S==null)break;a=await v(a,S),l++}while(l{var y,x;return(x=(y=t.options).persister)==null?void 0:x.call(y,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function sc(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function vg(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function rA(e,t){return t?sc(e,t)!=null:!1}function oA(e,t){return!t||!e.getPreviousPageParam?!1:vg(e,t)!=null}var co,dr,fo,lt,fr,Pe,Is,pr,Je,gg,Yt,Rh,OE=(Rh=class extends mg{constructor(t){super();J(this,Je);J(this,co);J(this,dr);J(this,fo);J(this,lt);J(this,fr);J(this,Pe);J(this,Is);J(this,pr);B(this,pr,!1),B(this,Is,t.defaultOptions),this.setOptions(t.options),this.observers=[],B(this,fr,t.client),B(this,lt,_(this,fr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,B(this,dr,Ap(this.options)),this.state=t.state??_(this,dr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return _(this,co)}get promise(){var t;return(t=_(this,Pe))==null?void 0:t.promise}setOptions(t){if(this.options={..._(this,Is),...t},t!=null&&t._type&&B(this,co,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Ap(this.options);n.data!==void 0&&(this.setState(Np(n.data,n.dataUpdatedAt)),B(this,dr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,lt).remove(this)}setData(t,n){const r=CE(this.state.data,t,this.options);return Ne(this,Je,Yt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){Ne(this,Je,Yt).call(this,{type:"setState",state:t})}cancel(t){var r,o;const n=(r=_(this,Pe))==null?void 0:r.promise;return(o=_(this,Pe))==null||o.cancel(t),n?n.then(Ct).catch(Ct):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return _(this,dr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>xE(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Cd||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>nc(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!wE(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,Pe))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,Pe))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(this,lt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(_(this,Pe)&&(_(this,pr)||Ne(this,Je,gg).call(this)?_(this,Pe).cancel({revert:!0}):_(this,Pe).cancelRetry()),this.scheduleGc()),_(this,lt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ne(this,Je,Yt).call(this,{type:"invalidate"})}async fetch(t,n){var u,c,d,h,p,E,y,x,g,v,w;if(this.state.fetchStatus!=="idle"&&((u=_(this,Pe))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,Pe))return _(this,Pe).continueRetry(),_(this,Pe).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(C=>C.options.queryFn);S&&this.setOptions(S.options)}const r=new AbortController,o=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(B(this,pr,!0),r.signal)})},s=()=>{const S=dg(this.options,n),b=(()=>{const P={client:_(this,fr),queryKey:this.queryKey,meta:this.meta};return o(P),P})();return B(this,pr,!1),this.options.persister?this.options.persister(S,b,this):S(b)},a=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:_(this,fr),state:this.state,fetchFn:s};return o(S),S})(),l=_(this,co)==="infinite"?ME(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),B(this,fo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&Ne(this,Je,Yt).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),B(this,Pe,hg({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:S=>{S instanceof oc&&S.revert&&this.setState({..._(this,fo),fetchStatus:"idle"}),r.abort()},onFail:(S,C)=>{Ne(this,Je,Yt).call(this,{type:"failed",failureCount:S,error:C})},onPause:()=>{Ne(this,Je,Yt).call(this,{type:"pause"})},onContinue:()=>{Ne(this,Je,Yt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const S=await _(this,Pe).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(p=(h=_(this,lt).config).onSuccess)==null||p.call(h,S,this),(y=(E=_(this,lt).config).onSettled)==null||y.call(E,S,this.state.error,this),S}catch(S){if(S instanceof oc){if(S.silent)return _(this,Pe).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw Ne(this,Je,Yt).call(this,{type:"error",error:S}),(g=(x=_(this,lt).config).onError)==null||g.call(x,S,this),(w=(v=_(this,lt).config).onSettled)==null||w.call(v,this.state.data,S,this),S}finally{this.scheduleGc()}}},co=new WeakMap,dr=new WeakMap,fo=new WeakMap,lt=new WeakMap,fr=new WeakMap,Pe=new WeakMap,Is=new WeakMap,pr=new WeakMap,Je=new WeakSet,gg=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Yt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...jE(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...r,...Np(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return B(this,fo,t.manual?o:void 0),o;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ze.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,lt).notify({query:this,type:"updated",action:t})})},Rh);function jE(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pg(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Np(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ap(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ls,Dt,Le,hr,Ft,En,_h,IE=(_h=class extends mg{constructor(t){super();J(this,Ft);J(this,Ls);J(this,Dt);J(this,Le);J(this,hr);B(this,Ls,t.client),this.mutationId=t.mutationId,B(this,Le,t.mutationCache),B(this,Dt,[]),this.state=t.state||LE(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,Dt).includes(t)||(_(this,Dt).push(t),this.clearGcTimeout(),_(this,Le).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){B(this,Dt,_(this,Dt).filter(n=>n!==t)),this.scheduleGc(),_(this,Le).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,Dt).length||(this.state.status==="pending"?this.scheduleGc():_(this,Le).remove(this))}continue(){var t;return((t=_(this,hr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,a,l,u,c,d,h,p,E,y,x,g,v,w,S,C,b,P;const n=()=>{Ne(this,Ft,En).call(this,{type:"continue"})},r={client:_(this,Ls),meta:this.options.meta,mutationKey:this.options.mutationKey};B(this,hr,hg({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,O)=>{Ne(this,Ft,En).call(this,{type:"failed",failureCount:R,error:O})},onPause:()=>{Ne(this,Ft,En).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,Le).canRun(this)}));const o=this.state.status==="pending",s=!_(this,hr).canStart();try{if(o)n();else{Ne(this,Ft,En).call(this,{type:"pending",variables:t,isPaused:s}),_(this,Le).config.onMutate&&await _(this,Le).config.onMutate(t,this,r);const O=await((a=(i=this.options).onMutate)==null?void 0:a.call(i,t,r));O!==this.state.context&&Ne(this,Ft,En).call(this,{type:"pending",context:O,variables:t,isPaused:s})}const R=await _(this,hr).start();return await((u=(l=_(this,Le).config).onSuccess)==null?void 0:u.call(l,R,t,this.state.context,this,r)),await((d=(c=this.options).onSuccess)==null?void 0:d.call(c,R,t,this.state.context,r)),await((p=(h=_(this,Le).config).onSettled)==null?void 0:p.call(h,R,null,this.state.variables,this.state.context,this,r)),await((y=(E=this.options).onSettled)==null?void 0:y.call(E,R,null,t,this.state.context,r)),Ne(this,Ft,En).call(this,{type:"success",data:R}),R}catch(R){try{await((g=(x=_(this,Le).config).onError)==null?void 0:g.call(x,R,t,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((w=(v=this.options).onError)==null?void 0:w.call(v,R,t,this.state.context,r))}catch(O){Promise.reject(O)}try{await((C=(S=_(this,Le).config).onSettled)==null?void 0:C.call(S,void 0,R,this.state.variables,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((P=(b=this.options).onSettled)==null?void 0:P.call(b,void 0,R,t,this.state.context,r))}catch(O){Promise.reject(O)}throw Ne(this,Ft,En).call(this,{type:"error",error:R}),R}finally{_(this,Le).runNext(this)}}},Ls=new WeakMap,Dt=new WeakMap,Le=new WeakMap,hr=new WeakMap,Ft=new WeakSet,En=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ze.batch(()=>{_(this,Dt).forEach(r=>{r.onMutationUpdate(t)}),_(this,Le).notify({mutation:this,type:"updated",action:t})})},_h);function LE(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Jt,bt,Ds,Nh,DE=(Nh=class extends Ga{constructor(t={}){super();J(this,Jt);J(this,bt);J(this,Ds);this.config=t,B(this,Jt,new Set),B(this,bt,new Map),B(this,Ds,0)}build(t,n,r){const o=new IE({client:t,mutationCache:this,mutationId:++Js(this,Ds)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){_(this,Jt).add(t);const n=gi(t);if(typeof n=="string"){const r=_(this,bt).get(n);r?r.push(t):_(this,bt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(_(this,Jt).delete(t)){const n=gi(t);if(typeof n=="string"){const r=_(this,bt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&_(this,bt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=gi(t);if(typeof n=="string"){const r=_(this,bt).get(n),o=r==null?void 0:r.find(s=>s.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=gi(t);if(typeof n=="string"){const o=(r=_(this,bt).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ze.batch(()=>{_(this,Jt).forEach(t=>{this.notify({type:"removed",mutation:t})}),_(this,Jt).clear(),_(this,bt).clear()})}getAll(){return Array.from(_(this,Jt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Tp(n,r))}findAll(t={}){return this.getAll().filter(n=>Tp(t,n))}notify(t){ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ze.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ct))))}},Jt=new WeakMap,bt=new WeakMap,Ds=new WeakMap,Nh);function gi(e){var t;return(t=e.options.scope)==null?void 0:t.id}var $t,Ah,FE=(Ah=class extends Ga{constructor(t={}){super();J(this,$t);this.config=t,B(this,$t,new Map)}build(t,n,r){const o=n.queryKey,s=n.queryHash??Ed(o,n);let i=this.get(s);return i||(i=new OE({client:t,queryKey:o,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(i)),i}add(t){_(this,$t).has(t.queryHash)||(_(this,$t).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,$t).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,$t).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ze.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,$t).get(t)}getAll(){return[..._(this,$t).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>kp(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>kp(t,r)):n}notify(t){ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ze.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ze.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},$t=new WeakMap,Ah),ye,An,Mn,po,ho,On,mo,vo,Mh,$E=(Mh=class{constructor(e={}){J(this,ye);J(this,An);J(this,Mn);J(this,po);J(this,ho);J(this,On);J(this,mo);J(this,vo);B(this,ye,e.queryCache||new FE),B(this,An,e.mutationCache||new DE),B(this,Mn,e.defaultOptions||{}),B(this,po,new Map),B(this,ho,new Map),B(this,On,0)}mount(){Js(this,On)._++,_(this,On)===1&&(B(this,mo,ug.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,ye).onFocus())})),B(this,vo,ga.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,ye).onOnline())})))}unmount(){var e,t;Js(this,On)._--,_(this,On)===0&&((e=_(this,mo))==null||e.call(this),B(this,mo,void 0),(t=_(this,vo))==null||t.call(this),B(this,vo,void 0))}isFetching(e){return _(this,ye).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,An).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,ye).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=_(this,ye).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(nc(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return _(this,ye).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=_(this,ye).get(r.queryHash),s=o==null?void 0:o.state.data,i=gE(t,s);if(i!==void 0)return _(this,ye).build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return ze.batch(()=>_(this,ye).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,ye).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,ye);ze.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(this,ye);return ze.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ze.batch(()=>_(this,ye).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Ct).catch(Ct)}invalidateQueries(e,t={}){return ze.batch(()=>(_(this,ye).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ze.batch(()=>_(this,ye).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let s=o.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ct)),o.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ct)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(this,ye).build(this,t);return n.isStaleByTime(nc(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ct).catch(Ct)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ct).catch(Ct)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return ga.isOnline()?_(this,An).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,ye)}getMutationCache(){return _(this,An)}getDefaultOptions(){return _(this,Mn)}setDefaultOptions(e){B(this,Mn,e)}setQueryDefaults(e,t){_(this,po).set(Ns(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,po).values()],n={};return t.forEach(r=>{As(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){_(this,ho).set(Ns(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,ho).values()],n={};return t.forEach(r=>{As(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,Mn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ed(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Cd&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Mn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,ye).clear(),_(this,An).clear()}},ye=new WeakMap,An=new WeakMap,Mn=new WeakMap,po=new WeakMap,ho=new WeakMap,On=new WeakMap,mo=new WeakMap,vo=new WeakMap,Mh),yg=f.createContext(void 0),sA=e=>{const t=f.useContext(yg);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},zE=({client:e,children:t})=>(f.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),m.jsx(yg.Provider,{value:e,children:t}));const Mp=e=>e.endsWith("/")?e.slice(0,-1):e;function bd(){const e="https://paperswithcode.co".trim();if(!e)return"";try{const t=e.startsWith("http")?new URL(e):new URL(e,typeof window<"u"?window.location.origin:"http://localhost");return Mp(t.origin)}catch{return Mp(e)}}function UE(e){const t=e.startsWith("/")?e:`/${e}`,n=bd();return n?`${n}${t}`:t}function Pd(e){const t=e.startsWith("/")?e:`/${e}`;return UE(t)}function VE(){return Pd("/admin-dashboard")}function iA(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("blob:")||e.startsWith("//"))return e;if(e.startsWith("/")){const t=bd();return t?`${t}${e}`:e}return e}function Ws(){const t=String("1").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"}function ya(){const t=String("0").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"}function aA(){return typeof window<"u"&&window.location.hostname==="staging.paperswithcode.co"}function BE(){const t=String("1").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"}const WE="/hf-logo.svg?v=20260513b",Op=({size:e=14})=>m.jsx("img",{src:WE,alt:"",width:Math.round(e*95/88),height:e,"aria-hidden":"true",draggable:!1,style:{display:"block"}});function HE(e,t=!1,n=!1){const r=Pd("/api/v1/auth/hf/login"),s=new URL(r,window.location.origin).origin===window.location.origin?e:new URL(e,window.location.origin).toString(),i=new URLSearchParams({return_to:s});return t&&i.set("authorize_inference","true"),n&&i.set("collect_email","true"),`${r}?${i.toString()}`}const wg=({returnTo:e,compact:t=!1,label:n="Sign in",authorizeInference:r=!1,collectEmail:o=!1})=>{if(Ws())return null;const s=()=>{window.location.href=HE(e,r,o)};return t?m.jsx("button",{type:"button",className:"icon-btn","aria-label":"Sign in with Hugging Face",title:"Sign in with Hugging Face",onClick:s,children:m.jsx(Op,{size:16})}):m.jsxs("button",{type:"button",className:"hf-signin-btn",onClick:s,"aria-label":"Sign in with Hugging Face",children:[m.jsx(Op,{size:18}),m.jsx("span",{children:n})]})};function KE(e,t=[]){let n=[];function r(s,i){const a=f.createContext(i);a.displayName=s+"Context";const l=n.length;n=[...n,i];const u=d=>{var g;const{scope:h,children:p,...E}=d,y=((g=h==null?void 0:h[e])==null?void 0:g[l])||a,x=f.useMemo(()=>E,Object.values(E));return m.jsx(y.Provider,{value:x,children:p})};u.displayName=s+"Provider";function c(d,h){var y;const p=((y=h==null?void 0:h[e])==null?void 0:y[l])||a,E=f.useContext(p);if(E)return E;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[u,c]}const o=()=>{const s=n.map(i=>f.createContext(i));return function(a){const l=(a==null?void 0:a[e])||s;return f.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,GE(o,...t)]}function GE(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:l,scopeName:u})=>{const d=l(s)[`__scope${u}`];return{...a,...d}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function qe(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var vt=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{};function jp(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function kr(...e){return t=>{let n=!1;const r=e.map(o=>{const s=jp(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o{let{children:s,...i}=r;xg(s)&&typeof wa=="function"&&(s=wa(s._payload));const a=f.Children.toArray(s),l=a.find(ZE);if(l){const u=l.props.children,c=a.map(d=>d===l?f.Children.count(u)>1?f.Children.only(null):f.isValidElement(u)?u.props.children:null:d);return m.jsx(t,{...i,ref:o,children:f.isValidElement(u)?f.cloneElement(u,void 0,c):null})}return m.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var lA=Sg("Slot");function XE(e){const t=f.forwardRef((n,r)=>{let{children:o,...s}=n;if(xg(o)&&typeof wa=="function"&&(o=wa(o._payload)),f.isValidElement(o)){const i=eC(o),a=JE(s,o.props);return o.type!==f.Fragment&&(a.ref=r?kr(r,i):i),f.cloneElement(o,a)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qE=Symbol("radix.slottable");function ZE(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qE}function JE(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function eC(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],kd=tC.reduce((e,t)=>{const n=Sg(`Primitive.${t}`),r=f.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Eg={exports:{}},Cg={};/** + */function va(){return va=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[o]=e[o]);return n}function ZS(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function JS(e,t){return e.button===0&&(!t||t==="_self")&&!ZS(e)}function tc(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function eE(e,t){let n=tc(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(s=>{n.append(o,s)})}),n}const tE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],nE=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],rE="6";try{window.__reactRouterVersion=rE}catch{}const oE=f.createContext({isTransitioning:!1}),sE="startTransition",ga=Ta[sE];function iE(e){let{basename:t,children:n,future:r,window:o}=e,s=f.useRef();s.current==null&&(s.current=dS({window:o,v5Compat:!0}));let i=s.current,[a,l]=f.useState({action:i.action,location:i.location}),{v7_startTransition:u}=r||{},c=f.useCallback(d=>{u&&ga?ga(()=>l(d)):l(d)},[l,u]);return f.useLayoutEffect(()=>i.listen(c),[i,c]),f.useEffect(()=>ag(r),[r]),f.createElement(lg,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:i,future:r})}function aE(e){let{basename:t,children:n,future:r,window:o}=e,s=f.useRef();s.current==null&&(s.current=fS({window:o,v5Compat:!0}));let i=s.current,[a,l]=f.useState({action:i.action,location:i.location}),{v7_startTransition:u}=r||{},c=f.useCallback(d=>{u&&ga?ga(()=>l(d)):l(d)},[l,u]);return f.useLayoutEffect(()=>i.listen(c),[i,c]),f.useEffect(()=>ag(r),[r]),f.createElement(lg,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:i,future:r})}const lE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",uE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,qt=f.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:s,replace:i,state:a,target:l,to:u,preventScrollReset:c,viewTransition:d}=t,m=ug(t,tE),{basename:p}=f.useContext(dn),E,y=!1;if(typeof u=="string"&&uE.test(u)&&(E=u,lE))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=bo(S.pathname,p);S.origin===w.origin&&C!=null?u=C+S.search+S.hash:y=!0}catch{}let x=DS(u,{relative:o}),g=dE(u,{replace:i,state:a,target:l,preventScrollReset:c,relative:o,viewTransition:d});function v(w){r&&r(w),w.defaultPrevented||g(w)}return f.createElement("a",va({},m,{href:E||x,onClick:y||s?r:v,ref:n,target:l}))}),nr=f.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:o=!1,className:s="",end:i=!1,style:a,to:l,viewTransition:u,children:c}=t,d=ug(t,nE),m=Ka(l,{relative:d.relative}),p=Mt(),E=f.useContext(eg),{navigator:y,basename:x}=f.useContext(dn),g=E!=null&&fE(m)&&u===!0,v=y.encodeLocation?y.encodeLocation(m).pathname:m.pathname,w=p.pathname,S=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;o||(w=w.toLowerCase(),S=S?S.toLowerCase():null,v=v.toLowerCase()),S&&x&&(S=bo(S,x)||S);const C=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let b=w===v||!i&&w.startsWith(v)&&w.charAt(C)==="/",P=S!=null&&(S===v||!i&&S.startsWith(v)&&S.charAt(v.length)==="/"),R={isActive:b,isPending:P,isTransitioning:g},O=b?r:void 0,M;typeof s=="function"?M=s(R):M=[s,b?"active":null,P?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let $=typeof a=="function"?a(R):a;return f.createElement(qt,va({},d,{"aria-current":O,className:M,ref:n,style:$,to:l,viewTransition:u}),typeof c=="function"?c(R):c)});var nc;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(nc||(nc={}));var Rp;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Rp||(Rp={}));function cE(e){let t=f.useContext(Wa);return t||he(!1),t}function dE(e,t){let{target:n,replace:r,state:o,preventScrollReset:s,relative:i,viewTransition:a}=t===void 0?{}:t,l=Cd(),u=Mt(),c=Ka(e,{relative:i});return f.useCallback(d=>{if(JS(d,n)){d.preventDefault();let m=r!==void 0?r:Rs(u)===Rs(c);l(e,{replace:m,state:o,preventScrollReset:s,relative:i,viewTransition:a})}},[u,l,c,r,o,n,e,s,i,a])}function nA(e){let t=f.useRef(tc(e)),n=f.useRef(!1),r=Mt(),o=f.useMemo(()=>eE(r.search,n.current?null:t.current),[r.search]),s=Cd(),i=f.useCallback((a,l)=>{const u=tc(typeof a=="function"?a(o):a);n.current=!0,s("?"+u,l)},[s,o]);return[o,i]}function fE(e,t){t===void 0&&(t={});let n=f.useContext(oE);n==null&&he(!1);let{basename:r}=cE(nc.useViewTransitionState),o=Ka(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=bo(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=bo(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ju(o.pathname,i)!=null||Ju(o.pathname,s)!=null}var Ga=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ur,Rn,ao,Ph,pE=(Ph=class extends Ga{constructor(){super();J(this,ur);J(this,Rn);J(this,ao);B(this,ao,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,Rn)||this.setEventListener(_(this,ao))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Rn))==null||t.call(this),B(this,Rn,void 0))}setEventListener(t){var n;B(this,ao,t),(n=_(this,Rn))==null||n.call(this),B(this,Rn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,ur)!==t&&(B(this,ur,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,ur)=="boolean"?_(this,ur):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ur=new WeakMap,Rn=new WeakMap,ao=new WeakMap,Ph),cg=new pE,hE={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_n,bc,kh,mE=(kh=class{constructor(){J(this,_n,hE);J(this,bc,!1)}setTimeoutProvider(e){B(this,_n,e)}setTimeout(e,t){return _(this,_n).setTimeout(e,t)}clearTimeout(e){_(this,_n).clearTimeout(e)}setInterval(e,t){return _(this,_n).setInterval(e,t)}clearInterval(e){_(this,_n).clearInterval(e)}},_n=new WeakMap,bc=new WeakMap,kh),rc=new mE;function vE(e){setTimeout(e,0)}var gE=typeof window>"u"||"Deno"in globalThis;function Ct(){}function yE(e,t){return typeof e=="function"?e(t):e}function wE(e){return typeof e=="number"&&e>=0&&e!==1/0}function xE(e,t){return Math.max(e+(t||0)-Date.now(),0)}function oc(e,t){return typeof e=="function"?e(t):e}function SE(e,t){return typeof e=="function"?e(t):e}function _p(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:s,queryKey:i,stale:a}=e;if(i){if(r){if(t.queryHash!==bd(i,t.options))return!1}else if(!As(t.queryKey,i))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||s&&!s(t))}function Np(e,t){const{exact:n,status:r,predicate:o,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(Ns(t.options.mutationKey)!==Ns(s))return!1}else if(!As(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function bd(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ns)(e)}function Ns(e){return JSON.stringify(e,(t,n)=>sc(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function As(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>As(e[n],t[n])):!1}var EE=Object.prototype.hasOwnProperty;function dg(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Ap(e)&&Ap(t);if(!r&&!(sc(e)&&sc(t)))return t;const s=(r?e:Object.keys(e)).length,i=r?t:Object.keys(t),a=i.length,l=r?new Array(a):{};let u=0;for(let c=0;c{rc.setTimeout(t,e)})}function bE(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?dg(e,t):t}function oA(e){return e}function PE(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function kE(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Pd=Symbol();function fg(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Pd?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function sA(e,t){return typeof e=="function"?e(...t):!!e}function TE(e,t,n){let r=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=t()),r||(r=!0,o.aborted?n():o.addEventListener("abort",n,{once:!0})),o)}),e}var pg=(()=>{let e=()=>gE;return{isServer(){return e()},setIsServer(t){e=t}}})();function RE(){let e,t;const n=new Promise((o,s)=>{e=o,t=s});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}var _E=vE;function NE(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=_E;const s=a=>{t?e.push(a):o(()=>{n(a)})},i=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||i()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var ze=NE(),lo,Nn,uo,Th,AE=(Th=class extends Ga{constructor(){super();J(this,lo,!0);J(this,Nn);J(this,uo);B(this,uo,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){_(this,Nn)||this.setEventListener(_(this,uo))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Nn))==null||t.call(this),B(this,Nn,void 0))}setEventListener(t){var n;B(this,uo,t),(n=_(this,Nn))==null||n.call(this),B(this,Nn,t(this.setOnline.bind(this)))}setOnline(t){_(this,lo)!==t&&(B(this,lo,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,lo)}},lo=new WeakMap,Nn=new WeakMap,uo=new WeakMap,Th),ya=new AE;function ME(e){return Math.min(1e3*2**e,3e4)}function hg(e){return(e??"online")==="online"?ya.isOnline():!0}var ic=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function mg(e){let t=!1,n=0,r;const o=RE(),s=()=>o.status!=="pending",i=y=>{var x;if(!s()){const g=new ic(y);m(g),(x=e.onCancel)==null||x.call(e,g)}},a=()=>{t=!0},l=()=>{t=!1},u=()=>cg.isFocused()&&(e.networkMode==="always"||ya.isOnline())&&e.canRun(),c=()=>hg(e.networkMode)&&e.canRun(),d=y=>{s()||(r==null||r(),o.resolve(y))},m=y=>{s()||(r==null||r(),o.reject(y))},p=()=>new Promise(y=>{var x;r=g=>{(s()||u())&&y(g)},(x=e.onPause)==null||x.call(e)}).then(()=>{var y;r=void 0,s()||(y=e.onContinue)==null||y.call(e)}),E=()=>{if(s())return;let y;const x=n===0?e.initialPromise:void 0;try{y=x??e.fn()}catch(g){y=Promise.reject(g)}Promise.resolve(y).then(d).catch(g=>{var b;if(s())return;const v=e.retry??(pg.isServer()?0:3),w=e.retryDelay??ME,S=typeof w=="function"?w(n,g):w,C=v===!0||typeof v=="number"&&nu()?void 0:p()).then(()=>{t?m(g):E()})})};return{promise:o,status:()=>o.status,cancel:i,continue:()=>(r==null||r(),o),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?E():p().then(E),o)}}var cr,Rh,vg=(Rh=class{constructor(){J(this,cr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),wE(this.gcTime)&&B(this,cr,rc.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(pg.isServer()?1/0:5*60*1e3))}clearGcTimeout(){_(this,cr)!==void 0&&(rc.clearTimeout(_(this,cr)),B(this,cr,void 0))}},cr=new WeakMap,Rh);function OE(e){return{onFetch:(t,n)=>{var c,d,m,p,E;const r=t.options,o=(m=(d=(c=t.fetchOptions)==null?void 0:c.meta)==null?void 0:d.fetchMore)==null?void 0:m.direction,s=((p=t.state.data)==null?void 0:p.pages)||[],i=((E=t.state.data)==null?void 0:E.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let y=!1;const x=w=>{TE(w,()=>t.signal,()=>y=!0)},g=fg(t.options,t.fetchOptions),v=async(w,S,C)=>{if(y)return Promise.reject(t.signal.reason);if(S==null&&w.pages.length)return Promise.resolve(w);const P=(()=>{const $={client:t.client,queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};return x($),$})(),R=await g(P),{maxPages:O}=t.options,M=C?kE:PE;return{pages:M(w.pages,R,O),pageParams:M(w.pageParams,S,O)}};if(o&&s.length){const w=o==="backward",S=w?gg:ac,C={pages:s,pageParams:i},b=S(r,C);a=await v(C,b,w)}else{const w=e??s.length;do{const S=l===0?i[0]??r.initialPageParam:ac(r,a);if(l>0&&S==null)break;a=await v(a,S),l++}while(l{var y,x;return(x=(y=t.options).persister)==null?void 0:x.call(y,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function ac(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function gg(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function iA(e,t){return t?ac(e,t)!=null:!1}function aA(e,t){return!t||!e.getPreviousPageParam?!1:gg(e,t)!=null}var co,dr,fo,lt,fr,Pe,Ls,pr,Je,yg,Yt,_h,jE=(_h=class extends vg{constructor(t){super();J(this,Je);J(this,co);J(this,dr);J(this,fo);J(this,lt);J(this,fr);J(this,Pe);J(this,Ls);J(this,pr);B(this,pr,!1),B(this,Ls,t.defaultOptions),this.setOptions(t.options),this.observers=[],B(this,fr,t.client),B(this,lt,_(this,fr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,B(this,dr,jp(this.options)),this.state=t.state??_(this,dr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return _(this,co)}get promise(){var t;return(t=_(this,Pe))==null?void 0:t.promise}setOptions(t){if(this.options={..._(this,Ls),...t},t!=null&&t._type&&B(this,co,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=jp(this.options);n.data!==void 0&&(this.setState(Op(n.data,n.dataUpdatedAt)),B(this,dr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,lt).remove(this)}setData(t,n){const r=bE(this.state.data,t,this.options);return Ne(this,Je,Yt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){Ne(this,Je,Yt).call(this,{type:"setState",state:t})}cancel(t){var r,o;const n=(r=_(this,Pe))==null?void 0:r.promise;return(o=_(this,Pe))==null||o.cancel(t),n?n.then(Ct).catch(Ct):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return _(this,dr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>SE(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pd||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>oc(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!xE(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,Pe))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,Pe))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(this,lt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(_(this,Pe)&&(_(this,pr)||Ne(this,Je,yg).call(this)?_(this,Pe).cancel({revert:!0}):_(this,Pe).cancelRetry()),this.scheduleGc()),_(this,lt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ne(this,Je,Yt).call(this,{type:"invalidate"})}async fetch(t,n){var u,c,d,m,p,E,y,x,g,v,w;if(this.state.fetchStatus!=="idle"&&((u=_(this,Pe))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,Pe))return _(this,Pe).continueRetry(),_(this,Pe).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(C=>C.options.queryFn);S&&this.setOptions(S.options)}const r=new AbortController,o=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(B(this,pr,!0),r.signal)})},s=()=>{const S=fg(this.options,n),b=(()=>{const P={client:_(this,fr),queryKey:this.queryKey,meta:this.meta};return o(P),P})();return B(this,pr,!1),this.options.persister?this.options.persister(S,b,this):S(b)},a=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:_(this,fr),state:this.state,fetchFn:s};return o(S),S})(),l=_(this,co)==="infinite"?OE(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),B(this,fo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&Ne(this,Je,Yt).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),B(this,Pe,mg({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:S=>{S instanceof ic&&S.revert&&this.setState({..._(this,fo),fetchStatus:"idle"}),r.abort()},onFail:(S,C)=>{Ne(this,Je,Yt).call(this,{type:"failed",failureCount:S,error:C})},onPause:()=>{Ne(this,Je,Yt).call(this,{type:"pause"})},onContinue:()=>{Ne(this,Je,Yt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const S=await _(this,Pe).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(p=(m=_(this,lt).config).onSuccess)==null||p.call(m,S,this),(y=(E=_(this,lt).config).onSettled)==null||y.call(E,S,this.state.error,this),S}catch(S){if(S instanceof ic){if(S.silent)return _(this,Pe).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw Ne(this,Je,Yt).call(this,{type:"error",error:S}),(g=(x=_(this,lt).config).onError)==null||g.call(x,S,this),(w=(v=_(this,lt).config).onSettled)==null||w.call(v,this.state.data,S,this),S}finally{this.scheduleGc()}}},co=new WeakMap,dr=new WeakMap,fo=new WeakMap,lt=new WeakMap,fr=new WeakMap,Pe=new WeakMap,Ls=new WeakMap,pr=new WeakMap,Je=new WeakSet,yg=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Yt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...IE(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...r,...Op(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return B(this,fo,t.manual?o:void 0),o;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ze.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,lt).notify({query:this,type:"updated",action:t})})},_h);function IE(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:hg(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Op(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function jp(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ds,Dt,Le,hr,Ft,En,Nh,LE=(Nh=class extends vg{constructor(t){super();J(this,Ft);J(this,Ds);J(this,Dt);J(this,Le);J(this,hr);B(this,Ds,t.client),this.mutationId=t.mutationId,B(this,Le,t.mutationCache),B(this,Dt,[]),this.state=t.state||DE(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,Dt).includes(t)||(_(this,Dt).push(t),this.clearGcTimeout(),_(this,Le).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){B(this,Dt,_(this,Dt).filter(n=>n!==t)),this.scheduleGc(),_(this,Le).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,Dt).length||(this.state.status==="pending"?this.scheduleGc():_(this,Le).remove(this))}continue(){var t;return((t=_(this,hr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,a,l,u,c,d,m,p,E,y,x,g,v,w,S,C,b,P;const n=()=>{Ne(this,Ft,En).call(this,{type:"continue"})},r={client:_(this,Ds),meta:this.options.meta,mutationKey:this.options.mutationKey};B(this,hr,mg({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,O)=>{Ne(this,Ft,En).call(this,{type:"failed",failureCount:R,error:O})},onPause:()=>{Ne(this,Ft,En).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,Le).canRun(this)}));const o=this.state.status==="pending",s=!_(this,hr).canStart();try{if(o)n();else{Ne(this,Ft,En).call(this,{type:"pending",variables:t,isPaused:s}),_(this,Le).config.onMutate&&await _(this,Le).config.onMutate(t,this,r);const O=await((a=(i=this.options).onMutate)==null?void 0:a.call(i,t,r));O!==this.state.context&&Ne(this,Ft,En).call(this,{type:"pending",context:O,variables:t,isPaused:s})}const R=await _(this,hr).start();return await((u=(l=_(this,Le).config).onSuccess)==null?void 0:u.call(l,R,t,this.state.context,this,r)),await((d=(c=this.options).onSuccess)==null?void 0:d.call(c,R,t,this.state.context,r)),await((p=(m=_(this,Le).config).onSettled)==null?void 0:p.call(m,R,null,this.state.variables,this.state.context,this,r)),await((y=(E=this.options).onSettled)==null?void 0:y.call(E,R,null,t,this.state.context,r)),Ne(this,Ft,En).call(this,{type:"success",data:R}),R}catch(R){try{await((g=(x=_(this,Le).config).onError)==null?void 0:g.call(x,R,t,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((w=(v=this.options).onError)==null?void 0:w.call(v,R,t,this.state.context,r))}catch(O){Promise.reject(O)}try{await((C=(S=_(this,Le).config).onSettled)==null?void 0:C.call(S,void 0,R,this.state.variables,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((P=(b=this.options).onSettled)==null?void 0:P.call(b,void 0,R,t,this.state.context,r))}catch(O){Promise.reject(O)}throw Ne(this,Ft,En).call(this,{type:"error",error:R}),R}finally{_(this,Le).runNext(this)}}},Ds=new WeakMap,Dt=new WeakMap,Le=new WeakMap,hr=new WeakMap,Ft=new WeakSet,En=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ze.batch(()=>{_(this,Dt).forEach(r=>{r.onMutationUpdate(t)}),_(this,Le).notify({mutation:this,type:"updated",action:t})})},Nh);function DE(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Jt,bt,Fs,Ah,FE=(Ah=class extends Ga{constructor(t={}){super();J(this,Jt);J(this,bt);J(this,Fs);this.config=t,B(this,Jt,new Set),B(this,bt,new Map),B(this,Fs,0)}build(t,n,r){const o=new LE({client:t,mutationCache:this,mutationId:++ei(this,Fs)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){_(this,Jt).add(t);const n=yi(t);if(typeof n=="string"){const r=_(this,bt).get(n);r?r.push(t):_(this,bt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(_(this,Jt).delete(t)){const n=yi(t);if(typeof n=="string"){const r=_(this,bt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&_(this,bt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=yi(t);if(typeof n=="string"){const r=_(this,bt).get(n),o=r==null?void 0:r.find(s=>s.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=yi(t);if(typeof n=="string"){const o=(r=_(this,bt).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ze.batch(()=>{_(this,Jt).forEach(t=>{this.notify({type:"removed",mutation:t})}),_(this,Jt).clear(),_(this,bt).clear()})}getAll(){return Array.from(_(this,Jt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Np(n,r))}findAll(t={}){return this.getAll().filter(n=>Np(t,n))}notify(t){ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ze.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ct))))}},Jt=new WeakMap,bt=new WeakMap,Fs=new WeakMap,Ah);function yi(e){var t;return(t=e.options.scope)==null?void 0:t.id}var $t,Mh,$E=(Mh=class extends Ga{constructor(t={}){super();J(this,$t);this.config=t,B(this,$t,new Map)}build(t,n,r){const o=n.queryKey,s=n.queryHash??bd(o,n);let i=this.get(s);return i||(i=new jE({client:t,queryKey:o,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(i)),i}add(t){_(this,$t).has(t.queryHash)||(_(this,$t).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,$t).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,$t).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ze.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,$t).get(t)}getAll(){return[..._(this,$t).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>_p(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>_p(t,r)):n}notify(t){ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ze.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ze.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},$t=new WeakMap,Mh),ye,An,Mn,po,ho,On,mo,vo,Oh,zE=(Oh=class{constructor(e={}){J(this,ye);J(this,An);J(this,Mn);J(this,po);J(this,ho);J(this,On);J(this,mo);J(this,vo);B(this,ye,e.queryCache||new $E),B(this,An,e.mutationCache||new FE),B(this,Mn,e.defaultOptions||{}),B(this,po,new Map),B(this,ho,new Map),B(this,On,0)}mount(){ei(this,On)._++,_(this,On)===1&&(B(this,mo,cg.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,ye).onFocus())})),B(this,vo,ya.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,ye).onOnline())})))}unmount(){var e,t;ei(this,On)._--,_(this,On)===0&&((e=_(this,mo))==null||e.call(this),B(this,mo,void 0),(t=_(this,vo))==null||t.call(this),B(this,vo,void 0))}isFetching(e){return _(this,ye).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,An).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,ye).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=_(this,ye).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(oc(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return _(this,ye).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=_(this,ye).get(r.queryHash),s=o==null?void 0:o.state.data,i=yE(t,s);if(i!==void 0)return _(this,ye).build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return ze.batch(()=>_(this,ye).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,ye).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,ye);ze.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(this,ye);return ze.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ze.batch(()=>_(this,ye).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Ct).catch(Ct)}invalidateQueries(e,t={}){return ze.batch(()=>(_(this,ye).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ze.batch(()=>_(this,ye).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let s=o.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ct)),o.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ct)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(this,ye).build(this,t);return n.isStaleByTime(oc(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ct).catch(Ct)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ct).catch(Ct)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return ya.isOnline()?_(this,An).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,ye)}getMutationCache(){return _(this,An)}getDefaultOptions(){return _(this,Mn)}setDefaultOptions(e){B(this,Mn,e)}setQueryDefaults(e,t){_(this,po).set(Ns(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,po).values()],n={};return t.forEach(r=>{As(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){_(this,ho).set(Ns(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,ho).values()],n={};return t.forEach(r=>{As(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,Mn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=bd(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Pd&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Mn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,ye).clear(),_(this,An).clear()}},ye=new WeakMap,An=new WeakMap,Mn=new WeakMap,po=new WeakMap,ho=new WeakMap,On=new WeakMap,mo=new WeakMap,vo=new WeakMap,Oh),wg=f.createContext(void 0),lA=e=>{const t=f.useContext(wg);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},UE=({client:e,children:t})=>(f.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),h.jsx(wg.Provider,{value:e,children:t}));const Ip=e=>e.endsWith("/")?e.slice(0,-1):e;function kd(){const e="https://paperswithcode.co".trim();if(!e)return"";try{const t=e.startsWith("http")?new URL(e):new URL(e,typeof window<"u"?window.location.origin:"http://localhost");return Ip(t.origin)}catch{return Ip(e)}}function VE(e){const t=e.startsWith("/")?e:`/${e}`,n=kd();return n?`${n}${t}`:t}function Td(e){const t=e.startsWith("/")?e:`/${e}`;return VE(t)}function BE(){return Td("/admin-dashboard")}function uA(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("blob:")||e.startsWith("//"))return e;if(e.startsWith("/")){const t=kd();return t?`${t}${e}`:e}return e}function Hs(){const t=String("1").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"}function Ms(){const t=String("0").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"}function xg(e){return["1","true","yes"].includes("".trim().toLowerCase())}function WE(){return xg()}function cA(){return Ms()&&xg()}function dA(){return typeof window<"u"&&window.location.hostname==="staging.paperswithcode.co"}function HE(){const t=String("1").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"}const KE="/hf-logo.svg?v=20260513b",Lp=({size:e=14})=>h.jsx("img",{src:KE,alt:"",width:Math.round(e*95/88),height:e,"aria-hidden":"true",draggable:!1,style:{display:"block"}});function GE(e,t=!1,n=!1){const r=Td("/api/v1/auth/hf/login"),s=new URL(r,window.location.origin).origin===window.location.origin?e:new URL(e,window.location.origin).toString(),i=new URLSearchParams({return_to:s});return t&&i.set("authorize_inference","true"),n&&i.set("collect_email","true"),`${r}?${i.toString()}`}const Sg=({returnTo:e,compact:t=!1,label:n="Sign in",authorizeInference:r=!1,collectEmail:o=!1})=>{if(Hs())return null;const s=()=>{window.location.href=GE(e,r,o)};return t?h.jsx("button",{type:"button",className:"icon-btn","aria-label":"Sign in with Hugging Face",title:"Sign in with Hugging Face",onClick:s,children:h.jsx(Lp,{size:16})}):h.jsxs("button",{type:"button",className:"hf-signin-btn",onClick:s,"aria-label":"Sign in with Hugging Face",children:[h.jsx(Lp,{size:18}),h.jsx("span",{children:n})]})};function QE(e,t=[]){let n=[];function r(s,i){const a=f.createContext(i);a.displayName=s+"Context";const l=n.length;n=[...n,i];const u=d=>{var g;const{scope:m,children:p,...E}=d,y=((g=m==null?void 0:m[e])==null?void 0:g[l])||a,x=f.useMemo(()=>E,Object.values(E));return h.jsx(y.Provider,{value:x,children:p})};u.displayName=s+"Provider";function c(d,m){var y;const p=((y=m==null?void 0:m[e])==null?void 0:y[l])||a,E=f.useContext(p);if(E)return E;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[u,c]}const o=()=>{const s=n.map(i=>f.createContext(i));return function(a){const l=(a==null?void 0:a[e])||s;return f.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,YE(o,...t)]}function YE(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:l,scopeName:u})=>{const d=l(s)[`__scope${u}`];return{...a,...d}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function qe(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var vt=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{};function Dp(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function kr(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Dp(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o{let{children:s,...i}=r;Eg(s)&&typeof wa=="function"&&(s=wa(s._payload));const a=f.Children.toArray(s),l=a.find(eC);if(l){const u=l.props.children,c=a.map(d=>d===l?f.Children.count(u)>1?f.Children.only(null):f.isValidElement(u)?u.props.children:null:d);return h.jsx(t,{...i,ref:o,children:f.isValidElement(u)?f.cloneElement(u,void 0,c):null})}return h.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var fA=Cg("Slot");function ZE(e){const t=f.forwardRef((n,r)=>{let{children:o,...s}=n;if(Eg(o)&&typeof wa=="function"&&(o=wa(o._payload)),f.isValidElement(o)){const i=nC(o),a=tC(s,o.props);return o.type!==f.Fragment&&(a.ref=r?kr(r,i):i),f.cloneElement(o,a)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var JE=Symbol("radix.slottable");function eC(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===JE}function tC(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function nC(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var rC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rd=rC.reduce((e,t)=>{const n=Cg(`Primitive.${t}`),r=f.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),bg={exports:{}},Pg={};/** * @license React * use-sync-external-store-shim.production.js * @@ -73,8 +73,8 @@ Error generating stack: `+s.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ko=f;function nC(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var rC=typeof Object.is=="function"?Object.is:nC,oC=ko.useState,sC=ko.useEffect,iC=ko.useLayoutEffect,aC=ko.useDebugValue;function lC(e,t){var n=t(),r=oC({inst:{value:n,getSnapshot:t}}),o=r[0].inst,s=r[1];return iC(function(){o.value=n,o.getSnapshot=t,Vl(o)&&s({inst:o})},[e,n,t]),sC(function(){return Vl(o)&&s({inst:o}),e(function(){Vl(o)&&s({inst:o})})},[e]),aC(n),n}function Vl(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!rC(e,n)}catch{return!0}}function uC(e,t){return t()}var cC=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?uC:lC;Cg.useSyncExternalStore=ko.useSyncExternalStore!==void 0?ko.useSyncExternalStore:cC;Eg.exports=Cg;var dC=Eg.exports;function fC(){return dC.useSyncExternalStore(pC,()=>!0,()=>!1)}function pC(){return()=>{}}var Td="Avatar",[hC]=KE(Td),[mC,bg]=hC(Td),Pg=f.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[o,s]=f.useState("idle");return m.jsx(mC,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:s,children:m.jsx(kd.span,{...r,ref:t})})});Pg.displayName=Td;var kg="AvatarImage",Tg=f.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...s}=e,i=bg(kg,n),a=vC(r,s),l=qe(u=>{o(u),i.onImageLoadingStatusChange(u)});return vt(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?m.jsx(kd.img,{...s,ref:t,src:r}):null});Tg.displayName=kg;var Rg="AvatarFallback",_g=f.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...o}=e,s=bg(Rg,n),[i,a]=f.useState(r===void 0);return f.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),i&&s.imageLoadingStatus!=="loaded"?m.jsx(kd.span,{...o,ref:t}):null});_g.displayName=Rg;function Ip(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function vC(e,{referrerPolicy:t,crossOrigin:n}){const r=fC(),o=f.useRef(null),s=r?(o.current||(o.current=new window.Image),o.current):null,[i,a]=f.useState(()=>Ip(s,e));return vt(()=>{a(Ip(s,e))},[s,e]),vt(()=>{const l=d=>()=>{a(d)};if(!s)return;const u=l("loaded"),c=l("error");return s.addEventListener("load",u),s.addEventListener("error",c),t&&(s.referrerPolicy=t),typeof n=="string"&&(s.crossOrigin=n),()=>{s.removeEventListener("load",u),s.removeEventListener("error",c)}},[s,n,t]),i}var Ng=Pg,Ag=Tg,Mg=_g;function Og(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t{const t=wC(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(Rd);return a[0]===""&&a.length!==1&&a.shift(),Ig(a,t)||yC(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},Ig=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?Ig(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(Rd);return(i=t.validators.find(({validator:a})=>a(s)))==null?void 0:i.classGroupId},Lp=/^\[(.+)\]$/,yC=e=>{if(Lp.test(e)){const t=Lp.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},wC=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return SC(Object.entries(e.classGroups),n).forEach(([s,i])=>{ic(i,r,s,t)}),r},ic=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Dp(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(xC(o)){ic(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{ic(i,Dp(t,s),n,r)})})},Dp=(e,t)=>{let n=e;return t.split(Rd).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},xC=e=>e.isThemeGetter,SC=(e,t)=>t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([i,a])=>[t+i,a])):s);return[n,o]}):e,EC=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},Lg="!",CC=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length,i=a=>{const l=[];let u=0,c=0,d;for(let x=0;xc?d-c:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:E,maybePostfixModifierPosition:y}};return n?a=>n({className:a,parseClassName:i}):i},bC=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},PC=e=>({cache:EC(e.cacheSize),parseClassName:CC(e),...gC(e)}),kC=/\s+/,TC=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=[],i=e.trim().split(kC);let a="";for(let l=i.length-1;l>=0;l-=1){const u=i[l],{modifiers:c,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let E=!!p,y=r(E?h.substring(0,p):h);if(!y){if(!E){a=u+(a.length>0?" "+a:a);continue}if(y=r(h),!y){a=u+(a.length>0?" "+a:a);continue}E=!1}const x=bC(c).join(":"),g=d?x+Lg:x,v=g+y;if(s.includes(v))continue;s.push(v);const w=o(y,E);for(let S=0;S0?" "+a:a)}return a};function RC(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rd(c),e());return n=PC(u),r=n.cache.get,o=n.cache.set,s=a,a(l)}function a(l){const u=r(l);if(u)return u;const c=TC(l,n);return o(l,c),c}return function(){return s(RC.apply(null,arguments))}}const ie=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Fg=/^\[(?:([a-z-]+):)?(.+)\]$/i,NC=/^\d+\/\d+$/,AC=new Set(["px","full","screen"]),MC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,OC=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,jC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qt=e=>oo(e)||AC.has(e)||NC.test(e),xn=e=>Oo(e,"length",WC),oo=e=>!!e&&!Number.isNaN(Number(e)),Bl=e=>Oo(e,"number",oo),Ko=e=>!!e&&Number.isInteger(Number(e)),DC=e=>e.endsWith("%")&&oo(e.slice(0,-1)),Q=e=>Fg.test(e),Sn=e=>MC.test(e),FC=new Set(["length","size","percentage"]),$C=e=>Oo(e,FC,$g),zC=e=>Oo(e,"position",$g),UC=new Set(["image","url"]),VC=e=>Oo(e,UC,KC),BC=e=>Oo(e,"",HC),Go=()=>!0,Oo=(e,t,n)=>{const r=Fg.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},WC=e=>OC.test(e)&&!jC.test(e),$g=()=>!1,HC=e=>IC.test(e),KC=e=>LC.test(e),GC=()=>{const e=ie("colors"),t=ie("spacing"),n=ie("blur"),r=ie("brightness"),o=ie("borderColor"),s=ie("borderRadius"),i=ie("borderSpacing"),a=ie("borderWidth"),l=ie("contrast"),u=ie("grayscale"),c=ie("hueRotate"),d=ie("invert"),h=ie("gap"),p=ie("gradientColorStops"),E=ie("gradientColorStopPositions"),y=ie("inset"),x=ie("margin"),g=ie("opacity"),v=ie("padding"),w=ie("saturate"),S=ie("scale"),C=ie("sepia"),b=ie("skew"),P=ie("space"),R=ie("translate"),O=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",Q,t],L=()=>[Q,t],H=()=>["",Qt,xn],I=()=>["auto",oo,Q],Y=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],z=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],N=()=>["start","end","center","between","around","evenly","stretch"],k=()=>["","0",Q],j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[oo,Q];return{cacheSize:500,separator:":",theme:{colors:[Go],spacing:[Qt,xn],blur:["none","",Sn,Q],brightness:U(),borderColor:[e],borderRadius:["none","","full",Sn,Q],borderSpacing:L(),borderWidth:H(),contrast:U(),grayscale:k(),hueRotate:U(),invert:k(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[DC,xn],inset:$(),margin:$(),opacity:U(),padding:L(),saturate:U(),scale:U(),sepia:k(),skew:U(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",Q]}],container:["container"],columns:[{columns:[Sn]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Y(),Q]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ko,Q]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Q]}],grow:[{grow:k()}],shrink:[{shrink:k()}],order:[{order:["first","last","none",Ko,Q]}],"grid-cols":[{"grid-cols":[Go]}],"col-start-end":[{col:["auto",{span:["full",Ko,Q]},Q]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[Go]}],"row-start-end":[{row:["auto",{span:[Ko,Q]},Q]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Q]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Q]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...N()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...N(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...N(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Q,t]}],"min-w":[{"min-w":[Q,t,"min","max","fit"]}],"max-w":[{"max-w":[Q,t,"none","full","min","max","fit","prose",{screen:[Sn]},Sn]}],h:[{h:[Q,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Q,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Q,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Q,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Sn,xn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Bl]}],"font-family":[{font:[Go]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Q]}],"line-clamp":[{"line-clamp":["none",oo,Bl]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Qt,Q]}],"list-image":[{"list-image":["none",Q]}],"list-style-type":[{list:["none","disc","decimal",Q]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Qt,xn]}],"underline-offset":[{"underline-offset":["auto",Qt,Q]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Y(),zC]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",$C]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VC]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[E]}],"gradient-via-pos":[{via:[E]}],"gradient-to-pos":[{to:[E]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...z(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:z()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...z()]}],"outline-offset":[{"outline-offset":[Qt,Q]}],"outline-w":[{outline:[Qt,xn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[Qt,xn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Sn,BC]}],"shadow-color":[{shadow:[Go]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Sn,Q]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Q]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",Q]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",Q]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Ko,Q]}],"translate-x":[{"translate-x":[R]}],"translate-y":[{"translate-y":[R]}],"skew-x":[{"skew-x":[b]}],"skew-y":[{"skew-y":[b]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Q]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Qt,xn,Bl]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},QC=_C(GC);function _e(...e){return QC(jg(e))}function uA(e){const t=e.trim(),n=t.match(/^(\d{4})-(\d{4,5})(v\d+)?$/);if(n)return`${n[1]}.${n[2]}`;const r=t.match(/^(\d{4}\.\d{4,5})(v\d+)$/);return r?r[1]:t}function cA(e){if(e==null||e==="")return"—";const t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.abs(t)>=100?t.toFixed(0):Math.abs(t)>=10?t.toFixed(1):t.toFixed(2):String(e)}const zg=f.forwardRef(({className:e,...t},n)=>m.jsx(Ng,{ref:n,className:_e("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));zg.displayName=Ng.displayName;const Ug=f.forwardRef(({className:e,...t},n)=>m.jsx(Ag,{ref:n,className:_e("aspect-square h-full w-full",e),...t}));Ug.displayName=Ag.displayName;const Vg=f.forwardRef(({className:e,...t},n)=>m.jsx(Mg,{ref:n,className:_e("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));Vg.displayName=Mg.displayName;function V(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function dA(e,t){const n=f.createContext(t),r=s=>{const{children:i,...a}=s,l=f.useMemo(()=>a,Object.values(a));return m.jsx(n.Provider,{value:l,children:i})};r.displayName=e+"Provider";function o(s){const i=f.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function Tr(e,t=[]){let n=[];function r(s,i){const a=f.createContext(i),l=n.length;n=[...n,i];const u=d=>{var g;const{scope:h,children:p,...E}=d,y=((g=h==null?void 0:h[e])==null?void 0:g[l])||a,x=f.useMemo(()=>E,Object.values(E));return m.jsx(y.Provider,{value:x,children:p})};u.displayName=s+"Provider";function c(d,h){var y;const p=((y=h==null?void 0:h[e])==null?void 0:y[l])||a,E=f.useContext(p);if(E)return E;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[u,c]}const o=()=>{const s=n.map(i=>f.createContext(i));return function(a){const l=(a==null?void 0:a[e])||s;return f.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,YC(o,...t)]}function YC(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:l,scopeName:u})=>{const d=l(s)[`__scope${u}`];return{...a,...d}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var XC=Ta[" useInsertionEffect ".trim().toString()]||vt;function _d({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=qC({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:o;{const c=f.useRef(e!==void 0);f.useEffect(()=>{const d=c.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=a},[a,r])}const u=f.useCallback(c=>{var d;if(a){const h=ZC(c)?c(e):c;h!==e&&((d=i.current)==null||d.call(i,h))}else s(c)},[a,e,s,i]);return[l,u]}function qC({defaultProp:e,onChange:t}){const[n,r]=f.useState(e),o=f.useRef(n),s=f.useRef(t);return XC(()=>{s.current=t},[t]),f.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function ZC(e){return typeof e=="function"}function JC(e){const t=eb(e),n=f.forwardRef((r,o)=>{const{children:s,...i}=r,a=f.Children.toArray(s),l=a.find(nb);if(l){const u=l.props.children,c=a.map(d=>d===l?f.Children.count(u)>1?f.Children.only(null):f.isValidElement(u)?u.props.children:null:d);return m.jsx(t,{...i,ref:o,children:f.isValidElement(u)?f.cloneElement(u,void 0,c):null})}return m.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function eb(e){const t=f.forwardRef((n,r)=>{const{children:o,...s}=n;if(f.isValidElement(o)){const i=ob(o),a=rb(s,o.props);return o.type!==f.Fragment&&(a.ref=r?kr(r,i):i),f.cloneElement(o,a)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tb=Symbol("radix.slottable");function nb(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tb}function rb(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function ob(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var sb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ve=sb.reduce((e,t)=>{const n=JC(`Primitive.${t}`),r=f.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Nd(e,t){e&&Bs.flushSync(()=>e.dispatchEvent(t))}function Fp(e){const t=ib(e),n=f.forwardRef((r,o)=>{const{children:s,...i}=r,a=f.Children.toArray(s),l=a.find(lb);if(l){const u=l.props.children,c=a.map(d=>d===l?f.Children.count(u)>1?f.Children.only(null):f.isValidElement(u)?u.props.children:null:d);return m.jsx(t,{...i,ref:o,children:f.isValidElement(u)?f.cloneElement(u,void 0,c):null})}return m.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function ib(e){const t=f.forwardRef((n,r)=>{const{children:o,...s}=n;if(f.isValidElement(o)){const i=cb(o),a=ub(s,o.props);return o.type!==f.Fragment&&(a.ref=r?kr(r,i):i),f.cloneElement(o,a)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ab=Symbol("radix.slottable");function lb(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ab}function ub(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function cb(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ad(e){const t=e+"CollectionProvider",[n,r]=Tr(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=y=>{const{scope:x,children:g}=y,v=T.useRef(null),w=T.useRef(new Map).current;return m.jsx(o,{scope:x,itemMap:w,collectionRef:v,children:g})};i.displayName=t;const a=e+"CollectionSlot",l=Fp(a),u=T.forwardRef((y,x)=>{const{scope:g,children:v}=y,w=s(a,g),S=Re(x,w.collectionRef);return m.jsx(l,{ref:S,children:v})});u.displayName=a;const c=e+"CollectionItemSlot",d="data-radix-collection-item",h=Fp(c),p=T.forwardRef((y,x)=>{const{scope:g,children:v,...w}=y,S=T.useRef(null),C=Re(x,S),b=s(c,g);return T.useEffect(()=>(b.itemMap.set(S,{ref:S,...w}),()=>void b.itemMap.delete(S))),m.jsx(h,{[d]:"",ref:C,children:v})});p.displayName=c;function E(y){const x=s(e+"CollectionConsumer",y);return T.useCallback(()=>{const v=x.collectionRef.current;if(!v)return[];const w=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(x.itemMap.values()).sort((b,P)=>w.indexOf(b.ref.current)-w.indexOf(P.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:p},E,r]}var db=f.createContext(void 0);function Bg(e){const t=f.useContext(db);return e||t||"ltr"}function fb(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e);f.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var pb="DismissableLayer",ac="dismissableLayer.update",hb="dismissableLayer.pointerDownOutside",mb="dismissableLayer.focusOutside",$p,Wg=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qa=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...l}=e,u=f.useContext(Wg),[c,d]=f.useState(null),h=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=f.useState({}),E=Re(t,P=>d(P)),y=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=y.indexOf(x),v=c?y.indexOf(c):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=g,C=gb(P=>{const R=P.target,O=[...u.branches].some(M=>M.contains(R));!S||O||(o==null||o(P),i==null||i(P),P.defaultPrevented||a==null||a())},h),b=yb(P=>{const R=P.target;[...u.branches].some(M=>M.contains(R))||(s==null||s(P),i==null||i(P),P.defaultPrevented||a==null||a())},h);return fb(P=>{v===u.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&a&&(P.preventDefault(),a()))},h),f.useEffect(()=>{if(c)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&($p=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),zp(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=$p)}},[c,h,n,u]),f.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),zp())},[c,u]),f.useEffect(()=>{const P=()=>p({});return document.addEventListener(ac,P),()=>document.removeEventListener(ac,P)},[]),m.jsx(ve.div,{...l,ref:E,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:V(e.onFocusCapture,b.onFocusCapture),onBlurCapture:V(e.onBlurCapture,b.onBlurCapture),onPointerDownCapture:V(e.onPointerDownCapture,C.onPointerDownCapture)})});Qa.displayName=pb;var vb="DismissableLayerBranch",Hg=f.forwardRef((e,t)=>{const n=f.useContext(Wg),r=f.useRef(null),o=Re(t,r);return f.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),m.jsx(ve.div,{...e,ref:o})});Hg.displayName=vb;function gb(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e),r=f.useRef(!1),o=f.useRef(()=>{});return f.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){Kg(hb,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function yb(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e),r=f.useRef(!1);return f.useEffect(()=>{const o=s=>{s.target&&!r.current&&Kg(mb,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function zp(){const e=new CustomEvent(ac);document.dispatchEvent(e)}function Kg(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Nd(o,s):o.dispatchEvent(s)}var wb=Qa,xb=Hg,Wl=0;function Sb(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Up()),document.body.insertAdjacentElement("beforeend",e[1]??Up()),Wl++,()=>{Wl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Wl--}},[])}function Up(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Hl="focusScope.autoFocusOnMount",Kl="focusScope.autoFocusOnUnmount",Vp={bubbles:!1,cancelable:!0},Eb="FocusScope",Gg=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,l]=f.useState(null),u=qe(o),c=qe(s),d=f.useRef(null),h=Re(t,y=>l(y)),p=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(r){let y=function(w){if(p.paused||!a)return;const S=w.target;a.contains(S)?d.current=S:Cn(d.current,{select:!0})},x=function(w){if(p.paused||!a)return;const S=w.relatedTarget;S!==null&&(a.contains(S)||Cn(d.current,{select:!0}))},g=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&Cn(a)};document.addEventListener("focusin",y),document.addEventListener("focusout",x);const v=new MutationObserver(g);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),v.disconnect()}}},[r,a,p.paused]),f.useEffect(()=>{if(a){Wp.add(p);const y=document.activeElement;if(!a.contains(y)){const g=new CustomEvent(Hl,Vp);a.addEventListener(Hl,u),a.dispatchEvent(g),g.defaultPrevented||(Cb(Rb(Qg(a)),{select:!0}),document.activeElement===y&&Cn(a))}return()=>{a.removeEventListener(Hl,u),setTimeout(()=>{const g=new CustomEvent(Kl,Vp);a.addEventListener(Kl,c),a.dispatchEvent(g),g.defaultPrevented||Cn(y??document.body,{select:!0}),a.removeEventListener(Kl,c),Wp.remove(p)},0)}}},[a,u,c,p]);const E=f.useCallback(y=>{if(!n&&!r||p.paused)return;const x=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,g=document.activeElement;if(x&&g){const v=y.currentTarget,[w,S]=bb(v);w&&S?!y.shiftKey&&g===S?(y.preventDefault(),n&&Cn(w,{select:!0})):y.shiftKey&&g===w&&(y.preventDefault(),n&&Cn(S,{select:!0})):g===v&&y.preventDefault()}},[n,r,p.paused]);return m.jsx(ve.div,{tabIndex:-1,...i,ref:h,onKeyDown:E})});Gg.displayName=Eb;function Cb(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Cn(r,{select:t}),document.activeElement!==n)return}function bb(e){const t=Qg(e),n=Bp(t,e),r=Bp(t.reverse(),e);return[n,r]}function Qg(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Bp(e,t){for(const n of e)if(!Pb(n,{upTo:t}))return n}function Pb(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function kb(e){return e instanceof HTMLInputElement&&"select"in e}function Cn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&kb(e)&&t&&e.select()}}var Wp=Tb();function Tb(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Hp(e,t),e.unshift(t)},remove(t){var n;e=Hp(e,t),(n=e[0])==null||n.resume()}}}function Hp(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Rb(e){return e.filter(t=>t.tagName!=="A")}var _b=Ta[" useId ".trim().toString()]||(()=>{}),Nb=0;function lc(e){const[t,n]=f.useState(_b());return vt(()=>{n(r=>r??String(Nb++))},[e]),t?`radix-${t}`:""}const Ab=["top","right","bottom","left"],Qn=Math.min,et=Math.max,xa=Math.round,yi=Math.floor,Ht=e=>({x:e,y:e}),Mb={left:"right",right:"left",bottom:"top",top:"bottom"};function uc(e,t,n){return et(e,Qn(t,n))}function ln(e,t){return typeof e=="function"?e(t):e}function un(e){return e.split("-")[0]}function jo(e){return e.split("-")[1]}function Md(e){return e==="x"?"y":"x"}function Od(e){return e==="y"?"height":"width"}function Vt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function jd(e){return Md(Vt(e))}function Ob(e,t,n){n===void 0&&(n=!1);const r=jo(e),o=jd(e),s=Od(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Sa(i)),[i,Sa(i)]}function jb(e){const t=Sa(e);return[cc(e),t,cc(t)]}function cc(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Kp=["left","right"],Gp=["right","left"],Ib=["top","bottom"],Lb=["bottom","top"];function Db(e,t,n){switch(e){case"top":case"bottom":return n?t?Gp:Kp:t?Kp:Gp;case"left":case"right":return t?Ib:Lb;default:return[]}}function Fb(e,t,n,r){const o=jo(e);let s=Db(un(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(cc)))),s}function Sa(e){const t=un(e);return Mb[t]+e.slice(t.length)}function $b(e){return{top:0,right:0,bottom:0,left:0,...e}}function Yg(e){return typeof e!="number"?$b(e):{top:e,right:e,bottom:e,left:e}}function Ea(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Qp(e,t,n){let{reference:r,floating:o}=e;const s=Vt(t),i=jd(t),a=Od(i),l=un(t),u=s==="y",c=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let p;switch(l){case"top":p={x:c,y:r.y-o.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(jo(t)){case"start":p[i]-=h*(n&&u?-1:1);break;case"end":p[i]+=h*(n&&u?-1:1);break}return p}async function zb(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=ln(t,e),E=Yg(p),x=a[h?d==="floating"?"reference":"floating":d],g=Ea(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),v=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},C=Ea(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:w,strategy:l}):v);return{top:(g.top-C.top+E.top)/S.y,bottom:(C.bottom-g.bottom+E.bottom)/S.y,left:(g.left-C.left+E.left)/S.x,right:(C.right-g.right+E.right)/S.x}}const Ub=50,Vb=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:zb},l=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:d}=Qp(u,r,l),h=r,p=0;const E={};for(let y=0;y({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:u,padding:c=0}=ln(e,t)||{};if(u==null)return{};const d=Yg(c),h={x:n,y:r},p=jd(o),E=Od(p),y=await i.getDimensions(u),x=p==="y",g=x?"top":"left",v=x?"bottom":"right",w=x?"clientHeight":"clientWidth",S=s.reference[E]+s.reference[p]-h[p]-s.floating[E],C=h[p]-s.reference[p],b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let P=b?b[w]:0;(!P||!await(i.isElement==null?void 0:i.isElement(b)))&&(P=a.floating[w]||s.floating[E]);const R=S/2-C/2,O=P/2-y[E]/2-1,M=Qn(d[g],O),$=Qn(d[v],O),L=M,H=P-y[E]-$,I=P/2-y[E]/2+R,Y=uc(L,I,H),z=!l.arrow&&jo(o)!=null&&I!==Y&&s.reference[E]/2-(II<=0)){var $,L;const I=((($=s.flip)==null?void 0:$.index)||0)+1,Y=P[I];if(Y&&(!(d==="alignment"?v!==Vt(Y):!1)||M.every(N=>Vt(N.placement)===v?N.overflows[0]>0:!0)))return{data:{index:I,overflows:M},reset:{placement:Y}};let z=(L=M.filter(W=>W.overflows[0]<=0).sort((W,N)=>W.overflows[1]-N.overflows[1])[0])==null?void 0:L.placement;if(!z)switch(p){case"bestFit":{var H;const W=(H=M.filter(N=>{if(b){const k=Vt(N.placement);return k===v||k==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(k=>k>0).reduce((k,j)=>k+j,0)]).sort((N,k)=>N[1]-k[1])[0])==null?void 0:H[0];W&&(z=W);break}case"initialPlacement":z=a;break}if(o!==z)return{reset:{placement:z}}}return{}}}};function Yp(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Xp(e){return Ab.some(t=>e[t]>=0)}const Hb=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=ln(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=Yp(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Xp(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=Yp(i,n.floating);return{data:{escapedOffsets:a,escaped:Xp(a)}}}default:return{}}}}},Xg=new Set(["left","top"]);async function Kb(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=un(n),a=jo(n),l=Vt(n)==="y",u=Xg.has(i)?-1:1,c=s&&l?-1:1,d=ln(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:E}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof E=="number"&&(p=a==="end"?E*-1:E),l?{x:p*c,y:h*u}:{x:h*u,y:p*c}}const Gb=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,l=await Kb(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:i}}}}},Qb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:g=>{let{x:v,y:w}=g;return{x:v,y:w}}},...u}=ln(e,t),c={x:n,y:r},d=await s.detectOverflow(t,u),h=Vt(un(o)),p=Md(h);let E=c[p],y=c[h];if(i){const g=p==="y"?"top":"left",v=p==="y"?"bottom":"right",w=E+d[g],S=E-d[v];E=uc(w,E,S)}if(a){const g=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=y+d[g],S=y-d[v];y=uc(w,y,S)}const x=l.fn({...t,[p]:E,[h]:y});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[p]:i,[h]:a}}}}}},Yb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=ln(e,t),c={x:n,y:r},d=Vt(o),h=Md(d);let p=c[h],E=c[d];const y=ln(a,t),x=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(l){const w=h==="y"?"height":"width",S=s.reference[h]-s.floating[w]+x.mainAxis,C=s.reference[h]+s.reference[w]-x.mainAxis;pC&&(p=C)}if(u){var g,v;const w=h==="y"?"width":"height",S=Xg.has(un(o)),C=s.reference[d]-s.floating[w]+(S&&((g=i.offset)==null?void 0:g[d])||0)+(S?0:x.crossAxis),b=s.reference[d]+s.reference[w]+(S?0:((v=i.offset)==null?void 0:v[d])||0)-(S?x.crossAxis:0);Eb&&(E=b)}return{[h]:p,[d]:E}}}},Xb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:l=()=>{},...u}=ln(e,t),c=await i.detectOverflow(t,u),d=un(o),h=jo(o),p=Vt(o)==="y",{width:E,height:y}=s.floating;let x,g;d==="top"||d==="bottom"?(x=d,g=h===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(g=d,x=h==="end"?"top":"bottom");const v=y-c.top-c.bottom,w=E-c.left-c.right,S=Qn(y-c[x],v),C=Qn(E-c[g],w),b=!t.middlewareData.shift;let P=S,R=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=v),b&&!h){const M=et(c.left,0),$=et(c.right,0),L=et(c.top,0),H=et(c.bottom,0);p?R=E-2*(M!==0||$!==0?M+$:et(c.left,c.right)):P=y-2*(L!==0||H!==0?L+H:et(c.top,c.bottom))}await l({...t,availableWidth:R,availableHeight:P});const O=await i.getDimensions(a.floating);return E!==O.width||y!==O.height?{reset:{rects:!0}}:{}}}};function Ya(){return typeof window<"u"}function Io(e){return qg(e)?(e.nodeName||"").toLowerCase():"#document"}function rt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Kt(e){var t;return(t=(qg(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function qg(e){return Ya()?e instanceof Node||e instanceof rt(e).Node:!1}function Nt(e){return Ya()?e instanceof Element||e instanceof rt(e).Element:!1}function pn(e){return Ya()?e instanceof HTMLElement||e instanceof rt(e).HTMLElement:!1}function qp(e){return!Ya()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rt(e).ShadowRoot}function Hs(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=At(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function qb(e){return/^(table|td|th)$/.test(Io(e))}function Xa(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Zb=/transform|translate|scale|rotate|perspective|filter/,Jb=/paint|layout|strict|content/,rr=e=>!!e&&e!=="none";let Gl;function Id(e){const t=Nt(e)?At(e):e;return rr(t.transform)||rr(t.translate)||rr(t.scale)||rr(t.rotate)||rr(t.perspective)||!Ld()&&(rr(t.backdropFilter)||rr(t.filter))||Zb.test(t.willChange||"")||Jb.test(t.contain||"")}function eP(e){let t=Yn(e);for(;pn(t)&&!To(t);){if(Id(t))return t;if(Xa(t))return null;t=Yn(t)}return null}function Ld(){return Gl==null&&(Gl=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Gl}function To(e){return/^(html|body|#document)$/.test(Io(e))}function At(e){return rt(e).getComputedStyle(e)}function qa(e){return Nt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yn(e){if(Io(e)==="html")return e;const t=e.assignedSlot||e.parentNode||qp(e)&&e.host||Kt(e);return qp(t)?t.host:t}function Zg(e){const t=Yn(e);return To(t)?e.ownerDocument?e.ownerDocument.body:e.body:pn(t)&&Hs(t)?t:Zg(t)}function Ms(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Zg(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=rt(o);if(s){const a=dc(i);return t.concat(i,i.visualViewport||[],Hs(o)?o:[],a&&n?Ms(a):[])}else return t.concat(o,Ms(o,[],n))}function dc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Jg(e){const t=At(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=pn(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=xa(n)!==s||xa(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Dd(e){return Nt(e)?e:e.contextElement}function so(e){const t=Dd(e);if(!pn(t))return Ht(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Jg(t);let i=(s?xa(n.width):n.width)/r,a=(s?xa(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const tP=Ht(0);function ey(e){const t=rt(e);return!Ld()||!t.visualViewport?tP:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nP(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==rt(e)?!1:t}function Er(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Dd(e);let i=Ht(1);t&&(r?Nt(r)&&(i=so(r)):i=so(e));const a=nP(s,n,r)?ey(s):Ht(0);let l=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,c=o.width/i.x,d=o.height/i.y;if(s){const h=rt(s),p=r&&Nt(r)?rt(r):r;let E=h,y=dc(E);for(;y&&r&&p!==E;){const x=so(y),g=y.getBoundingClientRect(),v=At(y),w=g.left+(y.clientLeft+parseFloat(v.paddingLeft))*x.x,S=g.top+(y.clientTop+parseFloat(v.paddingTop))*x.y;l*=x.x,u*=x.y,c*=x.x,d*=x.y,l+=w,u+=S,E=rt(y),y=dc(E)}}return Ea({width:c,height:d,x:l,y:u})}function Za(e,t){const n=qa(e).scrollLeft;return t?t.left+n:Er(Kt(e)).left+n}function ty(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Za(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function rP(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Kt(r),a=t?Xa(t.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},u=Ht(1);const c=Ht(0),d=pn(r);if((d||!d&&!s)&&((Io(r)!=="body"||Hs(i))&&(l=qa(r)),d)){const p=Er(r);u=so(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const h=i&&!d&&!s?ty(i,l):Ht(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x+h.x,y:n.y*u.y-l.scrollTop*u.y+c.y+h.y}}function oP(e){return Array.from(e.getClientRects())}function sP(e){const t=Kt(e),n=qa(e),r=e.ownerDocument.body,o=et(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=et(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Za(e);const a=-n.scrollTop;return At(r).direction==="rtl"&&(i+=et(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const Zp=25;function iP(e,t){const n=rt(e),r=Kt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;const c=Ld();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const u=Za(r);if(u<=0){const c=r.ownerDocument,d=c.body,h=getComputedStyle(d),p=c.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,E=Math.abs(r.clientWidth-d.clientWidth-p);E<=Zp&&(s-=E)}else u<=Zp&&(s+=u);return{width:s,height:i,x:a,y:l}}function aP(e,t){const n=Er(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=pn(e)?so(e):Ht(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,u=r*s.y;return{width:i,height:a,x:l,y:u}}function Jp(e,t,n){let r;if(t==="viewport")r=iP(e,n);else if(t==="document")r=sP(Kt(e));else if(Nt(t))r=aP(t,n);else{const o=ey(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ea(r)}function ny(e,t){const n=Yn(e);return n===t||!Nt(n)||To(n)?!1:At(n).position==="fixed"||ny(n,t)}function lP(e,t){const n=t.get(e);if(n)return n;let r=Ms(e,[],!1).filter(a=>Nt(a)&&Io(a)!=="body"),o=null;const s=At(e).position==="fixed";let i=s?Yn(e):e;for(;Nt(i)&&!To(i);){const a=At(i),l=Id(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Hs(i)&&!l&&ny(e,i))?r=r.filter(c=>c!==i):o=a,i=Yn(i)}return t.set(e,r),r}function uP(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Xa(t)?[]:lP(t,this._c):[].concat(n),r],a=Jp(t,i[0],o);let l=a.top,u=a.right,c=a.bottom,d=a.left;for(let h=1;h{i(!1,1e-7)},1e3)}P===1&&!oy(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(C,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return i(!0),s}function vP(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=Dd(e),c=o||s?[...u?Ms(u):[],...t?Ms(t):[]]:[];c.forEach(g=>{o&&g.addEventListener("scroll",n,{passive:!0}),s&&g.addEventListener("resize",n)});const d=u&&a?mP(u,n):null;let h=-1,p=null;i&&(p=new ResizeObserver(g=>{let[v]=g;v&&v.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),u&&!l&&p.observe(u),t&&p.observe(t));let E,y=l?Er(e):null;l&&x();function x(){const g=Er(e);y&&!oy(y,g)&&n(),y=g,E=requestAnimationFrame(x)}return n(),()=>{var g;c.forEach(v=>{o&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),d==null||d(),(g=p)==null||g.disconnect(),p=null,l&&cancelAnimationFrame(E)}}const gP=Gb,yP=Qb,wP=Wb,xP=Xb,SP=Hb,th=Bb,EP=Yb,CP=(e,t,n)=>{const r=new Map,o={platform:hP,...n},s={...o.platform,_c:r};return Vb(e,t,{...o,platform:s})};var bP=typeof document<"u",PP=function(){},Fi=bP?f.useLayoutEffect:PP;function Ca(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ca(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ca(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function sy(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nh(e,t){const n=sy(e);return Math.round(t*n)/n}function Yl(e){const t=f.useRef(e);return Fi(()=>{t.current=e}),t}function kP(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:u}=e,[c,d]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=f.useState(r);Ca(h,r)||p(r);const[E,y]=f.useState(null),[x,g]=f.useState(null),v=f.useCallback(N=>{N!==b.current&&(b.current=N,y(N))},[]),w=f.useCallback(N=>{N!==P.current&&(P.current=N,g(N))},[]),S=s||E,C=i||x,b=f.useRef(null),P=f.useRef(null),R=f.useRef(c),O=l!=null,M=Yl(l),$=Yl(o),L=Yl(u),H=f.useCallback(()=>{if(!b.current||!P.current)return;const N={placement:t,strategy:n,middleware:h};$.current&&(N.platform=$.current),CP(b.current,P.current,N).then(k=>{const j={...k,isPositioned:L.current!==!1};I.current&&!Ca(R.current,j)&&(R.current=j,Bs.flushSync(()=>{d(j)}))})},[h,t,n,$,L]);Fi(()=>{u===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,d(N=>({...N,isPositioned:!1})))},[u]);const I=f.useRef(!1);Fi(()=>(I.current=!0,()=>{I.current=!1}),[]),Fi(()=>{if(S&&(b.current=S),C&&(P.current=C),S&&C){if(M.current)return M.current(S,C,H);H()}},[S,C,H,M,O]);const Y=f.useMemo(()=>({reference:b,floating:P,setReference:v,setFloating:w}),[v,w]),z=f.useMemo(()=>({reference:S,floating:C}),[S,C]),W=f.useMemo(()=>{const N={position:n,left:0,top:0};if(!z.floating)return N;const k=nh(z.floating,c.x),j=nh(z.floating,c.y);return a?{...N,transform:"translate("+k+"px, "+j+"px)",...sy(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:j}},[n,a,z.floating,c.x,c.y]);return f.useMemo(()=>({...c,update:H,refs:Y,elements:z,floatingStyles:W}),[c,H,Y,z,W])}const TP=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?th({element:r.current,padding:o}).fn(n):{}:r?th({element:r,padding:o}).fn(n):{}}}},RP=(e,t)=>{const n=gP(e);return{name:n.name,fn:n.fn,options:[e,t]}},_P=(e,t)=>{const n=yP(e);return{name:n.name,fn:n.fn,options:[e,t]}},NP=(e,t)=>({fn:EP(e).fn,options:[e,t]}),AP=(e,t)=>{const n=wP(e);return{name:n.name,fn:n.fn,options:[e,t]}},MP=(e,t)=>{const n=xP(e);return{name:n.name,fn:n.fn,options:[e,t]}},OP=(e,t)=>{const n=SP(e);return{name:n.name,fn:n.fn,options:[e,t]}},jP=(e,t)=>{const n=TP(e);return{name:n.name,fn:n.fn,options:[e,t]}};var IP="Arrow",iy=f.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return m.jsx(ve.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});iy.displayName=IP;var LP=iy;function DP(e){const[t,n]=f.useState(void 0);return vt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Fd="Popper",[ay,Ja]=Tr(Fd),[FP,ly]=ay(Fd),uy=e=>{const{__scopePopper:t,children:n}=e,[r,o]=f.useState(null);return m.jsx(FP,{scope:t,anchor:r,onAnchorChange:o,children:n})};uy.displayName=Fd;var cy="PopperAnchor",dy=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=ly(cy,n),i=f.useRef(null),a=Re(t,i),l=f.useRef(null);return f.useEffect(()=>{const u=l.current;l.current=(r==null?void 0:r.current)||i.current,u!==l.current&&s.onAnchorChange(l.current)}),r?null:m.jsx(ve.div,{...o,ref:a})});dy.displayName=cy;var $d="PopperContent",[$P,zP]=ay($d),fy=f.forwardRef((e,t)=>{var q,Gt,be,Ot,hn,Ar;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:E,...y}=e,x=ly($d,n),[g,v]=f.useState(null),w=Re(t,mn=>v(mn)),[S,C]=f.useState(null),b=DP(S),P=(b==null?void 0:b.width)??0,R=(b==null?void 0:b.height)??0,O=r+(s!=="center"?"-"+s:""),M=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},$=Array.isArray(u)?u:[u],L=$.length>0,H={padding:M,boundary:$.filter(VP),altBoundary:L},{refs:I,floatingStyles:Y,placement:z,isPositioned:W,middlewareData:N}=kP({strategy:"fixed",placement:O,whileElementsMounted:(...mn)=>vP(...mn,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[RP({mainAxis:o+R,alignmentAxis:i}),l&&_P({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?NP():void 0,...H}),l&&AP({...H}),MP({...H,apply:({elements:mn,rects:Xs,availableWidth:ul,availableHeight:qs})=>{const{width:cl,height:Lo}=Xs.reference,Mr=mn.floating.style;Mr.setProperty("--radix-popper-available-width",`${ul}px`),Mr.setProperty("--radix-popper-available-height",`${qs}px`),Mr.setProperty("--radix-popper-anchor-width",`${cl}px`),Mr.setProperty("--radix-popper-anchor-height",`${Lo}px`)}}),S&&jP({element:S,padding:a}),BP({arrowWidth:P,arrowHeight:R}),h&&OP({strategy:"referenceHidden",...H})]}),[k,j]=my(z),U=qe(E);vt(()=>{W&&(U==null||U())},[W,U]);const F=(q=N.arrow)==null?void 0:q.x,G=(Gt=N.arrow)==null?void 0:Gt.y,X=((be=N.arrow)==null?void 0:be.centerOffset)!==0,[de,ge]=f.useState();return vt(()=>{g&&ge(window.getComputedStyle(g).zIndex)},[g]),m.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...Y,transform:W?Y.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[(Ot=N.transformOrigin)==null?void 0:Ot.x,(hn=N.transformOrigin)==null?void 0:hn.y].join(" "),...((Ar=N.hide)==null?void 0:Ar.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx($P,{scope:n,placedSide:k,onArrowChange:C,arrowX:F,arrowY:G,shouldHideArrow:X,children:m.jsx(ve.div,{"data-side":k,"data-align":j,...y,ref:w,style:{...y.style,animation:W?void 0:"none"}})})})});fy.displayName=$d;var py="PopperArrow",UP={top:"bottom",right:"left",bottom:"top",left:"right"},hy=f.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=zP(py,r),i=UP[s.placedSide];return m.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:m.jsx(LP,{...o,ref:n,style:{...o.style,display:"block"}})})});hy.displayName=py;function VP(e){return e!==null}var BP=e=>({name:"transformOrigin",options:e,fn(t){var x,g,v;const{placement:n,rects:r,middlewareData:o}=t,i=((x=o.arrow)==null?void 0:x.centerOffset)!==0,a=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[u,c]=my(n),d={start:"0%",center:"50%",end:"100%"}[c],h=(((g=o.arrow)==null?void 0:g.x)??0)+a/2,p=(((v=o.arrow)==null?void 0:v.y)??0)+l/2;let E="",y="";return u==="bottom"?(E=i?d:`${h}px`,y=`${-l}px`):u==="top"?(E=i?d:`${h}px`,y=`${r.floating.height+l}px`):u==="right"?(E=`${-l}px`,y=i?d:`${p}px`):u==="left"&&(E=`${r.floating.width+l}px`,y=i?d:`${p}px`),{data:{x:E,y}}}});function my(e){const[t,n="center"]=e.split("-");return[t,n]}var WP=uy,vy=dy,gy=fy,yy=hy,HP="Portal",zd=f.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=f.useState(!1);vt(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?Kv.createPortal(m.jsx(ve.div,{...r,ref:t}),i):null});zd.displayName=HP;function KP(e,t){return f.useReducer((n,r)=>t[n][r]??n,e)}var Rr=e=>{const{present:t,children:n}=e,r=GP(t),o=typeof n=="function"?n({present:r.isPresent}):f.Children.only(n),s=Re(r.ref,QP(o));return typeof n=="function"||r.isPresent?f.cloneElement(o,{ref:s}):null};Rr.displayName="Presence";function GP(e){const[t,n]=f.useState(),r=f.useRef(null),o=f.useRef(e),s=f.useRef("none"),i=e?"mounted":"unmounted",[a,l]=KP(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const u=wi(r.current);s.current=a==="mounted"?u:"none"},[a]),vt(()=>{const u=r.current,c=o.current;if(c!==e){const h=s.current,p=wi(u);e?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),vt(()=>{if(t){let u;const c=t.ownerDocument.defaultView??window,d=p=>{const y=wi(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&y&&(l("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(s.current=wi(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{c.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:f.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function wi(e){return(e==null?void 0:e.animationName)||"none"}function QP(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Xl="rovingFocusGroup.onEntryFocus",YP={bubbles:!1,cancelable:!0},Ks="RovingFocusGroup",[fc,wy,XP]=Ad(Ks),[qP,xy]=Tr(Ks,[XP]),[ZP,JP]=qP(Ks),Sy=f.forwardRef((e,t)=>m.jsx(fc.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(fc.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(ek,{...e,ref:t})})}));Sy.displayName=Ks;var ek=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:c=!1,...d}=e,h=f.useRef(null),p=Re(t,h),E=Bg(s),[y,x]=_d({prop:i,defaultProp:a??null,onChange:l,caller:Ks}),[g,v]=f.useState(!1),w=qe(u),S=wy(n),C=f.useRef(!1),[b,P]=f.useState(0);return f.useEffect(()=>{const R=h.current;if(R)return R.addEventListener(Xl,w),()=>R.removeEventListener(Xl,w)},[w]),m.jsx(ZP,{scope:n,orientation:r,dir:E,loop:o,currentTabStopId:y,onItemFocus:f.useCallback(R=>x(R),[x]),onItemShiftTab:f.useCallback(()=>v(!0),[]),onFocusableItemAdd:f.useCallback(()=>P(R=>R+1),[]),onFocusableItemRemove:f.useCallback(()=>P(R=>R-1),[]),children:m.jsx(ve.div,{tabIndex:g||b===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:V(e.onMouseDown,()=>{C.current=!0}),onFocus:V(e.onFocus,R=>{const O=!C.current;if(R.target===R.currentTarget&&O&&!g){const M=new CustomEvent(Xl,YP);if(R.currentTarget.dispatchEvent(M),!M.defaultPrevented){const $=S().filter(z=>z.focusable),L=$.find(z=>z.active),H=$.find(z=>z.id===y),Y=[L,H,...$].filter(Boolean).map(z=>z.ref.current);by(Y,c)}}C.current=!1}),onBlur:V(e.onBlur,()=>v(!1))})})}),Ey="RovingFocusGroupItem",Cy=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,l=lc(),u=s||l,c=JP(Ey,n),d=c.currentTabStopId===u,h=wy(n),{onFocusableItemAdd:p,onFocusableItemRemove:E,currentTabStopId:y}=c;return f.useEffect(()=>{if(r)return p(),()=>E()},[r,p,E]),m.jsx(fc.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:m.jsx(ve.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...a,ref:t,onMouseDown:V(e.onMouseDown,x=>{r?c.onItemFocus(u):x.preventDefault()}),onFocus:V(e.onFocus,()=>c.onItemFocus(u)),onKeyDown:V(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){c.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const g=rk(x,c.orientation,c.dir);if(g!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let w=h().filter(S=>S.focusable).map(S=>S.ref.current);if(g==="last")w.reverse();else if(g==="prev"||g==="next"){g==="prev"&&w.reverse();const S=w.indexOf(x.currentTarget);w=c.loop?ok(w,S+1):w.slice(S+1)}setTimeout(()=>by(w))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:y!=null}):i})})});Cy.displayName=Ey;var tk={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function nk(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function rk(e,t,n){const r=nk(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return tk[r]}function by(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ok(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var sk=Sy,ik=Cy;function ak(e){const t=lk(e),n=f.forwardRef((r,o)=>{const{children:s,...i}=r,a=f.Children.toArray(s),l=a.find(ck);if(l){const u=l.props.children,c=a.map(d=>d===l?f.Children.count(u)>1?f.Children.only(null):f.isValidElement(u)?u.props.children:null:d);return m.jsx(t,{...i,ref:o,children:f.isValidElement(u)?f.cloneElement(u,void 0,c):null})}return m.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function lk(e){const t=f.forwardRef((n,r)=>{const{children:o,...s}=n;if(f.isValidElement(o)){const i=fk(o),a=dk(s,o.props);return o.type!==f.Fragment&&(a.ref=r?kr(r,i):i),f.cloneElement(o,a)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uk=Symbol("radix.slottable");function ck(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uk}function dk(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function fk(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var pk=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Dr=new WeakMap,xi=new WeakMap,Si={},ql=0,Py=function(e){return e&&(e.host||Py(e.parentNode))},hk=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Py(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},mk=function(e,t,n,r){var o=hk(t,Array.isArray(e)?e:[e]);Si[n]||(Si[n]=new WeakMap);var s=Si[n],i=[],a=new Set,l=new Set(o),u=function(d){!d||a.has(d)||(a.add(d),u(d.parentNode))};o.forEach(u);var c=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(h){if(a.has(h))c(h);else try{var p=h.getAttribute(r),E=p!==null&&p!=="false",y=(Dr.get(h)||0)+1,x=(s.get(h)||0)+1;Dr.set(h,y),s.set(h,x),i.push(h),y===1&&E&&xi.set(h,!0),x===1&&h.setAttribute(n,"true"),E||h.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",h,g)}})};return c(t),a.clear(),ql++,function(){i.forEach(function(d){var h=Dr.get(d)-1,p=s.get(d)-1;Dr.set(d,h),s.set(d,p),h||(xi.has(d)||d.removeAttribute(r),xi.delete(d)),p||d.removeAttribute(n)}),ql--,ql||(Dr=new WeakMap,Dr=new WeakMap,xi=new WeakMap,Si={})}},vk=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=pk(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),mk(r,o,n,"aria-hidden")):function(){return null}},Ut=function(){return Ut=Object.assign||function(t){for(var n,r=1,o=arguments.length;r"u")return Ok;var t=jk(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Lk=_y(),io="data-scroll-locked",Dk=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),` - .`.concat(yk,` { + */var ko=f;function oC(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var sC=typeof Object.is=="function"?Object.is:oC,iC=ko.useState,aC=ko.useEffect,lC=ko.useLayoutEffect,uC=ko.useDebugValue;function cC(e,t){var n=t(),r=iC({inst:{value:n,getSnapshot:t}}),o=r[0].inst,s=r[1];return lC(function(){o.value=n,o.getSnapshot=t,Vl(o)&&s({inst:o})},[e,n,t]),aC(function(){return Vl(o)&&s({inst:o}),e(function(){Vl(o)&&s({inst:o})})},[e]),uC(n),n}function Vl(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!sC(e,n)}catch{return!0}}function dC(e,t){return t()}var fC=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?dC:cC;Pg.useSyncExternalStore=ko.useSyncExternalStore!==void 0?ko.useSyncExternalStore:fC;bg.exports=Pg;var pC=bg.exports;function hC(){return pC.useSyncExternalStore(mC,()=>!0,()=>!1)}function mC(){return()=>{}}var _d="Avatar",[vC]=QE(_d),[gC,kg]=vC(_d),Tg=f.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[o,s]=f.useState("idle");return h.jsx(gC,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:s,children:h.jsx(Rd.span,{...r,ref:t})})});Tg.displayName=_d;var Rg="AvatarImage",_g=f.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...s}=e,i=kg(Rg,n),a=yC(r,s),l=qe(u=>{o(u),i.onImageLoadingStatusChange(u)});return vt(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?h.jsx(Rd.img,{...s,ref:t,src:r}):null});_g.displayName=Rg;var Ng="AvatarFallback",Ag=f.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...o}=e,s=kg(Ng,n),[i,a]=f.useState(r===void 0);return f.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),i&&s.imageLoadingStatus!=="loaded"?h.jsx(Rd.span,{...o,ref:t}):null});Ag.displayName=Ng;function Fp(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function yC(e,{referrerPolicy:t,crossOrigin:n}){const r=hC(),o=f.useRef(null),s=r?(o.current||(o.current=new window.Image),o.current):null,[i,a]=f.useState(()=>Fp(s,e));return vt(()=>{a(Fp(s,e))},[s,e]),vt(()=>{const l=d=>()=>{a(d)};if(!s)return;const u=l("loaded"),c=l("error");return s.addEventListener("load",u),s.addEventListener("error",c),t&&(s.referrerPolicy=t),typeof n=="string"&&(s.crossOrigin=n),()=>{s.removeEventListener("load",u),s.removeEventListener("error",c)}},[s,n,t]),i}var Mg=Tg,Og=_g,jg=Ag;function Ig(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t{const t=SC(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(Nd);return a[0]===""&&a.length!==1&&a.shift(),Dg(a,t)||xC(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},Dg=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?Dg(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(Nd);return(i=t.validators.find(({validator:a})=>a(s)))==null?void 0:i.classGroupId},$p=/^\[(.+)\]$/,xC=e=>{if($p.test(e)){const t=$p.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},SC=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return CC(Object.entries(e.classGroups),n).forEach(([s,i])=>{lc(i,r,s,t)}),r},lc=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:zp(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(EC(o)){lc(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{lc(i,zp(t,s),n,r)})})},zp=(e,t)=>{let n=e;return t.split(Nd).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},EC=e=>e.isThemeGetter,CC=(e,t)=>t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([i,a])=>[t+i,a])):s);return[n,o]}):e,bC=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},Fg="!",PC=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length,i=a=>{const l=[];let u=0,c=0,d;for(let x=0;xc?d-c:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:E,maybePostfixModifierPosition:y}};return n?a=>n({className:a,parseClassName:i}):i},kC=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},TC=e=>({cache:bC(e.cacheSize),parseClassName:PC(e),...wC(e)}),RC=/\s+/,_C=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=[],i=e.trim().split(RC);let a="";for(let l=i.length-1;l>=0;l-=1){const u=i[l],{modifiers:c,hasImportantModifier:d,baseClassName:m,maybePostfixModifierPosition:p}=n(u);let E=!!p,y=r(E?m.substring(0,p):m);if(!y){if(!E){a=u+(a.length>0?" "+a:a);continue}if(y=r(m),!y){a=u+(a.length>0?" "+a:a);continue}E=!1}const x=kC(c).join(":"),g=d?x+Fg:x,v=g+y;if(s.includes(v))continue;s.push(v);const w=o(y,E);for(let S=0;S0?" "+a:a)}return a};function NC(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rd(c),e());return n=TC(u),r=n.cache.get,o=n.cache.set,s=a,a(l)}function a(l){const u=r(l);if(u)return u;const c=_C(l,n);return o(l,c),c}return function(){return s(NC.apply(null,arguments))}}const ie=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},zg=/^\[(?:([a-z-]+):)?(.+)\]$/i,MC=/^\d+\/\d+$/,OC=new Set(["px","full","screen"]),jC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,IC=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,LC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,DC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,FC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qt=e=>oo(e)||OC.has(e)||MC.test(e),xn=e=>Oo(e,"length",KC),oo=e=>!!e&&!Number.isNaN(Number(e)),Bl=e=>Oo(e,"number",oo),Ko=e=>!!e&&Number.isInteger(Number(e)),$C=e=>e.endsWith("%")&&oo(e.slice(0,-1)),Q=e=>zg.test(e),Sn=e=>jC.test(e),zC=new Set(["length","size","percentage"]),UC=e=>Oo(e,zC,Ug),VC=e=>Oo(e,"position",Ug),BC=new Set(["image","url"]),WC=e=>Oo(e,BC,QC),HC=e=>Oo(e,"",GC),Go=()=>!0,Oo=(e,t,n)=>{const r=zg.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},KC=e=>IC.test(e)&&!LC.test(e),Ug=()=>!1,GC=e=>DC.test(e),QC=e=>FC.test(e),YC=()=>{const e=ie("colors"),t=ie("spacing"),n=ie("blur"),r=ie("brightness"),o=ie("borderColor"),s=ie("borderRadius"),i=ie("borderSpacing"),a=ie("borderWidth"),l=ie("contrast"),u=ie("grayscale"),c=ie("hueRotate"),d=ie("invert"),m=ie("gap"),p=ie("gradientColorStops"),E=ie("gradientColorStopPositions"),y=ie("inset"),x=ie("margin"),g=ie("opacity"),v=ie("padding"),w=ie("saturate"),S=ie("scale"),C=ie("sepia"),b=ie("skew"),P=ie("space"),R=ie("translate"),O=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",Q,t],L=()=>[Q,t],H=()=>["",Qt,xn],I=()=>["auto",oo,Q],Y=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],z=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],N=()=>["start","end","center","between","around","evenly","stretch"],k=()=>["","0",Q],j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[oo,Q];return{cacheSize:500,separator:":",theme:{colors:[Go],spacing:[Qt,xn],blur:["none","",Sn,Q],brightness:U(),borderColor:[e],borderRadius:["none","","full",Sn,Q],borderSpacing:L(),borderWidth:H(),contrast:U(),grayscale:k(),hueRotate:U(),invert:k(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[$C,xn],inset:$(),margin:$(),opacity:U(),padding:L(),saturate:U(),scale:U(),sepia:k(),skew:U(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",Q]}],container:["container"],columns:[{columns:[Sn]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Y(),Q]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ko,Q]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Q]}],grow:[{grow:k()}],shrink:[{shrink:k()}],order:[{order:["first","last","none",Ko,Q]}],"grid-cols":[{"grid-cols":[Go]}],"col-start-end":[{col:["auto",{span:["full",Ko,Q]},Q]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[Go]}],"row-start-end":[{row:["auto",{span:[Ko,Q]},Q]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Q]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Q]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...N()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...N(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...N(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Q,t]}],"min-w":[{"min-w":[Q,t,"min","max","fit"]}],"max-w":[{"max-w":[Q,t,"none","full","min","max","fit","prose",{screen:[Sn]},Sn]}],h:[{h:[Q,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Q,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Q,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Q,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Sn,xn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Bl]}],"font-family":[{font:[Go]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Q]}],"line-clamp":[{"line-clamp":["none",oo,Bl]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Qt,Q]}],"list-image":[{"list-image":["none",Q]}],"list-style-type":[{list:["none","disc","decimal",Q]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Qt,xn]}],"underline-offset":[{"underline-offset":["auto",Qt,Q]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Y(),VC]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",UC]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},WC]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[E]}],"gradient-via-pos":[{via:[E]}],"gradient-to-pos":[{to:[E]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...z(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:z()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...z()]}],"outline-offset":[{"outline-offset":[Qt,Q]}],"outline-w":[{outline:[Qt,xn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[Qt,xn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Sn,HC]}],"shadow-color":[{shadow:[Go]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Sn,Q]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Q]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",Q]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",Q]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Ko,Q]}],"translate-x":[{"translate-x":[R]}],"translate-y":[{"translate-y":[R]}],"skew-x":[{"skew-x":[b]}],"skew-y":[{"skew-y":[b]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Q]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Qt,xn,Bl]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},XC=AC(YC);function _e(...e){return XC(Lg(e))}function pA(e){const t=e.trim(),n=t.match(/^(\d{4})-(\d{4,5})(v\d+)?$/);if(n)return`${n[1]}.${n[2]}`;const r=t.match(/^(\d{4}\.\d{4,5})(v\d+)$/);return r?r[1]:t}function hA(e){if(e==null||e==="")return"—";const t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.abs(t)>=100?t.toFixed(0):Math.abs(t)>=10?t.toFixed(1):t.toFixed(2):String(e)}const Vg=f.forwardRef(({className:e,...t},n)=>h.jsx(Mg,{ref:n,className:_e("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));Vg.displayName=Mg.displayName;const Bg=f.forwardRef(({className:e,...t},n)=>h.jsx(Og,{ref:n,className:_e("aspect-square h-full w-full",e),...t}));Bg.displayName=Og.displayName;const Wg=f.forwardRef(({className:e,...t},n)=>h.jsx(jg,{ref:n,className:_e("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));Wg.displayName=jg.displayName;function V(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function mA(e,t){const n=f.createContext(t),r=s=>{const{children:i,...a}=s,l=f.useMemo(()=>a,Object.values(a));return h.jsx(n.Provider,{value:l,children:i})};r.displayName=e+"Provider";function o(s){const i=f.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function Tr(e,t=[]){let n=[];function r(s,i){const a=f.createContext(i),l=n.length;n=[...n,i];const u=d=>{var g;const{scope:m,children:p,...E}=d,y=((g=m==null?void 0:m[e])==null?void 0:g[l])||a,x=f.useMemo(()=>E,Object.values(E));return h.jsx(y.Provider,{value:x,children:p})};u.displayName=s+"Provider";function c(d,m){var y;const p=((y=m==null?void 0:m[e])==null?void 0:y[l])||a,E=f.useContext(p);if(E)return E;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[u,c]}const o=()=>{const s=n.map(i=>f.createContext(i));return function(a){const l=(a==null?void 0:a[e])||s;return f.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,qC(o,...t)]}function qC(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:l,scopeName:u})=>{const d=l(s)[`__scope${u}`];return{...a,...d}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var ZC=Ta[" useInsertionEffect ".trim().toString()]||vt;function Ad({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=JC({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:o;{const c=f.useRef(e!==void 0);f.useEffect(()=>{const d=c.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=a},[a,r])}const u=f.useCallback(c=>{var d;if(a){const m=eb(c)?c(e):c;m!==e&&((d=i.current)==null||d.call(i,m))}else s(c)},[a,e,s,i]);return[l,u]}function JC({defaultProp:e,onChange:t}){const[n,r]=f.useState(e),o=f.useRef(n),s=f.useRef(t);return ZC(()=>{s.current=t},[t]),f.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function eb(e){return typeof e=="function"}function tb(e){const t=nb(e),n=f.forwardRef((r,o)=>{const{children:s,...i}=r,a=f.Children.toArray(s),l=a.find(ob);if(l){const u=l.props.children,c=a.map(d=>d===l?f.Children.count(u)>1?f.Children.only(null):f.isValidElement(u)?u.props.children:null:d);return h.jsx(t,{...i,ref:o,children:f.isValidElement(u)?f.cloneElement(u,void 0,c):null})}return h.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function nb(e){const t=f.forwardRef((n,r)=>{const{children:o,...s}=n;if(f.isValidElement(o)){const i=ib(o),a=sb(s,o.props);return o.type!==f.Fragment&&(a.ref=r?kr(r,i):i),f.cloneElement(o,a)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rb=Symbol("radix.slottable");function ob(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rb}function sb(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function ib(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ab=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ve=ab.reduce((e,t)=>{const n=tb(`Primitive.${t}`),r=f.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Md(e,t){e&&Ws.flushSync(()=>e.dispatchEvent(t))}function Up(e){const t=lb(e),n=f.forwardRef((r,o)=>{const{children:s,...i}=r,a=f.Children.toArray(s),l=a.find(cb);if(l){const u=l.props.children,c=a.map(d=>d===l?f.Children.count(u)>1?f.Children.only(null):f.isValidElement(u)?u.props.children:null:d);return h.jsx(t,{...i,ref:o,children:f.isValidElement(u)?f.cloneElement(u,void 0,c):null})}return h.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function lb(e){const t=f.forwardRef((n,r)=>{const{children:o,...s}=n;if(f.isValidElement(o)){const i=fb(o),a=db(s,o.props);return o.type!==f.Fragment&&(a.ref=r?kr(r,i):i),f.cloneElement(o,a)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ub=Symbol("radix.slottable");function cb(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ub}function db(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function fb(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Od(e){const t=e+"CollectionProvider",[n,r]=Tr(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=y=>{const{scope:x,children:g}=y,v=T.useRef(null),w=T.useRef(new Map).current;return h.jsx(o,{scope:x,itemMap:w,collectionRef:v,children:g})};i.displayName=t;const a=e+"CollectionSlot",l=Up(a),u=T.forwardRef((y,x)=>{const{scope:g,children:v}=y,w=s(a,g),S=Re(x,w.collectionRef);return h.jsx(l,{ref:S,children:v})});u.displayName=a;const c=e+"CollectionItemSlot",d="data-radix-collection-item",m=Up(c),p=T.forwardRef((y,x)=>{const{scope:g,children:v,...w}=y,S=T.useRef(null),C=Re(x,S),b=s(c,g);return T.useEffect(()=>(b.itemMap.set(S,{ref:S,...w}),()=>void b.itemMap.delete(S))),h.jsx(m,{[d]:"",ref:C,children:v})});p.displayName=c;function E(y){const x=s(e+"CollectionConsumer",y);return T.useCallback(()=>{const v=x.collectionRef.current;if(!v)return[];const w=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(x.itemMap.values()).sort((b,P)=>w.indexOf(b.ref.current)-w.indexOf(P.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:p},E,r]}var pb=f.createContext(void 0);function Hg(e){const t=f.useContext(pb);return e||t||"ltr"}function hb(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e);f.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var mb="DismissableLayer",uc="dismissableLayer.update",vb="dismissableLayer.pointerDownOutside",gb="dismissableLayer.focusOutside",Vp,Kg=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qa=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...l}=e,u=f.useContext(Kg),[c,d]=f.useState(null),m=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=f.useState({}),E=Re(t,P=>d(P)),y=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=y.indexOf(x),v=c?y.indexOf(c):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=g,C=wb(P=>{const R=P.target,O=[...u.branches].some(M=>M.contains(R));!S||O||(o==null||o(P),i==null||i(P),P.defaultPrevented||a==null||a())},m),b=xb(P=>{const R=P.target;[...u.branches].some(M=>M.contains(R))||(s==null||s(P),i==null||i(P),P.defaultPrevented||a==null||a())},m);return hb(P=>{v===u.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&a&&(P.preventDefault(),a()))},m),f.useEffect(()=>{if(c)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Vp=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),Bp(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Vp)}},[c,m,n,u]),f.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),Bp())},[c,u]),f.useEffect(()=>{const P=()=>p({});return document.addEventListener(uc,P),()=>document.removeEventListener(uc,P)},[]),h.jsx(ve.div,{...l,ref:E,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:V(e.onFocusCapture,b.onFocusCapture),onBlurCapture:V(e.onBlurCapture,b.onBlurCapture),onPointerDownCapture:V(e.onPointerDownCapture,C.onPointerDownCapture)})});Qa.displayName=mb;var yb="DismissableLayerBranch",Gg=f.forwardRef((e,t)=>{const n=f.useContext(Kg),r=f.useRef(null),o=Re(t,r);return f.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),h.jsx(ve.div,{...e,ref:o})});Gg.displayName=yb;function wb(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e),r=f.useRef(!1),o=f.useRef(()=>{});return f.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){Qg(vb,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function xb(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e),r=f.useRef(!1);return f.useEffect(()=>{const o=s=>{s.target&&!r.current&&Qg(gb,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Bp(){const e=new CustomEvent(uc);document.dispatchEvent(e)}function Qg(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Md(o,s):o.dispatchEvent(s)}var Sb=Qa,Eb=Gg,Wl=0;function Cb(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Wp()),document.body.insertAdjacentElement("beforeend",e[1]??Wp()),Wl++,()=>{Wl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Wl--}},[])}function Wp(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Hl="focusScope.autoFocusOnMount",Kl="focusScope.autoFocusOnUnmount",Hp={bubbles:!1,cancelable:!0},bb="FocusScope",Yg=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,l]=f.useState(null),u=qe(o),c=qe(s),d=f.useRef(null),m=Re(t,y=>l(y)),p=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(r){let y=function(w){if(p.paused||!a)return;const S=w.target;a.contains(S)?d.current=S:Cn(d.current,{select:!0})},x=function(w){if(p.paused||!a)return;const S=w.relatedTarget;S!==null&&(a.contains(S)||Cn(d.current,{select:!0}))},g=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&Cn(a)};document.addEventListener("focusin",y),document.addEventListener("focusout",x);const v=new MutationObserver(g);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),v.disconnect()}}},[r,a,p.paused]),f.useEffect(()=>{if(a){Gp.add(p);const y=document.activeElement;if(!a.contains(y)){const g=new CustomEvent(Hl,Hp);a.addEventListener(Hl,u),a.dispatchEvent(g),g.defaultPrevented||(Pb(Nb(Xg(a)),{select:!0}),document.activeElement===y&&Cn(a))}return()=>{a.removeEventListener(Hl,u),setTimeout(()=>{const g=new CustomEvent(Kl,Hp);a.addEventListener(Kl,c),a.dispatchEvent(g),g.defaultPrevented||Cn(y??document.body,{select:!0}),a.removeEventListener(Kl,c),Gp.remove(p)},0)}}},[a,u,c,p]);const E=f.useCallback(y=>{if(!n&&!r||p.paused)return;const x=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,g=document.activeElement;if(x&&g){const v=y.currentTarget,[w,S]=kb(v);w&&S?!y.shiftKey&&g===S?(y.preventDefault(),n&&Cn(w,{select:!0})):y.shiftKey&&g===w&&(y.preventDefault(),n&&Cn(S,{select:!0})):g===v&&y.preventDefault()}},[n,r,p.paused]);return h.jsx(ve.div,{tabIndex:-1,...i,ref:m,onKeyDown:E})});Yg.displayName=bb;function Pb(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Cn(r,{select:t}),document.activeElement!==n)return}function kb(e){const t=Xg(e),n=Kp(t,e),r=Kp(t.reverse(),e);return[n,r]}function Xg(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Kp(e,t){for(const n of e)if(!Tb(n,{upTo:t}))return n}function Tb(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Rb(e){return e instanceof HTMLInputElement&&"select"in e}function Cn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Rb(e)&&t&&e.select()}}var Gp=_b();function _b(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Qp(e,t),e.unshift(t)},remove(t){var n;e=Qp(e,t),(n=e[0])==null||n.resume()}}}function Qp(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Nb(e){return e.filter(t=>t.tagName!=="A")}var Ab=Ta[" useId ".trim().toString()]||(()=>{}),Mb=0;function cc(e){const[t,n]=f.useState(Ab());return vt(()=>{n(r=>r??String(Mb++))},[e]),t?`radix-${t}`:""}const Ob=["top","right","bottom","left"],Qn=Math.min,et=Math.max,xa=Math.round,wi=Math.floor,Ht=e=>({x:e,y:e}),jb={left:"right",right:"left",bottom:"top",top:"bottom"};function dc(e,t,n){return et(e,Qn(t,n))}function ln(e,t){return typeof e=="function"?e(t):e}function un(e){return e.split("-")[0]}function jo(e){return e.split("-")[1]}function jd(e){return e==="x"?"y":"x"}function Id(e){return e==="y"?"height":"width"}function Vt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ld(e){return jd(Vt(e))}function Ib(e,t,n){n===void 0&&(n=!1);const r=jo(e),o=Ld(e),s=Id(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Sa(i)),[i,Sa(i)]}function Lb(e){const t=Sa(e);return[fc(e),t,fc(t)]}function fc(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Yp=["left","right"],Xp=["right","left"],Db=["top","bottom"],Fb=["bottom","top"];function $b(e,t,n){switch(e){case"top":case"bottom":return n?t?Xp:Yp:t?Yp:Xp;case"left":case"right":return t?Db:Fb;default:return[]}}function zb(e,t,n,r){const o=jo(e);let s=$b(un(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(fc)))),s}function Sa(e){const t=un(e);return jb[t]+e.slice(t.length)}function Ub(e){return{top:0,right:0,bottom:0,left:0,...e}}function qg(e){return typeof e!="number"?Ub(e):{top:e,right:e,bottom:e,left:e}}function Ea(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function qp(e,t,n){let{reference:r,floating:o}=e;const s=Vt(t),i=Ld(t),a=Id(i),l=un(t),u=s==="y",c=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let p;switch(l){case"top":p={x:c,y:r.y-o.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(jo(t)){case"start":p[i]-=m*(n&&u?-1:1);break;case"end":p[i]+=m*(n&&u?-1:1);break}return p}async function Vb(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:m=!1,padding:p=0}=ln(t,e),E=qg(p),x=a[m?d==="floating"?"reference":"floating":d],g=Ea(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),v=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},C=Ea(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:w,strategy:l}):v);return{top:(g.top-C.top+E.top)/S.y,bottom:(C.bottom-g.bottom+E.bottom)/S.y,left:(g.left-C.left+E.left)/S.x,right:(C.right-g.right+E.right)/S.x}}const Bb=50,Wb=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:Vb},l=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:d}=qp(u,r,l),m=r,p=0;const E={};for(let y=0;y({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:u,padding:c=0}=ln(e,t)||{};if(u==null)return{};const d=qg(c),m={x:n,y:r},p=Ld(o),E=Id(p),y=await i.getDimensions(u),x=p==="y",g=x?"top":"left",v=x?"bottom":"right",w=x?"clientHeight":"clientWidth",S=s.reference[E]+s.reference[p]-m[p]-s.floating[E],C=m[p]-s.reference[p],b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let P=b?b[w]:0;(!P||!await(i.isElement==null?void 0:i.isElement(b)))&&(P=a.floating[w]||s.floating[E]);const R=S/2-C/2,O=P/2-y[E]/2-1,M=Qn(d[g],O),$=Qn(d[v],O),L=M,H=P-y[E]-$,I=P/2-y[E]/2+R,Y=dc(L,I,H),z=!l.arrow&&jo(o)!=null&&I!==Y&&s.reference[E]/2-(II<=0)){var $,L;const I=((($=s.flip)==null?void 0:$.index)||0)+1,Y=P[I];if(Y&&(!(d==="alignment"?v!==Vt(Y):!1)||M.every(N=>Vt(N.placement)===v?N.overflows[0]>0:!0)))return{data:{index:I,overflows:M},reset:{placement:Y}};let z=(L=M.filter(W=>W.overflows[0]<=0).sort((W,N)=>W.overflows[1]-N.overflows[1])[0])==null?void 0:L.placement;if(!z)switch(p){case"bestFit":{var H;const W=(H=M.filter(N=>{if(b){const k=Vt(N.placement);return k===v||k==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(k=>k>0).reduce((k,j)=>k+j,0)]).sort((N,k)=>N[1]-k[1])[0])==null?void 0:H[0];W&&(z=W);break}case"initialPlacement":z=a;break}if(o!==z)return{reset:{placement:z}}}return{}}}};function Zp(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Jp(e){return Ob.some(t=>e[t]>=0)}const Gb=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=ln(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=Zp(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Jp(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=Zp(i,n.floating);return{data:{escapedOffsets:a,escaped:Jp(a)}}}default:return{}}}}},Zg=new Set(["left","top"]);async function Qb(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=un(n),a=jo(n),l=Vt(n)==="y",u=Zg.has(i)?-1:1,c=s&&l?-1:1,d=ln(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:E}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof E=="number"&&(p=a==="end"?E*-1:E),l?{x:p*c,y:m*u}:{x:m*u,y:p*c}}const Yb=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,l=await Qb(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:i}}}}},Xb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:g=>{let{x:v,y:w}=g;return{x:v,y:w}}},...u}=ln(e,t),c={x:n,y:r},d=await s.detectOverflow(t,u),m=Vt(un(o)),p=jd(m);let E=c[p],y=c[m];if(i){const g=p==="y"?"top":"left",v=p==="y"?"bottom":"right",w=E+d[g],S=E-d[v];E=dc(w,E,S)}if(a){const g=m==="y"?"top":"left",v=m==="y"?"bottom":"right",w=y+d[g],S=y-d[v];y=dc(w,y,S)}const x=l.fn({...t,[p]:E,[m]:y});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[p]:i,[m]:a}}}}}},qb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=ln(e,t),c={x:n,y:r},d=Vt(o),m=jd(d);let p=c[m],E=c[d];const y=ln(a,t),x=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(l){const w=m==="y"?"height":"width",S=s.reference[m]-s.floating[w]+x.mainAxis,C=s.reference[m]+s.reference[w]-x.mainAxis;pC&&(p=C)}if(u){var g,v;const w=m==="y"?"width":"height",S=Zg.has(un(o)),C=s.reference[d]-s.floating[w]+(S&&((g=i.offset)==null?void 0:g[d])||0)+(S?0:x.crossAxis),b=s.reference[d]+s.reference[w]+(S?0:((v=i.offset)==null?void 0:v[d])||0)-(S?x.crossAxis:0);Eb&&(E=b)}return{[m]:p,[d]:E}}}},Zb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:l=()=>{},...u}=ln(e,t),c=await i.detectOverflow(t,u),d=un(o),m=jo(o),p=Vt(o)==="y",{width:E,height:y}=s.floating;let x,g;d==="top"||d==="bottom"?(x=d,g=m===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(g=d,x=m==="end"?"top":"bottom");const v=y-c.top-c.bottom,w=E-c.left-c.right,S=Qn(y-c[x],v),C=Qn(E-c[g],w),b=!t.middlewareData.shift;let P=S,R=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=v),b&&!m){const M=et(c.left,0),$=et(c.right,0),L=et(c.top,0),H=et(c.bottom,0);p?R=E-2*(M!==0||$!==0?M+$:et(c.left,c.right)):P=y-2*(L!==0||H!==0?L+H:et(c.top,c.bottom))}await l({...t,availableWidth:R,availableHeight:P});const O=await i.getDimensions(a.floating);return E!==O.width||y!==O.height?{reset:{rects:!0}}:{}}}};function Ya(){return typeof window<"u"}function Io(e){return Jg(e)?(e.nodeName||"").toLowerCase():"#document"}function rt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Kt(e){var t;return(t=(Jg(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Jg(e){return Ya()?e instanceof Node||e instanceof rt(e).Node:!1}function Nt(e){return Ya()?e instanceof Element||e instanceof rt(e).Element:!1}function pn(e){return Ya()?e instanceof HTMLElement||e instanceof rt(e).HTMLElement:!1}function eh(e){return!Ya()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rt(e).ShadowRoot}function Ks(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=At(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Jb(e){return/^(table|td|th)$/.test(Io(e))}function Xa(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const eP=/transform|translate|scale|rotate|perspective|filter/,tP=/paint|layout|strict|content/,rr=e=>!!e&&e!=="none";let Gl;function Dd(e){const t=Nt(e)?At(e):e;return rr(t.transform)||rr(t.translate)||rr(t.scale)||rr(t.rotate)||rr(t.perspective)||!Fd()&&(rr(t.backdropFilter)||rr(t.filter))||eP.test(t.willChange||"")||tP.test(t.contain||"")}function nP(e){let t=Yn(e);for(;pn(t)&&!To(t);){if(Dd(t))return t;if(Xa(t))return null;t=Yn(t)}return null}function Fd(){return Gl==null&&(Gl=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Gl}function To(e){return/^(html|body|#document)$/.test(Io(e))}function At(e){return rt(e).getComputedStyle(e)}function qa(e){return Nt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yn(e){if(Io(e)==="html")return e;const t=e.assignedSlot||e.parentNode||eh(e)&&e.host||Kt(e);return eh(t)?t.host:t}function ey(e){const t=Yn(e);return To(t)?e.ownerDocument?e.ownerDocument.body:e.body:pn(t)&&Ks(t)?t:ey(t)}function Os(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ey(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=rt(o);if(s){const a=pc(i);return t.concat(i,i.visualViewport||[],Ks(o)?o:[],a&&n?Os(a):[])}else return t.concat(o,Os(o,[],n))}function pc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ty(e){const t=At(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=pn(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=xa(n)!==s||xa(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function $d(e){return Nt(e)?e:e.contextElement}function so(e){const t=$d(e);if(!pn(t))return Ht(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=ty(t);let i=(s?xa(n.width):n.width)/r,a=(s?xa(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const rP=Ht(0);function ny(e){const t=rt(e);return!Fd()||!t.visualViewport?rP:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oP(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==rt(e)?!1:t}function Er(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=$d(e);let i=Ht(1);t&&(r?Nt(r)&&(i=so(r)):i=so(e));const a=oP(s,n,r)?ny(s):Ht(0);let l=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,c=o.width/i.x,d=o.height/i.y;if(s){const m=rt(s),p=r&&Nt(r)?rt(r):r;let E=m,y=pc(E);for(;y&&r&&p!==E;){const x=so(y),g=y.getBoundingClientRect(),v=At(y),w=g.left+(y.clientLeft+parseFloat(v.paddingLeft))*x.x,S=g.top+(y.clientTop+parseFloat(v.paddingTop))*x.y;l*=x.x,u*=x.y,c*=x.x,d*=x.y,l+=w,u+=S,E=rt(y),y=pc(E)}}return Ea({width:c,height:d,x:l,y:u})}function Za(e,t){const n=qa(e).scrollLeft;return t?t.left+n:Er(Kt(e)).left+n}function ry(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Za(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function sP(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Kt(r),a=t?Xa(t.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},u=Ht(1);const c=Ht(0),d=pn(r);if((d||!d&&!s)&&((Io(r)!=="body"||Ks(i))&&(l=qa(r)),d)){const p=Er(r);u=so(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const m=i&&!d&&!s?ry(i,l):Ht(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x+m.x,y:n.y*u.y-l.scrollTop*u.y+c.y+m.y}}function iP(e){return Array.from(e.getClientRects())}function aP(e){const t=Kt(e),n=qa(e),r=e.ownerDocument.body,o=et(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=et(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Za(e);const a=-n.scrollTop;return At(r).direction==="rtl"&&(i+=et(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const th=25;function lP(e,t){const n=rt(e),r=Kt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;const c=Fd();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const u=Za(r);if(u<=0){const c=r.ownerDocument,d=c.body,m=getComputedStyle(d),p=c.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,E=Math.abs(r.clientWidth-d.clientWidth-p);E<=th&&(s-=E)}else u<=th&&(s+=u);return{width:s,height:i,x:a,y:l}}function uP(e,t){const n=Er(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=pn(e)?so(e):Ht(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,u=r*s.y;return{width:i,height:a,x:l,y:u}}function nh(e,t,n){let r;if(t==="viewport")r=lP(e,n);else if(t==="document")r=aP(Kt(e));else if(Nt(t))r=uP(t,n);else{const o=ny(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ea(r)}function oy(e,t){const n=Yn(e);return n===t||!Nt(n)||To(n)?!1:At(n).position==="fixed"||oy(n,t)}function cP(e,t){const n=t.get(e);if(n)return n;let r=Os(e,[],!1).filter(a=>Nt(a)&&Io(a)!=="body"),o=null;const s=At(e).position==="fixed";let i=s?Yn(e):e;for(;Nt(i)&&!To(i);){const a=At(i),l=Dd(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Ks(i)&&!l&&oy(e,i))?r=r.filter(c=>c!==i):o=a,i=Yn(i)}return t.set(e,r),r}function dP(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Xa(t)?[]:cP(t,this._c):[].concat(n),r],a=nh(t,i[0],o);let l=a.top,u=a.right,c=a.bottom,d=a.left;for(let m=1;m{i(!1,1e-7)},1e3)}P===1&&!iy(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(C,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return i(!0),s}function yP(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=$d(e),c=o||s?[...u?Os(u):[],...t?Os(t):[]]:[];c.forEach(g=>{o&&g.addEventListener("scroll",n,{passive:!0}),s&&g.addEventListener("resize",n)});const d=u&&a?gP(u,n):null;let m=-1,p=null;i&&(p=new ResizeObserver(g=>{let[v]=g;v&&v.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),u&&!l&&p.observe(u),t&&p.observe(t));let E,y=l?Er(e):null;l&&x();function x(){const g=Er(e);y&&!iy(y,g)&&n(),y=g,E=requestAnimationFrame(x)}return n(),()=>{var g;c.forEach(v=>{o&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),d==null||d(),(g=p)==null||g.disconnect(),p=null,l&&cancelAnimationFrame(E)}}const wP=Yb,xP=Xb,SP=Kb,EP=Zb,CP=Gb,oh=Hb,bP=qb,PP=(e,t,n)=>{const r=new Map,o={platform:vP,...n},s={...o.platform,_c:r};return Wb(e,t,{...o,platform:s})};var kP=typeof document<"u",TP=function(){},$i=kP?f.useLayoutEffect:TP;function Ca(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ca(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ca(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function ay(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function sh(e,t){const n=ay(e);return Math.round(t*n)/n}function Yl(e){const t=f.useRef(e);return $i(()=>{t.current=e}),t}function RP(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:u}=e,[c,d]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=f.useState(r);Ca(m,r)||p(r);const[E,y]=f.useState(null),[x,g]=f.useState(null),v=f.useCallback(N=>{N!==b.current&&(b.current=N,y(N))},[]),w=f.useCallback(N=>{N!==P.current&&(P.current=N,g(N))},[]),S=s||E,C=i||x,b=f.useRef(null),P=f.useRef(null),R=f.useRef(c),O=l!=null,M=Yl(l),$=Yl(o),L=Yl(u),H=f.useCallback(()=>{if(!b.current||!P.current)return;const N={placement:t,strategy:n,middleware:m};$.current&&(N.platform=$.current),PP(b.current,P.current,N).then(k=>{const j={...k,isPositioned:L.current!==!1};I.current&&!Ca(R.current,j)&&(R.current=j,Ws.flushSync(()=>{d(j)}))})},[m,t,n,$,L]);$i(()=>{u===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,d(N=>({...N,isPositioned:!1})))},[u]);const I=f.useRef(!1);$i(()=>(I.current=!0,()=>{I.current=!1}),[]),$i(()=>{if(S&&(b.current=S),C&&(P.current=C),S&&C){if(M.current)return M.current(S,C,H);H()}},[S,C,H,M,O]);const Y=f.useMemo(()=>({reference:b,floating:P,setReference:v,setFloating:w}),[v,w]),z=f.useMemo(()=>({reference:S,floating:C}),[S,C]),W=f.useMemo(()=>{const N={position:n,left:0,top:0};if(!z.floating)return N;const k=sh(z.floating,c.x),j=sh(z.floating,c.y);return a?{...N,transform:"translate("+k+"px, "+j+"px)",...ay(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:j}},[n,a,z.floating,c.x,c.y]);return f.useMemo(()=>({...c,update:H,refs:Y,elements:z,floatingStyles:W}),[c,H,Y,z,W])}const _P=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?oh({element:r.current,padding:o}).fn(n):{}:r?oh({element:r,padding:o}).fn(n):{}}}},NP=(e,t)=>{const n=wP(e);return{name:n.name,fn:n.fn,options:[e,t]}},AP=(e,t)=>{const n=xP(e);return{name:n.name,fn:n.fn,options:[e,t]}},MP=(e,t)=>({fn:bP(e).fn,options:[e,t]}),OP=(e,t)=>{const n=SP(e);return{name:n.name,fn:n.fn,options:[e,t]}},jP=(e,t)=>{const n=EP(e);return{name:n.name,fn:n.fn,options:[e,t]}},IP=(e,t)=>{const n=CP(e);return{name:n.name,fn:n.fn,options:[e,t]}},LP=(e,t)=>{const n=_P(e);return{name:n.name,fn:n.fn,options:[e,t]}};var DP="Arrow",ly=f.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return h.jsx(ve.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});ly.displayName=DP;var FP=ly;function $P(e){const[t,n]=f.useState(void 0);return vt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var zd="Popper",[uy,Ja]=Tr(zd),[zP,cy]=uy(zd),dy=e=>{const{__scopePopper:t,children:n}=e,[r,o]=f.useState(null);return h.jsx(zP,{scope:t,anchor:r,onAnchorChange:o,children:n})};dy.displayName=zd;var fy="PopperAnchor",py=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=cy(fy,n),i=f.useRef(null),a=Re(t,i),l=f.useRef(null);return f.useEffect(()=>{const u=l.current;l.current=(r==null?void 0:r.current)||i.current,u!==l.current&&s.onAnchorChange(l.current)}),r?null:h.jsx(ve.div,{...o,ref:a})});py.displayName=fy;var Ud="PopperContent",[UP,VP]=uy(Ud),hy=f.forwardRef((e,t)=>{var q,Gt,be,Ot,hn,Ar;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:E,...y}=e,x=cy(Ud,n),[g,v]=f.useState(null),w=Re(t,mn=>v(mn)),[S,C]=f.useState(null),b=$P(S),P=(b==null?void 0:b.width)??0,R=(b==null?void 0:b.height)??0,O=r+(s!=="center"?"-"+s:""),M=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},$=Array.isArray(u)?u:[u],L=$.length>0,H={padding:M,boundary:$.filter(WP),altBoundary:L},{refs:I,floatingStyles:Y,placement:z,isPositioned:W,middlewareData:N}=RP({strategy:"fixed",placement:O,whileElementsMounted:(...mn)=>yP(...mn,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[NP({mainAxis:o+R,alignmentAxis:i}),l&&AP({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?MP():void 0,...H}),l&&OP({...H}),jP({...H,apply:({elements:mn,rects:qs,availableWidth:ul,availableHeight:Zs})=>{const{width:cl,height:Lo}=qs.reference,Mr=mn.floating.style;Mr.setProperty("--radix-popper-available-width",`${ul}px`),Mr.setProperty("--radix-popper-available-height",`${Zs}px`),Mr.setProperty("--radix-popper-anchor-width",`${cl}px`),Mr.setProperty("--radix-popper-anchor-height",`${Lo}px`)}}),S&&LP({element:S,padding:a}),HP({arrowWidth:P,arrowHeight:R}),m&&IP({strategy:"referenceHidden",...H})]}),[k,j]=gy(z),U=qe(E);vt(()=>{W&&(U==null||U())},[W,U]);const F=(q=N.arrow)==null?void 0:q.x,G=(Gt=N.arrow)==null?void 0:Gt.y,X=((be=N.arrow)==null?void 0:be.centerOffset)!==0,[de,ge]=f.useState();return vt(()=>{g&&ge(window.getComputedStyle(g).zIndex)},[g]),h.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...Y,transform:W?Y.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[(Ot=N.transformOrigin)==null?void 0:Ot.x,(hn=N.transformOrigin)==null?void 0:hn.y].join(" "),...((Ar=N.hide)==null?void 0:Ar.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:h.jsx(UP,{scope:n,placedSide:k,onArrowChange:C,arrowX:F,arrowY:G,shouldHideArrow:X,children:h.jsx(ve.div,{"data-side":k,"data-align":j,...y,ref:w,style:{...y.style,animation:W?void 0:"none"}})})})});hy.displayName=Ud;var my="PopperArrow",BP={top:"bottom",right:"left",bottom:"top",left:"right"},vy=f.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=VP(my,r),i=BP[s.placedSide];return h.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:h.jsx(FP,{...o,ref:n,style:{...o.style,display:"block"}})})});vy.displayName=my;function WP(e){return e!==null}var HP=e=>({name:"transformOrigin",options:e,fn(t){var x,g,v;const{placement:n,rects:r,middlewareData:o}=t,i=((x=o.arrow)==null?void 0:x.centerOffset)!==0,a=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[u,c]=gy(n),d={start:"0%",center:"50%",end:"100%"}[c],m=(((g=o.arrow)==null?void 0:g.x)??0)+a/2,p=(((v=o.arrow)==null?void 0:v.y)??0)+l/2;let E="",y="";return u==="bottom"?(E=i?d:`${m}px`,y=`${-l}px`):u==="top"?(E=i?d:`${m}px`,y=`${r.floating.height+l}px`):u==="right"?(E=`${-l}px`,y=i?d:`${p}px`):u==="left"&&(E=`${r.floating.width+l}px`,y=i?d:`${p}px`),{data:{x:E,y}}}});function gy(e){const[t,n="center"]=e.split("-");return[t,n]}var KP=dy,yy=py,wy=hy,xy=vy,GP="Portal",Vd=f.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=f.useState(!1);vt(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?Gv.createPortal(h.jsx(ve.div,{...r,ref:t}),i):null});Vd.displayName=GP;function QP(e,t){return f.useReducer((n,r)=>t[n][r]??n,e)}var Rr=e=>{const{present:t,children:n}=e,r=YP(t),o=typeof n=="function"?n({present:r.isPresent}):f.Children.only(n),s=Re(r.ref,XP(o));return typeof n=="function"||r.isPresent?f.cloneElement(o,{ref:s}):null};Rr.displayName="Presence";function YP(e){const[t,n]=f.useState(),r=f.useRef(null),o=f.useRef(e),s=f.useRef("none"),i=e?"mounted":"unmounted",[a,l]=QP(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const u=xi(r.current);s.current=a==="mounted"?u:"none"},[a]),vt(()=>{const u=r.current,c=o.current;if(c!==e){const m=s.current,p=xi(u);e?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&m!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),vt(()=>{if(t){let u;const c=t.ownerDocument.defaultView??window,d=p=>{const y=xi(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&y&&(l("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},m=p=>{p.target===t&&(s.current=xi(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{c.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:f.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function xi(e){return(e==null?void 0:e.animationName)||"none"}function XP(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Xl="rovingFocusGroup.onEntryFocus",qP={bubbles:!1,cancelable:!0},Gs="RovingFocusGroup",[hc,Sy,ZP]=Od(Gs),[JP,Ey]=Tr(Gs,[ZP]),[ek,tk]=JP(Gs),Cy=f.forwardRef((e,t)=>h.jsx(hc.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(hc.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(nk,{...e,ref:t})})}));Cy.displayName=Gs;var nk=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:c=!1,...d}=e,m=f.useRef(null),p=Re(t,m),E=Hg(s),[y,x]=Ad({prop:i,defaultProp:a??null,onChange:l,caller:Gs}),[g,v]=f.useState(!1),w=qe(u),S=Sy(n),C=f.useRef(!1),[b,P]=f.useState(0);return f.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(Xl,w),()=>R.removeEventListener(Xl,w)},[w]),h.jsx(ek,{scope:n,orientation:r,dir:E,loop:o,currentTabStopId:y,onItemFocus:f.useCallback(R=>x(R),[x]),onItemShiftTab:f.useCallback(()=>v(!0),[]),onFocusableItemAdd:f.useCallback(()=>P(R=>R+1),[]),onFocusableItemRemove:f.useCallback(()=>P(R=>R-1),[]),children:h.jsx(ve.div,{tabIndex:g||b===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:V(e.onMouseDown,()=>{C.current=!0}),onFocus:V(e.onFocus,R=>{const O=!C.current;if(R.target===R.currentTarget&&O&&!g){const M=new CustomEvent(Xl,qP);if(R.currentTarget.dispatchEvent(M),!M.defaultPrevented){const $=S().filter(z=>z.focusable),L=$.find(z=>z.active),H=$.find(z=>z.id===y),Y=[L,H,...$].filter(Boolean).map(z=>z.ref.current);ky(Y,c)}}C.current=!1}),onBlur:V(e.onBlur,()=>v(!1))})})}),by="RovingFocusGroupItem",Py=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,l=cc(),u=s||l,c=tk(by,n),d=c.currentTabStopId===u,m=Sy(n),{onFocusableItemAdd:p,onFocusableItemRemove:E,currentTabStopId:y}=c;return f.useEffect(()=>{if(r)return p(),()=>E()},[r,p,E]),h.jsx(hc.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:h.jsx(ve.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...a,ref:t,onMouseDown:V(e.onMouseDown,x=>{r?c.onItemFocus(u):x.preventDefault()}),onFocus:V(e.onFocus,()=>c.onItemFocus(u)),onKeyDown:V(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){c.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const g=sk(x,c.orientation,c.dir);if(g!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let w=m().filter(S=>S.focusable).map(S=>S.ref.current);if(g==="last")w.reverse();else if(g==="prev"||g==="next"){g==="prev"&&w.reverse();const S=w.indexOf(x.currentTarget);w=c.loop?ik(w,S+1):w.slice(S+1)}setTimeout(()=>ky(w))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:y!=null}):i})})});Py.displayName=by;var rk={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ok(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function sk(e,t,n){const r=ok(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return rk[r]}function ky(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ik(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ak=Cy,lk=Py;function uk(e){const t=ck(e),n=f.forwardRef((r,o)=>{const{children:s,...i}=r,a=f.Children.toArray(s),l=a.find(fk);if(l){const u=l.props.children,c=a.map(d=>d===l?f.Children.count(u)>1?f.Children.only(null):f.isValidElement(u)?u.props.children:null:d);return h.jsx(t,{...i,ref:o,children:f.isValidElement(u)?f.cloneElement(u,void 0,c):null})}return h.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function ck(e){const t=f.forwardRef((n,r)=>{const{children:o,...s}=n;if(f.isValidElement(o)){const i=hk(o),a=pk(s,o.props);return o.type!==f.Fragment&&(a.ref=r?kr(r,i):i),f.cloneElement(o,a)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var dk=Symbol("radix.slottable");function fk(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dk}function pk(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function hk(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mk=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Dr=new WeakMap,Si=new WeakMap,Ei={},ql=0,Ty=function(e){return e&&(e.host||Ty(e.parentNode))},vk=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Ty(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},gk=function(e,t,n,r){var o=vk(t,Array.isArray(e)?e:[e]);Ei[n]||(Ei[n]=new WeakMap);var s=Ei[n],i=[],a=new Set,l=new Set(o),u=function(d){!d||a.has(d)||(a.add(d),u(d.parentNode))};o.forEach(u);var c=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(m){if(a.has(m))c(m);else try{var p=m.getAttribute(r),E=p!==null&&p!=="false",y=(Dr.get(m)||0)+1,x=(s.get(m)||0)+1;Dr.set(m,y),s.set(m,x),i.push(m),y===1&&E&&Si.set(m,!0),x===1&&m.setAttribute(n,"true"),E||m.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",m,g)}})};return c(t),a.clear(),ql++,function(){i.forEach(function(d){var m=Dr.get(d)-1,p=s.get(d)-1;Dr.set(d,m),s.set(d,p),m||(Si.has(d)||d.removeAttribute(r),Si.delete(d)),p||d.removeAttribute(n)}),ql--,ql||(Dr=new WeakMap,Dr=new WeakMap,Si=new WeakMap,Ei={})}},yk=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=mk(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),gk(r,o,n,"aria-hidden")):function(){return null}},Ut=function(){return Ut=Object.assign||function(t){for(var n,r=1,o=arguments.length;r"u")return Ik;var t=Lk(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Fk=Ay(),io="data-scroll-locked",$k=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),` + .`.concat(xk,` { overflow: hidden `).concat(r,`; padding-right: `).concat(a,"px ").concat(r,`; } @@ -91,67 +91,67 @@ Error generating stack: `+s.message+` `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),` } - .`).concat($i,` { + .`).concat(zi,` { right: `).concat(a,"px ").concat(r,`; } - .`).concat(zi,` { + .`).concat(Ui,` { margin-right: `).concat(a,"px ").concat(r,`; } - .`).concat($i," .").concat($i,` { + .`).concat(zi," .").concat(zi,` { right: 0 `).concat(r,`; } - .`).concat(zi," .").concat(zi,` { + .`).concat(Ui," .").concat(Ui,` { margin-right: 0 `).concat(r,`; } body[`).concat(io,`] { - `).concat(wk,": ").concat(a,`px; + `).concat(Sk,": ").concat(a,`px; } -`)},oh=function(){var e=parseInt(document.body.getAttribute(io)||"0",10);return isFinite(e)?e:0},Fk=function(){f.useEffect(function(){return document.body.setAttribute(io,(oh()+1).toString()),function(){var e=oh()-1;e<=0?document.body.removeAttribute(io):document.body.setAttribute(io,e.toString())}},[])},$k=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Fk();var s=f.useMemo(function(){return Ik(o)},[o]);return f.createElement(Lk,{styles:Dk(s,!t,o,n?"":"!important")})},pc=!1;if(typeof window<"u")try{var Ei=Object.defineProperty({},"passive",{get:function(){return pc=!0,!0}});window.addEventListener("test",Ei,Ei),window.removeEventListener("test",Ei,Ei)}catch{pc=!1}var Fr=pc?{passive:!1}:!1,zk=function(e){return e.tagName==="TEXTAREA"},Ny=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!zk(e)&&n[t]==="visible")},Uk=function(e){return Ny(e,"overflowY")},Vk=function(e){return Ny(e,"overflowX")},sh=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Ay(e,r);if(o){var s=My(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Bk=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Wk=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Ay=function(e,t){return e==="v"?Uk(t):Vk(t)},My=function(e,t){return e==="v"?Bk(t):Wk(t)},Hk=function(e,t){return e==="h"&&t==="rtl"?-1:1},Kk=function(e,t,n,r,o){var s=Hk(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,l=t.contains(a),u=!1,c=i>0,d=0,h=0;do{if(!a)break;var p=My(e,a),E=p[0],y=p[1],x=p[2],g=y-x-s*E;(E||g)&&Ay(e,a)&&(d+=g,h+=E);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(c&&Math.abs(d)<1||!c&&Math.abs(h)<1)&&(u=!0),u},Ci=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ih=function(e){return[e.deltaX,e.deltaY]},ah=function(e){return e&&"current"in e?e.current:e},Gk=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Qk=function(e){return` +`)},ah=function(){var e=parseInt(document.body.getAttribute(io)||"0",10);return isFinite(e)?e:0},zk=function(){f.useEffect(function(){return document.body.setAttribute(io,(ah()+1).toString()),function(){var e=ah()-1;e<=0?document.body.removeAttribute(io):document.body.setAttribute(io,e.toString())}},[])},Uk=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;zk();var s=f.useMemo(function(){return Dk(o)},[o]);return f.createElement(Fk,{styles:$k(s,!t,o,n?"":"!important")})},mc=!1;if(typeof window<"u")try{var Ci=Object.defineProperty({},"passive",{get:function(){return mc=!0,!0}});window.addEventListener("test",Ci,Ci),window.removeEventListener("test",Ci,Ci)}catch{mc=!1}var Fr=mc?{passive:!1}:!1,Vk=function(e){return e.tagName==="TEXTAREA"},My=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Vk(e)&&n[t]==="visible")},Bk=function(e){return My(e,"overflowY")},Wk=function(e){return My(e,"overflowX")},lh=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Oy(e,r);if(o){var s=jy(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Hk=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Kk=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Oy=function(e,t){return e==="v"?Bk(t):Wk(t)},jy=function(e,t){return e==="v"?Hk(t):Kk(t)},Gk=function(e,t){return e==="h"&&t==="rtl"?-1:1},Qk=function(e,t,n,r,o){var s=Gk(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,l=t.contains(a),u=!1,c=i>0,d=0,m=0;do{if(!a)break;var p=jy(e,a),E=p[0],y=p[1],x=p[2],g=y-x-s*E;(E||g)&&Oy(e,a)&&(d+=g,m+=E);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(c&&Math.abs(d)<1||!c&&Math.abs(m)<1)&&(u=!0),u},bi=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},uh=function(e){return[e.deltaX,e.deltaY]},ch=function(e){return e&&"current"in e?e.current:e},Yk=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Xk=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},Yk=0,$r=[];function Xk(e){var t=f.useRef([]),n=f.useRef([0,0]),r=f.useRef(),o=f.useState(Yk++)[0],s=f.useState(_y)[0],i=f.useRef(e);f.useEffect(function(){i.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var y=gk([e.lockRef.current],(e.shards||[]).map(ah),!0).filter(Boolean);return y.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),y.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=f.useCallback(function(y,x){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!i.current.allowPinchZoom;var g=Ci(y),v=n.current,w="deltaX"in y?y.deltaX:v[0]-g[0],S="deltaY"in y?y.deltaY:v[1]-g[1],C,b=y.target,P=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in y&&P==="h"&&b.type==="range")return!1;var R=window.getSelection(),O=R&&R.anchorNode,M=O?O===b||O.contains(b):!1;if(M)return!1;var $=sh(P,b);if(!$)return!0;if($?C=P:(C=P==="v"?"h":"v",$=sh(P,b)),!$)return!1;if(!r.current&&"changedTouches"in y&&(w||S)&&(r.current=C),!C)return!0;var L=r.current||C;return Kk(L,x,y,L==="h"?w:S)},[]),l=f.useCallback(function(y){var x=y;if(!(!$r.length||$r[$r.length-1]!==s)){var g="deltaY"in x?ih(x):Ci(x),v=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&Gk(C.delta,g)})[0];if(v&&v.should){x.cancelable&&x.preventDefault();return}if(!v){var w=(i.current.shards||[]).map(ah).filter(Boolean).filter(function(C){return C.contains(x.target)}),S=w.length>0?a(x,w[0]):!i.current.noIsolation;S&&x.cancelable&&x.preventDefault()}}},[]),u=f.useCallback(function(y,x,g,v){var w={name:y,delta:x,target:g,should:v,shadowParent:qk(g)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),c=f.useCallback(function(y){n.current=Ci(y),r.current=void 0},[]),d=f.useCallback(function(y){u(y.type,ih(y),y.target,a(y,e.lockRef.current))},[]),h=f.useCallback(function(y){u(y.type,Ci(y),y.target,a(y,e.lockRef.current))},[]);f.useEffect(function(){return $r.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Fr),document.addEventListener("touchmove",l,Fr),document.addEventListener("touchstart",c,Fr),function(){$r=$r.filter(function(y){return y!==s}),document.removeEventListener("wheel",l,Fr),document.removeEventListener("touchmove",l,Fr),document.removeEventListener("touchstart",c,Fr)}},[]);var p=e.removeScrollBar,E=e.inert;return f.createElement(f.Fragment,null,E?f.createElement(s,{styles:Qk(o)}):null,p?f.createElement($k,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function qk(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Zk=kk(Ry,Xk);var Oy=f.forwardRef(function(e,t){return f.createElement(el,Ut({},e,{ref:t,sideCar:Zk}))});Oy.classNames=el.classNames;var hc=["Enter"," "],Jk=["ArrowDown","PageUp","Home"],jy=["ArrowUp","PageDown","End"],eT=[...Jk,...jy],tT={ltr:[...hc,"ArrowRight"],rtl:[...hc,"ArrowLeft"]},nT={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Gs="Menu",[Os,rT,oT]=Ad(Gs),[_r,Iy]=Tr(Gs,[oT,Ja,xy]),tl=Ja(),Ly=xy(),[sT,Nr]=_r(Gs),[iT,Qs]=_r(Gs),Dy=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=tl(t),[l,u]=f.useState(null),c=f.useRef(!1),d=qe(s),h=Bg(o);return f.useEffect(()=>{const p=()=>{c.current=!0,document.addEventListener("pointerdown",E,{capture:!0,once:!0}),document.addEventListener("pointermove",E,{capture:!0,once:!0})},E=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",E,{capture:!0}),document.removeEventListener("pointermove",E,{capture:!0})}},[]),m.jsx(WP,{...a,children:m.jsx(sT,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:u,children:m.jsx(iT,{scope:t,onClose:f.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:h,modal:i,children:r})})})};Dy.displayName=Gs;var aT="MenuAnchor",Ud=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=tl(n);return m.jsx(vy,{...o,...r,ref:t})});Ud.displayName=aT;var Vd="MenuPortal",[lT,Fy]=_r(Vd,{forceMount:void 0}),$y=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Nr(Vd,t);return m.jsx(lT,{scope:t,forceMount:n,children:m.jsx(Rr,{present:n||s.open,children:m.jsx(zd,{asChild:!0,container:o,children:r})})})};$y.displayName=Vd;var pt="MenuContent",[uT,Bd]=_r(pt),zy=f.forwardRef((e,t)=>{const n=Fy(pt,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Nr(pt,e.__scopeMenu),i=Qs(pt,e.__scopeMenu);return m.jsx(Os.Provider,{scope:e.__scopeMenu,children:m.jsx(Rr,{present:r||s.open,children:m.jsx(Os.Slot,{scope:e.__scopeMenu,children:i.modal?m.jsx(cT,{...o,ref:t}):m.jsx(dT,{...o,ref:t})})})})}),cT=f.forwardRef((e,t)=>{const n=Nr(pt,e.__scopeMenu),r=f.useRef(null),o=Re(t,r);return f.useEffect(()=>{const s=r.current;if(s)return vk(s)},[]),m.jsx(Wd,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:V(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),dT=f.forwardRef((e,t)=>{const n=Nr(pt,e.__scopeMenu);return m.jsx(Wd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),fT=ak("MenuContent.ScrollLock"),Wd=f.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:p,disableOutsideScroll:E,...y}=e,x=Nr(pt,n),g=Qs(pt,n),v=tl(n),w=Ly(n),S=rT(n),[C,b]=f.useState(null),P=f.useRef(null),R=Re(t,P,x.onContentChange),O=f.useRef(0),M=f.useRef(""),$=f.useRef(0),L=f.useRef(null),H=f.useRef("right"),I=f.useRef(0),Y=E?Oy:f.Fragment,z=E?{as:fT,allowPinchZoom:!0}:void 0,W=k=>{var q,Gt;const j=M.current+k,U=S().filter(be=>!be.disabled),F=document.activeElement,G=(q=U.find(be=>be.ref.current===F))==null?void 0:q.textValue,X=U.map(be=>be.textValue),de=bT(X,j,G),ge=(Gt=U.find(be=>be.textValue===de))==null?void 0:Gt.ref.current;(function be(Ot){M.current=Ot,window.clearTimeout(O.current),Ot!==""&&(O.current=window.setTimeout(()=>be(""),1e3))})(j),ge&&setTimeout(()=>ge.focus())};f.useEffect(()=>()=>window.clearTimeout(O.current),[]),Sb();const N=f.useCallback(k=>{var U,F;return H.current===((U=L.current)==null?void 0:U.side)&&kT(k,(F=L.current)==null?void 0:F.area)},[]);return m.jsx(uT,{scope:n,searchRef:M,onItemEnter:f.useCallback(k=>{N(k)&&k.preventDefault()},[N]),onItemLeave:f.useCallback(k=>{var j;N(k)||((j=P.current)==null||j.focus(),b(null))},[N]),onTriggerLeave:f.useCallback(k=>{N(k)&&k.preventDefault()},[N]),pointerGraceTimerRef:$,onPointerGraceIntentChange:f.useCallback(k=>{L.current=k},[]),children:m.jsx(Y,{...z,children:m.jsx(Gg,{asChild:!0,trapped:o,onMountAutoFocus:V(s,k=>{var j;k.preventDefault(),(j=P.current)==null||j.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:m.jsx(Qa,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:p,children:m.jsx(sk,{asChild:!0,...w,dir:g.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:b,onEntryFocus:V(l,k=>{g.isUsingKeyboardRef.current||k.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(gy,{role:"menu","aria-orientation":"vertical","data-state":nw(x.open),"data-radix-menu-content":"",dir:g.dir,...v,...y,ref:R,style:{outline:"none",...y.style},onKeyDown:V(y.onKeyDown,k=>{const U=k.target.closest("[data-radix-menu-content]")===k.currentTarget,F=k.ctrlKey||k.altKey||k.metaKey,G=k.key.length===1;U&&(k.key==="Tab"&&k.preventDefault(),!F&&G&&W(k.key));const X=P.current;if(k.target!==X||!eT.includes(k.key))return;k.preventDefault();const ge=S().filter(q=>!q.disabled).map(q=>q.ref.current);jy.includes(k.key)&&ge.reverse(),ET(ge)}),onBlur:V(e.onBlur,k=>{k.currentTarget.contains(k.target)||(window.clearTimeout(O.current),M.current="")}),onPointerMove:V(e.onPointerMove,js(k=>{const j=k.target,U=I.current!==k.clientX;if(k.currentTarget.contains(j)&&U){const F=k.clientX>I.current?"right":"left";H.current=F,I.current=k.clientX}}))})})})})})})});zy.displayName=pt;var pT="MenuGroup",Hd=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(ve.div,{role:"group",...r,ref:t})});Hd.displayName=pT;var hT="MenuLabel",Uy=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(ve.div,{...r,ref:t})});Uy.displayName=hT;var ba="MenuItem",lh="menu.itemSelect",nl=f.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=f.useRef(null),i=Qs(ba,e.__scopeMenu),a=Bd(ba,e.__scopeMenu),l=Re(t,s),u=f.useRef(!1),c=()=>{const d=s.current;if(!n&&d){const h=new CustomEvent(lh,{bubbles:!0,cancelable:!0});d.addEventListener(lh,p=>r==null?void 0:r(p),{once:!0}),Nd(d,h),h.defaultPrevented?u.current=!1:i.onClose()}};return m.jsx(Vy,{...o,ref:l,disabled:n,onClick:V(e.onClick,c),onPointerDown:d=>{var h;(h=e.onPointerDown)==null||h.call(e,d),u.current=!0},onPointerUp:V(e.onPointerUp,d=>{var h;u.current||(h=d.currentTarget)==null||h.click()}),onKeyDown:V(e.onKeyDown,d=>{const h=a.searchRef.current!=="";n||h&&d.key===" "||hc.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});nl.displayName=ba;var Vy=f.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=Bd(ba,n),a=Ly(n),l=f.useRef(null),u=Re(t,l),[c,d]=f.useState(!1),[h,p]=f.useState("");return f.useEffect(()=>{const E=l.current;E&&p((E.textContent??"").trim())},[s.children]),m.jsx(Os.ItemSlot,{scope:n,disabled:r,textValue:o??h,children:m.jsx(ik,{asChild:!0,...a,focusable:!r,children:m.jsx(ve.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:V(e.onPointerMove,js(E=>{r?i.onItemLeave(E):(i.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:V(e.onPointerLeave,js(E=>i.onItemLeave(E))),onFocus:V(e.onFocus,()=>d(!0)),onBlur:V(e.onBlur,()=>d(!1))})})})}),mT="MenuCheckboxItem",By=f.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return m.jsx(Qy,{scope:e.__scopeMenu,checked:n,children:m.jsx(nl,{role:"menuitemcheckbox","aria-checked":Pa(n)?"mixed":n,...o,ref:t,"data-state":Gd(n),onSelect:V(o.onSelect,()=>r==null?void 0:r(Pa(n)?!0:!n),{checkForDefaultPrevented:!1})})})});By.displayName=mT;var Wy="MenuRadioGroup",[vT,gT]=_r(Wy,{value:void 0,onValueChange:()=>{}}),Hy=f.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=qe(r);return m.jsx(vT,{scope:e.__scopeMenu,value:n,onValueChange:s,children:m.jsx(Hd,{...o,ref:t})})});Hy.displayName=Wy;var Ky="MenuRadioItem",Gy=f.forwardRef((e,t)=>{const{value:n,...r}=e,o=gT(Ky,e.__scopeMenu),s=n===o.value;return m.jsx(Qy,{scope:e.__scopeMenu,checked:s,children:m.jsx(nl,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":Gd(s),onSelect:V(r.onSelect,()=>{var i;return(i=o.onValueChange)==null?void 0:i.call(o,n)},{checkForDefaultPrevented:!1})})})});Gy.displayName=Ky;var Kd="MenuItemIndicator",[Qy,yT]=_r(Kd,{checked:!1}),Yy=f.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=yT(Kd,n);return m.jsx(Rr,{present:r||Pa(s.checked)||s.checked===!0,children:m.jsx(ve.span,{...o,ref:t,"data-state":Gd(s.checked)})})});Yy.displayName=Kd;var wT="MenuSeparator",Xy=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(ve.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Xy.displayName=wT;var xT="MenuArrow",qy=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=tl(n);return m.jsx(yy,{...o,...r,ref:t})});qy.displayName=xT;var ST="MenuSub",[fA,Zy]=_r(ST),Jo="MenuSubTrigger",Jy=f.forwardRef((e,t)=>{const n=Nr(Jo,e.__scopeMenu),r=Qs(Jo,e.__scopeMenu),o=Zy(Jo,e.__scopeMenu),s=Bd(Jo,e.__scopeMenu),i=f.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,u={__scopeMenu:e.__scopeMenu},c=f.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return f.useEffect(()=>c,[c]),f.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),m.jsx(Ud,{asChild:!0,...u,children:m.jsx(Vy,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":nw(n.open),...e,ref:kr(t,o.onTriggerChange),onClick:d=>{var h;(h=e.onClick)==null||h.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:V(e.onPointerMove,js(d=>{s.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),c()},100))})),onPointerLeave:V(e.onPointerLeave,js(d=>{var p,E;c();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const y=(E=n.content)==null?void 0:E.dataset.side,x=y==="right",g=x?-5:5,v=h[x?"left":"right"],w=h[x?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+g,y:d.clientY},{x:v,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x:v,y:h.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:V(e.onKeyDown,d=>{var p;const h=s.searchRef.current!=="";e.disabled||h&&d.key===" "||tT[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});Jy.displayName=Jo;var ew="MenuSubContent",tw=f.forwardRef((e,t)=>{const n=Fy(pt,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Nr(pt,e.__scopeMenu),i=Qs(pt,e.__scopeMenu),a=Zy(ew,e.__scopeMenu),l=f.useRef(null),u=Re(t,l);return m.jsx(Os.Provider,{scope:e.__scopeMenu,children:m.jsx(Rr,{present:r||s.open,children:m.jsx(Os.Slot,{scope:e.__scopeMenu,children:m.jsx(Wd,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:c=>{var d;i.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),c.preventDefault()},onCloseAutoFocus:c=>c.preventDefault(),onFocusOutside:V(e.onFocusOutside,c=>{c.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:V(e.onEscapeKeyDown,c=>{i.onClose(),c.preventDefault()}),onKeyDown:V(e.onKeyDown,c=>{var p;const d=c.currentTarget.contains(c.target),h=nT[i.dir].includes(c.key);d&&h&&(s.onOpenChange(!1),(p=a.trigger)==null||p.focus(),c.preventDefault())})})})})})});tw.displayName=ew;function nw(e){return e?"open":"closed"}function Pa(e){return e==="indeterminate"}function Gd(e){return Pa(e)?"indeterminate":e?"checked":"unchecked"}function ET(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function CT(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function bT(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=CT(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const l=i.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function PT(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;sr!=h>r&&n<(d-u)*(r-c)/(h-c)+u&&(o=!o)}return o}function kT(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return PT(n,t)}function js(e){return t=>t.pointerType==="mouse"?e(t):void 0}var TT=Dy,RT=Ud,_T=$y,NT=zy,AT=Hd,MT=Uy,OT=nl,jT=By,IT=Hy,LT=Gy,DT=Yy,FT=Xy,$T=qy,zT=Jy,UT=tw,rl="DropdownMenu",[VT]=Tr(rl,[Iy]),We=Iy(),[BT,rw]=VT(rl),ow=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,l=We(t),u=f.useRef(null),[c,d]=_d({prop:o,defaultProp:s??!1,onChange:i,caller:rl});return m.jsx(BT,{scope:t,triggerId:lc(),triggerRef:u,contentId:lc(),open:c,onOpenChange:d,onOpenToggle:f.useCallback(()=>d(h=>!h),[d]),modal:a,children:m.jsx(TT,{...l,open:c,onOpenChange:d,dir:r,modal:a,children:n})})};ow.displayName=rl;var sw="DropdownMenuTrigger",iw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=rw(sw,n),i=We(n);return m.jsx(RT,{asChild:!0,...i,children:m.jsx(ve.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:kr(t,s.triggerRef),onPointerDown:V(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:V(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});iw.displayName=sw;var WT="DropdownMenuPortal",aw=e=>{const{__scopeDropdownMenu:t,...n}=e,r=We(t);return m.jsx(_T,{...r,...n})};aw.displayName=WT;var lw="DropdownMenuContent",uw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=rw(lw,n),s=We(n),i=f.useRef(!1);return m.jsx(NT,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:V(e.onCloseAutoFocus,a=>{var l;i.current||(l=o.triggerRef.current)==null||l.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:V(e.onInteractOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,c=l.button===2||u;(!o.modal||c)&&(i.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)"}})});uw.displayName=lw;var HT="DropdownMenuGroup",KT=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return m.jsx(AT,{...o,...r,ref:t})});KT.displayName=HT;var GT="DropdownMenuLabel",cw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return m.jsx(MT,{...o,...r,ref:t})});cw.displayName=GT;var QT="DropdownMenuItem",dw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return m.jsx(OT,{...o,...r,ref:t})});dw.displayName=QT;var YT="DropdownMenuCheckboxItem",fw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return m.jsx(jT,{...o,...r,ref:t})});fw.displayName=YT;var XT="DropdownMenuRadioGroup",qT=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return m.jsx(IT,{...o,...r,ref:t})});qT.displayName=XT;var ZT="DropdownMenuRadioItem",pw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return m.jsx(LT,{...o,...r,ref:t})});pw.displayName=ZT;var JT="DropdownMenuItemIndicator",hw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return m.jsx(DT,{...o,...r,ref:t})});hw.displayName=JT;var eR="DropdownMenuSeparator",mw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return m.jsx(FT,{...o,...r,ref:t})});mw.displayName=eR;var tR="DropdownMenuArrow",nR=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return m.jsx($T,{...o,...r,ref:t})});nR.displayName=tR;var rR="DropdownMenuSubTrigger",vw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return m.jsx(zT,{...o,...r,ref:t})});vw.displayName=rR;var oR="DropdownMenuSubContent",gw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return m.jsx(UT,{...o,...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)"}})});gw.displayName=oR;var sR=ow,iR=iw,aR=aw,yw=uw,ww=cw,xw=dw,Sw=fw,Ew=pw,Cw=hw,bw=mw,Pw=vw,kw=gw;/** +`)},qk=0,$r=[];function Zk(e){var t=f.useRef([]),n=f.useRef([0,0]),r=f.useRef(),o=f.useState(qk++)[0],s=f.useState(Ay)[0],i=f.useRef(e);f.useEffect(function(){i.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var y=wk([e.lockRef.current],(e.shards||[]).map(ch),!0).filter(Boolean);return y.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),y.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=f.useCallback(function(y,x){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!i.current.allowPinchZoom;var g=bi(y),v=n.current,w="deltaX"in y?y.deltaX:v[0]-g[0],S="deltaY"in y?y.deltaY:v[1]-g[1],C,b=y.target,P=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in y&&P==="h"&&b.type==="range")return!1;var R=window.getSelection(),O=R&&R.anchorNode,M=O?O===b||O.contains(b):!1;if(M)return!1;var $=lh(P,b);if(!$)return!0;if($?C=P:(C=P==="v"?"h":"v",$=lh(P,b)),!$)return!1;if(!r.current&&"changedTouches"in y&&(w||S)&&(r.current=C),!C)return!0;var L=r.current||C;return Qk(L,x,y,L==="h"?w:S)},[]),l=f.useCallback(function(y){var x=y;if(!(!$r.length||$r[$r.length-1]!==s)){var g="deltaY"in x?uh(x):bi(x),v=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&Yk(C.delta,g)})[0];if(v&&v.should){x.cancelable&&x.preventDefault();return}if(!v){var w=(i.current.shards||[]).map(ch).filter(Boolean).filter(function(C){return C.contains(x.target)}),S=w.length>0?a(x,w[0]):!i.current.noIsolation;S&&x.cancelable&&x.preventDefault()}}},[]),u=f.useCallback(function(y,x,g,v){var w={name:y,delta:x,target:g,should:v,shadowParent:Jk(g)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),c=f.useCallback(function(y){n.current=bi(y),r.current=void 0},[]),d=f.useCallback(function(y){u(y.type,uh(y),y.target,a(y,e.lockRef.current))},[]),m=f.useCallback(function(y){u(y.type,bi(y),y.target,a(y,e.lockRef.current))},[]);f.useEffect(function(){return $r.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:m}),document.addEventListener("wheel",l,Fr),document.addEventListener("touchmove",l,Fr),document.addEventListener("touchstart",c,Fr),function(){$r=$r.filter(function(y){return y!==s}),document.removeEventListener("wheel",l,Fr),document.removeEventListener("touchmove",l,Fr),document.removeEventListener("touchstart",c,Fr)}},[]);var p=e.removeScrollBar,E=e.inert;return f.createElement(f.Fragment,null,E?f.createElement(s,{styles:Xk(o)}):null,p?f.createElement(Uk,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Jk(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const eT=Rk(Ny,Zk);var Iy=f.forwardRef(function(e,t){return f.createElement(el,Ut({},e,{ref:t,sideCar:eT}))});Iy.classNames=el.classNames;var vc=["Enter"," "],tT=["ArrowDown","PageUp","Home"],Ly=["ArrowUp","PageDown","End"],nT=[...tT,...Ly],rT={ltr:[...vc,"ArrowRight"],rtl:[...vc,"ArrowLeft"]},oT={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Qs="Menu",[js,sT,iT]=Od(Qs),[_r,Dy]=Tr(Qs,[iT,Ja,Ey]),tl=Ja(),Fy=Ey(),[aT,Nr]=_r(Qs),[lT,Ys]=_r(Qs),$y=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=tl(t),[l,u]=f.useState(null),c=f.useRef(!1),d=qe(s),m=Hg(o);return f.useEffect(()=>{const p=()=>{c.current=!0,document.addEventListener("pointerdown",E,{capture:!0,once:!0}),document.addEventListener("pointermove",E,{capture:!0,once:!0})},E=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",E,{capture:!0}),document.removeEventListener("pointermove",E,{capture:!0})}},[]),h.jsx(KP,{...a,children:h.jsx(aT,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:u,children:h.jsx(lT,{scope:t,onClose:f.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:m,modal:i,children:r})})})};$y.displayName=Qs;var uT="MenuAnchor",Bd=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=tl(n);return h.jsx(yy,{...o,...r,ref:t})});Bd.displayName=uT;var Wd="MenuPortal",[cT,zy]=_r(Wd,{forceMount:void 0}),Uy=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Nr(Wd,t);return h.jsx(cT,{scope:t,forceMount:n,children:h.jsx(Rr,{present:n||s.open,children:h.jsx(Vd,{asChild:!0,container:o,children:r})})})};Uy.displayName=Wd;var pt="MenuContent",[dT,Hd]=_r(pt),Vy=f.forwardRef((e,t)=>{const n=zy(pt,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Nr(pt,e.__scopeMenu),i=Ys(pt,e.__scopeMenu);return h.jsx(js.Provider,{scope:e.__scopeMenu,children:h.jsx(Rr,{present:r||s.open,children:h.jsx(js.Slot,{scope:e.__scopeMenu,children:i.modal?h.jsx(fT,{...o,ref:t}):h.jsx(pT,{...o,ref:t})})})})}),fT=f.forwardRef((e,t)=>{const n=Nr(pt,e.__scopeMenu),r=f.useRef(null),o=Re(t,r);return f.useEffect(()=>{const s=r.current;if(s)return yk(s)},[]),h.jsx(Kd,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:V(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),pT=f.forwardRef((e,t)=>{const n=Nr(pt,e.__scopeMenu);return h.jsx(Kd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),hT=uk("MenuContent.ScrollLock"),Kd=f.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:m,onDismiss:p,disableOutsideScroll:E,...y}=e,x=Nr(pt,n),g=Ys(pt,n),v=tl(n),w=Fy(n),S=sT(n),[C,b]=f.useState(null),P=f.useRef(null),R=Re(t,P,x.onContentChange),O=f.useRef(0),M=f.useRef(""),$=f.useRef(0),L=f.useRef(null),H=f.useRef("right"),I=f.useRef(0),Y=E?Iy:f.Fragment,z=E?{as:hT,allowPinchZoom:!0}:void 0,W=k=>{var q,Gt;const j=M.current+k,U=S().filter(be=>!be.disabled),F=document.activeElement,G=(q=U.find(be=>be.ref.current===F))==null?void 0:q.textValue,X=U.map(be=>be.textValue),de=kT(X,j,G),ge=(Gt=U.find(be=>be.textValue===de))==null?void 0:Gt.ref.current;(function be(Ot){M.current=Ot,window.clearTimeout(O.current),Ot!==""&&(O.current=window.setTimeout(()=>be(""),1e3))})(j),ge&&setTimeout(()=>ge.focus())};f.useEffect(()=>()=>window.clearTimeout(O.current),[]),Cb();const N=f.useCallback(k=>{var U,F;return H.current===((U=L.current)==null?void 0:U.side)&&RT(k,(F=L.current)==null?void 0:F.area)},[]);return h.jsx(dT,{scope:n,searchRef:M,onItemEnter:f.useCallback(k=>{N(k)&&k.preventDefault()},[N]),onItemLeave:f.useCallback(k=>{var j;N(k)||((j=P.current)==null||j.focus(),b(null))},[N]),onTriggerLeave:f.useCallback(k=>{N(k)&&k.preventDefault()},[N]),pointerGraceTimerRef:$,onPointerGraceIntentChange:f.useCallback(k=>{L.current=k},[]),children:h.jsx(Y,{...z,children:h.jsx(Yg,{asChild:!0,trapped:o,onMountAutoFocus:V(s,k=>{var j;k.preventDefault(),(j=P.current)==null||j.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:h.jsx(Qa,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:m,onDismiss:p,children:h.jsx(ak,{asChild:!0,...w,dir:g.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:b,onEntryFocus:V(l,k=>{g.isUsingKeyboardRef.current||k.preventDefault()}),preventScrollOnEntryFocus:!0,children:h.jsx(wy,{role:"menu","aria-orientation":"vertical","data-state":ow(x.open),"data-radix-menu-content":"",dir:g.dir,...v,...y,ref:R,style:{outline:"none",...y.style},onKeyDown:V(y.onKeyDown,k=>{const U=k.target.closest("[data-radix-menu-content]")===k.currentTarget,F=k.ctrlKey||k.altKey||k.metaKey,G=k.key.length===1;U&&(k.key==="Tab"&&k.preventDefault(),!F&&G&&W(k.key));const X=P.current;if(k.target!==X||!nT.includes(k.key))return;k.preventDefault();const ge=S().filter(q=>!q.disabled).map(q=>q.ref.current);Ly.includes(k.key)&&ge.reverse(),bT(ge)}),onBlur:V(e.onBlur,k=>{k.currentTarget.contains(k.target)||(window.clearTimeout(O.current),M.current="")}),onPointerMove:V(e.onPointerMove,Is(k=>{const j=k.target,U=I.current!==k.clientX;if(k.currentTarget.contains(j)&&U){const F=k.clientX>I.current?"right":"left";H.current=F,I.current=k.clientX}}))})})})})})})});Vy.displayName=pt;var mT="MenuGroup",Gd=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(ve.div,{role:"group",...r,ref:t})});Gd.displayName=mT;var vT="MenuLabel",By=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(ve.div,{...r,ref:t})});By.displayName=vT;var ba="MenuItem",dh="menu.itemSelect",nl=f.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=f.useRef(null),i=Ys(ba,e.__scopeMenu),a=Hd(ba,e.__scopeMenu),l=Re(t,s),u=f.useRef(!1),c=()=>{const d=s.current;if(!n&&d){const m=new CustomEvent(dh,{bubbles:!0,cancelable:!0});d.addEventListener(dh,p=>r==null?void 0:r(p),{once:!0}),Md(d,m),m.defaultPrevented?u.current=!1:i.onClose()}};return h.jsx(Wy,{...o,ref:l,disabled:n,onClick:V(e.onClick,c),onPointerDown:d=>{var m;(m=e.onPointerDown)==null||m.call(e,d),u.current=!0},onPointerUp:V(e.onPointerUp,d=>{var m;u.current||(m=d.currentTarget)==null||m.click()}),onKeyDown:V(e.onKeyDown,d=>{const m=a.searchRef.current!=="";n||m&&d.key===" "||vc.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});nl.displayName=ba;var Wy=f.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=Hd(ba,n),a=Fy(n),l=f.useRef(null),u=Re(t,l),[c,d]=f.useState(!1),[m,p]=f.useState("");return f.useEffect(()=>{const E=l.current;E&&p((E.textContent??"").trim())},[s.children]),h.jsx(js.ItemSlot,{scope:n,disabled:r,textValue:o??m,children:h.jsx(lk,{asChild:!0,...a,focusable:!r,children:h.jsx(ve.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:V(e.onPointerMove,Is(E=>{r?i.onItemLeave(E):(i.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:V(e.onPointerLeave,Is(E=>i.onItemLeave(E))),onFocus:V(e.onFocus,()=>d(!0)),onBlur:V(e.onBlur,()=>d(!1))})})})}),gT="MenuCheckboxItem",Hy=f.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return h.jsx(Xy,{scope:e.__scopeMenu,checked:n,children:h.jsx(nl,{role:"menuitemcheckbox","aria-checked":Pa(n)?"mixed":n,...o,ref:t,"data-state":Yd(n),onSelect:V(o.onSelect,()=>r==null?void 0:r(Pa(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Hy.displayName=gT;var Ky="MenuRadioGroup",[yT,wT]=_r(Ky,{value:void 0,onValueChange:()=>{}}),Gy=f.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=qe(r);return h.jsx(yT,{scope:e.__scopeMenu,value:n,onValueChange:s,children:h.jsx(Gd,{...o,ref:t})})});Gy.displayName=Ky;var Qy="MenuRadioItem",Yy=f.forwardRef((e,t)=>{const{value:n,...r}=e,o=wT(Qy,e.__scopeMenu),s=n===o.value;return h.jsx(Xy,{scope:e.__scopeMenu,checked:s,children:h.jsx(nl,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":Yd(s),onSelect:V(r.onSelect,()=>{var i;return(i=o.onValueChange)==null?void 0:i.call(o,n)},{checkForDefaultPrevented:!1})})})});Yy.displayName=Qy;var Qd="MenuItemIndicator",[Xy,xT]=_r(Qd,{checked:!1}),qy=f.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=xT(Qd,n);return h.jsx(Rr,{present:r||Pa(s.checked)||s.checked===!0,children:h.jsx(ve.span,{...o,ref:t,"data-state":Yd(s.checked)})})});qy.displayName=Qd;var ST="MenuSeparator",Zy=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(ve.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Zy.displayName=ST;var ET="MenuArrow",Jy=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=tl(n);return h.jsx(xy,{...o,...r,ref:t})});Jy.displayName=ET;var CT="MenuSub",[vA,ew]=_r(CT),Jo="MenuSubTrigger",tw=f.forwardRef((e,t)=>{const n=Nr(Jo,e.__scopeMenu),r=Ys(Jo,e.__scopeMenu),o=ew(Jo,e.__scopeMenu),s=Hd(Jo,e.__scopeMenu),i=f.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,u={__scopeMenu:e.__scopeMenu},c=f.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return f.useEffect(()=>c,[c]),f.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),h.jsx(Bd,{asChild:!0,...u,children:h.jsx(Wy,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":ow(n.open),...e,ref:kr(t,o.onTriggerChange),onClick:d=>{var m;(m=e.onClick)==null||m.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:V(e.onPointerMove,Is(d=>{s.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),c()},100))})),onPointerLeave:V(e.onPointerLeave,Is(d=>{var p,E;c();const m=(p=n.content)==null?void 0:p.getBoundingClientRect();if(m){const y=(E=n.content)==null?void 0:E.dataset.side,x=y==="right",g=x?-5:5,v=m[x?"left":"right"],w=m[x?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+g,y:d.clientY},{x:v,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:v,y:m.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:V(e.onKeyDown,d=>{var p;const m=s.searchRef.current!=="";e.disabled||m&&d.key===" "||rT[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});tw.displayName=Jo;var nw="MenuSubContent",rw=f.forwardRef((e,t)=>{const n=zy(pt,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Nr(pt,e.__scopeMenu),i=Ys(pt,e.__scopeMenu),a=ew(nw,e.__scopeMenu),l=f.useRef(null),u=Re(t,l);return h.jsx(js.Provider,{scope:e.__scopeMenu,children:h.jsx(Rr,{present:r||s.open,children:h.jsx(js.Slot,{scope:e.__scopeMenu,children:h.jsx(Kd,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:c=>{var d;i.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),c.preventDefault()},onCloseAutoFocus:c=>c.preventDefault(),onFocusOutside:V(e.onFocusOutside,c=>{c.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:V(e.onEscapeKeyDown,c=>{i.onClose(),c.preventDefault()}),onKeyDown:V(e.onKeyDown,c=>{var p;const d=c.currentTarget.contains(c.target),m=oT[i.dir].includes(c.key);d&&m&&(s.onOpenChange(!1),(p=a.trigger)==null||p.focus(),c.preventDefault())})})})})})});rw.displayName=nw;function ow(e){return e?"open":"closed"}function Pa(e){return e==="indeterminate"}function Yd(e){return Pa(e)?"indeterminate":e?"checked":"unchecked"}function bT(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function PT(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function kT(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=PT(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const l=i.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function TT(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;sr!=m>r&&n<(d-u)*(r-c)/(m-c)+u&&(o=!o)}return o}function RT(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return TT(n,t)}function Is(e){return t=>t.pointerType==="mouse"?e(t):void 0}var _T=$y,NT=Bd,AT=Uy,MT=Vy,OT=Gd,jT=By,IT=nl,LT=Hy,DT=Gy,FT=Yy,$T=qy,zT=Zy,UT=Jy,VT=tw,BT=rw,rl="DropdownMenu",[WT]=Tr(rl,[Dy]),We=Dy(),[HT,sw]=WT(rl),iw=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,l=We(t),u=f.useRef(null),[c,d]=Ad({prop:o,defaultProp:s??!1,onChange:i,caller:rl});return h.jsx(HT,{scope:t,triggerId:cc(),triggerRef:u,contentId:cc(),open:c,onOpenChange:d,onOpenToggle:f.useCallback(()=>d(m=>!m),[d]),modal:a,children:h.jsx(_T,{...l,open:c,onOpenChange:d,dir:r,modal:a,children:n})})};iw.displayName=rl;var aw="DropdownMenuTrigger",lw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=sw(aw,n),i=We(n);return h.jsx(NT,{asChild:!0,...i,children:h.jsx(ve.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:kr(t,s.triggerRef),onPointerDown:V(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:V(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});lw.displayName=aw;var KT="DropdownMenuPortal",uw=e=>{const{__scopeDropdownMenu:t,...n}=e,r=We(t);return h.jsx(AT,{...r,...n})};uw.displayName=KT;var cw="DropdownMenuContent",dw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=sw(cw,n),s=We(n),i=f.useRef(!1);return h.jsx(MT,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:V(e.onCloseAutoFocus,a=>{var l;i.current||(l=o.triggerRef.current)==null||l.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:V(e.onInteractOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,c=l.button===2||u;(!o.modal||c)&&(i.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)"}})});dw.displayName=cw;var GT="DropdownMenuGroup",QT=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return h.jsx(OT,{...o,...r,ref:t})});QT.displayName=GT;var YT="DropdownMenuLabel",fw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return h.jsx(jT,{...o,...r,ref:t})});fw.displayName=YT;var XT="DropdownMenuItem",pw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return h.jsx(IT,{...o,...r,ref:t})});pw.displayName=XT;var qT="DropdownMenuCheckboxItem",hw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return h.jsx(LT,{...o,...r,ref:t})});hw.displayName=qT;var ZT="DropdownMenuRadioGroup",JT=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return h.jsx(DT,{...o,...r,ref:t})});JT.displayName=ZT;var eR="DropdownMenuRadioItem",mw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return h.jsx(FT,{...o,...r,ref:t})});mw.displayName=eR;var tR="DropdownMenuItemIndicator",vw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return h.jsx($T,{...o,...r,ref:t})});vw.displayName=tR;var nR="DropdownMenuSeparator",gw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return h.jsx(zT,{...o,...r,ref:t})});gw.displayName=nR;var rR="DropdownMenuArrow",oR=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return h.jsx(UT,{...o,...r,ref:t})});oR.displayName=rR;var sR="DropdownMenuSubTrigger",yw=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return h.jsx(VT,{...o,...r,ref:t})});yw.displayName=sR;var iR="DropdownMenuSubContent",ww=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=We(n);return h.jsx(BT,{...o,...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)"}})});ww.displayName=iR;var aR=iw,lR=lw,uR=uw,xw=dw,Sw=fw,Ew=pw,Cw=hw,bw=mw,Pw=vw,kw=gw,Tw=yw,Rw=ww;/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Tw=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** + */const cR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_w=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var uR={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var dR={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cR=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},l)=>f.createElement("svg",{ref:l,...uR,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Tw("lucide",o),...a},[...i.map(([u,c])=>f.createElement(u,c)),...Array.isArray(s)?s:[s]]));/** + */const fR=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},l)=>f.createElement("svg",{ref:l,...dR,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:_w("lucide",o),...a},[...i.map(([u,c])=>f.createElement(u,c)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ol=(e,t)=>{const n=f.forwardRef(({className:r,...o},s)=>f.createElement(cR,{ref:s,iconNode:t,className:Tw(`lucide-${lR(e)}`,r),...o}));return n.displayName=`${e}`,n};/** + */const ol=(e,t)=>{const n=f.forwardRef(({className:r,...o},s)=>f.createElement(fR,{ref:s,iconNode:t,className:_w(`lucide-${cR(e)}`,r),...o}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dR=ol("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const pR=ol("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fR=ol("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const hR=ol("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pR=ol("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + */const mR=ol("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hR=ol("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),mR=sR,vR=iR,gR=f.forwardRef(({className:e,inset:t,children:n,...r},o)=>m.jsxs(Pw,{ref:o,className:_e("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...r,children:[n,m.jsx(fR,{className:"ml-auto h-4 w-4"})]}));gR.displayName=Pw.displayName;const yR=f.forwardRef(({className:e,...t},n)=>m.jsx(kw,{ref:n,className:_e("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",e),...t}));yR.displayName=kw.displayName;const Rw=f.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(aR,{children:m.jsx(yw,{ref:r,sideOffset:t,className:_e("z-50 min-w-[8rem] overflow-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",e),...n})}));Rw.displayName=yw.displayName;const It=f.forwardRef(({className:e,inset:t,...n},r)=>m.jsx(xw,{ref:r,className:_e("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...n}));It.displayName=xw.displayName;const wR=f.forwardRef(({className:e,children:t,checked:n,...r},o)=>m.jsxs(Sw,{ref:o,className:_e("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:n,...r,children:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(Cw,{children:m.jsx(dR,{className:"h-4 w-4"})})}),t]}));wR.displayName=Sw.displayName;const xR=f.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(Ew,{ref:r,className:_e("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(Cw,{children:m.jsx(pR,{className:"h-2 w-2 fill-current"})})}),t]}));xR.displayName=Ew.displayName;const _w=f.forwardRef(({className:e,inset:t,...n},r)=>m.jsx(ww,{ref:r,className:_e("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));_w.displayName=ww.displayName;const mc=f.forwardRef(({className:e,...t},n)=>m.jsx(bw,{ref:n,className:_e("-mx-1 my-1 h-px bg-muted",e),...t}));mc.displayName=bw.displayName;function SR(e){const n=(e.name||e.username||"?").trim().split(/\s+/).filter(Boolean);return n.length===0?"?":n.length===1?n[0][0].toUpperCase():(n[0][0]+n[n.length-1][0]).toUpperCase()}const ER=({user:e,onLogout:t})=>m.jsxs(mR,{children:[m.jsx(vR,{asChild:!0,children:m.jsx("button",{type:"button",className:"user-avatar-btn","aria-label":`Account menu for ${e.username}`,children:m.jsxs(zg,{className:"h-8 w-8",children:[e.avatar_url&&m.jsx(Ug,{src:e.avatar_url,alt:e.username}),m.jsx(Vg,{className:"text-xs",children:SR(e)})]})})}),m.jsxs(Rw,{align:"end",className:"w-56",children:[m.jsxs(_w,{className:"flex flex-col gap-0.5 py-2",children:[m.jsx("span",{className:"text-sm font-medium leading-tight",children:e.name||e.username}),m.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["@",e.username]}),e.is_admin&&m.jsx("span",{className:"mt-1 inline-flex w-fit items-center rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-amber-900",children:"Admin"}),e.role==="contributor"&&m.jsx("span",{className:"mt-1 inline-flex w-fit items-center rounded-full bg-blue-100 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-blue-900",children:"Contributor"})]}),m.jsx(mc,{}),m.jsx(It,{asChild:!0,children:m.jsx("a",{href:`https://huggingface.co/${encodeURIComponent(e.username)}`,target:"_blank",rel:"noopener noreferrer",children:"Hugging Face profile"})}),ya()&&m.jsx(It,{asChild:!0,children:m.jsx(qt,{to:"/chat",children:"Chat"})}),m.jsx(It,{asChild:!0,children:m.jsx(qt,{to:"/frameworks",children:"Frameworks"})}),m.jsx(It,{asChild:!0,children:m.jsx(qt,{to:"/trends",children:"Trends"})}),e.is_admin&&m.jsxs(m.Fragment,{children:[m.jsx(It,{asChild:!0,children:m.jsx(qt,{to:"/admin-dashboard",children:"Admin dashboard"})}),m.jsx(It,{asChild:!0,children:m.jsx(qt,{to:"/submissions",children:"Review submissions"})})]}),m.jsx(It,{asChild:!0,children:m.jsx(qt,{to:`/${encodeURIComponent(e.username)}`,children:"My contributions"})}),m.jsx(It,{asChild:!0,children:m.jsx(qt,{to:"/settings",children:"Settings"})}),m.jsx(mc,{}),m.jsx(It,{onSelect:n=>{n.preventDefault(),t()},children:"Log out"})]})]}),CR="cronAdminToken";function bR(){var e;return typeof window>"u"?"":((e=window.localStorage.getItem(CR))==null?void 0:e.trim())??""}const PR=!1;class Nw extends Error{constructor(n,r){var o;super(`API request failed: ${n.status} ${n.statusText}`);tr(this,"status");tr(this,"statusText");tr(this,"response");tr(this,"detail");tr(this,"code");this.name="ApiError",this.status=n.status,this.statusText=n.statusText,this.response=r;try{if(this.detail=(o=JSON.parse(r))==null?void 0:o.detail,typeof this.detail=="string"&&(this.message=this.detail),typeof this.detail=="object"&&this.detail!==null&&"code"in this.detail&&typeof this.detail.code=="string"&&(this.code=this.detail.code),typeof this.detail=="object"&&this.detail!==null&&"message"in this.detail&&typeof this.detail.message=="string"){const s="help"in this.detail&&typeof this.detail.help=="string"?` See ${this.detail.help} for help.`:"";this.message=`${this.detail.message}${s}`}}catch{this.detail=void 0}}}class kR{constructor(t){this.baseUrl=t}async fetch(t,n){const r=`${this.baseUrl}${t}`;try{const{headers:o,...s}=n??{},a=(s.method??"GET").toUpperCase()==="GET"?"default":"no-store",l=bR(),u=new Headers(o);return u.has("Content-Type")||u.set("Content-Type","application/json"),l&&!u.has("X-Admin-Token")&&u.set("X-Admin-Token",l),await fetch(r,{...s,cache:s.cache??a,credentials:s.credentials??"include",headers:u})}catch(o){throw console.error(`[API] Request to ${r} failed:`,o),o}}async request(t,n){const r=await this.fetch(t,n);if(!r.ok){const s=new Nw(r,await r.text());throw console.error("[API] Error response:",s.response),s}return r.status===204?void 0:await r.json()}}function TR(e){e instanceof Nw&&e.status===401&&e.code!=="fresh_auth_required"&&e.code!=="saved_papers_bucket_authorization_required"&&typeof window<"u"&&window.dispatchEvent(new CustomEvent("pwc:auth-stale"))}async function RR(e){try{return await e()}catch(t){throw TR(t),t}}const Aw=new kR(`${bd()}/api/v1`),_R=(e,t)=>Aw.fetch(e,t),vc=(e,t)=>RR(()=>Aw.request(e,t)),uh={async getCurrentUser(){if(Ws())return null;const e=await _R("/auth/me",{cache:"no-store"});return e.status===401||!e.ok?null:e.json()},async logout(){await vc("/auth/logout",{method:"POST"})},async requestStagingAccess(){await vc("/staging-access-request",{method:"POST"})}},Mw=T.createContext(null),ch="pwc:auth-stale",NR=({children:e})=>{const[t,n]=T.useState(null),[r,o]=T.useState(!0),s=T.useCallback(async()=>{o(!0);const l=await uh.getCurrentUser();n(l),o(!1)},[]),i=T.useCallback(async()=>{const l=Pd("/api/v1/auth/logout");if(new URL(l,window.location.origin).origin!==window.location.origin){const u=document.createElement("form");u.method="POST",u.action=`${l}?return_to=${encodeURIComponent(window.location.href)}`,document.body.appendChild(u),u.submit();return}await uh.logout(),n(null)},[]);T.useEffect(()=>{s()},[s]),T.useEffect(()=>{const l=()=>n(null);return window.addEventListener(ch,l),()=>window.removeEventListener(ch,l)},[]);const a=T.useMemo(()=>({user:t,isLoading:r,refresh:s,logout:i}),[t,r,s,i]);return m.jsx(Mw.Provider,{value:a,children:e})};function Qd(){const e=T.useContext(Mw);if(!e)throw new Error("useAuth must be used inside an ");return e}const Qo=({name:e,size:t=14})=>{const n={search:m.jsx("path",{d:"M11 11l3 3M7 12.5a5.5 5.5 0 110-11 5.5 5.5 0 010 11z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),bookmark:m.jsx("path",{d:"M4 2h8v12l-4-3-4 3V2z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),menu:m.jsx("path",{d:"M2 4h12M2 8h12M2 12h12",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),close:m.jsx("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})};return m.jsx("svg",{className:t===11?"icon-sm":"icon",viewBox:"0 0 16 16",width:t,height:t,children:n[e]})},dh="https://github.com/huggingface/paperswithcode-feedback/issues",AR="https://github.com/huggingface/pwc-cli",fh=[{to:"/",label:"Trending",end:!0},{to:"/tasks",label:"Browse state-of-the-art",end:!1},{to:"/methods",label:"Methods",end:!1},{to:"/conferences",label:"Conferences",end:!1},{to:"/organizations",label:"Organizations",end:!1},{to:"/submit",label:"Submit",end:!1}],MR=()=>{if(typeof navigator>"u")return!1;const e=navigator.userAgentData,t=(e==null?void 0:e.platform)||navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/i.test(t)},OR=()=>{const[e,t]=T.useState(!1);return T.useEffect(()=>{t(MR())},[]),m.jsx("kbd",{children:e?"⌘K":"Ctrl K"})},jR=({onOpenSearch:e})=>{const[t,n]=T.useState(!1),r=()=>n(!1),{user:o,logout:s}=Qd(),i=Mt(),a=ya()&&(i.pathname==="/chat"||i.pathname.startsWith("/chat/")),l=`${i.pathname}${i.search}`||"/",u=Ws();return m.jsxs(m.Fragment,{children:[m.jsxs("header",{className:`app-header${a?" app-header-chat":""}`,children:[m.jsxs("div",{className:"app-header-inner",children:[m.jsxs(nr,{to:"/",className:"brand",onClick:r,children:[m.jsx("span",{className:"brand-mark"}),m.jsxs("span",{className:"brand-name",children:["Papers ",m.jsx("em",{children:"With Code"})]})]}),m.jsx("nav",{className:"nav",children:fh.map(({to:c,label:d,end:h})=>m.jsx(nr,{to:c,end:h,className:({isActive:p})=>`nav-item ${p?"active":""}`,children:d},c))}),m.jsx("div",{className:"header-spacer"}),m.jsx("a",{className:"feedback-link header-feedback-link",href:dh,target:"_blank",rel:"noreferrer",children:"Submit feedback"}),m.jsxs("button",{className:"search-trigger",onClick:e,children:[m.jsx(Qo,{name:"search",size:13}),m.jsx("span",{children:"Search papers, authors, domains…"}),m.jsx(OR,{})]}),m.jsx("button",{className:"icon-btn mobile-search-btn","aria-label":"Search",onClick:e,children:m.jsx(Qo,{name:"search",size:14})}),!u&&m.jsx(nr,{to:"/saved",className:"icon-btn header-bookmark-btn","aria-label":"Saved papers",title:"Saved papers",children:m.jsx(Qo,{name:"bookmark",size:13})}),u?null:o?m.jsx(ER,{user:o,onLogout:s}):m.jsx(wg,{returnTo:l}),m.jsx("button",{className:"icon-btn mobile-menu-btn","aria-label":"Open menu",onClick:()=>n(c=>!c),children:m.jsx(Qo,{name:t?"close":"menu",size:14})})]}),m.jsxs("div",{className:"site-announcement",role:"status",children:[m.jsx("span",{children:"New: Papers with Code CLI and Skill now "}),m.jsx("a",{href:AR,target:"_blank",rel:"noreferrer",children:"available"}),m.jsx("span",{children:" as well as "}),m.jsx(nr,{to:"/chat",children:"chat"})]})]}),t&&m.jsx("div",{className:"mobile-nav-drawer",onClick:r,children:m.jsxs("div",{className:"mobile-nav-panel",onClick:c=>c.stopPropagation(),children:[m.jsxs("button",{type:"button",className:"mobile-nav-link mobile-nav-search",onClick:()=>{r(),e()},children:[m.jsx(Qo,{name:"search",size:14}),m.jsx("span",{children:"Search papers, authors, domains…"})]}),fh.map(({to:c,label:d,end:h})=>m.jsx(nr,{to:c,end:h,className:"mobile-nav-link",onClick:r,children:d},c)),m.jsx("a",{className:"mobile-nav-link",href:dh,target:"_blank",rel:"noreferrer",onClick:r,children:"Submit feedback"}),!u&&m.jsx(nr,{to:"/saved",className:"mobile-nav-link",onClick:r,children:"Saved papers"}),!u&&(o==null?void 0:o.is_admin)&&m.jsx(nr,{to:"/admin-dashboard",className:"mobile-nav-link",onClick:r,children:"Admin dashboard"})]})})]})},IR=()=>{const{pathname:e}=Mt();return e==="/chat"||e.startsWith("/chat/")?null:m.jsx("footer",{className:"site-footer",children:m.jsxs("div",{className:"site-footer-inner",children:[m.jsxs("span",{children:["© ",new Date().getFullYear()," Hugging Face"]}),m.jsx(qt,{to:"/privacy",children:"Privacy"}),m.jsx("a",{href:"https://github.com/huggingface/paperswithcode-feedback/issues",target:"_blank",rel:"noreferrer",children:"Feedback"})]})})},LR=1,DR=1e6;let tu=0;function FR(){return tu=(tu+1)%Number.MAX_SAFE_INTEGER,tu.toString()}const nu=new Map,ph=e=>{if(nu.has(e))return;const t=setTimeout(()=>{nu.delete(e),us({type:"REMOVE_TOAST",toastId:e})},DR);nu.set(e,t)},$R=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,LR)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?ph(n):e.toasts.forEach(r=>{ph(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Ui=[];let Vi={toasts:[]};function us(e){Vi=$R(Vi,e),Ui.forEach(t=>{t(Vi)})}function zR({...e}){const t=FR(),n=o=>us({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>us({type:"DISMISS_TOAST",toastId:t});return us({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function UR(){const[e,t]=f.useState(Vi);return f.useEffect(()=>(Ui.push(t),()=>{const n=Ui.indexOf(t);n>-1&&Ui.splice(n,1)}),[e]),{...e,toast:zR,dismiss:n=>us({type:"DISMISS_TOAST",toastId:n})}}var VR=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),BR="VisuallyHidden",sl=f.forwardRef((e,t)=>m.jsx(ve.span,{...e,ref:t,style:{...VR,...e.style}}));sl.displayName=BR;var WR=sl,Yd="ToastProvider",[Xd,HR,KR]=Ad("Toast"),[Ow]=Tr("Toast",[KR]),[GR,il]=Ow(Yd),jw=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:s=50,children:i}=e,[a,l]=f.useState(null),[u,c]=f.useState(0),d=f.useRef(!1),h=f.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Yd}\`. Expected non-empty \`string\`.`),m.jsx(Xd.Provider,{scope:t,children:m.jsx(GR,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:s,toastCount:u,viewport:a,onViewportChange:l,onToastAdd:f.useCallback(()=>c(p=>p+1),[]),onToastRemove:f.useCallback(()=>c(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:h,children:i})})};jw.displayName=Yd;var Iw="ToastViewport",QR=["F8"],gc="toast.viewportPause",yc="toast.viewportResume",Lw=f.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=QR,label:o="Notifications ({hotkey})",...s}=e,i=il(Iw,n),a=HR(n),l=f.useRef(null),u=f.useRef(null),c=f.useRef(null),d=f.useRef(null),h=Re(t,d,i.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),E=i.toastCount>0;f.useEffect(()=>{const x=g=>{var w;r.length!==0&&r.every(S=>g[S]||g.code===S)&&((w=d.current)==null||w.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[r]),f.useEffect(()=>{const x=l.current,g=d.current;if(E&&x&&g){const v=()=>{if(!i.isClosePausedRef.current){const b=new CustomEvent(gc);g.dispatchEvent(b),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const b=new CustomEvent(yc);g.dispatchEvent(b),i.isClosePausedRef.current=!1}},S=b=>{!x.contains(b.relatedTarget)&&w()},C=()=>{x.contains(document.activeElement)||w()};return x.addEventListener("focusin",v),x.addEventListener("focusout",S),x.addEventListener("pointermove",v),x.addEventListener("pointerleave",C),window.addEventListener("blur",v),window.addEventListener("focus",w),()=>{x.removeEventListener("focusin",v),x.removeEventListener("focusout",S),x.removeEventListener("pointermove",v),x.removeEventListener("pointerleave",C),window.removeEventListener("blur",v),window.removeEventListener("focus",w)}}},[E,i.isClosePausedRef]);const y=f.useCallback(({tabbingDirection:x})=>{const v=a().map(w=>{const S=w.ref.current,C=[S,...a_(S)];return x==="forwards"?C:C.reverse()});return(x==="forwards"?v.reverse():v).flat()},[a]);return f.useEffect(()=>{const x=d.current;if(x){const g=v=>{var C,b,P;const w=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!w){const R=document.activeElement,O=v.shiftKey;if(v.target===x&&O){(C=u.current)==null||C.focus();return}const L=y({tabbingDirection:O?"backwards":"forwards"}),H=L.findIndex(I=>I===R);ru(L.slice(H+1))?v.preventDefault():O?(b=u.current)==null||b.focus():(P=c.current)==null||P.focus()}};return x.addEventListener("keydown",g),()=>x.removeEventListener("keydown",g)}},[a,y]),m.jsxs(xb,{ref:l,role:"region","aria-label":o.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:E?void 0:"none"},children:[E&&m.jsx(wc,{ref:u,onFocusFromOutsideViewport:()=>{const x=y({tabbingDirection:"forwards"});ru(x)}}),m.jsx(Xd.Slot,{scope:n,children:m.jsx(ve.ol,{tabIndex:-1,...s,ref:h})}),E&&m.jsx(wc,{ref:c,onFocusFromOutsideViewport:()=>{const x=y({tabbingDirection:"backwards"});ru(x)}})]})});Lw.displayName=Iw;var Dw="ToastFocusProxy",wc=f.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,s=il(Dw,n);return m.jsx(sl,{tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=s.viewport)!=null&&u.contains(a))&&r()}})});wc.displayName=Dw;var Ys="Toast",YR="toast.swipeStart",XR="toast.swipeMove",qR="toast.swipeCancel",ZR="toast.swipeEnd",Fw=f.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:s,...i}=e,[a,l]=_d({prop:r,defaultProp:o??!0,onChange:s,caller:Ys});return m.jsx(Rr,{present:n||a,children:m.jsx(t_,{open:a,...i,ref:t,onClose:()=>l(!1),onPause:qe(e.onPause),onResume:qe(e.onResume),onSwipeStart:V(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:V(e.onSwipeMove,u=>{const{x:c,y:d}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${d}px`)}),onSwipeCancel:V(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:V(e.onSwipeEnd,u=>{const{x:c,y:d}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${d}px`),l(!1)})})})});Fw.displayName=Ys;var[JR,e_]=Ow(Ys,{onClose(){}}),t_=f.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:s,onClose:i,onEscapeKeyDown:a,onPause:l,onResume:u,onSwipeStart:c,onSwipeMove:d,onSwipeCancel:h,onSwipeEnd:p,...E}=e,y=il(Ys,n),[x,g]=f.useState(null),v=Re(t,I=>g(I)),w=f.useRef(null),S=f.useRef(null),C=o||y.duration,b=f.useRef(0),P=f.useRef(C),R=f.useRef(0),{onToastAdd:O,onToastRemove:M}=y,$=qe(()=>{var Y;(x==null?void 0:x.contains(document.activeElement))&&((Y=y.viewport)==null||Y.focus()),i()}),L=f.useCallback(I=>{!I||I===1/0||(window.clearTimeout(R.current),b.current=new Date().getTime(),R.current=window.setTimeout($,I))},[$]);f.useEffect(()=>{const I=y.viewport;if(I){const Y=()=>{L(P.current),u==null||u()},z=()=>{const W=new Date().getTime()-b.current;P.current=P.current-W,window.clearTimeout(R.current),l==null||l()};return I.addEventListener(gc,z),I.addEventListener(yc,Y),()=>{I.removeEventListener(gc,z),I.removeEventListener(yc,Y)}}},[y.viewport,C,l,u,L]),f.useEffect(()=>{s&&!y.isClosePausedRef.current&&L(C)},[s,C,y.isClosePausedRef,L]),f.useEffect(()=>(O(),()=>M()),[O,M]);const H=f.useMemo(()=>x?Hw(x):null,[x]);return y.viewport?m.jsxs(m.Fragment,{children:[H&&m.jsx(n_,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:H}),m.jsx(JR,{scope:n,onClose:$,children:Bs.createPortal(m.jsx(Xd.ItemSlot,{scope:n,children:m.jsx(wb,{asChild:!0,onEscapeKeyDown:V(a,()=>{y.isFocusedToastEscapeKeyDownRef.current||$(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:m.jsx(ve.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":y.swipeDirection,...E,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:V(e.onKeyDown,I=>{I.key==="Escape"&&(a==null||a(I.nativeEvent),I.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:V(e.onPointerDown,I=>{I.button===0&&(w.current={x:I.clientX,y:I.clientY})}),onPointerMove:V(e.onPointerMove,I=>{if(!w.current)return;const Y=I.clientX-w.current.x,z=I.clientY-w.current.y,W=!!S.current,N=["left","right"].includes(y.swipeDirection),k=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,j=N?k(0,Y):0,U=N?0:k(0,z),F=I.pointerType==="touch"?10:2,G={x:j,y:U},X={originalEvent:I,delta:G};W?(S.current=G,bi(XR,d,X,{discrete:!1})):hh(G,y.swipeDirection,F)?(S.current=G,bi(YR,c,X,{discrete:!1}),I.target.setPointerCapture(I.pointerId)):(Math.abs(Y)>F||Math.abs(z)>F)&&(w.current=null)}),onPointerUp:V(e.onPointerUp,I=>{const Y=S.current,z=I.target;if(z.hasPointerCapture(I.pointerId)&&z.releasePointerCapture(I.pointerId),S.current=null,w.current=null,Y){const W=I.currentTarget,N={originalEvent:I,delta:Y};hh(Y,y.swipeDirection,y.swipeThreshold)?bi(ZR,p,N,{discrete:!0}):bi(qR,h,N,{discrete:!0}),W.addEventListener("click",k=>k.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),n_=e=>{const{__scopeToast:t,children:n,...r}=e,o=il(Ys,t),[s,i]=f.useState(!1),[a,l]=f.useState(!1);return s_(()=>i(!0)),f.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:m.jsx(zd,{asChild:!0,children:m.jsx(sl,{...r,children:s&&m.jsxs(m.Fragment,{children:[o.label," ",n]})})})},r_="ToastTitle",$w=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return m.jsx(ve.div,{...r,ref:t})});$w.displayName=r_;var o_="ToastDescription",zw=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return m.jsx(ve.div,{...r,ref:t})});zw.displayName=o_;var Uw="ToastAction",Vw=f.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?m.jsx(Ww,{altText:n,asChild:!0,children:m.jsx(qd,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Uw}\`. Expected non-empty \`string\`.`),null)});Vw.displayName=Uw;var Bw="ToastClose",qd=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=e_(Bw,n);return m.jsx(Ww,{asChild:!0,children:m.jsx(ve.button,{type:"button",...r,ref:t,onClick:V(e.onClick,o.onClose)})})});qd.displayName=Bw;var Ww=f.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return m.jsx(ve.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function Hw(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),i_(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!o)if(s){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...Hw(r))}}),t}function bi(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Nd(o,s):o.dispatchEvent(s)}var hh=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),s=r>o;return t==="left"||t==="right"?s&&r>n:!s&&o>n};function s_(e=()=>{}){const t=qe(e);vt(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function i_(e){return e.nodeType===e.ELEMENT_NODE}function a_(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ru(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var l_=jw,Kw=Lw,Gw=Fw,Qw=$w,Yw=zw,Xw=Vw,qw=qd;const mh=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,vh=jg,u_=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return vh(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const c=n==null?void 0:n[u],d=s==null?void 0:s[u];if(c===null)return null;const h=mh(c)||mh(d);return o[u][h]}),a=n&&Object.entries(n).reduce((u,c)=>{let[d,h]=c;return h===void 0||(u[d]=h),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:h,...p}=c;return Object.entries(p).every(E=>{let[y,x]=E;return Array.isArray(x)?x.includes({...s,...a}[y]):{...s,...a}[y]===x})?[...u,d,h]:u},[]);return vh(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)},c_=l_,Zw=f.forwardRef(({className:e,...t},n)=>m.jsx(Kw,{ref:n,className:_e("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));Zw.displayName=Kw.displayName;const d_=u_("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Jw=f.forwardRef(({className:e,variant:t,...n},r)=>m.jsx(Gw,{ref:r,className:_e(d_({variant:t}),e),...n}));Jw.displayName=Gw.displayName;const f_=f.forwardRef(({className:e,...t},n)=>m.jsx(Xw,{ref:n,className:_e("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));f_.displayName=Xw.displayName;const e0=f.forwardRef(({className:e,...t},n)=>m.jsx(qw,{ref:n,className:_e("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:m.jsx(hR,{className:"h-4 w-4"})}));e0.displayName=qw.displayName;const t0=f.forwardRef(({className:e,...t},n)=>m.jsx(Qw,{ref:n,className:_e("text-sm font-semibold",e),...t}));t0.displayName=Qw.displayName;const n0=f.forwardRef(({className:e,...t},n)=>m.jsx(Yw,{ref:n,className:_e("text-sm opacity-90",e),...t}));n0.displayName=Yw.displayName;function p_(){const{toasts:e}=UR();return m.jsxs(c_,{children:[e.map(function({id:t,title:n,description:r,action:o,...s}){return m.jsxs(Jw,{...s,children:[m.jsxs("div",{className:"grid gap-1",children:[n&&m.jsx(t0,{children:n}),r&&m.jsx(n0,{children:r})]}),o,m.jsx(e0,{})]},t)}),m.jsx(Zw,{})]})}var h_=e=>{switch(e){case"success":return g_;case"info":return w_;case"warning":return y_;case"error":return x_;default:return null}},m_=Array(12).fill(0),v_=({visible:e,className:t})=>T.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},T.createElement("div",{className:"sonner-spinner"},m_.map((n,r)=>T.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),g_=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),y_=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),w_=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),x_=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),S_=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},T.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),E_=()=>{let[e,t]=T.useState(document.hidden);return T.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},xc=1,C_=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,o=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:xc++,s=this.toasts.find(a=>a.id===o),i=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),s?this.toasts=this.toasts.map(a=>a.id===o?(this.publish({...a,...e,id:o,title:n}),{...a,...e,id:o,dismissible:i,title:n}):a):this.addToast({title:n,...r,dismissible:i,id:o}),o},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),o=n!==void 0,s,i=r.then(async l=>{if(s=["resolve",l],T.isValidElement(l))o=!1,this.create({id:n,type:"default",message:l});else if(P_(l)&&!l.ok){o=!1;let u=typeof t.error=="function"?await t.error(`HTTP error! status: ${l.status}`):t.error,c=typeof t.description=="function"?await t.description(`HTTP error! status: ${l.status}`):t.description;this.create({id:n,type:"error",message:u,description:c})}else if(t.success!==void 0){o=!1;let u=typeof t.success=="function"?await t.success(l):t.success,c=typeof t.description=="function"?await t.description(l):t.description;this.create({id:n,type:"success",message:u,description:c})}}).catch(async l=>{if(s=["reject",l],t.error!==void 0){o=!1;let u=typeof t.error=="function"?await t.error(l):t.error,c=typeof t.description=="function"?await t.description(l):t.description;this.create({id:n,type:"error",message:u,description:c})}}).finally(()=>{var l;o&&(this.dismiss(n),n=void 0),(l=t.finally)==null||l.call(t)}),a=()=>new Promise((l,u)=>i.then(()=>s[0]==="reject"?u(s[1]):l(s[1])).catch(u));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||xc++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},He=new C_,b_=(e,t)=>{let n=(t==null?void 0:t.id)||xc++;return He.addToast({title:e,...t,id:n}),n},P_=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",k_=b_,T_=()=>He.toasts,R_=()=>He.getActiveToasts();Object.assign(k_,{success:He.success,info:He.info,warning:He.warning,error:He.error,custom:He.custom,message:He.message,promise:He.promise,dismiss:He.dismiss,loading:He.loading},{getHistory:T_,getToasts:R_});function __(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}__(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} -`);function Pi(e){return e.label!==void 0}var N_=3,A_="32px",M_="16px",gh=4e3,O_=356,j_=14,I_=20,L_=200;function St(...e){return e.filter(Boolean).join(" ")}function D_(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var F_=e=>{var t,n,r,o,s,i,a,l,u,c,d;let{invert:h,toast:p,unstyled:E,interacting:y,setHeights:x,visibleToasts:g,heights:v,index:w,toasts:S,expanded:C,removeToast:b,defaultRichColors:P,closeButton:R,style:O,cancelButtonStyle:M,actionButtonStyle:$,className:L="",descriptionClassName:H="",duration:I,position:Y,gap:z,loadingIcon:W,expandByDefault:N,classNames:k,icons:j,closeButtonAriaLabel:U="Close toast",pauseWhenPageIsHidden:F}=e,[G,X]=T.useState(null),[de,ge]=T.useState(null),[q,Gt]=T.useState(!1),[be,Ot]=T.useState(!1),[hn,Ar]=T.useState(!1),[mn,Xs]=T.useState(!1),[ul,qs]=T.useState(!1),[cl,Lo]=T.useState(0),[Mr,Jd]=T.useState(0),Do=T.useRef(p.duration||I||gh),ef=T.useRef(null),Jn=T.useRef(null),p0=w===0,h0=w+1<=g,at=p.type,Or=p.dismissible!==!1,m0=p.className||"",v0=p.descriptionClassName||"",Zs=T.useMemo(()=>v.findIndex(K=>K.toastId===p.id)||0,[v,p.id]),g0=T.useMemo(()=>{var K;return(K=p.closeButton)!=null?K:R},[p.closeButton,R]),tf=T.useMemo(()=>p.duration||I||gh,[p.duration,I]),dl=T.useRef(0),jr=T.useRef(0),nf=T.useRef(0),Ir=T.useRef(null),[y0,w0]=Y.split("-"),rf=T.useMemo(()=>v.reduce((K,oe,ue)=>ue>=Zs?K:K+oe.height,0),[v,Zs]),of=E_(),x0=p.invert||h,fl=at==="loading";jr.current=T.useMemo(()=>Zs*z+rf,[Zs,rf]),T.useEffect(()=>{Do.current=tf},[tf]),T.useEffect(()=>{Gt(!0)},[]),T.useEffect(()=>{let K=Jn.current;if(K){let oe=K.getBoundingClientRect().height;return Jd(oe),x(ue=>[{toastId:p.id,height:oe,position:p.position},...ue]),()=>x(ue=>ue.filter(gt=>gt.toastId!==p.id))}},[x,p.id]),T.useLayoutEffect(()=>{if(!q)return;let K=Jn.current,oe=K.style.height;K.style.height="auto";let ue=K.getBoundingClientRect().height;K.style.height=oe,Jd(ue),x(gt=>gt.find(yt=>yt.toastId===p.id)?gt.map(yt=>yt.toastId===p.id?{...yt,height:ue}:yt):[{toastId:p.id,height:ue,position:p.position},...gt])},[q,p.title,p.description,x,p.id]);let vn=T.useCallback(()=>{Ot(!0),Lo(jr.current),x(K=>K.filter(oe=>oe.toastId!==p.id)),setTimeout(()=>{b(p)},L_)},[p,b,x,jr]);T.useEffect(()=>{if(p.promise&&at==="loading"||p.duration===1/0||p.type==="loading")return;let K;return C||y||F&&of?(()=>{if(nf.current{var oe;(oe=p.onAutoClose)==null||oe.call(p,p),vn()},Do.current)),()=>clearTimeout(K)},[C,y,p,at,F,of,vn]),T.useEffect(()=>{p.delete&&vn()},[vn,p.delete]);function S0(){var K,oe,ue;return j!=null&&j.loading?T.createElement("div",{className:St(k==null?void 0:k.loader,(K=p==null?void 0:p.classNames)==null?void 0:K.loader,"sonner-loader"),"data-visible":at==="loading"},j.loading):W?T.createElement("div",{className:St(k==null?void 0:k.loader,(oe=p==null?void 0:p.classNames)==null?void 0:oe.loader,"sonner-loader"),"data-visible":at==="loading"},W):T.createElement(v_,{className:St(k==null?void 0:k.loader,(ue=p==null?void 0:p.classNames)==null?void 0:ue.loader),visible:at==="loading"})}return T.createElement("li",{tabIndex:0,ref:Jn,className:St(L,m0,k==null?void 0:k.toast,(t=p==null?void 0:p.classNames)==null?void 0:t.toast,k==null?void 0:k.default,k==null?void 0:k[at],(n=p==null?void 0:p.classNames)==null?void 0:n[at]),"data-sonner-toast":"","data-rich-colors":(r=p.richColors)!=null?r:P,"data-styled":!(p.jsx||p.unstyled||E),"data-mounted":q,"data-promise":!!p.promise,"data-swiped":ul,"data-removed":be,"data-visible":h0,"data-y-position":y0,"data-x-position":w0,"data-index":w,"data-front":p0,"data-swiping":hn,"data-dismissible":Or,"data-type":at,"data-invert":x0,"data-swipe-out":mn,"data-swipe-direction":de,"data-expanded":!!(C||N&&q),style:{"--index":w,"--toasts-before":w,"--z-index":S.length-w,"--offset":`${be?cl:jr.current}px`,"--initial-height":N?"auto":`${Mr}px`,...O,...p.style},onDragEnd:()=>{Ar(!1),X(null),Ir.current=null},onPointerDown:K=>{fl||!Or||(ef.current=new Date,Lo(jr.current),K.target.setPointerCapture(K.pointerId),K.target.tagName!=="BUTTON"&&(Ar(!0),Ir.current={x:K.clientX,y:K.clientY}))},onPointerUp:()=>{var K,oe,ue,gt;if(mn||!Or)return;Ir.current=null;let yt=Number(((K=Jn.current)==null?void 0:K.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),gn=Number(((oe=Jn.current)==null?void 0:oe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),er=new Date().getTime()-((ue=ef.current)==null?void 0:ue.getTime()),wt=G==="x"?yt:gn,yn=Math.abs(wt)/er;if(Math.abs(wt)>=I_||yn>.11){Lo(jr.current),(gt=p.onDismiss)==null||gt.call(p,p),ge(G==="x"?yt>0?"right":"left":gn>0?"down":"up"),vn(),Xs(!0),qs(!1);return}Ar(!1),X(null)},onPointerMove:K=>{var oe,ue,gt,yt;if(!Ir.current||!Or||((oe=window.getSelection())==null?void 0:oe.toString().length)>0)return;let gn=K.clientY-Ir.current.y,er=K.clientX-Ir.current.x,wt=(ue=e.swipeDirections)!=null?ue:D_(Y);!G&&(Math.abs(er)>1||Math.abs(gn)>1)&&X(Math.abs(er)>Math.abs(gn)?"x":"y");let yn={x:0,y:0};G==="y"?(wt.includes("top")||wt.includes("bottom"))&&(wt.includes("top")&&gn<0||wt.includes("bottom")&&gn>0)&&(yn.y=gn):G==="x"&&(wt.includes("left")||wt.includes("right"))&&(wt.includes("left")&&er<0||wt.includes("right")&&er>0)&&(yn.x=er),(Math.abs(yn.x)>0||Math.abs(yn.y)>0)&&qs(!0),(gt=Jn.current)==null||gt.style.setProperty("--swipe-amount-x",`${yn.x}px`),(yt=Jn.current)==null||yt.style.setProperty("--swipe-amount-y",`${yn.y}px`)}},g0&&!p.jsx?T.createElement("button",{"aria-label":U,"data-disabled":fl,"data-close-button":!0,onClick:fl||!Or?()=>{}:()=>{var K;vn(),(K=p.onDismiss)==null||K.call(p,p)},className:St(k==null?void 0:k.closeButton,(o=p==null?void 0:p.classNames)==null?void 0:o.closeButton)},(s=j==null?void 0:j.close)!=null?s:S_):null,p.jsx||f.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:T.createElement(T.Fragment,null,at||p.icon||p.promise?T.createElement("div",{"data-icon":"",className:St(k==null?void 0:k.icon,(i=p==null?void 0:p.classNames)==null?void 0:i.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||S0():null,p.type!=="loading"?p.icon||(j==null?void 0:j[at])||h_(at):null):null,T.createElement("div",{"data-content":"",className:St(k==null?void 0:k.content,(a=p==null?void 0:p.classNames)==null?void 0:a.content)},T.createElement("div",{"data-title":"",className:St(k==null?void 0:k.title,(l=p==null?void 0:p.classNames)==null?void 0:l.title)},typeof p.title=="function"?p.title():p.title),p.description?T.createElement("div",{"data-description":"",className:St(H,v0,k==null?void 0:k.description,(u=p==null?void 0:p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),f.isValidElement(p.cancel)?p.cancel:p.cancel&&Pi(p.cancel)?T.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||M,onClick:K=>{var oe,ue;Pi(p.cancel)&&Or&&((ue=(oe=p.cancel).onClick)==null||ue.call(oe,K),vn())},className:St(k==null?void 0:k.cancelButton,(c=p==null?void 0:p.classNames)==null?void 0:c.cancelButton)},p.cancel.label):null,f.isValidElement(p.action)?p.action:p.action&&Pi(p.action)?T.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||$,onClick:K=>{var oe,ue;Pi(p.action)&&((ue=(oe=p.action).onClick)==null||ue.call(oe,K),!K.defaultPrevented&&vn())},className:St(k==null?void 0:k.actionButton,(d=p==null?void 0:p.classNames)==null?void 0:d.actionButton)},p.action.label):null))};function yh(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function $_(e,t){let n={};return[e,t].forEach((r,o)=>{let s=o===1,i=s?"--mobile-offset":"--offset",a=s?M_:A_;function l(u){["top","right","bottom","left"].forEach(c=>{n[`${i}-${c}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${i}-${u}`]=a:n[`${i}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):l(a)}),n}var z_=f.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:o=["altKey","KeyT"],expand:s,closeButton:i,className:a,offset:l,mobileOffset:u,theme:c="light",richColors:d,duration:h,style:p,visibleToasts:E=N_,toastOptions:y,dir:x=yh(),gap:g=j_,loadingIcon:v,icons:w,containerAriaLabel:S="Notifications",pauseWhenPageIsHidden:C}=e,[b,P]=T.useState([]),R=T.useMemo(()=>Array.from(new Set([r].concat(b.filter(F=>F.position).map(F=>F.position)))),[b,r]),[O,M]=T.useState([]),[$,L]=T.useState(!1),[H,I]=T.useState(!1),[Y,z]=T.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=T.useRef(null),N=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),k=T.useRef(null),j=T.useRef(!1),U=T.useCallback(F=>{P(G=>{var X;return(X=G.find(de=>de.id===F.id))!=null&&X.delete||He.dismiss(F.id),G.filter(({id:de})=>de!==F.id)})},[]);return T.useEffect(()=>He.subscribe(F=>{if(F.dismiss){P(G=>G.map(X=>X.id===F.id?{...X,delete:!0}:X));return}setTimeout(()=>{Kv.flushSync(()=>{P(G=>{let X=G.findIndex(de=>de.id===F.id);return X!==-1?[...G.slice(0,X),{...G[X],...F},...G.slice(X+1)]:[F,...G]})})})}),[]),T.useEffect(()=>{if(c!=="system"){z(c);return}if(c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window>"u")return;let F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:G})=>{z(G?"dark":"light")})}catch{F.addListener(({matches:X})=>{try{z(X?"dark":"light")}catch(de){console.error(de)}})}},[c]),T.useEffect(()=>{b.length<=1&&L(!1)},[b]),T.useEffect(()=>{let F=G=>{var X,de;o.every(ge=>G[ge]||G.code===ge)&&(L(!0),(X=W.current)==null||X.focus()),G.code==="Escape"&&(document.activeElement===W.current||(de=W.current)!=null&&de.contains(document.activeElement))&&L(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[o]),T.useEffect(()=>{if(W.current)return()=>{k.current&&(k.current.focus({preventScroll:!0}),k.current=null,j.current=!1)}},[W.current]),T.createElement("section",{ref:t,"aria-label":`${S} ${N}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},R.map((F,G)=>{var X;let[de,ge]=F.split("-");return b.length?T.createElement("ol",{key:F,dir:x==="auto"?yh():x,tabIndex:-1,ref:W,className:a,"data-sonner-toaster":!0,"data-theme":Y,"data-y-position":de,"data-lifted":$&&b.length>1&&!s,"data-x-position":ge,style:{"--front-toast-height":`${((X=O[0])==null?void 0:X.height)||0}px`,"--width":`${O_}px`,"--gap":`${g}px`,...p,...$_(l,u)},onBlur:q=>{j.current&&!q.currentTarget.contains(q.relatedTarget)&&(j.current=!1,k.current&&(k.current.focus({preventScroll:!0}),k.current=null))},onFocus:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||j.current||(j.current=!0,k.current=q.relatedTarget)},onMouseEnter:()=>L(!0),onMouseMove:()=>L(!0),onMouseLeave:()=>{H||L(!1)},onDragEnd:()=>L(!1),onPointerDown:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||I(!0)},onPointerUp:()=>I(!1)},b.filter(q=>!q.position&&G===0||q.position===F).map((q,Gt)=>{var be,Ot;return T.createElement(F_,{key:q.id,icons:w,index:Gt,toast:q,defaultRichColors:d,duration:(be=y==null?void 0:y.duration)!=null?be:h,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:n,visibleToasts:E,closeButton:(Ot=y==null?void 0:y.closeButton)!=null?Ot:i,interacting:H,position:F,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,removeToast:U,toasts:b.filter(hn=>hn.position==q.position),heights:O.filter(hn=>hn.position==q.position),setHeights:M,expandByDefault:s,gap:g,loadingIcon:v,expanded:$,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections})})):null}))});const U_=({...e})=>{const{theme:t="system"}=Z1();return m.jsx(z_,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};var V_=Symbol("radix.slottable");function B_(e){const t=({children:n})=>m.jsx(m.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=V_,t}var[al]=Tr("Tooltip",[Ja]),Zd=Ja(),r0="TooltipProvider",W_=700,wh="tooltip.open",[H_,o0]=al(r0),s0=e=>{const{__scopeTooltip:t,delayDuration:n=W_,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=f.useRef(!0),a=f.useRef(!1),l=f.useRef(0);return f.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),m.jsx(H_,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:f.useCallback(()=>{window.clearTimeout(l.current),i.current=!1},[]),onClose:f.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:f.useCallback(u=>{a.current=u},[]),disableHoverableContent:o,children:s})};s0.displayName=r0;var i0="Tooltip",[pA,ll]=al(i0),Sc="TooltipTrigger",K_=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=ll(Sc,n),s=o0(Sc,n),i=Zd(n),a=f.useRef(null),l=Re(t,a,o.onTriggerChange),u=f.useRef(!1),c=f.useRef(!1),d=f.useCallback(()=>u.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),m.jsx(vy,{asChild:!0,...i,children:m.jsx(ve.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:V(e.onPointerMove,h=>{h.pointerType!=="touch"&&!c.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:V(e.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:V(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:V(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:V(e.onBlur,o.onClose),onClick:V(e.onClick,o.onClose)})})});K_.displayName=Sc;var G_="TooltipPortal",[hA,Q_]=al(G_,{forceMount:void 0}),Ro="TooltipContent",a0=f.forwardRef((e,t)=>{const n=Q_(Ro,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=ll(Ro,e.__scopeTooltip);return m.jsx(Rr,{present:r||i.open,children:i.disableHoverableContent?m.jsx(l0,{side:o,...s,ref:t}):m.jsx(Y_,{side:o,...s,ref:t})})}),Y_=f.forwardRef((e,t)=>{const n=ll(Ro,e.__scopeTooltip),r=o0(Ro,e.__scopeTooltip),o=f.useRef(null),s=Re(t,o),[i,a]=f.useState(null),{trigger:l,onClose:u}=n,c=o.current,{onPointerInTransitChange:d}=r,h=f.useCallback(()=>{a(null),d(!1)},[d]),p=f.useCallback((E,y)=>{const x=E.currentTarget,g={x:E.clientX,y:E.clientY},v=eN(g,x.getBoundingClientRect()),w=tN(g,v),S=nN(y.getBoundingClientRect()),C=oN([...w,...S]);a(C),d(!0)},[d]);return f.useEffect(()=>()=>h(),[h]),f.useEffect(()=>{if(l&&c){const E=x=>p(x,c),y=x=>p(x,l);return l.addEventListener("pointerleave",E),c.addEventListener("pointerleave",y),()=>{l.removeEventListener("pointerleave",E),c.removeEventListener("pointerleave",y)}}},[l,c,p,h]),f.useEffect(()=>{if(i){const E=y=>{const x=y.target,g={x:y.clientX,y:y.clientY},v=(l==null?void 0:l.contains(x))||(c==null?void 0:c.contains(x)),w=!rN(g,i);v?h():w&&(h(),u())};return document.addEventListener("pointermove",E),()=>document.removeEventListener("pointermove",E)}},[l,c,i,u,h]),m.jsx(l0,{...e,ref:s})}),[X_,q_]=al(i0,{isInside:!1}),Z_=B_("TooltipContent"),l0=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,l=ll(Ro,n),u=Zd(n),{onClose:c}=l;return f.useEffect(()=>(document.addEventListener(wh,c),()=>document.removeEventListener(wh,c)),[c]),f.useEffect(()=>{if(l.trigger){const d=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&c()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,c]),m.jsx(Qa,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:m.jsxs(gy,{"data-state":l.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[m.jsx(Z_,{children:r}),m.jsx(X_,{scope:n,isInside:!0,children:m.jsx(WR,{id:l.contentId,role:"tooltip",children:o||r})})]})})});a0.displayName=Ro;var u0="TooltipArrow",J_=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Zd(n);return q_(u0,n).isInside?null:m.jsx(yy,{...o,...r,ref:t})});J_.displayName=u0;function eN(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function tN(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function nN(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function rN(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;sr!=h>r&&n<(d-u)*(r-c)/(h-c)+u&&(o=!o)}return o}function oN(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),sN(t)}function sN(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var iN=s0,c0=a0;const aN=iN,lN=f.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(c0,{ref:r,sideOffset:t,className:_e("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...n}));lN.displayName=c0.displayName;function uN(){const{pathname:e,hash:t}=Mt();f.useEffect(()=>{t||window.scrollTo(0,0)},[e,t])}class cN{constructor(t){this.request=t}getPreferences(){return this.request("/me/preferences")}updatePreferences(t){return this.request("/me/preferences",{method:"PUT",body:JSON.stringify(t)})}getRateLimitPolicy(){return this.request("/rate-limits",{credentials:"omit"})}getBookmarkIds(){return this.request("/me/bookmarks/ids")}getBookmarks(){return this.request("/me/bookmarks")}addBookmark(t){return this.request(`/me/bookmarks/${t}`,{method:"POST"})}removeBookmark(t){return this.request(`/me/bookmarks/${t}`,{method:"DELETE"})}}const xh=new cN(vc),ou={hide_closed_source_evals:!1},d0=T.createContext(null),dN=({children:e})=>{const{user:t}=Qd(),[n,r]=T.useState(ou),[o,s]=T.useState(!1);T.useEffect(()=>{let l=!1;if(!t){r(ou);return}return s(!0),xh.getPreferences().then(u=>{l||r(u)}).catch(()=>{l||r(ou)}).finally(()=>{l||s(!1)}),()=>{l=!0}},[t]);const i=T.useCallback(async l=>{const u={...n,hide_closed_source_evals:l};if(r(u),!!t)try{const c=await xh.updatePreferences(u);r(c)}catch{r(n)}},[n,t]),a=T.useMemo(()=>({preferences:n,canPersist:!!t,isLoading:o,setHideClosedSourceEvals:i}),[n,t,o,i]);return m.jsx(d0.Provider,{value:a,children:e})};function mA(){const e=T.useContext(d0);if(!e)throw new Error("usePreferences must be used inside a ");return e}const f0=BE(),fN=f0?iE:sE;if(!f0&&typeof window<"u"){const e=window.location.hash;e.startsWith("#/")&&!e.startsWith("#//")&&window.history.replaceState(null,"",e.slice(1))}const pN=T.lazy(()=>ne(()=>import("./FeedView-L4wL0Zxa.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))),hN=T.lazy(()=>ne(()=>import("./ChatView-CdOXetxL.js"),__vite__mapDeps([20,11,21,9,10,12,6,3,4,22,23,24,25,26,27,28,14]))),mN=T.lazy(()=>ne(()=>import("./SharedChatView-CZGxCKbv.js"),__vite__mapDeps([29,11,21,9,10,12,6,3,4,22,23,24,25,26,27]))),vN=T.lazy(()=>ne(()=>import("./PapersListView-BYepbpX4.js"),__vite__mapDeps([30,1,2,3,4,5,6,7,13,15,11,16,31,17,8,18,19]))),gN=T.lazy(()=>ne(()=>import("./PaperDetailView-DQZWeXKk.js"),__vite__mapDeps([32,1,2,3,4,5,6,7,33,22,34,11,15,16,35,18,19,36,37,38,39,40,41,13,42,43,44,45,23,24,26,46,47]))),yN=T.lazy(()=>ne(()=>import("./TagsIndexView-DZXTETvq.js"),__vite__mapDeps([48,11,13,5,49,18,19,50,43,36,37,38,41,42,40]))),wN=T.lazy(()=>ne(()=>import("./TagBrowseView-B6A9Mvnz.js"),__vite__mapDeps([51,11,1,2,3,4,5,6,7,52,8,53,25,26,22,13,49,15,16,18,19,10,24]))),xN=T.lazy(()=>ne(()=>import("./MethodsIndexView-ooJqtLOL.js"),__vite__mapDeps([54,11,13,49,18,19,50,43,36,37,38,41,42,40]))),SN=T.lazy(()=>ne(()=>import("./FrameworksIndexView-I7yKuqQY.js"),__vite__mapDeps([55,11,1,2,3,4,5,6,7,13]))),EN=T.lazy(()=>ne(()=>import("./TrendsView-BvtNL0dp.js"),__vite__mapDeps([56,11,19,18]))),CN=T.lazy(()=>ne(()=>import("./ConferencesIndexView-BYCd9xd-.js"),__vite__mapDeps([57,11,13,18,19,50,43,36,37,38,41,42,40]))),bN=T.lazy(()=>ne(()=>import("./AiDeadlinesView-BROI0ZmS.js"),__vite__mapDeps([58,11,13,59,45,18,19,7,38]))),PN=T.lazy(()=>ne(()=>import("./ConferenceDetailView-BF2p7fm_.js"),__vite__mapDeps([60,11,53,3,4,25,26,22,6,13,5,18,19,7]))),kN=T.lazy(()=>ne(()=>import("./ConferenceTaskView-ny-_UWtG.js"),__vite__mapDeps([61,11,1,2,3,4,5,6,7,8,53,25,26,22,13,15,16,18,19]))),TN=T.lazy(()=>ne(()=>import("./OrganizationsIndexView-CIxnPMcd.js"),__vite__mapDeps([62,11,19,18,13,63]))),RN=T.lazy(()=>ne(()=>import("./OrganizationDetailView-7XdyiyeW.js"),__vite__mapDeps([64,65,11,1,2,3,4,5,6,7,53,25,26,22,66,18,13,8,19,39,36,38,40,15,16,67]))),_N=T.lazy(()=>ne(()=>import("./OrganizationTaskView-LqFkQbPW.js"),__vite__mapDeps([68,65,11,1,2,3,4,5,6,7,53,25,26,22,66,18,13,8,19,39,36,38,40,15,16,67]))),NN=T.lazy(()=>ne(()=>import("./AuthorDetailView-BqQhih_3.js"),__vite__mapDeps([69,11,6,18,67]))),AN=T.lazy(()=>ne(()=>import("./MethodDetailView-kXZaPUhq.js"),__vite__mapDeps([70,11,16,1,2,3,4,5,6,7,8,53,25,26,22,13,49,18,19]))),MN=T.lazy(()=>ne(()=>import("./BenchmarkDetailView-Cg86MceH.js"),__vite__mapDeps([71,11,13,33,6,22,7,34,18,59,45,19,2,3,4,52,1,5,49,72]))),ON=T.lazy(()=>ne(()=>import("./SavedPapersView-DhFWb_wi.js"),__vite__mapDeps([73,11,1,2,3,4,5,6,7,18,19,46]))),jN=T.lazy(()=>ne(()=>import("./SettingsView-BGS_66Ni.js"),__vite__mapDeps([74,41,59,45,12,35,28,11,75]))),IN=T.lazy(()=>ne(()=>import("./PrivacyView-CcXQdpRo.js"),__vite__mapDeps([76,35]))),LN=T.lazy(()=>ne(()=>import("./SubmitView-Bq6nl10o.js"),__vite__mapDeps([77,41,19,36,37,6]))),DN=T.lazy(()=>ne(()=>import("./CronDashboard-B0A5D1GB.js"),__vite__mapDeps([78,11,44,36,10,27,79,40,80,75,41,16,13,12,81]))),FN=T.lazy(()=>ne(()=>import("./SubmissionsDashboard-Fm_NO7Rs.js"),__vite__mapDeps([82,11,41,13,7,6,42,79,40,80,83]))),$N=T.lazy(()=>ne(()=>import("./UserProfileView-CRGhrhTR.js"),__vite__mapDeps([84,11,66,18,13]))),zN=T.lazy(()=>ne(()=>import("./RateLimitsView-BcVoE98a.js"),__vite__mapDeps([85,11]))),Sh=T.lazy(()=>ne(()=>import("./NotFound-CksCbtS8.js"),[])),UN=T.lazy(()=>ne(()=>import("./SearchOverlay-BRKHPZ6C.js"),__vite__mapDeps([86,11,2,3,4,13,6,31,5]))),VN=T.lazy(()=>ne(()=>import("./StagingAccessRequestView-CAvxF8g0.js"),__vite__mapDeps([87,80]))),Eh=()=>m.jsxs("div",{className:"page","aria-busy":"true","aria-live":"polite",children:[m.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:24,width:"30%",marginBottom:24}}),m.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:64,width:"60%",marginBottom:32}}),m.jsxs("div",{className:"paper-list",style:{display:"grid",gap:16},children:[m.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:96}}),m.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:96}}),m.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:96}})]})]}),BN=new $E({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}}),WN=()=>{const{arxivId:e}=ng();return m.jsx(Po,{to:e?`/paper/${e}`:"/papers",replace:!0})},HN=()=>{const{taskSlug:e}=ng();return m.jsx(Po,{to:e?`/tasks/${e}`:"/tasks",replace:!0})},Ch=({element:e})=>Ws()?m.jsx(Po,{to:"/",replace:!0}):m.jsx(m.Fragment,{children:e}),KN=({element:e})=>{const{user:t,isLoading:n}=Qd();return Ws()?m.jsx(Po,{to:"/",replace:!0}):n?m.jsx("div",{className:"page",children:m.jsx("div",{className:"submission-loading",children:m.jsx("span",{children:"Checking admin session..."})})}):t?t.is_admin?m.jsx(m.Fragment,{children:e}):m.jsx("div",{className:"page",children:m.jsxs("div",{className:"submission-empty submission-empty-warn",children:[m.jsx("h1",{children:"Admin access required"}),m.jsxs("p",{children:["Signed in as @",t.username,". This dashboard is limited to allowlisted admin accounts."]})]})}):m.jsx("div",{className:"page",children:m.jsxs("div",{className:"submission-empty submission-empty-warn",children:[m.jsx("h1",{children:"Sign in required"}),m.jsx("p",{children:"Sign in with an allowlisted Hugging Face admin account to view admin operations."}),m.jsx(wg,{returnTo:"/admin-dashboard"})]})})},GN=()=>{const e=VE(),t=typeof window<"u"&&new URL(e,window.location.origin).origin!==window.location.origin;return T.useEffect(()=>{t&&window.location.replace(e)},[e,t]),t?m.jsx("div",{className:"page",children:m.jsxs("div",{className:"submission-loading",children:[m.jsx("span",{children:"Opening the production admin dashboard..."}),m.jsx("a",{href:e,children:"Continue"})]})}):m.jsx(KN,{element:m.jsx(DN,{})})},QN=()=>{const[e,t]=T.useState(!1),n=Mt();return uN(),T.useLayoutEffect(()=>{var r;(r=document.getElementById("initial-discovery-footer"))==null||r.remove()},[]),T.useEffect(()=>{const r=o=>{(o.metaKey||o.ctrlKey)&&o.key==="k"&&(o.preventDefault(),t(!0))};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[]),n.pathname==="/request-access"?m.jsx(T.Suspense,{fallback:m.jsx(Eh,{}),children:m.jsx(VN,{})}):m.jsxs(m.Fragment,{children:[m.jsx(jR,{onOpenSearch:()=>t(!0)}),m.jsx("main",{children:m.jsx(T.Suspense,{fallback:m.jsx(Eh,{}),children:m.jsxs(XS,{children:[m.jsx(ee,{path:"/",element:m.jsx(pN,{})}),m.jsx(ee,{path:"/chat/:sessionId?",element:ya()?m.jsx(hN,{}):m.jsx(Po,{to:"/",replace:!0})}),m.jsx(ee,{path:"/share/:shareId",element:ya()?m.jsx(mN,{}):m.jsx(Sh,{})}),m.jsx(ee,{path:"/papers",element:m.jsx(vN,{})}),m.jsx(ee,{path:"/papers/:arxivId",element:m.jsx(WN,{})}),m.jsx(ee,{path:"/paper/:arxivId",element:m.jsx(gN,{})}),m.jsx(ee,{path:"/tasks",element:m.jsx(yN,{})}),m.jsx(ee,{path:"/tasks/:taskSlug",element:m.jsx(wN,{})}),m.jsx(ee,{path:"/task/:taskSlug",element:m.jsx(HN,{})}),m.jsx(ee,{path:"/methods",element:m.jsx(xN,{})}),m.jsx(ee,{path:"/methods/:methodSlug",element:m.jsx(AN,{})}),m.jsx(ee,{path:"/frameworks",element:m.jsx(SN,{})}),m.jsx(ee,{path:"/trends",element:m.jsx(EN,{})}),m.jsx(ee,{path:"/conferences",element:m.jsx(CN,{})}),m.jsx(ee,{path:"/ai-deadlines",element:m.jsx(bN,{})}),m.jsx(ee,{path:"/conferences/:confSlug",element:m.jsx(PN,{})}),m.jsx(ee,{path:"/conferences/:confSlug/:taskSlug",element:m.jsx(kN,{})}),m.jsx(ee,{path:"/organizations",element:m.jsx(TN,{})}),m.jsx(ee,{path:"/orgs/:orgSlug",element:m.jsx(RN,{})}),m.jsx(ee,{path:"/orgs/:orgSlug/:taskSlug",element:m.jsx(_N,{})}),m.jsx(ee,{path:"/authors/:authorId",element:m.jsx(NN,{})}),m.jsx(ee,{path:"/benchmark/:datasetSlug",element:m.jsx(MN,{})}),m.jsx(ee,{path:"/submit",element:m.jsx(LN,{})}),m.jsx(ee,{path:"/saved",element:m.jsx(Ch,{element:m.jsx(ON,{})})}),m.jsx(ee,{path:"/settings",element:m.jsx(jN,{})}),m.jsx(ee,{path:"/privacy",element:m.jsx(IN,{})}),m.jsx(ee,{path:"/admin-dashboard",element:m.jsx(GN,{})}),m.jsx(ee,{path:"/cron-dashboard",element:m.jsx(Po,{to:"/admin-dashboard",replace:!0})}),m.jsx(ee,{path:"/submissions",element:m.jsx(Ch,{element:m.jsx(FN,{})})}),m.jsx(ee,{path:"/rate-limits",element:m.jsx(zN,{})}),m.jsx(ee,{path:"/:username",element:m.jsx($N,{})}),m.jsx(ee,{path:"*",element:m.jsx(Sh,{})})]})})}),m.jsx(IR,{}),e&&m.jsx(T.Suspense,{fallback:null,children:m.jsx(UN,{open:e,onClose:()=>t(!1)})})]})},YN=()=>m.jsx(zE,{client:BN,children:m.jsx(NR,{children:m.jsx(dN,{children:m.jsxs(aN,{children:[m.jsx(fN,{children:m.jsx(QN,{})}),m.jsx(p_,{}),m.jsx(U_,{}),!1]})})})});iS();const XN=Gv(document.getElementById("root"));XN.render(m.jsx(T.StrictMode,{children:m.jsx(J1,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,storageKey:"pwc-theme",children:m.jsx(oS,{children:m.jsx(YN,{})})})}));export{vy as $,Nw as A,pR as B,dR as C,Pd as D,xh as E,Ws as F,UE as G,mR as H,ik as I,vR as J,Rw as K,qt as L,It as M,iA as N,lc as O,Rr as P,vt as Q,T as R,Ad as S,f_ as T,vc as U,Sg as V,u_ as W,hR as X,wg as Y,kr as Z,WP as _,JN as a,Ja as a0,zd as a1,vk as a2,Oy as a3,Sb as a4,Gg as a5,Qa as a6,gy as a7,yy as a8,dA as a9,wE as aA,tc as aB,ug as aC,jE as aD,CE as aE,uh as aF,tA as aa,ZN as ab,Oh as ac,Z1 as ad,oA as ae,rA as af,_R as ag,lA as ah,Ga as ai,ze as aj,eA as ak,cg as al,Ct as am,zg as an,Ug as ao,Vg as ap,Ns as aq,LE as ar,nA as as,Po as at,Mt as au,TE as av,xE as aw,nc as ax,fg as ay,yE as az,aA as b,ol as c,UR as d,ng as e,Qd as f,sA as g,HE as h,ya as i,m as j,uA as k,mA as l,ve as m,TR as n,_d as o,Re as p,V as q,f as r,DP as s,Tr as t,Sd as u,_e as v,cA as w,Bg as x,sk as y,xy as z}; + */const vR=ol("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),gR=aR,yR=lR,wR=f.forwardRef(({className:e,inset:t,children:n,...r},o)=>h.jsxs(Tw,{ref:o,className:_e("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...r,children:[n,h.jsx(hR,{className:"ml-auto h-4 w-4"})]}));wR.displayName=Tw.displayName;const xR=f.forwardRef(({className:e,...t},n)=>h.jsx(Rw,{ref:n,className:_e("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",e),...t}));xR.displayName=Rw.displayName;const Nw=f.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(uR,{children:h.jsx(xw,{ref:r,sideOffset:t,className:_e("z-50 min-w-[8rem] overflow-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",e),...n})}));Nw.displayName=xw.displayName;const It=f.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(Ew,{ref:r,className:_e("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...n}));It.displayName=Ew.displayName;const SR=f.forwardRef(({className:e,children:t,checked:n,...r},o)=>h.jsxs(Cw,{ref:o,className:_e("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:n,...r,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(Pw,{children:h.jsx(pR,{className:"h-4 w-4"})})}),t]}));SR.displayName=Cw.displayName;const ER=f.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(bw,{ref:r,className:_e("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(Pw,{children:h.jsx(mR,{className:"h-2 w-2 fill-current"})})}),t]}));ER.displayName=bw.displayName;const Aw=f.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(Sw,{ref:r,className:_e("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Aw.displayName=Sw.displayName;const gc=f.forwardRef(({className:e,...t},n)=>h.jsx(kw,{ref:n,className:_e("-mx-1 my-1 h-px bg-muted",e),...t}));gc.displayName=kw.displayName;function CR(e){const n=(e.name||e.username||"?").trim().split(/\s+/).filter(Boolean);return n.length===0?"?":n.length===1?n[0][0].toUpperCase():(n[0][0]+n[n.length-1][0]).toUpperCase()}const bR=({user:e,onLogout:t})=>h.jsxs(gR,{children:[h.jsx(yR,{asChild:!0,children:h.jsx("button",{type:"button",className:"user-avatar-btn","aria-label":`Account menu for ${e.username}`,children:h.jsxs(Vg,{className:"h-8 w-8",children:[e.avatar_url&&h.jsx(Bg,{src:e.avatar_url,alt:e.username}),h.jsx(Wg,{className:"text-xs",children:CR(e)})]})})}),h.jsxs(Nw,{align:"end",className:"w-56",children:[h.jsxs(Aw,{className:"flex flex-col gap-0.5 py-2",children:[h.jsx("span",{className:"text-sm font-medium leading-tight",children:e.name||e.username}),h.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["@",e.username]}),e.is_admin&&h.jsx("span",{className:"mt-1 inline-flex w-fit items-center rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-amber-900",children:"Admin"}),e.role==="contributor"&&h.jsx("span",{className:"mt-1 inline-flex w-fit items-center rounded-full bg-blue-100 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-blue-900",children:"Contributor"})]}),h.jsx(gc,{}),h.jsx(It,{asChild:!0,children:h.jsx("a",{href:`https://huggingface.co/${encodeURIComponent(e.username)}`,target:"_blank",rel:"noopener noreferrer",children:"Hugging Face profile"})}),Ms()&&h.jsx(It,{asChild:!0,children:h.jsx(qt,{to:"/chat",children:"Chat"})}),h.jsx(It,{asChild:!0,children:h.jsx(qt,{to:"/frameworks",children:"Frameworks"})}),h.jsx(It,{asChild:!0,children:h.jsx(qt,{to:"/trends",children:"Trends"})}),e.is_admin&&h.jsxs(h.Fragment,{children:[h.jsx(It,{asChild:!0,children:h.jsx(qt,{to:"/admin-dashboard",children:"Admin dashboard"})}),h.jsx(It,{asChild:!0,children:h.jsx(qt,{to:"/submissions",children:"Review submissions"})})]}),h.jsx(It,{asChild:!0,children:h.jsx(qt,{to:`/${encodeURIComponent(e.username)}`,children:"My contributions"})}),h.jsx(It,{asChild:!0,children:h.jsx(qt,{to:"/settings",children:"Settings"})}),h.jsx(gc,{}),h.jsx(It,{onSelect:n=>{n.preventDefault(),t()},children:"Log out"})]})]}),PR="cronAdminToken";function kR(){var e;return typeof window>"u"?"":((e=window.localStorage.getItem(PR))==null?void 0:e.trim())??""}const TR=!1;class Mw extends Error{constructor(n,r){var o;super(`API request failed: ${n.status} ${n.statusText}`);tr(this,"status");tr(this,"statusText");tr(this,"response");tr(this,"detail");tr(this,"code");this.name="ApiError",this.status=n.status,this.statusText=n.statusText,this.response=r;try{if(this.detail=(o=JSON.parse(r))==null?void 0:o.detail,typeof this.detail=="string"&&(this.message=this.detail),typeof this.detail=="object"&&this.detail!==null&&"code"in this.detail&&typeof this.detail.code=="string"&&(this.code=this.detail.code),typeof this.detail=="object"&&this.detail!==null&&"message"in this.detail&&typeof this.detail.message=="string"){const s="help"in this.detail&&typeof this.detail.help=="string"?` See ${this.detail.help} for help.`:"";this.message=`${this.detail.message}${s}`}}catch{this.detail=void 0}}}class RR{constructor(t){this.baseUrl=t}async fetch(t,n){const r=`${this.baseUrl}${t}`;try{const{headers:o,...s}=n??{},a=(s.method??"GET").toUpperCase()==="GET"?"default":"no-store",l=kR(),u=new Headers(o);return u.has("Content-Type")||u.set("Content-Type","application/json"),l&&!u.has("X-Admin-Token")&&u.set("X-Admin-Token",l),await fetch(r,{...s,cache:s.cache??a,credentials:s.credentials??"include",headers:u})}catch(o){throw console.error(`[API] Request to ${r} failed:`,o),o}}async request(t,n){const r=await this.fetch(t,n);if(!r.ok){const s=new Mw(r,await r.text());throw console.error("[API] Error response:",s.response),s}return r.status===204?void 0:await r.json()}}function _R(e){e instanceof Mw&&e.status===401&&e.code!=="fresh_auth_required"&&e.code!=="saved_papers_bucket_authorization_required"&&typeof window<"u"&&window.dispatchEvent(new CustomEvent("pwc:auth-stale"))}async function NR(e){try{return await e()}catch(t){throw _R(t),t}}const Ow=new RR(`${kd()}/api/v1`),AR=(e,t)=>Ow.fetch(e,t),yc=(e,t)=>NR(()=>Ow.request(e,t)),fh={async getCurrentUser(){if(Hs())return null;const e=await AR("/auth/me",{cache:"no-store"});return e.status===401||!e.ok?null:e.json()},async logout(){await yc("/auth/logout",{method:"POST"})},async requestStagingAccess(){await yc("/staging-access-request",{method:"POST"})}},jw=T.createContext(null),ph="pwc:auth-stale",MR=({children:e})=>{const[t,n]=T.useState(null),[r,o]=T.useState(!0),s=T.useCallback(async()=>{o(!0);const l=await fh.getCurrentUser();n(l),o(!1)},[]),i=T.useCallback(async()=>{const l=Td("/api/v1/auth/logout");if(new URL(l,window.location.origin).origin!==window.location.origin){const u=document.createElement("form");u.method="POST",u.action=`${l}?return_to=${encodeURIComponent(window.location.href)}`,document.body.appendChild(u),u.submit();return}await fh.logout(),n(null)},[]);T.useEffect(()=>{s()},[s]),T.useEffect(()=>{const l=()=>n(null);return window.addEventListener(ph,l),()=>window.removeEventListener(ph,l)},[]);const a=T.useMemo(()=>({user:t,isLoading:r,refresh:s,logout:i}),[t,r,s,i]);return h.jsx(jw.Provider,{value:a,children:e})};function Xd(){const e=T.useContext(jw);if(!e)throw new Error("useAuth must be used inside an ");return e}const Qo=({name:e,size:t=14})=>{const n={search:h.jsx("path",{d:"M11 11l3 3M7 12.5a5.5 5.5 0 110-11 5.5 5.5 0 010 11z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),bookmark:h.jsx("path",{d:"M4 2h8v12l-4-3-4 3V2z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),menu:h.jsx("path",{d:"M2 4h12M2 8h12M2 12h12",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),close:h.jsx("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})};return h.jsx("svg",{className:t===11?"icon-sm":"icon",viewBox:"0 0 16 16",width:t,height:t,children:n[e]})},hh="https://github.com/huggingface/paperswithcode-feedback/issues",OR="https://github.com/huggingface/pwc-cli",mh=[{to:"/",label:"Trending",end:!0},{to:"/tasks",label:"Browse state-of-the-art",end:!1},{to:"/methods",label:"Methods",end:!1},{to:"/conferences",label:"Conferences",end:!1},{to:"/organizations",label:"Organizations",end:!1},{to:"/submit",label:"Submit",end:!1}],jR=()=>{if(typeof navigator>"u")return!1;const e=navigator.userAgentData,t=(e==null?void 0:e.platform)||navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/i.test(t)},IR=()=>{const[e,t]=T.useState(!1);return T.useEffect(()=>{t(jR())},[]),h.jsx("kbd",{children:e?"⌘K":"Ctrl K"})},LR=({onOpenSearch:e})=>{const[t,n]=T.useState(!1),r=()=>n(!1),{user:o,logout:s}=Xd(),i=Mt(),a=Ms()&&(i.pathname==="/chat"||i.pathname.startsWith("/chat/")),l=`${i.pathname}${i.search}`||"/",u=Hs();return h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:`app-header${a?" app-header-chat":""}`,children:[h.jsxs("div",{className:"app-header-inner",children:[h.jsxs(nr,{to:"/",className:"brand",onClick:r,children:[h.jsx("span",{className:"brand-mark"}),h.jsxs("span",{className:"brand-name",children:["Papers ",h.jsx("em",{children:"With Code"})]})]}),h.jsx("nav",{className:"nav",children:mh.map(({to:c,label:d,end:m})=>h.jsx(nr,{to:c,end:m,className:({isActive:p})=>`nav-item ${p?"active":""}`,children:d},c))}),h.jsx("div",{className:"header-spacer"}),h.jsx("a",{className:"feedback-link header-feedback-link",href:hh,target:"_blank",rel:"noreferrer",children:"Submit feedback"}),h.jsxs("button",{className:"search-trigger",onClick:e,children:[h.jsx(Qo,{name:"search",size:13}),h.jsx("span",{children:"Search papers, authors, domains…"}),h.jsx(IR,{})]}),h.jsx("button",{className:"icon-btn mobile-search-btn","aria-label":"Search",onClick:e,children:h.jsx(Qo,{name:"search",size:14})}),!u&&h.jsx(nr,{to:"/saved",className:"icon-btn header-bookmark-btn","aria-label":"Saved papers",title:"Saved papers",children:h.jsx(Qo,{name:"bookmark",size:13})}),u?null:o?h.jsx(bR,{user:o,onLogout:s}):h.jsx(Sg,{returnTo:l}),h.jsx("button",{className:"icon-btn mobile-menu-btn","aria-label":"Open menu",onClick:()=>n(c=>!c),children:h.jsx(Qo,{name:t?"close":"menu",size:14})})]}),h.jsxs("div",{className:"site-announcement",role:"status",children:[h.jsx("span",{children:"New: Papers with Code CLI and Skill now "}),h.jsx("a",{href:OR,target:"_blank",rel:"noreferrer",children:"available"}),h.jsx("span",{children:" as well as "}),h.jsx(nr,{to:"/chat",children:"chat"})]})]}),t&&h.jsx("div",{className:"mobile-nav-drawer",onClick:r,children:h.jsxs("div",{className:"mobile-nav-panel",onClick:c=>c.stopPropagation(),children:[h.jsxs("button",{type:"button",className:"mobile-nav-link mobile-nav-search",onClick:()=>{r(),e()},children:[h.jsx(Qo,{name:"search",size:14}),h.jsx("span",{children:"Search papers, authors, domains…"})]}),mh.map(({to:c,label:d,end:m})=>h.jsx(nr,{to:c,end:m,className:"mobile-nav-link",onClick:r,children:d},c)),h.jsx("a",{className:"mobile-nav-link",href:hh,target:"_blank",rel:"noreferrer",onClick:r,children:"Submit feedback"}),!u&&h.jsx(nr,{to:"/saved",className:"mobile-nav-link",onClick:r,children:"Saved papers"}),!u&&(o==null?void 0:o.is_admin)&&h.jsx(nr,{to:"/admin-dashboard",className:"mobile-nav-link",onClick:r,children:"Admin dashboard"})]})})]})},DR=()=>{const{pathname:e}=Mt();return e==="/chat"||e.startsWith("/chat/")||e.startsWith("/pdf/")?null:h.jsx("footer",{className:"site-footer",children:h.jsxs("div",{className:"site-footer-inner",children:[h.jsxs("span",{children:["© ",new Date().getFullYear()," Hugging Face"]}),h.jsx(qt,{to:"/privacy",children:"Privacy"}),h.jsx("a",{href:"https://github.com/huggingface/paperswithcode-feedback/issues",target:"_blank",rel:"noreferrer",children:"Feedback"})]})})},FR=1,$R=1e6;let tu=0;function zR(){return tu=(tu+1)%Number.MAX_SAFE_INTEGER,tu.toString()}const nu=new Map,vh=e=>{if(nu.has(e))return;const t=setTimeout(()=>{nu.delete(e),us({type:"REMOVE_TOAST",toastId:e})},$R);nu.set(e,t)},UR=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,FR)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?vh(n):e.toasts.forEach(r=>{vh(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Vi=[];let Bi={toasts:[]};function us(e){Bi=UR(Bi,e),Vi.forEach(t=>{t(Bi)})}function VR({...e}){const t=zR(),n=o=>us({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>us({type:"DISMISS_TOAST",toastId:t});return us({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function BR(){const[e,t]=f.useState(Bi);return f.useEffect(()=>(Vi.push(t),()=>{const n=Vi.indexOf(t);n>-1&&Vi.splice(n,1)}),[e]),{...e,toast:VR,dismiss:n=>us({type:"DISMISS_TOAST",toastId:n})}}var WR=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),HR="VisuallyHidden",sl=f.forwardRef((e,t)=>h.jsx(ve.span,{...e,ref:t,style:{...WR,...e.style}}));sl.displayName=HR;var KR=sl,qd="ToastProvider",[Zd,GR,QR]=Od("Toast"),[Iw]=Tr("Toast",[QR]),[YR,il]=Iw(qd),Lw=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:s=50,children:i}=e,[a,l]=f.useState(null),[u,c]=f.useState(0),d=f.useRef(!1),m=f.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${qd}\`. Expected non-empty \`string\`.`),h.jsx(Zd.Provider,{scope:t,children:h.jsx(YR,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:s,toastCount:u,viewport:a,onViewportChange:l,onToastAdd:f.useCallback(()=>c(p=>p+1),[]),onToastRemove:f.useCallback(()=>c(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:m,children:i})})};Lw.displayName=qd;var Dw="ToastViewport",XR=["F8"],wc="toast.viewportPause",xc="toast.viewportResume",Fw=f.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=XR,label:o="Notifications ({hotkey})",...s}=e,i=il(Dw,n),a=GR(n),l=f.useRef(null),u=f.useRef(null),c=f.useRef(null),d=f.useRef(null),m=Re(t,d,i.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),E=i.toastCount>0;f.useEffect(()=>{const x=g=>{var w;r.length!==0&&r.every(S=>g[S]||g.code===S)&&((w=d.current)==null||w.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[r]),f.useEffect(()=>{const x=l.current,g=d.current;if(E&&x&&g){const v=()=>{if(!i.isClosePausedRef.current){const b=new CustomEvent(wc);g.dispatchEvent(b),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const b=new CustomEvent(xc);g.dispatchEvent(b),i.isClosePausedRef.current=!1}},S=b=>{!x.contains(b.relatedTarget)&&w()},C=()=>{x.contains(document.activeElement)||w()};return x.addEventListener("focusin",v),x.addEventListener("focusout",S),x.addEventListener("pointermove",v),x.addEventListener("pointerleave",C),window.addEventListener("blur",v),window.addEventListener("focus",w),()=>{x.removeEventListener("focusin",v),x.removeEventListener("focusout",S),x.removeEventListener("pointermove",v),x.removeEventListener("pointerleave",C),window.removeEventListener("blur",v),window.removeEventListener("focus",w)}}},[E,i.isClosePausedRef]);const y=f.useCallback(({tabbingDirection:x})=>{const v=a().map(w=>{const S=w.ref.current,C=[S,...u_(S)];return x==="forwards"?C:C.reverse()});return(x==="forwards"?v.reverse():v).flat()},[a]);return f.useEffect(()=>{const x=d.current;if(x){const g=v=>{var C,b,P;const w=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!w){const R=document.activeElement,O=v.shiftKey;if(v.target===x&&O){(C=u.current)==null||C.focus();return}const L=y({tabbingDirection:O?"backwards":"forwards"}),H=L.findIndex(I=>I===R);ru(L.slice(H+1))?v.preventDefault():O?(b=u.current)==null||b.focus():(P=c.current)==null||P.focus()}};return x.addEventListener("keydown",g),()=>x.removeEventListener("keydown",g)}},[a,y]),h.jsxs(Eb,{ref:l,role:"region","aria-label":o.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:E?void 0:"none"},children:[E&&h.jsx(Sc,{ref:u,onFocusFromOutsideViewport:()=>{const x=y({tabbingDirection:"forwards"});ru(x)}}),h.jsx(Zd.Slot,{scope:n,children:h.jsx(ve.ol,{tabIndex:-1,...s,ref:m})}),E&&h.jsx(Sc,{ref:c,onFocusFromOutsideViewport:()=>{const x=y({tabbingDirection:"backwards"});ru(x)}})]})});Fw.displayName=Dw;var $w="ToastFocusProxy",Sc=f.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,s=il($w,n);return h.jsx(sl,{tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=s.viewport)!=null&&u.contains(a))&&r()}})});Sc.displayName=$w;var Xs="Toast",qR="toast.swipeStart",ZR="toast.swipeMove",JR="toast.swipeCancel",e_="toast.swipeEnd",zw=f.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:s,...i}=e,[a,l]=Ad({prop:r,defaultProp:o??!0,onChange:s,caller:Xs});return h.jsx(Rr,{present:n||a,children:h.jsx(r_,{open:a,...i,ref:t,onClose:()=>l(!1),onPause:qe(e.onPause),onResume:qe(e.onResume),onSwipeStart:V(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:V(e.onSwipeMove,u=>{const{x:c,y:d}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${d}px`)}),onSwipeCancel:V(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:V(e.onSwipeEnd,u=>{const{x:c,y:d}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${d}px`),l(!1)})})})});zw.displayName=Xs;var[t_,n_]=Iw(Xs,{onClose(){}}),r_=f.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:s,onClose:i,onEscapeKeyDown:a,onPause:l,onResume:u,onSwipeStart:c,onSwipeMove:d,onSwipeCancel:m,onSwipeEnd:p,...E}=e,y=il(Xs,n),[x,g]=f.useState(null),v=Re(t,I=>g(I)),w=f.useRef(null),S=f.useRef(null),C=o||y.duration,b=f.useRef(0),P=f.useRef(C),R=f.useRef(0),{onToastAdd:O,onToastRemove:M}=y,$=qe(()=>{var Y;(x==null?void 0:x.contains(document.activeElement))&&((Y=y.viewport)==null||Y.focus()),i()}),L=f.useCallback(I=>{!I||I===1/0||(window.clearTimeout(R.current),b.current=new Date().getTime(),R.current=window.setTimeout($,I))},[$]);f.useEffect(()=>{const I=y.viewport;if(I){const Y=()=>{L(P.current),u==null||u()},z=()=>{const W=new Date().getTime()-b.current;P.current=P.current-W,window.clearTimeout(R.current),l==null||l()};return I.addEventListener(wc,z),I.addEventListener(xc,Y),()=>{I.removeEventListener(wc,z),I.removeEventListener(xc,Y)}}},[y.viewport,C,l,u,L]),f.useEffect(()=>{s&&!y.isClosePausedRef.current&&L(C)},[s,C,y.isClosePausedRef,L]),f.useEffect(()=>(O(),()=>M()),[O,M]);const H=f.useMemo(()=>x?Gw(x):null,[x]);return y.viewport?h.jsxs(h.Fragment,{children:[H&&h.jsx(o_,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:H}),h.jsx(t_,{scope:n,onClose:$,children:Ws.createPortal(h.jsx(Zd.ItemSlot,{scope:n,children:h.jsx(Sb,{asChild:!0,onEscapeKeyDown:V(a,()=>{y.isFocusedToastEscapeKeyDownRef.current||$(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:h.jsx(ve.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":y.swipeDirection,...E,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:V(e.onKeyDown,I=>{I.key==="Escape"&&(a==null||a(I.nativeEvent),I.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:V(e.onPointerDown,I=>{I.button===0&&(w.current={x:I.clientX,y:I.clientY})}),onPointerMove:V(e.onPointerMove,I=>{if(!w.current)return;const Y=I.clientX-w.current.x,z=I.clientY-w.current.y,W=!!S.current,N=["left","right"].includes(y.swipeDirection),k=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,j=N?k(0,Y):0,U=N?0:k(0,z),F=I.pointerType==="touch"?10:2,G={x:j,y:U},X={originalEvent:I,delta:G};W?(S.current=G,Pi(ZR,d,X,{discrete:!1})):gh(G,y.swipeDirection,F)?(S.current=G,Pi(qR,c,X,{discrete:!1}),I.target.setPointerCapture(I.pointerId)):(Math.abs(Y)>F||Math.abs(z)>F)&&(w.current=null)}),onPointerUp:V(e.onPointerUp,I=>{const Y=S.current,z=I.target;if(z.hasPointerCapture(I.pointerId)&&z.releasePointerCapture(I.pointerId),S.current=null,w.current=null,Y){const W=I.currentTarget,N={originalEvent:I,delta:Y};gh(Y,y.swipeDirection,y.swipeThreshold)?Pi(e_,p,N,{discrete:!0}):Pi(JR,m,N,{discrete:!0}),W.addEventListener("click",k=>k.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),o_=e=>{const{__scopeToast:t,children:n,...r}=e,o=il(Xs,t),[s,i]=f.useState(!1),[a,l]=f.useState(!1);return a_(()=>i(!0)),f.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:h.jsx(Vd,{asChild:!0,children:h.jsx(sl,{...r,children:s&&h.jsxs(h.Fragment,{children:[o.label," ",n]})})})},s_="ToastTitle",Uw=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return h.jsx(ve.div,{...r,ref:t})});Uw.displayName=s_;var i_="ToastDescription",Vw=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return h.jsx(ve.div,{...r,ref:t})});Vw.displayName=i_;var Bw="ToastAction",Ww=f.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?h.jsx(Kw,{altText:n,asChild:!0,children:h.jsx(Jd,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Bw}\`. Expected non-empty \`string\`.`),null)});Ww.displayName=Bw;var Hw="ToastClose",Jd=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=n_(Hw,n);return h.jsx(Kw,{asChild:!0,children:h.jsx(ve.button,{type:"button",...r,ref:t,onClick:V(e.onClick,o.onClose)})})});Jd.displayName=Hw;var Kw=f.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return h.jsx(ve.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function Gw(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),l_(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!o)if(s){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...Gw(r))}}),t}function Pi(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Md(o,s):o.dispatchEvent(s)}var gh=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),s=r>o;return t==="left"||t==="right"?s&&r>n:!s&&o>n};function a_(e=()=>{}){const t=qe(e);vt(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function l_(e){return e.nodeType===e.ELEMENT_NODE}function u_(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ru(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var c_=Lw,Qw=Fw,Yw=zw,Xw=Uw,qw=Vw,Zw=Ww,Jw=Jd;const yh=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,wh=Lg,d_=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return wh(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const c=n==null?void 0:n[u],d=s==null?void 0:s[u];if(c===null)return null;const m=yh(c)||yh(d);return o[u][m]}),a=n&&Object.entries(n).reduce((u,c)=>{let[d,m]=c;return m===void 0||(u[d]=m),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:m,...p}=c;return Object.entries(p).every(E=>{let[y,x]=E;return Array.isArray(x)?x.includes({...s,...a}[y]):{...s,...a}[y]===x})?[...u,d,m]:u},[]);return wh(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)},f_=c_,e0=f.forwardRef(({className:e,...t},n)=>h.jsx(Qw,{ref:n,className:_e("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));e0.displayName=Qw.displayName;const p_=d_("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),t0=f.forwardRef(({className:e,variant:t,...n},r)=>h.jsx(Yw,{ref:r,className:_e(p_({variant:t}),e),...n}));t0.displayName=Yw.displayName;const h_=f.forwardRef(({className:e,...t},n)=>h.jsx(Zw,{ref:n,className:_e("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));h_.displayName=Zw.displayName;const n0=f.forwardRef(({className:e,...t},n)=>h.jsx(Jw,{ref:n,className:_e("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:h.jsx(vR,{className:"h-4 w-4"})}));n0.displayName=Jw.displayName;const r0=f.forwardRef(({className:e,...t},n)=>h.jsx(Xw,{ref:n,className:_e("text-sm font-semibold",e),...t}));r0.displayName=Xw.displayName;const o0=f.forwardRef(({className:e,...t},n)=>h.jsx(qw,{ref:n,className:_e("text-sm opacity-90",e),...t}));o0.displayName=qw.displayName;function m_(){const{toasts:e}=BR();return h.jsxs(f_,{children:[e.map(function({id:t,title:n,description:r,action:o,...s}){return h.jsxs(t0,{...s,children:[h.jsxs("div",{className:"grid gap-1",children:[n&&h.jsx(r0,{children:n}),r&&h.jsx(o0,{children:r})]}),o,h.jsx(n0,{})]},t)}),h.jsx(e0,{})]})}var v_=e=>{switch(e){case"success":return w_;case"info":return S_;case"warning":return x_;case"error":return E_;default:return null}},g_=Array(12).fill(0),y_=({visible:e,className:t})=>T.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},T.createElement("div",{className:"sonner-spinner"},g_.map((n,r)=>T.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),w_=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),x_=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),S_=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),E_=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},T.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),C_=T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},T.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),b_=()=>{let[e,t]=T.useState(document.hidden);return T.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Ec=1,P_=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,o=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Ec++,s=this.toasts.find(a=>a.id===o),i=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),s?this.toasts=this.toasts.map(a=>a.id===o?(this.publish({...a,...e,id:o,title:n}),{...a,...e,id:o,dismissible:i,title:n}):a):this.addToast({title:n,...r,dismissible:i,id:o}),o},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),o=n!==void 0,s,i=r.then(async l=>{if(s=["resolve",l],T.isValidElement(l))o=!1,this.create({id:n,type:"default",message:l});else if(T_(l)&&!l.ok){o=!1;let u=typeof t.error=="function"?await t.error(`HTTP error! status: ${l.status}`):t.error,c=typeof t.description=="function"?await t.description(`HTTP error! status: ${l.status}`):t.description;this.create({id:n,type:"error",message:u,description:c})}else if(t.success!==void 0){o=!1;let u=typeof t.success=="function"?await t.success(l):t.success,c=typeof t.description=="function"?await t.description(l):t.description;this.create({id:n,type:"success",message:u,description:c})}}).catch(async l=>{if(s=["reject",l],t.error!==void 0){o=!1;let u=typeof t.error=="function"?await t.error(l):t.error,c=typeof t.description=="function"?await t.description(l):t.description;this.create({id:n,type:"error",message:u,description:c})}}).finally(()=>{var l;o&&(this.dismiss(n),n=void 0),(l=t.finally)==null||l.call(t)}),a=()=>new Promise((l,u)=>i.then(()=>s[0]==="reject"?u(s[1]):l(s[1])).catch(u));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Ec++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},He=new P_,k_=(e,t)=>{let n=(t==null?void 0:t.id)||Ec++;return He.addToast({title:e,...t,id:n}),n},T_=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",R_=k_,__=()=>He.toasts,N_=()=>He.getActiveToasts();Object.assign(R_,{success:He.success,info:He.info,warning:He.warning,error:He.error,custom:He.custom,message:He.message,promise:He.promise,dismiss:He.dismiss,loading:He.loading},{getHistory:__,getToasts:N_});function A_(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}A_(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} +`);function ki(e){return e.label!==void 0}var M_=3,O_="32px",j_="16px",xh=4e3,I_=356,L_=14,D_=20,F_=200;function St(...e){return e.filter(Boolean).join(" ")}function $_(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var z_=e=>{var t,n,r,o,s,i,a,l,u,c,d;let{invert:m,toast:p,unstyled:E,interacting:y,setHeights:x,visibleToasts:g,heights:v,index:w,toasts:S,expanded:C,removeToast:b,defaultRichColors:P,closeButton:R,style:O,cancelButtonStyle:M,actionButtonStyle:$,className:L="",descriptionClassName:H="",duration:I,position:Y,gap:z,loadingIcon:W,expandByDefault:N,classNames:k,icons:j,closeButtonAriaLabel:U="Close toast",pauseWhenPageIsHidden:F}=e,[G,X]=T.useState(null),[de,ge]=T.useState(null),[q,Gt]=T.useState(!1),[be,Ot]=T.useState(!1),[hn,Ar]=T.useState(!1),[mn,qs]=T.useState(!1),[ul,Zs]=T.useState(!1),[cl,Lo]=T.useState(0),[Mr,tf]=T.useState(0),Do=T.useRef(p.duration||I||xh),nf=T.useRef(null),Jn=T.useRef(null),m0=w===0,v0=w+1<=g,at=p.type,Or=p.dismissible!==!1,g0=p.className||"",y0=p.descriptionClassName||"",Js=T.useMemo(()=>v.findIndex(K=>K.toastId===p.id)||0,[v,p.id]),w0=T.useMemo(()=>{var K;return(K=p.closeButton)!=null?K:R},[p.closeButton,R]),rf=T.useMemo(()=>p.duration||I||xh,[p.duration,I]),dl=T.useRef(0),jr=T.useRef(0),of=T.useRef(0),Ir=T.useRef(null),[x0,S0]=Y.split("-"),sf=T.useMemo(()=>v.reduce((K,oe,ue)=>ue>=Js?K:K+oe.height,0),[v,Js]),af=b_(),E0=p.invert||m,fl=at==="loading";jr.current=T.useMemo(()=>Js*z+sf,[Js,sf]),T.useEffect(()=>{Do.current=rf},[rf]),T.useEffect(()=>{Gt(!0)},[]),T.useEffect(()=>{let K=Jn.current;if(K){let oe=K.getBoundingClientRect().height;return tf(oe),x(ue=>[{toastId:p.id,height:oe,position:p.position},...ue]),()=>x(ue=>ue.filter(gt=>gt.toastId!==p.id))}},[x,p.id]),T.useLayoutEffect(()=>{if(!q)return;let K=Jn.current,oe=K.style.height;K.style.height="auto";let ue=K.getBoundingClientRect().height;K.style.height=oe,tf(ue),x(gt=>gt.find(yt=>yt.toastId===p.id)?gt.map(yt=>yt.toastId===p.id?{...yt,height:ue}:yt):[{toastId:p.id,height:ue,position:p.position},...gt])},[q,p.title,p.description,x,p.id]);let vn=T.useCallback(()=>{Ot(!0),Lo(jr.current),x(K=>K.filter(oe=>oe.toastId!==p.id)),setTimeout(()=>{b(p)},F_)},[p,b,x,jr]);T.useEffect(()=>{if(p.promise&&at==="loading"||p.duration===1/0||p.type==="loading")return;let K;return C||y||F&&af?(()=>{if(of.current{var oe;(oe=p.onAutoClose)==null||oe.call(p,p),vn()},Do.current)),()=>clearTimeout(K)},[C,y,p,at,F,af,vn]),T.useEffect(()=>{p.delete&&vn()},[vn,p.delete]);function C0(){var K,oe,ue;return j!=null&&j.loading?T.createElement("div",{className:St(k==null?void 0:k.loader,(K=p==null?void 0:p.classNames)==null?void 0:K.loader,"sonner-loader"),"data-visible":at==="loading"},j.loading):W?T.createElement("div",{className:St(k==null?void 0:k.loader,(oe=p==null?void 0:p.classNames)==null?void 0:oe.loader,"sonner-loader"),"data-visible":at==="loading"},W):T.createElement(y_,{className:St(k==null?void 0:k.loader,(ue=p==null?void 0:p.classNames)==null?void 0:ue.loader),visible:at==="loading"})}return T.createElement("li",{tabIndex:0,ref:Jn,className:St(L,g0,k==null?void 0:k.toast,(t=p==null?void 0:p.classNames)==null?void 0:t.toast,k==null?void 0:k.default,k==null?void 0:k[at],(n=p==null?void 0:p.classNames)==null?void 0:n[at]),"data-sonner-toast":"","data-rich-colors":(r=p.richColors)!=null?r:P,"data-styled":!(p.jsx||p.unstyled||E),"data-mounted":q,"data-promise":!!p.promise,"data-swiped":ul,"data-removed":be,"data-visible":v0,"data-y-position":x0,"data-x-position":S0,"data-index":w,"data-front":m0,"data-swiping":hn,"data-dismissible":Or,"data-type":at,"data-invert":E0,"data-swipe-out":mn,"data-swipe-direction":de,"data-expanded":!!(C||N&&q),style:{"--index":w,"--toasts-before":w,"--z-index":S.length-w,"--offset":`${be?cl:jr.current}px`,"--initial-height":N?"auto":`${Mr}px`,...O,...p.style},onDragEnd:()=>{Ar(!1),X(null),Ir.current=null},onPointerDown:K=>{fl||!Or||(nf.current=new Date,Lo(jr.current),K.target.setPointerCapture(K.pointerId),K.target.tagName!=="BUTTON"&&(Ar(!0),Ir.current={x:K.clientX,y:K.clientY}))},onPointerUp:()=>{var K,oe,ue,gt;if(mn||!Or)return;Ir.current=null;let yt=Number(((K=Jn.current)==null?void 0:K.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),gn=Number(((oe=Jn.current)==null?void 0:oe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),er=new Date().getTime()-((ue=nf.current)==null?void 0:ue.getTime()),wt=G==="x"?yt:gn,yn=Math.abs(wt)/er;if(Math.abs(wt)>=D_||yn>.11){Lo(jr.current),(gt=p.onDismiss)==null||gt.call(p,p),ge(G==="x"?yt>0?"right":"left":gn>0?"down":"up"),vn(),qs(!0),Zs(!1);return}Ar(!1),X(null)},onPointerMove:K=>{var oe,ue,gt,yt;if(!Ir.current||!Or||((oe=window.getSelection())==null?void 0:oe.toString().length)>0)return;let gn=K.clientY-Ir.current.y,er=K.clientX-Ir.current.x,wt=(ue=e.swipeDirections)!=null?ue:$_(Y);!G&&(Math.abs(er)>1||Math.abs(gn)>1)&&X(Math.abs(er)>Math.abs(gn)?"x":"y");let yn={x:0,y:0};G==="y"?(wt.includes("top")||wt.includes("bottom"))&&(wt.includes("top")&&gn<0||wt.includes("bottom")&&gn>0)&&(yn.y=gn):G==="x"&&(wt.includes("left")||wt.includes("right"))&&(wt.includes("left")&&er<0||wt.includes("right")&&er>0)&&(yn.x=er),(Math.abs(yn.x)>0||Math.abs(yn.y)>0)&&Zs(!0),(gt=Jn.current)==null||gt.style.setProperty("--swipe-amount-x",`${yn.x}px`),(yt=Jn.current)==null||yt.style.setProperty("--swipe-amount-y",`${yn.y}px`)}},w0&&!p.jsx?T.createElement("button",{"aria-label":U,"data-disabled":fl,"data-close-button":!0,onClick:fl||!Or?()=>{}:()=>{var K;vn(),(K=p.onDismiss)==null||K.call(p,p)},className:St(k==null?void 0:k.closeButton,(o=p==null?void 0:p.classNames)==null?void 0:o.closeButton)},(s=j==null?void 0:j.close)!=null?s:C_):null,p.jsx||f.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:T.createElement(T.Fragment,null,at||p.icon||p.promise?T.createElement("div",{"data-icon":"",className:St(k==null?void 0:k.icon,(i=p==null?void 0:p.classNames)==null?void 0:i.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||C0():null,p.type!=="loading"?p.icon||(j==null?void 0:j[at])||v_(at):null):null,T.createElement("div",{"data-content":"",className:St(k==null?void 0:k.content,(a=p==null?void 0:p.classNames)==null?void 0:a.content)},T.createElement("div",{"data-title":"",className:St(k==null?void 0:k.title,(l=p==null?void 0:p.classNames)==null?void 0:l.title)},typeof p.title=="function"?p.title():p.title),p.description?T.createElement("div",{"data-description":"",className:St(H,y0,k==null?void 0:k.description,(u=p==null?void 0:p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),f.isValidElement(p.cancel)?p.cancel:p.cancel&&ki(p.cancel)?T.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||M,onClick:K=>{var oe,ue;ki(p.cancel)&&Or&&((ue=(oe=p.cancel).onClick)==null||ue.call(oe,K),vn())},className:St(k==null?void 0:k.cancelButton,(c=p==null?void 0:p.classNames)==null?void 0:c.cancelButton)},p.cancel.label):null,f.isValidElement(p.action)?p.action:p.action&&ki(p.action)?T.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||$,onClick:K=>{var oe,ue;ki(p.action)&&((ue=(oe=p.action).onClick)==null||ue.call(oe,K),!K.defaultPrevented&&vn())},className:St(k==null?void 0:k.actionButton,(d=p==null?void 0:p.classNames)==null?void 0:d.actionButton)},p.action.label):null))};function Sh(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function U_(e,t){let n={};return[e,t].forEach((r,o)=>{let s=o===1,i=s?"--mobile-offset":"--offset",a=s?j_:O_;function l(u){["top","right","bottom","left"].forEach(c=>{n[`${i}-${c}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${i}-${u}`]=a:n[`${i}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):l(a)}),n}var V_=f.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:o=["altKey","KeyT"],expand:s,closeButton:i,className:a,offset:l,mobileOffset:u,theme:c="light",richColors:d,duration:m,style:p,visibleToasts:E=M_,toastOptions:y,dir:x=Sh(),gap:g=L_,loadingIcon:v,icons:w,containerAriaLabel:S="Notifications",pauseWhenPageIsHidden:C}=e,[b,P]=T.useState([]),R=T.useMemo(()=>Array.from(new Set([r].concat(b.filter(F=>F.position).map(F=>F.position)))),[b,r]),[O,M]=T.useState([]),[$,L]=T.useState(!1),[H,I]=T.useState(!1),[Y,z]=T.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=T.useRef(null),N=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),k=T.useRef(null),j=T.useRef(!1),U=T.useCallback(F=>{P(G=>{var X;return(X=G.find(de=>de.id===F.id))!=null&&X.delete||He.dismiss(F.id),G.filter(({id:de})=>de!==F.id)})},[]);return T.useEffect(()=>He.subscribe(F=>{if(F.dismiss){P(G=>G.map(X=>X.id===F.id?{...X,delete:!0}:X));return}setTimeout(()=>{Gv.flushSync(()=>{P(G=>{let X=G.findIndex(de=>de.id===F.id);return X!==-1?[...G.slice(0,X),{...G[X],...F},...G.slice(X+1)]:[F,...G]})})})}),[]),T.useEffect(()=>{if(c!=="system"){z(c);return}if(c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window>"u")return;let F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:G})=>{z(G?"dark":"light")})}catch{F.addListener(({matches:X})=>{try{z(X?"dark":"light")}catch(de){console.error(de)}})}},[c]),T.useEffect(()=>{b.length<=1&&L(!1)},[b]),T.useEffect(()=>{let F=G=>{var X,de;o.every(ge=>G[ge]||G.code===ge)&&(L(!0),(X=W.current)==null||X.focus()),G.code==="Escape"&&(document.activeElement===W.current||(de=W.current)!=null&&de.contains(document.activeElement))&&L(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[o]),T.useEffect(()=>{if(W.current)return()=>{k.current&&(k.current.focus({preventScroll:!0}),k.current=null,j.current=!1)}},[W.current]),T.createElement("section",{ref:t,"aria-label":`${S} ${N}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},R.map((F,G)=>{var X;let[de,ge]=F.split("-");return b.length?T.createElement("ol",{key:F,dir:x==="auto"?Sh():x,tabIndex:-1,ref:W,className:a,"data-sonner-toaster":!0,"data-theme":Y,"data-y-position":de,"data-lifted":$&&b.length>1&&!s,"data-x-position":ge,style:{"--front-toast-height":`${((X=O[0])==null?void 0:X.height)||0}px`,"--width":`${I_}px`,"--gap":`${g}px`,...p,...U_(l,u)},onBlur:q=>{j.current&&!q.currentTarget.contains(q.relatedTarget)&&(j.current=!1,k.current&&(k.current.focus({preventScroll:!0}),k.current=null))},onFocus:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||j.current||(j.current=!0,k.current=q.relatedTarget)},onMouseEnter:()=>L(!0),onMouseMove:()=>L(!0),onMouseLeave:()=>{H||L(!1)},onDragEnd:()=>L(!1),onPointerDown:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||I(!0)},onPointerUp:()=>I(!1)},b.filter(q=>!q.position&&G===0||q.position===F).map((q,Gt)=>{var be,Ot;return T.createElement(z_,{key:q.id,icons:w,index:Gt,toast:q,defaultRichColors:d,duration:(be=y==null?void 0:y.duration)!=null?be:m,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:n,visibleToasts:E,closeButton:(Ot=y==null?void 0:y.closeButton)!=null?Ot:i,interacting:H,position:F,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,removeToast:U,toasts:b.filter(hn=>hn.position==q.position),heights:O.filter(hn=>hn.position==q.position),setHeights:M,expandByDefault:s,gap:g,loadingIcon:v,expanded:$,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections})})):null}))});const B_=({...e})=>{const{theme:t="system"}=eS();return h.jsx(V_,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};var W_=Symbol("radix.slottable");function H_(e){const t=({children:n})=>h.jsx(h.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=W_,t}var[al]=Tr("Tooltip",[Ja]),ef=Ja(),s0="TooltipProvider",K_=700,Eh="tooltip.open",[G_,i0]=al(s0),a0=e=>{const{__scopeTooltip:t,delayDuration:n=K_,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=f.useRef(!0),a=f.useRef(!1),l=f.useRef(0);return f.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),h.jsx(G_,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:f.useCallback(()=>{window.clearTimeout(l.current),i.current=!1},[]),onClose:f.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:f.useCallback(u=>{a.current=u},[]),disableHoverableContent:o,children:s})};a0.displayName=s0;var l0="Tooltip",[gA,ll]=al(l0),Cc="TooltipTrigger",Q_=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=ll(Cc,n),s=i0(Cc,n),i=ef(n),a=f.useRef(null),l=Re(t,a,o.onTriggerChange),u=f.useRef(!1),c=f.useRef(!1),d=f.useCallback(()=>u.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),h.jsx(yy,{asChild:!0,...i,children:h.jsx(ve.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:V(e.onPointerMove,m=>{m.pointerType!=="touch"&&!c.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:V(e.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:V(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:V(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:V(e.onBlur,o.onClose),onClick:V(e.onClick,o.onClose)})})});Q_.displayName=Cc;var Y_="TooltipPortal",[yA,X_]=al(Y_,{forceMount:void 0}),Ro="TooltipContent",u0=f.forwardRef((e,t)=>{const n=X_(Ro,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=ll(Ro,e.__scopeTooltip);return h.jsx(Rr,{present:r||i.open,children:i.disableHoverableContent?h.jsx(c0,{side:o,...s,ref:t}):h.jsx(q_,{side:o,...s,ref:t})})}),q_=f.forwardRef((e,t)=>{const n=ll(Ro,e.__scopeTooltip),r=i0(Ro,e.__scopeTooltip),o=f.useRef(null),s=Re(t,o),[i,a]=f.useState(null),{trigger:l,onClose:u}=n,c=o.current,{onPointerInTransitChange:d}=r,m=f.useCallback(()=>{a(null),d(!1)},[d]),p=f.useCallback((E,y)=>{const x=E.currentTarget,g={x:E.clientX,y:E.clientY},v=nN(g,x.getBoundingClientRect()),w=rN(g,v),S=oN(y.getBoundingClientRect()),C=iN([...w,...S]);a(C),d(!0)},[d]);return f.useEffect(()=>()=>m(),[m]),f.useEffect(()=>{if(l&&c){const E=x=>p(x,c),y=x=>p(x,l);return l.addEventListener("pointerleave",E),c.addEventListener("pointerleave",y),()=>{l.removeEventListener("pointerleave",E),c.removeEventListener("pointerleave",y)}}},[l,c,p,m]),f.useEffect(()=>{if(i){const E=y=>{const x=y.target,g={x:y.clientX,y:y.clientY},v=(l==null?void 0:l.contains(x))||(c==null?void 0:c.contains(x)),w=!sN(g,i);v?m():w&&(m(),u())};return document.addEventListener("pointermove",E),()=>document.removeEventListener("pointermove",E)}},[l,c,i,u,m]),h.jsx(c0,{...e,ref:s})}),[Z_,J_]=al(l0,{isInside:!1}),eN=H_("TooltipContent"),c0=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,l=ll(Ro,n),u=ef(n),{onClose:c}=l;return f.useEffect(()=>(document.addEventListener(Eh,c),()=>document.removeEventListener(Eh,c)),[c]),f.useEffect(()=>{if(l.trigger){const d=m=>{const p=m.target;p!=null&&p.contains(l.trigger)&&c()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,c]),h.jsx(Qa,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:h.jsxs(wy,{"data-state":l.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[h.jsx(eN,{children:r}),h.jsx(Z_,{scope:n,isInside:!0,children:h.jsx(KR,{id:l.contentId,role:"tooltip",children:o||r})})]})})});u0.displayName=Ro;var d0="TooltipArrow",tN=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=ef(n);return J_(d0,n).isInside?null:h.jsx(xy,{...o,...r,ref:t})});tN.displayName=d0;function nN(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function rN(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function oN(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function sN(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;sr!=m>r&&n<(d-u)*(r-c)/(m-c)+u&&(o=!o)}return o}function iN(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),aN(t)}function aN(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var lN=a0,f0=u0;const uN=lN,cN=f.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(f0,{ref:r,sideOffset:t,className:_e("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...n}));cN.displayName=f0.displayName;function dN(){const{pathname:e,hash:t}=Mt();f.useEffect(()=>{t||window.scrollTo(0,0)},[e,t])}class fN{constructor(t){this.request=t}getPreferences(){return this.request("/me/preferences")}updatePreferences(t){return this.request("/me/preferences",{method:"PUT",body:JSON.stringify(t)})}getRateLimitPolicy(){return this.request("/rate-limits",{credentials:"omit"})}getBookmarkIds(){return this.request("/me/bookmarks/ids")}getBookmarks(){return this.request("/me/bookmarks")}addBookmark(t){return this.request(`/me/bookmarks/${t}`,{method:"POST"})}removeBookmark(t){return this.request(`/me/bookmarks/${t}`,{method:"DELETE"})}}const Ch=new fN(yc),ou={hide_closed_source_evals:!1},p0=T.createContext(null),pN=({children:e})=>{const{user:t}=Xd(),[n,r]=T.useState(ou),[o,s]=T.useState(!1);T.useEffect(()=>{let l=!1;if(!t){r(ou);return}return s(!0),Ch.getPreferences().then(u=>{l||r(u)}).catch(()=>{l||r(ou)}).finally(()=>{l||s(!1)}),()=>{l=!0}},[t]);const i=T.useCallback(async l=>{const u={...n,hide_closed_source_evals:l};if(r(u),!!t)try{const c=await Ch.updatePreferences(u);r(c)}catch{r(n)}},[n,t]),a=T.useMemo(()=>({preferences:n,canPersist:!!t,isLoading:o,setHideClosedSourceEvals:i}),[n,t,o,i]);return h.jsx(p0.Provider,{value:a,children:e})};function wA(){const e=T.useContext(p0);if(!e)throw new Error("usePreferences must be used inside a ");return e}const h0=HE(),hN=h0?aE:iE;if(!h0&&typeof window<"u"){const e=window.location.hash;e.startsWith("#/")&&!e.startsWith("#//")&&window.history.replaceState(null,"",e.slice(1))}const mN=T.lazy(()=>ne(()=>import("./FeedView-CIK3mTNn.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))),vN=T.lazy(()=>ne(()=>import("./ChatView-D5ne7HbB.js"),__vite__mapDeps([20,11,21,9,10,12,6,3,4,22,23,24,25,26,27,28,14]))),gN=T.lazy(()=>ne(()=>import("./SharedChatView-gssSniE9.js"),__vite__mapDeps([29,11,21,9,10,12,6,3,4,22,23,24,25,26,27]))),yN=T.lazy(()=>ne(()=>import("./PapersListView-DTuy4U-C.js"),__vite__mapDeps([30,1,2,3,4,5,6,7,13,15,11,16,31,17,8,18,19]))),wN=T.lazy(()=>ne(()=>import("./PaperDetailView-Dys6fQi8.js"),__vite__mapDeps([32,1,2,3,4,5,6,7,33,22,34,11,15,16,35,18,19,36,37,38,39,40,41,13,42,43,44,45,23,24,26,46,47]))),xN=T.lazy(()=>ne(()=>import("./PaperReaderView-fLXDbLBc.js"),__vite__mapDeps([48,11,15,16,6,12,7,20,21,9,10,3,4,22,23,24,25,26,27,28,14,49]))),SN=T.lazy(()=>ne(()=>import("./TagsIndexView-Zr6z-Y-4.js"),__vite__mapDeps([50,11,13,5,51,18,19,52,43,36,37,38,41,42,40]))),EN=T.lazy(()=>ne(()=>import("./TagBrowseView-Dw0_Dir3.js"),__vite__mapDeps([53,11,1,2,3,4,5,6,7,54,8,55,25,26,22,13,51,15,16,18,19,10,24]))),CN=T.lazy(()=>ne(()=>import("./MethodsIndexView-geijTR_Z.js"),__vite__mapDeps([56,11,13,51,18,19,52,43,36,37,38,41,42,40]))),bN=T.lazy(()=>ne(()=>import("./FrameworksIndexView-ByziIlRP.js"),__vite__mapDeps([57,11,1,2,3,4,5,6,7,13]))),PN=T.lazy(()=>ne(()=>import("./TrendsView-Gyl495vi.js"),__vite__mapDeps([58,11,19,18]))),kN=T.lazy(()=>ne(()=>import("./ConferencesIndexView-CNg__9k_.js"),__vite__mapDeps([59,11,13,18,19,52,43,36,37,38,41,42,40]))),TN=T.lazy(()=>ne(()=>import("./AiDeadlinesView-BpSthBaV.js"),__vite__mapDeps([60,11,13,61,45,18,19,7,38]))),RN=T.lazy(()=>ne(()=>import("./ConferenceDetailView-Dbc2ENP6.js"),__vite__mapDeps([62,11,55,3,4,25,26,22,6,13,5,18,19,7]))),_N=T.lazy(()=>ne(()=>import("./ConferenceTaskView-BAJItIua.js"),__vite__mapDeps([63,11,1,2,3,4,5,6,7,8,55,25,26,22,13,15,16,18,19]))),NN=T.lazy(()=>ne(()=>import("./OrganizationsIndexView-wDeeuR4B.js"),__vite__mapDeps([64,11,19,18,13,65]))),AN=T.lazy(()=>ne(()=>import("./OrganizationDetailView-B70eYNbJ.js"),__vite__mapDeps([66,67,11,1,2,3,4,5,6,7,55,25,26,22,68,18,13,8,19,39,36,38,40,15,16,69]))),MN=T.lazy(()=>ne(()=>import("./OrganizationTaskView-DdRJ05b_.js"),__vite__mapDeps([70,67,11,1,2,3,4,5,6,7,55,25,26,22,68,18,13,8,19,39,36,38,40,15,16,69]))),ON=T.lazy(()=>ne(()=>import("./AuthorDetailView-B88e4SG9.js"),__vite__mapDeps([71,11,6,18,69]))),jN=T.lazy(()=>ne(()=>import("./MethodDetailView-CiYmZ5G6.js"),__vite__mapDeps([72,11,16,1,2,3,4,5,6,7,8,55,25,26,22,13,51,18,19]))),IN=T.lazy(()=>ne(()=>import("./BenchmarkDetailView-C5SE268J.js"),__vite__mapDeps([73,11,13,33,6,22,7,34,18,61,45,19,2,3,4,54,1,5,51,74]))),LN=T.lazy(()=>ne(()=>import("./SavedPapersView-Czyc5GTN.js"),__vite__mapDeps([75,11,1,2,3,4,5,6,7,18,19,46]))),DN=T.lazy(()=>ne(()=>import("./SettingsView-CbC3PqlO.js"),__vite__mapDeps([76,41,61,45,12,35,28,11,77]))),FN=T.lazy(()=>ne(()=>import("./PrivacyView-BKFNJZvc.js"),__vite__mapDeps([78,35]))),$N=T.lazy(()=>ne(()=>import("./SubmitView-Bt-NFHA_.js"),__vite__mapDeps([79,41,19,36,37,6]))),zN=T.lazy(()=>ne(()=>import("./CronDashboard-BnvHXrkn.js"),__vite__mapDeps([80,11,44,36,10,27,81,40,82,77,41,16,13,12,83]))),UN=T.lazy(()=>ne(()=>import("./SubmissionsDashboard-DxR4REQK.js"),__vite__mapDeps([84,11,41,13,7,6,42,81,40,82,85]))),VN=T.lazy(()=>ne(()=>import("./UserProfileView-flvwm70w.js"),__vite__mapDeps([86,11,68,18,13]))),BN=T.lazy(()=>ne(()=>import("./RateLimitsView-DckIJRFx.js"),__vite__mapDeps([87,11]))),su=T.lazy(()=>ne(()=>import("./NotFound--BkOSvuh.js"),[])),WN=T.lazy(()=>ne(()=>import("./SearchOverlay-C4cuTRdQ.js"),__vite__mapDeps([88,11,2,3,4,13,6,31,5]))),HN=T.lazy(()=>ne(()=>import("./StagingAccessRequestView-BS5zzPgR.js"),__vite__mapDeps([89,82]))),iu=()=>h.jsxs("div",{className:"page","aria-busy":"true","aria-live":"polite",children:[h.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:24,width:"30%",marginBottom:24}}),h.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:64,width:"60%",marginBottom:32}}),h.jsxs("div",{className:"paper-list",style:{display:"grid",gap:16},children:[h.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:96}}),h.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:96}}),h.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:96}})]})]}),KN=new zE({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}}),GN=()=>{const{arxivId:e}=rg();return h.jsx(Po,{to:e?`/paper/${e}`:"/papers",replace:!0})},QN=()=>{const{taskSlug:e}=rg();return h.jsx(Po,{to:e?`/tasks/${e}`:"/tasks",replace:!0})},bh=({element:e})=>Hs()?h.jsx(Po,{to:"/",replace:!0}):h.jsx(h.Fragment,{children:e}),YN=({element:e})=>{const{user:t,isLoading:n}=Xd();return Hs()?h.jsx(Po,{to:"/",replace:!0}):n?h.jsx("div",{className:"page",children:h.jsx("div",{className:"submission-loading",children:h.jsx("span",{children:"Checking admin session..."})})}):t?t.is_admin?h.jsx(h.Fragment,{children:e}):h.jsx("div",{className:"page",children:h.jsxs("div",{className:"submission-empty submission-empty-warn",children:[h.jsx("h1",{children:"Admin access required"}),h.jsxs("p",{children:["Signed in as @",t.username,". This dashboard is limited to allowlisted admin accounts."]})]})}):h.jsx("div",{className:"page",children:h.jsxs("div",{className:"submission-empty submission-empty-warn",children:[h.jsx("h1",{children:"Sign in required"}),h.jsx("p",{children:"Sign in with an allowlisted Hugging Face admin account to view admin operations."}),h.jsx(Sg,{returnTo:"/admin-dashboard"})]})})},XN=()=>{const e=BE(),t=typeof window<"u"&&new URL(e,window.location.origin).origin!==window.location.origin;return T.useEffect(()=>{t&&window.location.replace(e)},[e,t]),t?h.jsx("div",{className:"page",children:h.jsxs("div",{className:"submission-loading",children:[h.jsx("span",{children:"Opening the production admin dashboard..."}),h.jsx("a",{href:e,children:"Continue"})]})}):h.jsx(YN,{element:h.jsx(zN,{})})},qN=()=>{const[e,t]=T.useState(!1),n=Mt();return dN(),T.useLayoutEffect(()=>{var r;(r=document.getElementById("initial-discovery-footer"))==null||r.remove()},[]),T.useEffect(()=>{const r=o=>{(o.metaKey||o.ctrlKey)&&o.key==="k"&&(o.preventDefault(),t(!0))};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[]),n.pathname==="/request-access"?h.jsx(T.Suspense,{fallback:h.jsx(iu,{}),children:h.jsx(HN,{})}):n.pathname.startsWith("/pdf/")?h.jsx(T.Suspense,{fallback:h.jsx(iu,{}),children:h.jsx(Tp,{children:h.jsx(ee,{path:"/pdf/:arxivId",element:WE()?h.jsx(xN,{}):h.jsx(su,{})})})}):h.jsxs(h.Fragment,{children:[h.jsx(LR,{onOpenSearch:()=>t(!0)}),h.jsx("main",{children:h.jsx(T.Suspense,{fallback:h.jsx(iu,{}),children:h.jsxs(Tp,{children:[h.jsx(ee,{path:"/",element:h.jsx(mN,{})}),h.jsx(ee,{path:"/chat/:sessionId?",element:Ms()?h.jsx(vN,{}):h.jsx(Po,{to:"/",replace:!0})}),h.jsx(ee,{path:"/share/:shareId",element:Ms()?h.jsx(gN,{}):h.jsx(su,{})}),h.jsx(ee,{path:"/papers",element:h.jsx(yN,{})}),h.jsx(ee,{path:"/papers/:arxivId",element:h.jsx(GN,{})}),h.jsx(ee,{path:"/paper/:arxivId",element:h.jsx(wN,{})}),h.jsx(ee,{path:"/tasks",element:h.jsx(SN,{})}),h.jsx(ee,{path:"/tasks/:taskSlug",element:h.jsx(EN,{})}),h.jsx(ee,{path:"/task/:taskSlug",element:h.jsx(QN,{})}),h.jsx(ee,{path:"/methods",element:h.jsx(CN,{})}),h.jsx(ee,{path:"/methods/:methodSlug",element:h.jsx(jN,{})}),h.jsx(ee,{path:"/frameworks",element:h.jsx(bN,{})}),h.jsx(ee,{path:"/trends",element:h.jsx(PN,{})}),h.jsx(ee,{path:"/conferences",element:h.jsx(kN,{})}),h.jsx(ee,{path:"/ai-deadlines",element:h.jsx(TN,{})}),h.jsx(ee,{path:"/conferences/:confSlug",element:h.jsx(RN,{})}),h.jsx(ee,{path:"/conferences/:confSlug/:taskSlug",element:h.jsx(_N,{})}),h.jsx(ee,{path:"/organizations",element:h.jsx(NN,{})}),h.jsx(ee,{path:"/orgs/:orgSlug",element:h.jsx(AN,{})}),h.jsx(ee,{path:"/orgs/:orgSlug/:taskSlug",element:h.jsx(MN,{})}),h.jsx(ee,{path:"/authors/:authorId",element:h.jsx(ON,{})}),h.jsx(ee,{path:"/benchmark/:datasetSlug",element:h.jsx(IN,{})}),h.jsx(ee,{path:"/submit",element:h.jsx($N,{})}),h.jsx(ee,{path:"/saved",element:h.jsx(bh,{element:h.jsx(LN,{})})}),h.jsx(ee,{path:"/settings",element:h.jsx(DN,{})}),h.jsx(ee,{path:"/privacy",element:h.jsx(FN,{})}),h.jsx(ee,{path:"/admin-dashboard",element:h.jsx(XN,{})}),h.jsx(ee,{path:"/cron-dashboard",element:h.jsx(Po,{to:"/admin-dashboard",replace:!0})}),h.jsx(ee,{path:"/submissions",element:h.jsx(bh,{element:h.jsx(UN,{})})}),h.jsx(ee,{path:"/rate-limits",element:h.jsx(BN,{})}),h.jsx(ee,{path:"/:username",element:h.jsx(VN,{})}),h.jsx(ee,{path:"*",element:h.jsx(su,{})})]})})}),h.jsx(DR,{}),e&&h.jsx(T.Suspense,{fallback:null,children:h.jsx(WN,{open:e,onClose:()=>t(!1)})})]})},ZN=()=>h.jsx(UE,{client:KN,children:h.jsx(MR,{children:h.jsx(pN,{children:h.jsxs(uN,{children:[h.jsx(hN,{children:h.jsx(qN,{})}),h.jsx(m_,{}),h.jsx(B_,{}),!1]})})})});lS();const JN=Qv(document.getElementById("root"));JN.render(h.jsx(T.StrictMode,{children:h.jsx(tS,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,storageKey:"pwc-theme",children:h.jsx(iS,{children:h.jsx(ZN,{})})})}));export{Od as $,Mw as A,Ch as B,pR as C,Hs as D,VE as E,WE as F,gR as G,yR as H,lk as I,Nw as J,It as K,qt as L,uA as M,jh as N,Lg as O,Rr as P,cA as Q,ak as R,Sg as S,h_ as T,bR as U,_R as V,GE as W,vR as X,cc as Y,vt as Z,ne as _,nA as a,yc as a0,Cg as a1,d_ as a2,kr as a3,KP as a4,yy as a5,Ja as a6,Vd as a7,yk as a8,Iy as a9,RE as aA,SE as aB,oc as aC,pg as aD,wE as aE,xE as aF,rc as aG,cg as aH,IE as aI,bE as aJ,fh as aK,Cb as aa,Yg as ab,Qa as ac,wy as ad,xy as ae,mA as af,oA as ag,tA as ah,eS as ai,aA as aj,iA as ak,AR as al,fA as am,Ga as an,ze as ao,rA as ap,dg as aq,Ct as ar,Vg as as,Bg as at,Wg as au,Ns as av,DE as aw,sA as ax,Po as ay,Mt as az,dA as b,rg as c,ol as d,BR as e,wA as f,lA as g,ve as h,Ms as i,h as j,Ad as k,Re as l,V as m,pA as n,$P as o,Tr as p,_e as q,f as r,hA as s,Hg as t,Cd as u,Ey as v,mR as w,Td as x,Xd as y,T as z}; diff --git a/assets/index-WJQaPd7m.js b/assets/index-DlwDDz8H.js similarity index 72% rename from assets/index-WJQaPd7m.js rename to assets/index-DlwDDz8H.js index 09e3817bbcda47702bddf44f8b407d4d42d49942..f20a8e150e76d1204426d74591b321fb45009509 100644 --- a/assets/index-WJQaPd7m.js +++ b/assets/index-DlwDDz8H.js @@ -1 +1 @@ -import{r as u}from"./index-BrhBTT14.js";function o(r){const e=u.useRef({value:r,previous:r});return u.useMemo(()=>(e.current.value!==r&&(e.current.previous=e.current.value,e.current.value=r),e.current.previous),[r])}export{o as u}; +import{r as u}from"./index-D_-UZEuL.js";function o(r){const e=u.useRef({value:r,previous:r});return u.useMemo(()=>(e.current.value!==r&&(e.current.previous=e.current.value,e.current.value=r),e.current.previous),[r])}export{o as u}; diff --git a/assets/index-kn1cKd5w.css b/assets/index-Dyz2_XFB.css similarity index 69% rename from assets/index-kn1cKd5w.css rename to assets/index-Dyz2_XFB.css index 5625aa6863dd27a14a49b72a5f4cdc248a5d6894..83953c6021ff0830ed5348d6baab18baa825dcb0 100644 --- a/assets/index-kn1cKd5w.css +++ b/assets/index-Dyz2_XFB.css @@ -1 +1 @@ -@import"https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700;1,6..72,400&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent-tw: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 36 13% 7%;--foreground: 40 27% 93%;--card: 36 12% 10%;--card-foreground: 40 27% 93%;--popover: 36 12% 10%;--popover-foreground: 40 27% 93%;--primary: 40 27% 93%;--primary-foreground: 36 13% 7%;--secondary: 34 11% 15%;--secondary-foreground: 40 27% 93%;--muted: 34 11% 15%;--muted-foreground: 36 10% 64%;--accent-tw: 216 22% 20%;--accent-foreground: 213 38% 79%;--destructive: 0 63% 42%;--destructive-foreground: 40 27% 93%;--border: 35 11% 20%;--input: 35 11% 20%;--ring: 213 38% 67%}[data-shadcn] *{border-color:hsl(var(--border))}.\!container{width:100%!important;margin-right:auto!important;margin-left:auto!important;padding-right:2rem!important;padding-left:2rem!important}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.\!container{max-width:1400px!important}.container{max-width:1400px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.\!visible{visibility:visible!important}.visible{visibility:visible}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.left-2{left:.5rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:.5rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[60\]{z-index:60}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-6{margin-left:-1.5rem;margin-right:-1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-4{margin-right:1rem}.mr-auto{margin-right:auto}.mt-1{margin-top:.25rem}.mt-10{margin-top:2.5rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.\!block{display:block!important}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-36{height:9rem}.h-4{height:1rem}.h-40{height:10rem}.h-44{height:11rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[190px\]{height:190px}.h-\[220px\]{height:220px}.h-\[38px\]{height:38px}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-\[300px\]{max-height:300px}.max-h-\[350px\]{max-height:350px}.max-h-\[400px\]{max-height:400px}.max-h-\[460px\]{max-height:460px}.max-h-\[50vh\]{max-height:50vh}.max-h-\[600px\]{max-height:600px}.max-h-\[700px\]{max-height:700px}.max-h-\[800px\]{max-height:800px}.max-h-\[90vh\]{max-height:90vh}.max-h-\[min\(300px\,calc\(var\(--radix-popover-content-available-height\)-2\.75rem\)\)\]{max-height:min(300px,calc(var(--radix-popover-content-available-height) - 2.75rem))}.max-h-\[var\(--radix-popover-content-available-height\)\]{max-height:var(--radix-popover-content-available-height)}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-\[80px\]{min-height:80px}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-4{width:1rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-\[160px\]{width:160px}.w-\[calc\(100vw-2rem\)\]{width:calc(100vw - 2rem)}.w-\[var\(--radix-popover-trigger-width\)\]{width:var(--radix-popover-trigger-width)}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[180px\]{min-width:180px}.min-w-\[200px\]{min-width:200px}.min-w-\[240px\]{min-width:240px}.min-w-\[260px\]{min-width:260px}.min-w-\[8rem\]{min-width:8rem}.max-w-2xl{max-width:42rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[260px\]{max-width:260px}.max-w-\[280px\]{max-width:280px}.max-w-\[360px\]{max-width:360px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.table-fixed{table-layout:fixed}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-rows-\[auto_minmax\(0\,1fr\)_auto\]{grid-template-rows:auto minmax(0,1fr) auto}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-1{row-gap:.25rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overscroll-contain{overscroll-behavior:contain}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.\!border{border-width:1px!important}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.\!border-black{--tw-border-opacity: 1 !important;border-color:rgb(0 0 0 / var(--tw-border-opacity, 1))!important}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/40{border-color:hsl(var(--destructive) / .4)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.bg-accent{background-color:hsl(var(--accent-tw))}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/10{background-color:hsl(var(--destructive) / .1)}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/40{background-color:hsl(var(--muted) / .4)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-red-50\/50{background-color:#fef2f280}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pl-4{padding-left:1rem}.pl-5{padding-left:1.25rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-2{padding-right:.5rem}.pr-8{padding-right:2rem}.pr-9{padding-right:2.25rem}.pt-0{padding-top:0}.pt-2{padding-top:.5rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-widest{letter-spacing:.1em}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow{--tw-drop-shadow: drop-shadow(0 1px 2px rgb(0 0 0 / .1)) drop-shadow(0 1px 1px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-200{animation-duration:.2s}.\!running{animation-play-state:running!important}.running{animation-play-state:running}.paused{animation-play-state:paused}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.last\:mb-0:last-child{margin-bottom:0}.hover\:border-foreground\/50:hover{border-color:hsl(var(--foreground) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent-tw))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-emerald-600:hover{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.hover\:bg-muted\/20:hover{background-color:hsl(var(--muted) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-destructive:hover{color:hsl(var(--destructive))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:bg-accent:focus{background-color:hsl(var(--accent-tw))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-background{background-color:hsl(var(--background))}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color: hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[selected\=\'true\'\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent-tw))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:\!bg-black[data-state=checked]{--tw-bg-opacity: 1 !important;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))!important}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent-tw))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:\!text-white[data-state=checked]{--tw-text-opacity: 1 !important;color:rgb(255 255 255 / var(--tw-text-opacity, 1))!important}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity: .8}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y: -100%}.dark\:border-amber-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(120 53 15 / var(--tw-border-opacity, 1))}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}.dark\:bg-amber-950\/40:is(.dark *){background-color:#451a0366}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:mr-auto{margin-right:auto}.sm\:w-auto{width:auto}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:text-left{text-align:left}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y: 100%}}@media (min-width: 768px){.md\:col-span-2{grid-column:span 2 / span 2}.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 1024px){.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (min-width: 1280px){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}:root{--bg: #FAF8F4;--bg-elevated: #FFFFFF;--bg-subtle: #F2EFE8;--ink: #1A1814;--ink-soft: #5A554C;--ink-faint: #8E8678;--hairline: #E4DFD4;--hairline-strong: #C8C2B3;--accent: oklch(.45 .08 250);--accent-soft: oklch(.92 .03 250);--accent-text: oklch(.35 .1 250);--warn: oklch(.55 .12 30);--positive-bg: oklch(.96 .03 145);--positive-text: oklch(.34 .1 145);--positive-border: oklch(.86 .06 145);--negative-bg: oklch(.96 .03 25);--negative-text: oklch(.4 .12 25);--negative-border: oklch(.86 .06 25);--highlight-bg: oklch(.97 .04 70);--highlight-text: oklch(.42 .1 60);--highlight-border: oklch(.85 .07 70);--info-bg: oklch(.97 .04 230);--info-text: oklch(.42 .1 240);--info-border: oklch(.86 .07 230);--trend-code: #33639E;--trend-hf: #AA7D24;--serif: "Newsreader", Georgia, serif;--sans: "Inter", -apple-system, sans-serif;--mono: "JetBrains Mono", ui-monospace, monospace;color-scheme:light}.dark{--bg: #11100E;--bg-elevated: #1A1815;--bg-subtle: #24211D;--ink: #F3EFE7;--ink-soft: #B9B2A6;--ink-faint: #989084;--hairline: #332F29;--hairline-strong: #514A40;--accent: oklch(.72 .09 250);--accent-soft: oklch(.28 .04 250);--accent-text: oklch(.8 .08 250);--warn: oklch(.72 .12 30);--positive-bg: oklch(.25 .035 145);--positive-text: oklch(.79 .1 145);--positive-border: oklch(.43 .06 145);--negative-bg: oklch(.25 .04 25);--negative-text: oklch(.79 .1 25);--negative-border: oklch(.43 .06 25);--highlight-bg: oklch(.27 .04 70);--highlight-text: oklch(.82 .1 70);--highlight-border: oklch(.46 .07 70);--info-bg: oklch(.25 .04 230);--info-text: oklch(.8 .08 235);--info-border: oklch(.43 .07 230);--trend-code: #5C8FD6;--trend-hf: #B3831F;color-scheme:dark}*{box-sizing:border-box;margin:0;padding:0}html,body{background:var(--bg);color:var(--ink);font-family:var(--sans);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}a{color:inherit;text-decoration:none}button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}.app-header{border-bottom:1px solid var(--hairline);background:var(--bg);position:sticky;top:0;z-index:50}.app-header-inner{max-width:calc(50vw + 640px);margin:0 auto;padding:18px 32px;display:flex;align-items:center;gap:24px;min-width:0}.site-announcement{min-height:28px;padding:5px 32px 6px;border-top:1px solid var(--hairline);background:var(--bg-subtle);color:var(--ink-soft);font-size:12px;line-height:16px;text-align:center}.site-announcement a{color:var(--accent-text);font-weight:600;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.site-announcement a:hover{color:var(--ink)}.brand{display:flex;align-items:baseline;gap:10px;font-family:var(--serif);cursor:pointer}.brand-mark{width:22px;height:22px;background:var(--ink);position:relative;align-self:center;flex-shrink:0}.brand-mark:after{content:"";position:absolute;top:4px;left:4px;right:4px;bottom:4px;background:var(--bg)}.brand-mark:before{content:"";position:absolute;top:8px;left:8px;width:6px;height:6px;background:var(--ink);z-index:1}.brand-name{font-size:20px;font-weight:600;letter-spacing:-.02em;white-space:nowrap}.brand-name em{font-style:italic;font-weight:400;color:var(--ink-soft)}.nav{display:flex;gap:24px;margin-left:8px;flex-shrink:0}@media (max-width: 1100px){.nav{gap:18px}.nav-item:nth-child(n+4){display:none}}@media (max-width: 920px){.search-trigger kbd{display:none}}.nav-item{font-size:13px;color:var(--ink-soft);padding:4px 0;border-bottom:1px solid transparent;transition:color .15s}.nav-item:hover{color:var(--ink)}.nav-item.active{color:var(--ink);border-bottom-color:var(--ink)}.header-spacer{flex:1}.search-trigger{display:flex;align-items:center;gap:8px;padding:7px 12px;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);font-size:13px;color:var(--ink-faint);width:240px;min-width:0;flex-shrink:1;transition:border-color .15s;overflow:hidden}.search-trigger>span:not(:first-child){white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.search-trigger:hover{border-color:var(--hairline-strong)}.search-trigger kbd{margin-left:auto;font-family:var(--mono);font-size:11px;padding:1px 5px;border:1px solid var(--hairline);border-radius:3px;background:var(--bg-subtle);color:var(--ink-soft)}.icon-btn{width:32px;height:32px;display:flex;align-items:center;justify-content:center;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);transition:border-color .15s}.icon-btn:hover{border-color:var(--hairline-strong)}.hf-signin-btn{display:inline-flex;align-items:center;gap:8px;height:32px;padding:0 12px;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);font-size:13px;color:var(--ink);white-space:nowrap;transition:border-color .15s,background .15s}.hf-signin-btn:hover{border-color:var(--hairline-strong);background:var(--bg-subtle)}.user-avatar-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid var(--hairline);border-radius:999px;background:var(--bg-elevated);padding:0;overflow:hidden;transition:border-color .15s}.user-avatar-btn:hover{border-color:var(--hairline-strong)}.user-avatar-btn:focus-visible{outline:2px solid var(--hairline-strong);outline-offset:2px}.page{max-width:calc(50vw + 640px);margin:0 auto;padding:32px}.site-footer{border-top:1px solid var(--hairline);color:var(--ink-faint);font-size:12px}.site-footer-inner{display:flex;flex-wrap:wrap;gap:14px;max-width:calc(50vw + 640px);margin:0 auto;padding:20px 32px 28px}.site-footer a{color:var(--ink-soft)}.site-footer a:hover{color:var(--ink)}.layout-with-sidebar{display:grid;grid-template-columns:220px 1fr;gap:48px;align-items:start}.sidebar{position:sticky;top:100px}.sidebar-section{margin-bottom:28px}.sidebar-label{font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-faint);margin-bottom:12px}.sidebar-link{display:block;font-size:13px;color:var(--ink-soft);padding:5px 0;border-bottom:1px dotted transparent;transition:color .15s}.sidebar-link:hover{color:var(--ink)}.sidebar-link.active{color:var(--ink);font-weight:500}.sidebar-link .count{font-family:var(--mono);font-size:11px;color:var(--ink-faint);margin-left:6px}.breadcrumb{display:flex;align-items:center;gap:8px;font-family:var(--mono);font-size:11px;color:var(--ink-faint);margin-bottom:24px}.breadcrumb a{color:var(--ink-soft)}.breadcrumb a:hover{color:var(--ink)}.breadcrumb .sep{color:var(--hairline-strong)}.detail-title{font-family:var(--serif);font-size:38px;font-weight:500;line-height:1.15;letter-spacing:-.02em;margin-bottom:16px;text-wrap:balance}.action-btn{display:inline-flex;align-items:center;gap:6px;padding:7px 12px;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);font-size:12px;font-weight:500;color:var(--ink);transition:all .15s}.action-btn:hover{border-color:var(--ink)}.action-btn.primary{background:var(--ink);color:var(--bg);border-color:var(--ink)}.action-btn.primary:hover{background:color-mix(in oklch,var(--ink) 88%,var(--accent))}.no-results{padding:80px 0;text-align:center;font-family:var(--serif);color:var(--ink-faint);font-style:italic}.icon{width:14px;height:14px;flex-shrink:0}.icon-sm{width:11px;height:11px;flex-shrink:0}html{scroll-behavior:smooth}::-moz-selection{background:var(--accent-soft);color:var(--accent-text)}::selection{background:var(--accent-soft);color:var(--accent-text)}.mobile-menu-btn,.mobile-search-btn{display:none;width:36px;height:36px;align-items:center;justify-content:center;border-radius:4px;flex-shrink:0}.mobile-menu-btn:hover,.mobile-search-btn:hover{background:var(--bg-subtle)}.mobile-nav-drawer{position:fixed;top:0;right:0;bottom:0;left:0;background:#1a181466;z-index:100;display:flex;justify-content:flex-end}.mobile-nav-panel{width:min(320px,80vw);background:var(--bg-elevated);border-left:1px solid var(--hairline-strong);padding:24px 24px 32px;display:flex;flex-direction:column;gap:4px;height:100dvh;max-height:100vh;overflow-y:auto;box-shadow:-8px 0 24px #0000000f}.mobile-nav-link{font-family:var(--serif);font-size:17px;padding:12px 4px;color:var(--ink);border-bottom:1px solid var(--hairline)}.mobile-nav-link.active{color:var(--accent-text);font-style:italic}.mobile-nav-search{display:flex;align-items:center;gap:10px;width:100%;font-family:var(--sans);font-size:14px;color:var(--ink-faint);background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:6px;padding:10px 12px;margin-bottom:8px;text-align:left}.mobile-nav-search:hover{border-color:var(--hairline-strong);color:var(--ink)}@media (max-width: 880px){.nav,.search-trigger,.header-feedback-link{display:none}.mobile-menu-btn,.mobile-search-btn{display:inline-flex}}@media (max-width: 640px){.app-header-inner,.brand{gap:8px}.brand-mark{width:20px;height:20px}.brand-name{font-size:18px}.header-bookmark-btn{display:none}.hf-signin-btn{width:36px;height:36px;padding:0;gap:0;justify-content:center;flex-shrink:0}.hf-signin-btn>span{display:none}}@media (max-width: 880px){.app-header-inner{padding:14px 16px;gap:12px}.page{padding:24px 16px}.layout-with-sidebar{grid-template-columns:1fr;gap:24px}.layout-with-sidebar .sidebar{position:static;top:auto}.detail-title{font-size:28px}}@media (max-width: 640px){.app-header-inner{padding:12px 14px;gap:8px}.page{padding:20px 14px}.detail-title{font-size:24px}.brand-name{font-size:17px}}.access-request-page{min-height:100vh;min-height:100svh;display:grid;place-items:center;padding:32px 20px;background:radial-gradient(circle at 50% 8%,color-mix(in srgb,var(--accent-soft) 60%,transparent),transparent 42%),var(--bg)}.access-request-card{width:min(100%,470px);padding:38px;border:1px solid var(--hairline);border-radius:12px;background:color-mix(in srgb,var(--bg-elevated) 94%,transparent);box-shadow:0 20px 60px #1a181414}.access-request-brand{display:inline-flex;align-items:center;gap:10px;margin-bottom:42px;font-family:var(--serif)}.access-request-heading h1,.access-request-success h1{margin-bottom:12px;font-family:var(--serif);font-size:clamp(36px,8vw,48px);font-weight:500;line-height:1;letter-spacing:-.035em}.access-request-heading>p:last-child,.access-request-success p,.access-request-signin>p{color:var(--ink-soft);font-size:15px;line-height:1.65}.access-request-eyebrow{margin-bottom:10px;color:var(--accent-text);font-size:11px;font-weight:700;letter-spacing:.12em;text-transform:uppercase}.access-request-form,.access-request-signin{margin-top:30px}.access-request-form label{display:block;margin-bottom:8px;font-size:12px;font-weight:600}.access-request-input-wrap{display:flex;align-items:center;border:1px solid var(--hairline-strong);border-radius:7px;background:var(--bg);color:var(--ink-faint);transition:border-color .15s,box-shadow .15s}.access-request-input-wrap:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}.access-request-input-wrap>span{padding-left:13px;font-size:15px}.access-request-input-wrap input{width:100%;padding:11px 13px 11px 3px;border:0;outline:0;background:transparent;color:var(--ink);font:500 14px var(--sans)}.access-request-verified{margin-top:7px;color:var(--ink-faint);font-size:11px}.access-request-submit{width:100%;margin-top:20px;padding:12px 18px;border-radius:7px;background:var(--ink);color:var(--bg);font-size:13px;font-weight:600;transition:opacity .15s,transform .15s}.access-request-submit:hover:not(:disabled){transform:translateY(-1px)}.access-request-submit:disabled{cursor:wait;opacity:.6}.access-request-error{margin-top:12px;color:var(--negative-text);font-size:12px}.access-request-status{margin-top:30px;color:var(--ink-soft)}.access-request-signin .hf-signin-btn{margin-top:18px}.access-request-success svg{margin-bottom:24px;color:var(--positive-text)}@media (max-width: 520px){.access-request-card{padding:28px 24px}.access-request-brand{margin-bottom:34px}}.legal-page{max-width:880px;padding-bottom:72px;color:var(--ink-soft);font-family:var(--sans);font-size:15px;line-height:1.7}.legal-header{margin-bottom:34px;padding-bottom:24px;border-bottom:1px solid var(--hairline)}.legal-kicker{margin:0 0 6px;color:var(--accent-text);font-size:11px;font-weight:700;letter-spacing:.1em;text-transform:uppercase}.legal-header h1{margin:0;color:var(--ink);font-family:var(--serif);font-size:clamp(38px,6vw,56px);font-weight:500;letter-spacing:-.025em;line-height:1.05}.legal-effective-date{margin:12px 0 0;color:var(--ink-faint)}.legal-page section{margin-top:34px}.legal-page h2{margin:0 0 10px;color:var(--ink);font-family:var(--serif);font-size:25px;font-weight:600;line-height:1.25}.legal-page h3{margin:22px 0 6px;color:var(--ink);font-size:15px;font-weight:700}.legal-page p{margin:0 0 14px}.legal-page ul{margin:8px 0 16px;padding-left:22px}.legal-page li{margin:7px 0}.legal-page a{color:var(--accent-text);text-decoration:underline}.legal-page strong{color:var(--ink)}.feed-header{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:32px;gap:24px;flex-wrap:wrap}.feed-title{font-family:var(--serif);font-size:44px;font-weight:500;letter-spacing:-.025em;line-height:1}.feed-title em{font-style:italic;font-weight:400;color:var(--accent)}.feed-subtitle{font-size:13px;color:var(--ink-soft);margin-top:8px;font-family:var(--serif);font-style:italic}.conference-deadlines-link{font-size:16px;color:var(--ink-soft);margin-top:12px}.trend-chart{margin:0;width:100%}.trend-chart-visual{position:relative;min-width:0}.trend-chart-table{margin-top:10px}.feedback-link{display:inline-flex;align-items:center;height:32px;padding:0 12px;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);color:var(--ink-soft);font-size:13px;font-weight:500;white-space:nowrap;transition:border-color .15s,color .15s,background .15s}.feedback-link:hover{border-color:var(--hairline-strong);background:var(--bg-subtle);color:var(--ink)}.period-switch{display:flex;align-items:center;gap:2px;background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:6px;padding:3px}.period-btn{padding:5px 12px;font-size:12px;font-weight:500;color:var(--ink-soft);border-radius:4px;transition:all .15s}.period-btn.active{background:var(--ink);color:var(--bg)}.period-btn:not(.active):hover{background:var(--bg-subtle);color:var(--ink)}.date-nav{display:flex;align-items:center;gap:12px;font-family:var(--mono);font-size:12px;color:var(--ink-soft)}.date-nav button{width:26px;height:26px;border:1px solid var(--hairline);border-radius:4px;display:flex;align-items:center;justify-content:center;background:var(--bg-elevated)}.date-nav button:hover{background:var(--bg-subtle)}.paper-list{display:flex;flex-direction:column}.paper-card{display:grid;grid-template-columns:170px 1fr;gap:28px;padding:24px 0;border-bottom:1px solid var(--hairline);align-items:stretch}.paper-thumb-wrap{transition:transform .15s;display:flex;align-items:flex-end;justify-content:flex-start}.paper-thumb-wrap:hover{transform:translateY(-2px)}.paper-thumb-skeleton{width:160px;height:220px}.paper-card:first-child{padding-top:0}.paper-rank{font-family:var(--serif);font-size:32px;font-weight:500;color:var(--ink-faint);font-feature-settings:"tnum";line-height:.9;font-style:italic}.paper-body{min-width:0;display:flex;align-items:stretch;gap:28px}.paper-body-main{min-width:0;flex:1}.paper-resources{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:18px;flex:0 0 auto;width:92px;border-left:1px solid var(--hairline);padding-left:20px}.paper-resource{display:flex;flex-direction:column;align-items:center;gap:4px;color:inherit}a.paper-resource.is-link{text-decoration:none;cursor:pointer;border-radius:4px;transition:transform .15s}a.paper-resource.is-link:hover{transform:translateY(-1px)}a.paper-resource.is-link:hover .resource-value{text-decoration:underline;text-underline-offset:2px}a.paper-resource.is-link:focus-visible{outline:2px solid var(--ink);outline-offset:2px}.paper-resource .resource-stat{display:flex;flex-direction:column;align-items:center;gap:2px}.paper-resource .resource-value{display:inline-flex;align-items:center;gap:3px;font-family:var(--mono);font-size:14px;color:var(--ink);font-weight:500;font-variant-numeric:tabular-nums;letter-spacing:-.01em}.paper-resource .resource-label{font-family:var(--mono);font-size:10px;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-faint)}.paper-resource .gh-rate-arrow{color:var(--accent-text);font-size:13px;transform:translateY(-.5px)}.paper-meta-line{display:flex;align-items:center;gap:12px;font-family:var(--mono);font-size:11px;color:var(--ink-faint);margin-bottom:6px}.paper-meta-line .sep{color:var(--hairline-strong)}.paper-title{font-family:var(--serif);font-size:22px;font-weight:500;line-height:1.2;letter-spacing:-.015em;margin-bottom:6px;color:var(--ink);cursor:pointer;text-wrap:pretty}.paper-title:hover{color:var(--accent-text)}.paper-organization-logos{display:inline-flex;align-items:center;gap:4px;margin-left:7px;vertical-align:-4px}.paper-organization-logo{display:inline-grid;width:24px;height:24px;flex:0 0 24px;place-items:center;overflow:hidden;border:1px solid var(--hairline);border-radius:4px;background:var(--bg)}.paper-organization-logo:hover{border-color:var(--hairline-strong)}.paper-organization-logo img{width:100%;height:100%;padding:2px;-o-object-fit:contain;object-fit:contain}.paper-authors{font-size:13px;color:var(--ink-soft);margin-bottom:10px;font-family:var(--serif)}.paper-abstract{font-size:13.5px;color:var(--ink-soft);line-height:1.55;max-height:4.65em;margin-bottom:12px;font-family:var(--serif);text-wrap:pretty;display:-webkit-box;line-clamp:3;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.paper-tags{display:flex;flex-wrap:wrap;gap:6px}.paper-tags--clamped{--tag-row-height: 26px;max-height:calc(var(--tag-row-height) * 2 + 6px);overflow:hidden}.paper-sota{position:relative;white-space:nowrap;overflow:hidden;margin-bottom:12px;font-family:var(--mono);font-size:12px;line-height:1.6}.paper-sota-stack{margin-top:16px;padding-top:16px;border-top:1px solid var(--hairline)}.paper-sota-stack .paper-sota{margin-bottom:4px}.paper-sota-stack .paper-sota:last-child{margin-bottom:0}.paper-sota-measure{position:absolute;left:-9999px;top:0;visibility:hidden;white-space:pre;pointer-events:none}.paper-sota-label{font-weight:500;color:var(--ink-faint)}.paper-sota-label--sota{color:#b8860b}.paper-sota-sep,.paper-sota-on{color:var(--ink-faint)}.paper-sota-name{color:var(--accent-text)}.paper-sota-name:hover{text-decoration:underline}.paper-sota-more{font-size:11px;color:var(--ink-faint);cursor:pointer}.paper-sota-more:hover{color:var(--accent-text);text-decoration:underline}.paper-stats{display:flex;flex-direction:column;align-items:flex-end;gap:8px;font-family:var(--mono);font-size:11px;color:var(--ink-soft)}.upvote-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:8px 14px;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);font-family:var(--mono);font-size:13px;font-weight:500;min-width:56px;transition:all .15s}.upvote-btn:hover{border-color:var(--ink)}.upvote-btn.upvoted{background:var(--accent-soft);border-color:var(--accent);color:var(--accent-text)}.upvote-btn .arrow{font-size:9px;line-height:1;margin-bottom:2px}.upvote-btn .count{font-feature-settings:"tnum"}.stat-line{display:flex;align-items:center;gap:5px}.sort-bar{display:flex;align-items:center;justify-content:space-between;padding-bottom:16px;border-bottom:1px solid var(--hairline);margin-bottom:16px}.sort-options{display:flex;gap:4px}.sort-btn{padding:4px 10px;font-family:var(--mono);font-size:11px;font-weight:500;letter-spacing:.02em;color:var(--ink-soft);border-radius:4px;transition:all .15s;text-transform:lowercase}.sort-btn.active{background:var(--ink);color:var(--bg)}.sort-btn:not(.active):hover{background:var(--bg-subtle);color:var(--ink)}.paper-feed-toolbar-controls,.paper-feed-resource-controls,.paper-feed-filter-options{display:flex;align-items:center}.paper-feed-toolbar-controls{gap:14px;flex-wrap:wrap}.paper-feed-resource-controls{gap:10px}.paper-feed-resource-divider{width:1px;height:22px;background:var(--hairline)}.paper-feed-filter-options{gap:6px;flex-wrap:wrap}.paper-feed-filter{display:inline-flex;align-items:center;gap:6px;min-height:30px;padding:5px 10px;border:1px solid var(--hairline);border-radius:999px;background:var(--bg);color:var(--ink-soft);font-family:var(--mono);font-size:11px;letter-spacing:.01em;cursor:pointer;transition:border-color .15s,background .15s,color .15s}.paper-feed-filter-content{display:inline-flex;align-items:center;gap:6px}.paper-feed-filter:hover{border-color:var(--ink-faint);color:var(--ink)}.paper-feed-filter.active{border-color:var(--ink);background:var(--ink);color:var(--bg)}.paper-feed-filter:focus-visible{outline:2px solid var(--ink);outline-offset:2px}.paper-feed-filter-icon{display:inline-flex;color:currentColor;filter:grayscale(1)}.hf-resource-logo{position:relative;display:inline-flex;width:15px;height:15px}.hf-resource-logo img{position:absolute;top:0;right:0;bottom:0;left:0;display:block;width:15px;height:15px}.hf-resource-logo-white,.paper-feed-filter.active .hf-resource-logo-black{visibility:hidden}.paper-feed-filter.active .hf-resource-logo-white{visibility:visible}.paper-feed-filter-check{display:inline-flex;align-items:center;justify-content:center;width:17px;height:17px;border-radius:50%;background:color-mix(in srgb,var(--bg) 18%,transparent);color:currentColor;font-size:10px;line-height:1}.home-feed-sort-bar{flex-wrap:wrap;row-gap:10px}.results-count{font-family:var(--mono);font-size:11px;color:var(--ink-faint)}.paper-feed-scope-links{margin-top:12px;display:flex;flex-direction:column;align-items:flex-start;gap:8px}.paper-feed-primary-links,.paper-feed-task-tags{display:flex;flex-wrap:wrap;align-items:center;gap:10px}.papers-feed-layout-scoped{display:block}.paper-thumb{display:none}.papers-search-row{display:flex;margin-top:12px;margin-bottom:24px}.papers-search-input-wrap{display:flex;align-items:center;gap:8px;border:1px solid var(--hairline-strong);background:var(--bg-elevated);padding:10px 14px;border-radius:4px;flex:1;max-width:600px;color:var(--ink-faint)}.papers-search-input-wrap:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}.papers-search-input{flex:1;border:none;outline:none;background:transparent;font-family:var(--sans);font-size:14px;color:var(--ink)}.papers-search-input::-moz-placeholder{color:var(--ink-faint)}.papers-search-input::placeholder{color:var(--ink-faint)}@media (max-width: 880px){.feed-title{font-size:32px}.paper-card{grid-template-columns:120px 1fr;gap:16px;padding:20px 0}.paper-body{flex-direction:column;align-items:stretch;gap:12px}.paper-resources{width:auto;flex-direction:row;align-items:center;justify-content:flex-start;gap:24px;border-left:none;border-top:1px solid var(--hairline);padding-left:0;padding-top:12px}.paper-resource{flex-direction:row;gap:8px}.paper-resource .resource-stat{align-items:flex-start}}@media (min-width: 641px) and (max-width: 880px){.paper-thumb-wrap{min-width:0}.paper-thumb-wrap>div{width:100%!important;max-width:120px;height:auto!important;aspect-ratio:160 / 220}.paper-thumb-wrap>div>img,.paper-thumb-wrap>div>svg{width:100%!important;height:100%!important}.paper-thumb-skeleton{width:100%;max-width:120px;height:auto;aspect-ratio:160 / 220}}@media (max-width: 640px){.feed-header{margin-bottom:24px;gap:16px}.feed-title{font-size:26px}.paper-card{grid-template-columns:1fr;gap:12px}.paper-resources{border-top:none;padding-top:0}.paper-thumb-wrap{align-self:flex-start}.paper-title{font-size:19px}.paper-abstract{max-height:6.2em;-webkit-line-clamp:4;line-clamp:4}}.sort-options-time{margin-left:auto}.sort-btn-time{text-transform:none}@media (max-width: 900px){.sort-bar{flex-wrap:wrap;gap:8px}.sort-options-time{margin-left:0}}@media (max-width: 560px){.paper-feed-resource-divider{display:none}.paper-feed-resource-controls{gap:0}}.organization-hero{display:grid;grid-template-columns:minmax(260px,.34fr) minmax(0,1fr);align-items:center;gap:48px;margin:24px 0 32px}.organization-hero-profile{min-width:0}.organization-hero-title{display:flex;align-items:center;gap:14px}.organization-hero-title img{flex:none;-o-object-fit:contain;object-fit:contain}.organization-hero-links{display:flex;flex-wrap:wrap;gap:12px;margin-top:12px}.organization-contributions{width:100%;min-width:0}.organization-contributions-header{margin-bottom:12px}.organization-contributions-title{font-family:var(--serif);font-size:20px;font-weight:600;line-height:1.2}.organization-contributions-summary{margin-top:3px;color:var(--ink-soft);font-size:12px}.organization-contributions-legend{display:flex;align-items:center;justify-content:flex-start;gap:4px;margin-top:8px;color:var(--ink-faint);font-family:var(--mono);font-size:10px;white-space:nowrap}.organization-contributions-legend span:first-child{margin-right:3px}.organization-contributions-legend span:last-child{margin-left:3px}.organization-contributions-scroll{width:calc(100% + 34px);max-width:none;margin-left:-34px;overflow-x:auto;padding:2px 0;scrollbar-width:thin;scrollbar-color:var(--hairline-strong) transparent}.organization-contributions-plot{display:grid;grid-template-columns:25px auto;gap:9px;margin:0}.organization-contributions-weekdays{display:grid;grid-template-rows:repeat(7,12px);gap:3px;padding-top:24px;color:var(--ink-faint);font-family:var(--mono);font-size:9px;line-height:12px;text-align:right}.organization-contributions-months{display:grid;gap:3px;height:20px;color:var(--ink-faint);font-family:var(--mono);font-size:9px;line-height:12px}.organization-contributions-months span{grid-row:1;white-space:nowrap}.organization-contributions-grid{display:grid;grid-template-rows:repeat(7,12px);grid-auto-flow:column;gap:3px}.organization-contribution-cell{display:block;width:12px;height:12px;border:1px solid color-mix(in srgb,var(--hairline) 78%,transparent);border-radius:2px;background:var(--bg-subtle)}.organization-contribution-cell.level-1{border-color:color-mix(in srgb,var(--positive-border) 60%,transparent);background:color-mix(in srgb,var(--positive-bg) 65%,var(--positive-border))}.organization-contribution-cell.level-2{border-color:transparent;background:color-mix(in srgb,var(--positive-text) 35%,var(--positive-bg))}.organization-contribution-cell.level-3{border-color:transparent;background:color-mix(in srgb,var(--positive-text) 60%,var(--positive-bg))}.organization-contribution-cell.level-4{border-color:transparent;background:var(--positive-text)}.organization-contribution-cell.is-outside{visibility:hidden}.organization-contributions-skeleton{width:100%;height:154px;border-radius:6px}@media (max-width: 960px){.organization-hero{grid-template-columns:1fr;align-items:start;gap:28px}.organization-contributions-plot{margin:0 auto}.organization-contributions-scroll{width:100%;max-width:100%;margin-left:0}.organization-contributions-legend{justify-content:center;width:min(100%,826px);margin:8px auto 0}}@media (max-width: 640px){.organization-hero{margin-bottom:28px}.organization-contributions{max-width:calc(100vw - 28px)}}.tag-chip{display:inline-flex;align-items:center;gap:5px;padding:3px 9px;font-family:var(--mono);font-size:11px;font-weight:500;border-radius:4px;cursor:pointer;transition:filter .15s,transform .15s;white-space:nowrap;border:1px solid transparent}.tag-chip:hover{filter:brightness(.96);transform:translateY(-1px)}.tag-chip .dot{width:5px;height:5px;border-radius:50%}.paper-tags--clamped .tag-chip{line-height:16px}.tag-hero{padding:48px 0 32px;border-bottom:1px solid var(--hairline);margin-bottom:32px}.tag-hero-eyebrow{font-family:var(--mono);font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-faint);margin-bottom:12px;display:flex;align-items:center;gap:8px}.tag-hero-title{font-family:var(--serif);font-size:56px;font-weight:500;letter-spacing:-.025em;line-height:1;margin-bottom:16px;overflow-wrap:break-word}.tag-hero-meta{display:flex;gap:32px;margin-top:24px;font-family:var(--mono);font-size:12px;color:var(--ink-soft)}.tag-hero-meta .stat{display:flex;flex-direction:column;gap:4px}.tag-hero-meta .stat .label{font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-faint)}.tag-hero-meta .stat .value{font-family:var(--serif);font-size:22px;font-weight:500;color:var(--ink)}.tag-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:0;border-top:1px solid var(--hairline)}.tag-cell{padding:20px 24px;border-bottom:1px solid var(--hairline);border-right:1px solid var(--hairline);cursor:pointer;transition:background .15s;display:flex;flex-direction:column;gap:8px}.tag-cell:nth-child(3n){border-right:none}.tag-cell:hover{background:var(--bg-elevated)}.tag-cell .name{font-family:var(--serif);font-size:18px;font-weight:500;display:flex;align-items:center;gap:8px}.tag-cell .name .dot{width:8px;height:8px;border-radius:50%}.tag-cell .meta{font-family:var(--mono);font-size:11px;color:var(--ink-faint);display:flex;gap:12px}.tag-hero-meta .stat .value small{margin-left:2px;font-family:var(--mono);font-size:10px;font-weight:500;color:var(--ink-faint)}.framework-category{margin-top:32px}.framework-category-head{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;margin-bottom:16px}.framework-category-blurb{font-family:var(--serif);font-size:14px;line-height:1.55;color:var(--ink-soft);max-width:720px;margin:0}.framework-category-meta{font-family:var(--mono);font-size:11px;color:var(--ink-faint);white-space:nowrap}.framework-guide-link{display:inline-block;margin-top:8px;font-family:var(--mono);font-size:11px;color:var(--accent-text);text-decoration:none}.framework-guide-link:hover{text-decoration:underline}.framework-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px}.framework-card{border:1px solid var(--hairline);background:var(--bg-elevated);border-radius:6px;padding:18px 22px;scroll-margin-top:24px;display:flex;flex-direction:column;gap:12px;transition:border-color .15s}.framework-card:hover{border-color:var(--ink)}.framework-card-clickable{cursor:pointer}.framework-card-clickable:focus-visible{border-color:var(--ink);outline:2px solid var(--accent);outline-offset:2px}.framework-card-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}.framework-card-name{font-family:var(--serif);font-size:20px;font-weight:500;letter-spacing:-.01em;margin:0;color:var(--ink)}.framework-card-org{font-family:var(--mono);font-size:11px;color:var(--ink-faint);margin-top:4px}.framework-platform-row{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-end}.framework-platform-chip{font-family:var(--mono);font-size:10px;letter-spacing:.03em;text-transform:uppercase;padding:3px 8px;border-radius:3px;white-space:nowrap}.framework-card-desc{font-family:var(--sans);font-size:14px;line-height:1.55;color:var(--ink-soft);margin:0}.framework-card-when{font-family:var(--serif);font-style:italic;font-size:13px;line-height:1.5;color:var(--ink-soft);padding-top:4px;border-top:1px solid var(--hairline)}.framework-card-when-label{display:block;font-family:var(--mono);font-size:10px;font-style:normal;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-faint);margin-bottom:4px}.framework-card-links{display:flex;flex-wrap:wrap;gap:10px;margin-top:auto}.framework-link{display:inline-flex;align-items:center;gap:6px;font-family:var(--mono);font-size:11px;color:var(--accent-text);text-decoration:none;padding:4px 10px;border:1px solid var(--hairline);border-radius:4px;transition:border-color .15s,background .15s}.framework-link:hover{border-color:var(--ink);background:var(--bg-subtle)}.framework-link-disabled,.framework-link-disabled:hover{color:var(--ink-faint);background:transparent;border-color:var(--hairline);cursor:not-allowed}@media (max-width: 880px){.tag-grid{grid-template-columns:repeat(2,1fr)}.tag-cell:nth-child(3n){border-right:1px solid var(--hairline)}.tag-cell:nth-child(2n){border-right:none}.framework-category-head{flex-direction:column;gap:8px}.framework-card-head{flex-direction:column;gap:10px}.framework-platform-row{justify-content:flex-start}.tag-hero-title{font-size:40px}}@media (max-width: 640px){.tag-hero{padding:32px 0 24px;margin-bottom:24px}.tag-hero-title{font-size:30px}.tag-grid{grid-template-columns:1fr}.tag-cell{padding:16px;border-right:none!important}.framework-grid{grid-template-columns:1fr}.tag-hero-meta{gap:20px;flex-wrap:wrap}}.task-hero-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(320px,480px);gap:48px;align-items:start}.task-figure-card{background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:6px;padding:16px 16px 12px;margin:0;box-shadow:0 1px #00000005}.task-figure-img-wrap{width:100%;background:var(--bg);border-radius:4px;overflow:hidden;line-height:0}.task-figure-img{width:100%;height:auto;display:block}.task-figure-card--compact .task-figure-img{width:50%;margin:0 auto}.task-figure-card figcaption{font-family:var(--serif);font-style:italic;font-size:12px;color:var(--ink-faint);text-align:center;margin-top:10px;border-top:1px solid var(--hairline);padding-top:10px}.task-image-credit{color:var(--ink-faint);font-family:var(--mono);font-size:10px;font-style:normal}.task-image-credit p{margin:0}.task-image-credit a{color:inherit;text-decoration:underline;text-underline-offset:2px}.task-image-credit a:hover{color:var(--accent-text)}@media (max-width: 900px){.task-hero-grid{grid-template-columns:1fr;gap:24px}}.taxonomy-suggestion-cell{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;border-top:0;border-left:0;background:transparent;color:var(--ink-soft);text-align:left}.taxonomy-suggestion-cell .name{font-style:italic}.taxonomy-suggestion-icon{width:14px;height:14px}.task-page-grid{display:grid;grid-template-columns:1fr 260px;gap:56px;align-items:start}.task-explainer{font-family:var(--serif);font-size:17px;line-height:1.55;color:var(--ink);max-width:720px;margin-top:16px;margin-bottom:28px;text-wrap:pretty}.task-explainer p{margin:0 0 12px}.task-explainer p:last-child{margin-bottom:0}.task-explainer a{color:var(--accent-text);text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px}.task-explainer a:hover{color:var(--accent)}.task-explainer strong{color:var(--ink);font-weight:600}.task-explainer em{font-style:italic}.task-explainer code{font-family:var(--mono);font-size:.9em;background:var(--bg-elevated);padding:1px 5px;border-radius:3px}.task-research-trends{max-width:760px;margin:-8px 0 28px;border-left:2px solid var(--accent);background:var(--bg-elevated)}.task-research-trends-item{border-bottom:0}.task-research-trends-trigger{padding:18px 20px;color:var(--accent-text)}.task-research-trends-trigger:hover{text-decoration:none}.task-research-trends-trigger svg{width:16px;height:16px}.task-research-trends-title{font-family:var(--mono);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--accent-text)}.task-research-trends-content{padding:0 20px 16px}.task-research-trends ul{margin:0;padding-left:19px}.task-research-trends li{padding-left:4px;font-family:var(--serif);font-size:15px;line-height:1.5;color:var(--ink)}.task-research-trends li+li{margin-top:8px}.task-research-trends li::marker{color:var(--accent-text)}.task-research-trends p{margin:0}.task-research-trends a{color:var(--accent-text);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.task-quickstats{display:flex;gap:28px;font-family:var(--mono);font-size:11px;color:var(--ink-faint);letter-spacing:.05em;padding-bottom:14px;margin-bottom:0;border-bottom:1px solid var(--accent)}.task-quickstats .num{color:var(--ink);font-weight:600;font-size:12px;margin-right:5px;font-feature-settings:"tnum"}.task-framework-links{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin-top:14px}.task-framework-links-label{font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-faint);font-weight:600}.task-framework-link{display:inline-flex;align-items:center;gap:6px;font-family:var(--mono);font-size:12px;color:var(--ink);text-decoration:none;padding:4px 10px;border:1px solid var(--hairline);border-radius:999px;background:var(--bg-elevated);transition:color .15s,border-color .15s}.task-framework-link:hover{color:var(--accent-text);border-color:var(--accent)}.task-framework-link-stars{color:var(--ink-faint);font-size:11px}.task-side{position:sticky;top:100px;font-size:13px}.side-block{margin-bottom:28px}.side-block-num{font-family:var(--mono);font-size:10px;color:var(--accent-text);letter-spacing:.1em;margin-bottom:4px}.side-block-label{font-family:var(--mono);font-size:12px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink);font-weight:600;padding-bottom:8px;border-bottom:1px solid var(--hairline);margin-bottom:10px}.side-link-row{display:flex;justify-content:space-between;align-items:baseline;padding:5px 0;cursor:pointer;font-family:var(--serif);font-size:14px}.side-link-row:hover{color:var(--accent-text)}.side-link-row .count{font-family:var(--mono);font-size:11px;color:var(--ink-faint)}.side-domain-pill{font-family:var(--mono);font-size:11px;color:var(--accent-text);padding:6px 0}.side-method-row{display:flex;justify-content:space-between;align-items:center;padding:4px 0}.side-method-row .num{font-family:var(--mono);font-size:10.5px;color:var(--ink-faint)}.task-section-head{margin-top:28px;margin-bottom:14px}.task-section-eyebrow{font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--accent-text);margin-bottom:6px}.task-section-title{font-family:var(--mono);font-size:18px;font-weight:600;color:var(--ink);letter-spacing:.04em;text-transform:uppercase;display:flex;align-items:baseline;gap:10px}.task-section-title .meta{font-family:var(--mono);font-size:11px;color:var(--ink-faint);font-weight:400;letter-spacing:.05em;text-transform:none}.subtask-section{margin-bottom:24px}.subtask-section+.subtask-section{margin-top:8px}.subtask-head{display:flex;align-items:baseline;gap:10px;margin:18px 0 10px}.subtask-head-name{font-family:var(--mono);font-size:14px;font-weight:600;color:var(--ink);letter-spacing:.04em;text-transform:uppercase;text-decoration:none;transition:color .15s}.subtask-head-name:hover{color:var(--accent-text)}.subtask-head-meta{font-family:var(--mono);font-size:11px;color:var(--ink-faint);letter-spacing:.05em}.subtask-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;align-items:start}.subtask-grid .subtask-section{margin-bottom:0;border:1px solid var(--hairline);background:var(--bg-elevated);border-radius:6px;padding:12px 14px 10px}.subtask-grid .subtask-section+.subtask-section{margin-top:0}.subtask-grid .subtask-head{margin:0 0 8px;padding-bottom:8px;border-bottom:1px solid var(--hairline)}.subtask-grid .subtask-head-name{font-size:12px}.subtask-grid .subtask-head-meta{font-size:10px}.subtask-summary{display:flex;flex-direction:column;gap:7px;min-height:86px;color:var(--ink-soft);text-decoration:none;font-family:var(--mono);font-size:10px;line-height:1.4;letter-spacing:.05em;text-transform:uppercase}.subtask-summary:hover{color:var(--ink)}.subtask-summary-desc{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:3;font-family:var(--serif);font-size:13px;line-height:1.35;letter-spacing:0;text-transform:none;color:var(--ink-soft)}.subtask-grid .bench-row{display:grid;grid-template-columns:22px 1fr 16px;gap:10px;align-items:center;border:0;background:transparent;border-radius:0;padding:8px 0;margin-bottom:0;border-bottom:1px dashed var(--hairline);transition:none}.subtask-grid .bench-row:last-of-type{border-bottom:0}.subtask-grid .bench-row:hover{border-color:transparent}.subtask-grid .bench-row:hover .bench-row-name{color:var(--accent-text)}.subtask-grid .bench-row-num{font-size:10px}.subtask-grid .bench-row-name{font-size:13.5px;margin-bottom:2px;line-height:1.2}.subtask-grid .bench-row-sub{font-size:9.5px;letter-spacing:.06em}.subtask-grid .bench-row-arrow{font-size:14px}.subtask-grid .bench-show-more{font-size:10px;padding:6px 0 0;margin-top:2px}.bench-card{border:1px solid var(--hairline);background:var(--bg-elevated);border-radius:6px;padding:18px 22px;margin-bottom:14px;cursor:pointer;transition:border-color .15s}.bench-card:hover{border-color:var(--ink)}.bench-head{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:14px;gap:16px}.bench-name{font-family:var(--mono);font-size:14px;font-weight:600;letter-spacing:.02em;text-transform:uppercase;color:var(--ink)}.bench-sub{font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-faint);margin-top:4px}.bench-sota-value{font-family:var(--serif);font-size:36px;font-weight:500;color:var(--accent);font-feature-settings:"tnum";line-height:1}.bench-sota-tag{font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-faint);text-align:right;margin-top:4px}.bench-task-tag{font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--accent-text)}.domain-mega-title{font-family:var(--mono);font-size:56px;font-weight:600;letter-spacing:-.01em;line-height:1;text-transform:uppercase;margin-bottom:0;color:var(--ink);overflow-wrap:break-word}.benchmark-trend-table{border-top:1px solid var(--hairline)}.benchmark-trend-head,.benchmark-trend-row{display:grid;grid-template-columns:124px minmax(150px,.8fr) minmax(150px,.9fr) minmax(200px,1.3fr) 44px 78px;gap:20px;align-items:center}.benchmark-trend-head{padding:9px 16px;border-bottom:1px solid var(--hairline);font-family:var(--mono);font-size:9.5px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-faint)}.benchmark-trend-row{min-height:92px;padding:12px 16px;border-bottom:1px solid var(--hairline);background:transparent;transition:background .15s,border-color .15s}.benchmark-trend-row:hover{background:var(--bg-elevated);border-color:var(--hairline-strong)}.benchmark-trend-row:hover .bench-row-name{color:var(--accent-text)}.benchmark-trend-cell{min-width:0}.benchmark-trend-sparkline{display:block;width:112px;height:42px;overflow:visible}.benchmark-trend-axis{stroke:var(--hairline-strong);stroke-width:.8;stroke-dasharray:1.5 2.5;vector-effect:non-scaling-stroke}.benchmark-trend-area{fill:var(--accent-soft);opacity:.68}.benchmark-trend-line{fill:none;stroke:var(--accent);stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}.benchmark-trend-dot{fill:var(--bg-elevated);stroke:var(--accent);stroke-width:1.8;vector-effect:non-scaling-stroke}.benchmark-trend-point{cursor:crosshair;outline:none}.benchmark-trend-point-hit{fill:transparent}.benchmark-trend-point-mark{fill:var(--bg-elevated);stroke:var(--accent);stroke-width:1.25;opacity:0;transition:opacity .12s,r .12s;vector-effect:non-scaling-stroke}.benchmark-trend-point:hover .benchmark-trend-point-mark,.benchmark-trend-point:focus .benchmark-trend-point-mark{opacity:1;r:2.3px}.benchmark-trend-tooltip rect{fill:var(--ink);opacity:.94}.benchmark-trend-tooltip text{fill:var(--bg);font-family:var(--mono);font-size:3.2px;letter-spacing:.01em}.benchmark-trend-tooltip .benchmark-trend-tooltip-value{font-weight:700}.benchmark-trend-meta{display:flex;align-items:center;gap:6px;margin-top:3px;font-family:var(--mono);font-size:8.5px;letter-spacing:.035em;color:var(--ink-faint);white-space:nowrap}.benchmark-trend-meta strong{color:var(--ink-soft);font-weight:600}.benchmark-trend-change{padding:1px 4px;border-radius:999px;font-size:8px;font-weight:600}.benchmark-trend-change.is-up,.benchmark-trend-change.is-new{color:var(--positive-text);background:var(--positive-bg)}.benchmark-trend-change.is-down{color:var(--negative-text);background:var(--negative-bg)}.benchmark-trend-benchmark{min-width:0}.benchmark-trend-row .bench-row-name{display:block;margin-bottom:5px}.benchmark-trend-row .bench-row-best{width:100%;justify-content:flex-start;text-align:left}.bench-row-best-empty{color:var(--ink-faint);font-family:var(--mono)}.bench-row-paper{min-width:0;font-family:var(--serif);font-size:14px;line-height:1.35}.bench-row-paper a{color:var(--accent-text)}.bench-row-paper a:hover{text-decoration:underline}.bench-row-code{display:flex;justify-content:center}.bench-row-code a{display:inline-flex;color:var(--ink-soft);transition:color .15s,transform .15s}.bench-row-code a:hover{color:var(--accent-text);transform:translateY(-1px)}.bench-row-compare{display:flex;justify-content:center}.bench-row-compare a{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:30px;padding:0 10px;border:1px solid var(--accent);border-radius:999px;color:var(--accent-text);font-family:var(--mono);font-size:9px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;white-space:nowrap;transition:color .15s,background .15s}.bench-row-compare a svg{transition:transform .15s}.bench-row-compare a:hover{color:var(--bg);background:var(--accent)}.bench-row-compare a:hover svg{transform:translate(2px)}.bench-row-compare a:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.bench-row{display:grid;grid-template-columns:36px 1fr auto 28px;gap:18px;align-items:center;padding:16px 18px;border:1px solid var(--hairline);background:var(--bg-elevated);border-radius:6px;margin-bottom:8px;cursor:pointer;transition:border-color .15s,transform .15s}.bench-row:hover{border-color:var(--ink)}.bench-row:hover .bench-row-arrow{color:var(--accent-text);transform:translate(3px)}.bench-row-num{font-family:var(--mono);font-size:11px;color:var(--ink-faint);letter-spacing:.05em;font-feature-settings:"tnum"}.bench-row-name{font-family:var(--serif);font-size:18px;font-weight:500;color:var(--ink);letter-spacing:-.005em;margin-bottom:4px}.bench-row-sub{display:flex;align-items:center;gap:8px;font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-faint)}.bench-row-sub strong{color:var(--ink-soft);font-weight:600}.bench-row-sub .dot-sep{color:var(--hairline-strong)}.bench-row-sota{text-align:right}.bench-row-sota-value{font-family:var(--serif);font-size:22px;font-weight:500;color:var(--accent-text);font-feature-settings:"tnum";line-height:1}.bench-row-sota-tag{font-family:var(--mono);font-size:9.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-faint);margin-top:4px}.bench-row-arrow{font-family:var(--serif);font-size:18px;color:var(--hairline-strong);text-align:center;transition:color .15s,transform .15s}.bench-row-best{display:flex;align-items:center;justify-content:flex-end;gap:6px;max-width:240px;text-align:right}.bench-row-best-icon{color:var(--accent-text);flex:0 0 auto}.bench-row-best-name{font-family:var(--serif);font-size:14px;color:var(--ink-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bench-show-more{font-family:var(--mono);font-size:11px;letter-spacing:.05em;color:var(--ink-faint);background:transparent;border:0;padding:8px 2px 2px;margin-top:4px;cursor:pointer;text-transform:lowercase;transition:color .15s}.bench-show-more:hover{color:var(--accent-text)}.bm-action-btn{display:inline-flex;align-items:center;gap:8px;padding:8px 14px;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);font-family:var(--sans);font-size:13px;font-style:normal;color:var(--ink);cursor:pointer;transition:border-color .15s}.bm-action-btn:hover{border-color:var(--ink)}.bm-action-btn svg{display:block}@media (max-width: 880px){.task-page-grid{grid-template-columns:1fr;gap:32px}.task-side{position:static;top:auto;order:-1}.subtask-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.domain-mega-title{font-size:40px}.bench-row{grid-template-columns:28px 1fr auto;gap:12px;padding:14px}.bench-row>.bench-row-arrow{display:none}.bench-row-best{max-width:130px}.bench-row-best-name{font-size:12.5px}.benchmark-trend-head,.benchmark-trend-row{grid-template-columns:112px minmax(130px,.8fr) minmax(120px,.8fr) minmax(160px,1.2fr) 36px 72px;gap:14px}.benchmark-trend-sparkline{width:104px}}@media (max-width: 640px){.domain-mega-title{font-size:30px}.subtask-grid{grid-template-columns:1fr}.benchmark-trend-head{display:none}.benchmark-trend-row{grid-template-columns:100px minmax(0,1fr) 28px;grid-template-areas:"trend benchmark code" "trend best code" "trend paper paper" "trend compare compare";gap:4px 12px;min-height:120px;padding:12px 4px}.benchmark-trend-cell{grid-area:trend}.benchmark-trend-benchmark{grid-area:benchmark}.benchmark-trend-row .bench-row-best{grid-area:best;justify-content:flex-start;max-width:none;text-align:left}.benchmark-trend-row .bench-row-paper{grid-area:paper}.benchmark-trend-row .bench-row-code{grid-area:code}.benchmark-trend-row .bench-row-compare{grid-area:compare;justify-content:flex-start;margin-top:4px}.bench-row-compare a{min-height:26px;padding:0 9px;font-size:8.5px}.benchmark-trend-sparkline{width:96px}.benchmark-trend-meta{flex-wrap:wrap;gap:3px;white-space:normal}.task-quickstats{flex-wrap:wrap;gap:16px}}.paper-meta-line .arxiv-id{color:var(--accent-text)}.paper-authors .institution{font-style:italic;color:var(--ink-faint)}.paper-tags--clamped .method-chip{line-height:16px}.method-hero-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(360px,560px);gap:56px;align-items:start}.method-hero-grid--wide-figure{grid-template-columns:minmax(0,1fr) minmax(480px,640px)}.method-figure-card{background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:6px;padding:16px 16px 12px;margin:0;box-shadow:0 1px #00000005}.method-figure-svg{width:100%;display:block}.method-figure-svg--schematic{aspect-ratio:360 / 420}.method-figure-img{width:100%;height:auto;display:block}.method-figure-svg--compact .method-figure-img{width:50%;margin:0 auto}.method-figure-svg--scaled-80 .method-figure-img{width:80%;margin:0 auto}.method-figure-card figcaption{font-family:var(--serif);font-style:italic;font-size:12px;color:var(--ink-faint);text-align:center;margin-top:10px;border-top:1px solid var(--hairline);padding-top:10px}.method-image-credit{color:var(--ink-faint);font-family:var(--mono);font-size:10px;font-style:normal}.method-image-credit p{margin:0}.method-image-credit a{color:inherit;text-decoration:underline;text-underline-offset:2px}.method-image-credit a:hover{color:var(--accent-text)}.method-description{font-family:var(--serif);font-size:17px;color:var(--ink-soft);max-width:720px;line-height:1.6;margin-top:16px;text-wrap:pretty}.method-description p{margin:0 0 12px}.method-description p:last-child{margin-bottom:0}.method-description a{color:var(--accent-text);text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px}.method-description a:hover{color:var(--accent)}.method-description strong{color:var(--ink);font-weight:600}.method-description code{font-family:var(--mono);font-size:.9em;background:var(--bg-elevated);padding:1px 5px;border-radius:3px}.method-description ul,.method-description ol{padding-left:22px;margin:0 0 12px}.method-description ul{list-style-type:disc}.method-description ol{list-style-type:decimal}.method-description li{margin-bottom:4px}.method-description .katex-display{margin:14px 0;overflow-x:auto;overflow-y:hidden;padding:4px 0}.method-description .katex{font-size:1em}.method-source{margin-top:22px;display:flex;flex-direction:column;gap:6px;max-width:720px}.method-source-label{font-family:var(--mono);font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-faint)}.method-source-link{display:flex;flex-direction:column;gap:2px;padding:12px 14px;background:var(--bg-elevated);border:1px solid var(--hairline);border-left:3px solid var(--accent-text);border-radius:3px;cursor:pointer;transition:background .12s,border-color .12s;text-decoration:none}.method-source-link:not(.is-static):hover{background:var(--bg-subtle);border-color:var(--hairline-strong);border-left-color:var(--accent)}.method-source-link.is-static{cursor:default}.method-source-title{font-family:var(--serif);font-size:17px;font-weight:500;color:var(--ink);letter-spacing:-.005em}.method-source-link:not(.is-static):hover .method-source-title{text-decoration:underline;text-underline-offset:3px;text-decoration-thickness:1px}.method-source-meta{font-family:var(--mono);font-size:11px;color:var(--ink-faint)}@media (max-width: 1024px){.method-hero-grid{grid-template-columns:1fr;gap:24px}.method-figure-card{max-width:560px}.method-hero-grid--wide-figure .method-figure-card{max-width:640px}}.method-hero-title{font-family:var(--mono);font-size:48px;letter-spacing:-.01em}.method-trending-icon{flex:0 0 auto;color:var(--accent-text);fill:color-mix(in srgb,var(--accent-text) 18%,transparent)}.method-trend-score{color:var(--accent-text);font-weight:600}.method-trend-panel{margin-top:20px;padding-top:14px;border-top:1px solid var(--hairline-strong)}.method-trend-header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:4px}.method-trend-eyebrow{margin-bottom:5px;font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--accent-text)}.method-trend-header p{margin:3px 0 0;font-family:var(--mono);font-size:11px;color:var(--ink-faint)}.method-trend-summary{display:flex;flex-direction:column;align-items:flex-end;flex:0 0 auto;font-family:var(--mono);font-size:10px;color:var(--ink-faint)}.method-trend-summary>strong{font-family:var(--serif);font-size:19px;font-weight:500;line-height:1;color:var(--ink)}.method-usage-chart-wrap{position:relative;width:100%}.method-usage-chart{display:block;width:100%;height:auto;overflow:visible}.method-usage-gridline{stroke:var(--hairline);stroke-width:1}.method-usage-y-label,.method-usage-x-label{fill:var(--ink-faint);font-family:var(--mono);font-size:9px}.method-usage-bar-hit{fill:transparent}.method-usage-bar-mark{fill:color-mix(in srgb,var(--accent-text) 48%,var(--bg));transition:fill .12s}.method-usage-bar.is-current .method-usage-bar-mark{opacity:.55}.method-usage-bar:hover .method-usage-bar-mark,.method-usage-bar:focus .method-usage-bar-mark,.method-usage-bar.is-active .method-usage-bar-mark{fill:var(--accent-text)}.method-usage-bar:focus{outline:none}.method-usage-tooltip{position:absolute;top:4px;right:8px;display:flex;gap:8px;padding:5px 8px;border:1px solid var(--hairline-strong);background:var(--bg);font-family:var(--mono);font-size:10px;color:var(--ink-soft);pointer-events:none}.method-trend-skeleton{margin-top:20px}.method-trend-note{margin:6px 0 0;color:var(--ink-faint);font-family:var(--mono);font-size:10px}@media (max-width: 640px){.method-trend-header{flex-direction:column;gap:12px}.method-trend-summary{align-items:flex-start}}.method-chip{display:inline-flex;align-items:center;padding:4px 10px;font-family:var(--mono);font-size:11px;font-weight:500;color:var(--ink);background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:4px;cursor:pointer;transition:all .15s;white-space:nowrap}.method-chip:hover{border-color:var(--ink);background:var(--bg-subtle)}.side-method-row .method-chip{font-size:10.5px;padding:3px 8px}@media (max-width: 880px){.method-hero-title{font-size:40px}}@media (max-width: 640px){.method-hero-title{font-size:30px}}.filter-row{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-bottom:24px;padding:12px 16px;border:1px solid var(--hairline);border-radius:8px;background:var(--bg-elevated)}.filter-row .label{margin-right:8px;color:var(--ink-faint);font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase}.search-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#1a181466;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);z-index:100;display:flex;align-items:flex-start;justify-content:center;padding-top:100px}.search-modal{width:640px;max-width:calc(100vw - 32px);background:var(--bg);border:1px solid var(--hairline-strong);border-radius:12px;box-shadow:0 20px 60px #00000026;overflow:hidden}.search-modal-input{width:100%;padding:18px 20px;font-size:16px;font-family:var(--serif);border:none;background:transparent;outline:none;border-bottom:1px solid var(--hairline);color:var(--ink)}.search-modal-input::-moz-placeholder{color:var(--ink-faint);font-style:italic}.search-modal-input::placeholder{color:var(--ink-faint);font-style:italic}.search-results{max-height:480px;overflow-y:auto;padding:8px}.search-empty{padding:32px;text-align:center;color:var(--ink-faint);font-family:var(--serif);font-style:italic}.search-section-label{font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-faint);padding:10px 12px 6px}.search-result{display:flex;flex-direction:column;padding:10px 12px;border-radius:6px;cursor:pointer;gap:4px}.search-result:hover,.search-result.focused{background:var(--bg-subtle)}.search-result-title{font-family:var(--serif);font-size:14.5px;font-weight:500;line-height:1.3}.search-result-meta{font-family:var(--mono);font-size:10.5px;color:var(--ink-faint);display:flex;gap:10px}.search-result-tag{display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:6px;cursor:pointer}.search-result-tag:hover,.search-result-tag.focused{background:var(--bg-subtle)}.search-result-tag .name{font-family:var(--mono);font-size:12px}.search-result-tag .count{margin-left:auto;font-family:var(--mono);font-size:10px;color:var(--ink-faint)}.search-paper-pagination{display:flex;align-items:center;justify-content:space-between;padding:10px 12px 6px;border-top:1px solid var(--hairline);font-family:var(--mono);font-size:10px;color:var(--ink-faint)}.search-paper-pagination button{border:1px solid var(--hairline-strong);border-radius:5px;background:var(--bg);color:var(--ink-soft);padding:5px 9px;font:inherit;cursor:pointer}.search-paper-pagination button:hover:not(:disabled){background:var(--bg-subtle);color:var(--ink)}.search-paper-pagination button:disabled{opacity:.4;cursor:default}@media (max-width: 640px){.search-modal-input{font-size:16px;padding:14px 16px}}.search-ask-row{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;border-radius:6px;text-align:left;color:var(--ink)}.search-ask-row:hover{background:var(--bg-subtle)}.search-ask-chip{display:inline-flex;align-items:center;font-family:var(--mono);font-size:10.5px;color:var(--accent-text);background:var(--accent-soft);border-radius:5px;padding:2px 7px;flex:none}.search-ask-text{flex:1;min-width:0;font-family:var(--serif);font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.search-ask-row kbd{font-family:var(--sans);font-size:11px;color:var(--ink-faint);border:1px solid var(--hairline);border-radius:5px;padding:1px 6px}.search-empty-sub{display:block;margin-top:10px;font-family:var(--sans);font-style:normal;font-size:12px;color:var(--ink-faint)}.settings-section{border:1px solid var(--hairline);border-radius:10px;padding:20px 22px;margin-top:8px;max-width:760px}.settings-section-title{font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--ink-faint);margin:0 0 14px}.settings-note-flush{margin-top:0;padding-top:0;border-top:0}.settings-billing-loading{color:var(--ink-soft);font-size:13px}.settings-billing,.settings-billing-connect{display:flex;flex-direction:column;gap:14px}.settings-provider-grid{display:grid;gap:14px}.settings-provider-card{display:flex;flex-direction:column;gap:14px;padding:16px;border:1px solid var(--hairline);border-radius:8px;background:var(--bg-subtle)}.settings-provider-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.settings-provider-heading h3{margin:0;color:var(--ink);font-size:16px;font-weight:650}.settings-provider-heading p{margin:3px 0 0;color:var(--ink-soft);font-size:12px}.settings-usage-row{display:flex;flex-direction:column;gap:9px;padding:13px;border:1px solid var(--hairline);border-radius:7px;background:var(--bg-elevated)}.settings-usage-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.settings-usage-heading strong{flex-shrink:0;color:var(--ink);font-size:14px}.settings-usage-track{height:7px;overflow:hidden;border-radius:999px;background:var(--hairline)}.settings-usage-track>span{display:block;height:100%;border-radius:inherit;background:var(--accent)}.settings-limit-note{margin:0;color:var(--danger, #b42318);font-size:12px;line-height:1.45}.settings-byok-controls{display:flex;flex-direction:column;gap:10px;padding-top:2px}.settings-byok-controls form{display:flex;flex-direction:column;gap:10px}.settings-byok-controls input{width:100%;border:1px solid var(--hairline-strong);border-radius:7px;padding:10px 12px;color:var(--ink);background:var(--bg-elevated);font:inherit}.settings-fallback-control{display:flex;align-items:flex-start;gap:11px;cursor:pointer}.settings-fallback-control>span{display:flex;flex-direction:column;gap:4px}.settings-fallback-control strong{color:var(--ink);font-size:12px;line-height:1.4}.settings-fallback-control small{color:var(--ink-soft);font-size:11px;line-height:1.45}.settings-plan-row{display:flex;justify-content:space-between;align-items:flex-start;gap:20px}.settings-connected-badge{border-radius:999px;padding:4px 9px;color:var(--accent-text);background:var(--accent-soft);font-size:11px;font-weight:600}.settings-billing-help{color:var(--ink-soft);font-size:11px;margin:0;line-height:1.5}.settings-billing-actions{display:flex;flex-wrap:wrap;gap:8px}.settings-billing-actions .button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:34px;padding:7px 11px;border:1px solid var(--hairline-strong);border-radius:7px;color:var(--ink);background:var(--bg-elevated);font-size:12px;font-weight:600;text-decoration:none}.settings-billing-actions .button:hover{background:var(--bg-subtle)}.settings-billing-actions .button-primary{border-color:var(--accent);color:var(--accent-text);background:var(--accent-soft)}.settings-billing-actions .button:disabled{cursor:not-allowed;opacity:.55}.settings-billing-actions svg{width:12px;height:12px}.settings-token-label{color:var(--ink);font-size:12px;font-weight:600;margin-bottom:-8px}.settings-billing-connect input{width:100%;border:1px solid var(--hairline-strong);border-radius:7px;padding:10px 12px;color:var(--ink);background:var(--bg-elevated);font:inherit}.settings-billing-select{width:100%;min-height:42px;padding:9px 34px 9px 12px;border:1px solid var(--border);border-radius:7px;background:var(--bg-elevated);color:var(--ink);font:inherit}.settings-billing-select:focus{outline:2px solid var(--accent);outline-offset:1px}.settings-billing-select:disabled{cursor:wait;opacity:.7}.settings-billing-connect input:focus{border-color:var(--accent);outline:2px solid var(--accent-soft)}.settings-token-error{color:var(--danger, #b42318);font-size:12px}.theme-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.theme-option{display:flex;align-items:flex-start;gap:10px;min-width:0;padding:12px;border:1px solid var(--hairline);border-radius:7px;background:var(--bg-elevated);color:var(--ink-soft);text-align:left;transition:background .15s,border-color .15s,color .15s}.theme-option:hover{border-color:var(--hairline-strong);background:var(--bg-subtle);color:var(--ink)}.theme-option.is-selected{border-color:var(--accent);background:var(--accent-soft);color:var(--accent-text)}.theme-option:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.theme-option>svg{width:16px;height:16px;margin-top:1px;flex-shrink:0}.theme-option-copy{display:flex;flex-direction:column;gap:2px;min-width:0}.theme-option-label{color:var(--ink);font-size:13px;font-weight:600}.theme-option-desc{color:var(--ink-soft);font-size:11px;line-height:1.35}.theme-option.is-selected .theme-option-label,.theme-option.is-selected .theme-option-desc{color:var(--accent-text)}.settings-row{display:flex;align-items:flex-start;justify-content:space-between;gap:24px}.settings-row-text{display:flex;flex-direction:column;gap:4px;cursor:pointer}.settings-row-label{font-size:15px;font-weight:500;color:var(--ink)}.settings-row-desc{font-size:13px;color:var(--ink-soft);line-height:1.5;max-width:460px}.settings-note{margin-top:16px;padding-top:16px;border-top:1px solid var(--hairline);font-size:13px;color:var(--ink-soft);line-height:1.5}.settings-note-action{margin-top:10px}.closed-eval-tooltip-link,.external-eval-tooltip-link{font-weight:600;text-decoration:underline;text-underline-offset:2px}@media (max-width: 640px){.theme-options{grid-template-columns:1fr}}.saved-area-section{margin-top:28px}.saved-area-section:first-of-type{margin-top:4px}.saved-area-heading{font-family:var(--serif);font-size:22px;font-weight:500;color:var(--ink);margin:0 0 6px;padding-bottom:6px;border-bottom:1px solid var(--hairline-strong)}.saved-task-block{margin-top:16px}.saved-task-row{display:flex;align-items:center;gap:10px;margin-bottom:6px}.saved-task-count{font-size:12px;color:var(--ink-faint)}.saved-signin-panel{display:flex;justify-content:center;padding:80px 0}.saved-bucket-migration{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:24px;padding:14px 16px;border:1px solid var(--info-border);border-radius:6px;background:var(--info-bg);color:var(--info-text)}.saved-bucket-migration p{max-width:760px;font-size:13px;line-height:1.5}.saved-bucket-migration .hf-signin-btn{flex-shrink:0}@media (max-width: 700px){.saved-bucket-migration{align-items:flex-start;flex-direction:column}}.action-btn.is-saved{background:var(--ink);color:var(--bg);border-color:var(--ink)}.action-btn.is-saved:hover{background:color-mix(in oklch,var(--ink) 88%,var(--accent))}.ask-home-new{max-width:640px;margin:0 auto 6px;padding-left:9px;color:var(--ink-faint);font-size:14px;font-weight:700}.ask-home{position:relative;max-width:640px;margin:0 auto 36px;background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:14px;box-shadow:0 1px 2px #1e1c140a,0 12px 34px -18px #1e1c1447;padding:8px}.ask-home-textarea-wrap{position:relative}.ask-home textarea{position:relative;z-index:1;width:100%;border:0;outline:0;resize:none;background:transparent;font-family:var(--serif);font-size:17px;line-height:1.45;color:transparent;caret-color:var(--ink);padding:12px 12px 4px}.ask-home textarea::-moz-placeholder{color:var(--ink-faint)}.ask-home textarea::placeholder{color:var(--ink-faint)}.ask-home-foot{display:flex;align-items:center;justify-content:space-between;padding:4px 6px 4px 12px}.ask-home-provider-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.ask-home-hint{display:flex;align-items:center;gap:7px;font-size:12px;color:var(--ink-soft)}.ask-home-hint svg{color:var(--accent-text)}.ask-home-hint code{font-family:var(--mono);font-size:11px;background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:5px;padding:1px 6px}.chat-page{position:relative;display:flex;overflow:hidden;background:var(--bg)}.chat-main{flex:1;display:flex;flex-direction:column;min-width:0;background:var(--bg)}.chat-topbar{display:flex;align-items:center;gap:14px;padding:10px 24px;border-bottom:1px solid var(--hairline)}.chat-topbar-title{flex:1;min-width:0;font-family:var(--serif);font-size:14px;color:var(--ink-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-empty{flex:1;display:flex;align-items:center;justify-content:center;padding:40px 24px;overflow-y:auto}.chat-empty-inner{max-width:680px;width:100%;text-align:center}.chat-empty-eyebrow{font-family:var(--mono);font-size:11px;letter-spacing:.16em;text-transform:uppercase;color:var(--ink-faint);margin-bottom:18px}.chat-empty-title{font-family:var(--serif);font-weight:500;font-size:44px;line-height:1.05;letter-spacing:-.02em;margin-bottom:14px}.chat-empty-title em{font-style:italic;font-weight:400;color:var(--accent)}.chat-empty-sub{font-family:var(--serif);font-size:16px;line-height:1.5;color:var(--ink-soft);max-width:520px;margin:0 auto 26px;text-wrap:pretty}.chat-staging-access-note{max-width:560px;margin:-12px auto 18px;color:var(--ink-soft);font-size:13px;line-height:1.45}.chat-staging-badge{flex:none;border:1px solid color-mix(in oklch,var(--accent) 36%,var(--hairline));border-radius:999px;padding:3px 7px;color:var(--accent-text);background:color-mix(in oklch,var(--accent) 7%,var(--bg-elevated));font-family:var(--mono);font-size:10px;font-weight:700;letter-spacing:.08em;line-height:1;text-transform:uppercase}.chat-examples{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;margin-top:24px}.chat-example{font-family:var(--serif);font-size:14px;color:var(--ink-soft);background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:999px;padding:8px 16px;transition:border-color .15s,color .15s}.chat-example:hover{border-color:var(--hairline-strong);color:var(--ink)}.chat-paper-inline-highlight{color:var(--accent-text);text-decoration-line:underline;text-decoration-color:color-mix(in oklch,var(--accent) 40%,transparent);text-decoration-thickness:1px;text-underline-offset:2px}.chat-paper-inline-highlight.is-unavailable{color:var(--negative-text);text-decoration-color:var(--negative-border)}@media (max-width: 900px){.chat-empty-title{font-size:34px}}@media (forced-colors: active){.chat-paper-inline-highlight{outline:1px solid CanvasText}}@media (max-width: 560px){.chat-topbar{padding-inline:14px}}@media (min-width: 901px){.app-header-chat .app-header-inner{max-width:none;padding-left:0}.app-header-chat .brand{width:280px;flex:none;justify-content:center}.app-header-chat .nav{margin-left:0}}.chat-sidebar{width:280px;flex:none;background:var(--bg-subtle);border-right:1px solid var(--hairline);display:flex;flex-direction:column;transition:margin-left .2s ease}.chat-sidebar-closed{margin-left:-281px}.chat-sidebar-top{display:flex;align-items:center;gap:8px;padding:14px 12px 8px}.chat-sidebar-top .icon-btn{flex:none}.chat-new-chat{flex:1;display:flex;align-items:center;justify-content:center;gap:8px;padding:9px;background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:8px;font-size:13px;font-weight:500;color:var(--ink);transition:border-color .15s}.chat-new-chat:hover{border-color:var(--hairline-strong)}.chat-sessions{flex:1;overflow-y:auto;padding:4px 8px 20px}.chat-sessions-empty{padding:18px 10px;font-family:var(--serif);font-style:italic;font-size:13px;color:var(--ink-faint)}.chat-session-group{margin-top:14px}.chat-session-group-label{font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-faint);padding:6px 10px}.chat-session{display:flex;align-items:center;gap:6px;width:100%;text-align:left;padding:7px 10px;border-radius:7px;font-size:13px;color:var(--ink-soft);transition:background .12s,color .12s}.chat-session:hover{background:var(--hairline);color:var(--ink)}.chat-session-active{background:var(--hairline);color:var(--ink);font-weight:500}.chat-session-title{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-session-delete{display:none;align-items:center;color:var(--ink-faint);padding:2px;border-radius:4px;flex:none}.chat-session:hover .chat-session-delete{display:inline-flex}.chat-session-delete:hover{color:var(--negative-text)}.chat-session-menu{display:none;border:0;background:transparent;color:inherit;cursor:pointer;padding:0 3px;font-size:17px;line-height:1}.chat-session:hover .chat-session-menu,.chat-session:focus-within .chat-session-menu{display:inline-flex}.chat-session-title-input{min-width:0;flex:1;border:1px solid var(--border);border-radius:4px;background:var(--surface);color:var(--ink);font:inherit;padding:2px 4px}.chat-session-context-menu{position:fixed;z-index:1000;width:150px;padding:4px;border:1px solid var(--border);border-radius:7px;background:var(--surface);box-shadow:0 8px 24px #00000029}.chat-session-context-menu button{width:100%;border:0;border-radius:4px;background:transparent;color:var(--ink);padding:7px 9px;text-align:left;cursor:pointer}.chat-session-context-menu button:hover,.chat-session-context-menu button:focus{background:var(--hairline)}.chat-session-loading,.chat-session-load-error{flex:1;display:flex;align-items:center;justify-content:center;gap:10px;color:var(--ink-soft);font-family:var(--serif);font-size:14px}.chat-session-load-error{flex-direction:column}.chat-session-load-error p{margin:0}.chat-session-load-error button{border:1px solid var(--border);border-radius:5px;padding:7px 12px;background:var(--surface);color:var(--ink);cursor:pointer}.chat-session-load-error button:hover{background:var(--bg-subtle)}.chat-session-error{width:calc(100% - 56px);max-width:820px;margin:12px auto 0;padding:10px 12px;border:1px solid color-mix(in oklch,#c33 35%,var(--hairline));border-radius:8px;color:var(--ink);background:color-mix(in oklch,#c33 8%,var(--bg-elevated));font-size:13px}@media (max-width: 900px){.chat-sidebar{position:absolute;top:0;bottom:0;left:0;z-index:60;box-shadow:0 0 40px #0003}.chat-sidebar-closed{margin-left:0;transform:translate(-101%);box-shadow:none}}.chat-share-button{flex:none;display:inline-flex;align-items:center;gap:7px;min-height:34px;padding:6px 11px;border:1px solid var(--hairline-strong);border-radius:8px;background:var(--bg-elevated);color:var(--ink);font-size:13px;font-weight:600}.chat-share-button:hover:not(:disabled){background:var(--bg-subtle)}.chat-share-button:disabled{cursor:not-allowed;opacity:.55}.chat-share-button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.chat-share-button svg{width:15px;height:15px}.chat-share-toast{position:fixed;top:18px;left:50%;width:min(420px,calc(100vw - 32px));transform:translate(-50%)}.chat-share-dialog-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:110;display:grid;place-items:center;padding:20px;background:#0000006b}.chat-share-dialog{width:min(520px,100%);padding:22px;border:1px solid var(--hairline-strong);border-radius:12px;background:var(--bg-elevated);box-shadow:0 18px 60px #00000038}.chat-share-dialog h2{margin:0 0 8px;font-family:var(--serif);font-size:21px}.chat-share-dialog p{margin:0 0 14px;color:var(--ink-soft)}.chat-share-dialog input{width:100%;padding:9px 10px;border:1px solid var(--hairline-strong);border-radius:7px;background:var(--bg);color:var(--ink);font-family:var(--mono);font-size:12px}.chat-share-dialog input:focus{outline:2px solid var(--accent);outline-offset:2px}.chat-share-dialog button{display:block;margin:16px 0 0 auto;padding:7px 14px;border-radius:7px;background:var(--accent);color:#fff;font-weight:600}@media (max-width: 560px){.chat-share-button{width:34px;padding:6px;justify-content:center}.chat-share-button span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}}.chat-capacity-dialog-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:120;display:grid;place-items:center;padding:20px;background:#0000007a}.chat-capacity-dialog{width:min(500px,100%);padding:24px;border:1px solid var(--hairline-strong);border-radius:12px;background:var(--bg-elevated);box-shadow:0 18px 60px #0000003d}.chat-capacity-dialog h2{margin:0 0 9px;font-family:var(--serif);font-size:22px}.chat-capacity-dialog p{margin:0;color:var(--ink-soft);line-height:1.5}.chat-capacity-countdown{min-height:24px;padding-top:12px;font-size:13px}.chat-capacity-dialog-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:20px}.chat-capacity-dialog-actions button{padding:8px 14px;border-radius:7px;font-weight:600}.chat-capacity-cancel{border:1px solid var(--hairline-strong);background:var(--bg);color:var(--ink)}.chat-capacity-retry{background:var(--accent);color:#fff}.chat-capacity-retry:disabled{cursor:not-allowed;opacity:.5}.chat-capacity-dialog-actions button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.chat-openrouter-usage{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 14px;margin-bottom:7px;color:var(--ink-soft);font-size:11px;line-height:1.4}.chat-openrouter-usage strong{color:var(--ink)}.chat-openrouter-usage a{color:var(--accent-text);font-weight:600}.chat-paused-banner{margin-bottom:.75rem;border:1px solid var(--border);border-radius:.65rem;background:var(--muted);padding:.7rem .85rem;color:var(--muted-foreground);font-size:.875rem;line-height:1.4}.chat-billing-notice{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;margin:0 0 10px;padding:9px 11px;border:1px solid color-mix(in oklch,var(--accent) 24%,var(--hairline));border-radius:9px;color:var(--ink-soft);background:color-mix(in oklch,var(--accent) 5%,var(--bg-elevated));font-size:12px;line-height:1.4}.chat-billing-notice a{flex:none;color:var(--accent-text);font-weight:600;text-decoration:none}.chat-billing-notice a:hover{text-decoration:underline}.chat-billing-notice-actions{display:flex;align-items:center;gap:10px;flex:none}.chat-billing-notice-dismiss{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:6px;color:var(--ink-soft);background:transparent;cursor:pointer}.chat-billing-notice-dismiss:hover{color:var(--ink);background:color-mix(in oklch,var(--ink) 7%,transparent)}.chat-billing-notice-dismiss:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.ask-home>.chat-paper-picker{top:calc(100% + 6px);bottom:auto}.chat-model-picker{position:relative;display:inline-grid;max-width:190px;flex:0 0 auto}.chat-model-picker-sizer,.chat-model-select{min-width:0;max-width:190px;padding:3px 22px 3px 8px;font-family:var(--mono);font-size:11px}.chat-model-picker-sizer{visibility:hidden;overflow:hidden;white-space:nowrap}.chat-model-select{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;border-radius:6px;background:var(--accent-soft);color:var(--accent-text);cursor:pointer}.chat-model-picker-chevron{position:absolute;top:50%;right:6px;width:10px;height:7px;transform:translateY(-50%);fill:none;stroke:var(--accent-text);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.75;pointer-events:none}.chat-model-picker.is-disabled{opacity:.65}.chat-model-select:disabled{cursor:default}.chat-model-label{max-width:190px;border-radius:6px;background:var(--accent-soft);color:var(--accent-text);padding:3px 8px;font-family:var(--mono);font-size:11px}.chat-empty .chat-composer{text-align:left}.chat-composer-wrap{border-top:1px solid var(--hairline);background:var(--bg);padding:14px 28px 16px}.chat-composer-inner{max-width:820px;margin:0 auto}.chat-composer{position:relative;background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:14px;box-shadow:0 1px 2px #1e1c140a,0 10px 30px -20px #1e1c144d;padding:6px}.chat-composer-textarea-wrap{position:relative}.chat-paper-highlight-layer{position:absolute;z-index:0;top:0;right:0;bottom:0;left:0;box-sizing:border-box;overflow:hidden;pointer-events:none;color:transparent}.chat-paper-highlight-layer>div{min-height:100%;white-space:pre-wrap;overflow-wrap:break-word;word-break:break-word;color:var(--ink)}.chat-paper-highlight-layer-composer{padding:12px 12px 4px;font-family:var(--serif);font-size:16px;line-height:1.45}.chat-paper-highlight-layer-editor{padding:9px 11px;font-family:var(--serif);font-size:16px;line-height:1.45}.chat-paper-highlight-layer-home{padding:12px 12px 4px;font-family:var(--serif);font-size:17px;line-height:1.45}.chat-paper-picker{position:absolute;z-index:50;left:8px;bottom:calc(100% + 6px);width:min(560px,calc(100vw - 48px));max-height:384px;overflow-y:auto;border:1px solid var(--hairline-strong);border-radius:11px;background:var(--bg-elevated);box-shadow:0 16px 38px -16px #1e1c1473}.chat-paper-picker-status{padding:10px 12px;color:var(--ink-faint);font-size:12px}.chat-paper-option{display:flex;width:100%;min-height:64px;flex-direction:column;justify-content:center;gap:3px;padding:9px 12px;border:0;border-top:1px solid var(--hairline);color:var(--ink);background:transparent;text-align:left}.chat-paper-option.is-active,.chat-paper-option:hover{background:var(--accent-soft)}.chat-paper-option-title{font-family:var(--serif);font-size:14px;line-height:1.25}.chat-paper-option-meta{color:var(--ink-faint);font-family:var(--mono);font-size:10.5px}.chat-paper-mention-message{padding:3px 12px;color:var(--negative-text);font-size:11.5px}.chat-inline-paper-mention{display:inline}.chat-inline-paper-mention svg{display:inline-block;margin-right:3px;color:var(--accent-text);vertical-align:-.12em}.chat-inline-paper-link{color:var(--accent-text);font-weight:600;text-decoration-line:underline;text-decoration-color:color-mix(in oklch,var(--accent) 40%,transparent);text-decoration-thickness:1px;text-underline-offset:2px}.chat-inline-paper-link:hover{text-decoration-color:var(--accent-text)}.chat-composer textarea{position:relative;z-index:1;width:100%;border:0;outline:0;resize:none;background:transparent;font-family:var(--serif);font-size:16px;line-height:1.45;color:transparent;caret-color:var(--ink);padding:12px 12px 4px}.chat-composer textarea::-moz-placeholder{color:var(--ink-faint)}.chat-composer textarea::placeholder{color:var(--ink-faint)}.chat-composer-row{display:flex;align-items:center;justify-content:space-between;padding:2px 6px 4px}.chat-composer-tools{display:flex;align-items:center;flex-wrap:wrap;gap:12px}.chat-web-search-toggle{display:inline-flex;align-items:center;gap:5px;min-height:30px;padding:4px 9px;border:1px solid var(--hairline);border-radius:8px;background:transparent;color:var(--ink-muted);font:inherit;font-size:12px;cursor:pointer}.chat-web-search-toggle:hover:not(:disabled){border-color:var(--hairline-strong);color:var(--ink)}.chat-web-search-toggle.is-enabled{border-color:var(--accent);background:var(--accent-soft);color:var(--accent-text)}.chat-web-search-toggle:disabled{cursor:default;opacity:.55}.chat-effort-picker{position:relative}.chat-effort-trigger{display:inline-flex;align-items:center;gap:4px;min-height:30px;padding:4px 8px 4px 10px;border:1px solid var(--hairline);border-radius:8px;background:transparent;color:var(--ink-muted);font:inherit;font-size:12px;cursor:pointer}.chat-effort-trigger:hover:not(:disabled){border-color:var(--hairline-strong);color:var(--ink)}.chat-effort-trigger:disabled{cursor:default;opacity:.55}.chat-effort-menu{position:absolute;z-index:40;left:0;bottom:calc(100% + 7px);width:220px;padding:6px;border:1px solid var(--hairline);border-radius:11px;background:var(--bg-elevated);box-shadow:0 14px 36px -14px #1e1c1473}.ask-home .chat-effort-menu{top:calc(100% + 7px);bottom:auto}.chat-effort-menu-label{padding:5px 10px 6px;color:var(--ink-faint);font-size:11px;font-weight:600;letter-spacing:.02em}.chat-effort-option{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;padding:9px 10px;border:0;border-radius:7px;background:transparent;color:var(--ink);text-align:left;cursor:pointer}.chat-effort-option:hover,.chat-effort-option.is-selected{background:var(--bg-subtle)}.chat-effort-option-copy{display:flex;flex-direction:column;gap:2px}.chat-effort-option-copy strong{font-size:13px;font-weight:600}.chat-effort-option-copy small{color:var(--ink-faint);font-size:11px}.chat-composer-hint{font-size:11.5px;color:var(--ink-faint)}.chat-composer-foot{display:flex;align-items:center;justify-content:center;gap:6px;text-align:center;font-size:11.5px;color:var(--ink-faint);margin-top:9px}.chat-provider-attribution{white-space:nowrap}.chat-send{display:flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:10px;background:var(--hairline);color:var(--bg-elevated);cursor:not-allowed;transition:background .15s;flex:none}.chat-send-on{background:var(--ink);cursor:pointer}.chat-send-on:hover{background:color-mix(in oklch,var(--ink) 88%,var(--accent))}@media (max-width: 900px){.chat-composer-wrap{padding:12px 16px 14px}.chat-composer-hint{display:none}}@media (prefers-reduced-motion: reduce){.chat-paper-option{scroll-behavior:auto}}@media (forced-colors: active){.chat-paper-option.is-active,.chat-inline-paper-link{outline:1px solid CanvasText}}.chat-paper-link{color:var(--accent-text);border-bottom:1px solid color-mix(in oklch,var(--accent-text) 35%,transparent);white-space:normal}.chat-paper-link:hover{border-bottom-color:var(--accent-text)}.chat-hf-link:after{content:" 🤗";font-size:.85em;white-space:nowrap}.chat-github-link{color:var(--accent-text);border-bottom:1px solid color-mix(in oklch,var(--accent-text) 35%,transparent)}.chat-github-link:hover{border-bottom-color:var(--accent-text)}.chat-github-link svg{display:inline-block;width:1em;height:1em;margin-right:.3em;vertical-align:-.14em}.chat-external-link{color:var(--accent-text);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.chat-external-link:hover{text-decoration-thickness:2px}.chat-web-citation{color:var(--accent-text);text-decoration:underline;text-decoration-style:dotted;text-underline-offset:2px}.web-preview-pop.web-preview-pop{width:min(360px,calc(100vw - 24px));padding:0;overflow:hidden;border:1px solid var(--hairline);border-radius:12px;background:var(--bg-elevated);color:var(--ink);box-shadow:0 14px 44px -12px #1e1c1466}.web-preview-card{display:flex;flex-direction:column}.web-preview-image{display:block;width:100%;height:174px;-o-object-fit:cover;object-fit:cover;background:var(--bg-subtle);border-bottom:1px solid var(--hairline)}.web-preview-meta{padding:13px 14px 14px;min-width:0}.web-preview-source{display:flex;align-items:center;gap:5px;margin-bottom:6px;color:var(--ink-faint);font-size:11px}.web-preview-source img{width:14px;height:14px;border-radius:3px}.web-preview-meta strong{display:block;font-family:var(--serif);font-size:15px;font-weight:500;line-height:1.3}.web-preview-meta p{display:-webkit-box;overflow:hidden;margin:7px 0 0;color:var(--ink-soft);font-size:12px;line-height:1.4;-webkit-box-orient:vertical;-webkit-line-clamp:3}.paper-preview-pop.paper-preview-pop{width:min(344px,calc(100vw - 24px));padding:0;border:1px solid var(--hairline);border-radius:12px;background:var(--bg-elevated);color:var(--ink);box-shadow:0 14px 44px -12px #1e1c1466;overflow:hidden}.paper-preview-inner{display:flex;gap:14px;padding:14px}.paper-preview-meta{min-width:0;flex:1}.paper-preview-title{font-family:var(--serif);font-weight:500;font-size:15px;line-height:1.25;margin-bottom:5px}.paper-preview-auth{font-size:12px;color:var(--ink-soft);line-height:1.35}.paper-preview-venue{font-size:11.5px;color:var(--ink-faint);margin-top:3px;font-variant-numeric:tabular-nums}.paper-preview-tags{display:flex;flex-wrap:wrap;gap:5px;margin:9px 0}.paper-preview-tag{font-size:10.5px;font-family:var(--mono);background:var(--positive-bg);color:var(--positive-text);border-radius:5px;padding:2px 7px}.paper-preview-status{min-height:48px;padding:14px;display:flex;align-items:center;color:var(--ink-soft);font-size:12px}.paper-preview-thumb{position:relative;width:96px;height:124px;flex:none;background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:3px;box-shadow:0 1px 3px #1e1c1414;overflow:hidden;padding:11px 10px}.paper-preview-thumb-real{padding:0}.paper-preview-thumb-real img{display:block;width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.paper-preview-thumb-title{display:flex;flex-direction:column;align-items:center;gap:3px;margin-bottom:8px}.paper-preview-thumb-title span{height:3px;background:var(--ink);border-radius:2px}.paper-preview-thumb-title span:first-child{width:70%}.paper-preview-thumb-title span:last-child{width:52%}.paper-preview-thumb-auth{height:2px;width:40%;margin:0 auto 9px;background:var(--ink-faint);border-radius:2px}.paper-preview-thumb-cols{display:flex;gap:7px}.paper-preview-thumb-col{flex:1;height:74px;background:repeating-linear-gradient(var(--hairline-strong) 0 2px,transparent 2px 5px);opacity:.7}.paper-preview-thumb-fig{position:absolute;left:14px;right:14px;height:22px;background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:2px}.hf-preview-pop.hf-preview-pop{width:min(172px,calc(100vw - 24px));padding:0;border:1px solid var(--hairline);border-radius:12px;background:var(--bg-elevated);color:var(--ink);box-shadow:0 14px 44px -12px #1e1c1466;overflow:hidden}.hf-preview-card{display:grid}.hf-preview-image,.hf-preview-fallback{display:block;width:100%;aspect-ratio:2 / 1;-o-object-fit:cover;object-fit:cover;background:var(--bg-subtle)}.hf-preview-fallback{display:grid;place-items:center;font-size:48px;background:radial-gradient(circle at 70% 35%,rgba(84,104,255,.4),transparent 45%),linear-gradient(135deg,#0f6d79,#d18a48)}.hf-preview-meta{display:grid;gap:3px;padding:12px 14px 14px}.hf-preview-meta strong{overflow-wrap:anywhere;font-size:14px}.hf-preview-kind,.hf-preview-meta>span:last-child{color:var(--ink-faint);font-size:11.5px}.github-preview-pop.github-preview-pop{width:min(344px,calc(100vw - 24px));padding:0;border:1px solid var(--hairline);border-radius:12px;background:var(--bg-elevated);color:var(--ink);box-shadow:0 14px 44px -12px #1e1c1466;overflow:hidden}.github-preview-card{display:flex;gap:14px;padding:14px}.github-preview-image,.github-preview-fallback{display:block;width:72px;height:72px;flex:none;-o-object-fit:cover;object-fit:cover;border-radius:12px;background:var(--bg-subtle)}.github-preview-fallback{display:grid;place-items:center;color:#fff;background:linear-gradient(135deg,#24292f,#57606a)}.github-preview-fallback svg{width:36px;height:36px}.github-preview-meta{display:grid;gap:3px;min-width:0}.github-preview-meta strong{overflow-wrap:anywhere;font-size:14px}.github-preview-kind,.github-preview-meta>span:last-child{color:var(--ink-faint);font-size:11.5px}.github-preview-description{display:-webkit-box;overflow:hidden;color:var(--ink-soft);font-size:12px;line-height:1.35;-webkit-box-orient:vertical;-webkit-line-clamp:2}.github-preview-stats{font-variant-numeric:tabular-nums}.chat-ghost-link{color:var(--ink-soft);font-size:13px;padding:6px 10px;border-radius:6px}.chat-ghost-link:hover{color:var(--ink);background:var(--bg-subtle)}.chat-conversation{flex:1;overflow-y:auto}.chat-conversation-inner{max-width:820px;margin:0 auto;padding:30px 28px 40px}.chat-msg{margin-bottom:26px}.chat-msg-user{display:flex;justify-content:flex-end}.chat-user-message-wrap{display:flex;flex-direction:column;align-items:flex-end;max-width:74%}.chat-bubble{background:var(--accent-soft);color:var(--ink);border:1px solid color-mix(in oklch,var(--accent-soft) 70%,var(--hairline));border-radius:16px 16px 4px;padding:12px 18px;font-family:var(--serif);font-size:16px;line-height:1.45;max-width:100%;white-space:pre-wrap;-webkit-user-select:text;-moz-user-select:text;user-select:text;cursor:text}.chat-bubble::-moz-selection,.chat-bubble *::-moz-selection{background:var(--accent);color:var(--bg)}.chat-bubble::selection,.chat-bubble *::selection{background:var(--accent);color:var(--bg)}.chat-user-actions{display:flex;justify-content:flex-end;gap:2px;min-height:30px;padding:4px 2px 0;opacity:0;transform:translateY(-2px);transition:opacity .14s ease,transform .14s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.chat-msg-user:hover .chat-user-actions,.chat-msg-user:focus-within .chat-user-actions{opacity:1;transform:translateY(0)}.chat-user-action{width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:999px;color:var(--ink-soft);background:transparent}.chat-user-action:hover{color:var(--ink);background:var(--bg-elevated);border-color:var(--hairline)}.chat-user-action:focus-visible{outline:2px solid var(--accent);outline-offset:2px;opacity:1}.chat-user-action svg{width:14px;height:14px}.chat-inline-editor{width:min(620px,74%);min-width:min(360px,100%);padding:12px;border:1px solid color-mix(in oklch,var(--accent) 45%,var(--hairline));border-radius:16px 16px 4px;background:var(--accent-soft);box-shadow:0 8px 28px #00000014}.chat-inline-editor-textarea{position:relative;z-index:1;display:block;width:100%;min-height:72px;padding:8px 10px;resize:none;border:1px solid var(--hairline-strong);border-radius:10px;color:var(--ink);background:transparent;font-family:var(--serif);font-size:16px;line-height:1.45;white-space:pre-wrap}.chat-inline-editor-textarea-wrap{position:relative;background:var(--bg-elevated);border-radius:10px}.chat-inline-editor-textarea-wrap .chat-inline-editor-textarea{color:transparent;caret-color:var(--ink)}.chat-inline-editor-textarea:focus{outline:2px solid var(--accent);outline-offset:1px}.chat-inline-editor-notice{margin:8px 2px 0;color:var(--ink-soft);font-size:12.5px;line-height:1.4}.chat-inline-editor-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:10px}.chat-inline-editor-actions button{min-height:34px;padding:6px 14px;border:1px solid var(--hairline-strong);border-radius:999px;color:var(--ink);background:var(--bg-elevated);font-size:13px;font-weight:600}.chat-inline-editor-actions button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.chat-inline-editor-actions .chat-inline-editor-send{color:#fff;border-color:var(--accent);background:var(--accent)}.chat-inline-editor-actions button:disabled{cursor:not-allowed;opacity:.5}.chat-msg-blocks{display:flex;flex-direction:column;gap:14px}.chat-waiting{min-height:20px;display:flex;align-items:center;font-size:13px;font-weight:600}.chat-thinking{color:transparent;background:linear-gradient(100deg,var(--ink-faint) 30%,var(--accent-text) 50%,var(--ink-faint) 70%);background-size:220% 100%;background-clip:text;-webkit-background-clip:text;animation:chat-thinking-glow 1.8s ease-in-out infinite}@keyframes chat-thinking-glow{0%{background-position:100% 0}to{background-position:-100% 0}}@media (prefers-reduced-motion: reduce){.chat-thinking{color:var(--accent-text);background:none;animation:none}}.chat-reason-live{border:1px solid var(--hairline);border-left:2px solid var(--accent);background:var(--bg-elevated);border-radius:10px;padding:14px 16px}.chat-reason-live-head{display:flex;align-items:center;gap:9px;font-size:12.5px;font-weight:600;color:var(--accent-text)}.chat-reason-live-body{margin-top:9px;font-family:var(--serif);font-size:14.5px;line-height:1.6;color:var(--ink-soft)}.chat-reason-done{border:1px solid var(--hairline);border-radius:10px;background:var(--bg-elevated);overflow:hidden}.chat-reason-done-head{display:flex;align-items:center;gap:9px;width:100%;padding:11px 15px;font-size:13px;color:var(--ink-soft);font-weight:500;text-align:left}.chat-reason-done-head svg:first-child{color:var(--positive-text);flex:none}.chat-reason-done-head .chat-chev{margin-left:auto}.chat-reason-done-head:hover{color:var(--ink)}.chat-reason-done-body{padding:2px 16px 16px 39px;font-family:var(--serif);font-size:14px;line-height:1.65;color:var(--ink-soft)}.chat-answer.chat-reason-markdown{padding-top:0;padding-right:0;padding-bottom:0;font-size:inherit;line-height:inherit;color:inherit;white-space:normal}.chat-answer.chat-reason-live-body{padding-left:23px}.chat-answer.chat-reason-done-body{padding:2px 16px 16px 39px}.chat-tool{border:1px solid var(--hairline);border-radius:10px;background:var(--bg-elevated);overflow:hidden}.chat-tool-running{border-color:color-mix(in oklch,var(--accent) 35%,var(--hairline))}.chat-tool-failed{border-color:color-mix(in oklch,#b42318 55%,var(--hairline))}.chat-tool-failed .chat-tool-status{color:#b42318;font-weight:600}.chat-tool-head{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:11px 15px;text-align:left}.chat-tool-head:disabled{cursor:default}.chat-tool-head-left{display:flex;align-items:center;gap:9px;min-width:0}.chat-tool-head-left>svg{color:var(--accent-text);flex:none}.chat-tool-name{font-family:var(--mono);font-size:12px;font-weight:600;color:var(--ink);background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:5px;padding:2px 7px;flex:none}.chat-tool-query{font-family:var(--serif);font-style:italic;font-size:13.5px;color:var(--ink-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-tool-head-right{display:flex;align-items:center;gap:10px;flex:none}.chat-tool-status{font-size:11.5px;color:var(--ink-soft);font-variant-numeric:tabular-nums}.chat-tool-body{padding:4px 16px 16px;border-top:1px solid var(--hairline)}.chat-tool-args{margin:12px 0 4px}.chat-tool-label{display:block;font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-faint);margin-bottom:6px}.chat-tool-args pre{margin:0;background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:8px;padding:10px 12px;font-family:var(--mono);font-size:11.5px;line-height:1.5;color:var(--ink-soft);overflow-x:auto}.chat-tool-results-label{margin-top:16px}.chat-tool-output-head{display:flex;align-items:center;justify-content:space-between;margin-top:14px}.chat-tool-output-head .chat-tool-label{margin-bottom:0}.chat-tool-copy{color:var(--accent-text);font-family:var(--mono);font-size:11px}.chat-tool-output{max-height:320px;margin:7px 0 0;overflow:auto;white-space:pre;-moz-tab-size:4;-o-tab-size:4;tab-size:4;border:1px solid var(--hairline);border-radius:8px;background:var(--bg-subtle);padding:11px 12px;color:var(--ink);font-family:var(--mono);font-size:11.5px;line-height:1.5}.chat-tool-truncated{margin-top:7px;color:var(--ink-faint);font-size:11px}.chat-tool-results{list-style:none;margin:0;padding:0}.chat-hit{padding:11px 0;border-top:1px solid var(--hairline)}.chat-hit:first-child{border-top:0}.chat-hit-top{display:flex;align-items:baseline;gap:12px}.chat-hit-title{font-family:var(--serif);font-size:14.5px;font-weight:600;color:var(--accent-text);flex:1;line-height:1.3}.chat-hit-title:hover{text-decoration:underline}.chat-hit-meta{font-size:12px;color:var(--ink-faint);margin-top:2px}.chat-hit-truncated{color:var(--ink-faint);font-style:italic}.chat-hit-snippet{font-family:var(--serif);font-size:13.5px;line-height:1.5;color:var(--ink-soft);margin-top:5px;text-wrap:pretty}.chat-answer{font-family:var(--serif);font-size:16.5px;line-height:1.65;color:var(--ink);text-wrap:pretty;padding:2px}.chat-answer>:first-child{margin-top:0}.chat-answer>:last-child{margin-bottom:0}.chat-answer p{margin:0 0 .9em}.chat-answer h1,.chat-answer h2,.chat-answer h3,.chat-answer h4{font-family:var(--sans);font-weight:600;line-height:1.3;margin:1.35em 0 .5em}.chat-answer h1{font-size:1.45em}.chat-answer h2{font-size:1.25em}.chat-answer h3{font-size:1.08em}.chat-answer h4{font-size:1em}.chat-answer ul,.chat-answer ol{margin:0 0 .9em;padding-left:1.5em}.chat-answer ul{list-style-type:disc}.chat-answer ol{list-style-type:decimal}.chat-answer ul ul{list-style-type:circle}.chat-answer ul ul ul{list-style-type:square}.chat-answer li{margin:.2em 0}.chat-answer li>p{margin:0}.chat-answer blockquote{margin:0 0 .9em;padding-left:1em;border-left:3px solid var(--hairline-strong);color:var(--ink-soft)}.chat-answer code{font-family:var(--mono);font-size:.84em;background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:4px;padding:.1em .3em}.chat-answer pre{margin:0 0 1em;padding:12px 14px;overflow-x:auto;background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:8px;line-height:1.5}.chat-answer pre code{background:none;border:0;padding:0}.chat-answer table{display:block;width:-moz-max-content;width:max-content;max-width:100%;overflow-x:auto;border-collapse:collapse;margin:0 0 1em;font-family:var(--sans);font-size:.88em}.chat-answer th,.chat-answer td{border:1px solid var(--hairline);padding:6px 10px;text-align:left}.chat-answer th{background:var(--bg-subtle);font-weight:600}.chat-answer hr{border:0;border-top:1px solid var(--hairline);margin:1.25em 0}.chat-answer input[type=checkbox]{margin-right:.4em}.chat-answer strong{font-weight:600}.chat-error{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid var(--negative-border);background:var(--negative-bg);color:var(--negative-text);border-radius:10px;padding:12px 16px;font-size:13.5px}.chat-finish-note{font-family:var(--serif);font-style:italic;font-size:13px;color:var(--ink-faint)}.chat-feedback{display:flex;align-items:center;gap:4px;min-height:30px;margin-top:8px;color:var(--ink-faint);font-size:12px}.chat-feedback-label{margin-right:2px}.chat-feedback-action{width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:999px;color:var(--ink-soft);background:transparent}.chat-feedback-action:hover:not(:disabled),.chat-feedback-action-selected{color:var(--accent-text);background:var(--accent-soft);border-color:color-mix(in oklch,var(--accent) 35%,var(--hairline))}.chat-feedback-action:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.chat-feedback-action:disabled{cursor:wait}.chat-feedback-action svg{width:14px;height:14px}.chat-feedback-error{color:var(--negative-text);margin-left:4px}.chat-feedback-panel{width:min(460px,100%);margin-top:8px;padding:16px;border:1px solid var(--hairline);border-radius:12px;background:var(--bg-elevated);box-shadow:0 10px 30px #0000001a}.chat-feedback-panel-title{color:var(--ink);font-size:15px;font-weight:600}.chat-feedback-panel-label{display:block;margin-top:4px;color:var(--ink-soft);font-size:13px}.chat-feedback-comment{display:block;width:100%;min-height:92px;margin-top:12px;padding:10px 12px;resize:vertical;border:1px solid var(--hairline-strong);border-radius:8px;color:var(--ink);background:var(--bg);font:14px/1.45 var(--sans)}.chat-feedback-comment:focus{border-color:var(--accent);outline:2px solid color-mix(in oklch,var(--accent) 25%,transparent);outline-offset:1px}.chat-feedback-panel-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.chat-feedback-panel-actions button{min-width:72px;padding:8px 14px;border-radius:8px;font:600 13px var(--sans)}.chat-feedback-skip{border:1px solid transparent;color:var(--ink-soft);background:transparent}.chat-feedback-submit{border:1px solid var(--ink);color:var(--bg);background:var(--ink)}.chat-feedback-panel-actions button:disabled{cursor:wait;opacity:.65}.chat-error a,.chat-error button{flex:none;color:var(--accent-text);font-weight:600;text-decoration:none}.chat-error button{border:0;padding:0;background:transparent;cursor:pointer;font:inherit}.chat-error button:disabled{cursor:wait;opacity:.65}.chat-error-actions{display:flex;flex:none;flex-wrap:wrap;justify-content:flex-end;gap:8px 16px}.chat-error a:hover,.chat-error button:hover:not(:disabled){text-decoration:underline}@media (max-width: 900px){.chat-user-message-wrap{max-width:90%}.chat-inline-editor{width:90%;min-width:0}.chat-conversation-inner{padding:22px 16px 32px}}@media (max-width: 560px){.shared-chat-content .chat-user-message-wrap{max-width:88%}}@media (hover: none),(pointer: coarse){.chat-user-actions{opacity:1;transform:none}}.chat-caret{display:inline-block;width:7px;height:1.05em;background:var(--accent);margin-left:1px;vertical-align:text-bottom;animation:chat-blink 1s steps(1) infinite}@keyframes chat-blink{50%{opacity:0}}.chat-chev{transition:transform .18s;color:var(--ink-faint)}.chat-chev-open{transform:rotate(180deg)}.chat-spinner{width:14px;height:14px;border:2px solid color-mix(in oklch,var(--accent) 25%,transparent);border-top-color:var(--accent);border-radius:50%;display:inline-block;animation:chat-spin .7s linear infinite;flex:none}.chat-spinner-light{border-color:#fff6;border-top-color:#fff}@keyframes chat-spin{to{transform:rotate(360deg)}}.shared-chat-page{min-height:calc(100dvh - 60px);background:var(--bg)}.shared-chat-heading{border-bottom:1px solid var(--hairline);display:flex;align-items:center;gap:10px}.shared-chat-heading h1{max-width:calc(50vw + 640px);margin:0 auto;padding:13px 32px;color:var(--ink);font-family:var(--serif);font-size:20px;font-weight:600;line-height:1.1}.shared-chat-content{width:min(876px,100%);margin:0 auto;padding:34px 28px 64px}.shared-chat-transcript{padding:0 0 26px}.shared-chat-attribution{display:flex;flex-wrap:wrap;justify-content:center;gap:5px 12px;color:var(--ink-faint);font-size:12px;line-height:1.5}.shared-chat-attribution a{color:inherit;font-weight:600;text-decoration:none}.shared-chat-attribution a:hover{color:var(--accent-text);text-decoration:underline}.shared-chat-fresh{margin-top:26px;padding-top:28px;border-top:1px solid var(--hairline)}.shared-chat-fresh h2{margin:0 0 6px;font-family:var(--serif);font-size:21px;font-weight:600}.shared-chat-fresh>p{margin:0 0 16px;color:var(--ink-soft);font-family:var(--serif)}.shared-chat-access-note{margin:-6px 0 16px;padding:10px 12px;border:1px solid color-mix(in oklch,var(--accent) 24%,var(--hairline));border-radius:9px;color:var(--ink-soft);background:color-mix(in oklch,var(--accent) 5%,var(--bg-elevated));font-size:13px;line-height:1.45}.shared-chat-access-note a{color:var(--accent-text);font-weight:600}.shared-chat-state{min-height:55vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:48px 24px;text-align:center;color:var(--ink-soft)}.shared-chat-state h1{margin:0;color:var(--ink);font-family:var(--serif);font-size:27px}.shared-chat-state p{margin:0}.shared-chat-state button{margin-top:8px;padding:7px 13px;border:1px solid var(--hairline-strong);border-radius:7px;background:var(--bg-elevated);color:var(--ink)}@media (max-width: 900px){.shared-chat-heading h1{padding-inline:16px}}@media (max-width: 640px){.shared-chat-heading h1{padding-inline:14px}}@media (max-width: 560px){.shared-chat-content{padding:26px 16px 48px}} +@import"https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700;1,6..72,400&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent-tw: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 36 13% 7%;--foreground: 40 27% 93%;--card: 36 12% 10%;--card-foreground: 40 27% 93%;--popover: 36 12% 10%;--popover-foreground: 40 27% 93%;--primary: 40 27% 93%;--primary-foreground: 36 13% 7%;--secondary: 34 11% 15%;--secondary-foreground: 40 27% 93%;--muted: 34 11% 15%;--muted-foreground: 36 10% 64%;--accent-tw: 216 22% 20%;--accent-foreground: 213 38% 79%;--destructive: 0 63% 42%;--destructive-foreground: 40 27% 93%;--border: 35 11% 20%;--input: 35 11% 20%;--ring: 213 38% 67%}[data-shadcn] *{border-color:hsl(var(--border))}.\!container{width:100%!important;margin-right:auto!important;margin-left:auto!important;padding-right:2rem!important;padding-left:2rem!important}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.\!container{max-width:1400px!important}.container{max-width:1400px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.\!visible{visibility:visible!important}.visible{visibility:visible}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.left-2{left:.5rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:.5rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[60\]{z-index:60}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-6{margin-left:-1.5rem;margin-right:-1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-4{margin-right:1rem}.mr-auto{margin-right:auto}.mt-1{margin-top:.25rem}.mt-10{margin-top:2.5rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.\!block{display:block!important}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-36{height:9rem}.h-4{height:1rem}.h-40{height:10rem}.h-44{height:11rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[190px\]{height:190px}.h-\[220px\]{height:220px}.h-\[38px\]{height:38px}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-\[300px\]{max-height:300px}.max-h-\[350px\]{max-height:350px}.max-h-\[400px\]{max-height:400px}.max-h-\[460px\]{max-height:460px}.max-h-\[50vh\]{max-height:50vh}.max-h-\[600px\]{max-height:600px}.max-h-\[700px\]{max-height:700px}.max-h-\[800px\]{max-height:800px}.max-h-\[90vh\]{max-height:90vh}.max-h-\[min\(300px\,calc\(var\(--radix-popover-content-available-height\)-2\.75rem\)\)\]{max-height:min(300px,calc(var(--radix-popover-content-available-height) - 2.75rem))}.max-h-\[var\(--radix-popover-content-available-height\)\]{max-height:var(--radix-popover-content-available-height)}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-\[80px\]{min-height:80px}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-4{width:1rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-\[160px\]{width:160px}.w-\[calc\(100vw-2rem\)\]{width:calc(100vw - 2rem)}.w-\[var\(--radix-popover-trigger-width\)\]{width:var(--radix-popover-trigger-width)}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[180px\]{min-width:180px}.min-w-\[200px\]{min-width:200px}.min-w-\[240px\]{min-width:240px}.min-w-\[260px\]{min-width:260px}.min-w-\[8rem\]{min-width:8rem}.max-w-2xl{max-width:42rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[260px\]{max-width:260px}.max-w-\[280px\]{max-width:280px}.max-w-\[360px\]{max-width:360px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.table-fixed{table-layout:fixed}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-rows-\[auto_minmax\(0\,1fr\)_auto\]{grid-template-rows:auto minmax(0,1fr) auto}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-1{row-gap:.25rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overscroll-contain{overscroll-behavior:contain}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.\!border{border-width:1px!important}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.\!border-black{--tw-border-opacity: 1 !important;border-color:rgb(0 0 0 / var(--tw-border-opacity, 1))!important}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/40{border-color:hsl(var(--destructive) / .4)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.bg-accent{background-color:hsl(var(--accent-tw))}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/10{background-color:hsl(var(--destructive) / .1)}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/40{background-color:hsl(var(--muted) / .4)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-red-50\/50{background-color:#fef2f280}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pl-4{padding-left:1rem}.pl-5{padding-left:1.25rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-2{padding-right:.5rem}.pr-8{padding-right:2rem}.pr-9{padding-right:2.25rem}.pt-0{padding-top:0}.pt-2{padding-top:.5rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-widest{letter-spacing:.1em}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow{--tw-drop-shadow: drop-shadow(0 1px 2px rgb(0 0 0 / .1)) drop-shadow(0 1px 1px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-200{animation-duration:.2s}.\!running{animation-play-state:running!important}.running{animation-play-state:running}.paused{animation-play-state:paused}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.last\:mb-0:last-child{margin-bottom:0}.hover\:border-foreground\/50:hover{border-color:hsl(var(--foreground) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent-tw))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-emerald-600:hover{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.hover\:bg-muted\/20:hover{background-color:hsl(var(--muted) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-destructive:hover{color:hsl(var(--destructive))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:bg-accent:focus{background-color:hsl(var(--accent-tw))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-background{background-color:hsl(var(--background))}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color: hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[selected\=\'true\'\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent-tw))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:\!bg-black[data-state=checked]{--tw-bg-opacity: 1 !important;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))!important}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent-tw))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:\!text-white[data-state=checked]{--tw-text-opacity: 1 !important;color:rgb(255 255 255 / var(--tw-text-opacity, 1))!important}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity: .8}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y: -100%}.dark\:border-amber-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(120 53 15 / var(--tw-border-opacity, 1))}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}.dark\:bg-amber-950\/40:is(.dark *){background-color:#451a0366}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:mr-auto{margin-right:auto}.sm\:w-auto{width:auto}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:text-left{text-align:left}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y: 100%}}@media (min-width: 768px){.md\:col-span-2{grid-column:span 2 / span 2}.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 1024px){.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (min-width: 1280px){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}:root{--bg: #FAF8F4;--bg-elevated: #FFFFFF;--bg-subtle: #F2EFE8;--ink: #1A1814;--ink-soft: #5A554C;--ink-faint: #8E8678;--hairline: #E4DFD4;--hairline-strong: #C8C2B3;--accent: oklch(.45 .08 250);--accent-soft: oklch(.92 .03 250);--accent-text: oklch(.35 .1 250);--warn: oklch(.55 .12 30);--positive-bg: oklch(.96 .03 145);--positive-text: oklch(.34 .1 145);--positive-border: oklch(.86 .06 145);--negative-bg: oklch(.96 .03 25);--negative-text: oklch(.4 .12 25);--negative-border: oklch(.86 .06 25);--highlight-bg: oklch(.97 .04 70);--highlight-text: oklch(.42 .1 60);--highlight-border: oklch(.85 .07 70);--info-bg: oklch(.97 .04 230);--info-text: oklch(.42 .1 240);--info-border: oklch(.86 .07 230);--trend-code: #33639E;--trend-hf: #AA7D24;--serif: "Newsreader", Georgia, serif;--sans: "Inter", -apple-system, sans-serif;--mono: "JetBrains Mono", ui-monospace, monospace;color-scheme:light}.dark{--bg: #11100E;--bg-elevated: #1A1815;--bg-subtle: #24211D;--ink: #F3EFE7;--ink-soft: #B9B2A6;--ink-faint: #989084;--hairline: #332F29;--hairline-strong: #514A40;--accent: oklch(.72 .09 250);--accent-soft: oklch(.28 .04 250);--accent-text: oklch(.8 .08 250);--warn: oklch(.72 .12 30);--positive-bg: oklch(.25 .035 145);--positive-text: oklch(.79 .1 145);--positive-border: oklch(.43 .06 145);--negative-bg: oklch(.25 .04 25);--negative-text: oklch(.79 .1 25);--negative-border: oklch(.43 .06 25);--highlight-bg: oklch(.27 .04 70);--highlight-text: oklch(.82 .1 70);--highlight-border: oklch(.46 .07 70);--info-bg: oklch(.25 .04 230);--info-text: oklch(.8 .08 235);--info-border: oklch(.43 .07 230);--trend-code: #5C8FD6;--trend-hf: #B3831F;color-scheme:dark}*{box-sizing:border-box;margin:0;padding:0}html,body{background:var(--bg);color:var(--ink);font-family:var(--sans);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}a{color:inherit;text-decoration:none}button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}.app-header{border-bottom:1px solid var(--hairline);background:var(--bg);position:sticky;top:0;z-index:50}.app-header-inner{max-width:calc(50vw + 640px);margin:0 auto;padding:18px 32px;display:flex;align-items:center;gap:24px;min-width:0}.site-announcement{min-height:28px;padding:5px 32px 6px;border-top:1px solid var(--hairline);background:var(--bg-subtle);color:var(--ink-soft);font-size:12px;line-height:16px;text-align:center}.site-announcement a{color:var(--accent-text);font-weight:600;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.site-announcement a:hover{color:var(--ink)}.brand{display:flex;align-items:baseline;gap:10px;font-family:var(--serif);cursor:pointer}.brand-mark{width:22px;height:22px;background:var(--ink);position:relative;align-self:center;flex-shrink:0}.brand-mark:after{content:"";position:absolute;top:4px;left:4px;right:4px;bottom:4px;background:var(--bg)}.brand-mark:before{content:"";position:absolute;top:8px;left:8px;width:6px;height:6px;background:var(--ink);z-index:1}.brand-name{font-size:20px;font-weight:600;letter-spacing:-.02em;white-space:nowrap}.brand-name em{font-style:italic;font-weight:400;color:var(--ink-soft)}.nav{display:flex;gap:24px;margin-left:8px;flex-shrink:0}@media (max-width: 1100px){.nav{gap:18px}.nav-item:nth-child(n+4){display:none}}@media (max-width: 920px){.search-trigger kbd{display:none}}.nav-item{font-size:13px;color:var(--ink-soft);padding:4px 0;border-bottom:1px solid transparent;transition:color .15s}.nav-item:hover{color:var(--ink)}.nav-item.active{color:var(--ink);border-bottom-color:var(--ink)}.header-spacer{flex:1}.search-trigger{display:flex;align-items:center;gap:8px;padding:7px 12px;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);font-size:13px;color:var(--ink-faint);width:240px;min-width:0;flex-shrink:1;transition:border-color .15s;overflow:hidden}.search-trigger>span:not(:first-child){white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.search-trigger:hover{border-color:var(--hairline-strong)}.search-trigger kbd{margin-left:auto;font-family:var(--mono);font-size:11px;padding:1px 5px;border:1px solid var(--hairline);border-radius:3px;background:var(--bg-subtle);color:var(--ink-soft)}.icon-btn{width:32px;height:32px;display:flex;align-items:center;justify-content:center;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);transition:border-color .15s}.icon-btn:hover{border-color:var(--hairline-strong)}.hf-signin-btn{display:inline-flex;align-items:center;gap:8px;height:32px;padding:0 12px;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);font-size:13px;color:var(--ink);white-space:nowrap;transition:border-color .15s,background .15s}.hf-signin-btn:hover{border-color:var(--hairline-strong);background:var(--bg-subtle)}.user-avatar-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid var(--hairline);border-radius:999px;background:var(--bg-elevated);padding:0;overflow:hidden;transition:border-color .15s}.user-avatar-btn:hover{border-color:var(--hairline-strong)}.user-avatar-btn:focus-visible{outline:2px solid var(--hairline-strong);outline-offset:2px}.page{max-width:calc(50vw + 640px);margin:0 auto;padding:32px}.site-footer{border-top:1px solid var(--hairline);color:var(--ink-faint);font-size:12px}.site-footer-inner{display:flex;flex-wrap:wrap;gap:14px;max-width:calc(50vw + 640px);margin:0 auto;padding:20px 32px 28px}.site-footer a{color:var(--ink-soft)}.site-footer a:hover{color:var(--ink)}.layout-with-sidebar{display:grid;grid-template-columns:220px 1fr;gap:48px;align-items:start}.sidebar{position:sticky;top:100px}.sidebar-section{margin-bottom:28px}.sidebar-label{font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-faint);margin-bottom:12px}.sidebar-link{display:block;font-size:13px;color:var(--ink-soft);padding:5px 0;border-bottom:1px dotted transparent;transition:color .15s}.sidebar-link:hover{color:var(--ink)}.sidebar-link.active{color:var(--ink);font-weight:500}.sidebar-link .count{font-family:var(--mono);font-size:11px;color:var(--ink-faint);margin-left:6px}.breadcrumb{display:flex;align-items:center;gap:8px;font-family:var(--mono);font-size:11px;color:var(--ink-faint);margin-bottom:24px}.breadcrumb a{color:var(--ink-soft)}.breadcrumb a:hover{color:var(--ink)}.breadcrumb .sep{color:var(--hairline-strong)}.detail-title{font-family:var(--serif);font-size:38px;font-weight:500;line-height:1.15;letter-spacing:-.02em;margin-bottom:16px;text-wrap:balance}.action-btn{display:inline-flex;align-items:center;gap:6px;padding:7px 12px;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);font-size:12px;font-weight:500;color:var(--ink);transition:all .15s}.action-btn:hover{border-color:var(--ink)}.action-btn.primary{background:var(--ink);color:var(--bg);border-color:var(--ink)}.action-btn.primary:hover{background:color-mix(in oklch,var(--ink) 88%,var(--accent))}.no-results{padding:80px 0;text-align:center;font-family:var(--serif);color:var(--ink-faint);font-style:italic}.icon{width:14px;height:14px;flex-shrink:0}.icon-sm{width:11px;height:11px;flex-shrink:0}html{scroll-behavior:smooth}::-moz-selection{background:var(--accent-soft);color:var(--accent-text)}::selection{background:var(--accent-soft);color:var(--accent-text)}.mobile-menu-btn,.mobile-search-btn{display:none;width:36px;height:36px;align-items:center;justify-content:center;border-radius:4px;flex-shrink:0}.mobile-menu-btn:hover,.mobile-search-btn:hover{background:var(--bg-subtle)}.mobile-nav-drawer{position:fixed;top:0;right:0;bottom:0;left:0;background:#1a181466;z-index:100;display:flex;justify-content:flex-end}.mobile-nav-panel{width:min(320px,80vw);background:var(--bg-elevated);border-left:1px solid var(--hairline-strong);padding:24px 24px 32px;display:flex;flex-direction:column;gap:4px;height:100dvh;max-height:100vh;overflow-y:auto;box-shadow:-8px 0 24px #0000000f}.mobile-nav-link{font-family:var(--serif);font-size:17px;padding:12px 4px;color:var(--ink);border-bottom:1px solid var(--hairline)}.mobile-nav-link.active{color:var(--accent-text);font-style:italic}.mobile-nav-search{display:flex;align-items:center;gap:10px;width:100%;font-family:var(--sans);font-size:14px;color:var(--ink-faint);background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:6px;padding:10px 12px;margin-bottom:8px;text-align:left}.mobile-nav-search:hover{border-color:var(--hairline-strong);color:var(--ink)}@media (max-width: 880px){.nav,.search-trigger,.header-feedback-link{display:none}.mobile-menu-btn,.mobile-search-btn{display:inline-flex}}@media (max-width: 640px){.app-header-inner,.brand{gap:8px}.brand-mark{width:20px;height:20px}.brand-name{font-size:18px}.header-bookmark-btn{display:none}.hf-signin-btn{width:36px;height:36px;padding:0;gap:0;justify-content:center;flex-shrink:0}.hf-signin-btn>span{display:none}}@media (max-width: 880px){.app-header-inner{padding:14px 16px;gap:12px}.page{padding:24px 16px}.layout-with-sidebar{grid-template-columns:1fr;gap:24px}.layout-with-sidebar .sidebar{position:static;top:auto}.detail-title{font-size:28px}}@media (max-width: 640px){.app-header-inner{padding:12px 14px;gap:8px}.page{padding:20px 14px}.detail-title{font-size:24px}.brand-name{font-size:17px}}.access-request-page{min-height:100vh;min-height:100svh;display:grid;place-items:center;padding:32px 20px;background:radial-gradient(circle at 50% 8%,color-mix(in srgb,var(--accent-soft) 60%,transparent),transparent 42%),var(--bg)}.access-request-card{width:min(100%,470px);padding:38px;border:1px solid var(--hairline);border-radius:12px;background:color-mix(in srgb,var(--bg-elevated) 94%,transparent);box-shadow:0 20px 60px #1a181414}.access-request-brand{display:inline-flex;align-items:center;gap:10px;margin-bottom:42px;font-family:var(--serif)}.access-request-heading h1,.access-request-success h1{margin-bottom:12px;font-family:var(--serif);font-size:clamp(36px,8vw,48px);font-weight:500;line-height:1;letter-spacing:-.035em}.access-request-heading>p:last-child,.access-request-success p,.access-request-signin>p{color:var(--ink-soft);font-size:15px;line-height:1.65}.access-request-eyebrow{margin-bottom:10px;color:var(--accent-text);font-size:11px;font-weight:700;letter-spacing:.12em;text-transform:uppercase}.access-request-form,.access-request-signin{margin-top:30px}.access-request-form label{display:block;margin-bottom:8px;font-size:12px;font-weight:600}.access-request-input-wrap{display:flex;align-items:center;border:1px solid var(--hairline-strong);border-radius:7px;background:var(--bg);color:var(--ink-faint);transition:border-color .15s,box-shadow .15s}.access-request-input-wrap:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}.access-request-input-wrap>span{padding-left:13px;font-size:15px}.access-request-input-wrap input{width:100%;padding:11px 13px 11px 3px;border:0;outline:0;background:transparent;color:var(--ink);font:500 14px var(--sans)}.access-request-verified{margin-top:7px;color:var(--ink-faint);font-size:11px}.access-request-submit{width:100%;margin-top:20px;padding:12px 18px;border-radius:7px;background:var(--ink);color:var(--bg);font-size:13px;font-weight:600;transition:opacity .15s,transform .15s}.access-request-submit:hover:not(:disabled){transform:translateY(-1px)}.access-request-submit:disabled{cursor:wait;opacity:.6}.access-request-error{margin-top:12px;color:var(--negative-text);font-size:12px}.access-request-status{margin-top:30px;color:var(--ink-soft)}.access-request-signin .hf-signin-btn{margin-top:18px}.access-request-success svg{margin-bottom:24px;color:var(--positive-text)}@media (max-width: 520px){.access-request-card{padding:28px 24px}.access-request-brand{margin-bottom:34px}}.legal-page{max-width:880px;padding-bottom:72px;color:var(--ink-soft);font-family:var(--sans);font-size:15px;line-height:1.7}.legal-header{margin-bottom:34px;padding-bottom:24px;border-bottom:1px solid var(--hairline)}.legal-kicker{margin:0 0 6px;color:var(--accent-text);font-size:11px;font-weight:700;letter-spacing:.1em;text-transform:uppercase}.legal-header h1{margin:0;color:var(--ink);font-family:var(--serif);font-size:clamp(38px,6vw,56px);font-weight:500;letter-spacing:-.025em;line-height:1.05}.legal-effective-date{margin:12px 0 0;color:var(--ink-faint)}.legal-page section{margin-top:34px}.legal-page h2{margin:0 0 10px;color:var(--ink);font-family:var(--serif);font-size:25px;font-weight:600;line-height:1.25}.legal-page h3{margin:22px 0 6px;color:var(--ink);font-size:15px;font-weight:700}.legal-page p{margin:0 0 14px}.legal-page ul{margin:8px 0 16px;padding-left:22px}.legal-page li{margin:7px 0}.legal-page a{color:var(--accent-text);text-decoration:underline}.legal-page strong{color:var(--ink)}.feed-header{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:32px;gap:24px;flex-wrap:wrap}.feed-title{font-family:var(--serif);font-size:44px;font-weight:500;letter-spacing:-.025em;line-height:1}.feed-title em{font-style:italic;font-weight:400;color:var(--accent)}.feed-subtitle{font-size:13px;color:var(--ink-soft);margin-top:8px;font-family:var(--serif);font-style:italic}.conference-deadlines-link{font-size:16px;color:var(--ink-soft);margin-top:12px}.trend-chart{margin:0;width:100%}.trend-chart-visual{position:relative;min-width:0}.trend-chart-table{margin-top:10px}.feedback-link{display:inline-flex;align-items:center;height:32px;padding:0 12px;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);color:var(--ink-soft);font-size:13px;font-weight:500;white-space:nowrap;transition:border-color .15s,color .15s,background .15s}.feedback-link:hover{border-color:var(--hairline-strong);background:var(--bg-subtle);color:var(--ink)}.period-switch{display:flex;align-items:center;gap:2px;background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:6px;padding:3px}.period-btn{padding:5px 12px;font-size:12px;font-weight:500;color:var(--ink-soft);border-radius:4px;transition:all .15s}.period-btn.active{background:var(--ink);color:var(--bg)}.period-btn:not(.active):hover{background:var(--bg-subtle);color:var(--ink)}.date-nav{display:flex;align-items:center;gap:12px;font-family:var(--mono);font-size:12px;color:var(--ink-soft)}.date-nav button{width:26px;height:26px;border:1px solid var(--hairline);border-radius:4px;display:flex;align-items:center;justify-content:center;background:var(--bg-elevated)}.date-nav button:hover{background:var(--bg-subtle)}.paper-list{display:flex;flex-direction:column}.paper-card{display:grid;grid-template-columns:170px 1fr;gap:28px;padding:24px 0;border-bottom:1px solid var(--hairline);align-items:stretch}.paper-thumb-wrap{transition:transform .15s;display:flex;align-items:flex-end;justify-content:flex-start}.paper-thumb-wrap:hover{transform:translateY(-2px)}.paper-thumb-skeleton{width:160px;height:220px}.paper-card:first-child{padding-top:0}.paper-rank{font-family:var(--serif);font-size:32px;font-weight:500;color:var(--ink-faint);font-feature-settings:"tnum";line-height:.9;font-style:italic}.paper-body{min-width:0;display:flex;align-items:stretch;gap:28px}.paper-body-main{min-width:0;flex:1}.paper-resources{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:18px;flex:0 0 auto;width:92px;border-left:1px solid var(--hairline);padding-left:20px}.paper-resource{display:flex;flex-direction:column;align-items:center;gap:4px;color:inherit}a.paper-resource.is-link{text-decoration:none;cursor:pointer;border-radius:4px;transition:transform .15s}a.paper-resource.is-link:hover{transform:translateY(-1px)}a.paper-resource.is-link:hover .resource-value{text-decoration:underline;text-underline-offset:2px}a.paper-resource.is-link:focus-visible{outline:2px solid var(--ink);outline-offset:2px}.paper-resource .resource-stat{display:flex;flex-direction:column;align-items:center;gap:2px}.paper-resource .resource-value{display:inline-flex;align-items:center;gap:3px;font-family:var(--mono);font-size:14px;color:var(--ink);font-weight:500;font-variant-numeric:tabular-nums;letter-spacing:-.01em}.paper-resource .resource-label{font-family:var(--mono);font-size:10px;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-faint)}.paper-resource .gh-rate-arrow{color:var(--accent-text);font-size:13px;transform:translateY(-.5px)}.paper-meta-line{display:flex;align-items:center;gap:12px;font-family:var(--mono);font-size:11px;color:var(--ink-faint);margin-bottom:6px}.paper-meta-line .sep{color:var(--hairline-strong)}.paper-title{font-family:var(--serif);font-size:22px;font-weight:500;line-height:1.2;letter-spacing:-.015em;margin-bottom:6px;color:var(--ink);cursor:pointer;text-wrap:pretty}.paper-title:hover{color:var(--accent-text)}.paper-organization-logos{display:inline-flex;align-items:center;gap:4px;margin-left:7px;vertical-align:-4px}.paper-organization-logo{display:inline-grid;width:24px;height:24px;flex:0 0 24px;place-items:center;overflow:hidden;border:1px solid var(--hairline);border-radius:4px;background:var(--bg)}.paper-organization-logo:hover{border-color:var(--hairline-strong)}.paper-organization-logo img{width:100%;height:100%;padding:2px;-o-object-fit:contain;object-fit:contain}.paper-authors{font-size:13px;color:var(--ink-soft);margin-bottom:10px;font-family:var(--serif)}.paper-abstract{font-size:13.5px;color:var(--ink-soft);line-height:1.55;max-height:4.65em;margin-bottom:12px;font-family:var(--serif);text-wrap:pretty;display:-webkit-box;line-clamp:3;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.paper-tags{display:flex;flex-wrap:wrap;gap:6px}.paper-tags--clamped{--tag-row-height: 26px;max-height:calc(var(--tag-row-height) * 2 + 6px);overflow:hidden}.paper-sota{position:relative;white-space:nowrap;overflow:hidden;margin-bottom:12px;font-family:var(--mono);font-size:12px;line-height:1.6}.paper-sota-stack{margin-top:16px;padding-top:16px;border-top:1px solid var(--hairline)}.paper-sota-stack .paper-sota{margin-bottom:4px}.paper-sota-stack .paper-sota:last-child{margin-bottom:0}.paper-sota-measure{position:absolute;left:-9999px;top:0;visibility:hidden;white-space:pre;pointer-events:none}.paper-sota-label{font-weight:500;color:var(--ink-faint)}.paper-sota-label--sota{color:#b8860b}.paper-sota-sep,.paper-sota-on{color:var(--ink-faint)}.paper-sota-name{color:var(--accent-text)}.paper-sota-name:hover{text-decoration:underline}.paper-sota-more{font-size:11px;color:var(--ink-faint);cursor:pointer}.paper-sota-more:hover{color:var(--accent-text);text-decoration:underline}.paper-stats{display:flex;flex-direction:column;align-items:flex-end;gap:8px;font-family:var(--mono);font-size:11px;color:var(--ink-soft)}.upvote-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:8px 14px;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);font-family:var(--mono);font-size:13px;font-weight:500;min-width:56px;transition:all .15s}.upvote-btn:hover{border-color:var(--ink)}.upvote-btn.upvoted{background:var(--accent-soft);border-color:var(--accent);color:var(--accent-text)}.upvote-btn .arrow{font-size:9px;line-height:1;margin-bottom:2px}.upvote-btn .count{font-feature-settings:"tnum"}.stat-line{display:flex;align-items:center;gap:5px}.sort-bar{display:flex;align-items:center;justify-content:space-between;padding-bottom:16px;border-bottom:1px solid var(--hairline);margin-bottom:16px}.sort-options{display:flex;gap:4px}.sort-btn{padding:4px 10px;font-family:var(--mono);font-size:11px;font-weight:500;letter-spacing:.02em;color:var(--ink-soft);border-radius:4px;transition:all .15s;text-transform:lowercase}.sort-btn.active{background:var(--ink);color:var(--bg)}.sort-btn:not(.active):hover{background:var(--bg-subtle);color:var(--ink)}.paper-feed-toolbar-controls,.paper-feed-resource-controls,.paper-feed-filter-options{display:flex;align-items:center}.paper-feed-toolbar-controls{gap:14px;flex-wrap:wrap}.paper-feed-resource-controls{gap:10px}.paper-feed-resource-divider{width:1px;height:22px;background:var(--hairline)}.paper-feed-filter-options{gap:6px;flex-wrap:wrap}.paper-feed-filter{display:inline-flex;align-items:center;gap:6px;min-height:30px;padding:5px 10px;border:1px solid var(--hairline);border-radius:999px;background:var(--bg);color:var(--ink-soft);font-family:var(--mono);font-size:11px;letter-spacing:.01em;cursor:pointer;transition:border-color .15s,background .15s,color .15s}.paper-feed-filter-content{display:inline-flex;align-items:center;gap:6px}.paper-feed-filter:hover{border-color:var(--ink-faint);color:var(--ink)}.paper-feed-filter.active{border-color:var(--ink);background:var(--ink);color:var(--bg)}.paper-feed-filter:focus-visible{outline:2px solid var(--ink);outline-offset:2px}.paper-feed-filter-icon{display:inline-flex;color:currentColor;filter:grayscale(1)}.hf-resource-logo{position:relative;display:inline-flex;width:15px;height:15px}.hf-resource-logo img{position:absolute;top:0;right:0;bottom:0;left:0;display:block;width:15px;height:15px}.hf-resource-logo-white,.paper-feed-filter.active .hf-resource-logo-black{visibility:hidden}.paper-feed-filter.active .hf-resource-logo-white{visibility:visible}.paper-feed-filter-check{display:inline-flex;align-items:center;justify-content:center;width:17px;height:17px;border-radius:50%;background:color-mix(in srgb,var(--bg) 18%,transparent);color:currentColor;font-size:10px;line-height:1}.home-feed-sort-bar{flex-wrap:wrap;row-gap:10px}.results-count{font-family:var(--mono);font-size:11px;color:var(--ink-faint)}.paper-feed-scope-links{margin-top:12px;display:flex;flex-direction:column;align-items:flex-start;gap:8px}.paper-feed-primary-links,.paper-feed-task-tags{display:flex;flex-wrap:wrap;align-items:center;gap:10px}.papers-feed-layout-scoped{display:block}.paper-thumb{display:none}.papers-search-row{display:flex;margin-top:12px;margin-bottom:24px}.papers-search-input-wrap{display:flex;align-items:center;gap:8px;border:1px solid var(--hairline-strong);background:var(--bg-elevated);padding:10px 14px;border-radius:4px;flex:1;max-width:600px;color:var(--ink-faint)}.papers-search-input-wrap:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}.papers-search-input{flex:1;border:none;outline:none;background:transparent;font-family:var(--sans);font-size:14px;color:var(--ink)}.papers-search-input::-moz-placeholder{color:var(--ink-faint)}.papers-search-input::placeholder{color:var(--ink-faint)}@media (max-width: 880px){.feed-title{font-size:32px}.paper-card{grid-template-columns:120px 1fr;gap:16px;padding:20px 0}.paper-body{flex-direction:column;align-items:stretch;gap:12px}.paper-resources{width:auto;flex-direction:row;align-items:center;justify-content:flex-start;gap:24px;border-left:none;border-top:1px solid var(--hairline);padding-left:0;padding-top:12px}.paper-resource{flex-direction:row;gap:8px}.paper-resource .resource-stat{align-items:flex-start}}@media (min-width: 641px) and (max-width: 880px){.paper-thumb-wrap{min-width:0}.paper-thumb-wrap>div{width:100%!important;max-width:120px;height:auto!important;aspect-ratio:160 / 220}.paper-thumb-wrap>div>img,.paper-thumb-wrap>div>svg{width:100%!important;height:100%!important}.paper-thumb-skeleton{width:100%;max-width:120px;height:auto;aspect-ratio:160 / 220}}@media (max-width: 640px){.feed-header{margin-bottom:24px;gap:16px}.feed-title{font-size:26px}.paper-card{grid-template-columns:1fr;gap:12px}.paper-resources{border-top:none;padding-top:0}.paper-thumb-wrap{align-self:flex-start}.paper-title{font-size:19px}.paper-abstract{max-height:6.2em;-webkit-line-clamp:4;line-clamp:4}}.sort-options-time{margin-left:auto}.sort-btn-time{text-transform:none}@media (max-width: 900px){.sort-bar{flex-wrap:wrap;gap:8px}.sort-options-time{margin-left:0}}@media (max-width: 560px){.paper-feed-resource-divider{display:none}.paper-feed-resource-controls{gap:0}}.organization-hero{display:grid;grid-template-columns:minmax(260px,.34fr) minmax(0,1fr);align-items:center;gap:48px;margin:24px 0 32px}.organization-hero-profile{min-width:0}.organization-hero-title{display:flex;align-items:center;gap:14px}.organization-hero-title img{flex:none;-o-object-fit:contain;object-fit:contain}.organization-hero-links{display:flex;flex-wrap:wrap;gap:12px;margin-top:12px}.organization-contributions{width:100%;min-width:0}.organization-contributions-header{margin-bottom:12px}.organization-contributions-title{font-family:var(--serif);font-size:20px;font-weight:600;line-height:1.2}.organization-contributions-summary{margin-top:3px;color:var(--ink-soft);font-size:12px}.organization-contributions-legend{display:flex;align-items:center;justify-content:flex-start;gap:4px;margin-top:8px;color:var(--ink-faint);font-family:var(--mono);font-size:10px;white-space:nowrap}.organization-contributions-legend span:first-child{margin-right:3px}.organization-contributions-legend span:last-child{margin-left:3px}.organization-contributions-scroll{width:calc(100% + 34px);max-width:none;margin-left:-34px;overflow-x:auto;padding:2px 0;scrollbar-width:thin;scrollbar-color:var(--hairline-strong) transparent}.organization-contributions-plot{display:grid;grid-template-columns:25px auto;gap:9px;margin:0}.organization-contributions-weekdays{display:grid;grid-template-rows:repeat(7,12px);gap:3px;padding-top:24px;color:var(--ink-faint);font-family:var(--mono);font-size:9px;line-height:12px;text-align:right}.organization-contributions-months{display:grid;gap:3px;height:20px;color:var(--ink-faint);font-family:var(--mono);font-size:9px;line-height:12px}.organization-contributions-months span{grid-row:1;white-space:nowrap}.organization-contributions-grid{display:grid;grid-template-rows:repeat(7,12px);grid-auto-flow:column;gap:3px}.organization-contribution-cell{display:block;width:12px;height:12px;border:1px solid color-mix(in srgb,var(--hairline) 78%,transparent);border-radius:2px;background:var(--bg-subtle)}.organization-contribution-cell.level-1{border-color:color-mix(in srgb,var(--positive-border) 60%,transparent);background:color-mix(in srgb,var(--positive-bg) 65%,var(--positive-border))}.organization-contribution-cell.level-2{border-color:transparent;background:color-mix(in srgb,var(--positive-text) 35%,var(--positive-bg))}.organization-contribution-cell.level-3{border-color:transparent;background:color-mix(in srgb,var(--positive-text) 60%,var(--positive-bg))}.organization-contribution-cell.level-4{border-color:transparent;background:var(--positive-text)}.organization-contribution-cell.is-outside{visibility:hidden}.organization-contributions-skeleton{width:100%;height:154px;border-radius:6px}@media (max-width: 960px){.organization-hero{grid-template-columns:1fr;align-items:start;gap:28px}.organization-contributions-plot{margin:0 auto}.organization-contributions-scroll{width:100%;max-width:100%;margin-left:0}.organization-contributions-legend{justify-content:center;width:min(100%,826px);margin:8px auto 0}}@media (max-width: 640px){.organization-hero{margin-bottom:28px}.organization-contributions{max-width:calc(100vw - 28px)}}.tag-chip{display:inline-flex;align-items:center;gap:5px;padding:3px 9px;font-family:var(--mono);font-size:11px;font-weight:500;border-radius:4px;cursor:pointer;transition:filter .15s,transform .15s;white-space:nowrap;border:1px solid transparent}.tag-chip:hover{filter:brightness(.96);transform:translateY(-1px)}.tag-chip .dot{width:5px;height:5px;border-radius:50%}.paper-tags--clamped .tag-chip{line-height:16px}.tag-hero{padding:48px 0 32px;border-bottom:1px solid var(--hairline);margin-bottom:32px}.tag-hero-eyebrow{font-family:var(--mono);font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-faint);margin-bottom:12px;display:flex;align-items:center;gap:8px}.tag-hero-title{font-family:var(--serif);font-size:56px;font-weight:500;letter-spacing:-.025em;line-height:1;margin-bottom:16px;overflow-wrap:break-word}.tag-hero-meta{display:flex;gap:32px;margin-top:24px;font-family:var(--mono);font-size:12px;color:var(--ink-soft)}.tag-hero-meta .stat{display:flex;flex-direction:column;gap:4px}.tag-hero-meta .stat .label{font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-faint)}.tag-hero-meta .stat .value{font-family:var(--serif);font-size:22px;font-weight:500;color:var(--ink)}.tag-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:0;border-top:1px solid var(--hairline)}.tag-cell{padding:20px 24px;border-bottom:1px solid var(--hairline);border-right:1px solid var(--hairline);cursor:pointer;transition:background .15s;display:flex;flex-direction:column;gap:8px}.tag-cell:nth-child(3n){border-right:none}.tag-cell:hover{background:var(--bg-elevated)}.tag-cell .name{font-family:var(--serif);font-size:18px;font-weight:500;display:flex;align-items:center;gap:8px}.tag-cell .name .dot{width:8px;height:8px;border-radius:50%}.tag-cell .meta{font-family:var(--mono);font-size:11px;color:var(--ink-faint);display:flex;gap:12px}.tag-hero-meta .stat .value small{margin-left:2px;font-family:var(--mono);font-size:10px;font-weight:500;color:var(--ink-faint)}.framework-category{margin-top:32px}.framework-category-head{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;margin-bottom:16px}.framework-category-blurb{font-family:var(--serif);font-size:14px;line-height:1.55;color:var(--ink-soft);max-width:720px;margin:0}.framework-category-meta{font-family:var(--mono);font-size:11px;color:var(--ink-faint);white-space:nowrap}.framework-guide-link{display:inline-block;margin-top:8px;font-family:var(--mono);font-size:11px;color:var(--accent-text);text-decoration:none}.framework-guide-link:hover{text-decoration:underline}.framework-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px}.framework-card{border:1px solid var(--hairline);background:var(--bg-elevated);border-radius:6px;padding:18px 22px;scroll-margin-top:24px;display:flex;flex-direction:column;gap:12px;transition:border-color .15s}.framework-card:hover{border-color:var(--ink)}.framework-card-clickable{cursor:pointer}.framework-card-clickable:focus-visible{border-color:var(--ink);outline:2px solid var(--accent);outline-offset:2px}.framework-card-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}.framework-card-name{font-family:var(--serif);font-size:20px;font-weight:500;letter-spacing:-.01em;margin:0;color:var(--ink)}.framework-card-org{font-family:var(--mono);font-size:11px;color:var(--ink-faint);margin-top:4px}.framework-platform-row{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-end}.framework-platform-chip{font-family:var(--mono);font-size:10px;letter-spacing:.03em;text-transform:uppercase;padding:3px 8px;border-radius:3px;white-space:nowrap}.framework-card-desc{font-family:var(--sans);font-size:14px;line-height:1.55;color:var(--ink-soft);margin:0}.framework-card-when{font-family:var(--serif);font-style:italic;font-size:13px;line-height:1.5;color:var(--ink-soft);padding-top:4px;border-top:1px solid var(--hairline)}.framework-card-when-label{display:block;font-family:var(--mono);font-size:10px;font-style:normal;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-faint);margin-bottom:4px}.framework-card-links{display:flex;flex-wrap:wrap;gap:10px;margin-top:auto}.framework-link{display:inline-flex;align-items:center;gap:6px;font-family:var(--mono);font-size:11px;color:var(--accent-text);text-decoration:none;padding:4px 10px;border:1px solid var(--hairline);border-radius:4px;transition:border-color .15s,background .15s}.framework-link:hover{border-color:var(--ink);background:var(--bg-subtle)}.framework-link-disabled,.framework-link-disabled:hover{color:var(--ink-faint);background:transparent;border-color:var(--hairline);cursor:not-allowed}@media (max-width: 880px){.tag-grid{grid-template-columns:repeat(2,1fr)}.tag-cell:nth-child(3n){border-right:1px solid var(--hairline)}.tag-cell:nth-child(2n){border-right:none}.framework-category-head{flex-direction:column;gap:8px}.framework-card-head{flex-direction:column;gap:10px}.framework-platform-row{justify-content:flex-start}.tag-hero-title{font-size:40px}}@media (max-width: 640px){.tag-hero{padding:32px 0 24px;margin-bottom:24px}.tag-hero-title{font-size:30px}.tag-grid{grid-template-columns:1fr}.tag-cell{padding:16px;border-right:none!important}.framework-grid{grid-template-columns:1fr}.tag-hero-meta{gap:20px;flex-wrap:wrap}}.task-hero-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(320px,480px);gap:48px;align-items:start}.task-figure-card{background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:6px;padding:16px 16px 12px;margin:0;box-shadow:0 1px #00000005}.task-figure-img-wrap{width:100%;background:var(--bg);border-radius:4px;overflow:hidden;line-height:0}.task-figure-img{width:100%;height:auto;display:block}.task-figure-card--compact .task-figure-img{width:50%;margin:0 auto}.task-figure-card figcaption{font-family:var(--serif);font-style:italic;font-size:12px;color:var(--ink-faint);text-align:center;margin-top:10px;border-top:1px solid var(--hairline);padding-top:10px}.task-image-credit{color:var(--ink-faint);font-family:var(--mono);font-size:10px;font-style:normal}.task-image-credit p{margin:0}.task-image-credit a{color:inherit;text-decoration:underline;text-underline-offset:2px}.task-image-credit a:hover{color:var(--accent-text)}@media (max-width: 900px){.task-hero-grid{grid-template-columns:1fr;gap:24px}}.taxonomy-suggestion-cell{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;border-top:0;border-left:0;background:transparent;color:var(--ink-soft);text-align:left}.taxonomy-suggestion-cell .name{font-style:italic}.taxonomy-suggestion-icon{width:14px;height:14px}.task-page-grid{display:grid;grid-template-columns:1fr 260px;gap:56px;align-items:start}.task-explainer{font-family:var(--serif);font-size:17px;line-height:1.55;color:var(--ink);max-width:720px;margin-top:16px;margin-bottom:28px;text-wrap:pretty}.task-explainer p{margin:0 0 12px}.task-explainer p:last-child{margin-bottom:0}.task-explainer a{color:var(--accent-text);text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px}.task-explainer a:hover{color:var(--accent)}.task-explainer strong{color:var(--ink);font-weight:600}.task-explainer em{font-style:italic}.task-explainer code{font-family:var(--mono);font-size:.9em;background:var(--bg-elevated);padding:1px 5px;border-radius:3px}.task-research-trends{max-width:760px;margin:-8px 0 28px;border-left:2px solid var(--accent);background:var(--bg-elevated)}.task-research-trends-item{border-bottom:0}.task-research-trends-trigger{padding:18px 20px;color:var(--accent-text)}.task-research-trends-trigger:hover{text-decoration:none}.task-research-trends-trigger svg{width:16px;height:16px}.task-research-trends-title{font-family:var(--mono);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--accent-text)}.task-research-trends-content{padding:0 20px 16px}.task-research-trends ul{margin:0;padding-left:19px}.task-research-trends li{padding-left:4px;font-family:var(--serif);font-size:15px;line-height:1.5;color:var(--ink)}.task-research-trends li+li{margin-top:8px}.task-research-trends li::marker{color:var(--accent-text)}.task-research-trends p{margin:0}.task-research-trends a{color:var(--accent-text);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.task-quickstats{display:flex;gap:28px;font-family:var(--mono);font-size:11px;color:var(--ink-faint);letter-spacing:.05em;padding-bottom:14px;margin-bottom:0;border-bottom:1px solid var(--accent)}.task-quickstats .num{color:var(--ink);font-weight:600;font-size:12px;margin-right:5px;font-feature-settings:"tnum"}.task-framework-links{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin-top:14px}.task-framework-links-label{font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-faint);font-weight:600}.task-framework-link{display:inline-flex;align-items:center;gap:6px;font-family:var(--mono);font-size:12px;color:var(--ink);text-decoration:none;padding:4px 10px;border:1px solid var(--hairline);border-radius:999px;background:var(--bg-elevated);transition:color .15s,border-color .15s}.task-framework-link:hover{color:var(--accent-text);border-color:var(--accent)}.task-framework-link-stars{color:var(--ink-faint);font-size:11px}.task-side{position:sticky;top:100px;font-size:13px}.side-block{margin-bottom:28px}.side-block-num{font-family:var(--mono);font-size:10px;color:var(--accent-text);letter-spacing:.1em;margin-bottom:4px}.side-block-label{font-family:var(--mono);font-size:12px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink);font-weight:600;padding-bottom:8px;border-bottom:1px solid var(--hairline);margin-bottom:10px}.side-link-row{display:flex;justify-content:space-between;align-items:baseline;padding:5px 0;cursor:pointer;font-family:var(--serif);font-size:14px}.side-link-row:hover{color:var(--accent-text)}.side-link-row .count{font-family:var(--mono);font-size:11px;color:var(--ink-faint)}.side-domain-pill{font-family:var(--mono);font-size:11px;color:var(--accent-text);padding:6px 0}.side-method-row{display:flex;justify-content:space-between;align-items:center;padding:4px 0}.side-method-row .num{font-family:var(--mono);font-size:10.5px;color:var(--ink-faint)}.task-section-head{margin-top:28px;margin-bottom:14px}.task-section-eyebrow{font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--accent-text);margin-bottom:6px}.task-section-title{font-family:var(--mono);font-size:18px;font-weight:600;color:var(--ink);letter-spacing:.04em;text-transform:uppercase;display:flex;align-items:baseline;gap:10px}.task-section-title .meta{font-family:var(--mono);font-size:11px;color:var(--ink-faint);font-weight:400;letter-spacing:.05em;text-transform:none}.subtask-section{margin-bottom:24px}.subtask-section+.subtask-section{margin-top:8px}.subtask-head{display:flex;align-items:baseline;gap:10px;margin:18px 0 10px}.subtask-head-name{font-family:var(--mono);font-size:14px;font-weight:600;color:var(--ink);letter-spacing:.04em;text-transform:uppercase;text-decoration:none;transition:color .15s}.subtask-head-name:hover{color:var(--accent-text)}.subtask-head-meta{font-family:var(--mono);font-size:11px;color:var(--ink-faint);letter-spacing:.05em}.subtask-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;align-items:start}.subtask-grid .subtask-section{margin-bottom:0;border:1px solid var(--hairline);background:var(--bg-elevated);border-radius:6px;padding:12px 14px 10px}.subtask-grid .subtask-section+.subtask-section{margin-top:0}.subtask-grid .subtask-head{margin:0 0 8px;padding-bottom:8px;border-bottom:1px solid var(--hairline)}.subtask-grid .subtask-head-name{font-size:12px}.subtask-grid .subtask-head-meta{font-size:10px}.subtask-summary{display:flex;flex-direction:column;gap:7px;min-height:86px;color:var(--ink-soft);text-decoration:none;font-family:var(--mono);font-size:10px;line-height:1.4;letter-spacing:.05em;text-transform:uppercase}.subtask-summary:hover{color:var(--ink)}.subtask-summary-desc{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:3;font-family:var(--serif);font-size:13px;line-height:1.35;letter-spacing:0;text-transform:none;color:var(--ink-soft)}.subtask-grid .bench-row{display:grid;grid-template-columns:22px 1fr 16px;gap:10px;align-items:center;border:0;background:transparent;border-radius:0;padding:8px 0;margin-bottom:0;border-bottom:1px dashed var(--hairline);transition:none}.subtask-grid .bench-row:last-of-type{border-bottom:0}.subtask-grid .bench-row:hover{border-color:transparent}.subtask-grid .bench-row:hover .bench-row-name{color:var(--accent-text)}.subtask-grid .bench-row-num{font-size:10px}.subtask-grid .bench-row-name{font-size:13.5px;margin-bottom:2px;line-height:1.2}.subtask-grid .bench-row-sub{font-size:9.5px;letter-spacing:.06em}.subtask-grid .bench-row-arrow{font-size:14px}.subtask-grid .bench-show-more{font-size:10px;padding:6px 0 0;margin-top:2px}.bench-card{border:1px solid var(--hairline);background:var(--bg-elevated);border-radius:6px;padding:18px 22px;margin-bottom:14px;cursor:pointer;transition:border-color .15s}.bench-card:hover{border-color:var(--ink)}.bench-head{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:14px;gap:16px}.bench-name{font-family:var(--mono);font-size:14px;font-weight:600;letter-spacing:.02em;text-transform:uppercase;color:var(--ink)}.bench-sub{font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-faint);margin-top:4px}.bench-sota-value{font-family:var(--serif);font-size:36px;font-weight:500;color:var(--accent);font-feature-settings:"tnum";line-height:1}.bench-sota-tag{font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-faint);text-align:right;margin-top:4px}.bench-task-tag{font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--accent-text)}.domain-mega-title{font-family:var(--mono);font-size:56px;font-weight:600;letter-spacing:-.01em;line-height:1;text-transform:uppercase;margin-bottom:0;color:var(--ink);overflow-wrap:break-word}.benchmark-trend-table{border-top:1px solid var(--hairline)}.benchmark-trend-head,.benchmark-trend-row{display:grid;grid-template-columns:124px minmax(150px,.8fr) minmax(150px,.9fr) minmax(200px,1.3fr) 44px 78px;gap:20px;align-items:center}.benchmark-trend-head{padding:9px 16px;border-bottom:1px solid var(--hairline);font-family:var(--mono);font-size:9.5px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-faint)}.benchmark-trend-row{min-height:92px;padding:12px 16px;border-bottom:1px solid var(--hairline);background:transparent;transition:background .15s,border-color .15s}.benchmark-trend-row:hover{background:var(--bg-elevated);border-color:var(--hairline-strong)}.benchmark-trend-row:hover .bench-row-name{color:var(--accent-text)}.benchmark-trend-cell{min-width:0}.benchmark-trend-sparkline{display:block;width:112px;height:42px;overflow:visible}.benchmark-trend-axis{stroke:var(--hairline-strong);stroke-width:.8;stroke-dasharray:1.5 2.5;vector-effect:non-scaling-stroke}.benchmark-trend-area{fill:var(--accent-soft);opacity:.68}.benchmark-trend-line{fill:none;stroke:var(--accent);stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}.benchmark-trend-dot{fill:var(--bg-elevated);stroke:var(--accent);stroke-width:1.8;vector-effect:non-scaling-stroke}.benchmark-trend-point{cursor:crosshair;outline:none}.benchmark-trend-point-hit{fill:transparent}.benchmark-trend-point-mark{fill:var(--bg-elevated);stroke:var(--accent);stroke-width:1.25;opacity:0;transition:opacity .12s,r .12s;vector-effect:non-scaling-stroke}.benchmark-trend-point:hover .benchmark-trend-point-mark,.benchmark-trend-point:focus .benchmark-trend-point-mark{opacity:1;r:2.3px}.benchmark-trend-tooltip rect{fill:var(--ink);opacity:.94}.benchmark-trend-tooltip text{fill:var(--bg);font-family:var(--mono);font-size:3.2px;letter-spacing:.01em}.benchmark-trend-tooltip .benchmark-trend-tooltip-value{font-weight:700}.benchmark-trend-meta{display:flex;align-items:center;gap:6px;margin-top:3px;font-family:var(--mono);font-size:8.5px;letter-spacing:.035em;color:var(--ink-faint);white-space:nowrap}.benchmark-trend-meta strong{color:var(--ink-soft);font-weight:600}.benchmark-trend-change{padding:1px 4px;border-radius:999px;font-size:8px;font-weight:600}.benchmark-trend-change.is-up,.benchmark-trend-change.is-new{color:var(--positive-text);background:var(--positive-bg)}.benchmark-trend-change.is-down{color:var(--negative-text);background:var(--negative-bg)}.benchmark-trend-benchmark{min-width:0}.benchmark-trend-row .bench-row-name{display:block;margin-bottom:5px}.benchmark-trend-row .bench-row-best{width:100%;justify-content:flex-start;text-align:left}.bench-row-best-empty{color:var(--ink-faint);font-family:var(--mono)}.bench-row-paper{min-width:0;font-family:var(--serif);font-size:14px;line-height:1.35}.bench-row-paper a{color:var(--accent-text)}.bench-row-paper a:hover{text-decoration:underline}.bench-row-code{display:flex;justify-content:center}.bench-row-code a{display:inline-flex;color:var(--ink-soft);transition:color .15s,transform .15s}.bench-row-code a:hover{color:var(--accent-text);transform:translateY(-1px)}.bench-row-compare{display:flex;justify-content:center}.bench-row-compare a{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:30px;padding:0 10px;border:1px solid var(--accent);border-radius:999px;color:var(--accent-text);font-family:var(--mono);font-size:9px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;white-space:nowrap;transition:color .15s,background .15s}.bench-row-compare a svg{transition:transform .15s}.bench-row-compare a:hover{color:var(--bg);background:var(--accent)}.bench-row-compare a:hover svg{transform:translate(2px)}.bench-row-compare a:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.bench-row{display:grid;grid-template-columns:36px 1fr auto 28px;gap:18px;align-items:center;padding:16px 18px;border:1px solid var(--hairline);background:var(--bg-elevated);border-radius:6px;margin-bottom:8px;cursor:pointer;transition:border-color .15s,transform .15s}.bench-row:hover{border-color:var(--ink)}.bench-row:hover .bench-row-arrow{color:var(--accent-text);transform:translate(3px)}.bench-row-num{font-family:var(--mono);font-size:11px;color:var(--ink-faint);letter-spacing:.05em;font-feature-settings:"tnum"}.bench-row-name{font-family:var(--serif);font-size:18px;font-weight:500;color:var(--ink);letter-spacing:-.005em;margin-bottom:4px}.bench-row-sub{display:flex;align-items:center;gap:8px;font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-faint)}.bench-row-sub strong{color:var(--ink-soft);font-weight:600}.bench-row-sub .dot-sep{color:var(--hairline-strong)}.bench-row-sota{text-align:right}.bench-row-sota-value{font-family:var(--serif);font-size:22px;font-weight:500;color:var(--accent-text);font-feature-settings:"tnum";line-height:1}.bench-row-sota-tag{font-family:var(--mono);font-size:9.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-faint);margin-top:4px}.bench-row-arrow{font-family:var(--serif);font-size:18px;color:var(--hairline-strong);text-align:center;transition:color .15s,transform .15s}.bench-row-best{display:flex;align-items:center;justify-content:flex-end;gap:6px;max-width:240px;text-align:right}.bench-row-best-icon{color:var(--accent-text);flex:0 0 auto}.bench-row-best-name{font-family:var(--serif);font-size:14px;color:var(--ink-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bench-show-more{font-family:var(--mono);font-size:11px;letter-spacing:.05em;color:var(--ink-faint);background:transparent;border:0;padding:8px 2px 2px;margin-top:4px;cursor:pointer;text-transform:lowercase;transition:color .15s}.bench-show-more:hover{color:var(--accent-text)}.bm-action-btn{display:inline-flex;align-items:center;gap:8px;padding:8px 14px;border:1px solid var(--hairline);border-radius:6px;background:var(--bg-elevated);font-family:var(--sans);font-size:13px;font-style:normal;color:var(--ink);cursor:pointer;transition:border-color .15s}.bm-action-btn:hover{border-color:var(--ink)}.bm-action-btn svg{display:block}@media (max-width: 880px){.task-page-grid{grid-template-columns:1fr;gap:32px}.task-side{position:static;top:auto;order:-1}.subtask-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.domain-mega-title{font-size:40px}.bench-row{grid-template-columns:28px 1fr auto;gap:12px;padding:14px}.bench-row>.bench-row-arrow{display:none}.bench-row-best{max-width:130px}.bench-row-best-name{font-size:12.5px}.benchmark-trend-head,.benchmark-trend-row{grid-template-columns:112px minmax(130px,.8fr) minmax(120px,.8fr) minmax(160px,1.2fr) 36px 72px;gap:14px}.benchmark-trend-sparkline{width:104px}}@media (max-width: 640px){.domain-mega-title{font-size:30px}.subtask-grid{grid-template-columns:1fr}.benchmark-trend-head{display:none}.benchmark-trend-row{grid-template-columns:100px minmax(0,1fr) 28px;grid-template-areas:"trend benchmark code" "trend best code" "trend paper paper" "trend compare compare";gap:4px 12px;min-height:120px;padding:12px 4px}.benchmark-trend-cell{grid-area:trend}.benchmark-trend-benchmark{grid-area:benchmark}.benchmark-trend-row .bench-row-best{grid-area:best;justify-content:flex-start;max-width:none;text-align:left}.benchmark-trend-row .bench-row-paper{grid-area:paper}.benchmark-trend-row .bench-row-code{grid-area:code}.benchmark-trend-row .bench-row-compare{grid-area:compare;justify-content:flex-start;margin-top:4px}.bench-row-compare a{min-height:26px;padding:0 9px;font-size:8.5px}.benchmark-trend-sparkline{width:96px}.benchmark-trend-meta{flex-wrap:wrap;gap:3px;white-space:normal}.task-quickstats{flex-wrap:wrap;gap:16px}}.paper-meta-line .arxiv-id{color:var(--accent-text)}.paper-authors .institution{font-style:italic;color:var(--ink-faint)}.paper-tags--clamped .method-chip{line-height:16px}.method-hero-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(360px,560px);gap:56px;align-items:start}.method-hero-grid--wide-figure{grid-template-columns:minmax(0,1fr) minmax(480px,640px)}.method-figure-card{background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:6px;padding:16px 16px 12px;margin:0;box-shadow:0 1px #00000005}.method-figure-svg{width:100%;display:block}.method-figure-svg--schematic{aspect-ratio:360 / 420}.method-figure-img{width:100%;height:auto;display:block}.method-figure-svg--compact .method-figure-img{width:50%;margin:0 auto}.method-figure-svg--scaled-80 .method-figure-img{width:80%;margin:0 auto}.method-figure-card figcaption{font-family:var(--serif);font-style:italic;font-size:12px;color:var(--ink-faint);text-align:center;margin-top:10px;border-top:1px solid var(--hairline);padding-top:10px}.method-image-credit{color:var(--ink-faint);font-family:var(--mono);font-size:10px;font-style:normal}.method-image-credit p{margin:0}.method-image-credit a{color:inherit;text-decoration:underline;text-underline-offset:2px}.method-image-credit a:hover{color:var(--accent-text)}.method-description{font-family:var(--serif);font-size:17px;color:var(--ink-soft);max-width:720px;line-height:1.6;margin-top:16px;text-wrap:pretty}.method-description p{margin:0 0 12px}.method-description p:last-child{margin-bottom:0}.method-description a{color:var(--accent-text);text-decoration:underline;text-underline-offset:2px;text-decoration-thickness:1px}.method-description a:hover{color:var(--accent)}.method-description strong{color:var(--ink);font-weight:600}.method-description code{font-family:var(--mono);font-size:.9em;background:var(--bg-elevated);padding:1px 5px;border-radius:3px}.method-description ul,.method-description ol{padding-left:22px;margin:0 0 12px}.method-description ul{list-style-type:disc}.method-description ol{list-style-type:decimal}.method-description li{margin-bottom:4px}.method-description .katex-display{margin:14px 0;overflow-x:auto;overflow-y:hidden;padding:4px 0}.method-description .katex{font-size:1em}.method-source{margin-top:22px;display:flex;flex-direction:column;gap:6px;max-width:720px}.method-source-label{font-family:var(--mono);font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-faint)}.method-source-link{display:flex;flex-direction:column;gap:2px;padding:12px 14px;background:var(--bg-elevated);border:1px solid var(--hairline);border-left:3px solid var(--accent-text);border-radius:3px;cursor:pointer;transition:background .12s,border-color .12s;text-decoration:none}.method-source-link:not(.is-static):hover{background:var(--bg-subtle);border-color:var(--hairline-strong);border-left-color:var(--accent)}.method-source-link.is-static{cursor:default}.method-source-title{font-family:var(--serif);font-size:17px;font-weight:500;color:var(--ink);letter-spacing:-.005em}.method-source-link:not(.is-static):hover .method-source-title{text-decoration:underline;text-underline-offset:3px;text-decoration-thickness:1px}.method-source-meta{font-family:var(--mono);font-size:11px;color:var(--ink-faint)}@media (max-width: 1024px){.method-hero-grid{grid-template-columns:1fr;gap:24px}.method-figure-card{max-width:560px}.method-hero-grid--wide-figure .method-figure-card{max-width:640px}}.method-hero-title{font-family:var(--mono);font-size:48px;letter-spacing:-.01em}.method-trending-icon{flex:0 0 auto;color:var(--accent-text);fill:color-mix(in srgb,var(--accent-text) 18%,transparent)}.method-trend-score{color:var(--accent-text);font-weight:600}.method-trend-panel{margin-top:20px;padding-top:14px;border-top:1px solid var(--hairline-strong)}.method-trend-header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:4px}.method-trend-eyebrow{margin-bottom:5px;font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--accent-text)}.method-trend-header p{margin:3px 0 0;font-family:var(--mono);font-size:11px;color:var(--ink-faint)}.method-trend-summary{display:flex;flex-direction:column;align-items:flex-end;flex:0 0 auto;font-family:var(--mono);font-size:10px;color:var(--ink-faint)}.method-trend-summary>strong{font-family:var(--serif);font-size:19px;font-weight:500;line-height:1;color:var(--ink)}.method-usage-chart-wrap{position:relative;width:100%}.method-usage-chart{display:block;width:100%;height:auto;overflow:visible}.method-usage-gridline{stroke:var(--hairline);stroke-width:1}.method-usage-y-label,.method-usage-x-label{fill:var(--ink-faint);font-family:var(--mono);font-size:9px}.method-usage-bar-hit{fill:transparent}.method-usage-bar-mark{fill:color-mix(in srgb,var(--accent-text) 48%,var(--bg));transition:fill .12s}.method-usage-bar.is-current .method-usage-bar-mark{opacity:.55}.method-usage-bar:hover .method-usage-bar-mark,.method-usage-bar:focus .method-usage-bar-mark,.method-usage-bar.is-active .method-usage-bar-mark{fill:var(--accent-text)}.method-usage-bar:focus{outline:none}.method-usage-tooltip{position:absolute;top:4px;right:8px;display:flex;gap:8px;padding:5px 8px;border:1px solid var(--hairline-strong);background:var(--bg);font-family:var(--mono);font-size:10px;color:var(--ink-soft);pointer-events:none}.method-trend-skeleton{margin-top:20px}.method-trend-note{margin:6px 0 0;color:var(--ink-faint);font-family:var(--mono);font-size:10px}@media (max-width: 640px){.method-trend-header{flex-direction:column;gap:12px}.method-trend-summary{align-items:flex-start}}.method-chip{display:inline-flex;align-items:center;padding:4px 10px;font-family:var(--mono);font-size:11px;font-weight:500;color:var(--ink);background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:4px;cursor:pointer;transition:all .15s;white-space:nowrap}.method-chip:hover{border-color:var(--ink);background:var(--bg-subtle)}.side-method-row .method-chip{font-size:10.5px;padding:3px 8px}@media (max-width: 880px){.method-hero-title{font-size:40px}}@media (max-width: 640px){.method-hero-title{font-size:30px}}.filter-row{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-bottom:24px;padding:12px 16px;border:1px solid var(--hairline);border-radius:8px;background:var(--bg-elevated)}.filter-row .label{margin-right:8px;color:var(--ink-faint);font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase}.search-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#1a181466;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);z-index:100;display:flex;align-items:flex-start;justify-content:center;padding-top:100px}.search-modal{width:640px;max-width:calc(100vw - 32px);background:var(--bg);border:1px solid var(--hairline-strong);border-radius:12px;box-shadow:0 20px 60px #00000026;overflow:hidden}.search-modal-input{width:100%;padding:18px 20px;font-size:16px;font-family:var(--serif);border:none;background:transparent;outline:none;border-bottom:1px solid var(--hairline);color:var(--ink)}.search-modal-input::-moz-placeholder{color:var(--ink-faint);font-style:italic}.search-modal-input::placeholder{color:var(--ink-faint);font-style:italic}.search-results{max-height:480px;overflow-y:auto;padding:8px}.search-empty{padding:32px;text-align:center;color:var(--ink-faint);font-family:var(--serif);font-style:italic}.search-section-label{font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-faint);padding:10px 12px 6px}.search-result{display:flex;flex-direction:column;padding:10px 12px;border-radius:6px;cursor:pointer;gap:4px}.search-result:hover,.search-result.focused{background:var(--bg-subtle)}.search-result-title{font-family:var(--serif);font-size:14.5px;font-weight:500;line-height:1.3}.search-result-meta{font-family:var(--mono);font-size:10.5px;color:var(--ink-faint);display:flex;gap:10px}.search-result-tag{display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:6px;cursor:pointer}.search-result-tag:hover,.search-result-tag.focused{background:var(--bg-subtle)}.search-result-tag .name{font-family:var(--mono);font-size:12px}.search-result-tag .count{margin-left:auto;font-family:var(--mono);font-size:10px;color:var(--ink-faint)}.search-paper-pagination{display:flex;align-items:center;justify-content:space-between;padding:10px 12px 6px;border-top:1px solid var(--hairline);font-family:var(--mono);font-size:10px;color:var(--ink-faint)}.search-paper-pagination button{border:1px solid var(--hairline-strong);border-radius:5px;background:var(--bg);color:var(--ink-soft);padding:5px 9px;font:inherit;cursor:pointer}.search-paper-pagination button:hover:not(:disabled){background:var(--bg-subtle);color:var(--ink)}.search-paper-pagination button:disabled{opacity:.4;cursor:default}@media (max-width: 640px){.search-modal-input{font-size:16px;padding:14px 16px}}.search-ask-row{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;border-radius:6px;text-align:left;color:var(--ink)}.search-ask-row:hover{background:var(--bg-subtle)}.search-ask-chip{display:inline-flex;align-items:center;font-family:var(--mono);font-size:10.5px;color:var(--accent-text);background:var(--accent-soft);border-radius:5px;padding:2px 7px;flex:none}.search-ask-text{flex:1;min-width:0;font-family:var(--serif);font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.search-ask-row kbd{font-family:var(--sans);font-size:11px;color:var(--ink-faint);border:1px solid var(--hairline);border-radius:5px;padding:1px 6px}.search-empty-sub{display:block;margin-top:10px;font-family:var(--sans);font-style:normal;font-size:12px;color:var(--ink-faint)}.settings-section{border:1px solid var(--hairline);border-radius:10px;padding:20px 22px;margin-top:8px;max-width:760px}.settings-section-title{font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--ink-faint);margin:0 0 14px}.settings-note-flush{margin-top:0;padding-top:0;border-top:0}.settings-billing-loading{color:var(--ink-soft);font-size:13px}.settings-billing,.settings-billing-connect{display:flex;flex-direction:column;gap:14px}.settings-provider-grid{display:grid;gap:14px}.settings-provider-card{display:flex;flex-direction:column;gap:14px;padding:16px;border:1px solid var(--hairline);border-radius:8px;background:var(--bg-subtle)}.settings-provider-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.settings-provider-heading h3{margin:0;color:var(--ink);font-size:16px;font-weight:650}.settings-provider-heading p{margin:3px 0 0;color:var(--ink-soft);font-size:12px}.settings-usage-row{display:flex;flex-direction:column;gap:9px;padding:13px;border:1px solid var(--hairline);border-radius:7px;background:var(--bg-elevated)}.settings-usage-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.settings-usage-heading strong{flex-shrink:0;color:var(--ink);font-size:14px}.settings-usage-track{height:7px;overflow:hidden;border-radius:999px;background:var(--hairline)}.settings-usage-track>span{display:block;height:100%;border-radius:inherit;background:var(--accent)}.settings-limit-note{margin:0;color:var(--danger, #b42318);font-size:12px;line-height:1.45}.settings-byok-controls{display:flex;flex-direction:column;gap:10px;padding-top:2px}.settings-byok-controls form{display:flex;flex-direction:column;gap:10px}.settings-byok-controls input{width:100%;border:1px solid var(--hairline-strong);border-radius:7px;padding:10px 12px;color:var(--ink);background:var(--bg-elevated);font:inherit}.settings-fallback-control{display:flex;align-items:flex-start;gap:11px;cursor:pointer}.settings-fallback-control>span{display:flex;flex-direction:column;gap:4px}.settings-fallback-control strong{color:var(--ink);font-size:12px;line-height:1.4}.settings-fallback-control small{color:var(--ink-soft);font-size:11px;line-height:1.45}.settings-plan-row{display:flex;justify-content:space-between;align-items:flex-start;gap:20px}.settings-connected-badge{border-radius:999px;padding:4px 9px;color:var(--accent-text);background:var(--accent-soft);font-size:11px;font-weight:600}.settings-billing-help{color:var(--ink-soft);font-size:11px;margin:0;line-height:1.5}.settings-billing-actions{display:flex;flex-wrap:wrap;gap:8px}.settings-billing-actions .button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:34px;padding:7px 11px;border:1px solid var(--hairline-strong);border-radius:7px;color:var(--ink);background:var(--bg-elevated);font-size:12px;font-weight:600;text-decoration:none}.settings-billing-actions .button:hover{background:var(--bg-subtle)}.settings-billing-actions .button-primary{border-color:var(--accent);color:var(--accent-text);background:var(--accent-soft)}.settings-billing-actions .button:disabled{cursor:not-allowed;opacity:.55}.settings-billing-actions svg{width:12px;height:12px}.settings-token-label{color:var(--ink);font-size:12px;font-weight:600;margin-bottom:-8px}.settings-billing-connect input{width:100%;border:1px solid var(--hairline-strong);border-radius:7px;padding:10px 12px;color:var(--ink);background:var(--bg-elevated);font:inherit}.settings-billing-select{width:100%;min-height:42px;padding:9px 34px 9px 12px;border:1px solid var(--border);border-radius:7px;background:var(--bg-elevated);color:var(--ink);font:inherit}.settings-billing-select:focus{outline:2px solid var(--accent);outline-offset:1px}.settings-billing-select:disabled{cursor:wait;opacity:.7}.settings-billing-connect input:focus{border-color:var(--accent);outline:2px solid var(--accent-soft)}.settings-token-error{color:var(--danger, #b42318);font-size:12px}.theme-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.theme-option{display:flex;align-items:flex-start;gap:10px;min-width:0;padding:12px;border:1px solid var(--hairline);border-radius:7px;background:var(--bg-elevated);color:var(--ink-soft);text-align:left;transition:background .15s,border-color .15s,color .15s}.theme-option:hover{border-color:var(--hairline-strong);background:var(--bg-subtle);color:var(--ink)}.theme-option.is-selected{border-color:var(--accent);background:var(--accent-soft);color:var(--accent-text)}.theme-option:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.theme-option>svg{width:16px;height:16px;margin-top:1px;flex-shrink:0}.theme-option-copy{display:flex;flex-direction:column;gap:2px;min-width:0}.theme-option-label{color:var(--ink);font-size:13px;font-weight:600}.theme-option-desc{color:var(--ink-soft);font-size:11px;line-height:1.35}.theme-option.is-selected .theme-option-label,.theme-option.is-selected .theme-option-desc{color:var(--accent-text)}.settings-row{display:flex;align-items:flex-start;justify-content:space-between;gap:24px}.settings-row-text{display:flex;flex-direction:column;gap:4px;cursor:pointer}.settings-row-label{font-size:15px;font-weight:500;color:var(--ink)}.settings-row-desc{font-size:13px;color:var(--ink-soft);line-height:1.5;max-width:460px}.settings-note{margin-top:16px;padding-top:16px;border-top:1px solid var(--hairline);font-size:13px;color:var(--ink-soft);line-height:1.5}.settings-note-action{margin-top:10px}.closed-eval-tooltip-link,.external-eval-tooltip-link{font-weight:600;text-decoration:underline;text-underline-offset:2px}@media (max-width: 640px){.theme-options{grid-template-columns:1fr}}.paper-reader-shell{height:100dvh;min-height:0;display:flex;flex-direction:column;background:var(--bg);color:var(--ink);overflow:hidden}.reader-header{height:48px;flex:0 0 auto;display:flex;align-items:center;gap:14px;padding:0 14px;border-bottom:1px solid var(--border);background:var(--surface)}.reader-back,.reader-brand,.reader-paper-titlebar a{color:inherit;text-decoration:none}.reader-back{font-size:13px}.reader-brand{font-weight:650;letter-spacing:-.02em}.reader-brand em{font-weight:400}.reader-header-spacer{flex:1}.reader-workspace{position:relative;min-height:0;flex:1;display:flex;overflow:hidden}.reader-paper-pane,.reader-assistant-pane{min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}.reader-paper-pane{background:#3f4248}.reader-assistant-pane{background:var(--bg)}.reader-paper-titlebar{min-height:42px;flex:0 0 auto;display:flex;align-items:center;gap:12px;padding:7px 12px;background:var(--surface);border-bottom:1px solid var(--border)}.reader-paper-titlebar a{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}.reader-paper-titlebar span{flex:0 0 auto;color:var(--ink-faint);font:11px var(--mono)}.reader-resize-handle{position:relative;z-index:5;width:8px;flex:0 0 8px;cursor:col-resize;background:var(--border);touch-action:none;outline:none}.reader-resize-handle:after{content:"";position:absolute;top:0;right:2px;bottom:0;left:2px;background:var(--ink-faint);opacity:.25}.reader-resize-handle:focus-visible{box-shadow:inset 0 0 0 2px var(--accent)}.reader-resize-handle button{position:absolute;z-index:2;top:50%;left:50%;width:18px;height:32px;transform:translate(-50%,-50%);border:1px solid var(--border);border-radius:9px;background:var(--surface);color:var(--ink-faint);cursor:pointer}.reader-collapse-assistant{position:absolute;z-index:8;right:10px;top:8px;border:1px solid var(--border);border-radius:6px;padding:5px 8px;background:var(--surface);color:var(--ink-muted);font-size:11px}.reader-tabs{height:40px;flex:0 0 auto;display:flex;border-bottom:1px solid var(--border);background:var(--surface)}.reader-tabs button{flex:1;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--ink-muted)}.reader-tabs button[aria-selected=true]{border-bottom-color:var(--accent);color:var(--ink);font-weight:600}.reader-workspace .is-hidden{position:absolute!important;top:0;right:0;bottom:0;left:0;width:100%!important;visibility:hidden;pointer-events:none}.reader-workspace.is-tabs>.reader-paper-pane,.reader-workspace.is-tabs>.reader-assistant-pane{width:100%}.reader-status{min-height:100dvh;display:grid;place-content:center;gap:12px;text-align:center}.reader-chat-unavailable{height:100%;display:grid;place-content:center;color:var(--ink-muted);padding:24px;text-align:center}.pdf-viewer{min-height:0;flex:1;display:flex;flex-direction:column}.pdf-toolbar{position:relative;min-height:42px;flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:5px 8px;background:#25272b;color:#f8f8f8;font-size:12px}.pdf-toolbar-group{display:flex;align-items:center;gap:5px}.pdf-toolbar button,.pdf-toolbar a{min-height:30px;border:1px solid #555;border-radius:4px;padding:4px 8px;background:#33363b;color:inherit;text-decoration:none}.pdf-toolbar button:focus-visible,.pdf-toolbar a:focus-visible,.pdf-search-controls input:focus-visible{outline:2px solid #80bfff;outline-offset:1px}.pdf-toolbar button:disabled{opacity:.45}.pdf-page-form{display:flex;align-items:center;gap:4px}.pdf-page-form input{width:48px;min-height:28px;border:1px solid #555;border-radius:4px;background:#18191c;color:#fff;text-align:center}.pdf-zoom-value{min-width:42px;text-align:center;font-variant-numeric:tabular-nums}.pdf-search-controls{position:absolute;z-index:10;right:8px;top:calc(100% + 5px);display:flex;align-items:center;gap:5px;padding:7px;border-radius:6px;background:#25272b;box-shadow:0 5px 20px #0008}.pdf-search-controls input{width:min(260px,45vw);min-height:30px;border:1px solid #555;border-radius:4px;padding:4px 7px;background:#18191c;color:#fff}.pdf-search-controls span{min-width:70px;color:#ccc;text-align:center}.pdf-scroll{min-height:0;flex:1;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}.pdf-pages{display:flex;flex-direction:column;align-items:flex-start;gap:8px;min-width:-moz-max-content;min-width:max-content}.pdf-page{background:#fff;box-shadow:0 1px 5px #0008}.pdf-page .react-pdf__Page{margin:0}.pdf-loading,.pdf-error{min-height:50vh;display:grid;place-content:center;color:#fff;text-align:center;padding:24px}.pdf-error a,.pdf-error button{color:inherit}.chat-page--reader .chat-main{min-width:0}.chat-page--reader .chat-topbar{padding-right:96px}.chat-page--reader .chat-empty-inner{width:min(100%,560px);padding-inline:16px}.chat-reader-action{border:0;background:transparent;color:var(--accent-text);text-decoration:none;font-size:12px;white-space:nowrap}@media (max-width: 640px){.reader-header{padding-inline:8px}.reader-brand,.reader-paper-titlebar span,.pdf-zoom-value{display:none}.pdf-toolbar{flex-wrap:wrap}.pdf-toolbar-group{gap:3px}.pdf-toolbar button,.pdf-toolbar a{padding-inline:6px}}@media (forced-colors: active){.reader-resize-handle,.pdf-toolbar button,.pdf-toolbar a{border:1px solid ButtonText}}@media (prefers-reduced-motion: reduce){.paper-reader-shell *{scroll-behavior:auto!important}}.saved-area-section{margin-top:28px}.saved-area-section:first-of-type{margin-top:4px}.saved-area-heading{font-family:var(--serif);font-size:22px;font-weight:500;color:var(--ink);margin:0 0 6px;padding-bottom:6px;border-bottom:1px solid var(--hairline-strong)}.saved-task-block{margin-top:16px}.saved-task-row{display:flex;align-items:center;gap:10px;margin-bottom:6px}.saved-task-count{font-size:12px;color:var(--ink-faint)}.saved-signin-panel{display:flex;justify-content:center;padding:80px 0}.saved-bucket-migration{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:24px;padding:14px 16px;border:1px solid var(--info-border);border-radius:6px;background:var(--info-bg);color:var(--info-text)}.saved-bucket-migration p{max-width:760px;font-size:13px;line-height:1.5}.saved-bucket-migration .hf-signin-btn{flex-shrink:0}@media (max-width: 700px){.saved-bucket-migration{align-items:flex-start;flex-direction:column}}.action-btn.is-saved{background:var(--ink);color:var(--bg);border-color:var(--ink)}.action-btn.is-saved:hover{background:color-mix(in oklch,var(--ink) 88%,var(--accent))}.ask-home-new{max-width:640px;margin:0 auto 6px;padding-left:9px;color:var(--ink-faint);font-size:14px;font-weight:700}.ask-home{position:relative;max-width:640px;margin:0 auto 36px;background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:14px;box-shadow:0 1px 2px #1e1c140a,0 12px 34px -18px #1e1c1447;padding:8px}.ask-home-textarea-wrap{position:relative}.ask-home textarea{position:relative;z-index:1;width:100%;border:0;outline:0;resize:none;background:transparent;font-family:var(--serif);font-size:17px;line-height:1.45;color:transparent;caret-color:var(--ink);padding:12px 12px 4px}.ask-home textarea::-moz-placeholder{color:var(--ink-faint)}.ask-home textarea::placeholder{color:var(--ink-faint)}.ask-home-foot{display:flex;align-items:center;justify-content:space-between;padding:4px 6px 4px 12px}.ask-home-provider-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.ask-home-hint{display:flex;align-items:center;gap:7px;font-size:12px;color:var(--ink-soft)}.ask-home-hint svg{color:var(--accent-text)}.ask-home-hint code{font-family:var(--mono);font-size:11px;background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:5px;padding:1px 6px}.chat-page{position:relative;display:flex;overflow:hidden;background:var(--bg)}.chat-main{flex:1;display:flex;flex-direction:column;min-width:0;background:var(--bg)}.chat-topbar{display:flex;align-items:center;gap:14px;padding:10px 24px;border-bottom:1px solid var(--hairline)}.chat-topbar-title{flex:1;min-width:0;font-family:var(--serif);font-size:14px;color:var(--ink-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-empty{flex:1;display:flex;align-items:center;justify-content:center;padding:40px 24px;overflow-y:auto}.chat-empty-inner{max-width:680px;width:100%;text-align:center}.chat-empty-eyebrow{font-family:var(--mono);font-size:11px;letter-spacing:.16em;text-transform:uppercase;color:var(--ink-faint);margin-bottom:18px}.chat-empty-title{font-family:var(--serif);font-weight:500;font-size:44px;line-height:1.05;letter-spacing:-.02em;margin-bottom:14px}.chat-empty-title em{font-style:italic;font-weight:400;color:var(--accent)}.chat-empty-sub{font-family:var(--serif);font-size:16px;line-height:1.5;color:var(--ink-soft);max-width:520px;margin:0 auto 26px;text-wrap:pretty}.chat-staging-access-note{max-width:560px;margin:-12px auto 18px;color:var(--ink-soft);font-size:13px;line-height:1.45}.chat-staging-badge{flex:none;border:1px solid color-mix(in oklch,var(--accent) 36%,var(--hairline));border-radius:999px;padding:3px 7px;color:var(--accent-text);background:color-mix(in oklch,var(--accent) 7%,var(--bg-elevated));font-family:var(--mono);font-size:10px;font-weight:700;letter-spacing:.08em;line-height:1;text-transform:uppercase}.chat-examples{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;margin-top:24px}.chat-example{font-family:var(--serif);font-size:14px;color:var(--ink-soft);background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:999px;padding:8px 16px;transition:border-color .15s,color .15s}.chat-example:hover{border-color:var(--hairline-strong);color:var(--ink)}.chat-paper-inline-highlight{color:var(--accent-text);text-decoration-line:underline;text-decoration-color:color-mix(in oklch,var(--accent) 40%,transparent);text-decoration-thickness:1px;text-underline-offset:2px}.chat-paper-inline-highlight.is-unavailable{color:var(--negative-text);text-decoration-color:var(--negative-border)}@media (max-width: 900px){.chat-empty-title{font-size:34px}}@media (forced-colors: active){.chat-paper-inline-highlight{outline:1px solid CanvasText}}@media (max-width: 560px){.chat-topbar{padding-inline:14px}}@media (min-width: 901px){.app-header-chat .app-header-inner{max-width:none;padding-left:0}.app-header-chat .brand{width:280px;flex:none;justify-content:center}.app-header-chat .nav{margin-left:0}}.chat-sidebar{width:280px;flex:none;background:var(--bg-subtle);border-right:1px solid var(--hairline);display:flex;flex-direction:column;transition:margin-left .2s ease}.chat-sidebar-closed{margin-left:-281px}.chat-sidebar-top{display:flex;align-items:center;gap:8px;padding:14px 12px 8px}.chat-sidebar-top .icon-btn{flex:none}.chat-new-chat{flex:1;display:flex;align-items:center;justify-content:center;gap:8px;padding:9px;background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:8px;font-size:13px;font-weight:500;color:var(--ink);transition:border-color .15s}.chat-new-chat:hover{border-color:var(--hairline-strong)}.chat-sessions{flex:1;overflow-y:auto;padding:4px 8px 20px}.chat-sessions-empty{padding:18px 10px;font-family:var(--serif);font-style:italic;font-size:13px;color:var(--ink-faint)}.chat-session-group{margin-top:14px}.chat-session-group-label{font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-faint);padding:6px 10px}.chat-session{display:flex;align-items:center;gap:6px;width:100%;text-align:left;padding:7px 10px;border-radius:7px;font-size:13px;color:var(--ink-soft);transition:background .12s,color .12s}.chat-session:hover{background:var(--hairline);color:var(--ink)}.chat-session-active{background:var(--hairline);color:var(--ink);font-weight:500}.chat-session-title{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-session-delete{display:none;align-items:center;color:var(--ink-faint);padding:2px;border-radius:4px;flex:none}.chat-session:hover .chat-session-delete{display:inline-flex}.chat-session-delete:hover{color:var(--negative-text)}.chat-session-menu{display:none;border:0;background:transparent;color:inherit;cursor:pointer;padding:0 3px;font-size:17px;line-height:1}.chat-session:hover .chat-session-menu,.chat-session:focus-within .chat-session-menu{display:inline-flex}.chat-session-title-input{min-width:0;flex:1;border:1px solid var(--border);border-radius:4px;background:var(--surface);color:var(--ink);font:inherit;padding:2px 4px}.chat-session-context-menu{position:fixed;z-index:1000;width:150px;padding:4px;border:1px solid var(--border);border-radius:7px;background:var(--surface);box-shadow:0 8px 24px #00000029}.chat-session-context-menu button{width:100%;border:0;border-radius:4px;background:transparent;color:var(--ink);padding:7px 9px;text-align:left;cursor:pointer}.chat-session-context-menu button:hover,.chat-session-context-menu button:focus{background:var(--hairline)}.chat-session-loading,.chat-session-load-error{flex:1;display:flex;align-items:center;justify-content:center;gap:10px;color:var(--ink-soft);font-family:var(--serif);font-size:14px}.chat-session-load-error{flex-direction:column}.chat-session-load-error p{margin:0}.chat-session-load-error button{border:1px solid var(--border);border-radius:5px;padding:7px 12px;background:var(--surface);color:var(--ink);cursor:pointer}.chat-session-load-error button:hover{background:var(--bg-subtle)}.chat-session-error{width:calc(100% - 56px);max-width:820px;margin:12px auto 0;padding:10px 12px;border:1px solid color-mix(in oklch,#c33 35%,var(--hairline));border-radius:8px;color:var(--ink);background:color-mix(in oklch,#c33 8%,var(--bg-elevated));font-size:13px}@media (max-width: 900px){.chat-sidebar{position:absolute;top:0;bottom:0;left:0;z-index:60;box-shadow:0 0 40px #0003}.chat-sidebar-closed{margin-left:0;transform:translate(-101%);box-shadow:none}}.chat-share-button{flex:none;display:inline-flex;align-items:center;gap:7px;min-height:34px;padding:6px 11px;border:1px solid var(--hairline-strong);border-radius:8px;background:var(--bg-elevated);color:var(--ink);font-size:13px;font-weight:600}.chat-share-button:hover:not(:disabled){background:var(--bg-subtle)}.chat-share-button:disabled{cursor:not-allowed;opacity:.55}.chat-share-button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.chat-share-button svg{width:15px;height:15px}.chat-share-toast{position:fixed;top:18px;left:50%;width:min(420px,calc(100vw - 32px));transform:translate(-50%)}.chat-share-dialog-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:110;display:grid;place-items:center;padding:20px;background:#0000006b}.chat-share-dialog{width:min(520px,100%);padding:22px;border:1px solid var(--hairline-strong);border-radius:12px;background:var(--bg-elevated);box-shadow:0 18px 60px #00000038}.chat-share-dialog h2{margin:0 0 8px;font-family:var(--serif);font-size:21px}.chat-share-dialog p{margin:0 0 14px;color:var(--ink-soft)}.chat-share-dialog input{width:100%;padding:9px 10px;border:1px solid var(--hairline-strong);border-radius:7px;background:var(--bg);color:var(--ink);font-family:var(--mono);font-size:12px}.chat-share-dialog input:focus{outline:2px solid var(--accent);outline-offset:2px}.chat-share-dialog button{display:block;margin:16px 0 0 auto;padding:7px 14px;border-radius:7px;background:var(--accent);color:#fff;font-weight:600}@media (max-width: 560px){.chat-share-button{width:34px;padding:6px;justify-content:center}.chat-share-button span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}}.chat-capacity-dialog-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:120;display:grid;place-items:center;padding:20px;background:#0000007a}.chat-capacity-dialog{width:min(500px,100%);padding:24px;border:1px solid var(--hairline-strong);border-radius:12px;background:var(--bg-elevated);box-shadow:0 18px 60px #0000003d}.chat-capacity-dialog h2{margin:0 0 9px;font-family:var(--serif);font-size:22px}.chat-capacity-dialog p{margin:0;color:var(--ink-soft);line-height:1.5}.chat-capacity-countdown{min-height:24px;padding-top:12px;font-size:13px}.chat-capacity-dialog-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:20px}.chat-capacity-dialog-actions button{padding:8px 14px;border-radius:7px;font-weight:600}.chat-capacity-cancel{border:1px solid var(--hairline-strong);background:var(--bg);color:var(--ink)}.chat-capacity-retry{background:var(--accent);color:#fff}.chat-capacity-retry:disabled{cursor:not-allowed;opacity:.5}.chat-capacity-dialog-actions button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.chat-openrouter-usage{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 14px;margin-bottom:7px;color:var(--ink-soft);font-size:11px;line-height:1.4}.chat-openrouter-usage strong{color:var(--ink)}.chat-openrouter-usage a{color:var(--accent-text);font-weight:600}.chat-paused-banner{margin-bottom:.75rem;border:1px solid var(--border);border-radius:.65rem;background:var(--muted);padding:.7rem .85rem;color:var(--muted-foreground);font-size:.875rem;line-height:1.4}.chat-billing-notice{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;margin:0 0 10px;padding:9px 11px;border:1px solid color-mix(in oklch,var(--accent) 24%,var(--hairline));border-radius:9px;color:var(--ink-soft);background:color-mix(in oklch,var(--accent) 5%,var(--bg-elevated));font-size:12px;line-height:1.4}.chat-billing-notice a{flex:none;color:var(--accent-text);font-weight:600;text-decoration:none}.chat-billing-notice a:hover{text-decoration:underline}.chat-billing-notice-actions{display:flex;align-items:center;gap:10px;flex:none}.chat-billing-notice-dismiss{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:6px;color:var(--ink-soft);background:transparent;cursor:pointer}.chat-billing-notice-dismiss:hover{color:var(--ink);background:color-mix(in oklch,var(--ink) 7%,transparent)}.chat-billing-notice-dismiss:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.ask-home>.chat-paper-picker{top:calc(100% + 6px);bottom:auto}.chat-model-picker{position:relative;display:inline-grid;max-width:190px;flex:0 0 auto}.chat-model-picker-sizer,.chat-model-select{min-width:0;max-width:190px;padding:3px 22px 3px 8px;font-family:var(--mono);font-size:11px}.chat-model-picker-sizer{visibility:hidden;overflow:hidden;white-space:nowrap}.chat-model-select{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;border-radius:6px;background:var(--accent-soft);color:var(--accent-text);cursor:pointer}.chat-model-picker-chevron{position:absolute;top:50%;right:6px;width:10px;height:7px;transform:translateY(-50%);fill:none;stroke:var(--accent-text);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.75;pointer-events:none}.chat-model-picker.is-disabled{opacity:.65}.chat-model-select:disabled{cursor:default}.chat-model-label{max-width:190px;border-radius:6px;background:var(--accent-soft);color:var(--accent-text);padding:3px 8px;font-family:var(--mono);font-size:11px}.chat-empty .chat-composer{text-align:left}.chat-composer-wrap{border-top:1px solid var(--hairline);background:var(--bg);padding:14px 28px 16px}.chat-composer-inner{max-width:820px;margin:0 auto}.chat-composer{position:relative;background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:14px;box-shadow:0 1px 2px #1e1c140a,0 10px 30px -20px #1e1c144d;padding:6px}.chat-composer-textarea-wrap{position:relative}.chat-paper-highlight-layer{position:absolute;z-index:0;top:0;right:0;bottom:0;left:0;box-sizing:border-box;overflow:hidden;pointer-events:none;color:transparent}.chat-paper-highlight-layer>div{min-height:100%;white-space:pre-wrap;overflow-wrap:break-word;word-break:break-word;color:var(--ink)}.chat-paper-highlight-layer-composer{padding:12px 12px 4px;font-family:var(--serif);font-size:16px;line-height:1.45}.chat-paper-highlight-layer-editor{padding:9px 11px;font-family:var(--serif);font-size:16px;line-height:1.45}.chat-paper-highlight-layer-home{padding:12px 12px 4px;font-family:var(--serif);font-size:17px;line-height:1.45}.chat-paper-picker{position:absolute;z-index:50;left:8px;bottom:calc(100% + 6px);width:min(560px,calc(100vw - 48px));max-height:384px;overflow-y:auto;border:1px solid var(--hairline-strong);border-radius:11px;background:var(--bg-elevated);box-shadow:0 16px 38px -16px #1e1c1473}.chat-paper-picker-status{padding:10px 12px;color:var(--ink-faint);font-size:12px}.chat-paper-option{display:flex;width:100%;min-height:64px;flex-direction:column;justify-content:center;gap:3px;padding:9px 12px;border:0;border-top:1px solid var(--hairline);color:var(--ink);background:transparent;text-align:left}.chat-paper-option.is-active,.chat-paper-option:hover{background:var(--accent-soft)}.chat-paper-option-title{font-family:var(--serif);font-size:14px;line-height:1.25}.chat-paper-option-meta{color:var(--ink-faint);font-family:var(--mono);font-size:10.5px}.chat-paper-mention-message{padding:3px 12px;color:var(--negative-text);font-size:11.5px}.chat-inline-paper-mention{display:inline}.chat-inline-paper-mention svg{display:inline-block;margin-right:3px;color:var(--accent-text);vertical-align:-.12em}.chat-inline-paper-link{color:var(--accent-text);font-weight:600;text-decoration-line:underline;text-decoration-color:color-mix(in oklch,var(--accent) 40%,transparent);text-decoration-thickness:1px;text-underline-offset:2px}.chat-inline-paper-link:hover{text-decoration-color:var(--accent-text)}.chat-composer textarea{position:relative;z-index:1;width:100%;border:0;outline:0;resize:none;background:transparent;font-family:var(--serif);font-size:16px;line-height:1.45;color:transparent;caret-color:var(--ink);padding:12px 12px 4px}.chat-composer textarea::-moz-placeholder{color:var(--ink-faint)}.chat-composer textarea::placeholder{color:var(--ink-faint)}.chat-composer-row{display:flex;align-items:center;justify-content:space-between;padding:2px 6px 4px}.chat-composer-tools{display:flex;align-items:center;flex-wrap:wrap;gap:12px}.chat-web-search-toggle{display:inline-flex;align-items:center;gap:5px;min-height:30px;padding:4px 9px;border:1px solid var(--hairline);border-radius:8px;background:transparent;color:var(--ink-muted);font:inherit;font-size:12px;cursor:pointer}.chat-web-search-toggle:hover:not(:disabled){border-color:var(--hairline-strong);color:var(--ink)}.chat-web-search-toggle.is-enabled{border-color:var(--accent);background:var(--accent-soft);color:var(--accent-text)}.chat-web-search-toggle:disabled{cursor:default;opacity:.55}.chat-effort-picker{position:relative}.chat-effort-trigger{display:inline-flex;align-items:center;gap:4px;min-height:30px;padding:4px 8px 4px 10px;border:1px solid var(--hairline);border-radius:8px;background:transparent;color:var(--ink-muted);font:inherit;font-size:12px;cursor:pointer}.chat-effort-trigger:hover:not(:disabled){border-color:var(--hairline-strong);color:var(--ink)}.chat-effort-trigger:disabled{cursor:default;opacity:.55}.chat-effort-menu{position:absolute;z-index:40;left:0;bottom:calc(100% + 7px);width:220px;padding:6px;border:1px solid var(--hairline);border-radius:11px;background:var(--bg-elevated);box-shadow:0 14px 36px -14px #1e1c1473}.ask-home .chat-effort-menu{top:calc(100% + 7px);bottom:auto}.chat-effort-menu-label{padding:5px 10px 6px;color:var(--ink-faint);font-size:11px;font-weight:600;letter-spacing:.02em}.chat-effort-option{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;padding:9px 10px;border:0;border-radius:7px;background:transparent;color:var(--ink);text-align:left;cursor:pointer}.chat-effort-option:hover,.chat-effort-option.is-selected{background:var(--bg-subtle)}.chat-effort-option-copy{display:flex;flex-direction:column;gap:2px}.chat-effort-option-copy strong{font-size:13px;font-weight:600}.chat-effort-option-copy small{color:var(--ink-faint);font-size:11px}.chat-composer-hint{font-size:11.5px;color:var(--ink-faint)}.chat-composer-foot{display:flex;align-items:center;justify-content:center;gap:6px;text-align:center;font-size:11.5px;color:var(--ink-faint);margin-top:9px}.chat-provider-attribution{white-space:nowrap}.chat-send{display:flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:10px;background:var(--hairline);color:var(--bg-elevated);cursor:not-allowed;transition:background .15s;flex:none}.chat-send-on{background:var(--ink);cursor:pointer}.chat-send-on:hover{background:color-mix(in oklch,var(--ink) 88%,var(--accent))}@media (max-width: 900px){.chat-composer-wrap{padding:12px 16px 14px}.chat-composer-hint{display:none}}@media (prefers-reduced-motion: reduce){.chat-paper-option{scroll-behavior:auto}}@media (forced-colors: active){.chat-paper-option.is-active,.chat-inline-paper-link{outline:1px solid CanvasText}}.chat-paper-link{color:var(--accent-text);border-bottom:1px solid color-mix(in oklch,var(--accent-text) 35%,transparent);white-space:normal}.chat-paper-link:hover{border-bottom-color:var(--accent-text)}.chat-hf-link:after{content:" 🤗";font-size:.85em;white-space:nowrap}.chat-github-link{color:var(--accent-text);border-bottom:1px solid color-mix(in oklch,var(--accent-text) 35%,transparent)}.chat-github-link:hover{border-bottom-color:var(--accent-text)}.chat-github-link svg{display:inline-block;width:1em;height:1em;margin-right:.3em;vertical-align:-.14em}.chat-external-link{color:var(--accent-text);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.chat-external-link:hover{text-decoration-thickness:2px}.chat-web-citation{color:var(--accent-text);text-decoration:underline;text-decoration-style:dotted;text-underline-offset:2px}.web-preview-pop.web-preview-pop{width:min(360px,calc(100vw - 24px));padding:0;overflow:hidden;border:1px solid var(--hairline);border-radius:12px;background:var(--bg-elevated);color:var(--ink);box-shadow:0 14px 44px -12px #1e1c1466}.web-preview-card{display:flex;flex-direction:column}.web-preview-image{display:block;width:100%;height:174px;-o-object-fit:cover;object-fit:cover;background:var(--bg-subtle);border-bottom:1px solid var(--hairline)}.web-preview-meta{padding:13px 14px 14px;min-width:0}.web-preview-source{display:flex;align-items:center;gap:5px;margin-bottom:6px;color:var(--ink-faint);font-size:11px}.web-preview-source img{width:14px;height:14px;border-radius:3px}.web-preview-meta strong{display:block;font-family:var(--serif);font-size:15px;font-weight:500;line-height:1.3}.web-preview-meta p{display:-webkit-box;overflow:hidden;margin:7px 0 0;color:var(--ink-soft);font-size:12px;line-height:1.4;-webkit-box-orient:vertical;-webkit-line-clamp:3}.paper-preview-pop.paper-preview-pop{width:min(344px,calc(100vw - 24px));padding:0;border:1px solid var(--hairline);border-radius:12px;background:var(--bg-elevated);color:var(--ink);box-shadow:0 14px 44px -12px #1e1c1466;overflow:hidden}.paper-preview-inner{display:flex;gap:14px;padding:14px}.paper-preview-meta{min-width:0;flex:1}.paper-preview-title{font-family:var(--serif);font-weight:500;font-size:15px;line-height:1.25;margin-bottom:5px}.paper-preview-auth{font-size:12px;color:var(--ink-soft);line-height:1.35}.paper-preview-venue{font-size:11.5px;color:var(--ink-faint);margin-top:3px;font-variant-numeric:tabular-nums}.paper-preview-tags{display:flex;flex-wrap:wrap;gap:5px;margin:9px 0}.paper-preview-tag{font-size:10.5px;font-family:var(--mono);background:var(--positive-bg);color:var(--positive-text);border-radius:5px;padding:2px 7px}.paper-preview-status{min-height:48px;padding:14px;display:flex;align-items:center;color:var(--ink-soft);font-size:12px}.paper-preview-thumb{position:relative;width:96px;height:124px;flex:none;background:var(--bg-elevated);border:1px solid var(--hairline);border-radius:3px;box-shadow:0 1px 3px #1e1c1414;overflow:hidden;padding:11px 10px}.paper-preview-thumb-real{padding:0}.paper-preview-thumb-real img{display:block;width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.paper-preview-thumb-title{display:flex;flex-direction:column;align-items:center;gap:3px;margin-bottom:8px}.paper-preview-thumb-title span{height:3px;background:var(--ink);border-radius:2px}.paper-preview-thumb-title span:first-child{width:70%}.paper-preview-thumb-title span:last-child{width:52%}.paper-preview-thumb-auth{height:2px;width:40%;margin:0 auto 9px;background:var(--ink-faint);border-radius:2px}.paper-preview-thumb-cols{display:flex;gap:7px}.paper-preview-thumb-col{flex:1;height:74px;background:repeating-linear-gradient(var(--hairline-strong) 0 2px,transparent 2px 5px);opacity:.7}.paper-preview-thumb-fig{position:absolute;left:14px;right:14px;height:22px;background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:2px}.hf-preview-pop.hf-preview-pop{width:min(172px,calc(100vw - 24px));padding:0;border:1px solid var(--hairline);border-radius:12px;background:var(--bg-elevated);color:var(--ink);box-shadow:0 14px 44px -12px #1e1c1466;overflow:hidden}.hf-preview-card{display:grid}.hf-preview-image,.hf-preview-fallback{display:block;width:100%;aspect-ratio:2 / 1;-o-object-fit:cover;object-fit:cover;background:var(--bg-subtle)}.hf-preview-fallback{display:grid;place-items:center;font-size:48px;background:radial-gradient(circle at 70% 35%,rgba(84,104,255,.4),transparent 45%),linear-gradient(135deg,#0f6d79,#d18a48)}.hf-preview-meta{display:grid;gap:3px;padding:12px 14px 14px}.hf-preview-meta strong{overflow-wrap:anywhere;font-size:14px}.hf-preview-kind,.hf-preview-meta>span:last-child{color:var(--ink-faint);font-size:11.5px}.github-preview-pop.github-preview-pop{width:min(344px,calc(100vw - 24px));padding:0;border:1px solid var(--hairline);border-radius:12px;background:var(--bg-elevated);color:var(--ink);box-shadow:0 14px 44px -12px #1e1c1466;overflow:hidden}.github-preview-card{display:flex;gap:14px;padding:14px}.github-preview-image,.github-preview-fallback{display:block;width:72px;height:72px;flex:none;-o-object-fit:cover;object-fit:cover;border-radius:12px;background:var(--bg-subtle)}.github-preview-fallback{display:grid;place-items:center;color:#fff;background:linear-gradient(135deg,#24292f,#57606a)}.github-preview-fallback svg{width:36px;height:36px}.github-preview-meta{display:grid;gap:3px;min-width:0}.github-preview-meta strong{overflow-wrap:anywhere;font-size:14px}.github-preview-kind,.github-preview-meta>span:last-child{color:var(--ink-faint);font-size:11.5px}.github-preview-description{display:-webkit-box;overflow:hidden;color:var(--ink-soft);font-size:12px;line-height:1.35;-webkit-box-orient:vertical;-webkit-line-clamp:2}.github-preview-stats{font-variant-numeric:tabular-nums}.chat-ghost-link{color:var(--ink-soft);font-size:13px;padding:6px 10px;border-radius:6px}.chat-ghost-link:hover{color:var(--ink);background:var(--bg-subtle)}.chat-conversation{flex:1;overflow-y:auto}.chat-conversation-inner{max-width:820px;margin:0 auto;padding:30px 28px 40px}.chat-msg{margin-bottom:26px}.chat-msg-user{display:flex;justify-content:flex-end}.chat-user-message-wrap{display:flex;flex-direction:column;align-items:flex-end;max-width:74%}.chat-bubble{background:var(--accent-soft);color:var(--ink);border:1px solid color-mix(in oklch,var(--accent-soft) 70%,var(--hairline));border-radius:16px 16px 4px;padding:12px 18px;font-family:var(--serif);font-size:16px;line-height:1.45;max-width:100%;white-space:pre-wrap;-webkit-user-select:text;-moz-user-select:text;user-select:text;cursor:text}.chat-bubble::-moz-selection,.chat-bubble *::-moz-selection{background:var(--accent);color:var(--bg)}.chat-bubble::selection,.chat-bubble *::selection{background:var(--accent);color:var(--bg)}.chat-user-actions{display:flex;justify-content:flex-end;gap:2px;min-height:30px;padding:4px 2px 0;opacity:0;transform:translateY(-2px);transition:opacity .14s ease,transform .14s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.chat-msg-user:hover .chat-user-actions,.chat-msg-user:focus-within .chat-user-actions{opacity:1;transform:translateY(0)}.chat-user-action{width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:999px;color:var(--ink-soft);background:transparent}.chat-user-action:hover{color:var(--ink);background:var(--bg-elevated);border-color:var(--hairline)}.chat-user-action:focus-visible{outline:2px solid var(--accent);outline-offset:2px;opacity:1}.chat-user-action svg{width:14px;height:14px}.chat-inline-editor{width:min(620px,74%);min-width:min(360px,100%);padding:12px;border:1px solid color-mix(in oklch,var(--accent) 45%,var(--hairline));border-radius:16px 16px 4px;background:var(--accent-soft);box-shadow:0 8px 28px #00000014}.chat-inline-editor-textarea{position:relative;z-index:1;display:block;width:100%;min-height:72px;padding:8px 10px;resize:none;border:1px solid var(--hairline-strong);border-radius:10px;color:var(--ink);background:transparent;font-family:var(--serif);font-size:16px;line-height:1.45;white-space:pre-wrap}.chat-inline-editor-textarea-wrap{position:relative;background:var(--bg-elevated);border-radius:10px}.chat-inline-editor-textarea-wrap .chat-inline-editor-textarea{color:transparent;caret-color:var(--ink)}.chat-inline-editor-textarea:focus{outline:2px solid var(--accent);outline-offset:1px}.chat-inline-editor-notice{margin:8px 2px 0;color:var(--ink-soft);font-size:12.5px;line-height:1.4}.chat-inline-editor-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:10px}.chat-inline-editor-actions button{min-height:34px;padding:6px 14px;border:1px solid var(--hairline-strong);border-radius:999px;color:var(--ink);background:var(--bg-elevated);font-size:13px;font-weight:600}.chat-inline-editor-actions button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.chat-inline-editor-actions .chat-inline-editor-send{color:#fff;border-color:var(--accent);background:var(--accent)}.chat-inline-editor-actions button:disabled{cursor:not-allowed;opacity:.5}.chat-msg-blocks{display:flex;flex-direction:column;gap:14px}.chat-waiting{min-height:20px;display:flex;align-items:center;font-size:13px;font-weight:600}.chat-thinking{color:transparent;background:linear-gradient(100deg,var(--ink-faint) 30%,var(--accent-text) 50%,var(--ink-faint) 70%);background-size:220% 100%;background-clip:text;-webkit-background-clip:text;animation:chat-thinking-glow 1.8s ease-in-out infinite}@keyframes chat-thinking-glow{0%{background-position:100% 0}to{background-position:-100% 0}}@media (prefers-reduced-motion: reduce){.chat-thinking{color:var(--accent-text);background:none;animation:none}}.chat-reason-live{border:1px solid var(--hairline);border-left:2px solid var(--accent);background:var(--bg-elevated);border-radius:10px;padding:14px 16px}.chat-reason-live-head{display:flex;align-items:center;gap:9px;font-size:12.5px;font-weight:600;color:var(--accent-text)}.chat-reason-live-body{margin-top:9px;font-family:var(--serif);font-size:14.5px;line-height:1.6;color:var(--ink-soft)}.chat-reason-done{border:1px solid var(--hairline);border-radius:10px;background:var(--bg-elevated);overflow:hidden}.chat-reason-done-head{display:flex;align-items:center;gap:9px;width:100%;padding:11px 15px;font-size:13px;color:var(--ink-soft);font-weight:500;text-align:left}.chat-reason-done-head svg:first-child{color:var(--positive-text);flex:none}.chat-reason-done-head .chat-chev{margin-left:auto}.chat-reason-done-head:hover{color:var(--ink)}.chat-reason-done-body{padding:2px 16px 16px 39px;font-family:var(--serif);font-size:14px;line-height:1.65;color:var(--ink-soft)}.chat-answer.chat-reason-markdown{padding-top:0;padding-right:0;padding-bottom:0;font-size:inherit;line-height:inherit;color:inherit;white-space:normal}.chat-answer.chat-reason-live-body{padding-left:23px}.chat-answer.chat-reason-done-body{padding:2px 16px 16px 39px}.chat-tool{border:1px solid var(--hairline);border-radius:10px;background:var(--bg-elevated);overflow:hidden}.chat-tool-running{border-color:color-mix(in oklch,var(--accent) 35%,var(--hairline))}.chat-tool-failed{border-color:color-mix(in oklch,#b42318 55%,var(--hairline))}.chat-tool-failed .chat-tool-status{color:#b42318;font-weight:600}.chat-tool-head{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:11px 15px;text-align:left}.chat-tool-head:disabled{cursor:default}.chat-tool-head-left{display:flex;align-items:center;gap:9px;min-width:0}.chat-tool-head-left>svg{color:var(--accent-text);flex:none}.chat-tool-name{font-family:var(--mono);font-size:12px;font-weight:600;color:var(--ink);background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:5px;padding:2px 7px;flex:none}.chat-tool-query{font-family:var(--serif);font-style:italic;font-size:13.5px;color:var(--ink-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-tool-head-right{display:flex;align-items:center;gap:10px;flex:none}.chat-tool-status{font-size:11.5px;color:var(--ink-soft);font-variant-numeric:tabular-nums}.chat-tool-body{padding:4px 16px 16px;border-top:1px solid var(--hairline)}.chat-tool-args{margin:12px 0 4px}.chat-tool-label{display:block;font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-faint);margin-bottom:6px}.chat-tool-args pre{margin:0;background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:8px;padding:10px 12px;font-family:var(--mono);font-size:11.5px;line-height:1.5;color:var(--ink-soft);overflow-x:auto}.chat-tool-results-label{margin-top:16px}.chat-tool-output-head{display:flex;align-items:center;justify-content:space-between;margin-top:14px}.chat-tool-output-head .chat-tool-label{margin-bottom:0}.chat-tool-copy{color:var(--accent-text);font-family:var(--mono);font-size:11px}.chat-tool-output{max-height:320px;margin:7px 0 0;overflow:auto;white-space:pre;-moz-tab-size:4;-o-tab-size:4;tab-size:4;border:1px solid var(--hairline);border-radius:8px;background:var(--bg-subtle);padding:11px 12px;color:var(--ink);font-family:var(--mono);font-size:11.5px;line-height:1.5}.chat-tool-truncated{margin-top:7px;color:var(--ink-faint);font-size:11px}.chat-tool-results{list-style:none;margin:0;padding:0}.chat-hit{padding:11px 0;border-top:1px solid var(--hairline)}.chat-hit:first-child{border-top:0}.chat-hit-top{display:flex;align-items:baseline;gap:12px}.chat-hit-title{font-family:var(--serif);font-size:14.5px;font-weight:600;color:var(--accent-text);flex:1;line-height:1.3}.chat-hit-title:hover{text-decoration:underline}.chat-hit-meta{font-size:12px;color:var(--ink-faint);margin-top:2px}.chat-hit-truncated{color:var(--ink-faint);font-style:italic}.chat-hit-snippet{font-family:var(--serif);font-size:13.5px;line-height:1.5;color:var(--ink-soft);margin-top:5px;text-wrap:pretty}.chat-answer{font-family:var(--serif);font-size:16.5px;line-height:1.65;color:var(--ink);text-wrap:pretty;padding:2px}.chat-answer>:first-child{margin-top:0}.chat-answer>:last-child{margin-bottom:0}.chat-answer p{margin:0 0 .9em}.chat-answer h1,.chat-answer h2,.chat-answer h3,.chat-answer h4{font-family:var(--sans);font-weight:600;line-height:1.3;margin:1.35em 0 .5em}.chat-answer h1{font-size:1.45em}.chat-answer h2{font-size:1.25em}.chat-answer h3{font-size:1.08em}.chat-answer h4{font-size:1em}.chat-answer ul,.chat-answer ol{margin:0 0 .9em;padding-left:1.5em}.chat-answer ul{list-style-type:disc}.chat-answer ol{list-style-type:decimal}.chat-answer ul ul{list-style-type:circle}.chat-answer ul ul ul{list-style-type:square}.chat-answer li{margin:.2em 0}.chat-answer li>p{margin:0}.chat-answer blockquote{margin:0 0 .9em;padding-left:1em;border-left:3px solid var(--hairline-strong);color:var(--ink-soft)}.chat-answer code{font-family:var(--mono);font-size:.84em;background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:4px;padding:.1em .3em}.chat-answer pre{margin:0 0 1em;padding:12px 14px;overflow-x:auto;background:var(--bg-subtle);border:1px solid var(--hairline);border-radius:8px;line-height:1.5}.chat-answer pre code{background:none;border:0;padding:0}.chat-answer table{display:block;width:-moz-max-content;width:max-content;max-width:100%;overflow-x:auto;border-collapse:collapse;margin:0 0 1em;font-family:var(--sans);font-size:.88em}.chat-answer th,.chat-answer td{border:1px solid var(--hairline);padding:6px 10px;text-align:left}.chat-answer th{background:var(--bg-subtle);font-weight:600}.chat-answer hr{border:0;border-top:1px solid var(--hairline);margin:1.25em 0}.chat-answer input[type=checkbox]{margin-right:.4em}.chat-answer strong{font-weight:600}.chat-error{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid var(--negative-border);background:var(--negative-bg);color:var(--negative-text);border-radius:10px;padding:12px 16px;font-size:13.5px}.chat-finish-note{font-family:var(--serif);font-style:italic;font-size:13px;color:var(--ink-faint)}.chat-feedback{display:flex;align-items:center;gap:4px;min-height:30px;margin-top:8px;color:var(--ink-faint);font-size:12px}.chat-feedback-label{margin-right:2px}.chat-feedback-action{width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:999px;color:var(--ink-soft);background:transparent}.chat-feedback-action:hover:not(:disabled),.chat-feedback-action-selected{color:var(--accent-text);background:var(--accent-soft);border-color:color-mix(in oklch,var(--accent) 35%,var(--hairline))}.chat-feedback-action:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.chat-feedback-action:disabled{cursor:wait}.chat-feedback-action svg{width:14px;height:14px}.chat-feedback-error{color:var(--negative-text);margin-left:4px}.chat-feedback-panel{width:min(460px,100%);margin-top:8px;padding:16px;border:1px solid var(--hairline);border-radius:12px;background:var(--bg-elevated);box-shadow:0 10px 30px #0000001a}.chat-feedback-panel-title{color:var(--ink);font-size:15px;font-weight:600}.chat-feedback-panel-label{display:block;margin-top:4px;color:var(--ink-soft);font-size:13px}.chat-feedback-comment{display:block;width:100%;min-height:92px;margin-top:12px;padding:10px 12px;resize:vertical;border:1px solid var(--hairline-strong);border-radius:8px;color:var(--ink);background:var(--bg);font:14px/1.45 var(--sans)}.chat-feedback-comment:focus{border-color:var(--accent);outline:2px solid color-mix(in oklch,var(--accent) 25%,transparent);outline-offset:1px}.chat-feedback-panel-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.chat-feedback-panel-actions button{min-width:72px;padding:8px 14px;border-radius:8px;font:600 13px var(--sans)}.chat-feedback-skip{border:1px solid transparent;color:var(--ink-soft);background:transparent}.chat-feedback-submit{border:1px solid var(--ink);color:var(--bg);background:var(--ink)}.chat-feedback-panel-actions button:disabled{cursor:wait;opacity:.65}.chat-error a,.chat-error button{flex:none;color:var(--accent-text);font-weight:600;text-decoration:none}.chat-error button{border:0;padding:0;background:transparent;cursor:pointer;font:inherit}.chat-error button:disabled{cursor:wait;opacity:.65}.chat-error-actions{display:flex;flex:none;flex-wrap:wrap;justify-content:flex-end;gap:8px 16px}.chat-error a:hover,.chat-error button:hover:not(:disabled){text-decoration:underline}@media (max-width: 900px){.chat-user-message-wrap{max-width:90%}.chat-inline-editor{width:90%;min-width:0}.chat-conversation-inner{padding:22px 16px 32px}}@media (max-width: 560px){.shared-chat-content .chat-user-message-wrap{max-width:88%}}@media (hover: none),(pointer: coarse){.chat-user-actions{opacity:1;transform:none}}.chat-caret{display:inline-block;width:7px;height:1.05em;background:var(--accent);margin-left:1px;vertical-align:text-bottom;animation:chat-blink 1s steps(1) infinite}@keyframes chat-blink{50%{opacity:0}}.chat-chev{transition:transform .18s;color:var(--ink-faint)}.chat-chev-open{transform:rotate(180deg)}.chat-spinner{width:14px;height:14px;border:2px solid color-mix(in oklch,var(--accent) 25%,transparent);border-top-color:var(--accent);border-radius:50%;display:inline-block;animation:chat-spin .7s linear infinite;flex:none}.chat-spinner-light{border-color:#fff6;border-top-color:#fff}@keyframes chat-spin{to{transform:rotate(360deg)}}.shared-chat-page{min-height:calc(100dvh - 60px);background:var(--bg)}.shared-chat-heading{border-bottom:1px solid var(--hairline);display:flex;align-items:center;gap:10px}.shared-chat-heading h1{max-width:calc(50vw + 640px);margin:0 auto;padding:13px 32px;color:var(--ink);font-family:var(--serif);font-size:20px;font-weight:600;line-height:1.1}.shared-chat-content{width:min(876px,100%);margin:0 auto;padding:34px 28px 64px}.shared-chat-transcript{padding:0 0 26px}.shared-chat-attribution{display:flex;flex-wrap:wrap;justify-content:center;gap:5px 12px;color:var(--ink-faint);font-size:12px;line-height:1.5}.shared-chat-attribution a{color:inherit;font-weight:600;text-decoration:none}.shared-chat-attribution a:hover{color:var(--accent-text);text-decoration:underline}.shared-chat-fresh{margin-top:26px;padding-top:28px;border-top:1px solid var(--hairline)}.shared-chat-fresh h2{margin:0 0 6px;font-family:var(--serif);font-size:21px;font-weight:600}.shared-chat-fresh>p{margin:0 0 16px;color:var(--ink-soft);font-family:var(--serif)}.shared-chat-access-note{margin:-6px 0 16px;padding:10px 12px;border:1px solid color-mix(in oklch,var(--accent) 24%,var(--hairline));border-radius:9px;color:var(--ink-soft);background:color-mix(in oklch,var(--accent) 5%,var(--bg-elevated));font-size:13px;line-height:1.45}.shared-chat-access-note a{color:var(--accent-text);font-weight:600}.shared-chat-state{min-height:55vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:48px 24px;text-align:center;color:var(--ink-soft)}.shared-chat-state h1{margin:0;color:var(--ink);font-family:var(--serif);font-size:27px}.shared-chat-state p{margin:0}.shared-chat-state button{margin-top:8px;padding:7px 13px;border:1px solid var(--hairline-strong);border-radius:7px;background:var(--bg-elevated);color:var(--ink)}@media (max-width: 900px){.shared-chat-heading h1{padding-inline:16px}}@media (max-width: 640px){.shared-chat-heading h1{padding-inline:14px}}@media (max-width: 560px){.shared-chat-content{padding:26px 16px 48px}} diff --git a/assets/index-BLqBUiom.js b/assets/index-vCOH2DKd.js similarity index 87% rename from assets/index-BLqBUiom.js rename to assets/index-vCOH2DKd.js index 49ede690a3422fe6c41d1d77bbe9f68299c53bc3..2f3ba3fa25c392ca81ea62e59215140c4b30ebe9 100644 --- a/assets/index-BLqBUiom.js +++ b/assets/index-vCOH2DKd.js @@ -1,4 +1,4 @@ -import{ab as nn,ac as or,j as pn}from"./index-BrhBTT14.js";function pf(){}function mf(e){const t=[],n=String(e||"");let r=n.indexOf(","),i=0,o=!1;for(;!o;){r===-1&&(r=n.length,o=!0);const l=n.slice(i,r).trim();(l||!o)&&t.push(l),i=r+1,r=n.indexOf(",",i)}return t}function wi(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Si=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ci=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ei={};function ft(e,t){return(Ei.jsx?Ci:Si).test(e)}const Ii=/[ \t\n\f\r]/g;function Ai(e){return typeof e=="object"?e.type==="text"?ht(e.value):!1:ht(e)}function ht(e){return e.replace(Ii,"")===""}class qe{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}qe.prototype.normal={};qe.prototype.property={};qe.prototype.space=void 0;function ar(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new qe(n,r,t)}function vn(e){return e.toLowerCase()}class ee{constructor(t,n){this.attribute=n,this.property=t}}ee.prototype.attribute="";ee.prototype.booleanish=!1;ee.prototype.boolean=!1;ee.prototype.commaOrSpaceSeparated=!1;ee.prototype.commaSeparated=!1;ee.prototype.defined=!1;ee.prototype.mustUseProperty=!1;ee.prototype.number=!1;ee.prototype.overloadedBoolean=!1;ee.prototype.property="";ee.prototype.spaceSeparated=!1;ee.prototype.space=void 0;let Ti=0;const D=Ie(),W=Ie(),zn=Ie(),S=Ie(),V=Ie(),De=Ie(),te=Ie();function Ie(){return 2**++Ti}const Dn=Object.freeze(Object.defineProperty({__proto__:null,boolean:D,booleanish:W,commaOrSpaceSeparated:te,commaSeparated:De,number:S,overloadedBoolean:zn,spaceSeparated:V},Symbol.toStringTag,{value:"Module"})),mn=Object.keys(Dn);class Hn extends ee{constructor(t,n,r,i){let o=-1;if(super(t,n),pt(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&Li.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(mt,_i);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!mt.test(o)){let l=o.replace(Di,Ri);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=Hn}return new i(r,t)}function Ri(e){return"-"+e.toLowerCase()}function _i(e){return e.charAt(1).toUpperCase()}const Oi=ar([ur,Pi,fr,hr,pr],"html"),Un=ar([ur,vi,fr,hr,pr],"svg");function gf(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Mi(e){return e.join(" ").trim()}var Vn={},gt=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ni=/\n/g,Bi=/^\s*/,ji=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Hi=/^:\s*/,Ui=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Vi=/^[;\s]*/,$i=/^\s+|\s+$/g,qi=` +import{ah as nn,N as or,j as pn}from"./index-D_-UZEuL.js";function pf(){}function mf(e){const t=[],n=String(e||"");let r=n.indexOf(","),i=0,o=!1;for(;!o;){r===-1&&(r=n.length,o=!0);const l=n.slice(i,r).trim();(l||!o)&&t.push(l),i=r+1,r=n.indexOf(",",i)}return t}function wi(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Si=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ci=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ei={};function ft(e,t){return(Ei.jsx?Ci:Si).test(e)}const Ii=/[ \t\n\f\r]/g;function Ai(e){return typeof e=="object"?e.type==="text"?ht(e.value):!1:ht(e)}function ht(e){return e.replace(Ii,"")===""}class qe{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}qe.prototype.normal={};qe.prototype.property={};qe.prototype.space=void 0;function ar(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new qe(n,r,t)}function vn(e){return e.toLowerCase()}class ee{constructor(t,n){this.attribute=n,this.property=t}}ee.prototype.attribute="";ee.prototype.booleanish=!1;ee.prototype.boolean=!1;ee.prototype.commaOrSpaceSeparated=!1;ee.prototype.commaSeparated=!1;ee.prototype.defined=!1;ee.prototype.mustUseProperty=!1;ee.prototype.number=!1;ee.prototype.overloadedBoolean=!1;ee.prototype.property="";ee.prototype.spaceSeparated=!1;ee.prototype.space=void 0;let Ti=0;const D=Ie(),W=Ie(),zn=Ie(),S=Ie(),V=Ie(),De=Ie(),te=Ie();function Ie(){return 2**++Ti}const Dn=Object.freeze(Object.defineProperty({__proto__:null,boolean:D,booleanish:W,commaOrSpaceSeparated:te,commaSeparated:De,number:S,overloadedBoolean:zn,spaceSeparated:V},Symbol.toStringTag,{value:"Module"})),mn=Object.keys(Dn);class Hn extends ee{constructor(t,n,r,i){let o=-1;if(super(t,n),pt(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&Li.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(mt,_i);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!mt.test(o)){let l=o.replace(Di,Ri);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=Hn}return new i(r,t)}function Ri(e){return"-"+e.toLowerCase()}function _i(e){return e.charAt(1).toUpperCase()}const Oi=ar([ur,Pi,fr,hr,pr],"html"),Un=ar([ur,vi,fr,hr,pr],"svg");function gf(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Mi(e){return e.join(" ").trim()}var Vn={},gt=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ni=/\n/g,Bi=/^\s*/,ji=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Hi=/^:\s*/,Ui=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Vi=/^[;\s]*/,$i=/^\s+|\s+$/g,qi=` `,dt="/",yt="*",Ce="",Wi="comment",Yi="declaration";function Xi(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(d){var x=d.match(Ni);x&&(n+=x.length);var C=d.lastIndexOf(qi);r=~C?d.length-C:r+d.length}function o(){var d={line:n,column:r};return function(x){return x.position=new l(d),s(),x}}function l(d){this.start=d,this.end={line:n,column:r},this.source=t.source}l.prototype.content=e;function a(d){var x=new Error(t.source+":"+n+":"+r+": "+d);if(x.reason=d,x.filename=t.source,x.line=n,x.column=r,x.source=e,!t.silent)throw x}function u(d){var x=d.exec(e);if(x){var C=x[0];return i(C),e=e.slice(C.length),x}}function s(){u(Bi)}function f(d){var x;for(d=d||[];x=c();)x!==!1&&d.push(x);return d}function c(){var d=o();if(!(dt!=e.charAt(0)||yt!=e.charAt(1))){for(var x=2;Ce!=e.charAt(x)&&(yt!=e.charAt(x)||dt!=e.charAt(x+1));)++x;if(x+=2,Ce===e.charAt(x-1))return a("End of comment missing");var C=e.slice(2,x-2);return r+=2,i(C),e=e.slice(x),r+=2,d({type:Wi,comment:C})}}function p(){var d=o(),x=u(ji);if(x){if(c(),!u(Hi))return a("property missing ':'");var C=u(Ui),y=d({type:Yi,property:kt(x[0].replace(gt,Ce)),value:C?kt(C[0].replace(gt,Ce)):Ce});return u(Vi),y}}function h(){var d=[];f(d);for(var x;x=p();)x!==!1&&(d.push(x),f(d));return d}return s(),h()}function kt(e){return e?e.replace($i,Ce):Ce}var Qi=Xi,Gi=nn&&nn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Vn,"__esModule",{value:!0});Vn.default=Ji;const Ki=Gi(Qi);function Ji(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,Ki.default)(e),i=typeof t=="function";return r.forEach(o=>{if(o.type!=="declaration")return;const{property:l,value:a}=o;i?t(l,a,o):a&&(n=n||{},n[l]=a)}),n}var an={};Object.defineProperty(an,"__esModule",{value:!0});an.camelCase=void 0;var Zi=/^--[a-zA-Z0-9_-]+$/,el=/-([a-z])/g,nl=/^[^-]+$/,tl=/^-(webkit|moz|ms|o|khtml)-/,rl=/^-(ms)-/,il=function(e){return!e||nl.test(e)||Zi.test(e)},ll=function(e,t){return t.toUpperCase()},xt=function(e,t){return"".concat(t,"-")},ol=function(e,t){return t===void 0&&(t={}),il(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(rl,xt):e=e.replace(tl,xt),e.replace(el,ll))};an.camelCase=ol;var al=nn&&nn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},ul=al(Vn),sl=an;function Ln(e,t){var n={};return!e||typeof e!="string"||(0,ul.default)(e,function(r,i){r&&i&&(n[(0,sl.camelCase)(r,t)]=i)}),n}Ln.default=Ln;var cl=Ln;const fl=or(cl),mr=gr("end"),$n=gr("start");function gr(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function hl(e){const t=$n(e),n=mr(e);if(t&&n)return{start:t,end:n}}function je(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?bt(e.position):"start"in e||"end"in e?bt(e):"line"in e||"column"in e?Fn(e):""}function Fn(e){return wt(e&&e.line)+":"+wt(e&&e.column)}function bt(e){return Fn(e&&e.start)+"-"+Fn(e&&e.end)}function wt(e){return e&&typeof e=="number"?e:1}class K extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},l=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(l=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?o.ruleId=r:(o.source=r.slice(0,u),o.ruleId=r.slice(u+1))}if(!o.place&&o.ancestors&&o.ancestors){const u=o.ancestors[o.ancestors.length-1];u&&(o.place=u.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=je(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}K.prototype.file="";K.prototype.name="";K.prototype.reason="";K.prototype.message="";K.prototype.stack="";K.prototype.column=void 0;K.prototype.line=void 0;K.prototype.ancestors=void 0;K.prototype.cause=void 0;K.prototype.fatal=void 0;K.prototype.place=void 0;K.prototype.ruleId=void 0;K.prototype.source=void 0;const qn={}.hasOwnProperty,pl=new Map,ml=/[A-Z]/g,gl=new Set(["table","tbody","thead","tfoot","tr"]),dl=new Set(["td","th"]),dr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function yl(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Il(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=El(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Un:Oi,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=yr(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function yr(e,t,n){if(t.type==="element")return kl(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return xl(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return wl(e,t,n);if(t.type==="mdxjsEsm")return bl(e,t);if(t.type==="root")return Sl(e,t,n);if(t.type==="text")return Cl(e,t)}function kl(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Un,e.schema=i),e.ancestors.push(t);const o=xr(e,t.tagName,!1),l=Al(e,t);let a=Yn(e,t);return gl.has(t.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!Ai(u):!0})),kr(e,l,o,t),Wn(l,a),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function xl(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ve(e,t.position)}function bl(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ve(e,t.position)}function wl(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Un,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:xr(e,t.name,!0),l=Tl(e,t),a=Yn(e,t);return kr(e,l,o,t),Wn(l,a),e.ancestors.pop(),e.schema=r,e.create(t,o,l,n)}function Sl(e,t,n){const r={};return Wn(r,Yn(e,t)),e.create(t,e.Fragment,r,n)}function Cl(e,t){return t.value}function kr(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Wn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function El(e,t,n){return r;function r(i,o,l,a){const s=Array.isArray(l.children)?n:t;return a?s(o,l,a):s(o,l)}}function Il(e,t){return n;function n(r,i,o,l){const a=Array.isArray(o.children),u=$n(r);return t(i,o,l,a,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Al(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&qn.call(t.properties,i)){const o=Pl(e,i,t.properties[i]);if(o){const[l,a]=o;e.tableCellAlignToStyle&&l==="align"&&typeof a=="string"&&dl.has(t.tagName)?r=a:n[l]=a}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Tl(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const l=o.expression;l.type;const a=l.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ve(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,o=e.evaluater.evaluateExpression(a.expression)}else Ve(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function Yn(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:pl;for(;++ri?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);o0?(re(e,e.length,0,t),e):t}const Et={}.hasOwnProperty;function wr(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function se(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const J=xe(/[A-Za-z]/),G=xe(/[\dA-Za-z]/),Ml=xe(/[#-'*+\--9=?A-Z^-~]/);function tn(e){return e!==null&&(e<32||e===127)}const Rn=xe(/\d/),Nl=xe(/[\dA-Fa-f]/),Bl=xe(/[!-/:-@[-`{-~]/);function v(e){return e!==null&&e<-2}function U(e){return e!==null&&(e<0||e===32)}function R(e){return e===-2||e===-1||e===32}const un=xe(new RegExp("\\p{P}|\\p{S}","u")),Ee=xe(/\s/);function xe(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Re(e){const t=[];let n=-1,r=0,i=0;for(;++n55295&&o<57344){const a=e.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(l=String.fromCharCode(o,a),i=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function O(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(u){return R(u)?(e.enter(n),a(u)):t(u)}function a(u){return R(u)&&o++l))return;const M=t.events.length;let $=M,B,k;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(B){k=t.events[$][1].end;break}B=!0}for(y(r),w=M;wE;){const F=n[L];t.containerState=F[1],F[0].exit.call(t,e)}n.length=E}function A(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function $l(e,t,n){return O(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Le(e){if(e===null||U(e)||Ee(e))return 1;if(un(e))return 2}function sn(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},p={...e[n][1].start};At(c,-u),At(p,u),l={type:u>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},o={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...l.start},end:{...a.end}},e[r][1].end={...l.start},e[n][1].start={...a.end},s=[],e[r][1].end.offset-e[r][1].start.offset&&(s=ie(s,[["enter",e[r][1],t],["exit",e[r][1],t]])),s=ie(s,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",o,t]]),s=ie(s,sn(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),s=ie(s,[["exit",o,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,s=ie(s,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,re(e,r-1,n-r+3,s),n=r+s.length-f-2;break}}for(n=-1;++n0&&R(w)?O(e,A,"linePrefix",o+1)(w):A(w)}function A(w){return w===null||v(w)?e.check(Tt,x,L)(w):(e.enter("codeFlowValue"),E(w))}function E(w){return w===null||v(w)?(e.exit("codeFlowValue"),A(w)):(e.consume(w),E)}function L(w){return e.exit("codeFenced"),t(w)}function F(w,M,$){let B=0;return k;function k(N){return w.enter("lineEnding"),w.consume(N),w.exit("lineEnding"),T}function T(N){return w.enter("codeFencedFence"),R(N)?O(w,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):P(N)}function P(N){return N===a?(w.enter("codeFencedFenceSequence"),j(N)):$(N)}function j(N){return N===a?(B++,w.consume(N),j):B>=l?(w.exit("codeFencedFenceSequence"),R(N)?O(w,q,"whitespace")(N):q(N)):$(N)}function q(N){return N===null||v(N)?(w.exit("codeFencedFence"),M(N)):$(N)}}}function to(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const dn={name:"codeIndented",tokenize:io},ro={partial:!0,tokenize:lo};function io(e,t,n){const r=this;return i;function i(s){return e.enter("codeIndented"),O(e,o,"linePrefix",5)(s)}function o(s){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?l(s):n(s)}function l(s){return s===null?u(s):v(s)?e.attempt(ro,l,u)(s):(e.enter("codeFlowValue"),a(s))}function a(s){return s===null||v(s)?(e.exit("codeFlowValue"),l(s)):(e.consume(s),a)}function u(s){return e.exit("codeIndented"),t(s)}}function lo(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):v(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):O(e,o,"linePrefix",5)(l)}function o(l){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(l):v(l)?i(l):n(l)}}const oo={name:"codeText",previous:uo,resolve:ao,tokenize:so};function ao(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ne(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ne(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ne(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function Tr(e,t,n,r,i,o,l,a,u){const s=u||Number.POSITIVE_INFINITY;let f=0;return c;function c(y){return y===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(y),e.exit(o),p):y===null||y===32||y===41||tn(y)?n(y):(e.enter(r),e.enter(l),e.enter(a),e.enter("chunkString",{contentType:"string"}),x(y))}function p(y){return y===62?(e.enter(o),e.consume(y),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(a),p(y)):y===null||y===60||v(y)?n(y):(e.consume(y),y===92?d:h)}function d(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function x(y){return!f&&(y===null||y===41||U(y))?(e.exit("chunkString"),e.exit(a),e.exit(l),e.exit(r),t(y)):f999||h===null||h===91||h===93&&!u||h===94&&!a&&"_hiddenFootnoteSupport"in l.parser.constructs?n(h):h===93?(e.exit(o),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):v(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===null||h===91||h===93||v(h)||a++>999?(e.exit("chunkString"),f(h)):(e.consume(h),u||(u=!R(h)),h===92?p:c)}function p(h){return h===91||h===92||h===93?(e.consume(h),a++,c):c(h)}}function vr(e,t,n,r,i,o){let l;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),l=p===40?41:p,u):n(p)}function u(p){return p===l?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(o),s(p))}function s(p){return p===l?(e.exit(o),u(l)):p===null?n(p):v(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),O(e,s,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===l||p===null||v(p)?(e.exit("chunkString"),s(p)):(e.consume(p),p===92?c:f)}function c(p){return p===l||p===92?(e.consume(p),f):f(p)}}function He(e,t){let n;return r;function r(i){return v(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):R(i)?O(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const ko={name:"definition",tokenize:bo},xo={partial:!0,tokenize:wo};function bo(e,t,n){const r=this;let i;return o;function o(h){return e.enter("definition"),l(h)}function l(h){return Pr.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=se(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),u):n(h)}function u(h){return U(h)?He(e,s)(h):s(h)}function s(h){return Tr(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function f(h){return e.attempt(xo,c,c)(h)}function c(h){return R(h)?O(e,p,"whitespace")(h):p(h)}function p(h){return h===null||v(h)?(e.exit("definition"),r.parser.defined.push(i),t(h)):n(h)}}function wo(e,t,n){return r;function r(a){return U(a)?He(e,i)(a):n(a)}function i(a){return vr(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return R(a)?O(e,l,"whitespace")(a):l(a)}function l(a){return a===null||v(a)?t(a):n(a)}}const So={name:"hardBreakEscape",tokenize:Co};function Co(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return v(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const Eo={name:"headingAtx",resolve:Io,tokenize:Ao};function Io(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},re(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function Ao(e,t,n){let r=0;return i;function i(f){return e.enter("atxHeading"),o(f)}function o(f){return e.enter("atxHeadingSequence"),l(f)}function l(f){return f===35&&r++<6?(e.consume(f),l):f===null||U(f)?(e.exit("atxHeadingSequence"),a(f)):n(f)}function a(f){return f===35?(e.enter("atxHeadingSequence"),u(f)):f===null||v(f)?(e.exit("atxHeading"),t(f)):R(f)?O(e,a,"whitespace")(f):(e.enter("atxHeadingText"),s(f))}function u(f){return f===35?(e.consume(f),u):(e.exit("atxHeadingSequence"),a(f))}function s(f){return f===null||f===35||U(f)?(e.exit("atxHeadingText"),a(f)):(e.consume(f),s)}}const To=["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"],vt=["pre","script","style","textarea"],Po={concrete:!0,name:"htmlFlow",resolveTo:Do,tokenize:Lo},vo={partial:!0,tokenize:Ro},zo={partial:!0,tokenize:Fo};function Do(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(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}function Lo(e,t,n){const r=this;let i,o,l,a,u;return s;function s(g){return f(g)}function f(g){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(g),c}function c(g){return g===33?(e.consume(g),p):g===47?(e.consume(g),o=!0,x):g===63?(e.consume(g),i=3,r.interrupt?t:m):J(g)?(e.consume(g),l=String.fromCharCode(g),C):n(g)}function p(g){return g===45?(e.consume(g),i=2,h):g===91?(e.consume(g),i=5,a=0,d):J(g)?(e.consume(g),i=4,r.interrupt?t:m):n(g)}function h(g){return g===45?(e.consume(g),r.interrupt?t:m):n(g)}function d(g){const ae="CDATA[";return g===ae.charCodeAt(a++)?(e.consume(g),a===ae.length?r.interrupt?t:P:d):n(g)}function x(g){return J(g)?(e.consume(g),l=String.fromCharCode(g),C):n(g)}function C(g){if(g===null||g===47||g===62||U(g)){const ae=g===47,be=l.toLowerCase();return!ae&&!o&&vt.includes(be)?(i=1,r.interrupt?t(g):P(g)):To.includes(l.toLowerCase())?(i=6,ae?(e.consume(g),y):r.interrupt?t(g):P(g)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(g):o?A(g):E(g))}return g===45||G(g)?(e.consume(g),l+=String.fromCharCode(g),C):n(g)}function y(g){return g===62?(e.consume(g),r.interrupt?t:P):n(g)}function A(g){return R(g)?(e.consume(g),A):k(g)}function E(g){return g===47?(e.consume(g),k):g===58||g===95||J(g)?(e.consume(g),L):R(g)?(e.consume(g),E):k(g)}function L(g){return g===45||g===46||g===58||g===95||G(g)?(e.consume(g),L):F(g)}function F(g){return g===61?(e.consume(g),w):R(g)?(e.consume(g),F):E(g)}function w(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),u=g,M):R(g)?(e.consume(g),w):$(g)}function M(g){return g===u?(e.consume(g),u=null,B):g===null||v(g)?n(g):(e.consume(g),M)}function $(g){return g===null||g===34||g===39||g===47||g===60||g===61||g===62||g===96||U(g)?F(g):(e.consume(g),$)}function B(g){return g===47||g===62||R(g)?E(g):n(g)}function k(g){return g===62?(e.consume(g),T):n(g)}function T(g){return g===null||v(g)?P(g):R(g)?(e.consume(g),T):n(g)}function P(g){return g===45&&i===2?(e.consume(g),Q):g===60&&i===1?(e.consume(g),Y):g===62&&i===4?(e.consume(g),oe):g===63&&i===3?(e.consume(g),m):g===93&&i===5?(e.consume(g),he):v(g)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(vo,pe,j)(g)):g===null||v(g)?(e.exit("htmlFlowData"),j(g)):(e.consume(g),P)}function j(g){return e.check(zo,q,pe)(g)}function q(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),N}function N(g){return g===null||v(g)?j(g):(e.enter("htmlFlowData"),P(g))}function Q(g){return g===45?(e.consume(g),m):P(g)}function Y(g){return g===47?(e.consume(g),l="",le):P(g)}function le(g){if(g===62){const ae=l.toLowerCase();return vt.includes(ae)?(e.consume(g),oe):P(g)}return J(g)&&l.length<8?(e.consume(g),l+=String.fromCharCode(g),le):P(g)}function he(g){return g===93?(e.consume(g),m):P(g)}function m(g){return g===62?(e.consume(g),oe):g===45&&i===2?(e.consume(g),m):P(g)}function oe(g){return g===null||v(g)?(e.exit("htmlFlowData"),pe(g)):(e.consume(g),oe)}function pe(g){return e.exit("htmlFlow"),t(g)}}function Fo(e,t,n){const r=this;return i;function i(l){return v(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):n(l)}function o(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function Ro(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(We,t,n)}}const _o={name:"htmlText",tokenize:Oo};function Oo(e,t,n){const r=this;let i,o,l;return a;function a(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),u}function u(m){return m===33?(e.consume(m),s):m===47?(e.consume(m),F):m===63?(e.consume(m),E):J(m)?(e.consume(m),$):n(m)}function s(m){return m===45?(e.consume(m),f):m===91?(e.consume(m),o=0,d):J(m)?(e.consume(m),A):n(m)}function f(m){return m===45?(e.consume(m),h):n(m)}function c(m){return m===null?n(m):m===45?(e.consume(m),p):v(m)?(l=c,Y(m)):(e.consume(m),c)}function p(m){return m===45?(e.consume(m),h):c(m)}function h(m){return m===62?Q(m):m===45?p(m):c(m)}function d(m){const oe="CDATA[";return m===oe.charCodeAt(o++)?(e.consume(m),o===oe.length?x:d):n(m)}function x(m){return m===null?n(m):m===93?(e.consume(m),C):v(m)?(l=x,Y(m)):(e.consume(m),x)}function C(m){return m===93?(e.consume(m),y):x(m)}function y(m){return m===62?Q(m):m===93?(e.consume(m),y):x(m)}function A(m){return m===null||m===62?Q(m):v(m)?(l=A,Y(m)):(e.consume(m),A)}function E(m){return m===null?n(m):m===63?(e.consume(m),L):v(m)?(l=E,Y(m)):(e.consume(m),E)}function L(m){return m===62?Q(m):E(m)}function F(m){return J(m)?(e.consume(m),w):n(m)}function w(m){return m===45||G(m)?(e.consume(m),w):M(m)}function M(m){return v(m)?(l=M,Y(m)):R(m)?(e.consume(m),M):Q(m)}function $(m){return m===45||G(m)?(e.consume(m),$):m===47||m===62||U(m)?B(m):n(m)}function B(m){return m===47?(e.consume(m),Q):m===58||m===95||J(m)?(e.consume(m),k):v(m)?(l=B,Y(m)):R(m)?(e.consume(m),B):Q(m)}function k(m){return m===45||m===46||m===58||m===95||G(m)?(e.consume(m),k):T(m)}function T(m){return m===61?(e.consume(m),P):v(m)?(l=T,Y(m)):R(m)?(e.consume(m),T):B(m)}function P(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),i=m,j):v(m)?(l=P,Y(m)):R(m)?(e.consume(m),P):(e.consume(m),q)}function j(m){return m===i?(e.consume(m),i=void 0,N):m===null?n(m):v(m)?(l=j,Y(m)):(e.consume(m),j)}function q(m){return m===null||m===34||m===39||m===60||m===61||m===96?n(m):m===47||m===62||U(m)?B(m):(e.consume(m),q)}function N(m){return m===47||m===62||U(m)?B(m):n(m)}function Q(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),t):n(m)}function Y(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),le}function le(m){return R(m)?O(e,he,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):he(m)}function he(m){return e.enter("htmlTextData"),l(m)}}const Gn={name:"labelEnd",resolveAll:jo,resolveTo:Ho,tokenize:Uo},Mo={tokenize:Vo},No={tokenize:$o},Bo={tokenize:qo};function jo(e){let t=-1;const n=[];for(;++t=3&&(s===null||v(s))?(e.exit("thematicBreak"),t(s)):n(s)}function u(s){return s===i?(e.consume(s),r++,u):(e.exit("thematicBreakSequence"),R(s)?O(e,a,"whitespace")(s):a(s))}}const Z={continuation:{tokenize:na},exit:ra,name:"list",tokenize:ea},Jo={partial:!0,tokenize:ia},Zo={partial:!0,tokenize:ta};function ea(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return a;function a(h){const d=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(d==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Rn(h)){if(r.containerState.type||(r.containerState.type=d,e.enter(d,{_container:!0})),d==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Ze,n,s)(h):s(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(h)}return n(h)}function u(h){return Rn(h)&&++l<10?(e.consume(h),u):(!r.interrupt||l<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),s(h)):n(h)}function s(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(We,r.interrupt?n:f,e.attempt(Jo,p,c))}function f(h){return r.containerState.initialBlankLine=!0,o++,p(h)}function c(h){return R(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function na(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(We,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,O(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!R(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Zo,t,l)(a))}function l(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,O(e,e.attempt(Z,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function ta(e,t,n){const r=this;return O(e,i,"listItemIndent",r.containerState.size+1);function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(o):n(o)}}function ra(e){e.exit(this.containerState.type)}function ia(e,t,n){const r=this;return O(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const l=r.events[r.events.length-1];return!R(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const zt={name:"setextUnderline",resolveTo:la,tokenize:oa};function la(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",l,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function oa(e,t,n){const r=this;let i;return o;function o(s){let f=r.events.length,c;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){c=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=s,l(s)):n(s)}function l(s){return e.enter("setextHeadingLineSequence"),a(s)}function a(s){return s===i?(e.consume(s),a):(e.exit("setextHeadingLineSequence"),R(s)?O(e,u,"lineSuffix")(s):u(s))}function u(s){return s===null||v(s)?(e.exit("setextHeadingLine"),t(s)):n(s)}}const aa={tokenize:ua};function ua(e){const t=this,n=e.attempt(We,r,e.attempt(this.parser.constructs.flowInitial,i,O(e,e.attempt(this.parser.constructs.flow,i,e.attempt(ho,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const sa={resolveAll:Dr()},ca=zr("string"),fa=zr("text");function zr(e){return{resolveAll:Dr(e==="text"?ha:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,l,a);return l;function l(f){return s(f)?o(f):a(f)}function a(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),u}function u(f){return s(f)?(n.exit("data"),o(f)):(n.consume(f),u)}function s(f){if(f===null)return!0;const c=i[f];let p=-1;if(c)for(;++p-1){const a=l[0];typeof a=="string"?l[0]=a.slice(r):l.shift()}o>0&&l.push(e[i].slice(0,o))}return l}function Ia(e,t){let n=-1;const r=[];let i;for(;++n0){const ue=z.tokenStack[z.tokenStack.length-1];(ue[1]||Lt).call(z,void 0,ue[0])}for(I.position={start:ke(b.length>0?b[0][1].start:{line:1,column:1,offset:0}),end:ke(b.length>0?b[b.length-2][1].end:{line:1,column:1,offset:0})},H=-1;++Hn.getUsage(),enabled:e,staleTime:3e4,refetchOnWindowFocus:!0})}function c(e=!0){return r({queryKey:o,queryFn:()=>n.getOpenRouterCredential(),enabled:e,refetchOnWindowFocus:!0})}function m(e){const t=new Date(e);return{local:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t),utc:`${t.toLocaleString("en-GB",{timeZone:"UTC",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})} UTC`}}export{u as O,c as a,o as b,m as r,s as u}; +import{u as r}from"./useQuery-BZo4MZ3s.js";import{c as n}from"./chat-7zW8PrrA.js";const u=["chat","openrouter","usage"],o=["chat","openrouter","credential"];function s(e=!0){return r({queryKey:u,queryFn:()=>n.getUsage(),enabled:e,staleTime:3e4,refetchOnWindowFocus:!0})}function c(e=!0){return r({queryKey:o,queryFn:()=>n.getOpenRouterCredential(),enabled:e,refetchOnWindowFocus:!0})}function m(e){const t=new Date(e);return{local:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t),utc:`${t.toLocaleString("en-GB",{timeZone:"UTC",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})} UTC`}}export{u as O,c as a,o as b,m as r,s as u}; diff --git a/assets/papers-DBaPliAp.js b/assets/papers-DBaPliAp.js deleted file mode 100644 index c002a233ed631dd0724bc7a7ace666964a03f790..0000000000000000000000000000000000000000 --- a/assets/papers-DBaPliAp.js +++ /dev/null @@ -1 +0,0 @@ -var y=Object.defineProperty;var w=(n,e,t)=>e in n?y(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var m=(n,e,t)=>w(n,typeof e!="symbol"?e+"":e,t);import{A as f,D as S,U as l}from"./index-BrhBTT14.js";const d="pwc:fresh-auth-mutation";function v(n){if(typeof window>"u")return;sessionStorage.setItem("pwc:fresh-auth-edit",n);const e=S("/api/v1/auth/hf/login");window.location.assign(`${e}?return_to=${encodeURIComponent(window.location.href)}`)}class ${constructor(e,t=v){m(this,"paperLoads",new Map);m(this,"evaluationLoads",new Map);this.request=e,this.recoverFreshAuth=t}primePaper(e,t=!1){t&&this.paperLoads.delete(e);let r=this.paperLoads.get(e);return r||(r=this.request(`/papers/${e}/curation-state`).catch(s=>{throw this.paperLoads.delete(e),s}),this.paperLoads.set(e,r)),r}primeEvaluations(e,t=!1){t&&this.evaluationLoads.delete(e);let r=this.evaluationLoads.get(e);return r||(r=this.request(`/evaluations/curation-state?paper_id=${e}`).catch(s=>{throw this.evaluationLoads.delete(e),s}),this.evaluationLoads.set(e,r)),r}async mutatePaper(e,t,r,s,a){const o=this.paperLoads.get(e);if(!o)throw new Error("The catalog version was not loaded when this editor opened. Close and reopen the editor.");const h=(await o).sections[t];if(!h)throw new Error(`Missing curation version for ${t}`);return this.mutate(t,s,r,h,a,`paper:${e}:${t}`)}async mutateEvaluations(e,t,r,s){const a=this.evaluationLoads.get(String(e));if(!a)throw new Error("The evaluation version was not loaded when this editor opened. Close and reopen the editor.");const o=(await a).version;return this.mutate("evaluations",r,t,o,s,`paper:${e}:evaluations`)}async mutate(e,t,r,s,a,o){const h=new Headers(a.headers);Object.entries(this.idempotencyHeaders(o,r,s)).forEach(([i,g])=>h.set(i,g));const p={...a,headers:h};try{const i=await this.request(t,p);return this.clearAttempt(p),i}catch(i){throw i instanceof f&&i.status===401&&i.code==="fresh_auth_required"?(this.saveFreshAuthMutation(e,t,r,p),this.recoverFreshAuth(e)):i instanceof f&&i.status===409&&(this.clearAttempt(p),typeof window<"u"&&window.dispatchEvent(new CustomEvent("pwc:catalog-conflict",{detail:{endpoint:t}}))),i}}freshAuthMutationDraft(){const e=sessionStorage.getItem(d);if(!e)return null;try{const t=JSON.parse(e);if(!t.endpoint.startsWith("/")||t.endpoint.startsWith("//")||!["POST","PUT","PATCH","DELETE"].includes(t.options.method))throw new Error("Invalid saved mutation draft");return t}catch{return sessionStorage.removeItem(d),null}}async resumeFreshAuthMutation(){const e=this.freshAuthMutationDraft();if(!e)throw new Error("No saved catalog edit is available.");const t=await this.request(e.endpoint,{method:e.options.method,body:e.options.body,headers:e.options.headers});return this.clearAttempt({headers:e.options.headers}),sessionStorage.removeItem(d),sessionStorage.removeItem("pwc:fresh-auth-edit"),t}saveFreshAuthMutation(e,t,r,s){const a=Object.fromEntries(new Headers(s.headers).entries()),o=typeof s.body=="string"?s.body:void 0;sessionStorage.setItem(d,JSON.stringify({section:e,endpoint:t,payload:r,options:{method:(s.method??"POST").toUpperCase(),body:o,headers:a}}))}idempotencyHeaders(e,t,r){const s=`pwc:mutation:${e}:${JSON.stringify(t)}`,a=sessionStorage.getItem(s);if(a){const h=JSON.parse(a);return{"Idempotency-Key":h.key,"If-Match":h.version}}const o=crypto.randomUUID();return sessionStorage.setItem(s,JSON.stringify({key:o,version:r})),sessionStorage.setItem(`pwc:mutation-key:${o}`,s),{"Idempotency-Key":o,"If-Match":r}}clearAttempt(e){const t=new Headers(e.headers).get("Idempotency-Key");if(!t)return;const r=sessionStorage.getItem(`pwc:mutation-key:${t}`);r&&sessionStorage.removeItem(r),sessionStorage.removeItem(`pwc:mutation-key:${t}`),this.paperLoads.clear(),this.evaluationLoads.clear()}}const u=new $(l);function c(n){const e=new URLSearchParams;for(const[r,s]of Object.entries(n??{}))s!==void 0&&s!==""&&e.set(r,String(s));const t=e.toString();return t?`?${t}`:""}class P{constructor(e){this.request=e}list(e){const t=new URLSearchParams;for(const[s,a]of Object.entries(e??{}))a!==void 0&&a!==""&&t.set(s,String(a));const r=t.toString();return this.request(`/papers/${r?`?${r}`:""}`,{cache:"no-cache"})}search(e,t=1,r=10,s,a){const o=new URLSearchParams({q:e,page:t.toString(),page_size:r.toString()});return s&&o.set("mode",s),this.request(`/papers/search?${o.toString()}`,{signal:a})}get(e,t=!0){const r=t?"?include_resources=true":"";return this.request(`/papers/${e}${r}`)}getByArxivId(e,t=!0){const r=t?"?include_resources=true":"";return this.request(`/papers/arxiv/${e}${r}`)}related(e,t=4){return this.request(`/papers/${encodeURIComponent(e)}/related?limit=${t}`)}versions(e){return this.request(`/papers/arxiv/${e}/versions`)}indexFromArxiv(e){return this.request(`/papers/index/${e}`,{method:"POST"})}submit(e){return this.request("/papers/submit",{method:"POST",body:JSON.stringify(e)})}copyToBucket(e,t){return this.request(`/papers/${encodeURIComponent(e)}/copy-to-bucket`,{method:"POST",body:JSON.stringify(t)})}trending(e){const t=new URLSearchParams;for(const[s,a]of Object.entries(e??{}))a!==void 0&&t.set(s,String(a));const r=t.toString();return this.request(`/papers/trending${r?`?${r}`:""}`,{cache:"no-store"})}forTask(e,t){return this.request(`/tasks/${e}/papers${c(t)}`)}forMethod(e,t){return this.request(`/methods/${encodeURIComponent(e)}/papers${c(t)}`)}forConference(e,t){return this.request(`/conferences/${e}/papers${c(t)}`)}forOrganization(e,t){return this.request(`/organizations/${e}/papers${c(t)}`)}getAuthor(e){return this.request(`/authors/${e}`)}authorPapers(e,t){return this.request(`/authors/${e}/papers${c(t)}`)}primeCurationState(e,t=!1){return u.primePaper(e,t)}freshAuthMutationDraft(){return u.freshAuthMutationDraft()}resumeFreshAuthMutation(){return u.resumeFreshAuthMutation()}updateTasks(e,t){const r=new URLSearchParams(t.map(s=>["task_ids",String(s)])).toString();return u.mutatePaper(e,"tasks",t,`/papers/${e}/tasks?${r}`,{method:"PUT"})}updateMethods(e,t){const r=new URLSearchParams(t.map(s=>["method_ids",String(s)])).toString();return u.mutatePaper(e,"methods",t,`/papers/${e}/methods?${r}`,{method:"PUT"})}updateOrganizations(e,t){const r=new URLSearchParams(t.map(s=>["organization_ids",String(s)])).toString();return u.mutatePaper(e,"organizations",t,`/papers/${e}/organizations?${r}`,{method:"PUT"})}updateRepositories(e,t){return u.mutatePaper(e,"repositories",t,`/papers/${e}/repositories`,{method:"PUT",body:JSON.stringify({repositories:t})})}updateProjectPages(e,t){return u.mutatePaper(e,"project_pages",t,`/papers/${e}/project-pages`,{method:"PUT",body:JSON.stringify({project_pages:t})})}updateSourceUrl(e,t){return u.mutatePaper(e,"source_url",t,`/papers/${e}/source-url`,{method:"PUT",body:JSON.stringify({source_url:t})})}updateHfArtifacts(e,t){return u.mutatePaper(e,"hf_artifacts",t,`/papers/${e}/hf-artifacts`,{method:"PUT",body:JSON.stringify(t)})}}const U=new P(l);export{u as a,U as p}; diff --git a/assets/papers-DHqjKX7p.js b/assets/papers-DHqjKX7p.js new file mode 100644 index 0000000000000000000000000000000000000000..c077da012105bdcc4898fdcf10d09c14a4853048 --- /dev/null +++ b/assets/papers-DHqjKX7p.js @@ -0,0 +1 @@ +var y=Object.defineProperty;var w=(n,e,t)=>e in n?y(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var m=(n,e,t)=>w(n,typeof e!="symbol"?e+"":e,t);import{A as f,x as S,a0 as l}from"./index-D_-UZEuL.js";const d="pwc:fresh-auth-mutation";function v(n){if(typeof window>"u")return;sessionStorage.setItem("pwc:fresh-auth-edit",n);const e=S("/api/v1/auth/hf/login");window.location.assign(`${e}?return_to=${encodeURIComponent(window.location.href)}`)}class ${constructor(e,t=v){m(this,"paperLoads",new Map);m(this,"evaluationLoads",new Map);this.request=e,this.recoverFreshAuth=t}primePaper(e,t=!1){t&&this.paperLoads.delete(e);let r=this.paperLoads.get(e);return r||(r=this.request(`/papers/${e}/curation-state`).catch(s=>{throw this.paperLoads.delete(e),s}),this.paperLoads.set(e,r)),r}primeEvaluations(e,t=!1){t&&this.evaluationLoads.delete(e);let r=this.evaluationLoads.get(e);return r||(r=this.request(`/evaluations/curation-state?paper_id=${e}`).catch(s=>{throw this.evaluationLoads.delete(e),s}),this.evaluationLoads.set(e,r)),r}async mutatePaper(e,t,r,s,a){const o=this.paperLoads.get(e);if(!o)throw new Error("The catalog version was not loaded when this editor opened. Close and reopen the editor.");const h=(await o).sections[t];if(!h)throw new Error(`Missing curation version for ${t}`);return this.mutate(t,s,r,h,a,`paper:${e}:${t}`)}async mutateEvaluations(e,t,r,s){const a=this.evaluationLoads.get(String(e));if(!a)throw new Error("The evaluation version was not loaded when this editor opened. Close and reopen the editor.");const o=(await a).version;return this.mutate("evaluations",r,t,o,s,`paper:${e}:evaluations`)}async mutate(e,t,r,s,a,o){const h=new Headers(a.headers);Object.entries(this.idempotencyHeaders(o,r,s)).forEach(([i,g])=>h.set(i,g));const p={...a,headers:h};try{const i=await this.request(t,p);return this.clearAttempt(p),i}catch(i){throw i instanceof f&&i.status===401&&i.code==="fresh_auth_required"?(this.saveFreshAuthMutation(e,t,r,p),this.recoverFreshAuth(e)):i instanceof f&&i.status===409&&(this.clearAttempt(p),typeof window<"u"&&window.dispatchEvent(new CustomEvent("pwc:catalog-conflict",{detail:{endpoint:t}}))),i}}freshAuthMutationDraft(){const e=sessionStorage.getItem(d);if(!e)return null;try{const t=JSON.parse(e);if(!t.endpoint.startsWith("/")||t.endpoint.startsWith("//")||!["POST","PUT","PATCH","DELETE"].includes(t.options.method))throw new Error("Invalid saved mutation draft");return t}catch{return sessionStorage.removeItem(d),null}}async resumeFreshAuthMutation(){const e=this.freshAuthMutationDraft();if(!e)throw new Error("No saved catalog edit is available.");const t=await this.request(e.endpoint,{method:e.options.method,body:e.options.body,headers:e.options.headers});return this.clearAttempt({headers:e.options.headers}),sessionStorage.removeItem(d),sessionStorage.removeItem("pwc:fresh-auth-edit"),t}saveFreshAuthMutation(e,t,r,s){const a=Object.fromEntries(new Headers(s.headers).entries()),o=typeof s.body=="string"?s.body:void 0;sessionStorage.setItem(d,JSON.stringify({section:e,endpoint:t,payload:r,options:{method:(s.method??"POST").toUpperCase(),body:o,headers:a}}))}idempotencyHeaders(e,t,r){const s=`pwc:mutation:${e}:${JSON.stringify(t)}`,a=sessionStorage.getItem(s);if(a){const h=JSON.parse(a);return{"Idempotency-Key":h.key,"If-Match":h.version}}const o=crypto.randomUUID();return sessionStorage.setItem(s,JSON.stringify({key:o,version:r})),sessionStorage.setItem(`pwc:mutation-key:${o}`,s),{"Idempotency-Key":o,"If-Match":r}}clearAttempt(e){const t=new Headers(e.headers).get("Idempotency-Key");if(!t)return;const r=sessionStorage.getItem(`pwc:mutation-key:${t}`);r&&sessionStorage.removeItem(r),sessionStorage.removeItem(`pwc:mutation-key:${t}`),this.paperLoads.clear(),this.evaluationLoads.clear()}}const u=new $(l);function c(n){const e=new URLSearchParams;for(const[r,s]of Object.entries(n??{}))s!==void 0&&s!==""&&e.set(r,String(s));const t=e.toString();return t?`?${t}`:""}class P{constructor(e){this.request=e}list(e){const t=new URLSearchParams;for(const[s,a]of Object.entries(e??{}))a!==void 0&&a!==""&&t.set(s,String(a));const r=t.toString();return this.request(`/papers/${r?`?${r}`:""}`,{cache:"no-cache"})}search(e,t=1,r=10,s,a){const o=new URLSearchParams({q:e,page:t.toString(),page_size:r.toString()});return s&&o.set("mode",s),this.request(`/papers/search?${o.toString()}`,{signal:a})}get(e,t=!0){const r=t?"?include_resources=true":"";return this.request(`/papers/${e}${r}`)}getByArxivId(e,t=!0){const r=t?"?include_resources=true":"";return this.request(`/papers/arxiv/${e}${r}`)}related(e,t=4){return this.request(`/papers/${encodeURIComponent(e)}/related?limit=${t}`)}versions(e){return this.request(`/papers/arxiv/${e}/versions`)}indexFromArxiv(e){return this.request(`/papers/index/${e}`,{method:"POST"})}submit(e){return this.request("/papers/submit",{method:"POST",body:JSON.stringify(e)})}copyToBucket(e,t){return this.request(`/papers/${encodeURIComponent(e)}/copy-to-bucket`,{method:"POST",body:JSON.stringify(t)})}trending(e){const t=new URLSearchParams;for(const[s,a]of Object.entries(e??{}))a!==void 0&&t.set(s,String(a));const r=t.toString();return this.request(`/papers/trending${r?`?${r}`:""}`,{cache:"no-store"})}forTask(e,t){return this.request(`/tasks/${e}/papers${c(t)}`)}forMethod(e,t){return this.request(`/methods/${encodeURIComponent(e)}/papers${c(t)}`)}forConference(e,t){return this.request(`/conferences/${e}/papers${c(t)}`)}forOrganization(e,t){return this.request(`/organizations/${e}/papers${c(t)}`)}getAuthor(e){return this.request(`/authors/${e}`)}authorPapers(e,t){return this.request(`/authors/${e}/papers${c(t)}`)}primeCurationState(e,t=!1){return u.primePaper(e,t)}freshAuthMutationDraft(){return u.freshAuthMutationDraft()}resumeFreshAuthMutation(){return u.resumeFreshAuthMutation()}updateTasks(e,t){const r=new URLSearchParams(t.map(s=>["task_ids",String(s)])).toString();return u.mutatePaper(e,"tasks",t,`/papers/${e}/tasks?${r}`,{method:"PUT"})}updateMethods(e,t){const r=new URLSearchParams(t.map(s=>["method_ids",String(s)])).toString();return u.mutatePaper(e,"methods",t,`/papers/${e}/methods?${r}`,{method:"PUT"})}updateOrganizations(e,t){const r=new URLSearchParams(t.map(s=>["organization_ids",String(s)])).toString();return u.mutatePaper(e,"organizations",t,`/papers/${e}/organizations?${r}`,{method:"PUT"})}updateRepositories(e,t){return u.mutatePaper(e,"repositories",t,`/papers/${e}/repositories`,{method:"PUT",body:JSON.stringify({repositories:t})})}updateProjectPages(e,t){return u.mutatePaper(e,"project_pages",t,`/papers/${e}/project-pages`,{method:"PUT",body:JSON.stringify({project_pages:t})})}updateSourceUrl(e,t){return u.mutatePaper(e,"source_url",t,`/papers/${e}/source-url`,{method:"PUT",body:JSON.stringify({source_url:t})})}updateHfArtifacts(e,t){return u.mutatePaper(e,"hf_artifacts",t,`/papers/${e}/hf-artifacts`,{method:"PUT",body:JSON.stringify(t)})}}const O=new P(l);export{u as a,O as p}; diff --git a/assets/pdf.worker.min-GB3t0DcA.mjs b/assets/pdf.worker.min-GB3t0DcA.mjs new file mode 100644 index 0000000000000000000000000000000000000000..84fc7c596f6c7bc1b26d7cb39940c2d9f6b7c670 --- /dev/null +++ b/assets/pdf.worker.min-GB3t0DcA.mjs @@ -0,0 +1,21 @@ +/** + * @licstart The following is the entire license notice for the + * JavaScript code in this page + * + * Copyright 2024 Mozilla Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @licend The above is the entire license notice for the + * JavaScript code in this page + */var e={d:(t,i)=>{for(var a in i)e.o(i,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:i[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},__webpack_exports__ = globalThis.pdfjsWorker = {};e.d(__webpack_exports__,{WorkerMessageHandler:()=>WorkerMessageHandler});const t=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),i=[1,0,0,1,0,0],a=[.001,0,0,.001,0,0],s=1.35,r=.35,n=.25925925925925924,g=1,o=2,c=4,C=8,h=16,l=64,Q=128,E=256,u="pdfjs_internal_editor_",d=3,f=9,p=13,m=15,y={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},w=0,D=4,b=1,F=2,S=3,k=1,R=2,N=3,G=4,x=5,U=6,M=7,L=8,H=9,J=10,Y=11,v=12,K=13,T=14,q=15,O=16,W=17,j=20,X="Group",Z="R",V=1,z=2,_=4,$=16,AA=32,eA=128,tA=512,iA=1,aA=2,sA=4096,rA=8192,nA=32768,gA=65536,oA=131072,IA=1048576,cA=2097152,CA=8388608,hA=16777216,lA=1,BA=2,QA=3,EA=4,uA=5,dA={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"},fA={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},pA={O:"PageOpen",C:"PageClose"},mA={ERRORS:0,WARNINGS:1,INFOS:5},yA=1,wA=2,DA=3,bA=4,FA=5,SA=6,kA=7,RA=8,NA=9,GA=10,xA=11,UA=12,MA=13,LA=14,HA=15,JA=16,YA=17,vA=18,KA=19,TA=20,qA=21,OA=22,PA=23,WA=24,jA=25,XA=26,ZA=27,VA=28,zA=29,_A=30,$A=31,Ae=32,ee=33,te=34,ie=35,ae=36,se=37,re=38,ne=39,ge=40,oe=41,Ie=42,ce=43,Ce=44,he=45,le=46,Be=47,Qe=48,Ee=49,ue=50,de=51,fe=52,pe=53,me=54,ye=55,we=56,De=57,be=58,Fe=59,Se=60,ke=61,Re=62,Ne=63,Ge=64,xe=65,Ue=66,Me=67,Le=68,He=69,Je=70,Ye=71,ve=72,Ke=73,Te=74,qe=75,Oe=76,Pe=77,We=80,je=81,Xe=83,Ze=84,Ve=85,ze=86,_e=87,$e=88,At=89,et=90,tt=91,it=92,at=93,st=1,rt=2;let nt=mA.WARNINGS;function getVerbosityLevel(){return nt}function info(e){nt>=mA.INFOS&&console.log(`Info: ${e}`)}function warn(e){nt>=mA.WARNINGS&&console.log(`Warning: ${e}`)}function unreachable(e){throw new Error(e)}function assert(e,t){e||unreachable(t)}function createValidAbsoluteUrl(e,t=null,i=null){if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=stringToUTF8String(e)}catch{}}const a=t?new URL(e,t):new URL(e);if(function _isValidProtocol(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(a))return a}catch{}return null}function shadow(e,t,i,a=!1){Object.defineProperty(e,t,{value:i,enumerable:!a,configurable:!0,writable:!1});return i}const gt=function BaseExceptionClosure(){function BaseException(e,t){this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();class PasswordException extends gt{constructor(e,t){super(e,"PasswordException");this.code=t}}class UnknownErrorException extends gt{constructor(e,t){super(e,"UnknownErrorException");this.details=t}}class InvalidPDFException extends gt{constructor(e){super(e,"InvalidPDFException")}}class MissingPDFException extends gt{constructor(e){super(e,"MissingPDFException")}}class UnexpectedResponseException extends gt{constructor(e,t){super(e,"UnexpectedResponseException");this.status=t}}class FormatError extends gt{constructor(e){super(e,"FormatError")}}class AbortException extends gt{constructor(e){super(e,"AbortException")}}function bytesToString(e){"object"==typeof e&&void 0!==e?.length||unreachable("Invalid argument for bytesToString");const t=e.length,i=8192;if(t>24&255,e>>16&255,e>>8&255,255&e)}function objectSize(e){return Object.keys(e).length}class FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?shadow(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof navigator?.userAgent&&navigator.userAgent.includes("Firefox")}):shadow(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){return shadow(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const ot=Array.from(Array(256).keys(),(e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,i){return`#${ot[e]}${ot[t]}${ot[i]}`}static scaleMinMax(e,t){let i;if(e[0]){if(e[0]<0){i=t[0];t[0]=t[2];t[2]=i}t[0]*=e[0];t[2]*=e[0];if(e[3]<0){i=t[1];t[1]=t[3];t[3]=i}t[1]*=e[3];t[3]*=e[3]}else{i=t[0];t[0]=t[1];t[1]=i;i=t[2];t[2]=t[3];t[3]=i;if(e[1]<0){i=t[1];t[1]=t[3];t[3]=i}t[1]*=e[1];t[3]*=e[1];if(e[2]<0){i=t[0];t[0]=t[2];t[2]=i}t[0]*=e[2];t[2]*=e[2]}t[0]+=e[4];t[1]+=e[5];t[2]+=e[4];t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const i=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/i,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/i]}static getAxialAlignedBoundingBox(e,t){const i=this.applyTransform(e,t),a=this.applyTransform(e.slice(2,4),t),s=this.applyTransform([e[0],e[3]],t),r=this.applyTransform([e[2],e[1]],t);return[Math.min(i[0],a[0],s[0],r[0]),Math.min(i[1],a[1],s[1],r[1]),Math.max(i[0],a[0],s[0],r[0]),Math.max(i[1],a[1],s[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],i=e[0]*t[0]+e[1]*t[2],a=e[0]*t[1]+e[1]*t[3],s=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],n=(i+r)/2,g=Math.sqrt((i+r)**2-4*(i*r-s*a))/2,o=n+g||1,c=n-g||1;return[Math.sqrt(o),Math.sqrt(c)]}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){const i=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),a=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(i>a)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>r?null:[i,s,a,r]}static#A(e,t,i,a,s,r,n,g,o,c){if(o<=0||o>=1)return;const C=1-o,h=o*o,l=h*o,Q=C*(C*(C*e+3*o*t)+3*h*i)+l*a,E=C*(C*(C*s+3*o*r)+3*h*n)+l*g;c[0]=Math.min(c[0],Q);c[1]=Math.min(c[1],E);c[2]=Math.max(c[2],Q);c[3]=Math.max(c[3],E)}static#e(e,t,i,a,s,r,n,g,o,c,C,h){if(Math.abs(o)<1e-12){Math.abs(c)>=1e-12&&this.#A(e,t,i,a,s,r,n,g,-C/c,h);return}const l=c**2-4*C*o;if(l<0)return;const Q=Math.sqrt(l),E=2*o;this.#A(e,t,i,a,s,r,n,g,(-c+Q)/E,h);this.#A(e,t,i,a,s,r,n,g,(-c-Q)/E,h)}static bezierBoundingBox(e,t,i,a,s,r,n,g,o){if(o){o[0]=Math.min(o[0],e,n);o[1]=Math.min(o[1],t,g);o[2]=Math.max(o[2],e,n);o[3]=Math.max(o[3],t,g)}else o=[Math.min(e,n),Math.min(t,g),Math.max(e,n),Math.max(t,g)];this.#e(e,i,s,n,t,a,r,g,3*(3*(i-s)-e+n),6*(e-2*i+s),3*(i-e),o);this.#e(e,i,s,n,t,a,r,g,3*(3*(a-r)-t+g),6*(t-2*a+r),3*(a-t),o);return o}}const It=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function stringToPDFString(e){if(e[0]>="ï"){let t;if("þ"===e[0]&&"ÿ"===e[1]){t="utf-16be";e.length%2==1&&(e=e.slice(0,-1))}else if("ÿ"===e[0]&&"þ"===e[1]){t="utf-16le";e.length%2==1&&(e=e.slice(0,-1))}else"ï"===e[0]&&"»"===e[1]&&"¿"===e[2]&&(t="utf-8");if(t)try{const i=new TextDecoder(t,{fatal:!0}),a=stringToBytes(e),s=i.decode(a);return s.includes("")?s.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g,""):s}catch(e){warn(`stringToPDFString: "${e}".`)}}const t=[];for(let i=0,a=e.length;iot[e])).join("")}const mt=Symbol("CIRCULAR_REF"),yt=Symbol("EOF");let wt=Object.create(null),Dt=Object.create(null),bt=Object.create(null);class Name{constructor(e){this.name=e}static get(e){return Dt[e]||=new Name(e)}}class Cmd{constructor(e){this.cmd=e}static get(e){return wt[e]||=new Cmd(e)}}const Ft=function nonSerializableClosure(){return Ft};class Dict{constructor(e=null){this._map=Object.create(null);this.xref=e;this.objId=null;this.suppressEncryption=!1;this.__nonSerializable__=Ft}assignXref(e){this.xref=e}get size(){return Object.keys(this._map).length}get(e,t,i){let a=this._map[e];if(void 0===a&&void 0!==t){a=this._map[t];void 0===a&&void 0!==i&&(a=this._map[i])}return a instanceof Ref&&this.xref?this.xref.fetch(a,this.suppressEncryption):a}async getAsync(e,t,i){let a=this._map[e];if(void 0===a&&void 0!==t){a=this._map[t];void 0===a&&void 0!==i&&(a=this._map[i])}return a instanceof Ref&&this.xref?this.xref.fetchAsync(a,this.suppressEncryption):a}getArray(e,t,i){let a=this._map[e];if(void 0===a&&void 0!==t){a=this._map[t];void 0===a&&void 0!==i&&(a=this._map[i])}a instanceof Ref&&this.xref&&(a=this.xref.fetch(a,this.suppressEncryption));if(Array.isArray(a)){a=a.slice();for(let e=0,t=a.length;e{unreachable("Should not call `set` on the empty dictionary.")};return shadow(this,"empty",e)}static merge({xref:e,dictArray:t,mergeSubDicts:i=!1}){const a=new Dict(e),s=new Map;for(const e of t)if(e instanceof Dict)for(const[t,a]of Object.entries(e._map)){let e=s.get(t);if(void 0===e){e=[];s.set(t,e)}else if(!(i&&a instanceof Dict))continue;e.push(a)}for(const[t,i]of s){if(1===i.length||!(i[0]instanceof Dict)){a._map[t]=i[0];continue}const s=new Dict(e);for(const e of i)for(const[t,i]of Object.entries(e._map))void 0===s._map[t]&&(s._map[t]=i);s.size>0&&(a._map[t]=s)}s.clear();return a.size>0?a:Dict.empty}clone(){const e=new Dict(this.xref);for(const t of this.getKeys())e.set(t,this.getRaw(t));return e}delete(e){delete this._map[e]}}class Ref{constructor(e,t){this.num=e;this.gen=t}toString(){return 0===this.gen?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(e){const t=bt[e];if(t)return t;const i=/^(\d+)R(\d*)$/.exec(e);return i&&"0"!==i[1]?bt[e]=new Ref(parseInt(i[1]),i[2]?parseInt(i[2]):0):null}static get(e,t){const i=0===t?`${e}R`:`${e}R${t}`;return bt[i]||=new Ref(e,t)}}class RefSet{constructor(e=null){this._set=new Set(e?._set)}has(e){return this._set.has(e.toString())}put(e){this._set.add(e.toString())}remove(e){this._set.delete(e.toString())}[Symbol.iterator](){return this._set.values()}clear(){this._set.clear()}}class RefSetCache{constructor(){this._map=new Map}get size(){return this._map.size}get(e){return this._map.get(e.toString())}has(e){return this._map.has(e.toString())}put(e,t){this._map.set(e.toString(),t)}putAlias(e,t){this._map.set(e.toString(),this.get(t))}[Symbol.iterator](){return this._map.values()}clear(){this._map.clear()}*items(){for(const[e,t]of this._map)yield[Ref.fromString(e),t]}}function isName(e,t){return e instanceof Name&&(void 0===t||e.name===t)}function isCmd(e,t){return e instanceof Cmd&&(void 0===t||e.cmd===t)}function isDict(e,t){return e instanceof Dict&&(void 0===t||isName(e.get("Type"),t))}function isRefsEqual(e,t){return e.num===t.num&&e.gen===t.gen}class BaseStream{get length(){unreachable("Abstract getter `length` accessed")}get isEmpty(){unreachable("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return shadow(this,"isDataLoaded",!0)}getByte(){unreachable("Abstract method `getByte` called")}getBytes(e){unreachable("Abstract method `getBytes` called")}async getImageData(e,t){return this.getBytes(e,t)}async asyncGetBytes(){unreachable("Abstract method `asyncGetBytes` called")}get isAsync(){return!1}get canAsyncDecodeImageFromBuffer(){return!1}async getTransferableImage(){return null}peekByte(){const e=this.getByte();-1!==e&&this.pos--;return e}peekBytes(e){const t=this.getBytes(e);this.pos-=t.length;return t}getUint16(){const e=this.getByte(),t=this.getByte();return-1===e||-1===t?-1:(e<<8)+t}getInt32(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()}getByteRange(e,t){unreachable("Abstract method `getByteRange` called")}getString(e){return bytesToString(this.getBytes(e))}skip(e){this.pos+=e||1}reset(){unreachable("Abstract method `reset` called")}moveStart(){unreachable("Abstract method `moveStart` called")}makeSubStream(e,t,i=null){unreachable("Abstract method `makeSubStream` called")}getBaseStreams(){return null}}const St=/^[1-9]\.\d$/;function getLookupTableFactory(e){let t;return function(){if(e){t=Object.create(null);e(t);e=null}return t}}class MissingDataException extends gt{constructor(e,t){super(`Missing data [${e}, ${t})`,"MissingDataException");this.begin=e;this.end=t}}class ParserEOFException extends gt{constructor(e){super(e,"ParserEOFException")}}class XRefEntryException extends gt{constructor(e){super(e,"XRefEntryException")}}class XRefParseException extends gt{constructor(e){super(e,"XRefParseException")}}function arrayBuffersToBytes(e){const t=e.length;if(0===t)return new Uint8Array(0);if(1===t)return new Uint8Array(e[0]);let i=0;for(let a=0;a0,"The number should be a positive integer.");const i=[];let a;for(;e>=1e3;){e-=1e3;i.push("M")}a=e/100|0;e%=100;i.push(kt[a]);a=e/10|0;e%=10;i.push(kt[10+a]);i.push(kt[20+e]);const s=i.join("");return t?s.toLowerCase():s}function log2(e){return e<=0?0:Math.ceil(Math.log2(e))}function readInt8(e,t){return e[t]<<24>>24}function readUint16(e,t){return e[t]<<8|e[t+1]}function readUint32(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function isWhiteSpace(e){return 32===e||9===e||13===e||10===e}function isNumberArray(e,t){return Array.isArray(e)?(null===t||e.length===t)&&e.every((e=>"number"==typeof e)):ArrayBuffer.isView(e)&&(0===e.length||"number"==typeof e[0])&&(null===t||e.length===t)}function lookupMatrix(e,t){return isNumberArray(e,6)?e:t}function lookupRect(e,t){return isNumberArray(e,4)?e:t}function lookupNormalRect(e,t){return isNumberArray(e,4)?Util.normalizeRect(e):t}function parseXFAPath(e){const t=/(.+)\[(\d+)\]$/;return e.split(".").map((e=>{const i=e.match(t);return i?{name:i[1],pos:parseInt(i[2],10)}:{name:e,pos:0}}))}function escapePDFName(e){const t=[];let i=0;for(let a=0,s=e.length;a126||35===s||40===s||41===s||60===s||62===s||91===s||93===s||123===s||125===s||47===s||37===s){i"\n"===e?"\\n":"\r"===e?"\\r":`\\${e}`))}function _collectJS(e,t,i,a){if(!e)return;let s=null;if(e instanceof Ref){if(a.has(e))return;s=e;a.put(s);e=t.fetch(e)}if(Array.isArray(e))for(const s of e)_collectJS(s,t,i,a);else if(e instanceof Dict){if(isName(e.get("S"),"JavaScript")){const t=e.get("JS");let a;t instanceof BaseStream?a=t.getString():"string"==typeof t&&(a=t);a&&=stringToPDFString(a).replaceAll("\0","");a&&i.push(a)}_collectJS(e.getRaw("Next"),t,i,a)}s&&a.remove(s)}function collectActions(e,t,i){const a=Object.create(null),s=getInheritableProperty({dict:t,key:"AA",stopWhenFound:!1});if(s)for(let t=s.length-1;t>=0;t--){const r=s[t];if(r instanceof Dict)for(const t of r.getKeys()){const s=i[t];if(!s)continue;const n=[];_collectJS(r.getRaw(t),e,n,new RefSet);n.length>0&&(a[s]=n)}}if(t.has("A")){const i=[];_collectJS(t.get("A"),e,i,new RefSet);i.length>0&&(a.Action=i)}return objectSize(a)>0?a:null}const Rt={60:"<",62:">",38:"&",34:""",39:"'"};function*codePointIter(e){for(let t=0,i=e.length;t55295&&(i<57344||i>65533)&&t++;yield i}}function encodeToXmlString(e){const t=[];let i=0;for(let a=0,s=e.length;a55295&&(s<57344||s>65533)&&a++;i=a+1}}if(0===t.length)return e;i: ${e}.`);return!1}return!0}function validateCSSFont(e){const t=new Set(["100","200","300","400","500","600","700","800","900","1000","normal","bold","bolder","lighter"]),{fontFamily:i,fontWeight:a,italicAngle:s}=e;if(!validateFontName(i,!0))return!1;const r=a?a.toString():"";e.fontWeight=t.has(r)?r:"400";const n=parseFloat(s);e.italicAngle=isNaN(n)||n<-90||n>90?"14":s.toString();return!0}function recoverJsURL(e){const t=new RegExp("^\\s*("+["app.launchURL","window.open","xfa.host.gotoURL"].join("|").replaceAll(".","\\.")+")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))","i").exec(e);if(t?.[2]){const e=t[2];let i=!1;"true"===t[3]&&"app.launchURL"===t[1]&&(i=!0);return{url:e,newWindow:i}}return null}function numberToString(e){if(Number.isInteger(e))return e.toString();const t=Math.round(100*e);return t%100==0?(t/100).toString():t%10==0?e.toFixed(1):e.toFixed(2)}function getNewAnnotationsMap(e){if(!e)return null;const t=new Map;for(const[i,a]of e){if(!i.startsWith(u))continue;let e=t.get(a.pageIndex);if(!e){e=[];t.set(a.pageIndex,e)}e.push(a)}return t.size>0?t:null}function stringToAsciiOrUTF16BE(e){return function isAscii(e){return/^[\x00-\x7F]*$/.test(e)}(e)?e:stringToUTF16String(e,!0)}function stringToUTF16HexString(e){const t=[];for(let i=0,a=e.length;i>8&255],ot[255&a])}return t.join("")}function stringToUTF16String(e,t=!1){const i=[];t&&i.push("þÿ");for(let t=0,a=e.length;t>8&255),String.fromCharCode(255&a))}return i.join("")}function getRotationMatrix(e,t,i){switch(e){case 90:return[0,1,-1,0,t,0];case 180:return[-1,0,0,-1,t,i];case 270:return[0,-1,1,0,0,i];default:throw new Error("Invalid rotation")}}function getSizeInBytes(e){return Math.ceil(Math.ceil(Math.log2(1+e))/8)}class Stream extends BaseStream{constructor(e,t,i,a){super();this.bytes=e instanceof Uint8Array?e:new Uint8Array(e);this.start=t||0;this.pos=this.start;this.end=t+i||this.bytes.length;this.dict=a}get length(){return this.end-this.start}get isEmpty(){return 0===this.length}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getBytes(e){const t=this.bytes,i=this.pos,a=this.end;if(!e)return t.subarray(i,a);let s=i+e;s>a&&(s=a);this.pos=s;return t.subarray(i,s)}getByteRange(e,t){e<0&&(e=0);t>this.end&&(t=this.end);return this.bytes.subarray(e,t)}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(e,t,i=null){return new Stream(this.bytes.buffer,e,t,i)}}class StringStream extends Stream{constructor(e){super(stringToBytes(e))}}class NullStream extends Stream{constructor(){super(new Uint8Array(0))}}class ChunkedStream extends Stream{constructor(e,t,i){super(new Uint8Array(e),0,e,null);this.chunkSize=t;this._loadedChunks=new Set;this.numChunks=Math.ceil(e/t);this.manager=i;this.progressiveDataLength=0;this.lastSuccessfulEnsureByteChunk=-1}getMissingChunks(){const e=[];for(let t=0,i=this.numChunks;t=this.end?this.numChunks:Math.floor(t/this.chunkSize);for(let e=i;ethis.numChunks)&&t!==this.lastSuccessfulEnsureByteChunk){if(!this._loadedChunks.has(t))throw new MissingDataException(e,e+1);this.lastSuccessfulEnsureByteChunk=t}}ensureRange(e,t){if(e>=t)return;if(t<=this.progressiveDataLength)return;const i=Math.floor(e/this.chunkSize);if(i>this.numChunks)return;const a=Math.min(Math.floor((t-1)/this.chunkSize)+1,this.numChunks);for(let s=i;s=this.end)return-1;e>=this.progressiveDataLength&&this.ensureByte(e);return this.bytes[this.pos++]}getBytes(e){const t=this.bytes,i=this.pos,a=this.end;if(!e){a>this.progressiveDataLength&&this.ensureRange(i,a);return t.subarray(i,a)}let s=i+e;s>a&&(s=a);s>this.progressiveDataLength&&this.ensureRange(i,s);this.pos=s;return t.subarray(i,s)}getByteRange(e,t){e<0&&(e=0);t>this.end&&(t=this.end);t>this.progressiveDataLength&&this.ensureRange(e,t);return this.bytes.subarray(e,t)}makeSubStream(e,t,i=null){t?e+t>this.progressiveDataLength&&this.ensureRange(e,e+t):e>=this.progressiveDataLength&&this.ensureByte(e);function ChunkedStreamSubstream(){}ChunkedStreamSubstream.prototype=Object.create(this);ChunkedStreamSubstream.prototype.getMissingChunks=function(){const e=this.chunkSize,t=Math.floor(this.start/e),i=Math.floor((this.end-1)/e)+1,a=[];for(let e=t;e{const readChunk=({value:r,done:n})=>{try{if(n){const t=arrayBuffersToBytes(a);a=null;e(t);return}s+=r.byteLength;i.isStreamingSupported&&this.onProgress({loaded:s});a.push(r);i.read().then(readChunk,t)}catch(e){t(e)}};i.read().then(readChunk,t)})).then((t=>{this.aborted||this.onReceiveData({chunk:t,begin:e})}))}requestAllChunks(e=!1){if(!e){const e=this.stream.getMissingChunks();this._requestChunks(e)}return this._loadedStreamCapability.promise}_requestChunks(e){const t=this.currRequestId++,i=new Set;this._chunksNeededByRequest.set(t,i);for(const t of e)this.stream.hasChunk(t)||i.add(t);if(0===i.size)return Promise.resolve();const a=Promise.withResolvers();this._promisesByRequest.set(t,a);const s=[];for(const e of i){let i=this._requestsByChunk.get(e);if(!i){i=[];this._requestsByChunk.set(e,i);s.push(e)}i.push(t)}if(s.length>0){const e=this.groupChunks(s);for(const t of e){const e=t.beginChunk*this.chunkSize,i=Math.min(t.endChunk*this.chunkSize,this.length);this.sendRequest(e,i).catch(a.reject)}}return a.promise.catch((e=>{if(!this.aborted)throw e}))}getStream(){return this.stream}requestRange(e,t){t=Math.min(t,this.length);const i=this.getBeginChunk(e),a=this.getEndChunk(t),s=[];for(let e=i;e=0&&a+1!==r){t.push({beginChunk:i,endChunk:a+1});i=r}s+1===e.length&&t.push({beginChunk:i,endChunk:r+1});a=r}return t}onProgress(e){this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize+e.loaded,total:this.length})}onReceiveData(e){const t=e.chunk,i=void 0===e.begin,a=i?this.progressiveDataLength:e.begin,s=a+t.byteLength,r=Math.floor(a/this.chunkSize),n=s0||g.push(i)}}}if(!this.disableAutoFetch&&0===this._requestsByChunk.size){let e;if(1===this.stream.numChunksLoaded){const t=this.stream.numChunks-1;this.stream.hasChunk(t)||(e=t)}else e=this.stream.nextEmptyChunk(n);Number.isInteger(e)&&this._requestChunks([e])}for(const e of g){const t=this._promisesByRequest.get(e);this._promisesByRequest.delete(e);t.resolve()}this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize,total:this.length})}onError(e){this._loadedStreamCapability.reject(e)}getBeginChunk(e){return Math.floor(e/this.chunkSize)}getEndChunk(e){return Math.floor((e-1)/this.chunkSize)+1}abort(e){this.aborted=!0;this.pdfNetworkStream?.cancelAllRequests(e);for(const t of this._promisesByRequest.values())t.reject(e)}}class ColorSpace{constructor(e,t){this.name=e;this.numComps=t}getRgb(e,t){const i=new Uint8ClampedArray(3);this.getRgbItem(e,t,i,0);return i}getRgbItem(e,t,i,a){unreachable("Should not call ColorSpace.getRgbItem")}getRgbBuffer(e,t,i,a,s,r,n){unreachable("Should not call ColorSpace.getRgbBuffer")}getOutputLength(e,t){unreachable("Should not call ColorSpace.getOutputLength")}isPassthrough(e){return!1}isDefaultDecode(e,t){return ColorSpace.isDefaultDecode(e,this.numComps)}fillRgb(e,t,i,a,s,r,n,g,o){const c=t*i;let C=null;const h=1<h&&"DeviceGray"!==this.name&&"DeviceRGB"!==this.name){const t=n<=8?new Uint8Array(h):new Uint16Array(h);for(let e=0;e=.99554525?1:this.#B(0,1,1.055*e**(1/2.4)-.055)}#B(e,t,i){return Math.max(e,Math.min(t,i))}#Q(e){return e<0?-this.#Q(-e):e>8?((e+16)/116)**3:e*CalRGBCS.#I}#E(e,t,i){if(0===e[0]&&0===e[1]&&0===e[2]){i[0]=t[0];i[1]=t[1];i[2]=t[2];return}const a=this.#Q(0),s=(1-a)/(1-this.#Q(e[0])),r=1-s,n=(1-a)/(1-this.#Q(e[1])),g=1-n,o=(1-a)/(1-this.#Q(e[2])),c=1-o;i[0]=t[0]*s+r;i[1]=t[1]*n+g;i[2]=t[2]*o+c}#u(e,t,i){if(1===e[0]&&1===e[2]){i[0]=t[0];i[1]=t[1];i[2]=t[2];return}const a=i;this.#c(CalRGBCS.#i,t,a);const s=CalRGBCS.#n;this.#C(e,a,s);this.#c(CalRGBCS.#a,s,i)}#d(e,t,i){const a=i;this.#c(CalRGBCS.#i,t,a);const s=CalRGBCS.#n;this.#h(e,a,s);this.#c(CalRGBCS.#a,s,i)}#t(e,t,i,a,s){const r=this.#B(0,1,e[t]*s),n=this.#B(0,1,e[t+1]*s),g=this.#B(0,1,e[t+2]*s),o=1===r?1:r**this.GR,c=1===n?1:n**this.GG,C=1===g?1:g**this.GB,h=this.MXA*o+this.MXB*c+this.MXC*C,l=this.MYA*o+this.MYB*c+this.MYC*C,Q=this.MZA*o+this.MZB*c+this.MZC*C,E=CalRGBCS.#g;E[0]=h;E[1]=l;E[2]=Q;const u=CalRGBCS.#o;this.#u(this.whitePoint,E,u);const d=CalRGBCS.#g;this.#E(this.blackPoint,u,d);const f=CalRGBCS.#o;this.#d(CalRGBCS.#r,d,f);const p=CalRGBCS.#g;this.#c(CalRGBCS.#s,f,p);i[a]=255*this.#l(p[0]);i[a+1]=255*this.#l(p[1]);i[a+2]=255*this.#l(p[2])}getRgbItem(e,t,i,a){this.#t(e,t,i,a,1)}getRgbBuffer(e,t,i,a,s,r,n){const g=1/((1<this.amax||this.bmin>this.bmax){info("Invalid Range, falling back to defaults");this.amin=-100;this.amax=100;this.bmin=-100;this.bmax=100}}#f(e){return e>=6/29?e**3:108/841*(e-4/29)}#p(e,t,i,a){return i+e*(a-i)/t}#t(e,t,i,a,s){let r=e[t],n=e[t+1],g=e[t+2];if(!1!==i){r=this.#p(r,i,0,100);n=this.#p(n,i,this.amin,this.amax);g=this.#p(g,i,this.bmin,this.bmax)}n>this.amax?n=this.amax:nthis.bmax?g=this.bmax:g>>0}function hexToStr(e,t){return 1===t?String.fromCharCode(e[0],e[1]):3===t?String.fromCharCode(e[0],e[1],e[2],e[3]):String.fromCharCode(...e.subarray(0,t+1))}function addHex(e,t,i){let a=0;for(let s=i;s>=0;s--){a+=e[s]+t[s];e[s]=255&a;a>>=8}}function incHex(e,t){let i=1;for(let a=t;a>=0&&i>0;a--){i+=e[a];e[a]=255&i;i>>=8}}const Nt=16;class BinaryCMapStream{constructor(e){this.buffer=e;this.pos=0;this.end=e.length;this.tmpBuf=new Uint8Array(19)}readByte(){return this.pos>=this.end?-1:this.buffer[this.pos++]}readNumber(){let e,t=0;do{const i=this.readByte();if(i<0)throw new FormatError("unexpected EOF in bcmap");e=!(128&i);t=t<<7|127&i}while(!e);return t}readSigned(){const e=this.readNumber();return 1&e?~(e>>>1):e>>>1}readHex(e,t){e.set(this.buffer.subarray(this.pos,this.pos+t+1));this.pos+=t+1}readHexNumber(e,t){let i;const a=this.tmpBuf;let s=0;do{const e=this.readByte();if(e<0)throw new FormatError("unexpected EOF in bcmap");i=!(128&e);a[s++]=127&e}while(!i);let r=t,n=0,g=0;for(;r>=0;){for(;g<8&&a.length>0;){n|=a[--s]<>=8;g-=8}}readHexSigned(e,t){this.readHexNumber(e,t);const i=1&e[t]?255:0;let a=0;for(let s=0;s<=t;s++){a=(1&a)<<8|e[s];e[s]=a>>1^i}}readString(){const e=this.readNumber(),t=new Array(e);for(let i=0;i=0;){const e=l>>5;if(7===e){switch(31&l){case 0:a.readString();break;case 1:r=a.readString()}continue}const i=!!(16&l),s=15&l;if(s+1>Nt)throw new Error("BinaryCMapReader.process: Invalid dataSize.");const Q=1,E=a.readNumber();switch(e){case 0:a.readHex(n,s);a.readHexNumber(g,s);addHex(g,n,s);t.addCodespaceRange(s+1,hexToInt(n,s),hexToInt(g,s));for(let e=1;es&&(a=s)}else{for(;!this.eof;)this.readBlock(t);a=this.bufferLength}this.pos=a;return this.buffer.subarray(i,a)}async getImageData(e,t=null){if(!this.canAsyncDecodeImageFromBuffer)return this.getBytes(e,t);const i=await this.stream.asyncGetBytes();return this.decodeImage(i,t)}reset(){this.pos=0}makeSubStream(e,t,i=null){if(void 0===t)for(;!this.eof;)this.readBlock();else{const i=e+t;for(;this.bufferLength<=i&&!this.eof;)this.readBlock()}return new Stream(this.buffer,e,t,i)}getBaseStreams(){return this.str?this.str.getBaseStreams():null}}class StreamsSequenceStream extends DecodeStream{constructor(e,t=null){e=e.filter((e=>e instanceof BaseStream));let i=0;for(const t of e)i+=t instanceof DecodeStream?t._rawMinBufferLength:t.length;super(i);this.streams=e;this._onError=t}readBlock(){const e=this.streams;if(0===e.length){this.eof=!0;return}const t=e.shift();let i;try{i=t.getBytes()}catch(e){if(this._onError){this._onError(e,t.dict?.objId);return}throw e}const a=this.bufferLength,s=a+i.length;this.ensureBuffer(s).set(i,a);this.bufferLength=s}getBaseStreams(){const e=[];for(const t of this.streams){const i=t.getBaseStreams();i&&e.push(...i)}return e.length>0?e:null}}class Ascii85Stream extends DecodeStream{constructor(e,t){t&&(t*=.8);super(t);this.str=e;this.dict=e.dict;this.input=new Uint8Array(5)}readBlock(){const e=this.str;let t=e.getByte();for(;isWhiteSpace(t);)t=e.getByte();if(-1===t||126===t){this.eof=!0;return}const i=this.bufferLength;let a,s;if(122===t){a=this.ensureBuffer(i+4);for(s=0;s<4;++s)a[i+s]=0;this.bufferLength+=4}else{const r=this.input;r[0]=t;for(s=1;s<5;++s){t=e.getByte();for(;isWhiteSpace(t);)t=e.getByte();r[s]=t;if(-1===t||126===t)break}a=this.ensureBuffer(i+s-1);this.bufferLength+=s-1;if(s<5){for(;s<5;++s)r[s]=117;this.eof=!0}let n=0;for(s=0;s<5;++s)n=85*n+(r[s]-33);for(s=3;s>=0;--s){a[i+s]=255&n;n>>=8}}}}class AsciiHexStream extends DecodeStream{constructor(e,t){t&&(t*=.5);super(t);this.str=e;this.dict=e.dict;this.firstDigit=-1}readBlock(){const e=this.str.getBytes(8e3);if(!e.length){this.eof=!0;return}const t=e.length+1>>1,i=this.ensureBuffer(this.bufferLength+t);let a=this.bufferLength,s=this.firstDigit;for(const t of e){let e;if(t>=48&&t<=57)e=15&t;else{if(!(t>=65&&t<=70||t>=97&&t<=102)){if(62===t){this.eof=!0;break}continue}e=9+(15&t)}if(s<0)s=e;else{i[a++]=s<<4|e;s=-1}}if(s>=0&&this.eof){i[a++]=s<<4;s=-1}this.firstDigit=s;this.bufferLength=a}}const xt=-1,Ut=[[-1,-1],[-1,-1],[7,8],[7,7],[6,6],[6,6],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]],Mt=[[-1,-1],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],Lt=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]],Ht=[[-1,-1],[-1,-1],[12,-2],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],Jt=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],Yt=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];class CCITTFaxDecoder{constructor(e,t={}){if(!e||"function"!=typeof e.next)throw new Error('CCITTFaxDecoder - invalid "source" parameter.');this.source=e;this.eof=!1;this.encoding=t.K||0;this.eoline=t.EndOfLine||!1;this.byteAlign=t.EncodedByteAlign||!1;this.columns=t.Columns||1728;this.rows=t.Rows||0;this.eoblock=t.EndOfBlock??!0;this.black=t.BlackIs1||!1;this.codingLine=new Uint32Array(this.columns+1);this.refLine=new Uint32Array(this.columns+2);this.codingLine[0]=this.columns;this.codingPos=0;this.row=0;this.nextLine2D=this.encoding<0;this.inputBits=0;this.inputBuf=0;this.outputBits=0;this.rowsDone=!1;let i;for(;0===(i=this._lookBits(12));)this._eatBits(1);1===i&&this._eatBits(12);if(this.encoding>0){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}}readNextChar(){if(this.eof)return-1;const e=this.refLine,t=this.codingLine,i=this.columns;let a,s,r,n,g;if(0===this.outputBits){this.rowsDone&&(this.eof=!0);if(this.eof)return-1;this.err=!1;let r,g,o;if(this.nextLine2D){for(n=0;t[n]=64);do{g+=o=this._getWhiteCode()}while(o>=64)}else{do{r+=o=this._getWhiteCode()}while(o>=64);do{g+=o=this._getBlackCode()}while(o>=64)}this._addPixels(t[this.codingPos]+r,s);t[this.codingPos]0?--a:++a;for(;e[a]<=t[this.codingPos]&&e[a]0?--a:++a;for(;e[a]<=t[this.codingPos]&&e[a]0?--a:++a;for(;e[a]<=t[this.codingPos]&&e[a]=64);else do{r+=o=this._getWhiteCode()}while(o>=64);this._addPixels(t[this.codingPos]+r,s);s^=1}}let c=!1;this.byteAlign&&(this.inputBits&=-8);if(this.eoblock||this.row!==this.rows-1){r=this._lookBits(12);if(this.eoline)for(;r!==xt&&1!==r;){this._eatBits(1);r=this._lookBits(12)}else for(;0===r;){this._eatBits(1);r=this._lookBits(12)}if(1===r){this._eatBits(12);c=!0}else r===xt&&(this.eof=!0)}else this.rowsDone=!0;if(!this.eof&&this.encoding>0&&!this.rowsDone){this.nextLine2D=!this._lookBits(1);this._eatBits(1)}if(this.eoblock&&c&&this.byteAlign){r=this._lookBits(12);if(1===r){this._eatBits(12);if(this.encoding>0){this._lookBits(1);this._eatBits(1)}if(this.encoding>=0)for(n=0;n<4;++n){r=this._lookBits(12);1!==r&&info("bad rtc code: "+r);this._eatBits(12);if(this.encoding>0){this._lookBits(1);this._eatBits(1)}}this.eof=!0}}else if(this.err&&this.eoline){for(;;){r=this._lookBits(13);if(r===xt){this.eof=!0;return-1}if(r>>1==1)break;this._eatBits(1)}this._eatBits(12);if(this.encoding>0){this._eatBits(1);this.nextLine2D=!(1&r)}}this.outputBits=t[0]>0?t[this.codingPos=0]:t[this.codingPos=1];this.row++}if(this.outputBits>=8){g=1&this.codingPos?0:255;this.outputBits-=8;if(0===this.outputBits&&t[this.codingPos]r){g<<=r;1&this.codingPos||(g|=255>>8-r);this.outputBits-=r;r=0}else{g<<=this.outputBits;1&this.codingPos||(g|=255>>8-this.outputBits);r-=this.outputBits;this.outputBits=0;if(t[this.codingPos]0){g<<=r;r=0}}}while(r)}this.black&&(g^=255);return g}_addPixels(e,t){const i=this.codingLine;let a=this.codingPos;if(e>i[a]){if(e>this.columns){info("row is wrong length");this.err=!0;e=this.columns}1&a^t&&++a;i[a]=e}this.codingPos=a}_addPixelsNeg(e,t){const i=this.codingLine;let a=this.codingPos;if(e>i[a]){if(e>this.columns){info("row is wrong length");this.err=!0;e=this.columns}1&a^t&&++a;i[a]=e}else if(e0&&e=s){const t=i[e-s];if(t[0]===a){this._eatBits(a);return[!0,t[1],!0]}}}return[!1,0,!1]}_getTwoDimCode(){let e,t=0;if(this.eoblock){t=this._lookBits(7);e=Ut[t];if(e?.[0]>0){this._eatBits(e[0]);return e[1]}}else{const e=this._findTableCode(1,7,Ut);if(e[0]&&e[2])return e[1]}info("Bad two dim code");return xt}_getWhiteCode(){let e,t=0;if(this.eoblock){t=this._lookBits(12);if(t===xt)return 1;e=t>>5==0?Mt[t]:Lt[t>>3];if(e[0]>0){this._eatBits(e[0]);return e[1]}}else{let e=this._findTableCode(1,9,Lt);if(e[0])return e[1];e=this._findTableCode(11,12,Mt);if(e[0])return e[1]}info("bad white code");this._eatBits(1);return 1}_getBlackCode(){let e,t;if(this.eoblock){e=this._lookBits(13);if(e===xt)return 1;t=e>>7==0?Ht[e]:e>>9==0&&e>>7!=0?Jt[(e>>1)-64]:Yt[e>>7];if(t[0]>0){this._eatBits(t[0]);return t[1]}}else{let e=this._findTableCode(2,6,Yt);if(e[0])return e[1];e=this._findTableCode(7,12,Jt,64);if(e[0])return e[1];e=this._findTableCode(10,13,Ht);if(e[0])return e[1]}info("bad black code");this._eatBits(1);return 1}_lookBits(e){let t;for(;this.inputBits>16-e;this.inputBuf=this.inputBuf<<8|t;this.inputBits+=8}return this.inputBuf>>this.inputBits-e&65535>>16-e}_eatBits(e){(this.inputBits-=e)<0&&(this.inputBits=0)}}class CCITTFaxStream extends DecodeStream{constructor(e,t,i){super(t);this.str=e;this.dict=e.dict;i instanceof Dict||(i=Dict.empty);const a={next:()=>e.getByte()};this.ccittFaxDecoder=new CCITTFaxDecoder(a,{K:i.get("K"),EndOfLine:i.get("EndOfLine"),EncodedByteAlign:i.get("EncodedByteAlign"),Columns:i.get("Columns"),Rows:i.get("Rows"),EndOfBlock:i.get("EndOfBlock"),BlackIs1:i.get("BlackIs1")})}readBlock(){for(;!this.eof;){const e=this.ccittFaxDecoder.readNextChar();if(-1===e){this.eof=!0;return}this.ensureBuffer(this.bufferLength+1);this.buffer[this.bufferLength++]=e}}}const vt=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Kt=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),Tt=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),qt=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],Ot=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];class FlateStream extends DecodeStream{constructor(e,t){super(t);this.str=e;this.dict=e.dict;const i=e.getByte(),a=e.getByte();if(-1===i||-1===a)throw new FormatError(`Invalid header in flate stream: ${i}, ${a}`);if(8!=(15&i))throw new FormatError(`Unknown compression method in flate stream: ${i}, ${a}`);if(((i<<8)+a)%31!=0)throw new FormatError(`Bad FCHECK in flate stream: ${i}, ${a}`);if(32&a)throw new FormatError(`FDICT bit set in flate stream: ${i}, ${a}`);this.codeSize=0;this.codeBuf=0}async getImageData(e,t){const i=await this.asyncGetBytes();return i?.subarray(0,e)||this.getBytes(e)}async asyncGetBytes(){this.str.reset();const e=this.str.getBytes();try{const{readable:t,writable:i}=new DecompressionStream("deflate"),a=i.getWriter();await a.ready;a.write(e).then((async()=>{await a.ready;await a.close()})).catch((()=>{}));const s=[];let r=0;for await(const e of t){s.push(e);r+=e.byteLength}const n=new Uint8Array(r);let g=0;for(const e of s){n.set(e,g);g+=e.byteLength}return n}catch{this.str=new Stream(e,2,e.length,this.str.dict);this.reset();return null}}get isAsync(){return!0}getBits(e){const t=this.str;let i,a=this.codeSize,s=this.codeBuf;for(;a>e;this.codeSize=a-=e;return i}getCode(e){const t=this.str,i=e[0],a=e[1];let s,r=this.codeSize,n=this.codeBuf;for(;r>16,c=65535&g;if(o<1||r>o;this.codeSize=r-o;return c}generateHuffmanTable(e){const t=e.length;let i,a=0;for(i=0;ia&&(a=e[i]);const s=1<>=1}for(i=e;i>=1;if(0===t){let t;if(-1===(t=a.getByte())){this.#m("Bad block header in flate stream");return}let i=t;if(-1===(t=a.getByte())){this.#m("Bad block header in flate stream");return}i|=t<<8;if(-1===(t=a.getByte())){this.#m("Bad block header in flate stream");return}let s=t;if(-1===(t=a.getByte())){this.#m("Bad block header in flate stream");return}s|=t<<8;if(s!==(65535&~i)&&(0!==i||0!==s))throw new FormatError("Bad uncompressed block length in flate stream");this.codeBuf=0;this.codeSize=0;const r=this.bufferLength,n=r+i;e=this.ensureBuffer(n);this.bufferLength=n;if(0===i)-1===a.peekByte()&&(this.eof=!0);else{const t=a.getBytes(i);e.set(t,r);t.length0;)C[g++]=Q}s=this.generateHuffmanTable(C.subarray(0,e));r=this.generateHuffmanTable(C.subarray(e,c))}}e=this.buffer;let n=e?e.length:0,g=this.bufferLength;for(;;){let t=this.getCode(s);if(t<256){if(g+1>=n){e=this.ensureBuffer(g+1);n=e.length}e[g++]=t;continue}if(256===t){this.bufferLength=g;return}t-=257;t=Kt[t];let a=t>>16;a>0&&(a=this.getBits(a));i=(65535&t)+a;t=this.getCode(r);t=Tt[t];a=t>>16;a>0&&(a=this.getBits(a));const o=(65535&t)+a;if(g+i>=n){e=this.ensureBuffer(g+i);n=e.length}for(let t=0;t>9&127;this.clow=this.clow<<7&65535;this.ct-=7;this.a=32768}byteIn(){const e=this.data;let t=this.bp;if(255===e[t])if(e[t+1]>143){this.clow+=65280;this.ct=8}else{t++;this.clow+=e[t]<<9;this.ct=7;this.bp=t}else{t++;this.clow+=t65535){this.chigh+=this.clow>>16;this.clow&=65535}}readBit(e,t){let i=e[t]>>1,a=1&e[t];const s=Pt[i],r=s.qe;let n,g=this.a-r;if(this.chigh>15&1;this.clow=this.clow<<1&65535;this.ct--}while(0==(32768&g));this.a=g;e[t]=i<<1|a;return n}}class Jbig2Error extends gt{constructor(e){super(e,"Jbig2Error")}}class ContextCache{getContexts(e){return e in this?this[e]:this[e]=new Int8Array(65536)}}class DecodingContext{constructor(e,t,i){this.data=e;this.start=t;this.end=i}get decoder(){return shadow(this,"decoder",new ArithmeticDecoder(this.data,this.start,this.end))}get contextCache(){return shadow(this,"contextCache",new ContextCache)}}const Wt=2**31-1,jt=-(2**31);function decodeInteger(e,t,i){const a=e.getContexts(t);let s=1;function readBits(e){let t=0;for(let r=0;r>>0}const r=readBits(1),n=readBits(1)?readBits(1)?readBits(1)?readBits(1)?readBits(1)?readBits(32)+4436:readBits(12)+340:readBits(8)+84:readBits(6)+20:readBits(4)+4:readBits(2);let g;0===r?g=n:n>0&&(g=-n);return g>=jt&&g<=Wt?g:null}function decodeIAID(e,t,i){const a=e.getContexts("IAID");let s=1;for(let e=0;e=F&&M=S){K=K<<1&d;for(u=0;u=0&&H=0){J=G[L][H];J&&(K|=J<=e?c<<=1:c=c<<1|w[g][o]}for(Q=0;Q=m||o<0||o>=p?c<<=1:c=c<<1|a[g][o]}const E=D.readBit(b,c);t[n]=E}}return w}function decodeTextRegion(e,t,i,a,s,r,n,g,o,c,C,h,l,Q,E,u,d,f,p){if(e&&t)throw new Jbig2Error("refinement with Huffman is not supported");const m=[];let y,w;for(y=0;y1&&(s=e?p.readBits(f):decodeInteger(b,"IAIT",D));const r=n*F+s,S=e?Q.symbolIDTable.decode(p):decodeIAID(b,D,o),k=t&&(e?p.readBit():decodeInteger(b,"IARI",D));let R=g[S],N=R[0].length,G=R.length;if(k){const e=decodeInteger(b,"IARDW",D),t=decodeInteger(b,"IARDH",D);N+=e;G+=t;R=decodeRefinement(N,G,E,R,(e>>1)+decodeInteger(b,"IARDX",D),(t>>1)+decodeInteger(b,"IARDY",D),!1,u,d)}let x=0;c?1&h?x=G-1:a+=G-1:h>1?a+=N-1:x=N-1;const U=r-(1&h?0:G-1),M=a-(2&h?N-1:0);let L,H,J;if(c)for(L=0;L>5&7;const o=[31&n];let c=t+6;if(7===n){g=536870911&readUint32(e,c-1);c+=3;let t=g+7>>3;o[0]=e[c++];for(;--t>0;)o.push(e[c++])}else if(5===n||6===n)throw new Jbig2Error("invalid referred-to flags");i.retainBits=o;let C=4;i.number<=256?C=1:i.number<=65536&&(C=2);const h=[];let l,Q;for(l=0;l>>24&255;r[3]=t.height>>16&255;r[4]=t.height>>8&255;r[5]=255&t.height;for(l=c,Q=e.length;l>2&3;e.huffmanDWSelector=t>>4&3;e.bitmapSizeSelector=t>>6&1;e.aggregationInstancesSelector=t>>7&1;e.bitmapCodingContextUsed=!!(256&t);e.bitmapCodingContextRetained=!!(512&t);e.template=t>>10&3;e.refinementTemplate=t>>12&1;c+=2;if(!e.huffman){o=0===e.template?4:1;n=[];for(g=0;g>2&3;C.stripSize=1<>4&3;C.transposed=!!(64&h);C.combinationOperator=h>>7&3;C.defaultPixelValue=h>>9&1;C.dsOffset=h<<17>>27;C.refinementTemplate=h>>15&1;if(C.huffman){const e=readUint16(a,c);c+=2;C.huffmanFS=3&e;C.huffmanDS=e>>2&3;C.huffmanDT=e>>4&3;C.huffmanRefinementDW=e>>6&3;C.huffmanRefinementDH=e>>8&3;C.huffmanRefinementDX=e>>10&3;C.huffmanRefinementDY=e>>12&3;C.huffmanRefinementSizeSelector=!!(16384&e)}if(C.refinement&&!C.refinementTemplate){n=[];for(g=0;g<2;g++){n.push({x:readInt8(a,c),y:readInt8(a,c+1)});c+=2}C.refinementAt=n}C.numberOfSymbolInstances=readUint32(a,c);c+=4;r=[C,i.referredTo,a,c,s];break;case 16:const l={},Q=a[c++];l.mmr=!!(1&Q);l.template=Q>>1&3;l.patternWidth=a[c++];l.patternHeight=a[c++];l.maxPatternIndex=readUint32(a,c);c+=4;r=[l,i.number,a,c,s];break;case 22:case 23:const E={};E.info=readRegionSegmentInformation(a,c);c+=$t;const u=a[c++];E.mmr=!!(1&u);E.template=u>>1&3;E.enableSkip=!!(8&u);E.combinationOperator=u>>4&7;E.defaultPixelValue=u>>7&1;E.gridWidth=readUint32(a,c);c+=4;E.gridHeight=readUint32(a,c);c+=4;E.gridOffsetX=4294967295&readUint32(a,c);c+=4;E.gridOffsetY=4294967295&readUint32(a,c);c+=4;E.gridVectorX=readUint16(a,c);c+=2;E.gridVectorY=readUint16(a,c);c+=2;r=[E,i.referredTo,a,c,s];break;case 38:case 39:const d={};d.info=readRegionSegmentInformation(a,c);c+=$t;const f=a[c++];d.mmr=!!(1&f);d.template=f>>1&3;d.prediction=!!(8&f);if(!d.mmr){o=0===d.template?4:1;n=[];for(g=0;g>2&1;p.combinationOperator=m>>3&3;p.requiresBuffer=!!(32&m);p.combinationOperatorOverride=!!(64&m);r=[p];break;case 49:case 50:case 51:case 62:break;case 53:r=[i.number,a,c,s];break;default:throw new Jbig2Error(`segment type ${i.typeName}(${i.type}) is not implemented`)}const C="on"+i.typeName;C in t&&t[C].apply(t,r)}function processSegments(e,t){for(let i=0,a=e.length;i>3,i=new Uint8ClampedArray(t*e.height);e.defaultPixelValue&&i.fill(255);this.buffer=i}drawBitmap(e,t){const i=this.currentPageInfo,a=e.width,s=e.height,r=i.width+7>>3,n=i.combinationOperatorOverride?e.combinationOperator:i.combinationOperator,g=this.buffer,o=128>>(7&e.x);let c,C,h,l,Q=e.y*r+(e.x>>3);switch(n){case 0:for(c=0;c>=1;if(!h){h=128;l++}}Q+=r}break;case 2:for(c=0;c>=1;if(!h){h=128;l++}}Q+=r}break;default:throw new Jbig2Error(`operator ${n} is not supported`)}}onImmediateGenericRegion(e,t,i,a){const s=e.info,r=new DecodingContext(t,i,a),n=decodeBitmap(e.mmr,s.width,s.height,e.template,e.prediction,null,e.at,r);this.drawBitmap(s,n)}onImmediateLosslessGenericRegion(){this.onImmediateGenericRegion(...arguments)}onSymbolDictionary(e,t,i,a,s,r){let n,g;if(e.huffman){n=function getSymbolDictionaryHuffmanTables(e,t,i){let a,s,r,n,g=0;switch(e.huffmanDHSelector){case 0:case 1:a=getStandardTable(e.huffmanDHSelector+4);break;case 3:a=getCustomHuffmanTable(g,t,i);g++;break;default:throw new Jbig2Error("invalid Huffman DH selector")}switch(e.huffmanDWSelector){case 0:case 1:s=getStandardTable(e.huffmanDWSelector+2);break;case 3:s=getCustomHuffmanTable(g,t,i);g++;break;default:throw new Jbig2Error("invalid Huffman DW selector")}if(e.bitmapSizeSelector){r=getCustomHuffmanTable(g,t,i);g++}else r=getStandardTable(1);n=e.aggregationInstancesSelector?getCustomHuffmanTable(g,t,i):getStandardTable(1);return{tableDeltaHeight:a,tableDeltaWidth:s,tableBitmapSize:r,tableAggregateInstances:n}}(e,i,this.customTables);g=new Reader(a,s,r)}let o=this.symbols;o||(this.symbols=o={});const c=[];for(const e of i){const t=o[e];t&&c.push(...t)}const C=new DecodingContext(a,s,r);o[t]=function decodeSymbolDictionary(e,t,i,a,s,r,n,g,o,c,C,h){if(e&&t)throw new Jbig2Error("symbol refinement with Huffman is not supported");const l=[];let Q=0,E=log2(i.length+a);const u=C.decoder,d=C.contextCache;let f,p;if(e){f=getStandardTable(1);p=[];E=Math.max(E,1)}for(;l.length1)m=decodeTextRegion(e,t,a,Q,0,s,1,i.concat(l),E,0,0,1,0,r,o,c,C,0,h);else{const e=decodeIAID(d,u,E),t=decodeInteger(d,"IARDX",u),s=decodeInteger(d,"IARDY",u);m=decodeRefinement(a,Q,o,e=32){let i,a,n;switch(t){case 32:if(0===e)throw new Jbig2Error("no previous value in symbol ID table");a=s.readBits(2)+3;i=r[e-1].prefixLength;break;case 33:a=s.readBits(3)+3;i=0;break;case 34:a=s.readBits(7)+11;i=0;break;default:throw new Jbig2Error("invalid code length in symbol ID table")}for(n=0;n=0;d--){R=e?decodeMMRBitmap(k,o,c,!0):decodeBitmap(!1,o,c,i,!1,null,F,E);S[d]=R}for(N=0;N=0;f--){x^=S[f][N][G];U|=x<>8;H=h+N*l-G*Q>>8;if(L>=0&&L+w<=a&&H>=0&&H+D<=s)for(d=0;d=s)){Y=u[t];J=M[d];for(f=0;f=0&&e>1&7),o=1+(a>>4&7),c=[];let C,h,l=s;do{C=n.readBits(g);h=n.readBits(o);c.push(new HuffmanLine([l,C,h,0]));l+=1<>t&1;if(t<=0)this.children[i]=new HuffmanTreeNode(e);else{let a=this.children[i];a||(this.children[i]=a=new HuffmanTreeNode(null));a.buildTree(e,t-1)}}decodeNode(e){if(this.isLeaf){if(this.isOOB)return null;const t=e.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-t:t)}const t=this.children[e.readBit()];if(!t)throw new Jbig2Error("invalid Huffman data");return t.decodeNode(e)}}class HuffmanTable{constructor(e,t){t||this.assignPrefixCodes(e);this.rootNode=new HuffmanTreeNode(null);for(let t=0,i=e.length;t0&&this.rootNode.buildTree(i,i.prefixLength-1)}}decode(e){return this.rootNode.decodeNode(e)}assignPrefixCodes(e){const t=e.length;let i=0;for(let a=0;a=this.end)throw new Jbig2Error("end of data while reading bit");this.currentByte=this.data[this.position++];this.shift=7}const e=this.currentByte>>this.shift&1;this.shift--;return e}readBits(e){let t,i=0;for(t=e-1;t>=0;t--)i|=this.readBit()<=this.end?-1:this.data[this.position++]}}function getCustomHuffmanTable(e,t,i){let a=0;for(let s=0,r=t.length;s>i&1;i--}}if(a&&!g){const e=5;for(let t=0;t>2,o=new Uint32Array(e.buffer,t,g);if(FeatureTest.isLittleEndian){for(;n>>24|t<<8|4278190080;i[a+2]=t>>>16|s<<16|4278190080;i[a+3]=s>>>8|4278190080}for(let t=4*n,s=e.length;t>>8|255;i[a+2]=t<<16|s>>>16|255;i[a+3]=s<<8|255}for(let t=4*n,s=e.length;t>3,h=7&a,l=e.length;i=new Uint32Array(i.buffer);let Q=0;for(let a=0;a0&&!e[r-1];)r--;const n=[{children:[],index:0}];let g,o=n[0];for(i=0;i0;)o=n.pop();o.index++;n.push(o);for(;n.length<=i;){n.push(g={children:[],index:0});o.children[o.index]=g.children;o=g}s++}if(i+10){E--;return Q>>E&1}Q=e[t++];if(255===Q){const a=e[t++];if(a){if(220===a&&c){const a=readUint16(e,t+=2);t+=2;if(a>0&&a!==i.scanLines)throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data",a)}else if(217===a){if(c){const e=p*(8===i.precision?8:0);if(e>0&&Math.round(i.scanLines/e)>=5)throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",e)}throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data")}throw new JpegError(`unexpected marker ${(Q<<8|a).toString(16)}`)}}E=7;return Q>>>7}function decodeHuffman(e){let t=e;for(;;){t=t[readBit()];switch(typeof t){case"number":return t;case"object":continue}throw new JpegError("invalid huffman sequence")}}function receive(e){let t=0;for(;e>0;){t=t<<1|readBit();e--}return t}function receiveAndExtend(e){if(1===e)return 1===readBit()?1:-1;const t=receive(e);return t>=1<0){u--;return}let i=r;const a=n;for(;i<=a;){const a=decodeHuffman(e.huffmanTableAC),s=15&a,r=a>>4;if(0===s){if(r<15){u=receive(r)+(1<>4;if(0===s)if(c<15){u=receive(c)+(1<>4;if(0===a){if(r<15)break;s+=16;continue}s+=r;const n=ei[s];e.blockData[t+n]=receiveAndExtend(a);s++}};let k,R=0;const N=1===m?a[0].blocksPerLine*a[0].blocksPerColumn:C*i.mcusPerColumn;let G,x;for(;R<=N;){const i=s?Math.min(N-R,s):N;if(i>0){for(w=0;w0?"unexpected":"excessive"} MCU data, current marker is: ${k.invalid}`);t=k.offset}if(!(k.marker>=65488&&k.marker<=65495))break;t+=2}return t-l}function quantizeAndInverse(e,t,i){const a=e.quantizationTable,s=e.blockData;let r,n,g,o,c,C,h,l,Q,E,u,d,f,p,m,y,w;if(!a)throw new JpegError("missing required Quantization Table.");for(let e=0;e<64;e+=8){Q=s[t+e];E=s[t+e+1];u=s[t+e+2];d=s[t+e+3];f=s[t+e+4];p=s[t+e+5];m=s[t+e+6];y=s[t+e+7];Q*=a[e];if(0!=(E|u|d|f|p|m|y)){E*=a[e+1];u*=a[e+2];d*=a[e+3];f*=a[e+4];p*=a[e+5];m*=a[e+6];y*=a[e+7];r=gi*Q+128>>8;n=gi*f+128>>8;g=u;o=m;c=oi*(E-y)+128>>8;l=oi*(E+y)+128>>8;C=d<<4;h=p<<4;r=r+n+1>>1;n=r-n;w=g*ni+o*ri+128>>8;g=g*ri-o*ni+128>>8;o=w;c=c+h+1>>1;h=c-h;l=l+C+1>>1;C=l-C;r=r+o+1>>1;o=r-o;n=n+g+1>>1;g=n-g;w=c*si+l*ai+2048>>12;c=c*ai-l*si+2048>>12;l=w;w=C*ii+h*ti+2048>>12;C=C*ti-h*ii+2048>>12;h=w;i[e]=r+l;i[e+7]=r-l;i[e+1]=n+h;i[e+6]=n-h;i[e+2]=g+C;i[e+5]=g-C;i[e+3]=o+c;i[e+4]=o-c}else{w=gi*Q+512>>10;i[e]=w;i[e+1]=w;i[e+2]=w;i[e+3]=w;i[e+4]=w;i[e+5]=w;i[e+6]=w;i[e+7]=w}}for(let e=0;e<8;++e){Q=i[e];E=i[e+8];u=i[e+16];d=i[e+24];f=i[e+32];p=i[e+40];m=i[e+48];y=i[e+56];if(0!=(E|u|d|f|p|m|y)){r=gi*Q+2048>>12;n=gi*f+2048>>12;g=u;o=m;c=oi*(E-y)+2048>>12;l=oi*(E+y)+2048>>12;C=d;h=p;r=4112+(r+n+1>>1);n=r-n;w=g*ni+o*ri+2048>>12;g=g*ri-o*ni+2048>>12;o=w;c=c+h+1>>1;h=c-h;l=l+C+1>>1;C=l-C;r=r+o+1>>1;o=r-o;n=n+g+1>>1;g=n-g;w=c*si+l*ai+2048>>12;c=c*ai-l*si+2048>>12;l=w;w=C*ii+h*ti+2048>>12;C=C*ti-h*ii+2048>>12;h=w;Q=r+l;y=r-l;E=n+h;m=n-h;u=g+C;p=g-C;d=o+c;f=o-c;Q<16?Q=0:Q>=4080?Q=255:Q>>=4;E<16?E=0:E>=4080?E=255:E>>=4;u<16?u=0:u>=4080?u=255:u>>=4;d<16?d=0:d>=4080?d=255:d>>=4;f<16?f=0:f>=4080?f=255:f>>=4;p<16?p=0:p>=4080?p=255:p>>=4;m<16?m=0:m>=4080?m=255:m>>=4;y<16?y=0:y>=4080?y=255:y>>=4;s[t+e]=Q;s[t+e+8]=E;s[t+e+16]=u;s[t+e+24]=d;s[t+e+32]=f;s[t+e+40]=p;s[t+e+48]=m;s[t+e+56]=y}else{w=gi*Q+8192>>14;w=w<-2040?0:w>=2024?255:w+2056>>4;s[t+e]=w;s[t+e+8]=w;s[t+e+16]=w;s[t+e+24]=w;s[t+e+32]=w;s[t+e+40]=w;s[t+e+48]=w;s[t+e+56]=w}}}function buildComponentData(e,t){const i=t.blocksPerLine,a=t.blocksPerColumn,s=new Int16Array(64);for(let e=0;e=a)return null;const r=readUint16(e,t);if(r>=65472&&r<=65534)return{invalid:null,marker:r,offset:t};let n=readUint16(e,s);for(;!(n>=65472&&n<=65534);){if(++s>=a)return null;n=readUint16(e,s)}return{invalid:r.toString(16),marker:n,offset:s}}function prepareComponents(e){const t=Math.ceil(e.samplesPerLine/8/e.maxH),i=Math.ceil(e.scanLines/8/e.maxV);for(const a of e.components){const s=Math.ceil(Math.ceil(e.samplesPerLine/8)*a.h/e.maxH),r=Math.ceil(Math.ceil(e.scanLines/8)*a.v/e.maxV),n=t*a.h,g=64*(i*a.v)*(n+1);a.blockData=new Int16Array(g);a.blocksPerLine=s;a.blocksPerColumn=r}e.mcusPerLine=t;e.mcusPerColumn=i}function readDataBlock(e,t){const i=readUint16(e,t);let a=(t+=2)+i-2;const s=findNextFileMarker(e,a,t);if(s?.invalid){warn("readDataBlock - incorrect length, current marker is: "+s.invalid);a=s.offset}const r=e.subarray(t,a);return{appData:r,newOffset:t+=r.length}}function skipData(e,t){const i=readUint16(e,t),a=(t+=2)+i-2,s=findNextFileMarker(e,a,t);return s?.invalid?s.offset:a}class JpegImage{constructor({decodeTransform:e=null,colorTransform:t=-1}={}){this._decodeTransform=e;this._colorTransform=t}static canUseImageDecoder(e,t=-1){let i=0,a=null,s=readUint16(e,i);i+=2;if(65496!==s)throw new JpegError("SOI not found");s=readUint16(e,i);i+=2;A:for(;65497!==s;){switch(s){case 65472:case 65473:case 65474:a=e[i+7];break A;case 65535:255!==e[i]&&i--}i=skipData(e,i);s=readUint16(e,i);i+=2}return 4!==a&&(3!==a||0!==t)}parse(e,{dnlScanLines:t=null}={}){let i,a,s=0,r=null,n=null,g=0;const o=[],c=[],C=[];let h=readUint16(e,s);s+=2;if(65496!==h)throw new JpegError("SOI not found");h=readUint16(e,s);s+=2;A:for(;65497!==h;){let l,Q,E;switch(h){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:const{appData:u,newOffset:d}=readDataBlock(e,s);s=d;65504===h&&74===u[0]&&70===u[1]&&73===u[2]&&70===u[3]&&0===u[4]&&(r={version:{major:u[5],minor:u[6]},densityUnits:u[7],xDensity:u[8]<<8|u[9],yDensity:u[10]<<8|u[11],thumbWidth:u[12],thumbHeight:u[13],thumbData:u.subarray(14,14+3*u[12]*u[13])});65518===h&&65===u[0]&&100===u[1]&&111===u[2]&&98===u[3]&&101===u[4]&&(n={version:u[5]<<8|u[6],flags0:u[7]<<8|u[8],flags1:u[9]<<8|u[10],transformCode:u[11]});break;case 65499:const f=readUint16(e,s);s+=2;const p=f+s-2;let m;for(;s>4==0)for(Q=0;Q<64;Q++){m=ei[Q];i[m]=e[s++]}else{if(t>>4!=1)throw new JpegError("DQT - invalid table spec");for(Q=0;Q<64;Q++){m=ei[Q];i[m]=readUint16(e,s);s+=2}}o[15&t]=i}break;case 65472:case 65473:case 65474:if(i)throw new JpegError("Only single frame JPEGs supported");s+=2;i={};i.extended=65473===h;i.progressive=65474===h;i.precision=e[s++];const y=readUint16(e,s);s+=2;i.scanLines=t||y;i.samplesPerLine=readUint16(e,s);s+=2;i.components=[];i.componentIds={};const w=e[s++];let D=0,b=0;for(l=0;l>4,r=15&e[s+1];D>4==0?C:c)[15&t]=buildHuffmanTable(i,r)}break;case 65501:s+=2;a=readUint16(e,s);s+=2;break;case 65498:const S=1==++g&&!t;s+=2;const k=e[s++],R=[];for(l=0;l>4];r.huffmanTableAC=c[15&n];R.push(r)}const N=e[s++],G=e[s++],x=e[s++];try{s+=decodeScan(e,s,i,R,a,N,G,x>>4,15&x,S)}catch(t){if(t instanceof DNLMarkerError){warn(`${t.message} -- attempting to re-parse the JPEG image.`);return this.parse(e,{dnlScanLines:t.scanLines})}if(t instanceof EOIMarkerError){warn(`${t.message} -- ignoring the rest of the image data.`);break A}throw t}break;case 65500:s+=4;break;case 65535:255!==e[s]&&s--;break;default:const U=findNextFileMarker(e,s-2,s-3);if(U?.invalid){warn("JpegImage.parse - unexpected data, current marker is: "+U.invalid);s=U.offset;break}if(!U||s>=e.length-1){warn("JpegImage.parse - reached the end of the image data without finding an EOI marker (0xFFD9).");break A}throw new JpegError("JpegImage.parse - unknown marker: "+h.toString(16))}h=readUint16(e,s);s+=2}if(!i)throw new JpegError("JpegImage.parse - no frame data found.");this.width=i.samplesPerLine;this.height=i.scanLines;this.jfif=r;this.adobe=n;this.components=[];for(const e of i.components){const t=o[e.quantizationId];t&&(e.quantizationTable=t);this.components.push({index:e.index,output:buildComponentData(0,e),scaleX:e.h/i.maxH,scaleY:e.v/i.maxV,blocksPerLine:e.blocksPerLine,blocksPerColumn:e.blocksPerColumn})}this.numComponents=this.components.length}_getLinearizedBlockData(e,t,i=!1){const a=this.width/e,s=this.height/t;let r,n,g,o,c,C,h,l,Q,E,u,d=0;const f=this.components.length,p=e*t*f,m=new Uint8ClampedArray(p),y=new Uint32Array(e),w=4294967288;let D;for(h=0;h>8)+b[Q+1];return m}get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this._colorTransform&&(82!==this.components[0].index||71!==this.components[1].index||66!==this.components[2].index):1===this._colorTransform}_convertYccToRgb(e){let t,i,a;for(let s=0,r=e.length;s4)throw new JpegError("Unsupported color mode");const r=this._getLinearizedBlockData(e,t,s);if(1===this.numComponents&&(i||a)){const e=r.length*(i?4:3),t=new Uint8ClampedArray(e);let a=0;if(i)!function grayToRGBA(e,t){if(FeatureTest.isLittleEndian)for(let i=0,a=e.length;i0&&(e=e.subarray(t));break}return e}decodeImage(e){if(this.eof)return this.buffer;e=this.#y(e||this.bytes);const t=new JpegImage(this.jpegOptions);t.parse(e);const i=t.getData({width:this.drawWidth,height:this.drawHeight,forceRGBA:this.forceRGBA,forceRGB:this.forceRGB,isSourcePDF:!0});this.buffer=i;this.bufferLength=i.length;this.eof=!0;return this.buffer}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}async getTransferableImage(){if(!await JpegStream.canUseImageDecoder)return null;const e=this.jpegOptions;if(e.decodeTransform)return null;let t;try{const i=this.canAsyncDecodeImageFromBuffer&&await this.stream.asyncGetBytes()||this.bytes;if(!i)return null;const a=this.#y(i);if(!JpegImage.canUseImageDecoder(a,e.colorTransform))return null;t=new ImageDecoder({data:a,type:"image/jpeg",preferAnimation:!1});return(await t.decode()).image}catch(e){warn(`getTransferableImage - failed: "${e}".`);return null}finally{t?.close()}}}var Ii,ci=(Ii="undefined"!=typeof document?document.currentScript?.src:void 0,function(e={}){var t,i,a=e;new Promise(((e,a)=>{t=e;i=a}));a.decode=function(e,{numComponents:t=4,isIndexedColormap:i=!1,smaskInData:s=!1}){const r=e.length,n=a._malloc(r);a.HEAPU8.set(e,n);const g=a._jp2_decode(n,r,t>0?t:0,!!i,!!s);a._free(n);if(g){const{errorMessages:e}=a;if(e){delete a.errorMessages;return e}return"Unknown error"}const{imageData:o}=a;a.imageData=null;return o};var s,r=Object.assign({},a),n="./this.program",g="";"undefined"!=typeof document&&document.currentScript&&(g=document.currentScript.src);Ii&&(g=Ii);g=g.startsWith("blob:")?"":g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1);var o,c,C,h,l,Q=a.print||console.log.bind(console),E=a.printErr||console.error.bind(console);Object.assign(a,r);r=null;a.arguments&&a.arguments;a.thisProgram&&(n=a.thisProgram);a.quit&&a.quit;a.wasmBinary&&(o=a.wasmBinary);function tryParseAsDataURI(e){if(isDataURI(e))return function intArrayFromBase64(e){for(var t=atob(e),i=new Uint8Array(t.length),a=0;ae.startsWith(D);function instantiateSync(e,t){var i,a=function getBinarySync(e){if(e==u&&o)return new Uint8Array(o);var t=tryParseAsDataURI(e);if(t)return t;if(s)return s(e);throw'sync fetching of the wasm failed: you can preload it to Module["wasmBinary"] manually, or emcc.py will do that for you when generating HTML (but not JS)'}(e);i=new WebAssembly.Module(a);return[new WebAssembly.Instance(i,t),i]}var callRuntimeCallbacks=e=>{for(;e.length>0;)e.shift()(a)};a.noExitRuntime;var b,growMemory=e=>{var t=(e-c.buffer.byteLength+65535)/65536;try{c.grow(t);updateMemoryViews();return 1}catch(e){}},F={},getEnvStrings=()=>{if(!getEnvStrings.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:n||"./this.program"};for(var t in F)void 0===F[t]?delete e[t]:e[t]=F[t];var i=[];for(var t in e)i.push(`${t}=${e[t]}`);getEnvStrings.strings=i}return getEnvStrings.strings},S=[null,[],[]],k="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,UTF8ArrayToString=(e,t,i)=>{for(var a=t+i,s=t;e[s]&&!(s>=a);)++s;if(s-t>16&&e.buffer&&k)return k.decode(e.subarray(t,s));for(var r="";t>10,56320|1023&c)}}else r+=String.fromCharCode((31&n)<<6|g)}else r+=String.fromCharCode(n)}return r},printChar=(e,t)=>{var i=S[e];if(0===t||10===t){(1===e?Q:E)(UTF8ArrayToString(i,0));i.length=0}else i.push(t)},UTF8ToString=(e,t)=>e?UTF8ArrayToString(h,e,t):"",R={c:(e,t,i)=>h.copyWithin(e,t,t+i),g:function _copy_pixels_1(e,t){e>>=2;const i=a.imageData=new Uint8ClampedArray(t),s=a.HEAP32.subarray(e,e+t);i.set(s)},f:function _copy_pixels_3(e,t,i,s){e>>=2;t>>=2;i>>=2;const r=a.imageData=new Uint8ClampedArray(3*s),n=a.HEAP32.subarray(e,e+s),g=a.HEAP32.subarray(t,t+s),o=a.HEAP32.subarray(i,i+s);for(let e=0;e>=2;t>>=2;i>>=2;s>>=2;const n=a.imageData=new Uint8ClampedArray(4*r),g=a.HEAP32.subarray(e,e+r),o=a.HEAP32.subarray(t,t+r),c=a.HEAP32.subarray(i,i+r),C=a.HEAP32.subarray(s,s+r);for(let e=0;e{var t=h.length,i=2147483648;if((e>>>=0)>i)return!1;for(var a,s,r=1;r<=4;r*=2){var n=t*(1+.2/r);n=Math.min(n,e+100663296);var g=Math.min(i,(a=Math.max(e,n))+((s=65536)-a%s)%s);if(growMemory(g))return!0}return!1},l:(e,t)=>{var i=0;getEnvStrings().forEach(((a,s)=>{var r=t+i;l[e+4*s>>2]=r;((e,t)=>{for(var i=0;i{var i=getEnvStrings();l[e>>2]=i.length;var a=0;i.forEach((e=>a+=e.length+1));l[t>>2]=a;return 0},n:e=>52,j:function _fd_seek(e,t,i,a,s){return 70},b:(e,t,i,a)=>{for(var s=0,r=0;r>2],g=l[t+4>>2];t+=8;for(var o=0;o>2]=s;return 0},o:function _gray_to_rgba(e,t){e>>=2;const i=a.imageData=new Uint8ClampedArray(4*t),s=a.HEAP32.subarray(e,e+t);for(let e=0;e>=2;t>>=2;const s=a.imageData=new Uint8ClampedArray(4*i),r=a.HEAP32.subarray(e,e+i),n=a.HEAP32.subarray(t,t+i);for(let e=0;e>=2;t>>=2;i>>=2;const r=a.imageData=new Uint8ClampedArray(4*s),n=a.HEAP32.subarray(e,e+s),g=a.HEAP32.subarray(t,t+s),o=a.HEAP32.subarray(i,i+s);for(let e=0;e0)){!function preRun(){if(a.preRun){"function"==typeof a.preRun&&(a.preRun=[a.preRun]);for(;a.preRun.length;)e=a.preRun.shift(),d.unshift(e)}var e;callRuntimeCallbacks(d)}();if(!(m>0))if(a.setStatus){a.setStatus("Running...");setTimeout((function(){setTimeout((function(){a.setStatus("")}),1);doRun()}),1)}else doRun()}function doRun(){if(!b){b=!0;a.calledRun=!0;!function initRuntime(){callRuntimeCallbacks(f)}();t(a);a.onRuntimeInitialized&&a.onRuntimeInitialized();!function postRun(){if(a.postRun){"function"==typeof a.postRun&&(a.postRun=[a.postRun]);for(;a.postRun.length;)e=a.postRun.shift(),p.unshift(e)}var e;callRuntimeCallbacks(p)}()}}}if(a.preInit){"function"==typeof a.preInit&&(a.preInit=[a.preInit]);for(;a.preInit.length>0;)a.preInit.pop()()}run();return a});const Ci=ci;class JpxError extends gt{constructor(e){super(e,"JpxError")}}class JpxImage{static#w=null;static decode(e,t){t||={};this.#w||=Ci({warn});const i=this.#w.decode(e,t);if("string"==typeof i)throw new JpxError(i);return i}static cleanup(){this.#w=null}static parseImageProperties(e){let t=e.getByte();for(;t>=0;){const i=t;t=e.getByte();if(65361===(i<<8|t)){e.skip(4);const t=e.getInt32()>>>0,i=e.getInt32()>>>0,a=e.getInt32()>>>0,s=e.getInt32()>>>0;e.skip(16);return{width:t-a,height:i-s,bitsPerComponent:8,componentsCount:e.getUint16()}}}throw new JpxError("No size marker found in JPX stream")}}class JpxStream extends DecodeStream{constructor(e,t,i){super(t);this.stream=e;this.dict=e.dict;this.maybeLength=t;this.params=i}get bytes(){return shadow(this,"bytes",this.stream.getBytes(this.maybeLength))}ensureBuffer(e){}readBlock(e){this.decodeImage(null,e)}decodeImage(e,t){if(this.eof)return this.buffer;e||=this.bytes;this.buffer=JpxImage.decode(e,t);this.bufferLength=this.buffer.length;this.eof=!0;return this.buffer}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}}class LZWStream extends DecodeStream{constructor(e,t,i){super(t);this.str=e;this.dict=e.dict;this.cachedData=0;this.bitsCached=0;const a=4096,s={earlyChange:i,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(a),dictionaryLengths:new Uint16Array(a),dictionaryPrevCodes:new Uint16Array(a),currentSequence:new Uint8Array(a),currentSequenceLength:0};for(let e=0;e<256;++e){s.dictionaryValues[e]=e;s.dictionaryLengths[e]=1}this.lzwState=s}readBits(e){let t=this.bitsCached,i=this.cachedData;for(;t>>t&(1<0;if(e<256){l[0]=e;Q=1}else{if(!(e>=258)){if(256===e){C=9;n=258;Q=0;continue}this.eof=!0;delete this.lzwState;break}if(e=0;t--){l[t]=g[i];i=c[i]}}else l[Q++]=l[0]}if(s){c[n]=h;o[n]=o[h]+1;g[n]=l[0];n++;C=n+r&n+r-1?C:0|Math.min(Math.log(n+r)/.6931471805599453+1,12)}h=e;E+=Q;if(a15))throw new FormatError(`Unsupported predictor: ${a}`);this.readBlock=2===a?this.readBlockTiff:this.readBlockPng;this.str=e;this.dict=e.dict;const s=this.colors=i.get("Colors")||1,r=this.bits=i.get("BPC","BitsPerComponent")||8,n=this.columns=i.get("Columns")||1;this.pixBytes=s*r+7>>3;this.rowBytes=n*s*r+7>>3;return this}readBlockTiff(){const e=this.rowBytes,t=this.bufferLength,i=this.ensureBuffer(t+e),a=this.bits,s=this.colors,r=this.str.getBytes(e);this.eof=!r.length;if(this.eof)return;let n,g=0,o=0,c=0,C=0,h=t;if(1===a&&1===s)for(n=0;n>1;e^=e>>2;e^=e>>4;g=(1&e)<<7;i[h++]=e}else if(8===a){for(n=0;n>8&255;i[h++]=255&e}}else{const e=new Uint8Array(s+1),h=(1<>c-a)&h;c-=a;o=o<=8){i[Q++]=o>>C-8&255;C-=8}}C>0&&(i[Q++]=(o<<8-C)+(g&(1<<8-C)-1))}this.bufferLength+=e}readBlockPng(){const e=this.rowBytes,t=this.pixBytes,i=this.str.getByte(),a=this.str.getBytes(e);this.eof=!a.length;if(this.eof)return;const s=this.bufferLength,r=this.ensureBuffer(s+e);let n=r.subarray(s-e,s);0===n.length&&(n=new Uint8Array(e));let g,o,c,C=s;switch(i){case 0:for(g=0;g>1)+a[g];for(;g>1)+a[g]&255;C++}break;case 4:for(g=0;g0){const e=this.str.getBytes(a);t.set(e,i);i+=a}}else{a=257-a;const s=e[1];t=this.ensureBuffer(i+a+1);for(let e=0;e>")&&this.buf1!==yt;){if(!(this.buf1 instanceof Name)){info("Malformed dictionary: key must be a name object");this.shift();continue}const t=this.buf1.name;this.shift();if(this.buf1===yt)break;a.set(t,this.getObj(e))}if(this.buf1===yt){if(this.recoveryMode)return a;throw new ParserEOFException("End of file inside dictionary.")}if(isCmd(this.buf2,"stream"))return this.allowStreams?this.makeStream(a,e):a;this.shift();return a;default:return t}if(Number.isInteger(t)){if(Number.isInteger(this.buf1)&&isCmd(this.buf2,"R")){const e=Ref.get(t,this.buf1);this.shift();this.shift();return e}return t}return"string"==typeof t&&e?e.decryptString(t):t}findDefaultInlineStreamEnd(e){const{knownCommands:t}=this.lexer,i=e.pos;let a,s,r=0;for(;-1!==(a=e.getByte());)if(0===r)r=69===a?1:0;else if(1===r)r=73===a?2:0;else if(32===a||10===a||13===a){s=e.pos;const i=e.peekBytes(15),n=i.length;if(0===n)break;for(let e=0;e127))){r=0;break}}if(2!==r)continue;if(!t){warn("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");continue}const g=new Lexer(new Stream(i.slice()),t);g._hexStringWarn=()=>{};let o=0;for(;;){const e=g.getObj();if(e===yt){r=0;break}if(e instanceof Cmd){const i=t[e.cmd];if(!i){r=0;break}if(i.variableArgs?o<=i.numArgs:o===i.numArgs)break;o=0}else o++}if(2===r)break}else r=0;if(-1===a){warn("findDefaultInlineStreamEnd: Reached the end of the stream without finding a valid EI marker");if(s){warn('... trying to recover by using the last "EI" occurrence.');e.skip(-(e.pos-s))}}let n=4;e.skip(-n);a=e.peekByte();e.skip(n);isWhiteSpace(a)||n--;return e.pos-n-i}findDCTDecodeInlineStreamEnd(e){const t=e.pos;let i,a,s=!1;for(;-1!==(i=e.getByte());)if(255===i){switch(e.getByte()){case 0:break;case 255:e.skip(-1);break;case 217:s=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:a=e.getUint16();a>2?e.skip(a-2):e.skip(-2)}if(s)break}const r=e.pos-t;if(-1===i){warn("Inline DCTDecode image stream: EOI marker not found, searching for /EI/ instead.");e.skip(-r);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return r}findASCII85DecodeInlineStreamEnd(e){const t=e.pos;let i;for(;-1!==(i=e.getByte());)if(126===i){const t=e.pos;i=e.peekByte();for(;isWhiteSpace(i);){e.skip();i=e.peekByte()}if(62===i){e.skip();break}if(e.pos>t){const t=e.peekBytes(2);if(69===t[0]&&73===t[1])break}}const a=e.pos-t;if(-1===i){warn("Inline ASCII85Decode image stream: EOD marker not found, searching for /EI/ instead.");e.skip(-a);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return a}findASCIIHexDecodeInlineStreamEnd(e){const t=e.pos;let i;for(;-1!==(i=e.getByte())&&62!==i;);const a=e.pos-t;if(-1===i){warn("Inline ASCIIHexDecode image stream: EOD marker not found, searching for /EI/ instead.");e.skip(-a);return this.findDefaultInlineStreamEnd(e)}this.inlineStreamSkipEI(e);return a}inlineStreamSkipEI(e){let t,i=0;for(;-1!==(t=e.getByte());)if(0===i)i=69===t?1:0;else if(1===i)i=73===t?2:0;else if(2===i)break}makeInlineImage(e){const t=this.lexer,i=t.stream,a=Object.create(null);let s;for(;!isCmd(this.buf1,"ID")&&this.buf1!==yt;){if(!(this.buf1 instanceof Name))throw new FormatError("Dictionary key must be a name object");const t=this.buf1.name;this.shift();if(this.buf1===yt)break;a[t]=this.getObj(e)}-1!==t.beginInlineImagePos&&(s=i.pos-t.beginInlineImagePos);const r=this.xref.fetchIfRef(a.F||a.Filter);let n;if(r instanceof Name)n=r.name;else if(Array.isArray(r)){const e=this.xref.fetchIfRef(r[0]);e instanceof Name&&(n=e.name)}const g=i.pos;let o,c;switch(n){case"DCT":case"DCTDecode":o=this.findDCTDecodeInlineStreamEnd(i);break;case"A85":case"ASCII85Decode":o=this.findASCII85DecodeInlineStreamEnd(i);break;case"AHx":case"ASCIIHexDecode":o=this.findASCIIHexDecodeInlineStreamEnd(i);break;default:o=this.findDefaultInlineStreamEnd(i)}if(o<1e3&&s>0){const e=i.pos;i.pos=t.beginInlineImagePos;c=function getInlineImageCacheKey(e){const t=[],i=e.length;let a=0;for(;a=a){let a=!1;for(const e of s){const t=e.length;let s=0;for(;s=r){a=!0;break}if(s>=t){if(isWhiteSpace(n[o+g+s])){info(`Found "${bytesToString([...i,...e])}" when searching for endstream command.`);a=!0}break}}if(a){t.pos+=o;return t.pos-e}}o++}t.pos+=g}return-1}makeStream(e,t){const i=this.lexer;let a=i.stream;i.skipToNextLine();const s=a.pos-1;let r=e.get("Length");if(!Number.isInteger(r)){info(`Bad length "${r&&r.toString()}" in stream.`);r=0}a.pos=s+r;i.nextChar();if(this.tryShift()&&isCmd(this.buf2,"endstream"))this.shift();else{r=this.#D(s);if(r<0)throw new FormatError("Missing endstream command.");i.nextChar();this.shift();this.shift()}this.shift();a=a.makeSubStream(s,r,e);t&&(a=t.createStream(a,r));a=this.filter(a,e,r);a.dict=e;return a}filter(e,t,i){let a=t.get("F","Filter"),s=t.get("DP","DecodeParms");if(a instanceof Name){Array.isArray(s)&&warn("/DecodeParms should not be an Array, when /Filter is a Name.");return this.makeFilter(e,a.name,i,s)}let r=i;if(Array.isArray(a)){const t=a,i=s;for(let n=0,g=t.length;n=48&&e<=57?15&e:e>=65&&e<=70||e>=97&&e<=102?9+(15&e):-1}class Lexer{constructor(e,t=null){this.stream=e;this.nextChar();this.strBuf=[];this.knownCommands=t;this._hexStringNumWarn=0;this.beginInlineImagePos=-1}nextChar(){return this.currentChar=this.stream.getByte()}peekChar(){return this.stream.peekByte()}getNumber(){let e=this.currentChar,t=!1,i=0,a=1;if(45===e){a=-1;e=this.nextChar();45===e&&(e=this.nextChar())}else 43===e&&(e=this.nextChar());if(10===e||13===e)do{e=this.nextChar()}while(10===e||13===e);if(46===e){i=10;e=this.nextChar()}if(e<48||e>57){const t=`Invalid number: ${String.fromCharCode(e)} (charCode ${e})`;if(isWhiteSpace(e)||-1===e){info(`Lexer.getNumber - "${t}".`);return 0}throw new FormatError(t)}let s=e-48,r=0,n=1;for(;(e=this.nextChar())>=0;)if(e>=48&&e<=57){const a=e-48;if(t)r=10*r+a;else{0!==i&&(i*=10);s=10*s+a}}else if(46===e){if(0!==i)break;i=1}else if(45===e)warn("Badly formatted number: minus sign in the middle");else{if(69!==e&&101!==e)break;e=this.peekChar();if(43===e||45===e){n=45===e?-1:1;this.nextChar()}else if(e<48||e>57)break;t=!0}0!==i&&(s/=i);t&&(s*=10**(n*r));return a*s}getString(){let e=1,t=!1;const i=this.strBuf;i.length=0;let a=this.nextChar();for(;;){let s=!1;switch(0|a){case-1:warn("Unterminated string");t=!0;break;case 40:++e;i.push("(");break;case 41:if(0==--e){this.nextChar();t=!0}else i.push(")");break;case 92:a=this.nextChar();switch(a){case-1:warn("Unterminated string");t=!0;break;case 110:i.push("\n");break;case 114:i.push("\r");break;case 116:i.push("\t");break;case 98:i.push("\b");break;case 102:i.push("\f");break;case 92:case 40:case 41:i.push(String.fromCharCode(a));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:let e=15&a;a=this.nextChar();s=!0;if(a>=48&&a<=55){e=(e<<3)+(15&a);a=this.nextChar();if(a>=48&&a<=55){s=!1;e=(e<<3)+(15&a)}}i.push(String.fromCharCode(e));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:i.push(String.fromCharCode(a))}break;default:i.push(String.fromCharCode(a))}if(t)break;s||(a=this.nextChar())}return i.join("")}getName(){let e,t;const i=this.strBuf;i.length=0;for(;(e=this.nextChar())>=0&&!hi[e];)if(35===e){e=this.nextChar();if(hi[e]){warn("Lexer_getName: NUMBER SIGN (#) should be followed by a hexadecimal number.");i.push("#");break}const a=toHexDigit(e);if(-1!==a){t=e;e=this.nextChar();const s=toHexDigit(e);if(-1===s){warn(`Lexer_getName: Illegal digit (${String.fromCharCode(e)}) in hexadecimal number.`);i.push("#",String.fromCharCode(t));if(hi[e])break;i.push(String.fromCharCode(e));continue}i.push(String.fromCharCode(a<<4|s))}else i.push("#",String.fromCharCode(e))}else i.push(String.fromCharCode(e));i.length>127&&warn(`Name token is longer than allowed by the spec: ${i.length}`);return Name.get(i.join(""))}_hexStringWarn(e){5!=this._hexStringNumWarn++?this._hexStringNumWarn>5||warn(`getHexString - ignoring invalid character: ${e}`):warn("getHexString - ignoring additional invalid characters.")}getHexString(){const e=this.strBuf;e.length=0;let t=this.currentChar,i=-1,a=-1;this._hexStringNumWarn=0;for(;;){if(t<0){warn("Unterminated hex string");break}if(62===t){this.nextChar();break}if(1!==hi[t]){a=toHexDigit(t);if(-1===a)this._hexStringWarn(t);else if(-1===i)i=a;else{e.push(String.fromCharCode(i<<4|a));i=-1}t=this.nextChar()}else t=this.nextChar()}-1!==i&&e.push(String.fromCharCode(i<<4));return e.join("")}getObj(){let e=!1,t=this.currentChar;for(;;){if(t<0)return yt;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(1!==hi[t])break;t=this.nextChar()}switch(0|t){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:this.nextChar();return Cmd.get("[");case 93:this.nextChar();return Cmd.get("]");case 60:t=this.nextChar();if(60===t){this.nextChar();return Cmd.get("<<")}return this.getHexString();case 62:t=this.nextChar();if(62===t){this.nextChar();return Cmd.get(">>")}return Cmd.get(">");case 123:this.nextChar();return Cmd.get("{");case 125:this.nextChar();return Cmd.get("}");case 41:this.nextChar();throw new FormatError(`Illegal character: ${t}`)}let i=String.fromCharCode(t);if(t<32||t>127){const e=this.peekChar();if(e>=32&&e<=127){this.nextChar();return Cmd.get(i)}}const a=this.knownCommands;let s=void 0!==a?.[i];for(;(t=this.nextChar())>=0&&!hi[t];){const e=i+String.fromCharCode(t);if(s&&void 0===a[e])break;if(128===i.length)throw new FormatError(`Command token too long: ${i.length}`);i=e;s=void 0!==a?.[i]}if("true"===i)return!0;if("false"===i)return!1;if("null"===i)return null;"BI"===i&&(this.beginInlineImagePos=this.stream.pos);return Cmd.get(i)}skipToNextLine(){let e=this.currentChar;for(;e>=0;){if(13===e){e=this.nextChar();10===e&&this.nextChar();break}if(10===e){this.nextChar();break}e=this.nextChar()}}}class Linearization{static create(e){function getInt(e,t,i=!1){const a=e.get(t);if(Number.isInteger(a)&&(i?a>=0:a>0))return a;throw new Error(`The "${t}" parameter in the linearization dictionary is invalid.`)}const t=new Parser({lexer:new Lexer(e),xref:null}),i=t.getObj(),a=t.getObj(),s=t.getObj(),r=t.getObj();let n,g;if(!(Number.isInteger(i)&&Number.isInteger(a)&&isCmd(s,"obj")&&r instanceof Dict&&"number"==typeof(n=r.get("Linearized"))&&n>0))return null;if((g=getInt(r,"L"))!==e.length)throw new Error('The "L" parameter in the linearization dictionary does not equal the stream length.');return{length:g,hints:function getHints(e){const t=e.get("H");let i;if(Array.isArray(t)&&(2===(i=t.length)||4===i)){for(let e=0;e0))throw new Error(`Hint (${e}) in the linearization dictionary is invalid.`)}return t}throw new Error("Hint array in the linearization dictionary is invalid.")}(r),objectNumberFirst:getInt(r,"O"),endFirst:getInt(r,"E"),numPages:getInt(r,"N"),mainXRefEntriesOffset:getInt(r,"T"),pageFirst:r.has("P")?getInt(r,"P",!0):0}}}const li=["Adobe-GB1-UCS2","Adobe-CNS1-UCS2","Adobe-Japan1-UCS2","Adobe-Korea1-UCS2","78-EUC-H","78-EUC-V","78-H","78-RKSJ-H","78-RKSJ-V","78-V","78ms-RKSJ-H","78ms-RKSJ-V","83pv-RKSJ-H","90ms-RKSJ-H","90ms-RKSJ-V","90msp-RKSJ-H","90msp-RKSJ-V","90pv-RKSJ-H","90pv-RKSJ-V","Add-H","Add-RKSJ-H","Add-RKSJ-V","Add-V","Adobe-CNS1-0","Adobe-CNS1-1","Adobe-CNS1-2","Adobe-CNS1-3","Adobe-CNS1-4","Adobe-CNS1-5","Adobe-CNS1-6","Adobe-GB1-0","Adobe-GB1-1","Adobe-GB1-2","Adobe-GB1-3","Adobe-GB1-4","Adobe-GB1-5","Adobe-Japan1-0","Adobe-Japan1-1","Adobe-Japan1-2","Adobe-Japan1-3","Adobe-Japan1-4","Adobe-Japan1-5","Adobe-Japan1-6","Adobe-Korea1-0","Adobe-Korea1-1","Adobe-Korea1-2","B5-H","B5-V","B5pc-H","B5pc-V","CNS-EUC-H","CNS-EUC-V","CNS1-H","CNS1-V","CNS2-H","CNS2-V","ETHK-B5-H","ETHK-B5-V","ETen-B5-H","ETen-B5-V","ETenms-B5-H","ETenms-B5-V","EUC-H","EUC-V","Ext-H","Ext-RKSJ-H","Ext-RKSJ-V","Ext-V","GB-EUC-H","GB-EUC-V","GB-H","GB-V","GBK-EUC-H","GBK-EUC-V","GBK2K-H","GBK2K-V","GBKp-EUC-H","GBKp-EUC-V","GBT-EUC-H","GBT-EUC-V","GBT-H","GBT-V","GBTpc-EUC-H","GBTpc-EUC-V","GBpc-EUC-H","GBpc-EUC-V","H","HKdla-B5-H","HKdla-B5-V","HKdlb-B5-H","HKdlb-B5-V","HKgccs-B5-H","HKgccs-B5-V","HKm314-B5-H","HKm314-B5-V","HKm471-B5-H","HKm471-B5-V","HKscs-B5-H","HKscs-B5-V","Hankaku","Hiragana","KSC-EUC-H","KSC-EUC-V","KSC-H","KSC-Johab-H","KSC-Johab-V","KSC-V","KSCms-UHC-H","KSCms-UHC-HW-H","KSCms-UHC-HW-V","KSCms-UHC-V","KSCpc-EUC-H","KSCpc-EUC-V","Katakana","NWP-H","NWP-V","RKSJ-H","RKSJ-V","Roman","UniCNS-UCS2-H","UniCNS-UCS2-V","UniCNS-UTF16-H","UniCNS-UTF16-V","UniCNS-UTF32-H","UniCNS-UTF32-V","UniCNS-UTF8-H","UniCNS-UTF8-V","UniGB-UCS2-H","UniGB-UCS2-V","UniGB-UTF16-H","UniGB-UTF16-V","UniGB-UTF32-H","UniGB-UTF32-V","UniGB-UTF8-H","UniGB-UTF8-V","UniJIS-UCS2-H","UniJIS-UCS2-HW-H","UniJIS-UCS2-HW-V","UniJIS-UCS2-V","UniJIS-UTF16-H","UniJIS-UTF16-V","UniJIS-UTF32-H","UniJIS-UTF32-V","UniJIS-UTF8-H","UniJIS-UTF8-V","UniJIS2004-UTF16-H","UniJIS2004-UTF16-V","UniJIS2004-UTF32-H","UniJIS2004-UTF32-V","UniJIS2004-UTF8-H","UniJIS2004-UTF8-V","UniJISPro-UCS2-HW-V","UniJISPro-UCS2-V","UniJISPro-UTF8-V","UniJISX0213-UTF32-H","UniJISX0213-UTF32-V","UniJISX02132004-UTF32-H","UniJISX02132004-UTF32-V","UniKS-UCS2-H","UniKS-UCS2-V","UniKS-UTF16-H","UniKS-UTF16-V","UniKS-UTF32-H","UniKS-UTF32-V","UniKS-UTF8-H","UniKS-UTF8-V","V","WP-Symbol"],Bi=2**24-1;class CMap{constructor(e=!1){this.codespaceRanges=[[],[],[],[]];this.numCodespaceRanges=0;this._map=[];this.name="";this.vertical=!1;this.useCMap=null;this.builtInCMap=e}addCodespaceRange(e,t,i){this.codespaceRanges[e-1].push(t,i);this.numCodespaceRanges++}mapCidRange(e,t,i){if(t-e>Bi)throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");for(;e<=t;)this._map[e++]=i++}mapBfRange(e,t,i){if(t-e>Bi)throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");const a=i.length-1;for(;e<=t;){this._map[e++]=i;const t=i.charCodeAt(a)+1;t>255?i=i.substring(0,a-1)+String.fromCharCode(i.charCodeAt(a-1)+1)+"\0":i=i.substring(0,a)+String.fromCharCode(t)}}mapBfRangeToArray(e,t,i){if(t-e>Bi)throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");const a=i.length;let s=0;for(;e<=t&&s>>0;const n=s[r];for(let e=0,t=n.length;e=t&&a<=s){i.charcode=a;i.length=r+1;return}}}i.charcode=0;i.length=1}getCharCodeLength(e){const t=this.codespaceRanges;for(let i=0,a=t.length;i=s&&e<=r)return i+1}}return 1}get length(){return this._map.length}get isIdentityCMap(){if("Identity-H"!==this.name&&"Identity-V"!==this.name)return!1;if(65536!==this._map.length)return!1;for(let e=0;e<65536;e++)if(this._map[e]!==e)return!1;return!0}}class IdentityCMap extends CMap{constructor(e,t){super();this.vertical=e;this.addCodespaceRange(t,0,65535)}mapCidRange(e,t,i){unreachable("should not call mapCidRange")}mapBfRange(e,t,i){unreachable("should not call mapBfRange")}mapBfRangeToArray(e,t,i){unreachable("should not call mapBfRangeToArray")}mapOne(e,t){unreachable("should not call mapCidOne")}lookup(e){return Number.isInteger(e)&&e<=65535?e:void 0}contains(e){return Number.isInteger(e)&&e<=65535}forEach(e){for(let t=0;t<=65535;t++)e(t,t)}charCodeOf(e){return Number.isInteger(e)&&e<=65535?e:-1}getMap(){const e=new Array(65536);for(let t=0;t<=65535;t++)e[t]=t;return e}get length(){return 65536}get isIdentityCMap(){unreachable("should not access .isIdentityCMap")}}function strToInt(e){let t=0;for(let i=0;i>>0}function expectString(e){if("string"!=typeof e)throw new FormatError("Malformed CMap: expected string.")}function expectInt(e){if(!Number.isInteger(e))throw new FormatError("Malformed CMap: expected int.")}function parseBfChar(e,t){for(;;){let i=t.getObj();if(i===yt)break;if(isCmd(i,"endbfchar"))return;expectString(i);const a=strToInt(i);i=t.getObj();expectString(i);const s=i;e.mapOne(a,s)}}function parseBfRange(e,t){for(;;){let i=t.getObj();if(i===yt)break;if(isCmd(i,"endbfrange"))return;expectString(i);const a=strToInt(i);i=t.getObj();expectString(i);const s=strToInt(i);i=t.getObj();if(Number.isInteger(i)||"string"==typeof i){const t=Number.isInteger(i)?String.fromCharCode(i):i;e.mapBfRange(a,s,t)}else{if(!isCmd(i,"["))break;{i=t.getObj();const r=[];for(;!isCmd(i,"]")&&i!==yt;){r.push(i);i=t.getObj()}e.mapBfRangeToArray(a,s,r)}}}throw new FormatError("Invalid bf range.")}function parseCidChar(e,t){for(;;){let i=t.getObj();if(i===yt)break;if(isCmd(i,"endcidchar"))return;expectString(i);const a=strToInt(i);i=t.getObj();expectInt(i);const s=i;e.mapOne(a,s)}}function parseCidRange(e,t){for(;;){let i=t.getObj();if(i===yt)break;if(isCmd(i,"endcidrange"))return;expectString(i);const a=strToInt(i);i=t.getObj();expectString(i);const s=strToInt(i);i=t.getObj();expectInt(i);const r=i;e.mapCidRange(a,s,r)}}function parseCodespaceRange(e,t){for(;;){let i=t.getObj();if(i===yt)break;if(isCmd(i,"endcodespacerange"))return;if("string"!=typeof i)break;const a=strToInt(i);i=t.getObj();if("string"!=typeof i)break;const s=strToInt(i);e.addCodespaceRange(i.length,a,s)}throw new FormatError("Invalid codespace range.")}function parseWMode(e,t){const i=t.getObj();Number.isInteger(i)&&(e.vertical=!!i)}function parseCMapName(e,t){const i=t.getObj();i instanceof Name&&(e.name=i.name)}async function parseCMap(e,t,i,a){let s,r;A:for(;;)try{const i=t.getObj();if(i===yt)break;if(i instanceof Name){"WMode"===i.name?parseWMode(e,t):"CMapName"===i.name&&parseCMapName(e,t);s=i}else if(i instanceof Cmd)switch(i.cmd){case"endcmap":break A;case"usecmap":s instanceof Name&&(r=s.name);break;case"begincodespacerange":parseCodespaceRange(e,t);break;case"beginbfchar":parseBfChar(e,t);break;case"begincidchar":parseCidChar(e,t);break;case"beginbfrange":parseBfRange(e,t);break;case"begincidrange":parseCidRange(e,t)}}catch(e){if(e instanceof MissingDataException)throw e;warn("Invalid cMap data: "+e);continue}!a&&r&&(a=r);return a?extendCMap(e,i,a):e}async function extendCMap(e,t,i){e.useCMap=await createBuiltInCMap(i,t);if(0===e.numCodespaceRanges){const t=e.useCMap.codespaceRanges;for(let i=0;iextendCMap(s,t,e)));const r=new Lexer(new Stream(i));return parseCMap(s,r,t,null)}class CMapFactory{static async create({encoding:e,fetchBuiltInCMap:t,useCMap:i}){if(e instanceof Name)return createBuiltInCMap(e.name,t);if(e instanceof BaseStream){const a=await parseCMap(new CMap,new Lexer(e),t,i);return a.isIdentityCMap?createBuiltInCMap(a.name,t):a}throw new Error("Encoding required.")}}const Qi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Ei=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],ui=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],di=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],fi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","centoldstyle","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","","threequartersemdash","","questionsmall","","","","","Ethsmall","","","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","","","","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hypheninferior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","asuperior","centsuperior","","","","","Aacutesmall","Agravesmall","Acircumflexsmall","Adieresissmall","Atildesmall","Aringsmall","Ccedillasmall","Eacutesmall","Egravesmall","Ecircumflexsmall","Edieresissmall","Iacutesmall","Igravesmall","Icircumflexsmall","Idieresissmall","Ntildesmall","Oacutesmall","Ogravesmall","Ocircumflexsmall","Odieresissmall","Otildesmall","Uacutesmall","Ugravesmall","Ucircumflexsmall","Udieresissmall","","eightsuperior","fourinferior","threeinferior","sixinferior","eightinferior","seveninferior","Scaronsmall","","centinferior","twoinferior","","Dieresissmall","","Caronsmall","osuperior","fiveinferior","","commainferior","periodinferior","Yacutesmall","","dollarinferior","","","Thornsmall","","nineinferior","zeroinferior","Zcaronsmall","AEsmall","Oslashsmall","questiondownsmall","oneinferior","Lslashsmall","","","","","","","Cedillasmall","","","","","","OEsmall","figuredash","hyphensuperior","","","","","exclamdownsmall","","Ydieresissmall","","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","ninesuperior","zerosuperior","","esuperior","rsuperior","tsuperior","","","isuperior","ssuperior","dsuperior","","","","","","lsuperior","Ogoneksmall","Brevesmall","Macronsmall","bsuperior","nsuperior","msuperior","commasuperior","periodsuperior","Dotaccentsmall","Ringsmall","","","",""],pi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","space","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron"],mi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls","","","",""],yi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","bullet","Euro","bullet","quotesinglbase","florin","quotedblbase","ellipsis","dagger","daggerdbl","circumflex","perthousand","Scaron","guilsinglleft","OE","bullet","Zcaron","bullet","bullet","quoteleft","quoteright","quotedblleft","quotedblright","bullet","endash","emdash","tilde","trademark","scaron","guilsinglright","oe","bullet","zcaron","Ydieresis","space","exclamdown","cent","sterling","currency","yen","brokenbar","section","dieresis","copyright","ordfeminine","guillemotleft","logicalnot","hyphen","registered","macron","degree","plusminus","twosuperior","threesuperior","acute","mu","paragraph","periodcentered","cedilla","onesuperior","ordmasculine","guillemotright","onequarter","onehalf","threequarters","questiondown","Agrave","Aacute","Acircumflex","Atilde","Adieresis","Aring","AE","Ccedilla","Egrave","Eacute","Ecircumflex","Edieresis","Igrave","Iacute","Icircumflex","Idieresis","Eth","Ntilde","Ograve","Oacute","Ocircumflex","Otilde","Odieresis","multiply","Oslash","Ugrave","Uacute","Ucircumflex","Udieresis","Yacute","Thorn","germandbls","agrave","aacute","acircumflex","atilde","adieresis","aring","ae","ccedilla","egrave","eacute","ecircumflex","edieresis","igrave","iacute","icircumflex","idieresis","eth","ntilde","ograve","oacute","ocircumflex","otilde","odieresis","divide","oslash","ugrave","uacute","ucircumflex","udieresis","yacute","thorn","ydieresis"],wi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","universal","numbersign","existential","percent","ampersand","suchthat","parenleft","parenright","asteriskmath","plus","comma","minus","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","congruent","Alpha","Beta","Chi","Delta","Epsilon","Phi","Gamma","Eta","Iota","theta1","Kappa","Lambda","Mu","Nu","Omicron","Pi","Theta","Rho","Sigma","Tau","Upsilon","sigma1","Omega","Xi","Psi","Zeta","bracketleft","therefore","bracketright","perpendicular","underscore","radicalex","alpha","beta","chi","delta","epsilon","phi","gamma","eta","iota","phi1","kappa","lambda","mu","nu","omicron","pi","theta","rho","sigma","tau","upsilon","omega1","omega","xi","psi","zeta","braceleft","bar","braceright","similar","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Euro","Upsilon1","minute","lessequal","fraction","infinity","florin","club","diamond","heart","spade","arrowboth","arrowleft","arrowup","arrowright","arrowdown","degree","plusminus","second","greaterequal","multiply","proportional","partialdiff","bullet","divide","notequal","equivalence","approxequal","ellipsis","arrowvertex","arrowhorizex","carriagereturn","aleph","Ifraktur","Rfraktur","weierstrass","circlemultiply","circleplus","emptyset","intersection","union","propersuperset","reflexsuperset","notsubset","propersubset","reflexsubset","element","notelement","angle","gradient","registerserif","copyrightserif","trademarkserif","product","radical","dotmath","logicalnot","logicaland","logicalor","arrowdblboth","arrowdblleft","arrowdblup","arrowdblright","arrowdbldown","lozenge","angleleft","registersans","copyrightsans","trademarksans","summation","parenlefttp","parenleftex","parenleftbt","bracketlefttp","bracketleftex","bracketleftbt","bracelefttp","braceleftmid","braceleftbt","braceex","","angleright","integral","integraltp","integralex","integralbt","parenrighttp","parenrightex","parenrightbt","bracketrighttp","bracketrightex","bracketrightbt","bracerighttp","bracerightmid","bracerightbt",""],Di=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","a1","a2","a202","a3","a4","a5","a119","a118","a117","a11","a12","a13","a14","a15","a16","a105","a17","a18","a19","a20","a21","a22","a23","a24","a25","a26","a27","a28","a6","a7","a8","a9","a10","a29","a30","a31","a32","a33","a34","a35","a36","a37","a38","a39","a40","a41","a42","a43","a44","a45","a46","a47","a48","a49","a50","a51","a52","a53","a54","a55","a56","a57","a58","a59","a60","a61","a62","a63","a64","a65","a66","a67","a68","a69","a70","a71","a72","a73","a74","a203","a75","a204","a76","a77","a78","a79","a81","a82","a83","a84","a97","a98","a99","a100","","a89","a90","a93","a94","a91","a92","a205","a85","a206","a86","a87","a88","a95","a96","","","","","","","","","","","","","","","","","","","","a101","a102","a103","a104","a106","a107","a108","a112","a111","a110","a109","a120","a121","a122","a123","a124","a125","a126","a127","a128","a129","a130","a131","a132","a133","a134","a135","a136","a137","a138","a139","a140","a141","a142","a143","a144","a145","a146","a147","a148","a149","a150","a151","a152","a153","a154","a155","a156","a157","a158","a159","a160","a161","a163","a164","a196","a165","a192","a166","a167","a168","a169","a170","a171","a172","a173","a162","a174","a175","a176","a177","a178","a179","a193","a180","a199","a181","a200","a182","","a201","a183","a184","a197","a185","a194","a198","a186","a195","a187","a188","a189","a190","a191",""];function getEncoding(e){switch(e){case"WinAnsiEncoding":return yi;case"StandardEncoding":return mi;case"MacRomanEncoding":return pi;case"SymbolSetEncoding":return wi;case"ZapfDingbatsEncoding":return Di;case"ExpertEncoding":return di;case"MacExpertEncoding":return fi;default:return null}}const bi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Fi=391,Si=[null,{id:"hstem",min:2,stackClearing:!0,stem:!0},null,{id:"vstem",min:2,stackClearing:!0,stem:!0},{id:"vmoveto",min:1,stackClearing:!0},{id:"rlineto",min:2,resetStack:!0},{id:"hlineto",min:1,resetStack:!0},{id:"vlineto",min:1,resetStack:!0},{id:"rrcurveto",min:6,resetStack:!0},null,{id:"callsubr",min:1,undefStack:!0},{id:"return",min:0,undefStack:!0},null,null,{id:"endchar",min:0,stackClearing:!0},null,null,null,{id:"hstemhm",min:2,stackClearing:!0,stem:!0},{id:"hintmask",min:0,stackClearing:!0},{id:"cntrmask",min:0,stackClearing:!0},{id:"rmoveto",min:2,stackClearing:!0},{id:"hmoveto",min:1,stackClearing:!0},{id:"vstemhm",min:2,stackClearing:!0,stem:!0},{id:"rcurveline",min:8,resetStack:!0},{id:"rlinecurve",min:8,resetStack:!0},{id:"vvcurveto",min:4,resetStack:!0},{id:"hhcurveto",min:4,resetStack:!0},null,{id:"callgsubr",min:1,undefStack:!0},{id:"vhcurveto",min:4,resetStack:!0},{id:"hvcurveto",min:4,resetStack:!0}],ki=[null,null,null,{id:"and",min:2,stackDelta:-1},{id:"or",min:2,stackDelta:-1},{id:"not",min:1,stackDelta:0},null,null,null,{id:"abs",min:1,stackDelta:0},{id:"add",min:2,stackDelta:-1,stackFn(e,t){e[t-2]=e[t-2]+e[t-1]}},{id:"sub",min:2,stackDelta:-1,stackFn(e,t){e[t-2]=e[t-2]-e[t-1]}},{id:"div",min:2,stackDelta:-1,stackFn(e,t){e[t-2]=e[t-2]/e[t-1]}},null,{id:"neg",min:1,stackDelta:0,stackFn(e,t){e[t-1]=-e[t-1]}},{id:"eq",min:2,stackDelta:-1},null,null,{id:"drop",min:1,stackDelta:-1},null,{id:"put",min:2,stackDelta:-2},{id:"get",min:1,stackDelta:0},{id:"ifelse",min:4,stackDelta:-3},{id:"random",min:0,stackDelta:1},{id:"mul",min:2,stackDelta:-1,stackFn(e,t){e[t-2]=e[t-2]*e[t-1]}},null,{id:"sqrt",min:1,stackDelta:0},{id:"dup",min:1,stackDelta:1},{id:"exch",min:2,stackDelta:0},{id:"index",min:2,stackDelta:0},{id:"roll",min:3,stackDelta:-2},null,null,null,{id:"hflex",min:7,resetStack:!0},{id:"flex",min:13,resetStack:!0},{id:"hflex1",min:9,resetStack:!0},{id:"flex1",min:11,resetStack:!0}];class CFFParser{constructor(e,t,i){this.bytes=e.getBytes();this.properties=t;this.seacAnalysisEnabled=!!i}parse(){const e=this.properties,t=new CFF;this.cff=t;const i=this.parseHeader(),a=this.parseIndex(i.endPos),s=this.parseIndex(a.endPos),r=this.parseIndex(s.endPos),n=this.parseIndex(r.endPos),g=this.parseDict(s.obj.get(0)),o=this.createDict(CFFTopDict,g,t.strings);t.header=i.obj;t.names=this.parseNameIndex(a.obj);t.strings=this.parseStringIndex(r.obj);t.topDict=o;t.globalSubrIndex=n.obj;this.parsePrivateDict(t.topDict);t.isCIDFont=o.hasName("ROS");const c=o.getByName("CharStrings"),C=this.parseIndex(c).obj,h=o.getByName("FontMatrix");h&&(e.fontMatrix=h);const l=o.getByName("FontBBox");if(l){e.ascent=Math.max(l[3],l[1]);e.descent=Math.min(l[1],l[3]);e.ascentScaled=!0}let Q,E;if(t.isCIDFont){const e=this.parseIndex(o.getByName("FDArray")).obj;for(let i=0,a=e.count;i=t)throw new FormatError("Invalid CFF header");if(0!==i){info("cff data is shifted");e=e.subarray(i);this.bytes=e}const a=e[0],s=e[1],r=e[2],n=e[3];return{obj:new CFFHeader(a,s,r,n),endPos:r}}parseDict(e){let t=0;function parseOperand(){let i=e[t++];if(30===i)return function parseFloatOperand(){let i="";const a=15,s=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"],r=e.length;for(;t>4,g=15&r;if(n===a)break;i+=s[n];if(g===a)break;i+=s[g]}return parseFloat(i)}();if(28===i){i=e[t++];i=(i<<24|e[t++]<<16)>>16;return i}if(29===i){i=e[t++];i=i<<8|e[t++];i=i<<8|e[t++];i=i<<8|e[t++];return i}if(i>=32&&i<=246)return i-139;if(i>=247&&i<=250)return 256*(i-247)+e[t++]+108;if(i>=251&&i<=254)return-256*(i-251)-e[t++]-108;warn('CFFParser_parseDict: "'+i+'" is a reserved command.');return NaN}let i=[];const a=[];t=0;const s=e.length;for(;t10)return!1;let s=e.stackSize;const r=e.stack;let n=t.length;for(let g=0;g>16;g+=2;s++}else if(14===o){if(s>=4){s-=4;if(this.seacAnalysisEnabled){e.seac=r.slice(s,s+4);return!1}}c=Si[o]}else if(o>=32&&o<=246){r[s]=o-139;s++}else if(o>=247&&o<=254){r[s]=o<251?(o-247<<8)+t[g]+108:-(o-251<<8)-t[g]-108;g++;s++}else if(255===o){r[s]=(t[g]<<24|t[g+1]<<16|t[g+2]<<8|t[g+3])/65536;g+=4;s++}else if(19===o||20===o){e.hints+=s>>1;if(0===e.hints){t.copyWithin(g-1,g,-1);g-=1;n-=1;continue}g+=e.hints+7>>3;s%=2;c=Si[o]}else{if(10===o||29===o){const t=10===o?i:a;if(!t){c=Si[o];warn("Missing subrsIndex for "+c.id);return!1}let n=32768;t.count<1240?n=107:t.count<33900&&(n=1131);const g=r[--s]+n;if(g<0||g>=t.count||isNaN(g)){c=Si[o];warn("Out of bounds subrIndex for "+c.id);return!1}e.stackSize=s;e.callDepth++;if(!this.parseCharString(e,t.get(g),i,a))return!1;e.callDepth--;s=e.stackSize;continue}if(11===o){e.stackSize=s;return!0}if(0===o&&g===t.length){t[g-1]=14;c=Si[14]}else{if(9===o){t.copyWithin(g-1,g,-1);g-=1;n-=1;continue}c=Si[o]}}if(c){if(c.stem){e.hints+=s>>1;if(3===o||23===o)e.hasVStems=!0;else if(e.hasVStems&&(1===o||18===o)){warn("CFF stem hints are in wrong order");t[g-1]=1===o?3:23}}if("min"in c&&!e.undefStack&&s=2&&c.stem?s%=2:s>1&&warn("Found too many parameters for stack-clearing command");s>0&&(e.width=r[s-1])}if("stackDelta"in c){"stackFn"in c&&c.stackFn(r,s);s+=c.stackDelta}else if(c.stackClearing)s=0;else if(c.resetStack){s=0;e.undefStack=!1}else if(c.undefStack){s=0;e.undefStack=!0;e.firstStackClearing=!1}}}n=s.length){warn("Invalid fd index for glyph index.");h=!1}if(h){Q=s[e].privateDict;l=Q.subrsIndex}}else t&&(l=t);h&&(h=this.parseCharString(C,o,l,i));if(null!==C.width){const e=Q.getByName("nominalWidthX");g[c]=e+C.width}else{const e=Q.getByName("defaultWidthX");g[c]=e}null!==C.seac&&(n[c]=C.seac);h||e.set(c,new Uint8Array([14]))}return{charStrings:e,seacs:n,widths:g}}emptyPrivateDictionary(e){const t=this.createDict(CFFPrivateDict,[],e.strings);e.setByKey(18,[0,0]);e.privateDict=t}parsePrivateDict(e){if(!e.hasName("Private")){this.emptyPrivateDictionary(e);return}const t=e.getByName("Private");if(!Array.isArray(t)||2!==t.length){e.removeByName("Private");return}const i=t[0],a=t[1];if(0===i||a>=this.bytes.length){this.emptyPrivateDictionary(e);return}const s=a+i,r=this.bytes.subarray(a,s),n=this.parseDict(r),g=this.createDict(CFFPrivateDict,n,e.strings);e.privateDict=g;0===g.getByName("ExpansionFactor")&&g.setByName("ExpansionFactor",.06);if(!g.getByName("Subrs"))return;const o=g.getByName("Subrs"),c=a+o;if(0===o||c>=this.bytes.length){this.emptyPrivateDictionary(e);return}const C=this.parseIndex(c);g.subrsIndex=C.obj}parseCharsets(e,t,i,a){if(0===e)return new CFFCharset(!0,Gi.ISO_ADOBE,Qi);if(1===e)return new CFFCharset(!0,Gi.EXPERT,Ei);if(2===e)return new CFFCharset(!0,Gi.EXPERT_SUBSET,ui);const s=this.bytes,r=e,n=s[e++],g=[a?0:".notdef"];let o,c,C;t-=1;switch(n){case 0:for(C=0;C=65535){warn("Not enough space in charstrings to duplicate first glyph.");return}const e=this.charStrings.get(0);this.charStrings.add(e);this.isCIDFont&&this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0])}hasGlyphId(e){if(e<0||e>=this.charStrings.count)return!1;return this.charStrings.get(e).length>0}}class CFFHeader{constructor(e,t,i,a){this.major=e;this.minor=t;this.hdrSize=i;this.offSize=a}}class CFFStrings{constructor(){this.strings=[]}get(e){return e>=0&&e<=390?bi[e]:e-Fi<=this.strings.length?this.strings[e-Fi]:bi[0]}getSID(e){let t=bi.indexOf(e);if(-1!==t)return t;t=this.strings.indexOf(e);return-1!==t?t+Fi:-1}add(e){this.strings.push(e)}get count(){return this.strings.length}}class CFFIndex{constructor(){this.objects=[];this.length=0}add(e){this.length+=e.length;this.objects.push(e)}set(e,t){this.length+=t.length-this.objects[e].length;this.objects[e]=t}get(e){return this.objects[e]}get count(){return this.objects.length}}class CFFDict{constructor(e,t){this.keyToNameMap=e.keyToNameMap;this.nameToKeyMap=e.nameToKeyMap;this.defaults=e.defaults;this.types=e.types;this.opcodes=e.opcodes;this.order=e.order;this.strings=t;this.values=Object.create(null)}setByKey(e,t){if(!(e in this.keyToNameMap))return!1;if(0===t.length)return!0;for(const i of t)if(isNaN(i)){warn(`Invalid CFFDict value: "${t}" for key "${e}".`);return!0}const i=this.types[e];"num"!==i&&"sid"!==i&&"offset"!==i||(t=t[0]);this.values[e]=t;return!0}setByName(e,t){if(!(e in this.nameToKeyMap))throw new FormatError(`Invalid dictionary name "${e}"`);this.values[this.nameToKeyMap[e]]=t}hasName(e){return this.nameToKeyMap[e]in this.values}getByName(e){if(!(e in this.nameToKeyMap))throw new FormatError(`Invalid dictionary name ${e}"`);const t=this.nameToKeyMap[e];return t in this.values?this.values[t]:this.defaults[t]}removeByName(e){delete this.values[this.nameToKeyMap[e]]}static createTables(e){const t={keyToNameMap:{},nameToKeyMap:{},defaults:{},types:{},opcodes:{},order:[]};for(const i of e){const e=Array.isArray(i[0])?(i[0][0]<<8)+i[0][1]:i[0];t.keyToNameMap[e]=i[1];t.nameToKeyMap[i[1]]=e;t.types[e]=i[2];t.defaults[e]=i[3];t.opcodes[e]=Array.isArray(i[0])?i[0]:[i[0]];t.order.push(e)}return t}}const Ri=[[[12,30],"ROS",["sid","sid","num"],null],[[12,20],"SyntheticBase","num",null],[0,"version","sid",null],[1,"Notice","sid",null],[[12,0],"Copyright","sid",null],[2,"FullName","sid",null],[3,"FamilyName","sid",null],[4,"Weight","sid",null],[[12,1],"isFixedPitch","num",0],[[12,2],"ItalicAngle","num",0],[[12,3],"UnderlinePosition","num",-100],[[12,4],"UnderlineThickness","num",50],[[12,5],"PaintType","num",0],[[12,6],"CharstringType","num",2],[[12,7],"FontMatrix",["num","num","num","num","num","num"],[.001,0,0,.001,0,0]],[13,"UniqueID","num",null],[5,"FontBBox",["num","num","num","num"],[0,0,0,0]],[[12,8],"StrokeWidth","num",0],[14,"XUID","array",null],[15,"charset","offset",0],[16,"Encoding","offset",0],[17,"CharStrings","offset",0],[18,"Private",["offset","offset"],null],[[12,21],"PostScript","sid",null],[[12,22],"BaseFontName","sid",null],[[12,23],"BaseFontBlend","delta",null],[[12,31],"CIDFontVersion","num",0],[[12,32],"CIDFontRevision","num",0],[[12,33],"CIDFontType","num",0],[[12,34],"CIDCount","num",8720],[[12,35],"UIDBase","num",null],[[12,37],"FDSelect","offset",null],[[12,36],"FDArray","offset",null],[[12,38],"FontName","sid",null]];class CFFTopDict extends CFFDict{static get tables(){return shadow(this,"tables",this.createTables(Ri))}constructor(e){super(CFFTopDict.tables,e);this.privateDict=null}}const Ni=[[6,"BlueValues","delta",null],[7,"OtherBlues","delta",null],[8,"FamilyBlues","delta",null],[9,"FamilyOtherBlues","delta",null],[[12,9],"BlueScale","num",.039625],[[12,10],"BlueShift","num",7],[[12,11],"BlueFuzz","num",1],[10,"StdHW","num",null],[11,"StdVW","num",null],[[12,12],"StemSnapH","delta",null],[[12,13],"StemSnapV","delta",null],[[12,14],"ForceBold","num",0],[[12,17],"LanguageGroup","num",0],[[12,18],"ExpansionFactor","num",.06],[[12,19],"initialRandomSeed","num",0],[20,"defaultWidthX","num",0],[21,"nominalWidthX","num",0],[19,"Subrs","offset",null]];class CFFPrivateDict extends CFFDict{static get tables(){return shadow(this,"tables",this.createTables(Ni))}constructor(e){super(CFFPrivateDict.tables,e);this.subrsIndex=null}}const Gi={ISO_ADOBE:0,EXPERT:1,EXPERT_SUBSET:2};class CFFCharset{constructor(e,t,i,a){this.predefined=e;this.format=t;this.charset=i;this.raw=a}}class CFFEncoding{constructor(e,t,i,a){this.predefined=e;this.format=t;this.encoding=i;this.raw=a}}class CFFFDSelect{constructor(e,t){this.format=e;this.fdSelect=t}getFDIndex(e){return e<0||e>=this.fdSelect.length?-1:this.fdSelect[e]}}class CFFOffsetTracker{constructor(){this.offsets=Object.create(null)}isTracking(e){return e in this.offsets}track(e,t){if(e in this.offsets)throw new FormatError(`Already tracking location of ${e}`);this.offsets[e]=t}offset(e){for(const t in this.offsets)this.offsets[t]+=e}setEntryLocation(e,t,i){if(!(e in this.offsets))throw new FormatError(`Not tracking location of ${e}`);const a=i.data,s=this.offsets[e];for(let e=0,i=t.length;e>24&255;a[n]=c>>16&255;a[g]=c>>8&255;a[o]=255&c}}}class CFFCompiler{constructor(e){this.cff=e}compile(){const e=this.cff,t={data:[],length:0,add(e){try{this.data.push(...e)}catch{this.data=this.data.concat(e)}this.length=this.data.length}},i=this.compileHeader(e.header);t.add(i);const a=this.compileNameIndex(e.names);t.add(a);if(e.isCIDFont&&e.topDict.hasName("FontMatrix")){const t=e.topDict.getByName("FontMatrix");e.topDict.removeByName("FontMatrix");for(const i of e.fdArray){let e=t.slice(0);i.hasName("FontMatrix")&&(e=Util.transform(e,i.getByName("FontMatrix")));i.setByName("FontMatrix",e)}}const s=e.topDict.getByName("XUID");s?.length>16&&e.topDict.removeByName("XUID");e.topDict.setByName("charset",0);let r=this.compileTopDicts([e.topDict],t.length,e.isCIDFont);t.add(r.output);const n=r.trackers[0],g=this.compileStringIndex(e.strings.strings);t.add(g);const o=this.compileIndex(e.globalSubrIndex);t.add(o);if(e.encoding&&e.topDict.hasName("Encoding"))if(e.encoding.predefined)n.setEntryLocation("Encoding",[e.encoding.format],t);else{const i=this.compileEncoding(e.encoding);n.setEntryLocation("Encoding",[t.length],t);t.add(i)}const c=this.compileCharset(e.charset,e.charStrings.count,e.strings,e.isCIDFont);n.setEntryLocation("charset",[t.length],t);t.add(c);const C=this.compileCharStrings(e.charStrings);n.setEntryLocation("CharStrings",[t.length],t);t.add(C);if(e.isCIDFont){n.setEntryLocation("FDSelect",[t.length],t);const i=this.compileFDSelect(e.fdSelect);t.add(i);r=this.compileTopDicts(e.fdArray,t.length,!0);n.setEntryLocation("FDArray",[t.length],t);t.add(r.output);const a=r.trackers;this.compilePrivateDicts(e.fdArray,a,t)}this.compilePrivateDicts([e.topDict],[n],t);t.add([0]);return t.data}encodeNumber(e){return Number.isInteger(e)?this.encodeInteger(e):this.encodeFloat(e)}static get EncodeFloatRegExp(){return shadow(this,"EncodeFloatRegExp",/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/)}encodeFloat(e){let t=e.toString();const i=CFFCompiler.EncodeFloatRegExp.exec(t);if(i){const a=parseFloat("1e"+((i[2]?+i[2]:0)+i[1].length));t=(Math.round(e*a)/a).toString()}let a,s,r="";for(a=0,s=t.length;a=-107&&e<=107?[e+139]:e>=108&&e<=1131?[247+((e-=108)>>8),255&e]:e>=-1131&&e<=-108?[251+((e=-e-108)>>8),255&e]:e>=-32768&&e<=32767?[28,e>>8&255,255&e]:[29,e>>24&255,e>>16&255,e>>8&255,255&e];return t}compileHeader(e){return[e.major,e.minor,4,e.offSize]}compileNameIndex(e){const t=new CFFIndex;for(const i of e){const e=Math.min(i.length,127);let a=new Array(e);for(let t=0;t"~"||"["===e||"]"===e||"("===e||")"===e||"{"===e||"}"===e||"<"===e||">"===e||"/"===e||"%"===e)&&(e="_");a[t]=e}a=a.join("");""===a&&(a="Bad_Font_Name");t.add(stringToBytes(a))}return this.compileIndex(t)}compileTopDicts(e,t,i){const a=[];let s=new CFFIndex;for(const r of e){if(i){r.removeByName("CIDFontVersion");r.removeByName("CIDFontRevision");r.removeByName("CIDFontType");r.removeByName("CIDCount");r.removeByName("UIDBase")}const e=new CFFOffsetTracker,n=this.compileDict(r,e);a.push(e);s.add(n);e.offset(t)}s=this.compileIndex(s,a);return{trackers:a,output:s}}compilePrivateDicts(e,t,i){for(let a=0,s=e.length;a>8&255,255&r]);else{s=new Uint8Array(1+2*r);s[0]=0;let t=0;const a=e.charset.length;let n=!1;for(let r=1;r>8&255;s[r+1]=255&g}}return this.compileTypedArray(s)}compileEncoding(e){return this.compileTypedArray(e.raw)}compileFDSelect(e){const t=e.format;let i,a;switch(t){case 0:i=new Uint8Array(1+e.fdSelect.length);i[0]=t;for(a=0;a>8&255,255&s,r];for(a=1;a>8&255,255&a,t);r=t}}const g=(n.length-3)/3;n[1]=g>>8&255;n[2]=255&g;n.push(a>>8&255,255&a);i=new Uint8Array(n)}return this.compileTypedArray(i)}compileTypedArray(e){return Array.from(e)}compileIndex(e,t=[]){const i=e.objects,a=i.length;if(0===a)return[0,0];const s=[a>>8&255,255&a];let r,n,g=1;for(r=0;r>8&255,255&o):3===n?s.push(o>>16&255,o>>8&255,255&o):s.push(o>>>24&255,o>>16&255,o>>8&255,255&o);i[r]&&(o+=i[r].length)}for(r=0;r=5&&t<=7))return-1;a=e.substring(1)}if(a===a.toUpperCase()){i=parseInt(a,16);if(i>=0)return i}}return-1}const Ji=[[0,127],[128,255],[256,383],[384,591],[592,687,7424,7551,7552,7615],[688,767,42752,42783],[768,879,7616,7679],[880,1023],[11392,11519],[1024,1279,1280,1327,11744,11775,42560,42655],[1328,1423],[1424,1535],[42240,42559],[1536,1791,1872,1919],[1984,2047],[2304,2431],[2432,2559],[2560,2687],[2688,2815],[2816,2943],[2944,3071],[3072,3199],[3200,3327],[3328,3455],[3584,3711],[3712,3839],[4256,4351,11520,11567],[6912,7039],[4352,4607],[7680,7935,11360,11391,42784,43007],[7936,8191],[8192,8303,11776,11903],[8304,8351],[8352,8399],[8400,8447],[8448,8527],[8528,8591],[8592,8703,10224,10239,10496,10623,11008,11263],[8704,8959,10752,11007,10176,10223,10624,10751],[8960,9215],[9216,9279],[9280,9311],[9312,9471],[9472,9599],[9600,9631],[9632,9727],[9728,9983],[9984,10175],[12288,12351],[12352,12447],[12448,12543,12784,12799],[12544,12591,12704,12735],[12592,12687],[43072,43135],[12800,13055],[13056,13311],[44032,55215],[55296,57343],[67840,67871],[19968,40959,11904,12031,12032,12255,12272,12287,13312,19903,131072,173791,12688,12703],[57344,63743],[12736,12783,63744,64255,194560,195103],[64256,64335],[64336,65023],[65056,65071],[65040,65055],[65104,65135],[65136,65279],[65280,65519],[65520,65535],[3840,4095],[1792,1871],[1920,1983],[3456,3583],[4096,4255],[4608,4991,4992,5023,11648,11743],[5024,5119],[5120,5759],[5760,5791],[5792,5887],[6016,6143],[6144,6319],[10240,10495],[40960,42127],[5888,5919,5920,5951,5952,5983,5984,6015],[66304,66351],[66352,66383],[66560,66639],[118784,119039,119040,119295,119296,119375],[119808,120831],[1044480,1048573],[65024,65039,917760,917999],[917504,917631],[6400,6479],[6480,6527],[6528,6623],[6656,6687],[11264,11359],[11568,11647],[19904,19967],[43008,43055],[65536,65663,65664,65791,65792,65855],[65856,65935],[66432,66463],[66464,66527],[66640,66687],[66688,66735],[67584,67647],[68096,68191],[119552,119647],[73728,74751,74752,74879],[119648,119679],[7040,7103],[7168,7247],[7248,7295],[43136,43231],[43264,43311],[43312,43359],[43520,43615],[65936,65999],[66e3,66047],[66208,66271,66176,66207,67872,67903],[127024,127135,126976,127023]];function getUnicodeRangeFor(e,t=-1){if(-1!==t){const i=Ji[t];for(let a=0,s=i.length;a=i[a]&&e<=i[a+1])return t}for(let t=0,i=Ji.length;t=i[a]&&e<=i[a+1])return t}return-1}const Yi=new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$","u"),vi=new Map;const Ki=!0,Ti=1,qi=2,Oi=4,Pi=32,Wi=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function recoverGlyphName(e,t){if(void 0!==t[e])return e;const i=getUnicodeForGlyph(e,t);if(-1!==i)for(const e in t)if(t[e]===i)return e;info("Unable to recover a standard glyph name for: "+e);return e}function type1FontGlyphMapping(e,t,i){const a=Object.create(null);let s,r,n;const g=!!(e.flags&Oi);if(e.isInternalFont){n=t;for(r=0;r=0?s:0}}else if(e.baseEncodingName){n=getEncoding(e.baseEncodingName);for(r=0;r=0?s:0}}else if(g)for(r in t)a[r]=t[r];else{n=mi;for(r=0;r=0?s:0}}const o=e.differences;let c;if(o)for(r in o){const e=o[r];s=i.indexOf(e);if(-1===s){c||(c=xi());const t=recoverGlyphName(e,c);t!==e&&(s=i.indexOf(t))}a[r]=s>=0?s:0}return a}function normalizeFontName(e){return e.replaceAll(/[,_]/g,"-").replaceAll(/\s/g,"")}const ji=getLookupTableFactory((e=>{e[8211]=65074;e[8212]=65073;e[8229]=65072;e[8230]=65049;e[12289]=65041;e[12290]=65042;e[12296]=65087;e[12297]=65088;e[12298]=65085;e[12299]=65086;e[12300]=65089;e[12301]=65090;e[12302]=65091;e[12303]=65092;e[12304]=65083;e[12305]=65084;e[12308]=65081;e[12309]=65082;e[12310]=65047;e[12311]=65048;e[65103]=65076;e[65281]=65045;e[65288]=65077;e[65289]=65078;e[65292]=65040;e[65306]=65043;e[65307]=65044;e[65311]=65046;e[65339]=65095;e[65341]=65096;e[65343]=65075;e[65371]=65079;e[65373]=65080})),Xi=getLookupTableFactory((function(e){e["Times-Roman"]="Times-Roman";e.Helvetica="Helvetica";e.Courier="Courier";e.Symbol="Symbol";e["Times-Bold"]="Times-Bold";e["Helvetica-Bold"]="Helvetica-Bold";e["Courier-Bold"]="Courier-Bold";e.ZapfDingbats="ZapfDingbats";e["Times-Italic"]="Times-Italic";e["Helvetica-Oblique"]="Helvetica-Oblique";e["Courier-Oblique"]="Courier-Oblique";e["Times-BoldItalic"]="Times-BoldItalic";e["Helvetica-BoldOblique"]="Helvetica-BoldOblique";e["Courier-BoldOblique"]="Courier-BoldOblique";e.ArialNarrow="Helvetica";e["ArialNarrow-Bold"]="Helvetica-Bold";e["ArialNarrow-BoldItalic"]="Helvetica-BoldOblique";e["ArialNarrow-Italic"]="Helvetica-Oblique";e.ArialBlack="Helvetica";e["ArialBlack-Bold"]="Helvetica-Bold";e["ArialBlack-BoldItalic"]="Helvetica-BoldOblique";e["ArialBlack-Italic"]="Helvetica-Oblique";e["Arial-Black"]="Helvetica";e["Arial-Black-Bold"]="Helvetica-Bold";e["Arial-Black-BoldItalic"]="Helvetica-BoldOblique";e["Arial-Black-Italic"]="Helvetica-Oblique";e.Arial="Helvetica";e["Arial-Bold"]="Helvetica-Bold";e["Arial-BoldItalic"]="Helvetica-BoldOblique";e["Arial-Italic"]="Helvetica-Oblique";e.ArialMT="Helvetica";e["Arial-BoldItalicMT"]="Helvetica-BoldOblique";e["Arial-BoldMT"]="Helvetica-Bold";e["Arial-ItalicMT"]="Helvetica-Oblique";e["Arial-BoldItalicMT-BoldItalic"]="Helvetica-BoldOblique";e["Arial-BoldMT-Bold"]="Helvetica-Bold";e["Arial-ItalicMT-Italic"]="Helvetica-Oblique";e.ArialUnicodeMS="Helvetica";e["ArialUnicodeMS-Bold"]="Helvetica-Bold";e["ArialUnicodeMS-BoldItalic"]="Helvetica-BoldOblique";e["ArialUnicodeMS-Italic"]="Helvetica-Oblique";e["Courier-BoldItalic"]="Courier-BoldOblique";e["Courier-Italic"]="Courier-Oblique";e.CourierNew="Courier";e["CourierNew-Bold"]="Courier-Bold";e["CourierNew-BoldItalic"]="Courier-BoldOblique";e["CourierNew-Italic"]="Courier-Oblique";e["CourierNewPS-BoldItalicMT"]="Courier-BoldOblique";e["CourierNewPS-BoldMT"]="Courier-Bold";e["CourierNewPS-ItalicMT"]="Courier-Oblique";e.CourierNewPSMT="Courier";e["Helvetica-BoldItalic"]="Helvetica-BoldOblique";e["Helvetica-Italic"]="Helvetica-Oblique";e["Symbol-Bold"]="Symbol";e["Symbol-BoldItalic"]="Symbol";e["Symbol-Italic"]="Symbol";e.TimesNewRoman="Times-Roman";e["TimesNewRoman-Bold"]="Times-Bold";e["TimesNewRoman-BoldItalic"]="Times-BoldItalic";e["TimesNewRoman-Italic"]="Times-Italic";e.TimesNewRomanPS="Times-Roman";e["TimesNewRomanPS-Bold"]="Times-Bold";e["TimesNewRomanPS-BoldItalic"]="Times-BoldItalic";e["TimesNewRomanPS-BoldItalicMT"]="Times-BoldItalic";e["TimesNewRomanPS-BoldMT"]="Times-Bold";e["TimesNewRomanPS-Italic"]="Times-Italic";e["TimesNewRomanPS-ItalicMT"]="Times-Italic";e.TimesNewRomanPSMT="Times-Roman";e["TimesNewRomanPSMT-Bold"]="Times-Bold";e["TimesNewRomanPSMT-BoldItalic"]="Times-BoldItalic";e["TimesNewRomanPSMT-Italic"]="Times-Italic"})),Zi=getLookupTableFactory((function(e){e.Courier="FoxitFixed.pfb";e["Courier-Bold"]="FoxitFixedBold.pfb";e["Courier-BoldOblique"]="FoxitFixedBoldItalic.pfb";e["Courier-Oblique"]="FoxitFixedItalic.pfb";e.Helvetica="LiberationSans-Regular.ttf";e["Helvetica-Bold"]="LiberationSans-Bold.ttf";e["Helvetica-BoldOblique"]="LiberationSans-BoldItalic.ttf";e["Helvetica-Oblique"]="LiberationSans-Italic.ttf";e["Times-Roman"]="FoxitSerif.pfb";e["Times-Bold"]="FoxitSerifBold.pfb";e["Times-BoldItalic"]="FoxitSerifBoldItalic.pfb";e["Times-Italic"]="FoxitSerifItalic.pfb";e.Symbol="FoxitSymbol.pfb";e.ZapfDingbats="FoxitDingbats.pfb";e["LiberationSans-Regular"]="LiberationSans-Regular.ttf";e["LiberationSans-Bold"]="LiberationSans-Bold.ttf";e["LiberationSans-Italic"]="LiberationSans-Italic.ttf";e["LiberationSans-BoldItalic"]="LiberationSans-BoldItalic.ttf"})),Vi=getLookupTableFactory((function(e){e.Calibri="Helvetica";e["Calibri-Bold"]="Helvetica-Bold";e["Calibri-BoldItalic"]="Helvetica-BoldOblique";e["Calibri-Italic"]="Helvetica-Oblique";e.CenturyGothic="Helvetica";e["CenturyGothic-Bold"]="Helvetica-Bold";e["CenturyGothic-BoldItalic"]="Helvetica-BoldOblique";e["CenturyGothic-Italic"]="Helvetica-Oblique";e.ComicSansMS="Comic Sans MS";e["ComicSansMS-Bold"]="Comic Sans MS-Bold";e["ComicSansMS-BoldItalic"]="Comic Sans MS-BoldItalic";e["ComicSansMS-Italic"]="Comic Sans MS-Italic";e.GillSansMT="Helvetica";e["GillSansMT-Bold"]="Helvetica-Bold";e["GillSansMT-BoldItalic"]="Helvetica-BoldOblique";e["GillSansMT-Italic"]="Helvetica-Oblique";e.Impact="Helvetica";e["ItcSymbol-Bold"]="Helvetica-Bold";e["ItcSymbol-BoldItalic"]="Helvetica-BoldOblique";e["ItcSymbol-Book"]="Helvetica";e["ItcSymbol-BookItalic"]="Helvetica-Oblique";e["ItcSymbol-Medium"]="Helvetica";e["ItcSymbol-MediumItalic"]="Helvetica-Oblique";e.LucidaConsole="Courier";e["LucidaConsole-Bold"]="Courier-Bold";e["LucidaConsole-BoldItalic"]="Courier-BoldOblique";e["LucidaConsole-Italic"]="Courier-Oblique";e["LucidaSans-Demi"]="Helvetica-Bold";e["MS-Gothic"]="MS Gothic";e["MS-Gothic-Bold"]="MS Gothic-Bold";e["MS-Gothic-BoldItalic"]="MS Gothic-BoldItalic";e["MS-Gothic-Italic"]="MS Gothic-Italic";e["MS-Mincho"]="MS Mincho";e["MS-Mincho-Bold"]="MS Mincho-Bold";e["MS-Mincho-BoldItalic"]="MS Mincho-BoldItalic";e["MS-Mincho-Italic"]="MS Mincho-Italic";e["MS-PGothic"]="MS PGothic";e["MS-PGothic-Bold"]="MS PGothic-Bold";e["MS-PGothic-BoldItalic"]="MS PGothic-BoldItalic";e["MS-PGothic-Italic"]="MS PGothic-Italic";e["MS-PMincho"]="MS PMincho";e["MS-PMincho-Bold"]="MS PMincho-Bold";e["MS-PMincho-BoldItalic"]="MS PMincho-BoldItalic";e["MS-PMincho-Italic"]="MS PMincho-Italic";e.NuptialScript="Times-Italic";e.SegoeUISymbol="Helvetica"})),zi=getLookupTableFactory((function(e){e["Adobe Jenson"]=!0;e["Adobe Text"]=!0;e.Albertus=!0;e.Aldus=!0;e.Alexandria=!0;e.Algerian=!0;e["American Typewriter"]=!0;e.Antiqua=!0;e.Apex=!0;e.Arno=!0;e.Aster=!0;e.Aurora=!0;e.Baskerville=!0;e.Bell=!0;e.Bembo=!0;e["Bembo Schoolbook"]=!0;e.Benguiat=!0;e["Berkeley Old Style"]=!0;e["Bernhard Modern"]=!0;e["Berthold City"]=!0;e.Bodoni=!0;e["Bauer Bodoni"]=!0;e["Book Antiqua"]=!0;e.Bookman=!0;e["Bordeaux Roman"]=!0;e["Californian FB"]=!0;e.Calisto=!0;e.Calvert=!0;e.Capitals=!0;e.Cambria=!0;e.Cartier=!0;e.Caslon=!0;e.Catull=!0;e.Centaur=!0;e["Century Old Style"]=!0;e["Century Schoolbook"]=!0;e.Chaparral=!0;e["Charis SIL"]=!0;e.Cheltenham=!0;e["Cholla Slab"]=!0;e.Clarendon=!0;e.Clearface=!0;e.Cochin=!0;e.Colonna=!0;e["Computer Modern"]=!0;e["Concrete Roman"]=!0;e.Constantia=!0;e["Cooper Black"]=!0;e.Corona=!0;e.Ecotype=!0;e.Egyptienne=!0;e.Elephant=!0;e.Excelsior=!0;e.Fairfield=!0;e["FF Scala"]=!0;e.Folkard=!0;e.Footlight=!0;e.FreeSerif=!0;e["Friz Quadrata"]=!0;e.Garamond=!0;e.Gentium=!0;e.Georgia=!0;e.Gloucester=!0;e["Goudy Old Style"]=!0;e["Goudy Schoolbook"]=!0;e["Goudy Pro Font"]=!0;e.Granjon=!0;e["Guardian Egyptian"]=!0;e.Heather=!0;e.Hercules=!0;e["High Tower Text"]=!0;e.Hiroshige=!0;e["Hoefler Text"]=!0;e["Humana Serif"]=!0;e.Imprint=!0;e["Ionic No. 5"]=!0;e.Janson=!0;e.Joanna=!0;e.Korinna=!0;e.Lexicon=!0;e.LiberationSerif=!0;e["Liberation Serif"]=!0;e["Linux Libertine"]=!0;e.Literaturnaya=!0;e.Lucida=!0;e["Lucida Bright"]=!0;e.Melior=!0;e.Memphis=!0;e.Miller=!0;e.Minion=!0;e.Modern=!0;e["Mona Lisa"]=!0;e["Mrs Eaves"]=!0;e["MS Serif"]=!0;e["Museo Slab"]=!0;e["New York"]=!0;e["Nimbus Roman"]=!0;e["NPS Rawlinson Roadway"]=!0;e.NuptialScript=!0;e.Palatino=!0;e.Perpetua=!0;e.Plantin=!0;e["Plantin Schoolbook"]=!0;e.Playbill=!0;e["Poor Richard"]=!0;e["Rawlinson Roadway"]=!0;e.Renault=!0;e.Requiem=!0;e.Rockwell=!0;e.Roman=!0;e["Rotis Serif"]=!0;e.Sabon=!0;e.Scala=!0;e.Seagull=!0;e.Sistina=!0;e.Souvenir=!0;e.STIX=!0;e["Stone Informal"]=!0;e["Stone Serif"]=!0;e.Sylfaen=!0;e.Times=!0;e.Trajan=!0;e["Trinité"]=!0;e["Trump Mediaeval"]=!0;e.Utopia=!0;e["Vale Type"]=!0;e["Bitstream Vera"]=!0;e["Vera Serif"]=!0;e.Versailles=!0;e.Wanted=!0;e.Weiss=!0;e["Wide Latin"]=!0;e.Windsor=!0;e.XITS=!0})),_i=getLookupTableFactory((function(e){e.Dingbats=!0;e.Symbol=!0;e.ZapfDingbats=!0;e.Wingdings=!0;e["Wingdings-Bold"]=!0;e["Wingdings-Regular"]=!0})),$i=getLookupTableFactory((function(e){e[2]=10;e[3]=32;e[4]=33;e[5]=34;e[6]=35;e[7]=36;e[8]=37;e[9]=38;e[10]=39;e[11]=40;e[12]=41;e[13]=42;e[14]=43;e[15]=44;e[16]=45;e[17]=46;e[18]=47;e[19]=48;e[20]=49;e[21]=50;e[22]=51;e[23]=52;e[24]=53;e[25]=54;e[26]=55;e[27]=56;e[28]=57;e[29]=58;e[30]=894;e[31]=60;e[32]=61;e[33]=62;e[34]=63;e[35]=64;e[36]=65;e[37]=66;e[38]=67;e[39]=68;e[40]=69;e[41]=70;e[42]=71;e[43]=72;e[44]=73;e[45]=74;e[46]=75;e[47]=76;e[48]=77;e[49]=78;e[50]=79;e[51]=80;e[52]=81;e[53]=82;e[54]=83;e[55]=84;e[56]=85;e[57]=86;e[58]=87;e[59]=88;e[60]=89;e[61]=90;e[62]=91;e[63]=92;e[64]=93;e[65]=94;e[66]=95;e[67]=96;e[68]=97;e[69]=98;e[70]=99;e[71]=100;e[72]=101;e[73]=102;e[74]=103;e[75]=104;e[76]=105;e[77]=106;e[78]=107;e[79]=108;e[80]=109;e[81]=110;e[82]=111;e[83]=112;e[84]=113;e[85]=114;e[86]=115;e[87]=116;e[88]=117;e[89]=118;e[90]=119;e[91]=120;e[92]=121;e[93]=122;e[94]=123;e[95]=124;e[96]=125;e[97]=126;e[98]=196;e[99]=197;e[100]=199;e[101]=201;e[102]=209;e[103]=214;e[104]=220;e[105]=225;e[106]=224;e[107]=226;e[108]=228;e[109]=227;e[110]=229;e[111]=231;e[112]=233;e[113]=232;e[114]=234;e[115]=235;e[116]=237;e[117]=236;e[118]=238;e[119]=239;e[120]=241;e[121]=243;e[122]=242;e[123]=244;e[124]=246;e[125]=245;e[126]=250;e[127]=249;e[128]=251;e[129]=252;e[130]=8224;e[131]=176;e[132]=162;e[133]=163;e[134]=167;e[135]=8226;e[136]=182;e[137]=223;e[138]=174;e[139]=169;e[140]=8482;e[141]=180;e[142]=168;e[143]=8800;e[144]=198;e[145]=216;e[146]=8734;e[147]=177;e[148]=8804;e[149]=8805;e[150]=165;e[151]=181;e[152]=8706;e[153]=8721;e[154]=8719;e[156]=8747;e[157]=170;e[158]=186;e[159]=8486;e[160]=230;e[161]=248;e[162]=191;e[163]=161;e[164]=172;e[165]=8730;e[166]=402;e[167]=8776;e[168]=8710;e[169]=171;e[170]=187;e[171]=8230;e[179]=8220;e[180]=8221;e[181]=8216;e[182]=8217;e[200]=193;e[203]=205;e[207]=211;e[210]=218;e[223]=711;e[224]=321;e[225]=322;e[226]=352;e[227]=353;e[228]=381;e[229]=382;e[233]=221;e[234]=253;e[252]=263;e[253]=268;e[254]=269;e[258]=258;e[260]=260;e[261]=261;e[265]=280;e[266]=281;e[267]=282;e[268]=283;e[269]=313;e[275]=323;e[276]=324;e[278]=328;e[283]=344;e[284]=345;e[285]=346;e[286]=347;e[292]=367;e[295]=377;e[296]=378;e[298]=380;e[305]=963;e[306]=964;e[307]=966;e[308]=8215;e[309]=8252;e[310]=8319;e[311]=8359;e[312]=8592;e[313]=8593;e[337]=9552;e[493]=1039;e[494]=1040;e[672]=1488;e[673]=1489;e[674]=1490;e[675]=1491;e[676]=1492;e[677]=1493;e[678]=1494;e[679]=1495;e[680]=1496;e[681]=1497;e[682]=1498;e[683]=1499;e[684]=1500;e[685]=1501;e[686]=1502;e[687]=1503;e[688]=1504;e[689]=1505;e[690]=1506;e[691]=1507;e[692]=1508;e[693]=1509;e[694]=1510;e[695]=1511;e[696]=1512;e[697]=1513;e[698]=1514;e[705]=1524;e[706]=8362;e[710]=64288;e[711]=64298;e[759]=1617;e[761]=1776;e[763]=1778;e[775]=1652;e[777]=1764;e[778]=1780;e[779]=1781;e[780]=1782;e[782]=771;e[783]=64726;e[786]=8363;e[788]=8532;e[790]=768;e[791]=769;e[792]=768;e[795]=803;e[797]=64336;e[798]=64337;e[799]=64342;e[800]=64343;e[801]=64344;e[802]=64345;e[803]=64362;e[804]=64363;e[805]=64364;e[2424]=7821;e[2425]=7822;e[2426]=7823;e[2427]=7824;e[2428]=7825;e[2429]=7826;e[2430]=7827;e[2433]=7682;e[2678]=8045;e[2679]=8046;e[2830]=1552;e[2838]=686;e[2840]=751;e[2842]=753;e[2843]=754;e[2844]=755;e[2846]=757;e[2856]=767;e[2857]=848;e[2858]=849;e[2862]=853;e[2863]=854;e[2864]=855;e[2865]=861;e[2866]=862;e[2906]=7460;e[2908]=7462;e[2909]=7463;e[2910]=7464;e[2912]=7466;e[2913]=7467;e[2914]=7468;e[2916]=7470;e[2917]=7471;e[2918]=7472;e[2920]=7474;e[2921]=7475;e[2922]=7476;e[2924]=7478;e[2925]=7479;e[2926]=7480;e[2928]=7482;e[2929]=7483;e[2930]=7484;e[2932]=7486;e[2933]=7487;e[2934]=7488;e[2936]=7490;e[2937]=7491;e[2938]=7492;e[2940]=7494;e[2941]=7495;e[2942]=7496;e[2944]=7498;e[2946]=7500;e[2948]=7502;e[2950]=7504;e[2951]=7505;e[2952]=7506;e[2954]=7508;e[2955]=7509;e[2956]=7510;e[2958]=7512;e[2959]=7513;e[2960]=7514;e[2962]=7516;e[2963]=7517;e[2964]=7518;e[2966]=7520;e[2967]=7521;e[2968]=7522;e[2970]=7524;e[2971]=7525;e[2972]=7526;e[2974]=7528;e[2975]=7529;e[2976]=7530;e[2978]=1537;e[2979]=1538;e[2980]=1539;e[2982]=1549;e[2983]=1551;e[2984]=1552;e[2986]=1554;e[2987]=1555;e[2988]=1556;e[2990]=1623;e[2991]=1624;e[2995]=1775;e[2999]=1791;e[3002]=64290;e[3003]=64291;e[3004]=64292;e[3006]=64294;e[3007]=64295;e[3008]=64296;e[3011]=1900;e[3014]=8223;e[3015]=8244;e[3017]=7532;e[3018]=7533;e[3019]=7534;e[3075]=7590;e[3076]=7591;e[3079]=7594;e[3080]=7595;e[3083]=7598;e[3084]=7599;e[3087]=7602;e[3088]=7603;e[3091]=7606;e[3092]=7607;e[3095]=7610;e[3096]=7611;e[3099]=7614;e[3100]=7615;e[3103]=7618;e[3104]=7619;e[3107]=8337;e[3108]=8338;e[3116]=1884;e[3119]=1885;e[3120]=1885;e[3123]=1886;e[3124]=1886;e[3127]=1887;e[3128]=1887;e[3131]=1888;e[3132]=1888;e[3135]=1889;e[3136]=1889;e[3139]=1890;e[3140]=1890;e[3143]=1891;e[3144]=1891;e[3147]=1892;e[3148]=1892;e[3153]=580;e[3154]=581;e[3157]=584;e[3158]=585;e[3161]=588;e[3162]=589;e[3165]=891;e[3166]=892;e[3169]=1274;e[3170]=1275;e[3173]=1278;e[3174]=1279;e[3181]=7622;e[3182]=7623;e[3282]=11799;e[3316]=578;e[3379]=42785;e[3393]=1159;e[3416]=8377})),Aa=getLookupTableFactory((function(e){e[227]=322;e[264]=261;e[291]=346})),ea=getLookupTableFactory((function(e){e[1]=32;e[4]=65;e[5]=192;e[6]=193;e[9]=196;e[17]=66;e[18]=67;e[21]=268;e[24]=68;e[28]=69;e[29]=200;e[30]=201;e[32]=282;e[38]=70;e[39]=71;e[44]=72;e[47]=73;e[48]=204;e[49]=205;e[58]=74;e[60]=75;e[62]=76;e[68]=77;e[69]=78;e[75]=79;e[76]=210;e[80]=214;e[87]=80;e[89]=81;e[90]=82;e[92]=344;e[94]=83;e[97]=352;e[100]=84;e[104]=85;e[109]=220;e[115]=86;e[116]=87;e[121]=88;e[122]=89;e[124]=221;e[127]=90;e[129]=381;e[258]=97;e[259]=224;e[260]=225;e[263]=228;e[268]=261;e[271]=98;e[272]=99;e[273]=263;e[275]=269;e[282]=100;e[286]=101;e[287]=232;e[288]=233;e[290]=283;e[295]=281;e[296]=102;e[336]=103;e[346]=104;e[349]=105;e[350]=236;e[351]=237;e[361]=106;e[364]=107;e[367]=108;e[371]=322;e[373]=109;e[374]=110;e[381]=111;e[382]=242;e[383]=243;e[386]=246;e[393]=112;e[395]=113;e[396]=114;e[398]=345;e[400]=115;e[401]=347;e[403]=353;e[410]=116;e[437]=117;e[442]=252;e[448]=118;e[449]=119;e[454]=120;e[455]=121;e[457]=253;e[460]=122;e[462]=382;e[463]=380;e[853]=44;e[855]=58;e[856]=46;e[876]=47;e[878]=45;e[882]=45;e[894]=40;e[895]=41;e[896]=91;e[897]=93;e[923]=64;e[1004]=48;e[1005]=49;e[1006]=50;e[1007]=51;e[1008]=52;e[1009]=53;e[1010]=54;e[1011]=55;e[1012]=56;e[1013]=57;e[1081]=37;e[1085]=43;e[1086]=45}));function getStandardFontName(e){const t=normalizeFontName(e);return Xi()[t]}function isKnownFontName(e){const t=normalizeFontName(e);return!!(Xi()[t]||Vi()[t]||zi()[t]||_i()[t])}class ToUnicodeMap{constructor(e=[]){this._map=e}get length(){return this._map.length}forEach(e){for(const t in this._map)e(t,this._map[t].charCodeAt(0))}has(e){return void 0!==this._map[e]}get(e){return this._map[e]}charCodeOf(e){const t=this._map;if(t.length<=65536)return t.indexOf(e);for(const i in t)if(t[i]===e)return 0|i;return-1}amend(e){for(const t in e)this._map[t]=e[t]}}class IdentityToUnicodeMap{constructor(e,t){this.firstChar=e;this.lastChar=t}get length(){return this.lastChar+1-this.firstChar}forEach(e){for(let t=this.firstChar,i=this.lastChar;t<=i;t++)e(t,t)}has(e){return this.firstChar<=e&&e<=this.lastChar}get(e){if(this.firstChar<=e&&e<=this.lastChar)return String.fromCharCode(e)}charCodeOf(e){return Number.isInteger(e)&&e>=this.firstChar&&e<=this.lastChar?e:-1}amend(e){unreachable("Should not call amend()")}}class CFFFont{constructor(e,t){this.properties=t;const i=new CFFParser(e,t,Ki);this.cff=i.parse();this.cff.duplicateFirstGlyph();const a=new CFFCompiler(this.cff);this.seacs=this.cff.seacs;try{this.data=a.compile()}catch{warn("Failed to compile font "+t.loadedName);this.data=e}this._createBuiltInEncoding()}get numGlyphs(){return this.cff.charStrings.count}getCharset(){return this.cff.charset.charset}getGlyphMapping(){const e=this.cff,t=this.properties,{cidToGidMap:i,cMap:a}=t,s=e.charset.charset;let r,n;if(t.composite){let t,g;if(i?.length>0){t=Object.create(null);for(let e=0,a=i.length;e=0){const a=i[t];a&&(s[e]=a)}}s.length>0&&(this.properties.builtInEncoding=s)}}function getUint32(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function getUint16(e,t){return e[t]<<8|e[t+1]}function getInt16(e,t){return(e[t]<<24|e[t+1]<<16)>>16}function getInt8(e,t){return e[t]<<24>>24}function getFloat214(e,t){return getInt16(e,t)/16384}function getSubroutineBias(e){const t=e.length;let i=32768;t<1240?i=107:t<33900&&(i=1131);return i}function parseCmap(e,t,i){const a=1===getUint16(e,t+2)?getUint32(e,t+8):getUint32(e,t+16),s=getUint16(e,t+a);let r,n,g;if(4===s){getUint16(e,t+a+2);const i=getUint16(e,t+a+6)>>1;n=t+a+14;r=[];for(g=0;g>1;i0;)C.push({flags:r})}for(i=0;i>1;p=!0;break;case 4:n+=s.pop();moveTo(r,n);p=!0;break;case 5:for(;s.length>0;){r+=s.shift();n+=s.shift();lineTo(r,n)}break;case 6:for(;s.length>0;){r+=s.shift();lineTo(r,n);if(0===s.length)break;n+=s.shift();lineTo(r,n)}break;case 7:for(;s.length>0;){n+=s.shift();lineTo(r,n);if(0===s.length)break;r+=s.shift();lineTo(r,n)}break;case 8:for(;s.length>0;){c=r+s.shift();h=n+s.shift();C=c+s.shift();l=h+s.shift();r=C+s.shift();n=l+s.shift();bezierCurveTo(c,h,C,l,r,n)}break;case 10:d=s.pop();f=null;if(i.isCFFCIDFont){const e=i.fdSelect.getFDIndex(a);if(e>=0&&eMath.abs(n-t)?r+=s.shift():n+=s.shift();bezierCurveTo(c,h,C,l,r,n);break;default:throw new FormatError(`unknown operator: 12 ${m}`)}break;case 14:if(s.length>=4){const e=s.pop(),a=s.pop();n=s.pop();r=s.pop();t.add(ut);t.add(pt,[r,n]);let g=lookupCmap(i.cmap,String.fromCharCode(i.glyphNameMap[mi[e]]));compileCharString(i.glyphs[g.glyphId],t,i,g.glyphId);t.add(Et);g=lookupCmap(i.cmap,String.fromCharCode(i.glyphNameMap[mi[a]]));compileCharString(i.glyphs[g.glyphId],t,i,g.glyphId)}return;case 19:case 20:g+=s.length>>1;o+=g+7>>3;p=!0;break;case 21:n+=s.pop();r+=s.pop();moveTo(r,n);p=!0;break;case 22:r+=s.pop();moveTo(r,n);p=!0;break;case 24:for(;s.length>2;){c=r+s.shift();h=n+s.shift();C=c+s.shift();l=h+s.shift();r=C+s.shift();n=l+s.shift();bezierCurveTo(c,h,C,l,r,n)}r+=s.shift();n+=s.shift();lineTo(r,n);break;case 25:for(;s.length>6;){r+=s.shift();n+=s.shift();lineTo(r,n)}c=r+s.shift();h=n+s.shift();C=c+s.shift();l=h+s.shift();r=C+s.shift();n=l+s.shift();bezierCurveTo(c,h,C,l,r,n);break;case 26:s.length%2&&(r+=s.shift());for(;s.length>0;){c=r;h=n+s.shift();C=c+s.shift();l=h+s.shift();r=C;n=l+s.shift();bezierCurveTo(c,h,C,l,r,n)}break;case 27:s.length%2&&(n+=s.shift());for(;s.length>0;){c=r+s.shift();h=n;C=c+s.shift();l=h+s.shift();r=C+s.shift();n=l;bezierCurveTo(c,h,C,l,r,n)}break;case 28:s.push((e[o]<<24|e[o+1]<<16)>>16);o+=2;break;case 29:d=s.pop()+i.gsubrsBias;f=i.gsubrs[d];f&&parse(f);break;case 30:for(;s.length>0;){c=r;h=n+s.shift();C=c+s.shift();l=h+s.shift();r=C+s.shift();n=l+(1===s.length?s.shift():0);bezierCurveTo(c,h,C,l,r,n);if(0===s.length)break;c=r+s.shift();h=n;C=c+s.shift();l=h+s.shift();n=l+s.shift();r=C+(1===s.length?s.shift():0);bezierCurveTo(c,h,C,l,r,n)}break;case 31:for(;s.length>0;){c=r+s.shift();h=n;C=c+s.shift();l=h+s.shift();n=l+s.shift();r=C+(1===s.length?s.shift():0);bezierCurveTo(c,h,C,l,r,n);if(0===s.length)break;c=r;h=n+s.shift();C=c+s.shift();l=h+s.shift();r=C+s.shift();n=l+(1===s.length?s.shift():0);bezierCurveTo(c,h,C,l,r,n)}break;default:if(m<32)throw new FormatError(`unknown operator: ${m}`);if(m<247)s.push(m-139);else if(m<251)s.push(256*(m-247)+e[o++]+108);else if(m<255)s.push(256*-(m-251)-e[o++]-108);else{s.push((e[o]<<24|e[o+1]<<16|e[o+2]<<8|e[o+3])/65536);o+=4}}p&&(s.length=0)}}(e)}const ta=[];class Commands{cmds=[];add(e,t){if(t)if(isNumberArray(t,null))this.cmds.push(e,...t);else{warn(`Commands.add - "${e}" has at least one non-number arg: "${t}".`);const i=t.map((e=>"number"==typeof e?e:0));this.cmds.push(e,...i)}else this.cmds.push(e)}}class CompiledFont{constructor(e){this.fontMatrix=e;this.compiledGlyphs=Object.create(null);this.compiledCharCodeToGlyphId=Object.create(null)}getPathJs(e){const{charCode:t,glyphId:i}=lookupCmap(this.cmap,e);let a,s=this.compiledGlyphs[i];if(!s){try{s=this.compileGlyph(this.glyphs[i],i)}catch(e){s=ta;a=e}this.compiledGlyphs[i]=s}this.compiledCharCodeToGlyphId[t]??=i;if(a)throw a;return s}compileGlyph(e,t){if(!e||0===e.length||14===e[0])return ta;let i=this.fontMatrix;if(this.isCFFCIDFont){const e=this.fdSelect.getFDIndex(t);if(e>=0&&e2*getUint16(e,t)}const r=[];let n=s(t,0);for(let i=a;ie+(t.getSize()+3&-4)),0)}write(){const e=this.getSize(),t=new DataView(new ArrayBuffer(e)),i=e>131070,a=i?4:2,s=new DataView(new ArrayBuffer((this.glyphs.length+1)*a));i?s.setUint32(0,0):s.setUint16(0,0);let r=0,n=0;for(const e of this.glyphs){r+=e.write(r,t);r=r+3&-4;n+=a;i?s.setUint32(n,r):s.setUint16(n,r>>1)}return{isLocationLong:i,loca:new Uint8Array(s.buffer),glyf:new Uint8Array(t.buffer)}}scale(e){for(let t=0,i=this.glyphs.length;te+t.getSize()),0);return this.header.getSize()+e}write(e,t){if(!this.header)return 0;const i=e;e+=this.header.write(e,t);if(this.simple)e+=this.simple.write(e,t);else for(const i of this.composites)e+=i.write(e,t);return e-i}scale(e){if(!this.header)return;const t=(this.header.xMin+this.header.xMax)/2;this.header.scale(t,e);if(this.simple)this.simple.scale(t,e);else for(const i of this.composites)i.scale(t,e)}}class GlyphHeader{constructor({numberOfContours:e,xMin:t,yMin:i,xMax:a,yMax:s}){this.numberOfContours=e;this.xMin=t;this.yMin=i;this.xMax=a;this.yMax=s}static parse(e,t){return[10,new GlyphHeader({numberOfContours:t.getInt16(e),xMin:t.getInt16(e+2),yMin:t.getInt16(e+4),xMax:t.getInt16(e+6),yMax:t.getInt16(e+8)})]}getSize(){return 10}write(e,t){t.setInt16(e,this.numberOfContours);t.setInt16(e+2,this.xMin);t.setInt16(e+4,this.yMin);t.setInt16(e+6,this.xMax);t.setInt16(e+8,this.yMax);return 10}scale(e,t){this.xMin=Math.round(e+(this.xMin-e)*t);this.xMax=Math.round(e+(this.xMax-e)*t)}}class Contour{constructor({flags:e,xCoordinates:t,yCoordinates:i}){this.xCoordinates=t;this.yCoordinates=i;this.flags=e}}class SimpleGlyph{constructor({contours:e,instructions:t}){this.contours=e;this.instructions=t}static parse(e,t,i){const a=[];for(let s=0;s255?e+=2:g>0&&(e+=1);t=r;g=Math.abs(n-i);g>255?e+=2:g>0&&(e+=1);i=n}}return e}write(e,t){const i=e,a=[],s=[],r=[];let n=0,g=0;for(const i of this.contours){for(let e=0,t=i.xCoordinates.length;e=0?18:2;a.push(e)}else a.push(c)}n=o;const C=i.yCoordinates[e];c=C-g;if(0===c){t|=32;s.push(0)}else{const e=Math.abs(c);if(e<=255){t|=c>=0?36:4;s.push(e)}else s.push(c)}g=C;r.push(t)}t.setUint16(e,a.length-1);e+=2}t.setUint16(e,this.instructions.length);e+=2;if(this.instructions.length){new Uint8Array(t.buffer,0,t.buffer.byteLength).set(this.instructions,e);e+=this.instructions.length}for(const i of r)t.setUint8(e++,i);for(let i=0,s=a.length;i=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(e+=2):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(e+=2);return e}write(e,t){const i=e;2&this.flags?this.argument1>=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(this.flags|=1):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(this.flags|=1);t.setUint16(e,this.flags);t.setUint16(e+2,this.glyphIndex);e+=4;if(1&this.flags){if(2&this.flags){t.setInt16(e,this.argument1);t.setInt16(e+2,this.argument2)}else{t.setUint16(e,this.argument1);t.setUint16(e+2,this.argument2)}e+=4}else{t.setUint8(e,this.argument1);t.setUint8(e+1,this.argument2);e+=2}if(256&this.flags){t.setUint16(e,this.instructions.length);e+=2;if(this.instructions.length){new Uint8Array(t.buffer,0,t.buffer.byteLength).set(this.instructions,e);e+=this.instructions.length}}return e-i}scale(e,t){}}function writeInt16(e,t,i){e[t]=i>>8&255;e[t+1]=255&i}function writeInt32(e,t,i){e[t]=i>>24&255;e[t+1]=i>>16&255;e[t+2]=i>>8&255;e[t+3]=255&i}function writeData(e,t,i){if(i instanceof Uint8Array)e.set(i,t);else if("string"==typeof i)for(let a=0,s=i.length;ai;){i<<=1;a++}const s=i*t;return{range:s,entry:a,rangeShift:t*e-s}}toArray(){let e=this.sfnt;const t=this.tables,i=Object.keys(t);i.sort();const a=i.length;let s,r,n,g,o,c=12+16*a;const C=[c];for(s=0;s>>0;C.push(c)}const h=new Uint8Array(c);for(s=0;s>>0}writeInt32(h,c+4,e);writeInt32(h,c+8,C[s]);writeInt32(h,c+12,t[o].length);c+=16}return h}addTable(e,t){if(e in this.tables)throw new Error("Table "+e+" already exists");this.tables[e]=t}}const sa=[4],ra=[5],na=[6],ga=[7],oa=[8],Ia=[12,35],ca=[14],Ca=[21],ha=[22],la=[30],Ba=[31];class Type1CharString{constructor(){this.width=0;this.lsb=0;this.flexing=!1;this.output=[];this.stack=[]}convert(e,t,i){const a=e.length;let s,r,n,g=!1;for(let o=0;oa)return!0;const s=a-e;for(let e=s;e>8&255,255&t);else{t=65536*t|0;this.output.push(255,t>>24&255,t>>16&255,t>>8&255,255&t)}}this.output.push(...t);i?this.stack.splice(s,e):this.stack.length=0;return!1}}function isHexDigit(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function decrypt(e,t,i){if(i>=e.length)return new Uint8Array(0);let a,s,r=0|t;for(a=0;a>8;r=52845*(t+r)+22719&65535}return g}function isSpecial(e){return 47===e||91===e||93===e||123===e||125===e||40===e||41===e}class Type1Parser{constructor(e,t,i){if(t){const t=e.getBytes(),i=!((isHexDigit(t[0])||isWhiteSpace(t[0]))&&isHexDigit(t[1])&&isHexDigit(t[2])&&isHexDigit(t[3])&&isHexDigit(t[4])&&isHexDigit(t[5])&&isHexDigit(t[6])&&isHexDigit(t[7]));e=new Stream(i?decrypt(t,55665,4):function decryptAscii(e,t,i){let a=0|t;const s=e.length,r=new Uint8Array(s>>>1);let n,g;for(n=0,g=0;n>8;a=52845*(e+a)+22719&65535}}return r.slice(i,g)}(t,55665,4))}this.seacAnalysisEnabled=!!i;this.stream=e;this.nextChar()}readNumberArray(){this.getToken();const e=[];for(;;){const t=this.getToken();if(null===t||"]"===t||"}"===t)break;e.push(parseFloat(t||0))}return e}readNumber(){const e=this.getToken();return parseFloat(e||0)}readInt(){const e=this.getToken();return 0|parseInt(e||0,10)}readBoolean(){return"true"===this.getToken()?1:0}nextChar(){return this.currentChar=this.stream.getByte()}prevChar(){this.stream.skip(-2);return this.currentChar=this.stream.getByte()}getToken(){let e=!1,t=this.currentChar;for(;;){if(-1===t)return null;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(!isWhiteSpace(t))break;t=this.nextChar()}if(isSpecial(t)){this.nextChar();return String.fromCharCode(t)}let i="";do{i+=String.fromCharCode(t);t=this.nextChar()}while(t>=0&&!isWhiteSpace(t)&&!isSpecial(t));return i}readCharStrings(e,t){return-1===t?e:decrypt(e,4330,t)}extractFontProgram(e){const t=this.stream,i=[],a=[],s=Object.create(null);s.lenIV=4;const r={subrs:[],charstrings:[],properties:{privateData:s}};let n,g,o,c;for(;null!==(n=this.getToken());)if("/"===n){n=this.getToken();switch(n){case"CharStrings":this.getToken();this.getToken();this.getToken();this.getToken();for(;;){n=this.getToken();if(null===n||"end"===n)break;if("/"!==n)continue;const e=this.getToken();g=this.readInt();this.getToken();o=g>0?t.getBytes(g):new Uint8Array(0);c=r.properties.privateData.lenIV;const i=this.readCharStrings(o,c);this.nextChar();n=this.getToken();"noaccess"===n?this.getToken():"/"===n&&this.prevChar();a.push({glyph:e,encoded:i})}break;case"Subrs":this.readInt();this.getToken();for(;"dup"===this.getToken();){const e=this.readInt();g=this.readInt();this.getToken();o=g>0?t.getBytes(g):new Uint8Array(0);c=r.properties.privateData.lenIV;const a=this.readCharStrings(o,c);this.nextChar();n=this.getToken();"noaccess"===n&&this.getToken();i[e]=a}break;case"BlueValues":case"OtherBlues":case"FamilyBlues":case"FamilyOtherBlues":const e=this.readNumberArray();e.length>0&&e.length,0;break;case"StemSnapH":case"StemSnapV":r.properties.privateData[n]=this.readNumberArray();break;case"StdHW":case"StdVW":r.properties.privateData[n]=this.readNumberArray()[0];break;case"BlueShift":case"lenIV":case"BlueFuzz":case"BlueScale":case"LanguageGroup":r.properties.privateData[n]=this.readNumber();break;case"ExpansionFactor":r.properties.privateData[n]=this.readNumber()||.06;break;case"ForceBold":r.properties.privateData[n]=this.readBoolean()}}for(const{encoded:t,glyph:s}of a){const a=new Type1CharString,n=a.convert(t,i,this.seacAnalysisEnabled);let g=a.output;n&&(g=[14]);const o={glyphName:s,charstring:g,width:a.width,lsb:a.lsb,seac:a.seac};".notdef"===s?r.charstrings.unshift(o):r.charstrings.push(o);if(e.builtInEncoding){const t=e.builtInEncoding.indexOf(s);t>-1&&void 0===e.widths[t]&&t>=e.firstChar&&t<=e.lastChar&&(e.widths[t]=a.width)}}return r}extractFontHeader(e){let t;for(;null!==(t=this.getToken());)if("/"===t){t=this.getToken();switch(t){case"FontMatrix":const i=this.readNumberArray();e.fontMatrix=i;break;case"Encoding":const a=this.getToken();let s;if(/^\d+$/.test(a)){s=[];const e=0|parseInt(a,10);this.getToken();for(let i=0;i=s){n+=i;for(;n=0&&(a[e]=s)}}return type1FontGlyphMapping(e,a,i)}hasGlyphId(e){if(e<0||e>=this.numGlyphs)return!1;if(0===e)return!0;return this.charstrings[e-1].charstring.length>0}getSeacs(e){const t=[];for(let i=0,a=e.length;i0;e--)t[e]-=t[e-1];Q.setByName(e,t)}r.topDict.privateDict=Q;const u=new CFFIndex;for(C=0,h=a.length;C0&&e.toUnicode.amend(t)}class fonts_Glyph{constructor(e,t,i,a,s,r,n,g,o){this.originalCharCode=e;this.fontChar=t;this.unicode=i;this.accent=a;this.width=s;this.vmetric=r;this.operatorListId=n;this.isSpace=g;this.isInFont=o}get category(){return shadow(this,"category",function getCharUnicodeCategory(e){const t=vi.get(e);if(t)return t;const i=e.match(Yi),a={isWhitespace:!!i?.[1],isZeroWidthDiacritic:!!i?.[2],isInvisibleFormatMark:!!i?.[3]};vi.set(e,a);return a}(this.unicode),!0)}}function int16(e,t){return(e<<8)+t}function writeSignedInt16(e,t,i){e[t+1]=i;e[t]=i>>>8}function signedInt16(e,t){const i=(e<<8)+t;return 32768&i?i-65536:i}function string16(e){return String.fromCharCode(e>>8&255,255&e)}function safeString16(e){e>32767?e=32767:e<-32768&&(e=-32768);return String.fromCharCode(e>>8&255,255&e)}function isTrueTypeCollectionFile(e){return"ttcf"===bytesToString(e.peekBytes(4))}function getFontFileType(e,{type:t,subtype:i,composite:a}){let s,r;if(function isTrueTypeFile(e){const t=e.peekBytes(4);return 65536===readUint32(t,0)||"true"===bytesToString(t)}(e)||isTrueTypeCollectionFile(e))s=a?"CIDFontType2":"TrueType";else if(function isOpenTypeFile(e){return"OTTO"===bytesToString(e.peekBytes(4))}(e))s=a?"CIDFontType2":"OpenType";else if(function isType1File(e){const t=e.peekBytes(2);return 37===t[0]&&33===t[1]||128===t[0]&&1===t[1]}(e))s=a?"CIDFontType0":"MMType1"===t?"MMType1":"Type1";else if(function isCFFFile(e){const t=e.peekBytes(4);return t[0]>=1&&t[3]>=1&&t[3]<=4}(e))if(a){s="CIDFontType0";r="CIDFontType0C"}else{s="MMType1"===t?"MMType1":"Type1";r="Type1C"}else{warn("getFontFileType: Unable to detect correct font file Type/Subtype.");s=t;r=i}return[s,r]}function applyStandardFontGlyphMap(e,t){for(const i in t)e[+i]=t[i]}function buildToFontChar(e,t,i){const a=[];let s;for(let i=0,r=e.length;iC){o++;if(o>=Qa.length){warn("Ran out of space in font private use area.");break}c=Qa[o][0];C=Qa[o][1]}const E=c++;0===Q&&(Q=i);let u=a.get(l);"string"==typeof u&&(u=u.codePointAt(0));if(u&&!(h=u,Qa[0][0]<=h&&h<=Qa[0][1]||Qa[1][0]<=h&&h<=Qa[1][1])&&!g.has(Q)){r.set(u,Q);g.add(Q)}s[E]=Q;n[l]=E}var h;return{toFontChar:n,charCodeToGlyphId:s,toUnicodeExtraMap:r,nextAvailableFontCharCode:c}}function createCmapTable(e,t,i){const a=function getRanges(e,t,i){const a=[];for(const t in e)e[t]>=i||a.push({fontCharCode:0|t,glyphId:e[t]});if(t)for(const[e,s]of t)s>=i||a.push({fontCharCode:e,glyphId:s});0===a.length&&a.push({fontCharCode:0,glyphId:0});a.sort((function fontGetRangesSort(e,t){return e.fontCharCode-t.fontCharCode}));const s=[],r=a.length;for(let e=0;e65535?2:1;let r,n,g,o,c="\0\0"+string16(s)+"\0\0"+string32(4+8*s);for(r=a.length-1;r>=0&&!(a[r][0]<=65535);--r);const C=r+1;a[r][0]<65535&&65535===a[r][1]&&(a[r][1]=65534);const h=a[r][1]<65535?1:0,l=C+h,Q=OpenTypeFileBuilder.getSearchParams(l,2);let E,u,d,f,p="",m="",y="",w="",D="",b=0;for(r=0,n=C;r0){m+="ÿÿ";p+="ÿÿ";y+="\0";w+="\0\0"}const F="\0\0"+string16(2*l)+string16(Q.range)+string16(Q.entry)+string16(Q.rangeShift)+m+"\0\0"+p+y+w+D;let S="",k="";if(s>1){c+="\0\0\n"+string32(4+8*s+4+F.length);S="";for(r=0,n=a.length;re||!g)&&(g=e);o 123 are reserved for internal usage");n|=1<65535&&(o=65535)}else{g=0;o=255}const C=e.bbox||[0,0,0,0],h=i.unitsPerEm||(e.fontMatrix?1/Math.max(...e.fontMatrix.slice(0,4).map(Math.abs)):1e3),l=e.ascentScaled?1:h/Ea,Q=i.ascent||Math.round(l*(e.ascent||C[3]));let E=i.descent||Math.round(l*(e.descent||C[1]));E>0&&e.descent>0&&C[1]<0&&(E=-E);const u=i.yMax||Q,d=-i.yMin||-E;return"\0$ô\0\0\0Š»\0\0\0ŒŠ»\0\0ß\x001\0\0\0\0"+String.fromCharCode(e.fixedPitch?9:0)+"\0\0\0\0\0\0"+string32(a)+string32(s)+string32(r)+string32(n)+"*21*"+string16(e.italicAngle?1:0)+string16(g||e.firstChar)+string16(o||e.lastChar)+string16(Q)+string16(E)+"\0d"+string16(u)+string16(d)+"\0\0\0\0\0\0\0\0"+string16(e.xHeight)+string16(e.capHeight)+string16(0)+string16(g||e.firstChar)+"\0"}function createPostTable(e){return"\0\0\0"+string32(Math.floor(65536*e.italicAngle))+"\0\0\0\0"+string32(e.fixedPitch?1:0)+"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}function createPostscriptName(e){return e.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g,"").slice(0,63)}function createNameTable(e,t){t||(t=[[],[]]);const i=[t[0][0]||"Original licence",t[0][1]||e,t[0][2]||"Unknown",t[0][3]||"uniqueID",t[0][4]||e,t[0][5]||"Version 0.11",t[0][6]||createPostscriptName(e),t[0][7]||"Unknown",t[0][8]||"Unknown",t[0][9]||"Unknown"],a=[];let s,r,n,g,o;for(s=0,r=i.length;s0;if((n||g)&&"CIDFontType2"===i&&this.cidEncoding.startsWith("Identity-")){const i=e.cidToGidMap,a=[];applyStandardFontGlyphMap(a,$i());/Arial-?Black/i.test(t)?applyStandardFontGlyphMap(a,Aa()):/Calibri/i.test(t)&&applyStandardFontGlyphMap(a,ea());if(i){for(const e in a){const t=a[e];void 0!==i[t]&&(a[+e]=i[t])}i.length!==this.toUnicode.length&&e.hasIncludedToUnicodeMap&&this.toUnicode instanceof IdentityToUnicodeMap&&this.toUnicode.forEach((function(e,t){const s=a[e];void 0===i[s]&&(a[+e]=t)}))}this.toUnicode instanceof IdentityToUnicodeMap||this.toUnicode.forEach((function(e,t){a[+e]=t}));this.toFontChar=a;this.toUnicode=new ToUnicodeMap(a)}else if(/Symbol/i.test(a))this.toFontChar=buildToFontChar(wi,xi(),this.differences);else if(/Dingbats/i.test(a))this.toFontChar=buildToFontChar(Di,Mi(),this.differences);else if(n||g){const e=buildToFontChar(this.defaultEncoding,xi(),this.differences);"CIDFontType2"!==i||this.cidEncoding.startsWith("Identity-")||this.toUnicode instanceof IdentityToUnicodeMap||this.toUnicode.forEach((function(t,i){e[+t]=i}));this.toFontChar=e}else{const e=xi(),i=[];this.toUnicode.forEach(((t,a)=>{if(!this.composite){const i=getUnicodeForGlyph(this.differences[t]||this.defaultEncoding[t],e);-1!==i&&(a=i)}i[+t]=a}));this.composite&&this.toUnicode instanceof IdentityToUnicodeMap&&/Tahoma|Verdana/i.test(t)&&applyStandardFontGlyphMap(i,$i());this.toFontChar=i}amendFallbackToUnicode(e);this.loadedName=a.split("-",1)[0]}checkAndRepair(e,t,i){const a=["OS/2","cmap","head","hhea","hmtx","maxp","name","post","loca","glyf","fpgm","prep","cvt ","CFF "];function readTables(e,t){const i=Object.create(null);i["OS/2"]=null;i.cmap=null;i.head=null;i.hhea=null;i.hmtx=null;i.maxp=null;i.name=null;i.post=null;for(let s=0;s>>0,a=e.getInt32()>>>0,s=e.getInt32()>>>0,r=e.pos;e.pos=e.start||0;e.skip(a);const n=e.getBytes(s);e.pos=r;if("head"===t){n[8]=n[9]=n[10]=n[11]=0;n[17]|=32}return{tag:t,checksum:i,length:s,offset:a,data:n}}function readOpenTypeHeader(e){return{version:e.getString(4),numTables:e.getUint16(),searchRange:e.getUint16(),entrySelector:e.getUint16(),rangeShift:e.getUint16()}}function sanitizeGlyph(e,t,i,a,s,r){const n={length:0,sizeOfInstructions:0};if(t<0||t>=e.length||i>e.length||i-t<=12)return n;const g=e.subarray(t,i),o=signedInt16(g[2],g[3]),c=signedInt16(g[4],g[5]),C=signedInt16(g[6],g[7]),h=signedInt16(g[8],g[9]);if(o>C){writeSignedInt16(g,2,C);writeSignedInt16(g,6,o)}if(c>h){writeSignedInt16(g,4,h);writeSignedInt16(g,8,c)}const l=signedInt16(g[0],g[1]);if(l<0){if(l<-1)return n;a.set(g,s);n.length=g.length;return n}let Q,E=10,u=0;for(Q=0;Qg.length)return n;if(!r&&f>0){a.set(g.subarray(0,d),s);a.set([0,0],s+d);a.set(g.subarray(p,y),s+d+2);y-=f;g.length-y>3&&(y=y+3&-4);n.length=y;return n}if(g.length-y>3){y=y+3&-4;a.set(g.subarray(0,y),s);n.length=y;return n}a.set(g,s);n.length=g.length;return n}function readNameTable(e){const i=(t.start||0)+e.offset;t.pos=i;const a=[[],[]],s=[],r=e.length,n=i+r;if(0!==t.getUint16()||r<6)return[a,s];const g=t.getUint16(),o=t.getUint16();let c,C;for(c=0;cn)continue;t.pos=r;const g=e.name;if(e.encoding){let i="";for(let a=0,s=e.length;a0&&(c+=e-1)}}else{if(d||p){warn("TT: nested FDEFs not allowed");u=!0}d=!0;h=c;n=l.pop();t.functionsDefined[n]={data:o,i:c}}else if(!d&&!p){n=l.at(-1);if(isNaN(n))info("TT: CALL empty stack (or invalid entry).");else{t.functionsUsed[n]=!0;if(n in t.functionsStackDeltas){const e=l.length+t.functionsStackDeltas[n];if(e<0){warn("TT: CALL invalid functions stack delta.");t.hintsValid=!1;return}l.length=e}else if(n in t.functionsDefined&&!E.includes(n)){Q.push({data:o,i:c,stackTop:l.length-1});E.push(n);g=t.functionsDefined[n];if(!g){warn("TT: CALL non-existent function");t.hintsValid=!1;return}o=g.data;c=g.i}}}if(!d&&!p){let t=0;e<=142?t=s[e]:e>=192&&e<=223?t=-1:e>=224&&(t=-2);if(e>=113&&e<=117){a=l.pop();isNaN(a)||(t=2*-a)}for(;t<0&&l.length>0;){l.pop();t++}for(;t>0;){l.push(NaN);t--}}}t.tooComplexToFollowFunctions=u;const m=[o];c>o.length&&m.push(new Uint8Array(c-o.length));if(h>C){warn("TT: complementing a missing function tail");m.push(new Uint8Array([34,45]))}!function foldTTTable(e,t){if(t.length>1){let i,a,s=0;for(i=0,a=t.length;i>>0,r=[];for(let t=0;t>>0);const n={ttcTag:t,majorVersion:i,minorVersion:a,numFonts:s,offsetTable:r};switch(i){case 1:return n;case 2:n.dsigTag=e.getInt32()>>>0;n.dsigLength=e.getInt32()>>>0;n.dsigOffset=e.getInt32()>>>0;return n}throw new FormatError(`Invalid TrueType Collection majorVersion: ${i}.`)}(e),s=t.split("+");let r;for(let n=0;n0||!(i.cMap instanceof IdentityCMap));if("OTTO"===r.version&&!t||!n.head||!n.hhea||!n.maxp||!n.post){o=new Stream(n["CFF "].data);g=new CFFFont(o,i);adjustWidths(i);return this.convert(e,g,i)}delete n.glyf;delete n.loca;delete n.fpgm;delete n.prep;delete n["cvt "];this.isOpenType=!0}if(!n.maxp)throw new FormatError('Required "maxp" table is not found');t.pos=(t.start||0)+n.maxp.offset;let C=t.getInt32();const h=t.getUint16();if(65536!==C&&20480!==C){if(6===n.maxp.length)C=20480;else{if(!(n.maxp.length>=32))throw new FormatError('"maxp" table has a wrong version number');C=65536}!function writeUint32(e,t,i){e[t+3]=255&i;e[t+2]=i>>>8;e[t+1]=i>>>16;e[t]=i>>>24}(n.maxp.data,0,C)}if(i.scaleFactors?.length===h&&c){const{scaleFactors:e}=i,t=int16(n.head.data[50],n.head.data[51]),a=new GlyfTable({glyfTable:n.glyf.data,isGlyphLocationsLong:t,locaTable:n.loca.data,numGlyphs:h});a.scale(e);const{glyf:s,loca:r,isLocationLong:g}=a.write();n.glyf.data=s;n.loca.data=r;if(g!==!!t){n.head.data[50]=0;n.head.data[51]=g?1:0}const o=n.hmtx.data;for(let t=0;t>8&255;o[i+1]=255&a;writeSignedInt16(o,i+2,Math.round(e[t]*signedInt16(o[i+2],o[i+3])))}}let l=h+1,Q=!0;if(l>65535){Q=!1;l=h;warn("Not enough space in glyfs to duplicate first glyph.")}let E=0,u=0;if(C>=65536&&n.maxp.length>=32){t.pos+=8;if(t.getUint16()>2){n.maxp.data[14]=0;n.maxp.data[15]=2}t.pos+=4;E=t.getUint16();t.pos+=4;u=t.getUint16()}n.maxp.data[4]=l>>8;n.maxp.data[5]=255&l;const d=function sanitizeTTPrograms(e,t,i,a){const s={functionsDefined:[],functionsUsed:[],functionsStackDeltas:[],tooComplexToFollowFunctions:!1,hintsValid:!0};e&&sanitizeTTProgram(e,s);t&&sanitizeTTProgram(t,s);e&&function checkInvalidFunctions(e,t){if(!e.tooComplexToFollowFunctions)if(e.functionsDefined.length>t){warn("TT: more functions defined than expected");e.hintsValid=!1}else for(let i=0,a=e.functionsUsed.length;it){warn("TT: invalid function id: "+i);e.hintsValid=!1;return}if(e.functionsUsed[i]&&!e.functionsDefined[i]){warn("TT: undefined function: "+i);e.hintsValid=!1;return}}}(s,a);if(i&&1&i.length){const e=new Uint8Array(i.length+1);e.set(i.data);i.data=e}return s.hintsValid}(n.fpgm,n.prep,n["cvt "],E);if(!d){delete n.fpgm;delete n.prep;delete n["cvt "]}!function sanitizeMetrics(e,t,i,a,s,r){if(!t){i&&(i.data=null);return}e.pos=(e.start||0)+t.offset;e.pos+=4;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;e.pos+=2;const n=e.getUint16();e.pos+=8;e.pos+=2;let g=e.getUint16();if(0!==n){if(!(2&int16(a.data[44],a.data[45]))){t.data[22]=0;t.data[23]=0}}if(g>s){info(`The numOfMetrics (${g}) should not be greater than the numGlyphs (${s}).`);g=s;t.data[34]=(65280&g)>>8;t.data[35]=255&g}const o=s-g-(i.length-4*g>>1);if(o>0){const e=new Uint8Array(i.length+2*o);e.set(i.data);if(r){e[i.length]=i.data[2];e[i.length+1]=i.data[3]}i.data=e}}(t,n.hhea,n.hmtx,n.head,l,Q);if(!n.head)throw new FormatError('Required "head" table is not found');!function sanitizeHead(e,t,i){const a=e.data,s=function int32(e,t,i,a){return(e<<24)+(t<<16)+(i<<8)+a}(a[0],a[1],a[2],a[3]);if(s>>16!=1){info("Attempting to fix invalid version in head table: "+s);a[0]=0;a[1]=1;a[2]=0;a[3]=0}const r=int16(a[50],a[51]);if(r<0||r>1){info("Attempting to fix invalid indexToLocFormat in head table: "+r);const e=t+1;if(i===e<<1){a[50]=0;a[51]=0}else{if(i!==e<<2)throw new FormatError("Could not fix indexToLocFormat: "+r);a[50]=0;a[51]=1}}}(n.head,h,c?n.loca.length:0);let f=Object.create(null);if(c){const e=int16(n.head.data[50],n.head.data[51]),t=function sanitizeGlyphLocations(e,t,i,a,s,r,n){let g,o,c;if(a){g=4;o=function fontItemDecodeLong(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]};c=function fontItemEncodeLong(e,t,i){e[t]=i>>>24&255;e[t+1]=i>>16&255;e[t+2]=i>>8&255;e[t+3]=255&i}}else{g=2;o=function fontItemDecode(e,t){return e[t]<<9|e[t+1]<<1};c=function fontItemEncode(e,t,i){e[t]=i>>9&255;e[t+1]=i>>1&255}}const C=r?i+1:i,h=g*(1+C),l=new Uint8Array(h);l.set(e.data.subarray(0,h));e.data=l;const Q=t.data,E=Q.length,u=new Uint8Array(E);let d,f;const p=[];for(d=0,f=0;dE&&(e=E);p.push({index:d,offset:e,endOffset:0})}p.sort(((e,t)=>e.offset-t.offset));for(d=0;de.index-t.index));for(d=0;dn&&(n=e.sizeOfInstructions);w+=t;c(l,f,w)}if(0===w){const e=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]);for(d=0,f=g;di+w)t.data=u.subarray(0,i+w);else{t.data=new Uint8Array(i+w);t.data.set(u.subarray(0,w))}t.data.set(u.subarray(0,i),w);c(e.data,l.length-g,w+i)}else t.data=u.subarray(0,w);return{missingGlyphs:y,maxSizeOfInstructions:n}}(n.loca,n.glyf,h,e,d,Q,u);f=t.missingGlyphs;if(C>=65536&&n.maxp.length>=32){n.maxp.data[26]=t.maxSizeOfInstructions>>8;n.maxp.data[27]=255&t.maxSizeOfInstructions}}if(!n.hhea)throw new FormatError('Required "hhea" table is not found');if(0===n.hhea.data[10]&&0===n.hhea.data[11]){n.hhea.data[10]=255;n.hhea.data[11]=255}const p={unitsPerEm:int16(n.head.data[18],n.head.data[19]),yMax:signedInt16(n.head.data[42],n.head.data[43]),yMin:signedInt16(n.head.data[38],n.head.data[39]),ascent:signedInt16(n.hhea.data[4],n.hhea.data[5]),descent:signedInt16(n.hhea.data[6],n.hhea.data[7]),lineGap:signedInt16(n.hhea.data[8],n.hhea.data[9])};this.ascent=p.ascent/p.unitsPerEm;this.descent=p.descent/p.unitsPerEm;this.lineGap=p.lineGap/p.unitsPerEm;if(this.cssFontInfo?.lineHeight){this.lineHeight=this.cssFontInfo.metrics.lineHeight;this.lineGap=this.cssFontInfo.metrics.lineGap}else this.lineHeight=this.ascent-this.descent+this.lineGap;n.post&&function readPostScriptTable(e,i,a){const s=(t.start||0)+e.offset;t.pos=s;const r=s+e.length,n=t.getInt32();t.skip(28);let g,o,c=!0;switch(n){case 65536:g=Wi;break;case 131072:const e=t.getUint16();if(e!==a){c=!1;break}const s=[];for(o=0;o=32768){c=!1;break}s.push(e)}if(!c)break;const C=[],h=[];for(;t.pos65535)throw new FormatError("Max size of CID is 65,535");let s=-1;t?s=a:void 0!==e[a]&&(s=e[a]);s>=0&&s>>0;let C=!1;if(g?.platformId!==s||g?.encodingId!==r){if(0!==s||0!==r&&1!==r&&3!==r)if(1===s&&0===r)C=!0;else if(3!==s||1!==r||!a&&g){if(i&&3===s&&0===r){C=!0;let i=!0;if(e>3;e.push(a);i=Math.max(a,i)}const a=[];for(let e=0;e<=i;e++)a.push({firstCode:t.getUint16(),entryCount:t.getUint16(),idDelta:signedInt16(t.getByte(),t.getByte()),idRangePos:t.pos+t.getUint16()});for(let i=0;i<256;i++)if(0===e[i]){t.pos=a[0].idRangePos+2*i;Q=t.getUint16();h.push({charCode:i,glyphId:Q})}else{const s=a[e[i]];for(l=0;l>1;t.skip(6);const i=[];let a;for(a=0;a>1)-(e-a);s.offsetIndex=n;g=Math.max(g,n+s.end-s.start+1)}else s.offsetIndex=-1}const o=[];for(l=0;l>>0;for(l=0;l>>0,i=t.getInt32()>>>0;let a=t.getInt32()>>>0;for(let t=e;t<=i;t++)h.push({charCode:t,glyphId:a++})}}}h.sort((function(e,t){return e.charCode-t.charCode}));for(let e=1;e=61440&&t<=61695&&(t&=255);m[t]=e.glyphId}else for(const e of r)m[e.charCode]=e.glyphId;if(i.glyphNames&&(g.length||this.differences.length))for(let e=0;e<256;++e){if(!o&&void 0!==m[e])continue;const t=this.differences[e]||g[e];if(!t)continue;const a=i.glyphNames.indexOf(t);a>0&&hasGlyph(a)&&(m[e]=a)}}0===m.length&&(m[0]=0);let y=l-1;Q||(y=0);if(!i.cssFontInfo){const e=adjustMapping(m,hasGlyph,y,this.toUnicode);this.toFontChar=e.toFontChar;n.cmap={tag:"cmap",data:createCmapTable(e.charCodeToGlyphId,e.toUnicodeExtraMap,l)};n["OS/2"]&&function validateOS2Table(e,t){t.pos=(t.start||0)+e.offset;const i=t.getUint16();t.skip(60);const a=t.getUint16();if(i<4&&768&a)return!1;if(t.getUint16()>t.getUint16())return!1;t.skip(6);if(0===t.getUint16())return!1;e.data[8]=e.data[9]=0;return!0}(n["OS/2"],t)||(n["OS/2"]={tag:"OS/2",data:createOS2Table(i,e.charCodeToGlyphId,p)})}if(!c)try{o=new Stream(n["CFF "].data);g=new CFFParser(o,i,Ki).parse();g.duplicateFirstGlyph();const e=new CFFCompiler(g);n["CFF "].data=e.compile()}catch{warn("Failed to compile font "+i.loadedName)}if(n.name){const[t,a]=readNameTable(n.name);n.name.data=createNameTable(e,t);this.psName=t[0][6]||null;i.composite||function adjustTrueTypeToUnicode(e,t,i){if(e.isInternalFont)return;if(e.hasIncludedToUnicodeMap)return;if(e.hasEncoding)return;if(e.toUnicode instanceof IdentityToUnicodeMap)return;if(!t)return;if(0===i.length)return;if(e.defaultEncoding===yi)return;for(const e of i)if(!isWinNameRecord(e))return;const a=yi,s=[],r=xi();for(const e in a){const t=a[e];if(""===t)continue;const i=r[t];void 0!==i&&(s[e]=String.fromCharCode(i))}s.length>0&&e.toUnicode.amend(s)}(i,this.isSymbolicFont,a)}else n.name={tag:"name",data:createNameTable(this.name)};const w=new OpenTypeFileBuilder(r.version);for(const e in n)w.addTable(e,n[e].data);return w.toArray()}convert(e,t,i){i.fixedPitch=!1;i.builtInEncoding&&function adjustType1ToUnicode(e,t){if(e.isInternalFont)return;if(e.hasIncludedToUnicodeMap)return;if(t===e.defaultEncoding)return;if(e.toUnicode instanceof IdentityToUnicodeMap)return;const i=[],a=xi();for(const s in t){if(e.hasEncoding&&(e.baseEncodingName||void 0!==e.differences[s]))continue;const r=getUnicodeForGlyph(t[s],a);-1!==r&&(i[s]=String.fromCharCode(r))}i.length>0&&e.toUnicode.amend(i)}(i,i.builtInEncoding);let s=1;t instanceof CFFFont&&(s=t.numGlyphs-1);const r=t.getGlyphMapping(i);let n=null,g=r,o=null;if(!i.cssFontInfo){n=adjustMapping(r,t.hasGlyphId.bind(t),s,this.toUnicode);this.toFontChar=n.toFontChar;g=n.charCodeToGlyphId;o=n.toUnicodeExtraMap}const c=t.numGlyphs;function getCharCodes(e,t){let i=null;for(const a in e)t===e[a]&&(i||=[]).push(0|a);return i}function createCharCode(e,t){for(const i in e)if(t===e[i])return 0|i;n.charCodeToGlyphId[n.nextAvailableFontCharCode]=t;return n.nextAvailableFontCharCode++}const C=t.seacs;if(n&&C?.length){const e=i.fontMatrix||a,s=t.getCharset(),g=Object.create(null);for(let t in C){t|=0;const i=C[t],a=mi[i[2]],o=mi[i[3]],c=s.indexOf(a),h=s.indexOf(o);if(c<0||h<0)continue;const l={x:i[0]*e[0]+i[1]*e[2]+e[4],y:i[0]*e[1]+i[1]*e[3]+e[5]},Q=getCharCodes(r,t);if(Q)for(const e of Q){const t=n.charCodeToGlyphId,i=createCharCode(t,c),a=createCharCode(t,h);g[e]={baseFontCharCode:i,accentFontCharCode:a,accentOffset:l}}}i.seacMap=g}const h=i.fontMatrix?1/Math.max(...i.fontMatrix.slice(0,4).map(Math.abs)):1e3,l=new OpenTypeFileBuilder("OTTO");l.addTable("CFF ",t.data);l.addTable("OS/2",createOS2Table(i,g));l.addTable("cmap",createCmapTable(g,o,c));l.addTable("head","\0\0\0\0\0\0\0\0\0\0_<õ\0\0"+safeString16(h)+"\0\0\0\0ž\v~'\0\0\0\0ž\v~'\0\0"+safeString16(i.descent)+"ÿ"+safeString16(i.ascent)+string16(i.italicAngle?2:0)+"\0\0\0\0\0\0\0");l.addTable("hhea","\0\0\0"+safeString16(i.ascent)+safeString16(i.descent)+"\0\0ÿÿ\0\0\0\0\0\0"+safeString16(i.capHeight)+safeString16(Math.tan(i.italicAngle)*i.xHeight)+"\0\0\0\0\0\0\0\0\0\0\0\0"+string16(c));l.addTable("hmtx",function fontFieldsHmtx(){const e=t.charstrings,i=t.cff?t.cff.widths:null;let a="\0\0\0\0";for(let t=1,s=c;t=65520&&e<=65535?0:e>=62976&&e<=63743?Hi()[e]||e:173===e?45:e}(i)}this.isType3Font&&(s=i);let C=null;if(this.seacMap?.[e]){c=!0;const t=this.seacMap[e];i=t.baseFontCharCode;C={fontChar:String.fromCodePoint(t.accentFontCharCode),offset:t.accentOffset}}let h="";"number"==typeof i&&(i<=1114111?h=String.fromCodePoint(i):warn(`charToGlyph - invalid fontCharCode: ${i}`));if(this.missingFile&&this.vertical&&1===h.length){const e=ji()[h.charCodeAt(0)];e&&(h=o=String.fromCharCode(e))}r=new fonts_Glyph(e,h,o,C,a,g,s,t,c);return this._glyphCache[e]=r}charsToGlyphs(e){let t=this._charsCache[e];if(t)return t;t=[];if(this.cMap){const i=Object.create(null),a=e.length;let s=0;for(;st.length%2==1,a=this.toUnicode instanceof IdentityToUnicodeMap?e=>this.toUnicode.charCodeOf(e):e=>this.toUnicode.charCodeOf(String.fromCodePoint(e));for(let s=0,r=e.length;s55295&&(r<57344||r>65533)&&s++;if(this.toUnicode){const e=a(r);if(-1!==e){if(hasCurrentBufErrors()){t.push(i.join(""));i.length=0}for(let t=(this.cMap?this.cMap.getCharCodeLength(e):1)-1;t>=0;t--)i.push(String.fromCharCode(e>>8*t&255));continue}}if(!hasCurrentBufErrors()){t.push(i.join(""));i.length=0}i.push(String.fromCodePoint(r))}t.push(i.join(""));return t}}class ErrorFont{constructor(e){this.error=e;this.loadedName="g_font_error";this.missingFile=!0}charsToGlyphs(){return[]}encodeString(e){return[e]}exportData(e=!1){return{error:this.error}}}const fa=2,pa=3,ma=4,ya=5,wa=6,Da=7;class Pattern{constructor(){unreachable("Cannot initialize Pattern.")}static parseShading(e,t,i,a,s){const r=e instanceof BaseStream?e.dict:e,n=r.get("ShadingType");try{switch(n){case fa:case pa:return new RadialAxialShading(r,t,i,a,s);case ma:case ya:case wa:case Da:return new MeshShading(e,t,i,a,s);default:throw new FormatError("Unsupported ShadingType: "+n)}}catch(e){if(e instanceof MissingDataException)throw e;warn(e);return new DummyShading}}}class BaseShading{static SMALL_NUMBER=1e-6;getIR(){unreachable("Abstract method `getIR` called.")}}class RadialAxialShading extends BaseShading{constructor(e,t,i,a,s){super();this.shadingType=e.get("ShadingType");let r=0;this.shadingType===fa?r=4:this.shadingType===pa&&(r=6);this.coordsArr=e.getArray("Coords");if(!isNumberArray(this.coordsArr,r))throw new FormatError("RadialAxialShading: Invalid /Coords array.");const n=ColorSpace.parse({cs:e.getRaw("CS")||e.getRaw("ColorSpace"),xref:t,resources:i,pdfFunctionFactory:a,localColorSpaceCache:s});this.bbox=lookupNormalRect(e.getArray("BBox"),null);let g=0,o=1;const c=e.getArray("Domain");isNumberArray(c,2)&&([g,o]=c);let C=!1,h=!1;const l=e.getArray("Extend");(function isBooleanArray(e,t){return Array.isArray(e)&&(null===t||e.length===t)&&e.every((e=>"boolean"==typeof e))})(l,2)&&([C,h]=l);if(!(this.shadingType!==pa||C&&h)){const[e,t,i,a,s,r]=this.coordsArr,n=Math.hypot(e-a,t-s);i<=r+n&&r<=i+n&&warn("Unsupported radial gradient.")}this.extendStart=C;this.extendEnd=h;const Q=e.getRaw("Function"),E=a.createFromArray(Q),u=(o-g)/840,d=this.colorStops=[];if(g>=o||u<=0){info("Bad shading domain.");return}const f=new Float32Array(n.numComps),p=new Float32Array(1);let m,y=0;p[0]=g;E(p,0,f,0);let w=n.getRgb(f,0);const D=Util.makeHexColor(w[0],w[1],w[2]);d.push([0,D]);let b=1;p[0]=g+u;E(p,0,f,0);let F=n.getRgb(f,0),S=F[0]-w[0]+1,k=F[1]-w[1]+1,R=F[2]-w[2]+1,N=F[0]-w[0]-1,G=F[1]-w[1]-1,x=F[2]-w[2]-1;for(let e=2;e<840;e++){p[0]=g+e*u;E(p,0,f,0);m=n.getRgb(f,0);const t=e-y;S=Math.min(S,(m[0]-w[0]+1)/t);k=Math.min(k,(m[1]-w[1]+1)/t);R=Math.min(R,(m[2]-w[2]+1)/t);N=Math.max(N,(m[0]-w[0]-1)/t);G=Math.max(G,(m[1]-w[1]-1)/t);x=Math.max(x,(m[2]-w[2]-1)/t);if(!(N<=S&&G<=k&&x<=R)){const e=Util.makeHexColor(F[0],F[1],F[2]);d.push([b/840,e]);S=m[0]-F[0]+1;k=m[1]-F[1]+1;R=m[2]-F[2]+1;N=m[0]-F[0]-1;G=m[1]-F[1]-1;x=m[2]-F[2]-1;y=b;w=F}b=e;F=m}const U=Util.makeHexColor(F[0],F[1],F[2]);d.push([1,U]);let M="transparent";if(e.has("Background")){m=n.getRgb(e.get("Background"),0);M=Util.makeHexColor(m[0],m[1],m[2])}if(!C){d.unshift([0,M]);d[1][0]+=BaseShading.SMALL_NUMBER}if(!h){d.at(-1)[0]-=BaseShading.SMALL_NUMBER;d.push([1,M])}this.colorStops=d}getIR(){const{coordsArr:e,shadingType:t}=this;let i,a,s,r,n;if(t===fa){a=[e[0],e[1]];s=[e[2],e[3]];r=null;n=null;i="axial"}else if(t===pa){a=[e[0],e[1]];s=[e[3],e[4]];r=e[2];n=e[5];i="radial"}else unreachable(`getPattern type unknown: ${t}`);return["RadialAxial",i,this.bbox,this.colorStops,a,s,r,n]}}class MeshStreamReader{constructor(e,t){this.stream=e;this.context=t;this.buffer=0;this.bufferLength=0;const i=t.numComps;this.tmpCompsBuf=new Float32Array(i);const a=t.colorSpace.numComps;this.tmpCsCompsBuf=t.colorFn?new Float32Array(a):this.tmpCompsBuf}get hasData(){if(this.stream.end)return this.stream.pos0)return!0;const e=this.stream.getByte();if(e<0)return!1;this.buffer=e;this.bufferLength=8;return!0}readBits(e){let t=this.buffer,i=this.bufferLength;if(32===e){if(0===i)return(this.stream.getByte()<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte())>>>0;t=t<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte();const e=this.stream.getByte();this.buffer=e&(1<>i)>>>0}if(8===e&&0===i)return this.stream.getByte();for(;i>i}align(){this.buffer=0;this.bufferLength=0}readFlag(){return this.readBits(this.context.bitsPerFlag)}readCoordinate(){const e=this.context.bitsPerCoordinate,t=this.readBits(e),i=this.readBits(e),a=this.context.decode,s=e<32?1/((1<r?r:e;t=t>n?n:t;i=ie*s[t])):i;let n,g=-2;const o=[];for(const[e,t]of a.map(((e,t)=>[e,t])).sort((([e],[t])=>e-t)))if(-1!==e)if(e===g+1){n.push(r[t]);g+=1}else{g=e;n=[r[t]];o.push(e,n)}return o}(e),i=new Dict(null);i.set("BaseFont",Name.get(e));i.set("Type",Name.get("Font"));i.set("Subtype",Name.get("CIDFontType2"));i.set("Encoding",Name.get("Identity-H"));i.set("CIDToGIDMap",Name.get("Identity"));i.set("W",t);i.set("FirstChar",t[0]);i.set("LastChar",t.at(-2)+t.at(-1).length-1);const a=new Dict(null);i.set("FontDescriptor",a);const s=new Dict(null);s.set("Ordering","Identity");s.set("Registry","Adobe");s.set("Supplement",0);i.set("CIDSystemInfo",s);return i}class PostScriptParser{constructor(e){this.lexer=e;this.operators=[];this.token=null;this.prev=null}nextToken(){this.prev=this.token;this.token=this.lexer.getToken()}accept(e){if(this.token.type===e){this.nextToken();return!0}return!1}expect(e){if(this.accept(e))return!0;throw new FormatError(`Unexpected symbol: found ${this.token.type} expected ${e}.`)}parse(){this.nextToken();this.expect(ls.LBRACE);this.parseBlock();this.expect(ls.RBRACE);return this.operators}parseBlock(){for(;;)if(this.accept(ls.NUMBER))this.operators.push(this.prev.value);else if(this.accept(ls.OPERATOR))this.operators.push(this.prev.value);else{if(!this.accept(ls.LBRACE))return;this.parseCondition()}}parseCondition(){const e=this.operators.length;this.operators.push(null,null);this.parseBlock();this.expect(ls.RBRACE);if(this.accept(ls.IF)){this.operators[e]=this.operators.length;this.operators[e+1]="jz"}else{if(!this.accept(ls.LBRACE))throw new FormatError("PS Function: error parsing conditional.");{const t=this.operators.length;this.operators.push(null,null);const i=this.operators.length;this.parseBlock();this.expect(ls.RBRACE);this.expect(ls.IFELSE);this.operators[t]=this.operators.length;this.operators[t+1]="j";this.operators[e]=i;this.operators[e+1]="jz"}}}}const ls={LBRACE:0,RBRACE:1,NUMBER:2,OPERATOR:3,IF:4,IFELSE:5};class PostScriptToken{static get opCache(){return shadow(this,"opCache",Object.create(null))}constructor(e,t){this.type=e;this.value=t}static getOperator(e){return PostScriptToken.opCache[e]||=new PostScriptToken(ls.OPERATOR,e)}static get LBRACE(){return shadow(this,"LBRACE",new PostScriptToken(ls.LBRACE,"{"))}static get RBRACE(){return shadow(this,"RBRACE",new PostScriptToken(ls.RBRACE,"}"))}static get IF(){return shadow(this,"IF",new PostScriptToken(ls.IF,"IF"))}static get IFELSE(){return shadow(this,"IFELSE",new PostScriptToken(ls.IFELSE,"IFELSE"))}}class PostScriptLexer{constructor(e){this.stream=e;this.nextChar();this.strBuf=[]}nextChar(){return this.currentChar=this.stream.getByte()}getToken(){let e=!1,t=this.currentChar;for(;;){if(t<0)return yt;if(e)10!==t&&13!==t||(e=!1);else if(37===t)e=!0;else if(!isWhiteSpace(t))break;t=this.nextChar()}switch(0|t){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return new PostScriptToken(ls.NUMBER,this.getNumber());case 123:this.nextChar();return PostScriptToken.LBRACE;case 125:this.nextChar();return PostScriptToken.RBRACE}const i=this.strBuf;i.length=0;i[0]=String.fromCharCode(t);for(;(t=this.nextChar())>=0&&(t>=65&&t<=90||t>=97&&t<=122);)i.push(String.fromCharCode(t));const a=i.join("");switch(a.toLowerCase()){case"if":return PostScriptToken.IF;case"ifelse":return PostScriptToken.IFELSE;default:return PostScriptToken.getOperator(a)}}getNumber(){let e=this.currentChar;const t=this.strBuf;t.length=0;t[0]=String.fromCharCode(e);for(;(e=this.nextChar())>=0&&(e>=48&&e<=57||45===e||46===e);)t.push(String.fromCharCode(e));const i=parseFloat(t.join(""));if(isNaN(i))throw new FormatError(`Invalid floating point number: ${i}`);return i}}class BaseLocalCache{constructor(e){this._onlyRefs=!0===e?.onlyRefs;if(!this._onlyRefs){this._nameRefMap=new Map;this._imageMap=new Map}this._imageCache=new RefSetCache}getByName(e){this._onlyRefs&&unreachable("Should not call `getByName` method.");const t=this._nameRefMap.get(e);return t?this.getByRef(t):this._imageMap.get(e)||null}getByRef(e){return this._imageCache.get(e)||null}set(e,t,i){unreachable("Abstract method `set` called.")}}class LocalImageCache extends BaseLocalCache{set(e,t=null,i){if("string"!=typeof e)throw new Error('LocalImageCache.set - expected "name" argument.');if(t){if(this._imageCache.has(t))return;this._nameRefMap.set(e,t);this._imageCache.put(t,i)}else this._imageMap.has(e)||this._imageMap.set(e,i)}}class LocalColorSpaceCache extends BaseLocalCache{set(e=null,t=null,i){if("string"!=typeof e&&!t)throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');if(t){if(this._imageCache.has(t))return;null!==e&&this._nameRefMap.set(e,t);this._imageCache.put(t,i)}else this._imageMap.has(e)||this._imageMap.set(e,i)}}class LocalFunctionCache extends BaseLocalCache{constructor(e){super({onlyRefs:!0})}set(e=null,t,i){if(!t)throw new Error('LocalFunctionCache.set - expected "ref" argument.');this._imageCache.has(t)||this._imageCache.put(t,i)}}class LocalGStateCache extends BaseLocalCache{set(e,t=null,i){if("string"!=typeof e)throw new Error('LocalGStateCache.set - expected "name" argument.');if(t){if(this._imageCache.has(t))return;this._nameRefMap.set(e,t);this._imageCache.put(t,i)}else this._imageMap.has(e)||this._imageMap.set(e,i)}}class LocalTilingPatternCache extends BaseLocalCache{constructor(e){super({onlyRefs:!0})}set(e=null,t,i){if(!t)throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');this._imageCache.has(t)||this._imageCache.put(t,i)}}class RegionalImageCache extends BaseLocalCache{constructor(e){super({onlyRefs:!0})}set(e=null,t,i){if(!t)throw new Error('RegionalImageCache.set - expected "ref" argument.');this._imageCache.has(t)||this._imageCache.put(t,i)}}class GlobalImageCache{static NUM_PAGES_THRESHOLD=2;static MIN_IMAGES_TO_CACHE=10;static MAX_BYTE_SIZE=5e7;#b=new RefSet;constructor(){this._refCache=new RefSetCache;this._imageCache=new RefSetCache}get#F(){let e=0;for(const t of this._imageCache)e+=t.byteSize;return e}get#S(){return!(this._imageCache.size+e)):null}class PDFFunction{static getSampleArray(e,t,i,a){let s,r,n=1;for(s=0,r=e.length;s>o)*C;c&=(1<i?e=i:e0&&(l=r[h-1]);let Q=a[1];h>1,c=s.length>>1,C=new PostScriptEvaluator(g),h=Object.create(null);let l=8192;const Q=new Float32Array(c);return function constructPostScriptFn(e,t,i,a){let s,n,g="";const E=Q;for(s=0;se&&(n=e)}d[s]=n}if(l>0){l--;h[g]=d}i.set(d,a)}}}function isPDFFunction(e){let t;if(e instanceof Dict)t=e;else{if(!(e instanceof BaseStream))return!1;t=e.dict}return t.has("FunctionType")}class PostScriptStack{static MAX_STACK_SIZE=100;constructor(e){this.stack=e?Array.from(e):[]}push(e){if(this.stack.length>=PostScriptStack.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");this.stack.push(e)}pop(){if(this.stack.length<=0)throw new Error("PostScript function stack underflow.");return this.stack.pop()}copy(e){if(this.stack.length+e>=PostScriptStack.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");const t=this.stack;for(let i=t.length-e,a=e-1;a>=0;a--,i++)t.push(t[i])}index(e){this.push(this.stack[this.stack.length-e-1])}roll(e,t){const i=this.stack,a=i.length-e,s=i.length-1,r=a+(t-Math.floor(t/e)*e);for(let e=a,t=s;e0?t.push(n<>g);break;case"ceiling":n=t.pop();t.push(Math.ceil(n));break;case"copy":n=t.pop();t.copy(n);break;case"cos":n=t.pop();t.push(Math.cos(n%360/180*Math.PI));break;case"cvi":n=0|t.pop();t.push(n);break;case"cvr":break;case"div":g=t.pop();n=t.pop();t.push(n/g);break;case"dup":t.copy(1);break;case"eq":g=t.pop();n=t.pop();t.push(n===g);break;case"exch":t.roll(2,1);break;case"exp":g=t.pop();n=t.pop();t.push(n**g);break;case"false":t.push(!1);break;case"floor":n=t.pop();t.push(Math.floor(n));break;case"ge":g=t.pop();n=t.pop();t.push(n>=g);break;case"gt":g=t.pop();n=t.pop();t.push(n>g);break;case"idiv":g=t.pop();n=t.pop();t.push(n/g|0);break;case"index":n=t.pop();t.index(n);break;case"le":g=t.pop();n=t.pop();t.push(n<=g);break;case"ln":n=t.pop();t.push(Math.log(n));break;case"log":n=t.pop();t.push(Math.log10(n));break;case"lt":g=t.pop();n=t.pop();t.push(n=t?new AstLiteral(t):e.max<=t?e:new AstMin(e,t)}class PostScriptCompiler{compile(e,t,i){const a=[],s=[],r=t.length>>1,n=i.length>>1;let g,o,c,C,h,l,Q,E,u=0;for(let e=0;et.min){g.unshift("Math.max(",r,", ");g.push(")")}if(n4){a=!0;t=0}else{a=!1;t=1}const o=[];for(r=0;r=0&&"ET"===us[e];--e)us[e]="EN";for(let e=r+1;e0&&(t=us[r-1]);let i=h;e+1E&&isOdd(E)&&(d=E)}for(E=u;E>=d;--E){let e=-1;for(r=0,n=o.length;r=0){reverseValues(Es,e,r);e=-1}}else e<0&&(e=r);e>=0&&reverseValues(Es,e,o.length)}for(r=0,n=Es.length;r"!==e||(Es[r]="")}return createBidiText(Es.join(""),a)}const ds={style:"normal",weight:"normal"},fs={style:"normal",weight:"bold"},ps={style:"italic",weight:"normal"},ms={style:"italic",weight:"bold"},ys=new Map([["Times-Roman",{local:["Times New Roman","Times-Roman","Times","Liberation Serif","Nimbus Roman","Nimbus Roman L","Tinos","Thorndale","TeX Gyre Termes","FreeSerif","Linux Libertine O","Libertinus Serif","DejaVu Serif","Bitstream Vera Serif","Ubuntu"],style:ds,ultimate:"serif"}],["Times-Bold",{alias:"Times-Roman",style:fs,ultimate:"serif"}],["Times-Italic",{alias:"Times-Roman",style:ps,ultimate:"serif"}],["Times-BoldItalic",{alias:"Times-Roman",style:ms,ultimate:"serif"}],["Helvetica",{local:["Helvetica","Helvetica Neue","Arial","Arial Nova","Liberation Sans","Arimo","Nimbus Sans","Nimbus Sans L","A030","TeX Gyre Heros","FreeSans","DejaVu Sans","Albany","Bitstream Vera Sans","Arial Unicode MS","Microsoft Sans Serif","Apple Symbols","Cantarell"],path:"LiberationSans-Regular.ttf",style:ds,ultimate:"sans-serif"}],["Helvetica-Bold",{alias:"Helvetica",path:"LiberationSans-Bold.ttf",style:fs,ultimate:"sans-serif"}],["Helvetica-Oblique",{alias:"Helvetica",path:"LiberationSans-Italic.ttf",style:ps,ultimate:"sans-serif"}],["Helvetica-BoldOblique",{alias:"Helvetica",path:"LiberationSans-BoldItalic.ttf",style:ms,ultimate:"sans-serif"}],["Courier",{local:["Courier","Courier New","Liberation Mono","Nimbus Mono","Nimbus Mono L","Cousine","Cumberland","TeX Gyre Cursor","FreeMono","Linux Libertine Mono O","Libertinus Mono"],style:ds,ultimate:"monospace"}],["Courier-Bold",{alias:"Courier",style:fs,ultimate:"monospace"}],["Courier-Oblique",{alias:"Courier",style:ps,ultimate:"monospace"}],["Courier-BoldOblique",{alias:"Courier",style:ms,ultimate:"monospace"}],["ArialBlack",{local:["Arial Black"],style:{style:"normal",weight:"900"},fallback:"Helvetica-Bold"}],["ArialBlack-Bold",{alias:"ArialBlack"}],["ArialBlack-Italic",{alias:"ArialBlack",style:{style:"italic",weight:"900"},fallback:"Helvetica-BoldOblique"}],["ArialBlack-BoldItalic",{alias:"ArialBlack-Italic"}],["ArialNarrow",{local:["Arial Narrow","Liberation Sans Narrow","Helvetica Condensed","Nimbus Sans Narrow","TeX Gyre Heros Cn"],style:ds,fallback:"Helvetica"}],["ArialNarrow-Bold",{alias:"ArialNarrow",style:fs,fallback:"Helvetica-Bold"}],["ArialNarrow-Italic",{alias:"ArialNarrow",style:ps,fallback:"Helvetica-Oblique"}],["ArialNarrow-BoldItalic",{alias:"ArialNarrow",style:ms,fallback:"Helvetica-BoldOblique"}],["Calibri",{local:["Calibri","Carlito"],style:ds,fallback:"Helvetica"}],["Calibri-Bold",{alias:"Calibri",style:fs,fallback:"Helvetica-Bold"}],["Calibri-Italic",{alias:"Calibri",style:ps,fallback:"Helvetica-Oblique"}],["Calibri-BoldItalic",{alias:"Calibri",style:ms,fallback:"Helvetica-BoldOblique"}],["Wingdings",{local:["Wingdings","URW Dingbats"],style:ds}],["Wingdings-Regular",{alias:"Wingdings"}],["Wingdings-Bold",{alias:"Wingdings"}]]),ws=new Map([["Arial-Black","ArialBlack"]]);function getFamilyName(e){const t=new Set(["thin","extralight","ultralight","demilight","semilight","light","book","regular","normal","medium","demibold","semibold","bold","extrabold","ultrabold","black","heavy","extrablack","ultrablack","roman","italic","oblique","ultracondensed","extracondensed","condensed","semicondensed","normal","semiexpanded","expanded","extraexpanded","ultraexpanded","bolditalic"]);return e.split(/[- ,+]+/g).filter((e=>!t.has(e.toLowerCase()))).join(" ")}function generateFont({alias:e,local:t,path:i,fallback:a,style:s,ultimate:r},n,g,o=!0,c=!0,C=""){const h={style:null,ultimate:null};if(t){const e=C?` ${C}`:"";for(const i of t)n.push(`local(${i}${e})`)}if(e){const t=ys.get(e),r=C||function getStyleToAppend(e){switch(e){case fs:return"Bold";case ps:return"Italic";case ms:return"Bold Italic";default:if("bold"===e?.weight)return"Bold";if("italic"===e?.style)return"Italic"}return""}(s);Object.assign(h,generateFont(t,n,g,o&&!a,c&&!i,r))}s&&(h.style=s);r&&(h.ultimate=r);if(o&&a){const e=ys.get(a),{ultimate:t}=generateFont(e,n,g,o,c&&!i,C);h.ultimate||=t}c&&i&&g&&n.push(`url(${g}${i})`);return h}function getFontSubstitution(e,t,i,a,s,r){if(a.startsWith("InvalidPDFjsFont_"))return null;"TrueType"!==r&&"Type1"!==r||!/^[A-Z]{6}\+/.test(a)||(a=a.slice(7));const n=a=normalizeFontName(a);let g=e.get(n);if(g)return g;let o=ys.get(a);if(!o)for(const[e,t]of ws)if(a.startsWith(e)){a=`${t}${a.substring(e.length)}`;o=ys.get(a);break}let c=!1;if(!o){o=ys.get(s);c=!0}const C=`${t.getDocId()}_s${t.createFontId()}`;if(!o){if(!validateFontName(a)){warn(`Cannot substitute the font because of its name: ${a}`);e.set(n,null);return null}const t=/bold/gi.test(a),i=/oblique|italic/gi.test(a),s=t&&i&&ms||t&&fs||i&&ps||ds;g={css:`"${getFamilyName(a)}",${C}`,guessFallback:!0,loadedName:C,baseFontName:a,src:`local(${a})`,style:s};e.set(n,g);return g}const h=[];c&&validateFontName(a)&&h.push(`local(${a})`);const{style:l,ultimate:Q}=generateFont(o,h,i),E=null===Q,u=E?"":`,${Q}`;g={css:`"${getFamilyName(a)}",${C}${u}`,guessFallback:E,loadedName:C,baseFontName:a,src:h.join(","),style:l};e.set(n,g);return g}class ImageResizer{static#k=2048;static#R=!1;constructor(e,t){this._imgData=e;this._isMask=t}static get canUseImageDecoder(){return shadow(this,"canUseImageDecoder",this.#R||"undefined"==typeof ImageDecoder?Promise.resolve(!1):ImageDecoder.isTypeSupported("image/bmp"))}static needsToBeResized(e,t){if(e<=this.#k&&t<=this.#k)return!1;const{MAX_DIM:i}=this;if(e>i||t>i)return!0;const a=e*t;if(this._hasMaxArea)return a>this.MAX_AREA;if(a(this.MAX_AREA=this.#k**2)}static get MAX_DIM(){return shadow(this,"MAX_DIM",this._guessMax(2048,65537,0,1))}static get MAX_AREA(){this._hasMaxArea=!0;return shadow(this,"MAX_AREA",this._guessMax(this.#k,this.MAX_DIM,128,0)**2)}static set MAX_AREA(e){if(e>=0){this._hasMaxArea=!0;shadow(this,"MAX_AREA",e)}}static setMaxArea(e){this._hasMaxArea||(this.MAX_AREA=e>>2)}static setOptions(e){this.setMaxArea(e.maxArea??-1);this.#R=e.isChrome??!1}static _areGoodDims(e,t){try{const i=new OffscreenCanvas(e,t),a=i.getContext("2d");a.fillRect(0,0,1,1);const s=a.getImageData(0,0,1,1).data[3];i.width=i.height=1;return 0!==s}catch{return!1}}static _guessMax(e,t,i,a){for(;e+i+1{warn(`BMP image decoding failed: ${e}`);return createImageBitmap(new Blob([this._encodeBMP().buffer],{type:"image/bmp"}))})).finally((()=>{t.close()}))}else i=createImageBitmap(new Blob([e.buffer],{type:"image/bmp"}));const{MAX_AREA:a,MAX_DIM:s}=ImageResizer,{_imgData:r}=this,{width:n,height:g}=r,o=Math.max(n/s,g/s,Math.sqrt(n*g/a)),c=Math.max(o,2),C=Math.round(10*(o+1.25))/10/c,h=Math.floor(Math.log2(C)),l=new Array(h+2).fill(2);l[0]=c;l.splice(-1,1,C/(1<>3,n=i+3&-4;if(i!==n){const e=new Uint8Array(n*t);let a=0;for(let r=0,g=t*i;r>>8;t[i++]=255&s}}}else{if(!ArrayBuffer.isView(e))throw new Error("Invalid data format, must be a string or TypedArray.");t=e.slice();i=t.byteLength}const a=i>>2,s=i-4*a,r=new Uint32Array(t.buffer,0,a);let n=0,g=0,o=this.h1,c=this.h2;const C=3432918353,h=461845907,l=11601,Q=13715;for(let e=0;e>>17;n=n*h&bs|n*Q&Fs;o^=n;o=o<<13|o>>>19;o=5*o+3864292196}else{g=r[e];g=g*C&bs|g*l&Fs;g=g<<15|g>>>17;g=g*h&bs|g*Q&Fs;c^=g;c=c<<13|c>>>19;c=5*c+3864292196}n=0;switch(s){case 3:n^=t[4*a+2]<<16;case 2:n^=t[4*a+1]<<8;case 1:n^=t[4*a];n=n*C&bs|n*l&Fs;n=n<<15|n>>>17;n=n*h&bs|n*Q&Fs;1&a?o^=n:c^=n}this.h1=o;this.h2=c}hexdigest(){let e=this.h1,t=this.h2;e^=t>>>1;e=3981806797*e&bs|36045*e&Fs;t=4283543511*t&bs|(2950163797*(t<<16|e>>>16)&bs)>>>16;e^=t>>>1;e=444984403*e&bs|60499*e&Fs;t=3301882366*t&bs|(3120437893*(t<<16|e>>>16)&bs)>>>16;e^=t>>>1;return(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}function addState(e,t,i,a,s){let r=e;for(let e=0,i=t.length-1;e1e3){c=Math.max(c,l);Q+=h+2;l=0;h=0}C.push({transform:t,x:l,y:Q,w:i.width,h:i.height});l+=i.width+2;h=Math.max(h,i.height)}const E=Math.max(c,l)+1,u=Q+h+1,d=new Uint8Array(E*u*4),f=E<<2;for(let e=0;e=0;){t[r-4]=t[r];t[r-3]=t[r+1];t[r-2]=t[r+2];t[r-1]=t[r+3];t[r+i]=t[r+i-4];t[r+i+1]=t[r+i-3];t[r+i+2]=t[r+i-2];t[r+i+3]=t[r+i-1];r-=f}}const p={width:E,height:u};if(e.isOffscreenCanvasSupported){const e=new OffscreenCanvas(E,u);e.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(d.buffer),E,u),0,0);p.bitmap=e.transferToImageBitmap();p.data=null}else{p.kind=S;p.data=d}i.splice(r,4*o,_e);a.splice(r,4*o,[p,C]);return r+1}));addState(Ss,[GA,UA,Xe,xA],null,(function iterateImageMaskGroup(e,t){const i=e.fnArray,a=(t-(e.iCurr-3))%4;switch(a){case 0:return i[t]===GA;case 1:return i[t]===UA;case 2:return i[t]===Xe;case 3:return i[t]===xA}throw new Error(`iterateImageMaskGroup - invalid pos: ${a}`)}),(function foundImageMaskGroup(e,t){const i=e.fnArray,a=e.argsArray,s=e.iCurr,r=s-3,n=s-2,g=s-1;let o=Math.floor((t-r)/4);if(o<10)return t-(t-r)%4;let c,C,h=!1;const l=a[g][0],Q=a[n][0],E=a[n][1],u=a[n][2],d=a[n][3];if(E===u){h=!0;c=n+4;let e=g+4;for(let t=1;t=4&&i[r-4]===i[n]&&i[r-3]===i[g]&&i[r-2]===i[o]&&i[r-1]===i[c]&&a[r-4][0]===C&&a[r-4][1]===h){l++;Q-=5}let E=Q+4;for(let e=1;e=i)break}a=(a||Ss)[e[t]];if(a&&!Array.isArray(a)){r.iCurr=t;t++;if(!a.checkFn||(0,a.checkFn)(r)){s=a;a=null}else a=null}else t++}this.state=a;this.match=s;this.lastProcessed=t}flush(){for(;this.match;){const e=this.queue.fnArray.length;this.lastProcessed=(0,this.match.processFn)(this.context,e);this.match=null;this.state=null;this._optimize()}}reset(){this.state=null;this.match=null;this.lastProcessed=0}}class OperatorList{static CHUNK_SIZE=1e3;static CHUNK_SIZE_ABOUT=this.CHUNK_SIZE-5;constructor(e=0,t){this._streamSink=t;this.fnArray=[];this.argsArray=[];this.optimizer=!t||e&E?new NullOptimizer(this):new QueueOptimizer(this);this.dependencies=new Set;this._totalLength=0;this.weight=0;this._resolved=t?null:Promise.resolve()}set isOffscreenCanvasSupported(e){this.optimizer.isOffscreenCanvasSupported=e}get length(){return this.argsArray.length}get ready(){return this._resolved||this._streamSink.ready}get totalLength(){return this._totalLength+this.length}addOp(e,t){this.optimizer.push(e,t);this.weight++;this._streamSink&&(this.weight>=OperatorList.CHUNK_SIZE||this.weight>=OperatorList.CHUNK_SIZE_ABOUT&&(e===xA||e===Ae))&&this.flush()}addImageOps(e,t,i){void 0!==i&&this.addOp(Je,["OC",i]);this.addOp(e,t);void 0!==i&&this.addOp(Ye,[])}addDependency(e){if(!this.dependencies.has(e)){this.dependencies.add(e);this.addOp(yA,[e])}}addDependencies(e){for(const t of e)this.addDependency(t)}addOpList(e){if(e instanceof OperatorList){for(const t of e.dependencies)this.dependencies.add(t);for(let t=0,i=e.length;ta&&(e=a);return e}function resizeImageMask(e,t,i,a,s,r){const n=s*r;let g;g=t<=8?new Uint8Array(n):t<=16?new Uint16Array(n):new Uint32Array(n);const o=i/s,c=a/r;let C,h,l,Q,E=0;const u=new Uint16Array(s),d=i;for(C=0;C0&&Number.isInteger(i.height)&&i.height>0&&(i.width!==l||i.height!==Q)){warn("PDFImage - using the Width/Height of the image data, rather than the image dictionary.");l=i.width;Q=i.height}if(l<1||Q<1)throw new FormatError(`Invalid image width: ${l} or height: ${Q}`);this.width=l;this.height=Q;this.interpolate=c.get("I","Interpolate");this.imageMask=c.get("IM","ImageMask")||!1;this.matte=c.get("Matte")||!1;let E=i.bitsPerComponent;if(!E){E=c.get("BPC","BitsPerComponent");if(!E){if(!this.imageMask)throw new FormatError(`Bits per component missing in image: ${this.imageMask}`);E=1}}this.bpc=E;if(!this.imageMask){let s=c.getRaw("CS")||c.getRaw("ColorSpace");const r=!!s;if(r)this.jpxDecoderOptions?.smaskInData&&(s=Name.get("DeviceRGBA"));else if(this.jpxDecoderOptions)s=Name.get("DeviceRGBA");else switch(i.numComps){case 1:s=Name.get("DeviceGray");break;case 3:s=Name.get("DeviceRGB");break;case 4:s=Name.get("DeviceCMYK");break;default:throw new Error(`Images with ${i.numComps} color components not supported.`)}this.colorSpace=ColorSpace.parse({cs:s,xref:e,resources:a?t:null,pdfFunctionFactory:g,localColorSpaceCache:o});this.numComps=this.colorSpace.numComps;if(this.jpxDecoderOptions){this.jpxDecoderOptions.numComponents=r?this.numComp:0;this.jpxDecoderOptions.isIndexedColormap="Indexed"===this.colorSpace.name}}this.decode=c.getArray("D","Decode");this.needsDecode=!1;if(this.decode&&(this.colorSpace&&!this.colorSpace.isDefaultDecode(this.decode,E)||n&&!ColorSpace.isDefaultDecode(this.decode,1))){this.needsDecode=!0;const e=(1<>3)*i,g=e.byteLength;let o,c;if(!a||s&&!(n===g))if(s){o=new Uint8Array(n);o.set(e);o.fill(255,g)}else o=new Uint8Array(e);else o=e;if(s)for(c=0;c>7&1;n[l+1]=h>>6&1;n[l+2]=h>>5&1;n[l+3]=h>>4&1;n[l+4]=h>>3&1;n[l+5]=h>>2&1;n[l+6]=h>>1&1;n[l+7]=1&h;l+=8}if(l>=1}}}}else{let i=0;h=0;for(l=0,C=r;l>a;s<0?s=0:s>c&&(s=c);n[l]=s;h&=(1<n[a+1]){t=255;break}}g[C]=t}}}if(g)for(C=0,l=3,h=t*a;C>3,C=t&&ImageResizer.needsToBeResized(i,a);if(!this.smask&&!this.mask&&"DeviceRGBA"===this.colorSpace.name){s.kind=S;const e=s.data=await this.getImageBytes(g*n*4,{});return t?C?ImageResizer.createImage(s,!1):this.createBitmap(S,i,a,e):s}if(!e){let e;"DeviceGray"===this.colorSpace.name&&1===o?e=b:"DeviceRGB"!==this.colorSpace.name||8!==o||this.needsDecode||(e=F);if(e&&!this.smask&&!this.mask&&i===n&&a===g){const r=await this.#N(n,g);if(r)return r;const o=await this.getImageBytes(g*c,{});if(t)return C?ImageResizer.createImage({data:o,kind:e,width:i,height:a,interpolate:this.interpolate},this.needsDecode):this.createBitmap(e,n,g,o);s.kind=e;s.data=o;if(this.needsDecode){assert(e===b,"PDFImage.createImageData: The image must be grayscale.");const t=s.data;for(let e=0,i=t.length;e>3,n=await this.getImageBytes(a*r,{internal:!0}),g=this.getComponents(n);let o,c;if(1===s){c=i*a;if(this.needsDecode)for(o=0;o0&&t.args[0].count++}class TimeSlotManager{static TIME_SLOT_DURATION_MS=20;static CHECK_TIME_EVERY=100;constructor(){this.reset()}check(){if(++this.checkedh){const e="Image exceeded maximum allowed size and was removed.";if(this.options.ignoreErrors){warn(e);return}throw new Error(e)}let l;g.has("OC")&&(l=await this.parseMarkedContentProps(g.get("OC"),e));let Q,E;if(g.get("IM","ImageMask")||!1){const e=g.get("I","Interpolate"),i=c+7>>3,n=t.getBytes(i*C),h=g.getArray("D","Decode");if(this.parsingType3Font){Q=PDFImage.createRawMask({imgArray:n,width:c,height:C,imageIsFromDecodeStream:t instanceof DecodeStream,inverseDecode:h?.[0]>0,interpolate:e});Q.cached=!!s;E=[Q];a.addImageOps(Xe,E,l);if(s){const e={fn:Xe,args:E,optionalContent:l};r.set(s,o,e);o&&this._regionalImageCache.set(null,o,e)}return}Q=await PDFImage.createMask({imgArray:n,width:c,height:C,imageIsFromDecodeStream:t instanceof DecodeStream,inverseDecode:h?.[0]>0,interpolate:e,isOffscreenCanvasSupported:this.options.isOffscreenCanvasSupported});if(Q.isSingleOpaquePixel){a.addImageOps(et,[],l);if(s){const e={fn:et,args:[],optionalContent:l};r.set(s,o,e);o&&this._regionalImageCache.set(null,o,e)}return}const u=`mask_${this.idFactory.createObjId()}`;a.addDependency(u);Q.dataLen=Q.bitmap?Q.width*Q.height*4:Q.data.length;this._sendImgData(u,Q);E=[{data:u,width:Q.width,height:Q.height,interpolate:Q.interpolate,count:1}];a.addImageOps(Xe,E,l);if(s){const e={objId:u,fn:Xe,args:E,optionalContent:l};r.set(s,o,e);o&&this._regionalImageCache.set(null,o,e)}return}if(i&&c+C<200&&!g.has("SMask")&&!g.has("Mask")){try{const s=new PDFImage({xref:this.xref,res:e,image:t,isInline:i,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:n});Q=await s.createImageData(!0,!1);a.isOffscreenCanvasSupported=this.options.isOffscreenCanvasSupported;a.addImageOps(ze,[Q],l)}catch(e){const t=`Unable to decode inline image: "${e}".`;if(!this.options.ignoreErrors)throw new Error(t);warn(t)}return}let u=`img_${this.idFactory.createObjId()}`,d=!1;if(this.parsingType3Font)u=`${this.idFactory.getDocId()}_type3_${u}`;else if(s&&o){d=this.globalImageCache.shouldCache(o,this.pageIndex);if(d){assert(!i,"Cannot cache an inline image globally.");u=`${this.idFactory.getDocId()}_${u}`}}a.addDependency(u);E=[u,c,C];a.addImageOps(Ve,E,l);if(d){if(this.globalImageCache.hasDecodeFailed(o)){this.globalImageCache.setData(o,{objId:u,fn:Ve,args:E,optionalContent:l,byteSize:0});this._sendImgData(u,null,d);return}if(c*C>25e4||g.has("SMask")||g.has("Mask")){const e=await this.handler.sendWithPromise("commonobj",[u,"CopyLocalImage",{imageRef:o}]);if(e){this.globalImageCache.setData(o,{objId:u,fn:Ve,args:E,optionalContent:l,byteSize:0});this.globalImageCache.addByteSize(o,e);return}}}PDFImage.buildImage({xref:this.xref,res:e,image:t,isInline:i,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:n}).then((async e=>{Q=await e.createImageData(!1,this.options.isOffscreenCanvasSupported);Q.dataLen=Q.bitmap?Q.width*Q.height*4:Q.data.length;Q.ref=o;d&&this.globalImageCache.addByteSize(o,Q.dataLen);return this._sendImgData(u,Q,d)})).catch((e=>{warn(`Unable to decode image "${u}": "${e}".`);o&&this.globalImageCache.addDecodeFailed(o);return this._sendImgData(u,null,d)}));if(s){const e={objId:u,fn:Ve,args:E,optionalContent:l};r.set(s,o,e);if(o){this._regionalImageCache.set(null,o,e);d&&this.globalImageCache.setData(o,{objId:u,fn:Ve,args:E,optionalContent:l,byteSize:0})}}}handleSMask(e,t,i,a,s,r){const n=e.get("G"),g={subtype:e.get("S").name,backdrop:e.get("BC")},o=e.get("TR");if(isPDFFunction(o)){const e=this._pdfFunctionFactory.create(o),t=new Uint8Array(256),i=new Float32Array(1);for(let a=0;a<256;a++){i[0]=a/255;e(i,0,i,0);t[a]=255*i[0]|0}g.transferMap=t}return this.buildFormXObject(t,n,g,i,a,s.state.clone(),r)}handleTransferFunction(e){let t;if(Array.isArray(e))t=e;else{if(!isPDFFunction(e))return null;t=[e]}const i=[];let a=0,s=0;for(const e of t){const t=this.xref.fetchIfRef(e);a++;if(isName(t,"Identity")){i.push(null);continue}if(!isPDFFunction(t))return null;const r=this._pdfFunctionFactory.create(t),n=new Uint8Array(256),g=new Float32Array(1);for(let e=0;e<256;e++){g[0]=e/255;r(g,0,g,0);n[e]=255*g[0]|0}i.push(n);s++}return 1!==a&&4!==a||0===s?null:i}handleTilingType(e,t,i,a,s,r,n,g){const o=new OperatorList,c=Dict.merge({xref:this.xref,dictArray:[s.get("Resources"),i]});return this.getOperatorList({stream:a,task:n,resources:c,operatorList:o}).then((function(){const i=o.getIR(),a=getTilingPatternIR(i,s,t);r.addDependencies(o.dependencies);r.addOp(e,a);s.objId&&g.set(null,s.objId,{operatorListIR:i,dict:s})})).catch((e=>{if(!(e instanceof AbortException)){if(!this.options.ignoreErrors)throw e;warn(`handleTilingType - ignoring pattern: "${e}".`)}}))}async handleSetFont(e,t,i,a,s,r,n=null,g=null){const o=t?.[0]instanceof Name?t[0].name:null;let c=await this.loadFont(o,i,e,n,g);if(c.font.isType3Font)try{await c.loadType3Data(this,e,s);a.addDependencies(c.type3Dependencies)}catch(e){c=new TranslatedFont({loadedName:"g_font_error",font:new ErrorFont(`Type3 font load error: ${e}`),dict:c.font,evaluatorOptions:this.options})}r.font=c.font;c.send(this.handler);return c.loadedName}handleText(e,t){const i=t.font,a=i.charsToGlyphs(e);if(i.data){(!!(t.textRenderingMode&D)||"Pattern"===t.fillColorSpace.name||i.disableFontFace||this.options.disableFontFace)&&PartialEvaluator.buildFontPaths(i,a,this.handler,this.options)}return a}ensureStateFont(e){if(e.font)return;const t=new FormatError("Missing setFont (Tf) operator before text rendering operator.");if(!this.options.ignoreErrors)throw t;warn(`ensureStateFont: "${t}".`)}async setGState({resources:e,gState:t,operatorList:i,cacheKey:a,task:s,stateManager:r,localGStateCache:n,localColorSpaceCache:g}){const o=t.objId;let c=!0;const C=[];let h=Promise.resolve();for(const a of t.getKeys()){const n=t.get(a);switch(a){case"Type":break;case"LW":case"LC":case"LJ":case"ML":case"D":case"RI":case"FL":case"CA":case"ca":C.push([a,n]);break;case"Font":c=!1;h=h.then((()=>this.handleSetFont(e,null,n[0],i,s,r.state).then((function(e){i.addDependency(e);C.push([a,[e,n[1]]])}))));break;case"BM":C.push([a,normalizeBlendMode(n)]);break;case"SMask":if(isName(n,"None")){C.push([a,!1]);break}if(n instanceof Dict){c=!1;h=h.then((()=>this.handleSMask(n,e,i,s,r,g)));C.push([a,!0])}else warn("Unsupported SMask type");break;case"TR":const t=this.handleTransferFunction(n);C.push([a,t]);break;case"OP":case"op":case"OPM":case"BG":case"BG2":case"UCR":case"UCR2":case"TR2":case"HT":case"SM":case"SA":case"AIS":case"TK":info("graphic state operator "+a);break;default:info("Unknown graphic state operator "+a)}}await h;C.length>0&&i.addOp(NA,[C]);c&&n.set(a,o,C)}loadFont(e,t,i,a=null,s=null){const errorFont=async()=>new TranslatedFont({loadedName:"g_font_error",font:new ErrorFont(`Font "${e}" is not available.`),dict:t,evaluatorOptions:this.options});let r;if(t)t instanceof Ref&&(r=t);else{const t=i.get("Font");t&&(r=t.getRaw(e))}if(r){if(this.type3FontRefs?.has(r))return errorFont();if(this.fontCache.has(r))return this.fontCache.get(r);try{t=this.xref.fetchIfRef(r)}catch(e){warn(`loadFont - lookup failed: "${e}".`)}}if(!(t instanceof Dict)){if(!this.options.ignoreErrors&&!this.parsingType3Font){warn(`Font "${e}" is not available.`);return errorFont()}warn(`Font "${e}" is not available -- attempting to fallback to a default font.`);t=a||PartialEvaluator.fallbackFontDict}if(t.cacheKey&&this.fontCache.has(t.cacheKey))return this.fontCache.get(t.cacheKey);const{promise:n,resolve:g}=Promise.withResolvers();let o;try{o=this.preEvaluateFont(t);o.cssFontInfo=s}catch(e){warn(`loadFont - preEvaluateFont failed: "${e}".`);return errorFont()}const{descriptor:c,hash:C}=o,h=r instanceof Ref;let l;if(C&&c instanceof Dict){const e=c.fontAliases||=Object.create(null);if(e[C]){const t=e[C].aliasRef;if(h&&t&&this.fontCache.has(t)){this.fontCache.putAlias(r,t);return this.fontCache.get(r)}}else e[C]={fontID:this.idFactory.createFontId()};h&&(e[C].aliasRef=r);l=e[C].fontID}else l=this.idFactory.createFontId();assert(l?.startsWith("f"),'The "fontID" must be (correctly) defined.');if(h)this.fontCache.put(r,n);else{t.cacheKey=`cacheKey_${l}`;this.fontCache.put(t.cacheKey,n)}t.loadedName=`${this.idFactory.getDocId()}_${l}`;this.translateFont(o).then((e=>{g(new TranslatedFont({loadedName:t.loadedName,font:e,dict:t,evaluatorOptions:this.options}))})).catch((e=>{warn(`loadFont - translateFont failed: "${e}".`);g(new TranslatedFont({loadedName:t.loadedName,font:new ErrorFont(e instanceof Error?e.message:e),dict:t,evaluatorOptions:this.options}))}));return n}buildPath(e,t,i,a=!1){const s=e.length-1;i||(i=[]);if(s<0||e.fnArray[s]!==tt){if(a){warn(`Encountered path operator "${t}" inside of a text object.`);e.addOp(GA,null)}let s;switch(t){case KA:const e=i[0]+i[2],t=i[1]+i[3];s=[Math.min(i[0],e),Math.min(i[1],t),Math.max(i[0],e),Math.max(i[1],t)];break;case MA:case LA:s=[i[0],i[1],i[0],i[1]];break;default:s=[1/0,1/0,-1/0,-1/0]}e.addOp(tt,[[t],i,s]);a&&e.addOp(xA,null)}else{const a=e.argsArray[s];a[0].push(t);a[1].push(...i);const r=a[2];switch(t){case KA:const e=i[0]+i[2],t=i[1]+i[3];r[0]=Math.min(r[0],i[0],e);r[1]=Math.min(r[1],i[1],t);r[2]=Math.max(r[2],i[0],e);r[3]=Math.max(r[3],i[1],t);break;case MA:case LA:r[0]=Math.min(r[0],i[0]);r[1]=Math.min(r[1],i[1]);r[2]=Math.max(r[2],i[0]);r[3]=Math.max(r[3],i[1])}}}parseColorSpace({cs:e,resources:t,localColorSpaceCache:i}){return ColorSpace.parseAsync({cs:e,xref:this.xref,resources:t,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:i}).catch((e=>{if(e instanceof AbortException)return null;if(this.options.ignoreErrors){warn(`parseColorSpace - ignoring ColorSpace: "${e}".`);return null}throw e}))}parseShading({shading:e,resources:t,localColorSpaceCache:i,localShadingPatternCache:a}){let s,r=a.get(e);if(r)return r;try{s=Pattern.parseShading(e,this.xref,t,this._pdfFunctionFactory,i).getIR()}catch(t){if(t instanceof AbortException)return null;if(this.options.ignoreErrors){warn(`parseShading - ignoring shading: "${t}".`);a.set(e,null);return null}throw t}r=`pattern_${this.idFactory.createObjId()}`;this.parsingType3Font&&(r=`${this.idFactory.getDocId()}_type3_${r}`);a.set(e,r);this.parsingType3Font?this.handler.send("commonobj",[r,"Pattern",s]):this.handler.send("obj",[r,this.pageIndex,"Pattern",s]);return r}handleColorN(e,t,i,a,s,r,n,g,o,c){const C=i.pop();if(C instanceof Name){const h=s.getRaw(C.name),l=h instanceof Ref&&o.getByRef(h);if(l)try{const s=a.base?a.base.getRgb(i,0):null,r=getTilingPatternIR(l.operatorListIR,l.dict,s);e.addOp(t,r);return}catch{}const Q=this.xref.fetchIfRef(h);if(Q){const s=Q instanceof BaseStream?Q.dict:Q,C=s.get("PatternType");if(C===Rs){const g=a.base?a.base.getRgb(i,0):null;return this.handleTilingType(t,g,r,Q,s,e,n,o)}if(C===Ns){const i=s.get("Shading"),a=this.parseShading({shading:i,resources:r,localColorSpaceCache:g,localShadingPatternCache:c});if(a){const i=lookupMatrix(s.getArray("Matrix"),null);e.addOp(t,["Shading",a,i])}return}throw new FormatError(`Unknown PatternType: ${C}`)}}throw new FormatError(`Unknown PatternName: ${C}`)}_parseVisibilityExpression(e,t,i){if(++t>10){warn("Visibility expression is too deeply nested");return}const a=e.length,s=this.xref.fetchIfRef(e[0]);if(!(a<2)&&s instanceof Name){switch(s.name){case"And":case"Or":case"Not":i.push(s.name);break;default:warn(`Invalid operator ${s.name} in visibility expression`);return}for(let s=1;s0)return{type:"OCMD",expression:t}}const t=i.get("OCGs");if(Array.isArray(t)||t instanceof Dict){const e=[];if(Array.isArray(t))for(const i of t)e.push(i.toString());else e.push(t.objId);return{type:a,ids:e,policy:i.get("P")instanceof Name?i.get("P").name:null,expression:null}}if(t instanceof Ref)return{type:a,id:t.toString()}}return null}getOperatorList({stream:e,task:t,resources:i,operatorList:a,initialState:s=null,fallbackFontDict:r=null}){i||=Dict.empty;s||=new EvalState;if(!a)throw new Error('getOperatorList: missing "operatorList" parameter');const n=this,g=this.xref;let o=!1;const c=new LocalImageCache,C=new LocalColorSpaceCache,h=new LocalGStateCache,l=new LocalTilingPatternCache,Q=new Map,E=i.get("XObject")||Dict.empty,u=i.get("Pattern")||Dict.empty,d=new StateManager(s),f=new EvaluatorPreprocessor(e,g,d),p=new TimeSlotManager;function closePendingRestoreOPS(e){for(let e=0,t=f.savedStatesDepth;e0&&a.addOp(NA,[t]);e=null;continue}}next(new Promise((function(e,s){if(!S)throw new FormatError("GState must be referred to by name.");const r=i.get("ExtGState");if(!(r instanceof Dict))throw new FormatError("ExtGState should be a dictionary.");const g=r.get(F);if(!(g instanceof Dict))throw new FormatError("GState should be a dictionary.");n.setGState({resources:i,gState:g,operatorList:a,cacheKey:F,task:t,stateManager:d,localGStateCache:h,localColorSpaceCache:C}).then(e,s)})).catch((function(e){if(!(e instanceof AbortException)){if(!n.options.ignoreErrors)throw e;warn(`getOperatorList - ignoring ExtGState: "${e}".`)}})));return;case MA:case LA:case HA:case JA:case YA:case vA:case KA:n.buildPath(a,s,e,o);continue;case Me:case Le:case ve:case Ke:continue;case Je:if(!(e[0]instanceof Name)){warn(`Expected name for beginMarkedContentProps arg0=${e[0]}`);a.addOp(Je,["OC",null]);continue}if("OC"===e[0].name){next(n.parseMarkedContentProps(e[1],i).then((e=>{a.addOp(Je,["OC",e])})).catch((e=>{if(!(e instanceof AbortException)){if(!n.options.ignoreErrors)throw e;warn(`getOperatorList - ignoring beginMarkedContentProps: "${e}".`);a.addOp(Je,["OC",null])}})));return}e=[e[0].name,e[1]instanceof Dict?e[1].get("MCID"):null];break;default:if(null!==e){for(w=0,D=e.length;w{if(!(e instanceof AbortException)){if(!this.options.ignoreErrors)throw e;warn(`getOperatorList - ignoring errors during "${t.name}" task: "${e}".`);closePendingRestoreOPS()}}))}getTextContent({stream:e,task:t,resources:s,stateManager:r=null,includeMarkedContent:n=!1,sink:g,seenStyles:o=new Set,viewBox:c,lang:C=null,markedContentData:h=null,disableNormalization:l=!1,keepWhiteSpace:Q=!1}){s||=Dict.empty;r||=new StateManager(new TextState);n&&(h||={level:0});const E={items:[],styles:Object.create(null),lang:C},u={initialized:!1,str:[],totalWidth:0,totalHeight:0,width:0,height:0,vertical:!1,prevTransform:null,textAdvanceScale:0,spaceInFlowMin:0,spaceInFlowMax:0,trackingSpaceMin:1/0,negativeSpaceMax:-1/0,notASpace:-1/0,transform:null,fontName:null,hasEOL:!1},d=[" "," "];let f=0;function saveLastChar(e){const t=(f+1)%2,i=" "!==d[f]&&" "===d[t];d[f]=e;f=t;return!Q&&i}function shouldAddWhitepsace(){return!Q&&" "!==d[f]&&" "===d[(f+1)%2]}function resetLastChars(){d[0]=d[1]=" ";f=0}const p=this,m=this.xref,y=[];let w=null;const D=new LocalImageCache,b=new LocalGStateCache,F=new EvaluatorPreprocessor(e,m,r);let S;function pushWhitespace({width:e=0,height:t=0,transform:i=u.prevTransform,fontName:a=u.fontName}){E.items.push({str:" ",dir:"ltr",width:e,height:t,transform:i,fontName:a,hasEOL:!1})}function getCurrentTextTransform(){const e=S.font,t=[S.fontSize*S.textHScale,0,0,S.fontSize,0,S.textRise];if(e.isType3Font&&(S.fontSize<=1||e.isCharBBox)&&!isArrayEqual(S.fontMatrix,a)){const i=e.bbox[3]-e.bbox[1];i>0&&(t[3]*=i*S.fontMatrix[3])}return Util.transform(S.ctm,Util.transform(S.textMatrix,t))}function ensureTextContentItem(){if(u.initialized)return u;const{font:e,loadedName:t}=S;if(!o.has(t)){o.add(t);E.styles[t]={fontFamily:e.fallbackName,ascent:e.ascent,descent:e.descent,vertical:e.vertical};if(p.options.fontExtraProperties&&e.systemFontInfo){const i=E.styles[t];i.fontSubstitution=e.systemFontInfo.css;i.fontSubstitutionLoadedName=e.systemFontInfo.loadedName}}u.fontName=t;const i=u.transform=getCurrentTextTransform();if(e.vertical){u.width=u.totalWidth=Math.hypot(i[0],i[1]);u.height=u.totalHeight=0;u.vertical=!0}else{u.width=u.totalWidth=0;u.height=u.totalHeight=Math.hypot(i[2],i[3]);u.vertical=!1}const a=Math.hypot(S.textLineMatrix[0],S.textLineMatrix[1]),s=Math.hypot(S.ctm[0],S.ctm[1]);u.textAdvanceScale=s*a;const{fontSize:r}=S;u.trackingSpaceMin=.102*r;u.notASpace=.03*r;u.negativeSpaceMax=-.2*r;u.spaceInFlowMin=.102*r;u.spaceInFlowMax=.6*r;u.hasEOL=!1;u.initialized=!0;return u}function updateAdvanceScale(){if(!u.initialized)return;const e=Math.hypot(S.textLineMatrix[0],S.textLineMatrix[1]),t=Math.hypot(S.ctm[0],S.ctm[1])*e;if(t!==u.textAdvanceScale){if(u.vertical){u.totalHeight+=u.height*u.textAdvanceScale;u.height=0}else{u.totalWidth+=u.width*u.textAdvanceScale;u.width=0}u.textAdvanceScale=t}}function runBidiTransform(e){let t=e.str.join("");l||(t=function normalizeUnicode(e){if(!ct){ct=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;Ct=new Map([["ſt","ſt"]])}return e.replaceAll(ct,((e,t,i)=>t?t.normalize("NFKC"):Ct.get(i)))}(t));const i=bidi(t,-1,e.vertical);return{str:i.str,dir:i.dir,width:Math.abs(e.totalWidth),height:Math.abs(e.totalHeight),transform:e.transform,fontName:e.fontName,hasEOL:e.hasEOL}}async function handleSetFont(e,i){const r=await p.loadFont(e,i,s);if(r.font.isType3Font)try{await r.loadType3Data(p,s,t)}catch{}S.loadedName=r.loadedName;S.font=r.font;S.fontMatrix=r.font.fontMatrix||a}function applyInverseRotation(e,t,i){const a=Math.hypot(i[0],i[1]);return[(i[0]*e+i[1]*t)/a,(i[2]*e+i[3]*t)/a]}function compareWithLastPosition(e){const t=getCurrentTextTransform();let i=t[4],a=t[5];if(S.font?.vertical){if(ic[2]||a+ec[3])return!1}else if(i+ec[2]||ac[3])return!1;if(!S.font||!u.prevTransform)return!0;let s=u.prevTransform[4],r=u.prevTransform[5];if(s===i&&r===a)return!0;let n=-1;t[0]&&0===t[1]&&0===t[2]?n=t[0]>0?0:180:t[1]&&0===t[0]&&0===t[3]&&(n=t[1]>0?90:270);switch(n){case 0:break;case 90:[i,a]=[a,i];[s,r]=[r,s];break;case 180:[i,a,s,r]=[-i,-a,-s,-r];break;case 270:[i,a]=[-a,-i];[s,r]=[-r,-s];break;default:[i,a]=applyInverseRotation(i,a,t);[s,r]=applyInverseRotation(s,r,u.prevTransform)}if(S.font.vertical){const e=(r-a)/u.textAdvanceScale,t=i-s,n=Math.sign(u.height);if(e.5*u.width){appendEOL();return!0}resetLastChars();flushTextContentItem();return!0}if(Math.abs(t)>u.width){appendEOL();return!0}e<=n*u.notASpace&&resetLastChars();if(e<=n*u.trackingSpaceMin)if(shouldAddWhitepsace()){resetLastChars();flushTextContentItem();pushWhitespace({height:Math.abs(e)})}else u.height+=e;else if(!addFakeSpaces(e,u.prevTransform,n))if(0===u.str.length){resetLastChars();pushWhitespace({height:Math.abs(e)})}else u.height+=e;Math.abs(t)>.25*u.width&&flushTextContentItem();return!0}const g=(i-s)/u.textAdvanceScale,o=a-r,C=Math.sign(u.width);if(g.5*u.height){appendEOL();return!0}resetLastChars();flushTextContentItem();return!0}if(Math.abs(o)>u.height){appendEOL();return!0}g<=C*u.notASpace&&resetLastChars();if(g<=C*u.trackingSpaceMin)if(shouldAddWhitepsace()){resetLastChars();flushTextContentItem();pushWhitespace({width:Math.abs(g)})}else u.width+=g;else if(!addFakeSpaces(g,u.prevTransform,C))if(0===u.str.length){resetLastChars();pushWhitespace({width:Math.abs(g)})}else u.width+=g;Math.abs(o)>.25*u.height&&flushTextContentItem();return!0}function buildTextContentItem({chars:e,extraSpacing:t}){const i=S.font;if(!e){const e=S.charSpacing+t;e&&(i.vertical?S.translateTextMatrix(0,-e):S.translateTextMatrix(e*S.textHScale,0));Q&&compareWithLastPosition(0);return}const a=i.charsToGlyphs(e),s=S.fontMatrix[0]*S.fontSize;for(let e=0,r=a.length;e0){const e=y.join("");y.length=0;buildTextContentItem({chars:e,extraSpacing:0})}break;case Ce:if(!r.state.font){p.ensureStateFont(r.state);continue}buildTextContentItem({chars:f[0],extraSpacing:0});break;case le:if(!r.state.font){p.ensureStateFont(r.state);continue}S.carriageReturn();buildTextContentItem({chars:f[0],extraSpacing:0});break;case Be:if(!r.state.font){p.ensureStateFont(r.state);continue}S.wordSpacing=f[0];S.charSpacing=f[1];S.carriageReturn();buildTextContentItem({chars:f[2],extraSpacing:0});break;case Ue:flushTextContentItem();w||(w=s.get("XObject")||Dict.empty);var G=f[0]instanceof Name,x=f[0].name;if(G&&D.getByName(x))break;next(new Promise((function(e,i){if(!G)throw new FormatError("XObject must be referred to by name.");let a=w.getRaw(x);if(a instanceof Ref){if(D.getByRef(a)){e();return}if(p.globalImageCache.getData(a,p.pageIndex)){e();return}a=m.fetch(a)}if(!(a instanceof BaseStream))throw new FormatError("XObject should be a stream");const E=a.dict.get("Subtype");if(!(E instanceof Name))throw new FormatError("XObject should have a Name subtype");if("Form"!==E.name){D.set(x,a.dict.objId,!0);e();return}const u=r.state.clone(),d=new StateManager(u),f=lookupMatrix(a.dict.getArray("Matrix"),null);f&&d.transform(f);enqueueChunk();const y={enqueueInvoked:!1,enqueue(e,t){this.enqueueInvoked=!0;g.enqueue(e,t)},get desiredSize(){return g.desiredSize},get ready(){return g.ready}};p.getTextContent({stream:a,task:t,resources:a.dict.get("Resources")||s,stateManager:d,includeMarkedContent:n,sink:y,seenStyles:o,viewBox:c,lang:C,markedContentData:h,disableNormalization:l,keepWhiteSpace:Q}).then((function(){y.enqueueInvoked||D.set(x,a.dict.objId,!0);e()}),i)})).catch((function(e){if(!(e instanceof AbortException)){if(!p.options.ignoreErrors)throw e;warn(`getTextContent - ignoring XObject: "${e}".`)}})));return;case NA:G=f[0]instanceof Name;x=f[0].name;if(G&&b.getByName(x))break;next(new Promise((function(e,t){if(!G)throw new FormatError("GState must be referred to by name.");const i=s.get("ExtGState");if(!(i instanceof Dict))throw new FormatError("ExtGState should be a dictionary.");const a=i.get(x);if(!(a instanceof Dict))throw new FormatError("GState should be a dictionary.");const r=a.get("Font");if(r){flushTextContentItem();S.fontName=null;S.fontSize=r[1];handleSetFont(null,r[0]).then(e,t)}else{b.set(x,a.objId,!0);e()}})).catch((function(e){if(!(e instanceof AbortException)){if(!p.options.ignoreErrors)throw e;warn(`getTextContent - ignoring ExtGState: "${e}".`)}})));return;case He:flushTextContentItem();if(n){h.level++;E.items.push({type:"beginMarkedContent",tag:f[0]instanceof Name?f[0].name:null})}break;case Je:flushTextContentItem();if(n){h.level++;let e=null;f[1]instanceof Dict&&(e=f[1].get("MCID"));E.items.push({type:"beginMarkedContentProps",id:Number.isInteger(e)?`${p.idFactory.getPageObjId()}_mc${e}`:null,tag:f[0]instanceof Name?f[0].name:null})}break;case Ye:flushTextContentItem();if(n){if(0===h.level)break;h.level--;E.items.push({type:"endMarkedContent"})}break;case xA:!e||e.font===S.font&&e.fontSize===S.fontSize&&e.fontName===S.fontName||flushTextContentItem()}if(E.items.length>=g.desiredSize){d=!0;break}}if(d)next(Gs);else{flushTextContentItem();enqueueChunk();e()}})).catch((e=>{if(!(e instanceof AbortException)){if(!this.options.ignoreErrors)throw e;warn(`getTextContent - ignoring errors during "${t.name}" task: "${e}".`);flushTextContentItem();enqueueChunk()}}))}async extractDataStructures(e,t){const i=this.xref;let a;const s=this.readToUnicode(t.toUnicode);if(t.composite){const i=e.get("CIDSystemInfo");i instanceof Dict&&(t.cidSystemInfo={registry:stringToPDFString(i.get("Registry")),ordering:stringToPDFString(i.get("Ordering")),supplement:i.get("Supplement")});try{const t=e.get("CIDToGIDMap");t instanceof BaseStream&&(a=t.getBytes())}catch(e){if(!this.options.ignoreErrors)throw e;warn(`extractDataStructures - ignoring CIDToGIDMap data: "${e}".`)}}const r=[];let n,g=null;if(e.has("Encoding")){n=e.get("Encoding");if(n instanceof Dict){g=n.get("BaseEncoding");g=g instanceof Name?g.name:null;if(n.has("Differences")){const e=n.get("Differences");let t=0;for(const a of e){const e=i.fetchIfRef(a);if("number"==typeof e)t=e;else{if(!(e instanceof Name))throw new FormatError(`Invalid entry in 'Differences' array: ${e}`);r[t++]=e.name}}}}else if(n instanceof Name)g=n.name;else{const e="Encoding is not a Name nor a Dict";if(!this.options.ignoreErrors)throw new FormatError(e);warn(e)}"MacRomanEncoding"!==g&&"MacExpertEncoding"!==g&&"WinAnsiEncoding"!==g&&(g=null)}const o=!t.file||t.isInternalFont,c=_i()[t.name];g&&o&&c&&(g=null);if(g)t.defaultEncoding=getEncoding(g);else{const e=!!(t.flags&Oi),i=!!(t.flags&Pi);n=mi;"TrueType"!==t.type||i||(n=yi);if(e||c){n=pi;o&&(/Symbol/i.test(t.name)?n=wi:/Dingbats/i.test(t.name)?n=Di:/Wingdings/i.test(t.name)&&(n=yi))}t.defaultEncoding=n}t.differences=r;t.baseEncodingName=g;t.hasEncoding=!!g||r.length>0;t.dict=e;t.toUnicode=await s;const C=await this.buildToUnicode(t);t.toUnicode=C;a&&(t.cidToGidMap=this.readCidToGidMap(a,C));return t}_simpleFontToUnicode(e,t=!1){assert(!e.composite,"Must be a simple font.");const i=[],a=e.defaultEncoding.slice(),s=e.baseEncodingName,r=e.differences;for(const e in r){const t=r[e];".notdef"!==t&&(a[e]=t)}const n=xi();for(const r in a){let g=a[r];if(""===g)continue;let o=n[g];if(void 0!==o){i[r]=String.fromCharCode(o);continue}let c=0;switch(g[0]){case"G":3===g.length&&(c=parseInt(g.substring(1),16));break;case"g":5===g.length&&(c=parseInt(g.substring(1),16));break;case"C":case"c":if(g.length>=3&&g.length<=4){const i=g.substring(1);if(t){c=parseInt(i,16);break}c=+i;if(Number.isNaN(c)&&Number.isInteger(parseInt(i,16)))return this._simpleFontToUnicode(e,!0)}break;case"u":o=getUnicodeForGlyph(g,n);-1!==o&&(c=o);break;default:switch(g){case"f_h":case"f_t":case"T_h":i[r]=g.replaceAll("_","");continue}}if(c>0&&c<=1114111&&Number.isInteger(c)){if(s&&c===+r){const e=getEncoding(s);if(e&&(g=e[r])){i[r]=String.fromCharCode(n[g]);continue}}i[r]=String.fromCodePoint(c)}}return i}async buildToUnicode(e){e.hasIncludedToUnicodeMap=e.toUnicode?.length>0;if(e.hasIncludedToUnicodeMap){!e.composite&&e.hasEncoding&&(e.fallbackToUnicode=this._simpleFontToUnicode(e));return e.toUnicode}if(!e.composite)return new ToUnicodeMap(this._simpleFontToUnicode(e));if(e.composite&&(e.cMap.builtInCMap&&!(e.cMap instanceof IdentityCMap)||"Adobe"===e.cidSystemInfo?.registry&&("GB1"===e.cidSystemInfo.ordering||"CNS1"===e.cidSystemInfo.ordering||"Japan1"===e.cidSystemInfo.ordering||"Korea1"===e.cidSystemInfo.ordering))){const{registry:t,ordering:i}=e.cidSystemInfo,a=Name.get(`${t}-${i}-UCS2`),s=await CMapFactory.create({encoding:a,fetchBuiltInCMap:this._fetchBuiltInCMapBound,useCMap:null}),r=[],n=[];e.cMap.forEach((function(e,t){if(t>65535)throw new FormatError("Max size of CID is 65,535");const i=s.lookup(t);if(i){n.length=0;for(let e=0,t=i.length;e>1;(0!==s||t.has(r))&&(i[r]=s)}return i}extractWidths(e,t,i){const a=this.xref;let s=[],r=0;const n=[];let g;if(i.composite){const t=e.get("DW");r="number"==typeof t?Math.ceil(t):1e3;const o=e.get("W");if(Array.isArray(o))for(let e=0,t=o.length;e{const t=o.get(e),s=new OperatorList;return a.getOperatorList({stream:t,task:i,resources:c,operatorList:s}).then((()=>{s.fnArray[0]===Ee&&this._removeType3ColorOperators(s,E);C[e]=s.getIR();for(const e of s.dependencies)n.add(e)})).catch((function(t){warn(`Type3 font resource "${e}" is not available.`);const i=new OperatorList;C[e]=i.getIR()}))}));this.type3Loaded=g.then((()=>{r.charProcOperatorList=C;if(this._bbox){r.isCharBBox=!0;r.bbox=this._bbox}}));return this.type3Loaded}_removeType3ColorOperators(e,t=NaN){const i=Util.normalizeRect(e.argsArray[0].slice(2)),a=i[2]-i[0],s=i[3]-i[1],r=Math.hypot(a,s);if(0===a||0===s){e.fnArray.splice(0,1);e.argsArray.splice(0,1)}else if(0===t||Math.round(r/t)>=10){this._bbox||(this._bbox=[1/0,1/0,-1/0,-1/0]);this._bbox[0]=Math.min(this._bbox[0],i[0]);this._bbox[1]=Math.min(this._bbox[1],i[1]);this._bbox[2]=Math.max(this._bbox[2],i[2]);this._bbox[3]=Math.max(this._bbox[3],i[3])}let n=0,g=e.length;for(;n=MA&&r<=VA;if(s.variableArgs)g>n&&info(`Command ${a}: expected [0, ${n}] args, but received ${g} args.`);else{if(g!==n){const e=this.nonProcessedArgs;for(;g>n;){e.push(t.shift());g--}for(;gEvaluatorPreprocessor.MAX_INVALID_PATH_OPS)throw new FormatError(`Invalid ${e}`);warn(`Skipping ${e}`);null!==t&&(t.length=0);continue}}this.preprocessCommand(r,t);e.fn=r;e.args=t;return!0}if(i===yt)return!1;if(null!==i){null===t&&(t=[]);t.push(i);if(t.length>33)throw new FormatError("Too many arguments")}}}preprocessCommand(e,t){switch(0|e){case GA:this.stateManager.save();break;case xA:this.stateManager.restore();break;case UA:this.stateManager.transform(t)}}}class DefaultAppearanceEvaluator extends EvaluatorPreprocessor{constructor(e){super(new StringStream(e))}parse(){const e={fn:0,args:[]},t={fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3)};try{for(;;){e.args.length=0;if(!this.read(e))break;if(0!==this.savedStatesDepth)continue;const{fn:i,args:a}=e;switch(0|i){case se:const[e,i]=a;e instanceof Name&&(t.fontName=e.name);"number"==typeof i&&i>0&&(t.fontSize=i);break;case Fe:ColorSpace.singletons.rgb.getRgbItem(a,0,t.fontColor,0);break;case De:ColorSpace.singletons.gray.getRgbItem(a,0,t.fontColor,0);break;case ke:ColorSpace.singletons.cmyk.getRgbItem(a,0,t.fontColor,0)}}}catch(e){warn(`parseDefaultAppearance - ignoring errors: "${e}".`)}return t}}function parseDefaultAppearance(e){return new DefaultAppearanceEvaluator(e).parse()}class AppearanceStreamEvaluator extends EvaluatorPreprocessor{constructor(e,t,i){super(e);this.stream=e;this.evaluatorOptions=t;this.xref=i;this.resources=e.dict?.get("Resources")}parse(){const e={fn:0,args:[]};let t={scaleFactor:1,fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3),fillColorSpace:ColorSpace.singletons.gray},i=!1;const a=[];try{for(;;){e.args.length=0;if(i||!this.read(e))break;const{fn:s,args:r}=e;switch(0|s){case GA:a.push({scaleFactor:t.scaleFactor,fontSize:t.fontSize,fontName:t.fontName,fontColor:t.fontColor.slice(),fillColorSpace:t.fillColorSpace});break;case xA:t=a.pop()||t;break;case Ie:t.scaleFactor*=Math.hypot(r[0],r[1]);break;case se:const[e,s]=r;e instanceof Name&&(t.fontName=e.name);"number"==typeof s&&s>0&&(t.fontSize=s*t.scaleFactor);break;case de:t.fillColorSpace=ColorSpace.parse({cs:r[0],xref:this.xref,resources:this.resources,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:this._localColorSpaceCache});break;case me:t.fillColorSpace.getRgbItem(r,0,t.fontColor,0);break;case Fe:ColorSpace.singletons.rgb.getRgbItem(r,0,t.fontColor,0);break;case De:ColorSpace.singletons.gray.getRgbItem(r,0,t.fontColor,0);break;case ke:ColorSpace.singletons.cmyk.getRgbItem(r,0,t.fontColor,0);break;case Ce:case he:case le:case Be:i=!0}}}catch(e){warn(`parseAppearanceStream - ignoring errors: "${e}".`)}this.stream.reset();delete t.scaleFactor;delete t.fillColorSpace;return t}get _localColorSpaceCache(){return shadow(this,"_localColorSpaceCache",new LocalColorSpaceCache)}get _pdfFunctionFactory(){return shadow(this,"_pdfFunctionFactory",new PDFFunctionFactory({xref:this.xref,isEvalSupported:this.evaluatorOptions.isEvalSupported}))}}function getPdfColor(e,t){if(e[0]===e[1]&&e[1]===e[2]){return`${numberToString(e[0]/255)} ${t?"g":"G"}`}return Array.from(e,(e=>numberToString(e/255))).join(" ")+" "+(t?"rg":"RG")}class FakeUnicodeFont{constructor(e,t){this.xref=e;this.widths=null;this.firstChar=1/0;this.lastChar=-1/0;this.fontFamily=t;const i=new OffscreenCanvas(1,1);this.ctxMeasure=i.getContext("2d",{willReadFrequently:!0});FakeUnicodeFont._fontNameId||(FakeUnicodeFont._fontNameId=1);this.fontName=Name.get(`InvalidPDFjsFont_${t}_${FakeUnicodeFont._fontNameId++}`)}get fontDescriptorRef(){if(!FakeUnicodeFont._fontDescriptorRef){const e=new Dict(this.xref);e.set("Type",Name.get("FontDescriptor"));e.set("FontName",this.fontName);e.set("FontFamily","MyriadPro Regular");e.set("FontBBox",[0,0,0,0]);e.set("FontStretch",Name.get("Normal"));e.set("FontWeight",400);e.set("ItalicAngle",0);FakeUnicodeFont._fontDescriptorRef=this.xref.getNewPersistentRef(e)}return FakeUnicodeFont._fontDescriptorRef}get descendantFontRef(){const e=new Dict(this.xref);e.set("BaseFont",this.fontName);e.set("Type",Name.get("Font"));e.set("Subtype",Name.get("CIDFontType0"));e.set("CIDToGIDMap",Name.get("Identity"));e.set("FirstChar",this.firstChar);e.set("LastChar",this.lastChar);e.set("FontDescriptor",this.fontDescriptorRef);e.set("DW",1e3);const t=[],i=[...this.widths.entries()].sort();let a=null,s=null;for(const[e,r]of i)if(a)if(e===a+s.length)s.push(r);else{t.push(a,s);a=e;s=[r]}else{a=e;s=[r]}a&&t.push(a,s);e.set("W",t);const r=new Dict(this.xref);r.set("Ordering","Identity");r.set("Registry","Adobe");r.set("Supplement",0);e.set("CIDSystemInfo",r);return this.xref.getNewPersistentRef(e)}get baseFontRef(){const e=new Dict(this.xref);e.set("BaseFont",this.fontName);e.set("Type",Name.get("Font"));e.set("Subtype",Name.get("Type0"));e.set("Encoding",Name.get("Identity-H"));e.set("DescendantFonts",[this.descendantFontRef]);e.set("ToUnicode",Name.get("Identity-H"));return this.xref.getNewPersistentRef(e)}get resources(){const e=new Dict(this.xref),t=new Dict(this.xref);t.set(this.fontName.name,this.baseFontRef);e.set("Font",t);return e}_createContext(){this.widths=new Map;this.ctxMeasure.font=`1000px ${this.fontFamily}`;return this.ctxMeasure}createFontResources(e){const t=this._createContext();for(const i of e.split(/\r\n?|\n/))for(const e of i.split("")){const i=e.charCodeAt(0);if(this.widths.has(i))continue;const a=t.measureText(e),s=Math.ceil(a.width);this.widths.set(i,s);this.firstChar=Math.min(i,this.firstChar);this.lastChar=Math.max(i,this.lastChar)}return this.resources}static getFirstPositionInfo(e,t,i){const[a,n,g,o]=e;let c=g-a,C=o-n;t%180!=0&&([c,C]=[C,c]);const h=s*i;return{coords:[0,C+r*i-h],bbox:[0,0,c,C],matrix:0!==t?getRotationMatrix(t,C,h):void 0}}createAppearance(e,t,i,a,n,g){const o=this._createContext(),c=[];let C=-1/0;for(const t of e.split(/\r\n?|\n/)){c.push(t);const e=o.measureText(t).width;C=Math.max(C,e);for(const e of codePointIter(t)){const t=String.fromCodePoint(e);let i=this.widths.get(e);if(void 0===i){const a=o.measureText(t);i=Math.ceil(a.width);this.widths.set(e,i);this.firstChar=Math.min(e,this.firstChar);this.lastChar=Math.max(e,this.lastChar)}}}C*=a/1e3;const[h,l,Q,E]=t;let u=Q-h,d=E-l;i%180!=0&&([u,d]=[d,u]);let f=1;C>u&&(f=u/C);let p=1;const m=s*a,y=r*a,w=m*c.length;w>d&&(p=d/w);const D=a*Math.min(f,p),b=["q",`0 0 ${numberToString(u)} ${numberToString(d)} re W n`,"BT",`1 0 0 1 0 ${numberToString(d+y)} Tm 0 Tc ${getPdfColor(n,!0)}`,`/${this.fontName.name} ${numberToString(D)} Tf`],{resources:F}=this;if(1!==(g="number"==typeof g&&g>=0&&g<=1?g:1)){b.push("/R0 gs");const e=new Dict(this.xref),t=new Dict(this.xref);t.set("ca",g);t.set("CA",g);t.set("Type",Name.get("ExtGState"));e.set("R0",t);F.set("ExtGState",e)}const S=numberToString(m);for(const e of c)b.push(`0 -${S} Td <${stringToUTF16HexString(e)}> Tj`);b.push("ET","Q");const k=b.join("\n"),R=new Dict(this.xref);R.set("Subtype",Name.get("Form"));R.set("Type",Name.get("XObject"));R.set("BBox",[0,0,u,d]);R.set("Length",k.length);R.set("Resources",F);if(i){const e=getRotationMatrix(i,u,d);R.set("Matrix",e)}const N=new StringStream(k);N.dict=R;return N}}class NameOrNumberTree{constructor(e,t,i){this.root=e;this.xref=t;this._type=i}getAll(){const e=new Map;if(!this.root)return e;const t=this.xref,i=new RefSet;i.put(this.root);const a=[this.root];for(;a.length>0;){const s=t.fetchIfRef(a.shift());if(!(s instanceof Dict))continue;if(s.has("Kids")){const e=s.get("Kids");if(!Array.isArray(e))continue;for(const t of e){if(i.has(t))throw new FormatError(`Duplicate entry in "${this._type}" tree.`);a.push(t);i.put(t)}continue}const r=s.get(this._type);if(Array.isArray(r))for(let i=0,a=r.length;i10){warn(`Search depth limit reached for "${this._type}" tree.`);return null}const s=i.get("Kids");if(!Array.isArray(s))return null;let r=0,n=s.length-1;for(;r<=n;){const a=r+n>>1,g=t.fetchIfRef(s[a]),o=g.get("Limits");if(et.fetchIfRef(o[1]))){i=g;break}r=a+1}}if(r>n)return null}const s=i.get(this._type);if(Array.isArray(s)){let i=0,a=s.length-2;for(;i<=a;){const r=i+a>>1,n=r+(1&r),g=t.fetchIfRef(s[n]);if(eg))return s[n+1];i=n+2}}}return null}get(e){return this.xref.fetchIfRef(this.getRaw(e))}}class NameTree extends NameOrNumberTree{constructor(e,t){super(e,t,"Names")}}class NumberTree extends NameOrNumberTree{constructor(e,t){super(e,t,"Nums")}}function clearGlobalCaches(){!function clearPatternCaches(){ba=Object.create(null)}();!function clearPrimitiveCaches(){wt=Object.create(null);Dt=Object.create(null);bt=Object.create(null)}();!function clearUnicodeCaches(){vi.clear()}();JpxImage.cleanup()}function pickPlatformItem(e){return e instanceof Dict?e.has("UF")?e.get("UF"):e.has("F")?e.get("F"):e.has("Unix")?e.get("Unix"):e.has("Mac")?e.get("Mac"):e.has("DOS")?e.get("DOS"):null:null}class FileSpec{#G=!1;constructor(e,t,i=!1){if(e instanceof Dict){this.xref=t;this.root=e;e.has("FS")&&(this.fs=e.get("FS"));e.has("RF")&&warn("Related file specifications are not supported");i||(e.has("EF")?this.#G=!0:warn("Non-embedded file specifications are not supported"))}}get filename(){let e="";const t=pickPlatformItem(this.root);t&&"string"==typeof t&&(e=stringToPDFString(t).replaceAll("\\\\","\\").replaceAll("\\/","/").replaceAll("\\","/"));return shadow(this,"filename",e||"unnamed")}get content(){if(!this.#G)return null;this._contentRef||=pickPlatformItem(this.root?.get("EF"));let e=null;if(this._contentRef){const t=this.xref.fetchIfRef(this._contentRef);t instanceof BaseStream?e=t.getBytes():warn("Embedded file specification points to non-existing/invalid content")}else warn("Embedded file specification does not have any content");return e}get description(){let e="";const t=this.root?.get("Desc");t&&"string"==typeof t&&(e=stringToPDFString(t));return shadow(this,"description",e)}get serializable(){return{rawFilename:this.filename,filename:(e=this.filename,e.substring(e.lastIndexOf("/")+1)),content:this.content,description:this.description};var e}}const xs=0,Us=-2,Ms=-3,Ls=-4,Hs=-5,Js=-6,Ys=-9;function isWhitespace(e,t){const i=e[t];return" "===i||"\n"===i||"\r"===i||"\t"===i}class XMLParserBase{_resolveEntities(e){return e.replaceAll(/&([^;]+);/g,((e,t)=>{if("#x"===t.substring(0,2))return String.fromCodePoint(parseInt(t.substring(2),16));if("#"===t.substring(0,1))return String.fromCodePoint(parseInt(t.substring(1),10));switch(t){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return'"';case"apos":return"'"}return this.onResolveEntity(t)}))}_parseContent(e,t){const i=[];let a=t;function skipWs(){for(;a"!==e[a]&&"/"!==e[a];)++a;const s=e.substring(t,a);skipWs();for(;a"!==e[a]&&"/"!==e[a]&&"?"!==e[a];){skipWs();let t="",s="";for(;a"!==e[i]&&"?"!==e[i]&&"/"!==e[i];)++i;const a=e.substring(t,i);!function skipWs(){for(;i"!==e[i+1]);)++i;return{name:a,value:e.substring(s,i),parsed:i-t}}parseXml(e){let t=0;for(;t",i);if(t<0){this.onError(Ys);return}this.onEndElement(e.substring(i,t));i=t+1;break;case"?":++i;const a=this._parseProcessingInstruction(e,i);if("?>"!==e.substring(i+a.parsed,i+a.parsed+2)){this.onError(Ms);return}this.onPi(a.name,a.value);i+=a.parsed+2;break;case"!":if("--"===e.substring(i+1,i+3)){t=e.indexOf("--\x3e",i+3);if(t<0){this.onError(Hs);return}this.onComment(e.substring(i+3,t));i=t+3}else if("[CDATA["===e.substring(i+1,i+8)){t=e.indexOf("]]>",i+8);if(t<0){this.onError(Us);return}this.onCdata(e.substring(i+8,t));i=t+3}else{if("DOCTYPE"!==e.substring(i+1,i+8)){this.onError(Js);return}{const a=e.indexOf("[",i+8);let s=!1;t=e.indexOf(">",i+8);if(t<0){this.onError(Ls);return}if(a>0&&t>a){t=e.indexOf("]>",i+8);if(t<0){this.onError(Ls);return}s=!0}const r=e.substring(i+8,t+(s?1:0));this.onDoctype(r);i=t+(s?2:1)}}break;default:const s=this._parseContent(e,i);if(null===s){this.onError(Js);return}let r=!1;if("/>"===e.substring(i+s.parsed,i+s.parsed+2))r=!0;else if(">"!==e.substring(i+s.parsed,i+s.parsed+1)){this.onError(Ys);return}this.onBeginElement(s.name,s.attributes,r);i+=s.parsed+(r?2:1)}}else{for(;i0}searchNode(e,t){if(t>=e.length)return this;const i=e[t];if(i.name.startsWith("#")&&t0){a.push([s,0]);s=s.childNodes[0]}else{if(0===a.length)return null;for(;0!==a.length;){const[e,t]=a.pop(),i=t+1;if(i");for(const t of this.childNodes)t.dump(e);e.push(``)}else this.nodeValue?e.push(`>${encodeToXmlString(this.nodeValue)}`):e.push("/>")}else e.push(encodeToXmlString(this.nodeValue))}}class SimpleXMLParser extends XMLParserBase{constructor({hasAttributes:e=!1,lowerCaseName:t=!1}){super();this._currentFragment=null;this._stack=null;this._errorCode=xs;this._hasAttributes=e;this._lowerCaseName=t}parseFromString(e){this._currentFragment=[];this._stack=[];this._errorCode=xs;this.parseXml(e);if(this._errorCode!==xs)return;const[t]=this._currentFragment;return t?{documentElement:t}:void 0}onText(e){if(function isWhitespaceString(e){for(let t=0,i=e.length;t\\376\\377([^<]+)/g,(function(e,t){const i=t.replaceAll(/\\([0-3])([0-7])([0-7])/g,(function(e,t,i,a){return String.fromCharCode(64*t+8*i+1*a)})).replaceAll(/&(amp|apos|gt|lt|quot);/g,(function(e,t){switch(t){case"amp":return"&";case"apos":return"'";case"gt":return">";case"lt":return"<";case"quot":return'"'}throw new Error(`_repair: ${t} isn't defined.`)})),a=[">"];for(let e=0,t=i.length;e=32&&t<127&&60!==t&&62!==t&&38!==t?a.push(String.fromCharCode(t)):a.push("&#x"+(65536+t).toString(16).substring(1)+";")}return a.join("")}))}_getSequence(e){const t=e.nodeName;return"rdf:bag"!==t&&"rdf:seq"!==t&&"rdf:alt"!==t?null:e.childNodes.filter((e=>"rdf:li"===e.nodeName))}_parseArray(e){if(!e.hasChildNodes())return;const[t]=e.childNodes,i=this._getSequence(t)||[];this._metadataMap.set(e.nodeName,i.map((e=>e.textContent.trim())))}_parse(e){let t=e.documentElement;if("rdf:rdf"!==t.nodeName){t=t.firstChild;for(;t&&"rdf:rdf"!==t.nodeName;)t=t.nextSibling}if(t&&"rdf:rdf"===t.nodeName&&t.hasChildNodes())for(const e of t.childNodes)if("rdf:description"===e.nodeName)for(const t of e.childNodes){const e=t.nodeName;switch(e){case"#text":continue;case"dc:creator":case"dc:subject":this._parseArray(t);continue}this._metadataMap.set(e,t.textContent.trim())}}get serializable(){return{parsedData:this._metadataMap,rawData:this._data}}}class DecryptStream extends DecodeStream{constructor(e,t,i){super(t);this.str=e;this.dict=e.dict;this.decrypt=i;this.nextChunk=null;this.initialized=!1}readBlock(){let e;if(this.initialized)e=this.nextChunk;else{e=this.str.getBytes(512);this.initialized=!0}if(!e||0===e.length){this.eof=!0;return}this.nextChunk=this.str.getBytes(512);const t=this.nextChunk?.length>0;e=(0,this.decrypt)(e,!t);const i=this.bufferLength,a=i+e.length;this.ensureBuffer(a).set(e,i);this.bufferLength=a}}class ARCFourCipher{constructor(e){this.a=0;this.b=0;const t=new Uint8Array(256),i=e.length;for(let e=0;e<256;++e)t[e]=e;for(let a=0,s=0;a<256;++a){const r=t[a];s=s+r+e[a%i]&255;t[a]=t[s];t[s]=r}this.s=t}encryptBlock(e){let t=this.a,i=this.b;const a=this.s,s=e.length,r=new Uint8Array(s);for(let n=0;n>5&255;C[h++]=s>>13&255;C[h++]=s>>21&255;C[h++]=s>>>29&255;C[h++]=0;C[h++]=0;C[h++]=0;const E=new Int32Array(16);for(h=0;h>>32-g)|0;s=r}r=r+s|0;n=n+c|0;g=g+Q|0;o=o+u|0}return new Uint8Array([255&r,r>>8&255,r>>16&255,r>>>24&255,255&n,n>>8&255,n>>16&255,n>>>24&255,255&g,g>>8&255,g>>16&255,g>>>24&255,255&o,o>>8&255,o>>16&255,o>>>24&255])}}();class Word64{constructor(e,t){this.high=0|e;this.low=0|t}and(e){this.high&=e.high;this.low&=e.low}xor(e){this.high^=e.high;this.low^=e.low}or(e){this.high|=e.high;this.low|=e.low}shiftRight(e){if(e>=32){this.low=this.high>>>e-32|0;this.high=0}else{this.low=this.low>>>e|this.high<<32-e;this.high=this.high>>>e|0}}shiftLeft(e){if(e>=32){this.high=this.low<>>32-e;this.low<<=e}}rotateRight(e){let t,i;if(32&e){i=this.low;t=this.high}else{t=this.low;i=this.high}e&=31;this.low=t>>>e|i<<32-e;this.high=i>>>e|t<<32-e}not(){this.high=~this.high;this.low=~this.low}add(e){const t=(this.low>>>0)+(e.low>>>0);let i=(this.high>>>0)+(e.high>>>0);t>4294967295&&(i+=1);this.low=0|t;this.high=0|i}copyTo(e,t){e[t]=this.high>>>24&255;e[t+1]=this.high>>16&255;e[t+2]=this.high>>8&255;e[t+3]=255&this.high;e[t+4]=this.low>>>24&255;e[t+5]=this.low>>16&255;e[t+6]=this.low>>8&255;e[t+7]=255&this.low}assign(e){this.high=e.high;this.low=e.low}}const Ks=function calculateSHA256Closure(){function rotr(e,t){return e>>>t|e<<32-t}function ch(e,t,i){return e&t^~e&i}function maj(e,t,i){return e&t^e&i^t&i}function sigma(e){return rotr(e,2)^rotr(e,13)^rotr(e,22)}function sigmaPrime(e){return rotr(e,6)^rotr(e,11)^rotr(e,25)}function littleSigma(e){return rotr(e,7)^rotr(e,18)^e>>>3}const e=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];return function hash(t,i,a){let s=1779033703,r=3144134277,n=1013904242,g=2773480762,o=1359893119,c=2600822924,C=528734635,h=1541459225;const l=64*Math.ceil((a+9)/64),Q=new Uint8Array(l);let E,u;for(E=0;E>>29&255;Q[E++]=a>>21&255;Q[E++]=a>>13&255;Q[E++]=a>>5&255;Q[E++]=a<<3&255;const f=new Uint32Array(64);for(E=0;E>>10)+f[u-7]+littleSigma(f[u-15])+f[u-16]|0;let t,i,a=s,l=r,d=n,m=g,y=o,w=c,D=C,b=h;for(u=0;u<64;++u){t=b+sigmaPrime(y)+ch(y,w,D)+e[u]+f[u];i=sigma(a)+maj(a,l,d);b=D;D=w;w=y;y=m+t|0;m=d;d=l;l=a;a=t+i|0}s=s+a|0;r=r+l|0;n=n+d|0;g=g+m|0;o=o+y|0;c=c+w|0;C=C+D|0;h=h+b|0}var p;return new Uint8Array([s>>24&255,s>>16&255,s>>8&255,255&s,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,g>>24&255,g>>16&255,g>>8&255,255&g,o>>24&255,o>>16&255,o>>8&255,255&o,c>>24&255,c>>16&255,c>>8&255,255&c,C>>24&255,C>>16&255,C>>8&255,255&C,h>>24&255,h>>16&255,h>>8&255,255&h])}}(),Ts=function calculateSHA512Closure(){function ch(e,t,i,a,s){e.assign(t);e.and(i);s.assign(t);s.not();s.and(a);e.xor(s)}function maj(e,t,i,a,s){e.assign(t);e.and(i);s.assign(t);s.and(a);e.xor(s);s.assign(i);s.and(a);e.xor(s)}function sigma(e,t,i){e.assign(t);e.rotateRight(28);i.assign(t);i.rotateRight(34);e.xor(i);i.assign(t);i.rotateRight(39);e.xor(i)}function sigmaPrime(e,t,i){e.assign(t);e.rotateRight(14);i.assign(t);i.rotateRight(18);e.xor(i);i.assign(t);i.rotateRight(41);e.xor(i)}function littleSigma(e,t,i){e.assign(t);e.rotateRight(1);i.assign(t);i.rotateRight(8);e.xor(i);i.assign(t);i.shiftRight(7);e.xor(i)}function littleSigmaPrime(e,t,i){e.assign(t);e.rotateRight(19);i.assign(t);i.rotateRight(61);e.xor(i);i.assign(t);i.shiftRight(6);e.xor(i)}const e=[new Word64(1116352408,3609767458),new Word64(1899447441,602891725),new Word64(3049323471,3964484399),new Word64(3921009573,2173295548),new Word64(961987163,4081628472),new Word64(1508970993,3053834265),new Word64(2453635748,2937671579),new Word64(2870763221,3664609560),new Word64(3624381080,2734883394),new Word64(310598401,1164996542),new Word64(607225278,1323610764),new Word64(1426881987,3590304994),new Word64(1925078388,4068182383),new Word64(2162078206,991336113),new Word64(2614888103,633803317),new Word64(3248222580,3479774868),new Word64(3835390401,2666613458),new Word64(4022224774,944711139),new Word64(264347078,2341262773),new Word64(604807628,2007800933),new Word64(770255983,1495990901),new Word64(1249150122,1856431235),new Word64(1555081692,3175218132),new Word64(1996064986,2198950837),new Word64(2554220882,3999719339),new Word64(2821834349,766784016),new Word64(2952996808,2566594879),new Word64(3210313671,3203337956),new Word64(3336571891,1034457026),new Word64(3584528711,2466948901),new Word64(113926993,3758326383),new Word64(338241895,168717936),new Word64(666307205,1188179964),new Word64(773529912,1546045734),new Word64(1294757372,1522805485),new Word64(1396182291,2643833823),new Word64(1695183700,2343527390),new Word64(1986661051,1014477480),new Word64(2177026350,1206759142),new Word64(2456956037,344077627),new Word64(2730485921,1290863460),new Word64(2820302411,3158454273),new Word64(3259730800,3505952657),new Word64(3345764771,106217008),new Word64(3516065817,3606008344),new Word64(3600352804,1432725776),new Word64(4094571909,1467031594),new Word64(275423344,851169720),new Word64(430227734,3100823752),new Word64(506948616,1363258195),new Word64(659060556,3750685593),new Word64(883997877,3785050280),new Word64(958139571,3318307427),new Word64(1322822218,3812723403),new Word64(1537002063,2003034995),new Word64(1747873779,3602036899),new Word64(1955562222,1575990012),new Word64(2024104815,1125592928),new Word64(2227730452,2716904306),new Word64(2361852424,442776044),new Word64(2428436474,593698344),new Word64(2756734187,3733110249),new Word64(3204031479,2999351573),new Word64(3329325298,3815920427),new Word64(3391569614,3928383900),new Word64(3515267271,566280711),new Word64(3940187606,3454069534),new Word64(4118630271,4000239992),new Word64(116418474,1914138554),new Word64(174292421,2731055270),new Word64(289380356,3203993006),new Word64(460393269,320620315),new Word64(685471733,587496836),new Word64(852142971,1086792851),new Word64(1017036298,365543100),new Word64(1126000580,2618297676),new Word64(1288033470,3409855158),new Word64(1501505948,4234509866),new Word64(1607167915,987167468),new Word64(1816402316,1246189591)];return function hash(t,i,a,s=!1){let r,n,g,o,c,C,h,l;if(s){r=new Word64(3418070365,3238371032);n=new Word64(1654270250,914150663);g=new Word64(2438529370,812702999);o=new Word64(355462360,4144912697);c=new Word64(1731405415,4290775857);C=new Word64(2394180231,1750603025);h=new Word64(3675008525,1694076839);l=new Word64(1203062813,3204075428)}else{r=new Word64(1779033703,4089235720);n=new Word64(3144134277,2227873595);g=new Word64(1013904242,4271175723);o=new Word64(2773480762,1595750129);c=new Word64(1359893119,2917565137);C=new Word64(2600822924,725511199);h=new Word64(528734635,4215389547);l=new Word64(1541459225,327033209)}const Q=128*Math.ceil((a+17)/128),E=new Uint8Array(Q);let u,d;for(u=0;u>>29&255;E[u++]=a>>21&255;E[u++]=a>>13&255;E[u++]=a>>5&255;E[u++]=a<<3&255;const p=new Array(80);for(u=0;u<80;u++)p[u]=new Word64(0,0);let m=new Word64(0,0),y=new Word64(0,0),w=new Word64(0,0),D=new Word64(0,0),b=new Word64(0,0),F=new Word64(0,0),S=new Word64(0,0),k=new Word64(0,0);const R=new Word64(0,0),N=new Word64(0,0),G=new Word64(0,0),x=new Word64(0,0);let U,M;for(u=0;u=1;--e){i=r[13];r[13]=r[9];r[9]=r[5];r[5]=r[1];r[1]=i;i=r[14];a=r[10];r[14]=r[6];r[10]=r[2];r[6]=i;r[2]=a;i=r[15];a=r[11];s=r[7];r[15]=r[3];r[11]=i;r[7]=a;r[3]=s;for(let e=0;e<16;++e)r[e]=this._inv_s[r[e]];for(let i=0,a=16*e;i<16;++i,++a)r[i]^=t[a];for(let e=0;e<16;e+=4){const t=this._mix[r[e]],a=this._mix[r[e+1]],s=this._mix[r[e+2]],n=this._mix[r[e+3]];i=t^a>>>8^a<<24^s>>>16^s<<16^n>>>24^n<<8;r[e]=i>>>24&255;r[e+1]=i>>16&255;r[e+2]=i>>8&255;r[e+3]=255&i}}i=r[13];r[13]=r[9];r[9]=r[5];r[5]=r[1];r[1]=i;i=r[14];a=r[10];r[14]=r[6];r[10]=r[2];r[6]=i;r[2]=a;i=r[15];a=r[11];s=r[7];r[15]=r[3];r[11]=i;r[7]=a;r[3]=s;for(let e=0;e<16;++e){r[e]=this._inv_s[r[e]];r[e]^=t[e]}return r}_encrypt(e,t){const i=this._s;let a,s,r;const n=new Uint8Array(16);n.set(e);for(let e=0;e<16;++e)n[e]^=t[e];for(let e=1;e=a;--i)if(e[i]!==t){t=0;break}g-=t;r[r.length-1]=e.subarray(0,16-t)}}const o=new Uint8Array(g);for(let e=0,t=0,i=r.length;e=256&&(g=255&(27^g))}for(let t=0;t<4;++t){i[e]=a^=i[e-32];e++;i[e]=s^=i[e-32];e++;i[e]=r^=i[e-32];e++;i[e]=n^=i[e-32];e++}}return i}}class PDF17{checkOwnerPassword(e,t,i,a){const s=new Uint8Array(e.length+56);s.set(e,0);s.set(t,e.length);s.set(i,e.length+t.length);return isArrayEqual(Ks(s,0,s.length),a)}checkUserPassword(e,t,i){const a=new Uint8Array(e.length+8);a.set(e,0);a.set(t,e.length);return isArrayEqual(Ks(a,0,a.length),i)}getOwnerKey(e,t,i,a){const s=new Uint8Array(e.length+56);s.set(e,0);s.set(t,e.length);s.set(i,e.length+t.length);const r=Ks(s,0,s.length);return new AES256Cipher(r).decryptBlock(a,!1,new Uint8Array(16))}getUserKey(e,t,i){const a=new Uint8Array(e.length+8);a.set(e,0);a.set(t,e.length);const s=Ks(a,0,a.length);return new AES256Cipher(s).decryptBlock(i,!1,new Uint8Array(16))}}class PDF20{_hash(e,t,i){let a=Ks(t,0,t.length).subarray(0,32),s=[0],r=0;for(;r<64||s.at(-1)>r-32;){const t=e.length+a.length+i.length,c=new Uint8Array(t);let C=0;c.set(e,C);C+=e.length;c.set(a,C);C+=a.length;c.set(i,C);const h=new Uint8Array(64*t);for(let e=0,i=0;e<64;e++,i+=t)h.set(c,i);s=new AES128Cipher(a.subarray(0,16)).encrypt(h,a.subarray(16,32));const l=s.slice(0,16).reduce(((e,t)=>e+t),0)%3;0===l?a=Ks(s,0,s.length):1===l?a=(n=s,g=0,o=s.length,Ts(n,g,o,!0)):2===l&&(a=Ts(s,0,s.length));r++}var n,g,o;return a.subarray(0,32)}checkOwnerPassword(e,t,i,a){const s=new Uint8Array(e.length+56);s.set(e,0);s.set(t,e.length);s.set(i,e.length+t.length);return isArrayEqual(this._hash(e,s,i),a)}checkUserPassword(e,t,i){const a=new Uint8Array(e.length+8);a.set(e,0);a.set(t,e.length);return isArrayEqual(this._hash(e,a,[]),i)}getOwnerKey(e,t,i,a){const s=new Uint8Array(e.length+56);s.set(e,0);s.set(t,e.length);s.set(i,e.length+t.length);const r=this._hash(e,s,i);return new AES256Cipher(r).decryptBlock(a,!1,new Uint8Array(16))}getUserKey(e,t,i){const a=new Uint8Array(e.length+8);a.set(e,0);a.set(t,e.length);const s=this._hash(e,a,[]);return new AES256Cipher(s).decryptBlock(i,!1,new Uint8Array(16))}}class CipherTransform{constructor(e,t){this.StringCipherConstructor=e;this.StreamCipherConstructor=t}createStream(e,t){const i=new this.StreamCipherConstructor;return new DecryptStream(e,t,(function cipherTransformDecryptStream(e,t){return i.decryptBlock(e,t)}))}decryptString(e){const t=new this.StringCipherConstructor;let i=stringToBytes(e);i=t.decryptBlock(i,!0);return bytesToString(i)}encryptString(e){const t=new this.StringCipherConstructor;if(t instanceof AESBaseCipher){const i=16-e.length%16;e+=String.fromCharCode(i).repeat(i);const a=new Uint8Array(16);if("undefined"!=typeof crypto)crypto.getRandomValues(a);else for(let e=0;e<16;e++)a[e]=Math.floor(256*Math.random());let s=stringToBytes(e);s=t.encrypt(s,a);const r=new Uint8Array(16+s.length);r.set(a);r.set(s,16);return bytesToString(r)}let i=stringToBytes(e);i=t.encrypt(i);return bytesToString(i)}}class CipherTransformFactory{static#x=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]);#U(e,t,i,a,s,r,n,g,o,c,C,h){if(t){const e=Math.min(127,t.length);t=t.subarray(0,e)}else t=[];const l=6===e?new PDF20:new PDF17;return l.checkUserPassword(t,g,n)?l.getUserKey(t,o,C):t.length&&l.checkOwnerPassword(t,a,r,i)?l.getOwnerKey(t,s,r,c):null}#M(e,t,i,a,s,r,n,g){const o=40+i.length+e.length,c=new Uint8Array(o);let C,h,l=0;if(t){h=Math.min(32,t.length);for(;l>8&255;c[l++]=s>>16&255;c[l++]=s>>>24&255;for(C=0,h=e.length;C=4&&!g){c[l++]=255;c[l++]=255;c[l++]=255;c[l++]=255}let Q=vs(c,0,l);const E=n>>3;if(r>=3)for(C=0;C<50;++C)Q=vs(Q,0,E);const u=Q.subarray(0,E);let d,f;if(r>=3){for(l=0;l<32;++l)c[l]=CipherTransformFactory.#x[l];for(C=0,h=e.length;C>3;if(i>=3)for(g=0;g<50;++g)o=vs(o,0,o.length);let C,h;if(i>=3){h=t;const e=new Uint8Array(c);for(g=19;g>=0;g--){for(let t=0;t>8&255;s[n++]=e>>16&255;s[n++]=255&t;s[n++]=t>>8&255;if(a){s[n++]=115;s[n++]=65;s[n++]=108;s[n++]=84}return vs(s,0,n).subarray(0,Math.min(i.length+5,16))}#J(e,t,i,a,s){if(!(t instanceof Name))throw new FormatError("Invalid crypt filter name.");const r=this,n=e.get(t.name),g=n?.get("CFM");if(!g||"None"===g.name)return function(){return new NullCipher};if("V2"===g.name)return function(){return new ARCFourCipher(r.#H(i,a,s,!1))};if("AESV2"===g.name)return function(){return new AES128Cipher(r.#H(i,a,s,!0))};if("AESV3"===g.name)return function(){return new AES256Cipher(s)};throw new FormatError("Unknown crypto method")}constructor(e,t,i){const a=e.get("Filter");if(!isName(a,"Standard"))throw new FormatError("unknown encryption method");this.filterName=a.name;this.dict=e;const s=e.get("V");if(!Number.isInteger(s)||1!==s&&2!==s&&4!==s&&5!==s)throw new FormatError("unsupported encryption algorithm");this.algorithm=s;let r=e.get("Length");if(!r)if(s<=3)r=40;else{const t=e.get("CF"),i=e.get("StmF");if(t instanceof Dict&&i instanceof Name){t.suppressEncryption=!0;const e=t.get(i.name);r=e?.get("Length")||128;r<40&&(r<<=3)}}if(!Number.isInteger(r)||r<40||r%8!=0)throw new FormatError("invalid key length");const n=stringToBytes(e.get("O")),g=stringToBytes(e.get("U")),o=n.subarray(0,32),c=g.subarray(0,32),C=e.get("P"),h=e.get("R"),l=(4===s||5===s)&&!1!==e.get("EncryptMetadata");this.encryptMetadata=l;const Q=stringToBytes(t);let E,u;if(i){if(6===h)try{i=utf8StringToString(i)}catch{warn("CipherTransformFactory: Unable to convert UTF8 encoded password.")}E=stringToBytes(i)}if(5!==s)u=this.#M(Q,E,o,c,C,h,r,l);else{const t=n.subarray(32,40),i=n.subarray(40,48),a=g.subarray(0,48),s=g.subarray(32,40),r=g.subarray(40,48),C=stringToBytes(e.get("OE")),l=stringToBytes(e.get("UE")),Q=stringToBytes(e.get("Perms"));u=this.#U(h,E,o,t,i,a,c,s,r,C,l,Q)}if(!u&&!i)throw new PasswordException("No password given",st);if(!u&&i){const e=this.#L(E,o,h,r);u=this.#M(Q,e,o,c,C,h,r,l)}if(!u)throw new PasswordException("Incorrect Password",rt);this.encryptionKey=u;if(s>=4){const t=e.get("CF");t instanceof Dict&&(t.suppressEncryption=!0);this.cf=t;this.stmf=e.get("StmF")||Name.get("Identity");this.strf=e.get("StrF")||Name.get("Identity");this.eff=e.get("EFF")||this.stmf}}createCipherTransform(e,t){if(4===this.algorithm||5===this.algorithm)return new CipherTransform(this.#J(this.cf,this.strf,e,t,this.encryptionKey),this.#J(this.cf,this.stmf,e,t,this.encryptionKey));const i=this.#H(e,t,this.encryptionKey,!1),cipherConstructor=function(){return new ARCFourCipher(i)};return new CipherTransform(cipherConstructor,cipherConstructor)}}async function writeObject(e,t,i,{encrypt:a=null}){const s=a?.createCipherTransform(e.num,e.gen);i.push(`${e.num} ${e.gen} obj\n`);t instanceof Dict?await writeDict(t,i,s):t instanceof BaseStream?await writeStream(t,i,s):(Array.isArray(t)||ArrayBuffer.isView(t))&&await writeArray(t,i,s);i.push("\nendobj\n")}async function writeDict(e,t,i){t.push("<<");for(const a of e.getKeys()){t.push(` /${escapePDFName(a)} `);await writeValue(e.getRaw(a),t,i)}t.push(">>")}async function writeStream(e,t,i){let a=e.getBytes();const{dict:s}=e,[r,n]=await Promise.all([s.getAsync("Filter"),s.getAsync("DecodeParms")]),g=isName(Array.isArray(r)?await s.xref.fetchIfRefAsync(r[0]):r,"FlateDecode");if(a.length>=256||g)try{const e=new CompressionStream("deflate"),t=e.writable.getWriter();await t.ready;t.write(a).then((async()=>{await t.ready;await t.close()})).catch((()=>{}));const i=await new Response(e.readable).arrayBuffer();a=new Uint8Array(i);let o,c;if(r){if(!g){o=Array.isArray(r)?[Name.get("FlateDecode"),...r]:[Name.get("FlateDecode"),r];n&&(c=Array.isArray(n)?[null,...n]:[null,n])}}else o=Name.get("FlateDecode");o&&s.set("Filter",o);c&&s.set("DecodeParms",c)}catch(e){info(`writeStream - cannot compress data: "${e}".`)}let o=bytesToString(a);i&&(o=i.encryptString(o));s.set("Length",o.length);await writeDict(s,t,i);t.push(" stream\n",o,"\nendstream")}async function writeArray(e,t,i){t.push("[");let a=!0;for(const s of e){a?a=!1:t.push(" ");await writeValue(s,t,i)}t.push("]")}async function writeValue(e,t,i){if(e instanceof Name)t.push(`/${escapePDFName(e.name)}`);else if(e instanceof Ref)t.push(`${e.num} ${e.gen} R`);else if(Array.isArray(e)||ArrayBuffer.isView(e))await writeArray(e,t,i);else if("string"==typeof e){i&&(e=i.encryptString(e));t.push(`(${escapeString(e)})`)}else"number"==typeof e?t.push(numberToString(e)):"boolean"==typeof e?t.push(e.toString()):e instanceof Dict?await writeDict(e,t,i):e instanceof BaseStream?await writeStream(e,t,i):null===e?t.push("null"):warn(`Unhandled value in writer: ${typeof e}, please file a bug.`)}function writeInt(e,t,i,a){for(let s=t+i-1;s>i-1;s--){a[s]=255&e;e>>=8}return i+t}function writeString(e,t,i){for(let a=0,s=e.length;a1&&(r=i.documentElement.searchNode([s.at(-1)],0));r?r.childNodes=Array.isArray(a)?a.map((e=>new SimpleDOMNode("value",e))):[new SimpleDOMNode("#text",a)]:warn(`Node not found for path: ${t}`)}const a=[];i.documentElement.dump(a);return a.join("")}(a.fetchIfRef(t).getString(),i)}const s=a.encrypt;if(s){e=s.createCipherTransform(t.num,t.gen).encryptString(e)}const r=`${t.num} ${t.gen} obj\n<< /Type /EmbeddedFile /Length ${e.length}>>\nstream\n`+e+"\nendstream\nendobj\n";i.push({ref:t,data:r})}function getIndexes(e){const t=[];for(const{ref:i}of e)i.num===t.at(-2)+t.at(-1)?t[t.length-1]+=1:t.push(i.num,1);return t}function computeIDs(e,t,i){if(Array.isArray(t.fileIds)&&t.fileIds.length>0){const a=function computeMD5(e,t){const i=Math.floor(Date.now()/1e3),a=t.filename||"",s=[i.toString(),a,e.toString()];let r=s.reduce(((e,t)=>e+t.length),0);for(const e of Object.values(t.info)){s.push(e);r+=e.length}const n=new Uint8Array(r);let g=0;for(const e of s){writeString(e,g,n);g+=e.length}return bytesToString(vs(n))}(e,t);i.set("ID",[t.fileIds[0],a])}}async function incrementalUpdate({originalData:e,xrefInfo:t,newRefs:i,xref:a=null,hasXfa:s=!1,xfaDatasetsRef:r=null,hasXfaDatasetsEntry:n=!1,needAppearances:g,acroFormRef:o=null,acroForm:c=null,xfaData:C=null,useXrefStream:h=!1}){await async function updateAcroform({xref:e,acroForm:t,acroFormRef:i,hasXfa:a,hasXfaDatasetsEntry:s,xfaDatasetsRef:r,needAppearances:n,newRefs:g}){!a||s||r||warn("XFA - Cannot save it");if(!n&&(!a||!r||s))return;const o=t.clone();if(a&&!s){const e=t.get("XFA").slice();e.splice(2,0,"datasets");e.splice(3,0,r);o.set("XFA",e)}n&&o.set("NeedAppearances",!0);const c=[];await writeObject(i,o,c,e);g.push({ref:i,data:c.join("")})}({xref:a,acroForm:c,acroFormRef:o,hasXfa:s,hasXfaDatasetsEntry:n,xfaDatasetsRef:r,needAppearances:g,newRefs:i});s&&updateXFA({xfaData:C,xfaDatasetsRef:r,newRefs:i,xref:a});const l=[];let Q=e.length;const E=e.at(-1);if(10!==E&&13!==E){l.push("\n");Q+=1}const u=function getTrailerDict(e,t,i){const a=new Dict(null);a.set("Prev",e.startXRef);const s=e.newRef;if(i){t.push({ref:s,data:""});a.set("Size",s.num+1);a.set("Type",Name.get("XRef"))}else a.set("Size",s.num);null!==e.rootRef&&a.set("Root",e.rootRef);null!==e.infoRef&&a.set("Info",e.infoRef);null!==e.encryptRef&&a.set("Encrypt",e.encryptRef);return a}(t,i,h);i=i.sort(((e,t)=>e.ref.num-t.ref.num));for(const{data:e}of i)null!==e&&l.push(e);await(h?async function getXRefStreamTable(e,t,i,a,s){const r=[];let n=0,g=0;for(const{ref:e,data:a}of i){let i;n=Math.max(n,t);if(null!==a){i=Math.min(e.gen,65535);r.push([1,t,i]);t+=a.length}else{i=Math.min(e.gen+1,65535);r.push([0,0,i])}g=Math.max(g,i)}a.set("Index",getIndexes(i));const o=[1,getSizeInBytes(n),getSizeInBytes(g)];a.set("W",o);computeIDs(t,e,a);const c=o.reduce(((e,t)=>e+t),0),C=new Uint8Array(c*r.length),h=new Stream(C);h.dict=a;let l=0;for(const[e,t,i]of r){l=writeInt(e,o[0],l,C);l=writeInt(t,o[1],l,C);l=writeInt(i,o[2],l,C)}await writeObject(e.newRef,h,s,{});s.push("startxref\n",t.toString(),"\n%%EOF\n")}(t,Q,i,u,l):async function getXRefTable(e,t,i,a,s){s.push("xref\n");const r=getIndexes(i);let n=0;for(const{ref:e,data:a}of i){if(e.num===r[n]){s.push(`${r[n]} ${r[n+1]}\n`);n+=2}if(null!==a){s.push(`${t.toString().padStart(10,"0")} ${Math.min(e.gen,65535).toString().padStart(5,"0")} n\r\n`);t+=a.length}else s.push(`0000000000 ${Math.min(e.gen+1,65535).toString().padStart(5,"0")} f\r\n`)}computeIDs(t,e,a);s.push("trailer\n");await writeDict(a,s);s.push("\nstartxref\n",t.toString(),"\n%%EOF\n")}(t,Q,i,u,l));const d=l.reduce(((e,t)=>e+t.length),e.length),f=new Uint8Array(d);f.set(e);let p=e.length;for(const e of l){writeString(e,p,f);p+=e.length}return f}const qs=1,Os=2,Ws=3,js=4,Xs=5;class StructTreeRoot{constructor(e,t){this.dict=e;this.ref=t instanceof Ref?t:null;this.roleMap=new Map;this.structParentIds=null}init(){this.readRoleMap()}#Y(e,t,i){if(!(e instanceof Ref)||t<0)return;this.structParentIds||=new RefSetCache;let a=this.structParentIds.get(e);if(!a){a=[];this.structParentIds.put(e,a)}a.push([t,i])}addAnnotationIdToPage(e,t){this.#Y(e,t,js)}readRoleMap(){const e=this.dict.get("RoleMap");e instanceof Dict&&e.forEach(((e,t)=>{t instanceof Name&&this.roleMap.set(e,t.name)}))}static async canCreateStructureTree({catalogRef:e,pdfManager:t,newAnnotationsByPage:i}){if(!(e instanceof Ref)){warn("Cannot save the struct tree: no catalog reference.");return!1}let a=0,s=!0;for(const[e,r]of i){const{ref:i}=await t.getPage(e);if(!(i instanceof Ref)){warn(`Cannot save the struct tree: page ${e} has no ref.`);s=!0;break}for(const e of r)if(e.accessibilityData?.type){e.parentTreeId=a++;s=!1}}if(s){for(const e of i.values())for(const t of e)delete t.parentTreeId;return!1}return!0}static async createStructureTree({newAnnotationsByPage:e,xref:t,catalogRef:i,pdfManager:a,newRefs:s}){const r=a.catalog.cloneDict(),n=new RefSetCache;n.put(i,r);const g=t.getNewTemporaryRef();r.set("StructTreeRoot",g);const o=new Dict(t);o.set("Type",Name.get("StructTreeRoot"));const c=t.getNewTemporaryRef();o.set("ParentTree",c);const C=[];o.set("K",C);n.put(g,o);const h=new Dict(t),l=[];h.set("Nums",l);const Q=await this.#v({newAnnotationsByPage:e,structTreeRootRef:g,structTreeRoot:null,kids:C,nums:l,xref:t,pdfManager:a,newRefs:s,cache:n});o.set("ParentTreeNextKey",Q);n.put(c,h);const E=[];for(const[e,i]of n.items()){E.length=0;await writeObject(e,i,E,t);s.push({ref:e,data:E.join("")})}}async canUpdateStructTree({pdfManager:e,xref:t,newAnnotationsByPage:i}){if(!this.ref){warn("Cannot update the struct tree: no root reference.");return!1}let a=this.dict.get("ParentTreeNextKey");if(!Number.isInteger(a)||a<0){warn("Cannot update the struct tree: invalid next key.");return!1}const s=this.dict.get("ParentTree");if(!(s instanceof Dict)){warn("Cannot update the struct tree: ParentTree isn't a dict.");return!1}const r=s.get("Nums");if(!Array.isArray(r)){warn("Cannot update the struct tree: nums isn't an array.");return!1}const n=new NumberTree(s,t);for(const t of i.keys()){const{pageDict:i}=await e.getPage(t);if(!i.has("StructParents"))continue;const a=i.get("StructParents");if(!Number.isInteger(a)||!Array.isArray(n.get(a))){warn(`Cannot save the struct tree: page ${t} has a wrong id.`);return!1}}let g=!0;for(const[t,s]of i){const{pageDict:i}=await e.getPage(t);StructTreeRoot.#K({elements:s,xref:this.dict.xref,pageDict:i,numberTree:n});for(const e of s)if(e.accessibilityData?.type){e.accessibilityData.structParent>=0||(e.parentTreeId=a++);g=!1}}if(g){for(const e of i.values())for(const t of e){delete t.parentTreeId;delete t.structTreeParent}return!1}return!0}async updateStructureTree({newAnnotationsByPage:e,pdfManager:t,newRefs:i}){const a=this.dict.xref,s=this.dict.clone(),r=this.ref,n=new RefSetCache;n.put(r,s);let g,o=s.getRaw("ParentTree");if(o instanceof Ref)g=a.fetch(o);else{g=o;o=a.getNewTemporaryRef();s.set("ParentTree",o)}g=g.clone();n.put(o,g);let c=g.getRaw("Nums"),C=null;if(c instanceof Ref){C=c;c=a.fetch(C)}c=c.slice();C||g.set("Nums",c);const h=await StructTreeRoot.#v({newAnnotationsByPage:e,structTreeRootRef:r,structTreeRoot:this,kids:null,nums:c,xref:a,pdfManager:t,newRefs:i,cache:n});if(-1===h)return;s.set("ParentTreeNextKey",h);C&&n.put(C,c);const l=[];for(const[e,t]of n.items()){l.length=0;await writeObject(e,t,l,a);i.push({ref:e,data:l.join("")})}}static async#v({newAnnotationsByPage:e,structTreeRootRef:t,structTreeRoot:i,kids:a,nums:s,xref:r,pdfManager:n,newRefs:g,cache:o}){const c=Name.get("OBJR");let C,h=-1;const l=[];for(const[Q,E]of e){const e=await n.getPage(Q),{ref:u}=e,d=u instanceof Ref;for(const{accessibilityData:n,ref:f,parentTreeId:p,structTreeParent:m}of E){if(!n?.type)continue;const{structParent:E}=n;if(i&&Number.isInteger(E)&&E>=0){let t=(C||=new Map).get(Q);if(void 0===t){t=new StructTreePage(i,e.pageDict).collectObjects(u);C.set(Q,t)}const a=t?.get(E);if(a){const e=r.fetch(a).clone();StructTreeRoot.#T(e,n);l.length=0;await writeObject(a,e,l,r);g.push({ref:a,data:l.join("")});continue}}h=Math.max(h,p);const y=r.getNewTemporaryRef(),w=new Dict(r);StructTreeRoot.#T(w,n);await this.#q({structTreeParent:m,tagDict:w,newTagRef:y,structTreeRootRef:t,fallbackKids:a,xref:r,cache:o});const D=new Dict(r);w.set("K",D);D.set("Type",c);d&&D.set("Pg",u);D.set("Obj",f);o.put(y,w);s.push(p,y)}}return h+1}static#T(e,{type:t,title:i,lang:a,alt:s,expanded:r,actualText:n}){e.set("S",Name.get(t));i&&e.set("T",stringToAsciiOrUTF16BE(i));a&&e.set("Lang",stringToAsciiOrUTF16BE(a));s&&e.set("Alt",stringToAsciiOrUTF16BE(s));r&&e.set("E",stringToAsciiOrUTF16BE(r));n&&e.set("ActualText",stringToAsciiOrUTF16BE(n))}static#K({elements:e,xref:t,pageDict:i,numberTree:a}){const s=new Map;for(const t of e)if(t.structTreeParentId){const e=parseInt(t.structTreeParentId.split("_mc")[1],10);let i=s.get(e);if(!i){i=[];s.set(e,i)}i.push(t)}const r=i.get("StructParents");if(!Number.isInteger(r))return;const n=a.get(r),updateElement=(e,i,a)=>{const r=s.get(e);if(r){const e=i.getRaw("P"),s=t.fetchIfRef(e);if(e instanceof Ref&&s instanceof Dict){const e={ref:a,dict:i};for(const t of r)t.structTreeParent=e}return!0}return!1};for(const e of n){if(!(e instanceof Ref))continue;const i=t.fetch(e),a=i.get("K");if(Number.isInteger(a))updateElement(a,i,e);else if(Array.isArray(a))for(let s of a){s=t.fetchIfRef(s);if(Number.isInteger(s)&&updateElement(s,i,e))break;if(!(s instanceof Dict))continue;if(!isName(s.get("Type"),"MCR"))break;const a=s.get("MCID");if(Number.isInteger(a)&&updateElement(a,i,e))break}}}static async#q({structTreeParent:e,tagDict:t,newTagRef:i,structTreeRootRef:a,fallbackKids:s,xref:r,cache:n}){let g,o=null;if(e){({ref:o}=e);g=e.dict.getRaw("P")||a}else g=a;t.set("P",g);const c=r.fetchIfRef(g);if(!c){s.push(i);return}let C=n.get(g);if(!C){C=c.clone();n.put(g,C)}const h=C.getRaw("K");let l=h instanceof Ref?n.get(h):null;if(!l){l=r.fetchIfRef(h);l=Array.isArray(l)?l.slice():[h];const e=r.getNewTemporaryRef();C.set("K",e);n.put(e,l)}const Q=l.indexOf(o);l.splice(Q>=0?Q+1:l.length,0,i)}}class StructElementNode{constructor(e,t){this.tree=e;this.dict=t;this.kids=[];this.parseKids()}get role(){const e=this.dict.get("S"),t=e instanceof Name?e.name:"",{root:i}=this.tree;return i.roleMap.has(t)?i.roleMap.get(t):t}parseKids(){let e=null;const t=this.dict.getRaw("Pg");t instanceof Ref&&(e=t.toString());const i=this.dict.get("K");if(Array.isArray(i))for(const t of i){const i=this.parseKid(e,t);i&&this.kids.push(i)}else{const t=this.parseKid(e,i);t&&this.kids.push(t)}}parseKid(e,t){if(Number.isInteger(t))return this.tree.pageDict.objId!==e?null:new StructElement({type:qs,mcid:t,pageObjId:e});let i=null;t instanceof Ref?i=this.dict.xref.fetch(t):t instanceof Dict&&(i=t);if(!i)return null;const a=i.getRaw("Pg");a instanceof Ref&&(e=a.toString());const s=i.get("Type")instanceof Name?i.get("Type").name:null;if("MCR"===s){if(this.tree.pageDict.objId!==e)return null;const t=i.getRaw("Stm");return new StructElement({type:Os,refObjId:t instanceof Ref?t.toString():null,pageObjId:e,mcid:i.get("MCID")})}if("OBJR"===s){if(this.tree.pageDict.objId!==e)return null;const t=i.getRaw("Obj");return new StructElement({type:Ws,refObjId:t instanceof Ref?t.toString():null,pageObjId:e})}return new StructElement({type:Xs,dict:i})}}class StructElement{constructor({type:e,dict:t=null,mcid:i=null,pageObjId:a=null,refObjId:s=null}){this.type=e;this.dict=t;this.mcid=i;this.pageObjId=a;this.refObjId=s;this.parentNode=null}}class StructTreePage{constructor(e,t){this.root=e;this.rootDict=e?e.dict:null;this.pageDict=t;this.nodes=[]}collectObjects(e){if(!(this.root&&this.rootDict&&e instanceof Ref))return null;const t=this.rootDict.get("ParentTree");if(!t)return null;const i=this.root.structParentIds?.get(e);if(!i)return null;const a=new Map,s=new NumberTree(t,this.rootDict.xref);for(const[e]of i){const t=s.getRaw(e);t instanceof Ref&&a.set(e,t)}return a}parse(e){if(!(this.root&&this.rootDict&&e instanceof Ref))return;const t=this.rootDict.get("ParentTree");if(!t)return;const i=this.pageDict.get("StructParents"),a=this.root.structParentIds?.get(e);if(!Number.isInteger(i)&&!a)return;const s=new Map,r=new NumberTree(t,this.rootDict.xref);if(Number.isInteger(i)){const e=r.get(i);if(Array.isArray(e))for(const t of e)t instanceof Ref&&this.addNode(this.rootDict.xref.fetch(t),s)}if(a)for(const[e,t]of a){const i=r.get(e);if(i){const e=this.addNode(this.rootDict.xref.fetchIfRef(i),s);1===e?.kids?.length&&e.kids[0].type===Ws&&(e.kids[0].type=t)}}}addNode(e,t,i=0){if(i>40){warn("StructTree MAX_DEPTH reached.");return null}if(!(e instanceof Dict))return null;if(t.has(e))return t.get(e);const a=new StructElementNode(this,e);t.set(e,a);const s=e.get("P");if(!s||isName(s.get("Type"),"StructTreeRoot")){this.addTopLevelNode(e,a)||t.delete(e);return a}const r=this.addNode(s,t,i+1);if(!r)return a;let n=!1;for(const t of r.kids)if(t.type===Xs&&t.dict===e){t.parentNode=a;n=!0}n||t.delete(e);return a}addTopLevelNode(e,t){const i=this.rootDict.get("K");if(!i)return!1;if(i instanceof Dict){if(i.objId!==e.objId)return!1;this.nodes[0]=t;return!0}if(!Array.isArray(i))return!0;let a=!1;for(let s=0;s40){warn("StructTree too deep to be fully serialized.");return}const a=Object.create(null);a.role=e.role;a.children=[];t.children.push(a);let s=e.dict.get("Alt");"string"!=typeof s&&(s=e.dict.get("ActualText"));"string"==typeof s&&(a.alt=stringToPDFString(s));const r=e.dict.get("A");if(r instanceof Dict){const e=lookupNormalRect(r.getArray("BBox"),null);if(e)a.bbox=e;else{const e=r.get("Width"),t=r.get("Height");"number"==typeof e&&e>0&&"number"==typeof t&&t>0&&(a.bbox=[0,0,e,t])}}const n=e.dict.get("Lang");"string"==typeof n&&(a.lang=stringToPDFString(n));for(const t of e.kids){const e=t.type===Xs?t.parentNode:null;e?nodeToSerializable(e,a,i+1):t.type===qs||t.type===Os?a.children.push({type:"content",id:`p${t.pageObjId}_mc${t.mcid}`}):t.type===Ws?a.children.push({type:"object",id:t.refObjId}):t.type===js&&a.children.push({type:"annotation",id:`pdfjs_internal_id_${t.refObjId}`})}}const e=Object.create(null);e.children=[];e.role="Root";for(const t of this.nodes)t&&nodeToSerializable(t,e);return e}}function isValidExplicitDest(e){if(!Array.isArray(e)||e.length<2)return!1;const[t,i,...a]=e;if(!(t instanceof Ref||Number.isInteger(t)))return!1;if(!(i instanceof Name))return!1;const s=a.length;let r=!0;switch(i.name){case"XYZ":if(s<2||s>3)return!1;break;case"Fit":case"FitB":return 0===s;case"FitH":case"FitBH":case"FitV":case"FitBV":if(s>1)return!1;break;case"FitR":if(4!==s)return!1;r=!1;break;default:return!1}for(const e of a)if(!("number"==typeof e||r&&null===e))return!1;return!0}function fetchDest(e){e instanceof Dict&&(e=e.get("D"));return isValidExplicitDest(e)?e:null}function fetchRemoteDest(e){let t=e.get("D");if(t){t instanceof Name&&(t=t.name);if("string"==typeof t)return stringToPDFString(t);if(isValidExplicitDest(t))return JSON.stringify(t)}return null}class Catalog{constructor(e,t){this.pdfManager=e;this.xref=t;this._catDict=t.getCatalogObj();if(!(this._catDict instanceof Dict))throw new FormatError("Catalog object is not a dictionary.");this.toplevelPagesDict;this._actualNumPages=null;this.fontCache=new RefSetCache;this.builtInCMapCache=new Map;this.standardFontDataCache=new Map;this.globalImageCache=new GlobalImageCache;this.pageKidsCountCache=new RefSetCache;this.pageIndexCache=new RefSetCache;this.pageDictCache=new RefSetCache;this.nonBlendModesSet=new RefSet;this.systemFontCache=new Map}cloneDict(){return this._catDict.clone()}get version(){const e=this._catDict.get("Version");if(e instanceof Name){if(St.test(e.name))return shadow(this,"version",e.name);warn(`Invalid PDF catalog version: ${e.name}`)}return shadow(this,"version",null)}get lang(){const e=this._catDict.get("Lang");return shadow(this,"lang",e&&"string"==typeof e?stringToPDFString(e):null)}get needsRendering(){const e=this._catDict.get("NeedsRendering");return shadow(this,"needsRendering","boolean"==typeof e&&e)}get collection(){let e=null;try{const t=this._catDict.get("Collection");t instanceof Dict&&t.size>0&&(e=t)}catch(e){if(e instanceof MissingDataException)throw e;info("Cannot fetch Collection entry; assuming no collection is present.")}return shadow(this,"collection",e)}get acroForm(){let e=null;try{const t=this._catDict.get("AcroForm");t instanceof Dict&&t.size>0&&(e=t)}catch(e){if(e instanceof MissingDataException)throw e;info("Cannot fetch AcroForm entry; assuming no forms are present.")}return shadow(this,"acroForm",e)}get acroFormRef(){const e=this._catDict.getRaw("AcroForm");return shadow(this,"acroFormRef",e instanceof Ref?e:null)}get metadata(){const e=this._catDict.getRaw("Metadata");if(!(e instanceof Ref))return shadow(this,"metadata",null);let t=null;try{const i=this.xref.fetch(e,!this.xref.encrypt?.encryptMetadata);if(i instanceof BaseStream&&i.dict instanceof Dict){const e=i.dict.get("Type"),a=i.dict.get("Subtype");if(isName(e,"Metadata")&&isName(a,"XML")){const e=stringToUTF8String(i.getString());e&&(t=new MetadataParser(e).serializable)}}}catch(e){if(e instanceof MissingDataException)throw e;info(`Skipping invalid Metadata: "${e}".`)}return shadow(this,"metadata",t)}get markInfo(){let e=null;try{e=this._readMarkInfo()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable to read mark info.")}return shadow(this,"markInfo",e)}_readMarkInfo(){const e=this._catDict.get("MarkInfo");if(!(e instanceof Dict))return null;const t={Marked:!1,UserProperties:!1,Suspects:!1};for(const i in t){const a=e.get(i);"boolean"==typeof a&&(t[i]=a)}return t}get structTreeRoot(){let e=null;try{e=this._readStructTreeRoot()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable read to structTreeRoot info.")}return shadow(this,"structTreeRoot",e)}_readStructTreeRoot(){const e=this._catDict.getRaw("StructTreeRoot"),t=this.xref.fetchIfRef(e);if(!(t instanceof Dict))return null;const i=new StructTreeRoot(t,e);i.init();return i}get toplevelPagesDict(){const e=this._catDict.get("Pages");if(!(e instanceof Dict))throw new FormatError("Invalid top-level pages dictionary.");return shadow(this,"toplevelPagesDict",e)}get documentOutline(){let e=null;try{e=this._readDocumentOutline()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable to read document outline.")}return shadow(this,"documentOutline",e)}_readDocumentOutline(){let e=this._catDict.get("Outlines");if(!(e instanceof Dict))return null;e=e.getRaw("First");if(!(e instanceof Ref))return null;const t={items:[]},i=[{obj:e,parent:t}],a=new RefSet;a.put(e);const s=this.xref,r=new Uint8ClampedArray(3);for(;i.length>0;){const t=i.shift(),n=s.fetchIfRef(t.obj);if(null===n)continue;n.has("Title")||warn("Invalid outline item encountered.");const g={url:null,dest:null,action:null};Catalog.parseDestDictionary({destDict:n,resultObj:g,docBaseUrl:this.baseUrl,docAttachments:this.attachments});const o=n.get("Title"),c=n.get("F")||0,C=n.getArray("C"),h=n.get("Count");let l=r;!isNumberArray(C,3)||0===C[0]&&0===C[1]&&0===C[2]||(l=ColorSpace.singletons.rgb.getRgb(C,0));const Q={action:g.action,attachment:g.attachment,dest:g.dest,url:g.url,unsafeUrl:g.unsafeUrl,newWindow:g.newWindow,setOCGState:g.setOCGState,title:"string"==typeof o?stringToPDFString(o):"",color:l,count:Number.isInteger(h)?h:void 0,bold:!!(2&c),italic:!!(1&c),items:[]};t.parent.items.push(Q);e=n.getRaw("First");if(e instanceof Ref&&!a.has(e)){i.push({obj:e,parent:Q});a.put(e)}e=n.getRaw("Next");if(e instanceof Ref&&!a.has(e)){i.push({obj:e,parent:t.parent});a.put(e)}}return t.items.length>0?t.items:null}get permissions(){let e=null;try{e=this._readPermissions()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable to read permissions.")}return shadow(this,"permissions",e)}_readPermissions(){const e=this.xref.trailer.get("Encrypt");if(!(e instanceof Dict))return null;let t=e.get("P");if("number"!=typeof t)return null;t+=2**32;const i=[];for(const e in y){const a=y[e];t&a&&i.push(a)}return i}get optionalContentConfig(){let e=null;try{const t=this._catDict.get("OCProperties");if(!t)return shadow(this,"optionalContentConfig",null);const i=t.get("D");if(!i)return shadow(this,"optionalContentConfig",null);const a=t.get("OCGs");if(!Array.isArray(a))return shadow(this,"optionalContentConfig",null);const s=new RefSetCache;for(const e of a)e instanceof Ref&&!s.has(e)&&s.put(e,this.#O(e));e=this.#P(i,s)}catch(e){if(e instanceof MissingDataException)throw e;warn(`Unable to read optional content config: ${e}`)}return shadow(this,"optionalContentConfig",e)}#O(e){const t=this.xref.fetch(e),i={id:e.toString(),name:null,intent:null,usage:{print:null,view:null},rbGroups:[]},a=t.get("Name");"string"==typeof a&&(i.name=stringToPDFString(a));let s=t.getArray("Intent");Array.isArray(s)||(s=[s]);s.every((e=>e instanceof Name))&&(i.intent=s.map((e=>e.name)));const r=t.get("Usage");if(!(r instanceof Dict))return i;const n=i.usage,g=r.get("Print");if(g instanceof Dict){const e=g.get("PrintState");if(e instanceof Name)switch(e.name){case"ON":case"OFF":n.print={printState:e.name}}}const o=r.get("View");if(o instanceof Dict){const e=o.get("ViewState");if(e instanceof Name)switch(e.name){case"ON":case"OFF":n.view={viewState:e.name}}}return i}#P(e,t){function parseOnOff(e){const i=[];if(Array.isArray(e))for(const a of e)a instanceof Ref&&t.has(a)&&i.push(a.toString());return i}function parseOrder(e,i=0){if(!Array.isArray(e))return null;const s=[];for(const r of e){if(r instanceof Ref&&t.has(r)){a.put(r);s.push(r.toString());continue}const e=parseNestedOrder(r,i);e&&s.push(e)}if(i>0)return s;const r=[];for(const[e]of t.items())a.has(e)||r.push(e.toString());r.length&&s.push({name:null,order:r});return s}function parseNestedOrder(e,t){if(++t>s){warn("parseNestedOrder - reached MAX_NESTED_LEVELS.");return null}const a=i.fetchIfRef(e);if(!Array.isArray(a))return null;const r=i.fetchIfRef(a[0]);if("string"!=typeof r)return null;const n=parseOrder(a.slice(1),t);return n&&n.length?{name:stringToPDFString(r),order:n}:null}const i=this.xref,a=new RefSet,s=10;!function parseRBGroups(e){if(Array.isArray(e))for(const a of e){const e=i.fetchIfRef(a);if(!Array.isArray(e)||!e.length)continue;const s=new Set;for(const i of e)if(i instanceof Ref&&t.has(i)&&!s.has(i.toString())){s.add(i.toString());t.get(i).rbGroups.push(s)}}}(e.get("RBGroups"));return{name:"string"==typeof e.get("Name")?stringToPDFString(e.get("Name")):null,creator:"string"==typeof e.get("Creator")?stringToPDFString(e.get("Creator")):null,baseState:e.get("BaseState")instanceof Name?e.get("BaseState").name:null,on:parseOnOff(e.get("ON")),off:parseOnOff(e.get("OFF")),order:parseOrder(e.get("Order")),groups:[...t]}}setActualNumPages(e=null){this._actualNumPages=e}get hasActualNumPages(){return null!==this._actualNumPages}get _pagesCount(){const e=this.toplevelPagesDict.get("Count");if(!Number.isInteger(e))throw new FormatError("Page count in top-level pages dictionary is not an integer.");return shadow(this,"_pagesCount",e)}get numPages(){return this.hasActualNumPages?this._actualNumPages:this._pagesCount}get destinations(){const e=this._readDests(),t=Object.create(null);if(e instanceof NameTree)for(const[i,a]of e.getAll()){const e=fetchDest(a);e&&(t[stringToPDFString(i)]=e)}else e instanceof Dict&&e.forEach((function(e,i){const a=fetchDest(i);a&&(t[e]=a)}));return shadow(this,"destinations",t)}getDestination(e){const t=this._readDests();if(t instanceof NameTree){const i=fetchDest(t.get(e));if(i)return i;const a=this.destinations[e];if(a){warn(`Found "${e}" at an incorrect position in the NameTree.`);return a}}else if(t instanceof Dict){const i=fetchDest(t.get(e));if(i)return i}return null}_readDests(){const e=this._catDict.get("Names");return e?.has("Dests")?new NameTree(e.getRaw("Dests"),this.xref):this._catDict.has("Dests")?this._catDict.get("Dests"):void 0}get pageLabels(){let e=null;try{e=this._readPageLabels()}catch(e){if(e instanceof MissingDataException)throw e;warn("Unable to read page labels.")}return shadow(this,"pageLabels",e)}_readPageLabels(){const e=this._catDict.getRaw("PageLabels");if(!e)return null;const t=new Array(this.numPages);let i=null,a="";const s=new NumberTree(e,this.xref).getAll();let r="",n=1;for(let e=0,g=this.numPages;e=1))throw new FormatError("Invalid start in PageLabel dictionary.");n=e}else n=1}switch(i){case"D":r=n;break;case"R":case"r":r=toRomanNumerals(n,"r"===i);break;case"A":case"a":const e=26,t="a"===i?97:65,a=n-1;r=String.fromCharCode(t+a%e).repeat(Math.floor(a/e)+1);break;default:if(i)throw new FormatError(`Invalid style "${i}" in PageLabel dictionary.`);r=""}t[e]=a+r;n++}return t}get pageLayout(){const e=this._catDict.get("PageLayout");let t="";if(e instanceof Name)switch(e.name){case"SinglePage":case"OneColumn":case"TwoColumnLeft":case"TwoColumnRight":case"TwoPageLeft":case"TwoPageRight":t=e.name}return shadow(this,"pageLayout",t)}get pageMode(){const e=this._catDict.get("PageMode");let t="UseNone";if(e instanceof Name)switch(e.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"FullScreen":case"UseOC":case"UseAttachments":t=e.name}return shadow(this,"pageMode",t)}get viewerPreferences(){const e=this._catDict.get("ViewerPreferences");if(!(e instanceof Dict))return shadow(this,"viewerPreferences",null);let t=null;for(const i of e.getKeys()){const a=e.get(i);let s;switch(i){case"HideToolbar":case"HideMenubar":case"HideWindowUI":case"FitWindow":case"CenterWindow":case"DisplayDocTitle":case"PickTrayByPDFSize":"boolean"==typeof a&&(s=a);break;case"NonFullScreenPageMode":if(a instanceof Name)switch(a.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"UseOC":s=a.name;break;default:s="UseNone"}break;case"Direction":if(a instanceof Name)switch(a.name){case"L2R":case"R2L":s=a.name;break;default:s="L2R"}break;case"ViewArea":case"ViewClip":case"PrintArea":case"PrintClip":if(a instanceof Name)switch(a.name){case"MediaBox":case"CropBox":case"BleedBox":case"TrimBox":case"ArtBox":s=a.name;break;default:s="CropBox"}break;case"PrintScaling":if(a instanceof Name)switch(a.name){case"None":case"AppDefault":s=a.name;break;default:s="AppDefault"}break;case"Duplex":if(a instanceof Name)switch(a.name){case"Simplex":case"DuplexFlipShortEdge":case"DuplexFlipLongEdge":s=a.name;break;default:s="None"}break;case"PrintPageRange":if(Array.isArray(a)&&a.length%2==0){a.every(((e,t,i)=>Number.isInteger(e)&&e>0&&(0===t||e>=i[t-1])&&e<=this.numPages))&&(s=a)}break;case"NumCopies":Number.isInteger(a)&&a>0&&(s=a);break;default:warn(`Ignoring non-standard key in ViewerPreferences: ${i}.`);continue}if(void 0!==s){t||(t=Object.create(null));t[i]=s}else warn(`Bad value, for key "${i}", in ViewerPreferences: ${a}.`)}return shadow(this,"viewerPreferences",t)}get openAction(){const e=this._catDict.get("OpenAction"),t=Object.create(null);if(e instanceof Dict){const i=new Dict(this.xref);i.set("A",e);const a={url:null,dest:null,action:null};Catalog.parseDestDictionary({destDict:i,resultObj:a});Array.isArray(a.dest)?t.dest=a.dest:a.action&&(t.action=a.action)}else Array.isArray(e)&&(t.dest=e);return shadow(this,"openAction",objectSize(t)>0?t:null)}get attachments(){const e=this._catDict.get("Names");let t=null;if(e instanceof Dict&&e.has("EmbeddedFiles")){const i=new NameTree(e.getRaw("EmbeddedFiles"),this.xref);for(const[e,a]of i.getAll()){const i=new FileSpec(a,this.xref);t||(t=Object.create(null));t[stringToPDFString(e)]=i.serializable}}return shadow(this,"attachments",t)}get xfaImages(){const e=this._catDict.get("Names");let t=null;if(e instanceof Dict&&e.has("XFAImages")){const i=new NameTree(e.getRaw("XFAImages"),this.xref);for(const[e,a]of i.getAll()){t||(t=new Dict(this.xref));t.set(stringToPDFString(e),a)}}return shadow(this,"xfaImages",t)}_collectJavaScript(){const e=this._catDict.get("Names");let t=null;function appendIfJavaScriptDict(e,i){if(!(i instanceof Dict))return;if(!isName(i.get("S"),"JavaScript"))return;let a=i.get("JS");if(a instanceof BaseStream)a=a.getString();else if("string"!=typeof a)return;a=stringToPDFString(a).replaceAll("\0","");a&&(t||=new Map).set(e,a)}if(e instanceof Dict&&e.has("JavaScript")){const t=new NameTree(e.getRaw("JavaScript"),this.xref);for(const[e,i]of t.getAll())appendIfJavaScriptDict(stringToPDFString(e),i)}const i=this._catDict.get("OpenAction");i&&appendIfJavaScriptDict("OpenAction",i);return t}get jsActions(){const e=this._collectJavaScript();let t=collectActions(this.xref,this._catDict,fA);if(e){t||=Object.create(null);for(const[i,a]of e)i in t?t[i].push(a):t[i]=[a]}return shadow(this,"jsActions",t)}async fontFallback(e,t){const i=await Promise.all(this.fontCache);for(const a of i)if(a.loadedName===e){a.fallback(t);return}}async cleanup(e=!1){clearGlobalCaches();this.globalImageCache.clear(e);this.pageKidsCountCache.clear();this.pageIndexCache.clear();this.pageDictCache.clear();this.nonBlendModesSet.clear();const t=await Promise.all(this.fontCache);for(const{dict:e}of t)delete e.cacheKey;this.fontCache.clear();this.builtInCMapCache.clear();this.standardFontDataCache.clear();this.systemFontCache.clear()}async getPageDict(e){const t=[this.toplevelPagesDict],i=new RefSet,a=this._catDict.getRaw("Pages");a instanceof Ref&&i.put(a);const s=this.xref,r=this.pageKidsCountCache,n=this.pageIndexCache,g=this.pageDictCache;let o=0;for(;t.length;){const a=t.pop();if(a instanceof Ref){const c=r.get(a);if(c>=0&&o+c<=e){o+=c;continue}if(i.has(a))throw new FormatError("Pages tree contains circular reference.");i.put(a);const C=await(g.get(a)||s.fetchAsync(a));if(C instanceof Dict){let t=C.getRaw("Type");t instanceof Ref&&(t=await s.fetchAsync(t));if(isName(t,"Page")||!C.has("Kids")){r.has(a)||r.put(a,1);n.has(a)||n.put(a,o);if(o===e)return[C,a];o++;continue}}t.push(C);continue}if(!(a instanceof Dict))throw new FormatError("Page dictionary kid reference points to wrong type of object.");const{objId:c}=a;let C=a.getRaw("Count");C instanceof Ref&&(C=await s.fetchAsync(C));if(Number.isInteger(C)&&C>=0){c&&!r.has(c)&&r.put(c,C);if(o+C<=e){o+=C;continue}}let h=a.getRaw("Kids");h instanceof Ref&&(h=await s.fetchAsync(h));if(!Array.isArray(h)){let t=a.getRaw("Type");t instanceof Ref&&(t=await s.fetchAsync(t));if(isName(t,"Page")||!a.has("Kids")){if(o===e)return[a,null];o++;continue}throw new FormatError("Page dictionary kids object is not an array.")}for(let e=h.length-1;e>=0;e--){const i=h[e];t.push(i);a===this.toplevelPagesDict&&i instanceof Ref&&!g.has(i)&&g.put(i,s.fetchAsync(i))}}throw new Error(`Page index ${e} not found.`)}async getAllPageDicts(e=!1){const{ignoreErrors:t}=this.pdfManager.evaluatorOptions,i=[{currentNode:this.toplevelPagesDict,posInKids:0}],a=new RefSet,s=this._catDict.getRaw("Pages");s instanceof Ref&&a.put(s);const r=new Map,n=this.xref,g=this.pageIndexCache;let o=0;function addPageDict(e,t){t&&!g.has(t)&&g.put(t,o);r.set(o++,[e,t])}function addPageError(i){if(i instanceof XRefEntryException&&!e)throw i;if(e&&t&&0===o){warn(`getAllPageDicts - Skipping invalid first page: "${i}".`);i=Dict.empty}r.set(o++,[i,null])}for(;i.length>0;){const e=i.at(-1),{currentNode:t,posInKids:s}=e;let r=t.getRaw("Kids");if(r instanceof Ref)try{r=await n.fetchAsync(r)}catch(e){addPageError(e);break}if(!Array.isArray(r)){addPageError(new FormatError("Page dictionary kids object is not an array."));break}if(s>=r.length){i.pop();continue}const g=r[s];let o;if(g instanceof Ref){if(a.has(g)){addPageError(new FormatError("Pages tree contains circular reference."));break}a.put(g);try{o=await n.fetchAsync(g)}catch(e){addPageError(e);break}}else o=g;if(!(o instanceof Dict)){addPageError(new FormatError("Page dictionary kid reference points to wrong type of object."));break}let c=o.getRaw("Type");if(c instanceof Ref)try{c=await n.fetchAsync(c)}catch(e){addPageError(e);break}isName(c,"Page")||!o.has("Kids")?addPageDict(o,g instanceof Ref?g:null):i.push({currentNode:o,posInKids:0});e.posInKids++}return r}getPageIndex(e){const t=this.pageIndexCache.get(e);if(void 0!==t)return Promise.resolve(t);const i=this.xref;let a=0;const next=t=>function pagesBeforeRef(t){let a,s=0;return i.fetchAsync(t).then((function(i){if(isRefsEqual(t,e)&&!isDict(i,"Page")&&!(i instanceof Dict&&!i.has("Type")&&i.has("Contents")))throw new FormatError("The reference does not point to a /Page dictionary.");if(!i)return null;if(!(i instanceof Dict))throw new FormatError("Node must be a dictionary.");a=i.getRaw("Parent");return i.getAsync("Parent")})).then((function(e){if(!e)return null;if(!(e instanceof Dict))throw new FormatError("Parent must be a dictionary.");return e.getAsync("Kids")})).then((function(e){if(!e)return null;const r=[];let n=!1;for(const a of e){if(!(a instanceof Ref))throw new FormatError("Kid must be a reference.");if(isRefsEqual(a,t)){n=!0;break}r.push(i.fetchAsync(a).then((function(e){if(!(e instanceof Dict))throw new FormatError("Kid node must be a dictionary.");e.has("Count")?s+=e.get("Count"):s++})))}if(!n)throw new FormatError("Kid reference not found in parent's kids.");return Promise.all(r).then((function(){return[s,a]}))}))}(t).then((t=>{if(!t){this.pageIndexCache.put(e,a);return a}const[i,s]=t;a+=i;return next(s)}));return next(e)}get baseUrl(){const e=this._catDict.get("URI");if(e instanceof Dict){const t=e.get("Base");if("string"==typeof t){const e=createValidAbsoluteUrl(t,null,{tryConvertEncoding:!0});if(e)return shadow(this,"baseUrl",e.href)}}return shadow(this,"baseUrl",this.pdfManager.docBaseUrl)}static parseDestDictionary({destDict:e,resultObj:t,docBaseUrl:i=null,docAttachments:a=null}){if(!(e instanceof Dict)){warn("parseDestDictionary: `destDict` must be a dictionary.");return}let s,r,n=e.get("A");if(!(n instanceof Dict))if(e.has("Dest"))n=e.get("Dest");else{n=e.get("AA");n instanceof Dict&&(n.has("D")?n=n.get("D"):n.has("U")&&(n=n.get("U")))}if(n instanceof Dict){const e=n.get("S");if(!(e instanceof Name)){warn("parseDestDictionary: Invalid type in Action dictionary.");return}const i=e.name;switch(i){case"ResetForm":const e=n.get("Flags"),g=0==(1&("number"==typeof e?e:0)),o=[],c=[];for(const e of n.get("Fields")||[])e instanceof Ref?c.push(e.toString()):"string"==typeof e&&o.push(stringToPDFString(e));t.resetForm={fields:o,refs:c,include:g};break;case"URI":s=n.get("URI");s instanceof Name&&(s="/"+s.name);break;case"GoTo":r=n.get("D");break;case"Launch":case"GoToR":const C=n.get("F");if(C instanceof Dict){const e=new FileSpec(C,null,!0),{rawFilename:t}=e.serializable;s=t}else"string"==typeof C&&(s=C);const h=fetchRemoteDest(n);h&&"string"==typeof s&&(s=s.split("#",1)[0]+"#"+h);const l=n.get("NewWindow");"boolean"==typeof l&&(t.newWindow=l);break;case"GoToE":const Q=n.get("T");let E;if(a&&Q instanceof Dict){const e=Q.get("R"),t=Q.get("N");isName(e,"C")&&"string"==typeof t&&(E=a[stringToPDFString(t)])}if(E){t.attachment=E;const e=fetchRemoteDest(n);e&&(t.attachmentDest=e)}else warn('parseDestDictionary - unimplemented "GoToE" action.');break;case"Named":const u=n.get("N");u instanceof Name&&(t.action=u.name);break;case"SetOCGState":const d=n.get("State"),f=n.get("PreserveRB");if(!Array.isArray(d)||0===d.length)break;const p=[];for(const e of d)if(e instanceof Name)switch(e.name){case"ON":case"OFF":case"Toggle":p.push(e.name)}else e instanceof Ref&&p.push(e.toString());if(p.length!==d.length)break;t.setOCGState={state:p,preserveRB:"boolean"!=typeof f||f};break;case"JavaScript":const m=n.get("JS");let y;m instanceof BaseStream?y=m.getString():"string"==typeof m&&(y=m);const w=y&&recoverJsURL(stringToPDFString(y));if(w){s=w.url;t.newWindow=w.newWindow;break}default:if("JavaScript"===i||"SubmitForm"===i)break;warn(`parseDestDictionary - unsupported action: "${i}".`)}}else e.has("Dest")&&(r=e.get("Dest"));if("string"==typeof s){const e=createValidAbsoluteUrl(s,i,{addDefaultProtocol:!0,tryConvertEncoding:!0});e&&(t.url=e.href);t.unsafeUrl=s}if(r){r instanceof Name&&(r=r.name);"string"==typeof r?t.dest=stringToPDFString(r):isValidExplicitDest(r)&&(t.dest=r)}}}function addChildren(e,t){if(e instanceof Dict)e=e.getRawValues();else if(e instanceof BaseStream)e=e.dict.getRawValues();else if(!Array.isArray(e))return;for(const a of e)((i=a)instanceof Ref||i instanceof Dict||i instanceof BaseStream||Array.isArray(i))&&t.push(a);var i}class ObjectLoader{constructor(e,t,i){this.dict=e;this.keys=t;this.xref=i;this.refSet=null}async load(){if(this.xref.stream.isDataLoaded)return;const{keys:e,dict:t}=this;this.refSet=new RefSet;const i=[];for(const a of e){const e=t.getRaw(a);void 0!==e&&i.push(e)}return this._walk(i)}async _walk(e){const t=[],i=[];for(;e.length;){let a=e.pop();if(a instanceof Ref){if(this.refSet.has(a))continue;try{this.refSet.put(a);a=this.xref.fetch(a)}catch(e){if(!(e instanceof MissingDataException)){warn(`ObjectLoader._walk - requesting all data: "${e}".`);this.refSet=null;const{manager:t}=this.xref.stream;return t.requestAllChunks()}t.push(a);i.push({begin:e.begin,end:e.end})}}if(a instanceof BaseStream){const e=a.getBaseStreams();if(e){let s=!1;for(const t of e)if(!t.isDataLoaded){s=!0;i.push({begin:t.start,end:t.end})}s&&t.push(a)}}addChildren(a,e)}if(i.length){await this.xref.stream.manager.requestRanges(i);for(const e of t)e instanceof Ref&&this.refSet.remove(e);return this._walk(t)}this.refSet=null}}const Zs=Symbol(),Vs=Symbol(),zs=Symbol(),_s=Symbol(),$s=Symbol(),Ar=Symbol(),er=Symbol(),tr=Symbol(),ir=Symbol(),ar=Symbol("content"),sr=Symbol("data"),rr=Symbol(),nr=Symbol("extra"),gr=Symbol(),or=Symbol(),Ir=Symbol(),cr=Symbol(),Cr=Symbol(),hr=Symbol(),lr=Symbol(),Qr=Symbol(),Er=Symbol(),ur=Symbol(),dr=Symbol(),fr=Symbol(),pr=Symbol(),mr=Symbol(),yr=Symbol(),wr=Symbol(),Dr=Symbol(),br=Symbol(),Fr=Symbol(),Sr=Symbol(),kr=Symbol(),Rr=Symbol(),Nr=Symbol(),Gr=Symbol(),xr=Symbol(),Ur=Symbol(),Mr=Symbol(),Lr=Symbol(),Hr=Symbol(),Jr=Symbol(),Yr=Symbol(),vr=Symbol(),Kr=Symbol("namespaceId"),Tr=Symbol("nodeName"),qr=Symbol(),Or=Symbol(),Pr=Symbol(),Wr=Symbol(),jr=Symbol(),Xr=Symbol(),Zr=Symbol(),Vr=Symbol(),zr=Symbol("root"),_r=Symbol(),$r=Symbol(),An=Symbol(),en=Symbol(),tn=Symbol(),an=Symbol(),sn=Symbol(),rn=Symbol(),nn=Symbol(),gn=Symbol(),on=Symbol(),In=Symbol("uid"),cn=Symbol(),Cn={config:{id:0,check:e=>e.startsWith("http://www.xfa.org/schema/xci/")},connectionSet:{id:1,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-connection-set/")},datasets:{id:2,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-data/")},form:{id:3,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-form/")},localeSet:{id:4,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-locale-set/")},pdf:{id:5,check:e=>"http://ns.adobe.com/xdp/pdf/"===e},signature:{id:6,check:e=>"http://www.w3.org/2000/09/xmldsig#"===e},sourceSet:{id:7,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-source-set/")},stylesheet:{id:8,check:e=>"http://www.w3.org/1999/XSL/Transform"===e},template:{id:9,check:e=>e.startsWith("http://www.xfa.org/schema/xfa-template/")},xdc:{id:10,check:e=>e.startsWith("http://www.xfa.org/schema/xdc/")},xdp:{id:11,check:e=>"http://ns.adobe.com/xdp/"===e},xfdf:{id:12,check:e=>"http://ns.adobe.com/xfdf/"===e},xhtml:{id:13,check:e=>"http://www.w3.org/1999/xhtml"===e},xmpmeta:{id:14,check:e=>"http://ns.adobe.com/xmpmeta/"===e}},hn={pt:e=>e,cm:e=>e/2.54*72,mm:e=>e/25.4*72,in:e=>72*e,px:e=>e},ln=/([+-]?\d+\.?\d*)(.*)/;function stripQuotes(e){return e.startsWith("'")||e.startsWith('"')?e.slice(1,-1):e}function getInteger({data:e,defaultValue:t,validate:i}){if(!e)return t;e=e.trim();const a=parseInt(e,10);return!isNaN(a)&&i(a)?a:t}function getFloat({data:e,defaultValue:t,validate:i}){if(!e)return t;e=e.trim();const a=parseFloat(e);return!isNaN(a)&&i(a)?a:t}function getKeyword({data:e,defaultValue:t,validate:i}){return e&&i(e=e.trim())?e:t}function getStringOption(e,t){return getKeyword({data:e,defaultValue:t[0],validate:e=>t.includes(e)})}function getMeasurement(e,t="0"){t||="0";if(!e)return getMeasurement(t);const i=e.trim().match(ln);if(!i)return getMeasurement(t);const[,a,s]=i,r=parseFloat(a);if(isNaN(r))return getMeasurement(t);if(0===r)return 0;const n=hn[s];return n?n(r):r}function getRatio(e){if(!e)return{num:1,den:1};const t=e.trim().split(/\s*:\s*/).map((e=>parseFloat(e))).filter((e=>!isNaN(e)));1===t.length&&t.push(1);if(0===t.length)return{num:1,den:1};const[i,a]=t;return{num:i,den:a}}function getRelevant(e){return e?e.trim().split(/\s+/).map((e=>({excluded:"-"===e[0],viewname:e.substring(1)}))):[]}class HTMLResult{static get FAILURE(){return shadow(this,"FAILURE",new HTMLResult(!1,null,null,null))}static get EMPTY(){return shadow(this,"EMPTY",new HTMLResult(!0,null,null,null))}constructor(e,t,i,a){this.success=e;this.html=t;this.bbox=i;this.breakNode=a}isBreak(){return!!this.breakNode}static breakNode(e){return new HTMLResult(!1,null,null,e)}static success(e,t=null){return new HTMLResult(!0,e,t,null)}}class FontFinder{constructor(e){this.fonts=new Map;this.cache=new Map;this.warned=new Set;this.defaultFont=null;this.add(e)}add(e,t=null){for(const t of e)this.addPdfFont(t);for(const e of this.fonts.values())e.regular||(e.regular=e.italic||e.bold||e.bolditalic);if(!t||0===t.size)return;const i=this.fonts.get("PdfJS-Fallback-PdfJS-XFA");for(const e of t)this.fonts.set(e,i)}addPdfFont(e){const t=e.cssFontInfo,i=t.fontFamily;let a=this.fonts.get(i);if(!a){a=Object.create(null);this.fonts.set(i,a);this.defaultFont||(this.defaultFont=a)}let s="";const r=parseFloat(t.fontWeight);0!==parseFloat(t.italicAngle)?s=r>=700?"bolditalic":"italic":r>=700&&(s="bold");if(!s){(e.name.includes("Bold")||e.psName?.includes("Bold"))&&(s="bold");(e.name.includes("Italic")||e.name.endsWith("It")||e.psName?.includes("Italic")||e.psName?.endsWith("It"))&&(s+="italic")}s||(s="regular");a[s]=e}getDefault(){return this.defaultFont}find(e,t=!0){let i=this.fonts.get(e)||this.cache.get(e);if(i)return i;const a=/,|-|_| |bolditalic|bold|italic|regular|it/gi;let s=e.replaceAll(a,"");i=this.fonts.get(s);if(i){this.cache.set(e,i);return i}s=s.toLowerCase();const r=[];for(const[e,t]of this.fonts.entries())e.replaceAll(a,"").toLowerCase().startsWith(s)&&r.push(t);if(0===r.length)for(const[,e]of this.fonts.entries())e.regular.name?.replaceAll(a,"").toLowerCase().startsWith(s)&&r.push(e);if(0===r.length){s=s.replaceAll(/psmt|mt/gi,"");for(const[e,t]of this.fonts.entries())e.replaceAll(a,"").toLowerCase().startsWith(s)&&r.push(t)}if(0===r.length)for(const e of this.fonts.values())e.regular.name?.replaceAll(a,"").toLowerCase().startsWith(s)&&r.push(e);if(r.length>=1){1!==r.length&&t&&warn(`XFA - Too many choices to guess the correct font: ${e}`);this.cache.set(e,r[0]);return r[0]}if(t&&!this.warned.has(e)){this.warned.add(e);warn(`XFA - Cannot find the font: ${e}`)}return null}}function selectFont(e,t){return"italic"===e.posture?"bold"===e.weight?t.bolditalic:t.italic:"bold"===e.weight?t.bold:t.regular}class FontInfo{constructor(e,t,i,a){this.lineHeight=i;this.paraMargin=t||{top:0,bottom:0,left:0,right:0};if(!e){[this.pdfFont,this.xfaFont]=this.defaultFont(a);return}this.xfaFont={typeface:e.typeface,posture:e.posture,weight:e.weight,size:e.size,letterSpacing:e.letterSpacing};const s=a.find(e.typeface);if(s){this.pdfFont=selectFont(e,s);this.pdfFont||([this.pdfFont,this.xfaFont]=this.defaultFont(a))}else[this.pdfFont,this.xfaFont]=this.defaultFont(a)}defaultFont(e){const t=e.find("Helvetica",!1)||e.find("Myriad Pro",!1)||e.find("Arial",!1)||e.getDefault();if(t?.regular){const e=t.regular;return[e,{typeface:e.cssFontInfo.fontFamily,posture:"normal",weight:"normal",size:10,letterSpacing:0}]}return[null,{typeface:"Courier",posture:"normal",weight:"normal",size:10,letterSpacing:0}]}}class FontSelector{constructor(e,t,i,a){this.fontFinder=a;this.stack=[new FontInfo(e,t,i,a)]}pushData(e,t,i){const a=this.stack.at(-1);for(const t of["typeface","posture","weight","size","letterSpacing"])e[t]||(e[t]=a.xfaFont[t]);for(const e of["top","bottom","left","right"])isNaN(t[e])&&(t[e]=a.paraMargin[e]);const s=new FontInfo(e,t,i||a.lineHeight,this.fontFinder);s.pdfFont||(s.pdfFont=a.pdfFont);this.stack.push(s)}popFont(){this.stack.pop()}topFont(){return this.stack.at(-1)}}class TextMeasure{constructor(e,t,i,a){this.glyphs=[];this.fontSelector=new FontSelector(e,t,i,a);this.extraHeight=0}pushData(e,t,i){this.fontSelector.pushData(e,t,i)}popFont(e){return this.fontSelector.popFont()}addPara(){const e=this.fontSelector.topFont();this.extraHeight+=e.paraMargin.top+e.paraMargin.bottom}addString(e){if(!e)return;const t=this.fontSelector.topFont(),i=t.xfaFont.size;if(t.pdfFont){const a=t.xfaFont.letterSpacing,s=t.pdfFont,r=s.lineHeight||1.2,n=t.lineHeight||Math.max(1.2,r)*i,g=r-(void 0===s.lineGap?.2:s.lineGap),o=Math.max(1,g)*i,c=i/1e3,C=s.defaultWidth||s.charsToGlyphs(" ")[0].width;for(const t of e.split(/[\u2029\n]/)){const e=s.encodeString(t).join(""),i=s.charsToGlyphs(e);for(const e of i){const t=e.width||C;this.glyphs.push([t*c+a,n,o,e.unicode,!1])}this.glyphs.push([0,0,0,"\n",!0])}this.glyphs.pop()}else{for(const t of e.split(/[\u2029\n]/)){for(const e of t.split(""))this.glyphs.push([i,1.2*i,i,e,!1]);this.glyphs.push([0,0,0,"\n",!0])}this.glyphs.pop()}}compute(e){let t=-1,i=0,a=0,s=0,r=0,n=0,g=!1,o=!0;for(let c=0,C=this.glyphs.length;ce){a=Math.max(a,r);r=0;s+=n;n=d;t=-1;i=0;g=!0;o=!1}else{n=Math.max(d,n);i=r;r+=C;t=c}else if(r+C>e){s+=n;n=d;if(-1!==t){c=t;a=Math.max(a,i);r=0;t=-1;i=0}else{a=Math.max(a,r);r=C}g=!0;o=!1}else{r+=C;n=Math.max(d,n)}}a=Math.max(a,r);s+=n+this.extraHeight;return{width:1.02*a,height:s,isBroken:g}}}const Bn=/^[^.[]+/,Qn=/^[^\]]+/,En={dot:0,dotDot:1,dotHash:2,dotBracket:3,dotParen:4},un=new Map([["$data",(e,t)=>e.datasets?e.datasets.data:e],["$record",(e,t)=>(e.datasets?e.datasets.data:e)[fr]()[0]],["$template",(e,t)=>e.template],["$connectionSet",(e,t)=>e.connectionSet],["$form",(e,t)=>e.form],["$layout",(e,t)=>e.layout],["$host",(e,t)=>e.host],["$dataWindow",(e,t)=>e.dataWindow],["$event",(e,t)=>e.event],["!",(e,t)=>e.datasets],["$xfa",(e,t)=>e],["xfa",(e,t)=>e],["$",(e,t)=>t]]),dn=new WeakMap;function parseExpression(e,t,i=!0){let a=e.match(Bn);if(!a)return null;let[s]=a;const r=[{name:s,cacheName:"."+s,index:0,js:null,formCalc:null,operator:En.dot}];let n=s.length;for(;n0&&C.push(e)}if(0!==C.length||g||0!==o)e=isFinite(c)?C.filter((e=>ce[c])):C.flat();else{const i=t[wr]();if(!(t=i))return null;o=-1;e=[t]}}return 0===e.length?null:e}function createDataNode(e,t,i){const a=parseExpression(i);if(!a)return null;if(a.some((e=>e.operator===En.dotDot)))return null;const s=un.get(a[0].name);let r=0;if(s){e=s(e,t);r=1}else e=t||e;for(let t=a.length;re[sn]())).join("")}get[mn](){const e=Object.getPrototypeOf(this);if(!e._attributes){const t=e._attributes=new Set;for(const e of Object.getOwnPropertyNames(this)){if(null===this[e]||this[e]instanceof XFAObject||this[e]instanceof XFAObjectArray)break;t.add(e)}}return shadow(this,mn,e._attributes)}[Ur](e){let t=this;for(;t;){if(t===e)return!0;t=t[wr]()}return!1}[wr](){return this[xn]}[yr](){return this[wr]()}[fr](e=null){return e?this[e]:this[yn]}[rr](){const e=Object.create(null);this[ar]&&(e.$content=this[ar]);for(const t of Object.getOwnPropertyNames(this)){const i=this[t];null!==i&&(i instanceof XFAObject?e[t]=i[rr]():i instanceof XFAObjectArray?i.isEmpty()||(e[t]=i.dump()):e[t]=i)}return e}[on](){return null}[nn](){return HTMLResult.EMPTY}*[pr](){for(const e of this[fr]())yield e}*[Fn](e,t){for(const i of this[pr]())if(!e||t===e.has(i[Tr])){const e=this[Cr](),t=i[nn](e);t.success||(this[nr].failingNode=i);yield t}}[or](){return null}[Vs](e,t){this[nr].children.push(e)}[Cr](){}[_s]({filter:e=null,include:t=!0}){if(this[nr].generator){const e=this[Cr](),t=this[nr].failingNode[nn](e);if(!t.success)return t;t.html&&this[Vs](t.html,t.bbox);delete this[nr].failingNode}else this[nr].generator=this[Fn](e,t);for(;;){const e=this[nr].generator.next();if(e.done)break;const t=e.value;if(!t.success)return t;t.html&&this[Vs](t.html,t.bbox)}this[nr].generator=null;return HTMLResult.EMPTY}[en](e){this[Mn]=new Set(Object.keys(e))}[kn](e){const t=this[mn],i=this[Mn];return[...e].filter((e=>t.has(e)&&!i.has(e)))}[_r](e,t=new Set){for(const i of this[yn])i[Un](e,t)}[Un](e,t){const i=this[Sn](e,t);i?this[fn](i,e,t):this[_r](e,t)}[Sn](e,t){const{use:i,usehref:a}=this;if(!i&&!a)return null;let s=null,r=null,n=null,g=i;if(a){g=a;a.startsWith("#som(")&&a.endsWith(")")?r=a.slice(5,-1):a.startsWith(".#som(")&&a.endsWith(")")?r=a.slice(6,-1):a.startsWith("#")?n=a.slice(1):a.startsWith(".#")&&(n=a.slice(2))}else i.startsWith("#")?n=i.slice(1):r=i;this.use=this.usehref="";if(n)s=e.get(n);else{s=searchNode(e.get(zr),this,r,!0,!1);s&&(s=s[0])}if(!s){warn(`XFA - Invalid prototype reference: ${g}.`);return null}if(s[Tr]!==this[Tr]){warn(`XFA - Incompatible prototype: ${s[Tr]} !== ${this[Tr]}.`);return null}if(t.has(s)){warn("XFA - Cycle detected in prototypes use.");return null}t.add(s);const o=s[Sn](e,t);o&&s[fn](o,e,t);s[_r](e,t);t.delete(s);return s}[fn](e,t,i){if(i.has(e)){warn("XFA - Cycle detected in prototypes use.");return}!this[ar]&&e[ar]&&(this[ar]=e[ar]);new Set(i).add(e);for(const t of this[kn](e[Mn])){this[t]=e[t];this[Mn]&&this[Mn].add(t)}for(const a of Object.getOwnPropertyNames(this)){if(this[mn].has(a))continue;const s=this[a],r=e[a];if(s instanceof XFAObjectArray){for(const e of s[yn])e[Un](t,i);for(let a=s[yn].length,n=r[yn].length;aXFAObject[wn](e))):"object"==typeof e&&null!==e?Object.assign({},e):e}[tr](){const e=Object.create(Object.getPrototypeOf(this));for(const t of Object.getOwnPropertySymbols(this))try{e[t]=this[t]}catch{shadow(e,t,this[t])}e[In]=`${e[Tr]}${Hn++}`;e[yn]=[];for(const t of Object.getOwnPropertyNames(this)){if(this[mn].has(t)){e[t]=XFAObject[wn](this[t]);continue}const i=this[t];e[t]=i instanceof XFAObjectArray?new XFAObjectArray(i[Nn]):null}for(const t of this[yn]){const i=t[Tr],a=t[tr]();e[yn].push(a);a[xn]=e;null===e[i]?e[i]=a:e[i][yn].push(a)}return e}[fr](e=null){return e?this[yn].filter((t=>t[Tr]===e)):this[yn]}[hr](e){return this[e]}[lr](e,t,i=!0){return Array.from(this[Qr](e,t,i))}*[Qr](e,t,i=!0){if("parent"!==e){for(const i of this[yn]){i[Tr]===e&&(yield i);i.name===e&&(yield i);(t||i[Jr]())&&(yield*i[Qr](e,t,!1))}i&&this[mn].has(e)&&(yield new XFAAttribute(this,e,this[e]))}else yield this[xn]}}class XFAObjectArray{constructor(e=1/0){this[Nn]=e;this[yn]=[]}get isXFAObject(){return!1}get isXFAObjectArray(){return!0}push(e){if(this[yn].length<=this[Nn]){this[yn].push(e);return!0}warn(`XFA - node "${e[Tr]}" accepts no more than ${this[Nn]} children`);return!1}isEmpty(){return 0===this[yn].length}dump(){return 1===this[yn].length?this[yn][0][rr]():this[yn].map((e=>e[rr]()))}[tr](){const e=new XFAObjectArray(this[Nn]);e[yn]=this[yn].map((e=>e[tr]()));return e}get children(){return this[yn]}clear(){this[yn].length=0}}class XFAAttribute{constructor(e,t,i){this[xn]=e;this[Tr]=t;this[ar]=i;this[ir]=!1;this[In]="attribute"+Hn++}[wr](){return this[xn]}[xr](){return!0}[Er](){return this[ar].trim()}[tn](e){e=e.value||"";this[ar]=e.toString()}[sn](){return this[ar]}[Ur](e){return this[xn]===e||this[xn][Ur](e)}}class XmlObject extends XFAObject{constructor(e,t,i={}){super(e,t);this[ar]="";this[Dn]=null;if("#text"!==t){const e=new Map;this[pn]=e;for(const[t,a]of Object.entries(i))e.set(t,new XFAAttribute(this,t,a));if(i.hasOwnProperty(qr)){const e=i[qr].xfa.dataNode;void 0!==e&&("dataGroup"===e?this[Dn]=!1:"dataValue"===e&&(this[Dn]=!0))}}this[ir]=!1}[gn](e){const t=this[Tr];if("#text"===t){e.push(encodeToXmlString(this[ar]));return}const i=utf8StringToString(t),a=this[Kr]===Jn?"xfa:":"";e.push(`<${a}${i}`);for(const[t,i]of this[pn].entries()){const a=utf8StringToString(t);e.push(` ${a}="${encodeToXmlString(i[ar])}"`)}null!==this[Dn]&&(this[Dn]?e.push(' xfa:dataNode="dataValue"'):e.push(' xfa:dataNode="dataGroup"'));if(this[ar]||0!==this[yn].length){e.push(">");if(this[ar])"string"==typeof this[ar]?e.push(encodeToXmlString(this[ar])):this[ar][gn](e);else for(const t of this[yn])t[gn](e);e.push(``)}else e.push("/>")}[Or](e){if(this[ar]){const e=new XmlObject(this[Kr],"#text");this[zs](e);e[ar]=this[ar];this[ar]=""}this[zs](e);return!0}[Wr](e){this[ar]+=e}[gr](){if(this[ar]&&this[yn].length>0){const e=new XmlObject(this[Kr],"#text");this[zs](e);e[ar]=this[ar];delete this[ar]}}[nn](){return"#text"===this[Tr]?HTMLResult.success({name:"#text",value:this[ar]}):HTMLResult.EMPTY}[fr](e=null){return e?this[yn].filter((t=>t[Tr]===e)):this[yn]}[cr](){return this[pn]}[hr](e){const t=this[pn].get(e);return void 0!==t?t:this[fr](e)}*[Qr](e,t){const i=this[pn].get(e);i&&(yield i);for(const i of this[yn]){i[Tr]===e&&(yield i);t&&(yield*i[Qr](e,t))}}*[Ir](e,t){const i=this[pn].get(e);!i||t&&i[ir]||(yield i);for(const i of this[yn])yield*i[Ir](e,t)}*[dr](e,t,i){for(const a of this[yn]){a[Tr]!==e||i&&a[ir]||(yield a);t&&(yield*a[dr](e,t,i))}}[xr](){return null===this[Dn]?0===this[yn].length||this[yn][0][Kr]===Cn.xhtml.id:this[Dn]}[Er](){return null===this[Dn]?0===this[yn].length?this[ar].trim():this[yn][0][Kr]===Cn.xhtml.id?this[yn][0][sn]().trim():null:this[ar].trim()}[tn](e){e=e.value||"";this[ar]=e.toString()}[rr](e=!1){const t=Object.create(null);e&&(t.$ns=this[Kr]);this[ar]&&(t.$content=this[ar]);t.$name=this[Tr];t.children=[];for(const i of this[yn])t.children.push(i[rr](e));t.attributes=Object.create(null);for(const[e,i]of this[pn])t.attributes[e]=i[ar];return t}}class ContentObject extends XFAObject{constructor(e,t){super(e,t);this[ar]=""}[Wr](e){this[ar]+=e}[gr](){}}class OptionObject extends ContentObject{constructor(e,t,i){super(e,t);this[Gn]=i}[gr](){this[ar]=getKeyword({data:this[ar],defaultValue:this[Gn][0],validate:e=>this[Gn].includes(e)})}[$s](e){super[$s](e);delete this[Gn]}}class StringObject extends ContentObject{[gr](){this[ar]=this[ar].trim()}}class IntegerObject extends ContentObject{constructor(e,t,i,a){super(e,t);this[bn]=i;this[Ln]=a}[gr](){this[ar]=getInteger({data:this[ar],defaultValue:this[bn],validate:this[Ln]})}[$s](e){super[$s](e);delete this[bn];delete this[Ln]}}class Option01 extends IntegerObject{constructor(e,t){super(e,t,0,(e=>1===e))}}class Option10 extends IntegerObject{constructor(e,t){super(e,t,1,(e=>0===e))}}function measureToString(e){return"string"==typeof e?"0px":Number.isInteger(e)?`${e}px`:`${e.toFixed(2)}px`}const Yn={anchorType(e,t){const i=e[yr]();if(i&&(!i.layout||"position"===i.layout)){"transform"in t||(t.transform="");switch(e.anchorType){case"bottomCenter":t.transform+="translate(-50%, -100%)";break;case"bottomLeft":t.transform+="translate(0,-100%)";break;case"bottomRight":t.transform+="translate(-100%,-100%)";break;case"middleCenter":t.transform+="translate(-50%,-50%)";break;case"middleLeft":t.transform+="translate(0,-50%)";break;case"middleRight":t.transform+="translate(-100%,-50%)";break;case"topCenter":t.transform+="translate(-50%,0)";break;case"topRight":t.transform+="translate(-100%,0)"}}},dimensions(e,t){const i=e[yr]();let a=e.w;const s=e.h;if(i.layout?.includes("row")){const t=i[nr],s=e.colSpan;let r;if(-1===s){r=t.columnWidths.slice(t.currentColumn).reduce(((e,t)=>e+t),0);t.currentColumn=0}else{r=t.columnWidths.slice(t.currentColumn,t.currentColumn+s).reduce(((e,t)=>e+t),0);t.currentColumn=(t.currentColumn+e.colSpan)%t.columnWidths.length}isNaN(r)||(a=e.w=r)}t.width=""!==a?measureToString(a):"auto";t.height=""!==s?measureToString(s):"auto"},position(e,t){const i=e[yr]();if(!i?.layout||"position"===i.layout){t.position="absolute";t.left=measureToString(e.x);t.top=measureToString(e.y)}},rotate(e,t){if(e.rotate){"transform"in t||(t.transform="");t.transform+=`rotate(-${e.rotate}deg)`;t.transformOrigin="top left"}},presence(e,t){switch(e.presence){case"invisible":t.visibility="hidden";break;case"hidden":case"inactive":t.display="none"}},hAlign(e,t){if("para"===e[Tr])switch(e.hAlign){case"justifyAll":t.textAlign="justify-all";break;case"radix":t.textAlign="left";break;default:t.textAlign=e.hAlign}else switch(e.hAlign){case"left":t.alignSelf="start";break;case"center":t.alignSelf="center";break;case"right":t.alignSelf="end"}},margin(e,t){e.margin&&(t.margin=e.margin[on]().margin)}};function setMinMaxDimensions(e,t){if("position"===e[yr]().layout){e.minW>0&&(t.minWidth=measureToString(e.minW));e.maxW>0&&(t.maxWidth=measureToString(e.maxW));e.minH>0&&(t.minHeight=measureToString(e.minH));e.maxH>0&&(t.maxHeight=measureToString(e.maxH))}}function layoutText(e,t,i,a,s,r){const n=new TextMeasure(t,i,a,s);"string"==typeof e?n.addString(e):e[jr](n);return n.compute(r)}function layoutNode(e,t){let i=null,a=null,s=!1;if((!e.w||!e.h)&&e.value){let r=0,n=0;if(e.margin){r=e.margin.leftInset+e.margin.rightInset;n=e.margin.topInset+e.margin.bottomInset}let g=null,o=null;if(e.para){o=Object.create(null);g=""===e.para.lineHeight?null:e.para.lineHeight;o.top=""===e.para.spaceAbove?0:e.para.spaceAbove;o.bottom=""===e.para.spaceBelow?0:e.para.spaceBelow;o.left=""===e.para.marginLeft?0:e.para.marginLeft;o.right=""===e.para.marginRight?0:e.para.marginRight}let c=e.font;if(!c){const t=e[Dr]();let i=e[wr]();for(;i&&i!==t;){if(i.font){c=i.font;break}i=i[wr]()}}const C=(e.w||t.width)-r,h=e[br].fontFinder;if(e.value.exData&&e.value.exData[ar]&&"text/html"===e.value.exData.contentType){const t=layoutText(e.value.exData[ar],c,o,g,h,C);a=t.width;i=t.height;s=t.isBroken}else{const t=e.value[sn]();if(t){const e=layoutText(t,c,o,g,h,C);a=e.width;i=e.height;s=e.isBroken}}null===a||e.w||(a+=r);null===i||e.h||(i+=n)}return{w:a,h:i,isBroken:s}}function computeBbox(e,t,i){let a;if(""!==e.w&&""!==e.h)a=[e.x,e.y,e.w,e.h];else{if(!i)return null;let s=e.w;if(""===s){if(0===e.maxW){const t=e[yr]();s="position"===t.layout&&""!==t.w?0:e.minW}else s=Math.min(e.maxW,i.width);t.attributes.style.width=measureToString(s)}let r=e.h;if(""===r){if(0===e.maxH){const t=e[yr]();r="position"===t.layout&&""!==t.h?0:e.minH}else r=Math.min(e.maxH,i.height);t.attributes.style.height=measureToString(r)}a=[e.x,e.y,s,r]}return a}function fixDimensions(e){const t=e[yr]();if(t.layout?.includes("row")){const i=t[nr],a=e.colSpan;let s;s=-1===a?i.columnWidths.slice(i.currentColumn).reduce(((e,t)=>e+t),0):i.columnWidths.slice(i.currentColumn,i.currentColumn+a).reduce(((e,t)=>e+t),0);isNaN(s)||(e.w=s)}t.layout&&"position"!==t.layout&&(e.x=e.y=0);"table"===e.layout&&""===e.w&&Array.isArray(e.columnWidths)&&(e.w=e.columnWidths.reduce(((e,t)=>e+t),0))}function layoutClass(e){switch(e.layout){case"position":default:return"xfaPosition";case"lr-tb":return"xfaLrTb";case"rl-row":return"xfaRlRow";case"rl-tb":return"xfaRlTb";case"row":return"xfaRow";case"table":return"xfaTable";case"tb":return"xfaTb"}}function toStyle(e,...t){const i=Object.create(null);for(const a of t){const t=e[a];if(null!==t)if(Yn.hasOwnProperty(a))Yn[a](e,i);else if(t instanceof XFAObject){const e=t[on]();e?Object.assign(i,e):warn(`(DEBUG) - XFA - style for ${a} not implemented yet`)}}return i}function createWrapper(e,t){const{attributes:i}=t,{style:a}=i,s={name:"div",attributes:{class:["xfaWrapper"],style:Object.create(null)},children:[]};i.class.push("xfaWrapped");if(e.border){const{widths:i,insets:r}=e.border[nr];let n,g,o=r[0],c=r[3];const C=r[0]+r[2],h=r[1]+r[3];switch(e.border.hand){case"even":o-=i[0]/2;c-=i[3]/2;n=`calc(100% + ${(i[1]+i[3])/2-h}px)`;g=`calc(100% + ${(i[0]+i[2])/2-C}px)`;break;case"left":o-=i[0];c-=i[3];n=`calc(100% + ${i[1]+i[3]-h}px)`;g=`calc(100% + ${i[0]+i[2]-C}px)`;break;case"right":n=h?`calc(100% - ${h}px)`:"100%";g=C?`calc(100% - ${C}px)`:"100%"}const l=["xfaBorder"];isPrintOnly(e.border)&&l.push("xfaPrintOnly");const Q={name:"div",attributes:{class:l,style:{top:`${o}px`,left:`${c}px`,width:n,height:g}},children:[]};for(const e of["border","borderWidth","borderColor","borderRadius","borderStyle"])if(void 0!==a[e]){Q.attributes.style[e]=a[e];delete a[e]}s.children.push(Q,t)}else s.children.push(t);for(const e of["background","backgroundClip","top","left","width","height","minWidth","minHeight","maxWidth","maxHeight","transform","transformOrigin","visibility"])if(void 0!==a[e]){s.attributes.style[e]=a[e];delete a[e]}s.attributes.style.position="absolute"===a.position?"absolute":"relative";delete a.position;if(a.alignSelf){s.attributes.style.alignSelf=a.alignSelf;delete a.alignSelf}return s}function fixTextIndent(e){const t=getMeasurement(e.textIndent,"0px");if(t>=0)return;const i="padding"+("left"===("right"===e.textAlign?"right":"left")?"Left":"Right"),a=getMeasurement(e[i],"0px");e[i]=a-t+"px"}function setAccess(e,t){switch(e.access){case"nonInteractive":t.push("xfaNonInteractive");break;case"readOnly":t.push("xfaReadOnly");break;case"protected":t.push("xfaDisabled")}}function isPrintOnly(e){return e.relevant.length>0&&!e.relevant[0].excluded&&"print"===e.relevant[0].viewname}function getCurrentPara(e){const t=e[Dr]()[nr].paraStack;return t.length?t.at(-1):null}function setPara(e,t,i){if(i.attributes.class?.includes("xfaRich")){if(t){""===e.h&&(t.height="auto");""===e.w&&(t.width="auto")}const a=getCurrentPara(e);if(a){const e=i.attributes.style;e.display="flex";e.flexDirection="column";switch(a.vAlign){case"top":e.justifyContent="start";break;case"bottom":e.justifyContent="end";break;case"middle":e.justifyContent="center"}const t=a[on]();for(const[i,a]of Object.entries(t))i in e||(e[i]=a)}}}function setFontFamily(e,t,i,a){if(!i){delete a.fontFamily;return}const s=stripQuotes(e.typeface);a.fontFamily=`"${s}"`;const r=i.find(s);if(r){const{fontFamily:i}=r.regular.cssFontInfo;i!==s&&(a.fontFamily=`"${i}"`);const n=getCurrentPara(t);if(n&&""!==n.lineHeight)return;if(a.lineHeight)return;const g=selectFont(e,r);g&&(a.lineHeight=Math.max(1.2,g.lineHeight))}}function fixURL(e){const t=createValidAbsoluteUrl(e,null,{addDefaultProtocol:!0,tryConvertEncoding:!0});return t?t.href:null}function createLine(e,t){return{name:"div",attributes:{class:["lr-tb"===e.layout?"xfaLr":"xfaRl"]},children:t}}function flushHTML(e){if(!e[nr])return null;const t={name:"div",attributes:e[nr].attributes,children:e[nr].children};if(e[nr].failingNode){const i=e[nr].failingNode[or]();i&&(e.layout.endsWith("-tb")?t.children.push(createLine(e,[i])):t.children.push(i))}return 0===t.children.length?null:t}function addHTML(e,t,i){const a=e[nr],s=a.availableSpace,[r,n,g,o]=i;switch(e.layout){case"position":a.width=Math.max(a.width,r+g);a.height=Math.max(a.height,n+o);a.children.push(t);break;case"lr-tb":case"rl-tb":if(!a.line||1===a.attempt){a.line=createLine(e,[]);a.children.push(a.line);a.numberInLine=0}a.numberInLine+=1;a.line.children.push(t);if(0===a.attempt){a.currentWidth+=g;a.height=Math.max(a.height,a.prevHeight+o)}else{a.currentWidth=g;a.prevHeight=a.height;a.height+=o;a.attempt=0}a.width=Math.max(a.width,a.currentWidth);break;case"rl-row":case"row":{a.children.push(t);a.width+=g;a.height=Math.max(a.height,o);const e=measureToString(a.height);for(const t of a.children)t.attributes.style.height=e;break}case"table":case"tb":a.width=Math.min(s.width,Math.max(a.width,g));a.height+=o;a.children.push(t)}}function getAvailableSpace(e){const t=e[nr].availableSpace,i=e.margin?e.margin.topInset+e.margin.bottomInset:0,a=e.margin?e.margin.leftInset+e.margin.rightInset:0;switch(e.layout){case"lr-tb":case"rl-tb":return 0===e[nr].attempt?{width:t.width-a-e[nr].currentWidth,height:t.height-i-e[nr].prevHeight}:{width:t.width-a,height:t.height-i-e[nr].height};case"rl-row":case"row":return{width:e[nr].columnWidths.slice(e[nr].currentColumn).reduce(((e,t)=>e+t)),height:t.height-a};case"table":case"tb":return{width:t.width-a,height:t.height-i-e[nr].height};default:return t}}function checkDimensions(e,t){if(null===e[Dr]()[nr].firstUnsplittable)return!0;if(0===e.w||0===e.h)return!0;const i=e[yr](),a=i[nr]?.attempt||0,[,s,r,n]=function getTransformedBBox(e){let t,i,a=""===e.w?NaN:e.w,s=""===e.h?NaN:e.h,[r,n]=[0,0];switch(e.anchorType||""){case"bottomCenter":[r,n]=[a/2,s];break;case"bottomLeft":[r,n]=[0,s];break;case"bottomRight":[r,n]=[a,s];break;case"middleCenter":[r,n]=[a/2,s/2];break;case"middleLeft":[r,n]=[0,s/2];break;case"middleRight":[r,n]=[a,s/2];break;case"topCenter":[r,n]=[a/2,0];break;case"topRight":[r,n]=[a,0]}switch(e.rotate||0){case 0:[t,i]=[-r,-n];break;case 90:[t,i]=[-n,r];[a,s]=[s,-a];break;case 180:[t,i]=[r,n];[a,s]=[-a,-s];break;case 270:[t,i]=[n,-r];[a,s]=[-s,a]}return[e.x+t+Math.min(0,a),e.y+i+Math.min(0,s),Math.abs(a),Math.abs(s)]}(e);switch(i.layout){case"lr-tb":case"rl-tb":return 0===a?e[Dr]()[nr].noLayoutFailure?""!==e.w?Math.round(r-t.width)<=2:t.width>2:!(""!==e.h&&Math.round(n-t.height)>2)&&(""!==e.w?Math.round(r-t.width)<=2||0===i[nr].numberInLine&&t.height>2:t.width>2):!!e[Dr]()[nr].noLayoutFailure||!(""!==e.h&&Math.round(n-t.height)>2)&&((""===e.w||Math.round(r-t.width)<=2||!i[Hr]())&&t.height>2);case"table":case"tb":return!!e[Dr]()[nr].noLayoutFailure||(""===e.h||e[Lr]()?(""===e.w||Math.round(r-t.width)<=2||!i[Hr]())&&t.height>2:Math.round(n-t.height)<=2);case"position":if(e[Dr]()[nr].noLayoutFailure)return!0;if(""===e.h||Math.round(n+s-t.height)<=2)return!0;return n+s>e[Dr]()[nr].currentContentArea.h;case"rl-row":case"row":return!!e[Dr]()[nr].noLayoutFailure||(""===e.h||Math.round(n-t.height)<=2);default:return!0}}const vn=Cn.template.id,Kn="http://www.w3.org/2000/svg",Tn=/^H(\d+)$/,qn=new Set(["image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/apng","image/x-png","image/bmp","image/x-ms-bmp","image/tiff","image/tif","application/octet-stream"]),On=[[[66,77],"image/bmp"],[[255,216,255],"image/jpeg"],[[73,73,42,0],"image/tiff"],[[77,77,0,42],"image/tiff"],[[71,73,70,56,57,97],"image/gif"],[[137,80,78,71,13,10,26,10],"image/png"]];function getBorderDims(e){if(!e||!e.border)return{w:0,h:0};const t=e.border[ur]();return t?{w:t.widths[0]+t.widths[2]+t.insets[0]+t.insets[2],h:t.widths[1]+t.widths[3]+t.insets[1]+t.insets[3]}:{w:0,h:0}}function hasMargin(e){return e.margin&&(e.margin.topInset||e.margin.rightInset||e.margin.bottomInset||e.margin.leftInset)}function _setValue(e,t){if(!e.value){const t=new Value({});e[zs](t);e.value=t}e.value[tn](t)}function*getContainedChildren(e){for(const t of e[fr]())t instanceof SubformSet?yield*t[pr]():yield t}function isRequired(e){return"error"===e.validate?.nullTest}function setTabIndex(e){for(;e;){if(!e.traversal){e[an]=e[wr]()[an];return}if(e[an])return;let t=null;for(const i of e.traversal[fr]())if("next"===i.operation){t=i;break}if(!t||!t.ref){e[an]=e[wr]()[an];return}const i=e[Dr]();e[an]=++i[an];const a=i[$r](t.ref,e);if(!a)return;e=a[0]}}function applyAssist(e,t){const i=e.assist;if(i){const e=i[nn]();e&&(t.title=e);const a=i.role.match(Tn);if(a){const e="heading",i=a[1];t.role=e;t["aria-level"]=i}}if("table"===e.layout)t.role="table";else if("row"===e.layout)t.role="row";else{const i=e[wr]();"row"===i.layout&&(t.role="TH"===i.assist?.role?"columnheader":"cell")}}function ariaLabel(e){if(!e.assist)return null;const t=e.assist;return t.speak&&""!==t.speak[ar]?t.speak[ar]:t.toolTip?t.toolTip[ar]:null}function valueToHtml(e){return HTMLResult.success({name:"div",attributes:{class:["xfaRich"],style:Object.create(null)},children:[{name:"span",attributes:{style:Object.create(null)},value:e}]})}function setFirstUnsplittable(e){const t=e[Dr]();if(null===t[nr].firstUnsplittable){t[nr].firstUnsplittable=e;t[nr].noLayoutFailure=!0}}function unsetFirstUnsplittable(e){const t=e[Dr]();t[nr].firstUnsplittable===e&&(t[nr].noLayoutFailure=!1)}function handleBreak(e){if(e[nr])return!1;e[nr]=Object.create(null);if("auto"===e.targetType)return!1;const t=e[Dr]();let i=null;if(e.target){i=t[$r](e.target,e[wr]());if(!i)return!1;i=i[0]}const{currentPageArea:a,currentContentArea:s}=t[nr];if("pageArea"===e.targetType){i instanceof PageArea||(i=null);if(e.startNew){e[nr].target=i||a;return!0}if(i&&i!==a){e[nr].target=i;return!0}return!1}i instanceof ContentArea||(i=null);const r=i&&i[wr]();let n,g=r;if(e.startNew)if(i){const e=r.contentArea.children,t=e.indexOf(s),a=e.indexOf(i);-1!==t&&te;a[nr].noLayoutFailure=!0;const n=t[nn](i);e[Vs](n.html,n.bbox);a[nr].noLayoutFailure=s;t[yr]=r}class AppearanceFilter extends StringObject{constructor(e){super(vn,"appearanceFilter");this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Arc extends XFAObject{constructor(e){super(vn,"arc",!0);this.circular=getInteger({data:e.circular,defaultValue:0,validate:e=>1===e});this.hand=getStringOption(e.hand,["even","left","right"]);this.id=e.id||"";this.startAngle=getFloat({data:e.startAngle,defaultValue:0,validate:e=>!0});this.sweepAngle=getFloat({data:e.sweepAngle,defaultValue:360,validate:e=>!0});this.use=e.use||"";this.usehref=e.usehref||"";this.edge=null;this.fill=null}[nn](){const e=this.edge||new Edge({}),t=e[on](),i=Object.create(null);"visible"===this.fill?.presence?Object.assign(i,this.fill[on]()):i.fill="transparent";i.strokeWidth=measureToString("visible"===e.presence?e.thickness:0);i.stroke=t.color;let a;const s={xmlns:Kn,style:{width:"100%",height:"100%",overflow:"visible"}};if(360===this.sweepAngle)a={name:"ellipse",attributes:{xmlns:Kn,cx:"50%",cy:"50%",rx:"50%",ry:"50%",style:i}};else{const e=this.startAngle*Math.PI/180,t=this.sweepAngle*Math.PI/180,r=this.sweepAngle>180?1:0,[n,g,o,c]=[50*(1+Math.cos(e)),50*(1-Math.sin(e)),50*(1+Math.cos(e+t)),50*(1-Math.sin(e+t))];a={name:"path",attributes:{xmlns:Kn,d:`M ${n} ${g} A 50 50 0 ${r} 0 ${o} ${c}`,vectorEffect:"non-scaling-stroke",style:i}};Object.assign(s,{viewBox:"0 0 100 100",preserveAspectRatio:"none"})}const r={name:"svg",children:[a],attributes:s};if(hasMargin(this[wr]()[wr]()))return HTMLResult.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[r]});r.attributes.style.position="absolute";return HTMLResult.success(r)}}class Area extends XFAObject{constructor(e){super(vn,"area",!0);this.colSpan=getInteger({data:e.colSpan,defaultValue:1,validate:e=>e>=1||-1===e});this.id=e.id||"";this.name=e.name||"";this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.desc=null;this.extras=null;this.area=new XFAObjectArray;this.draw=new XFAObjectArray;this.exObject=new XFAObjectArray;this.exclGroup=new XFAObjectArray;this.field=new XFAObjectArray;this.subform=new XFAObjectArray;this.subformSet=new XFAObjectArray}*[pr](){yield*getContainedChildren(this)}[Jr](){return!0}[Gr](){return!0}[Vs](e,t){const[i,a,s,r]=t;this[nr].width=Math.max(this[nr].width,i+s);this[nr].height=Math.max(this[nr].height,a+r);this[nr].children.push(e)}[Cr](){return this[nr].availableSpace}[nn](e){const t=toStyle(this,"position"),i={style:t,id:this[In],class:["xfaArea"]};isPrintOnly(this)&&i.class.push("xfaPrintOnly");this.name&&(i.xfaName=this.name);const a=[];this[nr]={children:a,width:0,height:0,availableSpace:e};const s=this[_s]({filter:new Set(["area","draw","field","exclGroup","subform","subformSet"]),include:!0});if(!s.success){if(s.isBreak())return s;delete this[nr];return HTMLResult.FAILURE}t.width=measureToString(this[nr].width);t.height=measureToString(this[nr].height);const r={name:"div",attributes:i,children:a},n=[this.x,this.y,this[nr].width,this[nr].height];delete this[nr];return HTMLResult.success(r,n)}}class Assist extends XFAObject{constructor(e){super(vn,"assist",!0);this.id=e.id||"";this.role=e.role||"";this.use=e.use||"";this.usehref=e.usehref||"";this.speak=null;this.toolTip=null}[nn](){return this.toolTip?.[ar]||null}}class Barcode extends XFAObject{constructor(e){super(vn,"barcode",!0);this.charEncoding=getKeyword({data:e.charEncoding?e.charEncoding.toLowerCase():"",defaultValue:"",validate:e=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(e)||e.match(/iso-8859-\d{2}/)});this.checksum=getStringOption(e.checksum,["none","1mod10","1mod10_1mod11","2mod10","auto"]);this.dataColumnCount=getInteger({data:e.dataColumnCount,defaultValue:-1,validate:e=>e>=0});this.dataLength=getInteger({data:e.dataLength,defaultValue:-1,validate:e=>e>=0});this.dataPrep=getStringOption(e.dataPrep,["none","flateCompress"]);this.dataRowCount=getInteger({data:e.dataRowCount,defaultValue:-1,validate:e=>e>=0});this.endChar=e.endChar||"";this.errorCorrectionLevel=getInteger({data:e.errorCorrectionLevel,defaultValue:-1,validate:e=>e>=0&&e<=8});this.id=e.id||"";this.moduleHeight=getMeasurement(e.moduleHeight,"5mm");this.moduleWidth=getMeasurement(e.moduleWidth,"0.25mm");this.printCheckDigit=getInteger({data:e.printCheckDigit,defaultValue:0,validate:e=>1===e});this.rowColumnRatio=getRatio(e.rowColumnRatio);this.startChar=e.startChar||"";this.textLocation=getStringOption(e.textLocation,["below","above","aboveEmbedded","belowEmbedded","none"]);this.truncate=getInteger({data:e.truncate,defaultValue:0,validate:e=>1===e});this.type=getStringOption(e.type?e.type.toLowerCase():"",["aztec","codabar","code2of5industrial","code2of5interleaved","code2of5matrix","code2of5standard","code3of9","code3of9extended","code11","code49","code93","code128","code128a","code128b","code128c","code128sscc","datamatrix","ean8","ean8add2","ean8add5","ean13","ean13add2","ean13add5","ean13pwcd","fim","logmars","maxicode","msi","pdf417","pdf417macro","plessey","postauscust2","postauscust3","postausreplypaid","postausstandard","postukrm4scc","postusdpbc","postusimb","postusstandard","postus5zip","qrcode","rfid","rss14","rss14expanded","rss14limited","rss14stacked","rss14stackedomni","rss14truncated","telepen","ucc128","ucc128random","ucc128sscc","upca","upcaadd2","upcaadd5","upcapwcd","upce","upceadd2","upceadd5","upcean2","upcean5","upsmaxicode"]);this.upsMode=getStringOption(e.upsMode,["usCarrier","internationalCarrier","secureSymbol","standardSymbol"]);this.use=e.use||"";this.usehref=e.usehref||"";this.wideNarrowRatio=getRatio(e.wideNarrowRatio);this.encrypt=null;this.extras=null}}class Bind extends XFAObject{constructor(e){super(vn,"bind",!0);this.match=getStringOption(e.match,["once","dataRef","global","none"]);this.ref=e.ref||"";this.picture=null}}class BindItems extends XFAObject{constructor(e){super(vn,"bindItems");this.connection=e.connection||"";this.labelRef=e.labelRef||"";this.ref=e.ref||"";this.valueRef=e.valueRef||""}}class Bookend extends XFAObject{constructor(e){super(vn,"bookend");this.id=e.id||"";this.leader=e.leader||"";this.trailer=e.trailer||"";this.use=e.use||"";this.usehref=e.usehref||""}}class BooleanElement extends Option01{constructor(e){super(vn,"boolean");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[nn](e){return valueToHtml(1===this[ar]?"1":"0")}}class Border extends XFAObject{constructor(e){super(vn,"border",!0);this.break=getStringOption(e.break,["close","open"]);this.hand=getStringOption(e.hand,["even","left","right"]);this.id=e.id||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.corner=new XFAObjectArray(4);this.edge=new XFAObjectArray(4);this.extras=null;this.fill=null;this.margin=null}[ur](){if(!this[nr]){const e=this.edge.children.slice();if(e.length<4){const t=e.at(-1)||new Edge({});for(let i=e.length;i<4;i++)e.push(t)}const t=e.map((e=>e.thickness)),i=[0,0,0,0];if(this.margin){i[0]=this.margin.topInset;i[1]=this.margin.rightInset;i[2]=this.margin.bottomInset;i[3]=this.margin.leftInset}this[nr]={widths:t,insets:i,edges:e}}return this[nr]}[on](){const{edges:e}=this[ur](),t=e.map((e=>{const t=e[on]();t.color||="#000000";return t})),i=Object.create(null);this.margin&&Object.assign(i,this.margin[on]());"visible"===this.fill?.presence&&Object.assign(i,this.fill[on]());if(this.corner.children.some((e=>0!==e.radius))){const e=this.corner.children.map((e=>e[on]()));if(2===e.length||3===e.length){const t=e.at(-1);for(let i=e.length;i<4;i++)e.push(t)}i.borderRadius=e.map((e=>e.radius)).join(" ")}switch(this.presence){case"invisible":case"hidden":i.borderStyle="";break;case"inactive":i.borderStyle="none";break;default:i.borderStyle=t.map((e=>e.style)).join(" ")}i.borderWidth=t.map((e=>e.width)).join(" ");i.borderColor=t.map((e=>e.color)).join(" ");return i}}class Break extends XFAObject{constructor(e){super(vn,"break",!0);this.after=getStringOption(e.after,["auto","contentArea","pageArea","pageEven","pageOdd"]);this.afterTarget=e.afterTarget||"";this.before=getStringOption(e.before,["auto","contentArea","pageArea","pageEven","pageOdd"]);this.beforeTarget=e.beforeTarget||"";this.bookendLeader=e.bookendLeader||"";this.bookendTrailer=e.bookendTrailer||"";this.id=e.id||"";this.overflowLeader=e.overflowLeader||"";this.overflowTarget=e.overflowTarget||"";this.overflowTrailer=e.overflowTrailer||"";this.startNew=getInteger({data:e.startNew,defaultValue:0,validate:e=>1===e});this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}}class BreakAfter extends XFAObject{constructor(e){super(vn,"breakAfter",!0);this.id=e.id||"";this.leader=e.leader||"";this.startNew=getInteger({data:e.startNew,defaultValue:0,validate:e=>1===e});this.target=e.target||"";this.targetType=getStringOption(e.targetType,["auto","contentArea","pageArea"]);this.trailer=e.trailer||"";this.use=e.use||"";this.usehref=e.usehref||"";this.script=null}}class BreakBefore extends XFAObject{constructor(e){super(vn,"breakBefore",!0);this.id=e.id||"";this.leader=e.leader||"";this.startNew=getInteger({data:e.startNew,defaultValue:0,validate:e=>1===e});this.target=e.target||"";this.targetType=getStringOption(e.targetType,["auto","contentArea","pageArea"]);this.trailer=e.trailer||"";this.use=e.use||"";this.usehref=e.usehref||"";this.script=null}[nn](e){this[nr]={};return HTMLResult.FAILURE}}class Button extends XFAObject{constructor(e){super(vn,"button",!0);this.highlight=getStringOption(e.highlight,["inverted","none","outline","push"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}[nn](e){const t=this[wr]()[wr](),i={name:"button",attributes:{id:this[In],class:["xfaButton"],style:{}},children:[]};for(const e of t.event.children){if("click"!==e.activity||!e.script)continue;const t=recoverJsURL(e.script[ar]);if(!t)continue;const a=fixURL(t.url);a&&i.children.push({name:"a",attributes:{id:"link"+this[In],href:a,newWindow:t.newWindow,class:["xfaLink"],style:{}},children:[]})}return HTMLResult.success(i)}}class Calculate extends XFAObject{constructor(e){super(vn,"calculate",!0);this.id=e.id||"";this.override=getStringOption(e.override,["disabled","error","ignore","warning"]);this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.message=null;this.script=null}}class Caption extends XFAObject{constructor(e){super(vn,"caption",!0);this.id=e.id||"";this.placement=getStringOption(e.placement,["left","bottom","inline","right","top"]);this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.reserve=Math.ceil(getMeasurement(e.reserve));this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.font=null;this.margin=null;this.para=null;this.value=null}[tn](e){_setValue(this,e)}[ur](e){if(!this[nr]){let{width:t,height:i}=e;switch(this.placement){case"left":case"right":case"inline":t=this.reserve<=0?t:this.reserve;break;case"top":case"bottom":i=this.reserve<=0?i:this.reserve}this[nr]=layoutNode(this,{width:t,height:i})}return this[nr]}[nn](e){if(!this.value)return HTMLResult.EMPTY;this[Zr]();const t=this.value[nn](e).html;if(!t){this[Xr]();return HTMLResult.EMPTY}const i=this.reserve;if(this.reserve<=0){const{w:t,h:i}=this[ur](e);switch(this.placement){case"left":case"right":case"inline":this.reserve=t;break;case"top":case"bottom":this.reserve=i}}const a=[];"string"==typeof t?a.push({name:"#text",value:t}):a.push(t);const s=toStyle(this,"font","margin","visibility");switch(this.placement){case"left":case"right":this.reserve>0&&(s.width=measureToString(this.reserve));break;case"top":case"bottom":this.reserve>0&&(s.height=measureToString(this.reserve))}setPara(this,null,t);this[Xr]();this.reserve=i;return HTMLResult.success({name:"div",attributes:{style:s,class:["xfaCaption"]},children:a})}}class Certificate extends StringObject{constructor(e){super(vn,"certificate");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Certificates extends XFAObject{constructor(e){super(vn,"certificates",!0);this.credentialServerPolicy=getStringOption(e.credentialServerPolicy,["optional","required"]);this.id=e.id||"";this.url=e.url||"";this.urlPolicy=e.urlPolicy||"";this.use=e.use||"";this.usehref=e.usehref||"";this.encryption=null;this.issuers=null;this.keyUsage=null;this.oids=null;this.signing=null;this.subjectDNs=null}}class CheckButton extends XFAObject{constructor(e){super(vn,"checkButton",!0);this.id=e.id||"";this.mark=getStringOption(e.mark,["default","check","circle","cross","diamond","square","star"]);this.shape=getStringOption(e.shape,["square","round"]);this.size=getMeasurement(e.size,"10pt");this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.margin=null}[nn](e){const t=toStyle("margin"),i=measureToString(this.size);t.width=t.height=i;let a,s,r;const n=this[wr]()[wr](),g=n.items.children.length&&n.items.children[0][nn]().html||[],o={on:(void 0!==g[0]?g[0]:"on").toString(),off:(void 0!==g[1]?g[1]:"off").toString()},c=(n.value?.[sn]()||"off")===o.on||void 0,C=n[yr](),h=n[In];let l;if(C instanceof ExclGroup){r=C[In];a="radio";s="xfaRadio";l=C[sr]?.[In]||C[In]}else{a="checkbox";s="xfaCheckbox";l=n[sr]?.[In]||n[In]}const Q={name:"input",attributes:{class:[s],style:t,fieldId:h,dataId:l,type:a,checked:c,xfaOn:o.on,xfaOff:o.off,"aria-label":ariaLabel(n),"aria-required":!1}};r&&(Q.attributes.name=r);if(isRequired(n)){Q.attributes["aria-required"]=!0;Q.attributes.required=!0}return HTMLResult.success({name:"label",attributes:{class:["xfaLabel"]},children:[Q]})}}class ChoiceList extends XFAObject{constructor(e){super(vn,"choiceList",!0);this.commitOn=getStringOption(e.commitOn,["select","exit"]);this.id=e.id||"";this.open=getStringOption(e.open,["userControl","always","multiSelect","onEntry"]);this.textEntry=getInteger({data:e.textEntry,defaultValue:0,validate:e=>1===e});this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.margin=null}[nn](e){const t=toStyle(this,"border","margin"),i=this[wr]()[wr](),a={fontSize:`calc(${i.font?.size||10}px * var(--scale-factor))`},s=[];if(i.items.children.length>0){const e=i.items;let t=0,r=0;if(2===e.children.length){t=e.children[0].save;r=1-t}const n=e.children[t][nn]().html,g=e.children[r][nn]().html;let o=!1;const c=i.value?.[sn]()||"";for(let e=0,t=n.length;eMath.min(Math.max(0,parseInt(e.trim(),10)),255))).map((e=>isNaN(e)?0:e));if(r.length<3)return{r:i,g:a,b:s};[i,a,s]=r;return{r:i,g:a,b:s}}(e.value):"";this.extras=null}[Fr](){return!1}[on](){return this.value?Util.makeHexColor(this.value.r,this.value.g,this.value.b):null}}class Comb extends XFAObject{constructor(e){super(vn,"comb");this.id=e.id||"";this.numberOfCells=getInteger({data:e.numberOfCells,defaultValue:0,validate:e=>e>=0});this.use=e.use||"";this.usehref=e.usehref||""}}class Connect extends XFAObject{constructor(e){super(vn,"connect",!0);this.connection=e.connection||"";this.id=e.id||"";this.ref=e.ref||"";this.usage=getStringOption(e.usage,["exportAndImport","exportOnly","importOnly"]);this.use=e.use||"";this.usehref=e.usehref||"";this.picture=null}}class ContentArea extends XFAObject{constructor(e){super(vn,"contentArea",!0);this.h=getMeasurement(e.h);this.id=e.id||"";this.name=e.name||"";this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.w=getMeasurement(e.w);this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.desc=null;this.extras=null}[nn](e){const t={left:measureToString(this.x),top:measureToString(this.y),width:measureToString(this.w),height:measureToString(this.h)},i=["xfaContentarea"];isPrintOnly(this)&&i.push("xfaPrintOnly");return HTMLResult.success({name:"div",children:[],attributes:{style:t,class:i,id:this[In]}})}}class Corner extends XFAObject{constructor(e){super(vn,"corner",!0);this.id=e.id||"";this.inverted=getInteger({data:e.inverted,defaultValue:0,validate:e=>1===e});this.join=getStringOption(e.join,["square","round"]);this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.radius=getMeasurement(e.radius);this.stroke=getStringOption(e.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]);this.thickness=getMeasurement(e.thickness,"0.5pt");this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[on](){const e=toStyle(this,"visibility");e.radius=measureToString("square"===this.join?0:this.radius);return e}}class DateElement extends ContentObject{constructor(e){super(vn,"date");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[gr](){const e=this[ar].trim();this[ar]=e?new Date(e):null}[nn](e){return valueToHtml(this[ar]?this[ar].toString():"")}}class DateTime extends ContentObject{constructor(e){super(vn,"dateTime");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[gr](){const e=this[ar].trim();this[ar]=e?new Date(e):null}[nn](e){return valueToHtml(this[ar]?this[ar].toString():"")}}class DateTimeEdit extends XFAObject{constructor(e){super(vn,"dateTimeEdit",!0);this.hScrollPolicy=getStringOption(e.hScrollPolicy,["auto","off","on"]);this.id=e.id||"";this.picker=getStringOption(e.picker,["host","none"]);this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.comb=null;this.extras=null;this.margin=null}[nn](e){const t=toStyle(this,"border","font","margin"),i=this[wr]()[wr](),a={name:"input",attributes:{type:"text",fieldId:i[In],dataId:i[sr]?.[In]||i[In],class:["xfaTextfield"],style:t,"aria-label":ariaLabel(i),"aria-required":!1}};if(isRequired(i)){a.attributes["aria-required"]=!0;a.attributes.required=!0}return HTMLResult.success({name:"label",attributes:{class:["xfaLabel"]},children:[a]})}}class Decimal extends ContentObject{constructor(e){super(vn,"decimal");this.fracDigits=getInteger({data:e.fracDigits,defaultValue:2,validate:e=>!0});this.id=e.id||"";this.leadDigits=getInteger({data:e.leadDigits,defaultValue:-1,validate:e=>!0});this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[gr](){const e=parseFloat(this[ar].trim());this[ar]=isNaN(e)?null:e}[nn](e){return valueToHtml(null!==this[ar]?this[ar].toString():"")}}class DefaultUi extends XFAObject{constructor(e){super(vn,"defaultUi",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}}class Desc extends XFAObject{constructor(e){super(vn,"desc",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.boolean=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.decimal=new XFAObjectArray;this.exData=new XFAObjectArray;this.float=new XFAObjectArray;this.image=new XFAObjectArray;this.integer=new XFAObjectArray;this.text=new XFAObjectArray;this.time=new XFAObjectArray}}class DigestMethod extends OptionObject{constructor(e){super(vn,"digestMethod",["","SHA1","SHA256","SHA512","RIPEMD160"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class DigestMethods extends XFAObject{constructor(e){super(vn,"digestMethods",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.digestMethod=new XFAObjectArray}}class Draw extends XFAObject{constructor(e){super(vn,"draw",!0);this.anchorType=getStringOption(e.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]);this.colSpan=getInteger({data:e.colSpan,defaultValue:1,validate:e=>e>=1||-1===e});this.h=e.h?getMeasurement(e.h):"";this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.locale=e.locale||"";this.maxH=getMeasurement(e.maxH,"0pt");this.maxW=getMeasurement(e.maxW,"0pt");this.minH=getMeasurement(e.minH,"0pt");this.minW=getMeasurement(e.minW,"0pt");this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.rotate=getInteger({data:e.rotate,defaultValue:0,validate:e=>e%90==0});this.use=e.use||"";this.usehref=e.usehref||"";this.w=e.w?getMeasurement(e.w):"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.assist=null;this.border=null;this.caption=null;this.desc=null;this.extras=null;this.font=null;this.keep=null;this.margin=null;this.para=null;this.traversal=null;this.ui=null;this.value=null;this.setProperty=new XFAObjectArray}[tn](e){_setValue(this,e)}[nn](e){setTabIndex(this);if("hidden"===this.presence||"inactive"===this.presence)return HTMLResult.EMPTY;fixDimensions(this);this[Zr]();const t=this.w,i=this.h,{w:a,h:s,isBroken:r}=layoutNode(this,e);if(a&&""===this.w){if(r&&this[yr]()[Hr]()){this[Xr]();return HTMLResult.FAILURE}this.w=a}s&&""===this.h&&(this.h=s);setFirstUnsplittable(this);if(!checkDimensions(this,e)){this.w=t;this.h=i;this[Xr]();return HTMLResult.FAILURE}unsetFirstUnsplittable(this);const n=toStyle(this,"font","hAlign","dimensions","position","presence","rotate","anchorType","border","margin");setMinMaxDimensions(this,n);if(n.margin){n.padding=n.margin;delete n.margin}const g=["xfaDraw"];this.font&&g.push("xfaFont");isPrintOnly(this)&&g.push("xfaPrintOnly");const o={style:n,id:this[In],class:g};this.name&&(o.xfaName=this.name);const c={name:"div",attributes:o,children:[]};applyAssist(this,o);const C=computeBbox(this,c,e),h=this.value?this.value[nn](e).html:null;if(null===h){this.w=t;this.h=i;this[Xr]();return HTMLResult.success(createWrapper(this,c),C)}c.children.push(h);setPara(this,n,h);this.w=t;this.h=i;this[Xr]();return HTMLResult.success(createWrapper(this,c),C)}}class Edge extends XFAObject{constructor(e){super(vn,"edge",!0);this.cap=getStringOption(e.cap,["square","butt","round"]);this.id=e.id||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.stroke=getStringOption(e.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]);this.thickness=getMeasurement(e.thickness,"0.5pt");this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[on](){const e=toStyle(this,"visibility");Object.assign(e,{linecap:this.cap,width:measureToString(this.thickness),color:this.color?this.color[on]():"#000000",style:""});if("visible"!==this.presence)e.style="none";else switch(this.stroke){case"solid":e.style="solid";break;case"dashDot":case"dashDotDot":case"dashed":e.style="dashed";break;case"dotted":e.style="dotted";break;case"embossed":e.style="ridge";break;case"etched":e.style="groove";break;case"lowered":e.style="inset";break;case"raised":e.style="outset"}return e}}class Encoding extends OptionObject{constructor(e){super(vn,"encoding",["adbe.x509.rsa_sha1","adbe.pkcs7.detached","adbe.pkcs7.sha1"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Encodings extends XFAObject{constructor(e){super(vn,"encodings",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.encoding=new XFAObjectArray}}class Encrypt extends XFAObject{constructor(e){super(vn,"encrypt",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.certificate=null}}class EncryptData extends XFAObject{constructor(e){super(vn,"encryptData",!0);this.id=e.id||"";this.operation=getStringOption(e.operation,["encrypt","decrypt"]);this.target=e.target||"";this.use=e.use||"";this.usehref=e.usehref||"";this.filter=null;this.manifest=null}}class Encryption extends XFAObject{constructor(e){super(vn,"encryption",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.certificate=new XFAObjectArray}}class EncryptionMethod extends OptionObject{constructor(e){super(vn,"encryptionMethod",["","AES256-CBC","TRIPLEDES-CBC","AES128-CBC","AES192-CBC"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class EncryptionMethods extends XFAObject{constructor(e){super(vn,"encryptionMethods",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.encryptionMethod=new XFAObjectArray}}class Event extends XFAObject{constructor(e){super(vn,"event",!0);this.activity=getStringOption(e.activity,["click","change","docClose","docReady","enter","exit","full","indexChange","initialize","mouseDown","mouseEnter","mouseExit","mouseUp","postExecute","postOpen","postPrint","postSave","postSign","postSubmit","preExecute","preOpen","prePrint","preSave","preSign","preSubmit","ready","validationState"]);this.id=e.id||"";this.listen=getStringOption(e.listen,["refOnly","refAndDescendents"]);this.name=e.name||"";this.ref=e.ref||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.encryptData=null;this.execute=null;this.script=null;this.signData=null;this.submit=null}}class ExData extends ContentObject{constructor(e){super(vn,"exData");this.contentType=e.contentType||"";this.href=e.href||"";this.id=e.id||"";this.maxLength=getInteger({data:e.maxLength,defaultValue:-1,validate:e=>e>=-1});this.name=e.name||"";this.rid=e.rid||"";this.transferEncoding=getStringOption(e.transferEncoding,["none","base64","package"]);this.use=e.use||"";this.usehref=e.usehref||""}[Nr](){return"text/html"===this.contentType}[Or](e){if("text/html"===this.contentType&&e[Kr]===Cn.xhtml.id){this[ar]=e;return!0}if("text/xml"===this.contentType){this[ar]=e;return!0}return!1}[nn](e){return"text/html"===this.contentType&&this[ar]?this[ar][nn](e):HTMLResult.EMPTY}}class ExObject extends XFAObject{constructor(e){super(vn,"exObject",!0);this.archive=e.archive||"";this.classId=e.classId||"";this.codeBase=e.codeBase||"";this.codeType=e.codeType||"";this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.boolean=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.decimal=new XFAObjectArray;this.exData=new XFAObjectArray;this.exObject=new XFAObjectArray;this.float=new XFAObjectArray;this.image=new XFAObjectArray;this.integer=new XFAObjectArray;this.text=new XFAObjectArray;this.time=new XFAObjectArray}}class ExclGroup extends XFAObject{constructor(e){super(vn,"exclGroup",!0);this.access=getStringOption(e.access,["open","nonInteractive","protected","readOnly"]);this.accessKey=e.accessKey||"";this.anchorType=getStringOption(e.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]);this.colSpan=getInteger({data:e.colSpan,defaultValue:1,validate:e=>e>=1||-1===e});this.h=e.h?getMeasurement(e.h):"";this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.layout=getStringOption(e.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]);this.maxH=getMeasurement(e.maxH,"0pt");this.maxW=getMeasurement(e.maxW,"0pt");this.minH=getMeasurement(e.minH,"0pt");this.minW=getMeasurement(e.minW,"0pt");this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.w=e.w?getMeasurement(e.w):"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.assist=null;this.bind=null;this.border=null;this.calculate=null;this.caption=null;this.desc=null;this.extras=null;this.margin=null;this.para=null;this.traversal=null;this.validate=null;this.connect=new XFAObjectArray;this.event=new XFAObjectArray;this.field=new XFAObjectArray;this.setProperty=new XFAObjectArray}[Gr](){return!0}[Fr](){return!0}[tn](e){for(const t of this.field.children){if(!t.value){const e=new Value({});t[zs](e);t.value=e}t.value[tn](e)}}[Hr](){return this.layout.endsWith("-tb")&&0===this[nr].attempt&&this[nr].numberInLine>0||this[wr]()[Hr]()}[Lr](){const e=this[yr]();if(!e[Lr]())return!1;if(void 0!==this[nr]._isSplittable)return this[nr]._isSplittable;if("position"===this.layout||this.layout.includes("row")){this[nr]._isSplittable=!1;return!1}if(e.layout?.endsWith("-tb")&&0!==e[nr].numberInLine)return!1;this[nr]._isSplittable=!0;return!0}[or](){return flushHTML(this)}[Vs](e,t){addHTML(this,e,t)}[Cr](){return getAvailableSpace(this)}[nn](e){setTabIndex(this);if("hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return HTMLResult.EMPTY;fixDimensions(this);const t=[],i={id:this[In],class:[]};setAccess(this,i.class);this[nr]||(this[nr]=Object.create(null));Object.assign(this[nr],{children:t,attributes:i,attempt:0,line:null,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,e.width),height:Math.min(this.h||1/0,e.height)},width:0,height:0,prevHeight:0,currentWidth:0});const a=this[Lr]();a||setFirstUnsplittable(this);if(!checkDimensions(this,e))return HTMLResult.FAILURE;const s=new Set(["field"]);if(this.layout.includes("row")){const e=this[yr]().columnWidths;if(Array.isArray(e)&&e.length>0){this[nr].columnWidths=e;this[nr].currentColumn=0}}const r=toStyle(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),n=["xfaExclgroup"],g=layoutClass(this);g&&n.push(g);isPrintOnly(this)&&n.push("xfaPrintOnly");i.style=r;i.class=n;this.name&&(i.xfaName=this.name);this[Zr]();const o="lr-tb"===this.layout||"rl-tb"===this.layout,c=o?2:1;for(;this[nr].attempte>=1||-1===e});this.h=e.h?getMeasurement(e.h):"";this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.locale=e.locale||"";this.maxH=getMeasurement(e.maxH,"0pt");this.maxW=getMeasurement(e.maxW,"0pt");this.minH=getMeasurement(e.minH,"0pt");this.minW=getMeasurement(e.minW,"0pt");this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.rotate=getInteger({data:e.rotate,defaultValue:0,validate:e=>e%90==0});this.use=e.use||"";this.usehref=e.usehref||"";this.w=e.w?getMeasurement(e.w):"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.assist=null;this.bind=null;this.border=null;this.calculate=null;this.caption=null;this.desc=null;this.extras=null;this.font=null;this.format=null;this.items=new XFAObjectArray(2);this.keep=null;this.margin=null;this.para=null;this.traversal=null;this.ui=null;this.validate=null;this.value=null;this.bindItems=new XFAObjectArray;this.connect=new XFAObjectArray;this.event=new XFAObjectArray;this.setProperty=new XFAObjectArray}[Gr](){return!0}[tn](e){_setValue(this,e)}[nn](e){setTabIndex(this);if(!this.ui){this.ui=new Ui({});this.ui[br]=this[br];this[zs](this.ui);let e;switch(this.items.children.length){case 0:e=new TextEdit({});this.ui.textEdit=e;break;case 1:e=new CheckButton({});this.ui.checkButton=e;break;case 2:e=new ChoiceList({});this.ui.choiceList=e}this.ui[zs](e)}if(!this.ui||"hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return HTMLResult.EMPTY;this.caption&&delete this.caption[nr];this[Zr]();const t=this.caption?this.caption[nn](e).html:null,i=this.w,a=this.h;let s=0,r=0;if(this.margin){s=this.margin.leftInset+this.margin.rightInset;r=this.margin.topInset+this.margin.bottomInset}let n=null;if(""===this.w||""===this.h){let t=null,i=null,a=0,g=0;if(this.ui.checkButton)a=g=this.ui.checkButton.size;else{const{w:t,h:i}=layoutNode(this,e);if(null!==t){a=t;g=i}else g=function fonts_getMetrics(e,t=!1){let i=null;if(e){const t=stripQuotes(e.typeface),a=e[br].fontFinder.find(t);i=selectFont(e,a)}if(!i)return{lineHeight:12,lineGap:2,lineNoGap:10};const a=e.size||10,s=i.lineHeight?Math.max(t?0:1.2,i.lineHeight):1.2,r=void 0===i.lineGap?.2:i.lineGap;return{lineHeight:s*a,lineGap:r*a,lineNoGap:Math.max(1,s-r)*a}}(this.font,!0).lineNoGap}n=getBorderDims(this.ui[ur]());a+=n.w;g+=n.h;if(this.caption){const{w:s,h:r,isBroken:n}=this.caption[ur](e);if(n&&this[yr]()[Hr]()){this[Xr]();return HTMLResult.FAILURE}t=s;i=r;switch(this.caption.placement){case"left":case"right":case"inline":t+=a;break;case"top":case"bottom":i+=g}}else{t=a;i=g}if(t&&""===this.w){t+=s;this.w=Math.min(this.maxW<=0?1/0:this.maxW,this.minW+1e>=1&&e<=5});this.appearanceFilter=null;this.certificates=null;this.digestMethods=null;this.encodings=null;this.encryptionMethods=null;this.handler=null;this.lockDocument=null;this.mdp=null;this.reasons=null;this.timeStamp=null}}class Float extends ContentObject{constructor(e){super(vn,"float");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[gr](){const e=parseFloat(this[ar].trim());this[ar]=isNaN(e)?null:e}[nn](e){return valueToHtml(null!==this[ar]?this[ar].toString():"")}}class template_Font extends XFAObject{constructor(e){super(vn,"font",!0);this.baselineShift=getMeasurement(e.baselineShift);this.fontHorizontalScale=getFloat({data:e.fontHorizontalScale,defaultValue:100,validate:e=>e>=0});this.fontVerticalScale=getFloat({data:e.fontVerticalScale,defaultValue:100,validate:e=>e>=0});this.id=e.id||"";this.kerningMode=getStringOption(e.kerningMode,["none","pair"]);this.letterSpacing=getMeasurement(e.letterSpacing,"0");this.lineThrough=getInteger({data:e.lineThrough,defaultValue:0,validate:e=>1===e||2===e});this.lineThroughPeriod=getStringOption(e.lineThroughPeriod,["all","word"]);this.overline=getInteger({data:e.overline,defaultValue:0,validate:e=>1===e||2===e});this.overlinePeriod=getStringOption(e.overlinePeriod,["all","word"]);this.posture=getStringOption(e.posture,["normal","italic"]);this.size=getMeasurement(e.size,"10pt");this.typeface=e.typeface||"Courier";this.underline=getInteger({data:e.underline,defaultValue:0,validate:e=>1===e||2===e});this.underlinePeriod=getStringOption(e.underlinePeriod,["all","word"]);this.use=e.use||"";this.usehref=e.usehref||"";this.weight=getStringOption(e.weight,["normal","bold"]);this.extras=null;this.fill=null}[$s](e){super[$s](e);this[br].usedTypefaces.add(this.typeface)}[on](){const e=toStyle(this,"fill"),t=e.color;if(t)if("#000000"===t)delete e.color;else if(!t.startsWith("#")){e.background=t;e.backgroundClip="text";e.color="transparent"}this.baselineShift&&(e.verticalAlign=measureToString(this.baselineShift));e.fontKerning="none"===this.kerningMode?"none":"normal";e.letterSpacing=measureToString(this.letterSpacing);if(0!==this.lineThrough){e.textDecoration="line-through";2===this.lineThrough&&(e.textDecorationStyle="double")}if(0!==this.overline){e.textDecoration="overline";2===this.overline&&(e.textDecorationStyle="double")}e.fontStyle=this.posture;e.fontSize=measureToString(.99*this.size);setFontFamily(this,this,this[br].fontFinder,e);if(0!==this.underline){e.textDecoration="underline";2===this.underline&&(e.textDecorationStyle="double")}e.fontWeight=this.weight;return e}}class Format extends XFAObject{constructor(e){super(vn,"format",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.picture=null}}class Handler extends StringObject{constructor(e){super(vn,"handler");this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Hyphenation extends XFAObject{constructor(e){super(vn,"hyphenation");this.excludeAllCaps=getInteger({data:e.excludeAllCaps,defaultValue:0,validate:e=>1===e});this.excludeInitialCap=getInteger({data:e.excludeInitialCap,defaultValue:0,validate:e=>1===e});this.hyphenate=getInteger({data:e.hyphenate,defaultValue:0,validate:e=>1===e});this.id=e.id||"";this.pushCharacterCount=getInteger({data:e.pushCharacterCount,defaultValue:3,validate:e=>e>=0});this.remainCharacterCount=getInteger({data:e.remainCharacterCount,defaultValue:3,validate:e=>e>=0});this.use=e.use||"";this.usehref=e.usehref||"";this.wordCharacterCount=getInteger({data:e.wordCharacterCount,defaultValue:7,validate:e=>e>=0})}}class Image extends StringObject{constructor(e){super(vn,"image");this.aspect=getStringOption(e.aspect,["fit","actual","height","none","width"]);this.contentType=e.contentType||"";this.href=e.href||"";this.id=e.id||"";this.name=e.name||"";this.transferEncoding=getStringOption(e.transferEncoding,["base64","none","package"]);this.use=e.use||"";this.usehref=e.usehref||""}[nn](){if(this.contentType&&!qn.has(this.contentType.toLowerCase()))return HTMLResult.EMPTY;let e=this[br].images&&this[br].images.get(this.href);if(!e&&(this.href||!this[ar]))return HTMLResult.EMPTY;e||"base64"!==this.transferEncoding||(e=function fromBase64Util(e){return Uint8Array.fromBase64?Uint8Array.fromBase64(e):stringToBytes(atob(e))}(this[ar]));if(!e)return HTMLResult.EMPTY;if(!this.contentType){for(const[t,i]of On)if(e.length>t.length&&t.every(((t,i)=>t===e[i]))){this.contentType=i;break}if(!this.contentType)return HTMLResult.EMPTY}const t=new Blob([e],{type:this.contentType});let i;switch(this.aspect){case"fit":case"actual":break;case"height":i={height:"100%",objectFit:"fill"};break;case"none":i={width:"100%",height:"100%",objectFit:"fill"};break;case"width":i={width:"100%",objectFit:"fill"}}const a=this[wr]();return HTMLResult.success({name:"img",attributes:{class:["xfaImage"],style:i,src:URL.createObjectURL(t),alt:a?ariaLabel(a[wr]()):null}})}}class ImageEdit extends XFAObject{constructor(e){super(vn,"imageEdit",!0);this.data=getStringOption(e.data,["link","embed"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.margin=null}[nn](e){return"embed"===this.data?HTMLResult.success({name:"div",children:[],attributes:{}}):HTMLResult.EMPTY}}class Integer extends ContentObject{constructor(e){super(vn,"integer");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[gr](){const e=parseInt(this[ar].trim(),10);this[ar]=isNaN(e)?null:e}[nn](e){return valueToHtml(null!==this[ar]?this[ar].toString():"")}}class Issuers extends XFAObject{constructor(e){super(vn,"issuers",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.certificate=new XFAObjectArray}}class Items extends XFAObject{constructor(e){super(vn,"items",!0);this.id=e.id||"";this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.ref=e.ref||"";this.save=getInteger({data:e.save,defaultValue:0,validate:e=>1===e});this.use=e.use||"";this.usehref=e.usehref||"";this.boolean=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.decimal=new XFAObjectArray;this.exData=new XFAObjectArray;this.float=new XFAObjectArray;this.image=new XFAObjectArray;this.integer=new XFAObjectArray;this.text=new XFAObjectArray;this.time=new XFAObjectArray}[nn](){const e=[];for(const t of this[fr]())e.push(t[sn]());return HTMLResult.success(e)}}class Keep extends XFAObject{constructor(e){super(vn,"keep",!0);this.id=e.id||"";const t=["none","contentArea","pageArea"];this.intact=getStringOption(e.intact,t);this.next=getStringOption(e.next,t);this.previous=getStringOption(e.previous,t);this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}}class KeyUsage extends XFAObject{constructor(e){super(vn,"keyUsage");const t=["","yes","no"];this.crlSign=getStringOption(e.crlSign,t);this.dataEncipherment=getStringOption(e.dataEncipherment,t);this.decipherOnly=getStringOption(e.decipherOnly,t);this.digitalSignature=getStringOption(e.digitalSignature,t);this.encipherOnly=getStringOption(e.encipherOnly,t);this.id=e.id||"";this.keyAgreement=getStringOption(e.keyAgreement,t);this.keyCertSign=getStringOption(e.keyCertSign,t);this.keyEncipherment=getStringOption(e.keyEncipherment,t);this.nonRepudiation=getStringOption(e.nonRepudiation,t);this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Line extends XFAObject{constructor(e){super(vn,"line",!0);this.hand=getStringOption(e.hand,["even","left","right"]);this.id=e.id||"";this.slope=getStringOption(e.slope,["\\","/"]);this.use=e.use||"";this.usehref=e.usehref||"";this.edge=null}[nn](){const e=this[wr]()[wr](),t=this.edge||new Edge({}),i=t[on](),a=Object.create(null),s="visible"===t.presence?t.thickness:0;a.strokeWidth=measureToString(s);a.stroke=i.color;let r,n,g,o,c="100%",C="100%";if(e.w<=s){[r,n,g,o]=["50%",0,"50%","100%"];c=a.strokeWidth}else if(e.h<=s){[r,n,g,o]=[0,"50%","100%","50%"];C=a.strokeWidth}else"\\"===this.slope?[r,n,g,o]=[0,0,"100%","100%"]:[r,n,g,o]=[0,"100%","100%",0];const h={name:"svg",children:[{name:"line",attributes:{xmlns:Kn,x1:r,y1:n,x2:g,y2:o,style:a}}],attributes:{xmlns:Kn,width:c,height:C,style:{overflow:"visible"}}};if(hasMargin(e))return HTMLResult.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[h]});h.attributes.style.position="absolute";return HTMLResult.success(h)}}class Linear extends XFAObject{constructor(e){super(vn,"linear",!0);this.id=e.id||"";this.type=getStringOption(e.type,["toRight","toBottom","toLeft","toTop"]);this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[on](e){e=e?e[on]():"#FFFFFF";return`linear-gradient(${this.type.replace(/([RBLT])/," $1").toLowerCase()}, ${e}, ${this.color?this.color[on]():"#000000"})`}}class LockDocument extends ContentObject{constructor(e){super(vn,"lockDocument");this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}[gr](){this[ar]=getStringOption(this[ar],["auto","0","1"])}}class Manifest extends XFAObject{constructor(e){super(vn,"manifest",!0);this.action=getStringOption(e.action,["include","all","exclude"]);this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.ref=new XFAObjectArray}}class Margin extends XFAObject{constructor(e){super(vn,"margin",!0);this.bottomInset=getMeasurement(e.bottomInset,"0");this.id=e.id||"";this.leftInset=getMeasurement(e.leftInset,"0");this.rightInset=getMeasurement(e.rightInset,"0");this.topInset=getMeasurement(e.topInset,"0");this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}[on](){return{margin:measureToString(this.topInset)+" "+measureToString(this.rightInset)+" "+measureToString(this.bottomInset)+" "+measureToString(this.leftInset)}}}class Mdp extends XFAObject{constructor(e){super(vn,"mdp");this.id=e.id||"";this.permissions=getInteger({data:e.permissions,defaultValue:2,validate:e=>1===e||3===e});this.signatureType=getStringOption(e.signatureType,["filler","author"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Medium extends XFAObject{constructor(e){super(vn,"medium");this.id=e.id||"";this.imagingBBox=function getBBox(e){const t=-1;if(!e)return{x:t,y:t,width:t,height:t};const i=e.trim().split(/\s*,\s*/).map((e=>getMeasurement(e,"-1")));if(i.length<4||i[2]<0||i[3]<0)return{x:t,y:t,width:t,height:t};const[a,s,r,n]=i;return{x:a,y:s,width:r,height:n}}(e.imagingBBox);this.long=getMeasurement(e.long);this.orientation=getStringOption(e.orientation,["portrait","landscape"]);this.short=getMeasurement(e.short);this.stock=e.stock||"";this.trayIn=getStringOption(e.trayIn,["auto","delegate","pageFront"]);this.trayOut=getStringOption(e.trayOut,["auto","delegate"]);this.use=e.use||"";this.usehref=e.usehref||""}}class Message extends XFAObject{constructor(e){super(vn,"message",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.text=new XFAObjectArray}}class NumericEdit extends XFAObject{constructor(e){super(vn,"numericEdit",!0);this.hScrollPolicy=getStringOption(e.hScrollPolicy,["auto","off","on"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.comb=null;this.extras=null;this.margin=null}[nn](e){const t=toStyle(this,"border","font","margin"),i=this[wr]()[wr](),a={name:"input",attributes:{type:"text",fieldId:i[In],dataId:i[sr]?.[In]||i[In],class:["xfaTextfield"],style:t,"aria-label":ariaLabel(i),"aria-required":!1}};if(isRequired(i)){a.attributes["aria-required"]=!0;a.attributes.required=!0}return HTMLResult.success({name:"label",attributes:{class:["xfaLabel"]},children:[a]})}}class Occur extends XFAObject{constructor(e){super(vn,"occur",!0);this.id=e.id||"";this.initial=""!==e.initial?getInteger({data:e.initial,defaultValue:"",validate:e=>!0}):"";this.max=""!==e.max?getInteger({data:e.max,defaultValue:1,validate:e=>!0}):"";this.min=""!==e.min?getInteger({data:e.min,defaultValue:1,validate:e=>!0}):"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}[$s](){const e=this[wr](),t=this.min;""===this.min&&(this.min=e instanceof PageArea||e instanceof PageSet?0:1);""===this.max&&(this.max=""===t?e instanceof PageArea||e instanceof PageSet?-1:1:this.min);-1!==this.max&&this.max!0});this.name=e.name||"";this.numbered=getInteger({data:e.numbered,defaultValue:1,validate:e=>!0});this.oddOrEven=getStringOption(e.oddOrEven,["any","even","odd"]);this.pagePosition=getStringOption(e.pagePosition,["any","first","last","only","rest"]);this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.desc=null;this.extras=null;this.medium=null;this.occur=null;this.area=new XFAObjectArray;this.contentArea=new XFAObjectArray;this.draw=new XFAObjectArray;this.exclGroup=new XFAObjectArray;this.field=new XFAObjectArray;this.subform=new XFAObjectArray}[Yr](){if(!this[nr]){this[nr]={numberOfUse:0};return!0}return!this.occur||-1===this.occur.max||this[nr].numberOfUsee.oddOrEven===t&&e.pagePosition===i));if(a)return a;a=this.pageArea.children.find((e=>"any"===e.oddOrEven&&e.pagePosition===i));if(a)return a;a=this.pageArea.children.find((e=>"any"===e.oddOrEven&&"any"===e.pagePosition));return a||this.pageArea.children[0]}}class Para extends XFAObject{constructor(e){super(vn,"para",!0);this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.lineHeight=e.lineHeight?getMeasurement(e.lineHeight,"0pt"):"";this.marginLeft=e.marginLeft?getMeasurement(e.marginLeft,"0pt"):"";this.marginRight=e.marginRight?getMeasurement(e.marginRight,"0pt"):"";this.orphans=getInteger({data:e.orphans,defaultValue:0,validate:e=>e>=0});this.preserve=e.preserve||"";this.radixOffset=e.radixOffset?getMeasurement(e.radixOffset,"0pt"):"";this.spaceAbove=e.spaceAbove?getMeasurement(e.spaceAbove,"0pt"):"";this.spaceBelow=e.spaceBelow?getMeasurement(e.spaceBelow,"0pt"):"";this.tabDefault=e.tabDefault?getMeasurement(this.tabDefault):"";this.tabStops=(e.tabStops||"").trim().split(/\s+/).map(((e,t)=>t%2==1?getMeasurement(e):e));this.textIndent=e.textIndent?getMeasurement(e.textIndent,"0pt"):"";this.use=e.use||"";this.usehref=e.usehref||"";this.vAlign=getStringOption(e.vAlign,["top","bottom","middle"]);this.widows=getInteger({data:e.widows,defaultValue:0,validate:e=>e>=0});this.hyphenation=null}[on](){const e=toStyle(this,"hAlign");""!==this.marginLeft&&(e.paddingLeft=measureToString(this.marginLeft));""!==this.marginRight&&(e.paddingight=measureToString(this.marginRight));""!==this.spaceAbove&&(e.paddingTop=measureToString(this.spaceAbove));""!==this.spaceBelow&&(e.paddingBottom=measureToString(this.spaceBelow));if(""!==this.textIndent){e.textIndent=measureToString(this.textIndent);fixTextIndent(e)}this.lineHeight>0&&(e.lineHeight=measureToString(this.lineHeight));""!==this.tabDefault&&(e.tabSize=measureToString(this.tabDefault));this.tabStops.length;this.hyphenatation&&Object.assign(e,this.hyphenatation[on]());return e}}class PasswordEdit extends XFAObject{constructor(e){super(vn,"passwordEdit",!0);this.hScrollPolicy=getStringOption(e.hScrollPolicy,["auto","off","on"]);this.id=e.id||"";this.passwordChar=e.passwordChar||"*";this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.margin=null}}class template_Pattern extends XFAObject{constructor(e){super(vn,"pattern",!0);this.id=e.id||"";this.type=getStringOption(e.type,["crossHatch","crossDiagonal","diagonalLeft","diagonalRight","horizontal","vertical"]);this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[on](e){e=e?e[on]():"#FFFFFF";const t=this.color?this.color[on]():"#000000",i="repeating-linear-gradient",a=`${e},${e} 5px,${t} 5px,${t} 10px`;switch(this.type){case"crossHatch":return`${i}(to top,${a}) ${i}(to right,${a})`;case"crossDiagonal":return`${i}(45deg,${a}) ${i}(-45deg,${a})`;case"diagonalLeft":return`${i}(45deg,${a})`;case"diagonalRight":return`${i}(-45deg,${a})`;case"horizontal":return`${i}(to top,${a})`;case"vertical":return`${i}(to right,${a})`}return""}}class Picture extends StringObject{constructor(e){super(vn,"picture");this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Proto extends XFAObject{constructor(e){super(vn,"proto",!0);this.appearanceFilter=new XFAObjectArray;this.arc=new XFAObjectArray;this.area=new XFAObjectArray;this.assist=new XFAObjectArray;this.barcode=new XFAObjectArray;this.bindItems=new XFAObjectArray;this.bookend=new XFAObjectArray;this.boolean=new XFAObjectArray;this.border=new XFAObjectArray;this.break=new XFAObjectArray;this.breakAfter=new XFAObjectArray;this.breakBefore=new XFAObjectArray;this.button=new XFAObjectArray;this.calculate=new XFAObjectArray;this.caption=new XFAObjectArray;this.certificate=new XFAObjectArray;this.certificates=new XFAObjectArray;this.checkButton=new XFAObjectArray;this.choiceList=new XFAObjectArray;this.color=new XFAObjectArray;this.comb=new XFAObjectArray;this.connect=new XFAObjectArray;this.contentArea=new XFAObjectArray;this.corner=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.dateTimeEdit=new XFAObjectArray;this.decimal=new XFAObjectArray;this.defaultUi=new XFAObjectArray;this.desc=new XFAObjectArray;this.digestMethod=new XFAObjectArray;this.digestMethods=new XFAObjectArray;this.draw=new XFAObjectArray;this.edge=new XFAObjectArray;this.encoding=new XFAObjectArray;this.encodings=new XFAObjectArray;this.encrypt=new XFAObjectArray;this.encryptData=new XFAObjectArray;this.encryption=new XFAObjectArray;this.encryptionMethod=new XFAObjectArray;this.encryptionMethods=new XFAObjectArray;this.event=new XFAObjectArray;this.exData=new XFAObjectArray;this.exObject=new XFAObjectArray;this.exclGroup=new XFAObjectArray;this.execute=new XFAObjectArray;this.extras=new XFAObjectArray;this.field=new XFAObjectArray;this.fill=new XFAObjectArray;this.filter=new XFAObjectArray;this.float=new XFAObjectArray;this.font=new XFAObjectArray;this.format=new XFAObjectArray;this.handler=new XFAObjectArray;this.hyphenation=new XFAObjectArray;this.image=new XFAObjectArray;this.imageEdit=new XFAObjectArray;this.integer=new XFAObjectArray;this.issuers=new XFAObjectArray;this.items=new XFAObjectArray;this.keep=new XFAObjectArray;this.keyUsage=new XFAObjectArray;this.line=new XFAObjectArray;this.linear=new XFAObjectArray;this.lockDocument=new XFAObjectArray;this.manifest=new XFAObjectArray;this.margin=new XFAObjectArray;this.mdp=new XFAObjectArray;this.medium=new XFAObjectArray;this.message=new XFAObjectArray;this.numericEdit=new XFAObjectArray;this.occur=new XFAObjectArray;this.oid=new XFAObjectArray;this.oids=new XFAObjectArray;this.overflow=new XFAObjectArray;this.pageArea=new XFAObjectArray;this.pageSet=new XFAObjectArray;this.para=new XFAObjectArray;this.passwordEdit=new XFAObjectArray;this.pattern=new XFAObjectArray;this.picture=new XFAObjectArray;this.radial=new XFAObjectArray;this.reason=new XFAObjectArray;this.reasons=new XFAObjectArray;this.rectangle=new XFAObjectArray;this.ref=new XFAObjectArray;this.script=new XFAObjectArray;this.setProperty=new XFAObjectArray;this.signData=new XFAObjectArray;this.signature=new XFAObjectArray;this.signing=new XFAObjectArray;this.solid=new XFAObjectArray;this.speak=new XFAObjectArray;this.stipple=new XFAObjectArray;this.subform=new XFAObjectArray;this.subformSet=new XFAObjectArray;this.subjectDN=new XFAObjectArray;this.subjectDNs=new XFAObjectArray;this.submit=new XFAObjectArray;this.text=new XFAObjectArray;this.textEdit=new XFAObjectArray;this.time=new XFAObjectArray;this.timeStamp=new XFAObjectArray;this.toolTip=new XFAObjectArray;this.traversal=new XFAObjectArray;this.traverse=new XFAObjectArray;this.ui=new XFAObjectArray;this.validate=new XFAObjectArray;this.value=new XFAObjectArray;this.variables=new XFAObjectArray}}class Radial extends XFAObject{constructor(e){super(vn,"radial",!0);this.id=e.id||"";this.type=getStringOption(e.type,["toEdge","toCenter"]);this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[on](e){e=e?e[on]():"#FFFFFF";const t=this.color?this.color[on]():"#000000";return`radial-gradient(circle at center, ${"toEdge"===this.type?`${e},${t}`:`${t},${e}`})`}}class Reason extends StringObject{constructor(e){super(vn,"reason");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Reasons extends XFAObject{constructor(e){super(vn,"reasons",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.reason=new XFAObjectArray}}class Rectangle extends XFAObject{constructor(e){super(vn,"rectangle",!0);this.hand=getStringOption(e.hand,["even","left","right"]);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.corner=new XFAObjectArray(4);this.edge=new XFAObjectArray(4);this.fill=null}[nn](){const e=this.edge.children.length?this.edge.children[0]:new Edge({}),t=e[on](),i=Object.create(null);"visible"===this.fill?.presence?Object.assign(i,this.fill[on]()):i.fill="transparent";i.strokeWidth=measureToString("visible"===e.presence?e.thickness:0);i.stroke=t.color;const a=(this.corner.children.length?this.corner.children[0]:new Corner({}))[on](),s={name:"svg",children:[{name:"rect",attributes:{xmlns:Kn,width:"100%",height:"100%",x:0,y:0,rx:a.radius,ry:a.radius,style:i}}],attributes:{xmlns:Kn,style:{overflow:"visible"},width:"100%",height:"100%"}};if(hasMargin(this[wr]()[wr]()))return HTMLResult.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[s]});s.attributes.style.position="absolute";return HTMLResult.success(s)}}class RefElement extends StringObject{constructor(e){super(vn,"ref");this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Script extends StringObject{constructor(e){super(vn,"script");this.binding=e.binding||"";this.contentType=e.contentType||"";this.id=e.id||"";this.name=e.name||"";this.runAt=getStringOption(e.runAt,["client","both","server"]);this.use=e.use||"";this.usehref=e.usehref||""}}class SetProperty extends XFAObject{constructor(e){super(vn,"setProperty");this.connection=e.connection||"";this.ref=e.ref||"";this.target=e.target||""}}class SignData extends XFAObject{constructor(e){super(vn,"signData",!0);this.id=e.id||"";this.operation=getStringOption(e.operation,["sign","clear","verify"]);this.ref=e.ref||"";this.target=e.target||"";this.use=e.use||"";this.usehref=e.usehref||"";this.filter=null;this.manifest=null}}class Signature extends XFAObject{constructor(e){super(vn,"signature",!0);this.id=e.id||"";this.type=getStringOption(e.type,["PDF1.3","PDF1.6"]);this.use=e.use||"";this.usehref=e.usehref||"";this.border=null;this.extras=null;this.filter=null;this.manifest=null;this.margin=null}}class Signing extends XFAObject{constructor(e){super(vn,"signing",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.certificate=new XFAObjectArray}}class Solid extends XFAObject{constructor(e){super(vn,"solid",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null}[on](e){return e?e[on]():"#FFFFFF"}}class Speak extends StringObject{constructor(e){super(vn,"speak");this.disable=getInteger({data:e.disable,defaultValue:0,validate:e=>1===e});this.id=e.id||"";this.priority=getStringOption(e.priority,["custom","caption","name","toolTip"]);this.rid=e.rid||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Stipple extends XFAObject{constructor(e){super(vn,"stipple",!0);this.id=e.id||"";this.rate=getInteger({data:e.rate,defaultValue:50,validate:e=>e>=0&&e<=100});this.use=e.use||"";this.usehref=e.usehref||"";this.color=null;this.extras=null}[on](e){const t=this.rate/100;return Util.makeHexColor(Math.round(e.value.r*(1-t)+this.value.r*t),Math.round(e.value.g*(1-t)+this.value.g*t),Math.round(e.value.b*(1-t)+this.value.b*t))}}class Subform extends XFAObject{constructor(e){super(vn,"subform",!0);this.access=getStringOption(e.access,["open","nonInteractive","protected","readOnly"]);this.allowMacro=getInteger({data:e.allowMacro,defaultValue:0,validate:e=>1===e});this.anchorType=getStringOption(e.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]);this.colSpan=getInteger({data:e.colSpan,defaultValue:1,validate:e=>e>=1||-1===e});this.columnWidths=(e.columnWidths||"").trim().split(/\s+/).map((e=>"-1"===e?-1:getMeasurement(e)));this.h=e.h?getMeasurement(e.h):"";this.hAlign=getStringOption(e.hAlign,["left","center","justify","justifyAll","radix","right"]);this.id=e.id||"";this.layout=getStringOption(e.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]);this.locale=e.locale||"";this.maxH=getMeasurement(e.maxH,"0pt");this.maxW=getMeasurement(e.maxW,"0pt");this.mergeMode=getStringOption(e.mergeMode,["consumeData","matchTemplate"]);this.minH=getMeasurement(e.minH,"0pt");this.minW=getMeasurement(e.minW,"0pt");this.name=e.name||"";this.presence=getStringOption(e.presence,["visible","hidden","inactive","invisible"]);this.relevant=getRelevant(e.relevant);this.restoreState=getStringOption(e.restoreState,["manual","auto"]);this.scope=getStringOption(e.scope,["name","none"]);this.use=e.use||"";this.usehref=e.usehref||"";this.w=e.w?getMeasurement(e.w):"";this.x=getMeasurement(e.x,"0pt");this.y=getMeasurement(e.y,"0pt");this.assist=null;this.bind=null;this.bookend=null;this.border=null;this.break=null;this.calculate=null;this.desc=null;this.extras=null;this.keep=null;this.margin=null;this.occur=null;this.overflow=null;this.pageSet=null;this.para=null;this.traversal=null;this.validate=null;this.variables=null;this.area=new XFAObjectArray;this.breakAfter=new XFAObjectArray;this.breakBefore=new XFAObjectArray;this.connect=new XFAObjectArray;this.draw=new XFAObjectArray;this.event=new XFAObjectArray;this.exObject=new XFAObjectArray;this.exclGroup=new XFAObjectArray;this.field=new XFAObjectArray;this.proto=new XFAObjectArray;this.setProperty=new XFAObjectArray;this.subform=new XFAObjectArray;this.subformSet=new XFAObjectArray}[yr](){const e=this[wr]();return e instanceof SubformSet?e[yr]():e}[Gr](){return!0}[Hr](){return this.layout.endsWith("-tb")&&0===this[nr].attempt&&this[nr].numberInLine>0||this[wr]()[Hr]()}*[pr](){yield*getContainedChildren(this)}[or](){return flushHTML(this)}[Vs](e,t){addHTML(this,e,t)}[Cr](){return getAvailableSpace(this)}[Lr](){const e=this[yr]();if(!e[Lr]())return!1;if(void 0!==this[nr]._isSplittable)return this[nr]._isSplittable;if("position"===this.layout||this.layout.includes("row")){this[nr]._isSplittable=!1;return!1}if(this.keep&&"none"!==this.keep.intact){this[nr]._isSplittable=!1;return!1}if(e.layout?.endsWith("-tb")&&0!==e[nr].numberInLine)return!1;this[nr]._isSplittable=!0;return!0}[nn](e){setTabIndex(this);if(this.break){if("auto"!==this.break.after||""!==this.break.afterTarget){const e=new BreakAfter({targetType:this.break.after,target:this.break.afterTarget,startNew:this.break.startNew.toString()});e[br]=this[br];this[zs](e);this.breakAfter.push(e)}if("auto"!==this.break.before||""!==this.break.beforeTarget){const e=new BreakBefore({targetType:this.break.before,target:this.break.beforeTarget,startNew:this.break.startNew.toString()});e[br]=this[br];this[zs](e);this.breakBefore.push(e)}if(""!==this.break.overflowTarget){const e=new Overflow({target:this.break.overflowTarget,leader:this.break.overflowLeader,trailer:this.break.overflowTrailer});e[br]=this[br];this[zs](e);this.overflow.push(e)}this[Vr](this.break);this.break=null}if("hidden"===this.presence||"inactive"===this.presence)return HTMLResult.EMPTY;(this.breakBefore.children.length>1||this.breakAfter.children.length>1)&&warn("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");if(this.breakBefore.children.length>=1){const e=this.breakBefore.children[0];if(handleBreak(e))return HTMLResult.breakNode(e)}if(this[nr]?.afterBreakAfter)return HTMLResult.EMPTY;fixDimensions(this);const t=[],i={id:this[In],class:[]};setAccess(this,i.class);this[nr]||(this[nr]=Object.create(null));Object.assign(this[nr],{children:t,line:null,attributes:i,attempt:0,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,e.width),height:Math.min(this.h||1/0,e.height)},width:0,height:0,prevHeight:0,currentWidth:0});const a=this[Dr](),s=a[nr].noLayoutFailure,r=this[Lr]();r||setFirstUnsplittable(this);if(!checkDimensions(this,e))return HTMLResult.FAILURE;const n=new Set(["area","draw","exclGroup","field","subform","subformSet"]);if(this.layout.includes("row")){const e=this[yr]().columnWidths;if(Array.isArray(e)&&e.length>0){this[nr].columnWidths=e;this[nr].currentColumn=0}}const g=toStyle(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),o=["xfaSubform"],c=layoutClass(this);c&&o.push(c);i.style=g;i.class=o;this.name&&(i.xfaName=this.name);if(this.overflow){const t=this.overflow[ur]();if(t.addLeader){t.addLeader=!1;handleOverflow(this,t.leader,e)}}this[Zr]();const C="lr-tb"===this.layout||"rl-tb"===this.layout,h=C?2:1;for(;this[nr].attempt=1){const e=this.breakAfter.children[0];if(handleBreak(e)){this[nr].afterBreakAfter=p;return HTMLResult.breakNode(e)}}delete this[nr];return p}}class SubformSet extends XFAObject{constructor(e){super(vn,"subformSet",!0);this.id=e.id||"";this.name=e.name||"";this.relation=getStringOption(e.relation,["ordered","choice","unordered"]);this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.bookend=null;this.break=null;this.desc=null;this.extras=null;this.occur=null;this.overflow=null;this.breakAfter=new XFAObjectArray;this.breakBefore=new XFAObjectArray;this.subform=new XFAObjectArray;this.subformSet=new XFAObjectArray}*[pr](){yield*getContainedChildren(this)}[yr](){let e=this[wr]();for(;!(e instanceof Subform);)e=e[wr]();return e}[Gr](){return!0}}class SubjectDN extends ContentObject{constructor(e){super(vn,"subjectDN");this.delimiter=e.delimiter||",";this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[gr](){this[ar]=new Map(this[ar].split(this.delimiter).map((e=>{(e=e.split("=",2))[0]=e[0].trim();return e})))}}class SubjectDNs extends XFAObject{constructor(e){super(vn,"subjectDNs",!0);this.id=e.id||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||"";this.subjectDN=new XFAObjectArray}}class Submit extends XFAObject{constructor(e){super(vn,"submit",!0);this.embedPDF=getInteger({data:e.embedPDF,defaultValue:0,validate:e=>1===e});this.format=getStringOption(e.format,["xdp","formdata","pdf","urlencoded","xfd","xml"]);this.id=e.id||"";this.target=e.target||"";this.textEncoding=getKeyword({data:e.textEncoding?e.textEncoding.toLowerCase():"",defaultValue:"",validate:e=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(e)||e.match(/iso-8859-\d{2}/)});this.use=e.use||"";this.usehref=e.usehref||"";this.xdpContent=e.xdpContent||"";this.encrypt=null;this.encryptData=new XFAObjectArray;this.signData=new XFAObjectArray}}class Template extends XFAObject{constructor(e){super(vn,"template",!0);this.baseProfile=getStringOption(e.baseProfile,["full","interactiveForms"]);this.extras=null;this.subform=new XFAObjectArray}[gr](){0===this.subform.children.length&&warn("XFA - No subforms in template node.");this.subform.children.length>=2&&warn("XFA - Several subforms in template node: please file a bug.");this[an]=5e3}[Lr](){return!0}[$r](e,t){return e.startsWith("#")?[this[Sr].get(e.slice(1))]:searchNode(this,t,e,!0,!0)}*[rn](){if(!this.subform.children.length)return HTMLResult.success({name:"div",children:[]});this[nr]={overflowNode:null,firstUnsplittable:null,currentContentArea:null,currentPageArea:null,noLayoutFailure:!1,pageNumber:1,pagePosition:"first",oddOrEven:"odd",blankOrNotBlank:"nonBlank",paraStack:[]};const e=this.subform.children[0];e.pageSet[Ar]();const t=e.pageSet.pageArea.children,i={name:"div",children:[]};let a=null,s=null,r=null;if(e.breakBefore.children.length>=1){s=e.breakBefore.children[0];r=s.target}else if(e.subform.children.length>=1&&e.subform.children[0].breakBefore.children.length>=1){s=e.subform.children[0].breakBefore.children[0];r=s.target}else if(e.break?.beforeTarget){s=e.break;r=s.beforeTarget}else if(e.subform.children.length>=1&&e.subform.children[0].break?.beforeTarget){s=e.subform.children[0].break;r=s.beforeTarget}if(s){const e=this[$r](r,s[wr]());if(e instanceof PageArea){a=e;s[nr]={}}}a||(a=t[0]);a[nr]={numberOfUse:1};const n=a[wr]();n[nr]={numberOfUse:1,pageIndex:n.pageArea.children.indexOf(a),pageSetIndex:0};let g,o=null,c=null,C=!0,h=0,l=0;for(;;){if(C)h=0;else{i.children.pop();if(3==++h){warn("XFA - Something goes wrong: please file a bug.");return i}}g=null;this[nr].currentPageArea=a;const t=a[nn]().html;i.children.push(t);if(o){this[nr].noLayoutFailure=!0;t.children.push(o[nn](a[nr].space).html);o=null}if(c){this[nr].noLayoutFailure=!0;t.children.push(c[nn](a[nr].space).html);c=null}const s=a.contentArea.children,r=t.children.filter((e=>e.attributes.class.includes("xfaContentarea")));C=!1;this[nr].firstUnsplittable=null;this[nr].noLayoutFailure=!1;const flush=t=>{const i=e[or]();if(i){C||=i.children?.length>0;r[t].children.push(i)}};for(let t=l,a=s.length;t0;r[t].children.push(h.html)}else!C&&i.children.length>1&&i.children.pop();return i}if(h.isBreak()){const e=h.breakNode;flush(t);if("auto"===e.targetType)continue;if(e.leader){o=this[$r](e.leader,e[wr]());o=o?o[0]:null}if(e.trailer){c=this[$r](e.trailer,e[wr]());c=c?c[0]:null}if("pageArea"===e.targetType){g=e[nr].target;t=1/0}else if(e[nr].target){g=e[nr].target;l=e[nr].index+1;t=1/0}else t=e[nr].index}else if(this[nr].overflowNode){const e=this[nr].overflowNode;this[nr].overflowNode=null;const i=e[ur](),a=i.target;i.addLeader=null!==i.leader;i.addTrailer=null!==i.trailer;flush(t);const r=t;t=1/0;if(a instanceof PageArea)g=a;else if(a instanceof ContentArea){const e=s.indexOf(a);if(-1!==e)e>r?t=e-1:l=e;else{g=a[wr]();l=g.contentArea.children.indexOf(a)}}}else flush(t)}this[nr].pageNumber+=1;g&&(g[Yr]()?g[nr].numberOfUse+=1:g=null);a=g||a[mr]();yield null}}}class Text extends ContentObject{constructor(e){super(vn,"text");this.id=e.id||"";this.maxChars=getInteger({data:e.maxChars,defaultValue:0,validate:e=>e>=0});this.name=e.name||"";this.rid=e.rid||"";this.use=e.use||"";this.usehref=e.usehref||""}[Zs](){return!0}[Or](e){if(e[Kr]===Cn.xhtml.id){this[ar]=e;return!0}warn(`XFA - Invalid content in Text: ${e[Tr]}.`);return!1}[Wr](e){this[ar]instanceof XFAObject||super[Wr](e)}[gr](){"string"==typeof this[ar]&&(this[ar]=this[ar].replaceAll("\r\n","\n"))}[ur](){return"string"==typeof this[ar]?this[ar].split(/[\u2029\u2028\n]/).reduce(((e,t)=>{t&&e.push(t);return e}),[]).join("\n"):this[ar][sn]()}[nn](e){if("string"==typeof this[ar]){const e=valueToHtml(this[ar]).html;if(this[ar].includes("\u2029")){e.name="div";e.children=[];this[ar].split("\u2029").map((e=>e.split(/[\u2028\n]/).reduce(((e,t)=>{e.push({name:"span",value:t},{name:"br"});return e}),[]))).forEach((t=>{e.children.push({name:"p",children:t})}))}else if(/[\u2028\n]/.test(this[ar])){e.name="div";e.children=[];this[ar].split(/[\u2028\n]/).forEach((t=>{e.children.push({name:"span",value:t},{name:"br"})}))}return HTMLResult.success(e)}return this[ar][nn](e)}}class TextEdit extends XFAObject{constructor(e){super(vn,"textEdit",!0);this.allowRichText=getInteger({data:e.allowRichText,defaultValue:0,validate:e=>1===e});this.hScrollPolicy=getStringOption(e.hScrollPolicy,["auto","off","on"]);this.id=e.id||"";this.multiLine=getInteger({data:e.multiLine,defaultValue:"",validate:e=>0===e||1===e});this.use=e.use||"";this.usehref=e.usehref||"";this.vScrollPolicy=getStringOption(e.vScrollPolicy,["auto","off","on"]);this.border=null;this.comb=null;this.extras=null;this.margin=null}[nn](e){const t=toStyle(this,"border","font","margin");let i;const a=this[wr]()[wr]();""===this.multiLine&&(this.multiLine=a instanceof Draw?1:0);i=1===this.multiLine?{name:"textarea",attributes:{dataId:a[sr]?.[In]||a[In],fieldId:a[In],class:["xfaTextfield"],style:t,"aria-label":ariaLabel(a),"aria-required":!1}}:{name:"input",attributes:{type:"text",dataId:a[sr]?.[In]||a[In],fieldId:a[In],class:["xfaTextfield"],style:t,"aria-label":ariaLabel(a),"aria-required":!1}};if(isRequired(a)){i.attributes["aria-required"]=!0;i.attributes.required=!0}return HTMLResult.success({name:"label",attributes:{class:["xfaLabel"]},children:[i]})}}class Time extends StringObject{constructor(e){super(vn,"time");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}[gr](){const e=this[ar].trim();this[ar]=e?new Date(e):null}[nn](e){return valueToHtml(this[ar]?this[ar].toString():"")}}class TimeStamp extends XFAObject{constructor(e){super(vn,"timeStamp");this.id=e.id||"";this.server=e.server||"";this.type=getStringOption(e.type,["optional","required"]);this.use=e.use||"";this.usehref=e.usehref||""}}class ToolTip extends StringObject{constructor(e){super(vn,"toolTip");this.id=e.id||"";this.rid=e.rid||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Traversal extends XFAObject{constructor(e){super(vn,"traversal",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.traverse=new XFAObjectArray}}class Traverse extends XFAObject{constructor(e){super(vn,"traverse",!0);this.id=e.id||"";this.operation=getStringOption(e.operation,["next","back","down","first","left","right","up"]);this.ref=e.ref||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.script=null}get name(){return this.operation}[Jr](){return!1}}class Ui extends XFAObject{constructor(e){super(vn,"ui",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.picture=null;this.barcode=null;this.button=null;this.checkButton=null;this.choiceList=null;this.dateTimeEdit=null;this.defaultUi=null;this.imageEdit=null;this.numericEdit=null;this.passwordEdit=null;this.signature=null;this.textEdit=null}[ur](){if(void 0===this[nr]){for(const e of Object.getOwnPropertyNames(this)){if("extras"===e||"picture"===e)continue;const t=this[e];if(t instanceof XFAObject){this[nr]=t;return t}}this[nr]=null}return this[nr]}[nn](e){const t=this[ur]();return t?t[nn](e):HTMLResult.EMPTY}}class Validate extends XFAObject{constructor(e){super(vn,"validate",!0);this.formatTest=getStringOption(e.formatTest,["warning","disabled","error"]);this.id=e.id||"";this.nullTest=getStringOption(e.nullTest,["disabled","error","warning"]);this.scriptTest=getStringOption(e.scriptTest,["error","disabled","warning"]);this.use=e.use||"";this.usehref=e.usehref||"";this.extras=null;this.message=null;this.picture=null;this.script=null}}class Value extends XFAObject{constructor(e){super(vn,"value",!0);this.id=e.id||"";this.override=getInteger({data:e.override,defaultValue:0,validate:e=>1===e});this.relevant=getRelevant(e.relevant);this.use=e.use||"";this.usehref=e.usehref||"";this.arc=null;this.boolean=null;this.date=null;this.dateTime=null;this.decimal=null;this.exData=null;this.float=null;this.image=null;this.integer=null;this.line=null;this.rectangle=null;this.text=null;this.time=null}[tn](e){const t=this[wr]();if(t instanceof Field&&t.ui?.imageEdit){if(!this.image){this.image=new Image({});this[zs](this.image)}this.image[ar]=e[ar];return}const i=e[Tr];if(null===this[i]){for(const e of Object.getOwnPropertyNames(this)){const t=this[e];if(t instanceof XFAObject){this[e]=null;this[Vr](t)}}this[e[Tr]]=e;this[zs](e)}else this[i][ar]=e[ar]}[sn](){if(this.exData)return"string"==typeof this.exData[ar]?this.exData[ar].trim():this.exData[ar][sn]().trim();for(const e of Object.getOwnPropertyNames(this)){if("image"===e)continue;const t=this[e];if(t instanceof XFAObject)return(t[ar]||"").toString().trim()}return null}[nn](e){for(const t of Object.getOwnPropertyNames(this)){const i=this[t];if(i instanceof XFAObject)return i[nn](e)}return HTMLResult.EMPTY}}class Variables extends XFAObject{constructor(e){super(vn,"variables",!0);this.id=e.id||"";this.use=e.use||"";this.usehref=e.usehref||"";this.boolean=new XFAObjectArray;this.date=new XFAObjectArray;this.dateTime=new XFAObjectArray;this.decimal=new XFAObjectArray;this.exData=new XFAObjectArray;this.float=new XFAObjectArray;this.image=new XFAObjectArray;this.integer=new XFAObjectArray;this.manifest=new XFAObjectArray;this.script=new XFAObjectArray;this.text=new XFAObjectArray;this.time=new XFAObjectArray}[Jr](){return!0}}class TemplateNamespace{static[cn](e,t){if(TemplateNamespace.hasOwnProperty(e)){const i=TemplateNamespace[e](t);i[en](t);return i}}static appearanceFilter(e){return new AppearanceFilter(e)}static arc(e){return new Arc(e)}static area(e){return new Area(e)}static assist(e){return new Assist(e)}static barcode(e){return new Barcode(e)}static bind(e){return new Bind(e)}static bindItems(e){return new BindItems(e)}static bookend(e){return new Bookend(e)}static boolean(e){return new BooleanElement(e)}static border(e){return new Border(e)}static break(e){return new Break(e)}static breakAfter(e){return new BreakAfter(e)}static breakBefore(e){return new BreakBefore(e)}static button(e){return new Button(e)}static calculate(e){return new Calculate(e)}static caption(e){return new Caption(e)}static certificate(e){return new Certificate(e)}static certificates(e){return new Certificates(e)}static checkButton(e){return new CheckButton(e)}static choiceList(e){return new ChoiceList(e)}static color(e){return new Color(e)}static comb(e){return new Comb(e)}static connect(e){return new Connect(e)}static contentArea(e){return new ContentArea(e)}static corner(e){return new Corner(e)}static date(e){return new DateElement(e)}static dateTime(e){return new DateTime(e)}static dateTimeEdit(e){return new DateTimeEdit(e)}static decimal(e){return new Decimal(e)}static defaultUi(e){return new DefaultUi(e)}static desc(e){return new Desc(e)}static digestMethod(e){return new DigestMethod(e)}static digestMethods(e){return new DigestMethods(e)}static draw(e){return new Draw(e)}static edge(e){return new Edge(e)}static encoding(e){return new Encoding(e)}static encodings(e){return new Encodings(e)}static encrypt(e){return new Encrypt(e)}static encryptData(e){return new EncryptData(e)}static encryption(e){return new Encryption(e)}static encryptionMethod(e){return new EncryptionMethod(e)}static encryptionMethods(e){return new EncryptionMethods(e)}static event(e){return new Event(e)}static exData(e){return new ExData(e)}static exObject(e){return new ExObject(e)}static exclGroup(e){return new ExclGroup(e)}static execute(e){return new Execute(e)}static extras(e){return new Extras(e)}static field(e){return new Field(e)}static fill(e){return new Fill(e)}static filter(e){return new Filter(e)}static float(e){return new Float(e)}static font(e){return new template_Font(e)}static format(e){return new Format(e)}static handler(e){return new Handler(e)}static hyphenation(e){return new Hyphenation(e)}static image(e){return new Image(e)}static imageEdit(e){return new ImageEdit(e)}static integer(e){return new Integer(e)}static issuers(e){return new Issuers(e)}static items(e){return new Items(e)}static keep(e){return new Keep(e)}static keyUsage(e){return new KeyUsage(e)}static line(e){return new Line(e)}static linear(e){return new Linear(e)}static lockDocument(e){return new LockDocument(e)}static manifest(e){return new Manifest(e)}static margin(e){return new Margin(e)}static mdp(e){return new Mdp(e)}static medium(e){return new Medium(e)}static message(e){return new Message(e)}static numericEdit(e){return new NumericEdit(e)}static occur(e){return new Occur(e)}static oid(e){return new Oid(e)}static oids(e){return new Oids(e)}static overflow(e){return new Overflow(e)}static pageArea(e){return new PageArea(e)}static pageSet(e){return new PageSet(e)}static para(e){return new Para(e)}static passwordEdit(e){return new PasswordEdit(e)}static pattern(e){return new template_Pattern(e)}static picture(e){return new Picture(e)}static proto(e){return new Proto(e)}static radial(e){return new Radial(e)}static reason(e){return new Reason(e)}static reasons(e){return new Reasons(e)}static rectangle(e){return new Rectangle(e)}static ref(e){return new RefElement(e)}static script(e){return new Script(e)}static setProperty(e){return new SetProperty(e)}static signData(e){return new SignData(e)}static signature(e){return new Signature(e)}static signing(e){return new Signing(e)}static solid(e){return new Solid(e)}static speak(e){return new Speak(e)}static stipple(e){return new Stipple(e)}static subform(e){return new Subform(e)}static subformSet(e){return new SubformSet(e)}static subjectDN(e){return new SubjectDN(e)}static subjectDNs(e){return new SubjectDNs(e)}static submit(e){return new Submit(e)}static template(e){return new Template(e)}static text(e){return new Text(e)}static textEdit(e){return new TextEdit(e)}static time(e){return new Time(e)}static timeStamp(e){return new TimeStamp(e)}static toolTip(e){return new ToolTip(e)}static traversal(e){return new Traversal(e)}static traverse(e){return new Traverse(e)}static ui(e){return new Ui(e)}static validate(e){return new Validate(e)}static value(e){return new Value(e)}static variables(e){return new Variables(e)}}const Pn=Cn.datasets.id;function createText(e){const t=new Text({});t[ar]=e;return t}class Binder{constructor(e){this.root=e;this.datasets=e.datasets;this.data=e.datasets?.data||new XmlObject(Cn.datasets.id,"data");this.emptyMerge=0===this.data[fr]().length;this.root.form=this.form=e.template[tr]()}_isConsumeData(){return!this.emptyMerge&&this._mergeMode}_isMatchTemplate(){return!this._isConsumeData()}bind(){this._bindElement(this.form,this.data);return this.form}getData(){return this.data}_bindValue(e,t,i){e[sr]=t;if(e[Fr]())if(t[xr]()){const i=t[Er]();e[tn](createText(i))}else if(e instanceof Field&&"multiSelect"===e.ui?.choiceList?.open){const i=t[fr]().map((e=>e[ar].trim())).join("\n");e[tn](createText(i))}else this._isConsumeData()&&warn("XFA - Nodes haven't the same type.");else!t[xr]()||this._isMatchTemplate()?this._bindElement(e,t):warn("XFA - Nodes haven't the same type.")}_findDataByNameToConsume(e,t,i,a){if(!e)return null;let s,r;for(let a=0;a<3;a++){s=i[dr](e,!1,!0);for(;;){r=s.next().value;if(!r)break;if(t===r[xr]())return r}if(i[Kr]===Cn.datasets.id&&"data"===i[Tr])break;i=i[wr]()}if(!a)return null;s=this.data[dr](e,!0,!1);r=s.next().value;if(r)return r;s=this.data[Ir](e,!0);r=s.next().value;return r?.[xr]()?r:null}_setProperties(e,t){if(e.hasOwnProperty("setProperty"))for(const{ref:i,target:a,connection:s}of e.setProperty.children){if(s)continue;if(!i)continue;const r=searchNode(this.root,t,i,!1,!1);if(!r){warn(`XFA - Invalid reference: ${i}.`);continue}const[n]=r;if(!n[Ur](this.data)){warn("XFA - Invalid node: must be a data node.");continue}const g=searchNode(this.root,e,a,!1,!1);if(!g){warn(`XFA - Invalid target: ${a}.`);continue}const[o]=g;if(!o[Ur](e)){warn("XFA - Invalid target: must be a property or subproperty.");continue}const c=o[wr]();if(o instanceof SetProperty||c instanceof SetProperty){warn("XFA - Invalid target: cannot be a setProperty or one of its properties.");continue}if(o instanceof BindItems||c instanceof BindItems){warn("XFA - Invalid target: cannot be a bindItems or one of its properties.");continue}const C=n[sn](),h=o[Tr];if(o instanceof XFAAttribute){const e=Object.create(null);e[h]=C;const t=Reflect.construct(Object.getPrototypeOf(c).constructor,[e]);c[h]=t[h]}else if(o.hasOwnProperty(ar)){o[sr]=n;o[ar]=C;o[gr]()}else warn("XFA - Invalid node to use in setProperty")}}_bindItems(e,t){if(!e.hasOwnProperty("items")||!e.hasOwnProperty("bindItems")||e.bindItems.isEmpty())return;for(const t of e.items.children)e[Vr](t);e.items.clear();const i=new Items({}),a=new Items({});e[zs](i);e.items.push(i);e[zs](a);e.items.push(a);for(const{ref:s,labelRef:r,valueRef:n,connection:g}of e.bindItems.children){if(g)continue;if(!s)continue;const e=searchNode(this.root,t,s,!1,!1);if(e)for(const t of e){if(!t[Ur](this.datasets)){warn(`XFA - Invalid ref (${s}): must be a datasets child.`);continue}const e=searchNode(this.root,t,r,!0,!1);if(!e){warn(`XFA - Invalid label: ${r}.`);continue}const[g]=e;if(!g[Ur](this.datasets)){warn("XFA - Invalid label: must be a datasets child.");continue}const o=searchNode(this.root,t,n,!0,!1);if(!o){warn(`XFA - Invalid value: ${n}.`);continue}const[c]=o;if(!c[Ur](this.datasets)){warn("XFA - Invalid value: must be a datasets child.");continue}const C=createText(g[sn]()),h=createText(c[sn]());i[zs](C);i.text.push(C);a[zs](h);a.text.push(h)}else warn(`XFA - Invalid reference: ${s}.`)}}_bindOccurrences(e,t,i){let a;if(t.length>1){a=e[tr]();a[Vr](a.occur);a.occur=null}this._bindValue(e,t[0],i);this._setProperties(e,t[0]);this._bindItems(e,t[0]);if(1===t.length)return;const s=e[wr](),r=e[Tr],n=s[kr](e);for(let e=1,g=t.length;et.name===e.name)).length:i[a].children.length;const r=i[kr](e)+1,n=t.initial-s;if(n){const t=e[tr]();t[Vr](t.occur);t.occur=null;i[a].push(t);i[Rr](r,t);for(let e=1;e0)this._bindOccurrences(a,[e[0]],null);else if(this.emptyMerge){const e=t[Kr]===Pn?-1:t[Kr],i=a[sr]=new XmlObject(e,a.name||"root");t[zs](i);this._bindElement(a,i)}continue}if(!a[Gr]())continue;let e=!1,s=null,r=null,n=null;if(a.bind){switch(a.bind.match){case"none":this._setAndBind(a,t);continue;case"global":e=!0;break;case"dataRef":if(!a.bind.ref){warn(`XFA - ref is empty in node ${a[Tr]}.`);this._setAndBind(a,t);continue}r=a.bind.ref}a.bind.picture&&(s=a.bind.picture[ar])}const[g,o]=this._getOccurInfo(a);if(r){n=searchNode(this.root,t,r,!0,!1);if(null===n){n=createDataNode(this.data,t,r);if(!n)continue;this._isConsumeData()&&(n[ir]=!0);this._setAndBind(a,n);continue}this._isConsumeData()&&(n=n.filter((e=>!e[ir])));n.length>o?n=n.slice(0,o):0===n.length&&(n=null);n&&this._isConsumeData()&&n.forEach((e=>{e[ir]=!0}))}else{if(!a.name){this._setAndBind(a,t);continue}if(this._isConsumeData()){const i=[];for(;i.length0?i:null}else{n=t[dr](a.name,!1,this.emptyMerge).next().value;if(!n){if(0===g){i.push(a);continue}const e=t[Kr]===Pn?-1:t[Kr];n=a[sr]=new XmlObject(e,a.name);this.emptyMerge&&(n[ir]=!0);t[zs](n);this._setAndBind(a,n);continue}this.emptyMerge&&(n[ir]=!0);n=[n]}}n?this._bindOccurrences(a,n,s):g>0?this._setAndBind(a,t):i.push(a)}i.forEach((e=>e[wr]()[Vr](e)))}}class DataHandler{constructor(e,t){this.data=t;this.dataset=e.datasets||null}serialize(e){const t=[[-1,this.data[fr]()]];for(;t.length>0;){const i=t.at(-1),[a,s]=i;if(a+1===s.length){t.pop();continue}const r=s[++i[0]],n=e.get(r[In]);if(n)r[tn](n);else{const t=r[cr]();for(const i of t.values()){const t=e.get(i[In]);if(t){i[tn](t);break}}}const g=r[fr]();g.length>0&&t.push([-1,g])}const i=[''];if(this.dataset)for(const e of this.dataset[fr]())"data"!==e[Tr]&&e[gn](i);this.data[gn](i);i.push("");return i.join("")}}const Wn=Cn.config.id;class Acrobat extends XFAObject{constructor(e){super(Wn,"acrobat",!0);this.acrobat7=null;this.autoSave=null;this.common=null;this.validate=null;this.validateApprovalSignatures=null;this.submitUrl=new XFAObjectArray}}class Acrobat7 extends XFAObject{constructor(e){super(Wn,"acrobat7",!0);this.dynamicRender=null}}class ADBE_JSConsole extends OptionObject{constructor(e){super(Wn,"ADBE_JSConsole",["delegate","Enable","Disable"])}}class ADBE_JSDebugger extends OptionObject{constructor(e){super(Wn,"ADBE_JSDebugger",["delegate","Enable","Disable"])}}class AddSilentPrint extends Option01{constructor(e){super(Wn,"addSilentPrint")}}class AddViewerPreferences extends Option01{constructor(e){super(Wn,"addViewerPreferences")}}class AdjustData extends Option10{constructor(e){super(Wn,"adjustData")}}class AdobeExtensionLevel extends IntegerObject{constructor(e){super(Wn,"adobeExtensionLevel",0,(e=>e>=1&&e<=8))}}class Agent extends XFAObject{constructor(e){super(Wn,"agent",!0);this.name=e.name?e.name.trim():"";this.common=new XFAObjectArray}}class AlwaysEmbed extends ContentObject{constructor(e){super(Wn,"alwaysEmbed")}}class Amd extends StringObject{constructor(e){super(Wn,"amd")}}class config_Area extends XFAObject{constructor(e){super(Wn,"area");this.level=getInteger({data:e.level,defaultValue:0,validate:e=>e>=1&&e<=3});this.name=getStringOption(e.name,["","barcode","coreinit","deviceDriver","font","general","layout","merge","script","signature","sourceSet","templateCache"])}}class Attributes extends OptionObject{constructor(e){super(Wn,"attributes",["preserve","delegate","ignore"])}}class AutoSave extends OptionObject{constructor(e){super(Wn,"autoSave",["disabled","enabled"])}}class Base extends StringObject{constructor(e){super(Wn,"base")}}class BatchOutput extends XFAObject{constructor(e){super(Wn,"batchOutput");this.format=getStringOption(e.format,["none","concat","zip","zipCompress"])}}class BehaviorOverride extends ContentObject{constructor(e){super(Wn,"behaviorOverride")}[gr](){this[ar]=new Map(this[ar].trim().split(/\s+/).filter((e=>e.includes(":"))).map((e=>e.split(":",2))))}}class Cache extends XFAObject{constructor(e){super(Wn,"cache",!0);this.templateCache=null}}class Change extends Option01{constructor(e){super(Wn,"change")}}class Common extends XFAObject{constructor(e){super(Wn,"common",!0);this.data=null;this.locale=null;this.localeSet=null;this.messaging=null;this.suppressBanner=null;this.template=null;this.validationMessaging=null;this.versionControl=null;this.log=new XFAObjectArray}}class Compress extends XFAObject{constructor(e){super(Wn,"compress");this.scope=getStringOption(e.scope,["imageOnly","document"])}}class CompressLogicalStructure extends Option01{constructor(e){super(Wn,"compressLogicalStructure")}}class CompressObjectStream extends Option10{constructor(e){super(Wn,"compressObjectStream")}}class Compression extends XFAObject{constructor(e){super(Wn,"compression",!0);this.compressLogicalStructure=null;this.compressObjectStream=null;this.level=null;this.type=null}}class Config extends XFAObject{constructor(e){super(Wn,"config",!0);this.acrobat=null;this.present=null;this.trace=null;this.agent=new XFAObjectArray}}class Conformance extends OptionObject{constructor(e){super(Wn,"conformance",["A","B"])}}class ContentCopy extends Option01{constructor(e){super(Wn,"contentCopy")}}class Copies extends IntegerObject{constructor(e){super(Wn,"copies",1,(e=>e>=1))}}class Creator extends StringObject{constructor(e){super(Wn,"creator")}}class CurrentPage extends IntegerObject{constructor(e){super(Wn,"currentPage",0,(e=>e>=0))}}class Data extends XFAObject{constructor(e){super(Wn,"data",!0);this.adjustData=null;this.attributes=null;this.incrementalLoad=null;this.outputXSL=null;this.range=null;this.record=null;this.startNode=null;this.uri=null;this.window=null;this.xsl=null;this.excludeNS=new XFAObjectArray;this.transform=new XFAObjectArray}}class Debug extends XFAObject{constructor(e){super(Wn,"debug",!0);this.uri=null}}class DefaultTypeface extends ContentObject{constructor(e){super(Wn,"defaultTypeface");this.writingScript=getStringOption(e.writingScript,["*","Arabic","Cyrillic","EastEuropeanRoman","Greek","Hebrew","Japanese","Korean","Roman","SimplifiedChinese","Thai","TraditionalChinese","Vietnamese"])}}class Destination extends OptionObject{constructor(e){super(Wn,"destination",["pdf","pcl","ps","webClient","zpl"])}}class DocumentAssembly extends Option01{constructor(e){super(Wn,"documentAssembly")}}class Driver extends XFAObject{constructor(e){super(Wn,"driver",!0);this.name=e.name?e.name.trim():"";this.fontInfo=null;this.xdc=null}}class DuplexOption extends OptionObject{constructor(e){super(Wn,"duplexOption",["simplex","duplexFlipLongEdge","duplexFlipShortEdge"])}}class DynamicRender extends OptionObject{constructor(e){super(Wn,"dynamicRender",["forbidden","required"])}}class Embed extends Option01{constructor(e){super(Wn,"embed")}}class config_Encrypt extends Option01{constructor(e){super(Wn,"encrypt")}}class config_Encryption extends XFAObject{constructor(e){super(Wn,"encryption",!0);this.encrypt=null;this.encryptionLevel=null;this.permissions=null}}class EncryptionLevel extends OptionObject{constructor(e){super(Wn,"encryptionLevel",["40bit","128bit"])}}class Enforce extends StringObject{constructor(e){super(Wn,"enforce")}}class Equate extends XFAObject{constructor(e){super(Wn,"equate");this.force=getInteger({data:e.force,defaultValue:1,validate:e=>0===e});this.from=e.from||"";this.to=e.to||""}}class EquateRange extends XFAObject{constructor(e){super(Wn,"equateRange");this.from=e.from||"";this.to=e.to||"";this._unicodeRange=e.unicodeRange||""}get unicodeRange(){const e=[],t=/U\+([0-9a-fA-F]+)/,i=this._unicodeRange;for(let a of i.split(",").map((e=>e.trim())).filter((e=>!!e))){a=a.split("-",2).map((e=>{const i=e.match(t);return i?parseInt(i[1],16):0}));1===a.length&&a.push(a[0]);e.push(a)}return shadow(this,"unicodeRange",e)}}class Exclude extends ContentObject{constructor(e){super(Wn,"exclude")}[gr](){this[ar]=this[ar].trim().split(/\s+/).filter((e=>e&&["calculate","close","enter","exit","initialize","ready","validate"].includes(e)))}}class ExcludeNS extends StringObject{constructor(e){super(Wn,"excludeNS")}}class FlipLabel extends OptionObject{constructor(e){super(Wn,"flipLabel",["usePrinterSetting","on","off"])}}class config_FontInfo extends XFAObject{constructor(e){super(Wn,"fontInfo",!0);this.embed=null;this.map=null;this.subsetBelow=null;this.alwaysEmbed=new XFAObjectArray;this.defaultTypeface=new XFAObjectArray;this.neverEmbed=new XFAObjectArray}}class FormFieldFilling extends Option01{constructor(e){super(Wn,"formFieldFilling")}}class GroupParent extends StringObject{constructor(e){super(Wn,"groupParent")}}class IfEmpty extends OptionObject{constructor(e){super(Wn,"ifEmpty",["dataValue","dataGroup","ignore","remove"])}}class IncludeXDPContent extends StringObject{constructor(e){super(Wn,"includeXDPContent")}}class IncrementalLoad extends OptionObject{constructor(e){super(Wn,"incrementalLoad",["none","forwardOnly"])}}class IncrementalMerge extends Option01{constructor(e){super(Wn,"incrementalMerge")}}class Interactive extends Option01{constructor(e){super(Wn,"interactive")}}class Jog extends OptionObject{constructor(e){super(Wn,"jog",["usePrinterSetting","none","pageSet"])}}class LabelPrinter extends XFAObject{constructor(e){super(Wn,"labelPrinter",!0);this.name=getStringOption(e.name,["zpl","dpl","ipl","tcpl"]);this.batchOutput=null;this.flipLabel=null;this.fontInfo=null;this.xdc=null}}class Layout extends OptionObject{constructor(e){super(Wn,"layout",["paginate","panel"])}}class Level extends IntegerObject{constructor(e){super(Wn,"level",0,(e=>e>0))}}class Linearized extends Option01{constructor(e){super(Wn,"linearized")}}class Locale extends StringObject{constructor(e){super(Wn,"locale")}}class LocaleSet extends StringObject{constructor(e){super(Wn,"localeSet")}}class Log extends XFAObject{constructor(e){super(Wn,"log",!0);this.mode=null;this.threshold=null;this.to=null;this.uri=null}}class MapElement extends XFAObject{constructor(e){super(Wn,"map",!0);this.equate=new XFAObjectArray;this.equateRange=new XFAObjectArray}}class MediumInfo extends XFAObject{constructor(e){super(Wn,"mediumInfo",!0);this.map=null}}class config_Message extends XFAObject{constructor(e){super(Wn,"message",!0);this.msgId=null;this.severity=null}}class Messaging extends XFAObject{constructor(e){super(Wn,"messaging",!0);this.message=new XFAObjectArray}}class Mode extends OptionObject{constructor(e){super(Wn,"mode",["append","overwrite"])}}class ModifyAnnots extends Option01{constructor(e){super(Wn,"modifyAnnots")}}class MsgId extends IntegerObject{constructor(e){super(Wn,"msgId",1,(e=>e>=1))}}class NameAttr extends StringObject{constructor(e){super(Wn,"nameAttr")}}class NeverEmbed extends ContentObject{constructor(e){super(Wn,"neverEmbed")}}class NumberOfCopies extends IntegerObject{constructor(e){super(Wn,"numberOfCopies",null,(e=>e>=2&&e<=5))}}class OpenAction extends XFAObject{constructor(e){super(Wn,"openAction",!0);this.destination=null}}class Output extends XFAObject{constructor(e){super(Wn,"output",!0);this.to=null;this.type=null;this.uri=null}}class OutputBin extends StringObject{constructor(e){super(Wn,"outputBin")}}class OutputXSL extends XFAObject{constructor(e){super(Wn,"outputXSL",!0);this.uri=null}}class Overprint extends OptionObject{constructor(e){super(Wn,"overprint",["none","both","draw","field"])}}class Packets extends StringObject{constructor(e){super(Wn,"packets")}[gr](){"*"!==this[ar]&&(this[ar]=this[ar].trim().split(/\s+/).filter((e=>["config","datasets","template","xfdf","xslt"].includes(e))))}}class PageOffset extends XFAObject{constructor(e){super(Wn,"pageOffset");this.x=getInteger({data:e.x,defaultValue:"useXDCSetting",validate:e=>!0});this.y=getInteger({data:e.y,defaultValue:"useXDCSetting",validate:e=>!0})}}class PageRange extends StringObject{constructor(e){super(Wn,"pageRange")}[gr](){const e=this[ar].trim().split(/\s+/).map((e=>parseInt(e,10))),t=[];for(let i=0,a=e.length;i!1))}}class Pcl extends XFAObject{constructor(e){super(Wn,"pcl",!0);this.name=e.name||"";this.batchOutput=null;this.fontInfo=null;this.jog=null;this.mediumInfo=null;this.outputBin=null;this.pageOffset=null;this.staple=null;this.xdc=null}}class Pdf extends XFAObject{constructor(e){super(Wn,"pdf",!0);this.name=e.name||"";this.adobeExtensionLevel=null;this.batchOutput=null;this.compression=null;this.creator=null;this.encryption=null;this.fontInfo=null;this.interactive=null;this.linearized=null;this.openAction=null;this.pdfa=null;this.producer=null;this.renderPolicy=null;this.scriptModel=null;this.silentPrint=null;this.submitFormat=null;this.tagged=null;this.version=null;this.viewerPreferences=null;this.xdc=null}}class Pdfa extends XFAObject{constructor(e){super(Wn,"pdfa",!0);this.amd=null;this.conformance=null;this.includeXDPContent=null;this.part=null}}class Permissions extends XFAObject{constructor(e){super(Wn,"permissions",!0);this.accessibleContent=null;this.change=null;this.contentCopy=null;this.documentAssembly=null;this.formFieldFilling=null;this.modifyAnnots=null;this.plaintextMetadata=null;this.print=null;this.printHighQuality=null}}class PickTrayByPDFSize extends Option01{constructor(e){super(Wn,"pickTrayByPDFSize")}}class config_Picture extends StringObject{constructor(e){super(Wn,"picture")}}class PlaintextMetadata extends Option01{constructor(e){super(Wn,"plaintextMetadata")}}class Presence extends OptionObject{constructor(e){super(Wn,"presence",["preserve","dissolve","dissolveStructure","ignore","remove"])}}class Present extends XFAObject{constructor(e){super(Wn,"present",!0);this.behaviorOverride=null;this.cache=null;this.common=null;this.copies=null;this.destination=null;this.incrementalMerge=null;this.layout=null;this.output=null;this.overprint=null;this.pagination=null;this.paginationOverride=null;this.script=null;this.validate=null;this.xdp=null;this.driver=new XFAObjectArray;this.labelPrinter=new XFAObjectArray;this.pcl=new XFAObjectArray;this.pdf=new XFAObjectArray;this.ps=new XFAObjectArray;this.submitUrl=new XFAObjectArray;this.webClient=new XFAObjectArray;this.zpl=new XFAObjectArray}}class Print extends Option01{constructor(e){super(Wn,"print")}}class PrintHighQuality extends Option01{constructor(e){super(Wn,"printHighQuality")}}class PrintScaling extends OptionObject{constructor(e){super(Wn,"printScaling",["appdefault","noScaling"])}}class PrinterName extends StringObject{constructor(e){super(Wn,"printerName")}}class Producer extends StringObject{constructor(e){super(Wn,"producer")}}class Ps extends XFAObject{constructor(e){super(Wn,"ps",!0);this.name=e.name||"";this.batchOutput=null;this.fontInfo=null;this.jog=null;this.mediumInfo=null;this.outputBin=null;this.staple=null;this.xdc=null}}class Range extends ContentObject{constructor(e){super(Wn,"range")}[gr](){this[ar]=this[ar].trim().split(/\s*,\s*/,2).map((e=>e.split("-").map((e=>parseInt(e.trim(),10))))).filter((e=>e.every((e=>!isNaN(e))))).map((e=>{1===e.length&&e.push(e[0]);return e}))}}class Record extends ContentObject{constructor(e){super(Wn,"record")}[gr](){this[ar]=this[ar].trim();const e=parseInt(this[ar],10);!isNaN(e)&&e>=0&&(this[ar]=e)}}class Relevant extends ContentObject{constructor(e){super(Wn,"relevant")}[gr](){this[ar]=this[ar].trim().split(/\s+/)}}class Rename extends ContentObject{constructor(e){super(Wn,"rename")}[gr](){this[ar]=this[ar].trim();(this[ar].toLowerCase().startsWith("xml")||new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*","u").test(this[ar]))&&warn("XFA - Rename: invalid XFA name")}}class RenderPolicy extends OptionObject{constructor(e){super(Wn,"renderPolicy",["server","client"])}}class RunScripts extends OptionObject{constructor(e){super(Wn,"runScripts",["both","client","none","server"])}}class config_Script extends XFAObject{constructor(e){super(Wn,"script",!0);this.currentPage=null;this.exclude=null;this.runScripts=null}}class ScriptModel extends OptionObject{constructor(e){super(Wn,"scriptModel",["XFA","none"])}}class Severity extends OptionObject{constructor(e){super(Wn,"severity",["ignore","error","information","trace","warning"])}}class SilentPrint extends XFAObject{constructor(e){super(Wn,"silentPrint",!0);this.addSilentPrint=null;this.printerName=null}}class Staple extends XFAObject{constructor(e){super(Wn,"staple");this.mode=getStringOption(e.mode,["usePrinterSetting","on","off"])}}class StartNode extends StringObject{constructor(e){super(Wn,"startNode")}}class StartPage extends IntegerObject{constructor(e){super(Wn,"startPage",0,(e=>!0))}}class SubmitFormat extends OptionObject{constructor(e){super(Wn,"submitFormat",["html","delegate","fdf","xml","pdf"])}}class SubmitUrl extends StringObject{constructor(e){super(Wn,"submitUrl")}}class SubsetBelow extends IntegerObject{constructor(e){super(Wn,"subsetBelow",100,(e=>e>=0&&e<=100))}}class SuppressBanner extends Option01{constructor(e){super(Wn,"suppressBanner")}}class Tagged extends Option01{constructor(e){super(Wn,"tagged")}}class config_Template extends XFAObject{constructor(e){super(Wn,"template",!0);this.base=null;this.relevant=null;this.startPage=null;this.uri=null;this.xsl=null}}class Threshold extends OptionObject{constructor(e){super(Wn,"threshold",["trace","error","information","warning"])}}class To extends OptionObject{constructor(e){super(Wn,"to",["null","memory","stderr","stdout","system","uri"])}}class TemplateCache extends XFAObject{constructor(e){super(Wn,"templateCache");this.maxEntries=getInteger({data:e.maxEntries,defaultValue:5,validate:e=>e>=0})}}class Trace extends XFAObject{constructor(e){super(Wn,"trace",!0);this.area=new XFAObjectArray}}class Transform extends XFAObject{constructor(e){super(Wn,"transform",!0);this.groupParent=null;this.ifEmpty=null;this.nameAttr=null;this.picture=null;this.presence=null;this.rename=null;this.whitespace=null}}class Type extends OptionObject{constructor(e){super(Wn,"type",["none","ascii85","asciiHex","ccittfax","flate","lzw","runLength","native","xdp","mergedXDP"])}}class Uri extends StringObject{constructor(e){super(Wn,"uri")}}class config_Validate extends OptionObject{constructor(e){super(Wn,"validate",["preSubmit","prePrint","preExecute","preSave"])}}class ValidateApprovalSignatures extends ContentObject{constructor(e){super(Wn,"validateApprovalSignatures")}[gr](){this[ar]=this[ar].trim().split(/\s+/).filter((e=>["docReady","postSign"].includes(e)))}}class ValidationMessaging extends OptionObject{constructor(e){super(Wn,"validationMessaging",["allMessagesIndividually","allMessagesTogether","firstMessageOnly","noMessages"])}}class Version extends OptionObject{constructor(e){super(Wn,"version",["1.7","1.6","1.5","1.4","1.3","1.2"])}}class VersionControl extends XFAObject{constructor(e){super(Wn,"VersionControl");this.outputBelow=getStringOption(e.outputBelow,["warn","error","update"]);this.sourceAbove=getStringOption(e.sourceAbove,["warn","error"]);this.sourceBelow=getStringOption(e.sourceBelow,["update","maintain"])}}class ViewerPreferences extends XFAObject{constructor(e){super(Wn,"viewerPreferences",!0);this.ADBE_JSConsole=null;this.ADBE_JSDebugger=null;this.addViewerPreferences=null;this.duplexOption=null;this.enforce=null;this.numberOfCopies=null;this.pageRange=null;this.pickTrayByPDFSize=null;this.printScaling=null}}class WebClient extends XFAObject{constructor(e){super(Wn,"webClient",!0);this.name=e.name?e.name.trim():"";this.fontInfo=null;this.xdc=null}}class Whitespace extends OptionObject{constructor(e){super(Wn,"whitespace",["preserve","ltrim","normalize","rtrim","trim"])}}class Window extends ContentObject{constructor(e){super(Wn,"window")}[gr](){const e=this[ar].trim().split(/\s*,\s*/,2).map((e=>parseInt(e,10)));if(e.some((e=>isNaN(e))))this[ar]=[0,0];else{1===e.length&&e.push(e[0]);this[ar]=e}}}class Xdc extends XFAObject{constructor(e){super(Wn,"xdc",!0);this.uri=new XFAObjectArray;this.xsl=new XFAObjectArray}}class Xdp extends XFAObject{constructor(e){super(Wn,"xdp",!0);this.packets=null}}class Xsl extends XFAObject{constructor(e){super(Wn,"xsl",!0);this.debug=null;this.uri=null}}class Zpl extends XFAObject{constructor(e){super(Wn,"zpl",!0);this.name=e.name?e.name.trim():"";this.batchOutput=null;this.flipLabel=null;this.fontInfo=null;this.xdc=null}}class ConfigNamespace{static[cn](e,t){if(ConfigNamespace.hasOwnProperty(e))return ConfigNamespace[e](t)}static acrobat(e){return new Acrobat(e)}static acrobat7(e){return new Acrobat7(e)}static ADBE_JSConsole(e){return new ADBE_JSConsole(e)}static ADBE_JSDebugger(e){return new ADBE_JSDebugger(e)}static addSilentPrint(e){return new AddSilentPrint(e)}static addViewerPreferences(e){return new AddViewerPreferences(e)}static adjustData(e){return new AdjustData(e)}static adobeExtensionLevel(e){return new AdobeExtensionLevel(e)}static agent(e){return new Agent(e)}static alwaysEmbed(e){return new AlwaysEmbed(e)}static amd(e){return new Amd(e)}static area(e){return new config_Area(e)}static attributes(e){return new Attributes(e)}static autoSave(e){return new AutoSave(e)}static base(e){return new Base(e)}static batchOutput(e){return new BatchOutput(e)}static behaviorOverride(e){return new BehaviorOverride(e)}static cache(e){return new Cache(e)}static change(e){return new Change(e)}static common(e){return new Common(e)}static compress(e){return new Compress(e)}static compressLogicalStructure(e){return new CompressLogicalStructure(e)}static compressObjectStream(e){return new CompressObjectStream(e)}static compression(e){return new Compression(e)}static config(e){return new Config(e)}static conformance(e){return new Conformance(e)}static contentCopy(e){return new ContentCopy(e)}static copies(e){return new Copies(e)}static creator(e){return new Creator(e)}static currentPage(e){return new CurrentPage(e)}static data(e){return new Data(e)}static debug(e){return new Debug(e)}static defaultTypeface(e){return new DefaultTypeface(e)}static destination(e){return new Destination(e)}static documentAssembly(e){return new DocumentAssembly(e)}static driver(e){return new Driver(e)}static duplexOption(e){return new DuplexOption(e)}static dynamicRender(e){return new DynamicRender(e)}static embed(e){return new Embed(e)}static encrypt(e){return new config_Encrypt(e)}static encryption(e){return new config_Encryption(e)}static encryptionLevel(e){return new EncryptionLevel(e)}static enforce(e){return new Enforce(e)}static equate(e){return new Equate(e)}static equateRange(e){return new EquateRange(e)}static exclude(e){return new Exclude(e)}static excludeNS(e){return new ExcludeNS(e)}static flipLabel(e){return new FlipLabel(e)}static fontInfo(e){return new config_FontInfo(e)}static formFieldFilling(e){return new FormFieldFilling(e)}static groupParent(e){return new GroupParent(e)}static ifEmpty(e){return new IfEmpty(e)}static includeXDPContent(e){return new IncludeXDPContent(e)}static incrementalLoad(e){return new IncrementalLoad(e)}static incrementalMerge(e){return new IncrementalMerge(e)}static interactive(e){return new Interactive(e)}static jog(e){return new Jog(e)}static labelPrinter(e){return new LabelPrinter(e)}static layout(e){return new Layout(e)}static level(e){return new Level(e)}static linearized(e){return new Linearized(e)}static locale(e){return new Locale(e)}static localeSet(e){return new LocaleSet(e)}static log(e){return new Log(e)}static map(e){return new MapElement(e)}static mediumInfo(e){return new MediumInfo(e)}static message(e){return new config_Message(e)}static messaging(e){return new Messaging(e)}static mode(e){return new Mode(e)}static modifyAnnots(e){return new ModifyAnnots(e)}static msgId(e){return new MsgId(e)}static nameAttr(e){return new NameAttr(e)}static neverEmbed(e){return new NeverEmbed(e)}static numberOfCopies(e){return new NumberOfCopies(e)}static openAction(e){return new OpenAction(e)}static output(e){return new Output(e)}static outputBin(e){return new OutputBin(e)}static outputXSL(e){return new OutputXSL(e)}static overprint(e){return new Overprint(e)}static packets(e){return new Packets(e)}static pageOffset(e){return new PageOffset(e)}static pageRange(e){return new PageRange(e)}static pagination(e){return new Pagination(e)}static paginationOverride(e){return new PaginationOverride(e)}static part(e){return new Part(e)}static pcl(e){return new Pcl(e)}static pdf(e){return new Pdf(e)}static pdfa(e){return new Pdfa(e)}static permissions(e){return new Permissions(e)}static pickTrayByPDFSize(e){return new PickTrayByPDFSize(e)}static picture(e){return new config_Picture(e)}static plaintextMetadata(e){return new PlaintextMetadata(e)}static presence(e){return new Presence(e)}static present(e){return new Present(e)}static print(e){return new Print(e)}static printHighQuality(e){return new PrintHighQuality(e)}static printScaling(e){return new PrintScaling(e)}static printerName(e){return new PrinterName(e)}static producer(e){return new Producer(e)}static ps(e){return new Ps(e)}static range(e){return new Range(e)}static record(e){return new Record(e)}static relevant(e){return new Relevant(e)}static rename(e){return new Rename(e)}static renderPolicy(e){return new RenderPolicy(e)}static runScripts(e){return new RunScripts(e)}static script(e){return new config_Script(e)}static scriptModel(e){return new ScriptModel(e)}static severity(e){return new Severity(e)}static silentPrint(e){return new SilentPrint(e)}static staple(e){return new Staple(e)}static startNode(e){return new StartNode(e)}static startPage(e){return new StartPage(e)}static submitFormat(e){return new SubmitFormat(e)}static submitUrl(e){return new SubmitUrl(e)}static subsetBelow(e){return new SubsetBelow(e)}static suppressBanner(e){return new SuppressBanner(e)}static tagged(e){return new Tagged(e)}static template(e){return new config_Template(e)}static templateCache(e){return new TemplateCache(e)}static threshold(e){return new Threshold(e)}static to(e){return new To(e)}static trace(e){return new Trace(e)}static transform(e){return new Transform(e)}static type(e){return new Type(e)}static uri(e){return new Uri(e)}static validate(e){return new config_Validate(e)}static validateApprovalSignatures(e){return new ValidateApprovalSignatures(e)}static validationMessaging(e){return new ValidationMessaging(e)}static version(e){return new Version(e)}static versionControl(e){return new VersionControl(e)}static viewerPreferences(e){return new ViewerPreferences(e)}static webClient(e){return new WebClient(e)}static whitespace(e){return new Whitespace(e)}static window(e){return new Window(e)}static xdc(e){return new Xdc(e)}static xdp(e){return new Xdp(e)}static xsl(e){return new Xsl(e)}static zpl(e){return new Zpl(e)}}const jn=Cn.connectionSet.id;class ConnectionSet extends XFAObject{constructor(e){super(jn,"connectionSet",!0);this.wsdlConnection=new XFAObjectArray;this.xmlConnection=new XFAObjectArray;this.xsdConnection=new XFAObjectArray}}class EffectiveInputPolicy extends XFAObject{constructor(e){super(jn,"effectiveInputPolicy");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class EffectiveOutputPolicy extends XFAObject{constructor(e){super(jn,"effectiveOutputPolicy");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class Operation extends StringObject{constructor(e){super(jn,"operation");this.id=e.id||"";this.input=e.input||"";this.name=e.name||"";this.output=e.output||"";this.use=e.use||"";this.usehref=e.usehref||""}}class RootElement extends StringObject{constructor(e){super(jn,"rootElement");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class SoapAction extends StringObject{constructor(e){super(jn,"soapAction");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class SoapAddress extends StringObject{constructor(e){super(jn,"soapAddress");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class connection_set_Uri extends StringObject{constructor(e){super(jn,"uri");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class WsdlAddress extends StringObject{constructor(e){super(jn,"wsdlAddress");this.id=e.id||"";this.name=e.name||"";this.use=e.use||"";this.usehref=e.usehref||""}}class WsdlConnection extends XFAObject{constructor(e){super(jn,"wsdlConnection",!0);this.dataDescription=e.dataDescription||"";this.name=e.name||"";this.effectiveInputPolicy=null;this.effectiveOutputPolicy=null;this.operation=null;this.soapAction=null;this.soapAddress=null;this.wsdlAddress=null}}class XmlConnection extends XFAObject{constructor(e){super(jn,"xmlConnection",!0);this.dataDescription=e.dataDescription||"";this.name=e.name||"";this.uri=null}}class XsdConnection extends XFAObject{constructor(e){super(jn,"xsdConnection",!0);this.dataDescription=e.dataDescription||"";this.name=e.name||"";this.rootElement=null;this.uri=null}}class ConnectionSetNamespace{static[cn](e,t){if(ConnectionSetNamespace.hasOwnProperty(e))return ConnectionSetNamespace[e](t)}static connectionSet(e){return new ConnectionSet(e)}static effectiveInputPolicy(e){return new EffectiveInputPolicy(e)}static effectiveOutputPolicy(e){return new EffectiveOutputPolicy(e)}static operation(e){return new Operation(e)}static rootElement(e){return new RootElement(e)}static soapAction(e){return new SoapAction(e)}static soapAddress(e){return new SoapAddress(e)}static uri(e){return new connection_set_Uri(e)}static wsdlAddress(e){return new WsdlAddress(e)}static wsdlConnection(e){return new WsdlConnection(e)}static xmlConnection(e){return new XmlConnection(e)}static xsdConnection(e){return new XsdConnection(e)}}const Xn=Cn.datasets.id;class datasets_Data extends XmlObject{constructor(e){super(Xn,"data",e)}[Mr](){return!0}}class Datasets extends XFAObject{constructor(e){super(Xn,"datasets",!0);this.data=null;this.Signature=null}[Or](e){const t=e[Tr];("data"===t&&e[Kr]===Xn||"Signature"===t&&e[Kr]===Cn.signature.id)&&(this[t]=e);this[zs](e)}}class DatasetsNamespace{static[cn](e,t){if(DatasetsNamespace.hasOwnProperty(e))return DatasetsNamespace[e](t)}static datasets(e){return new Datasets(e)}static data(e){return new datasets_Data(e)}}const Zn=Cn.localeSet.id;class CalendarSymbols extends XFAObject{constructor(e){super(Zn,"calendarSymbols",!0);this.name="gregorian";this.dayNames=new XFAObjectArray(2);this.eraNames=null;this.meridiemNames=null;this.monthNames=new XFAObjectArray(2)}}class CurrencySymbol extends StringObject{constructor(e){super(Zn,"currencySymbol");this.name=getStringOption(e.name,["symbol","isoname","decimal"])}}class CurrencySymbols extends XFAObject{constructor(e){super(Zn,"currencySymbols",!0);this.currencySymbol=new XFAObjectArray(3)}}class DatePattern extends StringObject{constructor(e){super(Zn,"datePattern");this.name=getStringOption(e.name,["full","long","med","short"])}}class DatePatterns extends XFAObject{constructor(e){super(Zn,"datePatterns",!0);this.datePattern=new XFAObjectArray(4)}}class DateTimeSymbols extends ContentObject{constructor(e){super(Zn,"dateTimeSymbols")}}class Day extends StringObject{constructor(e){super(Zn,"day")}}class DayNames extends XFAObject{constructor(e){super(Zn,"dayNames",!0);this.abbr=getInteger({data:e.abbr,defaultValue:0,validate:e=>1===e});this.day=new XFAObjectArray(7)}}class Era extends StringObject{constructor(e){super(Zn,"era")}}class EraNames extends XFAObject{constructor(e){super(Zn,"eraNames",!0);this.era=new XFAObjectArray(2)}}class locale_set_Locale extends XFAObject{constructor(e){super(Zn,"locale",!0);this.desc=e.desc||"";this.name="isoname";this.calendarSymbols=null;this.currencySymbols=null;this.datePatterns=null;this.dateTimeSymbols=null;this.numberPatterns=null;this.numberSymbols=null;this.timePatterns=null;this.typeFaces=null}}class locale_set_LocaleSet extends XFAObject{constructor(e){super(Zn,"localeSet",!0);this.locale=new XFAObjectArray}}class Meridiem extends StringObject{constructor(e){super(Zn,"meridiem")}}class MeridiemNames extends XFAObject{constructor(e){super(Zn,"meridiemNames",!0);this.meridiem=new XFAObjectArray(2)}}class Month extends StringObject{constructor(e){super(Zn,"month")}}class MonthNames extends XFAObject{constructor(e){super(Zn,"monthNames",!0);this.abbr=getInteger({data:e.abbr,defaultValue:0,validate:e=>1===e});this.month=new XFAObjectArray(12)}}class NumberPattern extends StringObject{constructor(e){super(Zn,"numberPattern");this.name=getStringOption(e.name,["full","long","med","short"])}}class NumberPatterns extends XFAObject{constructor(e){super(Zn,"numberPatterns",!0);this.numberPattern=new XFAObjectArray(4)}}class NumberSymbol extends StringObject{constructor(e){super(Zn,"numberSymbol");this.name=getStringOption(e.name,["decimal","grouping","percent","minus","zero"])}}class NumberSymbols extends XFAObject{constructor(e){super(Zn,"numberSymbols",!0);this.numberSymbol=new XFAObjectArray(5)}}class TimePattern extends StringObject{constructor(e){super(Zn,"timePattern");this.name=getStringOption(e.name,["full","long","med","short"])}}class TimePatterns extends XFAObject{constructor(e){super(Zn,"timePatterns",!0);this.timePattern=new XFAObjectArray(4)}}class TypeFace extends XFAObject{constructor(e){super(Zn,"typeFace",!0);this.name=""|e.name}}class TypeFaces extends XFAObject{constructor(e){super(Zn,"typeFaces",!0);this.typeFace=new XFAObjectArray}}class LocaleSetNamespace{static[cn](e,t){if(LocaleSetNamespace.hasOwnProperty(e))return LocaleSetNamespace[e](t)}static calendarSymbols(e){return new CalendarSymbols(e)}static currencySymbol(e){return new CurrencySymbol(e)}static currencySymbols(e){return new CurrencySymbols(e)}static datePattern(e){return new DatePattern(e)}static datePatterns(e){return new DatePatterns(e)}static dateTimeSymbols(e){return new DateTimeSymbols(e)}static day(e){return new Day(e)}static dayNames(e){return new DayNames(e)}static era(e){return new Era(e)}static eraNames(e){return new EraNames(e)}static locale(e){return new locale_set_Locale(e)}static localeSet(e){return new locale_set_LocaleSet(e)}static meridiem(e){return new Meridiem(e)}static meridiemNames(e){return new MeridiemNames(e)}static month(e){return new Month(e)}static monthNames(e){return new MonthNames(e)}static numberPattern(e){return new NumberPattern(e)}static numberPatterns(e){return new NumberPatterns(e)}static numberSymbol(e){return new NumberSymbol(e)}static numberSymbols(e){return new NumberSymbols(e)}static timePattern(e){return new TimePattern(e)}static timePatterns(e){return new TimePatterns(e)}static typeFace(e){return new TypeFace(e)}static typeFaces(e){return new TypeFaces(e)}}const Vn=Cn.signature.id;class signature_Signature extends XFAObject{constructor(e){super(Vn,"signature",!0)}}class SignatureNamespace{static[cn](e,t){if(SignatureNamespace.hasOwnProperty(e))return SignatureNamespace[e](t)}static signature(e){return new signature_Signature(e)}}const zn=Cn.stylesheet.id;class Stylesheet extends XFAObject{constructor(e){super(zn,"stylesheet",!0)}}class StylesheetNamespace{static[cn](e,t){if(StylesheetNamespace.hasOwnProperty(e))return StylesheetNamespace[e](t)}static stylesheet(e){return new Stylesheet(e)}}const _n=Cn.xdp.id;class xdp_Xdp extends XFAObject{constructor(e){super(_n,"xdp",!0);this.uuid=e.uuid||"";this.timeStamp=e.timeStamp||"";this.config=null;this.connectionSet=null;this.datasets=null;this.localeSet=null;this.stylesheet=new XFAObjectArray;this.template=null}[Pr](e){const t=Cn[e[Tr]];return t&&e[Kr]===t.id}}class XdpNamespace{static[cn](e,t){if(XdpNamespace.hasOwnProperty(e))return XdpNamespace[e](t)}static xdp(e){return new xdp_Xdp(e)}}const $n=Cn.xhtml.id,Ag=Symbol(),eg=new Set(["color","font","font-family","font-size","font-stretch","font-style","font-weight","margin","margin-bottom","margin-left","margin-right","margin-top","letter-spacing","line-height","orphans","page-break-after","page-break-before","page-break-inside","tab-interval","tab-stop","text-align","text-decoration","text-indent","vertical-align","widows","kerning-mode","xfa-font-horizontal-scale","xfa-font-vertical-scale","xfa-spacerun","xfa-tab-stops"]),tg=new Map([["page-break-after","breakAfter"],["page-break-before","breakBefore"],["page-break-inside","breakInside"],["kerning-mode",e=>"none"===e?"none":"normal"],["xfa-font-horizontal-scale",e=>`scaleX(${Math.max(0,Math.min(parseInt(e)/100)).toFixed(2)})`],["xfa-font-vertical-scale",e=>`scaleY(${Math.max(0,Math.min(parseInt(e)/100)).toFixed(2)})`],["xfa-spacerun",""],["xfa-tab-stops",""],["font-size",(e,t)=>measureToString(.99*(e=t.fontSize=getMeasurement(e)))],["letter-spacing",e=>measureToString(getMeasurement(e))],["line-height",e=>measureToString(getMeasurement(e))],["margin",e=>measureToString(getMeasurement(e))],["margin-bottom",e=>measureToString(getMeasurement(e))],["margin-left",e=>measureToString(getMeasurement(e))],["margin-right",e=>measureToString(getMeasurement(e))],["margin-top",e=>measureToString(getMeasurement(e))],["text-indent",e=>measureToString(getMeasurement(e))],["font-family",e=>e],["vertical-align",e=>measureToString(getMeasurement(e))]]),ig=/\s+/g,ag=/[\r\n]+/g,sg=/\r\n?/g;function mapStyle(e,t,i){const a=Object.create(null);if(!e)return a;const s=Object.create(null);for(const[t,i]of e.split(";").map((e=>e.split(":",2)))){const e=tg.get(t);if(""===e)continue;let r=i;e&&(r="string"==typeof e?e:e(i,s));t.endsWith("scale")?a.transform=a.transform?`${a[t]} ${r}`:r:a[t.replaceAll(/-([a-zA-Z])/g,((e,t)=>t.toUpperCase()))]=r}a.fontFamily&&setFontFamily({typeface:a.fontFamily,weight:a.fontWeight||"normal",posture:a.fontStyle||"normal",size:s.fontSize||0},t,t[br].fontFinder,a);if(i&&a.verticalAlign&&"0px"!==a.verticalAlign&&a.fontSize){const e=.583,t=.333,i=getMeasurement(a.fontSize);a.fontSize=measureToString(i*e);a.verticalAlign=measureToString(Math.sign(getMeasurement(a.verticalAlign))*i*t)}i&&a.fontSize&&(a.fontSize=`calc(${a.fontSize} * var(--scale-factor))`);fixTextIndent(a);return a}const rg=new Set(["body","html"]);class XhtmlObject extends XmlObject{constructor(e,t){super($n,t);this[Ag]=!1;this.style=e.style||""}[$s](e){super[$s](e);this.style=function checkStyle(e){return e.style?e.style.trim().split(/\s*;\s*/).filter((e=>!!e)).map((e=>e.split(/\s*:\s*/,2))).filter((([t,i])=>{"font-family"===t&&e[br].usedTypefaces.add(i);return eg.has(t)})).map((e=>e.join(":"))).join(";"):""}(this)}[Zs](){return!rg.has(this[Tr])}[Wr](e,t=!1){if(t)this[Ag]=!0;else{e=e.replaceAll(ag,"");this.style.includes("xfa-spacerun:yes")||(e=e.replaceAll(ig," "))}e&&(this[ar]+=e)}[jr](e,t=!0){const i=Object.create(null),a={top:NaN,bottom:NaN,left:NaN,right:NaN};let s=null;for(const[e,t]of this.style.split(";").map((e=>e.split(":",2))))switch(e){case"font-family":i.typeface=stripQuotes(t);break;case"font-size":i.size=getMeasurement(t);break;case"font-weight":i.weight=t;break;case"font-style":i.posture=t;break;case"letter-spacing":i.letterSpacing=getMeasurement(t);break;case"margin":const e=t.split(/ \t/).map((e=>getMeasurement(e)));switch(e.length){case 1:a.top=a.bottom=a.left=a.right=e[0];break;case 2:a.top=a.bottom=e[0];a.left=a.right=e[1];break;case 3:a.top=e[0];a.bottom=e[2];a.left=a.right=e[1];break;case 4:a.top=e[0];a.left=e[1];a.bottom=e[2];a.right=e[3]}break;case"margin-top":a.top=getMeasurement(t);break;case"margin-bottom":a.bottom=getMeasurement(t);break;case"margin-left":a.left=getMeasurement(t);break;case"margin-right":a.right=getMeasurement(t);break;case"line-height":s=getMeasurement(t)}e.pushData(i,a,s);if(this[ar])e.addString(this[ar]);else for(const t of this[fr]())"#text"!==t[Tr]?t[jr](e):e.addString(t[ar]);t&&e.popFont()}[nn](e){const t=[];this[nr]={children:t};this[_s]({});if(0===t.length&&!this[ar])return HTMLResult.EMPTY;let i;i=this[Ag]?this[ar]?this[ar].replaceAll(sg,"\n"):void 0:this[ar]||void 0;return HTMLResult.success({name:this[Tr],attributes:{href:this.href,style:mapStyle(this.style,this,this[Ag])},children:t,value:i})}}class A extends XhtmlObject{constructor(e){super(e,"a");this.href=fixURL(e.href)||""}}class B extends XhtmlObject{constructor(e){super(e,"b")}[jr](e){e.pushFont({weight:"bold"});super[jr](e);e.popFont()}}class Body extends XhtmlObject{constructor(e){super(e,"body")}[nn](e){const t=super[nn](e),{html:i}=t;if(!i)return HTMLResult.EMPTY;i.name="div";i.attributes.class=["xfaRich"];return t}}class Br extends XhtmlObject{constructor(e){super(e,"br")}[sn](){return"\n"}[jr](e){e.addString("\n")}[nn](e){return HTMLResult.success({name:"br"})}}class Html extends XhtmlObject{constructor(e){super(e,"html")}[nn](e){const t=[];this[nr]={children:t};this[_s]({});if(0===t.length)return HTMLResult.success({name:"div",attributes:{class:["xfaRich"],style:{}},value:this[ar]||""});if(1===t.length){const e=t[0];if(e.attributes?.class.includes("xfaRich"))return HTMLResult.success(e)}return HTMLResult.success({name:"div",attributes:{class:["xfaRich"],style:{}},children:t})}}class I extends XhtmlObject{constructor(e){super(e,"i")}[jr](e){e.pushFont({posture:"italic"});super[jr](e);e.popFont()}}class Li extends XhtmlObject{constructor(e){super(e,"li")}}class Ol extends XhtmlObject{constructor(e){super(e,"ol")}}class P extends XhtmlObject{constructor(e){super(e,"p")}[jr](e){super[jr](e,!1);e.addString("\n");e.addPara();e.popFont()}[sn](){return this[wr]()[fr]().at(-1)===this?super[sn]():super[sn]()+"\n"}}class Span extends XhtmlObject{constructor(e){super(e,"span")}}class Sub extends XhtmlObject{constructor(e){super(e,"sub")}}class Sup extends XhtmlObject{constructor(e){super(e,"sup")}}class Ul extends XhtmlObject{constructor(e){super(e,"ul")}}class XhtmlNamespace{static[cn](e,t){if(XhtmlNamespace.hasOwnProperty(e))return XhtmlNamespace[e](t)}static a(e){return new A(e)}static b(e){return new B(e)}static body(e){return new Body(e)}static br(e){return new Br(e)}static html(e){return new Html(e)}static i(e){return new I(e)}static li(e){return new Li(e)}static ol(e){return new Ol(e)}static p(e){return new P(e)}static span(e){return new Span(e)}static sub(e){return new Sub(e)}static sup(e){return new Sup(e)}static ul(e){return new Ul(e)}}const ng={config:ConfigNamespace,connection:ConnectionSetNamespace,datasets:DatasetsNamespace,localeSet:LocaleSetNamespace,signature:SignatureNamespace,stylesheet:StylesheetNamespace,template:TemplateNamespace,xdp:XdpNamespace,xhtml:XhtmlNamespace};class UnknownNamespace{constructor(e){this.namespaceId=e}[cn](e,t){return new XmlObject(this.namespaceId,e,t)}}class Root extends XFAObject{constructor(e){super(-1,"root",Object.create(null));this.element=null;this[Sr]=e}[Or](e){this.element=e;return!0}[gr](){super[gr]();if(this.element.template instanceof Template){this[Sr].set(zr,this.element);this.element.template[_r](this[Sr]);this.element.template[Sr]=this[Sr]}}}class Empty extends XFAObject{constructor(){super(-1,"",Object.create(null))}[Or](e){return!1}}class Builder{constructor(e=null){this._namespaceStack=[];this._nsAgnosticLevel=0;this._namespacePrefixes=new Map;this._namespaces=new Map;this._nextNsId=Math.max(...Object.values(Cn).map((({id:e})=>e)));this._currentNamespace=e||new UnknownNamespace(++this._nextNsId)}buildRoot(e){return new Root(e)}build({nsPrefix:e,name:t,attributes:i,namespace:a,prefixes:s}){const r=null!==a;if(r){this._namespaceStack.push(this._currentNamespace);this._currentNamespace=this._searchNamespace(a)}s&&this._addNamespacePrefix(s);if(i.hasOwnProperty(qr)){const e=ng.datasets,t=i[qr];let a=null;for(const[i,s]of Object.entries(t)){if(this._getNamespaceToUse(i)===e){a={xfa:s};break}}a?i[qr]=a:delete i[qr]}const n=this._getNamespaceToUse(e),g=n?.[cn](t,i)||new Empty;g[Mr]()&&this._nsAgnosticLevel++;(r||s||g[Mr]())&&(g[er]={hasNamespace:r,prefixes:s,nsAgnostic:g[Mr]()});return g}isNsAgnostic(){return this._nsAgnosticLevel>0}_searchNamespace(e){let t=this._namespaces.get(e);if(t)return t;for(const[i,{check:a}]of Object.entries(Cn))if(a(e)){t=ng[i];if(t){this._namespaces.set(e,t);return t}break}t=new UnknownNamespace(++this._nextNsId);this._namespaces.set(e,t);return t}_addNamespacePrefix(e){for(const{prefix:t,value:i}of e){const e=this._searchNamespace(i);let a=this._namespacePrefixes.get(t);if(!a){a=[];this._namespacePrefixes.set(t,a)}a.push(e)}}_getNamespaceToUse(e){if(!e)return this._currentNamespace;const t=this._namespacePrefixes.get(e);if(t?.length>0)return t.at(-1);warn(`Unknown namespace prefix: ${e}.`);return null}clean(e){const{hasNamespace:t,prefixes:i,nsAgnostic:a}=e;t&&(this._currentNamespace=this._namespaceStack.pop());i&&i.forEach((({prefix:e})=>{this._namespacePrefixes.get(e).pop()}));a&&this._nsAgnosticLevel--}}class XFAParser extends XMLParserBase{constructor(e=null,t=!1){super();this._builder=new Builder(e);this._stack=[];this._globalData={usedTypefaces:new Set};this._ids=new Map;this._current=this._builder.buildRoot(this._ids);this._errorCode=xs;this._whiteRegex=/^\s+$/;this._nbsps=/\xa0+/g;this._richText=t}parse(e){this.parseXml(e);if(this._errorCode===xs){this._current[gr]();return this._current.element}}onText(e){e=e.replace(this._nbsps,(e=>e.slice(1)+" "));this._richText||this._current[Zs]()?this._current[Wr](e,this._richText):this._whiteRegex.test(e)||this._current[Wr](e.trim())}onCdata(e){this._current[Wr](e)}_mkAttributes(e,t){let i=null,a=null;const s=Object.create({});for(const{name:r,value:n}of e)if("xmlns"===r)i?warn(`XFA - multiple namespace definition in <${t}>`):i=n;else if(r.startsWith("xmlns:")){const e=r.substring(6);a||(a=[]);a.push({prefix:e,value:n})}else{const e=r.indexOf(":");if(-1===e)s[r]=n;else{let t=s[qr];t||(t=s[qr]=Object.create(null));const[i,a]=[r.slice(0,e),r.slice(e+1)];(t[i]||=Object.create(null))[a]=n}}return[i,a,s]}_getNameAndPrefix(e,t){const i=e.indexOf(":");return-1===i?[e,null]:[e.substring(i+1),t?"":e.substring(0,i)]}onBeginElement(e,t,i){const[a,s,r]=this._mkAttributes(t,e),[n,g]=this._getNameAndPrefix(e,this._builder.isNsAgnostic()),o=this._builder.build({nsPrefix:g,name:n,attributes:r,namespace:a,prefixes:s});o[br]=this._globalData;if(i){o[gr]();this._current[Or](o)&&o[An](this._ids);o[$s](this._builder)}else{this._stack.push(this._current);this._current=o}}onEndElement(e){const t=this._current;if(t[Nr]()&&"string"==typeof t[ar]){const e=new XFAParser;e._globalData=this._globalData;const i=e.parse(t[ar]);t[ar]=null;t[Or](i)}t[gr]();this._current=this._stack.pop();this._current[Or](t)&&t[An](this._ids);t[$s](this._builder)}onError(e){this._errorCode=e}}class XFAFactory{constructor(e){try{this.root=(new XFAParser).parse(XFAFactory._createDocument(e));const t=new Binder(this.root);this.form=t.bind();this.dataHandler=new DataHandler(this.root,t.getData());this.form[br].template=this.form}catch(e){warn(`XFA - an error occurred during parsing and binding: ${e}`)}}isValid(){return this.root&&this.form}_createPagesHelper(){const e=this.form[rn]();return new Promise(((t,i)=>{const nextIteration=()=>{try{const i=e.next();i.done?t(i.value):setTimeout(nextIteration,0)}catch(e){i(e)}};setTimeout(nextIteration,0)}))}async _createPages(){try{this.pages=await this._createPagesHelper();this.dims=this.pages.children.map((e=>{const{width:t,height:i}=e.attributes.style;return[0,0,parseInt(t),parseInt(i)]}))}catch(e){warn(`XFA - an error occurred during layout: ${e}`)}}getBoundingBox(e){return this.dims[e]}async getNumPages(){this.pages||await this._createPages();return this.dims.length}setImages(e){this.form[br].images=e}setFonts(e){this.form[br].fontFinder=new FontFinder(e);const t=[];for(let e of this.form[br].usedTypefaces){e=stripQuotes(e);this.form[br].fontFinder.find(e)||t.push(e)}return t.length>0?t:null}appendFonts(e,t){this.form[br].fontFinder.add(e,t)}async getPages(){this.pages||await this._createPages();const e=this.pages;this.pages=null;return e}serializeData(e){return this.dataHandler.serialize(e)}static _createDocument(e){return e["/xdp:xdp"]?Object.values(e).join(""):e["xdp:xdp"]}static getRichTextAsHtml(e){if(!e||"string"!=typeof e)return null;try{let t=new XFAParser(XhtmlNamespace,!0).parse(e);if(!["body","xhtml"].includes(t[Tr])){const e=XhtmlNamespace.body({});e[zs](t);t=e}const i=t[nn]();if(!i.success)return null;const{html:a}=i,{attributes:s}=a;if(s){s.class&&(s.class=s.class.filter((e=>!e.startsWith("xfa"))));s.dir="auto"}return{html:a,str:t[sn]()}}catch(e){warn(`XFA - an error occurred during parsing of rich text: ${e}`)}return null}}class AnnotationFactory{static createGlobals(e){return Promise.all([e.ensureCatalog("acroForm"),e.ensureDoc("xfaDatasets"),e.ensureCatalog("structTreeRoot"),e.ensureCatalog("baseUrl"),e.ensureCatalog("attachments")]).then((([t,i,a,s,r])=>({pdfManager:e,acroForm:t instanceof Dict?t:Dict.empty,xfaDatasets:i,structTreeRoot:a,baseUrl:s,attachments:r})),(e=>{warn(`createGlobals: "${e}".`);return null}))}static async create(e,t,i,a,s,r,n){const g=s?await this._getPageIndex(e,t,i.pdfManager):null;return i.pdfManager.ensure(this,"_create",[e,t,i,a,s,r,g,n])}static _create(e,t,i,a,s=!1,r=null,n=null,g=null){const o=e.fetchIfRef(t);if(!(o instanceof Dict))return;const{acroForm:c,pdfManager:C}=i,h=t instanceof Ref?t.toString():`annot_${a.createObjId()}`;let l=o.get("Subtype");l=l instanceof Name?l.name:null;const Q={xref:e,ref:t,dict:o,subtype:l,id:h,annotationGlobals:i,collectFields:s,orphanFields:r,needAppearances:!s&&!0===c.get("NeedAppearances"),pageIndex:n,evaluatorOptions:C.evaluatorOptions,pageRef:g};switch(l){case"Link":return new LinkAnnotation(Q);case"Text":return new TextAnnotation(Q);case"Widget":let e=getInheritableProperty({dict:o,key:"FT"});e=e instanceof Name?e.name:null;switch(e){case"Tx":return new TextWidgetAnnotation(Q);case"Btn":return new ButtonWidgetAnnotation(Q);case"Ch":return new ChoiceWidgetAnnotation(Q);case"Sig":return new SignatureWidgetAnnotation(Q)}warn(`Unimplemented widget field type "${e}", falling back to base field type.`);return new WidgetAnnotation(Q);case"Popup":return new PopupAnnotation(Q);case"FreeText":return new FreeTextAnnotation(Q);case"Line":return new LineAnnotation(Q);case"Square":return new SquareAnnotation(Q);case"Circle":return new CircleAnnotation(Q);case"PolyLine":return new PolylineAnnotation(Q);case"Polygon":return new PolygonAnnotation(Q);case"Caret":return new CaretAnnotation(Q);case"Ink":return new InkAnnotation(Q);case"Highlight":return new HighlightAnnotation(Q);case"Underline":return new UnderlineAnnotation(Q);case"Squiggly":return new SquigglyAnnotation(Q);case"StrikeOut":return new StrikeOutAnnotation(Q);case"Stamp":return new StampAnnotation(Q);case"FileAttachment":return new FileAttachmentAnnotation(Q);default:s||warn(l?`Unimplemented annotation type "${l}", falling back to base annotation.`:"Annotation is missing the required /Subtype.");return new Annotation(Q)}}static async _getPageIndex(e,t,i){try{const a=await e.fetchIfRefAsync(t);if(!(a instanceof Dict))return-1;const s=a.getRaw("P");if(s instanceof Ref)try{return await i.ensureCatalog("getPageIndex",[s])}catch(e){info(`_getPageIndex -- not a valid page reference: "${e}".`)}if(a.has("Kids"))return-1;const r=await i.ensureDoc("numPages");for(let e=0;ee/255))}function getQuadPoints(e,t){const i=e.getArray("QuadPoints");if(!isNumberArray(i,null)||0===i.length||i.length%8>0)return null;const a=new Float32Array(i.length);for(let e=0,s=i.length;et[2]||Et[3]))return null;a.set([l,u,Q,u,l,E,Q,E],e)}return a}function getTransformMatrix(e,t,i){const[a,s,r,n]=Util.getAxialAlignedBoundingBox(t,i);if(a===r||s===n)return[1,0,0,1,e[0],e[1]];const g=(e[2]-e[0])/(r-a),o=(e[3]-e[1])/(n-s);return[g,0,0,o,e[0]-a*g,e[1]-s*o]}class Annotation{constructor(e){const{dict:t,xref:i,annotationGlobals:a,ref:s,orphanFields:r}=e,n=r?.get(s);n&&t.set("Parent",n);this.setTitle(t.get("T"));this.setContents(t.get("Contents"));this.setModificationDate(t.get("M"));this.setFlags(t.get("F"));this.setRectangle(t.getArray("Rect"));this.setColor(t.getArray("C"));this.setBorderStyle(t);this.setAppearance(t);this.setOptionalContent(t);const g=t.get("MK");this.setBorderAndBackgroundColors(g);this.setRotation(g,t);this.ref=e.ref instanceof Ref?e.ref:null;this._streams=[];this.appearance&&this._streams.push(this.appearance);const o=!!(this.flags&eA),c=!!(this.flags&tA);this.data={annotationFlags:this.flags,borderStyle:this.borderStyle,color:this.color,backgroundColor:this.backgroundColor,borderColor:this.borderColor,rotation:this.rotation,contentsObj:this._contents,hasAppearance:!!this.appearance,id:e.id,modificationDate:this.modificationDate,rect:this.rectangle,subtype:e.subtype,hasOwnCanvas:!1,noRotate:!!(this.flags&$),noHTML:o&&c,isEditable:!1,structParent:-1};if(a.structTreeRoot){let i=t.get("StructParent");this.data.structParent=i=Number.isInteger(i)&&i>=0?i:-1;a.structTreeRoot.addAnnotationIdToPage(e.pageRef,i)}if(e.collectFields){const a=t.get("Kids");if(Array.isArray(a)){const e=[];for(const t of a)t instanceof Ref&&e.push(t.toString());0!==e.length&&(this.data.kidIds=e)}this.data.actions=collectActions(i,t,dA);this.data.fieldName=this._constructFieldName(t);this.data.pageIndex=e.pageIndex}const C=t.get("IT");C instanceof Name&&(this.data.it=C.name);this._isOffscreenCanvasSupported=e.evaluatorOptions.isOffscreenCanvasSupported;this._fallbackFontDict=null;this._needAppearances=!1}_hasFlag(e,t){return!!(e&t)}_buildFlags(e,t){let{flags:i}=this;if(void 0===e){if(void 0===t)return;return t?i&~_:i&~z|_}if(e){i|=_;return t?i&~AA|z:i&~z|AA}i&=~(z|AA);return t?i&~_:i|_}_isViewable(e){return!this._hasFlag(e,V)&&!this._hasFlag(e,AA)}_isPrintable(e){return this._hasFlag(e,_)&&!this._hasFlag(e,z)&&!this._hasFlag(e,V)}mustBeViewed(e,t){const i=e?.get(this.data.id)?.noView;return void 0!==i?!i:this.viewable&&!this._hasFlag(this.flags,z)}mustBePrinted(e){const t=e?.get(this.data.id)?.noPrint;return void 0!==t?!t:this.printable}mustBeViewedWhenEditing(e,t=null){return e?!this.data.isEditable:!t?.has(this.data.id)}get viewable(){return null!==this.data.quadPoints&&(0===this.flags||this._isViewable(this.flags))}get printable(){return null!==this.data.quadPoints&&(0!==this.flags&&this._isPrintable(this.flags))}_parseStringHelper(e){const t="string"==typeof e?stringToPDFString(e):"";return{str:t,dir:t&&"rtl"===bidi(t).dir?"rtl":"ltr"}}setDefaultAppearance(e){const{dict:t,annotationGlobals:i}=e,a=getInheritableProperty({dict:t,key:"DA"})||i.acroForm.get("DA");this._defaultAppearance="string"==typeof a?a:"";this.data.defaultAppearanceData=parseDefaultAppearance(this._defaultAppearance)}setTitle(e){this._title=this._parseStringHelper(e)}setContents(e){this._contents=this._parseStringHelper(e)}setModificationDate(e){this.modificationDate="string"==typeof e?e:null}setFlags(e){this.flags=Number.isInteger(e)&&e>0?e:0;this.flags&V&&"Annotation"!==this.constructor.name&&(this.flags^=V)}hasFlag(e){return this._hasFlag(this.flags,e)}setRectangle(e){this.rectangle=lookupNormalRect(e,[0,0,0,0])}setColor(e){this.color=getRgbColor(e)}setLineEndings(e){this.lineEndings=["None","None"];if(Array.isArray(e)&&2===e.length)for(let t=0;t<2;t++){const i=e[t];if(i instanceof Name)switch(i.name){case"None":continue;case"Square":case"Circle":case"Diamond":case"OpenArrow":case"ClosedArrow":case"Butt":case"ROpenArrow":case"RClosedArrow":case"Slash":this.lineEndings[t]=i.name;continue}warn(`Ignoring invalid lineEnding: ${i}`)}}setRotation(e,t){this.rotation=0;let i=e instanceof Dict?e.get("R")||0:t.get("Rotate")||0;if(Number.isInteger(i)&&0!==i){i%=360;i<0&&(i+=360);i%90==0&&(this.rotation=i)}}setBorderAndBackgroundColors(e){if(e instanceof Dict){this.borderColor=getRgbColor(e.getArray("BC"),null);this.backgroundColor=getRgbColor(e.getArray("BG"),null)}else this.borderColor=this.backgroundColor=null}setBorderStyle(e){this.borderStyle=new AnnotationBorderStyle;if(e instanceof Dict)if(e.has("BS")){const t=e.get("BS");if(t instanceof Dict){const e=t.get("Type");if(!e||isName(e,"Border")){this.borderStyle.setWidth(t.get("W"),this.rectangle);this.borderStyle.setStyle(t.get("S"));this.borderStyle.setDashArray(t.getArray("D"))}}}else if(e.has("Border")){const t=e.getArray("Border");if(Array.isArray(t)&&t.length>=3){this.borderStyle.setHorizontalCornerRadius(t[0]);this.borderStyle.setVerticalCornerRadius(t[1]);this.borderStyle.setWidth(t[2],this.rectangle);4===t.length&&this.borderStyle.setDashArray(t[3],!0)}}else this.borderStyle.setWidth(0)}setAppearance(e){this.appearance=null;const t=e.get("AP");if(!(t instanceof Dict))return;const i=t.get("N");if(i instanceof BaseStream){this.appearance=i;return}if(!(i instanceof Dict))return;const a=e.get("AS");if(!(a instanceof Name&&i.has(a.name)))return;const s=i.get(a.name);s instanceof BaseStream&&(this.appearance=s)}setOptionalContent(e){this.oc=null;const t=e.get("OC");t instanceof Name?warn("setOptionalContent: Support for /Name-entry is not implemented."):t instanceof Dict&&(this.oc=t)}loadResources(e,t){return t.dict.getAsync("Resources").then((t=>{if(!t)return;return new ObjectLoader(t,e,t.xref).load().then((function(){return t}))}))}async getOperatorList(e,t,a,s){const{hasOwnCanvas:r,id:n,rect:g}=this.data;let c=this.appearance;const C=!!(r&&a&o);if(C&&(g[0]===g[2]||g[1]===g[3])){this.data.hasOwnCanvas=!1;return{opList:new OperatorList,separateForm:!1,separateCanvas:!1}}if(!c){if(!C)return{opList:new OperatorList,separateForm:!1,separateCanvas:!1};c=new StringStream("");c.dict=new Dict}const h=c.dict,l=await this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"],c),Q=lookupRect(h.getArray("BBox"),[0,0,1,1]),E=lookupMatrix(h.getArray("Matrix"),i),u=getTransformMatrix(g,Q,E),d=new OperatorList;let f;this.oc&&(f=await e.parseMarkedContentProps(this.oc,null));void 0!==f&&d.addOp(Je,["OC",f]);d.addOp(We,[n,g,u,E,C]);await e.getOperatorList({stream:c,task:t,resources:l,operatorList:d,fallbackFontDict:this._fallbackFontDict});d.addOp(je,[]);void 0!==f&&d.addOp(Ye,[]);this.reset();return{opList:d,separateForm:!1,separateCanvas:C}}async save(e,t,i){return null}get hasTextContent(){return!1}async extractTextContent(e,t,i){if(!this.appearance)return;const a=await this.loadResources(["ExtGState","Font","Properties","XObject"],this.appearance),s=[],r=[];let n=null;const g={desiredSize:Math.Infinity,ready:!0,enqueue(e,t){for(const t of e.items)if(void 0!==t.str){n||=t.transform.slice(-2);r.push(t.str);if(t.hasEOL){s.push(r.join("").trimEnd());r.length=0}}}};await e.getTextContent({stream:this.appearance,task:t,resources:a,includeMarkedContent:!0,keepWhiteSpace:!0,sink:g,viewBox:i});this.reset();r.length&&s.push(r.join("").trimEnd());if(s.length>1||s[0]){const e=this.appearance.dict,t=lookupRect(e.getArray("BBox"),null),i=lookupMatrix(e.getArray("Matrix"),null);this.data.textPosition=this._transformPoint(n,t,i);this.data.textContent=s}}_transformPoint(e,t,i){const{rect:a}=this.data;t||=[0,0,1,1];i||=[1,0,0,1,0,0];const s=getTransformMatrix(a,t,i);s[4]-=a[0];s[5]-=a[1];e=Util.applyTransform(e,s);return Util.applyTransform(e,i)}getFieldObject(){return this.data.kidIds?{id:this.data.id,actions:this.data.actions,name:this.data.fieldName,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,type:"",kidIds:this.data.kidIds,page:this.data.pageIndex,rotation:this.rotation}:null}reset(){for(const e of this._streams)e.reset()}_constructFieldName(e){if(!e.has("T")&&!e.has("Parent")){warn("Unknown field name, falling back to empty field name.");return""}if(!e.has("Parent"))return stringToPDFString(e.get("T"));const t=[];e.has("T")&&t.unshift(stringToPDFString(e.get("T")));let i=e;const a=new RefSet;e.objId&&a.put(e.objId);for(;i.has("Parent");){i=i.get("Parent");if(!(i instanceof Dict)||i.objId&&a.has(i.objId))break;i.objId&&a.put(i.objId);i.has("T")&&t.unshift(stringToPDFString(i.get("T")))}return t.join(".")}}class AnnotationBorderStyle{constructor(){this.width=1;this.rawWidth=1;this.style=lA;this.dashArray=[3];this.horizontalCornerRadius=0;this.verticalCornerRadius=0}setWidth(e,t=[0,0,0,0]){if(e instanceof Name)this.width=0;else if("number"==typeof e){if(e>0){this.rawWidth=e;const i=(t[2]-t[0])/2,a=(t[3]-t[1])/2;if(i>0&&a>0&&(e>i||e>a)){warn(`AnnotationBorderStyle.setWidth - ignoring width: ${e}`);e=1}}this.width=e}}setStyle(e){if(e instanceof Name)switch(e.name){case"S":this.style=lA;break;case"D":this.style=BA;break;case"B":this.style=QA;break;case"I":this.style=EA;break;case"U":this.style=uA}}setDashArray(e,t=!1){if(Array.isArray(e)){let i=!0,a=!0;for(const t of e){if(!(+t>=0)){i=!1;break}t>0&&(a=!1)}if(0===e.length||i&&!a){this.dashArray=e;t&&this.setStyle(Name.get("D"))}else this.width=0}else e&&(this.width=0)}setHorizontalCornerRadius(e){Number.isInteger(e)&&(this.horizontalCornerRadius=e)}setVerticalCornerRadius(e){Number.isInteger(e)&&(this.verticalCornerRadius=e)}}class MarkupAnnotation extends Annotation{constructor(e){super(e);const{dict:t}=e;if(t.has("IRT")){const e=t.getRaw("IRT");this.data.inReplyTo=e instanceof Ref?e.toString():null;const i=t.get("RT");this.data.replyType=i instanceof Name?i.name:Z}let i=null;if(this.data.replyType===X){const e=t.get("IRT");this.setTitle(e.get("T"));this.data.titleObj=this._title;this.setContents(e.get("Contents"));this.data.contentsObj=this._contents;if(e.has("CreationDate")){this.setCreationDate(e.get("CreationDate"));this.data.creationDate=this.creationDate}else this.data.creationDate=null;if(e.has("M")){this.setModificationDate(e.get("M"));this.data.modificationDate=this.modificationDate}else this.data.modificationDate=null;i=e.getRaw("Popup");if(e.has("C")){this.setColor(e.getArray("C"));this.data.color=this.color}else this.data.color=null}else{this.data.titleObj=this._title;this.setCreationDate(t.get("CreationDate"));this.data.creationDate=this.creationDate;i=t.getRaw("Popup");t.has("C")||(this.data.color=null)}this.data.popupRef=i instanceof Ref?i.toString():null;t.has("RC")&&(this.data.richText=XFAFactory.getRichTextAsHtml(t.get("RC")))}setCreationDate(e){this.creationDate="string"==typeof e?e:null}_setDefaultAppearance({xref:e,extra:t,strokeColor:i,fillColor:a,blendMode:s,strokeAlpha:r,fillAlpha:n,pointsCallback:g}){let o=Number.MAX_VALUE,c=Number.MAX_VALUE,C=Number.MIN_VALUE,h=Number.MIN_VALUE;const l=["q"];t&&l.push(t);i&&l.push(`${i[0]} ${i[1]} ${i[2]} RG`);a&&l.push(`${a[0]} ${a[1]} ${a[2]} rg`);let Q=this.data.quadPoints;Q||(Q=Float32Array.from([this.rectangle[0],this.rectangle[3],this.rectangle[2],this.rectangle[3],this.rectangle[0],this.rectangle[1],this.rectangle[2],this.rectangle[1]]));for(let e=0,t=Q.length;e"string"==typeof e)).map((e=>stringToPDFString(e))):e instanceof Name?stringToPDFString(e.name):"string"==typeof e?stringToPDFString(e):null}hasFieldFlag(e){return!!(this.data.fieldFlags&e)}_isViewable(e){return!0}mustBeViewed(e,t){return t?this.viewable:super.mustBeViewed(e,t)&&!this._hasFlag(this.flags,AA)}getRotationMatrix(e){let t=e?.get(this.data.id)?.rotation;void 0===t&&(t=this.rotation);if(0===t)return i;return getRotationMatrix(t,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1])}getBorderAndBackgroundAppearances(e){let t=e?.get(this.data.id)?.rotation;void 0===t&&(t=this.rotation);if(!this.backgroundColor&&!this.borderColor)return"";const i=this.data.rect[2]-this.data.rect[0],a=this.data.rect[3]-this.data.rect[1],s=0===t||180===t?`0 0 ${i} ${a} re`:`0 0 ${a} ${i} re`;let r="";this.backgroundColor&&(r=`${getPdfColor(this.backgroundColor,!0)} ${s} f `);if(this.borderColor){r+=`${this.borderStyle.width||1} w ${getPdfColor(this.borderColor,!1)} ${s} S `}return r}async getOperatorList(e,t,i,a){if(i&h&&!(this instanceof SignatureWidgetAnnotation)&&!this.data.noHTML&&!this.data.hasOwnCanvas)return{opList:new OperatorList,separateForm:!0,separateCanvas:!1};if(!this._hasText)return super.getOperatorList(e,t,i,a);const s=await this._getAppearance(e,t,i,a);if(this.appearance&&null===s)return super.getOperatorList(e,t,i,a);const r=new OperatorList;if(!this._defaultAppearance||null===s)return{opList:r,separateForm:!1,separateCanvas:!1};const n=!!(this.data.hasOwnCanvas&&i&o),g=[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]],c=getTransformMatrix(this.data.rect,g,[1,0,0,1,0,0]);let C;this.oc&&(C=await e.parseMarkedContentProps(this.oc,null));void 0!==C&&r.addOp(Je,["OC",C]);r.addOp(We,[this.data.id,this.data.rect,c,this.getRotationMatrix(a),n]);const l=new StringStream(s);await e.getOperatorList({stream:l,task:t,resources:this._fieldResources.mergedResources,operatorList:r});r.addOp(je,[]);void 0!==C&&r.addOp(Ye,[]);return{opList:r,separateForm:!1,separateCanvas:n}}_getMKDict(e){const t=new Dict(null);e&&t.set("R",e);this.borderColor&&t.set("BC",getPdfColorArray(this.borderColor));this.backgroundColor&&t.set("BG",getPdfColorArray(this.backgroundColor));return t.size>0?t:null}amendSavedDict(e,t){}async save(e,t,a){const s=a?.get(this.data.id),r=this._buildFlags(s?.noView,s?.noPrint);let n=s?.value,g=s?.rotation;if(n===this.data.fieldValue||void 0===n){if(!this._hasValueFromXFA&&void 0===g&&void 0===r)return null;n||=this.data.fieldValue}if(void 0===g&&!this._hasValueFromXFA&&Array.isArray(n)&&Array.isArray(this.data.fieldValue)&&isArrayEqual(n,this.data.fieldValue)&&void 0===r)return null;void 0===g&&(g=this.rotation);let o=null;if(!this._needAppearances){o=await this._getAppearance(e,t,C,a);if(null===o&&void 0===r)return null}let c=!1;if(o?.needAppearances){c=!0;o=null}const{xref:h}=e,l=h.fetchIfRef(this.ref);if(!(l instanceof Dict))return null;const Q=new Dict(h);for(const e of l.getKeys())"AP"!==e&&Q.set(e,l.getRaw(e));if(void 0!==r){Q.set("F",r);if(null===o&&!c){const e=l.getRaw("AP");e&&Q.set("AP",e)}}const E={path:this.data.fieldName,value:n};Q.set("V",Array.isArray(n)?n.map(stringToAsciiOrUTF16BE):stringToAsciiOrUTF16BE(n));this.amendSavedDict(a,Q);const u=this._getMKDict(g);u&&Q.set("MK",u);const d=[],f=[{ref:this.ref,data:"",xfa:E,needAppearances:c}];if(null!==o){const e=h.getNewTemporaryRef(),t=new Dict(h);Q.set("AP",t);t.set("N",e);const s=this._getSaveFieldResources(h),r=new StringStream(o),n=r.dict=new Dict(h);n.set("Subtype",Name.get("Form"));n.set("Resources",s);n.set("BBox",[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]]);const g=this.getRotationMatrix(a);g!==i&&n.set("Matrix",g);await writeObject(e,r,d,h);f.push({ref:e,data:d.join(""),xfa:null,needAppearances:!1});d.length=0}Q.set("M",`D:${getModificationDate()}`);await writeObject(this.ref,Q,d,h);f[0].data=d.join("");return f}async _getAppearance(e,t,i,a){if(this.hasFieldFlag(rA))return null;const s=a?.get(this.data.id);let r,g;if(s){r=s.formattedValue||s.value;g=s.rotation}if(void 0===g&&void 0===r&&!this._needAppearances&&(!this._hasValueFromXFA||this.appearance))return null;const o=this.getBorderAndBackgroundAppearances(a);if(void 0===r){r=this.data.fieldValue;if(!r)return`/Tx BMC q ${o}Q EMC`}Array.isArray(r)&&1===r.length&&(r=r[0]);assert("string"==typeof r,"Expected `value` to be a string.");r=r.trimEnd();if(this.data.combo){const e=this.data.options.find((({exportValue:e})=>r===e));r=e?.displayValue||r}if(""===r)return`/Tx BMC q ${o}Q EMC`;void 0===g&&(g=this.rotation);let c,h=-1;if(this.data.multiLine){c=r.split(/\r\n?|\n/).map((e=>e.normalize("NFC")));h=c.length}else c=[r.replace(/\r\n?|\n/,"").normalize("NFC")];let l=this.data.rect[3]-this.data.rect[1],Q=this.data.rect[2]-this.data.rect[0];90!==g&&270!==g||([Q,l]=[l,Q]);this._defaultAppearance||(this.data.defaultAppearanceData=parseDefaultAppearance(this._defaultAppearance="/Helvetica 0 Tf 0 g"));let E,u,d,f=await WidgetAnnotation._getFontData(e,t,this.data.defaultAppearanceData,this._fieldResources.mergedResources);const p=[];let m=!1;for(const e of c){const t=f.encodeString(e);t.length>1&&(m=!0);p.push(t.join(""))}if(m&&i&C)return{needAppearances:!0};if(m&&this._isOffscreenCanvasSupported){const i=this.data.comb?"monospace":"sans-serif",a=new FakeUnicodeFont(e.xref,i),s=a.createFontResources(c.join("")),n=s.getRaw("Font");if(this._fieldResources.mergedResources.has("Font")){const e=this._fieldResources.mergedResources.get("Font");for(const t of n.getKeys())e.set(t,n.getRaw(t))}else this._fieldResources.mergedResources.set("Font",n);const g=a.fontName.name;f=await WidgetAnnotation._getFontData(e,t,{fontName:g,fontSize:0},s);for(let e=0,t=p.length;e2)return`/Tx BMC q ${o}BT `+E+` 1 0 0 1 ${numberToString(2)} ${numberToString(b)} Tm (${escapeString(p[0])}) Tj ET Q EMC`;return`/Tx BMC q ${o}BT `+E+` 1 0 0 1 0 0 Tm ${this._renderText(p[0],f,u,Q,D,{shift:0},2,b)} ET Q EMC`}static async _getFontData(e,t,i,a){const s=new OperatorList,r={font:null,clone(){return this}},{fontName:n,fontSize:g}=i;await e.handleSetFont(a,[n&&Name.get(n),g],null,s,t,r,null);return r.font}_getTextWidth(e,t){return t.charsToGlyphs(e).reduce(((e,t)=>e+t.width),0)/1e3}_computeFontSize(e,t,i,a,r){let{fontSize:n}=this.data.defaultAppearanceData,g=(n||12)*s,o=Math.round(e/g);if(!n){const roundWithTwoDigits=e=>Math.floor(100*e)/100;if(-1===r){const r=this._getTextWidth(i,a);n=roundWithTwoDigits(Math.min(e/s,t/r));o=1}else{const c=i.split(/\r\n?|\n/),C=[];for(const e of c){const t=a.encodeString(e).join(""),i=a.charsToGlyphs(t),s=a.getCharPositions(t);C.push({line:t,glyphs:i,positions:s})}const isTooBig=i=>{let s=0;for(const r of C){s+=this._splitLine(null,a,i,t,r).length*i;if(s>e)return!0}return!1};o=Math.max(o,r);for(;;){g=e/o;n=roundWithTwoDigits(g/s);if(!isTooBig(n))break;o++}}const{fontName:c,fontColor:C}=this.data.defaultAppearanceData;this._defaultAppearance=function createDefaultAppearance({fontSize:e,fontName:t,fontColor:i}){return`/${escapePDFName(t)} ${e} Tf ${getPdfColor(i,!0)}`}({fontSize:n,fontName:c,fontColor:C})}return[this._defaultAppearance,n,e/o]}_renderText(e,t,i,a,s,r,n,g){let o;if(1===s){o=(a-this._getTextWidth(e,t)*i)/2}else if(2===s){o=a-this._getTextWidth(e,t)*i-n}else o=n;const c=numberToString(o-r.shift);r.shift=o;return`${c} ${g=numberToString(g)} Td (${escapeString(e)}) Tj`}_getSaveFieldResources(e){const{localResources:t,appearanceResources:i,acroFormResources:a}=this._fieldResources,s=this.data.defaultAppearanceData?.fontName;if(!s)return t||Dict.empty;for(const e of[t,i])if(e instanceof Dict){const t=e.get("Font");if(t instanceof Dict&&t.has(s))return e}if(a instanceof Dict){const i=a.get("Font");if(i instanceof Dict&&i.has(s)){const a=new Dict(e);a.set(s,i.getRaw(s));const r=new Dict(e);r.set("Font",a);return Dict.merge({xref:e,dictArray:[r,t],mergeSubDicts:!0})}}return t||Dict.empty}getFieldObject(){return null}}class TextWidgetAnnotation extends WidgetAnnotation{constructor(e){super(e);const{dict:t}=e;if(t.has("PMD")){this.flags|=z;this.data.hidden=!0;warn("Barcodes are not supported")}this.data.hasOwnCanvas=this.data.readOnly&&!this.data.noHTML;this._hasText=!0;"string"!=typeof this.data.fieldValue&&(this.data.fieldValue="");let i=getInheritableProperty({dict:t,key:"Q"});(!Number.isInteger(i)||i<0||i>2)&&(i=null);this.data.textAlignment=i;let a=getInheritableProperty({dict:t,key:"MaxLen"});(!Number.isInteger(a)||a<0)&&(a=0);this.data.maxLen=a;this.data.multiLine=this.hasFieldFlag(sA);this.data.comb=this.hasFieldFlag(hA)&&!this.hasFieldFlag(sA)&&!this.hasFieldFlag(rA)&&!this.hasFieldFlag(IA)&&0!==this.data.maxLen;this.data.doNotScroll=this.hasFieldFlag(CA)}get hasTextContent(){return!!this.appearance&&!this._needAppearances}_getCombAppearance(e,t,i,a,s,r,n,g,o,c,C){const h=s/this.data.maxLen,l=this.getBorderAndBackgroundAppearances(C),Q=[],E=t.getCharPositions(i);for(const[e,t]of E)Q.push(`(${escapeString(i.substring(e,t))}) Tj`);const u=Q.join(` ${numberToString(h)} 0 Td `);return`/Tx BMC q ${l}BT `+e+` 1 0 0 1 ${numberToString(n)} ${numberToString(g+o)} Tm ${u} ET Q EMC`}_getMultilineAppearance(e,t,i,a,s,r,n,g,o,c,C,h){const l=[],Q=s-2*g,E={shift:0};for(let e=0,r=t.length;ea){o.push(e.substring(l,i));l=i;Q=u;c=-1;h=-1}else{Q+=u;c=i;C=s;h=t}else if(Q+u>a)if(-1!==c){o.push(e.substring(l,C));l=C;t=h+1;c=-1;Q=0}else{o.push(e.substring(l,i));l=i;Q=u}else Q+=u}lt?`\\${t}`:"\\s+"));new RegExp(`^\\s*${r}\\s*$`).test(this.data.fieldValue)&&(this.data.textContent=this.data.fieldValue.split("\n"))}getFieldObject(){return{id:this.data.id,value:this.data.fieldValue,defaultValue:this.data.defaultFieldValue||"",multiline:this.data.multiLine,password:this.hasFieldFlag(rA),charLimit:this.data.maxLen,comb:this.data.comb,editable:!this.data.readOnly,hidden:this.data.hidden,name:this.data.fieldName,rect:this.data.rect,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:"text"}}}class ButtonWidgetAnnotation extends WidgetAnnotation{constructor(e){super(e);this.checkedAppearance=null;this.uncheckedAppearance=null;this.data.checkBox=!this.hasFieldFlag(nA)&&!this.hasFieldFlag(gA);this.data.radioButton=this.hasFieldFlag(nA)&&!this.hasFieldFlag(gA);this.data.pushButton=this.hasFieldFlag(gA);this.data.isTooltipOnly=!1;if(this.data.checkBox)this._processCheckBox(e);else if(this.data.radioButton)this._processRadioButton(e);else if(this.data.pushButton){this.data.hasOwnCanvas=!0;this.data.noHTML=!1;this._processPushButton(e)}else warn("Invalid field flags for button widget annotation")}async getOperatorList(e,t,a,s){if(this.data.pushButton)return super.getOperatorList(e,t,a,!1,s);let r=null,n=null;if(s){const e=s.get(this.data.id);r=e?e.value:null;n=e?e.rotation:null}if(null===r&&this.appearance)return super.getOperatorList(e,t,a,s);null==r&&(r=this.data.checkBox?this.data.fieldValue===this.data.exportValue:this.data.fieldValue===this.data.buttonValue);const g=r?this.checkedAppearance:this.uncheckedAppearance;if(g){const r=this.appearance,o=lookupMatrix(g.dict.getArray("Matrix"),i);n&&g.dict.set("Matrix",this.getRotationMatrix(s));this.appearance=g;const c=super.getOperatorList(e,t,a,s);this.appearance=r;g.dict.set("Matrix",o);return c}return{opList:new OperatorList,separateForm:!1,separateCanvas:!1}}async save(e,t,i){return this.data.checkBox?this._saveCheckbox(e,t,i):this.data.radioButton?this._saveRadioButton(e,t,i):null}async _saveCheckbox(e,t,i){if(!i)return null;const a=i.get(this.data.id),s=this._buildFlags(a?.noView,a?.noPrint);let r=a?.rotation,n=a?.value;if(void 0===r&&void 0===s){if(void 0===n)return null;if(this.data.fieldValue===this.data.exportValue===n)return null}let g=e.xref.fetchIfRef(this.ref);if(!(g instanceof Dict))return null;g=g.clone();void 0===r&&(r=this.rotation);void 0===n&&(n=this.data.fieldValue===this.data.exportValue);const o={path:this.data.fieldName,value:n?this.data.exportValue:""},c=Name.get(n?this.data.exportValue:"Off");g.set("V",c);g.set("AS",c);g.set("M",`D:${getModificationDate()}`);void 0!==s&&g.set("F",s);const C=this._getMKDict(r);C&&g.set("MK",C);const h=[];await writeObject(this.ref,g,h,e.xref);return[{ref:this.ref,data:h.join(""),xfa:o}]}async _saveRadioButton(e,t,i){if(!i)return null;const a=i.get(this.data.id),s=this._buildFlags(a?.noView,a?.noPrint);let r=a?.rotation,n=a?.value;if(void 0===r&&void 0===s){if(void 0===n)return null;if(this.data.fieldValue===this.data.buttonValue===n)return null}let g=e.xref.fetchIfRef(this.ref);if(!(g instanceof Dict))return null;g=g.clone();void 0===n&&(n=this.data.fieldValue===this.data.buttonValue);void 0===r&&(r=this.rotation);const o={path:this.data.fieldName,value:n?this.data.buttonValue:""},c=Name.get(n?this.data.buttonValue:"Off"),C=[];let h=null;if(n)if(this.parent instanceof Ref){const t=e.xref.fetch(this.parent);t.set("V",c);await writeObject(this.parent,t,C,e.xref);h=C.join("");C.length=0}else this.parent instanceof Dict&&this.parent.set("V",c);this.parent||g.set("V",c);g.set("AS",c);g.set("M",`D:${getModificationDate()}`);void 0!==s&&g.set("F",s);const l=this._getMKDict(r);l&&g.set("MK",l);await writeObject(this.ref,g,C,e.xref);const Q=[{ref:this.ref,data:C.join(""),xfa:o}];h&&Q.push({ref:this.parent,data:h,xfa:null});return Q}_getDefaultCheckedAppearance(e,t){const i=this.data.rect[2]-this.data.rect[0],a=this.data.rect[3]-this.data.rect[1],s=[0,0,i,a],r=.8*Math.min(i,a);let n,g;if("check"===t){n={width:.755*r,height:.705*r};g="3"}else if("disc"===t){n={width:.791*r,height:.705*r};g="l"}else unreachable(`_getDefaultCheckedAppearance - unsupported type: ${t}`);const o=`q BT /PdfJsZaDb ${r} Tf 0 g ${numberToString((i-n.width)/2)} ${numberToString((a-n.height)/2)} Td (${g}) Tj ET Q`,c=new Dict(e.xref);c.set("FormType",1);c.set("Subtype",Name.get("Form"));c.set("Type",Name.get("XObject"));c.set("BBox",s);c.set("Matrix",[1,0,0,1,0,0]);c.set("Length",o.length);const C=new Dict(e.xref),h=new Dict(e.xref);h.set("PdfJsZaDb",this.fallbackFontDict);C.set("Font",h);c.set("Resources",C);this.checkedAppearance=new StringStream(o);this.checkedAppearance.dict=c;this._streams.push(this.checkedAppearance)}_processCheckBox(e){const t=e.dict.get("AP");if(!(t instanceof Dict))return;const i=t.get("N");if(!(i instanceof Dict))return;const a=this._decodeFormValue(e.dict.get("AS"));"string"==typeof a&&(this.data.fieldValue=a);const s=null!==this.data.fieldValue&&"Off"!==this.data.fieldValue?this.data.fieldValue:"Yes",r=i.getKeys();if(0===r.length)r.push("Off",s);else if(1===r.length)"Off"===r[0]?r.push(s):r.unshift("Off");else if(r.includes(s)){r.length=0;r.push("Off",s)}else{const e=r.find((e=>"Off"!==e));r.length=0;r.push("Off",e)}r.includes(this.data.fieldValue)||(this.data.fieldValue="Off");this.data.exportValue=r[1];const n=i.get(this.data.exportValue);this.checkedAppearance=n instanceof BaseStream?n:null;const g=i.get("Off");this.uncheckedAppearance=g instanceof BaseStream?g:null;this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(e,"check");this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance);this._fallbackFontDict=this.fallbackFontDict;null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processRadioButton(e){this.data.buttonValue=null;const t=e.dict.get("Parent");if(t instanceof Dict){this.parent=e.dict.getRaw("Parent");const i=t.get("V");i instanceof Name&&(this.data.fieldValue=this._decodeFormValue(i))}const i=e.dict.get("AP");if(!(i instanceof Dict))return;const a=i.get("N");if(!(a instanceof Dict))return;for(const e of a.getKeys())if("Off"!==e){this.data.buttonValue=this._decodeFormValue(e);break}const s=a.get(this.data.buttonValue);this.checkedAppearance=s instanceof BaseStream?s:null;const r=a.get("Off");this.uncheckedAppearance=r instanceof BaseStream?r:null;this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(e,"disc");this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance);this._fallbackFontDict=this.fallbackFontDict;null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processPushButton(e){const{dict:t,annotationGlobals:i}=e;if(t.has("A")||t.has("AA")||this.data.alternativeText){this.data.isTooltipOnly=!t.has("A")&&!t.has("AA");Catalog.parseDestDictionary({destDict:t,resultObj:this.data,docBaseUrl:i.baseUrl,docAttachments:i.attachments})}else warn("Push buttons without action dictionaries are not supported")}getFieldObject(){let e,t="button";if(this.data.checkBox){t="checkbox";e=this.data.exportValue}else if(this.data.radioButton){t="radiobutton";e=this.data.buttonValue}return{id:this.data.id,value:this.data.fieldValue||"Off",defaultValue:this.data.defaultFieldValue,exportValues:e,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,hidden:this.data.hidden,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:t}}get fallbackFontDict(){const e=new Dict;e.set("BaseFont",Name.get("ZapfDingbats"));e.set("Type",Name.get("FallbackType"));e.set("Subtype",Name.get("FallbackType"));e.set("Encoding",Name.get("ZapfDingbatsEncoding"));return shadow(this,"fallbackFontDict",e)}}class ChoiceWidgetAnnotation extends WidgetAnnotation{constructor(e){super(e);const{dict:t,xref:i}=e;this.indices=t.getArray("I");this.hasIndices=Array.isArray(this.indices)&&this.indices.length>0;this.data.options=[];const a=getInheritableProperty({dict:t,key:"Opt"});if(Array.isArray(a))for(let e=0,t=a.length;e=0&&t0?this.data.fieldValue[0]:null;return{id:this.data.id,value:t,defaultValue:this.data.defaultFieldValue,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,numItems:this.data.fieldValue.length,multipleSelection:this.data.multiSelect,hidden:this.data.hidden,actions:this.data.actions,items:this.data.options,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:e}}amendSavedDict(e,t){if(!this.hasIndices)return;let i=e?.get(this.data.id)?.value;Array.isArray(i)||(i=[i]);const a=[],{options:s}=this.data;for(let e=0,t=0,r=s.length;ei){i=a;t=e}}[Q,E]=this._computeFontSize(e,c-4,t,l,-1)}const u=E*s,d=(u-E)/2,f=Math.floor(o/u);let p=0;if(h.length>0){const e=Math.min(...h),t=Math.max(...h);p=Math.max(0,t-f+1);p>e&&(p=e)}const m=Math.min(p+f+1,C),y=["/Tx BMC q",`1 1 ${c} ${o} re W n`];if(h.length){y.push("0.600006 0.756866 0.854904 rg");for(const e of h)p<=e&&ee.trimEnd()));const{coords:e,bbox:t,matrix:i}=FakeUnicodeFont.getFirstPositionInfo(this.rectangle,this.rotation,a);this.data.textPosition=this._transformPoint(e,t,i)}if(this._isOffscreenCanvasSupported){const s=e.dict.get("CA"),r=new FakeUnicodeFont(i,"sans-serif");this.appearance=r.createAppearance(this._contents.str,this.rectangle,this.rotation,a,t,s);this._streams.push(this.appearance)}else warn("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.")}}get hasTextContent(){return this._hasAppearance}static createNewDict(e,t,{apRef:i,ap:a}){const{color:s,fontSize:r,oldAnnotation:n,rect:g,rotation:o,user:c,value:C}=e,h=n||new Dict(t);h.set("Type",Name.get("Annot"));h.set("Subtype",Name.get("FreeText"));if(n){h.set("M",`D:${getModificationDate()}`);h.delete("RC")}else h.set("CreationDate",`D:${getModificationDate()}`);h.set("Rect",g);const l=`/Helv ${r} Tf ${getPdfColor(s,!0)}`;h.set("DA",l);h.set("Contents",stringToAsciiOrUTF16BE(C));h.set("F",4);h.set("Border",[0,0,0]);h.set("Rotate",o);c&&h.set("T",stringToAsciiOrUTF16BE(c));if(i||a){const e=new Dict(t);h.set("AP",e);i?e.set("N",i):e.set("N",a)}return h}static async createNewAppearanceStream(e,t,i){const{baseFontRef:a,evaluator:r,task:n}=i,{color:g,fontSize:o,rect:c,rotation:C,value:h}=e,l=new Dict(t),Q=new Dict(t);if(a)Q.set("Helv",a);else{const e=new Dict(t);e.set("BaseFont",Name.get("Helvetica"));e.set("Type",Name.get("Font"));e.set("Subtype",Name.get("Type1"));e.set("Encoding",Name.get("WinAnsiEncoding"));Q.set("Helv",e)}l.set("Font",Q);const E=await WidgetAnnotation._getFontData(r,n,{fontName:"Helv",fontSize:o},l),[u,d,f,p]=c;let m=f-u,y=p-d;C%180!=0&&([m,y]=[y,m]);const w=h.split("\n"),D=o/1e3;let b=-1/0;const F=[];for(let e of w){const t=E.encodeString(e);if(t.length>1)return null;e=t.join("");F.push(e);let i=0;const a=E.charsToGlyphs(e);for(const e of a)i+=e.width*D;b=Math.max(b,i)}let S=1;b>m&&(S=m/b);let k=1;const R=s*o,N=1*o,G=R*w.length;G>y&&(k=y/G);const x=o*Math.min(S,k);let U,M,L;switch(C){case 0:L=[1,0,0,1];M=[c[0],c[1],m,y];U=[c[0],c[3]-N];break;case 90:L=[0,1,-1,0];M=[c[1],-c[2],m,y];U=[c[1],-c[0]-N];break;case 180:L=[-1,0,0,-1];M=[-c[2],-c[3],m,y];U=[-c[2],-c[1]-N];break;case 270:L=[0,-1,1,0];M=[-c[3],c[0],m,y];U=[-c[3],c[2]-N]}const H=["q",`${L.join(" ")} 0 0 cm`,`${M.join(" ")} re W n`,"BT",`${getPdfColor(g,!0)}`,`0 Tc /Helv ${numberToString(x)} Tf`];H.push(`${U.join(" ")} Td (${escapeString(F[0])}) Tj`);const J=numberToString(R);for(let e=1,t=F.length;e{e.push(`${a[0]} ${a[1]} m`,`${a[2]} ${a[3]} l`,"S");return[t[0]-o,t[2]+o,t[7]-o,t[3]+o]}})}}}class SquareAnnotation extends MarkupAnnotation{constructor(e){super(e);const{dict:t,xref:i}=e;this.data.annotationType=x;this.data.hasOwnCanvas=this.data.noRotate;this.data.noHTML=!1;if(!this.appearance){const e=this.color?getPdfColorArray(this.color):[0,0,0],a=t.get("CA"),s=getRgbColor(t.getArray("IC"),null),r=s?getPdfColorArray(s):null,n=r?a:null;if(0===this.borderStyle.width&&!r)return;this._setDefaultAppearance({xref:i,extra:`${this.borderStyle.width} w`,strokeColor:e,fillColor:r,strokeAlpha:a,fillAlpha:n,pointsCallback:(e,t)=>{const i=t[4]+this.borderStyle.width/2,a=t[5]+this.borderStyle.width/2,s=t[6]-t[4]-this.borderStyle.width,n=t[3]-t[7]-this.borderStyle.width;e.push(`${i} ${a} ${s} ${n} re`);r?e.push("B"):e.push("S");return[t[0],t[2],t[7],t[3]]}})}}}class CircleAnnotation extends MarkupAnnotation{constructor(e){super(e);const{dict:t,xref:i}=e;this.data.annotationType=U;if(!this.appearance){const e=this.color?getPdfColorArray(this.color):[0,0,0],a=t.get("CA"),s=getRgbColor(t.getArray("IC"),null),r=s?getPdfColorArray(s):null,n=r?a:null;if(0===this.borderStyle.width&&!r)return;const g=4/3*Math.tan(Math.PI/8);this._setDefaultAppearance({xref:i,extra:`${this.borderStyle.width} w`,strokeColor:e,fillColor:r,strokeAlpha:a,fillAlpha:n,pointsCallback:(e,t)=>{const i=t[0]+this.borderStyle.width/2,a=t[1]-this.borderStyle.width/2,s=t[6]-this.borderStyle.width/2,n=t[7]+this.borderStyle.width/2,o=i+(s-i)/2,c=a+(n-a)/2,C=(s-i)/2*g,h=(n-a)/2*g;e.push(`${o} ${n} m`,`${o+C} ${n} ${s} ${c+h} ${s} ${c} c`,`${s} ${c-h} ${o+C} ${a} ${o} ${a} c`,`${o-C} ${a} ${i} ${c-h} ${i} ${c} c`,`${i} ${c+h} ${o-C} ${n} ${o} ${n} c`,"h");r?e.push("B"):e.push("S");return[t[0],t[2],t[7],t[3]]}})}}}class PolylineAnnotation extends MarkupAnnotation{constructor(e){super(e);const{dict:t,xref:i}=e;this.data.annotationType=L;this.data.hasOwnCanvas=this.data.noRotate;this.data.noHTML=!1;this.data.vertices=null;if(!(this instanceof PolygonAnnotation)){this.setLineEndings(t.getArray("LE"));this.data.lineEndings=this.lineEndings}const a=t.getArray("Vertices");if(!isNumberArray(a,null))return;const s=this.data.vertices=Float32Array.from(a);if(!this.appearance){const e=this.color?getPdfColorArray(this.color):[0,0,0],a=t.get("CA"),r=this.borderStyle.width||1,n=2*r,g=[1/0,1/0,-1/0,-1/0];for(let e=0,t=s.length;e{for(let t=0,i=s.length;t{for(const t of this.data.inkLists){for(let i=0,a=t.length;ie.points)));h.set("F",4);h.set("Rotate",c);g&&h.set("IT",Name.get("InkHighlight"));const l=new Dict(t);h.set("BS",l);l.set("W",C);h.set("C",Array.from(s,(e=>e/255)));h.set("CA",r);const Q=new Dict(t);h.set("AP",Q);i?Q.set("N",i):Q.set("N",a);return h}static async createNewAppearanceStream(e,t,i){if(e.outlines)return this.createNewAppearanceStreamForHighlight(e,t,i);const{color:a,rect:s,paths:r,thickness:n,opacity:g}=e,o=[`${n} w 1 J 1 j`,`${getPdfColor(a,!1)}`];1!==g&&o.push("/R0 gs");const c=[];for(const{bezier:e}of r){c.length=0;c.push(`${numberToString(e[0])} ${numberToString(e[1])} m`);if(2===e.length)c.push(`${numberToString(e[0])} ${numberToString(e[1])} l S`);else{for(let t=2,i=e.length;t{e.push(`${t[0]} ${t[1]} m`,`${t[2]} ${t[3]} l`,`${t[6]} ${t[7]} l`,`${t[4]} ${t[5]} l`,"f");return[t[0],t[2],t[7],t[3]]}})}}else this.data.popupRef=null}static createNewDict(e,t,{apRef:i,ap:a}){const{color:s,oldAnnotation:r,opacity:n,rect:g,rotation:o,user:c,quadPoints:C}=e,h=r||new Dict(t);h.set("Type",Name.get("Annot"));h.set("Subtype",Name.get("Highlight"));h.set(r?"M":"CreationDate",`D:${getModificationDate()}`);h.set("CreationDate",`D:${getModificationDate()}`);h.set("Rect",g);h.set("F",4);h.set("Border",[0,0,0]);h.set("Rotate",o);h.set("QuadPoints",C);h.set("C",Array.from(s,(e=>e/255)));h.set("CA",n);c&&h.set("T",stringToAsciiOrUTF16BE(c));if(i||a){const e=new Dict(t);h.set("AP",e);e.set("N",i||a)}return h}static async createNewAppearanceStream(e,t,i){const{color:a,rect:s,outlines:r,opacity:n}=e,g=[`${getPdfColor(a,!0)}`,"/R0 gs"],o=[];for(const e of r){o.length=0;o.push(`${numberToString(e[0])} ${numberToString(e[1])} m`);for(let t=2,i=e.length;t{e.push(`${t[4]} ${t[5]+1.3} m`,`${t[6]} ${t[7]+1.3} l`,"S");return[t[0],t[2],t[7],t[3]]}})}}else this.data.popupRef=null}}class SquigglyAnnotation extends MarkupAnnotation{constructor(e){super(e);const{dict:t,xref:i}=e;this.data.annotationType=Y;if(this.data.quadPoints=getQuadPoints(t,null)){if(!this.appearance){const e=this.color?getPdfColorArray(this.color):[0,0,0],a=t.get("CA");this._setDefaultAppearance({xref:i,extra:"[] 0 d 1 w",strokeColor:e,strokeAlpha:a,pointsCallback:(e,t)=>{const i=(t[1]-t[5])/6;let a=i,s=t[4];const r=t[5],n=t[6];e.push(`${s} ${r+a} m`);do{s+=2;a=0===a?i:0;e.push(`${s} ${r+a} l`)}while(s{e.push((t[0]+t[4])/2+" "+(t[1]+t[5])/2+" m",(t[2]+t[6])/2+" "+(t[3]+t[7])/2+" l","S");return[t[0],t[2],t[7],t[3]]}})}}else this.data.popupRef=null}}class StampAnnotation extends MarkupAnnotation{#W;constructor(e){super(e);this.data.annotationType=K;this.#W=this.data.hasOwnCanvas=this.data.noRotate;this.data.isEditable=!this.data.noHTML;this.data.noHTML=!1}mustBeViewedWhenEditing(e,t=null){if(e){if(!this.data.isEditable)return!1;this.#W=this.data.hasOwnCanvas;this.data.hasOwnCanvas=!0;return!0}this.data.hasOwnCanvas=this.#W;return!t?.has(this.data.id)}static async createImage(e,t){const{width:i,height:a}=e,s=new OffscreenCanvas(i,a),r=s.getContext("2d",{alpha:!0});r.drawImage(e,0,0);const n=r.getImageData(0,0,i,a).data,g=new Uint32Array(n.buffer),o=g.some(FeatureTest.isLittleEndian?e=>e>>>24!=255:e=>255!=(255&e));if(o){r.fillStyle="white";r.fillRect(0,0,i,a);r.drawImage(e,0,0)}const c=s.convertToBlob({type:"image/jpeg",quality:1}).then((e=>e.arrayBuffer())),C=Name.get("XObject"),h=Name.get("Image"),l=new Dict(t);l.set("Type",C);l.set("Subtype",h);l.set("BitsPerComponent",8);l.set("ColorSpace",Name.get("DeviceRGB"));l.set("Filter",Name.get("DCTDecode"));l.set("BBox",[0,0,i,a]);l.set("Width",i);l.set("Height",a);let Q=null;if(o){const e=new Uint8Array(g.length);if(FeatureTest.isLittleEndian)for(let t=0,i=g.length;t>>24;else for(let t=0,i=g.length;t=0&&r<=1?r:null}}function decodeString(e){try{return stringToUTF8String(e)}catch(t){warn(`UTF-8 decoding failed: "${t}".`);return e}}class DatasetXMLParser extends SimpleXMLParser{constructor(e){super(e);this.node=null}onEndElement(e){const t=super.onEndElement(e);if(t&&"xfa:datasets"===e){this.node=t;throw new Error("Aborting DatasetXMLParser.")}}}class DatasetReader{constructor(e){if(e.datasets)this.node=new SimpleXMLParser({hasAttributes:!0}).parseFromString(e.datasets).documentElement;else{const t=new DatasetXMLParser({hasAttributes:!0});try{t.parseFromString(e["xdp:xdp"])}catch{}this.node=t.node}}getValue(e){if(!this.node||!e)return"";const t=this.node.searchNode(parseXFAPath(e),0);if(!t)return"";const i=t.firstChild;return"value"===i?.nodeName?t.children.map((e=>decodeString(e.textContent))):decodeString(t.textContent)}}class XRef{#j=null;constructor(e,t){this.stream=e;this.pdfManager=t;this.entries=[];this._xrefStms=new Set;this._cacheMap=new Map;this._pendingRefs=new RefSet;this._newPersistentRefNum=null;this._newTemporaryRefNum=null;this._persistentRefsCache=null}getNewPersistentRef(e){null===this._newPersistentRefNum&&(this._newPersistentRefNum=this.entries.length||1);const t=this._newPersistentRefNum++;this._cacheMap.set(t,e);return Ref.get(t,0)}getNewTemporaryRef(){if(null===this._newTemporaryRefNum){this._newTemporaryRefNum=this.entries.length||1;if(this._newPersistentRefNum){this._persistentRefsCache=new Map;for(let e=this._newTemporaryRefNum;e0;){const[n,g]=r;if(!Number.isInteger(n)||!Number.isInteger(g))throw new FormatError(`Invalid XRef range fields: ${n}, ${g}`);if(!Number.isInteger(i)||!Number.isInteger(a)||!Number.isInteger(s))throw new FormatError(`Invalid XRef entry fields length: ${n}, ${g}`);for(let r=t.entryNum;r=e.length);){i+=String.fromCharCode(a);a=e[t]}return i}function skipUntil(e,t,i){const a=i.length,s=e.length;let r=0;for(;t=a)break;t++;r++}return r}const e=/\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g,t=/\b(startxref|\d+\s+\d+\s+obj)\b/g,i=/^(\d+)\s+(\d+)\s+obj\b/,a=new Uint8Array([116,114,97,105,108,101,114]),s=new Uint8Array([115,116,97,114,116,120,114,101,102]),r=new Uint8Array([47,88,82,101,102]);this.entries.length=0;this._cacheMap.clear();const n=this.stream;n.pos=0;const g=n.getBytes(),o=bytesToString(g),c=g.length;let C=n.start;const h=[],l=[];for(;C=c)break;Q=g[C]}while(10!==Q&&13!==Q);continue}const E=readToken(g,C);let u;if(E.startsWith("xref")&&(4===E.length||/\s/.test(E[4]))){C+=skipUntil(g,C,a);h.push(C);C+=skipUntil(g,C,s)}else if(u=i.exec(E)){const t=0|u[1],i=0|u[2],a=C+E.length;let s,h=!1;if(this.entries[t]){if(this.entries[t].gen===i)try{new Parser({lexer:new Lexer(n.makeSubStream(a))}).getObj();h=!0}catch(e){e instanceof ParserEOFException?warn(`indexObjects -- checking object (${E}): "${e}".`):h=!0}}else h=!0;h&&(this.entries[t]={offset:C-n.start,gen:i,uncompressed:!0});e.lastIndex=a;const Q=e.exec(o);if(Q){s=e.lastIndex+1-C;if("endobj"!==Q[1]){warn(`indexObjects: Found "${Q[1]}" inside of another "obj", caused by missing "endobj" -- trying to recover.`);s-=Q[1].length+1}}else s=c-C;const d=g.subarray(C,C+s),f=skipUntil(d,0,r);if(f0?Math.max(...this._xrefStms):null)}getEntry(e){const t=this.entries[e];return t&&!t.free&&t.offset?t:null}fetchIfRef(e,t=!1){return e instanceof Ref?this.fetch(e,t):e}fetch(e,t=!1){if(!(e instanceof Ref))throw new Error("ref object is not a reference");const i=e.num,a=this._cacheMap.get(i);if(void 0!==a){a instanceof Dict&&!a.objId&&(a.objId=e.toString());return a}let s=this.getEntry(i);if(null===s){this._cacheMap.set(i,s);return s}if(this._pendingRefs.has(e)){this._pendingRefs.remove(e);warn(`Ignoring circular reference: ${e}.`);return mt}this._pendingRefs.put(e);try{s=s.uncompressed?this.fetchUncompressed(e,s,t):this.fetchCompressed(e,s,t);this._pendingRefs.remove(e)}catch(t){this._pendingRefs.remove(e);throw t}s instanceof Dict?s.objId=e.toString():s instanceof BaseStream&&(s.dict.objId=e.toString());return s}fetchUncompressed(e,t,i=!1){const a=e.gen;let s=e.num;if(t.gen!==a){const r=`Inconsistent generation in XRef: ${e}`;if(this._generationFallback&&t.gen0&&t[3]-t[1]>0)return t;warn(`Empty, or invalid, /${e} entry.`)}return null}get mediaBox(){return shadow(this,"mediaBox",this._getBoundingBox("MediaBox")||gg)}get cropBox(){return shadow(this,"cropBox",this._getBoundingBox("CropBox")||this.mediaBox)}get userUnit(){let e=this.pageDict.get("UserUnit");("number"!=typeof e||e<=0)&&(e=1);return shadow(this,"userUnit",e)}get view(){const{cropBox:e,mediaBox:t}=this;if(e!==t&&!isArrayEqual(e,t)){const i=Util.intersect(e,t);if(i&&i[2]-i[0]>0&&i[3]-i[1]>0)return shadow(this,"view",i);warn("Empty /CropBox and /MediaBox intersection.")}return shadow(this,"view",t)}get rotate(){let e=this._getInheritableProperty("Rotate")||0;e%90!=0?e=0:e>=360?e%=360:e<0&&(e=(e%360+360)%360);return shadow(this,"rotate",e)}_onSubStreamError(e,t){if(!this.evaluatorOptions.ignoreErrors)throw e;warn(`getContentStream - ignoring sub-stream (${t}): "${e}".`)}getContentStream(){return this.pdfManager.ensure(this,"content").then((e=>e instanceof BaseStream?e:Array.isArray(e)?new StreamsSequenceStream(e,this._onSubStreamError.bind(this)):new NullStream))}get xfaData(){return shadow(this,"xfaData",this.xfaFactory?{bbox:this.xfaFactory.getBoundingBox(this.pageIndex)}:null)}async#X(e,t,i){const a=[];for(const s of e)if(s.id){const e=Ref.fromString(s.id);if(!e){warn(`A non-linked annotation cannot be modified: ${s.id}`);continue}if(s.deleted){t.put(e,e);if(s.popupRef){const e=Ref.fromString(s.popupRef);e&&t.put(e,e)}continue}i?.put(e);s.ref=e;a.push(this.xref.fetchAsync(e).then((e=>{e instanceof Dict&&(s.oldAnnotation=e.clone())}),(()=>{warn(`Cannot fetch \`oldAnnotation\` for: ${e}.`)})));delete s.id}await Promise.all(a)}async saveNewAnnotations(e,t,i,a){if(this.xfaFactory)throw new Error("XFA: Cannot save new annotations.");const s=new PartialEvaluator({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),r=new RefSetCache,n=new RefSet;await this.#X(i,r,n);const g=this.pageDict,o=this.annotations.filter((e=>!(e instanceof Ref&&r.has(e)))),c=await AnnotationFactory.saveNewAnnotations(s,t,i,a);for(const{ref:e}of c.annotations)e instanceof Ref&&!n.has(e)&&o.push(e);const C=g.get("Annots");g.set("Annots",o);const h=[];await writeObject(this.ref,g,h,this.xref);C&&g.set("Annots",C);const l=c.dependencies;l.push({ref:this.ref,data:h.join("")},...c.annotations);for(const e of r)l.push({ref:e,data:null});return l}save(e,t,i){const a=new PartialEvaluator({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions});return this._parsedAnnotations.then((function(e){const s=[];for(const r of e)s.push(r.save(a,t,i).catch((function(e){warn(`save - ignoring annotation data during "${t.name}" task: "${e}".`);return null})));return Promise.all(s).then((function(e){return e.filter((e=>!!e))}))}))}loadResources(e){this.resourcesPromise||=this.pdfManager.ensure(this,"resources");return this.resourcesPromise.then((()=>new ObjectLoader(this.resources,e,this.xref).load()))}getOperatorList({handler:e,sink:t,task:i,intent:a,cacheKey:s,annotationStorage:r=null,modifiedIds:n=null}){const C=this.getContentStream(),E=this.loadResources(["ColorSpace","ExtGState","Font","Pattern","Properties","Shading","XObject"]),d=new PartialEvaluator({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),f=this.xfaFactory?null:getNewAnnotationsMap(r),p=f?.get(this.pageIndex);let m=Promise.resolve(null),y=null;if(p){const e=this.pdfManager.ensureDoc("annotationGlobals");let t;const a=new Set;for(const{bitmapId:e,bitmap:t}of p)!e||t||a.has(e)||a.add(e);const{isOffscreenCanvasSupported:s}=this.evaluatorOptions;if(a.size>0){const e=p.slice();for(const[t,i]of r)t.startsWith(u)&&i.bitmap&&a.has(i.bitmapId)&&e.push(i);t=AnnotationFactory.generateImages(e,this.xref,s)}else t=AnnotationFactory.generateImages(p,this.xref,s);y=new RefSet;m=Promise.all([e,this.#X(p,y,null)]).then((([e])=>e?AnnotationFactory.printNewAnnotations(e,d,i,p,t):null))}const w=Promise.all([C,E]).then((([r])=>{const n=new OperatorList(a,t);e.send("StartRenderPage",{transparency:d.hasBlendModes(this.resources,this.nonBlendModesSet),pageIndex:this.pageIndex,cacheKey:s});return d.getOperatorList({stream:r,task:i,resources:this.resources,operatorList:n}).then((function(){return n}))}));return Promise.all([w,this._parsedAnnotations,m]).then((function([e,t,s]){if(s){t=t.filter((e=>!(e.ref&&y.has(e.ref))));for(let e=0,i=s.length;ee.ref&&isRefsEqual(e.ref,a.refToReplace)));if(r>=0){t.splice(r,1,a);s.splice(e--,1);i--}}}t=t.concat(s)}if(0===t.length||a&l){e.flush(!0);return{length:e.totalLength}}const C=!!(a&h),E=!!(a&Q),u=!!(a&g),f=!!(a&o),p=!!(a&c),m=[];for(const e of t)(u||f&&e.mustBeViewed(r,C)&&e.mustBeViewedWhenEditing(E,n)||p&&e.mustBePrinted(r))&&m.push(e.getOperatorList(d,i,a,r).catch((function(e){warn(`getOperatorList - ignoring annotation data during "${i.name}" task: "${e}".`);return{opList:null,separateForm:!1,separateCanvas:!1}})));return Promise.all(m).then((function(t){let i=!1,a=!1;for(const{opList:s,separateForm:r,separateCanvas:n}of t){e.addOpList(s);i||=r;a||=n}e.flush(!0,{form:i,canvas:a});return{length:e.totalLength}}))}))}async extractTextContent({handler:e,task:t,includeMarkedContent:i,disableNormalization:a,sink:s}){const r=this.getContentStream(),n=this.loadResources(["ExtGState","Font","Properties","XObject"]),g=this.pdfManager.ensureCatalog("lang"),[o,,c]=await Promise.all([r,n,g]);return new PartialEvaluator({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}).getTextContent({stream:o,task:t,resources:this.resources,includeMarkedContent:i,disableNormalization:a,sink:s,viewBox:this.view,lang:c})}async getStructTree(){const e=await this.pdfManager.ensureCatalog("structTreeRoot");if(!e)return null;await this._parsedAnnotations;const t=await this.pdfManager.ensure(this,"_parseStructTree",[e]);return this.pdfManager.ensure(t,"serializable")}_parseStructTree(e){const t=new StructTreePage(e,this.pageDict);t.parse(this.ref);return t}async getAnnotationsData(e,t,i){const a=await this._parsedAnnotations;if(0===a.length)return a;const s=[],r=[];let n;const C=!!(i&g),h=!!(i&o),l=!!(i&c);for(const i of a){const a=C||h&&i.viewable;(a||l&&i.printable)&&s.push(i.data);if(i.hasTextContent&&a){n||=new PartialEvaluator({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions});r.push(i.extractTextContent(n,t,[-1/0,-1/0,1/0,1/0]).catch((function(e){warn(`getAnnotationsData - ignoring textContent during "${t.name}" task: "${e}".`)})))}}await Promise.all(r);return s}get annotations(){const e=this._getInheritableProperty("Annots");return shadow(this,"annotations",Array.isArray(e)?e:[])}get _parsedAnnotations(){return shadow(this,"_parsedAnnotations",this.pdfManager.ensure(this,"annotations").then((async e=>{if(0===e.length)return e;const[t,i]=await Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureDoc("fieldObjects")]);if(!t)return[];const a=i?.orphanFields,s=[];for(const i of e)s.push(AnnotationFactory.create(this.xref,i,t,this._localIdFactory,!1,a,this.ref).catch((function(e){warn(`_parsedAnnotations: "${e}".`);return null})));const r=[];let n,g;for(const e of await Promise.all(s))e&&(e instanceof WidgetAnnotation?(g||=[]).push(e):e instanceof PopupAnnotation?(n||=[]).push(e):r.push(e));g&&r.push(...g);n&&r.push(...n);return r})))}get jsActions(){return shadow(this,"jsActions",collectActions(this.xref,this.pageDict,pA))}}const og=new Uint8Array([37,80,68,70,45]),Ig=new Uint8Array([115,116,97,114,116,120,114,101,102]),cg=new Uint8Array([101,110,100,111,98,106]);function find(e,t,i=1024,a=!1){const s=t.length,r=e.peekBytes(i),n=r.length-s;if(n<=0)return!1;if(a){const i=s-1;let a=r.length-1;for(;a>=i;){let n=0;for(;n=s){e.pos+=a-i;return!0}a--}}else{let i=0;for(;i<=n;){let a=0;for(;a=s){e.pos+=i;return!0}i++}}return!1}class PDFDocument{constructor(e,t){if(t.length<=0)throw new InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");this.pdfManager=e;this.stream=t;this.xref=new XRef(t,e);this._pagePromises=new Map;this._version=null;const i={font:0};this._globalIdFactory=class{static getDocId(){return`g_${e.docId}`}static createFontId(){return"f"+ ++i.font}static createObjId(){unreachable("Abstract method `createObjId` called.")}static getPageObjId(){unreachable("Abstract method `getPageObjId` called.")}}}parse(e){this.xref.parse(e);this.catalog=new Catalog(this.pdfManager,this.xref)}get linearization(){let e=null;try{e=Linearization.create(this.stream)}catch(e){if(e instanceof MissingDataException)throw e;info(e)}return shadow(this,"linearization",e)}get startXRef(){const e=this.stream;let t=0;if(this.linearization){e.reset();if(find(e,cg)){e.skip(6);let i=e.peekByte();for(;isWhiteSpace(i);){e.pos++;i=e.peekByte()}t=e.pos-e.start}}else{const i=1024,a=Ig.length;let s=!1,r=e.end;for(;!s&&r>0;){r-=i-a;r<0&&(r=0);e.pos=r;s=find(e,Ig,i,!0)}if(s){e.skip(9);let i;do{i=e.getByte()}while(isWhiteSpace(i));let a="";for(;i>=32&&i<=57;){a+=String.fromCharCode(i);i=e.getByte()}t=parseInt(a,10);isNaN(t)&&(t=0)}}return shadow(this,"startXRef",t)}checkHeader(){const e=this.stream;e.reset();if(!find(e,og))return;e.moveStart();e.skip(og.length);let t,i="";for(;(t=e.getByte())>32&&i.length<7;)i+=String.fromCharCode(t);St.test(i)?this._version=i:warn(`Invalid PDF header version: ${i}`)}parseStartXRef(){this.xref.setStartXRef(this.startXRef)}get numPages(){let e=0;e=this.catalog.hasActualNumPages?this.catalog.numPages:this.xfaFactory?this.xfaFactory.getNumPages():this.linearization?this.linearization.numPages:this.catalog.numPages;return shadow(this,"numPages",e)}_hasOnlyDocumentSignatures(e,t=0){return!!Array.isArray(e)&&e.every((e=>{if(!((e=this.xref.fetchIfRef(e))instanceof Dict))return!1;if(e.has("Kids")){if(++t>10){warn("_hasOnlyDocumentSignatures: maximum recursion depth reached");return!1}return this._hasOnlyDocumentSignatures(e.get("Kids"),t)}const i=isName(e.get("FT"),"Sig"),a=e.get("Rect"),s=Array.isArray(a)&&a.every((e=>0===e));return i&&s}))}get _xfaStreams(){const e=this.catalog.acroForm;if(!e)return null;const t=e.get("XFA"),i={"xdp:xdp":"",template:"",datasets:"",config:"",connectionSet:"",localeSet:"",stylesheet:"","/xdp:xdp":""};if(t instanceof BaseStream&&!t.isEmpty){i["xdp:xdp"]=t;return i}if(!Array.isArray(t)||0===t.length)return null;for(let e=0,a=t.length;e{h.set(e,t)}));const l=[];for(const[e,i]of h){const s=i.get("FontDescriptor");if(!(s instanceof Dict))continue;let r=s.get("FontFamily");r=r.replaceAll(/[ ]+(\d)/g,"$1");const n={fontFamily:r,fontWeight:s.get("FontWeight"),italicAngle:-s.get("ItalicAngle")};validateCSSFont(n)&&l.push(g.handleSetFont(a,[Name.get(e),1],null,o,t,C,null,n).catch((function(e){warn(`loadXfaFonts: "${e}".`);return null})))}await Promise.all(l);const Q=this.xfaFactory.setFonts(c);if(!Q)return;n.ignoreErrors=!0;l.length=0;c.length=0;const E=new Set;for(const e of Q)getXfaFontName(`${e}-Regular`)||E.add(e);E.size&&Q.push("PdfJS-Fallback");for(const e of Q)if(!E.has(e))for(const i of[{name:"Regular",fontWeight:400,italicAngle:0},{name:"Bold",fontWeight:700,italicAngle:0},{name:"Italic",fontWeight:400,italicAngle:12},{name:"BoldItalic",fontWeight:700,italicAngle:12}]){const s=`${e}-${i.name}`,r=getXfaFontDict(s);l.push(g.handleSetFont(a,[Name.get(s),1],null,o,t,C,r,{fontFamily:e,fontWeight:i.fontWeight,italicAngle:i.italicAngle}).catch((function(e){warn(`loadXfaFonts: "${e}".`);return null})))}await Promise.all(l);this.xfaFactory.appendFonts(c,E)}async serializeXfaData(e){return this.xfaFactory?this.xfaFactory.serializeData(e):null}get version(){return this.catalog.version||this._version}get formInfo(){const e={hasFields:!1,hasAcroForm:!1,hasXfa:!1,hasSignatures:!1},t=this.catalog.acroForm;if(!t)return shadow(this,"formInfo",e);try{const i=t.get("Fields"),a=Array.isArray(i)&&i.length>0;e.hasFields=a;const s=t.get("XFA");e.hasXfa=Array.isArray(s)&&s.length>0||s instanceof BaseStream&&!s.isEmpty;const r=!!(1&t.get("SigFlags")),n=r&&this._hasOnlyDocumentSignatures(i);e.hasAcroForm=a&&!n;e.hasSignatures=r}catch(e){if(e instanceof MissingDataException)throw e;warn(`Cannot fetch form information: "${e}".`)}return shadow(this,"formInfo",e)}get documentInfo(){const e={PDFFormatVersion:this.version,Language:this.catalog.lang,EncryptFilterName:this.xref.encrypt?this.xref.encrypt.filterName:null,IsLinearized:!!this.linearization,IsAcroFormPresent:this.formInfo.hasAcroForm,IsXFAPresent:this.formInfo.hasXfa,IsCollectionPresent:!!this.catalog.collection,IsSignaturesPresent:this.formInfo.hasSignatures};let t;try{t=this.xref.trailer.get("Info")}catch(e){if(e instanceof MissingDataException)throw e;info("The document information dictionary is invalid.")}if(!(t instanceof Dict))return shadow(this,"documentInfo",e);for(const i of t.getKeys()){const a=t.get(i);switch(i){case"Title":case"Author":case"Subject":case"Keywords":case"Creator":case"Producer":case"CreationDate":case"ModDate":if("string"==typeof a){e[i]=stringToPDFString(a);continue}break;case"Trapped":if(a instanceof Name){e[i]=a;continue}break;default:let t;switch(typeof a){case"string":t=stringToPDFString(a);break;case"number":case"boolean":t=a;break;default:a instanceof Name&&(t=a)}if(void 0===t){warn(`Bad value, for custom key "${i}", in Info: ${a}.`);continue}e.Custom||(e.Custom=Object.create(null));e.Custom[i]=t;continue}warn(`Bad value, for key "${i}", in Info: ${a}.`)}return shadow(this,"documentInfo",e)}get fingerprints(){const e="\0".repeat(16);function validate(t){return"string"==typeof t&&16===t.length&&t!==e}const t=this.xref.trailer.get("ID");let i,a;if(Array.isArray(t)&&validate(t[0])){i=stringToBytes(t[0]);t[1]!==t[0]&&validate(t[1])&&(a=stringToBytes(t[1]))}else i=vs(this.stream.getByteRange(0,1024),0,1024);return shadow(this,"fingerprints",[toHexUtil(i),a?toHexUtil(a):null])}async _getLinearizationPage(e){const{catalog:t,linearization:i,xref:a}=this,s=Ref.get(i.objectNumberFirst,0);try{const e=await a.fetchAsync(s);if(e instanceof Dict){let i=e.getRaw("Type");i instanceof Ref&&(i=await a.fetchAsync(i));if(isName(i,"Page")||!e.has("Type")&&!e.has("Kids")&&e.has("Contents")){t.pageKidsCountCache.has(s)||t.pageKidsCountCache.put(s,1);t.pageIndexCache.has(s)||t.pageIndexCache.put(s,0);return[e,s]}}throw new FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.")}catch(i){warn(`_getLinearizationPage: "${i.message}".`);return t.getPageDict(e)}}getPage(e){const t=this._pagePromises.get(e);if(t)return t;const{catalog:i,linearization:a,xfaFactory:s}=this;let r;r=s?Promise.resolve([Dict.empty,null]):a?.pageFirst===e?this._getLinearizationPage(e):i.getPageDict(e);r=r.then((([t,a])=>new Page({pdfManager:this.pdfManager,xref:this.xref,pageIndex:e,pageDict:t,ref:a,globalIdFactory:this._globalIdFactory,fontCache:i.fontCache,builtInCMapCache:i.builtInCMapCache,standardFontDataCache:i.standardFontDataCache,globalImageCache:i.globalImageCache,systemFontCache:i.systemFontCache,nonBlendModesSet:i.nonBlendModesSet,xfaFactory:s})));this._pagePromises.set(e,r);return r}async checkFirstPage(e=!1){if(!e)try{await this.getPage(0)}catch(e){if(e instanceof XRefEntryException){this._pagePromises.delete(0);await this.cleanup();throw new XRefParseException}}}async checkLastPage(e=!1){const{catalog:t,pdfManager:i}=this;t.setActualNumPages();let a;try{await Promise.all([i.ensureDoc("xfaFactory"),i.ensureDoc("linearization"),i.ensureCatalog("numPages")]);if(this.xfaFactory)return;a=this.linearization?this.linearization.numPages:t.numPages;if(!Number.isInteger(a))throw new FormatError("Page count is not an integer.");if(a<=1)return;await this.getPage(a-1)}catch(s){this._pagePromises.delete(a-1);await this.cleanup();if(s instanceof XRefEntryException&&!e)throw new XRefParseException;warn(`checkLastPage - invalid /Pages tree /Count: ${a}.`);let r;try{r=await t.getAllPageDicts(e)}catch(i){if(i instanceof XRefEntryException&&!e)throw new XRefParseException;t.setActualNumPages(1);return}for(const[e,[a,s]]of r){let r;if(a instanceof Error){r=Promise.reject(a);r.catch((()=>{}))}else r=Promise.resolve(new Page({pdfManager:i,xref:this.xref,pageIndex:e,pageDict:a,ref:s,globalIdFactory:this._globalIdFactory,fontCache:t.fontCache,builtInCMapCache:t.builtInCMapCache,standardFontDataCache:t.standardFontDataCache,globalImageCache:t.globalImageCache,systemFontCache:t.systemFontCache,nonBlendModesSet:t.nonBlendModesSet,xfaFactory:null}));this._pagePromises.set(e,r)}t.setActualNumPages(r.size)}}fontFallback(e,t){return this.catalog.fontFallback(e,t)}async cleanup(e=!1){return this.catalog?this.catalog.cleanup(e):clearGlobalCaches()}async#Z(e,t,i,a,s,r,n){const{xref:g}=this;if(!(i instanceof Ref)||r.has(i))return;r.put(i);const o=await g.fetchAsync(i);if(!(o instanceof Dict))return;if(o.has("T")){const t=stringToPDFString(await o.getAsync("T"));e=""===e?t:`${e}.${t}`}else{let i=o;for(;;){i=i.getRaw("Parent")||t;if(i instanceof Ref){if(r.has(i))break;i=await g.fetchAsync(i)}if(!(i instanceof Dict))break;if(i.has("T")){const t=stringToPDFString(await i.getAsync("T"));e=""===e?t:`${e}.${t}`;break}}}t&&!o.has("Parent")&&isName(o.get("Subtype"),"Widget")&&n.put(i,t);a.has(e)||a.set(e,[]);a.get(e).push(AnnotationFactory.create(g,i,s,null,!0,n,null).then((e=>e?.getFieldObject())).catch((function(e){warn(`#collectFieldObjects: "${e}".`);return null})));if(!o.has("Kids"))return;const c=await o.getAsync("Kids");if(Array.isArray(c))for(const t of c)await this.#Z(e,i,t,a,s,r,n)}get fieldObjects(){return shadow(this,"fieldObjects",this.pdfManager.ensureDoc("formInfo").then((async e=>{if(!e.hasFields)return null;const[t,i]=await Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureCatalog("acroForm")]);if(!t)return null;const a=new RefSet,s=Object.create(null),r=new Map,n=new RefSetCache;for(const e of await i.getAsync("Fields"))await this.#Z("",null,e,r,t,a,n);const g=[];for(const[e,t]of r)g.push(Promise.all(t).then((t=>{(t=t.filter((e=>!!e))).length>0&&(s[e]=t)})));await Promise.all(g);return{allFields:s,orphanFields:n}})))}get hasJSActions(){return shadow(this,"hasJSActions",this.pdfManager.ensureDoc("_parseHasJSActions"))}async _parseHasJSActions(){const[e,t]=await Promise.all([this.pdfManager.ensureCatalog("jsActions"),this.pdfManager.ensureDoc("fieldObjects")]);return!!e||!!t&&Object.values(t.allFields).some((e=>e.some((e=>null!==e.actions))))}get calculationOrderIds(){const e=this.catalog.acroForm?.get("CO");if(!Array.isArray(e)||0===e.length)return shadow(this,"calculationOrderIds",null);const t=[];for(const i of e)i instanceof Ref&&t.push(i.toString());return shadow(this,"calculationOrderIds",t.length?t:null)}get annotationGlobals(){return shadow(this,"annotationGlobals",AnnotationFactory.createGlobals(this.pdfManager))}}class BasePdfManager{constructor(e){this._docBaseUrl=function parseDocBaseUrl(e){if(e){const t=createValidAbsoluteUrl(e);if(t)return t.href;warn(`Invalid absolute docBaseUrl: "${e}".`)}return null}(e.docBaseUrl);this._docId=e.docId;this._password=e.password;this.enableXfa=e.enableXfa;e.evaluatorOptions.isOffscreenCanvasSupported&&=FeatureTest.isOffscreenCanvasSupported;this.evaluatorOptions=Object.freeze(e.evaluatorOptions)}get docId(){return this._docId}get password(){return this._password}get docBaseUrl(){return this._docBaseUrl}get catalog(){return this.pdfDocument.catalog}ensureDoc(e,t){return this.ensure(this.pdfDocument,e,t)}ensureXRef(e,t){return this.ensure(this.pdfDocument.xref,e,t)}ensureCatalog(e,t){return this.ensure(this.pdfDocument.catalog,e,t)}getPage(e){return this.pdfDocument.getPage(e)}fontFallback(e,t){return this.pdfDocument.fontFallback(e,t)}loadXfaFonts(e,t){return this.pdfDocument.loadXfaFonts(e,t)}loadXfaImages(){return this.pdfDocument.loadXfaImages()}serializeXfaData(e){return this.pdfDocument.serializeXfaData(e)}cleanup(e=!1){return this.pdfDocument.cleanup(e)}async ensure(e,t,i){unreachable("Abstract method `ensure` called")}requestRange(e,t){unreachable("Abstract method `requestRange` called")}requestLoadedStream(e=!1){unreachable("Abstract method `requestLoadedStream` called")}sendProgressiveData(e){unreachable("Abstract method `sendProgressiveData` called")}updatePassword(e){this._password=e}terminate(e){unreachable("Abstract method `terminate` called")}}class LocalPdfManager extends BasePdfManager{constructor(e){super(e);const t=new Stream(e.source);this.pdfDocument=new PDFDocument(this,t);this._loadedStreamPromise=Promise.resolve(t)}async ensure(e,t,i){const a=e[t];return"function"==typeof a?a.apply(e,i):a}requestRange(e,t){return Promise.resolve()}requestLoadedStream(e=!1){return this._loadedStreamPromise}terminate(e){}}class NetworkPdfManager extends BasePdfManager{constructor(e){super(e);this.streamManager=new ChunkedStreamManager(e.source,{msgHandler:e.handler,length:e.length,disableAutoFetch:e.disableAutoFetch,rangeChunkSize:e.rangeChunkSize});this.pdfDocument=new PDFDocument(this,this.streamManager.getStream())}async ensure(e,t,i){try{const a=e[t];return"function"==typeof a?a.apply(e,i):a}catch(a){if(!(a instanceof MissingDataException))throw a;await this.requestRange(a.begin,a.end);return this.ensure(e,t,i)}}requestRange(e,t){return this.streamManager.requestRange(e,t)}requestLoadedStream(e=!1){return this.streamManager.requestAllChunks(e)}sendProgressiveData(e){this.streamManager.onReceiveData({chunk:e})}terminate(e){this.streamManager.abort(e)}}const Cg=1,hg=2,lg=1,Bg=2,Qg=3,Eg=4,ug=5,dg=6,fg=7,pg=8;function wrapReason(e){e instanceof Error||"object"==typeof e&&null!==e||unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.');switch(e.name){case"AbortException":return new AbortException(e.message);case"MissingPDFException":return new MissingPDFException(e.message);case"PasswordException":return new PasswordException(e.message,e.code);case"UnexpectedResponseException":return new UnexpectedResponseException(e.message,e.status);case"UnknownErrorException":return new UnknownErrorException(e.message,e.details);default:return new UnknownErrorException(e.message,e.toString())}}class MessageHandler{#V=new AbortController;constructor(e,t,i){this.sourceName=e;this.targetName=t;this.comObj=i;this.callbackId=1;this.streamId=1;this.streamSinks=Object.create(null);this.streamControllers=Object.create(null);this.callbackCapabilities=Object.create(null);this.actionHandler=Object.create(null);i.addEventListener("message",this.#z.bind(this),{signal:this.#V.signal})}#z({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){this.#_(e);return}if(e.callback){const t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw new Error(`Cannot resolve callback ${t}`);delete this.callbackCapabilities[t];if(e.callback===Cg)i.resolve(e.data);else{if(e.callback!==hg)throw new Error("Unexpected callback case");i.reject(wrapReason(e.reason))}return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const i=this.sourceName,a=e.sourceName,s=this.comObj;new Promise((function(i){i(t(e.data))})).then((function(t){s.postMessage({sourceName:i,targetName:a,callback:Cg,callbackId:e.callbackId,data:t})}),(function(t){s.postMessage({sourceName:i,targetName:a,callback:hg,callbackId:e.callbackId,reason:wrapReason(t)})}))}else e.streamId?this.#$(e):t(e.data)}on(e,t){const i=this.actionHandler;if(i[e])throw new Error(`There is already an actionName called "${e}"`);i[e]=t}send(e,t,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},i)}sendWithPromise(e,t,i){const a=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[a]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:a,data:t},i)}catch(e){s.reject(e)}return s.promise}sendWithStream(e,t,i,a){const s=this.streamId++,r=this.sourceName,n=this.targetName,g=this.comObj;return new ReadableStream({start:i=>{const o=Promise.withResolvers();this.streamControllers[s]={controller:i,startCall:o,pullCall:null,cancelCall:null,isClosed:!1};g.postMessage({sourceName:r,targetName:n,action:e,streamId:s,data:t,desiredSize:i.desiredSize},a);return o.promise},pull:e=>{const t=Promise.withResolvers();this.streamControllers[s].pullCall=t;g.postMessage({sourceName:r,targetName:n,stream:dg,streamId:s,desiredSize:e.desiredSize});return t.promise},cancel:e=>{assert(e instanceof Error,"cancel must have a valid reason");const t=Promise.withResolvers();this.streamControllers[s].cancelCall=t;this.streamControllers[s].isClosed=!0;g.postMessage({sourceName:r,targetName:n,stream:lg,streamId:s,reason:wrapReason(e)});return t.promise}},i)}#$(e){const t=e.streamId,i=this.sourceName,a=e.sourceName,s=this.comObj,r=this,n=this.actionHandler[e.action],g={enqueue(e,r=1,n){if(this.isCancelled)return;const g=this.desiredSize;this.desiredSize-=r;if(g>0&&this.desiredSize<=0){this.sinkCapability=Promise.withResolvers();this.ready=this.sinkCapability.promise}s.postMessage({sourceName:i,targetName:a,stream:Eg,streamId:t,chunk:e},n)},close(){if(!this.isCancelled){this.isCancelled=!0;s.postMessage({sourceName:i,targetName:a,stream:Qg,streamId:t});delete r.streamSinks[t]}},error(e){assert(e instanceof Error,"error must have a valid reason");if(!this.isCancelled){this.isCancelled=!0;s.postMessage({sourceName:i,targetName:a,stream:ug,streamId:t,reason:wrapReason(e)})}},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};g.sinkCapability.resolve();g.ready=g.sinkCapability.promise;this.streamSinks[t]=g;new Promise((function(t){t(n(e.data,g))})).then((function(){s.postMessage({sourceName:i,targetName:a,stream:pg,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:a,stream:pg,streamId:t,reason:wrapReason(e)})}))}#_(e){const t=e.streamId,i=this.sourceName,a=e.sourceName,s=this.comObj,r=this.streamControllers[t],n=this.streamSinks[t];switch(e.stream){case pg:e.success?r.startCall.resolve():r.startCall.reject(wrapReason(e.reason));break;case fg:e.success?r.pullCall.resolve():r.pullCall.reject(wrapReason(e.reason));break;case dg:if(!n){s.postMessage({sourceName:i,targetName:a,stream:fg,streamId:t,success:!0});break}n.desiredSize<=0&&e.desiredSize>0&&n.sinkCapability.resolve();n.desiredSize=e.desiredSize;new Promise((function(e){e(n.onPull?.())})).then((function(){s.postMessage({sourceName:i,targetName:a,stream:fg,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:a,stream:fg,streamId:t,reason:wrapReason(e)})}));break;case Eg:assert(r,"enqueue should have stream controller");if(r.isClosed)break;r.controller.enqueue(e.chunk);break;case Qg:assert(r,"close should have stream controller");if(r.isClosed)break;r.isClosed=!0;r.controller.close();this.#AA(r,t);break;case ug:assert(r,"error should have stream controller");r.controller.error(wrapReason(e.reason));this.#AA(r,t);break;case Bg:e.success?r.cancelCall.resolve():r.cancelCall.reject(wrapReason(e.reason));this.#AA(r,t);break;case lg:if(!n)break;new Promise((function(t){t(n.onCancel?.(wrapReason(e.reason)))})).then((function(){s.postMessage({sourceName:i,targetName:a,stream:Bg,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:a,stream:Bg,streamId:t,reason:wrapReason(e)})}));n.sinkCapability.reject(wrapReason(e.reason));n.isCancelled=!0;delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#AA(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]);delete this.streamControllers[t]}destroy(){this.#V?.abort();this.#V=null}}class PDFWorkerStream{constructor(e){this._msgHandler=e;this._contentLength=null;this._fullRequestReader=null;this._rangeRequestReaders=[]}getFullReader(){assert(!this._fullRequestReader,"PDFWorkerStream.getFullReader can only be called once.");this._fullRequestReader=new PDFWorkerStreamReader(this._msgHandler);return this._fullRequestReader}getRangeReader(e,t){const i=new PDFWorkerStreamRangeReader(e,t,this._msgHandler);this._rangeRequestReaders.push(i);return i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}}class PDFWorkerStreamReader{constructor(e){this._msgHandler=e;this.onProgress=null;this._contentLength=null;this._isRangeSupported=!1;this._isStreamingSupported=!1;const t=this._msgHandler.sendWithStream("GetReader");this._reader=t.getReader();this._headersReady=this._msgHandler.sendWithPromise("ReaderHeadersReady").then((e=>{this._isStreamingSupported=e.isStreamingSupported;this._isRangeSupported=e.isRangeSupported;this._contentLength=e.contentLength}))}get headersReady(){return this._headersReady}get contentLength(){return this._contentLength}get isStreamingSupported(){return this._isStreamingSupported}get isRangeSupported(){return this._isRangeSupported}async read(){const{value:e,done:t}=await this._reader.read();return t?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e)}}class PDFWorkerStreamRangeReader{constructor(e,t,i){this._msgHandler=i;this.onProgress=null;const a=this._msgHandler.sendWithStream("GetRangeReader",{begin:e,end:t});this._reader=a.getReader()}get isStreamingSupported(){return!1}async read(){const{value:e,done:t}=await this._reader.read();return t?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e)}}class WorkerTask{constructor(e){this.name=e;this.terminated=!1;this._capability=Promise.withResolvers()}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}class WorkerMessageHandler{static setup(e,t){let i=!1;e.on("test",(function(t){if(!i){i=!0;e.send("test",t instanceof Uint8Array)}}));e.on("configure",(function(e){!function setVerbosityLevel(e){Number.isInteger(e)&&(nt=e)}(e.verbosity)}));e.on("GetDocRequest",(function(e){return WorkerMessageHandler.createDocumentHandler(e,t)}))}static createDocumentHandler(e,t){let i,a=!1,s=null;const r=new Set,n=getVerbosityLevel(),{docId:g,apiVersion:o}=e,c="4.8.69";if(o!==c)throw new Error(`The API version "${o}" does not match the Worker version "${c}".`);const C=[];for(const e in[])C.push(e);if(C.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+C.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");const h=g+"_worker";let l=new MessageHandler(h,g,t);function ensureNotTerminated(){if(a)throw new Error("Worker was terminated")}function startWorkerTask(e){r.add(e)}function finishWorkerTask(e){e.finish();r.delete(e)}async function loadDocument(e){await i.ensureDoc("checkHeader");await i.ensureDoc("parseStartXRef");await i.ensureDoc("parse",[e]);await i.ensureDoc("checkFirstPage",[e]);await i.ensureDoc("checkLastPage",[e]);const t=await i.ensureDoc("isPureXfa");if(t){const e=new WorkerTask("loadXfaFonts");startWorkerTask(e);await Promise.all([i.loadXfaFonts(l,e).catch((e=>{})).then((()=>finishWorkerTask(e))),i.loadXfaImages()])}const[a,s]=await Promise.all([i.ensureDoc("numPages"),i.ensureDoc("fingerprints")]);return{numPages:a,fingerprints:s,htmlForXfa:t?await i.ensureDoc("htmlForXfa"):null}}function setupDoc(e){function onSuccess(e){ensureNotTerminated();l.send("GetDoc",{pdfInfo:e})}function onFailure(e){ensureNotTerminated();if(e instanceof PasswordException){const t=new WorkerTask(`PasswordException: response ${e.code}`);startWorkerTask(t);l.sendWithPromise("PasswordRequest",e).then((function({password:e}){finishWorkerTask(t);i.updatePassword(e);pdfManagerReady()})).catch((function(){finishWorkerTask(t);l.send("DocException",e)}))}else e instanceof InvalidPDFException||e instanceof MissingPDFException||e instanceof UnexpectedResponseException||e instanceof UnknownErrorException?l.send("DocException",e):l.send("DocException",new UnknownErrorException(e.message,e.toString()))}function pdfManagerReady(){ensureNotTerminated();loadDocument(!1).then(onSuccess,(function(e){ensureNotTerminated();e instanceof XRefParseException?i.requestLoadedStream().then((function(){ensureNotTerminated();loadDocument(!0).then(onSuccess,onFailure)})):onFailure(e)}))}ensureNotTerminated();(function getPdfManager({data:e,password:t,disableAutoFetch:i,rangeChunkSize:a,length:r,docBaseUrl:n,enableXfa:o,evaluatorOptions:c}){const C={source:null,disableAutoFetch:i,docBaseUrl:n,docId:g,enableXfa:o,evaluatorOptions:c,handler:l,length:r,password:t,rangeChunkSize:a},h=Promise.withResolvers();let Q;if(e){try{C.source=e;Q=new LocalPdfManager(C);h.resolve(Q)}catch(e){h.reject(e)}return h.promise}let E,u=[],d=0;try{E=new PDFWorkerStream(l)}catch(e){h.reject(e);return h.promise}const f=E.getFullReader();f.headersReady.then((function(){if(f.isRangeSupported){C.source=E;C.length=f.contentLength;C.disableAutoFetch||=f.isStreamingSupported;Q=new NetworkPdfManager(C);for(const e of u)Q.sendProgressiveData(e);u=[];h.resolve(Q);s=null}})).catch((function(e){h.reject(e);s=null}));new Promise((function(e,t){const readChunk=function({value:e,done:i}){try{ensureNotTerminated();if(i){if(!Q){const e=arrayBuffersToBytes(u);u=[];r&&e.length!==r&&warn("reported HTTP length is different from actual");C.source=e;Q=new LocalPdfManager(C);h.resolve(Q)}s=null;return}d+=e.byteLength;f.isStreamingSupported||l.send("DocProgress",{loaded:d,total:Math.max(d,f.contentLength||0)});Q?Q.sendProgressiveData(e):u.push(e);f.read().then(readChunk,t)}catch(e){t(e)}};f.read().then(readChunk,t)})).catch((function(e){h.reject(e);s=null}));s=function(e){E.cancelAllRequests(e)};return h.promise})(e).then((function(e){if(a){e.terminate(new AbortException("Worker was terminated."));throw new Error("Worker was terminated")}i=e;i.requestLoadedStream(!0).then((e=>{l.send("DataLoaded",{length:e.bytes.byteLength})}))})).then(pdfManagerReady,onFailure)}l.on("GetPage",(function(e){return i.getPage(e.pageIndex).then((function(e){return Promise.all([i.ensure(e,"rotate"),i.ensure(e,"ref"),i.ensure(e,"userUnit"),i.ensure(e,"view")]).then((function([e,t,i,a]){return{rotate:e,ref:t,refStr:t?.toString()??null,userUnit:i,view:a}}))}))}));l.on("GetPageIndex",(function(e){const t=Ref.get(e.num,e.gen);return i.ensureCatalog("getPageIndex",[t])}));l.on("GetDestinations",(function(e){return i.ensureCatalog("destinations")}));l.on("GetDestination",(function(e){return i.ensureCatalog("getDestination",[e.id])}));l.on("GetPageLabels",(function(e){return i.ensureCatalog("pageLabels")}));l.on("GetPageLayout",(function(e){return i.ensureCatalog("pageLayout")}));l.on("GetPageMode",(function(e){return i.ensureCatalog("pageMode")}));l.on("GetViewerPreferences",(function(e){return i.ensureCatalog("viewerPreferences")}));l.on("GetOpenAction",(function(e){return i.ensureCatalog("openAction")}));l.on("GetAttachments",(function(e){return i.ensureCatalog("attachments")}));l.on("GetDocJSActions",(function(e){return i.ensureCatalog("jsActions")}));l.on("GetPageJSActions",(function({pageIndex:e}){return i.getPage(e).then((function(e){return i.ensure(e,"jsActions")}))}));l.on("GetOutline",(function(e){return i.ensureCatalog("documentOutline")}));l.on("GetOptionalContentConfig",(function(e){return i.ensureCatalog("optionalContentConfig")}));l.on("GetPermissions",(function(e){return i.ensureCatalog("permissions")}));l.on("GetMetadata",(function(e){return Promise.all([i.ensureDoc("documentInfo"),i.ensureCatalog("metadata")])}));l.on("GetMarkInfo",(function(e){return i.ensureCatalog("markInfo")}));l.on("GetData",(function(e){return i.requestLoadedStream().then((function(e){return e.bytes}))}));l.on("GetAnnotations",(function({pageIndex:e,intent:t}){return i.getPage(e).then((function(i){const a=new WorkerTask(`GetAnnotations: page ${e}`);startWorkerTask(a);return i.getAnnotationsData(l,a,t).then((e=>{finishWorkerTask(a);return e}),(e=>{finishWorkerTask(a);throw e}))}))}));l.on("GetFieldObjects",(function(e){return i.ensureDoc("fieldObjects").then((e=>e?.allFields||null))}));l.on("HasJSActions",(function(e){return i.ensureDoc("hasJSActions")}));l.on("GetCalculationOrderIds",(function(e){return i.ensureDoc("calculationOrderIds")}));l.on("SaveDocument",(async function({isPureXfa:e,numPages:t,annotationStorage:a,filename:s}){const r=[i.requestLoadedStream(),i.ensureCatalog("acroForm"),i.ensureCatalog("acroFormRef"),i.ensureDoc("startXRef"),i.ensureDoc("xref"),i.ensureDoc("linearization"),i.ensureCatalog("structTreeRoot")],n=[],g=e?null:getNewAnnotationsMap(a),[o,c,C,h,Q,E,u]=await Promise.all(r),d=Q.trailer.getRaw("Root")||null;let f;if(g){u?await u.canUpdateStructTree({pdfManager:i,xref:Q,newAnnotationsByPage:g})&&(f=u):await StructTreeRoot.canCreateStructureTree({catalogRef:d,pdfManager:i,newAnnotationsByPage:g})&&(f=null);const e=AnnotationFactory.generateImages(a.values(),Q,i.evaluatorOptions.isOffscreenCanvasSupported),t=void 0===f?n:[];for(const[a,s]of g)t.push(i.getPage(a).then((t=>{const i=new WorkerTask(`Save (editor): page ${a}`);return t.saveNewAnnotations(l,i,s,e).finally((function(){finishWorkerTask(i)}))})));null===f?n.push(Promise.all(t).then((async e=>{await StructTreeRoot.createStructureTree({newAnnotationsByPage:g,xref:Q,catalogRef:d,pdfManager:i,newRefs:e});return e}))):f&&n.push(Promise.all(t).then((async e=>{await f.updateStructureTree({newAnnotationsByPage:g,pdfManager:i,newRefs:e});return e})))}if(e)n.push(i.serializeXfaData(a));else for(let e=0;ee.needAppearances)),D=c instanceof Dict&&c.get("XFA")||null;let b=null,F=!1;if(Array.isArray(D)){for(let e=0,t=D.length;e{"string"==typeof i&&(e[t]=stringToPDFString(i))}));S={rootRef:d,encryptRef:Q.trailer.getRaw("Encrypt")||null,newRef:Q.getNewTemporaryRef(),infoRef:Q.trailer.getRaw("Info")||null,info:e,fileIds:Q.trailer.get("ID")||null,startXRef:E?h:Q.lastXRefStreamPos??h,filename:s}}return incrementalUpdate({originalData:o.bytes,xrefInfo:S,newRefs:m,xref:Q,hasXfa:!!D,xfaDatasetsRef:b,hasXfaDatasetsEntry:F,needAppearances:w,acroFormRef:C,acroForm:c,xfaData:y,useXrefStream:isDict(Q.topDict,"XRef")}).finally((()=>{Q.resetNewTemporaryRef()}))}));l.on("GetOperatorList",(function(e,t){const a=e.pageIndex;i.getPage(a).then((function(i){const s=new WorkerTask(`GetOperatorList: page ${a}`);startWorkerTask(s);const r=n>=mA.INFOS?Date.now():0;i.getOperatorList({handler:l,sink:t,task:s,intent:e.intent,cacheKey:e.cacheKey,annotationStorage:e.annotationStorage,modifiedIds:e.modifiedIds}).then((function(e){finishWorkerTask(s);r&&info(`page=${a+1} - getOperatorList: time=${Date.now()-r}ms, len=${e.length}`);t.close()}),(function(e){finishWorkerTask(s);s.terminated||t.error(e)}))}))}));l.on("GetTextContent",(function(e,t){const{pageIndex:a,includeMarkedContent:s,disableNormalization:r}=e;i.getPage(a).then((function(e){const i=new WorkerTask("GetTextContent: page "+a);startWorkerTask(i);const g=n>=mA.INFOS?Date.now():0;e.extractTextContent({handler:l,task:i,sink:t,includeMarkedContent:s,disableNormalization:r}).then((function(){finishWorkerTask(i);g&&info(`page=${a+1} - getTextContent: time=`+(Date.now()-g)+"ms");t.close()}),(function(e){finishWorkerTask(i);i.terminated||t.error(e)}))}))}));l.on("GetStructTree",(function(e){return i.getPage(e.pageIndex).then((function(e){return i.ensure(e,"getStructTree")}))}));l.on("FontFallback",(function(e){return i.fontFallback(e.id,l)}));l.on("Cleanup",(function(e){return i.cleanup(!0)}));l.on("Terminate",(function(e){a=!0;const t=[];if(i){i.terminate(new AbortException("Worker was terminated."));const e=i.cleanup();t.push(e);i=null}else clearGlobalCaches();s?.(new AbortException("Worker was terminated."));for(const e of r){t.push(e.finished);e.terminate()}return Promise.all(t).then((function(){l.destroy();l=null}))}));l.on("Ready",(function(t){setupDoc(e);e=null}));return h}static initializeFromPort(e){const t=new MessageHandler("worker","main",e);WorkerMessageHandler.setup(t,e);t.send("ready",null)}}"undefined"==typeof window&&!t&&"undefined"!=typeof self&&function isMessagePort(e){return"function"==typeof e.postMessage&&"onmessage"in e}(self)&&WorkerMessageHandler.initializeFromPort(self);var mg=__webpack_exports__.WorkerMessageHandler;export{mg as WorkerMessageHandler}; \ No newline at end of file diff --git a/assets/savedPapersAuth-D0oFR2zr.js b/assets/savedPapersAuth-CrQIIpSo.js similarity index 85% rename from assets/savedPapersAuth-D0oFR2zr.js rename to assets/savedPapersAuth-CrQIIpSo.js index 9f9ef661403eaf638892f390863ef34359a7a81e..c99ffc25bed37ec2d4dd554658fdea1520019a1d 100644 --- a/assets/savedPapersAuth-D0oFR2zr.js +++ b/assets/savedPapersAuth-CrQIIpSo.js @@ -1 +1 @@ -import{D as i}from"./index-BrhBTT14.js";const s="saved_papers_authorized";function u(n=!1){const r=i("/api/v1/auth/hf/login"),o=new URL(r,window.location.origin).origin,t=new URL(window.location.href);n&&t.searchParams.set(s,"1");const a=o===window.location.origin?`${t.pathname}${t.search}${t.hash}`:t.toString(),e=new URLSearchParams({return_to:a,authorize_bucket:"true",bucket_create:"true"});return`${r}?${e.toString()}`}export{s as S,u as s}; +import{x as i}from"./index-D_-UZEuL.js";const s="saved_papers_authorized";function u(n=!1){const r=i("/api/v1/auth/hf/login"),o=new URL(r,window.location.origin).origin,t=new URL(window.location.href);n&&t.searchParams.set(s,"1");const a=o===window.location.origin?`${t.pathname}${t.search}${t.hash}`:t.toString(),e=new URLSearchParams({return_to:a,authorize_bucket:"true",bucket_create:"true"});return`${r}?${e.toString()}`}export{s as S,u as s}; diff --git a/assets/searchable-select-7qMDVvfT.js b/assets/searchable-select-Dmf1cwUh.js similarity index 80% rename from assets/searchable-select-7qMDVvfT.js rename to assets/searchable-select-Dmf1cwUh.js index ea7c823903fe545bf012d0ba31ddbdde2f086c1f..f28050107e6f6d08334a1525eb39bc8820ac1506 100644 --- a/assets/searchable-select-7qMDVvfT.js +++ b/assets/searchable-select-Dmf1cwUh.js @@ -1,4 +1,4 @@ -import{c as we,r as n,j as f,Z as B,o as Ye,_ as et,O as $,p as Re,m as A,q as G,$ as Ee,a0 as Pe,P as Se,a1 as tt,t as rt,a2 as nt,a3 as ot,a4 as at,a5 as lt,a6 as st,a7 as it,a8 as ct,v as O,C as ut}from"./index-BrhBTT14.js";import{u as dt}from"./useQuery-GhY2LXSI.js";import{B as ft}from"./button-CusGeqPB.js";import{R as pt,P as mt,O as vt,C as ht}from"./dialog-BhRZv4T5.js";import{L as gt}from"./loader-circle-BqZ1qbXL.js";/** +import{d as we,r as n,j as f,a3 as B,k as Xe,a4 as et,Y as $,l as Re,h as A,m as G,a5 as Ee,a6 as Pe,P as Se,a7 as tt,p as rt,a8 as nt,a9 as ot,aa as at,ab as lt,ac as st,ad as it,ae as ct,q as M,C as ut}from"./index-D_-UZEuL.js";import{u as dt}from"./useQuery-BZo4MZ3s.js";import{B as ft}from"./button-Cc8PFtC1.js";import{R as pt,P as mt,O as vt,C as ht}from"./dialog-ChaQ5z93.js";import{L as gt}from"./loader-circle-D1SscQUT.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. @@ -8,4 +8,4 @@ import{c as we,r as n,j as f,Z as B,o as Ye,_ as et,O as $,p as Re,m as A,q as G * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bt=we("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);function yt(e){const r=Ct(e),t=n.forwardRef((s,o)=>{const{children:l,...i}=s,c=n.Children.toArray(l),v=c.find(Rt);if(v){const u=v.props.children,h=c.map(g=>g===v?n.Children.count(u)>1?n.Children.only(null):n.isValidElement(u)?u.props.children:null:g);return f.jsx(r,{...i,ref:o,children:n.isValidElement(u)?n.cloneElement(u,void 0,h):null})}return f.jsx(r,{...i,ref:o,children:l})});return t.displayName=`${e}.Slot`,t}function Ct(e){const r=n.forwardRef((t,s)=>{const{children:o,...l}=t;if(n.isValidElement(o)){const i=Pt(o),c=Et(l,o.props);return o.type!==n.Fragment&&(c.ref=s?B(s,i):i),n.cloneElement(o,c)}return n.Children.count(o)>1?n.Children.only(null):null});return r.displayName=`${e}.SlotClone`,r}var wt=Symbol("radix.slottable");function Rt(e){return n.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===wt}function Et(e,r){const t={...r};for(const s in r){const o=e[s],l=r[s];/^on[A-Z]/.test(s)?o&&l?t[s]=(...c)=>{const v=l(...c);return o(...c),v}:o&&(t[s]=o):s==="style"?t[s]={...o,...l}:s==="className"&&(t[s]=[o,l].filter(Boolean).join(" "))}return{...e,...t}}function Pt(e){var s,o;let r=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,t=r&&"isReactWarning"in r&&r.isReactWarning;return t?e.ref:(r=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,t=r&&"isReactWarning"in r&&r.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var X="Popover",[ke]=rt(X,[Pe]),U=Pe(),[St,D]=ke(X),je=e=>{const{__scopePopover:r,children:t,open:s,defaultOpen:o,onOpenChange:l,modal:i=!1}=e,c=U(r),v=n.useRef(null),[u,h]=n.useState(!1),[g,y]=Ye({prop:s,defaultProp:o??!1,onChange:l,caller:X});return f.jsx(et,{...c,children:f.jsx(St,{scope:r,contentId:$(),triggerRef:v,open:g,onOpenChange:y,onOpenToggle:n.useCallback(()=>y(w=>!w),[y]),hasCustomAnchor:u,onCustomAnchorAdd:n.useCallback(()=>h(!0),[]),onCustomAnchorRemove:n.useCallback(()=>h(!1),[]),modal:i,children:t})})};je.displayName=X;var Ne="PopoverAnchor",kt=n.forwardRef((e,r)=>{const{__scopePopover:t,...s}=e,o=D(Ne,t),l=U(t),{onCustomAnchorAdd:i,onCustomAnchorRemove:c}=o;return n.useEffect(()=>(i(),()=>c()),[i,c]),f.jsx(Ee,{...l,...s,ref:r})});kt.displayName=Ne;var Ae="PopoverTrigger",Ie=n.forwardRef((e,r)=>{const{__scopePopover:t,...s}=e,o=D(Ae,t),l=U(t),i=Re(r,o.triggerRef),c=f.jsx(A.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Fe(o.open),...s,ref:i,onClick:G(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:f.jsx(Ee,{asChild:!0,...l,children:c})});Ie.displayName=Ae;var de="PopoverPortal",[jt,Nt]=ke(de,{forceMount:void 0}),Oe=e=>{const{__scopePopover:r,forceMount:t,children:s,container:o}=e,l=D(de,r);return f.jsx(jt,{scope:r,forceMount:t,children:f.jsx(Se,{present:t||l.open,children:f.jsx(tt,{asChild:!0,container:o,children:s})})})};Oe.displayName=de;var W="PopoverContent",_e=n.forwardRef((e,r)=>{const t=Nt(W,e.__scopePopover),{forceMount:s=t.forceMount,...o}=e,l=D(W,e.__scopePopover);return f.jsx(Se,{present:s||l.open,children:l.modal?f.jsx(It,{...o,ref:r}):f.jsx(Ot,{...o,ref:r})})});_e.displayName=W;var At=yt("PopoverContent.RemoveScroll"),It=n.forwardRef((e,r)=>{const t=D(W,e.__scopePopover),s=n.useRef(null),o=Re(r,s),l=n.useRef(!1);return n.useEffect(()=>{const i=s.current;if(i)return nt(i)},[]),f.jsx(ot,{as:At,allowPinchZoom:!0,children:f.jsx(Me,{...e,ref:o,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:G(e.onCloseAutoFocus,i=>{var c;i.preventDefault(),l.current||(c=t.triggerRef.current)==null||c.focus()}),onPointerDownOutside:G(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,v=c.button===0&&c.ctrlKey===!0,u=c.button===2||v;l.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:G(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ot=n.forwardRef((e,r)=>{const t=D(W,e.__scopePopover),s=n.useRef(!1),o=n.useRef(!1);return f.jsx(Me,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var i,c;(i=e.onCloseAutoFocus)==null||i.call(e,l),l.defaultPrevented||(s.current||(c=t.triggerRef.current)==null||c.focus(),l.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:l=>{var v,u;(v=e.onInteractOutside)==null||v.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=l.target;((u=t.triggerRef.current)==null?void 0:u.contains(i))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&o.current&&l.preventDefault()}})}),Me=n.forwardRef((e,r)=>{const{__scopePopover:t,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:v,onFocusOutside:u,onInteractOutside:h,...g}=e,y=D(W,t),w=U(t);return at(),f.jsx(lt,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:l,children:f.jsx(st,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:h,onEscapeKeyDown:c,onPointerDownOutside:v,onFocusOutside:u,onDismiss:()=>y.onOpenChange(!1),children:f.jsx(it,{"data-state":Fe(y.open),role:"dialog",id:y.contentId,...w,...g,ref:r,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),De="PopoverClose",_t=n.forwardRef((e,r)=>{const{__scopePopover:t,...s}=e,o=D(De,t);return f.jsx(A.button,{type:"button",...s,ref:r,onClick:G(e.onClick,()=>o.onOpenChange(!1))})});_t.displayName=De;var Mt="PopoverArrow",Dt=n.forwardRef((e,r)=>{const{__scopePopover:t,...s}=e,o=U(t);return f.jsx(ct,{...o,...s,ref:r})});Dt.displayName=Mt;function Fe(e){return e?"open":"closed"}var Ft=je,$t=Ie,Lt=Oe,$e=_e;const Tt=Ft,Vt=$t,Le=n.forwardRef(({className:e,align:r="center",sideOffset:t=4,...s},o)=>f.jsx(Lt,{children:f.jsx($e,{ref:o,align:r,sideOffset:t,className:O("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...s})}));Le.displayName=$e.displayName;var be=1,qt=.9,Kt=.8,Bt=.17,le=.1,se=.999,Wt=.9999,Ht=.99,zt=/[\\\/_+.#"@\[\(\{&]/,Gt=/[\\\/_+.#"@\[\(\{&]/g,Ut=/[\s-]/,Te=/[\s-]/g;function ce(e,r,t,s,o,l,i){if(l===r.length)return o===e.length?be:Ht;var c=`${o},${l}`;if(i[c]!==void 0)return i[c];for(var v=s.charAt(l),u=t.indexOf(v,o),h=0,g,y,w,k;u>=0;)g=ce(e,r,t,s,u+1,l+1,i),g>h&&(u===o?g*=be:zt.test(e.charAt(u-1))?(g*=Kt,w=e.slice(o,u-1).match(Gt),w&&o>0&&(g*=Math.pow(se,w.length))):Ut.test(e.charAt(u-1))?(g*=qt,k=e.slice(o,u-1).match(Te),k&&o>0&&(g*=Math.pow(se,k.length))):(g*=Bt,o>0&&(g*=Math.pow(se,u-o))),e.charAt(u)!==r.charAt(l)&&(g*=Wt)),(gg&&(g=y*le)),g>h&&(h=g),u=t.indexOf(v,u+1);return i[c]=h,h}function ye(e){return e.toLowerCase().replace(Te," ")}function Qt(e,r,t){return e=t&&t.length>0?`${e+" "+t.join(" ")}`:e,ce(e,r,ye(e),ye(r),0,0,{})}var z='[cmdk-group=""]',ie='[cmdk-group-items=""]',Zt='[cmdk-group-heading=""]',Ve='[cmdk-item=""]',Ce=`${Ve}:not([aria-disabled="true"])`,ue="cmdk-item-select",q="data-value",Jt=(e,r,t)=>Qt(e,r,t),qe=n.createContext(void 0),Q=()=>n.useContext(qe),Ke=n.createContext(void 0),fe=()=>n.useContext(Ke),Be=n.createContext(void 0),We=n.forwardRef((e,r)=>{let t=K(()=>{var a,p;return{search:"",value:(p=(a=e.value)!=null?a:e.defaultValue)!=null?p:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=K(()=>new Set),o=K(()=>new Map),l=K(()=>new Map),i=K(()=>new Set),c=He(e),{label:v,children:u,value:h,onValueChange:g,filter:y,shouldFilter:w,loop:k,disablePointerSelection:T=!1,vimBindings:j=!0,...F}=e,N=$(),Z=$(),_=$(),I=n.useRef(null),m=ir();L(()=>{if(h!==void 0){let a=h.trim();t.current.value=a,R.emit()}},[h]),L(()=>{m(6,me)},[]);let R=n.useMemo(()=>({subscribe:a=>(i.current.add(a),()=>i.current.delete(a)),snapshot:()=>t.current,setState:(a,p,x)=>{var d,b,C,S;if(!Object.is(t.current[a],p)){if(t.current[a]=p,a==="search")ne(),te(),m(1,re);else if(a==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let E=document.getElementById(_);E?E.focus():(d=document.getElementById(N))==null||d.focus()}if(m(7,()=>{var E;t.current.selectedItemId=(E=V())==null?void 0:E.id,R.emit()}),x||m(5,me),((b=c.current)==null?void 0:b.value)!==void 0){let E=p??"";(S=(C=c.current).onValueChange)==null||S.call(C,E);return}}R.emit()}},emit:()=>{i.current.forEach(a=>a())}}),[]),ee=n.useMemo(()=>({value:(a,p,x)=>{var d;p!==((d=l.current.get(a))==null?void 0:d.value)&&(l.current.set(a,{value:p,keywords:x}),t.current.filtered.items.set(a,pe(p,x)),m(2,()=>{te(),R.emit()}))},item:(a,p)=>(s.current.add(a),p&&(o.current.has(p)?o.current.get(p).add(a):o.current.set(p,new Set([a]))),m(3,()=>{ne(),te(),t.current.value||re(),R.emit()}),()=>{l.current.delete(a),s.current.delete(a),t.current.filtered.items.delete(a);let x=V();m(4,()=>{ne(),(x==null?void 0:x.getAttribute("id"))===a&&re(),R.emit()})}),group:a=>(o.current.has(a)||o.current.set(a,new Set),()=>{l.current.delete(a),o.current.delete(a)}),filter:()=>c.current.shouldFilter,label:v||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:N,inputId:_,labelId:Z,listInnerRef:I}),[]);function pe(a,p){var x,d;let b=(d=(x=c.current)==null?void 0:x.filter)!=null?d:Jt;return a?b(a,t.current.search,p):0}function te(){if(!t.current.search||c.current.shouldFilter===!1)return;let a=t.current.filtered.items,p=[];t.current.filtered.groups.forEach(d=>{let b=o.current.get(d),C=0;b.forEach(S=>{let E=a.get(S);C=Math.max(E,C)}),p.push([d,C])});let x=I.current;H().sort((d,b)=>{var C,S;let E=d.getAttribute("id"),J=b.getAttribute("id");return((C=a.get(J))!=null?C:0)-((S=a.get(E))!=null?S:0)}).forEach(d=>{let b=d.closest(ie);b?b.appendChild(d.parentElement===b?d:d.closest(`${ie} > *`)):x.appendChild(d.parentElement===x?d:d.closest(`${ie} > *`))}),p.sort((d,b)=>b[1]-d[1]).forEach(d=>{var b;let C=(b=I.current)==null?void 0:b.querySelector(`${z}[${q}="${encodeURIComponent(d[0])}"]`);C==null||C.parentElement.appendChild(C)})}function re(){let a=H().find(x=>x.getAttribute("aria-disabled")!=="true"),p=a==null?void 0:a.getAttribute(q);R.setState("value",p||void 0)}function ne(){var a,p,x,d;if(!t.current.search||c.current.shouldFilter===!1){t.current.filtered.count=s.current.size;return}t.current.filtered.groups=new Set;let b=0;for(let C of s.current){let S=(p=(a=l.current.get(C))==null?void 0:a.value)!=null?p:"",E=(d=(x=l.current.get(C))==null?void 0:x.keywords)!=null?d:[],J=pe(S,E);t.current.filtered.items.set(C,J),J>0&&b++}for(let[C,S]of o.current)for(let E of S)if(t.current.filtered.items.get(E)>0){t.current.filtered.groups.add(C);break}t.current.filtered.count=b}function me(){var a,p,x;let d=V();d&&(((a=d.parentElement)==null?void 0:a.firstChild)===d&&((x=(p=d.closest(z))==null?void 0:p.querySelector(Zt))==null||x.scrollIntoView({block:"nearest"})),d.scrollIntoView({block:"nearest"}))}function V(){var a;return(a=I.current)==null?void 0:a.querySelector(`${Ve}[aria-selected="true"]`)}function H(){var a;return Array.from(((a=I.current)==null?void 0:a.querySelectorAll(Ce))||[])}function oe(a){let p=H()[a];p&&R.setState("value",p.getAttribute(q))}function ae(a){var p;let x=V(),d=H(),b=d.findIndex(S=>S===x),C=d[b+a];(p=c.current)!=null&&p.loop&&(C=b+a<0?d[d.length-1]:b+a===d.length?d[0]:d[b+a]),C&&R.setState("value",C.getAttribute(q))}function ve(a){let p=V(),x=p==null?void 0:p.closest(z),d;for(;x&&!d;)x=a>0?lr(x,z):sr(x,z),d=x==null?void 0:x.querySelector(Ce);d?R.setState("value",d.getAttribute(q)):ae(a)}let he=()=>oe(H().length-1),ge=a=>{a.preventDefault(),a.metaKey?he():a.altKey?ve(1):ae(1)},xe=a=>{a.preventDefault(),a.metaKey?oe(0):a.altKey?ve(-1):ae(-1)};return n.createElement(A.div,{ref:r,tabIndex:-1,...F,"cmdk-root":"",onKeyDown:a=>{var p;(p=F.onKeyDown)==null||p.call(F,a);let x=a.nativeEvent.isComposing||a.keyCode===229;if(!(a.defaultPrevented||x))switch(a.key){case"n":case"j":{j&&a.ctrlKey&&ge(a);break}case"ArrowDown":{ge(a);break}case"p":case"k":{j&&a.ctrlKey&&xe(a);break}case"ArrowUp":{xe(a);break}case"Home":{a.preventDefault(),oe(0);break}case"End":{a.preventDefault(),he();break}case"Enter":{a.preventDefault();let d=V();if(d){let b=new Event(ue);d.dispatchEvent(b)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:ee.inputId,id:ee.labelId,style:ur},v),Y(e,a=>n.createElement(Ke.Provider,{value:R},n.createElement(qe.Provider,{value:ee},a))))}),Xt=n.forwardRef((e,r)=>{var t,s;let o=$(),l=n.useRef(null),i=n.useContext(Be),c=Q(),v=He(e),u=(s=(t=v.current)==null?void 0:t.forceMount)!=null?s:i==null?void 0:i.forceMount;L(()=>{if(!u)return c.item(o,i==null?void 0:i.id)},[u]);let h=ze(o,l,[e.value,e.children,l],e.keywords),g=fe(),y=M(m=>m.value&&m.value===h.current),w=M(m=>u||c.filter()===!1?!0:m.search?m.filtered.items.get(o)>0:!0);n.useEffect(()=>{let m=l.current;if(!(!m||e.disabled))return m.addEventListener(ue,k),()=>m.removeEventListener(ue,k)},[w,e.onSelect,e.disabled]);function k(){var m,R;T(),(R=(m=v.current).onSelect)==null||R.call(m,h.current)}function T(){g.setState("value",h.current,!0)}if(!w)return null;let{disabled:j,value:F,onSelect:N,forceMount:Z,keywords:_,...I}=e;return n.createElement(A.div,{ref:B(l,r),...I,id:o,"cmdk-item":"",role:"option","aria-disabled":!!j,"aria-selected":!!y,"data-disabled":!!j,"data-selected":!!y,onPointerMove:j||c.getDisablePointerSelection()?void 0:T,onClick:j?void 0:k},e.children)}),Yt=n.forwardRef((e,r)=>{let{heading:t,children:s,forceMount:o,...l}=e,i=$(),c=n.useRef(null),v=n.useRef(null),u=$(),h=Q(),g=M(w=>o||h.filter()===!1?!0:w.search?w.filtered.groups.has(i):!0);L(()=>h.group(i),[]),ze(i,c,[e.value,e.heading,v]);let y=n.useMemo(()=>({id:i,forceMount:o}),[o]);return n.createElement(A.div,{ref:B(c,r),...l,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},t&&n.createElement("div",{ref:v,"cmdk-group-heading":"","aria-hidden":!0,id:u},t),Y(e,w=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":t?u:void 0},n.createElement(Be.Provider,{value:y},w))))}),er=n.forwardRef((e,r)=>{let{alwaysRender:t,...s}=e,o=n.useRef(null),l=M(i=>!i.search);return!t&&!l?null:n.createElement(A.div,{ref:B(o,r),...s,"cmdk-separator":"",role:"separator"})}),tr=n.forwardRef((e,r)=>{let{onValueChange:t,...s}=e,o=e.value!=null,l=fe(),i=M(u=>u.search),c=M(u=>u.selectedItemId),v=Q();return n.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),n.createElement(A.input,{ref:r,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":v.listId,"aria-labelledby":v.labelId,"aria-activedescendant":c,id:v.inputId,type:"text",value:o?e.value:i,onChange:u=>{o||l.setState("search",u.target.value),t==null||t(u.target.value)}})}),rr=n.forwardRef((e,r)=>{let{children:t,label:s="Suggestions",...o}=e,l=n.useRef(null),i=n.useRef(null),c=M(u=>u.selectedItemId),v=Q();return n.useEffect(()=>{if(i.current&&l.current){let u=i.current,h=l.current,g,y=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let w=u.offsetHeight;h.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return y.observe(u),()=>{cancelAnimationFrame(g),y.unobserve(u)}}},[]),n.createElement(A.div,{ref:B(l,r),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":s,id:v.listId},Y(e,u=>n.createElement("div",{ref:B(i,v.listInnerRef),"cmdk-list-sizer":""},u)))}),nr=n.forwardRef((e,r)=>{let{open:t,onOpenChange:s,overlayClassName:o,contentClassName:l,container:i,...c}=e;return n.createElement(pt,{open:t,onOpenChange:s},n.createElement(mt,{container:i},n.createElement(vt,{"cmdk-overlay":"",className:o}),n.createElement(ht,{"aria-label":e.label,"cmdk-dialog":"",className:l},n.createElement(We,{ref:r,...c}))))}),or=n.forwardRef((e,r)=>M(t=>t.filtered.count===0)?n.createElement(A.div,{ref:r,...e,"cmdk-empty":"",role:"presentation"}):null),ar=n.forwardRef((e,r)=>{let{progress:t,children:s,label:o="Loading...",...l}=e;return n.createElement(A.div,{ref:r,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Y(e,i=>n.createElement("div",{"aria-hidden":!0},i)))}),P=Object.assign(We,{List:rr,Item:Xt,Input:tr,Group:Yt,Separator:er,Dialog:nr,Empty:or,Loading:ar});function lr(e,r){let t=e.nextElementSibling;for(;t;){if(t.matches(r))return t;t=t.nextElementSibling}}function sr(e,r){let t=e.previousElementSibling;for(;t;){if(t.matches(r))return t;t=t.previousElementSibling}}function He(e){let r=n.useRef(e);return L(()=>{r.current=e}),r}var L=typeof window>"u"?n.useEffect:n.useLayoutEffect;function K(e){let r=n.useRef();return r.current===void 0&&(r.current=e()),r}function M(e){let r=fe(),t=()=>e(r.snapshot());return n.useSyncExternalStore(r.subscribe,t,t)}function ze(e,r,t,s=[]){let o=n.useRef(),l=Q();return L(()=>{var i;let c=(()=>{var u;for(let h of t){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(u=h.current.textContent)==null?void 0:u.trim():o.current}})(),v=s.map(u=>u.trim());l.value(e,c,v),(i=r.current)==null||i.setAttribute(q,c),o.current=c}),o}var ir=()=>{let[e,r]=n.useState(),t=K(()=>new Map);return L(()=>{t.current.forEach(s=>s()),t.current=new Map},[e]),(s,o)=>{t.current.set(s,o),r({})}};function cr(e){let r=e.type;return typeof r=="function"?r(e.props):"render"in r?r.render(e.props):e}function Y({asChild:e,children:r},t){return e&&n.isValidElement(r)?n.cloneElement(cr(r),{ref:r.ref},t(r.props.children)):t(r)}var ur={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ge=n.forwardRef(({className:e,...r},t)=>f.jsx(P,{ref:t,className:O("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...r}));Ge.displayName=P.displayName;const Ue=n.forwardRef(({className:e,...r},t)=>f.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[f.jsx(bt,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),f.jsx(P.Input,{ref:t,className:O("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...r})]}));Ue.displayName=P.Input.displayName;const Qe=n.forwardRef(({className:e,...r},t)=>f.jsx(P.List,{ref:t,className:O("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...r}));Qe.displayName=P.List.displayName;const Ze=n.forwardRef((e,r)=>f.jsx(P.Empty,{ref:r,className:"py-6 text-center text-sm",...e}));Ze.displayName=P.Empty.displayName;const Je=n.forwardRef(({className:e,...r},t)=>f.jsx(P.Group,{ref:t,className:O("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...r}));Je.displayName=P.Group.displayName;const dr=n.forwardRef(({className:e,...r},t)=>f.jsx(P.Separator,{ref:t,className:O("-mx-1 h-px bg-border",e),...r}));dr.displayName=P.Separator.displayName;const Xe=n.forwardRef(({className:e,...r},t)=>f.jsx(P.Item,{ref:t,className:O("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),...r}));Xe.displayName=P.Item.displayName;const fr=250;function xr({value:e,onChange:r,placeholder:t="Select...",searchPlaceholder:s="Search...",emptyMessage:o="No results found.",disabled:l=!1,selectedOption:i,queryKey:c,queryFn:v,enabled:u=!0,className:h,ariaLabel:g}){const[y,w]=n.useState(!1),[k,T]=n.useState(""),[j,F]=n.useState("");n.useEffect(()=>{const m=window.setTimeout(()=>{F(k.trim())},fr);return()=>window.clearTimeout(m)},[k]),n.useEffect(()=>{y||(T(""),F(""))},[y]);const{data:N=[],isFetching:Z}=dt({queryKey:[...c,j],queryFn:()=>v(j),enabled:u&&y}),_=n.useMemo(()=>!e||N.some(m=>m.value===e)?N:(i==null?void 0:i.value)===e?[i,...N]:N,[N,i,e]),I=n.useMemo(()=>{if(!e)return t;const m=_.find(R=>R.value===e)??((i==null?void 0:i.value)===e?i:null);return(m==null?void 0:m.label)??t},[_,t,i,e]);return f.jsxs(Tt,{open:y,onOpenChange:w,modal:!0,children:[f.jsx(Vt,{asChild:!0,children:f.jsxs(ft,{type:"button",variant:"outline",role:"combobox","aria-expanded":y,"aria-label":g,disabled:l,className:O("h-8 w-full justify-between px-2 text-sm font-normal",!e&&"text-muted-foreground",h),children:[f.jsx("span",{className:"truncate",children:I}),f.jsx(xt,{className:"ml-1 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),f.jsx(Le,{className:"z-[60] w-[var(--radix-popover-trigger-width)] max-h-[var(--radix-popover-content-available-height)] overflow-hidden p-0",align:"start",collisionPadding:8,onWheel:m=>m.stopPropagation(),children:f.jsxs(Ge,{shouldFilter:!1,className:"h-full",children:[f.jsx(Ue,{placeholder:s,value:k,onValueChange:T}),f.jsx(Qe,{className:"max-h-[min(300px,calc(var(--radix-popover-content-available-height)-2.75rem))] min-h-0 overscroll-contain",children:Z?f.jsxs("div",{className:"flex items-center justify-center py-6 text-sm text-muted-foreground",children:[f.jsx(gt,{className:"mr-2 h-4 w-4 animate-spin"}),"Loading..."]}):_.length===0?f.jsx(Ze,{children:o}):f.jsx(Je,{children:_.map(m=>f.jsxs(Xe,{value:m.value,onSelect:()=>{r(m.value),w(!1)},children:[f.jsx(ut,{className:O("mr-2 h-4 w-4",e===m.value?"opacity-100":"opacity-0")}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"truncate",children:m.label}),m.description?f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:m.description}):null]})]},m.value))})})]})})]})}export{xr as S,bt as a}; + */const bt=we("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);function yt(e){const r=Ct(e),t=n.forwardRef((s,o)=>{const{children:l,...i}=s,c=n.Children.toArray(l),v=c.find(Rt);if(v){const u=v.props.children,h=c.map(g=>g===v?n.Children.count(u)>1?n.Children.only(null):n.isValidElement(u)?u.props.children:null:g);return f.jsx(r,{...i,ref:o,children:n.isValidElement(u)?n.cloneElement(u,void 0,h):null})}return f.jsx(r,{...i,ref:o,children:l})});return t.displayName=`${e}.Slot`,t}function Ct(e){const r=n.forwardRef((t,s)=>{const{children:o,...l}=t;if(n.isValidElement(o)){const i=Pt(o),c=Et(l,o.props);return o.type!==n.Fragment&&(c.ref=s?B(s,i):i),n.cloneElement(o,c)}return n.Children.count(o)>1?n.Children.only(null):null});return r.displayName=`${e}.SlotClone`,r}var wt=Symbol("radix.slottable");function Rt(e){return n.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===wt}function Et(e,r){const t={...r};for(const s in r){const o=e[s],l=r[s];/^on[A-Z]/.test(s)?o&&l?t[s]=(...c)=>{const v=l(...c);return o(...c),v}:o&&(t[s]=o):s==="style"?t[s]={...o,...l}:s==="className"&&(t[s]=[o,l].filter(Boolean).join(" "))}return{...e,...t}}function Pt(e){var s,o;let r=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,t=r&&"isReactWarning"in r&&r.isReactWarning;return t?e.ref:(r=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,t=r&&"isReactWarning"in r&&r.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var J="Popover",[ke]=rt(J,[Pe]),U=Pe(),[St,D]=ke(J),je=e=>{const{__scopePopover:r,children:t,open:s,defaultOpen:o,onOpenChange:l,modal:i=!1}=e,c=U(r),v=n.useRef(null),[u,h]=n.useState(!1),[g,y]=Xe({prop:s,defaultProp:o??!1,onChange:l,caller:J});return f.jsx(et,{...c,children:f.jsx(St,{scope:r,contentId:$(),triggerRef:v,open:g,onOpenChange:y,onOpenToggle:n.useCallback(()=>y(w=>!w),[y]),hasCustomAnchor:u,onCustomAnchorAdd:n.useCallback(()=>h(!0),[]),onCustomAnchorRemove:n.useCallback(()=>h(!1),[]),modal:i,children:t})})};je.displayName=J;var Ne="PopoverAnchor",kt=n.forwardRef((e,r)=>{const{__scopePopover:t,...s}=e,o=D(Ne,t),l=U(t),{onCustomAnchorAdd:i,onCustomAnchorRemove:c}=o;return n.useEffect(()=>(i(),()=>c()),[i,c]),f.jsx(Ee,{...l,...s,ref:r})});kt.displayName=Ne;var Ae="PopoverTrigger",Ie=n.forwardRef((e,r)=>{const{__scopePopover:t,...s}=e,o=D(Ae,t),l=U(t),i=Re(r,o.triggerRef),c=f.jsx(A.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Fe(o.open),...s,ref:i,onClick:G(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:f.jsx(Ee,{asChild:!0,...l,children:c})});Ie.displayName=Ae;var de="PopoverPortal",[jt,Nt]=ke(de,{forceMount:void 0}),Me=e=>{const{__scopePopover:r,forceMount:t,children:s,container:o}=e,l=D(de,r);return f.jsx(jt,{scope:r,forceMount:t,children:f.jsx(Se,{present:t||l.open,children:f.jsx(tt,{asChild:!0,container:o,children:s})})})};Me.displayName=de;var W="PopoverContent",Oe=n.forwardRef((e,r)=>{const t=Nt(W,e.__scopePopover),{forceMount:s=t.forceMount,...o}=e,l=D(W,e.__scopePopover);return f.jsx(Se,{present:s||l.open,children:l.modal?f.jsx(It,{...o,ref:r}):f.jsx(Mt,{...o,ref:r})})});Oe.displayName=W;var At=yt("PopoverContent.RemoveScroll"),It=n.forwardRef((e,r)=>{const t=D(W,e.__scopePopover),s=n.useRef(null),o=Re(r,s),l=n.useRef(!1);return n.useEffect(()=>{const i=s.current;if(i)return nt(i)},[]),f.jsx(ot,{as:At,allowPinchZoom:!0,children:f.jsx(_e,{...e,ref:o,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:G(e.onCloseAutoFocus,i=>{var c;i.preventDefault(),l.current||(c=t.triggerRef.current)==null||c.focus()}),onPointerDownOutside:G(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,v=c.button===0&&c.ctrlKey===!0,u=c.button===2||v;l.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:G(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Mt=n.forwardRef((e,r)=>{const t=D(W,e.__scopePopover),s=n.useRef(!1),o=n.useRef(!1);return f.jsx(_e,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var i,c;(i=e.onCloseAutoFocus)==null||i.call(e,l),l.defaultPrevented||(s.current||(c=t.triggerRef.current)==null||c.focus(),l.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:l=>{var v,u;(v=e.onInteractOutside)==null||v.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=l.target;((u=t.triggerRef.current)==null?void 0:u.contains(i))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&o.current&&l.preventDefault()}})}),_e=n.forwardRef((e,r)=>{const{__scopePopover:t,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:v,onFocusOutside:u,onInteractOutside:h,...g}=e,y=D(W,t),w=U(t);return at(),f.jsx(lt,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:l,children:f.jsx(st,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:h,onEscapeKeyDown:c,onPointerDownOutside:v,onFocusOutside:u,onDismiss:()=>y.onOpenChange(!1),children:f.jsx(it,{"data-state":Fe(y.open),role:"dialog",id:y.contentId,...w,...g,ref:r,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),De="PopoverClose",Ot=n.forwardRef((e,r)=>{const{__scopePopover:t,...s}=e,o=D(De,t);return f.jsx(A.button,{type:"button",...s,ref:r,onClick:G(e.onClick,()=>o.onOpenChange(!1))})});Ot.displayName=De;var _t="PopoverArrow",Dt=n.forwardRef((e,r)=>{const{__scopePopover:t,...s}=e,o=U(t);return f.jsx(ct,{...o,...s,ref:r})});Dt.displayName=_t;function Fe(e){return e?"open":"closed"}var Ft=je,$t=Ie,Lt=Me,$e=Oe;const Tt=Ft,Vt=$t,Le=n.forwardRef(({className:e,align:r="center",sideOffset:t=4,...s},o)=>f.jsx(Lt,{children:f.jsx($e,{ref:o,align:r,sideOffset:t,className:M("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...s})}));Le.displayName=$e.displayName;var be=1,qt=.9,Kt=.8,Bt=.17,le=.1,se=.999,Wt=.9999,Ht=.99,zt=/[\\\/_+.#"@\[\(\{&]/,Gt=/[\\\/_+.#"@\[\(\{&]/g,Ut=/[\s-]/,Te=/[\s-]/g;function ce(e,r,t,s,o,l,i){if(l===r.length)return o===e.length?be:Ht;var c=`${o},${l}`;if(i[c]!==void 0)return i[c];for(var v=s.charAt(l),u=t.indexOf(v,o),h=0,g,y,w,k;u>=0;)g=ce(e,r,t,s,u+1,l+1,i),g>h&&(u===o?g*=be:zt.test(e.charAt(u-1))?(g*=Kt,w=e.slice(o,u-1).match(Gt),w&&o>0&&(g*=Math.pow(se,w.length))):Ut.test(e.charAt(u-1))?(g*=qt,k=e.slice(o,u-1).match(Te),k&&o>0&&(g*=Math.pow(se,k.length))):(g*=Bt,o>0&&(g*=Math.pow(se,u-o))),e.charAt(u)!==r.charAt(l)&&(g*=Wt)),(gg&&(g=y*le)),g>h&&(h=g),u=t.indexOf(v,u+1);return i[c]=h,h}function ye(e){return e.toLowerCase().replace(Te," ")}function Qt(e,r,t){return e=t&&t.length>0?`${e+" "+t.join(" ")}`:e,ce(e,r,ye(e),ye(r),0,0,{})}var z='[cmdk-group=""]',ie='[cmdk-group-items=""]',Yt='[cmdk-group-heading=""]',Ve='[cmdk-item=""]',Ce=`${Ve}:not([aria-disabled="true"])`,ue="cmdk-item-select",q="data-value",Zt=(e,r,t)=>Qt(e,r,t),qe=n.createContext(void 0),Q=()=>n.useContext(qe),Ke=n.createContext(void 0),fe=()=>n.useContext(Ke),Be=n.createContext(void 0),We=n.forwardRef((e,r)=>{let t=K(()=>{var a,p;return{search:"",value:(p=(a=e.value)!=null?a:e.defaultValue)!=null?p:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=K(()=>new Set),o=K(()=>new Map),l=K(()=>new Map),i=K(()=>new Set),c=He(e),{label:v,children:u,value:h,onValueChange:g,filter:y,shouldFilter:w,loop:k,disablePointerSelection:T=!1,vimBindings:j=!0,...F}=e,N=$(),Y=$(),O=$(),I=n.useRef(null),m=ir();L(()=>{if(h!==void 0){let a=h.trim();t.current.value=a,R.emit()}},[h]),L(()=>{m(6,me)},[]);let R=n.useMemo(()=>({subscribe:a=>(i.current.add(a),()=>i.current.delete(a)),snapshot:()=>t.current,setState:(a,p,x)=>{var d,b,C,S;if(!Object.is(t.current[a],p)){if(t.current[a]=p,a==="search")ne(),te(),m(1,re);else if(a==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let E=document.getElementById(O);E?E.focus():(d=document.getElementById(N))==null||d.focus()}if(m(7,()=>{var E;t.current.selectedItemId=(E=V())==null?void 0:E.id,R.emit()}),x||m(5,me),((b=c.current)==null?void 0:b.value)!==void 0){let E=p??"";(S=(C=c.current).onValueChange)==null||S.call(C,E);return}}R.emit()}},emit:()=>{i.current.forEach(a=>a())}}),[]),ee=n.useMemo(()=>({value:(a,p,x)=>{var d;p!==((d=l.current.get(a))==null?void 0:d.value)&&(l.current.set(a,{value:p,keywords:x}),t.current.filtered.items.set(a,pe(p,x)),m(2,()=>{te(),R.emit()}))},item:(a,p)=>(s.current.add(a),p&&(o.current.has(p)?o.current.get(p).add(a):o.current.set(p,new Set([a]))),m(3,()=>{ne(),te(),t.current.value||re(),R.emit()}),()=>{l.current.delete(a),s.current.delete(a),t.current.filtered.items.delete(a);let x=V();m(4,()=>{ne(),(x==null?void 0:x.getAttribute("id"))===a&&re(),R.emit()})}),group:a=>(o.current.has(a)||o.current.set(a,new Set),()=>{l.current.delete(a),o.current.delete(a)}),filter:()=>c.current.shouldFilter,label:v||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:N,inputId:O,labelId:Y,listInnerRef:I}),[]);function pe(a,p){var x,d;let b=(d=(x=c.current)==null?void 0:x.filter)!=null?d:Zt;return a?b(a,t.current.search,p):0}function te(){if(!t.current.search||c.current.shouldFilter===!1)return;let a=t.current.filtered.items,p=[];t.current.filtered.groups.forEach(d=>{let b=o.current.get(d),C=0;b.forEach(S=>{let E=a.get(S);C=Math.max(E,C)}),p.push([d,C])});let x=I.current;H().sort((d,b)=>{var C,S;let E=d.getAttribute("id"),Z=b.getAttribute("id");return((C=a.get(Z))!=null?C:0)-((S=a.get(E))!=null?S:0)}).forEach(d=>{let b=d.closest(ie);b?b.appendChild(d.parentElement===b?d:d.closest(`${ie} > *`)):x.appendChild(d.parentElement===x?d:d.closest(`${ie} > *`))}),p.sort((d,b)=>b[1]-d[1]).forEach(d=>{var b;let C=(b=I.current)==null?void 0:b.querySelector(`${z}[${q}="${encodeURIComponent(d[0])}"]`);C==null||C.parentElement.appendChild(C)})}function re(){let a=H().find(x=>x.getAttribute("aria-disabled")!=="true"),p=a==null?void 0:a.getAttribute(q);R.setState("value",p||void 0)}function ne(){var a,p,x,d;if(!t.current.search||c.current.shouldFilter===!1){t.current.filtered.count=s.current.size;return}t.current.filtered.groups=new Set;let b=0;for(let C of s.current){let S=(p=(a=l.current.get(C))==null?void 0:a.value)!=null?p:"",E=(d=(x=l.current.get(C))==null?void 0:x.keywords)!=null?d:[],Z=pe(S,E);t.current.filtered.items.set(C,Z),Z>0&&b++}for(let[C,S]of o.current)for(let E of S)if(t.current.filtered.items.get(E)>0){t.current.filtered.groups.add(C);break}t.current.filtered.count=b}function me(){var a,p,x;let d=V();d&&(((a=d.parentElement)==null?void 0:a.firstChild)===d&&((x=(p=d.closest(z))==null?void 0:p.querySelector(Yt))==null||x.scrollIntoView({block:"nearest"})),d.scrollIntoView({block:"nearest"}))}function V(){var a;return(a=I.current)==null?void 0:a.querySelector(`${Ve}[aria-selected="true"]`)}function H(){var a;return Array.from(((a=I.current)==null?void 0:a.querySelectorAll(Ce))||[])}function oe(a){let p=H()[a];p&&R.setState("value",p.getAttribute(q))}function ae(a){var p;let x=V(),d=H(),b=d.findIndex(S=>S===x),C=d[b+a];(p=c.current)!=null&&p.loop&&(C=b+a<0?d[d.length-1]:b+a===d.length?d[0]:d[b+a]),C&&R.setState("value",C.getAttribute(q))}function ve(a){let p=V(),x=p==null?void 0:p.closest(z),d;for(;x&&!d;)x=a>0?lr(x,z):sr(x,z),d=x==null?void 0:x.querySelector(Ce);d?R.setState("value",d.getAttribute(q)):ae(a)}let he=()=>oe(H().length-1),ge=a=>{a.preventDefault(),a.metaKey?he():a.altKey?ve(1):ae(1)},xe=a=>{a.preventDefault(),a.metaKey?oe(0):a.altKey?ve(-1):ae(-1)};return n.createElement(A.div,{ref:r,tabIndex:-1,...F,"cmdk-root":"",onKeyDown:a=>{var p;(p=F.onKeyDown)==null||p.call(F,a);let x=a.nativeEvent.isComposing||a.keyCode===229;if(!(a.defaultPrevented||x))switch(a.key){case"n":case"j":{j&&a.ctrlKey&&ge(a);break}case"ArrowDown":{ge(a);break}case"p":case"k":{j&&a.ctrlKey&&xe(a);break}case"ArrowUp":{xe(a);break}case"Home":{a.preventDefault(),oe(0);break}case"End":{a.preventDefault(),he();break}case"Enter":{a.preventDefault();let d=V();if(d){let b=new Event(ue);d.dispatchEvent(b)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:ee.inputId,id:ee.labelId,style:ur},v),X(e,a=>n.createElement(Ke.Provider,{value:R},n.createElement(qe.Provider,{value:ee},a))))}),Jt=n.forwardRef((e,r)=>{var t,s;let o=$(),l=n.useRef(null),i=n.useContext(Be),c=Q(),v=He(e),u=(s=(t=v.current)==null?void 0:t.forceMount)!=null?s:i==null?void 0:i.forceMount;L(()=>{if(!u)return c.item(o,i==null?void 0:i.id)},[u]);let h=ze(o,l,[e.value,e.children,l],e.keywords),g=fe(),y=_(m=>m.value&&m.value===h.current),w=_(m=>u||c.filter()===!1?!0:m.search?m.filtered.items.get(o)>0:!0);n.useEffect(()=>{let m=l.current;if(!(!m||e.disabled))return m.addEventListener(ue,k),()=>m.removeEventListener(ue,k)},[w,e.onSelect,e.disabled]);function k(){var m,R;T(),(R=(m=v.current).onSelect)==null||R.call(m,h.current)}function T(){g.setState("value",h.current,!0)}if(!w)return null;let{disabled:j,value:F,onSelect:N,forceMount:Y,keywords:O,...I}=e;return n.createElement(A.div,{ref:B(l,r),...I,id:o,"cmdk-item":"",role:"option","aria-disabled":!!j,"aria-selected":!!y,"data-disabled":!!j,"data-selected":!!y,onPointerMove:j||c.getDisablePointerSelection()?void 0:T,onClick:j?void 0:k},e.children)}),Xt=n.forwardRef((e,r)=>{let{heading:t,children:s,forceMount:o,...l}=e,i=$(),c=n.useRef(null),v=n.useRef(null),u=$(),h=Q(),g=_(w=>o||h.filter()===!1?!0:w.search?w.filtered.groups.has(i):!0);L(()=>h.group(i),[]),ze(i,c,[e.value,e.heading,v]);let y=n.useMemo(()=>({id:i,forceMount:o}),[o]);return n.createElement(A.div,{ref:B(c,r),...l,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},t&&n.createElement("div",{ref:v,"cmdk-group-heading":"","aria-hidden":!0,id:u},t),X(e,w=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":t?u:void 0},n.createElement(Be.Provider,{value:y},w))))}),er=n.forwardRef((e,r)=>{let{alwaysRender:t,...s}=e,o=n.useRef(null),l=_(i=>!i.search);return!t&&!l?null:n.createElement(A.div,{ref:B(o,r),...s,"cmdk-separator":"",role:"separator"})}),tr=n.forwardRef((e,r)=>{let{onValueChange:t,...s}=e,o=e.value!=null,l=fe(),i=_(u=>u.search),c=_(u=>u.selectedItemId),v=Q();return n.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),n.createElement(A.input,{ref:r,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":v.listId,"aria-labelledby":v.labelId,"aria-activedescendant":c,id:v.inputId,type:"text",value:o?e.value:i,onChange:u=>{o||l.setState("search",u.target.value),t==null||t(u.target.value)}})}),rr=n.forwardRef((e,r)=>{let{children:t,label:s="Suggestions",...o}=e,l=n.useRef(null),i=n.useRef(null),c=_(u=>u.selectedItemId),v=Q();return n.useEffect(()=>{if(i.current&&l.current){let u=i.current,h=l.current,g,y=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let w=u.offsetHeight;h.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return y.observe(u),()=>{cancelAnimationFrame(g),y.unobserve(u)}}},[]),n.createElement(A.div,{ref:B(l,r),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":s,id:v.listId},X(e,u=>n.createElement("div",{ref:B(i,v.listInnerRef),"cmdk-list-sizer":""},u)))}),nr=n.forwardRef((e,r)=>{let{open:t,onOpenChange:s,overlayClassName:o,contentClassName:l,container:i,...c}=e;return n.createElement(pt,{open:t,onOpenChange:s},n.createElement(mt,{container:i},n.createElement(vt,{"cmdk-overlay":"",className:o}),n.createElement(ht,{"aria-label":e.label,"cmdk-dialog":"",className:l},n.createElement(We,{ref:r,...c}))))}),or=n.forwardRef((e,r)=>_(t=>t.filtered.count===0)?n.createElement(A.div,{ref:r,...e,"cmdk-empty":"",role:"presentation"}):null),ar=n.forwardRef((e,r)=>{let{progress:t,children:s,label:o="Loading...",...l}=e;return n.createElement(A.div,{ref:r,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},X(e,i=>n.createElement("div",{"aria-hidden":!0},i)))}),P=Object.assign(We,{List:rr,Item:Jt,Input:tr,Group:Xt,Separator:er,Dialog:nr,Empty:or,Loading:ar});function lr(e,r){let t=e.nextElementSibling;for(;t;){if(t.matches(r))return t;t=t.nextElementSibling}}function sr(e,r){let t=e.previousElementSibling;for(;t;){if(t.matches(r))return t;t=t.previousElementSibling}}function He(e){let r=n.useRef(e);return L(()=>{r.current=e}),r}var L=typeof window>"u"?n.useEffect:n.useLayoutEffect;function K(e){let r=n.useRef();return r.current===void 0&&(r.current=e()),r}function _(e){let r=fe(),t=()=>e(r.snapshot());return n.useSyncExternalStore(r.subscribe,t,t)}function ze(e,r,t,s=[]){let o=n.useRef(),l=Q();return L(()=>{var i;let c=(()=>{var u;for(let h of t){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(u=h.current.textContent)==null?void 0:u.trim():o.current}})(),v=s.map(u=>u.trim());l.value(e,c,v),(i=r.current)==null||i.setAttribute(q,c),o.current=c}),o}var ir=()=>{let[e,r]=n.useState(),t=K(()=>new Map);return L(()=>{t.current.forEach(s=>s()),t.current=new Map},[e]),(s,o)=>{t.current.set(s,o),r({})}};function cr(e){let r=e.type;return typeof r=="function"?r(e.props):"render"in r?r.render(e.props):e}function X({asChild:e,children:r},t){return e&&n.isValidElement(r)?n.cloneElement(cr(r),{ref:r.ref},t(r.props.children)):t(r)}var ur={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ge=n.forwardRef(({className:e,...r},t)=>f.jsx(P,{ref:t,className:M("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...r}));Ge.displayName=P.displayName;const Ue=n.forwardRef(({className:e,...r},t)=>f.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[f.jsx(bt,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),f.jsx(P.Input,{ref:t,className:M("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...r})]}));Ue.displayName=P.Input.displayName;const Qe=n.forwardRef(({className:e,...r},t)=>f.jsx(P.List,{ref:t,className:M("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...r}));Qe.displayName=P.List.displayName;const Ye=n.forwardRef((e,r)=>f.jsx(P.Empty,{ref:r,className:"py-6 text-center text-sm",...e}));Ye.displayName=P.Empty.displayName;const Ze=n.forwardRef(({className:e,...r},t)=>f.jsx(P.Group,{ref:t,className:M("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...r}));Ze.displayName=P.Group.displayName;const dr=n.forwardRef(({className:e,...r},t)=>f.jsx(P.Separator,{ref:t,className:M("-mx-1 h-px bg-border",e),...r}));dr.displayName=P.Separator.displayName;const Je=n.forwardRef(({className:e,...r},t)=>f.jsx(P.Item,{ref:t,className:M("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),...r}));Je.displayName=P.Item.displayName;const fr=250;function xr({value:e,onChange:r,placeholder:t="Select...",searchPlaceholder:s="Search...",emptyMessage:o="No results found.",disabled:l=!1,selectedOption:i,queryKey:c,queryFn:v,enabled:u=!0,className:h,ariaLabel:g}){const[y,w]=n.useState(!1),[k,T]=n.useState(""),[j,F]=n.useState("");n.useEffect(()=>{const m=window.setTimeout(()=>{F(k.trim())},fr);return()=>window.clearTimeout(m)},[k]),n.useEffect(()=>{y||(T(""),F(""))},[y]);const{data:N=[],isFetching:Y}=dt({queryKey:[...c,j],queryFn:()=>v(j),enabled:u&&y}),O=n.useMemo(()=>!e||N.some(m=>m.value===e)?N:(i==null?void 0:i.value)===e?[i,...N]:N,[N,i,e]),I=n.useMemo(()=>{if(!e)return t;const m=O.find(R=>R.value===e)??((i==null?void 0:i.value)===e?i:null);return(m==null?void 0:m.label)??t},[O,t,i,e]);return f.jsxs(Tt,{open:y,onOpenChange:w,modal:!0,children:[f.jsx(Vt,{asChild:!0,children:f.jsxs(ft,{type:"button",variant:"outline",role:"combobox","aria-expanded":y,"aria-label":g,disabled:l,className:M("h-8 w-full justify-between px-2 text-sm font-normal",!e&&"text-muted-foreground",h),children:[f.jsx("span",{className:"truncate",children:I}),f.jsx(xt,{className:"ml-1 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),f.jsx(Le,{className:"z-[60] w-[var(--radix-popover-trigger-width)] max-h-[var(--radix-popover-content-available-height)] overflow-hidden p-0",align:"start",collisionPadding:8,onWheel:m=>m.stopPropagation(),children:f.jsxs(Ge,{shouldFilter:!1,className:"h-full",children:[f.jsx(Ue,{placeholder:s,value:k,onValueChange:T}),f.jsx(Qe,{className:"max-h-[min(300px,calc(var(--radix-popover-content-available-height)-2.75rem))] min-h-0 overscroll-contain",children:Y?f.jsxs("div",{className:"flex items-center justify-center py-6 text-sm text-muted-foreground",children:[f.jsx(gt,{className:"mr-2 h-4 w-4 animate-spin"}),"Loading..."]}):O.length===0?f.jsx(Ye,{children:o}):f.jsx(Ze,{children:O.map(m=>f.jsxs(Je,{value:m.value,onSelect:()=>{r(m.value),w(!1)},children:[f.jsx(ut,{className:M("mr-2 h-4 w-4",e===m.value?"opacity-100":"opacity-0")}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"truncate",children:m.label}),m.description?f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:m.description}):null]})]},m.value))})})]})})]})}export{xr as S,bt as a}; diff --git a/assets/shield-alert-BkQ9lngS.js b/assets/shield-alert-Dix0M7Y-.js similarity index 81% rename from assets/shield-alert-BkQ9lngS.js rename to assets/shield-alert-Dix0M7Y-.js index 0a20f84435e38df6c71e7f4770d3ca629966c6f0..28fe92054be56dee755b5228eef6176557e060f9 100644 --- a/assets/shield-alert-BkQ9lngS.js +++ b/assets/shield-alert-Dix0M7Y-.js @@ -1,4 +1,4 @@ -import{c as e}from"./index-BrhBTT14.js";/** +import{d as e}from"./index-D_-UZEuL.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. @@ -8,9 +8,9 @@ import{c as e}from"./index-BrhBTT14.js";/** * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const c=e("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + */const h=e("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const h=e("ShieldAlert",[["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"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);export{t as C,c as R,h as S}; + */const c=e("ShieldAlert",[["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"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);export{t as C,h as R,c as S}; diff --git a/assets/skeleton-DHdzoBmM.js b/assets/skeleton-CCZ1iXls.js similarity index 62% rename from assets/skeleton-DHdzoBmM.js rename to assets/skeleton-CCZ1iXls.js index 44f4d474efd1dbec1a85b3aaa340911f9e277c3a..1a17da03377892d7561b9182bae0479c1c7d4f0b 100644 --- a/assets/skeleton-DHdzoBmM.js +++ b/assets/skeleton-CCZ1iXls.js @@ -1 +1 @@ -import{j as t,v as n}from"./index-BrhBTT14.js";function m({className:e,...s}){return t.jsx("div",{className:n("animate-pulse rounded-md bg-muted",e),...s})}export{m as S}; +import{j as t,q as n}from"./index-D_-UZEuL.js";function m({className:e,...s}){return t.jsx("div",{className:n("animate-pulse rounded-md bg-muted",e),...s})}export{m as S}; diff --git a/assets/submissions-BpzsA2lc.js b/assets/submissions-BpzsA2lc.js new file mode 100644 index 0000000000000000000000000000000000000000..cdf946e0d382de26aca62e0b99e57f673d4d724c --- /dev/null +++ b/assets/submissions-BpzsA2lc.js @@ -0,0 +1 @@ +import{a0 as Be}from"./index-D_-UZEuL.js";var v;(function(s){s.assertEqual=n=>{};function e(n){}s.assertIs=e;function t(n){throw new Error}s.assertNever=t,s.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},s.getValidEnumValues=n=>{const a=s.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return s.objectValues(i)},s.objectValues=n=>s.objectKeys(n).map(function(a){return n[a]}),s.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},s.find=(n,a)=>{for(const i of n)if(a(i))return i},s.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function r(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}s.joinValues=r,s.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));var we;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(we||(we={}));const u=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$=s=>{switch(typeof s){case"undefined":return u.undefined;case"string":return u.string;case"number":return Number.isNaN(s)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(s)?u.array:s===null?u.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?u.promise:typeof Map<"u"&&s instanceof Map?u.map:typeof Set<"u"&&s instanceof Set?u.set:typeof Date<"u"&&s instanceof Date?u.date:u.object;default:return u.unknown}},d=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class I extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},r={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let o=r,f=0;for(;ft.message){const t={},r=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}I.create=s=>new I(s);const ue=(s,e)=>{let t;switch(s.code){case d.invalid_type:s.received===u.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,v.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${v.joinValues(s.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${v.joinValues(s.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${v.joinValues(s.options)}, received '${s.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:v.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case d.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case d.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,v.assertNever(s)}return{message:t}};let qe=ue;function Fe(){return qe}const We=s=>{const{data:e,path:t,errorMaps:r,issueData:n}=s,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const f=r.filter(p=>!!p).slice().reverse();for(const p of f)o=p(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}};function c(s,e){const t=Fe(),r=We({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===ue?void 0:ue].filter(n=>!!n)});s.common.issues.push(r)}class S{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const n of t){const a=await n.key,i=await n.value;r.push({key:a,value:i})}return S.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const m=Object.freeze({status:"aborted"}),F=s=>({status:"dirty",value:s}),O=s=>({status:"valid",value:s}),Te=s=>s.status==="aborted",Se=s=>s.status==="dirty",U=s=>s.status==="valid",Q=s=>typeof Promise<"u"&&s instanceof Promise;var l;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(l||(l={}));class A{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ce=(s,e)=>{if(U(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new I(s.common.issues);return this._error=t,this._error}}};function y(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:n}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{const{message:f}=s;return i.code==="invalid_enum_value"?{message:f??o.defaultError}:typeof o.data>"u"?{message:f??r??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:f??t??o.defaultError}},description:n}}class g{get description(){return this._def.description}_getType(e){return $(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Q(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Ce(r,n)}"~validate"(e){var r,n;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return U(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(n=(r=a==null?void 0:a.message)==null?void 0:r.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>U(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(Q(n)?n:Promise.resolve(n));return Ce(r,a)}refine(e,t){const r=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:d.custom,...r(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new z({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return E.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N.create(this)}promise(){return re.create(this,this._def)}or(e){return K.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new z({...y(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ne({...y(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new Pe({typeName:_.ZodBranded,type:this,...y(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ae({...y(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ke.create(this,e)}readonly(){return ie.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Je=/^c[^\s-]{8,}$/i,Ye=/^[0-9a-z]+$/,He=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ge=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Qe=/^[a-z0-9_-]{21}$/i,Xe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ke=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,et=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ce;const st=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,nt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,at=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,it=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ot=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,je="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dt=new RegExp(`^${je}$`);function Ie(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);const t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ct(s){return new RegExp(`^${Ie(s)}$`)}function ut(s){let e=`${je}T${Ie(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function lt(s,e){return!!((e==="v4"||!e)&&st.test(s)||(e==="v6"||!e)&&nt.test(s))}function ht(s,e){if(!Xe.test(s))return!1;try{const[t]=s.split(".");if(!t)return!1;const r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(r));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function ft(s,e){return!!((e==="v4"||!e)&&rt.test(s)||(e==="v6"||!e)&&at.test(s))}class R extends g{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_type,expected:u.string,received:a.parsedType}),m}const r=new S;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.lengthe.test(n),{validation:t,code:d.invalid_string,...l.errToObj(r)})}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...l.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...l.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...l.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...l.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...l.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...l.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...l.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...l.errToObj(t)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new R({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew R({checks:[],typeName:_.ZodString,coerce:(s==null?void 0:s.coerce)??!1,...y(s)});function pt(s,e){const t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,n=t>r?t:r,a=Number.parseInt(s.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}class B extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==u.number){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_type,expected:u.number,received:a.parsedType}),m}let r;const n=new S;for(const a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.dataa.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?pt(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:d.not_finite,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,r,n){return new B({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:l.toString(n)}]})}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&v.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.valuenew B({checks:[],typeName:_.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...y(s)});class W extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==u.bigint)return this._getInvalidInput(e);let r;const n=new S;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.dataa.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:u.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,r,n){return new W({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:l.toString(n)}]})}_addCheck(e){return new W({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew W({checks:[],typeName:_.ZodBigInt,coerce:(s==null?void 0:s.coerce)??!1,...y(s)});class le extends g{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.boolean,received:r.parsedType}),m}return O(e.data)}}le.create=s=>new le({typeName:_.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...y(s)});class X extends g{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_type,expected:u.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_date}),m}const r=new S;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):v.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new X({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:l.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew X({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:_.ZodDate,...y(s)});class Oe extends g{_parse(e){if(this._getType(e)!==u.symbol){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.symbol,received:r.parsedType}),m}return O(e.data)}}Oe.create=s=>new Oe({typeName:_.ZodSymbol,...y(s)});class he extends g{_parse(e){if(this._getType(e)!==u.undefined){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.undefined,received:r.parsedType}),m}return O(e.data)}}he.create=s=>new he({typeName:_.ZodUndefined,...y(s)});class fe extends g{_parse(e){if(this._getType(e)!==u.null){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.null,received:r.parsedType}),m}return O(e.data)}}fe.create=s=>new fe({typeName:_.ZodNull,...y(s)});class Ne extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}}Ne.create=s=>new Ne({typeName:_.ZodAny,...y(s)});class pe extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}}pe.create=s=>new pe({typeName:_.ZodUnknown,...y(s)});class P extends g{_parse(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:u.never,received:t.parsedType}),m}}P.create=s=>new P({typeName:_.ZodNever,...y(s)});class Ae extends g{_parse(e){if(this._getType(e)!==u.undefined){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.void,received:r.parsedType}),m}return O(e.data)}}Ae.create=s=>new Ae({typeName:_.ZodVoid,...y(s)});class N extends g{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==u.array)return c(t,{code:d.invalid_type,expected:u.array,received:t.parsedType}),m;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.lengthn.maxLength.value&&(c(t,{code:d.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new A(t,i,t.path,o)))).then(i=>S.mergeArray(r,i));const a=[...t.data].map((i,o)=>n.type._parseSync(new A(t,i,t.path,o)));return S.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new N({...this._def,minLength:{value:e,message:l.toString(t)}})}max(e,t){return new N({...this._def,maxLength:{value:e,message:l.toString(t)}})}length(e,t){return new N({...this._def,exactLength:{value:e,message:l.toString(t)}})}nonempty(e){return this.min(1,e)}}N.create=(s,e)=>new N({type:s,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...y(e)});function D(s){if(s instanceof w){const e={};for(const t in s.shape){const r=s.shape[t];e[t]=E.create(D(r))}return new w({...s._def,shape:()=>e})}else return s instanceof N?new N({...s._def,type:D(s.element)}):s instanceof E?E.create(D(s.unwrap())):s instanceof L?L.create(D(s.unwrap())):s instanceof M?M.create(s.items.map(e=>D(e))):s}class w extends g{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.object){const p=this._getOrReturnCtx(e);return c(p,{code:d.invalid_type,expected:u.object,received:p.parsedType}),m}const{status:r,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof P&&this._def.unknownKeys==="strip"))for(const p in n.data)i.includes(p)||o.push(p);const f=[];for(const p of i){const x=a[p],q=n.data[p];f.push({key:{status:"valid",value:p},value:x._parse(new A(n,q,n.path,p)),alwaysSet:p in n.data})}if(this._def.catchall instanceof P){const p=this._def.unknownKeys;if(p==="passthrough")for(const x of o)f.push({key:{status:"valid",value:x},value:{status:"valid",value:n.data[x]}});else if(p==="strict")o.length>0&&(c(n,{code:d.unrecognized_keys,keys:o}),r.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const x of o){const q=n.data[x];f.push({key:{status:"valid",value:x},value:p._parse(new A(n,q,n.path,x)),alwaysSet:x in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const p=[];for(const x of f){const q=await x.key,Ue=await x.value;p.push({key:q,value:Ue,alwaysSet:x.alwaysSet})}return p}).then(p=>S.mergeObjectSync(r,p)):S.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new w({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var a,i;const n=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,r).message)??r.defaultError;return t.code==="unrecognized_keys"?{message:l.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new w({...this._def,unknownKeys:"strip"})}passthrough(){return new w({...this._def,unknownKeys:"passthrough"})}extend(e){return new w({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new w({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new w({...this._def,catchall:e})}pick(e){const t={};for(const r of v.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new w({...this._def,shape:()=>t})}omit(e){const t={};for(const r of v.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new w({...this._def,shape:()=>t})}deepPartial(){return D(this)}partial(e){const t={};for(const r of v.objectKeys(this.shape)){const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new w({...this._def,shape:()=>t})}required(e){const t={};for(const r of v.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof E;)a=a._def.innerType;t[r]=a}return new w({...this._def,shape:()=>t})}keyof(){return $e(v.objectKeys(this.shape))}}w.create=(s,e)=>new w({shape:()=>s,unknownKeys:"strip",catchall:P.create(),typeName:_.ZodObject,...y(e)});w.strictCreate=(s,e)=>new w({shape:()=>s,unknownKeys:"strict",catchall:P.create(),typeName:_.ZodObject,...y(e)});w.lazycreate=(s,e)=>new w({shape:s,unknownKeys:"strip",catchall:P.create(),typeName:_.ZodObject,...y(e)});class K extends g{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new I(o.ctx.common.issues));return c(t,{code:d.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(r.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const f of r){const p={...t,common:{...t.common,issues:[]},parent:null},x=f._parseSync({data:t.data,path:t.path,parent:p});if(x.status==="valid")return x;x.status==="dirty"&&!a&&(a={result:x,ctx:p}),p.common.issues.length&&i.push(p.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(f=>new I(f));return c(t,{code:d.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}}K.create=(s,e)=>new K({options:s,typeName:_.ZodUnion,...y(e)});const Z=s=>s instanceof _e?Z(s.schema):s instanceof z?Z(s.innerType()):s instanceof se?[s.value]:s instanceof V?s.options:s instanceof ye?v.objectValues(s.enum):s instanceof ne?Z(s._def.innerType):s instanceof he?[void 0]:s instanceof fe?[null]:s instanceof E?[void 0,...Z(s.unwrap())]:s instanceof L?[null,...Z(s.unwrap())]:s instanceof Pe||s instanceof ie?Z(s.unwrap()):s instanceof ae?Z(s._def.innerType):[];class xe extends g{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.object)return c(t,{code:d.invalid_type,expected:u.object,received:t.parsedType}),m;const r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(c(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const a of t){const i=Z(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new xe({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...y(r)})}}function me(s,e){const t=$(s),r=$(e);if(s===e)return{valid:!0,data:s};if(t===u.object&&r===u.object){const n=v.objectKeys(e),a=v.objectKeys(s).filter(o=>n.indexOf(o)!==-1),i={...s,...e};for(const o of a){const f=me(s[o],e[o]);if(!f.valid)return{valid:!1};i[o]=f.data}return{valid:!0,data:i}}else if(t===u.array&&r===u.array){if(s.length!==e.length)return{valid:!1};const n=[];for(let a=0;a{if(Te(a)||Te(i))return m;const o=me(a.value,i.value);return o.valid?((Se(a)||Se(i))&&t.dirty(),{status:t.value,value:o.data}):(c(r,{code:d.invalid_intersection_types}),m)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ee.create=(s,e,t)=>new ee({left:s,right:e,typeName:_.ZodIntersection,...y(t)});class M extends g{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.array)return c(r,{code:d.invalid_type,expected:u.array,received:r.parsedType}),m;if(r.data.lengththis._def.items.length&&(c(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...r.data].map((i,o)=>{const f=this._def.items[o]||this._def.rest;return f?f._parse(new A(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>S.mergeArray(t,i)):S.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new M({...this._def,rest:e})}}M.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new M({items:s,typeName:_.ZodTuple,rest:null,...y(e)})};class te extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.object)return c(r,{code:d.invalid_type,expected:u.object,received:r.parsedType}),m;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)n.push({key:a._parse(new A(r,o,r.path,o)),value:i._parse(new A(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?S.mergeObjectAsync(t,n):S.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof g?new te({keyType:e,valueType:t,typeName:_.ZodRecord,...y(r)}):new te({keyType:R.create(),valueType:e,typeName:_.ZodRecord,...y(t)})}}class Ze extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.map)return c(r,{code:d.invalid_type,expected:u.map,received:r.parsedType}),m;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,f],p)=>({key:n._parse(new A(r,o,r.path,[p,"key"])),value:a._parse(new A(r,f,r.path,[p,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const f of i){const p=await f.key,x=await f.value;if(p.status==="aborted"||x.status==="aborted")return m;(p.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(p.value,x.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const f of i){const p=f.key,x=f.value;if(p.status==="aborted"||x.status==="aborted")return m;(p.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(p.value,x.value)}return{status:t.value,value:o}}}}Ze.create=(s,e,t)=>new Ze({valueType:e,keyType:s,typeName:_.ZodMap,...y(t)});class J extends g{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.set)return c(r,{code:d.invalid_type,expected:u.set,received:r.parsedType}),m;const n=this._def;n.minSize!==null&&r.data.sizen.maxSize.value&&(c(r,{code:d.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(f){const p=new Set;for(const x of f){if(x.status==="aborted")return m;x.status==="dirty"&&t.dirty(),p.add(x.value)}return{status:t.value,value:p}}const o=[...r.data.values()].map((f,p)=>a._parse(new A(r,f,r.path,p)));return r.common.async?Promise.all(o).then(f=>i(f)):i(o)}min(e,t){return new J({...this._def,minSize:{value:e,message:l.toString(t)}})}max(e,t){return new J({...this._def,maxSize:{value:e,message:l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}J.create=(s,e)=>new J({valueType:s,minSize:null,maxSize:null,typeName:_.ZodSet,...y(e)});class _e extends g{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}_e.create=(s,e)=>new _e({getter:s,typeName:_.ZodLazy,...y(e)});class se extends g{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return c(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}se.create=(s,e)=>new se({value:s,typeName:_.ZodLiteral,...y(e)});function $e(s,e){return new V({values:s,typeName:_.ZodEnum,...y(e)})}class V extends g{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return c(t,{expected:v.joinValues(r),received:t.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return c(t,{received:t.data,code:d.invalid_enum_value,options:r}),m}return O(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return V.create(e,{...this._def,...t})}exclude(e,t=this._def){return V.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}V.create=$e;class ye extends g{_parse(e){const t=v.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==u.string&&r.parsedType!==u.number){const n=v.objectValues(t);return c(r,{expected:v.joinValues(n),received:r.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=v.objectValues(t);return c(r,{received:r.data,code:d.invalid_enum_value,options:n}),m}return O(e.data)}get enum(){return this._def.values}}ye.create=(s,e)=>new ye({values:s,typeName:_.ZodNativeEnum,...y(e)});class re extends g{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return c(t,{code:d.invalid_type,expected:u.promise,received:t.parsedType}),m;const r=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return O(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}re.create=(s,e)=>new re({type:s,typeName:_.ZodPromise,...y(e)});class z extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{c(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return m;const f=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return f.status==="aborted"?m:f.status==="dirty"||t.value==="dirty"?F(f.value):f});{if(t.value==="aborted")return m;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?m:o.status==="dirty"||t.value==="dirty"?F(o.value):o}}if(n.type==="refinement"){const i=o=>{const f=n.refinement(o,a);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!U(i))return m;const o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>U(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):m);v.assertNever(n)}}z.create=(s,e,t)=>new z({schema:s,typeName:_.ZodEffects,effect:e,...y(t)});z.createWithPreprocess=(s,e,t)=>new z({schema:e,effect:{type:"preprocess",transform:s},typeName:_.ZodEffects,...y(t)});class E extends g{_parse(e){return this._getType(e)===u.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}E.create=(s,e)=>new E({innerType:s,typeName:_.ZodOptional,...y(e)});class L extends g{_parse(e){return this._getType(e)===u.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}L.create=(s,e)=>new L({innerType:s,typeName:_.ZodNullable,...y(e)});class ne extends g{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===u.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ne.create=(s,e)=>new ne({innerType:s,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});class ae extends g{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Q(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ae.create=(s,e)=>new ae({innerType:s,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});class Re extends g{_parse(e){if(this._getType(e)!==u.nan){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.nan,received:r.parsedType}),m}return{status:"valid",value:e.data}}}Re.create=s=>new Re({typeName:_.ZodNaN,...y(s)});class Pe extends g{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ke extends g{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),F(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new ke({in:e,out:t,typeName:_.ZodPipeline})}}class ie extends g{_parse(e){const t=this._def.innerType._parse(e),r=n=>(U(n)&&(n.value=Object.freeze(n.value)),n);return Q(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}}ie.create=(s,e)=>new ie({innerType:s,typeName:_.ZodReadonly,...y(e)});var _;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(_||(_={}));const h=R.create,b=B.create,oe=le.create,mt=pe.create;P.create;const T=N.create,k=w.create,_t=K.create,Me=xe.create;ee.create;M.create;const Ve=te.create,G=se.create,ge=V.create;re.create;E.create;L.create;const j=Ve(mt()),be=k({id:b(),name:h(),slug:h().optional()}).passthrough(),de=k({url:h(),is_official:oe()}),ve=k({task_id:b(),dataset_id:b(),model_name:h().nullish(),harness:h().nullish(),methodology:h().nullish(),metrics:Ve(_t([h(),b()])),uses_additional_data:oe().optional(),is_open:oe().optional(),best_rank:b().nullish(),best_metric:h().nullish(),evaluated_on:h().nullish(),external_source_url:h().nullish(),num_parameters:b().nullish(),hf_model_url:h().nullish()}).passthrough(),yt=ve.partial().extend({id:b().optional()}),gt=Me("op",[k({op:G("create"),data:ve}),k({op:G("update"),evaluation_id:b(),data:ve}),k({op:G("delete"),evaluation_id:b()})]),Ee=k({hf_models:T(h()),hf_datasets:T(h()),hf_spaces:T(h())}),ze=k({file_name:h(),mime_type:h(),data_url:h().optional(),url:h().optional()}),Y=k({name:h(),description:h().optional()}),vt=Y.extend({image:ze.optional(),image_credit:h().optional(),parent_id:b().optional(),area_id:b().optional(),keywords:h().optional()}),xt=Y.extend({image:ze.optional(),image_credit:h().optional(),source_paper_id:b().optional(),source_url:h().optional(),source_title:h().optional()}),kt=Y.extend({description:h(),task_ids:T(b()),full_name:h().optional(),url:h().optional(),hf_url:h().optional(),paper_url:h().optional(),license_name:h().optional(),license_url:h().optional()}),bt=Y.extend({description:h(),direction:ge(["higher_is_better","lower_is_better"]),full_name:h().optional(),scale:h().optional(),task_id:b(),dataset_id:b()}),wt=Y.extend({short_name:h().optional(),venue:h().optional(),location:h().optional(),url:h(),year:b(),start_date:h().optional(),end_date:h().optional()}),Tt=k({id:b(),paper_id:b().nullable(),hf_username:h(),is_author:oe(),status:ge(["pending","approved","rejected"]),applied_payload:j.nullish(),conflict_payload:j.nullish(),result_entity_type:h().nullish(),result_entity_id:h().nullish(),admin_note:h().nullish(),user_review_reason:h().nullish(),reviewed_by:h().nullish(),reviewed_by_kind:ge(["human","codex"]).nullish(),review_evidence:j.nullish(),created_at:h(),updated_at:h(),reviewed_at:h().nullish()});function C(s,e,t){return Tt.extend({edit_type:G(s),proposed_payload:e,current_payload:t.nullish()})}const St=C("tasks",k({task_ids:T(b())}),k({tasks:T(be)})),Ct=C("methods",k({method_ids:T(b())}),k({methods:T(be)})),Ot=C("evaluations",k({operations:T(gt)}),k({evaluations:T(yt)})),Nt=C("repositories",k({repositories:T(de)}),k({repositories:T(de)})),At=C("project_pages",k({project_pages:T(de)}),k({project_pages:T(de)})),Zt=C("source_url",k({source_url:h()}),k({source_url:h().nullish()})),Rt=C("hf_artifacts",Ee,Ee),Et=C("organizations",k({organization_ids:T(b())}),k({organizations:T(be)})),jt=C("new_task",vt,j),It=C("new_method",xt,j),$t=C("new_benchmark",kt,j),Pt=C("new_metric",bt,j),Mt=C("new_conference",wt,j),Vt=C("new_external_paper",k({title:h().optional(),source_url:h(),authors:T(h()),date_published:h().optional(),abstract:h().optional()}),j),Le=Me("edit_type",[St,Ct,Ot,Nt,At,Zt,Rt,Et,jt,It,$t,Pt,Mt,Vt]);function qt(s,e,t){return{paper_id:s,edit_type:e,proposed_payload:t}}const zt=k({count:b(),results:T(Le)});class Lt extends Error{constructor(e){super(`Malformed pending-edit payload: ${e}`),this.name="PendingEditPayloadError"}}function De(s,e){const t=s.safeParse(e);if(t.success)return t.data;const r=t.error.issues[0];throw new Lt(`${(r==null?void 0:r.path.join("."))||"response"}: ${(r==null?void 0:r.message)||"invalid value"}`)}const H=s=>De(Le,s),Dt=s=>De(zt,s);class Ut{constructor(e){this.request=e}async submit(e){return H(await this.request("/me/paper-edits",{method:"POST",body:JSON.stringify(e)}))}list(e){const t=new URLSearchParams;for(const[n,a]of Object.entries(e??{}))a!==void 0&&t.set(n,String(a));const r=t.toString();return this.request(`/admin/paper-edits${r?`?${r}`:""}`).then(Dt)}async get(e){return H(await this.request(`/admin/paper-edits/${e}`))}async approve(e,t={}){return H(await this.request(`/admin/paper-edits/${e}/approve`,{method:"POST",body:JSON.stringify(t)}))}async reject(e,t={}){return H(await this.request(`/admin/paper-edits/${e}/reject`,{method:"POST",body:JSON.stringify(t)}))}}const Ft=new Ut(Be);export{qt as p,Ft as s}; diff --git a/assets/submissions-C1hG3qlt.js b/assets/submissions-C1hG3qlt.js deleted file mode 100644 index 24133756865f87c581f72f55eeed515d4add1ee0..0000000000000000000000000000000000000000 --- a/assets/submissions-C1hG3qlt.js +++ /dev/null @@ -1 +0,0 @@ -import{U as Be}from"./index-BrhBTT14.js";var v;(function(s){s.assertEqual=n=>{};function e(n){}s.assertIs=e;function t(n){throw new Error}s.assertNever=t,s.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},s.getValidEnumValues=n=>{const a=s.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return s.objectValues(i)},s.objectValues=n=>s.objectKeys(n).map(function(a){return n[a]}),s.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},s.find=(n,a)=>{for(const i of n)if(a(i))return i},s.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function r(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}s.joinValues=r,s.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));var we;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(we||(we={}));const u=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$=s=>{switch(typeof s){case"undefined":return u.undefined;case"string":return u.string;case"number":return Number.isNaN(s)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(s)?u.array:s===null?u.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?u.promise:typeof Map<"u"&&s instanceof Map?u.map:typeof Set<"u"&&s instanceof Set?u.set:typeof Date<"u"&&s instanceof Date?u.date:u.object;default:return u.unknown}},d=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class I extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},r={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let o=r,f=0;for(;ft.message){const t={},r=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}I.create=s=>new I(s);const ue=(s,e)=>{let t;switch(s.code){case d.invalid_type:s.received===u.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,v.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${v.joinValues(s.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${v.joinValues(s.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${v.joinValues(s.options)}, received '${s.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:v.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case d.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case d.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,v.assertNever(s)}return{message:t}};let qe=ue;function Fe(){return qe}const We=s=>{const{data:e,path:t,errorMaps:r,issueData:n}=s,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const f=r.filter(p=>!!p).slice().reverse();for(const p of f)o=p(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}};function c(s,e){const t=Fe(),r=We({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===ue?void 0:ue].filter(n=>!!n)});s.common.issues.push(r)}class S{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const n of t){const a=await n.key,i=await n.value;r.push({key:a,value:i})}return S.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const m=Object.freeze({status:"aborted"}),F=s=>({status:"dirty",value:s}),O=s=>({status:"valid",value:s}),Te=s=>s.status==="aborted",Se=s=>s.status==="dirty",U=s=>s.status==="valid",Q=s=>typeof Promise<"u"&&s instanceof Promise;var l;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(l||(l={}));class A{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ce=(s,e)=>{if(U(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new I(s.common.issues);return this._error=t,this._error}}};function y(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:n}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{const{message:f}=s;return i.code==="invalid_enum_value"?{message:f??o.defaultError}:typeof o.data>"u"?{message:f??r??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:f??t??o.defaultError}},description:n}}class g{get description(){return this._def.description}_getType(e){return $(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Q(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Ce(r,n)}"~validate"(e){var r,n;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return U(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(n=(r=a==null?void 0:a.message)==null?void 0:r.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>U(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(Q(n)?n:Promise.resolve(n));return Ce(r,a)}refine(e,t){const r=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:d.custom,...r(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new z({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return E.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N.create(this)}promise(){return re.create(this,this._def)}or(e){return K.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new z({...y(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ne({...y(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new Pe({typeName:_.ZodBranded,type:this,...y(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ae({...y(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ke.create(this,e)}readonly(){return ie.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Je=/^c[^\s-]{8,}$/i,Ye=/^[0-9a-z]+$/,He=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ge=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Qe=/^[a-z0-9_-]{21}$/i,Xe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ke=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,et=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ce;const st=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,nt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,at=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,it=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ot=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,je="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dt=new RegExp(`^${je}$`);function Ie(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);const t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ct(s){return new RegExp(`^${Ie(s)}$`)}function ut(s){let e=`${je}T${Ie(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function lt(s,e){return!!((e==="v4"||!e)&&st.test(s)||(e==="v6"||!e)&&nt.test(s))}function ht(s,e){if(!Xe.test(s))return!1;try{const[t]=s.split(".");if(!t)return!1;const r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(r));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function ft(s,e){return!!((e==="v4"||!e)&&rt.test(s)||(e==="v6"||!e)&&at.test(s))}class R extends g{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_type,expected:u.string,received:a.parsedType}),m}const r=new S;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.lengthe.test(n),{validation:t,code:d.invalid_string,...l.errToObj(r)})}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...l.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...l.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...l.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...l.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...l.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...l.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...l.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...l.errToObj(t)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new R({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew R({checks:[],typeName:_.ZodString,coerce:(s==null?void 0:s.coerce)??!1,...y(s)});function pt(s,e){const t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,n=t>r?t:r,a=Number.parseInt(s.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}class B extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==u.number){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_type,expected:u.number,received:a.parsedType}),m}let r;const n=new S;for(const a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.dataa.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?pt(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:d.not_finite,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,r,n){return new B({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:l.toString(n)}]})}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&v.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.valuenew B({checks:[],typeName:_.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...y(s)});class W extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==u.bigint)return this._getInvalidInput(e);let r;const n=new S;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.dataa.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:u.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,r,n){return new W({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:l.toString(n)}]})}_addCheck(e){return new W({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew W({checks:[],typeName:_.ZodBigInt,coerce:(s==null?void 0:s.coerce)??!1,...y(s)});class le extends g{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.boolean,received:r.parsedType}),m}return O(e.data)}}le.create=s=>new le({typeName:_.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...y(s)});class X extends g{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_type,expected:u.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_date}),m}const r=new S;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):v.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new X({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:l.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew X({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:_.ZodDate,...y(s)});class Oe extends g{_parse(e){if(this._getType(e)!==u.symbol){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.symbol,received:r.parsedType}),m}return O(e.data)}}Oe.create=s=>new Oe({typeName:_.ZodSymbol,...y(s)});class he extends g{_parse(e){if(this._getType(e)!==u.undefined){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.undefined,received:r.parsedType}),m}return O(e.data)}}he.create=s=>new he({typeName:_.ZodUndefined,...y(s)});class fe extends g{_parse(e){if(this._getType(e)!==u.null){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.null,received:r.parsedType}),m}return O(e.data)}}fe.create=s=>new fe({typeName:_.ZodNull,...y(s)});class Ne extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}}Ne.create=s=>new Ne({typeName:_.ZodAny,...y(s)});class pe extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}}pe.create=s=>new pe({typeName:_.ZodUnknown,...y(s)});class P extends g{_parse(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:u.never,received:t.parsedType}),m}}P.create=s=>new P({typeName:_.ZodNever,...y(s)});class Ae extends g{_parse(e){if(this._getType(e)!==u.undefined){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.void,received:r.parsedType}),m}return O(e.data)}}Ae.create=s=>new Ae({typeName:_.ZodVoid,...y(s)});class N extends g{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==u.array)return c(t,{code:d.invalid_type,expected:u.array,received:t.parsedType}),m;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.lengthn.maxLength.value&&(c(t,{code:d.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new A(t,i,t.path,o)))).then(i=>S.mergeArray(r,i));const a=[...t.data].map((i,o)=>n.type._parseSync(new A(t,i,t.path,o)));return S.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new N({...this._def,minLength:{value:e,message:l.toString(t)}})}max(e,t){return new N({...this._def,maxLength:{value:e,message:l.toString(t)}})}length(e,t){return new N({...this._def,exactLength:{value:e,message:l.toString(t)}})}nonempty(e){return this.min(1,e)}}N.create=(s,e)=>new N({type:s,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...y(e)});function D(s){if(s instanceof w){const e={};for(const t in s.shape){const r=s.shape[t];e[t]=E.create(D(r))}return new w({...s._def,shape:()=>e})}else return s instanceof N?new N({...s._def,type:D(s.element)}):s instanceof E?E.create(D(s.unwrap())):s instanceof L?L.create(D(s.unwrap())):s instanceof M?M.create(s.items.map(e=>D(e))):s}class w extends g{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.object){const p=this._getOrReturnCtx(e);return c(p,{code:d.invalid_type,expected:u.object,received:p.parsedType}),m}const{status:r,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof P&&this._def.unknownKeys==="strip"))for(const p in n.data)i.includes(p)||o.push(p);const f=[];for(const p of i){const x=a[p],q=n.data[p];f.push({key:{status:"valid",value:p},value:x._parse(new A(n,q,n.path,p)),alwaysSet:p in n.data})}if(this._def.catchall instanceof P){const p=this._def.unknownKeys;if(p==="passthrough")for(const x of o)f.push({key:{status:"valid",value:x},value:{status:"valid",value:n.data[x]}});else if(p==="strict")o.length>0&&(c(n,{code:d.unrecognized_keys,keys:o}),r.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const x of o){const q=n.data[x];f.push({key:{status:"valid",value:x},value:p._parse(new A(n,q,n.path,x)),alwaysSet:x in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const p=[];for(const x of f){const q=await x.key,Ue=await x.value;p.push({key:q,value:Ue,alwaysSet:x.alwaysSet})}return p}).then(p=>S.mergeObjectSync(r,p)):S.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new w({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var a,i;const n=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,r).message)??r.defaultError;return t.code==="unrecognized_keys"?{message:l.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new w({...this._def,unknownKeys:"strip"})}passthrough(){return new w({...this._def,unknownKeys:"passthrough"})}extend(e){return new w({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new w({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new w({...this._def,catchall:e})}pick(e){const t={};for(const r of v.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new w({...this._def,shape:()=>t})}omit(e){const t={};for(const r of v.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new w({...this._def,shape:()=>t})}deepPartial(){return D(this)}partial(e){const t={};for(const r of v.objectKeys(this.shape)){const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new w({...this._def,shape:()=>t})}required(e){const t={};for(const r of v.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof E;)a=a._def.innerType;t[r]=a}return new w({...this._def,shape:()=>t})}keyof(){return $e(v.objectKeys(this.shape))}}w.create=(s,e)=>new w({shape:()=>s,unknownKeys:"strip",catchall:P.create(),typeName:_.ZodObject,...y(e)});w.strictCreate=(s,e)=>new w({shape:()=>s,unknownKeys:"strict",catchall:P.create(),typeName:_.ZodObject,...y(e)});w.lazycreate=(s,e)=>new w({shape:s,unknownKeys:"strip",catchall:P.create(),typeName:_.ZodObject,...y(e)});class K extends g{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new I(o.ctx.common.issues));return c(t,{code:d.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(r.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const f of r){const p={...t,common:{...t.common,issues:[]},parent:null},x=f._parseSync({data:t.data,path:t.path,parent:p});if(x.status==="valid")return x;x.status==="dirty"&&!a&&(a={result:x,ctx:p}),p.common.issues.length&&i.push(p.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(f=>new I(f));return c(t,{code:d.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}}K.create=(s,e)=>new K({options:s,typeName:_.ZodUnion,...y(e)});const Z=s=>s instanceof _e?Z(s.schema):s instanceof z?Z(s.innerType()):s instanceof se?[s.value]:s instanceof V?s.options:s instanceof ye?v.objectValues(s.enum):s instanceof ne?Z(s._def.innerType):s instanceof he?[void 0]:s instanceof fe?[null]:s instanceof E?[void 0,...Z(s.unwrap())]:s instanceof L?[null,...Z(s.unwrap())]:s instanceof Pe||s instanceof ie?Z(s.unwrap()):s instanceof ae?Z(s._def.innerType):[];class xe extends g{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.object)return c(t,{code:d.invalid_type,expected:u.object,received:t.parsedType}),m;const r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(c(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const a of t){const i=Z(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new xe({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...y(r)})}}function me(s,e){const t=$(s),r=$(e);if(s===e)return{valid:!0,data:s};if(t===u.object&&r===u.object){const n=v.objectKeys(e),a=v.objectKeys(s).filter(o=>n.indexOf(o)!==-1),i={...s,...e};for(const o of a){const f=me(s[o],e[o]);if(!f.valid)return{valid:!1};i[o]=f.data}return{valid:!0,data:i}}else if(t===u.array&&r===u.array){if(s.length!==e.length)return{valid:!1};const n=[];for(let a=0;a{if(Te(a)||Te(i))return m;const o=me(a.value,i.value);return o.valid?((Se(a)||Se(i))&&t.dirty(),{status:t.value,value:o.data}):(c(r,{code:d.invalid_intersection_types}),m)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ee.create=(s,e,t)=>new ee({left:s,right:e,typeName:_.ZodIntersection,...y(t)});class M extends g{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.array)return c(r,{code:d.invalid_type,expected:u.array,received:r.parsedType}),m;if(r.data.lengththis._def.items.length&&(c(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...r.data].map((i,o)=>{const f=this._def.items[o]||this._def.rest;return f?f._parse(new A(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>S.mergeArray(t,i)):S.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new M({...this._def,rest:e})}}M.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new M({items:s,typeName:_.ZodTuple,rest:null,...y(e)})};class te extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.object)return c(r,{code:d.invalid_type,expected:u.object,received:r.parsedType}),m;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)n.push({key:a._parse(new A(r,o,r.path,o)),value:i._parse(new A(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?S.mergeObjectAsync(t,n):S.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof g?new te({keyType:e,valueType:t,typeName:_.ZodRecord,...y(r)}):new te({keyType:R.create(),valueType:e,typeName:_.ZodRecord,...y(t)})}}class Ze extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.map)return c(r,{code:d.invalid_type,expected:u.map,received:r.parsedType}),m;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,f],p)=>({key:n._parse(new A(r,o,r.path,[p,"key"])),value:a._parse(new A(r,f,r.path,[p,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const f of i){const p=await f.key,x=await f.value;if(p.status==="aborted"||x.status==="aborted")return m;(p.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(p.value,x.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const f of i){const p=f.key,x=f.value;if(p.status==="aborted"||x.status==="aborted")return m;(p.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(p.value,x.value)}return{status:t.value,value:o}}}}Ze.create=(s,e,t)=>new Ze({valueType:e,keyType:s,typeName:_.ZodMap,...y(t)});class J extends g{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.set)return c(r,{code:d.invalid_type,expected:u.set,received:r.parsedType}),m;const n=this._def;n.minSize!==null&&r.data.sizen.maxSize.value&&(c(r,{code:d.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(f){const p=new Set;for(const x of f){if(x.status==="aborted")return m;x.status==="dirty"&&t.dirty(),p.add(x.value)}return{status:t.value,value:p}}const o=[...r.data.values()].map((f,p)=>a._parse(new A(r,f,r.path,p)));return r.common.async?Promise.all(o).then(f=>i(f)):i(o)}min(e,t){return new J({...this._def,minSize:{value:e,message:l.toString(t)}})}max(e,t){return new J({...this._def,maxSize:{value:e,message:l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}J.create=(s,e)=>new J({valueType:s,minSize:null,maxSize:null,typeName:_.ZodSet,...y(e)});class _e extends g{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}_e.create=(s,e)=>new _e({getter:s,typeName:_.ZodLazy,...y(e)});class se extends g{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return c(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}se.create=(s,e)=>new se({value:s,typeName:_.ZodLiteral,...y(e)});function $e(s,e){return new V({values:s,typeName:_.ZodEnum,...y(e)})}class V extends g{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return c(t,{expected:v.joinValues(r),received:t.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return c(t,{received:t.data,code:d.invalid_enum_value,options:r}),m}return O(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return V.create(e,{...this._def,...t})}exclude(e,t=this._def){return V.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}V.create=$e;class ye extends g{_parse(e){const t=v.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==u.string&&r.parsedType!==u.number){const n=v.objectValues(t);return c(r,{expected:v.joinValues(n),received:r.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=v.objectValues(t);return c(r,{received:r.data,code:d.invalid_enum_value,options:n}),m}return O(e.data)}get enum(){return this._def.values}}ye.create=(s,e)=>new ye({values:s,typeName:_.ZodNativeEnum,...y(e)});class re extends g{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return c(t,{code:d.invalid_type,expected:u.promise,received:t.parsedType}),m;const r=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return O(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}re.create=(s,e)=>new re({type:s,typeName:_.ZodPromise,...y(e)});class z extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{c(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return m;const f=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return f.status==="aborted"?m:f.status==="dirty"||t.value==="dirty"?F(f.value):f});{if(t.value==="aborted")return m;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?m:o.status==="dirty"||t.value==="dirty"?F(o.value):o}}if(n.type==="refinement"){const i=o=>{const f=n.refinement(o,a);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!U(i))return m;const o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>U(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):m);v.assertNever(n)}}z.create=(s,e,t)=>new z({schema:s,typeName:_.ZodEffects,effect:e,...y(t)});z.createWithPreprocess=(s,e,t)=>new z({schema:e,effect:{type:"preprocess",transform:s},typeName:_.ZodEffects,...y(t)});class E extends g{_parse(e){return this._getType(e)===u.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}E.create=(s,e)=>new E({innerType:s,typeName:_.ZodOptional,...y(e)});class L extends g{_parse(e){return this._getType(e)===u.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}L.create=(s,e)=>new L({innerType:s,typeName:_.ZodNullable,...y(e)});class ne extends g{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===u.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ne.create=(s,e)=>new ne({innerType:s,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});class ae extends g{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Q(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ae.create=(s,e)=>new ae({innerType:s,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});class Re extends g{_parse(e){if(this._getType(e)!==u.nan){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.nan,received:r.parsedType}),m}return{status:"valid",value:e.data}}}Re.create=s=>new Re({typeName:_.ZodNaN,...y(s)});class Pe extends g{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ke extends g{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),F(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new ke({in:e,out:t,typeName:_.ZodPipeline})}}class ie extends g{_parse(e){const t=this._def.innerType._parse(e),r=n=>(U(n)&&(n.value=Object.freeze(n.value)),n);return Q(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}}ie.create=(s,e)=>new ie({innerType:s,typeName:_.ZodReadonly,...y(e)});var _;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(_||(_={}));const h=R.create,b=B.create,oe=le.create,mt=pe.create;P.create;const T=N.create,k=w.create,_t=K.create,Me=xe.create;ee.create;M.create;const Ve=te.create,G=se.create,ge=V.create;re.create;E.create;L.create;const j=Ve(mt()),be=k({id:b(),name:h(),slug:h().optional()}).passthrough(),de=k({url:h(),is_official:oe()}),ve=k({task_id:b(),dataset_id:b(),model_name:h().nullish(),harness:h().nullish(),methodology:h().nullish(),metrics:Ve(_t([h(),b()])),uses_additional_data:oe().optional(),is_open:oe().optional(),best_rank:b().nullish(),best_metric:h().nullish(),evaluated_on:h().nullish(),external_source_url:h().nullish(),num_parameters:b().nullish(),hf_model_url:h().nullish()}).passthrough(),yt=ve.partial().extend({id:b().optional()}),gt=Me("op",[k({op:G("create"),data:ve}),k({op:G("update"),evaluation_id:b(),data:ve}),k({op:G("delete"),evaluation_id:b()})]),Ee=k({hf_models:T(h()),hf_datasets:T(h()),hf_spaces:T(h())}),ze=k({file_name:h(),mime_type:h(),data_url:h().optional(),url:h().optional()}),Y=k({name:h(),description:h().optional()}),vt=Y.extend({image:ze.optional(),image_credit:h().optional(),parent_id:b().optional(),area_id:b().optional(),keywords:h().optional()}),xt=Y.extend({image:ze.optional(),image_credit:h().optional(),source_paper_id:b().optional(),source_url:h().optional(),source_title:h().optional()}),kt=Y.extend({description:h(),task_ids:T(b()),full_name:h().optional(),url:h().optional(),hf_url:h().optional(),paper_url:h().optional(),license_name:h().optional(),license_url:h().optional()}),bt=Y.extend({description:h(),direction:ge(["higher_is_better","lower_is_better"]),full_name:h().optional(),scale:h().optional(),task_id:b(),dataset_id:b()}),wt=Y.extend({short_name:h().optional(),venue:h().optional(),location:h().optional(),url:h(),year:b(),start_date:h().optional(),end_date:h().optional()}),Tt=k({id:b(),paper_id:b().nullable(),hf_username:h(),is_author:oe(),status:ge(["pending","approved","rejected"]),applied_payload:j.nullish(),conflict_payload:j.nullish(),result_entity_type:h().nullish(),result_entity_id:h().nullish(),admin_note:h().nullish(),user_review_reason:h().nullish(),reviewed_by:h().nullish(),reviewed_by_kind:ge(["human","codex"]).nullish(),review_evidence:j.nullish(),created_at:h(),updated_at:h(),reviewed_at:h().nullish()});function C(s,e,t){return Tt.extend({edit_type:G(s),proposed_payload:e,current_payload:t.nullish()})}const St=C("tasks",k({task_ids:T(b())}),k({tasks:T(be)})),Ct=C("methods",k({method_ids:T(b())}),k({methods:T(be)})),Ot=C("evaluations",k({operations:T(gt)}),k({evaluations:T(yt)})),Nt=C("repositories",k({repositories:T(de)}),k({repositories:T(de)})),At=C("project_pages",k({project_pages:T(de)}),k({project_pages:T(de)})),Zt=C("source_url",k({source_url:h()}),k({source_url:h().nullish()})),Rt=C("hf_artifacts",Ee,Ee),Et=C("organizations",k({organization_ids:T(b())}),k({organizations:T(be)})),jt=C("new_task",vt,j),It=C("new_method",xt,j),$t=C("new_benchmark",kt,j),Pt=C("new_metric",bt,j),Mt=C("new_conference",wt,j),Vt=C("new_external_paper",k({title:h().optional(),source_url:h(),authors:T(h()),date_published:h().optional(),abstract:h().optional()}),j),Le=Me("edit_type",[St,Ct,Ot,Nt,At,Zt,Rt,Et,jt,It,$t,Pt,Mt,Vt]);function qt(s,e,t){return{paper_id:s,edit_type:e,proposed_payload:t}}const zt=k({count:b(),results:T(Le)});class Lt extends Error{constructor(e){super(`Malformed pending-edit payload: ${e}`),this.name="PendingEditPayloadError"}}function De(s,e){const t=s.safeParse(e);if(t.success)return t.data;const r=t.error.issues[0];throw new Lt(`${(r==null?void 0:r.path.join("."))||"response"}: ${(r==null?void 0:r.message)||"invalid value"}`)}const H=s=>De(Le,s),Dt=s=>De(zt,s);class Ut{constructor(e){this.request=e}async submit(e){return H(await this.request("/me/paper-edits",{method:"POST",body:JSON.stringify(e)}))}list(e){const t=new URLSearchParams;for(const[n,a]of Object.entries(e??{}))a!==void 0&&t.set(n,String(a));const r=t.toString();return this.request(`/admin/paper-edits${r?`?${r}`:""}`).then(Dt)}async get(e){return H(await this.request(`/admin/paper-edits/${e}`))}async approve(e,t={}){return H(await this.request(`/admin/paper-edits/${e}/approve`,{method:"POST",body:JSON.stringify(t)}))}async reject(e,t={}){return H(await this.request(`/admin/paper-edits/${e}/reject`,{method:"POST",body:JSON.stringify(t)}))}}const Ft=new Ut(Be);export{qt as p,Ft as s}; diff --git a/assets/switch-DpBsrlqh.js b/assets/switch-giaX-T5P.js similarity index 50% rename from assets/switch-DpBsrlqh.js rename to assets/switch-giaX-T5P.js index c3e9e96b868f9377d4ac9acfb844413f4653da13..edb00b729f255e1200e066db3eb42153964beb4f 100644 --- a/assets/switch-DpBsrlqh.js +++ b/assets/switch-giaX-T5P.js @@ -1 +1 @@ -import{r as s,p as C,o as I,j as a,m as y,q as M,s as H,t as q,v as x}from"./index-BrhBTT14.js";import{u as A}from"./index-WJQaPd7m.js";var b="Switch",[U]=q(b),[z,L]=U(b),P=s.forwardRef((t,o)=>{const{__scopeSwitch:e,name:n,checked:r,defaultChecked:m,required:d,disabled:c,value:u="on",onCheckedChange:v,form:i,...w}=t,[l,p]=s.useState(null),S=C(o,h=>p(h)),k=s.useRef(!1),g=l?i||!!l.closest("form"):!0,[f,B]=I({prop:r,defaultProp:m??!1,onChange:v,caller:b});return a.jsxs(z,{scope:e,checked:f,disabled:c,children:[a.jsx(y.button,{type:"button",role:"switch","aria-checked":f,"aria-required":d,"data-state":j(f),"data-disabled":c?"":void 0,disabled:c,value:u,...w,ref:S,onClick:M(t.onClick,h=>{B(T=>!T),g&&(k.current=h.isPropagationStopped(),k.current||h.stopPropagation())})}),g&&a.jsx(N,{control:l,bubbles:!k.current,name:n,value:u,checked:f,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});P.displayName=b;var E="SwitchThumb",R=s.forwardRef((t,o)=>{const{__scopeSwitch:e,...n}=t,r=L(E,e);return a.jsx(y.span,{"data-state":j(r.checked),"data-disabled":r.disabled?"":void 0,...n,ref:o})});R.displayName=E;var O="SwitchBubbleInput",N=s.forwardRef(({__scopeSwitch:t,control:o,checked:e,bubbles:n=!0,...r},m)=>{const d=s.useRef(null),c=C(d,m),u=A(e),v=H(o);return s.useEffect(()=>{const i=d.current;if(!i)return;const w=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(w,"checked").set;if(u!==e&&p){const S=new Event("click",{bubbles:n});p.call(i,e),i.dispatchEvent(S)}},[u,e,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:e,...r,tabIndex:-1,ref:c,style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});N.displayName=O;function j(t){return t?"checked":"unchecked"}var _=P,D=R;const F=s.forwardRef(({className:t,...o},e)=>a.jsx(_,{className:x("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",t),...o,ref:e,children:a.jsx(D,{className:x("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));F.displayName=_.displayName;export{F as S}; +import{r as o,l as C,k as I,j as a,h as y,m as M,o as H,p as q,q as x}from"./index-D_-UZEuL.js";import{u as A}from"./index-DlwDDz8H.js";var b="Switch",[U]=q(b),[z,L]=U(b),P=o.forwardRef((t,s)=>{const{__scopeSwitch:e,name:n,checked:r,defaultChecked:m,required:d,disabled:c,value:l="on",onCheckedChange:v,form:i,...w}=t,[u,p]=o.useState(null),k=C(s,h=>p(h)),S=o.useRef(!1),g=u?i||!!u.closest("form"):!0,[f,B]=I({prop:r,defaultProp:m??!1,onChange:v,caller:b});return a.jsxs(z,{scope:e,checked:f,disabled:c,children:[a.jsx(y.button,{type:"button",role:"switch","aria-checked":f,"aria-required":d,"data-state":j(f),"data-disabled":c?"":void 0,disabled:c,value:l,...w,ref:k,onClick:M(t.onClick,h=>{B(T=>!T),g&&(S.current=h.isPropagationStopped(),S.current||h.stopPropagation())})}),g&&a.jsx(N,{control:u,bubbles:!S.current,name:n,value:l,checked:f,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});P.displayName=b;var E="SwitchThumb",R=o.forwardRef((t,s)=>{const{__scopeSwitch:e,...n}=t,r=L(E,e);return a.jsx(y.span,{"data-state":j(r.checked),"data-disabled":r.disabled?"":void 0,...n,ref:s})});R.displayName=E;var O="SwitchBubbleInput",N=o.forwardRef(({__scopeSwitch:t,control:s,checked:e,bubbles:n=!0,...r},m)=>{const d=o.useRef(null),c=C(d,m),l=A(e),v=H(s);return o.useEffect(()=>{const i=d.current;if(!i)return;const w=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(w,"checked").set;if(l!==e&&p){const k=new Event("click",{bubbles:n});p.call(i,e),i.dispatchEvent(k)}},[l,e,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:e,...r,tabIndex:-1,ref:c,style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});N.displayName=O;function j(t){return t?"checked":"unchecked"}var _=P,D=R;const F=o.forwardRef(({className:t,...s},e)=>a.jsx(_,{className:x("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",t),...s,ref:e,children:a.jsx(D,{className:x("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));F.displayName=_.displayName;export{F as S}; diff --git a/assets/textarea-D6mDqvzM.js b/assets/textarea-DlQmtN_E.js similarity index 93% rename from assets/textarea-D6mDqvzM.js rename to assets/textarea-DlQmtN_E.js index 9a5f6e7dc04505385765476a811af223a17a4dee..eb695dd30e8b6700c41c77d679d08d1338be6475 100644 --- a/assets/textarea-D6mDqvzM.js +++ b/assets/textarea-DlQmtN_E.js @@ -1 +1 @@ -import{r as s,j as i,v as t}from"./index-BrhBTT14.js";const a=s.forwardRef(({className:e,type:r,...o},n)=>i.jsx("input",{type:r,className:t("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...o}));a.displayName="Input";const d=s.forwardRef(({className:e,...r},o)=>i.jsx("textarea",{className:t("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...r}));d.displayName="Textarea";export{a as I,d as T}; +import{r as s,j as i,q as t}from"./index-D_-UZEuL.js";const a=s.forwardRef(({className:e,type:r,...o},n)=>i.jsx("input",{type:r,className:t("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...o}));a.displayName="Input";const d=s.forwardRef(({className:e,...r},o)=>i.jsx("textarea",{className:t("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...r}));d.displayName="Textarea";export{a as I,d as T}; diff --git a/assets/transform-Duf4Shfn.js b/assets/transform-CUuA-koJ.js similarity index 99% rename from assets/transform-Duf4Shfn.js rename to assets/transform-CUuA-koJ.js index 2429f99eb8e2270429520b373581fca5a14ce8ff..ddfd7663771365096c327414565ffb24ffa449b9 100644 --- a/assets/transform-Duf4Shfn.js +++ b/assets/transform-CUuA-koJ.js @@ -1 +1 @@ -import{N as _}from"./index-BrhBTT14.js";function pe(t){let e=2166136261;const n=t||"";for(let r=0;r=a.getTime()?n+1:e.getTime()>=o.getTime()?n:n-1}function F(t){const e=w(t);return e.setHours(0,0,0,0),e}function E(t){const e=w(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function J(t,e){const n=F(t),r=F(e),a=+n-E(n),i=+r-E(r);return Math.round((a-i)/z)}function K(t){const e=j(t),n=D(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),T(n)}function Z(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function tt(t){if(!Z(t)&&typeof t!="number")return!1;const e=w(t);return!isNaN(Number(e))}function et(t){const e=w(t),n=D(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}const nt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},rt=(t,e,n)=>{let r;const a=nt[t];return typeof a=="string"?r=a:e===1?r=a.one:r=a.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Y(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const at={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},it={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ot={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},st={date:Y({formats:at,defaultWidth:"full"}),time:Y({formats:it,defaultWidth:"full"}),dateTime:Y({formats:ot,defaultWidth:"full"})},ut={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ct=(t,e,n,r)=>ut[t];function O(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,s=n!=null&&n.width?String(n.width):o;a=t.formattingValues[s]||t.formattingValues[o]}else{const o=t.defaultWidth,s=n!=null&&n.width?String(n.width):t.defaultWidth;a=t.values[s]||t.values[o]}const i=t.argumentCallback?t.argumentCallback(e):e;return a[i]}}const dt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},lt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ft={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ht={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},mt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},gt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},wt=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},yt={ordinalNumber:wt,era:O({values:dt,defaultWidth:"wide"}),quarter:O({values:lt,defaultWidth:"wide",argumentCallback:t=>t-1}),month:O({values:ft,defaultWidth:"wide"}),day:O({values:ht,defaultWidth:"wide"}),dayPeriod:O({values:mt,defaultWidth:"wide",formattingValues:gt,defaultFormattingWidth:"wide"})};function P(t){return(e,n={})=>{const r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(a);if(!i)return null;const o=i[0],s=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],u=Array.isArray(s)?Dt(s,g=>g.test(o)):bt(s,g=>g.test(o));let d;d=t.valueCallback?t.valueCallback(u):u,d=n.valueCallback?n.valueCallback(d):d;const f=e.slice(o.length);return{value:d,rest:f}}}function bt(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Dt(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const a=r[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const s=e.slice(a.length);return{value:o,rest:s}}}const kt=/^(\d+)(th|st|nd|rd)?/i,Ot=/\d+/i,Pt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},pt={any:[/^b/i,/^(a|c)/i]},xt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},vt={any:[/1/i,/2/i,/3/i,/4/i]},Tt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},St={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Wt={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Yt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Nt={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ct={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},_t={ordinalNumber:Mt({matchPattern:kt,parsePattern:Ot,valueCallback:t=>parseInt(t,10)}),era:P({matchPatterns:Pt,defaultMatchWidth:"wide",parsePatterns:pt,defaultParseWidth:"any"}),quarter:P({matchPatterns:xt,defaultMatchWidth:"wide",parsePatterns:vt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:P({matchPatterns:Tt,defaultMatchWidth:"wide",parsePatterns:St,defaultParseWidth:"any"}),day:P({matchPatterns:Wt,defaultMatchWidth:"wide",parsePatterns:Yt,defaultParseWidth:"any"}),dayPeriod:P({matchPatterns:Nt,defaultMatchWidth:"any",parsePatterns:Ct,defaultParseWidth:"any"})},Ft={code:"en-US",formatDistance:rt,formatLong:st,formatRelative:ct,localize:yt,match:_t,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Et(t){const e=w(t);return J(e,et(e))+1}function qt(t){const e=w(t),n=+T(e)-+K(e);return Math.round(n/I)+1}function Q(t,e){var f,g,l,k;const n=w(t),r=n.getFullYear(),a=S(),i=(e==null?void 0:e.firstWeekContainsDate)??((g=(f=e==null?void 0:e.locale)==null?void 0:f.options)==null?void 0:g.firstWeekContainsDate)??a.firstWeekContainsDate??((k=(l=a.locale)==null?void 0:l.options)==null?void 0:k.firstWeekContainsDate)??1,o=D(t,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const s=x(o,e),u=D(t,0);u.setFullYear(r,0,i),u.setHours(0,0,0,0);const d=x(u,e);return n.getTime()>=s.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function Lt(t,e){var s,u,d,f;const n=S(),r=(e==null?void 0:e.firstWeekContainsDate)??((u=(s=e==null?void 0:e.locale)==null?void 0:s.options)==null?void 0:u.firstWeekContainsDate)??n.firstWeekContainsDate??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??1,a=Q(t,e),i=D(t,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),x(i,e)}function Ut(t,e){const n=w(t),r=+x(n,e)-+Lt(n,e);return Math.round(r/I)+1}function c(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const y={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return c(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):c(n+1,2)},d(t,e){return c(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return c(t.getHours()%12||12,e.length)},H(t,e){return c(t.getHours(),e.length)},m(t,e){return c(t.getMinutes(),e.length)},s(t,e){return c(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return c(a,e.length)}},M={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},q={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return y.y(t,e)},Y:function(t,e,n,r){const a=Q(t,r),i=a>0?a:1-a;if(e==="YY"){const o=i%100;return c(o,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):c(i,e.length)},R:function(t,e){const n=j(t);return c(n,e.length)},u:function(t,e){const n=t.getFullYear();return c(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return c(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return c(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return y.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return c(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const a=Ut(t,r);return e==="wo"?n.ordinalNumber(a,{unit:"week"}):c(a,e.length)},I:function(t,e,n){const r=qt(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):c(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):y.d(t,e)},D:function(t,e,n){const r=Et(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):c(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const a=t.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return c(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const a=t.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return c(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),a=r===0?7:r;switch(e){case"i":return String(a);case"ii":return c(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const a=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let a;switch(r===12?a=M.noon:r===0?a=M.midnight:a=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let a;switch(r>=17?a=M.evening:r>=12?a=M.afternoon:r>=4?a=M.morning:a=M.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return y.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):y.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):c(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):c(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):y.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):y.s(t,e)},S:function(t,e){return y.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return U(r);case"XXXX":case"XX":return b(r);case"XXXXX":case"XXX":default:return b(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return U(r);case"xxxx":case"xx":return b(r);case"xxxxx":case"xxx":default:return b(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+L(r,":");case"OOOO":default:return"GMT"+b(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+L(r,":");case"zzzz":default:return"GMT"+b(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return c(r,e.length)},T:function(t,e,n){const r=t.getTime();return c(r,e.length)}};function L(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=Math.trunc(r/60),i=r%60;return i===0?n+String(a):n+String(a)+e+c(i,2)}function U(t,e){return t%60===0?(t>0?"-":"+")+c(Math.abs(t)/60,2):b(t,e)}function b(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=c(Math.trunc(r/60),2),i=c(r%60,2);return n+a+e+i}const H=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},X=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Ht=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return H(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",H(r,e)).replace("{{time}}",X(a,e))},It={p:X,P:Ht},Rt=/^D+$/,At=/^Y+$/,jt=["D","DD","YY","YYYY"];function Qt(t){return Rt.test(t)}function Xt(t){return At.test(t)}function Bt(t,e,n){const r=Gt(t,e,n);if(console.warn(r),jt.includes(t))throw new RangeError(r)}function Gt(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const $t=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,zt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Vt=/^'([^]*?)'?$/,Jt=/''/g,Kt=/[a-zA-Z]/;function Zt(t,e,n){var f,g,l,k;const r=S(),a=r.locale??Ft,i=r.firstWeekContainsDate??((g=(f=r.locale)==null?void 0:f.options)==null?void 0:g.firstWeekContainsDate)??1,o=r.weekStartsOn??((k=(l=r.locale)==null?void 0:l.options)==null?void 0:k.weekStartsOn)??0,s=w(t);if(!tt(s))throw new RangeError("Invalid time value");let u=e.match(zt).map(m=>{const h=m[0];if(h==="p"||h==="P"){const W=It[h];return W(m,a.formatLong)}return m}).join("").match($t).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const h=m[0];if(h==="'")return{isToken:!1,value:te(m)};if(q[h])return{isToken:!0,value:m};if(h.match(Kt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:m}});a.localize.preprocessor&&(u=a.localize.preprocessor(s,u));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return u.map(m=>{if(!m.isToken)return m.value;const h=m.value;(Xt(h)||Qt(h))&&Bt(h,e,String(t));const W=q[h[0]];return W(s,h,a.localize,d)}).join("")}function te(t){const e=t.match(Vt);return e?e[1].replace(Jt,"'"):t}function B(t,e){const r=ae(t);let a;if(r.date){const u=ie(r.date,2);a=oe(u.restDateString,u.year)}if(!a||isNaN(a.getTime()))return new Date(NaN);const i=a.getTime();let o=0,s;if(r.time&&(o=se(r.time),isNaN(o)))return new Date(NaN);if(r.timezone){if(s=ue(r.timezone),isNaN(s))return new Date(NaN)}else{const u=new Date(i+o),d=new Date(0);return d.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),d.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),d}return new Date(i+o+s)}const v={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},ee=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ne=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,re=/^([+-])(\d{2})(?::?(\d{2}))?$/;function ae(t){const e={},n=t.split(v.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],v.timeZoneDelimiter.test(e.date)&&(e.date=t.split(v.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const a=v.timezone.exec(r);a?(e.time=r.replace(a[1],""),e.timezone=a[1]):e.time=r}return e}function ie(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const a=r[1]?parseInt(r[1]):null,i=r[2]?parseInt(r[2]):null;return{year:i===null?a:i*100,restDateString:t.slice((r[1]||r[2]).length)}}function oe(t,e){if(e===null)return new Date(NaN);const n=t.match(ee);if(!n)return new Date(NaN);const r=!!n[4],a=p(n[1]),i=p(n[2])-1,o=p(n[3]),s=p(n[4]),u=p(n[5])-1;if(r)return he(e,s,u)?ce(e,s,u):new Date(NaN);{const d=new Date(0);return!le(e,i,o)||!fe(e,a)?new Date(NaN):(d.setUTCFullYear(e,i,Math.max(a,o)),d)}}function p(t){return t?parseInt(t):1}function se(t){const e=t.match(ne);if(!e)return NaN;const n=N(e[1]),r=N(e[2]),a=N(e[3]);return me(n,r,a)?n*A+r*R+a*1e3:NaN}function N(t){return t&&parseFloat(t.replace(",","."))||0}function ue(t){if(t==="Z")return 0;const e=t.match(re);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return ge(r,a)?n*(r*A+a*R):NaN}function ce(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const a=r.getUTCDay()||7,i=(e-1)*7+n+1-a;return r.setUTCDate(r.getUTCDate()+i),r}const de=[31,null,31,30,31,30,31,31,30,31,30,31];function G(t){return t%400===0||t%4===0&&t%100!==0}function le(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(de[e]||(G(t)?29:28))}function fe(t,e){return e>=1&&e<=(G(t)?366:365)}function he(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function me(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function ge(t,e){return e>=0&&e<=59}const we={model:"models",dataset:"datasets",space:"spaces"};function ye(t){const e=t.hf_artifact_summary;return!e||!e.best_kind||!e.best_url||e.best_count<=0?{hfKind:null,hfCount:0,hfUrl:null}:{hfKind:we[e.best_kind]??null,hfCount:e.best_count,hfUrl:e.best_url}}function be(t){if(!t||t.length===0)return{github:null,githubUrl:null,velocity24h:null};const e=t.filter(a=>a.is_official),r=[...e.length>0?e:t].sort((a,i)=>(i.num_stars||0)-(a.num_stars||0))[0];return{github:r&&r.num_stars>0?r.num_stars:null,githubUrl:(r==null?void 0:r.url)||null,velocity24h:(r==null?void 0:r.trending_score)??null}}function De(t){if(!t)return null;try{const e=typeof t=="string"?B(t):t;return Zt(e,"MMM d, yyyy")}catch{return null}}function Me(t){if(!t)return null;try{return B(t).getFullYear()}catch{return null}}function ve(t){var f,g;const{github:e,githubUrl:n,velocity24h:r}=be(t.repositories),{hfKind:a,hfCount:i,hfUrl:o}=ye(t),s=(t.tasks||[]).map(l=>l.slug||"").filter(Boolean),u=(t.methods||[]).map(l=>({id:l.id,name:l.name,slug:l.slug})),d=(t.leaderboard_ranks||[]).filter(l=>l.best_rank>=1&&l.best_rank<=3).map(l=>({name:l.dataset_name,slug:l.dataset_slug||null,rank:l.best_rank}));return{id:t.arxiv_id||t.id,dbId:t.id,title:t.title,abstract:t.abstract||"",authors:t.authors||[],tags:s,methods:u,organizations:(t.organizations||[]).map(l=>({name:l.name,slug:l.slug,logoUrl:_(l.logo_url)||null})),citations:t.citation_count||0,github:e,githubUrl:n,project:((g=(f=t.project_pages)==null?void 0:f[0])==null?void 0:g.url)||null,date:De(t.published),publishedIso:t.published||null,year:Me(t.published),thumbnailUrl:_(t.thumbnail_url)||null,tldr:t.tldr||null,version:t.version||"v1",velocity24h:r,hfKind:a,hfCount:i,hfUrl:o,sotaRanks:d}}function ke(t){const e=$.get(t.toLowerCase());if(e)return e;const n=t.toUpperCase();return C.has(n)?n:t.replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase())}const C=new Set(["OCR"]),$=new Map([["3d-tracking","3D Tracking"],["point-tracking","2D Point Tracking"],["3d-generation","3D generation"],["3d-understanding","3D understanding"],["3d-semantic-segmentation","3D semantic segmentation"],["3d-instance-segmentation","3D instance segmentation"],["3d-object-detection","3D object detection"],["text-to-sql","Text-to-SQL"]]);function Te(t,e){const n=t||ke(e||""),r=$.get((e==null?void 0:e.toLowerCase())||Oe(n));if(r)return r;const a=e==null?void 0:e.toUpperCase(),i=n.toUpperCase();return/^[A-Z0-9][A-Z0-9-]{1,}$/.test(n)||a&&C.has(a)||C.has(i)?i:n.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase())}function Oe(t){return t.trim().toLowerCase().replace(/[\s_]+/g,"-")}export{ke as a,xe as c,Te as d,pe as h,be as s,ve as t}; +import{M as _}from"./index-D_-UZEuL.js";function pe(t){let e=2166136261;const n=t||"";for(let r=0;r=a.getTime()?n+1:e.getTime()>=o.getTime()?n:n-1}function F(t){const e=w(t);return e.setHours(0,0,0,0),e}function E(t){const e=w(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function J(t,e){const n=F(t),r=F(e),a=+n-E(n),i=+r-E(r);return Math.round((a-i)/z)}function K(t){const e=j(t),n=D(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),T(n)}function Z(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function tt(t){if(!Z(t)&&typeof t!="number")return!1;const e=w(t);return!isNaN(Number(e))}function et(t){const e=w(t),n=D(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}const nt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},rt=(t,e,n)=>{let r;const a=nt[t];return typeof a=="string"?r=a:e===1?r=a.one:r=a.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Y(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const at={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},it={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ot={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},st={date:Y({formats:at,defaultWidth:"full"}),time:Y({formats:it,defaultWidth:"full"}),dateTime:Y({formats:ot,defaultWidth:"full"})},ut={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ct=(t,e,n,r)=>ut[t];function O(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,s=n!=null&&n.width?String(n.width):o;a=t.formattingValues[s]||t.formattingValues[o]}else{const o=t.defaultWidth,s=n!=null&&n.width?String(n.width):t.defaultWidth;a=t.values[s]||t.values[o]}const i=t.argumentCallback?t.argumentCallback(e):e;return a[i]}}const dt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},lt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ft={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ht={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},mt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},gt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},wt=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},yt={ordinalNumber:wt,era:O({values:dt,defaultWidth:"wide"}),quarter:O({values:lt,defaultWidth:"wide",argumentCallback:t=>t-1}),month:O({values:ft,defaultWidth:"wide"}),day:O({values:ht,defaultWidth:"wide"}),dayPeriod:O({values:mt,defaultWidth:"wide",formattingValues:gt,defaultFormattingWidth:"wide"})};function P(t){return(e,n={})=>{const r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(a);if(!i)return null;const o=i[0],s=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],u=Array.isArray(s)?Dt(s,g=>g.test(o)):bt(s,g=>g.test(o));let d;d=t.valueCallback?t.valueCallback(u):u,d=n.valueCallback?n.valueCallback(d):d;const f=e.slice(o.length);return{value:d,rest:f}}}function bt(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Dt(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const a=r[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const s=e.slice(a.length);return{value:o,rest:s}}}const kt=/^(\d+)(th|st|nd|rd)?/i,Ot=/\d+/i,Pt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},pt={any:[/^b/i,/^(a|c)/i]},xt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},vt={any:[/1/i,/2/i,/3/i,/4/i]},Tt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},St={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Wt={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Yt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Nt={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ct={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},_t={ordinalNumber:Mt({matchPattern:kt,parsePattern:Ot,valueCallback:t=>parseInt(t,10)}),era:P({matchPatterns:Pt,defaultMatchWidth:"wide",parsePatterns:pt,defaultParseWidth:"any"}),quarter:P({matchPatterns:xt,defaultMatchWidth:"wide",parsePatterns:vt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:P({matchPatterns:Tt,defaultMatchWidth:"wide",parsePatterns:St,defaultParseWidth:"any"}),day:P({matchPatterns:Wt,defaultMatchWidth:"wide",parsePatterns:Yt,defaultParseWidth:"any"}),dayPeriod:P({matchPatterns:Nt,defaultMatchWidth:"any",parsePatterns:Ct,defaultParseWidth:"any"})},Ft={code:"en-US",formatDistance:rt,formatLong:st,formatRelative:ct,localize:yt,match:_t,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Et(t){const e=w(t);return J(e,et(e))+1}function qt(t){const e=w(t),n=+T(e)-+K(e);return Math.round(n/I)+1}function Q(t,e){var f,g,l,k;const n=w(t),r=n.getFullYear(),a=S(),i=(e==null?void 0:e.firstWeekContainsDate)??((g=(f=e==null?void 0:e.locale)==null?void 0:f.options)==null?void 0:g.firstWeekContainsDate)??a.firstWeekContainsDate??((k=(l=a.locale)==null?void 0:l.options)==null?void 0:k.firstWeekContainsDate)??1,o=D(t,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const s=x(o,e),u=D(t,0);u.setFullYear(r,0,i),u.setHours(0,0,0,0);const d=x(u,e);return n.getTime()>=s.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function Lt(t,e){var s,u,d,f;const n=S(),r=(e==null?void 0:e.firstWeekContainsDate)??((u=(s=e==null?void 0:e.locale)==null?void 0:s.options)==null?void 0:u.firstWeekContainsDate)??n.firstWeekContainsDate??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??1,a=Q(t,e),i=D(t,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),x(i,e)}function Ut(t,e){const n=w(t),r=+x(n,e)-+Lt(n,e);return Math.round(r/I)+1}function c(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const y={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return c(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):c(n+1,2)},d(t,e){return c(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return c(t.getHours()%12||12,e.length)},H(t,e){return c(t.getHours(),e.length)},m(t,e){return c(t.getMinutes(),e.length)},s(t,e){return c(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return c(a,e.length)}},M={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},q={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return y.y(t,e)},Y:function(t,e,n,r){const a=Q(t,r),i=a>0?a:1-a;if(e==="YY"){const o=i%100;return c(o,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):c(i,e.length)},R:function(t,e){const n=j(t);return c(n,e.length)},u:function(t,e){const n=t.getFullYear();return c(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return c(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return c(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return y.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return c(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const a=Ut(t,r);return e==="wo"?n.ordinalNumber(a,{unit:"week"}):c(a,e.length)},I:function(t,e,n){const r=qt(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):c(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):y.d(t,e)},D:function(t,e,n){const r=Et(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):c(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const a=t.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return c(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const a=t.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return c(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),a=r===0?7:r;switch(e){case"i":return String(a);case"ii":return c(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const a=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let a;switch(r===12?a=M.noon:r===0?a=M.midnight:a=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let a;switch(r>=17?a=M.evening:r>=12?a=M.afternoon:r>=4?a=M.morning:a=M.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return y.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):y.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):c(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):c(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):y.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):y.s(t,e)},S:function(t,e){return y.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return U(r);case"XXXX":case"XX":return b(r);case"XXXXX":case"XXX":default:return b(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return U(r);case"xxxx":case"xx":return b(r);case"xxxxx":case"xxx":default:return b(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+L(r,":");case"OOOO":default:return"GMT"+b(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+L(r,":");case"zzzz":default:return"GMT"+b(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return c(r,e.length)},T:function(t,e,n){const r=t.getTime();return c(r,e.length)}};function L(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=Math.trunc(r/60),i=r%60;return i===0?n+String(a):n+String(a)+e+c(i,2)}function U(t,e){return t%60===0?(t>0?"-":"+")+c(Math.abs(t)/60,2):b(t,e)}function b(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=c(Math.trunc(r/60),2),i=c(r%60,2);return n+a+e+i}const H=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},X=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Ht=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return H(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",H(r,e)).replace("{{time}}",X(a,e))},It={p:X,P:Ht},Rt=/^D+$/,At=/^Y+$/,jt=["D","DD","YY","YYYY"];function Qt(t){return Rt.test(t)}function Xt(t){return At.test(t)}function Bt(t,e,n){const r=Gt(t,e,n);if(console.warn(r),jt.includes(t))throw new RangeError(r)}function Gt(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const $t=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,zt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Vt=/^'([^]*?)'?$/,Jt=/''/g,Kt=/[a-zA-Z]/;function Zt(t,e,n){var f,g,l,k;const r=S(),a=r.locale??Ft,i=r.firstWeekContainsDate??((g=(f=r.locale)==null?void 0:f.options)==null?void 0:g.firstWeekContainsDate)??1,o=r.weekStartsOn??((k=(l=r.locale)==null?void 0:l.options)==null?void 0:k.weekStartsOn)??0,s=w(t);if(!tt(s))throw new RangeError("Invalid time value");let u=e.match(zt).map(m=>{const h=m[0];if(h==="p"||h==="P"){const W=It[h];return W(m,a.formatLong)}return m}).join("").match($t).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const h=m[0];if(h==="'")return{isToken:!1,value:te(m)};if(q[h])return{isToken:!0,value:m};if(h.match(Kt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:m}});a.localize.preprocessor&&(u=a.localize.preprocessor(s,u));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return u.map(m=>{if(!m.isToken)return m.value;const h=m.value;(Xt(h)||Qt(h))&&Bt(h,e,String(t));const W=q[h[0]];return W(s,h,a.localize,d)}).join("")}function te(t){const e=t.match(Vt);return e?e[1].replace(Jt,"'"):t}function B(t,e){const r=ae(t);let a;if(r.date){const u=ie(r.date,2);a=oe(u.restDateString,u.year)}if(!a||isNaN(a.getTime()))return new Date(NaN);const i=a.getTime();let o=0,s;if(r.time&&(o=se(r.time),isNaN(o)))return new Date(NaN);if(r.timezone){if(s=ue(r.timezone),isNaN(s))return new Date(NaN)}else{const u=new Date(i+o),d=new Date(0);return d.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),d.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),d}return new Date(i+o+s)}const v={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},ee=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ne=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,re=/^([+-])(\d{2})(?::?(\d{2}))?$/;function ae(t){const e={},n=t.split(v.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],v.timeZoneDelimiter.test(e.date)&&(e.date=t.split(v.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const a=v.timezone.exec(r);a?(e.time=r.replace(a[1],""),e.timezone=a[1]):e.time=r}return e}function ie(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const a=r[1]?parseInt(r[1]):null,i=r[2]?parseInt(r[2]):null;return{year:i===null?a:i*100,restDateString:t.slice((r[1]||r[2]).length)}}function oe(t,e){if(e===null)return new Date(NaN);const n=t.match(ee);if(!n)return new Date(NaN);const r=!!n[4],a=p(n[1]),i=p(n[2])-1,o=p(n[3]),s=p(n[4]),u=p(n[5])-1;if(r)return he(e,s,u)?ce(e,s,u):new Date(NaN);{const d=new Date(0);return!le(e,i,o)||!fe(e,a)?new Date(NaN):(d.setUTCFullYear(e,i,Math.max(a,o)),d)}}function p(t){return t?parseInt(t):1}function se(t){const e=t.match(ne);if(!e)return NaN;const n=N(e[1]),r=N(e[2]),a=N(e[3]);return me(n,r,a)?n*A+r*R+a*1e3:NaN}function N(t){return t&&parseFloat(t.replace(",","."))||0}function ue(t){if(t==="Z")return 0;const e=t.match(re);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return ge(r,a)?n*(r*A+a*R):NaN}function ce(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const a=r.getUTCDay()||7,i=(e-1)*7+n+1-a;return r.setUTCDate(r.getUTCDate()+i),r}const de=[31,null,31,30,31,30,31,31,30,31,30,31];function G(t){return t%400===0||t%4===0&&t%100!==0}function le(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(de[e]||(G(t)?29:28))}function fe(t,e){return e>=1&&e<=(G(t)?366:365)}function he(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function me(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function ge(t,e){return e>=0&&e<=59}const we={model:"models",dataset:"datasets",space:"spaces"};function ye(t){const e=t.hf_artifact_summary;return!e||!e.best_kind||!e.best_url||e.best_count<=0?{hfKind:null,hfCount:0,hfUrl:null}:{hfKind:we[e.best_kind]??null,hfCount:e.best_count,hfUrl:e.best_url}}function be(t){if(!t||t.length===0)return{github:null,githubUrl:null,velocity24h:null};const e=t.filter(a=>a.is_official),r=[...e.length>0?e:t].sort((a,i)=>(i.num_stars||0)-(a.num_stars||0))[0];return{github:r&&r.num_stars>0?r.num_stars:null,githubUrl:(r==null?void 0:r.url)||null,velocity24h:(r==null?void 0:r.trending_score)??null}}function De(t){if(!t)return null;try{const e=typeof t=="string"?B(t):t;return Zt(e,"MMM d, yyyy")}catch{return null}}function Me(t){if(!t)return null;try{return B(t).getFullYear()}catch{return null}}function ve(t){var f,g;const{github:e,githubUrl:n,velocity24h:r}=be(t.repositories),{hfKind:a,hfCount:i,hfUrl:o}=ye(t),s=(t.tasks||[]).map(l=>l.slug||"").filter(Boolean),u=(t.methods||[]).map(l=>({id:l.id,name:l.name,slug:l.slug})),d=(t.leaderboard_ranks||[]).filter(l=>l.best_rank>=1&&l.best_rank<=3).map(l=>({name:l.dataset_name,slug:l.dataset_slug||null,rank:l.best_rank}));return{id:t.arxiv_id||t.id,dbId:t.id,title:t.title,abstract:t.abstract||"",authors:t.authors||[],tags:s,methods:u,organizations:(t.organizations||[]).map(l=>({name:l.name,slug:l.slug,logoUrl:_(l.logo_url)||null})),citations:t.citation_count||0,github:e,githubUrl:n,project:((g=(f=t.project_pages)==null?void 0:f[0])==null?void 0:g.url)||null,date:De(t.published),publishedIso:t.published||null,year:Me(t.published),thumbnailUrl:_(t.thumbnail_url)||null,tldr:t.tldr||null,version:t.version||"v1",velocity24h:r,hfKind:a,hfCount:i,hfUrl:o,sotaRanks:d}}function ke(t){const e=$.get(t.toLowerCase());if(e)return e;const n=t.toUpperCase();return C.has(n)?n:t.replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase())}const C=new Set(["OCR"]),$=new Map([["3d-tracking","3D Tracking"],["point-tracking","2D Point Tracking"],["3d-generation","3D generation"],["3d-understanding","3D understanding"],["3d-semantic-segmentation","3D semantic segmentation"],["3d-instance-segmentation","3D instance segmentation"],["3d-object-detection","3D object detection"],["text-to-sql","Text-to-SQL"]]);function Te(t,e){const n=t||ke(e||""),r=$.get((e==null?void 0:e.toLowerCase())||Oe(n));if(r)return r;const a=e==null?void 0:e.toUpperCase(),i=n.toUpperCase();return/^[A-Z0-9][A-Z0-9-]{1,}$/.test(n)||a&&C.has(a)||C.has(i)?i:n.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase())}function Oe(t){return t.trim().toLowerCase().replace(/[\s_]+/g,"-")}export{ke as a,xe as c,Te as d,pe as h,be as s,ve as t}; diff --git a/assets/useDebounce-DzNGzmqr.js b/assets/useDebounce-iJszRYwl.js similarity index 66% rename from assets/useDebounce-DzNGzmqr.js rename to assets/useDebounce-iJszRYwl.js index fb402cbc7085bf8190b495a3b2409f57799dd5dc..7e1c28945a7fac5c40b7ded24d140baa2a401c4d 100644 --- a/assets/useDebounce-DzNGzmqr.js +++ b/assets/useDebounce-iJszRYwl.js @@ -1 +1 @@ -import{r as o}from"./index-BrhBTT14.js";function s(e,t=300){const[r,u]=o.useState(e);return o.useEffect(()=>{const c=setTimeout(()=>u(e),t);return()=>clearTimeout(c)},[e,t]),r}export{s as u}; +import{r as o}from"./index-D_-UZEuL.js";function s(e,t=300){const[r,u]=o.useState(e);return o.useEffect(()=>{const c=setTimeout(()=>u(e),t);return()=>clearTimeout(c)},[e,t]),r}export{s as u}; diff --git a/assets/useInfiniteQuery-bETtM5yS.js b/assets/useInfiniteQuery-CFUEkcEs.js similarity index 89% rename from assets/useInfiniteQuery-bETtM5yS.js rename to assets/useInfiniteQuery-CFUEkcEs.js index 9ba7cbd339fd6e70f5ee4a96c83f1f9cf0943615..c7e116a7a5df1158f76e7e20abe80f2ee81bdf67 100644 --- a/assets/useInfiniteQuery-bETtM5yS.js +++ b/assets/useInfiniteQuery-CFUEkcEs.js @@ -1 +1 @@ -import{Q as v,a as p}from"./useQuery-GhY2LXSI.js";import{ae as x,af as b}from"./index-BrhBTT14.js";var l=class extends v{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var f,P;const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:g,isError:c,isRefetchError:d}=i,r=(P=(f=s.fetchMeta)==null?void 0:f.fetchMore)==null?void 0:P.direction,h=c&&r==="forward",n=a&&r==="forward",o=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:b(t,s.data),hasPreviousPage:x(t,s.data),isFetchNextPageError:h,isFetchingNextPage:n,isFetchPreviousPageError:o,isFetchingPreviousPage:u,isRefetchError:d&&!h&&!o,isRefetching:g&&!n&&!u}}};function w(e,t){return p(e,l)}export{w as u}; +import{Q as v,a as p}from"./useQuery-BZo4MZ3s.js";import{aj as x,ak as b}from"./index-D_-UZEuL.js";var l=class extends v{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var f,P;const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:g,isError:c,isRefetchError:d}=i,r=(P=(f=s.fetchMeta)==null?void 0:f.fetchMore)==null?void 0:P.direction,h=c&&r==="forward",n=a&&r==="forward",o=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:b(t,s.data),hasPreviousPage:x(t,s.data),isFetchNextPageError:h,isFetchingNextPage:n,isFetchPreviousPageError:o,isFetchingPreviousPage:u,isRefetchError:d&&!h&&!o,isRefetching:g&&!n&&!u}}};function w(e,t){return p(e,l)}export{w as u}; diff --git a/assets/useIntersectionObserver-Lj6hnXj6.js b/assets/useIntersectionObserver-Cq9n7uOQ.js similarity index 92% rename from assets/useIntersectionObserver-Lj6hnXj6.js rename to assets/useIntersectionObserver-Cq9n7uOQ.js index 3014a7316a86fec70ae879cac2ae26a1b4953c13..c072fa127e5813e4e038267cd78759ffeed4ad00 100644 --- a/assets/useIntersectionObserver-Lj6hnXj6.js +++ b/assets/useIntersectionObserver-Cq9n7uOQ.js @@ -1 +1 @@ -import{j as e,r as c}from"./index-BrhBTT14.js";import{I as d}from"./components-74u_bIKK.js";const h=()=>e.jsxs("span",{className:"hf-resource-logo",children:[e.jsx("img",{className:"hf-resource-logo-black",src:"/hf-logo-monochrome-black.svg?v=20260729",alt:""}),e.jsx("img",{className:"hf-resource-logo-white",src:"/hf-logo-monochrome-white.svg?v=20260729",alt:""})]}),u=({checked:r,icon:t,label:n,onChange:a})=>e.jsxs("button",{type:"button",className:`paper-feed-filter ${r?"active":""}`,"aria-pressed":r,onClick:()=>a(!r),children:[e.jsxs("span",{className:"paper-feed-filter-content",children:[e.jsx("span",{className:"paper-feed-filter-icon","aria-hidden":"true",children:t}),n]}),r&&e.jsx("span",{className:"paper-feed-filter-check","aria-hidden":"true",children:"✓"})]}),x=({hasCode:r,hasHfArtifacts:t,onHasCodeChange:n,onHasHfArtifactsChange:a,showDivider:o=!0,showHasCode:s=!0})=>e.jsxs("div",{className:"paper-feed-resource-controls",role:"group","aria-label":"Resource filters",children:[o&&e.jsx("span",{className:"paper-feed-resource-divider","aria-hidden":"true"}),e.jsxs("div",{className:"paper-feed-filter-options",children:[s&&e.jsx(u,{checked:r,icon:e.jsx(d,{name:"github",size:14}),label:"Has code",onChange:n}),e.jsx(u,{checked:t,icon:e.jsx(h,{}),label:"Has artifacts",onChange:a})]})]});function j(r={}){const{threshold:t=0,rootMargin:n="0px"}=r,[a,o]=c.useState(!1),s=c.useRef(null),f=c.useCallback(i=>{if(s.current&&(s.current.disconnect(),s.current=null),!i){o(!1);return}const l=new IntersectionObserver(([p])=>o(p.isIntersecting),{threshold:t,rootMargin:n});l.observe(i),s.current=l},[t,n]);return c.useEffect(()=>()=>{s.current&&(s.current.disconnect(),s.current=null)},[]),{targetRef:f,isIntersecting:a}}export{x as P,j as u}; +import{j as e,r as c}from"./index-D_-UZEuL.js";import{I as d}from"./components-CmC5jqhM.js";const h=()=>e.jsxs("span",{className:"hf-resource-logo",children:[e.jsx("img",{className:"hf-resource-logo-black",src:"/hf-logo-monochrome-black.svg?v=20260729",alt:""}),e.jsx("img",{className:"hf-resource-logo-white",src:"/hf-logo-monochrome-white.svg?v=20260729",alt:""})]}),u=({checked:r,icon:t,label:n,onChange:a})=>e.jsxs("button",{type:"button",className:`paper-feed-filter ${r?"active":""}`,"aria-pressed":r,onClick:()=>a(!r),children:[e.jsxs("span",{className:"paper-feed-filter-content",children:[e.jsx("span",{className:"paper-feed-filter-icon","aria-hidden":"true",children:t}),n]}),r&&e.jsx("span",{className:"paper-feed-filter-check","aria-hidden":"true",children:"✓"})]}),x=({hasCode:r,hasHfArtifacts:t,onHasCodeChange:n,onHasHfArtifactsChange:a,showDivider:o=!0,showHasCode:s=!0})=>e.jsxs("div",{className:"paper-feed-resource-controls",role:"group","aria-label":"Resource filters",children:[o&&e.jsx("span",{className:"paper-feed-resource-divider","aria-hidden":"true"}),e.jsxs("div",{className:"paper-feed-filter-options",children:[s&&e.jsx(u,{checked:r,icon:e.jsx(d,{name:"github",size:14}),label:"Has code",onChange:n}),e.jsx(u,{checked:t,icon:e.jsx(h,{}),label:"Has artifacts",onChange:a})]})]});function j(r={}){const{threshold:t=0,rootMargin:n="0px"}=r,[a,o]=c.useState(!1),s=c.useRef(null),f=c.useCallback(i=>{if(s.current&&(s.current.disconnect(),s.current=null),!i){o(!1);return}const l=new IntersectionObserver(([p])=>o(p.isIntersecting),{threshold:t,rootMargin:n});l.observe(i),s.current=l},[t,n]);return c.useEffect(()=>()=>{s.current&&(s.current.disconnect(),s.current=null)},[]),{targetRef:f,isIntersecting:a}}export{x as P,j as u}; diff --git a/assets/useMutation-DqfuSW7Q.js b/assets/useMutation-P0Dg96Vh.js similarity index 67% rename from assets/useMutation-DqfuSW7Q.js rename to assets/useMutation-P0Dg96Vh.js index d65c3a9f51fea7df493168d96a46960e4124ad97..1ddbd99b4c4d11304714d9fdbe12a4c5e084c353 100644 --- a/assets/useMutation-DqfuSW7Q.js +++ b/assets/useMutation-P0Dg96Vh.js @@ -1 +1 @@ -var j=i=>{throw TypeError(i)};var E=(i,t,s)=>t.has(i)||j("Cannot "+s);var e=(i,t,s)=>(E(i,t,"read from private field"),s?s.call(i):t.get(i)),b=(i,t,s)=>t.has(i)?j("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),p=(i,t,s,r)=>(E(i,t,"write to private field"),r?r.call(i,s):t.set(i,s),s),y=(i,t,s)=>(E(i,t,"access private method"),s);import{ai as k,ak as q,aq as R,ar as U,aj as P,g as L,r as v,am as A,as as D}from"./index-BrhBTT14.js";var a,c,o,h,n,C,S,w,I=(w=class extends k{constructor(t,s){super();b(this,n);b(this,a);b(this,c);b(this,o);b(this,h);p(this,a,t),this.setOptions(s),this.bindMethods(),y(this,n,C).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const s=this.options;this.options=e(this,a).defaultMutationOptions(t),q(this.options,s)||e(this,a).getMutationCache().notify({type:"observerOptionsUpdated",mutation:e(this,o),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&R(s.mutationKey)!==R(this.options.mutationKey)?this.reset():((r=e(this,o))==null?void 0:r.state.status)==="pending"&&e(this,o).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=e(this,o))==null||t.removeObserver(this)}onMutationUpdate(t){y(this,n,C).call(this),y(this,n,S).call(this,t)}getCurrentResult(){return e(this,c)}reset(){var t;(t=e(this,o))==null||t.removeObserver(this),p(this,o,void 0),y(this,n,C).call(this),y(this,n,S).call(this)}mutate(t,s){var r;return p(this,h,s),(r=e(this,o))==null||r.removeObserver(this),p(this,o,e(this,a).getMutationCache().build(e(this,a),this.options)),e(this,o).addObserver(this),e(this,o).execute(t)}},a=new WeakMap,c=new WeakMap,o=new WeakMap,h=new WeakMap,n=new WeakSet,C=function(){var s;const t=((s=e(this,o))==null?void 0:s.state)??U();p(this,c,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},S=function(t){P.batch(()=>{var s,r,u,f,d,O,x,K;if(e(this,h)&&this.hasListeners()){const m=e(this,c).variables,g=e(this,c).context,M={client:e(this,a),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(r=(s=e(this,h)).onSuccess)==null||r.call(s,t.data,m,g,M)}catch(l){Promise.reject(l)}try{(f=(u=e(this,h)).onSettled)==null||f.call(u,t.data,null,m,g,M)}catch(l){Promise.reject(l)}}else if((t==null?void 0:t.type)==="error"){try{(O=(d=e(this,h)).onError)==null||O.call(d,t.error,m,g,M)}catch(l){Promise.reject(l)}try{(K=(x=e(this,h)).onSettled)==null||K.call(x,void 0,t.error,m,g,M)}catch(l){Promise.reject(l)}}}this.listeners.forEach(m=>{m(e(this,c))})})},w);function z(i,t){const s=L(),[r]=v.useState(()=>new I(s,i));v.useEffect(()=>{r.setOptions(i)},[r,i]);const u=v.useSyncExternalStore(v.useCallback(d=>r.subscribe(P.batchCalls(d)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),f=v.useCallback((d,O)=>{r.mutate(d,O).catch(A)},[r]);if(u.error&&D(r.options.throwOnError,[u.error]))throw u.error;return{...u,mutate:f,mutateAsync:u.mutate}}export{z as u}; +var w=i=>{throw TypeError(i)};var E=(i,t,s)=>t.has(i)||w("Cannot "+s);var e=(i,t,s)=>(E(i,t,"read from private field"),s?s.call(i):t.get(i)),b=(i,t,s)=>t.has(i)?w("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),p=(i,t,s,r)=>(E(i,t,"write to private field"),r?r.call(i,s):t.set(i,s),s),v=(i,t,s)=>(E(i,t,"access private method"),s);import{an as U,ap as k,av as R,aw as q,ao as P,g as L,r as y,ar as A,ax as D}from"./index-D_-UZEuL.js";var a,c,o,h,n,C,S,j,I=(j=class extends U{constructor(t,s){super();b(this,n);b(this,a);b(this,c);b(this,o);b(this,h);p(this,a,t),this.setOptions(s),this.bindMethods(),v(this,n,C).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const s=this.options;this.options=e(this,a).defaultMutationOptions(t),k(this.options,s)||e(this,a).getMutationCache().notify({type:"observerOptionsUpdated",mutation:e(this,o),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&R(s.mutationKey)!==R(this.options.mutationKey)?this.reset():((r=e(this,o))==null?void 0:r.state.status)==="pending"&&e(this,o).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=e(this,o))==null||t.removeObserver(this)}onMutationUpdate(t){v(this,n,C).call(this),v(this,n,S).call(this,t)}getCurrentResult(){return e(this,c)}reset(){var t;(t=e(this,o))==null||t.removeObserver(this),p(this,o,void 0),v(this,n,C).call(this),v(this,n,S).call(this)}mutate(t,s){var r;return p(this,h,s),(r=e(this,o))==null||r.removeObserver(this),p(this,o,e(this,a).getMutationCache().build(e(this,a),this.options)),e(this,o).addObserver(this),e(this,o).execute(t)}},a=new WeakMap,c=new WeakMap,o=new WeakMap,h=new WeakMap,n=new WeakSet,C=function(){var s;const t=((s=e(this,o))==null?void 0:s.state)??q();p(this,c,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},S=function(t){P.batch(()=>{var s,r,u,f,d,O,x,K;if(e(this,h)&&this.hasListeners()){const m=e(this,c).variables,g=e(this,c).context,M={client:e(this,a),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(r=(s=e(this,h)).onSuccess)==null||r.call(s,t.data,m,g,M)}catch(l){Promise.reject(l)}try{(f=(u=e(this,h)).onSettled)==null||f.call(u,t.data,null,m,g,M)}catch(l){Promise.reject(l)}}else if((t==null?void 0:t.type)==="error"){try{(O=(d=e(this,h)).onError)==null||O.call(d,t.error,m,g,M)}catch(l){Promise.reject(l)}try{(K=(x=e(this,h)).onSettled)==null||K.call(x,void 0,t.error,m,g,M)}catch(l){Promise.reject(l)}}}this.listeners.forEach(m=>{m(e(this,c))})})},j);function z(i,t){const s=L(),[r]=y.useState(()=>new I(s,i));y.useEffect(()=>{r.setOptions(i)},[r,i]);const u=y.useSyncExternalStore(y.useCallback(d=>r.subscribe(P.batchCalls(d)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),f=y.useCallback((d,O)=>{r.mutate(d,O).catch(A)},[r]);if(u.error&&D(r.options.throwOnError,[u.error]))throw u.error;return{...u,mutate:f,mutateAsync:u.mutate}}export{z as u}; diff --git a/assets/usePapers-C1lfz0oo.js b/assets/usePapers-BCHtBW8G.js similarity index 93% rename from assets/usePapers-C1lfz0oo.js rename to assets/usePapers-BCHtBW8G.js index 7381d79d6291e5aa10686b5d6711754709bd6669..3a4316e965f65759bf426de854f039bd80419fb2 100644 --- a/assets/usePapers-C1lfz0oo.js +++ b/assets/usePapers-BCHtBW8G.js @@ -1 +1 @@ -import{aa as _}from"./index-BrhBTT14.js";import{u as b}from"./useQuery-GhY2LXSI.js";import{u as g}from"./useInfiniteQuery-bETtM5yS.js";import{p}from"./papers-DBaPliAp.js";function z(a,e=!0){return b({queryKey:["paper",a],queryFn:()=>p.get(a),enabled:e&&!!a,staleTime:10*60*1e3,refetchOnWindowFocus:!1})}function O(a={}){const{page_size:e=20,search:r,order_by:t="date_published",order_dir:s="desc",time:n,published_after:i,published_before:o,conference:u,latest_only:f=!0,include_resources:l=!1,has_code:c=!1,has_hf_artifacts:d=!1,framework:y,repository:m,enabled:P=!0}=a;return g({queryKey:["papers-infinite",{page_size:e,search:r,order_by:t,order_dir:s,time:n,published_after:i,published_before:o,conference:u,latest_only:f,include_resources:l,has_code:c,has_hf_artifacts:d,framework:y,repository:m}],queryFn:({pageParam:h=1})=>p.list({page:h,page_size:e,search:r,order_by:t,order_dir:s,time:n,published_after:i,published_before:o,conference:u,latest_only:f,include_resources:l,has_code:c,has_hf_artifacts:d,framework:y,repository:m}),getNextPageParam:h=>h.next_page,initialPageParam:1,enabled:P,staleTime:5*60*1e3,placeholderData:_,refetchOnWindowFocus:!1})}function T(a){const{taskId:e,page_size:r=20,order_by:t="date_published",order_dir:s="desc",latest_only:n=!0,include_resources:i=!0,has_code:o=!1,has_hf_artifacts:u=!1,enabled:f=!0}=a;return g({queryKey:["task-papers-infinite",e,{page_size:r,order_by:t,order_dir:s,latest_only:n,include_resources:i,has_code:o,has_hf_artifacts:u}],queryFn:({pageParam:l=1})=>p.forTask(e,{page:l,page_size:r,order_by:t,order_dir:s,latest_only:n,include_resources:i,has_code:o,has_hf_artifacts:u}),getNextPageParam:l=>l.next_page,initialPageParam:1,enabled:f&&!!e,staleTime:5*60*1e3,placeholderData:_,refetchOnWindowFocus:!1})}function w(a){const{conferenceSlug:e,taskSlug:r,presentation:t,page_size:s=20,order_by:n="date_published",order_dir:i="desc",latest_only:o=!0,include_resources:u=!0,has_code:f=!1,has_hf_artifacts:l=!1,enabled:c=!0}=a;return g({queryKey:["conference-papers-infinite",e,r,t,{page_size:s,order_by:n,order_dir:i,latest_only:o,include_resources:u,has_code:f,has_hf_artifacts:l}],queryFn:({pageParam:d=1})=>p.forConference(e,{task:r,presentation:t,page:d,page_size:s,order_by:n,order_dir:i,latest_only:o,include_resources:u,has_code:f,has_hf_artifacts:l}),getNextPageParam:d=>d.next_page,initialPageParam:1,enabled:c&&!!e,staleTime:5*60*1e3,placeholderData:_,refetchOnWindowFocus:!1})}function I(a){const{organizationSlug:e,taskSlug:r,page_size:t=20,order_by:s="date_published",order_dir:n="desc",latest_only:i=!0,include_resources:o=!0,has_code:u=!1,has_hf_artifacts:f=!1,enabled:l=!0}=a;return g({queryKey:["organization-papers-infinite",e,r,{page_size:t,order_by:s,order_dir:n,latest_only:i,include_resources:o,has_code:u,has_hf_artifacts:f}],queryFn:({pageParam:c=1})=>p.forOrganization(e,{task:r,page:c,page_size:t,order_by:s,order_dir:n,latest_only:i,include_resources:o,has_code:u,has_hf_artifacts:f}),getNextPageParam:c=>c.next_page,initialPageParam:1,enabled:l&&!!e,staleTime:5*60*1e3,placeholderData:_,refetchOnWindowFocus:!1})}export{z as a,T as b,w as c,I as d,O as u}; +import{ag as _}from"./index-D_-UZEuL.js";import{u as b}from"./useQuery-BZo4MZ3s.js";import{u as g}from"./useInfiniteQuery-CFUEkcEs.js";import{p}from"./papers-DHqjKX7p.js";function z(a,e=!0){return b({queryKey:["paper",a],queryFn:()=>p.get(a),enabled:e&&!!a,staleTime:10*60*1e3,refetchOnWindowFocus:!1})}function O(a={}){const{page_size:e=20,search:r,order_by:t="date_published",order_dir:s="desc",time:n,published_after:i,published_before:o,conference:u,latest_only:f=!0,include_resources:l=!1,has_code:c=!1,has_hf_artifacts:d=!1,framework:y,repository:m,enabled:P=!0}=a;return g({queryKey:["papers-infinite",{page_size:e,search:r,order_by:t,order_dir:s,time:n,published_after:i,published_before:o,conference:u,latest_only:f,include_resources:l,has_code:c,has_hf_artifacts:d,framework:y,repository:m}],queryFn:({pageParam:h=1})=>p.list({page:h,page_size:e,search:r,order_by:t,order_dir:s,time:n,published_after:i,published_before:o,conference:u,latest_only:f,include_resources:l,has_code:c,has_hf_artifacts:d,framework:y,repository:m}),getNextPageParam:h=>h.next_page,initialPageParam:1,enabled:P,staleTime:5*60*1e3,placeholderData:_,refetchOnWindowFocus:!1})}function T(a){const{taskId:e,page_size:r=20,order_by:t="date_published",order_dir:s="desc",latest_only:n=!0,include_resources:i=!0,has_code:o=!1,has_hf_artifacts:u=!1,enabled:f=!0}=a;return g({queryKey:["task-papers-infinite",e,{page_size:r,order_by:t,order_dir:s,latest_only:n,include_resources:i,has_code:o,has_hf_artifacts:u}],queryFn:({pageParam:l=1})=>p.forTask(e,{page:l,page_size:r,order_by:t,order_dir:s,latest_only:n,include_resources:i,has_code:o,has_hf_artifacts:u}),getNextPageParam:l=>l.next_page,initialPageParam:1,enabled:f&&!!e,staleTime:5*60*1e3,placeholderData:_,refetchOnWindowFocus:!1})}function w(a){const{conferenceSlug:e,taskSlug:r,presentation:t,page_size:s=20,order_by:n="date_published",order_dir:i="desc",latest_only:o=!0,include_resources:u=!0,has_code:f=!1,has_hf_artifacts:l=!1,enabled:c=!0}=a;return g({queryKey:["conference-papers-infinite",e,r,t,{page_size:s,order_by:n,order_dir:i,latest_only:o,include_resources:u,has_code:f,has_hf_artifacts:l}],queryFn:({pageParam:d=1})=>p.forConference(e,{task:r,presentation:t,page:d,page_size:s,order_by:n,order_dir:i,latest_only:o,include_resources:u,has_code:f,has_hf_artifacts:l}),getNextPageParam:d=>d.next_page,initialPageParam:1,enabled:c&&!!e,staleTime:5*60*1e3,placeholderData:_,refetchOnWindowFocus:!1})}function I(a){const{organizationSlug:e,taskSlug:r,page_size:t=20,order_by:s="date_published",order_dir:n="desc",latest_only:i=!0,include_resources:o=!0,has_code:u=!1,has_hf_artifacts:f=!1,enabled:l=!0}=a;return g({queryKey:["organization-papers-infinite",e,r,{page_size:t,order_by:s,order_dir:n,latest_only:i,include_resources:o,has_code:u,has_hf_artifacts:f}],queryFn:({pageParam:c=1})=>p.forOrganization(e,{task:r,page:c,page_size:t,order_by:s,order_dir:n,latest_only:i,include_resources:o,has_code:u,has_hf_artifacts:f}),getNextPageParam:c=>c.next_page,initialPageParam:1,enabled:l&&!!e,staleTime:5*60*1e3,placeholderData:_,refetchOnWindowFocus:!1})}export{z as a,T as b,w as c,I as d,O as u}; diff --git a/assets/usePeriodFilter-By9tdCWv.js b/assets/usePeriodFilter-By9tdCWv.js deleted file mode 100644 index 95dee5d484723145c346ecb1cc9e52d093f639bc..0000000000000000000000000000000000000000 --- a/assets/usePeriodFilter-By9tdCWv.js +++ /dev/null @@ -1 +0,0 @@ -import"./index-BrhBTT14.js";const e=["Today","This Week","This Month","All Time"];export{e as P}; diff --git a/assets/usePeriodFilter-fHKAAcyd.js b/assets/usePeriodFilter-fHKAAcyd.js new file mode 100644 index 0000000000000000000000000000000000000000..6608eb88672190479a239212c2be003b25ea4e27 --- /dev/null +++ b/assets/usePeriodFilter-fHKAAcyd.js @@ -0,0 +1 @@ +import"./index-D_-UZEuL.js";const e=["Today","This Week","This Month","All Time"];export{e as P}; diff --git a/assets/useQuery-GhY2LXSI.js b/assets/useQuery-BZo4MZ3s.js similarity index 73% rename from assets/useQuery-GhY2LXSI.js rename to assets/useQuery-BZo4MZ3s.js index ed258553b1efdde2aefa6f3ad9db1a1753508693..a6c51940d81699f4e3709ade779eece53b252997 100644 --- a/assets/useQuery-GhY2LXSI.js +++ b/assets/useQuery-BZo4MZ3s.js @@ -1 +1 @@ -var bt=s=>{throw TypeError(s)};var $=(s,t,e)=>t.has(s)||bt("Cannot "+e);var i=(s,t,e)=>($(s,t,"read from private field"),e?e.call(s):t.get(s)),p=(s,t,e)=>t.has(s)?bt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),u=(s,t,e,r)=>($(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e),l=(s,t,e)=>($(s,t,"access private method"),e);import{ai as Tt,av as gt,aw as S,ak as q,ax as j,am as tt,ay as et,az as vt,aA as Mt,aB as J,aC as Qt,aD as xt,aE as mt,aj as Ct,r as O,as as Ot,g as _t}from"./index-BrhBTT14.js";var v,a,H,g,x,U,C,w,z,P,L,_,D,T,N,n,A,st,it,rt,at,nt,ht,ot,It,Et,Dt=(Et=class extends Tt{constructor(t,e){super();p(this,n);p(this,v);p(this,a);p(this,H);p(this,g);p(this,x);p(this,U);p(this,C);p(this,w);p(this,z);p(this,P);p(this,L);p(this,_);p(this,D);p(this,T);p(this,N,new Set);this.options=e,u(this,v,t),u(this,w,null),u(this,C,gt()),this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,a).addObserver(this),Rt(i(this,a),this.options)?l(this,n,A).call(this):this.updateResult(),l(this,n,at).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ct(i(this,a),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ct(i(this,a),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,l(this,n,nt).call(this),l(this,n,ht).call(this),i(this,a).removeObserver(this)}setOptions(t){const e=this.options,r=i(this,a);if(this.options=i(this,v).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof S(this.options.enabled,i(this,a))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");l(this,n,ot).call(this),i(this,a).setOptions(this.options),e._defaulted&&!q(this.options,e)&&i(this,v).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,a),observer:this});const h=this.hasListeners();h&&St(i(this,a),r,this.options,e)&&l(this,n,A).call(this),this.updateResult(),h&&(i(this,a)!==r||S(this.options.enabled,i(this,a))!==S(e.enabled,i(this,a))||j(this.options.staleTime,i(this,a))!==j(e.staleTime,i(this,a)))&&l(this,n,st).call(this);const o=l(this,n,it).call(this);h&&(i(this,a)!==r||S(this.options.enabled,i(this,a))!==S(e.enabled,i(this,a))||o!==i(this,T))&&l(this,n,rt).call(this,o)}getOptimisticResult(t){const e=i(this,v).getQueryCache().build(i(this,v),t),r=this.createResult(e,t);return Ut(this,r)&&(u(this,g,r),u(this,U,this.options),u(this,x,i(this,a).state)),r}getCurrentResult(){return i(this,g)}trackResult(t,e){return new Proxy(t,{get:(r,h)=>(this.trackProp(h),e==null||e(h),h==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&i(this,C).status==="pending"&&i(this,C).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,h))})}trackProp(t){i(this,N).add(t)}getCurrentQuery(){return i(this,a)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=i(this,v).defaultQueryOptions(t),r=i(this,v).getQueryCache().build(i(this,v),e);return r.fetch().then(()=>this.createResult(r,e))}fetch(t){return l(this,n,A).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,g)))}createResult(t,e){var ft;const r=i(this,a),h=this.options,o=i(this,g),c=i(this,x),y=i(this,U),b=t!==r?t.state:i(this,H),{state:E}=t;let d={...E},M=!1,f;if(e._optimisticResults){const R=this.hasListeners(),k=!R&&Rt(t,e),V=R&&St(t,r,e,h);(k||V)&&(d={...d,...xt(E.data,t.options)}),e._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:Q,errorUpdatedAt:B,status:m}=d;f=d.data;let W=!1;if(e.placeholderData!==void 0&&f===void 0&&m==="pending"){let R;o!=null&&o.isPlaceholderData&&e.placeholderData===(y==null?void 0:y.placeholderData)?(R=o.data,W=!0):R=typeof e.placeholderData=="function"?e.placeholderData((ft=i(this,L))==null?void 0:ft.state.data,i(this,L)):e.placeholderData,R!==void 0&&(m="success",f=mt(o==null?void 0:o.data,R,e),M=!0)}if(e.select&&f!==void 0&&!W)if(o&&f===(c==null?void 0:c.data)&&e.select===i(this,z))f=i(this,P);else try{u(this,z,e.select),f=e.select(f),f=mt(o==null?void 0:o.data,f,e),u(this,P,f),u(this,w,null)}catch(R){u(this,w,R)}i(this,w)&&(Q=i(this,w),f=i(this,P),B=Date.now(),m="error");const X=d.fetchStatus==="fetching",Y=m==="pending",Z=m==="error",lt=Y&&X,dt=f!==void 0,I={status:m,fetchStatus:d.fetchStatus,isPending:Y,isSuccess:m==="success",isError:Z,isInitialLoading:lt,isLoading:lt,data:f,dataUpdatedAt:d.dataUpdatedAt,error:Q,errorUpdatedAt:B,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:d.dataUpdateCount>b.dataUpdateCount||d.errorUpdateCount>b.errorUpdateCount,isFetching:X,isRefetching:X&&!Y,isLoadingError:Z&&!dt,isPaused:d.fetchStatus==="paused",isPlaceholderData:M,isRefetchError:Z&&dt,isStale:ut(t,e),refetch:this.refetch,promise:i(this,C),isEnabled:S(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=I.data!==void 0,k=I.status==="error"&&!R,V=G=>{k?G.reject(I.error):R&&G.resolve(I.data)},pt=()=>{const G=u(this,C,I.promise=gt());V(G)},K=i(this,C);switch(K.status){case"pending":t.queryHash===r.queryHash&&V(K);break;case"fulfilled":(k||I.data!==K.value)&&pt();break;case"rejected":(!k||I.error!==K.reason)&&pt();break}}return I}updateResult(){const t=i(this,g),e=this.createResult(i(this,a),this.options);if(u(this,x,i(this,a).state),u(this,U,this.options),i(this,x).data!==void 0&&u(this,L,i(this,a)),q(e,t))return;u(this,g,e);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:h}=this.options,o=typeof h=="function"?h():h;if(o==="all"||!o&&!i(this,N).size)return!0;const c=new Set(o??i(this,N));return this.options.throwOnError&&c.add("error"),Object.keys(i(this,g)).some(y=>{const F=y;return i(this,g)[F]!==t[F]&&c.has(F)})};l(this,n,It).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&l(this,n,at).call(this)}},v=new WeakMap,a=new WeakMap,H=new WeakMap,g=new WeakMap,x=new WeakMap,U=new WeakMap,C=new WeakMap,w=new WeakMap,z=new WeakMap,P=new WeakMap,L=new WeakMap,_=new WeakMap,D=new WeakMap,T=new WeakMap,N=new WeakMap,n=new WeakSet,A=function(t){l(this,n,ot).call(this);let e=i(this,a).fetch(this.options,t);return t!=null&&t.throwOnError||(e=e.catch(tt)),e},st=function(){l(this,n,nt).call(this);const t=j(this.options.staleTime,i(this,a));if(et.isServer()||i(this,g).isStale||!vt(t))return;const r=Mt(i(this,g).dataUpdatedAt,t)+1;u(this,_,J.setTimeout(()=>{i(this,g).isStale||this.updateResult()},r))},it=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(i(this,a)):this.options.refetchInterval)??!1},rt=function(t){l(this,n,ht).call(this),u(this,T,t),!(et.isServer()||S(this.options.enabled,i(this,a))===!1||!vt(i(this,T))||i(this,T)===0)&&u(this,D,J.setInterval(()=>{(this.options.refetchIntervalInBackground||Qt.isFocused())&&l(this,n,A).call(this)},i(this,T)))},at=function(){l(this,n,st).call(this),l(this,n,rt).call(this,l(this,n,it).call(this))},nt=function(){i(this,_)!==void 0&&(J.clearTimeout(i(this,_)),u(this,_,void 0))},ht=function(){i(this,D)!==void 0&&(J.clearInterval(i(this,D)),u(this,D,void 0))},ot=function(){const t=i(this,v).getQueryCache().build(i(this,v),this.options);if(t===i(this,a))return;const e=i(this,a);u(this,a,t),u(this,H,t.state),this.hasListeners()&&(e==null||e.removeObserver(this),t.addObserver(this))},It=function(t){Ct.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(i(this,g))}),i(this,v).getQueryCache().notify({query:i(this,a),type:"observerResultsUpdated"})})},Et);function Ft(s,t){return S(t.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&S(t.retryOnMount,s)===!1)}function Rt(s,t){return Ft(s,t)||s.state.data!==void 0&&ct(s,t,t.refetchOnMount)}function ct(s,t,e){if(S(t.enabled,s)!==!1&&j(t.staleTime,s)!=="static"){const r=typeof e=="function"?e(s):e;return r==="always"||r!==!1&&ut(s,t)}return!1}function St(s,t,e,r){return(s!==t||S(r.enabled,s)===!1)&&(!e.suspense||s.state.status!=="error")&&ut(s,e)}function ut(s,t){return S(t.enabled,s)!==!1&&s.isStaleByTime(j(t.staleTime,s))}function Ut(s,t){return!q(s.getCurrentResult(),t)}var wt=O.createContext(!1),Pt=()=>O.useContext(wt);wt.Provider;function Lt(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var Nt=O.createContext(Lt()),Bt=()=>O.useContext(Nt),kt=(s,t,e)=>{const r=e!=null&&e.state.error&&typeof s.throwOnError=="function"?Ot(s.throwOnError,[e.state.error,e]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||r)&&(t.isReset()||(s.retryOnMount=!1))},At=s=>{O.useEffect(()=>{s.clearReset()},[s])},jt=({result:s,errorResetBoundary:t,throwOnError:e,query:r,suspense:h})=>s.isError&&!t.isReset()&&!s.isFetching&&r&&(h&&s.data===void 0||Ot(e,[s.error,r])),Ht=s=>{if(s.suspense){const e=h=>h==="static"?h:Math.max(h??1e3,1e3),r=s.staleTime;s.staleTime=typeof r=="function"?(...h)=>e(r(...h)):e(r),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},zt=(s,t)=>s.isLoading&&s.isFetching&&!t,Wt=(s,t)=>(s==null?void 0:s.suspense)&&t.isPending,yt=(s,t,e)=>t.fetchOptimistic(s).catch(()=>{e.clearReset()});function Vt(s,t,e){var M,f,Q,B;const r=Pt(),h=Bt(),o=_t(),c=o.defaultQueryOptions(s);(f=(M=o.getDefaultOptions().queries)==null?void 0:M._experimental_beforeQuery)==null||f.call(M,c);const y=o.getQueryCache().get(c.queryHash);c._optimisticResults=r?"isRestoring":"optimistic",Ht(c),kt(c,h,y),At(h);const F=!o.getQueryCache().get(c.queryHash),[b]=O.useState(()=>new t(o,c)),E=b.getOptimisticResult(c),d=!r&&s.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(m=>{const W=d?b.subscribe(Ct.batchCalls(m)):tt;return b.updateResult(),W},[b,d]),()=>b.getCurrentResult(),()=>b.getCurrentResult()),O.useEffect(()=>{b.setOptions(c)},[c,b]),Wt(c,E))throw yt(c,b,h);if(jt({result:E,errorResetBoundary:h,throwOnError:c.throwOnError,query:y,suspense:c.suspense}))throw E.error;if((B=(Q=o.getDefaultOptions().queries)==null?void 0:Q._experimental_afterQuery)==null||B.call(Q,c,E),c.experimental_prefetchInRender&&!et.isServer()&&zt(E,r)){const m=F?yt(c,b,h):y==null?void 0:y.promise;m==null||m.catch(tt).finally(()=>{b.updateResult()})}return c.notifyOnChangeProps?E:b.trackResult(E)}function Xt(s,t){return Vt(s,Dt)}export{Dt as Q,Vt as a,Pt as b,Bt as c,kt as d,Ht as e,At as f,yt as g,jt as h,Wt as s,Xt as u}; +var bt=s=>{throw TypeError(s)};var $=(s,t,e)=>t.has(s)||bt("Cannot "+e);var i=(s,t,e)=>($(s,t,"read from private field"),e?e.call(s):t.get(s)),p=(s,t,e)=>t.has(s)?bt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),u=(s,t,e,r)=>($(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e),l=(s,t,e)=>($(s,t,"access private method"),e);import{an as Tt,aA as gt,aB as S,ap as q,aC as H,ar as tt,aD as et,aE as vt,aF as Mt,aG as K,aH as Qt,aI as xt,aJ as mt,ao as Ct,r as O,ax as Ot,g as _t}from"./index-D_-UZEuL.js";var v,a,j,g,x,U,C,w,W,P,L,_,F,T,N,n,A,st,it,rt,at,nt,ht,ot,It,Et,Ft=(Et=class extends Tt{constructor(t,e){super();p(this,n);p(this,v);p(this,a);p(this,j);p(this,g);p(this,x);p(this,U);p(this,C);p(this,w);p(this,W);p(this,P);p(this,L);p(this,_);p(this,F);p(this,T);p(this,N,new Set);this.options=e,u(this,v,t),u(this,w,null),u(this,C,gt()),this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,a).addObserver(this),Rt(i(this,a),this.options)?l(this,n,A).call(this):this.updateResult(),l(this,n,at).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ct(i(this,a),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ct(i(this,a),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,l(this,n,nt).call(this),l(this,n,ht).call(this),i(this,a).removeObserver(this)}setOptions(t){const e=this.options,r=i(this,a);if(this.options=i(this,v).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof S(this.options.enabled,i(this,a))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");l(this,n,ot).call(this),i(this,a).setOptions(this.options),e._defaulted&&!q(this.options,e)&&i(this,v).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,a),observer:this});const h=this.hasListeners();h&&St(i(this,a),r,this.options,e)&&l(this,n,A).call(this),this.updateResult(),h&&(i(this,a)!==r||S(this.options.enabled,i(this,a))!==S(e.enabled,i(this,a))||H(this.options.staleTime,i(this,a))!==H(e.staleTime,i(this,a)))&&l(this,n,st).call(this);const o=l(this,n,it).call(this);h&&(i(this,a)!==r||S(this.options.enabled,i(this,a))!==S(e.enabled,i(this,a))||o!==i(this,T))&&l(this,n,rt).call(this,o)}getOptimisticResult(t){const e=i(this,v).getQueryCache().build(i(this,v),t),r=this.createResult(e,t);return Ut(this,r)&&(u(this,g,r),u(this,U,this.options),u(this,x,i(this,a).state)),r}getCurrentResult(){return i(this,g)}trackResult(t,e){return new Proxy(t,{get:(r,h)=>(this.trackProp(h),e==null||e(h),h==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&i(this,C).status==="pending"&&i(this,C).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,h))})}trackProp(t){i(this,N).add(t)}getCurrentQuery(){return i(this,a)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=i(this,v).defaultQueryOptions(t),r=i(this,v).getQueryCache().build(i(this,v),e);return r.fetch().then(()=>this.createResult(r,e))}fetch(t){return l(this,n,A).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,g)))}createResult(t,e){var ft;const r=i(this,a),h=this.options,o=i(this,g),c=i(this,x),y=i(this,U),b=t!==r?t.state:i(this,j),{state:E}=t;let d={...E},M=!1,f;if(e._optimisticResults){const R=this.hasListeners(),k=!R&&Rt(t,e),V=R&&St(t,r,e,h);(k||V)&&(d={...d,...xt(E.data,t.options)}),e._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:Q,errorUpdatedAt:B,status:m}=d;f=d.data;let z=!1;if(e.placeholderData!==void 0&&f===void 0&&m==="pending"){let R;o!=null&&o.isPlaceholderData&&e.placeholderData===(y==null?void 0:y.placeholderData)?(R=o.data,z=!0):R=typeof e.placeholderData=="function"?e.placeholderData((ft=i(this,L))==null?void 0:ft.state.data,i(this,L)):e.placeholderData,R!==void 0&&(m="success",f=mt(o==null?void 0:o.data,R,e),M=!0)}if(e.select&&f!==void 0&&!z)if(o&&f===(c==null?void 0:c.data)&&e.select===i(this,W))f=i(this,P);else try{u(this,W,e.select),f=e.select(f),f=mt(o==null?void 0:o.data,f,e),u(this,P,f),u(this,w,null)}catch(R){u(this,w,R)}i(this,w)&&(Q=i(this,w),f=i(this,P),B=Date.now(),m="error");const X=d.fetchStatus==="fetching",Y=m==="pending",Z=m==="error",lt=Y&&X,dt=f!==void 0,I={status:m,fetchStatus:d.fetchStatus,isPending:Y,isSuccess:m==="success",isError:Z,isInitialLoading:lt,isLoading:lt,data:f,dataUpdatedAt:d.dataUpdatedAt,error:Q,errorUpdatedAt:B,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:d.dataUpdateCount>b.dataUpdateCount||d.errorUpdateCount>b.errorUpdateCount,isFetching:X,isRefetching:X&&!Y,isLoadingError:Z&&!dt,isPaused:d.fetchStatus==="paused",isPlaceholderData:M,isRefetchError:Z&&dt,isStale:ut(t,e),refetch:this.refetch,promise:i(this,C),isEnabled:S(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=I.data!==void 0,k=I.status==="error"&&!R,V=J=>{k?J.reject(I.error):R&&J.resolve(I.data)},pt=()=>{const J=u(this,C,I.promise=gt());V(J)},G=i(this,C);switch(G.status){case"pending":t.queryHash===r.queryHash&&V(G);break;case"fulfilled":(k||I.data!==G.value)&&pt();break;case"rejected":(!k||I.error!==G.reason)&&pt();break}}return I}updateResult(){const t=i(this,g),e=this.createResult(i(this,a),this.options);if(u(this,x,i(this,a).state),u(this,U,this.options),i(this,x).data!==void 0&&u(this,L,i(this,a)),q(e,t))return;u(this,g,e);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:h}=this.options,o=typeof h=="function"?h():h;if(o==="all"||!o&&!i(this,N).size)return!0;const c=new Set(o??i(this,N));return this.options.throwOnError&&c.add("error"),Object.keys(i(this,g)).some(y=>{const D=y;return i(this,g)[D]!==t[D]&&c.has(D)})};l(this,n,It).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&l(this,n,at).call(this)}},v=new WeakMap,a=new WeakMap,j=new WeakMap,g=new WeakMap,x=new WeakMap,U=new WeakMap,C=new WeakMap,w=new WeakMap,W=new WeakMap,P=new WeakMap,L=new WeakMap,_=new WeakMap,F=new WeakMap,T=new WeakMap,N=new WeakMap,n=new WeakSet,A=function(t){l(this,n,ot).call(this);let e=i(this,a).fetch(this.options,t);return t!=null&&t.throwOnError||(e=e.catch(tt)),e},st=function(){l(this,n,nt).call(this);const t=H(this.options.staleTime,i(this,a));if(et.isServer()||i(this,g).isStale||!vt(t))return;const r=Mt(i(this,g).dataUpdatedAt,t)+1;u(this,_,K.setTimeout(()=>{i(this,g).isStale||this.updateResult()},r))},it=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(i(this,a)):this.options.refetchInterval)??!1},rt=function(t){l(this,n,ht).call(this),u(this,T,t),!(et.isServer()||S(this.options.enabled,i(this,a))===!1||!vt(i(this,T))||i(this,T)===0)&&u(this,F,K.setInterval(()=>{(this.options.refetchIntervalInBackground||Qt.isFocused())&&l(this,n,A).call(this)},i(this,T)))},at=function(){l(this,n,st).call(this),l(this,n,rt).call(this,l(this,n,it).call(this))},nt=function(){i(this,_)!==void 0&&(K.clearTimeout(i(this,_)),u(this,_,void 0))},ht=function(){i(this,F)!==void 0&&(K.clearInterval(i(this,F)),u(this,F,void 0))},ot=function(){const t=i(this,v).getQueryCache().build(i(this,v),this.options);if(t===i(this,a))return;const e=i(this,a);u(this,a,t),u(this,j,t.state),this.hasListeners()&&(e==null||e.removeObserver(this),t.addObserver(this))},It=function(t){Ct.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(i(this,g))}),i(this,v).getQueryCache().notify({query:i(this,a),type:"observerResultsUpdated"})})},Et);function Dt(s,t){return S(t.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&S(t.retryOnMount,s)===!1)}function Rt(s,t){return Dt(s,t)||s.state.data!==void 0&&ct(s,t,t.refetchOnMount)}function ct(s,t,e){if(S(t.enabled,s)!==!1&&H(t.staleTime,s)!=="static"){const r=typeof e=="function"?e(s):e;return r==="always"||r!==!1&&ut(s,t)}return!1}function St(s,t,e,r){return(s!==t||S(r.enabled,s)===!1)&&(!e.suspense||s.state.status!=="error")&&ut(s,e)}function ut(s,t){return S(t.enabled,s)!==!1&&s.isStaleByTime(H(t.staleTime,s))}function Ut(s,t){return!q(s.getCurrentResult(),t)}var wt=O.createContext(!1),Pt=()=>O.useContext(wt);wt.Provider;function Lt(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var Nt=O.createContext(Lt()),Bt=()=>O.useContext(Nt),kt=(s,t,e)=>{const r=e!=null&&e.state.error&&typeof s.throwOnError=="function"?Ot(s.throwOnError,[e.state.error,e]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||r)&&(t.isReset()||(s.retryOnMount=!1))},At=s=>{O.useEffect(()=>{s.clearReset()},[s])},Ht=({result:s,errorResetBoundary:t,throwOnError:e,query:r,suspense:h})=>s.isError&&!t.isReset()&&!s.isFetching&&r&&(h&&s.data===void 0||Ot(e,[s.error,r])),jt=s=>{if(s.suspense){const e=h=>h==="static"?h:Math.max(h??1e3,1e3),r=s.staleTime;s.staleTime=typeof r=="function"?(...h)=>e(r(...h)):e(r),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},Wt=(s,t)=>s.isLoading&&s.isFetching&&!t,zt=(s,t)=>(s==null?void 0:s.suspense)&&t.isPending,yt=(s,t,e)=>t.fetchOptimistic(s).catch(()=>{e.clearReset()});function Vt(s,t,e){var M,f,Q,B;const r=Pt(),h=Bt(),o=_t(),c=o.defaultQueryOptions(s);(f=(M=o.getDefaultOptions().queries)==null?void 0:M._experimental_beforeQuery)==null||f.call(M,c);const y=o.getQueryCache().get(c.queryHash);c._optimisticResults=r?"isRestoring":"optimistic",jt(c),kt(c,h,y),At(h);const D=!o.getQueryCache().get(c.queryHash),[b]=O.useState(()=>new t(o,c)),E=b.getOptimisticResult(c),d=!r&&s.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(m=>{const z=d?b.subscribe(Ct.batchCalls(m)):tt;return b.updateResult(),z},[b,d]),()=>b.getCurrentResult(),()=>b.getCurrentResult()),O.useEffect(()=>{b.setOptions(c)},[c,b]),zt(c,E))throw yt(c,b,h);if(Ht({result:E,errorResetBoundary:h,throwOnError:c.throwOnError,query:y,suspense:c.suspense}))throw E.error;if((B=(Q=o.getDefaultOptions().queries)==null?void 0:Q._experimental_afterQuery)==null||B.call(Q,c,E),c.experimental_prefetchInRender&&!et.isServer()&&Wt(E,r)){const m=D?yt(c,b,h):y==null?void 0:y.promise;m==null||m.catch(tt).finally(()=>{b.updateResult()})}return c.notifyOnChangeProps?E:b.trackResult(E)}function Xt(s,t){return Vt(s,Ft)}export{Ft as Q,Vt as a,Pt as b,Bt as c,kt as d,jt as e,At as f,yt as g,Ht as h,zt as s,Xt as u}; diff --git a/index.html b/index.html index b4b75266d6766583a5bc8080ea7dec5e39b076fe..ebd6e141da5885f69bffa3a4c82eedfefcb289f9 100644 --- a/index.html +++ b/index.html @@ -73,8 +73,8 @@ plausible.init(); })(); - - + +