PageSourceSearch

https://artificialanalysis.ai/_next/static/chunks/38221-9c358c057504705a.js

js artificialanalysis.ai collected 2026-10-02 02:15:33 UTC 115,844 bytes, 2 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0fa55-4241-7a22-9b44-743345807193")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[38221],{1488:(e,t,n)=>{n.d(t,{z:()=>r});var l=n(36772),a=n(96040);function r(e){let t,n,r,o,c=(0,l.c)(7),[u,d]=(0,a.useState)(!1),m=(0,a.useRef)(0);c[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{i(e)&&(e.preventDefault(),m.current=m.current+1,d(!0))},c[0]=t):t=c[0],c[1]===Symbol.for("react.memo_cache_sentinel")?(n=e=>{i(e)&&(m.current=Math.max(0,m.current-1),0===m.current&&d(!1))},c[1]=n):n=c[1],c[2]!==e?(r={onDragEnter:t,onDragOver:s,onDragLeave:n,onDrop:t=>{i(t)&&(t.preventDefault(),m.current=0,d(!1),e(Array.from(t.dataTransfer.files)))}},c[2]=e,c[3]=r):r=c[3];let p=r;return c[4]!==p||c[5]!==u?(o={isDragging:u,dropZoneProps:p},c[4]=p,c[5]=u,c[6]=o):o=c[6],o}function s(e){i(e)&&e.preventDefault()}function i(e){return e.dataTransfer.types.includes("Files")}},3340:(e,t,n)=>{n.d(t,{P:()=>S,B:()=>_});var l=n(58212),a=n(36772),r=n(96040),s=n(77759),i=n(10743),o=n(7980),c=n(26385),u=n(36896),d=n(83386),m=n(90989);let p=null,h=(0,m.default)(()=>Promise.all([n.e(91623),n.e(35765),n.e(55992),n.e(46989),n.e(26762),n.e(45231),n.e(68135),n.e(83607),n.e(62479),n.e(64989),n.e(38310),n.e(68692),n.e(63793)]).then(n.bind(n,46169)).then(e=>(p=e,e.DropdownMenu)),{loadableGenerated:{webpack:()=>[46169]}}),f=()=>null!=p?p:(0,d.Ny)(),x=(0,r.createContext)(null);function g(e){var t,n;let[a]=(0,r.useState)(()=>{var e,t;return null!=(t=null==(e=f())?void 0:e.DropdownMenu)?t:h}),[s,i]=(0,r.useState)(null!=(t=e.defaultOpen)&&t),o=null!=(n=e.open)?n:s,c=t=>{var n;i(t),null==(n=e.onOpenChange)||n.call(e,t)}
1,u=(0,r.useRef)({focused:!1,clicked:!1,open:null,at:0,setOpen:c});return(0,l.jsx)(x.Provider,{value:u,children:(0,l.jsx)(r.Suspense,{fallback:(0,l.jsx)(b,{menu:e,open:o,hand:u,onPress:e=>{let t=u.current;t.open=null===t.open?!o:null,t.at=Date.now(),t.setOpen=c,t.clicked=!0;let n=l=>{l.target instanceof Node&&e.contains(l.target)||(t.clicked=!1,document.removeEventListener("pointerdown",n,!0),document.removeEventListener("focusin",n,!0))};document.addEventListener("pointerdown",n,!0),document.addEventListener("focusin",n,!0)}}),children:(0,l.jsx)(a,{...e,open:o,onOpenChange:c})})})}function b(e){let{menu:t,open:n,hand:a,onPress:s}=e,i=r.Children.toArray(t.children).find(e=>(0,r.isValidElement)(e)&&e.type===y);if(!(0,r.isValidElement)(i))return null;let{asChild:o,children:c,onClick:u,...d}=i.props,m={type:"button","aria-haspopup":"menu","aria-expanded":n,"data-state":n?"open":"closed",ref:e=>(function(e,t){if(null!=e)return()=>{t.focused=document.activeElement===e}})(e,a.current),onClick:e=>{null==u||u(e),s(e.currentTarget)}};return o?(0,r.isValidElement)(c)?(0,r.cloneElement)(c,m):null:(0,l.jsx)("button",{...d,...m,children:c})}function y(e){let t=(0,r.useContext)(x),[n]=(0,r.useState)(()=>{var e;return null==(e=f())?void 0:e.DropdownMenuTrigger});return null==n?null:(0,l.jsx)(n,{...e,ref:e=>{null!=e&&null!=t&&function(e,t){let{focused:n,open:l,at:a}=t,r=n||t.clicked;t.focused=!1,t.open=null,n&&e.focus({preventScroll:!0}),null!==l&&r&&Date.now()-a<2e3&&queueMicrotask(()=>t.setOpen(l))}(e,t.current)}})}var v=n(47927),w=n(27433),k=n(44742),j=n(83325),N=n(26571);let _="File upload isn’t available for your organization yet.";function S(e){let t,n,m,p,h,f,x,b,S,A,R,I,E,T,O,U,L,P,z,F,D,q,M=(0,a.c)(50),{orgSlug:W,busy:$,locked:K,open:G,onOpenChange:B,note:J,onUpload:V,onStoredSource:H}=e,Y=void 0===J?null:J,Q=(0,j.Qv)(),{uploadsEnabled:X}=(0,w.mz)("flags");M[0]===Symbol.for("react.memo_cache_sentinel")?([m,t,...n]=N.r0,M[0]=t,M[1]=n,M[2]=m):(t=M[0],n=M[1],m=M[2]);let Z=(0,r.useId)();M[3]!==Q||M[4]!==W?(p=async()=>{try{await navigator.clipboard.writeText((0,v.k_)(W)),Q("coding_agent","coding-agent"),d.nO.success("Prompt copied. Paste it into your coding agent.")}catch(e){d.nO.error("Couldn’t copy the prompt to the clipboard")}},M[3]=Q,M[4]=W,M[5]=p):p=M[5];let ee=p,et=$||void 0!==K&&K;M[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,l.jsx)(i.A,{}
1),M[6]=h):h=M[6],M[7]!==$||M[8]!==et?(f=(0,l.jsx)(y,{asChild:!0,children:(0,l.jsxs)(d.$n,{variant:"primary",size:"lg",disabled:et,pending:$,children:["Import",h]})}),M[7]=$,M[8]=et,M[9]=f):f=M[9],M[10]!==Y?(x=null!=Y&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"px-2.5 pb-2 pt-1.5 text-xs leading-snug text-amber-800",children:Y}),(0,l.jsx)(d.mB,{})]}),M[10]=Y,M[11]=x):x=M[11];let en=!X,el=X?void 0:Z;M[12]!==Q||M[13]!==V?(b=()=>{Q("file","upload"),V()},M[12]=Q,M[13]=V,M[14]=b):b=M[14];let ea=X?"items-start gap-2.5 px-2.5 py-2":"items-start gap-2.5 px-2.5 pb-0.5 pt-2";M[15]===Symbol.for("react.memo_cache_sentinel")?(S=(0,l.jsx)(o.A,{className:"mt-0.5 h-4 w-4 shrink-0"}),M[15]=S):S=M[15];let er=X?m.line:null;return M[16]!==er?(A=(0,l.jsx)(C,{label:m.label,line:er}),M[16]=er,M[17]=A):A=M[17],M[18]!==b||M[19]!==ea||M[20]!==A||M[21]!==en||M[22]!==el?(R=(0,l.jsxs)(d._2,{disabled:en,"aria-describedby":el,onSelect:b,className:ea,children:[S,A]}),M[18]=b,M[19]=ea,M[20]=A,M[21]=en,M[22]=el,M[23]=R):R=M[23],M[24]!==Z||M[25]!==X?(I=!X&&(0,l.jsx)("p",{id:Z,role:"none",className:"pb-2 pl-9 pr-2.5 text-xs leading-snug text-muted-foreground",children:_}),M[24]=Z,M[25]=X,M[26]=I):I=M[26],M[27]!==ee?(E=()=>void ee(),M[27]=ee,M[28]=E):E=M[28],M[29]===Symbol.for("react.memo_cache_sentinel")?(T=(0,l.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded bg-black text-white","aria-hidden":!0,children:(0,l.jsx)(c.A,{className:"h-3 w-3"})}),O=(0,l.jsx)(C,{label:t.label,line:t.line,emphasised:!0}),M[29]=T,M[30]=O):(T=M[29],O=M[30]),M[31]===Symbol.for("react.memo_cache_sentinel")?(U=(0,l.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-neutral-200 bg-white","aria-label":"Copy prompt",role:"img",children:(0,l.jsx)(u.A,{className:"h-3.5 w-3.5"})}),M[31]=U):U=M[31],M[32]!==E?(L=(0,l.jsxs)(d._2,{onSelect:E,className:"items-center gap-2.5 bg-neutral-50 px-2.5 py-2 focus:bg-neutral-100",children:[T,O,U]}),M[32]=E,M[33]=L):L=M[33],M[34]===Symbol.for("react.memo_cache_sentinel")?(P=(0,l.jsx)(d.mB,{}),z=(0,l.jsx)(d.lp,{className:"px-2.5 pb-1 pt-2 text-xs font-normal text-muted-foreground",children:N.iI}),M[34]=P,M[35]=z):(P=M[34],z=M[35]),M[36]!==Q||M[37]!==H?(F=n.map(e=>(0,l.jsxs)(d._2,{onSelect:()=>{Q("huggingface"===e.id?"huggingface":"platform",e.id),H(e.id)},className:"items-start gap-2.5 px-2.5 py-1.5",children:["huggingface"===e.id?(0,l.jsx)(s.default,{src:"/img/logos/huggingface.svg",alt:"",width:18,height:18,unoptimized:!0,className:"mt-px"}):(0,l.jsx)(k.v,{label:e.label,className:"mt-px"}),(0,l.jsx)(C,{label:e.label,line:e.line})]},e.id)),M[36]=Q,M[37]=H,M[38]=F):F=M[38],M[39]!==R||M[40]!==I||M[41]!==L||M[42]!==F||M[43]!==x?(D=(0,l.jsxs)(d.SQ,{align:"end",className:"w-[340px] p-1.5",children:[x,R,I,L,P,z,F]}),M[39]=R,M[40]=I,M[41]=L,M[42]=F,M[43]=x,M[44]=D):D=M[44],M[45]!==B||M[46]!==G||M[47]!==D||M[48]!==f?(q=(0,l.jsxs)(g,{modal:!1,open:G,onOpenChange:B,children:[f,D]}),M[45]=B,M[46]=G,M[47]=D,M[48]=f,M[49]=q):q=M[49],q}function C(e){let t,n,r,s=(0,a.c)(8),{label:i,line:o,emphasised:c}=e,u=void 0!==c&&c?"text-[13.5px] font-medium text-foreground":"text-[13.5px] text-foreground";return s[0]!==i||s[1]!==u?(t=(0,l.jsx)("span",{className:u,children:i}),s[0]=i,s[1]=u,s[2]=t):t=s[2],s[3]!==o?(n=null!=o&&(0,l.jsx)("span",{className:"text-xs leading-snug text-muted-foreground",children:o}),s[3]=o,s[4]=n):n=s[4],s[5]!==t||s[6]!==n?(r=(0,l.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[t,n]}),s[5]=t,s[6]=n,s[7]=r):r=s[7],r}},3869:(e,t,n)=>{n.d(t,{K:()=>C});var l=n(96040),a=n(56608),r=n(32672),s=n(43987),i=n(70895),o=n(36772),c=n(61082),u=n(92164),d=n(65403),m=n(44597),p=n(65957),h=n(40329),f=n(83325),x=n(59514);async function g(e,t,n){let l=(0,x.LL)(n);if(404===l||409===l)return"kept";let a="".concat((0,x.Gn)(e),"/benchmarks/").concat(t),r=(0,x.eR)(n);if(!r)try{let e=await (0,x.m9)(a);if("draft"!==e.status||e.updated_at!==e.created_at)return"started"}catch(e){return"kept"}try{let e=await fetch("".concat(a,"?if_untouched=true"),{method:"DELETE"});if(e.ok)return"deleted";return 409!==e.status||r?"kept":"started"}catch(e){return"kept"}}let b={auto_start_completion_chat:!1},y={auto_approve_plan:!0};function v(e){return(null==e?void 0:e.inferTaskType)?{infer_task_type:!0}:{}}function w(e){return e.r2_key}function k(e){return e.r2_key}async function j(e,t){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await (0,x.mk)(n)}var N=n(38285),_=n(65260),S=n(72324);function C(e){var t;let{orgSlug:n,onNormalizeStarted:C,inferTaskType:A=!1,target:R,onRefused:I}=e,[E,T]=(0,l.useState)(null),[O,U]=(0,l.useState)([]),[L,P]=(0,l.useState)([]),[z,F]=(0,l.useState)(null),[D,q]=(0,l.useState)([]),[M,W]=(0,l.useState)(null),[$,K]=(0,l.useState)(""),[G,B]=(0,l.useState)(i.N),[J,V]=(0,l.useState)(null),[H,Y]=(0,l.useState)(!1),[Q,X]=(0,l.useState)(null),[Z,ee]=(0,l.useState)(null),[et,en]=(0,l.useState)(null),[el,ea]=(0,l.useState)(null),[er,es]=(0,l.useState)(null),[ei,eo]=(0,l.useState)(!1),{activeImport:ec,isPreparing:eu,importDatasetFiles:ed,importHuggingFace:em,
1importPlatform:ep,importTrajectoryFiles:eh}=function(e){let t,n,a,r,s,i,N,_,S,C=(0,o.c)(48),{orgSlug:A,onStarted:R,target:I,onRefused:E}=e,T=void 0===I?null:I,[O,U]=(0,l.useState)(null),L=(0,l.useRef)(null),{uploadFiles:P}=(0,m.ix)(A),{deleteBenchmark:z}=(0,p.q)(A),{mutate:F}=(0,u.iX)(),D=(0,h.g)(),{redesignEnabled:q}=(0,d.t$)();C[0]!==E||C[1]!==T?(t=async(e,t,n)=>{if(L.current)return;L.current=e,U(e);let l=()=>{L.current=null,U(null)};try{await n(),null!=T&&l()}catch(n){let e=n instanceof Error?n.message:"Unexpected error";null!=E?E(e,(0,x.Ox)(n)):c.oR.error(t,{description:e}),l()}},C[0]=E,C[1]=T,C[2]=t):t=C[2];let M=t;C[3]!==A?(n=async(e,t,n)=>{let l=await fetch("".concat((0,x.Gn)(A),"/benchmarks"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.slice(0,120),eval_style:t,grading_mode:null!=n?n:null})});if(!l.ok)throw Error(await (0,x.IP)(l));return await l.json()},C[3]=A,C[4]=n):n=C[4];let W=n;C[5]!==D||C[6]!==z||C[7]!==F||C[8]!==R||C[9]!==A||C[10]!==q||C[11]!==T?(a=async(e,t,n,l,a)=>{if(null!=T){let e="".concat((0,x.Gn)(A),"/benchmarks/").concat(t,"/").concat(n);await j(e,{...l,write_mode:null!=a?a:T.writeMode}),R(t);return}try{await j("".concat((0,x.Gn)(A),"/benchmarks/").concat(t,"/").concat(n),l)}catch(n){if(!q)throw function(e){let t=(0,x.LL)(e);return(0,x.eR)(e)&&404!==t&&409!==t}(n)&&await z(t)&&F("".concat((0,x.Gn)(A),"/benchmarks")),n;let e=await g(A,t,n);if("deleted"===e&&F("".concat((0,x.Gn)(A),"/benchmarks")),"deleted"===e||"kept"===e&&404===(0,x.LL)(n))throw n;if("kept"===e){c.oR.error("The import did not start",{description:n instanceof Error?n.message:"Unexpected error"}),R(t);return}}(0,f.Nw)(t,"create",!0),D("optima_benchmark_created",{source:"upload",created_benchmark_id:t,import_kind:e}),R(t)},C[5]=D,C[6]=z,C[7]=F,C[8]=R,C[9]=A,C[10]=q,C[11]=T,C[12]=a):a=C[12];let $=a;C[13]!==(null==T?void 0:T.benchmarkId)?(r=async e=>{var t;return null!=(t=null==T?void 0:T.benchmarkId)?t:(await e()).id},C[13]=null==T?void 0:T.benchmarkId,C[14]=r):r=C[14];let K=r;C[15]!==W||C[16]!==K||C[17]!==q||C[18]!==M||C[19]!==$||C[20]!==P?(s=async(e,t,n,l,a,r)=>{0!==e.length&&await M("datasetFiles","Could not start normalization",async()=>{let s=await P(e),i=await K(()=>{var n,r;return W((null!=(r=null!=t?t:null==(n=e[0])?void 0:n.name)?r:"").replace(/\.[^.]+$/,"")||"Untitled benchmark",l,a)});await $("datasetFiles",i,"normalize",{r2_keys:s.map(k),...n?{task_sheet_name:n}:{},...v(r),...q?b:{}},null==r?void 0:r.writeMode)})},C[15]=W,C[16]=K,C[17]=q,C[18]=M,C[19]=$,C[20]=P,C[21]=s):s=C[21];let G=s;C[22]!==W||C[23]!==K||C[24]!==q||C[25]!==M||C[26]!==$?(i=async(e,t,n,l,a,r)=>{let s=void 0===l?"auto":l;await M("huggingFace","Could not import dataset",async()=>{let l=await K(()=>W(e,n,a));await $("huggingFace",l,"normalize/huggingface",{url:t.trim(),mode:s,...v(r),...q?b:{},...q&&"traces"===s?y:{}})})},C[22]=W,C[23]=K,C[24]=q,C[25]=M,C[26]=$,C[27]=i):i=C[27];let B=i;C[28]!==W||C[29]!==K||C[30]!==q||C[31]!==M||C[32]!==$?(N=async(e,t)=>{let{tasks:n}=e;await M("platform",n?"Could not import tasks":"Could not import trajectories",async()=>{let l=await K(()=>{var t;return W("".concat(e.definition.label," — ").concat(e.dataset.name),null!=(t=null==n?void 0:n.evalStyle)?t:"agentic")}),a={platform:e.platform,connection_id:e.connectionId||null,api_key:e.connectionId?null:e.apiKey.trim(),secondary_api_key:e.connectionId?null:e.secondaryApiKey.trim()||null,dataset:e.dataset.id,base_url:e.connectionId?null:e.baseUrl.trim()||null,workspace:e.connectionId?null:e.workspace.trim()||null,max_tasks:e.maxTasks,...n?{mode:"tasks",...v(t),...q?b:{}}:q?y:{}};await $("platform",l,"normalize/platform",a)})},C[28]=W,C[29]=K,C[30]=q,C[31]=M,C[32]=$,C[33]=N):N=C[33];let J=N;C[34]!==W||C[35]!==K||C[36]!==q||C[37]!==M||C[38]!==$||C[39]!==P?(_=async(e,t)=>{0!==e.length&&await M("trajectoryFiles","Could not import trajectory files",async()=>{let n=await P(e),l=await K(()=>{var t,n;return W((null!=(n=null==(t=e[0])?void 0:t.name)?n:"").replace(/\.[^.]+$/,"")||"Agent trajectories","agentic")});await $("trajectoryFiles",l,"normalize/trajectories",{r2_keys:n.map(w),...q?y:{}}
1,t)})},C[34]=W,C[35]=K,C[36]=q,C[37]=M,C[38]=$,C[39]=P,C[40]=_):_=C[40];let V=_,H=null!=O;return C[41]!==O||C[42]!==G||C[43]!==B||C[44]!==J||C[45]!==V||C[46]!==H?(S={activeImport:O,isPreparing:H,importDatasetFiles:G,importHuggingFace:B,importPlatform:J,importTrajectoryFiles:V},C[41]=O,C[42]=G,C[43]=B,C[44]=J,C[45]=V,C[46]=H,C[47]=S):S=C[47],S}({orgSlug:n,onStarted:C,target:R,onRefused:I});(0,l.useEffect)(()=>{let e=!1;return async function(){try{let[t,l]=await Promise.all([fetch("".concat((0,x.Gn)(n),"/import-platforms"),{cache:"no-store"}),fetch("".concat((0,x.Gn)(n),"/import-platforms/connections"),{cache:"no-store"})]);if(!t.ok)throw Error(await (0,x.IP)(t));if(!l.ok)throw Error(await (0,x.IP)(l));let a=S.be.parse(await t.json()),r=S.cp.parse(await l.json());if(e)return;U(a.platforms),P(r.connections)}catch(t){e||F(t instanceof Error?t.message:"Could not load platforms")}}(),()=>{e=!0}},[n]);let ef=O.find(e=>e.key===E),ex=(0,l.useMemo)(()=>(0,s.Y)(D,M),[D,M]),eg=(0,l.useCallback)(e=>{T(e),q([]),W(null),K(""),B(i.N),V(null),X(null),Y(!1),ee(null),en(null),ea(null),es(null)},[]),eb=(0,l.useCallback)(e=>{K(e),ee(null),en(null),es(null)},[]);(0,l.useEffect)(()=>{if("local"!==E)return;let e=ex.dataset;if(!e){V(null),X(null);return}let t=!1;return Y(!0),X(null),(0,N.op)(e,ex.referenceFiles.length).then(n=>{t||(V(n),ee(null),null==n&&X("We could not read ".concat(e.name," here — check it is valid.")))}).finally(()=>{t||Y(!1)}),()=>{t=!0}},[E,ex.dataset,ex.referenceFiles.length]),(0,l.useEffect)(()=>{"local"!==E&&"huggingface"!==E&&ef&&V(G.dataset?(0,N.zl)(ef.label,G.dataset):null)},[E,ef,G.dataset]);let ey=null!=E&&"local"!==E&&"huggingface"!==E,ev=null!=(t=null!=Z?Z:null==J?void 0:J.kind)?t:ey?"traces":null,ew=et?(0,a.h)(et):"objective",ek=null!=er?er:ew;(0,l.useEffect)(()=>{if(A||null==J||"tasks"!==ev)return void ea(null);let e=!1;return eo(!0),(0,_.A1)(n,(0,_.Sf)(J),J.columns).then(t=>{e||ea((null==t?void 0:t.style)!=null?(0,_.kC)(t.style,J):null)}).finally(()=>{e||eo(!1)}),()=>{e=!0}},[n,J,ev,A]);let ej=(0,l.useCallback)(e=>{en(e),es(null)},[]),eN="traces"===ev,e_="tasks"===ev,eS=null!=J&&!eu&&!H&&(!e_||null!=et||A)&&("local"===E?D.length>0:"huggingface"===E?(0,r.cO)($):null!=G.dataset),eC=e=>{if(!ef||!G.dataset)return;let t="tasks"===e;ep({platform:E,definition:ef,dataset:G.dataset,connectionId:G.connectionId,apiKey:G.apiKey,secondaryApiKey:G.secondaryApiKey,baseUrl:G.baseUrl,workspace:G.workspace,maxTasks:G.maxTasks,...t?{tasks:{evalStyle:"qa"}}:{}},t?{inferTaskType:!0}:void 0)},eA=A?{inferTaskType:!0}:void 0;return{source:E,changeSource:eg,platformDefinitions:O,platformDefinition:ef,platformConnections:L,setPlatformConnections:P,platformLoadError:z,files:D,setFiles:q,datasetName:M,setDatasetName:W,hfUrl:$,changeHuggingFaceUrl:eb,platformSelection:G,setPlatformSelection:B,shape:J,setShape:V,isDetecting:H,setIsDetecting:Y,detectError:Q,setDetectError:X,kindOverride:Z,setKindOverride:ee,isTraces:eN,needsEvalStyle:e_,evalStyle:et,chooseEvalStyle:ej,recommendedStyle:el,isRecommending:ei,gradingRecommendation:ew,chosenGradingMode:ek,setGradingMode:es,activeImport:ec,isPreparing:eu,canImport:eS,startImport:()=>{var e,t,n;let l=eN?"agentic":A?"qa":null!=et?et:"agentic";if("local"===E)return eN?void eh(D):void ed(D,null!=(t=null==(e=ex.dataset)?void 0:e.name)?t:null,ex.taskSheetName,l,A?void 0:ek,eA);if("huggingface"===E){let e=null!=(n=null==J?void 0:J.label)?n:$.trim();(0,r.cO)($)&&em(e,$,l,null!=ev?ev:"auto",e_&&!A?ek:void 0,eA);return}eC("traces")}
1,importPlatformAs:eC,importCheckedFile:(e,t,n)=>{if("traces"===t)return void eh([e],n);ed([e],e.name,e.name,"qa",void 0,{inferTaskType:!0,writeMode:n})}}}},3895:(e,t,n)=>{n.d(t,{p:()=>s});var l=n(58212),a=n(96040),r=n(27724);let s=a.forwardRef((e,t)=>{let{className:n,type:a,...s}=e;return(0,l.jsx)("input",{type:a,className:(0,r.cn)("flex h-9 w-full rounded-lg border border-neutral-100 bg-transparent px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-neutral-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:t,...s})});s.displayName="Input"},24351:(e,t,n)=>{n.d(t,{Collapsible:()=>a,CollapsibleContent:()=>s,CollapsibleTrigger:()=>r});var l=n(48266);let a=l.bL,r=l.R6,s=l.Ke},26571:(e,t,n)=>{n.d(t,{b9:()=>c,iI:()=>s,r0:()=>r,rf:()=>o,rv:()=>l,yV:()=>i,z3:()=>u});let l=500,a="Traces \xb7 first ".concat(l," records"),r=[{id:"upload",label:"Upload file",group:"direct",line:"A task sheet, eval, eval description or trace export \xb7 Excel, CSV, JSON, PDF, Word"},{id:"coding-agent",label:"Your coding agent",group:"direct",line:"Paste prompt into your agent"},{id:"huggingface",label:"Hugging Face",group:"stored",line:"Tasks or traces \xb7 first 200 tasks or 500 records"},{id:"braintrust",label:"Braintrust",group:"stored",line:a},{id:"langfuse",label:"Langfuse",group:"stored",line:a},{id:"langsmith",label:"LangSmith",group:"stored",line:a},{id:"comet_opik",label:"Comet Opik",group:"stored",line:a},{id:"arize_ax",label:"Arize AX",group:"stored",line:a}],s="Datasets or traces you already store";function i(e){return null==e}function o(e){return r.find(t=>t.id===e)}function c(e){let t=e.needs_secondary_key?"Secret key + public key":"API key";if(!e.needs_workspace)return t;let n=e.workspace_label;return"".concat(t," + ").concat(/^[A-Z][a-z]+$/.test(n)?n.toLowerCase():n)}let u={braintrust:"https://www.braintrust.dev/app/~/configuration/org/api-keys",arize_ax:"https://arize.com/docs/ax/security-and-settings/api-keys",langfuse:"https://langfuse.com/faq/all/where-are-langfuse-api-keys",langsmith:{US:"https://smith.langchain.com/settings",EU:"https://eu.smith.langchain.com/settings"},comet_opik:"https://www.comet.com/account-settings/apiKeys"}},32672:(e,t,n)=>{n.d(t,{J$:()=>x,KU:()=>g,ZR:()=>y,bR:()=>b,cO:()=>f});var l=n(58212),a=n(96040),r=n(33505),s=n(1573),i=n(24121),o=n(72324),c=n(59514),u=n(35984),d=n(38285),m=n(39540);let p=/(?:^|[^\w.:/@-])(?:https?:\/\/)?(?:www\.)?(?:huggingface|hf)\.co(?:[/:]|$)|git@(?:huggingface|hf)\.co:|hf:\/\/|load_dataset\(/i,h=/^(?:(?:datasets|spaces|buckets)\/)?[\w.-]+\/[\w.-]+(?:@\S*)?\/?$/;function f(e){let t=e.trim();return p.test(t)||h.test(t)}let x="That does not look like a Hugging Face link. Paste a dataset or bucket URL, or the org/name shorthand.",g=/gated|token|not found|private|access/i;async function b(e,t){let n=await fetch("".concat((0,c.Gn)(e),"/huggingface/preview"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:t})});if(!n.ok)throw Error(await (0,c.IP)(n));return o.aV.parse(await n.json())}function y(e){let{orgSlug:t,url:n,onUrlChange:o,onShapeChange:c,onDetectingChange:p,onErrorChange:h,disabled:y}=e,[v,w]=(0,a.useState)(!1),k=(0,a.useRef)(0),{account:j,isLoading:N,isSaving:_,connect:S,disconnect:C,refresh:A}=(0,u.D)(t),R=f(n),[I,E]=(0,a.useState)(""),T=n.trim()!==I,O=(0,a.useCallback)(async()=>{let e=n.trim();if(E(e),c(null),!f(e))return void h(x);let l=++k.current;p(!0),h(null);try{let n=await b(t,e);if(k.current!==l)return;c((0,d.uA)(n))}catch(t){if(k.current!==l)return;let e=t instanceof Error?t.message:"Could not read that dataset";c(null),h(e),g.test(e)&&w(!0)}finally{k.current===l&&p(!1)}},[n,t,c,p,h]);return(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("input",{type:"text",value:n,onChange:e=>{o(e.target.value),c(null),h(null)},onKeyDown:e=>{"Enter"!==e.key||y||O()},disabled:y,placeholder:"https://huggingface.co/datasets/org/name",className:"min-w-0 flex-1 rounded-lg border bg-background px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-60"}),(0,l.jsxs)(r.$,{onClick:()=>void O(),disabled:y||0===n.trim().length,variant:"outline",className:"shrink-0 gap-1.5",children:[(0,l.jsx)(s.A,{className:"h-3.5 w-3.5"}),"Check"]})]}),(0,l.jsxs)("p",{className:"text-xs text-neutral-500",children:["A dataset or bucket link, an ",(0,l.jsx)("code",{className:"text-[11px]",children:"org/name"})," shorthand, or a link into one config or split. Either a table of tasks or a set of agent traces — press Check and we read it and tell you which."]}),T&&R&&(0,l.jsx)("p",{className:"text-xs text-amber-600",children:"Press Check to read this dataset."}),N?(0,l.jsxs)("p",{className:"flex items-center gap-1.5 text-xs text-neutral-400",children:[(0,l.jsx)(i.A,{className:"h-3 w-3 animate-spin"}),"Checking your Hugging Face connection…"]}):v||j?(0,l.jsx)(m.p,{account:j,isSaving:_,connect:async e=>{let t=await S(e);return R&&O(),t},disconnect:async()=>{await C(),await A()},purpose:"import"}):(0,l.jsx)("button",{type:"button",onClick:()=>w(!0),className:"text-xs text-neutral-500 underline underline-offset-2 hover:text-neutral-900",children:"Importing a private or gated dataset?"})]})}},36368:(e,t,n)=>{n.d(t,{XP:()=>c,ho:()=>o,jc:()=>i});var l=n(58212),a=n(36772),r=n(92515),s=n(27724);let i=[{id:"use-case",label:"Use Case"},{id:"plan",label:"Plan"},{id:"dataset",label:"Dataset"}],o=[{id:"use-case",label:"Upload Data"},{id:"dataset",label:"Dataset"}];function c(e){let t,n,i,o,c=(0,a.c)(20),{steps:u,activeId:d,reachedId:m,onStepClick:p}=e;if(c[0]!==d||c[1]!==u){let e;c[3]!==d?(e=e=>e.id===d,c[3]=d,c[4]=e):e=c[4],t=u.findIndex(e),c[0]=d,c[1]=u,c[2]=t}else t=c[2];let h=t;c[5]!==h||c[6]!==m||c[7]!==u?(n=null!=m?u.findIndex(e=>e.id===m):h,c[5]=h,c[6]=m,c[7]=u,c[8]=n):n=c[8];let f=n;if(c[9]!==h||c[10]!==p||c[11]!==f||c[12]!==u){let e;c[14]!==h||c[15]!==p||c[16]!==f?(e=(e,t)=>{let n=t===h,a=t<=f,i=null!=p&&a&&!n;return(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-3",children:[t>0&&(0,l.jsx)("span",{className:"h-px w-8 shrink-0 bg-neutral-200"}),(0,l.jsxs)("button",{type:"button",disabled:!i&&!n,"aria-current":n?"step":void 0,onClick:i?()=>p(e.id):void 0,className:(0,s.cn)("group flex shrink-0 items-center gap-2 whitespace-nowrap rounded-full py-0.5 pr-1 transition-colors",!a&&"cursor-default"),children:[(0,l.jsx)("span",{className:(0,s.cn)("flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-semibold transition-colors",n?"bg-black text-white shadow-sm":a?"bg-neutral-100 text-neutral-700 group-hover:bg-neutral-200":"border border-neutral-200 bg-background text-neutral-400"),children:a&&!n?(0,l.jsx)(r.A,{className:"h-3.5 w-3.5"}):t+1}),(0,l.jsx)("span",{className:(0,s.cn)("text-sm transition-colors",n?"font-semibold text-neutral-900":a?"font-medium text-neutral-600 group-hover:text-neutral-900":"font-medium text-neutral-400"),children:e.label})]})]},e.id)}
1,c[14]=h,c[15]=p,c[16]=f,c[17]=e):e=c[17],i=u.map(e),c[9]=h,c[10]=p,c[11]=f,c[12]=u,c[13]=i}else i=c[13];return c[18]!==i?(o=(0,l.jsx)("nav",{"aria-label":"Benchmark creation progress",className:"flex items-center gap-3 overflow-x-auto py-1",children:i}),c[18]=i,c[19]=o):o=c[19],o}},38285:(e,t,n)=>{n.d(t,{BI:()=>c,GW:()=>f,op:()=>d,uA:()=>o,zl:()=>u});var l=n(92785);let a=["messages","message_history","conversation","conversations","chat","chats","dialog","dialogue","turns","trajectory","trajectories","steps","history","transcript","events","trace","spans","tool_calls","agent_steps"],r=["trace_id","traceid","conversation_id","session_id","root_span_id"],s=["span_id","spanid","observation_id","run_id","parent_id","parent_span_id"],i={tasks:200,traces:500};function o(e){let t=["".concat(e.tables.length," ").concat(1===e.tables.length?"table":"tables"),"".concat(e.file_count," files")];return e.reference_file_count>0&&t.push("".concat(e.reference_file_count," reference files")),e.private&&t.push("private"),e.gated&&t.push("gated"),{kind:e.kind,reason:e.kind_reason,label:e.repo_id,columns:e.columns,rowCount:e.row_count,rowCap:i,facts:t,cardExcerpt:e.card_excerpt,sampleRows:e.sample_rows,warnings:e.warnings}}function c(e,t){if(null==e.rowCap||null==e.rowCount)return e.facts;let n=e.rowCap[t];return["".concat(e.rowCount.toLocaleString()," rows"),...e.rowCount>n?["importing the first ".concat(n)]:[],...e.facts]}function u(e,t){return{kind:"traces",reason:"".concat(e," exports agent runs, so each record is one step of a trace"),label:"".concat(e," \xb7 ").concat(t.name),columns:[],rowCount:t.record_count,facts:[t.kind,...null!=t.record_count?["".concat(t.record_count," records")]:[]],cardExcerpt:"",sampleRows:[],warnings:[]}}async function d(e,t){var n;let l=e.name.toLowerCase(),a=[(n=null,""),...t>0?["".concat(t," reference files")]:[]];if(l.endsWith(".zip"))return{kind:"tasks",reason:"we will find the dataset inside the archive after upload",label:e.name,columns:[],rowCount:null,facts:["archive",...t>0?["+".concat(t," more files")]:[]],cardExcerpt:"",sampleRows:[],warnings:[]};if(e.size>0x1900000)return{kind:"tasks",reason:"too large to read here — we will read it after upload",label:e.name,columns:[],rowCount:null,facts:a.filter(Boolean),cardExcerpt:"",sampleRows:[],warnings:[]};let r=await m(e,l);if(null==r)return null;let s=[...new Set(r.flatMap(e=>Object.keys(e)))],{kind:i,reason:o}=f(s,r);return{kind:i,reason:o,label:e.name,columns:s,rowCount:null,facts:["".concat(s.length," ").concat(1===s.length?"column":"columns"),...t>0?["".concat(t," reference files")]:[]],cardExcerpt:"",sampleRows:r.slice(0,4).map(e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,n]=e;return[t,String(null!=n?n:"").slice(0,400)]}))),warnings:[]}}async function m(e,t){try{var n,a;if(t.endsWith(".xlsx")||t.endsWith(".xlsm")){let t=l.LF(await e.arrayBuffer(),{type:"array",sheetRows:21}),a=t.Sheets[null!=(n=t.SheetNames[0])?n:""];if(!a)return null;return l.Wp.sheet_to_json(a).slice(0,20)}let s=await e.slice(0,524288).text();if(t.endsWith(".csv")||t.endsWith(".tsv")){let e=l.LF(s,{type:"string",raw:!0,sheetRows:21}),t=e.Sheets[null!=(a=e.SheetNames[0])?a:""];if(!t)return null;return l.Wp.sheet_to_json(t).slice(0,20)}if(t.endsWith(".jsonl")||t.endsWith(".json")){var r=s;let e=r.trim();if(e.startsWith("[")){let t=e.lastIndexOf("},"),n=p(-1===t?e:"".concat(e.slice(0,t+1),"]"));return Array.isArray(n)?n.filter(h).slice(0,20):null}let t=e.split("\n").map(e=>p(e.trim())).filter(h).slice(0,20);return t.length>0?t:null}}catch(e){}return null}function p(e){if(!e)return null;try{return JSON.parse(e)}catch(e){return null}}function h(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}function f(e,t){let n=new Map(e.map(e=>[e.toLowerCase(),e]));for(let e of a){let l=n.get(e);if(l&&t.some(e=>(function(e){let t="string"==typeof e&&e.trim().startsWith("[")?p(e):e;if(!Array.isArray(t)||0===t.length)return!1;let n=t.slice(0,5).filter(h);if(0===n.length)return!1;let l=[["role","content"],["from","value"],["role","parts"],["name","arguments"],["type","content"]];return n.some(e=>l.some(t=>t.every(t=>t in e)))})(e[l])))return{kind:"traces",reason:"the '".concat(l,"' column holds a list of conversation turns")}}let l=r.find(e=>n.has(e)),i=s.some(e=>n.has(e));if(l&&i)return{kind:"traces",reason:"the file carries trace and span identifiers, so each row is one step of a trace"};if(l&&t.length>1){let e=t.map(e=>{var t,a;return String(null!=(a=e[null!=(t=n.get(l))?t:""])?a:"")}
1).filter(Boolean);if(e.length>0&&new Set(e).size<e.length)return{kind:"traces",reason:"'".concat(l,"' repeats across rows, so each row is one step of a trace")}}return{kind:"tasks",reason:"each row looks like one task"}}},43987:(e,t,n)=>{n.d(t,{p:()=>I,Y:()=>R});var l=n(58212),a=n(36772),r=n(96040),s=n(33505),i=n(27724),o=n(77947),c=n(29448),u=n(72484),d=n(26959),m=n(1488),p=n(30332),h=n(10743),f=n(49961);let x=[{name:"prompt",requirement:"required",what:"What the model is asked to do, exactly as it will see it."},{name:"rubric",requirement:"required",what:"How a good answer is told from a poor one. Read only by the judge, never by the model."},{name:"title",requirement:"recommended",what:"A short label for the task. Written for you if you leave it out."},{name:"category",requirement:"recommended",what:"How results break down in the charts, e.g. Refunds, Billing."},{name:"reference_files",requirement:"optional",what:"Filenames the task needs as input — upload them alongside."},{name:"expected_deliverables",requirement:"optional",what:"Filenames the model must produce, e.g. forecast.xlsx."},{name:"system_prompt",requirement:"optional",what:"Per-task answering instructions, if a task needs its own."}],g=[{title:"Reconcile supplier ledger",category:"Reconciliation",prompt:"Reconcile the supplier ledger in ledger_q3.xlsx against the bank statement in bank_q3.csv. List every unmatched line with its amount and a likely cause, and save your findings as reconciliation.xlsx.",reference_files:"ledger_q3.xlsx, bank_q3.csv",expected_deliverables:"reconciliation.xlsx",rubric:"Finds all four unmatched lines (\xa31,240.00, \xa386.50, \xa33,900.00, \xa312.75). Gives a plausible cause for each. Totals in the summary row match the sum of the listed lines."},{title:"Draft a late-payment chaser",category:"Correspondence",prompt:"Write an email to a customer 45 days late on invoice INV-2287 for \xa33,900. Keep the relationship intact, state the amount and the date, and offer a payment plan.",reference_files:"",expected_deliverables:"",rubric:"States the invoice number, the amount and how late it is. Offers a payment plan. Stays polite throughout and never threatens legal action."}],b=["title","category","prompt","system_prompt","reference_files","expected_deliverables","rubric"];function y(e){let t,n,o,c,u,d,m,p,b=(0,a.c)(17),{className:y}=e,[_,S]=(0,r.useState)(!1);b[0]!==y?(t=(0,i.cn)("rounded-xl border bg-neutral-50/60",y),b[0]=y,b[1]=t):t=b[1],b[2]===Symbol.for("react.memo_cache_sentinel")?(n=()=>S(N),b[2]=n):n=b[2],b[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,l.jsxs)("span",{className:"min-w-0",children:[(0,l.jsx)("span",{className:"block text-sm font-semibold text-neutral-900",children:"What should my file look like?"}),(0,l.jsx)("span",{className:"mt-0.5 block text-xs text-neutral-500",children:"One row per task, one column per field — plus a rubric saying how each task is judged."})]}),b[3]=o):o=b[3];let C=_&&"rotate-180";return b[4]!==C?(c=(0,i.cn)("h-4 w-4 shrink-0 text-neutral-400 transition-transform",C),b[4]=C,b[5]=c):c=b[5],b[6]!==c?(u=(0,l.jsx)(h.A,{className:c}),b[6]=c,b[7]=u):u=b[7],b[8]!==_||b[9]!==u?(d=(0,l.jsxs)("button",{type:"button",onClick:n,"aria-expanded":_,className:"flex w-full items-center justify-between gap-3 px-4 py-3 text-left",children:[o,u]}),b[8]=_,b[9]=u,b[10]=d):d=b[10],b[11]!==_?(m=_&&(0,l.jsxs)("div",{className:"space-y-4 border-t px-4 py-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-neutral-500",children:"Columns"}),(0,l.jsx)("ul",{className:"space-y-1.5",children:x.map(j)}),(0,l.jsx)("p",{className:"mt-2 text-xs text-neutral-500",children:"Your own column names are fine — we read the file and map them for you. Anything missing is asked for in a short chat after the import, so nothing here has to be right first time."})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-neutral-500",children:"Example"}),(0,l.jsx)("div",{className:"overflow-x-auto rounded-lg border bg-white",children:(0,l.jsxs)("table",{className:"w-full min-w-[720px] border-collapse text-left text-xs",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{className:"border-b bg-neutral-50 text-[11px] uppercase tracking-wide text-neutral-500",children:[(0,l.jsx)("th",{className:"px-3 py-2 font-semibold",children:"title"}),(0,l.jsx)("th",{className:"px-3 py-2 font-semibold",children:"category"}),(0,l.jsx)("th",{className:"px-3 py-2 font-semibold",children:"prompt"}),(0,l.jsx)("th",{className:"px-3 py-2 font-semibold",children:"reference_files"}),(0,l.jsx)("th",{className:"px-3 py-2 font-semibold",children:"rubric"})]})}),(0,l.jsx)("tbody",{children:g.map(k)})]})})]}),(0,l.jsxs)("div",{className:"rounded-lg border border-brand-mint/60 bg-brand-mint/10 px-3 py-2.5",children:[(0,l.jsx)("p",{className:"text-xs font-semibold text-neutral-900",children:"Writing a rubric"}),(0,l.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-neutral-600",children:"Write what you would check if you were marking the work yourself: the specific figures, the sections that must appear, the mistakes that would fail it. One or two sentences per task is enough."}),(0,l.jsxs)("p",{className:"mt-1.5 text-xs text-neutral-600",children:[(0,l.jsx)("span",{className:"font-medium text-emerald-700",children:"Good:"})," “Reports the \xa31,240.00 discrepancy, names the duplicate invoice as the cause, and totals to \xa35,239.25.”"]}),(0,l.jsxs)("p",{className:"mt-0.5 text-xs text-neutral-600",children:[(0,l.jsx)("span",{className:"font-medium text-amber-700",children:"Too vague:"})," “The answer should be accurate and well-written.”"]})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-t pt-3",children:[(0,l.jsxs)(s.$,{variant:"outline",size:"sm",className:"gap-1.5",onClick:w,children:[(0,l.jsx)(f.A,{className:"h-3.5 w-3.5"}),"Download CSV template"]}),(0,l.jsxs)(s.$,{variant:"outline",size:"sm",className:"gap-1.5",onClick:v,children:[(0,l.jsx)(f.A,{className:"h-3.5 w-3.5"}),"Download JSONL template"]}),(0,l.jsx)("span",{className:"text-xs text-neutral-500",children:"Filled in with the two example tasks above."})]})]}),b[11]=_,b[12]=m):m=b[12],b[13]!==t||b[14]!==d||b[15]!==m?(p=(0,l.jsxs)("div",{className:t,children:[d,m]}),b[13]=t,b[14]=d,b[15]=m,b[16]=p):p=b[16],p}function v(){return _("jsonl")}function w(){return _("csv")}function k(e){return(0,l.jsxs)("tr",{className:"border-b align-top last:border-0",children:[(0,l.jsx)("td",{className:"px-3 py-2 text-neutral-900",children:e.title}),(0,l.jsx)("td",{className:"px-3 py-2 text-neutral-600",children:e.category}),(0,l.jsx)("td",{className:"max-w-[280px] px-3 py-2 text-neutral-600",children:e.prompt}),(0,l.jsx)("td",{className:"px-3 py-2 text-neutral-600",children:e.reference_files||"—"}),(0,l.jsx)("td",{className:"max-w-[280px] px-3 py-2 text-neutral-600",children:e.rubric})]},e.title)}function j(e){return(0,l.jsxs)("li",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs",children:[(0,l.jsx)("code",{className:"rounded bg-white px-1.5 py-0.5 font-mono text-[11px] text-neutral-900 ring-1 ring-neutral-200",children:e.name}),(0,l.jsx)("span",{className:(0,i.cn)("rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide","required"===e.requirement?"bg-amber-100 text-amber-800":"recommended"===e.requirement?"bg-neutral-200 text-neutral-700":"bg-neutral-100 text-neutral-500"),
1children:e.requirement}),(0,l.jsx)("span",{className:"text-neutral-600",children:e.what})]},e.name)}function N(e){return!e}function _(e){let t=g.map(e=>({title:e.title,category:e.category,prompt:e.prompt,system_prompt:"",reference_files:e.reference_files,expected_deliverables:e.expected_deliverables,rubric:e.rubric})),n=new Blob(["csv"===e?"\uFEFF"+[b.join(","),...t.map(e=>b.map(t=>{var n;return n=e[t],'"'.concat(n.replaceAll('"','""'),'"')}).join(","))].join("\n"):t.map(e=>JSON.stringify(e)).join("\n")],{type:"csv"===e?"text/csv;charset=utf-8":"application/jsonl"}),l=URL.createObjectURL(n),a=document.createElement("a");a.href=l,a.download="optima-task-template.".concat(e),document.body.appendChild(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(l),1e3)}let S=[".xlsx",".xlsm",".csv",".tsv",".jsonl",".json"],C=e=>S.some(t=>e.name.toLowerCase().endsWith(t)),A=e=>e.name.toLowerCase().endsWith(".zip");function R(e,t){var n,l,a,r;let s=e.filter(C),i=e.filter(A),o=null!=(l=null!=(n=s.find(e=>e.name===t))?n:s.at(0))?l:null,c=null!=(a=null!=o?o:i.at(0))?a:null;return{files:e,dataset:c,taskSheetName:null!=(r=null==o?void 0:o.name)?r:null,referenceFiles:e.filter(e=>e!==c&&!A(e)),zips:i}}function I(e){var t;let{files:n,datasetName:a,onFilesChange:d,onDatasetNameChange:p,disabled:h}=e,f=(0,r.useRef)(null),{tabular:x,zips:g,dataset:b,referenceFiles:v}=(0,r.useMemo)(()=>({...R(n,a),tabular:n.filter(C)}),[n,a]),w=(0,r.useCallback)(e=>{e.length>0&&d([...n,...e])},[n,d]),k=(0,r.useCallback)(e=>d(n.filter(t=>t!==e)),[n,d]),{isDragging:j,dropZoneProps:N}=(0,m.z)(w);return(0,l.jsxs)("div",{className:"space-y-3",children:[0===n.length&&(0,l.jsx)(y,{}),(0,l.jsxs)("div",{...N,className:(0,i.cn)("flex flex-col items-center justify-center rounded-xl border-2 border-dashed px-6 py-8 text-center transition-colors",j?"border-black bg-neutral-50":"border-neutral-200",h&&"pointer-events-none opacity-60"),children:[(0,l.jsx)(o.A,{className:"mb-2 h-6 w-6 text-neutral-400"}),(0,l.jsx)("p",{className:"text-sm font-medium text-neutral-900",children:"Drop your files"}),(0,l.jsx)("p",{className:"mt-1 max-w-md text-xs text-neutral-500",children:"A spreadsheet, CSV, or JSONL — one row per task, or one row per agent trajectory — plus any files your tasks use. Or drop one ZIP with everything."}),(0,l.jsxs)(s.$,{variant:"outline",size:"sm",className:"mt-3 gap-1.5",onClick:()=>{var e;return null==(e=f.current)?void 0:e.click()},children:[(0,l.jsx)(o.A,{className:"h-3.5 w-3.5"}),"Choose files"]}),(0,l.jsx)("input",{ref:f,type:"file",multiple:!0,className:"hidden",onChange:e=>{var t;w(Array.from(null!=(t=e.target.files)?t:[])),e.target.value=""}})]}),n.length>0&&(0,l.jsxs)("div",{className:"space-y-3",children:[x.length>0&&(0,l.jsx)(E,{label:"Dataset",children:x.length>1?(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)("select",{value:null!=(t=null==b?void 0:b.name)?t:"",onChange:e=>p(e.target.value),className:"w-full rounded-lg border bg-background px-3 py-2 text-sm",children:x.map(e=>(0,l.jsx)("option",{value:e.name,children:e.name},e.name))}),(0,l.jsx)("p",{className:"text-xs text-neutral-500",children:"Other spreadsheets are treated as reference files."})]}):b&&(0,l.jsx)(T,{file:b,Icon:c.A,onRemove:()=>k(b)})}),g.length>0&&(0,l.jsx)(E,{label:"Archive",children:(0,l.jsx)("ul",{className:"space-y-1.5",children:g.map((e,t)=>(0,l.jsx)("li",{children:(0,l.jsx)(T,{file:e,Icon:u.A,note:"expanded after upload — we'll find the dataset inside",onRemove:()=>k(e)})},"".concat(e.name,"-").concat(t)))})}),v.length>0&&(0,l.jsx)(E,{label:"Reference files",children:(0,l.jsx)("ul",{className:"space-y-1.5",children:v.map((e,t)=>(0,l.jsx)("li",{children:(0,l.jsx)(T,{file:e,Icon:o.A,onRemove:()=>k(e)})},"".concat(e.name,"-").concat(t)))})}),0===x.length&&0===g.length&&(0,l.jsx)("p",{className:"text-xs text-amber-600",children:"No spreadsheet, CSV or JSONL here — we need one file with a row per task or per trajectory."})]})]})}function E(e){let t,n,r=(0,a.c)(5),{label:s,children:i}=e;return r[0]!==s?(t=(0,l.jsx)("div",{className:"mb-1.5 text-xs font-semibold text-neutral-900",children:s}),r[0]=s,r[1]=t):t=r[1],r[2]!==i||r[3]!==t?(n=(0,l.jsxs)("div",{children:[t,i]}),r[2]=i,r[3]=t,r[4]=n):n=r[4],n}function T(e){let t,n,r,s,i,o,c,u,m,h=(0,a.c)(21),{file:f,Icon:x,note:g,onRemove:b}=e;return h[0]!==x?(t=(0,l.jsx)(x,{className:"h-4 w-4 shrink-0 text-neutral-400"}),h[0]=x,h[1]=t):t=h[1],h[2]!==f.name?(n=(0,l.jsx)("div",{className:"truncate",children:f.name}),h[2]=f.name,h[3]=n):n=h[3],h[4]!==g?(r=g&&(0,l.jsx)("div",{className:"text-[11px] text-neutral-400",children:g}),h[4]=g,h[5]=r):r=h[5],h[6]!==n||h[7]!==r?(s=(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[n,r]}),h[6]=n,h[7]=r,h[8]=s):s=h[8],h[9]!==f.size?(i=(0,p.v7)(f.size),h[9]=f.size,h[10]=i):i=h[10],h[11]!==i?(o=(0,l.jsx)("span",{className:"shrink-0 text-xs text-neutral-500",children:i}),h[11]=i,h[12]=o):o=h[12],h[13]===Symbol.for("react.memo_cache_sentinel")?(c=(0,l.jsx)(d.A,{className:"h-3.5 w-3.5"}),h[13]=c):c=h[13],h[14]!==b?(u=(0,l.jsx)("button",{type:"button",onClick:b,className:"rounded p-0.5 text-neutral-400 hover:bg-neutral-100 hover:text-red-500",children:c}),h[14]=b,h[15]=u):u=h[15],h[16]!==t||h[17]!==s||h[18]!==o||h[19]!==u?(m=(0,l.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border px-3 py-2 text-sm",children:[t,s,o,u]}),h[16]=t,h[17]=s,h[18]=o,h[19]=u,h[20]=m):m=h[20],m}},44742:(e,t,n)=>{n.d(t,{v:()=>s});var l=n(58212),a=n(36772),r=n(27724);function s(e){let t,n,s,i=(0,a.c)(7),{label:o,className:c}=e;return i[0]!==c?(t=(0,r.cn)("flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded border border-neutral-100 bg-muted text-[10px] font-medium text-neutral-700",c),i[0]=c,i[1]=t):t=i[1],i[2]!==o?(n=o.charAt(0),i[2]=o,i[3]=n):n=i[3],i[4]!==t||i[5]!==n?(s=(0,l.jsx)("span",{className:t,"aria-hidden":!0,
1children:n}),i[4]=t,i[5]=n,i[6]=s):s=i[6],s}},47848:(e,t,n)=>{n.d(t,{J:()=>G});var l=n(58212),a=n(36772),r=n(96040),s=n(98148),i=n(72484),o=n(26959),c=n(83575),u=n(10743),d=n(83386),m=n(33505),p=n(27724),h=n(41151),f=n(59514),x=n(44597),g=n(52816),b=n(8734),y=n(83325),v=n(40329),w=n(34234),k=n(88515),j=n(46881),N=n(60568),_=n(97245);let S=new Set(["qa","document_input","agentic","interaction"]);function C(e,t){let n=A(t)&&A(t.detail)?t.detail:{},l="string"==typeof n.code?n.code:null;return{message:e,code:l,resumableRunId:"agent_resumable"===l&&"string"==typeof n.run_id?n.run_id:null,hold:"hold_required"===l||"hold_changed"===l?function(e){let{eval_style:t,hold_usd:n}=e;return"string"==typeof t&&S.has(t)?{eval_style:t,hold_usd:"string"==typeof n||"number"==typeof n?String(n):null}:null}(n):null}}function A(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}function R(e,t,n){if(null==t||(0,_.gU)(t)!==e)return null!=n&&(0,_.gU)(n)===e?null:e}var I=n(30332),E=n(3693),T=n(65918),O=n(56540),U=n(27433),L=n(65403),P=n(65260);let z=new Map,F=new Map,D=new Map,q=new Set;function M(e){return q.add(e),()=>{q.delete(e)}}function W(){}function $(e){return e+1}var K=n(83305);function G(e){var t,n,i;let o,c,u,m,_,S,A,R,I,U,G,J,V,Y,X,Z,et,el,ea,es,ei=(0,a.c)(80),{target:eo,bundle:ec,onBundleDone:eu,locked:ed,onBusyChange:em,rowsSaving:ep}=e,eh=void 0===ec?null:ec,ef=void 0!==ed&&ed,ex="draft"===eo.kind?eo.benchmarkId:null;ei[0]!==ex?(o=()=>null==ex?null:function(e){if((null==er?void 0:er.benchmarkId)!==e)return null;let t=er;return er=null,t}(ex),ei[0]=ex,ei[1]=o):o=ei[1];let[eg]=(0,r.useState)(o),[eb,ey]=(0,r.useState)(null!=(t=null==eg?void 0:eg.bundle)?t:null),ev=null!=eh?eh:eb,[ew,ek]=(0,r.useState)(null!=eg&&null==eg.bundle),ej=ew||null!=ev,[eN,e_]=(0,r.useState)((null==eg?void 0:eg.bundle)==null&&null!=(n=null==eg?void 0:eg.description)?n:"");ei[2]!==ev||ei[3]!==eN?(c=null!=ev?(0,k.qu)(ev):eN,ei[2]=ev,ei[3]=eN,ei[4]=c):c=ei[4];let eS=c;ei[5]!==(null==eg?void 0:eg.documents)?(u=null!=(i=null==eg?void 0:eg.documents)?i:[],ei[5]=null==eg?void 0:eg.documents,ei[6]=u):u=ei[6];let[eC,eA]=(0,r.useState)(u),[eR,eI]=(0,r.useState)(null),[eE,eT]=(0,r.useState)(null),eO=function(e,t,n,l,i,o,c){var u,d,m,p,h,k,N,_;let{orgSlug:S}=(0,L.t$)(),{commands:A}=(0,E.V)(),R=(0,g.g)(S),I=(0,v.g)(),T=(0,y.Qv)(),{uploadFiles:U}=(0,x.ix)(S),K=(0,r.useRef)(null!=(u=null==l?void 0:l.uploaded)?u:new Map),G=null!=i?"agent_upload":"describe",[B,J]=(0,r.useState)(null!=(d=null==l?void 0:l.refusal)?d:null),[V,H]=(0,r.useState)(null!=(m=null==l?void 0:l.refusal.hold)?m:null),[Y,Q]=(0,r.useState)(!1),X=(0,f.Gn)(S),Z="draft"===e.kind?e:null,ee=null!=(p=null==Z?void 0:Z.benchmarkId)?p:null,et=(0,s.Ay)(t&&(null==Z?void 0:Z.typeSet)===!0?["".concat(X,"/build-agent/benchmarks/").concat(Z.benchmarkId,"/build"),Z.evalStyle]:null,e=>{let[t]=e;return(0,f.m9)(t)}),en=function(e,t,n){let l,s,i,o,c,u=(0,a.c)(18);u[0]!==t?(l=t.trim(),u[0]=t,u[1]=l):l=u[1];let d=l,m="".concat(e,"\n").concat(d),[p,h]=(0,r.useState)(0);u[2]!==n||u[3]!==m||u[4]!==e||u[5]!==d?(s=()=>{let t;if(!n||""===d||z.has(m))return;let l=F.get(m);if(null!=l&&l.tries>=4)return;t=!0;let a=null==l?800:Math.max(800,l.retryAt-Date.now()),r=window.setTimeout(()=>{(function(e,t,n){let l=D.get(n);if(null!=l)return l;let a=(0,P.A1)(e,t,[]).then(e=>{var t;for(let l of(D.delete(n),function(e,t){var n,l,a,r;if(null==t){let t=(null!=(l=null==(n=F.get(e))?void 0:n.tries)?l:0)+1;F.set(e,{tries:t,retryAt:Date.now()+Math.min(3e4,2e3*2**(t-1))}),F.size>50&&F.delete(null!=(a=F.keys().next().value)?a:e);return}F.delete(e),z.set(e,t),z.size>50&&z.delete(null!=(r=z.keys().next().value)?r:e)}(n,null!=(t=null==e?void 0:e.style)?t:null),q))l()});return D.set(n,a),a})(e,d,m).then(()=>{t&&h($)})},a);return()=>{t=!1,window.clearTimeout(r)}},u[2]=n,u[3]=m,u[4]=e,u[5]=d,u[6]=s):s=u[6],u[7]!==p||u[8]!==n||u[9]!==m||u[10]!==e||u[11]!==d?(i=[n,m,e,d,p],u[7]=p,u[8]=n,u[9]=m,u[10]=e,u[11]=d,u[12]=i):i=u[12],(0,r.useEffect)(s,i),u[13]!==m?(o=()=>{var e;return null!=(e=z.get(m))?e:F.has(m)?null:void 0},u[13]=m,u[14]=o):o=u[14];let f=(0,r.useSyncExternalStore)(M,o,W);if(!n||""===d){let e;return u[15]===Symbol.for("react.memo_cache_sentinel")?(e={status:"idle"},u[15]=e):e=u[15],e}return u[16]!==f?(c=void 0===f?{status:"detecting"}:{status:"done",style:f},u[16]=f,u[17]=c):c=u[17],c}(S,null==i?n:null==i.style&&null!=(h=i.brief)?h:"",t&&(null==Z?void 0:Z.typeSet)!==!0&&null==c),el=null==i||null==i.style&&null!=i.brief?en:{status:"done",style:i.style},ea=(0,b.R)(t),es=function(e){let{draft:t,quote:n,quoteFailed:l,detection:a,holds:r,agreed:s,picked:i=null}=e,o=(e,t)=>{let n=(null==s?void 0:s.eval_style)===e?s.hold_usd:null;if(null!=n||"off"===r.status)return{kind:"known",evalStyle:e,detected:t,holdUsd:n};if("loading"===r.status)return{kind:"waiting",on:"hold"};if("failed"===r.status)return{kind:"unpriced"};
1if(!r.holds.billed)return{kind:"known",evalStyle:e,detected:t,holdUsd:null};let l=r.holds.start_usd[e];return null==l?{kind:"unpriced"}:{kind:"known",evalStyle:e,detected:t,holdUsd:l}};if((null==t?void 0:t.typeSet)===!0){var c;let e=e=>(null==e?void 0:e.eval_style)===t.evalStyle?e:null,a=null!=(c=e(s))?c:e(n);return null!=a?{kind:"known",evalStyle:a.eval_style,detected:null,holdUsd:a.hold_usd}:l?o(t.evalStyle,null):{kind:"waiting",on:"quote"}}return null==t&&null!=i?o(i,i):"idle"===a.status?{kind:"waiting",on:"description"}:"detecting"===a.status?{kind:"waiting",on:"detection"}:null!=a.style?o(a.style,a.style):null==t?o("qa",null):{kind:"unknown"}}({draft:null==Z?null:{evalStyle:Z.evalStyle,typeSet:Z.typeSet},quote:null!=(k=et.data)?k:null,quoteFailed:null!=et.error,detection:el,holds:ea.read,agreed:V,picked:null==Z&&""!==n.trim()?c:null}),ei=O.y.map(e=>e.key).filter(e=>"read"!==ea.read.status||!ea.read.holds.billed||null!=ea.read.holds.start_usd[e]);async function eo(e){let t=await (0,f.m9)("".concat(X,"/build-agent/benchmarks/").concat(e,"/latest-run"));return null!=t&&await R(t),t}async function ec(e,t,n){try{let l=await t();if(l.ok)return await n(l),null;let a=await (0,f.mk)(l);if((0,f.QR)(a)&&"build_agent"===a.details.operation.kind){I("optima_build_agent_failed",{source:G,reason:"insufficient_funds",is_financial:!0}),A.holdResumeFinancialError(a.details.operation.resource_id,a.details);let t=await eo(e).catch(()=>null);return null==t?C(a.message,null):null}let r=C(a.message,await l.json().catch(()=>null));return I("optima_build_agent_failed",{source:G,reason:"request_failed",is_financial:!1}),await eu(e,r),r}catch(e){return I("optima_build_agent_failed",{source:G,reason:"network_or_unknown",is_financial:!1}),C(e instanceof Error?e.message:"Unexpected error",null)}}async function eu(e,t){("agent_running"===t.code||"run_superseded"===t.code)&&await eo(e),null!=t.hold&&H(t.hold)}async function ed(t,n,l){if("new"===e.kind){null!=l&&(er={benchmarkId:t,description:n,refusal:l,bundle:i,documents:o,uploaded:K.current}),e.onCreated(t);return}J(l),await e.onChanged().catch(()=>void 0),Q(!1)}async function em(t){try{if("new"===e.kind)return await e.createDraft(t,G);return null!=t&&t!==e.evalStyle&&await (0,j.GS)(S,e.benchmarkId,{eval_style:t}),e.benchmarkId}catch(e){return J(C(e instanceof Error?e.message:"Unexpected error",null)),Q(!1),null}}async function ep(){let e=null!=i?[i.file,...o]:o;for(let t of e)if(!K.current.has(t))try{let e=(await U([t])).map(e=>e.r2_key);K.current.set(t,e)}catch(n){let e=t===(null==i?void 0:i.file)?"Could not upload the ZIP":"Could not upload your documents";return J(C(n instanceof Error?n.message:e,null)),Q(!1),null}return e.flatMap(e=>{var t;return null!=(t=K.current.get(e))?t:[]})}async function eh(e,t){if("known"!==es.kind)return!1;null==i&&T("describe"),Q(!0),J(null);let n=await ep();if(null==n)return!1;let l=await em(es.detected);if(null==l)return!1;let a={use_case:e.trim(),r2_keys:n,...null!=es.holdUsd&&{hold_usd:es.holdUsd},...null!=t&&{replace_stopped_run_id:t}};I("optima_build_agent_started",{source:G,eval_style:es.evalStyle,file_count:n.length});let r=await ec(l,()=>fetch("".concat(X,"/build-agent/benchmarks/").concat(l,"/build"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),async e=>R((await e.json()).run));return await ed(l,e,r),null==r}async function ef(e){null!=ee&&(Q(!0),J(null),J(await ec(ee,()=>fetch("".concat(X,"/build-agent/runs/").concat(e,"/resume"),{method:"POST"}),()=>eo(ee))),Q(!1))}let ex=null!=(N=null==B?void 0:B.resumableRunId)?N:null,eg=(0,s.Ay)(t&&null!=ex?"".concat(X,"/build-agent/runs/").concat(ex):null,f.m9);return{busy:Y,refusal:B,plan:es,pickable:ei,start:eh,resume:ef,retryHold:()=>{ea.retry(),null!=eg.error&&eg.mutate(),null!=et.error&&et.mutate()},resumeConsent:null==ex?null:(0,w._9)(ea.read,"resume",null!=eg.data?null!=(_=eg.data.run)?_:"failed":null!=eg.error?"failed":"loading")}}(eo,ej,eS,eg,ev,eC,eR);ei[7]!==eO.busy||ei[8]!==em?(m=()=>(null==em||em(eO.busy),()=>null==em?void 0:em(!1)),_=[eO.busy,em],ei[7]=eO.busy,ei[8]=em,ei[9]=m,ei[10]=_):(m=ei[9],_=ei[10]),(0,r.useEffect)(m,_);let eU=null!=ev||eN.trim().length>0,eL="draft"===eo.kind?eo.blockedReason:null,eP=eU&&!ef&&!(void 0!==ep&&ep)&&!eO.busy&&null==eL&&"known"===eO.plan.kind,ez=(0,r.useRef)(null);ei[11]!==eu?(S=function(){ey(null),null==eu||eu()},ei[11]=eu,ei[12]=S):S=ei[12];let eF=S;ei[13]!==eO||ei[14]!==ev||ei[15]!==eP||ei[16]!==eF||ei[17]!==eS?(A=async function(e){eP&&await eO.start(eS,e)&&null!=ev&&eF()},ei[13]=eO,ei[14]=ev,ei[15]=eP,ei[16]=eF,ei[17]=eS,ei[18]=A):A=ei[18];let eD=A;ei[19]!==eO.busy||ei[20]!==eP||ei[21]!==eD?(R=function(e){"Escape"!==e.key||eO.busy||e.currentTarget.blur(),"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&eP&&(e.preventDefault(),eD())},ei[19]=eO.busy,ei[20]=eP,ei[21]=eD,ei[22]=R):R=ei[22];let eq=R;ei[23]!==ej||ei[24]!==eL||ei[25]!==eO.plan?(I=ej?null!=eL?{text:eL,amber:!1}:function(e){switch(e.kind){case"waiting":if("description"===e.on)return null;return{text:"detection"===e.on?"Reading the task type…":"Checking what this build holds…",amber:!1};case"unpriced":return{text:"Couldn’t load what this build holds",amber:!1,retry:!0};case"unknown":return{text:"Couldn’t tell the task type from this. Set it with Type above.",amber:!0};case"known":{let t=null==e.holdUsd?"":(0,w.jV)({stage:"describe",holdUsd:e.holdUsd});return{text:"".concat((0,K.Dd)(e.evalStyle)).concat(""===t?"":"".concat(h.Y$).concat(t)),amber:!1,type:e.evalStyle,holdText:t}}}}(eO.plan):null,ei[23]=ej,ei[24]=eL,ei[25]=eO.plan,ei[26]=I):I=ei[26];let eM=I;ei[27]!==eO.busy||ei[28]!==ev||ei[29]!==eN||ei[30]!==eF||ei[31]!==eg||ei[32]!==ef||ei[33]!==eq?(U=null!=ev?(0,l.jsx)(B,{bundle:ev,disabled:eO.busy||ef,onRemove:eF}):(0,l.jsx)(d.d$,{"aria-label":"Describe your tasks",autoFocus:null!=eg&&null==eg.bundle,maxRows:8,maxLength:8e3,value:eN,disabled:eO.busy||ef,placeholder:N.ry,className:"min-w-0 flex-1",onFocus:()=>ek(!0),onChange:e=>{ek(!0),e_(e.target.value)},onKeyDown:eq}),ei[27]=eO.busy,ei[28]=ev,ei[29]=eN,ei[30]=eF,ei[31]=eg,ei[32]=ef,ei[33]=eq,ei[34]=U):U=ei[34],ei[35]!==eO.busy||ei[36]!==ev||ei[37]!==ef?(G=null==ev&&(0,l.jsx)(H,{disabled:eO.busy||ef,onAttach:e=>eA(t=>[...t,...e])}),ei[35]=eO.busy,ei[36]=ev,ei[37]=ef,ei[38]=G):G=ei[38];let eW=!eP&&!eO.busy;return ei[39]!==eD?(J=()=>void eD(),ei[39]=eD,ei[40]=J):J=ei[40],ei[41]!==eO.busy||ei[42]!==eW||ei[43]!==J?(V=(0,l.jsx)(d.$n,{variant:"primary",size:"lg",disabled:eW,pending:eO.busy,onClick:J,className:"mt-px shrink-0",children:"Build with the agent"}),ei[41]=eO.busy,ei[42]=eW,ei[43]=J,ei[44]=V):V=ei[44],ei[45]!==U||ei[46]!==G||ei[47]!==V?(Y=(0,l.jsxs)("div",{ref:ez,className:"flex items-start gap-2.5",children:[U,G,V]}),ei[45]=U,ei[46]=G,ei[47]=V,ei[48]=Y):Y=ei[48],ei[49]!==eO.busy||ei[50]!==eO.pickable||ei[51]!==eO.plan||ei[52]!==eM||ei[53]!==eU||ei[54]!==ef||ei[55]!==eR||ei[56]!==eE||ei[57]!==eo.kind?(X="new"===eo.kind&&eU&&null!=eM&&(0,l.jsx)(en,{plan:eO.plan,picked:eR,read:eE,pickable:eO.pickable,disabled:eO.busy||ef,onPick:(e,t)=>{eT(t),eI(e)}}),ei[49]=eO.busy,ei[50]=eO.pickable,ei[51]=eO.plan,ei[52]=eM,ei[53]=eU,ei[54]=ef,ei[55]=eR,ei[56]=eE,ei[57]=eo.kind,ei[58]=X):X=ei[58],ei[59]!==eO.retryHold||ei[60]!==eM||ei[61]!==eU||ei[62]!==eo.kind?(Z=null!=eM&&(0,l.jsxs)("span",{className:(0,p.cn)("pl-3 text-[11.5px] leading-4",eM.amber?"text-amber-800":"text-muted-foreground","new"===eo.kind&&eU&&"pl-0 text-[13px]"),children:["new"===eo.kind&&eU&&null!=eM.type?eM.holdText:eM.text,eM.retry&&(0,l.jsxs)(l.Fragment,{children:[h.Y$,(0,l.jsx)("button",{type:"button",onClick:eO.retryHold,className:"underline underline-offset-2 hover:text-neutral-900",children:"Try again"})]})]}),ei[59]=eO.retryHold,ei[60]=eM,ei[61]=eU,ei[62]=eo.kind,ei[63]=Z):Z=ei[63],ei[64]!==eO.busy||ei[65]!==eC||ei[66]!==ef?(et=eC.length>0&&(0,l.jsx)(Q,{documents:eC,disabled:eO.busy||ef,onRemove:e=>eA(t=>t.filter(t=>t!==e)),onEmptied:()=>{var e,t;return null==(t=ez.current)||null==(e=t.querySelector("button:not(:disabled)"))?void 0:e.focus()}}
1),ei[64]=eO.busy,ei[65]=eC,ei[66]=ef,ei[67]=et):et=ei[67],ei[68]!==X||ei[69]!==Z||ei[70]!==et?(el=(0,l.jsxs)("div",{className:"flex min-h-[2.25rem] flex-wrap items-center gap-x-4 gap-y-1",children:[X,Z,et]}),ei[68]=X,ei[69]=Z,ei[70]=et,ei[71]=el):el=ei[71],ei[72]!==eO||ei[73]!==eP||ei[74]!==eD?(ea=null!=eO.refusal&&(0,l.jsxs)("p",{role:"alert",className:"pl-3 text-[12px] text-amber-800",children:[eO.refusal.message,null!=eO.refusal.resumableRunId&&(0,l.jsx)(ee,{runId:eO.refusal.resumableRunId,disabled:eO.busy||null!=eO.resumeConsent&&"known"!==eO.resumeConsent.amount,canStartOver:eP,onResume:e=>void eO.resume(e),onStartOver:e=>void eD(e)}),null!=eO.refusal.resumableRunId&&null!=eO.resumeConsent&&(0,l.jsxs)("span",{className:"block text-[11.5px] text-amber-900/80",children:[eO.resumeConsent.line," ",(0,l.jsx)(T.U,{amount:eO.resumeConsent.amount,onRetry:eO.retryHold})]})]}),ei[72]=eO,ei[73]=eP,ei[74]=eD,ei[75]=ea):ea=ei[75],ei[76]!==Y||ei[77]!==el||ei[78]!==ea?(es=(0,l.jsxs)("section",{"aria-label":"Describe your tasks",className:"flex flex-col gap-1.5",children:[Y,el,ea]}),ei[76]=Y,ei[77]=el,ei[78]=ea,ei[79]=es):es=ei[79],es}function B(e){var t;let n,r,s,c,u,d,p,h=(0,a.c)(15),{bundle:f,disabled:x,onRemove:g}=e;h[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,l.jsx)(i.A,{className:"h-3.5 w-3.5 shrink-0 text-neutral-500","aria-hidden":!0}),h[0]=n):n=h[0];let b=null!=(t=f.name)?t:f.file.name;return h[1]!==b?(r=(0,l.jsx)("span",{className:"min-w-0 truncate",children:b}),h[1]=b,h[2]=r):r=h[2],h[3]!==f.file||h[4]!==f.name?(s=null!=f.name&&(0,l.jsx)("span",{className:"shrink-0 text-muted-foreground",children:f.file.name}),h[3]=f.file,h[4]=f.name,h[5]=s):s=h[5],h[6]===Symbol.for("react.memo_cache_sentinel")?(c=(0,l.jsx)("span",{className:"ml-auto shrink-0 text-muted-foreground",children:"Your coding agent’s bundle"}),h[6]=c):c=h[6],h[7]===Symbol.for("react.memo_cache_sentinel")?(u=(0,l.jsx)(o.A,{}),h[7]=u):u=h[7],h[8]!==x||h[9]!==g?(d=(0,l.jsx)(m.$,{variant:"ghost",size:"sm","aria-label":"Remove the bundle",disabled:x,onClick:g,className:"-mr-2 w-7 px-0 hover:no-underline [&_svg]:h-4 [&_svg]:w-4",children:u}),h[8]=x,h[9]=g,h[10]=d):d=h[10],h[11]!==r||h[12]!==s||h[13]!==d?(p=(0,l.jsxs)("div",{className:"flex h-[2.375rem] min-w-0 flex-1 items-center gap-2 rounded-lg border border-neutral-400 bg-white px-3 text-[13px]",children:[n,r,s,c,d]}),h[11]=r,h[12]=s,h[13]=d,h[14]=p):p=h[14],p}let J="Attach supporting documents",V={"--btn-px":"0px"};function H(e){let t,n,s,i,o,u,m,h=(0,a.c)(22),{disabled:f,onAttach:x}=e,{uploadsEnabled:g}=(0,U.mz)("flags"),b=(0,r.useRef)(null),y=(0,r.useId)(),v=g?J:I.E,w=!g||void 0,k=g?void 0:y;h[0]!==g?(t=()=>{if(g){var e;null==(e=b.current)||e.click()}},h[0]=g,h[1]=t):t=h[1];let j=!g&&"cursor-not-allowed opacity-50 hover:!bg-transparent active:!bg-transparent";return h[2]!==j?(n=(0,p.cn)("w-9",j),h[2]=j,h[3]=n):n=h[3],h[4]===Symbol.for("react.memo_cache_sentinel")?(s=(0,l.jsx)(c.A,{"aria-hidden":!0}),h[4]=s):s=h[4],h[5]!==f||h[6]!==v||h[7]!==w||h[8]!==k||h[9]!==t||h[10]!==n||h[11]!==g?(i=(0,l.jsx)(d.$n,{variant:"ghost",size:"lg","aria-label":J,title:v,disabled:f,"aria-disabled":w,"aria-describedby":k,press:g,onClick:t,className:n,style:V,children:s}),h[5]=f,h[6]=v,h[7]=w,h[8]=k,h[9]=t,h[10]=n,h[11]=g,h[12]=i):i=h[12],h[13]!==y||h[14]!==g?(o=!g&&(0,l.jsx)("span",{id:y,className:"sr-only",children:I.E}),h[13]=y,h[14]=g,h[15]=o):o=h[15],h[16]!==x?(u=(0,l.jsx)("input",{ref:b,type:"file",multiple:!0,accept:I.Wb,tabIndex:-1,"aria-hidden":!0,className:"hidden",onChange:e=>{var t;let n=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",n.length>0&&x(n)}}),h[16]=x,h[17]=u):u=h[17],h[18]!==u||h[19]!==i||h[20]!==o?(m=(0,l.jsxs)("span",{className:"mt-px flex shrink-0",children:[i,o,u]}),h[18]=u,h[19]=i,h[20]=o,h[21]=m):m=h[21],m}let Y="flex h-6 items-center gap-1 rounded-full border border-neutral-300 bg-white text-[11.5px] leading-4";function Q(e){let t,n,s,i,o=(0,a.c)(11),{documents:c,disabled:m,onRemove:h,onEmptied:f}=e,x=1===c.length?c[0]:void 0;o[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Map,o[0]=t):t=o[0];let g=(0,r.useRef)(t),b=(0,r.useRef)(null);o[1]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{var e;null!=b.current&&(null==(e=g.current.get(b.current))||e.focus(),b.current=null)},o[1]=n):n=o[1],(0,r.useEffect)(n),o[2]!==c||o[3]!==f||o[4]!==h?(s=e=>{var t;let n=c.filter(t=>t!==e);b.current=null!=(t=n[Math.min(c.indexOf(e),n.length-1)])?t:null,0===n.length&&f(),h(e)},o[2]=c,o[3]=f,o[4]=h,o[5]=s):s=o[5];let y=s;
1if(o[6]!==m||o[7]!==c||o[8]!==x||o[9]!==y){let e=e=>t=>{null==t?g.current.delete(e):g.current.set(e,t)};i=(0,l.jsx)("div",{className:"flex min-w-0 flex-1 justify-end",children:null!=x?(0,l.jsx)(Z,{file:x,disabled:m,onRemove:y,removeRef:e(x),className:(0,p.cn)(Y,"max-w-[16rem] pl-2.5 pr-0.5")}):(0,l.jsxs)(d.AM,{children:[(0,l.jsx)(d.Wv,{asChild:!0,children:(0,l.jsxs)("button",{type:"button",disabled:m,className:(0,p.cn)(Y,"shrink-0 pl-2.5 pr-1.5 hover:border-neutral-400 disabled:opacity-50"),children:[c.length," documents",(0,l.jsx)("span",{className:"text-muted-foreground",children:(0,I.v7)(c.reduce(X,0))}),(0,l.jsx)(u.A,{className:"h-3 w-3 text-neutral-500","aria-hidden":!0})]})}),(0,l.jsx)(d.hl,{align:"end",className:"w-72 p-1",children:(0,l.jsx)("ul",{"aria-label":"Supporting documents",children:c.map((t,n)=>(0,l.jsx)("li",{children:(0,l.jsx)(Z,{file:t,disabled:m,onRemove:y,removeRef:e(t),className:"h-7 pl-2 pr-0.5"})},"".concat(t.name,"-").concat(n)))})})]})}),o[6]=m,o[7]=c,o[8]=x,o[9]=y,o[10]=i}else i=o[10];return i}function X(e,t){return e+t.size}function Z(e){let t,n,r,s,i,c,u,d,m=(0,a.c)(23),{file:h,disabled:f,onRemove:x,removeRef:g,className:b}=e,y=h.name;m[0]!==b?(t=(0,p.cn)("flex min-w-0 items-center gap-1 text-[11.5px] leading-4",b),m[0]=b,m[1]=t):t=m[1],m[2]!==h.name?(n=(0,l.jsx)("span",{className:"min-w-0 flex-1 truncate",children:h.name}),m[2]=h.name,m[3]=n):n=m[3],m[4]!==h.size?(r=(0,I.v7)(h.size),m[4]=h.size,m[5]=r):r=m[5],m[6]!==r?(s=(0,l.jsx)("span",{className:"shrink-0 text-muted-foreground",children:r}),m[6]=r,m[7]=s):s=m[7];let v="Remove ".concat(h.name);return m[8]!==h||m[9]!==x?(i=()=>x(h),m[8]=h,m[9]=x,m[10]=i):i=m[10],m[11]===Symbol.for("react.memo_cache_sentinel")?(c=(0,l.jsx)(o.A,{className:"h-3 w-3","aria-hidden":!0}),m[11]=c):c=m[11],m[12]!==f||m[13]!==g||m[14]!==v||m[15]!==i?(u=(0,l.jsx)("button",{ref:g,type:"button","aria-label":v,disabled:f,onClick:i,className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-neutral-500 hover:bg-neutral-100 hover:text-neutral-900 disabled:opacity-50",children:c}),m[12]=f,m[13]=g,m[14]=v,m[15]=i,m[16]=u):u=m[16],m[17]!==h.name||m[18]!==t||m[19]!==n||m[20]!==s||m[21]!==u?(d=(0,l.jsxs)("span",{title:y,className:t,children:[n,s,u]}),m[17]=h.name,m[18]=t,m[19]=n,m[20]=s,m[21]=u,m[22]=d):d=m[22],d}function ee(e){let t,n,r,s,i,o=(0,a.c)(15),{runId:c,disabled:u,canStartOver:d,onResume:m,onStartOver:p}=e;o[0]!==m||o[1]!==c?(t=()=>m(c),o[0]=m,o[1]=c,o[2]=t):t=o[2],o[3]!==u||o[4]!==t?(n=(0,l.jsx)(et,{disabled:u,onClick:t,children:"Resume"}),o[3]=u,o[4]=t,o[5]=n):n=o[5];let h=!d;return o[6]!==p||o[7]!==c?(r=()=>p(c),o[6]=p,o[7]=c,o[8]=r):r=o[8],o[9]!==h||o[10]!==r?(s=(0,l.jsx)(et,{disabled:h,onClick:r,children:"Start over"}),o[9]=h,o[10]=r,o[11]=s):s=o[11],o[12]!==n||o[13]!==s?(i=(0,l.jsxs)(l.Fragment,{children:[n,s]}),o[12]=n,o[13]=s,o[14]=i):i=o[14],i}function et(e){let t,n=(0,a.c)(4),{disabled:r,onClick:s,children:i}=e;return n[0]!==i||n[1]!==r||n[2]!==s?(t=(0,l.jsx)("button",{type:"button",disabled:r,className:"ml-2 font-medium text-amber-900 underline underline-offset-2 hover:text-amber-950 disabled:opacity-50",onClick:s,children:i}),n[0]=i,n[1]=r,n[2]=s,n[3]=t):t=n[3],t}function en(e){let t,n,r,s,i,o,c=(0,a.c)(29),{plan:u,picked:m,read:p,pickable:h,disabled:f,onPick:x}=e,{interactionEnabled:g}=(0,L.t$)(),b="known"===u.kind?u.evalStyle:m,y=null==m?"known"===u.kind?u.detected:null:p;if(c[0]!==b||c[1]!==g||c[2]!==h||c[3]!==y){let e,n;c[5]!==b||c[6]!==g?(e=e=>"interaction"!==e.value||g||"interaction"===b,c[5]=b,c[6]=g,c[7]=e):e=c[7],c[8]!==b||c[9]!==h||c[10]!==y?(n=e=>{let t=R(e.value,b,y);return{...e,disabled:null!=t&&!h.includes(t)}},c[8]=b,c[9]=h,c[10]=y,c[11]=n):n=c[11],t=K.Ml.filter(e).map(n),c[0]=b,c[1]=g,c[2]=h,c[3]=y,c[4]=t}else t=c[4];let v=t;c[12]!==b||c[13]!==x||c[14]!==y?(n=e=>{let t=R(e,b,y);void 0!==t&&x(t,y)},c[12]=b,c[13]=x,c[14]=y,c[15]=n):n=c[15];let w=n;return c[16]!==v||c[17]!==m?(r=e=>(0,l.jsx)(K.e6,{options:v.map(el),ask:null,lock:null,note:null!=m?"The agent builds tasks of this type, and what the build holds follows it.":"Read from your description. Pick another if it’s wrong; what the build holds follows it.",pressed:e}),c[16]=v,c[17]=m,c[18]=r):r=c[18],c[19]!==b?(s=null==b?null:(0,_.gU)(b),c[19]=b,c[20]=s):s=c[20],c[21]!==f||c[22]!==v||c[23]!==w||c[24]!==s?(i=(0,l.jsx)(d.Iz,{"aria-label":"Type",size:"lg",options:v,value:s,disabled:f,commitOnArrow:!1,onValueChange:w}),c[21]=f,c[22]=v,c[23]=w,c[24]=s,c[25]=i):i=c[25],c[26]!==r||c[27]!==i?(o=(0,l.jsx)(K.iJ,{label:"Type",about:"What the task type means",lock:null,marker:null,warm:ea,card:r,children:i}),c[26]=r,c[27]=i,c[28]=o):o=c[28],o}function el(e){return{choice:e.value,switchesTo:null}}function ea(){(0,K.ru)()}let er=null},47927:(e,t,n)=>{n.d(t,{$Y:()=>v,k_:()=>y});var l=n(58212),a=n(36772),r=n(96040),s=n(64127),i=n(61082),o=n(33505),c=n(26385),u=n(56344),d=n(92515),m=n(36896);let p=["reviewing legal contracts","classifying documents","tutoring university level biology","summarizing research papers","interviewing hospital patients","complex excel analysis","explaining quantum physics","planning travel itineraries"];var h=n(40329);let f="curl -fsSL https://raw.githubusercontent.com/ArtificialAnalysis/optima/main/install.sh | sh",x="skill installed. build the eval from this chat, or point me elsewhere?",g=["our claims-review w
1orkflow","this repo, the PRs and reviews that show how we work","the support tickets in ./tickets","this chat"],b=g.reduce((e,t)=>t.length>e.length?t:e);function y(e){return"Run ".concat(f," and follow the installed skill. My Optima org: ").concat(e)}function v(e){let t,n,r,s,i=(0,a.c)(5),{orgSlug:o}=e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,l.jsx)("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand-mint text-black",children:(0,l.jsx)(c.A,{className:"h-5 w-5"})}),i[0]=t):t=i[0],i[1]===Symbol.for("react.memo_cache_sentinel")?(n=(0,l.jsx)("h2",{className:"font-brand-sans text-base font-semibold text-neutral-900",children:"Build from your agent context"}),r=(0,l.jsx)("p",{className:"mt-1 text-sm leading-relaxed text-neutral-500",children:"Use our skill to build an eval from your own context: your session history, codebase or local source files."}),i[1]=n,i[2]=r):(n=i[1],r=i[2]),i[3]!==o?(s=(0,l.jsx)("section",{className:"rounded-xl border bg-background p-6",children:(0,l.jsxs)("div",{className:"grid gap-6 lg:grid-cols-[minmax(0,5fr)_minmax(0,7fr)] lg:items-center",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[t,(0,l.jsxs)("div",{className:"min-w-0",children:[n,r,(0,l.jsx)("div",{className:"mt-4 flex items-stretch gap-2",children:(0,l.jsx)(k,{orgSlug:o})})]})]}),(0,l.jsx)(j,{orgSlug:o})]})}),i[3]=o,i[4]=s):s=i[4],s}function w(){let e,t=(0,a.c)(2),n=(0,h.g)();return t[0]!==n?(e=()=>n("optima_create_entry_selected",{path:"coding_agent"}),t[0]=n,t[1]=e):e=t[1],e}function k(e){let t,n,r,i,c,d,m=(0,a.c)(14),{orgSlug:p}=e,f=(0,h.g)(),x=w();m[0]!==p?(t=y(p),m[0]=p,m[1]=t):t=m[1],m[2]!==x||m[3]!==t?(n=(0,l.jsx)(N,{text:t,size:"lg",onCopied:x}),m[2]=x,m[3]=t,m[4]=n):n=m[4];let g="/orgs/".concat(p,"/optima/benchmarks/create?path=agent-upload");return m[5]!==f?(r=()=>f("optima_create_entry_selected",{path:"agent_upload"}),m[5]=f,m[6]=r):r=m[6],m[7]===Symbol.for("react.memo_cache_sentinel")?(i=(0,l.jsx)(u.A,{className:"h-4 w-4 shrink-0"}),m[7]=i):i=m[7],m[8]!==g||m[9]!==r?(c=(0,l.jsx)(o.$,{variant:"outline",className:"h-12 flex-1 basis-0 gap-2 px-3 text-sm font-semibold",asChild:!0,children:(0,l.jsxs)(s.Link,{href:g,onClick:r,children:[i,"Upload eval"]})}),m[8]=g,m[9]=r,m[10]=c):c=m[10],m[11]!==n||m[12]!==c?(d=(0,l.jsxs)(l.Fragment,{children:[n,c]}),m[11]=n,m[12]=c,m[13]=d):d=m[13],d}function j(e){let t,n,s,i,o,c,u,d,m,h,v=(0,a.c)(16),{orgSlug:k}=e,j=w();v[0]===Symbol.for("react.memo_cache_sentinel")?(t={prefix:"",suffixes:g,enabled:!0},v[0]=t):t=v[0];let _=function(e){let t,n,l,s,i,o=(0,a.c)(9),{prefix:c,suffixes:u,enabled:d}=e,m=void 0===u?p:u;o[0]!==c?(t=()=>"".concat(c,"|"),o[0]=c,o[1]=t):t=o[1];let[h,f]=(0,r.useState)(t),x=(0,r.useRef)(c),g=(0,r.useRef)(m);o[2]!==c||o[3]!==m?(n=()=>{x.current=c,g.current=m},l=[c,m],o[2]=c,o[3]=m,o[4]=n,o[5]=l):(n=o[4],l=o[5]),(0,r.useEffect)(n,l);let b=(0,r.useRef)("typing"),y=(0,r.useRef)(0),v=(0,r.useRef)(0),w=(0,r.useRef)(!0),k=(0,r.useRef)(!1),j=(0,r.useRef)(null),N=(0,r.useRef)(null);return(o[6]!==d?(s=()=>{if(!d)return;let e=function(){var e;let t=(null!=(e=g.current[v.current])?e:"").slice(0,y.current),n=w.current?"|":"";f("".concat(x.current).concat(t).concat(n))},t=function(){n(),w.current=!0,N.current=setInterval(()=>{w.current=!w.current,e()},530)};function n(){null!=N.current&&(clearInterval(N.current),N.current=null),w.current=!0}function l(){var a;let r=null!=(a=g.current[v.current])?a:"";switch(b.current){case"typing":n(),y.current=y.current+1,e(),y.current>=r.length?(b.current="pause_after_type",t(),j.current=setTimeout(l,2e3)):j.current=setTimeout(l,60+30*Math.random());break;case"pause_after_type":n(),b.current="deleting",e(),j.current=setTimeout(l,35);break;case"deleting":y.current=y.current-1,e(),y.current<=0?(b.current="pause_after_delete",t(),j.current=setTimeout(l,500)):j.current=setTimeout(l,35);break;case"pause_after_delete":n(),v.current=(v.current+1)%g.current.length,y.current=0,b.current="typing",e(),j.current=setTimeout(l,60+30*Math.random())}}return e(),k.current?(("pause_after_type"===b.current||"pause_after_delete"===b.current)&&t(),j.current=setTimeout(l,100)):(k.current=!0,j.current=setTimeout(l,800)),()=>{null!=j.current&&clearTimeout(j.current),n()}},i=[d],o[6]=d,o[7]=s,o[8]=i):(s=o[7],i=o[8]),(0,r.useEffect)(s,i),d)?h:c}(t);return v[1]===Symbol.for("react.memo_cache_sentinel")?(n=(0,l.jsxs)("div",{className:"flex gap-1.5",children:[(0,l.jsx)("span",{className:"h-2.5 w-2.5 rounded-full bg-neutral-700"}),(0,l.jsx)("span",{className:"h-2.5 w-2.5 rounded-full bg-neutral-700"}),(0,l.jsx)("span",{className:"h-2.5 w-2.5 rounded-full bg-neutral-700"})]}),v[1]=n):n=v[1],v[2]!==k?(s=y(k),v[2]=k,v[3]=s):s=v[3],v[4]!==j||v[5]!==s?(i=(0,l.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[n,(0,l.jsx)(N,{text:s,size:"sm",onCopied:j})]}),v[4]=j,v[5]=s,v[6]=i):i=v[6],v[7]===Symbol.for("react.memo_cache_sentinel")?(o=(0,l.jsxs)("div",{className:"invisible col-start-1 row-start-1",children:[(0,l.jsx)("div",{children:f}),(0,l.jsx)("div",{children:x}),(0,l.jsxs)("div",{children:[b,"|"]})]}),v[7]=o):o=v[7],v[8]===Symbol.for("react.memo_cache_sentinel")?(c=(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"select-none text-emerald-400",children:"$ "}),(0,l.jsx)("span",{className:"text-neutral-100",children:f})]}),u=(0,l.jsx)("div",{className:"text-neutral-400",children:x}),d=(0,l.jsx)("span",{className:"select-none text-emerald-400",children:"› "}),v[8]=c,v[9]=u,v[10]=d):(c=v[8],u=v[9],d=v[10]),v[11]!==_?(m=(0,l.jsxs)("div",{"aria-hidden":!0,
1className:"grid break-all font-mono text-xs leading-relaxed",children:[o,(0,l.jsxs)("div",{className:"col-start-1 row-start-1",children:[c,u,(0,l.jsxs)("div",{children:[d,(0,l.jsx)("span",{className:"text-neutral-100",children:_})]})]})]}),v[11]=_,v[12]=m):m=v[12],v[13]!==i||v[14]!==m?(h=(0,l.jsxs)("div",{className:"min-w-0 rounded-xl bg-neutral-900 p-4",children:[i,m]}),v[13]=i,v[14]=m,v[15]=h):h=v[15],h}function N(e){let t,n,s,c,u,p=(0,a.c)(17),{text:h,size:f,onCopied:x}=e,[g,b]=(0,r.useState)(!1),y=(0,r.useRef)(void 0);p[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>()=>{y.current&&clearTimeout(y.current)},n=[],p[0]=t,p[1]=n):(t=p[0],n=p[1]),(0,r.useEffect)(t,n),p[2]!==x||p[3]!==h?(s=async()=>{try{await navigator.clipboard.writeText(h),b(!0),x(),y.current=setTimeout(()=>b(!1),2e3)}catch(e){i.oR.error("Failed to copy to clipboard")}},p[2]=x,p[3]=h,p[4]=s):s=p[4];let v=s;if("sm"===f){let e,t;p[5]!==g?(e=g?(0,l.jsx)(d.A,{className:"h-3.5 w-3.5"}):(0,l.jsx)(m.A,{className:"h-3.5 w-3.5"}),p[5]=g,p[6]=e):e=p[6];let n=g?"Copied":"Copy prompt";return p[7]!==v||p[8]!==e||p[9]!==n?(t=(0,l.jsxs)("button",{type:"button",onClick:v,className:"flex shrink-0 items-center gap-1.5 rounded-md bg-brand-mint px-3 py-1.5 text-xs font-semibold text-black transition-colors hover:bg-brand-mint/90",children:[e,n]}),p[7]=v,p[8]=e,p[9]=n,p[10]=t):t=p[10],t}p[11]!==g?(c=g?(0,l.jsx)(d.A,{className:"h-4 w-4 shrink-0"}):(0,l.jsx)(m.A,{className:"h-4 w-4 shrink-0"}),p[11]=g,p[12]=c):c=p[12];let w=g?"Copied":"Copy prompt";return p[13]!==v||p[14]!==c||p[15]!==w?(u=(0,l.jsxs)(o.$,{className:"h-12 flex-1 basis-0 gap-2 border border-black bg-brand-mint px-3 text-sm font-semibold text-black hover:bg-brand-mint/90",onClick:v,children:[c,w]}),p[13]=v,p[14]=c,p[15]=w,p[16]=u):u=p[16],u}},56540:(e,t,n)=>{n.d(t,{v:()=>o,y:()=>i});var l=n(39268),a=n(53009),r=n(88616),s=n(32727);let i=[{key:"qa",label:"Q&A",promptTag:"Q&A",icon:l.A,description:"The model answers questions that have known correct answers",costLevel:"lower",available:!0},{key:"document_input",label:"Document input",promptTag:"Document input",icon:a.A,description:"The model answers questions about your uploaded files",costLevel:"moderate",available:!0},{key:"agentic",label:"Agentic",promptTag:"Agentic",icon:r.A,description:"The model completes tasks and produces deliverables, using tools along the way",costLevel:"higher",available:!0},{key:"interaction",label:"Interaction",promptTag:"Interaction",icon:s.A,description:"Simulate a real conversation with different types of users",costLevel:"higher",available:!0}];function o(e){return i.some(t=>t.key===e&&t.available)}},56608:(e,t,n)=>{n.d(t,{h:()=>o,y:()=>u});var l=n(58212),a=n(36772),r=n(27724),s=n(62469),i=n(69575);function o(e){return"agentic"===e?"subjective":"objective"}let c=[{key:"objective",label:"Score against the rubric",description:"A judge reads each criterion and awards a level. Every model gets the same score out of the same rubric.",Icon:s.A},{key:"subjective",label:"Compare models head-to-head",description:"Models are paired against each other and ranked by Elo, with your own calibration votes steering the judge.",Icon:i.A}];function u(e){let t,n,s=(0,a.c)(7),{value:i,recommended:o,onChange:u,disabled:d}=e;return s[0]!==d||s[1]!==u||s[2]!==o||s[3]!==i?(t=c.map(e=>(0,l.jsxs)("button",{type:"button",disabled:d,onClick:()=>u(e.key),className:(0,r.cn)("relative rounded-xl border p-4 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60",i===e.key?"border-black bg-brand-blue-light":"bg-background hover:border-black"),children:[o===e.key&&(0,l.jsx)("span",{className:"absolute -top-2 right-3 rounded-full bg-neutral-900 px-2 py-0.5 text-[10px] font-semibold text-white",children:"Recommended"}),(0,l.jsx)("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-brand-mint text-black",children:(0,l.jsx)(e.Icon,{className:"h-4 w-4"})}),(0,l.jsx)("span",{className:"mt-2.5 block text-sm font-semibold text-neutral-900",children:e.label}),(0,l.jsx)("span",{className:"mt-1 block text-xs leading-relaxed text-neutral-500",children:e.description})]},e.key)),s[0]=d,s[1]=u,s[2]=o,s[3]=i,s[4]=t):t=s[4],s[5]!==t?(n=(0,l.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:t}),s[5]=t,s[6]=n):n=s[6],n}},65260:(e,t,n)=>{n.d(t,{A1:()=>r,Sf:()=>c,kC:()=>o});var l=n(72324),a=n(59514);function r(e,t,n){return fetch("".concat((0,a.Gn)(e),"/build-agent/recommend-style"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({use_case:t,filenames:n})}).then(async e=>
1e.ok?l.ge.parse(await e.json()):null).catch(()=>null)}let s=["image","photo","figure","diagram","chart","screenshot","document","attachment","pdf","audio","video","file"];function i(e){return e.columns.filter(e=>s.some(t=>e.toLowerCase().includes(t)))}function o(e,t){return"qa"===e&&i(t).length>0?"document_input":e}function c(e){let t=['A dataset named "'.concat(e.label,'".')];e.columns.length>0&&t.push("Its columns are: ".concat(e.columns.join(", "),"."));let n=i(e);if(n.length>0&&t.push("Each task comes with file(s) the model must open, in: ".concat(n.join(", "),". ")+"This is therefore not a text-only task."),e.cardExcerpt&&t.push("Its dataset card says:\n".concat(e.cardExcerpt.slice(0,1500))),e.sampleRows.length>0){let n=e.sampleRows.map((e,t)=>"Example ".concat(t+1,": ").concat(JSON.stringify(e))).join("\n");t.push("Example rows:\n".concat(n))}return t.push("Classify what kind of evaluation this dataset is for."),t.join("\n\n").slice(0,8e3)}},65918:(e,t,n)=>{n.d(t,{U:()=>i,X:()=>s});var l=n(58212),a=n(36772),r=n(27724);function s(e){let t,n,s,o,c,u=(0,a.c)(12),{consent:d,onRetry:m,className:p}=e;return u[0]!==p?(t=(0,r.cn)("grid gap-0.5",p),u[0]=p,u[1]=t):t=u[1],u[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,l.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Uses credit"}),u[2]=n):n=u[2],u[3]!==d.line?(s=(0,l.jsx)("span",{className:"text-[11.5px] leading-snug text-muted-foreground",children:d.line}),u[3]=d.line,u[4]=s):s=u[4],u[5]!==d.amount||u[6]!==m?(o=(0,l.jsx)(i,{amount:d.amount,onRetry:m,reserve:!0}),u[5]=d.amount,u[6]=m,u[7]=o):o=u[7],u[8]!==t||u[9]!==s||u[10]!==o?(c=(0,l.jsxs)("div",{className:t,children:[n,s,o]}),u[8]=t,u[9]=s,u[10]=o,u[11]=c):c=u[11],c}function i(e){let t,n,s,i=(0,a.c)(10),{amount:o,onRetry:c,className:u,reserve:d}=e,m=void 0!==d&&d;if("known"===o&&!m)return null;let p=m&&"min-h-[1rem]";i[0]!==u||i[1]!==p?(t=(0,r.cn)("text-[11.5px] leading-snug text-muted-foreground",p,u),i[0]=u,i[1]=p,i[2]=t):t=i[2];let h=m?"polite":void 0;return i[3]!==o||i[4]!==c?(n="known"===o?null:"loading"===o?"Checking the amount…":(0,l.jsxs)(l.Fragment,{children:["Couldn’t load the amount \xb7"," ",(0,l.jsx)("button",{type:"button",onClick:c,className:"underline underline-offset-2 hover:text-neutral-900",children:"Try again"})]}),i[3]=o,i[4]=c,i[5]=n):n=i[5],i[6]!==t||i[7]!==h||i[8]!==n?(s=(0,l.jsx)("span",{className:t,"aria-live":h,children:n}),i[6]=t,i[7]=h,i[8]=n,i[9]=s):s=i[9],s}},65957:(e,t,n)=>{n.d(t,{q:()=>s});var l=n(96040),a=n(61082),r=n(59514);function s(e){let[t,n]=(0,l.useState)(null);return{deleteBenchmark:(0,l.useCallback)(async t=>{n(t);try{let n=await fetch("".concat((0,r.Gn)(e),"/benchmarks/").concat(t),{method:"DELETE"});if(!n.ok)return a.oR.error("Failed to delete benchmark",{description:await (0,r.IP)(n)}),!1;return!0}catch(e){return a.oR.error("Failed to delete benchmark",{description:e instanceof Error?e.message:"Unexpected error"}),!1}finally{n(null)}},[e]),deletingId:t}}},70895:(e,t,n)=>{n.d(t,{N:()=>h,e:()=>x});var l=n(58212),a=n(96040),r=n(61082),s=n(33505),i=n(73945),o=n(11499),c=n(24121),u=n(6845),d=n(72324),m=n(59514),p=n(26571);let h={connectionId:"",apiKey:"",secondaryApiKey:"",baseUrl:"",workspace:"",dataset:null,maxTasks:p.rv},f=[100,500,1e3,2500,5e3];function x(e){var t,n;let{orgSlug:h,platform:x,definition:g,connections:b,onConnectionsChange:y,selection:v,onSelectionChange:w,disabled:k,variant:j="wizard"}=e,N="panel"===j,[_,S]=(0,a.useState)([]),[C,A]=(0,a.useState)(!1),[R,I]=(0,a.useState)(null),[E,T]=(0,a.useState)(!0),O=b.filter(e=>e.platform===x),U=p.z3[x],L="string"==typeof U?[["Get a key",U]]:Object.entries(U).map(e=>{let[t,n]=e;return["Get a key (".concat(t,")"),n]}),P=O.find(e=>e.id===v.connectionId);(0,a.useEffect)(()=>{S([]),I(null)},[x]);let z=(0,a.useCallback)(e=>w({...v,...e}),[v,w]),F=v.connectionId.length>0||v.apiKey.trim().length>0&&(!g.needs_secondary_key||v.secondaryApiKey.trim().length>0)&&(!g.needs_workspace||v.workspace.trim().length>0),D=async()=>{A(!0),I(null);try{var e;let n={api_key:v.apiKey.trim(),secondary_api_key:v.secondaryApiKey.trim()||null,base_url:v.baseUrl.trim()||null,workspace:v.workspace.trim()||null},l=await t(),a=await fetch("".concat((0,m.Gn)(h),"/import-platforms/datasets"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({platform:x,connection_id:l,...l?{}:n})});if(!a.ok)throw Error(await (0,m.IP)(a));let s=d.Q8.parse(await a.json());async function t(){if(v.connectionId)return v.connectionId;if(!E)return null;let e=await fetch("".concat((0,m.Gn)(h),"/import-platforms/connections"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({platform:x,name:"".concat(g.label," connection"),...n})});if(!e.ok)throw Error("Saving the ".concat(g.label," connection failed: ").concat(await (0,m.IP)(e)));let t=d.WW.parse(await e.json());return y([...b.filter(e=>e.platform!==t.platform),t]),t.id}S(s.datasets),w({...v,...l?{connectionId:l,apiKey:"",secondaryApiKey:""}:{},dataset:null!=(e=s.datasets.at(0))?e:null}),0===s.datasets.length&&r.oR.info("No datasets found in ".concat(g.label))}catch(t){let e=t instanceof Error?t.message:"Unexpected error";I(e),r.oR.error("Could not load datasets",{description:e})}finally{A(!1)}};return(0,l.jsxs)("div",{className:"space-y-3",children:[R&&(0,l.jsx)("p",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:R}),(0,l.jsx)("div",{className:"rounded-lg border bg-neutral-50 px-3 py-2.5",children:(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(i.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-emerald-600"}),(0,l.jsxs)("div",{className:"text-xs text-neutral-600",children:[(0,l.jsx)("p",{className:"font-medium text-neutral-900",children:"Required access"}),(0,l.jsxs)("p",{className:"mt-0.5",children:[g.permissions,N&&L.map(e=>{let[t,n]=e;return(0,l.jsxs)(a.Fragment,{children:[" ",(0,l.jsxs)("a",{href:n,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-0.5 whitespace-nowrap font-medium text-neutral-900 underline underline-offset-2",children:[t,(0,l.jsx)(o.A,{className:"h-3 w-3"})]})]},n)})]})]})]})}),O.length>0&&(0,l.jsxs)("label",{className:"block",children:[(0,l.jsx)("span",{className:"mb-1 block text-xs font-medium text-neutral-500",children:"Connection"}),(0,l.jsxs)("select",{value:v.connectionId,onChange:e=>{S([]),z({connectionId:e.target.value,dataset:null})},disabled:k,className:"w-full rounded-lg border bg-background px-3 py-2 text-sm",children:[(0,l.jsx)("option",{value:"",children:"Use a new API key"}),O.map(e=>(0,l.jsx)("option",{value:e.id,children:N?"Your saved connection":e.name},e.id))]})]}),!v.connectionId&&(0,l.jsxs)("div",{className:N?"flex flex-col gap-3":"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,l.jsxs)("label",{className:"block",children:[(0,l.jsx)("span",{className:"mb-1 block text-xs font-medium text-neutral-500",children:"langfuse"===x?"Secret key":"API key"}),(0,l.jsx)("input",{type:"password",value:v.apiKey,onChange:e=>z({apiKey:e.target.value}),placeholder:"Paste API key",disabled:k,className:"w-full rounded-lg border bg-background px-3 py-2 text-sm"})]}),g.needs_secondary_key&&(0,l.jsxs)("label",{className:"block",children:[(0,l.jsx)("span",{className:"mb-1 block text-xs font-medium text-neutral-500",children:"Public key"}),(0,l.jsx)("input",{type:"password",value:v.secondaryApiKey,onChange:e=>z({secondaryApiKey:e.target.value}),placeholder:"pk-lf-…",disabled:k,className:"w-full rounded-lg border bg-background px-3 py-2 text-sm"})]}),g.needs_workspace&&(0,l.jsxs)("label",{className:"block",children:[(0,l.jsx)("span",{className:"mb-1 block text-xs font-medium text-neutral-500",children:g.workspace_label}),(0,l.jsx)("input",{value:v.workspace,onChange:e=>z({workspace:e.target.value}),placeholder:g.workspace_label,disabled:k,className:"w-full rounded-lg border bg-background px-3 py-2 text-sm"})]}),(0,l.jsxs)("label",{className:"block",children:[(0,l.jsx)("span",{className:"mb-1 block text-xs font-medium text-neutral-500",children:"Base URL (optional)"}),(0,l.jsx)("input",{type:"url",value:v.baseUrl,onChange:e=>z({baseUrl:e.target.value}),placeholder:g.default_base_url,disabled:k,className:"w-full rounded-lg border bg-background px-3 py-2 text-sm"})]}),(0,l.jsxs)("label",{className:"flex items-center gap-2 text-xs text-neutral-600 sm:col-span-2",children:[(0,l.jsx)("input",{type:"checkbox",checked:E,onChange:e=>T(e.target.checked),className:"rounded border-neutral-300"}),"Save this connection securely for future imports."]})]}),P&&(0,l.jsx)("p",{className:"text-xs text-neutral-500",children:N?"Using your saved connection. Choose “Use a new API key” above to replace it.":(0,l.jsxs)(l.Fragment,{children:["Using saved connection ",(0,l.jsx)("span",{className:"font-medium text-neutral-800",children:P.name}),". Choose “Use a new API key” above to replace it."]})}),(0,l.jsxs)(s.$,{variant:"outline",onClick:D,disabled:!F||C||k,className:"gap-1.5",children:[C?(0,l.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,l.jsx)(u.A,{className:"h-3.5 w-3.5"}),"Load datasets"]}),_.length>0&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-[minmax(0,1fr)_180px]",children:[(0,l.jsxs)("label",{className:"block",children:[(0,l.jsx)("span",{className:"mb-1 block text-xs font-medium text-neutral-500",children:"Dataset, experiment, or project"}),(0,l.jsx)("select",{value:null!=(n=null==(t=v.dataset)?void 0:t.id)?n:"",onCh
1ange:e=>{var t;return z({dataset:null!=(t=_.find(t=>t.id===e.target.value))?t:null})},disabled:k,className:"w-full rounded-lg border bg-background px-3 py-2 text-sm",children:_.map(e=>(0,l.jsxs)("option",{value:e.id,children:[e.name," (",e.kind,")",null!=e.record_count?" \xb7 ".concat(e.record_count," records"):""]},e.id))})]}),(0,l.jsxs)("label",{className:"block",children:[(0,l.jsx)("span",{className:"mb-1 block text-xs font-medium text-neutral-500",children:"Records to import"}),(0,l.jsx)("select",{value:v.maxTasks,onChange:e=>z({maxTasks:Number(e.target.value)}),disabled:k,className:"w-full rounded-lg border bg-background px-3 py-2 text-sm",children:f.map(e=>(0,l.jsxs)("option",{value:e,children:["Up to ",e.toLocaleString()]},e))})]})]}),(0,l.jsx)("p",{className:"text-xs text-neutral-500",children:N?"Imports the first ".concat(v.maxTasks.toLocaleString("en-US")," records."):"Imports are cursor/page paginated up to 5,000 records."})]})}},88515:(e,t,n)=>{n.d(t,{HK:()=>s,PI:()=>a,o_:()=>i,qu:()=>c,w_:()=>r});var l=n(56540);let a="The attached archive is a complete benchmark bundle. Read 00_BRIEF.md first: it describes the work being measured. 01_SOURCES.md is the file manifest; 02_TASK_SEEDS.md has the worked instances with established answers. Name the benchmark after the work described in the brief.";function r(e){var t,n;return null!=(n=null==(t=l.y.find(t=>t.key===e&&t.available))?void 0:t.key)?n:null}async function s(e){let t=new Uint8Array(await e.slice(Math.max(0,e.size-65557)).arrayBuffer());for(let e=t.length-22;e>=0;e--)if(80===t[e]&&75===t[e+1]&&5===t[e+2]&&6===t[e+3]){var n,l,a,s,i,o;let c=(null!=(s=t[e+20])?s:0)|(null!=(i=t[e+21])?i:0)<<8,u=new TextDecoder().decode(t.slice(e+22,e+22+c));return{style:r(null!=(o=null==(n=u.match(/eval_type=([a-z_]+)/))?void 0:n[1])?o:null),name:(null==(a=u.match(/name=(.+)$/))||null==(l=a[1])?void 0:l.trim())||null}}return null}async function i(e){var t,n;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=await s(e).catch(()=>null),r=null!=(t=null==a?void 0:a.style)?t:l,i=null!=a&&(null!=a.style||null!=a.name),c=null!=r&&i?null:await o(e);return i||null!=c?{file:e,style:r,name:null!=(n=null==a?void 0:a.name)?n:null,brief:c}:null}async function o(e){try{let{default:t}=await Promise.all([n.e(95704),n.e(58059)]).then(n.t.bind(n,58059,23)),l=await t.loadAsync(await e.arrayBuffer()),a=Object.values(l.files).find(e=>!e.dir&&"00_BRIEF.md"===e.name.split("/").pop());if(null==a)return null;return(await a.async("string")).slice(0,8e3)}catch(e){return null}}function c(e){return e.name?'This benchmark is called "'.concat(e.name,'". ').concat(a):a}},91613:(e,t,n)=>{n.d(t,{WF:()=>ei,Nd:()=>ec,VY:()=>eo});var l=n(58212),a=n(36772),r=n(96040),s=n(83386),i=n(33505),o=n(27433),c=n(65403),u=n(77759),d=n(92515),m=n(70366),p=n(3895),h=n(65918),f=n(39540),x=n(32672),g=n(35984),b=n(38285);let y={tasks:200,traces:500},v=new Set(["huggingface.co","www.huggingface.co","hf.co","www.hf.co"]),w=/^Previewed the '(.+)' table\.$/,k=/^(?:(?:https?:\/\/)?(?:www\.)?(?:huggingface|hf)\.co\/|hf:\/\/)buckets\//i,j={tasks:["row","rows"],traces:["record","records"]};function N(e){let t={config:null,split:null},n=e.trim();try{var l,a;let e=new URL(/^[a-z][\w+.-]*:/i.test(n)?n:"https://".concat(n));if(!/^https?:$/.test(e.protocol)||!v.has(e.hostname))return t;let r=e.pathname.split("/").filter(Boolean).map(decodeURIComponent);if("datasets"!==r[0]||"viewer"!==r[3])return t;return{config:null!=(l=r[4])?l:null,split:null!=(a=r[5])?a:null}}catch(e){return t}}function _(e,t,n){let{repo_id:l,revision:a}=e,r=null!=a&&"refs/convert/parquet"!==a?"@".concat(encodeURIComponent(a)):"",s=[t,...null!=n?[n]:[]].map(encodeURIComponent).join("/");return"https://huggingface.co/datasets/".concat(l).concat(r,"/viewer/").concat(s)}function S(e,t){var n,l;let a=e.configs.length>0?e.configs:["default"],r=N(t),s=null!=r.config&&a.includes(r.config)?r.config:null,i=null!=(n=function(e){var t,n;if(1===e.splits.length)return null!=(t=e.splits[0])?t:null;for(let t of e.warnings){let e=null==(n=w.exec(t))?void 0:n[1];if(null!=e)return e}return null}(e.preview))?n:r.split,o=t.trim()!==e.link?r.split:null!=i&&e.splits.includes(i)?i:null;return{configs:a,config:null!=s?s:1===a.length&&null!=(l=a[0])?l:null,split:o,scopable:!k.test(e.link)}}
1function C(e,t,n){return"".concat(e.toLocaleString("en-US")," ").concat(1===e?t:n)}var A=n(8734),R=n(34234),I=n(26571);function E(e){var t,n,o;let c,v,k,E,U,L,P,z,F,D,q,M,W,$,K,G,B,J,V,H,Y,Q,X,Z,ee=(0,a.c)(84),{orgSlug:et,imports:en,traceType:el,open:ea,onClose:er,onExitComplete:es}=e,ei=function(e,t){var n,l;let{account:a,isLoading:s,isSaving:i,connect:o,disconnect:c,refresh:u}=(0,g.D)(e),[d,m]=(0,r.useState)(!1),p=(0,r.useRef)(0),h=(0,r.useRef)(null!=(l=null==(n=t.shape)?void 0:n.hub)?l:null),{hfUrl:f,changeHuggingFaceUrl:y,setShape:v,setIsDetecting:w,setDetectError:k}=t,j=e=>{e!==f&&y(e)},C=async function(t){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=++p.current;if(n||v(null),!(0,x.cO)(t)){w(!1),k(x.J$);return}w(!0),k(null);try{let n=await (0,x.bR)(e,t);if(p.current!==l)return;let a=function(e,t,n){let l={preview:e,link:t,configs:e.configs,splits:e.splits};if(null==n||n.preview.repo_id!==e.repo_id||n.preview.revision!==e.revision)return l;let a=N(t),r=a.config===S(n,n.link).config;return{...l,configs:null!=a.config?n.configs:e.configs,splits:null!=a.split&&r?n.splits:e.splits}}(n,t,h.current);h.current=a;let r=function(e,t){let n=e.preview.default_config;return null==n||e.configs.length<2||!e.configs.includes(n)?null:null==N(t).config?_(e.preview,n):null}(a,t);if(null!=r){j(r),C(r,!0);return}v({...(0,b.uA)(n),hub:a})}catch(t){if(p.current!==l)return;let e=t instanceof Error?t.message:"Could not read that dataset";v(null),k(e),x.KU.test(e)&&m(!0)}finally{p.current===l&&w(!1)}};return{account:a,isLoading:s,isSaving:i,showConnect:d,offerConnect:!s&&null==a&&!d,needsCheck:!t.isDetecting&&null==t.shape&&null==t.detectError&&(0,x.cO)(f),openConnect:()=>m(!0),check:()=>void C(f.trim()),edit:e=>{p.current+=1,j(e),v(null),w(!1),k(null)},scope:e=>{e!==f.trim()&&(j(e),C(e,!0))},connect:async e=>{let t=await o(e);return(0,x.cO)(f)&&C(f.trim()),t},disconnect:async()=>{await c(),await u()}}}(et,en),eo=(0,A.R)(en.isTraces);ee[0]!==eo||ee[1]!==en.isTraces||ee[2]!==el?(c=en.isTraces?(0,R.NS)(eo.read,{stage:"trace-import",ownerType:el}):null,ee[0]=eo,ee[1]=en.isTraces,ee[2]=el,ee[3]=c):c=ee[3];let ec=c,{shape:eu,isDetecting:ed,detectError:em,isPreparing:ep}=en,eh=null==eu?void 0:eu.hub,ef=null!=(t=null==eu?void 0:eu.kind)?t:"tasks";ee[4]!==eh||ee[5]!==en.hfUrl?(v=null!=eh?S(eh,en.hfUrl):null,ee[4]=eh,ee[5]=en.hfUrl,ee[6]=v):v=ee[6];let ex=v,eg=null!=ex&&ex.scopable&&null==ex.config;ee[7]!==ep||ee[8]!==er?(k=e=>{e||ep||er()},ee[7]=ep,ee[8]=er,ee[9]=k):k=ee[9],ee[10]===Symbol.for("react.memo_cache_sentinel")?(E=(0,l.jsxs)(s.L3,{className:"flex items-center gap-2 font-brand-sans text-base font-medium",children:[(0,l.jsx)(u.default,{src:"/img/logos/huggingface.svg",alt:"",width:20,height:20,unoptimized:!0}),"Hugging Face"]}),ee[10]=E):E=ee[10],ee[11]===Symbol.for("react.memo_cache_sentinel")?(U=(0,l.jsxs)(s.c7,{children:[E,(0,l.jsx)(s.rr,{children:null==(n=(0,I.rf)("huggingface"))?void 0:n.line})]}),ee[11]=U):U=ee[11],ee[12]!==ei?(L=e=>ei.edit(e.target.value),ee[12]=ei,ee[13]=L):L=ee[13],ee[14]!==ep||ee[15]!==ei?(P=e=>{"Enter"!==e.key||ep||ei.check()},ee[14]=ep,ee[15]=ei,ee[16]=P):P=ee[16],ee[17]!==en.hfUrl||ee[18]!==ep||ee[19]!==L||ee[20]!==P?(z=(0,l.jsx)(p.p,{value:en.hfUrl,onChange:L,onKeyDown:P,disabled:ep,placeholder:"https://huggingface.co/datasets/org/name","aria-label":"Dataset",className:"min-w-0 flex-1 text-[13px] focus-visible:border-foreground focus-visible:ring-0 md:text-[13px]"}),ee[17]=en.hfUrl,ee[18]=ep,ee[19]=L,ee[20]=P,ee[21]=z):z=ee[21];let eb=ep||0===en.hfUrl.trim().length;(ee[22]!==ei.check||ee[23]!==eb?(F=(0,l.jsx)(i.$,{variant:"outlineSecondary",onClick:ei.check,disabled:eb,className:"h-9 shrink-0 px-4",children:"Check"}),ee[22]=ei.check,ee[23]=eb,ee[24]=F):F=ee[24],ee[25]!==F||ee[26]!==z?(D=(0,l.jsxs)("div",{className:"flex gap-2",children:[z,F]}),ee[25]=F,ee[26]=z,ee[27]=D):D=ee[27],ee[28]===Symbol.for("react.memo_cache_sentinel")?(q=(0,l.jsxs)("p",{className:"text-[11.5px] text-muted-foreground",children:["A dataset or bucket link, an ",(0,l.jsx)("code",{className:"text-[11px]",children:"org/name"})," shorthand, or a link into one config."]}),ee[28]=q):q=ee[28],ee[29]!==ei.needsCheck?(M=ei.needsCheck&&(0,l.jsx)("p",{className:"text-xs text-amber-600",children:"Press Check to read this dataset."}),ee[29]=ei.needsCheck,ee[30]=M):M=ee[30],ee[31]!==ei.account||ee[32]!==ei.connect||ee[33]!==ei.disconnect||ee[34]!==ei.isLoading||ee[35]!==ei.isSaving||ee[36]!==ei.showConnect?(W=!ei.isLoading&&(ei.showConnect||null!=ei.account)&&(0,l.jsx)(f.p,{account:ei.account,isSaving:ei.isSaving,connect:ei.connect,disconnect:ei.disconnect,purpose:"import"}),ee[31]=ei.account,ee[32]=ei.connect,ee[33]=ei.disconnect,ee[34]=ei.isLoading,ee[35]=ei.isSaving,ee[36]=ei.showConnect,ee[37]=W):W=ee[37],ee[38]!==D||ee[39]!==M||ee[40]!==W?($=(0,l.jsxs)("div",{className:"flex flex-col gap-1.5",children:[D,q,M,W]}),ee[38]=D,ee[39]=M,ee[40]=W,ee[41]=$):$=ee[41],ee[42]!==em||ee[43]!==eh||ee[44]!==ed||ee[45]!==ep||ee[46]!==ef||ee[47]!==ei||ee[48]!==ex)?(K=null!=eh&&null!=ex?(0,l.jsxs)(s.NW,{stale:ed,className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex items-start gap-2.5 rounded-lg bg-brand-mint/25 px-3.5 py-3",children:[(0,l.jsx)(d.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-brand-green-dark"}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-[3px] text-xs text-neutral-700",children:[(0,l.jsx)("span",{className:"break-words text-[13px] font-medium text-foreground",children:eh.preview.repo_id}),(0,l.jsx)("span",{className:"tabular-nums",children:(function(e,t){let n=y[t],l=[];return null!=e.row_count&&(l.push(C(e.row_count,...j[t])),e.row_count>n&&l.push("importing the first ".concat(n))),l.push(C(e.tables.length,"table","tables"),C(e.file_count,"file","files")),e.reference_file_count>0&&l.push(C(e.reference_file_count,"reference file","reference files")),l})(eh.preview,ef).join(" \xb7 ")}),(0,l.jsx)("span",{children:"traces"===ef?"Trace records":"A task dataset"})]}),(0,l.jsx)("span",{className:"shrink-0 text-[11px] text-brand-green-dark",children:(o=eh.preview).private?"Private":
1o.gated?"Gated":"Public"})]}),ex.scopable&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",children:[(0,l.jsx)(O,{label:"Config",placeholder:"Choose a config",value:ex.config,options:ex.configs,disabled:ed||ep,onChange:e=>ei.scope(_(eh.preview,e))}),(0,l.jsx)(O,{label:"Split",placeholder:null==ex.config?"Choose a config first":"Choose a split",value:ex.split,options:eh.splits,disabled:ed||ep||null==ex.config,onChange:e=>{null!=ex.config&&ei.scope(_(eh.preview,ex.config,e))}})]}),eh.preview.warnings.filter(e=>!w.test(e)).map(T)]}):ed?(0,l.jsxs)("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,l.jsx)(s.Mt,{}),"Reading it…"]}):null!=em&&(0,l.jsxs)("p",{className:"flex items-start gap-1.5 text-xs text-amber-700",children:[(0,l.jsx)(m.A,{className:"mt-0.5 h-3 w-3 shrink-0"}),em]}),ee[42]=em,ee[43]=eh,ee[44]=ed,ee[45]=ep,ee[46]=ef,ee[47]=ei,ee[48]=ex,ee[49]=K):K=ee[49],ee[50]!==ec||ee[51]!==eo?(G=null!=ec&&(0,l.jsx)(h.X,{consent:ec,onRetry:eo.retry}),ee[50]=ec,ee[51]=eo,ee[52]=G):G=ee[52],ee[53]!==ei.offerConnect||ee[54]!==ei.openConnect?(B=ei.offerConnect&&(0,l.jsxs)("span",{className:"mr-auto text-xs text-muted-foreground",children:["Private or gated?"," ",(0,l.jsx)("button",{type:"button",onClick:ei.openConnect,className:"text-foreground underline underline-offset-2 hover:text-neutral-700",children:"Connect Hugging Face"})]}),ee[53]=ei.offerConnect,ee[54]=ei.openConnect,ee[55]=B):B=ee[55],ee[56]!==eg?(J=eg&&(0,l.jsx)("span",{className:"text-xs text-amber-600",children:"Choose a config to import."}),ee[56]=eg,ee[57]=J):J=ee[57],ee[58]!==ep||ee[59]!==er?(V=(0,l.jsx)(i.$,{variant:"outlineSecondary",onClick:er,disabled:ep,children:"Cancel"}),ee[58]=ep,ee[59]=er,ee[60]=V):V=ee[60];let ey=!en.canImport&&!ep||eg||null!=ec&&"known"!==ec.amount;return ee[61]!==eh||ee[62]!==ef?(H=null!=eh?function(e,t){let[n,l]="traces"===t?j.traces:["task","tasks"],a=y[t];return null==e?"Import up to ".concat(a," ").concat(l):"Import ".concat(C(Math.min(e,a),n,l))}(eh.preview.row_count,ef):"Import",ee[61]=eh,ee[62]=ef,ee[63]=H):H=ee[63],ee[64]!==en.startImport||ee[65]!==ep||ee[66]!==ey||ee[67]!==H?(Y=(0,l.jsx)(s.$n,{variant:"primary",onClick:en.startImport,disabled:ey,pending:ep,children:H}),ee[64]=en.startImport,ee[65]=ep,ee[66]=ey,ee[67]=H,ee[68]=Y):Y=ee[68],ee[69]!==B||ee[70]!==J||ee[71]!==V||ee[72]!==Y?(Q=(0,l.jsxs)(s.Es,{className:"items-center gap-2 sm:gap-2",children:[B,J,V,Y]}),ee[69]=B,ee[70]=J,ee[71]=V,ee[72]=Y,ee[73]=Q):Q=ee[73],ee[74]!==$||ee[75]!==K||ee[76]!==G||ee[77]!==Q?(X=(0,l.jsxs)(s.Cf,{className:"gap-4 sm:max-w-xl",children:[U,$,K,G,Q]}),ee[74]=$,ee[75]=K,ee[76]=G,ee[77]=Q,ee[78]=X):X=ee[78],ee[79]!==es||ee[80]!==ea||ee[81]!==X||ee[82]!==k?(Z=(0,l.jsx)(s.lG,{open:ea,onOpenChange:k,onExitComplete:es,children:X}),ee[79]=es,ee[80]=ea,ee[81]=X,ee[82]=k,ee[83]=Z):Z=ee[83],Z}function T(e){return(0,l.jsx)("p",{className:"text-[11px] text-amber-700",children:e},e)}function O(e){let t,n,r,i,o,c,u,d=(0,a.c)(20),{label:m,placeholder:p,value:h,options:f,disabled:x,onChange:g}=e;d[0]!==m?(t=(0,l.jsx)("span",{className:"text-xs font-medium text-foreground",children:m}),d[0]=m,d[1]=t):t=d[1];let b=null!=h?h:"";return d[2]!==p?(n=(0,l.jsx)(s.yv,{placeholder:p}),d[2]=p,d[3]=n):n=d[3],d[4]!==m||d[5]!==n?(r=(0,l.jsx)(s.bq,{"aria-label":m,className:"bg-background px-[11px] text-[13px]",children:n}),d[4]=m,d[5]=n,d[6]=r):r=d[6],d[7]!==f?(i=f.map(U),d[7]=f,d[8]=i):i=d[8],d[9]!==i?(o=(0,l.jsx)(s.gC,{children:i}),d[9]=i,d[10]=o):o=d[10],d[11]!==x||d[12]!==g||d[13]!==b||d[14]!==r||d[15]!==o?(c=(0,l.jsxs)(s.l6,{value:b,onValueChange:g,disabled:x,children:[r,o]}),d[11]=x,d[12]=g,d[13]=b,d[14]=r,d[15]=o,d[16]=c):c=d[16],d[17]!==t||d[18]!==c?(u=(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-1.5",children:[t,c]}),d[17]=t,d[18]=c,d[19]=u):u=d[19],u}function U(e){return(0,l.jsx)(s.eb,{value:e,className:"text-[13px]",children:e},e)}var L=n(3340),P=n(24121),z=n(53952),F=n(70895),D=n(44742),q=n(72324),M=n(59514);function W(e,t,n){let l=t.connectionId||null,a={api_key:t.apiKey.trim(),secondary_api_key:t.secondaryApiKey.trim()||null,base_url:t.baseUrl.trim()||null,workspace:t.workspace.trim()||null};return{platform:e,connection_id:l,...l?{}:a,dataset:n.id}}async function $(e,t){let n=arguments.length>
12&&void 0!==arguments[2]?arguments[2]:15e3,l=new AbortController,a=setTimeout(()=>l.abort(),n);try{let n=await fetch("".concat((0,M.Gn)(e),"/import-platforms/preview"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:l.signal});if(!n.ok)throw Error(await (0,M.IP)(n));return q.Ac.parse(await n.json())}catch(e){if(l.signal.aborted)throw Error("the platform took more than 15 seconds to answer");throw e}finally{clearTimeout(a)}}function K(e){var t,n,o,c;let u,d,m,p,f,x,g,b,y,v,w,k,j,N,_,S,C,E,T,O=(0,a.c)(73),{orgSlug:U,imports:L,platform:q,traceType:M,onClose:K,onExitComplete:B}=e,{platformDefinitions:J,platformLoadError:V,platformSelection:H,isPreparing:Y}=L,Q=(0,z.Ls)(q);O[0]!==Q?(u=e=>e.key===Q,O[0]=Q,O[1]=u):u=O[1];let X=J.find(u);O[2]!==Q?(d=null==Q?void 0:(0,I.rf)(Q),O[2]=Q,O[3]=d):d=O[3];let Z=d,ee=null!=(n=null!=(t=null==X?void 0:X.label)?t:null==Z?void 0:Z.label)?n:"",et=function(e,t,n){let l,s,i,o,c,u,d=(0,a.c)(19),{dataset:m}=n,[p,h]=(0,r.useState)(null),f=null!=t&&null!=m?"".concat(t,"/").concat(n.connectionId,"/").concat(m.id):null;d[0]!==m?(l=null!=m&&"project"!==m.kind,d[0]=m,d[1]=l):l=d[1];let x=l;d[2]!==m||d[3]!==t||d[4]!==n?(s=null!=t&&null!=m?W(t,n,m):null,d[2]=m,d[3]=t,d[4]=n,d[5]=s):s=d[5];let g=(0,r.useRef)(s);if(d[6]!==m||d[7]!==t||d[8]!==n?(i=()=>{g.current=null!=t&&null!=m?W(t,n,m):null},d[6]=m,d[7]=t,d[8]=n,d[9]=i):i=d[9],(0,r.useEffect)(i),d[10]!==f||d[11]!==e||d[12]!==x?(o=()=>{let t,n=g.current;if(null!=f&&null!=n&&x)return t=!1,$(e,n).then(e=>{t||h({key:f,read:{status:"read",preview:e}})},e=>{let n=e instanceof Error?e.message:"Could not read its records";t||h({key:f,read:{status:"failed",error:n}})}),()=>{t=!0}},c=[e,f,x],d[10]=f,d[11]=e,d[12]=x,d[13]=o,d[14]=c):(o=d[13],c=d[14]),(0,r.useEffect)(o,c),null==f)return null;if(!x){let e;return d[15]===Symbol.for("react.memo_cache_sentinel")?(e={status:"project"},d[15]=e):e=d[15],e}return d[16]!==p||d[17]!==f?(u=(null==p?void 0:p.key)===f?p.read:{status:"reading"},d[16]=p,d[17]=f,d[18]=u):u=d[18],u}(U,Q,H);O[4]!==et?(m=null==et||"reading"===(c=et).status?null:"read"===c.status&&"tasks"===c.preview.kind?"tasks":"traces",O[4]=et,O[5]=m):m=O[5];let en=m,el=(0,A.R)(null!=Q&&"tasks"!==en);O[6]!==el||O[7]!==en||O[8]!==M?(p="tasks"!==en?(0,R.NS)(el.read,{stage:"trace-import",ownerType:M}):null,O[6]=el,O[7]=en,O[8]=M,O[9]=p):p=O[9];let ea=p,er=s.lG,es=null!=q;O[10]!==Y||O[11]!==K?(f=e=>{e||Y||K()},O[10]=Y,O[11]=K,O[12]=f):f=O[12];let ei=s.Cf,eo=s.c7;O[13]!==ee?(x=(0,l.jsx)(D.v,{label:ee}),O[13]=ee,O[14]=x):x=O[14],O[15]!==ee||O[16]!==x?(g=(0,l.jsxs)(s.L3,{className:"flex items-center gap-2 font-brand-sans text-base font-medium",children:[x,ee]}),O[15]=ee,O[16]=x,O[17]=g):g=O[17];let ec=s.rr,eu=null!=X?"".concat(X.description," \xb7 ").concat((0,I.b9)(X)):null==Z?void 0:Z.line;O[18]!==ec||O[19]!==eu?(b=(0,l.jsx)(ec,{children:eu}),O[18]=ec,O[19]=eu,O[20]=b):b=O[20],O[21]!==Z?(y=null!=Z&&(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:Z.line}),O[21]=Z,O[22]=y):y=O[22],O[23]!==eo||O[24]!==b||O[25]!==y||O[26]!==g?(v=(0,l.jsxs)(eo,{children:[g,b,y]}),O[23]=eo,O[24]=b,O[25]=y,O[26]=g,O[27]=v):v=O[27],O[28]!==X||O[29]!==L.platformConnections||O[30]!==L.setPlatformConnections||O[31]!==L.setPlatformSelection||O[32]!==Y||O[33]!==ee||O[34]!==U||O[35]!==V||O[36]!==H||O[37]!==Q?(w=null!=X&&null!=Q?(0,l.jsx)(F.e,{orgSlug:U,platform:Q,definition:X,connections:L.platformConnections,onConnectionsChange:L.setPlatformConnections,selection:H,onSelectionChange:L.setPlatformSelection,disabled:Y,variant:"panel"}):null!=V?(0,l.jsx)("p",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:V}):(0,l.jsxs)("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,l.jsx)(P.A,{className:"h-3 w-3 animate-spin"}),"Loading ",ee,"…"]}),O[28]=X,O[29]=L.platformConnections,O[30]=L.setPlatformConnections,O[31]=L.setPlatformSelection,O[32]=Y,O[33]=ee,O[34]=U,O[35]=V,O[36]=H,O[37]=Q,O[38]=w):w=O[38],O[39]!==X||O[40]!==H||O[41]!==et?(k=null!=X&&null!=et&&(0,l.jsx)(G,{name:null==(o=H.dataset)?void 0:o.name,read:et}),O[39]=X,O[40]=H,O[41]=et,O[42]=k):k=O[42],O[43]!==ea||O[44]!==el?(j=null!=ea&&(0,l.jsx)(h.X,{className:"mr-auto max-w-xs",consent:ea,onRetry:el.retry}),O[43]=ea,O[44]=el,O[45]=j):j=O[45],O[46]!==Y||O[47]!==K?(N=(0,l.jsx)(i.$,{variant:"outlineSecondary",onClick:K,disabled:Y,children:"Cancel"}),O[46]=Y,O[47]=K,O[48]=N):N=O[48],O[49]!==L||O[50]!==en?(_=()=>{null!=en&&L.importPlatformAs(en)},O[49]=L,O[50]=en,O[51]=_):_=O[51];let ed=!L.canImport&&!Y||null==en||null!=ea&&"known"!==ea.amount,em="tasks"===en?"Import tasks":"Import traces";return O[52]!==Y||O[53]!==_||O[54]!==ed||O[55]!==em?(S=(0,l.jsx)(s.$n,{variant:"primary",onClick:_,disabled:ed,pending:Y,children:em}),O[52]=Y,O[53]=_,O[54]=ed,O[55]=em,O[56]=S):S=O[56],O[57]!==j||O[58]!==N||O[59]!==S?(C=(0,l.jsxs)(s.Es,{className:"items-center gap-2 sm:gap-2",children:[j,N,S]}),O[57]=j,O[58]=N,O[59]=S,O[60]=C):C=O[60],O[61]!==ei||O[62]!==v||O[63]!==w||O[64]!==k||O[65]!==C?(E=(0,l.jsxs)(ei,{className:"max-h-[90dvh] gap-4 overflow-y-auto sm:max-w-xl",children:[v,w,k,
1C]}),O[61]=ei,O[62]=v,O[63]=w,O[64]=k,O[65]=C,O[66]=E):E=O[66],O[67]!==er||O[68]!==B||O[69]!==E||O[70]!==es||O[71]!==f?(T=(0,l.jsx)(er,{open:es,onOpenChange:f,onExitComplete:B,children:E}),O[67]=er,O[68]=B,O[69]=E,O[70]=es,O[71]=f,O[72]=T):T=O[72],T}function G(e){let t,n,r,s,i,o,c,u,p,h=(0,a.c)(23),{name:f,read:x}=e;if("reading"===x.status){let e;return h[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,l.jsxs)("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,l.jsx)(P.A,{className:"h-3 w-3 animate-spin"}),"Reading its first records…"]}),h[0]=e):e=h[0],e}h[1]!==x?(t=function(e){var t,n;if("project"===e.status)return{facts:"A project holds traced runs",kind:"Trace records",sample:null};if("failed"===e.status)return{facts:null,kind:"Imports as traces",sample:null};let{preview:l}=e,a=(t=l.reason).charAt(0).toUpperCase()+t.slice(1);return"tasks"===l.kind?{facts:a,kind:"A task dataset",sample:null!=(n=l.sample_rows[0])&&n.prompt?n.expected_answer?"".concat(n.prompt," → ").concat(n.expected_answer):n.prompt:null}:{facts:a,kind:"traces"===l.kind?"Trace records":"Imports as traces",sample:null}}(x),h[1]=x,h[2]=t):t=h[2];let g=t;return h[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,l.jsx)(d.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-brand-green-dark"}),h[3]=n):n=h[3],h[4]!==f?(r=null!=f&&(0,l.jsx)("span",{className:"break-words text-[13px] font-medium text-foreground",children:f}),h[4]=f,h[5]=r):r=h[5],h[6]!==g.facts?(s=null!=g.facts&&(0,l.jsx)("span",{className:"tabular-nums",children:g.facts}),h[6]=g.facts,h[7]=s):s=h[7],h[8]!==g.kind?(i=(0,l.jsx)("span",{children:g.kind}),h[8]=g.kind,h[9]=i):i=h[9],h[10]!==g.sample?(o=null!=g.sample&&(0,l.jsx)("span",{className:"truncate text-muted-foreground",children:g.sample}),h[10]=g.sample,h[11]=o):o=h[11],h[12]!==r||h[13]!==s||h[14]!==i||h[15]!==o?(c=(0,l.jsxs)("div",{className:"flex items-start gap-2.5 rounded-lg bg-brand-mint/25 px-3.5 py-3",children:[n,(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-[3px] text-xs text-neutral-700",children:[r,s,i,o]})]}),h[12]=r,h[13]=s,h[14]=i,h[15]=o,h[16]=c):c=h[16],h[17]!==x.error||h[18]!==x.status?(u="failed"===x.status&&(0,l.jsxs)("p",{className:"flex items-start gap-1.5 text-xs text-amber-700",children:[(0,l.jsx)(m.A,{className:"mt-0.5 h-3 w-3 shrink-0"}),"Couldn’t read its records: ",x.error]}),h[17]=x.error,h[18]=x.status,h[19]=u):u=h[19],h[20]!==c||h[21]!==u?(p=(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[c,u]}),h[20]=c,h[21]=u,h[22]=p):p=h[22],p}var B=n(3869),J=n(83325),V=n(88515),H=n(92785);let Y=[".xlsx",".xlsm",".csv",".tsv",".json",".jsonl"],Q=[".pdf",".docx",".doc"],X=[...Y,...Q,".zip"].join(",");async function Z(e){let[t]=e;if(null==t)return ee("Choose a file to import.");if(e.length>1)return ee("Import one file at a time. Supporting files attach to tasks in the table.");let n=t.name.toLowerCase();if(Q.some(e=>n.endsWith(e)))return ee("".concat(t.name," is a document. Import a task sheet for now: Excel, CSV or JSON."));if(!Y.some(e=>n.endsWith(e)))return ee("".concat(t.name," isn’t a file Optima can import. Use Excel, CSV or JSON."));if(0===t.size)return ee("".concat(t.name," is empty."));if(t.size>524288e3)return ee("".concat(t.name," is over 500 MB, the largest file Optima takes."));if(t.size>0x1900000)return{ok:!0,file:t,kind:"tasks",kindReason:null,rowCount:null};let l=await et(t,n);if("string"==typeof l)return ee("".concat(t.name," ").concat(l));if(0===l.columns.length)return ee("".concat(t.name," has no header row."));if(0===l.rows.length)return ee("".concat(t.name," has a header but no rows."));if(l.rows.length>5e3)return ee("".concat(t.name," has ").concat(l.rows.length.toLocaleString("en-US")," rows. One import takes up to ").concat(5e3.toLocaleString("en-US"),"."));let{kind:a,reason:r}=(0,b.GW)(l.columns,l.rows.slice(0,20));return{ok:!0,file:t,kind:a,kindReason:"traces"===a?r:null,rowCount:l.rows.length}}function ee(e){return{ok:!1,reason:e}}async function et(e,t){if(t.endsWith(".json")||t.endsWith(".jsonl"))return function(e,t){let n;if(t)for(let[t,l]of(n=[],e.split("\n").entries())){if(""===l.trim())continue;let e=el(l);
1if(void 0===e)return"has a line that isn’t JSON (line ".concat(t+1,").");n.push(e)}else{let t=el(e);if(void 0===t)return"isn’t valid JSON.";if(!Array.isArray(t))return"isn’t a list of records.";n=t}if(0===n.length)return"has no records.";if(!n.every(ea))return"has an entry that isn’t an object with named fields.";let l=n;return{columns:[...new Set(l.flatMap(e=>Object.keys(e)))],rows:l}}(await e.text(),t.endsWith(".jsonl"));try{var n;let l=t.endsWith(".xlsx")||t.endsWith(".xlsm")?H.LF(await e.arrayBuffer(),{type:"array"}):H.LF(await e.text(),{type:"string",raw:!0}),a=l.Sheets[null!=(n=l.SheetNames[0])?n:""];if(null==a)return"has no sheet to read.";return function(e){let[t=[],...n]=e,l=en(t)+1,a=t.slice(0,l).map(e=>String(e).trim());if(a.some(e=>""===e))return"has a blank column name in its header row.";let r=n.findIndex(e=>en(e)>=l);if(-1!==r)return"has more cells in row ".concat(r+2," than in its header row.");let s=n.map(e=>Object.fromEntries(a.map((t,n)=>{var l;return[t,null!=(l=e[n])?l:""]})));return{columns:a,rows:s}}(H.Wp.sheet_to_json(a,{header:1,blankrows:!1,defval:""}))}catch(e){return"could not be read. Check that it opens as a spreadsheet."}}function en(e){for(let n=e.length-1;n>=0;n-=1){var t;if(""!==String(null!=(t=e[n])?t:"").trim())return n}return -1}function el(e){try{return JSON.parse(e)}catch(e){return}}function ea(e){return"object"==typeof e&&null!=e&&!Array.isArray(e)}var er=n(93957),es=n(30332);let ei="append_not_supported";function eo(e){let{target:t,onStarted:n,enabled:s,locked:i=!1,hold:u=null,bundleStyle:d=null}=e,{orgSlug:m}=(0,c.t$)(),p=(0,o.mz)("benchmark").benchmark,h=(0,o.mz)("flags"),f=null==t?null:(0,R.ix)((null==p?void 0:p.id)===t.benchmarkId?p:null),[x,g]=(0,r.useState)(null),b=(0,r.useCallback)((e,t)=>g({message:e,code:t}),[]),y=(0,er.kl)(x,u);y!==x&&g(y);let v=(0,r.useRef)(u);(0,r.useEffect)(()=>{v.current=u});let w=(0,r.useCallback)(()=>{let e=(0,er.yA)(v.current);return null!=e&&g(e),null!=e},[]),[k,j]=(0,r.useState)(!1),[N,_]=(0,r.useState)(!1),S=null==t||0===t.taskCount?"replace":"append",C=k?"replace":S,A=(0,r.useMemo)(()=>null==t?null:{benchmarkId:t.benchmarkId,writeMode:C},[t,C]),[T,O]=(0,r.useState)(null),U=(0,r.useCallback)(e=>{j(!1),null!=t&&O(null),n(e)},[n,t]),P=(0,B.K)({orgSlug:m,onNormalizeStarted:U,inferTaskType:!0,target:A,onRefused:b}),F=(0,J.Qv)(),[D,q]=(0,r.useState)(!1),[M,W]=(0,r.useState)(null),[$,G]=(0,r.useState)(null),H=(0,r.useRef)(S),Y=(0,r.useRef)(null),Q=!s||P.isPreparing||D,ee=Q||i,{changeSource:et,importCheckedFile:en}=P,el=(0,r.useCallback)(e=>{let{file:n,kind:l,writeMode:a}=e;w()||(W(null),en(n,l,null==t?void 0:a))},[w,en,t]),ea=(0,r.useCallback)(async(e,t)=>{var n;if(W(null),w())return;if(!h.uploadsEnabled)return void b(es.E,null);let[l]=e;if(1===e.length&&null!=l&&l.name.toLowerCase().endsWith(".zip")){q(!0),g(null);let e=await (0,V.o_)(l,d);q(!1),null==e?b("".concat(l.name," isn’t a bundle from your coding agent. Import a task sheet."),null):(F("coding_agent","coding-agent"),G(e));return}F("file","upload"),q(!0),g(null);let a=await Z(e);q(!1),a.ok?"traces"===a.kind?W({file:a.file,reason:null!=(n=a.kindReason)?n:"",writeMode:t}):el({file:a.file,kind:"tasks",writeMode:t}
1):b(a.reason,null)},[d,F,h.uploadsEnabled,w,el,b]);!function(e,t){let n,l,s,i=(0,a.c)(5),o=(0,r.useRef)(e);i[0]!==e?(n=()=>{o.current=e},i[0]=e,i[1]=n):n=i[1],(0,r.useEffect)(n),i[2]!==t?(l=()=>{if(!t)return;let e=eu,n=t=>{e(t)&&t.preventDefault()},l=t=>{var n,l;e(t)&&(t.preventDefault(),o.current(Array.from(null!=(l=null==(n=t.dataTransfer)?void 0:n.files)?l:[])))};return window.addEventListener("dragover",n),window.addEventListener("drop",l),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",l)}},s=[t],i[2]=t,i[3]=l,i[4]=s):(l=i[3],s=i[4]),(0,r.useEffect)(l,s)}(e=>ea(e,S),!ee&&null==T);let eo=()=>{O(null),j(!1)},em=()=>{(0,I.yV)(T)&&et(null)},ep=(0,z.B8)("huggingface"===T),eh=null==t?"":"".concat(t.taskCount.toLocaleString("en-US")," ").concat(1===t.taskCount?"task":"tasks"),ef=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(L.P,{orgSlug:m,busy:Q,locked:i,open:N,onOpenChange:e=>{e&&j(!1),_(e)},note:k&&null!=t?"Replaces this draft's ".concat(eh,", and rows you typed or edited."):null,onUpload:()=>{var e;w()||(g(null),H.current=C,null==(e=Y.current)||e.click())},onStoredSource:e=>{w()||(g(null),et(e),O(e))}}),(0,l.jsx)("input",{ref:Y,type:"file",accept:X,className:"hidden",onChange:e=>{var t;let n=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",n.length>0&&ea(n,H.current)}})]}),ex=()=>{g(null),j(!0),_(!0)},eg=s&&!i&&null!=t,eb=null!=x&&(0,l.jsxs)("p",{role:"alert",className:"max-w-md text-xs text-amber-700",children:[x.message,x.code===ei&&eg&&(0,l.jsx)(ec,{onClick:ex})]});return{menu:ef,problemLine:eb,notices:null!=M&&(0,l.jsx)(ed,{traceType:f,fileName:M.file.name,reason:M.reason,onTraces:()=>el({file:M.file,kind:"traces",writeMode:M.writeMode}),onTasks:()=>el({file:M.file,kind:"tasks",writeMode:M.writeMode})}),dialogs:(0,l.jsxs)(l.Fragment,{children:[ep.present&&(0,l.jsx)(E,{orgSlug:m,imports:P,traceType:f,open:"huggingface"===T,onClose:eo,onExitComplete:()=>{ep.onExitComplete(),em()}}),(0,l.jsx)(K,{orgSlug:m,imports:P,traceType:f,platform:null!=T&&"huggingface"!==T?T:null,onClose:eo,onExitComplete:em})]}),preparing:P.isPreparing,replaceSource:eg?ex:void 0,bundle:$,dismissBundle:()=>G(null),pickFile:()=>{var e;g(null),H.current=C,null==(e=Y.current)||e.click()}}}function ec(e){let t,n=(0,a.c)(2),{onClick:r}=e;return n[0]!==r?(t=(0,l.jsx)("button",{type:"button",className:"ml-1.5 font-medium text-amber-900 underline underline-offset-2 hover:text-amber-950",onClick:r,children:"Replace instead"}),n[0]=r,n[1]=t):t=n[1],t}function eu(e){var t,n;return null!=(n=null==(t=e.dataTransfer)?void 0:t.types.includes("Files"))&&n}function ed(e){let t,n,r,o,c,u,d,m=(0,a.c)(21),{traceType:p,fileName:f,reason:x,onTraces:g,onTasks:b}=e,y=(0,A.R)(!0);m[0]!==y.read||m[1]!==p?(t=(0,R.NS)(y.read,{stage:"trace-import",ownerType:p}),m[0]=y.read,m[1]=p,m[2]=t):t=m[2];let v=t,w=x?": ".concat(x):"";m[3]!==f||m[4]!==w?(n=(0,l.jsxs)("p",{className:"text-[13px] text-amber-900",children:[f," looks like a trace export",w,"."]}),m[3]=f,m[4]=w,m[5]=n):n=m[5],m[6]!==v||m[7]!==y.retry?(r=null!=v&&(0,l.jsx)(h.X,{consent:v,onRetry:y.retry}),m[6]=v,m[7]=y.retry,m[8]=r):r=m[8],m[9]!==n||m[10]!==r?(o=(0,l.jsxs)("div",{className:"grid min-w-0 flex-1 gap-1.5",children:[n,r]}),m[9]=n,m[10]=r,m[11]=o):o=m[11];let k=null!=v&&"known"!==v.amount;return m[12]!==g||m[13]!==k?(c=(0,l.jsx)(s.$n,{variant:"primary",size:"sm",onClick:g,disabled:k,children:"Import as traces"}),m[12]=g,m[13]=k,m[14]=c):c=m[14],m[15]!==b?(u=(0,l.jsx)(i.$,{size:"sm",variant:"outlineSecondary",onClick:b,children:"Import as tasks anyway"}),m[15]=b,m[16]=u):u=m[16],m[17]!==o||m[18]!==c||m[19]!==u?(d=(0,l.jsxs)("div",{role:"alert",className:"flex flex-wrap items-center gap-3 rounded-lg border border-amber-200 bg-amber-50 px-3.5 py-2.5",children:[o,c,u]}),m[17]=o,m[18]=c,m[19]=u,m[20]=d):d=m[20],d}}}]);
2//# chunkId=01a0fa55-4241-7a22-9b44-743345807193

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.