PageSourceSearch

https://artificialanalysis.ai/_next/static/chunks/38581-638267fcbb012617.js

js artificialanalysis.ai collected 2026-10-02 02:15:30 UTC 154,592 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-41e5-7942-934d-20deaea9f2b1")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[38581],{67:(e,t,n)=>{n.d(t,{BQ:()=>p,C9:()=>m,FB:()=>u,GM:()=>c,M$:()=>s,Nd:()=>o,QC:()=>d,SL:()=>f,XH:()=>g,ve:()=>h,wR:()=>a});var l=n(63806),r=n(59838),i=n(97774);function s(e){return[e.prompt,e.title,e.system_prompt,e.user_persona].every(e=>null==e||""===e.trim())&&0===e.expected_deliverables.length&&0===e.reference_filenames.length&&null==e.rubric&&(""===e.category.trim()||e.category.trim()===l.Fj)}function a(e,t){let{here:n,open:l,busy:r}=t;return null!=e&&s(e)?n||l||r?"wait":"drop":"keep"}function u(e){var t;if(!("answer"in e))return e;let{answer:n,...l}=e,i=null!=(t=null==n?void 0:n.trim())?t:"";return{...l,rubric:i?(0,r.Zh)(i):null}}function o(e,t,n){var l,i,s,a,u,o;if("answer"in n){let t=null!=(s=null==(l=n.answer)?void 0:l.trim())?s:"";return""===t?(null!=(a=null==(i=e.rubric)?void 0:i.dimensions.length)?a:0)===0:(0,r.ut)(e)===t}return JSON.stringify(null!=(u=e[t])?u:null)===JSON.stringify(null!=(o=n[t])?o:null)}function d(e,t){let n=u(t),l=(0,i.Jv)({...e,...n},Object.keys(n));return"answer"in t&&null!=n.rubric?{...l,origins:{...l.origins,rubric:"answer"}}:l}function c(){let e=crypto.getRandomValues(new Uint8Array(5));return"task_".concat(Array.from(e,e=>e.toString(16).padStart(2,"0")).join(""))}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c();return{op:"insert",after:e,task:t,id_aa:n}}function f(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c();return{op:"insert",after:null,at:"end",task:e,id_aa:t}}function p(e,t){let n=e=>e.normalize("NFC")===t.normalize("NFC");return e.reference_filenames.some(n)?{...e,reference_filenames:e.reference_filenames.filter(e=>!n(e)),...null!=e.missing_files&&{missing_files:e.missing_files.filter(e=>!n(e))}}:e}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["rubric"],n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return{op:"review",ids:e.map(e=>e.id_aa),fields:t,on:n,revs:Object.fromEntries(e.map(e=>{var t;return[e.id_aa,null!=(t=e.rev)?t:""]}))}}let v={prompt:"",title:null,category:"general",system_prompt:null,user_persona:null,expected_deliverables:[],reference_filenames:[],rubric:null,flags:[]};function g(e,t,n){let l=[...e],r=null,s=e=>{var t;if(null==r)for(let[e,t]of(r=new Map,l.entries()))null==t||r.has(t.id_aa)||r.set(t.id_aa,e);return null!=(t=r.get(e))?t:-1},a=[],o=[],c=(e,t)=>{let n=s(e),r=l[n];null!=r&&(l[n]=t(r))},h=e=>{let t=s(e);t<0||(l[t]=null,null==r||r.delete(e))},f=(e,t)=>{let{after:n,at:i}=t,a="end"===i?l.length:null==n?0:s(n)+1;l.splice(a,0,e),a===l.length-1?null==r||r.set(e.id_aa,a):r=null},m=(e,t)=>{let{id_aa:n,rev:r}=t,a={rev:null!=r?r:void 0};if("set"===e.op)c(e.id_aa,t=>({...d(t,e.fields),...a}));else if("insert"===e.op&&null!=n){if(s(n)>=0)return;f({...v,...u(e.task),id_aa:n,origins:{"*":"user"},...a},e)}else if("delete"===e.op)h(e.id_aa);else if("move"===e.op&&e.after!==e.id_aa){let t=l[s(e.id_aa)];if(!t)return;h(e.id_aa),f(t,e)}else"review"===e.op&&null!=n?c(n,t=>(0,i.bT)(t,e.fields,e.on)):"detach"===e.op&&c(e.id_aa,t=>({...p(t,e.filename),...a}))},g=Map.groupBy(n.results,e=>e.i);for(let[e,l]of(t.forEach((e,t)=>{var l;for(let r of null!=(l=g.get(t))?l:[]){if("applied"===r.status){m(e,r);continue}"not_found"===r.status&&r.id_aa&&h(r.id_aa);let t=null==r.id_aa?void 0:n.conflicts[r.id_aa];"insert"===e.op&&t&&0>s(t.id_aa)&&f(t,e);let l="conflict"===r.status?a:o;l.includes(e)||l.push(e)}}),Object.entries(n.conflicts)))c(e,()=>l);for(let[e,t]of Object.entries(n.meta))c(e,e=>{var n;return{...e,...t,rev:null!=(n=t.rev)?n:void 0}});return{tasks:l.filter(e=>null!=e),conflicts:a,notFound:o}}},8734:(e,t,n)=>{n.d(t,{R:()=>a});var l=n(36772),r=n(98148),i=n(65403),s=n(59514);function a(e){let t,n,a,u,o=(0,l.c)(10),{orgSlug:d,billingEnabled:c}=(0,i.t$)();o[0]===Symbol.for("react.memo_cache_sentinel")?(t={revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1},o[0]=t):t=o[0];let{data:h,error:f,mutate:p}=(0,r.Ay)(c&&e?"".concat((0,s.Gn)(d),"/build-agent/holds"):null,s.m9,t);o[1]!==c||o[2]!==h||o[3]!==f?(n=c?null!=h?{status:"read",holds:h}:null!=f?{status:"failed"}:{status:"loading"}:{status:"off"},o[1]=c,o[2]=h,o[3]=f,o[4]=n):n=o[4];let m=n;return o[5]!==p?(a=()=>void p(),o[5]=p,o[6]=a):a=o[6],o[7]!==m||o[8]!==a?(u={read:m,retry:a},o[7]=m,o[8]=a,o[9]=u):u=o[9],u}}
1,17123:(e,t,n)=>{n.d(t,{HD:()=>r,PP:()=>s,dc:()=>i});let l=/google-sheets-html-origin|urn:schemas-microsoft-com:office:excel|content="LibreOffice/i;function r(e){let t=e.replace(/\r\n?/g,"\n").replace(/\n$/,""),n=[[]],l=0;for(;;){var r,i;let e=t.startsWith('"',l)?function(e,t){let n="",l=t+1;for(;;){let t=e.indexOf('"',l);if(t<0)return null;if(n+=e.slice(l,t),'"'===e[t+1]){n+='"',l=t+2;continue}let r=t+1;return r===e.length||"	"===e[r]||"\n"===e[r]?{text:n,end:r}:null}}(t,l):null,s=null!=(r=null==e?void 0:e.end)?r:function(e,t){for(let n=t;n<e.length;n+=1)if("	"===e[n]||"\n"===e[n])return n;return e.length}(t,l);if(n.at(-1).push(null!=(i=null==e?void 0:e.text)?i:t.slice(l,s)),s>=t.length)return n;"\n"===t[s]&&n.push([]),l=s+1}}function i(e,t){var n,r;return!!/<table[\s>]/i.test(e)&&(!!l.test(e)||(null!=(r=null==(n=e.match(/<tr[\s>]/gi))?void 0:n.length)?r:0)===t)}function s(e,t){var n,i,s,a;let u=r(e);if(u.length<2&&(null!=(s=null==(n=u[0])?void 0:n.length)?s:0)<2)return!1;let o=null!=(a=null==(i=t.match(/<tr[\s>]/gi))?void 0:i.length)?a:0;return/<table[\s>]/i.test(t)&&l.test(t)&&o===u.length}},23312:(e,t,n)=>{n.d(t,{Fm:()=>m,Sy:()=>g,pV:()=>f});var l=n(36772),r=n(96040),i=n(59514),s=n(97774),a=n(60568),u=n(63806),o=n(23496),d=n(67),c=n(68312),h=n(64047);let f=5e3,p=[1e3,2e3,5e3,1e4,3e4];function m(e,t,n){let i,s=(0,l.c)(4),a=void 0===n?Object.is:n,u=(0,r.useRef)(null);s[0]!==e||s[1]!==a||s[2]!==t?(i=()=>{let n=e.view(),l=u.current;if((null==l?void 0:l.view)===n&&l.select===t)return l.value;let r=t(n),i=null!=l&&a(l.value,r)?l.value:r;return u.current={view:n,select:t,value:i},i},s[0]=e,s[1]=a,s[2]=t,s[3]=i):i=s[3];let o=i;return(0,r.useSyncExternalStore)(e.subscribe,o,o)}let v=new WeakMap;function g(e){let t,n,i,s,a,u,o,d,c,f,p=(0,l.c)(35),{orgSlug:m,benchmarkId:g,createDraft:w,version:x,taskCount:b,completeness:y,readOnly:_,tasks:j,wholeOnly:N,runWrite:E,onWritten:R,carried:O,dropBlankRows:D}=e,M=void 0!==N&&N,T=void 0!==D&&D;p[0]!==g||p[1]!==O||p[2]!==y||p[3]!==m||p[4]!==b||p[5]!==j||p[6]!==x||p[7]!==M?(t=()=>{var e;return null!=(e=null==O?void 0:v.get(O))?e:new k({readPage:M?null:(e,t,n)=>S(m,e,t,n),sendOps:(e,t,n)=>C(m,e,t,n)},(0,h.Xx)(x,b,j),y,g)},p[0]=g,p[1]=O,p[2]=y,p[3]=m,p[4]=b,p[5]=j,p[6]=x,p[7]=M,p[8]=t):t=p[8];let[A]=(0,r.useState)(t);return p[9]!==w||p[10]!==T||p[11]!==R||p[12]!==_||p[13]!==E||p[14]!==A?(n=()=>{A.configure({readOnly:_,createDraft:w,runWrite:E,onWritten:R,dropBlankRows:T})},i=[A,_,w,E,R,T],p[9]=w,p[10]=T,p[11]=R,p[12]=_,p[13]=E,p[14]=A,p[15]=n,p[16]=i):(n=p[15],i=p[16]),(0,r.useEffect)(n,i),p[17]!==A||p[18]!==b||p[19]!==j||p[20]!==x?(s=()=>A.observe(x,b,j),a=[A,x,b,j],p[17]=A,p[18]=b,p[19]=j,p[20]=x,p[21]=s,p[22]=a):(s=p[21],a=p[22]),(0,r.useLayoutEffect)(s,a),p[23]!==A?(u=()=>A.attach(),o=[A],p[23]=A,p[24]=u,p[25]=o):(u=p[24],o=p[25]),(0,r.useEffect)(u,o),p[26]!==_||p[27]!==A?(d=()=>A.view(_),p[26]=_,p[27]=A,p[28]=d):d=p[28],p[29]!==A?(c=(e,t,n)=>A.observe(e,t,n),p[29]=A,p[30]=c):c=p[30],p[31]!==A||p[32]!==d||p[33]!==c?(f={subscribe:A.subscribe,view:d,viewRange:A.viewRange,edit:A.edit,commit:A.commit,confirm:A.confirm,keepHeld:A.keepHeld,dropHeld:A.dropHeld,dropInvalid:A.dropInvalid,accept:A.accept,acceptPending:A.acceptPending,dismissDropped:A.dismissDropped,setLocked:A.setLocked,revert:A.revert,leave:A.leave,abandon:A.abandon,addRow:A.addRow,removeRow:A.removeRow,holdRow:A.holdRow,holdRows:A.holdRows,holdFile:A.holdFile,keepFiles:A.keepFiles,restoreRows:A.restoreRows,sheet:A.sheet,nextUndo:A.nextUndo,nextRedo:A.nextRedo,lastChange:A.lastChange,retry:A.retry,drain:A.drain,ownWrite:A.ownWrite,observe:c,onLeftBlank:A.onLeftBlank,blankRows:A.blankRows,dropsBlank:A.dropsBlank},v.set(f,A),p[31]=A,p[32]=d,p[33]=c,p[34]=f):f=p[34],f}function w(e,t){return t.startsWith(c.a7)?e.get(t):t}function x(e,t){var n,l,r,i,s;let{keys:a,sending:u,queue:o,blank:d}=e;return t.startsWith(c.a7)?null!=(s=null!=(i=null!=(r=a.get(t))?r:null==(n=(0,c.ns)(u,t))?void 0:n.idAa)?i:null==(l=(0,c.ns)(o,t))?void 0:l.idAa)?s:t===d.key?d.idAa:t:t}function b(e){return!!Number.isFinite(e.due)&&("set"!==e.kind||!e.held)&&!("invalid"in e&&null!=e.invalid)}function y(e){let{id:t,name:n}=e;return{kind:"detach",id:t,name:n,due:1/0}}class k{configure(e){let t=this.config.readOnly&&!e.readOnly;!this.config.readOnly&&e.readOnly&&this.update({queue:(0,c.XA)(this.state.queue)}),this.config=e,t&&this.schedule()}attach(){let e=()=>this.sendEverything(!0),t=e=>{this.unsettled()&&(e.preventDefault(),e.returnValue=!0)};return window.addEventListener("pagehide",e),window.addEventListener("beforeunload",t),this.attached+=1,this.detached=!1,()=>{window.removeEventListener("pagehide",e),window.removeEventListener("beforeunload",t),this.attached-=1,queueMicrotask(()=>{this.attached>0||(this.detached=!0,null!=this.state.draftId?this.resume():this.stopRetrying(),this.sendEverything(!1))})}}settleClashes(e,t){for(let l of this.state.queue){var n;let r="set"===l.kind&&l.held&&!e.includes(l)?this.clashes.get("".concat(l.field,"\0").concat(l.id)):void 0;null!=r&&"set"===l.kind&&this.carry(new Map([[l.id,{from:r,to:null!=(n=l.baseRev)?n:r}]]),l.field,t)}}sendBack(e,t,n,l){null!=l&&this.update({queue:(0,c.lC)(this.state.queue,e,t)}),this.replaying=!0,this.edit(e,n,l),this.commit(e),this.replaying=!1}blankWith(e,t){let n=this.shownRow(e);if(null==n)return!1;let l={prompt:n.prompt,category:n.category,...(0,u.Or)(n,"rubric")};return(0,c.OQ)({...(0,c.LK)(l,t),...t})}holdInPlace(e,t){var n,l;let r=this.view(!1),i=null!=(l=null==(n=r.rows[r.keys.indexOf(this.rowKey(e))-1])?void 0:n.id_aa)?l:null;return this.sessions.delete(this.rowKey(e)),this.holdRows([e],i,t).length>0}keptText(e){let t=this.rowKey(e),n=this.sessions.get(t);if(null!=n&&void 0===n.created)return!0;let l=new Set([e,t]);return this.undoStack.some(e=>
1"cells"===e.kind&&(e.cells.some(e=>l.has(e.id))||e.added.some(e=>l.has(e.key))))}write(e){this.blocked=!1,this.update({queue:e}),this.schedule()}record(e){this.undoStack=(0,o.T)(this.undoStack,{...e,seq:this.changes+=1}),this.redoStack=[]}rowKey(e){return x(this.state,e)}shownRow(e){var t;let n=this.view(!1);return null!=(t=n.rows[n.keys.indexOf(this.rowKey(e))])?t:null}openSession(e,t,n){let l=this.rowKey(e),r=this.sessions.get(l);if(null==r){let t=(0,c.ns)(this.state.queue,e),i=null!=t&&!Number.isFinite(t.due)&&(0,c.OQ)(t.fields),s=e===this.state.blank.key?c.Im:i?t.after:void 0;r={id:e,cells:new Map,queued:new Set,sent:new Set,created:s,rev:void 0===s?n:void 0},this.sessions.set(l,r)}if(void 0!==r.created)return;let i=this.shownRow(e);for(let e of Object.keys(t)){let t="answer"===e?"rubric":e;if(null==i||r.cells.has(t))continue;r.cells.set(t,(0,u.Or)(i,t));let n=e=>"set"===e.kind&&e.field===t&&this.rowKey(e.id)===l;this.state.queue.some(n)&&r.queued.add(t)}}closeSession(e){let t=this.rowKey(e),n=this.sessions.get(t);if(null==n)return!1;this.sessions.delete(t);let l=this.shownRow(n.id);if(null==l)return!1;let{rev:r}=n;if(void 0!==n.created){if(this.dropsBlank()&&(0,d.M$)(l))return!0;let e={prompt:l.prompt,category:l.category,...(0,u.Or)(l,"rubric")};return this.record({kind:"cells",cells:[],added:[{key:n.id,after:n.created,fields:e,rev:r}]}),!0}let i=[...n.cells].flatMap(e=>{let[t,i]=e,s=(0,u.Or)(l,t);return JSON.stringify(s)===JSON.stringify(i)?[]:[{id:n.id,field:t,before:i,after:s,rev:r}]});return i.length>0&&this.record({kind:"cells",cells:i,added:[]}),i.length>0}landing(){let e=e=>w(this.state.keys,e),t=new Map;for(let r of this.state.sending){var n,l;if("set"!==r.kind)continue;let i=null!=(n=e(r.id))?n:r.id;t.set(i,[...null!=(l=t.get(i))?l:[],r])}return n=>{var l;let r=e(n),i=null==r?void 0:this.taskOf(r);if(null!=i&&this.state.rows.stale.has(i))return;let s=null==r?void 0:t.get(r);return null==i||null==s?i:null!=(l=(0,c.Zs)([i],s,()=>i.id_aa)[0])?l:i}}startHold(){this.record({kind:"delete"}),null!=this.holdTimer&&clearTimeout(this.holdTimer),this.holdTimer=setTimeout(()=>this.releaseHolds(),f)}isHeld(e){return this.state.holds.length>0&&(0,c.OU)(this.state.holds,e=>w(this.state.keys,e)).has(e)}endHold(){null!=this.holdTimer&&clearTimeout(this.holdTimer),this.holdTimer=null,this.undoStack=this.undoStack.filter(e=>"delete"!==e.kind)}releaseHolds(){this.endHold();let{holds:e,fileHolds:t}=this.state;if(0===e.length&&0===t.length)return;let n=Date.now();this.update({queue:(0,c.NS)((0,c.Du)(this.state.queue,t,n),this.stillDue(e),n),holds:[],fileHolds:[]}),this.schedule()}stillDue(e){if(!e.some(e=>e.auto))return e;let t=this.dropsBlank(),n=e=>w(this.state.keys,e),l=(0,c.Zs)(this.state.rows.rows,[...this.state.sending,...this.state.queue],n);return e.filter(e=>{var r;if(!e.auto)return!0;if(!t)return!1;let i=null!=(r=n(e.id))?r:e.id,s=l.find(e=>null!=e&&e.id_aa===i);return null!=s&&(0,d.M$)(s)})}adopt(e,t,n,l){let r=e.id_aa,i=e=>{var t;return(null!=(t=w(this.state.keys,e))?t:e)===r},s=this.state.queue.map(e=>("set"===e.kind||"delete"===e.kind)&&e.baseRev===t&&i(e.id)?{...e,baseRev:n}:e),a=this.state.holds.flatMap(e=>i(e.id)?e.auto?[]:[e.rev===t?{...e,rev:n}:e]:[e]),u=this.state.rows.rows.map(t=>(null==t?void 0:t.id_aa)===r?e:t);this.lastSeen.set(r,e),this.pass(l),this.carry(new Map([[r,{from:t,to:n}]])),this.update({queue:s,holds:a,rows:{...this.state.rows,rows:u}})}observe(e,t,n){this.passed.has(e)||(this.observed={version:e,count:t,tasks:n},this.applyObserved())}applyObserved(){let e=this.observed;if(null==e||this.state.sending.length>0)return;if(this.observed=null,null==this.io.readPage){let t=(0,h.Xx)(e.version,e.count,e.tasks);(0,h.ev)(t,this.state.rows)||this.update({rows:t});return}if(e.version===this.state.rows.version)return;let t=this.range&&{from:this.range.from-60,to:this.range.to+60},n=(0,h.ip)(this.state.rows,e.version,e.count);this.update({rows:(0,h.DA)(n,e.tasks,t)}),this.read()}read(){let{readPage:e}=this.io,t=this.state.draftId;if(null==e||null==t||null==this.range||null!=this.reading||this.state.sending.length>0)return;let n=this.tailDue?(0,h.RV)(this.state.rows):null;this.tailDue=null!=n;let l=null!=n?n:(0,h.C3)(this.state.rows,this.range.from-60,this.range.to+60,null);if(null==l)return;this.reading=l;let r=this.writes;e(t,l.offset,l.limit).then(e=>{this.reading=null;let t=r===this.writes&&0===this.state.sending.length&&(0,h.OY)(this.state.rows,e);if(t){for(let t of e.tasks)this.lastSeen.set(t.id_aa,t);this.update({rows:t})}this.read()},()=>{this.reading=null,setTimeout(()=>this.read(),3e3)})}schedule(){if(null!=this.timer&&clearTimeout(this.timer),this.timer=null,this.state.sending.length>0||this.blocked)return;let e=e=>w(this.state.keys,e),t=(0,c.m3)(this.state.queue,(0,c.OU)(this.state.holds,e),e);null!=t?this.timer=setTimeout(()=>void this.flush(!1),Math.max(0,t-Date.now())):this.clearIdleFailure()}clearIdleFailure(){null==this.state.failure||this.state.queue.some(b)||this.update({failure:null})}sendEverything(e){e&&null!=this.state.draftId&&this.resume();let t=Date.now(),{holds:n,fileHolds:l}=this.state;if(e&&this.state.sending.length>0&&n.length+l.length>0&&null!=this.state.draftId){let e=(0,c.NS)((0,c.Du)(this.state.queue,l,t),this.stillDue(n),t),r=_(e.filter(e=>
1("delete"===e.kind||"detach"===e.kind)&&!this.state.queue.includes(e)),e=>(0,c.Sp)(e,t,e=>w(this.state.keys,e)));null!=this.holdTimer&&clearTimeout(this.holdTimer),this.holdTimer=null,this.update({holds:[],fileHolds:[],queue:e.filter(e=>!r.edits.includes(e))}),r.ops.length>0&&this.io.sendOps(this.state.draftId,r.ops,!0).catch(()=>void 0)}this.releaseHolds();let r=(0,c.XA)(this.state.queue);this.update({queue:r.map(e=>Number.isFinite(e.due)?{...e,due:t}:e)}),this.flush(e)}async flush(e){var t,n,l,r,s,a;if(this.timer=null,this.state.sending.length>0||this.blocked||this.config.readOnly||e&&null==this.state.draftId)return;let u=Date.now(),o=e=>w(this.state.keys,e),d=(0,c.OU)(this.state.holds,o),h=e=>(0,c.Sp)(e,u,o,d),f=e?_(this.state.queue,h):h(this.state.queue);if(0===f.ops.length){f.rest.length!==this.state.queue.length&&this.update({queue:f.rest}),this.clearIdleFailure();let e=(0,c.m3)(f.rest.filter(e=>e.due>u),d,o);null!=e&&(this.timer=setTimeout(()=>void this.flush(!1),e-u));return}if(this.writes+=1,this.update({queue:f.rest,sending:f.edits,failure:null}),this.sessions.size>0)for(let e of f.edits)"set"===e.kind&&(null==(t=this.sessions.get(this.rowKey(e.id)))||t.sent.add(e.field));let p=async()=>{var t;return this.io.sendOps(null!=(t=this.state.draftId)?t:await this.createDraft(),f.ops,e)},m=!1;try{let e=await (null!=(r=null==(n=(l=this.config).runWrite)?void 0:n.call(l,p))?r:p());m=!0,this.settle(f,e),this.stopRetrying()}catch(l){let e=l instanceof N?(0,c.gs)(f,l.refused,this.state.queue):null;if(null!=e){this.stopRetrying(),this.takenBack=new Set,this.update({queue:e.queue,sending:[],failure:null,lost:[...this.state.lost,...e.lost]}),this.applyObserved(),this.read(),this.schedule();return}this.blocked=!0;let t=this.takenBack,n=e=>"set"===e.kind&&t.has("".concat(e.field,"\0").concat(this.rowKey(e.id)));this.update({queue:(0,c.hr)(this.state.sending,this.state.queue,n),sending:[],failure:l instanceof Error?l.message:"Unexpected error"}),!m&&((s=l)instanceof TypeError||(null!=(a=(0,i.LL)(s))?a:0)>=500)&&null!=this.state.draftId&&!this.detached?this.retryLater():this.stopRetrying()}this.takenBack=new Set,this.applyObserved(),this.read(),this.schedule()}retryLater(){null!=this.retryTimer&&clearTimeout(this.retryTimer);let e=p[Math.min(this.retries,p.length-1)];this.retries+=1,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.blocked=!1,this.schedule()},e)}stopRetrying(){null!=this.retryTimer&&clearTimeout(this.retryTimer),this.retryTimer=null,this.retries=0}resume(){this.stopRetrying(),this.blocked=!1}settle(e,t){var n,l,r;let i=(0,c.E1)(e.ops,t.results,this.revsAt(t.base_updated_at));for(let e of(this.observed=null,[this.state.rows.version,t.base_updated_at]))e!==t.updated_at&&this.pass(e);let{state:s,external:a}=(0,h.xo)(this.state.rows,e.ops,t);a&&e.ops.some(e=>"insert"===e.op&&"end"===e.at)&&(this.tailDue=!0);let u=(0,c.mr)(e,t.results,Date.now()),o=new Map([...this.state.keys,...u.minted]);for(let{id_aa:e}of t.results){let n=null==e?void 0:null!=(r=t.conflicts[e])?r:this.indexOf(s).get(e);null!=n&&this.lastSeen.set(n.id_aa,n)}let{queue:d,dropped:f}=(0,c.pL)(e,t,[...this.state.queue,...u.unplaced],e=>w(o,e));this.carryRevs(e,t),this.carry(i);let p=e=>w(o,e),m=(0,c.Sc)(d,(0,c.Cw)(this.state.holds,e,t.results,p),i,p);this.update({rows:s,keys:o,queue:m.queue,holds:m.holds,sending:[],completeness:t.completeness,failure:null,dropped:this.state.dropped+f}),null==(n=(l=this.config).onWritten)||n.call(l,t,e.ops)}revsAt(e){let t=this.state.rows;if(t.version!==e)return()=>void 0;let n=this.indexOf(t);return e=>{let l=n.get(e);return null==l||t.stale.has(l)?void 0:l.rev}}pass(e){this.passed.add(e),this.passed.size>64&&this.passed.delete(this.passed.values().next().value)}carryRevs(e,t){let n=new Map,l=new Map;for(let{i:r,id_aa:i,rev:s,status:a}of t.results){let t=e.ops[r];(null==t?void 0:t.op)==="set"&&"conflict"===a&&l.set(t.id_aa,t.base_rev),"applied"===a&&null!=i&&null!=s&&null!=t&&("set"===t.op?n.set(i,{from:t.base_rev,to:s}):"insert"===t.op?n.set(i,{from:void 0,to:s}):"review"===t.op&&n.set(i,{from:t.revs[i],to:s}))}for(let t of l.size>
10?[...e.edits,...this.state.queue]:[]){if("set"!==t.kind||t.held)continue;let e=this.rowKey(t.id);l.has(e)&&this.clashes.set("".concat(t.field,"\0").concat(e),l.get(e))}this.carry(n)}carry(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(0!==e.size)for(let[l,r]of(this.revMoves.push([e,t,n,this.changes]),this.sessions)){let i=e.get(l);null!=i&&n?r.cells.delete(t):null!=i&&i.from===r.rev&&(r.rev=i.to)}}async createDraft(){if(null==this.config.createDraft)throw Error("There is no draft to write to.");let e=await this.config.createDraft();return this.update({draftId:e}),e}revOf(e){var t;let n=w(this.state.keys,e);return null==n||null==(t=this.taskOf(n))?void 0:t.rev}indexOf(e){var t;if((null==(t=this.indexed)?void 0:t.rows)!==e){let t=new Map;for(let n of e.rows)null!=n&&t.set(n.id_aa,n);this.indexed={rows:e,byId:t}}return this.indexed.byId}nextBlank(){return{key:this.nextKey(),idAa:(0,d.GM)()}}nextKey(){return this.newRows+=1,"".concat(c.a7).concat(this.newRows)}update(e){for(let t of(this.state={...this.state,...e},this.listeners))t();let t=this.settleWaiters;for(let e of(this.settleWaiters=[],t))e()}unsettled(){let{queue:e,sending:t,holds:n,fileHolds:l}=this.state;return t.length>0||n.length>0||l.length>0||e.some(e=>!("set"===e.kind&&e.untilKept&&!e.held)&&!("insert"===e.kind&&!Number.isFinite(e.due)&&null==e.invalid&&(0,c.OQ)(e.fields)))}unsaved(){var e;let{queue:t,sending:n,failure:l}=this.state;if(t.some(e=>"set"===e.kind&&e.held))return{status:"changed",error:null};let r=t.find(e=>"invalid"in e&&null!=e.invalid);return null!=r&&"invalid"in r?{status:"failed",error:null!=(e=r.invali
1d)?e:null}:this.blocked||null!=l?{status:"failed",error:l}:n.length>0||t.some(b)?{status:"failed",error:null}:null}constructor(e,t,n,l){var r=this;this.config={readOnly:!0},this.listeners=new Set,this.timer=null,this.holdTimer=null,this.range=null,this.reading=null,this.writes=0,this.blocked=!1,this.retryTimer=null,this.retries=0,this.observed=null,this.passed=new Set,this.tailDue=!1,this.locked=!1,this.settleWaiters=[],this.attached=0,this.detached=!1,this.newRows=0,this.lastSeen=new Map,this.indexed=null,this.shown=null,this.undoStack=[],this.redoStack=[],this.sessions=new Map,this.replaying=!1,this.changes=0,this.takenBack=new Set,this.clashes=new Map,this.revMoves=[],this.blankListeners=new Set,this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.view=e=>{let t=this.shown;if((null==t?void 0:t.state)===this.state&&t.readOnly===e)return t.view;let n=function(e,t){let n=t=>w(e.keys,t),l=[...e.sending,...e.queue,...e.fileHolds.map(y)],r=(0,c.Zs)(e.rows.rows,l,n),i=(0,c.OU)(e.holds,n),s=0===i.size?r:r.filter(e=>null==e||!i.has(e.id_aa)),a=t?[]:(0,c.Zs)([],(0,c.JU)([],e.blank.key,null,e.blank.idAa),n),u=0===a.length?s:[...s,...a],o=new Set(e.queue.flatMap(e=>"insert"!==e.kind||Number.isFinite(e.due)?[]:[e.key]));return{rows:u,tasks:s.filter(e=>null==e||!o.has(e.id_aa)),keys:u.map((t,n)=>null==t?"position:".concat(n):x(e,t.id_aa)),version:e.rows.version,completeness:e.completeness,saving:e.sending.length>0||e.holds.length>0||e.fileHolds.length>0||e.queue.some(e=>Number.isFinite(e.due)),pending:e.sending.length>0||null==e.failure&&e.queue.some(b),failure:e.failure,dropped:e.dropped,lost:e.lost,draftId:e.draftId,held:new Set(e.queue.flatMap(e=>{var t;return"set"===e.kind&&e.held?["".concat(null!=(t=n(e.id))?t:e.id,":").concat(e.field)]:[]})),invalid:new Map(e.queue.flatMap(e=>{var t,l;if("delete"===e.kind||"review"===e.kind||"detach"===e.kind||null==e.invalid)return[];let r="insert"===e.kind?null!=(t=n(e.key))?t:e.key:null!=(l=n(e.id))?l:e.id;return[["".concat(r,":").concat("insert"===e.kind?"prompt":e.field),e.invalid]]})),resolveId:n,blankKey:t?null:e.blank.key,holding:e.holds.length,heldIds:i,filesHeld:e.fileHolds.length}}(this.state,e);return this.shown={state:this.state,readOnly:e,view:n},n},this.viewRange=(e,t)=>
1{this.range={from:e,to:t},this.read()},this.edit=(e,t,n)=>{if(this.config.readOnly||this.locked)return;let l=null!=n?n:this.revOf(e);this.replaying||this.openSession(e,t,l);let r=e===this.state.blank.key,i=r?(0,c.JU)(this.state.queue,e,c.Im,this.state.blank.idAa):this.state.queue;this.blocked=!1,this.update({queue:(0,c.wT)(i,e,t,Date.now()+c.ah,l),blank:r?this.nextBlank():this.state.blank}),this.schedule()},this.commit=e=>{if(this.update({queue:(0,c.fT)(this.state.queue,e,Date.now())}),this.schedule(),this.replaying||!this.closeSession(e))return;let t=this.blankRows([e]);if(t.length>0)for(let e of this.blankListeners)e(t)},this.onLeftBlank=e=>(this.blankListeners.add(e),()=>void this.blankListeners.delete(e)),this.dropsBlank=()=>!0===this.config.dropBlankRows,this.blankRows=e=>{if(!this.dropsBlank()||this.config.readOnly||this.locked)return[];let t=this.view(!1);return e.flatMap(e=>{let n=this.rowKey(e),l=t.rows[t.keys.indexOf(n)];return null!=l&&n!==t.blankKey&&(0,d.M$)(l)?[n]:[]})},this.confirm=e=>{this.keepHeld(e),this.commit(e)},this.keepHeld=(e,t)=>{let n=(0,c.rU)(this.state.queue,e,Date.now(),t);this.settleClashes(n,!1),this.write(n)},this.dropHeld=(e,t)=>{let n=(0,c.Zj)(this.state.queue,e,t);this.settleClashes(n,!0),this.update({queue:n})},this.dropInvalid=(e,t)=>{this.update({queue:(0,c.ny)(this.state.queue,e,t)})},this.accept=e=>{this.config.readOnly||this.locked||this.write((0,c.YB)(this.state.queue,e,Date.now()))},this.acceptPending=async()=>{if(this.config.readOnly)return{accepted:0};let e=this.view(!1).tasks.filter(e=>null!=e&&(0,s.e7)(e,"rubric"));if(0===e.length)return{accepted:0};let t=this.state.dropped,n=(0,c.YB)(this.state.queue,e,Date.now()),l=n[n.length-1];this.write(n);let r=await this.drain();if(null!=r){var i;let e=e=>"review"===e.kind&&(null==l?void 0:l.kind)==="review"&&e.tasks===l.tasks;return this.state.queue.some(e)&&(this.blocked=!1,this.update({queue:this.state.queue.filter(t=>!e(t)),failure:null})),{refused:null!=(i=r.error)?i:"The agent's scoring couldn't be accepted."}}if(this.state.dropped>t){let t=new Set(e.map(e=>e.id_aa)),n=this.view(!1).tasks.filter(e=>{var n;return null!=e&&t.has(e.id_aa)&&(null==(n=e.reviewed)?void 0:n.includes("rubric"))===!0}).length;return{refused:(0,a.MG)(n,e.length)}}return{accepted:e.length}},this.setLocked=e=>{let t=e&&!this.locked;this.locked=e,t&&this.sendEverything(!1)},this.dismissDropped=()=>{this.update({dropped:0,lost:[]})},this.revert=(e,t,n)=>{let l=this.rowKey(e),r=this.sessions.get(l),i=(null==r?void 0:r.cells.delete(t))===!0,s=(null==r?void 0:r.created)!==void 0,{rev:a,queued:u,sent:o}=null!=r?r:{};(null==r?void 0:r.cells.size)!==0||s||this.sessions.delete(l);let d=e=>"set"===e.kind&&e.field===t&&this.rowKey(e.id)===l,h=this.state.sending.some(d);h&&this.takenBack.add("".concat(t,"\0").concat(l));let f=(0,c.NX)(this.state.queue,e,t,n,this.landing()(e));"remove"===f.kind?this.removeRow(e,null):"queue"===f.kind?(this.settleClashes(f.queue,!0),this.update({queue:f.queue})):s&&this.blankWith(e,n)?this.holdInPlace(e,a):s||(null==o?void 0:o.has(t))===!0||h?this.sendBack(e,t,n,a):i&&(null==u?void 0:u.has(t))!==!0?this.update({queue:(0,c.lC)(this.state.queue,e,t)}):i&&this.sendBack(e,t,n,void 0)},this.leave=e=>{let t=(0,c.ns)(this.state.queue,e);if(null==t||!(0,c.OQ)(t.fields))return this.commit(e),!1;if(!this.keptText(e))return this.removeRow(e,null),!1;let n=this.sessions.get(this.rowKey(e));if(null!=n&&void 0===n.created&&n.cells.size>0){let l=Object.assign({},...n.cells.values());this.update({queue:(0,c.wT)(this.state.queue,e,l,t.due)})}return this.holdInPlace(e)},this.abandon=e=>(this.update({queue:(0,c.XA)(this.state.queue,e)}),this.leave(e)),this.addRow=e=>{let t=this.nextKey();return this.update({queue:(0,c.JU)(this.state.queue,t,e)}),t},this.nextUndo=()=>{var e,t;return this.config.readOnly||this.locked?null:null!=(t=null==(e=this.undoStack.at(-1))?void 0:e.kind)?t:null},this.nextRedo=()=>{var e;return this.config.readOnly||this.locked||(null==(e=this.redoStack.at(-1))?void 0:e.kind)!=="cells"?null:"cells"},this.lastChange=()=>{var e,t;return null!=(t=null==(e=this.undoStack.at(-1))?void 0:e.seq)?t:null},this.sheet=()=>({state:this.state,view:this.view(!1),rowKey:e=>this.rowKey(e),revOf:e=>this.revOf(e),landing:this.landing(),nextKey:()=>this.nextKey(),takesEdits:!this.config.readOnly&&!this.locked,stacks:()=>[this.undoStack,this.redoStack],setStacks:(e,t)=>{this.undoStack=e,this.redoStack=t},moves:this.revMoves,write:e=>this.write(e),record:e=>this.record(e)}),this.removeRow=(e,t)=>{this.config.readOnly||this.locked||this.isHeld(e)||(this.sessions.delete(this.rowKey(e)),this.update({queue:(0,c.jG)(this.state.queue,e,Date.now(),t,this.revOf(e))}),this.schedule())},this.holdRow=(e,t)=>this.holdRows([e],t).length>0,this.holdRows=function(e,t,n){let l=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(r.config.readOnly||r.locked)return[];let i=e=>w(r.state.keys,e),s=(0,c.OU)(r.state.holds,i),a=[...r.state.holds],u=r.state.queue,o=[];for(let d of e){if(d===r.state.blank.key)continue;let e=(0,c.ns)(u,d);if(!l&&null!=e&&(0,c.OQ)(e.fields)&&!r.keptText(d)){r.sessions.delete(r.rowKey(d)),u=(0,c.jG)(u,d,Date.now(),t);continue}if(o.push(d),s.has(d))continue;s.add(d);let h=r.state.sending.some(e=>{var t;return(0,c.Ee)(e,new Set([d,null!=(t=i(d))?t:d]),i)});a.push({id:d,before:t,rev:h?void 0:null!=n?n:r.revOf(d),...l&&{auto:!0}})}let d=a.length>r.state.holds.length;return(d||u!==r.state.queue)&&(r.update({queue:u,holds:a}),r.schedule(),d&&r.startHold()),o},this.holdFile=(e,t)=>
1!(this.config.readOnly||this.locked||this.state.fileHolds.some(n=>n.id===e&&n.name===t))&&(this.update({fileHolds:[...this.state.fileHolds,{id:e,name:t}]}),this.startHold(),!0),this.keepFiles=(e,t)=>{let n=new Set(t.map(e=>e.normalize("NFC"))),l=t=>t.id!==e||!n.has(t.name.normalize("NFC"));this.state.fileHolds.every(l)||this.update({fileHolds:this.state.fileHolds.filter(l)})},this.restoreRows=()=>{let{holds:e,fileHolds:t}=this.state;return(this.endHold(),0===e.length&&0===t.length)?[]:(this.update({holds:[],fileHolds:[]}),this.schedule(),[...e.map(e=>e.id),...t.map(e=>e.id)])},this.retry=()=>{this.blocked=!1,this.schedule(),this.read()},this.ownWrite=(e,t)=>{let n=this.taskOf(e),l=this.state.rows.version;if(t!==l||(null==n?void 0:n.rev)==null||this.state.rows.stale.has(n))return null;let r=n.rev;return t=>{(null==t?void 0:t.id_aa)===e&&null!=t.rev&&t.rev!==r&&this.adopt(t,r,t.rev,l)}},this.taskOf=e=>{var t;return null!=(t=this.indexOf(this.state.rows).get(e))?t:this.lastSeen.get(e)},this.drain=async()=>{if(this.config.readOnly)return null;for(this.sendEverything(!1);(this.state.sending.length>0||this.state.queue.some(b))&&!this.blocked&&(0!==this.state.sending.length||null!=this.timer);)await new Promise(e=>this.settleWaiters.push(e));return this.unsaved()},this.io=e,this.state={rows:t,queue:[],sending:[],keys:new Map,completeness:n,failure:null,dropped:0,lost:[],blank:this.nextBlank(),draftId:l,holds:[],fileHolds:[]}}}function _(e,t){let n=t(e);if(65536>=j(n.ops))return n;let l=0,r=e.length;for(;r-l>1;){let n=l+r>>1;65536>=j(t(e.slice(0,n)).ops)?l=n:r=n}if(0===l)return n;let i=t(e.slice(0,l));return{...i,rest:[...i.rest,...e.slice(l)]}}function j(e){return new TextEncoder().encode(JSON.stringify({ops:e})).length}async function S(e,t,n,l){let r=await fetch("".concat((0,i.Gn)(e),"/benchmarks/").concat(t,"/draft-tasks?offset=").concat(n,"&limit=").concat(l));if(!r.ok)throw Error(await (0,i.IP)(r));return r.json()}async function C(e,t,n,l){let r=JSON.stringify({ops:n}),s=await fetch("".concat((0,i.Gn)(e),"/benchmarks/").concat(t,"/draft-tasks"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:r,keepalive:l&&new TextEncoder().encode(r).length<=65536});if(422===s.status){let e=(0,c.FK)(await s.clone().json().catch(()=>null));if(e.length>0)throw new N(await (0,i.IP)(s),e)}if(!s.ok)throw await (0,i.mk)(s);return s.json()}class N extends Error{constructor(e,t){super(e),this.refused=t}}},23496:(e,t,n)=>{n.d(t,{T:()=>l});function l(e,t){return[...e.slice(Math.max(0,e.length-100+1)),t]}},23816:(e,t,n)=>{n.d(t,{$V:()=>w,Cc:()=>b,GA:()=>i,Lj:()=>o,MD:()=>s,N$:()=>f,Ok:()=>y,W2:()=>c,ZO:()=>h,cb:()=>r,i2:()=>x,iK:()=>m,nD:()=>a,nT:()=>p,s5:()=>d,u6:()=>v,uR:()=>g});let l=[["input","wanted"],["input","files","wanted"],["input","category","wanted"],["input","category","files","wanted"]];function r(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return l[2*!!e+ +!!t]}let i="header";function s(e,t,n,l,r){let i=Math.max(0,n-1),s=l.length-1,a=Math.max(0,l.indexOf(e.col)),u=(e,t)=>({index:Math.min(i,Math.max(0,e)),col:l[Math.min(s,Math.max(0,t))]});if(e.index<0){var o=e,d=t,c=a,h=i,f=l,p=u;let n=e=>({index:-1,col:f[Math.min(f.length-1,Math.max(0,e))]});switch(d){case"left":case"previous":return n(c-1);case"right":case"next":return n(c+1);case"rowStart":return n(0);case"rowEnd":return n(f.length-1);case"down":case"pageDown":case"enter":return p(0,c);case"first":return p(0,0);case"last":return p(h,f.length-1);case"up":case"pageUp":return o}return}switch(t){case"up":return 0===e.index?{index:-1,col:l[a]}:u(e.index-1,a);case"down":return u(e.index+1,a);case"enter":if(e.index>=i||null==e.tabFrom)return u(e.index+1,a);return u(e.index+1,Math.max(0,l.indexOf(e.tabFrom)));case"left":return u(e.index,a-1);case"right":return u(e.index,a+1);case"rowStart":return u(e.index,0);case"rowEnd":return u(e.index,s);case"first":return u(0,0);case"last":return u(i,s);case"pageUp":return u(e.index-r,a);case"pageDown":return u(e.index+r,a);case"next":if(a<s)return u(e.index,a+1);return e.index<i?u(e.index+1,0):u(e.index,a);case"previous":if(a>0)return u(e.index,a-1);return e.index>0?u(e.index-1,s):u(e.index,a)}}function a(e,t,n,l){let r=s(e,t?"previous":"next",n,l,0);return r.index===e.index&&r.col===e.col?null:r}let u=new Set(["-","–","=","≠"]);function o(e){let{key:t,ctrlKey:n,metaKey:l,altKey:r}=e;if(r)return null;let i=n||l;switch(t){case"ArrowUp":return"up";case"ArrowDown":return"down";case"ArrowLeft":return"left";case"ArrowRight":return"right";case"Home":return i?"first":"rowStart";case"End":return i?"last":"rowEnd";case"PageUp":return"pageUp";case"PageDown":return"pageDown";default:return null}}function d(e){var t;let{key:n,code:l,ctrlKey:r,metaKey:i,shiftKey:s,altKey:a}=e;if(!(r||i))return null;if(!a){if("Enter"===n)return"insert";let e=n.toLowerCase();return"z"===e?s?"redo":"undo":"y"!==e||!r||i||s?null:"redo"}if((null==(t=e.getModifierState)?void 0:t.call(e,"AltGraph"))===!0)return null;let o="NumpadAdd"===l&&"+"===n;return 1!==n.length||u.has(n)||o?"Minus"===l||"NumpadSubtract"===l||"-"===n||"–"===n?"delete":"Equal"===l||"NumpadAdd"===l||"="===n||"≠"===n?"insert":null:null}function c(e){let{key:t,altKey:n,ctrlKey:l,metaKey:r,shiftKey:i}=e;return"ArrowDown"===t&&n&&!l&&!r&&!i}function h(e){let{key:t,ctrlKey:n,metaKey:l,altKey:r,shiftKey:i}=e;if(!(n||l)||r||i)return null;let s=t.toLowerCase();return"a"===s?"selectAll":"c"===s?"copy":null}function f(e){return"touch"===e||"pen"===e}function p(e,t,n){return Math.abs(t-e.x)>3||Math.abs(n-e.y)>3}function m(e,t,n,l){if(e.dragged||l||t!==e.cell&&p(e,n.clientX,n.clientY))return!1;let{button:r,shiftKey:i,ctrlKey:s,metaKey:a,altKey:u}=n;return 0===r&&!i&&!s&&!a&&!u}function v(e,t,n){return f(e)&&t>=0&&"files"!==n}function g(e){let{key:t,ctrlKey:n,metaKey:l,altKey:r}=e;return l||n&&!r?null:"Process"===t?"composition":1===t.length?"character":null}function w(e,t,n){if(e[n]===t)return n;let l=e.indexOf(t);return l>=0?l:0===e.length?-1:Math.min(n,e.length-1)}function x(e){return(null==e?void 0:e.editing)===!0&&!0===e.fresh}class b{constructor(){var e=this;this.cursor=null,this.end=null,this.listeners=new Set,this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.get=()=>this.cursor,this.anchor=()=>this.end,this.set=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;for(let l of(e.cursor=t,e.end=null==t?null:n,e.listeners))l()},this.typed=e=>{var t;(null==(t=this.cursor)?void 0:t.editing)===!0&&(this.cursor={...this.cursor,seed:e})},this.rowState=e=>{let t=this.cursor;return(null==t?void 0:t.key)!==e?"":t.editing?null==t.seed?"".concat(t.col,":edit"):"".concat(t.col,":edit:").concat(t.seed):t.col}}}function y(e){if(""===e)return{col:null,editing:!1,seed:null};let[t,n,...l]=e.split(":");return{col:t,editing:"edit"===n,seed:l.length>0?l.join(":"):null}}}
1,25112:(e,t,n)=>{n.d(t,{$N:()=>d,$s:()=>v,AZ:()=>m,Gx:()=>c,X6:()=>o,hl:()=>h,rE:()=>p,wt:()=>f});var l=n(43359),r=n(59838);let i="Meets the criterion: ",s="Does not meet the criterion: ",a="Not met if: ";function u(e){return e.replace(/\s+/g," ").trim().replace(/[\s.]+$/,"")}function o(e){let t=u(e),n=t.charAt(0).toUpperCase()+t.slice(1);if(n.length<=120)return n;let l=n.slice(0,120);return"".concat(l.slice(0,Math.max(l.lastIndexOf(" "),60)).trimEnd(),"…")}function d(e){let{sentence:t,zero:n,middle:l}=g(e);return{sentence:t,zero:n,middle:l}}function c(e){return g(e).levels.length<=2&&1===e.weight}function h(e){return null!=e.description&&null==k(e,g(e))}function f(e,t){var n,l;let r=g(e);if(t===r.sentence)return e;let i={...r,sentence:t};return{...e,name:(n=e,l=r.sentence,""===n.name||n.name===o(l))?o(t):e.name,description:_(e,r,i),levels:j(i,!r.customZero)}}function p(e,t){let n=g(e);if(t===n.zero)return e;if(n.customZero)return{...e,levels:n.levels.map((e,n)=>0===n?{...e,description:t}:e)};let l={...n,zero:t};return{...e,description:_(e,n,l),levels:j(l,!0)}}function m(e,t){let n=g(e);return t.length===n.middle.length&&t.every((e,t)=>e===n.middle[t])?e:{...e,levels:j({...n,middle:t},!n.customZero)}}function v(e,t){if(t===(0,r.cY)(e))return e;let{description:n,levels:l}=(0,r.Zh)(t).dimensions[0];return{...e,description:n,levels:l}}function g(e){let t=function(e){var t;let n=(0,l.n)(e.levels,(e,t)=>e.score-t.score);return n.length>=2?n:(0,r.Ew)((null==(t=e.description)?void 0:t.trim())||e.name.trim())}(e),n=t.at(-1).description,a=t[0].description,u=""===n&&""===a||n.startsWith(i),o=n.startsWith(i)?n.slice(i.length):n,d=t.slice(1,-1).map(e=>e.description),c=function(e,t){if(""===e||e==="".concat(s).concat(t))return"";let n=w(t);return e.startsWith(n)?e.slice(n.length):null}(a,o);return{sentence:o,zero:null!=c?c:a,middle:d,prose:u,customZero:null==c,levels:t}}function w(e){return"".concat(s).concat(e.replace(/[\s.]+$/,""),".").concat(" Also not met if: ")}function x(e){return e.customZero?"":e.zero}function b(e){return""===e?null:"".concat(a).concat(e)}function y(e,t){return""===t?e:"".concat(e," ").concat(a).concat(t)}function k(e,t){let{description:n}=e,l=x(t);return null==n||n===b(l)?"note":""===t.sentence.trim()?null:n===y(t.sentence,l)||n.trim()===t.sentence.trim()?"sentence":null}function _(e,t,n){let l=k(e,t);if(null==l)return e.description;let r=x(n);return""!==n.sentence.trim()&&("sentence"===l||u(n.sentence).length>120)?y(n.sentence,r):b(r)}function j(e,t){let{sentence:n,zero:l,middle:r,prose:a}=e,u=a&&""===n&&""===l,o=u?"":a?"".concat(i).concat(n):n;return[u?"":t?""===l?"".concat(s).concat(n):"".concat(w(n)).concat(l):e.levels[0].description,...r,o].map((e,t)=>({score:t,description:e}))}},35984:(e,t,n)=>{n.d(t,{D:()=>s});var l=n(96040),r=n(72324),i=n(59514);function s(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],[n,s]=(0,l.useState)(null),[a,u]=(0,l.useState)(t),[o,d]=(0,l.useState)(!1),c=(0,l.useCallback)(async()=>{try{let t=await fetch("".concat((0,i.Gn)(e),"/huggingface/account"),{cache:"no-store"});if(!t.ok)throw Error(await (0,i.IP)(t));s(r.eK.parse(await t.json()).account)}catch(e){s(null)}finally{u(!1)}},[e]);return(0,l.useEffect)(()=>{t&&(u(!0),c())},[t,c]),{account:n,isLoading:a,isSaving:o,connect:(0,l.useCallback)(async t=>{d(!0);try{let n=await fetch("".concat((0,i.Gn)(e),"/huggingface/account"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})});if(!n.ok)throw Error(await (0,i.IP)(n));let l=r.eK.parse(await n.json()).account;return s(l),l}finally{d(!1)}},[e]),disconnect:(0,l.useCallback)(async()=>{d(!0);try{let t=await fetch("".concat((0,i.Gn)(e),"/huggingface/account"),{method:"DELETE"});if(!t.ok)throw Error(await (0,i.IP)(t));await c()}finally{d(!1)}},[e,c]),refresh:c}}},38635:(e,t,n)=>{n.d(t,{H:()=>ei});var l=n(58212),r=n(36772),i=n(96040),s=n(42633),a=n(90989),u=n(98746),o=n(58835),d=n(33505),c=n(27724),h=n(83386),f=n(51744),p=n(38341),m=n(41553),v=n(26959),g=n(60441),w=n(58351),x=n(70366),b=n(24121),y=n(7980),k=n(91445),_=n(60568),j=n(63806),S=n(68312),C=n(67),N=n(17123),E=n(23816);let R=["input","category","files"],O={category:104,files:170},D={input:120,category:72,files:96,wanted:160};function M(e,t,n){let l=R.filter(n=>"input"===n||("category"===n?e:t)),r=l.some(e=>null!=n[e]),i=e=>r?"".concat(D[e],"px"):"0",s=["".concat(32,"px"),...l.map(e=>{let t=n[e];return null!=t?"".concat(t,"px"):"input"===e?"minmax(".concat(i("input"),",1fr)"):"".concat(O[e],"px")}
1),"minmax(".concat(i("wanted"),",").concat(e?"1.05fr":"1fr",")")],a=l.reduce((e,t)=>{var l;return e+(null!=(l=n[t])?l:"input"===t?D.input:O[t])},32+D.wanted),u=e?720:600;return{template:s.join(" "),minWidth:r?Math.max(u,a):u}}function T(e,t){return Math.round(Math.min(1600,Math.max(D[e],t)))}function A(e,t){try{0===Object.keys(t).length?window.localStorage.removeItem(e):window.localStorage.setItem(e,JSON.stringify(t))}catch(e){}}var I=n(30332),q=n(59514),F=n(65403),L=n(32520);function H(e,t){var n,l;if(e.nativeEvent.isComposing||229===e.keyCode)return;let r=e.currentTarget,i=(n,l)=>{e.preventDefault(),e.stopPropagation(),t.onCommit(n,l)};switch(e.key){case"Enter":if(e.altKey||e.ctrlKey||e.metaKey){e.preventDefault(),r instanceof HTMLTextAreaElement&&((n=r).setRangeText("\n",n.selectionStart,n.selectionEnd,"end"),n.dispatchEvent(new Event("input",{bubbles:!0})));return}i(e.shiftKey?"up":"enter",!0);return;case"Tab":i(e.shiftKey?"previous":"next",!1);return;case"Escape":e.preventDefault(),e.stopPropagation(),t.onRevert();return;case"ArrowUp":case"ArrowDown":((l=r)instanceof HTMLInputElement||!l.value.includes("\n")&&l.scrollHeight<=40)&&i("ArrowUp"===e.key?"up":"down",!1);return;case"Home":case"End":e.preventDefault(),e.stopPropagation(),function(e,t,n,l){var r,i;let s=null!=(r=e.selectionStart)?r:0,a=null!=(i=e.selectionEnd)?i:s,[u,o]="backward"===e.selectionDirection?[a,s]:[s,a],d=(0,j.rb)(e.value,o,t,n);l?d<u?e.setSelectionRange(d,u,"backward"):e.setSelectionRange(u,d,"forward"):e.setSelectionRange(d,d)}(r,e.key,e.ctrlKey||e.metaKey,e.shiftKey);return}}let K="undefined"!=typeof CSS&&CSS.supports("field-sizing","content");function z(e,t){let n,l,s,a,u,o,d,c=(0,r.c)(12),h=(0,i.useRef)(null);return c[0]!==e?(n=()=>{let t=h.current;e&&null!=t&&document.activeElement!==t&&(t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length))},l=[e],c[0]=e,c[1]=n,c[2]=l):(n=c[1],l=c[2]),(0,i.useLayoutEffect)(n,l),c[3]!==e?(s=()=>{let t=h.current;e&&null!=t&&!K&&(t.style.height="0px",t.style.height="".concat(Math.min(t.scrollHeight,202),"px"))},c[3]=e,c[4]=s):s=c[4],c[5]!==e||c[6]!==t?(a=[e,t],c[5]=e,c[6]=t,c[7]=a):a=c[7],(0,i.useLayoutEffect)(s,a),c[8]!==e?(u=()=>{let t,n=h.current;if(!e||null==n)return;t=n.offsetHeight;let l=new ResizeObserver(()=>{let e=n.offsetHeight;e>t&&n.scrollIntoView({block:"nearest",inline:"nearest"}),t=e});return l.observe(n),()=>l.disconnect()},o=[e],c[8]=e,c[9]=u,c[10]=o):(u=c[9],o=c[10]),(0,i.useEffect)(u,o),c[11]===Symbol.for("react.memo_cache_sentinel")?(d=e=>{h.current=e},c[11]=d):d=c[11],d}function P(e){let{editor:t,id:n,label:r,value:i,placeholder:s,problem:a,onChange:u,keys:o,onBlur:d,onExpand:h,mark:f}=e;return(0,l.jsxs)("div",{className:(0,c.cn)("absolute inset-x-0 top-0 z-10 flex items-start bg-white",null==a?"shadow-[inset_0_0_0_1px_hsl(var(--brand-purple))]":"shadow-[inset_0_0_0_1.5px_theme(colors.red.500)]"),children:[f,(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("textarea",{ref:t,rows:1,"aria-label":r,"aria-invalid":null!=a||void 0,"aria-describedby":null!=a?"".concat(n,"-problem"):void 0,value:i,placeholder:s,onChange:e=>u(e.target.value),onKeyDown:e=>H(e,o),onBlur:d,className:(0,c.cn)("block max-h-[202px] w-full resize-none overflow-y-auto border-0 bg-transparent px-3 py-[11px] text-[12.5px] leading-[18px] text-neutral-900 outline-none [field-sizing:content] placeholder:text-neutral-400 focus:outline-none focus:ring-0",null!=f&&"pl-1.5",null!=h&&"pr-8")}),null!=a&&(0,l.jsx)("p",{id:"".concat(n,"-problem"),className:"px-3 pb-2 text-[11.5px] leading-4 text-red-700",children:a})]}),null!=h&&(0,l.jsx)("button",{type:"button",tabIndex:-1,"aria-label":"Open in the panel",title:"Open in the panel",disabled:null!=a,onMouseDown:e=>e.preventDefault(),onClick:h,className:"absolute right-1.5 top-[11px] flex h-[18px] w-[18px] items-center justify-center rounded text-neutral-500 hover:bg-neutral-100 hover:text-neutral-900 disabled:pointer-events-none disabled:opacity-40",children:(0,l.jsx)(L.A,{className:"h-3 w-3"})})]})}function B(e){var t;let n,s,a,u,o,d,h,f,p,m,v,g,w,x,b,y,k,_,S,C,N,E,R,O,D,M=(0,r.c)(78),{label:T,current:A,initial:I,typed:q,readOptions:F,onTyped:L,onDone:K}=e,[z]=(0,i.useState)(F),[P,B]=(0,i.useState)(I),[G,U]=(0,i.useState)(q),[$,Z]=(0,i.useState)(q);M[0]!==P?(n=(0,j.O1)(P),M[0]=P,M[1]=n):n=M[1];let X=n;M[2]!==z||M[3]!==P?(s=(0,j.MT)(z,P),M[2]=z,M[3]=P,M[4]=s):s=M[4];let J=s,V=$&&""!==X;M[5]!==V||M[6]!==z||M[7]!==P?(a=V?(0,j.co)(z,P):z,M[5]=V,M[6]=z,M[7]=P,M[8]=a):a=M[8];let Y=a;M[9]!==J||M[10]!==Y||M[11]!==V||M[12]!==X?(u=V&&null==J?[...Y,{value:X,label:"Add “".concat(X,"”"),adds:!0}]:Y,M[9]=J,M[10]=Y,M[11]=V,M[12]=X,M[13]=u):u=M[13];let Q=u;M[14]!==A||M[15]!==z||M[16]!==q||M[17]!==X?(o=()=>q?""===X?-1:0:z.findIndex(e=>e.value===A),M[14]=A,M[15]=z,M[16]=q,M[17]=X,M[18]=o):o=M[18];let[ee,et]=(0,i.useState)(o),en=ee>=0&&null!=(t=Q[ee])?t:null,el=(0,i.useId)(),er=(0,i.useRef)(null),ei=(0,i.useRef)(!1);M[19]!==K?(d=(e,t,n)=>
1{ei.current||(ei.current=!0,K(e,t,n))},M[19]=K,M[20]=d):d=M[20];let es=d;M[21]!==z||M[22]!==en||M[23]!==P||M[24]!==G?(h=()=>(0,j.ZV)("key",G,P,z,en),M[21]=z,M[22]=en,M[23]=P,M[24]=G,M[25]=h):h=M[25];let ea=h;M[26]!==z||M[27]!==P||M[28]!==G?(f=()=>(0,j.ZV)("blur",G,P,z,null),M[26]=z,M[27]=P,M[28]=G,M[29]=f):f=M[29];let eu=f;M[30]!==eu||M[31]!==K?(p={blurred:eu,onDone:K},M[30]=eu,M[31]=K,M[32]=p):p=M[32];let eo=(0,i.useRef)(p);M[33]!==eu||M[34]!==K?(m=()=>{eo.current={blurred:eu,onDone:K}},M[33]=eu,M[34]=K,M[35]=m):m=M[35],(0,i.useLayoutEffect)(m),M[36]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{ei.current=!1;let e=er.current;return()=>{(0,j.th)(ei.current,e)&&(ei.current=!0,eo.current.onDone(eo.current.blurred(),null,"blur"))}},g=[],M[36]=v,M[37]=g):(v=M[36],g=M[37]),(0,i.useEffect)(v,g),M[38]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{let e=er.current;null==e||e.focus({preventScroll:!0}),null==e||e.setSelectionRange(e.value.length,e.value.length)},x=[],M[38]=w,M[39]=x):(w=M[38],x=M[39]),(0,i.useLayoutEffect)(w,x);let ed=(0,i.useRef)(null);M[40]===Symbol.for("react.memo_cache_sentinel")?(b=()=>{var e;return null==(e=ed.current)?void 0:e.scrollIntoView({block:"nearest"})},M[40]=b):b=M[40],M[41]!==ee?(y=[ee],M[41]=ee,M[42]=y):y=M[42],(0,i.useLayoutEffect)(b,y),M[43]!==ea||M[44]!==es||M[45]!==Q.length?(k=function(e){if(!e.nativeEvent.isComposing&&229!==e.keyCode){if(("ArrowDown"===e.key||"ArrowUp"===e.key)&&Q.length>0&&!e.altKey){e.preventDefault(),e.stopPropagation();let t="ArrowDown"===e.key?1:-1;U(!0),et(e=>Math.max(0,Math.min(Q.length-1,e+t)));return}H(e,{onCommit:e=>es(ea(),e,"key"),onRevert:()=>es(null,null,"esc")})}},M[43]=ea,M[44]=es,M[45]=Q.length,M[46]=k):k=M[46];let ec=k,eh="".concat(el,"-empty"),ef=null==en?void 0:"".concat(el,"-").concat(ee),ep=0===Q.length?eh:void 0;return M[47]!==L?(_=e=>{let t=e.target.value;B(t),null==L||L(t),U(!0),Z(!0),et(""===t.trim()?-1:0)},M[47]=L,M[48]=_):_=M[48],M[49]!==eu||M[50]!==es?(S=()=>{(0,j.CK)(document.hasFocus())&&es(eu(),null,"blur")},M[49]=eu,M[50]=es,M[51]=S):S=M[51],M[52]!==T||M[53]!==el||M[54]!==ec||M[55]!==ef||M[56]!==ep||M[57]!==_||M[58]!==S||M[59]!==P?(C=(0,l.jsx)("input",{ref:er,type:"text",role:"combobox","aria-label":T,"aria-expanded":!0,"aria-controls":el,"aria-autocomplete":"list","aria-activedescendant":ef,"aria-describedby":ep,value:P,onChange:_,onKeyDown:ec,onBlur:S,className:"block h-10 w-full border-0 bg-white px-3 py-0 text-xs text-neutral-900 shadow-[inset_0_0_0_1px_hsl(var(--brand-purple))] outline-none focus:outline-none focus:ring-0"}),M[52]=T,M[53]=el,M[54]=ec,M[55]=ef,M[56]=ep,M[57]=_,M[58]=S,M[59]=P,M[60]=C):C=M[60],M[61]!==ee||M[62]!==es||M[63]!==el||M[64]!==Q?(N=Q.map((e,t)=>(0,l.jsx)("li",{ref:t===ee?ed:void 0,id:"".concat(el,"-").concat(t),role:"option","aria-selected":t===ee,onClick:()=>es(e.value,null,"key"),className:(0,c.cn)("cursor-pointer truncate px-3 py-1.5",e.adds&&"text-neutral-500",t===ee&&"bg-neutral-100"),children:e.label},e.adds?"+add":e.value)),M[61]=ee,M[62]=es,M[63]=el,M[64]=Q,M[65]=N):N=M[65],M[66]!==el||M[67]!==N?(E=(0,l.jsx)("ul",{id:el,role:"listbox","aria-label":"Categories",className:"max-h-[216px] overflow-auto",children:N}),M[66]=el,M[67]=N,M[68]=E):E=M[68],M[69]!==eh||M[70]!==Q.length?(R=0===Q.length&&(0,l.jsx)("p",{id:eh,className:"px-3 py-1.5 text-neutral-500",children:"No categories yet"}),M[69]=eh,M[70]=Q.length,M[71]=R):R=M[71],M[72]!==E||M[73]!==R?(O=(0,l.jsxs)("div",{role:"presentation",onMouseDown:W,className:"absolute left-0 top-full z-20 mt-1 w-max min-w-full max-w-[280px] rounded-md border bg-white py-1 text-xs shadow-md",children:[E,R]}),M[72]=E,M[73]=R,M[74]=O):O=M[74],M[75]!==C||M[76]!==O?(D=(0,l.jsxs)("div",{className:"absolute inset-x-0 top-0 z-10",children:[C,O]}),M[75]=C,M[76]=O,M[77]=D):D=M[77],D}function W(e){return e.preventDefault()}var G=n(23312),U=n(89324);let $=()=>!1,Z="Written by the agent.",X="shadow-[inset_0_0_0_1px_hsl(var(--brand-purple))]";function J(e){e.preventDefault(),e.stopPropagation()}let V="build-grid-delete",Y=null,Q=null,ee=!1;function et(){return null!=Q||(Q=n.e(23813).then(n.bind(n,23813)).then(e=>Y=e,e=>{throw Q=null,ee||u.Ay.captureException(e,{context:"optima.build_sheet_load"}),ee=!0,e})),Q}let en=()=>Promise.all([n.e(35765),n.e(55992),n.e(34880),n.e(64576)]).then(n.bind(n,64576)).then(e=>e.ImagePreview),el=(0,a.default)(en,{loading:()=>null}),er={PDF:"bg-red-700",XLS:"bg-green-800",CSV:"bg-green-800",DOC:"bg-blue-700",IMG:"bg-neutral-600",TXT:"bg-neutral-600",JSON:"bg-neutral-600",FILE:"bg-neutral-600"};function ei(e){let t,n,{grid:a,files:u,imported:f,gradingMode:v="objective",readOnly:g,saved:w=!1,openId:x=null,onOpenCell:b,onOpenInput:y,openField:k="wanted",focusCell:O=null,selection:D=null,onSelectionChange:q,carry:L=null,describe:H,locked:K=!1,status:z,gutterInside:P=!1,uploads:B=!1,onLockedEdit:W,className:Z}=e;var X,J,Q,ee,en=K;let el=(0,r.c)(3),er=(0,i.useRef)(null);el[0]!==en?(t=()=>{if(en){let e=document.activeElement;er.current=e instanceof HTMLElement&&e!==document.body?e:null;return}let e=er.current;er.current=null;let t=null==document.activeElement||document.activeElement===document.body;null!=e&&e.isConnected&&t&&e.focus({preventScroll:!0})},n=[en],el[0]=en,el[1]=t,el[2]=n):(t=el[1],n=el[2]),(0,i.useLayoutEffect)(t,n);let ei=(0,i.useRef)(null),eh=(0,i.useRef)(null),ew=(0,i.useRef)(null),[ex,ey]=(0,i.useState)(!1),ek=(0,i.useId)(),[e_]=(0,i.useState)(()=>{var e;
1return null!=(e=null==L?void 0:L.cursor)?e:new E.Cc}),eO=(0,i.useRef)(!1),eD=(0,i.useRef)("mouse"),eM=(0,i.useRef)(null),eT=(0,i.useRef)({x:0,y:0}),eA=(0,i.useRef)(null),eI=(0,i.useRef)(null),eq=(0,i.useRef)(null),eF=(0,i.useRef)([]),eK=(0,i.useRef)(new Set),[ez,eP]=(0,i.useState)(Y),eB=(0,i.useRef)([]),eW=e=>null!=eq.current&&eq.current!==e,[eG,eU]=(0,i.useState)({scrolls:!1,atEnd:!0,left:!1,right:!1}),e$=null!=D&&null!=q,eZ=e=>"subjective"===v||"criteria"===(0,_.GZ)(e,f).kind,eX=(0,i.useCallback)(e=>{var t,n,l;return t=e,n=w,l=e$,{keys:t.keys,taskCount:t.tasks.length,withCategory:(0,_.Z8)(t.tasks),withFiles:(0,_.Eh)(t.tasks),counts:n?{input:null,wanted:null}:(0,_.yo)(t.completeness,t.tasks),completeness:t.completeness,missingFiles:(0,_.NU)(t.completeness,"reference_files"),storedIds:l?t.tasks.flatMap(e=>{let n=null==e?void 0:t.resolveId(e.id_aa);return null==n?[]:[n]}):eo,blankKey:t.blankKey,holding:t.holding,filesHeld:t.filesHeld}},[w,e$]),eJ=(0,G.Fm)(a,eX,ed),eV=!g&&!w,eY=!eV||K,eQ=(0,i.useSyncExternalStore)(e_.subscribe,()=>(0,E.i2)(e_.get()),$),e0=e=>{let t=e_.get();return(0,E.i2)(t)&&e.keys.at(-1)!==(null==t?void 0:t.key)},e1=e=>e.keys.length-(null!=e.blankKey&&(eY||e0(e))?1:0),e2=e1(eJ),e3=eV&&0===eJ.taskCount,[e5,e4]=(0,i.useState)(e3||null!=L);e3&&!e5&&e4(!0);let{counts:e6,storedIds:e7,missingFiles:e8}=eJ,[e9,te]=(0,i.useState)(eJ.withCategory);eJ.withCategory&&!e9&&te(!0);let tt=eV&&B||eJ.withFiles,[tn,tl]=(0,i.useState)(tt);tt&&!tn&&tl(!0);let tr="grid-cols-[var(--sheet-cols)]",[ti,ts]=(0,i.useState)({}),ta=M(e9,tn,ti),{currentUserId:tu,orgSlug:to}=(0,F.t$)(),td=(0,G.Fm)(a,ef),tc=null==td?null:"".concat("optima.sheet-columns",":").concat(null!=tu?tu:"anon",":").concat(td),th=(0,i.useRef)(null);(0,i.useLayoutEffect)(()=>{if(null==tc||th.current===tc)return;let e=null==th.current;th.current=tc;let t=function(e){try{let t=window.localStorage.getItem(e);return null==t?null:function(e){let t={};if("object"!=typeof e||null==e)return t;for(let n of R){let l=e[n];"number"==typeof l&&Number.isFinite(l)&&(t[n]=T(n,l))}return t}(JSON.parse(t))}catch(e){return null}}(tc);null==t&&e?Object.keys(ti).length>0&&A(tc,ti):ts(null!=t?t:{})},[tc,ti]);let tf=eV&&!K,[tp]=(0,i.useState)(ea),tm=(0,i.useRef)(null),tv=e7.length>0&&e7.every(e=>null==D?void 0:D.has(e)),tg=!tv&&e7.some(e=>null==D?void 0:D.has(e)),tw=function(){let e,t,n=(0,r.c)(2),s=(0,i.useRef)(null),a=(0,i.useRef)(null);n[0]===Symbol.for("react.memo_cache_sentinel")?(e=(e,t)=>{let{multiple:n}=e,l=s.current;null!=l&&(a.current=t,l.multiple=n,l.click())},n[0]=e):e=n[0];let u=e;return n[1]===Symbol.for("react.memo_cache_sentinel")?(t={pick:u,input:(0,l.jsx)("input",{ref:s,type:"file","aria-hidden":!0,tabIndex:-1,accept:I.Wb,className:"hidden",onChange:e=>{var t;let n=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="";let l=a.current;a.current=null,n.length>0&&(null==l||l(n))}})},n[1]=t):t=n[1],t}(),[tx,tb]=(0,i.useState)(null),ty=(0,i.useRef)(null),{keys:tk}=eJ,t_=(0,i.useCallback)(e=>{var t;return null!=(t=tk[e])?t:"position:".concat(e)},[tk]),tj=(0,o.Te)({count:e2,getScrollElement:()=>ei.current,estimateSize:()=>40,getItemKey:t_,overscan:8,scrollMargin:40,scrollPaddingStart:40,useFlushSync:!1,...(null==L?void 0:L.rect)!=null&&{initialRect:L.rect}}),tS=tj.getVirtualItems(),tC=null!=(Q=null==(X=tS[0])?void 0:X.index)?Q:0,tN=null!=(ee=null==(J=tS.at(-1))?void 0:J.index)?ee:0,{viewRange:tE}=a,tR=tS.length>0;(0,i.useEffect)(()=>{tR&&tE(tC,tN)},[tE,tR,tC,tN]),(0,i.useEffect)(()=>{let e=ei.current;if(null==e)return;let t=()=>eE(e,eh.current,eU);t();let n=new ResizeObserver(t);return n.observe(e),null!=eh.current&&n.observe(eh.current),()=>n.disconnect()},[e2]);let tO=(0,i.useRef)(null),tD=eQ&&e0(eJ),tM=(0,i.useMemo)(()=>tD?tk.slice(0,-1):tk,[tD,tk]),tT=(0,i.useRef)(tM),tA=(0,i.useRef)(null);(0,i.useLayoutEffect)(()=>{var e;let t=tT.current,n=tA.current;tT.current=tM,tA.current=null;let l=tO.current,r=ei.current;!(0,_.nk)(t,tM)&&null!=l&&null!=r&&tf&&(null==(e=(0,h.Ny)())||e.moveRows(l,r,t,tM,40,n))},[tM,tf]);let tI={focusGrid:()=>{var e;return null==(e=ew.current)?void 0:e.focus({preventScroll:!0})},at:()=>{let e=e_.get();if(null==e)return null;if(e.key===E.GA)return{...e,index:-1};let t=(0,E.$V)(a.view().keys,e.key,e.index);return t<0?null:{...e,index:t}},moveTo:(e,t,n)=>{let l=a.view();
1if(e<0)return void e_.set({key:E.GA,index:-1,col:t,editing:!1,original:""});let r=l.keys[e];if(null==r)return;let i=tI.at();e_.set({key:r,index:e,col:t,editing:!1,original:"",...null!=n&&{tabFrom:n}});let s=null==i||i.key===r?void 0:l.rows[i.index];null!=s&&s.id_aa.startsWith(S.a7)&&tI.leaveRow(s.id_aa),tI.reveal(r,t)},reveal:(e,t)=>{var n,l;let r=(0,E.$V)(a.view().keys,e,null!=(l=null==(n=e_.get())?void 0:n.index)?l:0);r>=0&&tj.scrollToIndex(r,{align:"auto"}),requestAnimationFrame(()=>{var n;let l=e_.get();(null==l?void 0:l.key)===e&&l.col===t&&(null==(n=document.getElementById(ej(ek,e,t)))||n.scrollIntoView({block:"nearest",inline:"nearest"}))})},move:e=>{let t=tI.at();if(null==t)return;if("next"===e||"previous"===e)return void tI.tab("previous"===e);let n=(0,E.cb)(e9,tn),l=(0,E.MD)(t,e,e1(a.view()),n,eC(ei.current));tI.moveTo(l.index,l.col)},tab:e=>{var t;let n=tI.at();if(null==n)return!1;let l=(0,E.nD)(n,e,e1(a.view()),(0,E.cb)(e9,tn));return null!=l&&(tI.moveTo(l.index,l.col,n.index<0?void 0:null!=(t=n.tabFrom)?t:n.col),!0)},activate:e=>{var t,n;let l=a.view(),r=l.rows[e.index];if(null==r||K)return;let i=null!=(t=l.resolveId(r.id_aa))?t:null;if("files"===e.col){if(null==i||(null==u?void 0:u.busy.has(i))===!0)return;if((null==u?void 0:u.enabled)!==!0||!eV)return void tI.preview(e);let t=(0,_.yt)(r,null!=(n=null==e8?void 0:e8.has(r.id_aa))?n:null).find(e=>e.missing);return void(null!=t?tw.pick({multiple:!1},e=>u.fill(i,t.name,e[0])):tw.pick({multiple:!0},e=>u.attach(i,e)))}let s="wanted"===e.col?(0,_.GZ)(r,f).kind:null;if(null!=s&&("answer"!==s||eZ(r))&&null!=i)return void b(i,"empty"===s);tI.edit(e,null)},openPanel:e=>{var t;if(K)return!1;if("files"===e.col)return tI.preview(e);let n=a.view(),l=n.rows[e.index],r=null==l?null:null!=(t=n.resolveId(l.id_aa))?t:null;return"wanted"===e.col&&null!=r&&(b(r,!0),!0)},preview:e=>{var t,n,l,r;let i=a.view(),s=i.rows[e.index],u=null==s?null:null!=(t=i.resolveId(s.id_aa))?t:null,o=ty.current;if(null==s||null==u||null==o)return!1;let d=(0,_.yt)(s,null!=(n=null==e8?void 0:e8.has(s.id_aa))?n:null),c=d.filter(_.Hh).map(e=>e.name);if(0===c.length)return!1;let h=null!=(l=d.find(e=>e.missing))?l:d[0];return o({id:u,names:c,index:Math.max(0,c.indexOf(null!=(r=null==h?void 0:h.name)?r:""))}),!0},typesInto:e=>{let t=a.view().rows[e.index];return null!=t&&!!eV&&!K&&("input"===e.col?!(0,_.wT)(t.prompt):"category"===e.col?e9:"wanted"===e.col&&!eZ(t))},edit:(e,t)=>{let n=a.view(),l=n.rows[e.index],r=n.keys[e.index];if(null==l||null==r||!eV||K||eW(r)||"files"===e.col||"wanted"===e.col&&eZ(l)||"category"===e.col&&!e9)return;eI.current={key:r,original:(0,j.dc)(l)};let i=e_.get();e_.set({key:r,index:e.index,col:e.col,editing:!0,original:l.prompt,...null!=t&&{seed:t},...(null==i?void 0:i.key)===r&&i.col===e.col&&null!=i.tabFrom&&{tabFrom:i.tabFrom},...l.id_aa===n.blankKey&&{fresh:!0}});let s=null==t?null:(0,j.Ng)(e.col,t,l,f);null!=s&&a.edit(l.id_aa,s)},endEdit:e=>{let t=tI.at();null!=t&&e_.set({...t,editing:!1}),tI.focusGrid(),null!=e&&tI.move(e)},stopEdit:e=>{if(eO.current)return;let t=e_.get();(null==t?void 0:t.key)===e&&t.editing&&e_.set({...t,editing:!1})},clear:()=>{let e=tI.at();if(null==e||(null==Y?void 0:Y.clearRange(tI.sheetContext()))===!0)return;let t=a.view().rows[e.index];if(null!=t)if("input"===e.col)tI.edit(e,(0,_.p9)(t.prompt));else if("category"===e.col)tI.edit(e,"");else if("wanted"!==e.col||eZ(t)){if("files"===e.col){var n,l;let r=(0,_.yt)(t,null!=(n=null==e8?void 0:e8.has(t.id_aa))?n:null),i=null!=(l=r.find(e=>e.missing))?l:r[0];null!=i&&tI.removeFile(e.key,i.name)}}else tI.edit(e,"")},check:e=>{var t;let n=null==(t=eh.current)?void 0:t.querySelector('[data-row="'.concat(e.index,'"] [role="checkbox"]'));null!=n&&(n.dataset.kbd="",n.click())},paste:(e,t)=>{let n=a.view().rows[e.index];null!=n&&"files"!==e.col&&("wanted"===e.col&&eZ(n)||tI.edit(e,t))},blockEdit:(e,t)=>{t?eq.current=e:eq.current===e&&(eq.current=null)},select:function(e,t){var n,l,r;let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(eW(e))return;let u=a.view().keys.indexOf(e);if(i&&u>=0&&(null!=(l=null==(n=tI.at())?void 0:n.index)?l:-1)>=0){tI.withSheet((n,l)=>n.spanTo(l,a.view().keys.indexOf(e),t),void 0,{what:"click"}),tI.focusGrid();return}u>=0&&tI.moveTo(u,t);let o=ej(ek,e,t);eM.current=u<0||(0,E.N$)(eD.current)?null:{cell:o,key:e,col:t,over:o,dragged:!1,...eT.current},(0,E.N$)(eD.current)&&tI.hoverRow(u),(0,E.u6)(eD.current,u,t)&&((0,s.flushSync)(()=>tI.activate({index:u,col:t})),(null==(r=tI.at())?void 0:r.editing)===!0)||tI.focusGrid()},drag:e=>{var t;let n=eM.current;if(null==n)return;if((1&e.buttons)==0){eM.current=null;return}let l=null==(t=eS(e.target))?void 0:t.id;null!=l&&l!==n.over&&(0,E.nT)(n,e.clientX,e.clientY)&&(eM.current={...n,over:l,dragged:!0},tI.withSheet((e,t)=>
1e.dragTo(t,ek,l),void 0,{what:"drag"}))},leave:e=>{let t=eM.current;eM.current=null!=t&&(1&e.buttons)!=0?{...t,dragged:!0}:null},release:e=>{var t;let n=eM.current;eM.current=null;let l=e.target instanceof Element&&null!=e.target.closest("button");if(null==n||!(0,E.iK)(n,null==(t=eS(e.target))?void 0:t.id,e,l))return;let r=document.getElementById(n.cell),i=null==r||null==Y?void 0:Y.caretFrom(e.clientX,e.clientY,r);(0,s.flushSync)(()=>tI.edit({index:a.view().keys.indexOf(n.key),col:n.col},null)),eA.current=e_.get(),null==i||i()},editorPaste:e=>{let t=e_.get(),n=eA.current;if(eA.current=null,e.target===ew.current||(null==t?void 0:t.editing)!==!0||t!==n)return;let l=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("text/html");(0,N.PP)(l,r)&&(e.preventDefault(),tI.endEdit(null),tI.withSheet((e,t)=>e.pasteText(t,l,r,!0),void 0,{what:"paste"}))},insertBelow:e=>{let t=a.view().rows[e.index];null!=t&&eV&&!K&&(t.id_aa===a.view().blankKey?tI.moveTo(e.index,"input"):tI.addRow(t.id_aa))},hoverRow:(e,t)=>{var n,l,r,i;if(null==e&&null!=t&&tI.besideHover(t))return;let s=a.view(),u=null==e?void 0:s.keys[e],o=null==e?null:s.rows[e];if(null==e||!tf||null==u||null==o||o.id_aa===s.blankKey)return void tp.set(null);if((null==(n=tp.get())?void 0:n.key)===u)return;let d=null==(l=tO.current)?void 0:l.getBoundingClientRect(),c=null==(r=tm.current)?void 0:r.getBoundingClientRect(),h=null==(i=ei.current)?void 0:i.getBoundingClientRect();if(null==d||null==c||null==h)return;let f=Math.min(Math.max(d.top+40*e,h.top+40),h.bottom-40);tp.set({key:u,number:e+1,top:f-c.top})},gutterHover:e=>{var t,n;let l=null==(t=ei.current)?void 0:t.getBoundingClientRect(),r=null==(n=tO.current)?void 0:n.getBoundingClientRect(),i=null!=l&&null!=r&&e>=l.top+40&&e<l.bottom;tI.hoverRow(i?Math.floor((e-r.top)/40):null)},besideHover:e=>{var t;let n=tp.get();if(null==n)return!1;let l=null==(t=tm.current)?void 0:t.getBoundingClientRect();return null!=l&&e>=l.top+n.top&&e<l.top+n.top+40},deleteRow:e=>{var t,n;let l=a.view(),r=(0,E.$V)(l.keys,e,null!=(n=null==(t=e_.get())?void 0:t.index)?n:0);l.keys[r]===e&&tI.deleteRows(r,r)},deleteRows:function(e,t){var n,l,r,i;let{auto:s=!1,offer:u=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=a.view(),d=o.rows.slice(e,t+1).filter(e=>null!=e&&e.id_aa!==o.blankKey);if(0===d.length||!eV||K)return 0;let c=s?null:tI.at(),f=o.keys;e===t&&(tA.current=null!=(r=null==(n=(0,h.Ny)())?void 0:n.ghostRow(eh.current,e))?r:null);let p=new Set(a.holdRows(d.map(e=>e.id_aa),null!=(i=null==(l=o.rows[e-1])?void 0:l.id_aa)?i:null,void 0,s));if((0,_.nk)(f,a.view().keys)&&(tA.current=null),null!=D){let e=new Set(D);for(let t of d){let n=o.resolveId(t.id_aa);null!=n&&e.delete(n)&&p.has(t.id_aa)&&eF.current.push(n)}e.size<D.size&&(null==q||q(e))}if(null!=c&&c.index>=e&&c.index<=t){let t=a.view(),n=e<(null==t.blankKey?t.rows.length:t.rows.length-1)?e:Math.max(0,e-1);tI.moveTo(n,c.col),tI.focusGrid()}return p.size>0&&u&&tI.offerUndo(),p.size},dropBlank:function(e){var t,n;let l=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!a.dropsBlank())return 0;let r=a.view(),i=null==(t=e_.get())?void 0:t.key,s=[];for(let t of e){let e=r.keys.indexOf(t),l=r.rows[e],a=null==l?null:null!=(n=r.resolveId(l.id_aa))?n:null,o=(0,C.wR)(l,{here:i===t,open:null!=a&&a===x,busy:null!=a&&(null==u?void 0:u.busy.has(a))===!0});"wait"===o?eK.current.add(t):eK.current.delete(t),"drop"===o&&s.push(e)}s.sort((e,t)=>t-e);let o=s[0],d=0;for(let[e,t]of s.entries()){let n=s[e+1];n!==t-1&&null!=o&&(d+=tI.deleteRows(t,o,{auto:!0,offer:l}),o=n)}return d},dropWaitingBlank:()=>{eK.current.size>0&&tI.dropBlank([...eK.current])},removeFile:(e,t)=>{var n,l,r,i,s;let o=a.view(),d=(0,E.$V)(o.keys,e,null!=(i=null==(n=e_.get())?void 0:n.index)?i:0),c=o.keys[d]===e?o.rows[d]:null,f=null==c?null:null!=(s=o.resolveId(c.id_aa))?s:null;if(null==c||null==f||!eV||K||(null==u?void 0:u.busy.has(f))===!0||!c.reference_filenames.includes(t))return;let p=null==(l=document.getElementById(ej(ek,e,"files")))?void 0:l.querySelector("[data-chip]");null==(r=(0,h.Ny)())||r.chipOut((null==p?void 0:p.dataset.chip)===t?p:null),a.holdFile(f,t)&&tI.offerUndo()},leaveRow:e=>{a.leave(e)&&tI.offerUndo()},offerUndo:()=>{let{holding:e,filesHeld:t}=a.view();h.nO.message(function(e,t){let n=1===e?"Task deleted":"".concat(e.toLocaleStr
1ing("en-US")," tasks deleted"),l=1===t?"File removed":"".concat(t.toLocaleString("en-US")," files removed");return 0===t?n:0===e?l:"".concat(n,", ").concat(l.toLowerCase())}(e,t),{id:V,duration:G.pV,action:{label:"Undo",onClick:()=>tI.undoDelete()}})},undoDelete:()=>{var e,t;let n=a.restoreRows();h.nO.dismiss(V);let l=eF.current;eF.current=[],l.length>0&&null!=D&&(null==q||q(new Set([...D,...l])));let r=a.view().rows.findIndex(e=>null!=e&&e.id_aa===n.at(-1));r>=0&&tI.moveTo(r,null!=(t=null==(e=tI.at())?void 0:e.col)?t:"input"),tI.focusGrid()},abandonEdit:e=>{if(eO.current)return;let t=e_.get();if((null==t?void 0:t.key)!==e||!t.editing)return;let n=a.view(),l=n.rows[(0,E.$V)(n.keys,e,t.index)];null!=l&&a.abandon(l.id_aa)&&tI.offerUndo(),e_.set({...t,editing:!1}),(null==document.activeElement||document.activeElement===document.body)&&tI.focusGrid()},addRow:e=>{let t=e===S.Im?a.view().blankKey:a.addRow(e),n=a.view().rows.findIndex(e=>null!=e&&e.id_aa===t);n>=0&&tI.moveTo(n,"input"),tI.focusGrid()},openCell:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];K||null!=eq.current||b(e,t)},expand:(e,t)=>{var n,l,r;let i=a.view(),s=i.rows[(0,E.$V)(i.keys,e,null!=(l=null==(n=e_.get())?void 0:n.index)?l:0)],u=null==s?null:null!=(r=i.resolveId(s.id_aa))?r:null;null==s||null==u||K||(tI.stopEdit(e),a.commit(s.id_aa),"input"===t?null==y||y(u,null):b(u))},revertAnswer:e=>{var t,n;let l=a.view(),r=l.rows[(0,E.$V)(l.keys,e,null!=(n=null==(t=e_.get())?void 0:t.index)?n:0)],i=eI.current;null!=r&&(null==i?void 0:i.key)===e&&a.revert(r.id_aa,"rubric",i.original),tI.endEdit(null)},readCategories:()=>(0,j.rF)(a.view().tasks),rowCommand:e=>{let t=tI.at();if(null==t)return;let n=null==Y?void 0:Y.selection(tI.sheetContext());"insert"===e?tI.insertBelow(t):null!=n?tI.deleteRows(n.top,n.bottom):tI.deleteRow(t.key)},sheetContext:()=>({grid:a,cursor:e_,withCategory:e9,withFiles:tn,imported:f,takesEdits:eV&&!K,at:tI.at,rows:()=>e1(a.view()),page:()=>eC(ei.current),reveal:tI.reveal,openPaste:tI.paste,undoDelete:tI.undoDelete,dropBlank:(e,t)=>tI.dropBlank(e,t),toast:h.nO}),where:()=>{let e=e_.get(),t=e_.anchor();return[null==e?void 0:e.key,null==e?void 0:e.col,null==e?void 0:e.editing,null==t?void 0:t.key,null==t?void 0:t.col,a.lastChange()].join()},withSheet:(e,t,n)=>{null!=Y&&0===eB.current.length?e(Y,tI.sheetContext()):null!=t?(t.preventDefault(),tI.wait({press:t.nativeEvent})):tI.wait({run:()=>e(Y,tq.current.sheetContext()),...n})},typeText:e=>{let t=()=>{let t=tI.at();null!=t&&""!==e&&(tI.typesInto(t)?tI.edit(t,e):"input"===t.col&&tI.activate(t))};0===eB.current.length?t():tI.wait({run:t})},copyLater:()=>(function(e){let t=e.then(e=>null!=e?e:Promise.reject(Error("Nothing to copy")));(async()=>navigator.clipboard.write([new ClipboardItem({"text/plain":t.then(e=>new Blob([e],{type:"text/plain"}))})]))().catch(async()=>{await e!=null&&h.nO.message("Couldn't copy. Try again.")})})(new Promise(e=>tI.withSheet((t,n)=>e(t.copyLater(n)),void 0,{drop:()=>e(null)}))),wait:e=>{eB.current.push({...e,was:tI.where()}),eB.current.length>1||et().then(e=>{eP(()=>e);let t=eB.current;eB.current=[],e.drain(t,tI.where(),ei.current,h.nO)},()=>{let e=eB.current.some(e=>"paste"===e.what);for(let{drop:e}of eB.current)null==e||e();eB.current=[],h.nO.message(e?"Paste didn't go in: the table's tools didn't load. Paste again.":"Couldn't load the sheet tools. Try again.",{id:"build-sheet-load"})})},resizeStart:(e,t)=>{let n=eh.current,l=e.currentTarget,r=l.parentElement;if(0!==e.button||null==n||null==r)return;e.preventDefault(),l.setPointerCapture(e.pointerId);let i=e.clientX,s=r.getBoundingClientRect().width,a=i,u=0,o=()=>({...ti,[t]:T(t,s+a-i)}),d=()=>{u=0,ep(n,M(e9,tn,o()))},c=e=>{a=e.clientX,0===u&&(u=requestAnimationFrame(d))},h=e=>{l.removeEventListener("pointermove",c),l.removeEventListener("pointerup",h),l.removeEventListener("pointercancel",h),cancelAnimationFrame(u),delete l.dataset.dragging,"pointercancel"===e.type||a===i?ep(n,M(e9,tn,ti)):tq.current.keepWidths(o())};l.dataset.dragging="",l.addEventListener("pointermove",c),l.addEventListener("pointerup",h),l.addEventListener("pointercancel",h)},resetWidth:e=>{let{[e]:t,...n}=ti;Object.keys(n).length<Object.keys(ti).length&&tI.keepWidths(n)},keepWidths:e=>{ts(e),null!=tc&&A(tc,e)},toggle:(e,t)=>
1{let n=new Set(D);t?n.add(e):n.delete(e),null==q||q(n)}},tq=(0,i.useRef)(tI);(0,i.useLayoutEffect)(()=>{tq.current=tI}),(0,i.useEffect)(()=>a.onLeftBlank(e=>queueMicrotask(()=>tq.current.dropBlank(e))),[a]),(0,i.useEffect)(()=>e_.subscribe(()=>{eK.current.size>0&&queueMicrotask(()=>tq.current.dropWaitingBlank())}),[e_]);let tF=null==u?void 0:u.busy;(0,i.useEffect)(()=>tq.current.dropWaitingBlank(),[x,tF]);let{pick:tL}=tw,tH=(0,i.useMemo)(()=>({openCell:(e,t)=>tq.current.openCell(e,t),expand:(e,t)=>tq.current.expand(e,t),check:(e,t)=>tq.current.toggle(e,t),select:(e,t,n)=>tq.current.select(e,t,n),endEdit:e=>tq.current.endEdit(e),stopEdit:e=>tq.current.stopEdit(e),abandonEdit:e=>tq.current.abandonEdit(e),leaveRow:e=>tq.current.leaveRow(e),carriedAway:()=>eO.current,revertAnswer:e=>tq.current.revertAnswer(e),readCategories:()=>tq.current.readCategories(),blockEdit:(e,t)=>tq.current.blockEdit(e,t),addRow:e=>tq.current.addRow(e),deleteRow:e=>tq.current.deleteRow(e),removeFile:(e,t)=>tq.current.removeFile(e,t),setDropRow:tb,pick:tL,preview:e=>{var t;return null==(t=ty.current)?void 0:t.call(ty,e)}}),[tL]),tK=(0,i.useMemo)(()=>({start:(e,t)=>tq.current.resizeStart(e,t),reset:e=>tq.current.resetWidth(e)}),[]);(0,i.useEffect)(()=>e_.subscribe(()=>ev(ew.current,e_,ek)),[e_,ek]),(0,i.useLayoutEffect)(()=>{let e=e_.get(),t=ew.current;null!=t&&null!=e&&em(t,document.getElementById(ej(ek,e.key,e.col)))},[e_,ek,ta.template]);let tz=(0,i.useRef)(0),tP=eJ.holding+eJ.filesHeld;(0,i.useEffect)(()=>{tz.current>0&&0===tP&&h.nO.dismiss(V),0===eJ.holding&&(eF.current=[]),tz.current=tP},[tP,eJ.holding]),(0,i.useEffect)(()=>()=>{tz.current>0&&!eO.current&&h.nO.dismiss(V)},[]),(0,i.useEffect)(()=>null==ez?void 0:ez.carryAlong(a),[ez,a]),(0,i.useEffect)(()=>{if(!eV||null!=ez)return;let e=()=>void et().then(e=>eP(()=>e),()=>void 0);if("function"!=typeof window.requestIdleCallback){let t=setTimeout(e,1500);return()=>clearTimeout(t)}let t=window.requestIdleCallback(e);return()=>window.cancelIdleCallback(t)},[eV,ez]),(0,i.useEffect)(()=>{var e;(K||!eV)&&(null==(e=e_.get())?void 0:e.editing)===!0&&tq.current.endEdit(null),tp.set(null)},[K,eV,e_,tp]),(0,i.useEffect)(()=>{tp.set(null)},[tp,tk]),(0,i.useEffect)(()=>{let e=e_.get();if(null==e||e.key===E.GA)return;let t=(0,E.$V)(tk,e.key,e.index);t<0?e_.set(null):(tk[t]!==e.key||t!==e.index)&&e_.set({...e,key:tk[t],index:t,editing:e.editing&&tk[t]===e.key},e_.anchor())},[e_,tk]);let tB=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(null==x||tB.current===x)return;let{rows:e,resolveId:t}=a.view(),n=e.findIndex(e=>null!=e&&t(e.id_aa)===x);n<0||(tB.current=x,tj.scrollToIndex(n,{align:"auto"}))},[x,eJ,a,tj]);let tW=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(null==O)return;let e=tW.current,t=(null==e?void 0:e.request)!==O;if(t)tq.current.focusGrid();else if(e.tries>=20)return;let{rows:n,resolveId:l}=a.view(),r=n.findIndex(e=>{var t;return null!=e&&(null!=(t=l(e.id_aa))?t:e.id_aa)===O.id});if(r<0){tW.current={request:O,tries:(t?0:e.tries)+1};return}tW.current={request:O,tries:20},tq.current.moveTo(r,"wanted"===O.cell?"wanted":"input")},[O,a,eJ]),(0,i.useEffect)(()=>(0,U.C0)(a,e_,()=>ei.current),[a,e_]);let tG=(0,i.useRef)(null);(0,i.useLayoutEffect)(()=>{let e=(0,U.m8)(L);null!=e&&(tG.current=e,eI.current=e.answerStart)},[L]);let tU=tS.length>0;(0,i.useLayoutEffect)(()=>{let e=tG.current;if(null==e)return;let t=document.activeElement;if(null!=e.editor&&eg(ei.current,ew.current,t)){tG.current=null,t.setSelectionRange(e.editor.start,e.editor.end,e.editor.backward?"backward":"forward");return}(null==e.editor||tU)&&(tG.current=null,tq.current.focusGrid(),ev(ew.current,e_,ek))}),(0,i.useLayoutEffect)(()=>()=>{var e,t,n;let l=document.activeElement,r=(null==(e=ei.current)?void 0:e.contains(l))?{editor:eg(ei.current,ew.current,l)?{start:null!=(t=l.selectionStart)?t:0,end:null!=(n=l.selectionEnd)?n:0,backward:"backward"===l.selectionDirection}:null,answerStart:eI.current}:null;eO.current=(0,U.i0)(a,r)},[a]);let t$=e=>({id:ej(ek,E.GA,e),col:e,cursor:e_}),tZ=(0,l.jsxs)("div",{"aria-busy":K||void 0,className:(0,c.cn)("flex min-h-0 flex-col overflow-hidden rounded-[10px] border bg-background",K&&"cursor-progress",Z),children:[null!=u&&tw.input,(0,l.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[(0,l.jsxs)("div",{ref:ei,onScroll:e=>{eE(e.currentTarget,eh.current,eU),tp.set(null)},onPaste:tI.editorPaste,onInput:()=>{eA.current=null},onPointerDownCapture:e=>{eD.current=e.pointerType,eT.current={x:e.clientX,y:e.clientY},eM.current=null},onMouseMove:tI.drag,onMouseUp:tI.release,onMouseLeave:tI.leave,onWheel:()=>{let e=eM.current;eM.current=e&&{...e,dragged:!0}},className:"group/grid relative min-h-0 flex-1 touch-manipulation overflow-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:{scrollPaddingTop:40},children:[(0,l.jsx)("textarea",{ref:ew,role:"combobox","aria-label":"Selected cell","aria-controls":"".concat(ek,"-grid"),"aria-expanded":!1,"aria-haspopup":"grid","aria-autocomplete":"none",rows:1,spellCheck:!1,autoComplete:"off",inputMode:"none",onKeyDown:function(e){if(e.nativeEvent.isComposing||229===e.keyCode)return;let t=tI.at();if(null==t)return;let n=(0,E.ZO)(e);if("copy"===n){let t=ew.current;if(null==t)return;null!=Y&&0===eB.current.length?Y.copyKey(tI.sheetContext(),t):(e.preventDefault(),tI.copyLater());return}let l=(0,E.Lj)(e),r=(0,E.s5)(e),i="Tab"===e.key&&!e.ctrlKey&&!e.metaKey&&!e.altKey,s=(0,E.W2)(e);if(eB.current.length>0&&(null!=l||null!=n||null!=r||i||s||null!=(0,E.uR)(e)||/^(Escape|Enter|F2|Delete|Backspace)$/.test(e.key)))return void tI.withSheet(()=>{},e);if(null!=l){e.preventDefault(),e.shiftKey?tI.withSheet((e,t)=>
1e.extend(t,l),e):tI.move(l);return}if(s&&tI.openPanel(t))return void e.preventDefault();if("selectAll"===n){e.preventDefault(),tI.withSheet((e,t)=>e.selectAll(t),e);return}if("undo"===r||"redo"===r){let t="undo"===r?a.nextUndo():a.nextRedo();if(null==t)return;e.preventDefault(),"delete"===t?tI.undoDelete():tI.withSheet((e,t)=>e.undoChange(t,r),e);return}if(null!=r){e.preventDefault(),e.repeat||tI.rowCommand(r);return}if("Escape"===e.key&&null!=e_.anchor()){e.preventDefault(),e_.set(t,null);return}if("Tab"===e.key){i&&tI.tab(e.shiftKey)&&e.preventDefault();return}if("Enter"===e.key||"F2"===e.key)e.preventDefault(),tI.activate(t);else if(" "===e.key&&e$)e.preventDefault(),tI.check(t);else if("Delete"===e.key||"Backspace"===e.key)e.preventDefault(),eV||null==W||W(),tI.clear();else{let n=(0,E.uR)(e);if(null==n)return;if(!tI.typesInto(t)){let l=a.view().rows[t.index],r=null!=l&&("input"===t.col&&(0,_.wT)(l.prompt)||"wanted"===t.col&&eZ(l));("character"===n||r)&&e.preventDefault(),"character"!==n||eV||null==W||W(),r&&tI.activate(t);return}"character"===n&&(e.preventDefault(),tI.edit(t,e.key))}},onFocus:()=>{null==e_.get()&&e2>0&&tI.moveTo(0,"input")},onCopy:e=>{e.currentTarget.value="",null==Y?(e.preventDefault(),tI.copyLater()):Y.copyEvent(tI.sheetContext(),e.clipboardData)&&e.preventDefault()},onPaste:e=>{let t=tI.at(),n=e.clipboardData.getData("text/plain"),l=e.clipboardData.getData("text/html");e.preventDefault(),null!=t&&""!==n&&(eV||null==W||W(),/[\t\r\n]/.test(n)||null!=e_.anchor()||0!==eB.current.length?tI.withSheet((e,t)=>e.pasteText(t,n,l),void 0,{what:"paste"}):tI.paste(t,n))},onCompositionStart:()=>{let e=tI.at();ey(null!=e&&tI.typesInto(e))},onCompositionEnd:function(){var e;let t=ew.current,n=null!=(e=null==t?void 0:t.value)?e:"";null!=t&&(t.value=""),ey(!1),tI.typeText(n)},onInput:e=>{let t=e.currentTarget.value;e.nativeEvent instanceof InputEvent&&e.nativeEvent.isComposing||(e.currentTarget.value="",tI.typeText(t))},className:(0,c.cn)("absolute left-0 top-0 z-30 block resize-none overflow-hidden border-0 p-0 outline-none focus:outline-none focus:ring-0",ex?"bg-white px-3 py-[11px] text-[12.5px] leading-[18px] text-neutral-900 shadow-[inset_0_0_0_1px_hsl(var(--brand-purple))] data-[label]:pl-[7px] data-[label]:shadow-[inset_0_1px_hsl(var(--brand-purple)),inset_-1px_-1px_hsl(var(--brand-purple))]":"pointer-events-none bg-transparent text-transparent caret-transparent")}),(0,l.jsx)("fieldset",{role:"none",disabled:K,className:"contents",children:(0,l.jsxs)("div",{ref:eh,id:"".concat(ek,"-grid"),role:"grid","aria-label":"Tasks","aria-rowcount":e2+1,"aria-readonly":!eV||void 0,className:"w-full",style:{"--sheet-cols":ta.template,minWidth:ta.minWidth},children:[(0,l.jsxs)("div",{role:"row","aria-rowindex":1,className:(0,c.cn)("sticky top-0 z-30 grid h-10 border-b bg-neutral-50",tr),children:[e$?(0,l.jsx)("span",{role:"columnheader",className:"flex items-center pl-2.5",children:(0,l.jsx)(h.Sc,{"aria-label":"Select all tasks",checked:!!tv||!!tg&&"indeterminate",selectAllOf:ei,onCheckedChange:()=>q(new Set(tv?[]:e7))})}):(0,l.jsx)("span",{role:"columnheader","aria-label":"Row"}),(0,l.jsx)(eR,{...t$("input"),resize:tK,label:"Tasks",help:"What the model is asked to do.",count:e6.input,bordered:!0}
1),e9&&(0,l.jsx)(eR,{...t$("category"),resize:tK,label:"Category",help:"Groups results in the report.",bordered:!0}),tn&&(0,l.jsx)(eR,{...t$("files"),resize:tK,label:"Supporting files",help:"Documents given to the model with this task.",bordered:!0}),(0,l.jsx)(eR,{...t$("wanted"),label:_.ye[v],help:_.gp[v],info:!0,count:e6.wanted})]}),(0,l.jsxs)("div",{ref:tO,className:"relative",style:{height:tj.getTotalSize()},children:[tS.map(e=>(0,l.jsx)(ec,{grid:a,cursor:e_,gridId:ek,rowKey:String(e.key),index:e.index,top:e.start-40,last:e.index===e2-1&&!tD,blank:!eY&&!tD&&null!=eJ.blankKey&&e.index===e2-1,columns:tr,withCategory:e9,withFiles:tn,uploads:B,readOnly:g,saved:w,imported:f,gradingMode:v,canOpenInput:null!=y,openId:x,openField:k,selection:e$?D:null,files:u,missingFiles:e8,dropRow:tx,actions:tH},e.key)),null!=ez&&(0,l.jsx)(ez.RangeOverlay,{cursor:e_,grid:a,withCategory:e9,withFiles:tn,columns:tr,rowHeight:40})]})]})})]}),eG.left&&(0,l.jsx)("span",{"aria-hidden":!0,"data-edge":"left",className:(0,c.cn)(eN,"left-0 bg-gradient-to-r")}),eG.right&&(0,l.jsx)("span",{"aria-hidden":!0,"data-edge":"right",className:(0,c.cn)(eN,"right-0 bg-gradient-to-l")}),(0,l.jsx)(h.N$,{target:ei,content:eh,inset:[40,0],className:"z-40"}),(0,l.jsx)(h.N$,{target:ei,content:eh,axis:"x",inset:[0,12],className:"z-40"}),eG.scrolls&&!eG.atEnd&&(0,l.jsxs)(d.$,{variant:"secondary",size:"sm",onClick:()=>tj.scrollToIndex(e2-1,{align:"end"}),className:"absolute bottom-2.5 right-3 z-40 rounded-full px-3 shadow-md [&_svg]:h-4 [&_svg]:w-4",children:[(0,l.jsx)(p.A,{}),"Jump to end"]})]}),(0,l.jsxs)("div",{className:"shrink-0 border-t bg-neutral-50",children:[(0,l.jsxs)("div",{className:"grid h-10 grid-cols-[auto_minmax(0,1fr)_auto_auto] items-center gap-3 pl-1.5 pr-3",children:[(0,l.jsx)("div",{children:!g&&(0,l.jsx)(h.$n,{variant:"secondary",size:"sm",press:!1,icon:(0,l.jsx)(m.A,{}),disabled:K,onClick:()=>tI.addRow(S.Im),children:"Add task"})}),(0,l.jsx)(eL,{grid:a,cursor:e_,imported:f,gradingMode:v}),(0,l.jsx)(eb,{grid:a}),(0,l.jsxs)("span",{className:"flex min-w-[52px] items-center justify-end gap-1 text-[11.5px] tabular-nums text-neutral-500",children:[null!=ez&&(0,l.jsx)(ez.RangeStatus,{cursor:e_,grid:a,withCategory:e9,withFiles:tn,separated:!0}),(0,_.wp)(eJ.taskCount),e$&&(0,l.jsxs)(l.Fragment,{children:[" \xb7 ",D.size.toLocaleString("en-US")," selected",(0,l.jsx)(d.$,{variant:"ghost",size:"sm",onClick:()=>q(null),className:"h-6 px-1.5 text-[11.5px] hover:no-underline",children:"Clear"})]})]})]}),(0,l.jsx)(eH,{grid:a,readOnly:g}),z]})]}),tX=(0,l.jsxs)("div",{ref:tm,onPointerMove:e=>(function(e,t){if("mouse"!==e.pointerType||!(e.target instanceof Element)||null!=e.target.closest("[data-gutter], [data-gutter-strip]"))return;let n=e.target.closest("[data-row]");t(null==n?null:Number(n.dataset.row),e.clientY)})(e,tI.hoverRow),onPointerLeave:e=>{"mouse"===e.pointerType&&tp.set(null)},className:(0,c.cn)("relative flex min-h-0 flex-col",P&&"pr-7"),children:[tZ,tf&&(0,l.jsx)("div",{"data-gutter-strip":!0,onPointerMove:e=>{"mouse"===e.pointerType&&tI.gutterHover(e.clientY)},className:(0,c.cn)("absolute inset-y-0 w-7 max-sm:w-4",P?"right-0":"left-full")}),tf&&(0,l.jsx)(eu,{hover:tp,inside:P,onDelete:tH.deleteRow})]}),tJ=null!=td&&(0,l.jsx)(es,{show:ty,orgSlug:to,draftId:td});return null==H?(0,l.jsxs)(l.Fragment,{children:[tX,tJ]}):(0,l.jsxs)("div",{className:"flex min-h-0 flex-col gap-3",children:[e5&&H,tX,tJ]})}function es(e){let t,n,s,a,u,o,d=(0,r.c)(13),{show:c,orgSlug:h,draftId:f}=e,[p,m]=(0,i.useState)(null),[v,g]=(0,i.useState)(!1);return(d[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>e=>{m(e),g(!0)},n=[],d[0]=t,d[1]=n):(t=d[0],n=d[1]),(0,i.useImperativeHandle)(c,t,n),null==p)?null:(d[2]!==f||d[3]!==h||d[4]!==p.id?(s=e=>"".concat((0,q.mB)(h,"benchmarks/".concat(f,"/reference-files/").concat(e)),"?id_aa=").concat(encodeURIComponent(p.id)),d[2]=f,d[3]=h,d[4]=p.id,d[5]=s):s=d[5],d[6]===Symbol.for("react.memo_cache_sentinel")?(a=()=>g(!1),u=()=>m(null),d[6]=a,d[7]=u):(a=d[6],u=d[7]),d[8]!==v||d[9]!==p.index||d[10]!==p.names||d[11]!==s?(o=(0,l.jsx)(el,{names:p.names,start:p.index,urlOf:s,open:v,onClose:a,onExitComplete:u}),d[8]=v,d[9]=p.index,d[10]=p.names,d[11]=s,d[12]=o):o=d[12],o)}function ea(){let e=null,t=new Set;return{get:()=>e,set:n=>{if((null==n?void 0:n.key)!==(null==e?void 0:e.key)||(null==n?void 0:n.top)!==(null==e?void 0:e.top))for(let l of(e=n,t))l()},subscribe:e=>(t.add(e),()=>void t.delete(e))}}let eu=(0,i.memo)(function(e){let t,n,s,a,u,o,d=(0,r.c)(16),{hover:h,inside:f,onDelete:p}=e,m=(0,i.useSyncExternalStore)(h.subscribe,h.get,h.get);if(null==m)return null;let g=f?"right-0":"left-full";d[0]!==g?(t=(0,c.cn)("absolute z-10 flex w-7 items-center justify-center max-sm:w-4",g),d[0]=g,d[1]=t):t=d[1],d[2]!==m.top?(n={top:m.top,height:40},d[2]=m.top,d[3]=n):n=d[3];let w="Delete task ".concat(m.number);return d[4]!==m.key||d[5]!==h||d[6]!==p?(s=()=>{h.set(null),p(m.key)},d[4]=m.key,d[5]=h,d[6]=p,d[7]=s):s=d[7],d[8]===Symbol.for("react.memo_cache_sentinel")?(a=(0,l.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded group-hover/x:bg-neutral-100",children:(0,l.jsx)(v.A,{className:"h-3.5 w-3.5"})}),d[8]=a):a=d[8],d[9]!==w||d[10]!==s?(u=(0,l.jsx)("button",{type:"button",tabIndex:-1,"aria-label":w,title:"Delete task (Ctrl or ⌘+Alt+−)",onMouseDown:J,onClick:s,className:"group/x flex h-full w-full items-center justify-center text-neutral-400 hover:text-neutral-900",children:a}
1),d[9]=w,d[10]=s,d[11]=u):u=d[11],d[12]!==t||d[13]!==n||d[14]!==u?(o=(0,l.jsx)("div",{"data-gutter":!0,className:t,style:n,children:u}),d[12]=t,d[13]=n,d[14]=u,d[15]=o):o=d[15],o}),eo=[];function ed(e,t){return e.taskCount===t.taskCount&&e.withCategory===t.withCategory&&e.withFiles===t.withFiles&&e.completeness===t.completeness&&(0,_.AE)(e.counts.input,t.counts.input)&&(0,_.AE)(e.counts.wanted,t.counts.wanted)&&(0,_.nk)(e.keys,t.keys)&&(0,_.nk)(e.storedIds,t.storedIds)&&e.blankKey===t.blankKey&&e.holding===t.holding&&e.filesHeld===t.filesHeld}let ec=(0,i.memo)(function(e){let t,n,s,a,u,o,d,f,p,v,g,w,x,b,y,k,C,N,R,O=(0,r.c)(128),{grid:D,cursor:M,gridId:T,rowKey:A,index:q,top:F,last:L,blank:H,columns:K,withCategory:z,withFiles:P,uploads:W,readOnly:U,saved:$,imported:Z,gradingMode:X,canOpenInput:V,openId:Y,openField:Q,selection:ee,files:et,missingFiles:en,dropRow:el,actions:er}=e;O[0]!==q?(t=e=>(function(e,t){var n,l,r,i;let s=e.rows[t],a=null==s?void 0:s.id_aa;return{row:s,id:null==s?null:null!=(n=e.resolveId(s.id_aa))?n:null,heldPrompt:null!=a&&e.held.has("".concat(a,":prompt")),heldRubric:null!=a&&e.held.has("".concat(a,":rubric")),heldCategory:null!=a&&e.held.has("".concat(a,":category")),invalidPrompt:null==a?null:null!=(l=e.invalid.get("".concat(a,":prompt")))?l:null,invalidRubric:null==a?null:null!=(r=e.invalid.get("".concat(a,":rubric")))?r:null,invalidCategory:null==a?null:null!=(i=e.invalid.get("".concat(a,":category")))?i:null}})(e,q),O[0]=q,O[1]=t):t=O[1];let ei=t,{row:es,id:ea,heldPrompt:eu,heldRubric:eo,heldCategory:ed,invalidPrompt:ec,invalidRubric:ef,invalidCategory:ep}=(0,G.Fm)(D,ei,ex);O[2]!==M||O[3]!==A?(n=()=>M.rowState(A),O[2]=M,O[3]=A,O[4]=n):n=O[4];let em=n,ev=(0,i.useRef)(null);O[5]!==er||O[6]!==A?(s=()=>{let e=ev.current;return()=>{(null==e?void 0:e.isConnected)!==!0&&er.abandonEdit(A)}},a=[er,A],O[5]=er,O[6]=A,O[7]=s,O[8]=a):(s=O[7],a=O[8]),(0,i.useEffect)(s,a);let eg=(0,i.useSyncExternalStore)(M.subscribe,em,em);O[9]!==eg?(u=(0,E.Ok)(eg),O[9]=eg,O[10]=u):u=O[10];let{col:eb,editing:ey,seed:ek}=u,eS=ey?eb:null,eC=q+1,eN=null!=ea&&(null==ee?void 0:ee.has(ea))===!0,eE=(null==et?void 0:et.enabled)===!0&&!U&&null!=ea&&!et.busy.has(ea);O[11]!==er||O[12]!==A?(o=e=>{(0,j.CK)(document.hasFocus())&&(er.leaveRow(e),er.stopEdit(A))},O[11]=er,O[12]=A,O[13]=o):o=O[13];let eR=o,eI="input"===eb,eF="category"===eb,eL="files"===eb,eH="wanted"===eb,eK="input"===eS,ez="category"===eS,eB="wanted"===eS,eW=eK?eC:0,eG=eB?eC:0,eU=eB?ek:null,eZ=ez?ek:null;O[14]!==er||O[15]!==V||O[16]!==M||O[17]!==D||O[18]!==T||O[19]!==eu||O[20]!==ea||O[21]!==eK||O[22]!==eW||O[23]!==eI||O[24]!==ec||O[25]!==eR||O[26]!==Q||O[27]!==Y||O[28]!==U||O[29]!==es||O[30]!==A?(d=null!=es&&(0,l.jsx)(eD,{id:ej(T,A,"input"),rowKey:A,selected:eI,onSelect:er.select,task:es,number:eW,readOnly:U,editing:eK,blank:es.id_aa.startsWith(S.a7)&&""===es.prompt,held:eu,invalid:ec,open:null!=ea&&ea===Y&&"prompt"===Q,onExpand:null!=ea&&V?()=>er.expand(A,"input"):null,onChange:e=>D.edit(es.id_aa,{prompt:e}),onBlur:()=>eR(es.id_aa),keys:{onCommit:(e,t)=>{t?D.confirm(es.id_aa):er.leaveRow(es.id_aa),er.endEdit(e)},onRevert:()=>{var e,t;D.revert(es.id_aa,"prompt",{prompt:null!=(t=null==(e=M.get())?void 0:e.original)?t:es.prompt}),er.endEdit(null)}}}),O[14]=er,O[15]=V,O[16]=M,O[17]=D,O[18]=T,O[19]=eu,O[20]=ea,O[21]=eK,O[22]=eW,O[23]=eI,O[24]=ec,O[25]=eR,O[26]=Q,O[27]=Y,O[28]=U,O[29]=es,O[30]=A,O[31]=d):d=O[31];let eX=d;O[32]!==er||O[33]!==ez||O[34]!==eZ||O[35]!==eF||O[36]!==M.typed||O[37]!==D||O[38]!==T||O[39]!==ed||O[40]!==ep||O[41]!==eC||O[42]!==es||O[43]!==A||O[44]!==z?(f=null!=es&&z&&(0,l.jsxs)("span",{id:ej(T,A,"category"),role:"gridcell","aria-selected":eF,onMouseDown:ez?void 0:e=>eh(e,er.select,A,"category"),className:(0,c.cn)(ew(eF),"border-r px-3 text-xs",ed&&"bg-amber-50 shadow-[inset_0_0_0_1.5px_theme(colors.amber.400)]",null!=ep&&eM),children:[(0,l.jsx)("span",{className:"truncate",children:(0,I.Zi)(es.category)}),ed&&(0,l.jsx)(eq,{help:eA}),null!=ep&&(0,l.jsx)(eq,{help:eT(ep,"Change it, or press Enter, then Esc, to take the stored version."),invalid:!0}),ez&&(0,l.jsx)(B,{label:"Category, row ".concat(eC),initial:null!=eZ?eZ:(0,I.Zi)(es.category),typed:null!=eZ,readOptions:er.readCategories,current:es.category,onTyped:M.typed,onDone:(e,t,n)=>{"blur"===n&&er.carriedAway()||(null!=e&&e!==es.category&&D.edit(es.id_aa,{category:e}),"key"===n&&ed&&D.keepHeld(es.id_aa,"category"),"esc"===n&&(ed||null!=ep)&&D.revert(es.id_aa,"category",{category:es.category}),(null!=e||"key"===n)&&D.commit(es.id_aa),"blur"===n?er.stopEdit(A):er.endEdit(t))}})]}),O[32]=er,O[33]=ez,O[34]=eZ,O[35]=eF,O[36]=M.typed,O[37]=D,O[38]=T,O[39]=ed,O[40]=ep,O[41]=eC,O[42]=es,O[43]=A,O[44]=z,O[45]=f):f=O[45];let eJ=f;O[46]!==er||O[47]!==et||O[48]!==eL||O[49]!==T||O[50]!==ea||O[51]!==en||O[52]!==U||O[53]!==es||O[54]!==A||O[55]!==eE||O[56]!==W||O[57]!==P?(p=null!=es&&P&&(0,l.jsx)(eP,{id:ej(T,A,"files"),rowKey:A,selected:eL,onSelect:er.select,chips:(0,_.yt)(es,null==en?null:en.has(es.id_aa)
1),readOnly:U||!W,busy:null!=ea&&(null==et?void 0:et.busy.has(ea))===!0,onAttach:eE?()=>er.pick({multiple:!0},e=>et.attach(ea,e)):null,onFill:eE?e=>er.pick({multiple:!1},t=>et.fill(ea,e,t[0])):null,onPreview:null==ea?null:(e,t)=>er.preview({id:ea,names:e,index:t}),onRemove:U||null==ea?null:e=>er.removeFile(A,e)}),O[46]=er,O[47]=et,O[48]=eL,O[49]=T,O[50]=ea,O[51]=en,O[52]=U,O[53]=es,O[54]=A,O[55]=eE,O[56]=W,O[57]=P,O[58]=p):p=O[58];let eV=p;O[59]!==er||O[60]!==M.typed||O[61]!==X||O[62]!==D||O[63]!==T||O[64]!==eo||O[65]!==ea||O[66]!==Z||O[67]!==ef||O[68]!==eR||O[69]!==Q||O[70]!==Y||O[71]!==U||O[72]!==es||O[73]!==A||O[74]!==$||O[75]!==eB||O[76]!==eG||O[77]!==eU||O[78]!==eH?(v=null!=es&&(0,l.jsx)(e$,{id:ej(T,A,"wanted"),rowKey:A,selected:eH,onSelect:er.select,task:es,number:eG,imported:Z,gradingMode:X,readOnly:U,saved:$,held:eo,invalid:ef,open:null!=ea&&ea===Y&&"wanted"===Q,onOpen:null==ea?null:e=>er.openCell(ea,e),editing:eB,seed:eU,onExpand:null==ea?null:()=>er.expand(A,"wanted"),onAnswer:e=>D.edit(es.id_aa,{answer:e.trim()||null}),onTyped:M.typed,onBlock:er.blockEdit,onBlur:()=>eR(es.id_aa),keys:{onCommit:(e,t)=>{t?D.confirm(es.id_aa):D.commit(es.id_aa),er.endEdit(e)},onRevert:()=>er.revertAnswer(A)}}),O[59]=er,O[60]=M.typed,O[61]=X,O[62]=D,O[63]=T,O[64]=eo,O[65]=ea,O[66]=Z,O[67]=ef,O[68]=eR,O[69]=Q,O[70]=Y,O[71]=U,O[72]=es,O[73]=A,O[74]=$,O[75]=eB,O[76]=eG,O[77]=eU,O[78]=eH,O[79]=v):v=O[79];let eY=v;O[80]!==er||O[81]!==H||O[82]!==L||O[83]!==eC||O[84]!==U||O[85]!==es?(g=null!=es&&!U&&!L&&!H&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{type:"button",tabIndex:-1,"aria-label":"Add a task after row ".concat(eC),onMouseDown:J,onClick:()=>er.addRow(es.id_aa),className:(0,c.cn)("peer absolute -bottom-2.5 left-1.5 z-10 flex h-5 w-5 items-center justify-center rounded-full bg-brand-purple text-white","pointer-events-none opacity-0 transition-opacity duration-100 ease-out motion-reduce:transition-none [@media(hover:hover)]:group-hover/gutter:pointer-events-auto [@media(hover:hover)]:group-hover/gutter:opacity-100 [@media(hover:hover)]:group-hover/gutter:duration-0 [@media(hover:none)]:group-data-[selected]/row:pointer-events-auto [@media(hover:none)]:group-data-[selected]/row:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100"),children:(0,l.jsx)(m.A,{className:"h-3.5 w-3.5"})}),(0,l.jsx)("span",{className:"pointer-events-none absolute inset-x-0 -bottom-px hidden h-0.5 bg-brand-purple [@media(hover:hover)]:peer-hover:block"})]}),O[80]=er,O[81]=H,O[82]=L,O[83]=eC,O[84]=U,O[85]=es,O[86]=g):g=O[86];let eQ=g,e1=eC+1,e2=""!==eg||void 0;O[87]!==er||O[88]!==et||O[89]!==ea||O[90]!==eE?(w=eE&&{onDragOver:e=>{e_(e)&&(e.preventDefault(),e.stopPropagation(),er.setDropRow(ea))},onDragLeave:()=>er.setDropRow(e=>e===ea?null:e),onDrop:e=>{e_(e)&&(e.preventDefault(),e.stopPropagation(),er.setDropRow(null),et.attach(ea,Array.from(e.dataTransfer.files)))}},O[87]=er,O[88]=et,O[89]=ea,O[90]=eE,O[91]=w):w=O[91];let e3=(null!=es&&null!=Y&&ea===Y||eN)&&"bg-neutral-50",e5=el===ea&&null!=ea&&"bg-brand-mint/20 outline outline-1 -outline-offset-1 outline-brand-green-dark";O[92]!==K||O[93]!==e3||O[94]!==e5?(x=(0,c.cn)("group/row absolute left-0 top-0 grid w-full border-b hover:z-10 data-[selected]:z-20",K,e3,e5),O[92]=K,O[93]=e3,O[94]=e5,O[95]=x):x=O[95];let e4="translateY(".concat(F,"px)");return O[96]!==e4?(b={height:40,transform:e4},O[96]=e4,O[97]=b):b=O[97],O[98]!==er||O[99]!==H||O[100]!==eN||O[101]!==ea||O[102]!==eQ||O[103]!==eC||O[104]!==ee?(y=null!=ee&&null!=ea?(0,l.jsxs)("span",{role:"rowheader",className:"group/gutter flex items-center pl-2.5",onMouseDown:e0,children:[(0,l.jsx)(h.Sc,{tabIndex:-1,"aria-label":"Select row ".concat(eC),checked:eN,onCheckedChange:e=>er.check(ea,!0===e)}),eQ]}):H?(0,l.jsx)("span",{role:"rowheader","aria-label":"New task"}):(0,l.jsxs)("span",{role:"rowheader",className:"group/gutter flex items-center pl-3 text-[11px] tabular-nums text-neutral-400",children:[eC,eQ]}),O[98]=er,O[99]=H,O[100]=eN,O[101]=ea,O[102]=eQ,O[103]=eC,O[104]=ee,O[105]=y):y=O[105],O[106]!==es||O[107]!==z?(k=void 0===es&&(0,l.jsx)(eO,{withCategory:z}),O[106]=es,O[107]=z,O[108]=k):k=O[108],O[109]!==es?(C=null===es&&(0,l.jsx)("span",{role:"gridcell",className:"col-span-full col-start-2 flex items-center px-3 text-xs text-neutral-400",children:"This task can't be read."}),O[109]=es,O[110]=C):C=O[110],O[111]!==eJ||O[112]!==eV||O[113]!==eX||O[114]!==es||O[115]!==eY?(N=null!=es&&(0,l.jsxs)(l.Fragment,{children:[eX,eJ,eV,eY]}),O[111]=eJ,O[112]=eV,O[113]=eX,O[114]=es,O[115]=eY,O[116]=N):N=O[116],O[117]!==q||O[118]!==e1||O[119]!==e2||O[120]!==w||O[121]!==x||O[122]!==b||O[123]!==y||O[124]!==k||O[125]!==C||O[126]!==N?(R=(0,l.jsxs)("div",{ref:ev,role:"row","aria-rowindex":e1,"data-row":q,"data-selected":e2,...w,className:x,style:b,children:[y,k,C,N]}),O[117]=q,O[118]=e1,O[119]=e2,O[120]=w,O[121]=x,O[122]=b,O[123]=y,O[124]=k,O[125]=C,O[126]=N,O[127]=R):R=O[127],R});function eh(e,t,n,l){e.preventDefault(),t(n,l,e.shiftKey)}let ef=e=>e.draftId;function ep(e,t){e.style.setProperty("--sheet-cols",t.template),e.style.minWidth="".concat(t.minWidth,"px")}
1function em(e,t){let n=e.parentElement;if(null==t||null==n)return;let l=t.getBoundingClientRect(),r=n.getBoundingClientRect(),i=t.closest("[data-row]"),s=null==i?l.top-r.top+n.scrollTop:40+40*Number(i.dataset.row)+t.offsetTop,a=t.querySelector("[data-answer-label]"),u=null==a?0:a.getBoundingClientRect().right-l.left;e.style.transform="translate(".concat(l.left-r.left+n.scrollLeft+u,"px, ").concat(s,"px)"),e.style.width="".concat(l.width-u,"px"),e.style.height="".concat(null==i?l.height:t.offsetHeight,"px"),e.toggleAttribute("data-label",null!=a)}function ev(e,t,n){let l=t.get();null!=e&&(null==l?e.removeAttribute("aria-activedescendant"):e.setAttribute("aria-activedescendant",ej(n,l.key,l.col)),e.setAttribute("aria-expanded",String(null!=l)),requestAnimationFrame(()=>em(e,null==l?null:document.getElementById(ej(n,l.key,l.col)))))}function eg(e,t,n){return(n instanceof HTMLTextAreaElement||n instanceof HTMLInputElement)&&n!==t&&(null==e?void 0:e.contains(n))===!0}function ew(e){return(0,c.cn)("relative flex min-w-0 items-center",e&&"group-focus-within/grid:outline group-focus-within/grid:outline-1 group-focus-within/grid:-outline-offset-1 group-focus-within/grid:outline-brand-purple")}function ex(e,t){return e.row===t.row&&e.id===t.id&&e.heldPrompt===t.heldPrompt&&e.heldRubric===t.heldRubric&&e.heldCategory===t.heldCategory&&e.invalidPrompt===t.invalidPrompt&&e.invalidRubric===t.invalidRubric&&e.invalidCategory===t.invalidCategory}let eb=(0,i.memo)(function(e){let t,n=(0,r.c)(4),{grid:i}=e,s=(0,G.Fm)(i,ey),a=(0,G.Fm)(i,ek),u=null!=a?"failed":s?"saving":"idle";return n[0]!==a||n[1]!==i.retry||n[2]!==u?(t=(0,l.jsx)(h.av,{state:u,error:a,onRetry:i.retry,className:"justify-items-end"}),n[0]=a,n[1]=i.retry,n[2]=u,n[3]=t):t=n[3],t}),ey=e=>e.saving,ek=e=>e.failure;function e_(e){return e.dataTransfer.types.includes("Files")}function ej(e,t,n){return"".concat(e,"-").concat(t,"-").concat(n)}function eS(e){return e instanceof Element?e.closest('[role="gridcell"][id]'):null}function eC(e){return Math.max(1,Math.floor((null==e?0:e.clientHeight-40)/40)-1)}let eN="pointer-events-none absolute inset-y-0 z-40 w-6 from-neutral-900/[0.06] to-transparent";function eE(e,t,n){var l;if(null==e)return;let r=null!=(l=null==t?void 0:t.offsetHeight)?l:e.scrollHeight,i={scrolls:r>e.clientHeight+1,atEnd:e.scrollTop+e.clientHeight>=r-20,left:e.scrollLeft>1,right:e.scrollLeft+e.clientWidth<e.scrollWidth-1};n(e=>e.scrolls===i.scrolls&&e.atEnd===i.atEnd&&e.left===i.left&&e.right===i.right?e:i)}let eR=(0,i.memo)(function(e){let t,n,s,a,u,o,d,p,m,v=(0,r.c)(31),{id:w,col:x,cursor:b,label:y,help:k,info:_,count:j,bordered:S,resize:C}=e,N=void 0!==_&&_,R=(0,i.useId)();v[0]!==b?(t=()=>b.rowState(E.GA),v[0]=b,v[1]=t):t=v[1];let O=t,D=(0,i.useSyncExternalStore)(b.subscribe,O,O)===x,[M,T]=(0,i.useState)(!1);v[2]!==S||v[3]!==D?(n=(0,c.cn)(ew(D),"gap-1.5 whitespace-nowrap px-3",S&&"border-r"),v[2]=S,v[3]=D,v[4]=n):n=v[4],v[5]!==k||v[6]!==R?(s=(0,l.jsx)("span",{id:R,hidden:!0,children:k}),v[5]=k,v[6]=R,v[7]=s):s=v[7];let A=D||M;return v[8]!==N||v[9]!==y?(a=(0,l.jsx)(f.k$,{asChild:!0,children:N?(0,l.jsxs)("span",{className:"flex min-w-0 items-center gap-1 text-xs font-medium text-neutral-900",children:[(0,l.jsx)("span",{className:"truncate",children:y}),(0,l.jsx)(g.A,{"aria-hidden":!0,className:"h-3 w-3 shrink-0 text-neutral-400"})]}):(0,l.jsx)("span",{className:"truncate text-xs font-medium text-neutral-900",children:y})}),v[8]=N,v[9]=y,v[10]=a):a=v[10],v[11]!==k?(u=(0,l.jsx)(h.ZI,{children:k}),v[11]=k,v[12]=u):u=v[12],v[13]!==A||v[14]!==a||v[15]!==u?(o=(0,l.jsxs)(f.m_,{open:A,onOpenChange:T,children:[a,u]}),v[13]=A,v[14]=a,v[15]=u,v[16]=o):o=v[16],v[17]!==j?(d=null!=j&&(0,l.jsxs)("span",{className:(0,c.cn)("shrink-0 text-[11px] tabular-nums",j.have===j.total?"text-emerald-600":"text-neutral-500"),children:[j.have.toLocaleString("en-US")," of ",j.total.toLocaleString("en-US")]}),v[17]=j,v[18]=d):d=v[18],v[19]!==x||v[20]!==C?(p=null!=C&&"wanted"!==x&&(0,l.jsx)("span",{"aria-hidden":!0,"data-resize":x,onPointerDown:e=>C.start(e,x),onDoubleClick:()=>C.reset(x),className:"group/size absolute -right-1 top-0 z-10 flex h-full w-2 cursor-col-resize justify-center",children:(0,l.jsx)("span",{className:"h-full w-0.5 group-hover/size:bg-brand-purple group-data-[dragging]/size:bg-brand-purple"})}),v[19]=x,v[20]=C,v[21]=p):p=v[21],v[22]!==R||v[23]!==w||v[24]!==D||v[25]!==
1p||v[26]!==n||v[27]!==s||v[28]!==o||v[29]!==d?(m=(0,l.jsxs)("div",{id:w,role:"columnheader","aria-selected":D,"aria-describedby":R,className:n,children:[s,o,d,p]}),v[22]=R,v[23]=w,v[24]=D,v[25]=p,v[26]=n,v[27]=s,v[28]=o,v[29]=d,v[30]=m):m=v[30],m});function eO(e){let t,n,i,s,a=(0,r.c)(6),{withCategory:u}=e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,l.jsx)("span",{className:"h-2.5 w-1/3 animate-pulse rounded bg-neutral-100"}),a[0]=t):t=a[0],a[1]!==u?(n=u&&(0,l.jsx)("span",{className:"h-2.5 w-12 animate-pulse rounded bg-neutral-100"}),a[1]=u,a[2]=n):n=a[2],a[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,l.jsx)("span",{className:"h-2.5 w-1/4 animate-pulse rounded bg-neutral-100"}),a[3]=i):i=a[3],a[4]!==n?(s=(0,l.jsxs)("span",{role:"gridcell",className:"col-span-full col-start-2 flex items-center gap-3 px-3",children:[t,n,i]}),a[4]=n,a[5]=s):s=a[5],s}let eD=(0,i.memo)(function(e){let t,n,i,s,a,u,o=(0,r.c)(31),{id:d,rowKey:h,selected:f,onSelect:p,task:m,number:v,readOnly:g,editing:x,blank:b,held:y,invalid:k,open:j,onExpand:S,onChange:C,onBlur:N,keys:E}=e,R=!g&&(0,_.F1)(m,"prompt");o[0]!==m.prompt?(t=(0,_.wT)(m.prompt),o[0]=m.prompt,o[1]=t):t=o[1];let O=t,D=x&&!g,M=!g&&(f||b)?"Type a task":"",T=z(D,m.prompt);o[2]!==p||o[3]!==h||o[4]!==D?(n=D?void 0:e=>eh(e,p,h,"input"),o[2]=p,o[3]=h,o[4]=D,o[5]=n):n=o[5];let A=(0,c.cn)(ew(f),"border-r",R&&"bg-brand-mint/20",y&&"bg-amber-50 shadow-[inset_0_0_0_1.5px_theme(colors.amber.400)]",null!=k&&eM,j&&X),I=R&&(0,l.jsx)(eQ,{className:"ml-3"}),q=!D&&(0,l.jsxs)("span",{className:(0,c.cn)("flex min-w-0 flex-1 items-center gap-1.5 px-3 text-[12.5px]",R&&"pl-1.5"),children:[(0,l.jsx)("span",{className:(0,c.cn)("truncate",""===m.prompt?"text-neutral-400":"text-neutral-900"),children:O?(0,_.d2)(m.prompt):m.prompt||M}),O&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(w.A,{className:"h-3 w-3 shrink-0 text-neutral-400","aria-hidden":!0}),(0,l.jsx)("span",{className:"sr-only",children:"Multi-line."})]})]});return o[6]!==y?(i=y&&(0,l.jsx)(eq,{help:eA}),o[6]=y,o[7]=i):i=o[7],o[8]!==k?(s=null!=k&&(0,l.jsx)(eq,{help:eT(k,"Change it, or press Enter, then Esc, to take the stored version."),invalid:!0}),o[8]=k,o[9]=s):s=o[9],o[10]!==T||o[11]!==d||o[12]!==E||o[13]!==v||o[14]!==N||o[15]!==C||o[16]!==S||o[17]!==m.prompt||o[18]!==R||o[19]!==D?(a=D&&P({editor:T,id:d,label:"Task, row ".concat(v),value:m.prompt,placeholder:"Type a task",problem:null,onChange:C,keys:E,onBlur:N,onExpand:S,mark:R?(0,l.jsx)(eQ,{className:"ml-3 mt-[13px]"}):void 0}),o[10]=T,o[11]=d,o[12]=E,o[13]=v,o[14]=N,o[15]=C,o[16]=S,o[17]=m.prompt,o[18]=R,o[19]=D,o[20]=a):a=o[20],o[21]!==d||o[22]!==f||o[23]!==n||o[24]!==A||o[25]!==I||o[26]!==q||o[27]!==i||o[28]!==s||o[29]!==a?(u=(0,l.jsxs)("span",{id:d,role:"gridcell","aria-selected":f,onMouseDown:n,className:A,children:[I,q,i,s,a]}),o[21]=d,o[22]=f,o[23]=n,o[24]=A,o[25]=I,o[26]=q,o[27]=i,o[28]=s,o[29]=a,o[30]=u):u=o[30],u}),eM="bg-red-50 shadow-[inset_0_0_0_1.5px_theme(colors.red.300)]";function eT(e,t){return"Not saved: ".concat(e.replace(/\.$/,""),". ").concat(t)}let eA="Changed elsewhere since you edited it. Enter, then Enter, keeps yours; Enter, then Esc, takes the newer version.",eI="Changed elsewhere since you edited it. Open it to keep yours or take the newer version.";function eq(e){let t,n,i,s,a,u=(0,r.c)(11),{help:o,invalid:d}=e,p=void 0!==d&&d?"text-red-600":"text-amber-600";return u[0]!==p?(t=(0,c.cn)("mr-2 flex shrink-0",p),u[0]=p,u[1]=t):t=u[1],u[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,l.jsx)(x.A,{className:"h-3.5 w-3.5"}),u[2]=n):n=u[2],u[3]!==o||u[4]!==t?(i=(0,l.jsx)(f.k$,{asChild:!0,children:(0,l.jsx)("span",{role:"img","aria-label":o,className:t,children:n})}),u[3]=o,u[4]=t,u[5]=i):i=u[5],u[6]!==o?(s=(0,l.jsx)(h.ZI,{children:o}),u[6]=o,u[7]=s):s=u[7],u[8]!==i||u[9]!==s?(a=(0,l.jsxs)(f.m_,{children:[i,s]}),u[8]=i,u[9]=s,u[10]=a):a=u[10],a}let eF={input:"prompt",category:"category",files:null,wanted:"rubric"},eL=(0,i.memo)(function(e){let t,n,s,a,u,o,d=(0,r.c)(18),{grid:h,cursor:f,imported:p,gradingMode:m}=e;d[0]!==f||d[1]!==h?(t=e=>{let t=h.subscribe(e),n=f.subscribe(e);return()=>{t(),n()}},d[0]=f,d[1]=h,d[2]=t):t=d[2];let v=t;d[3]!==f||d[4]!==m||d[5]!==h||d[6]!==p?(n=()=>(function(e,t,n,l){let r=null==t?null:eF[t.col];if(null==t||null==r)return"";let i=(0,E.$V)(e.keys,t.key,t.index),s=e.rows[i];if(null==s)return"";let a="".concat(s.id_aa,":").concat(r),u="wanted"===t.col&&("subjective"===l||"criteria"===(0,_.GZ)(s,n).kind),o="Row ".concat((i+1).toLocaleStr
1ing("en-US")," \xb7 "),d=e.invalid.get(a);return null!=d?"i|".concat(o).concat(eT(d,u?"Open it to change it, or discard it below.":"Change it, or press Enter, then Esc, to take the stored version.")):e.held.has(a)?"h|".concat(o).concat(u?eI:eA):""})(h.view(),f.get(),p,m),d[3]=f,d[4]=m,d[5]=h,d[6]=p,d[7]=n):n=d[7];let g=n,w=(0,i.useSyncExternalStore)(v,g,g);d[8]!==w?(s=w.slice(2),d[8]=w,d[9]=s):s=d[9];let b=s,y=w.startsWith("i|")?"text-red-700":"text-amber-800";return d[10]!==y?(a=(0,c.cn)("flex min-w-0 items-center gap-1.5 text-[11.5px]",y),d[10]=y,d[11]=a):a=d[11],d[12]!==w||d[13]!==b?(u=""!==w&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(x.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,l.jsx)("span",{className:"truncate",title:b,children:b})]}),d[12]=w,d[13]=b,d[14]=u):u=d[14],d[15]!==a||d[16]!==u?(o=(0,l.jsx)("p",{"aria-live":"polite",className:a,children:u}),d[15]=a,d[16]=u,d[17]=o):o=d[17],o}),eH=(0,i.memo)(function(e){let t,n,i,s,a,u,o,c=(0,r.c)(24),{grid:h,readOnly:f}=e,{held:p,invalid:m,reason:g,dropped:w,lost:x}=(0,G.Fm)(h,eK,ez);if(0===p&&0===m&&0===w&&0===x.length)return null;c[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,l.jsx)(v.A,{}),c[0]=t):t=c[0],c[1]!==h.dismissDropped?(n=(0,l.jsx)(d.$,{variant:"ghost",size:"sm","aria-label":"Dismiss",onClick:h.dismissDropped,className:"w-7 px-0 hover:no-underline [&_svg]:h-4 [&_svg]:w-4",children:t}),c[1]=h.dismissDropped,c[2]=n):n=c[2];let b=n;return c[3]!==h||c[4]!==p||c[5]!==f?(i=p>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("span",{children:[p," ",1===p?"edit clashes":"edits clash"," with a newer version."]}),!f&&(0,l.jsxs)("span",{className:"flex items-center gap-1",children:[(0,l.jsx)(d.$,{variant:"outlineSecondary",size:"sm",onClick:()=>h.keepHeld(null),children:"Keep mine"}),(0,l.jsx)(d.$,{variant:"ghost",size:"sm",onClick:()=>h.dropHeld(null),className:"hover:no-underline",children:"Take theirs"})]})]}),c[3]=h,c[4]=p,c[5]=f,c[6]=i):i=c[6],c[7]!==h||c[8]!==m||c[9]!==f||c[10]!==g?(s=m>0&&(0,l.jsxs)("span",{className:"flex items-center gap-1",children:[m," ",1===m?"edit couldn't":"edits couldn't"," be saved: ",g,!f&&(0,l.jsx)(d.$,{variant:"ghost",size:"sm",onClick:()=>h.dropInvalid(null),className:"hover:no-underline",children:"Discard"})]}),c[7]=h,c[8]=m,c[9]=f,c[10]=g,c[11]=s):s=c[11],c[12]!==b||c[13]!==w||c[14]!==x.length?(a=w>0&&(0,l.jsxs)("span",{className:"flex items-center gap-1",children:[w," ",1===w?"change wasn't":"changes weren't"," saved: the task changed or was deleted elsewhere.",0===x.length&&b]}),c[12]=b,c[13]=w,c[14]=x.length,c[15]=a):a=c[15],c[16]!==b||c[17]!==x?(u=x.length>0&&(0,l.jsxs)("span",{className:"flex items-center gap-1",children:[x.length," ",1===x.length?"change couldn't":"changes couldn't"," be saved: ",x[0],b]}),c[16]=b,c[17]=x,c[18]=u):u=c[18],c[19]!==i||c[20]!==s||c[21]!==a||c[22]!==u?(o=(0,l.jsxs)("div",{role:"status",className:"flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-t border-amber-200 bg-amber-50 px-3 py-1.5 text-xs text-amber-900",children:[i,s,a,u]}),c[19]=i,c[20]=s,c[21]=a,c[22]=u,c[23]=o):o=c[23],o});function eK(e){return{held:e.held.size,invalid:e.invalid.size,reason:e.invalid.values().next().value,dropped:e.dropped,lost:e.lost}}
1function ez(e,t){return e.held===t.held&&e.invalid===t.invalid&&e.reason===t.reason&&e.dropped===t.dropped&&e.lost===t.lost}let eP=(0,i.memo)(function(e){let t,n,i,s,a,u,o,h,f,p,g=(0,r.c)(51),{id:w,rowKey:x,selected:y,onSelect:k,chips:j,readOnly:S,busy:C,onAttach:N,onFill:E,onPreview:R,onRemove:O}=e;if(g[0]!==j){var D;t=null!=(D=j.find(e1))?D:j[0],g[0]=j,g[1]=t}else t=g[1];let M=t;if(g[2]!==C||g[3]!==j||g[4]!==w||g[5]!==N||g[6]!==E||g[7]!==R||g[8]!==k||g[9]!==S||g[10]!==x||g[11]!==y||g[12]!==M){o=Symbol.for("react.early_return_sentinel");e:{let e,t,r,h=null==R?[]:j.filter(_.Hh).map(e2);i=e=>null==R?void 0:R(h,h.indexOf(e)),g[19]!==(null==M?void 0:M.name)?(e=e=>e!==(null==M?void 0:M.name),g[19]=null==M?void 0:M.name,g[20]=e):e=g[20],n=h.find(e),g[21]!==k||g[22]!==x?(t=e=>eh(e,k,x,"files"),g[21]=k,g[22]=x,g[23]=t):t=g[23],g[24]!==w||g[25]!==y||g[26]!==t?(r={id:w,role:"gridcell","aria-selected":y,onMouseDown:t},g[24]=w,g[25]=y,g[26]=t,g[27]=r):r=g[27];let f=r;if(C){let e,t,n;g[28]!==y?(e=(0,c.cn)(ew(y),"gap-1.5 border-r px-3 text-xs text-neutral-500"),g[28]=y,g[29]=e):e=g[29],g[30]===Symbol.for("react.memo_cache_sentinel")?(t=(0,l.jsx)(b.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin","aria-hidden":!0}),g[30]=t):t=g[30],g[31]!==f||g[32]!==e?(n=(0,l.jsxs)("span",{...f,className:e,children:[t,"Attaching…"]}),g[31]=f,g[32]=e,g[33]=n):n=g[33],o=n;break e}s=f,g[34]!==y?(a=(0,c.cn)(ew(y),"group/files gap-1.5 border-r px-3"),g[34]=y,g[35]=a):a=g[35],u=null==M?!S&&(0,l.jsxs)(d.$,{variant:"ghost",size:"sm",tabIndex:-1,disabled:null==N,onMouseDown:e3,onClick:null!=N?N:void 0,className:"-ml-1 px-1 text-neutral-500 hover:text-neutral-900 hover:no-underline [&_svg]:h-4 [&_svg]:w-4",children:[(0,l.jsx)(m.A,{}),"Attach"]}):(0,l.jsx)(eW,{chip:M,readOnly:S,onFill:E,onPreview:h.includes(M.name)?()=>i(M.name):null})}g[2]=C,g[3]=j,g[4]=w,g[5]=N,g[6]=E,g[7]=R,g[8]=k,g[9]=S,g[10]=x,g[11]=y,g[12]=M,g[13]=n,g[14]=i,g[15]=s,g[16]=a,g[17]=u,g[18]=o}else n=g[13],i=g[14],s=g[15],a=g[16],u=g[17],o=g[18];return o!==Symbol.for("react.early_return_sentinel")?o:(g[36]!==O||g[37]!==y||g[38]!==M?(h=null!=M&&null!=O&&(0,l.jsx)("button",{type:"button",tabIndex:-1,"aria-label":"Remove ".concat(M.name),title:"Remove from this task (Delete)",onMouseDown:e5,onClick:()=>O(M.name),className:(0,c.cn)("flex h-5 w-5 shrink-0 items-center justify-center rounded text-neutral-500 hover:bg-neutral-100 hover:text-neutral-900 group-hover/files:opacity-100",!y&&"opacity-0"),children:(0,l.jsx)(v.A,{className:"h-3 w-3"})}),g[36]=O,g[37]=y,g[38]=M,g[39]=h):h=g[39],g[40]!==j||g[41]!==n||g[42]!==i||g[43]!==M?(f=j.length>1&&(null==n?(0,l.jsxs)("span",{className:"shrink-0 text-[11px] tabular-nums text-neutral-500",children:["+",j.length-1]}):(0,l.jsxs)("button",{type:"button",tabIndex:-1,"aria-haspopup":"dialog",title:j.flatMap(e=>e===M?[]:[e.name]).join("\n"),onMouseDown:eB,onClick:()=>i(n),className:"shrink-0 cursor-zoom-in text-[11px] tabular-nums text-neutral-500 hover:text-neutral-900",children:["+",j.length-1]})),g[40]=j,g[41]=n,g[42]=i,g[43]=M,g[44]=f):f=g[44],g[45]!==s||g[46]!==a||g[47]!==u||g[48]!==h||g[49]!==f?(p=(0,l.jsxs)("span",{...s,className:a,children:[u,h,f]}),g[45]=s,g[46]=a,g[47]=u,g[48]=h,g[49]=f,g[50]=p):p=g[50],p)});function eB(e){e.preventDefault(),en()}function eW(e){let t,n,i,s,a=(0,r.c)(29),{chip:u,readOnly:o,onFill:d,onPreview:c}=e;if(!u.missing&&null!=c){let e,t,n;return a[0]!==u.badge?(e=(0,l.jsx)(eU,{badge:u.badge}),a[0]=u.badge,a[1]=e):e=a[1],a[2]!==u.name?(t=(0,l.jsx)("span",{className:"truncate group-hover/chip:underline",children:u.name}),a[2]=u.name,a[3]=t):t=a[3],a[4]!==u.name||a[5]!==c||a[6]!==e||a[7]!==t?(n=(0,l.jsxs)("button",{type:"button",tabIndex:-1,"aria-haspopup":"dialog",title:u.name,"data-chip":u.name,onMouseDown:eB,onClick:c,className:"group/chip inline-flex min-w-0 cursor-zoom-in items-center gap-[5px] text-xs text-neutral-900",children:[e,t]}),a[4]=u.name,a[5]=c,a[6]=e,a[7]=t,a[8]=n):n=a[8],n}if(!u.missing){let e,t,n;return a[9]!==u.badge?(e=(0,l.jsx)(eU,{badge:u.badge}),a[9]=u.badge,a[10]=e):e=a[10],a[11]!==u.name?(t=(0,l.jsx)("span",{className:"truncate",children:u.name}),a[11]=u.name,a[12]=t):t=a[12],a[13]!==u.name||a[14]!==e||a[15]!==t?(n=(0,l.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-[5px] text-xs text-neutral-900",title:u.name,"data-chip":u.name,children:[e,t]}),a[13]=u.name,a[14]=e,a[15]=t,a[16]=n):n=a[16],n}let h="".concat(u.name," is missing");return a[17]!==u.name?(t=(0,l.jsx)("span",{className:"truncate",children:u.name}),a[17]=u.name,a[18]=t):t=a[18],a[19]===Symbol.for("react.memo_cache_sentinel")?(n=(0,l.jsx)("span",{className:"shrink-0 text-amber-700",children:"missing"}),a[19]=n):n=a[19],a[20]!==u.name||a[21]!==d||a[22]!==o?(i=!o&&(0,l.jsx)("button",{type:"button",tabIndex:-1,"aria-label":"Upload ".concat(u.name),disabled:null==d,onMouseDown:eG,onClick:()=>null==d?void 0:d(u.name),className:"flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded border border-amber-200 bg-white disabled:opacity-50",children:(0,l.jsx)(y.A,{className:"h-3 w-3"})}),a[20]=u.name,a[21]=d,a[22]=o,a[23]=i):i=a[23],a[24]!==u.name||a[25]!==h||a[26]!==t||a[27]!==i?(s=(0,l.jsxs)("span",{title:h,"data-chip":u.name,className:"inline-flex h-6 min-w-0 items-center gap-1.5 rounded-md border border-dashed border-amber-500 bg-amber-50 pl-[7px] pr-1 text-[11.5px] text-amber-800",children:[t,n,i]}),a[24]=u.name,a[25]=h,a[26]=t,a[27]=i,a[28]=s):s=a[28],s}function eG(e){return e.preventDefault()}
1function eU(e){let t,n,i=(0,r.c)(5),{badge:s}=e,a=er[s];return i[0]!==a?(t=(0,c.cn)("shrink-0 rounded-[3px] px-[3px] py-px text-[9.5px] font-medium leading-none text-white",a),i[0]=a,i[1]=t):t=i[1],i[2]!==s||i[3]!==t?(n=(0,l.jsx)("span",{className:t,children:s}),i[2]=s,i[3]=t,i[4]=n):n=i[4],n}let e$=(0,i.memo)(function(e){var t;let n,s,a,u,o,d,h,f,p,m,v=(0,r.c)(51),{id:g,rowKey:x,selected:b,onSelect:y,task:k,number:S,imported:C,gradingMode:N,readOnly:E,saved:R,held:O,invalid:D,open:M,onOpen:T,editing:A,seed:I,onExpand:q,onAnswer:F,onTyped:L,onBlock:H,onBlur:K,keys:B}=e,W=_.qv[N],G=(0,_.GZ)(k,C,W),U="criteria"===G.kind,$=U||"subjective"===N,Z=!E&&U&&G.agent,J=A&&!E&&!$,V="answer"===G.kind?G.answer:"",[Y,Q]=(0,i.useState)(null);J&&null==Y&&Q(null!=I?I:V),J||null==Y||Q(null);let ee=null!=(t=null!=Y?Y:I)?t:V,et=J?(0,j.mr)(ee):null,en=null!=et;v[0]!==en||v[1]!==H||v[2]!==x?(n=()=>{if(en)return H(x,!0),()=>H(x,!1)},s=[en,H,x],v[0]=en,v[1]=H,v[2]=x,v[3]=n,v[4]=s):(n=v[3],s=v[4]),(0,i.useEffect)(n,s);let el=z(J,ee);v[5]!==y||v[6]!==x||v[7]!==J?(a=J?void 0:e=>eh(e,y,x,"wanted"),v[5]=y,v[6]=x,v[7]=J,v[8]=a):a=v[8];let er=$&&null!=T?()=>T("empty"===G.kind):void 0;v[9]!==O||v[10]!==D||v[11]!==T||v[12]!==M||v[13]!==$||v[14]!==b||v[15]!==Z?(u=(0,c.cn)(ew(b),"gap-[7px] px-3 text-[12.5px]",$&&null!=T&&"cursor-pointer",Z?"bg-brand-mint/20 hover:bg-brand-mint/30":"hover:bg-neutral-50",O&&"bg-amber-50 shadow-[inset_0_0_0_1.5px_theme(colors.amber.400)]",null!=D&&eM,M&&X),v[9]=O,v[10]=D,v[11]=T,v[12]=M,v[13]=$,v[14]=b,v[15]=Z,v[16]=u):u=v[16];let ei="answer"===G.kind&&!J&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eY,{mode:N}),(0,l.jsx)("span",{className:"truncate text-neutral-900",title:(0,_.P6)({label:W,text:G.answer}),children:G.answer}),b&&!R&&!E&&null!=T&&(0,l.jsx)(eJ,{keys:"⌥↓",shortcut:"Alt+ArrowDown",onOpen:()=>T(!0)})]});v[17]!==W||v[18]!==G||v[19]!==k||v[20]!==Z?(o="criteria"===G.kind&&(0,l.jsxs)(l.Fragment,{children:[Z&&(0,l.jsx)(eQ,{}),(0,l.jsxs)("span",{className:"flex min-w-0 flex-1",title:(0,_.WL)(k.rubric,W),children:[null!=G.first.label&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"max-w-[45%] shrink-0 truncate text-neutral-500",children:G.first.label}),(0,l.jsx)("span",{className:"mr-1 shrink-0 text-neutral-500",children:":"})]}),(0,l.jsx)("span",{className:"min-w-0 truncate text-neutral-900",children:G.first.text})]}),G.more>0&&(0,l.jsxs)("span",{className:"shrink-0 text-[11px] tabular-nums text-neutral-500",children:["+",G.more]})]}),v[17]=W,v[18]=G,v[19]=k,v[20]=Z,v[21]=o):o=v[21],v[22]!==G?(d="empty"===G.kind&&G.missing&&(0,l.jsx)("span",{className:"inline-flex h-6 items-center rounded-md border border-dashed border-neutral-300 px-2 text-xs text-neutral-500",children:"Missing"}),v[22]=G,v[23]=d):d=v[23],v[24]!==G||v[25]!==N||v[26]!==T||v[27]!==E||v[28]!==R||v[29]!==b||v[30]!==J?(h="empty"===G.kind&&!J&&!R&&!E&&b&&(0,l.jsxs)(l.Fragment,{children:[!G.missing&&("subjective"===N?(0,l.jsx)("span",{className:"truncate text-neutral-400",children:eX}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eY,{mode:N}),(0,l.jsx)("span",{className:"truncate text-neutral-400",children:eZ})]})),null!=T&&(0,l.jsx)(eJ,{keys:(0,l.jsx)(w.A,{className:"h-3 w-3"}),shortcut:"Enter",onOpen:()=>T(!0)})]}),v[24]=G,v[25]=N,v[26]=T,v[27]=E,v[28]=R,v[29]=b,v[30]=J,v[31]=h):h=v[31],v[32]!==U||v[33]!==O?(f=O&&(0,l.jsx)(eq,{help:U?eI:eA}),v[32]=U,v[33]=O,v[34]=f):f=v[34],v[35]!==U||v[36]!==D?(p=null!=D&&(0,l.jsx)(eq,{help:eT(D,U?"Open it to change it, or discard it below the table.":"Change it, or press Enter, then Esc, to take the stored version."),invalid:!0}),v[35]=U,v[36]=D,v[37]=p):p=v[37];let es=J&&P({editor:el,id:g,label:"".concat(_.ye[N],", row ").concat(S),value:ee,placeholder:eZ,problem:et,onChange:e=>{Q(e),L(e),null==(0,j.mr)(e)&&F(e)},keys:{onCommit:(e,t)=>{null==et&&B.onCommit(e,t)},onRevert:B.onRevert},onBlur:()=>{null==et&&K()},onExpand:q,mark:(0,l.jsx)(eY,{mode:N,className:"ml-3 mr-px mt-[11px]"})});return v[38]!==g||v[39]!==b||v[40]!==h||v[41]!==f||v[42]!==p||v[43]!==es||v[44]!==a||v[45]!==er||v[46]!==u||v[47]!==ei||v[48]!==o||v[49]!==d?(m=(0,l.jsxs)("span",{id:g,role:"gridcell","aria-selected":b,onMouseDown:a,onClick:er,className:u,children:[ei,o,d,h,f,p,es]}),v[38]=g,v[39]=b,v[40]=h,v[41]=f,v[42]=p,v[43]=es,v[44]=a,v[45]=er,v[46]=u,v[47]=ei,v[48]=o,v[49]=d,v[50]=m):m=v[50],m}),eZ="type the answer…",eX="Prefer the answer that…";function eJ(e){let t,n,i=(0,r.c)(6),{keys:s,shortcut:a,onOpen:u}=e;
1return i[0]!==s?(t=(0,l.jsx)("kbd",{"aria-hidden":!0,className:"flex h-[18px] min-w-[18px] items-center justify-center rounded border border-neutral-200 bg-neutral-50 px-1 font-sans text-[11px] text-neutral-500",children:s}),i[0]=s,i[1]=t):t=i[1],i[2]!==u||i[3]!==a||i[4]!==t?(n=(0,l.jsxs)("button",{type:"button",tabIndex:-1,"aria-keyshortcuts":a,onMouseDown:eV,onClick:u,className:"ml-auto flex shrink-0 items-center gap-1 text-xs text-neutral-500 hover:text-neutral-900",children:[t,"Criteria"]}),i[2]=u,i[3]=a,i[4]=t,i[5]=n):n=i[5],n}function eV(e){return e.preventDefault()}function eY(e){let t,n,i=(0,r.c)(5),{mode:s,className:a}=e;i[0]!==a?(t=(0,c.cn)("flex h-[18px] shrink-0 items-center rounded text-neutral-500",a),i[0]=a,i[1]=t):t=i[1];let u=_.qv[s];return i[2]!==t||i[3]!==u?(n=(0,l.jsxs)("span",{"data-answer-label":!0,className:t,children:[u,":"]}),i[2]=t,i[3]=u,i[4]=n):n=i[4],n}function eQ(e){let t,n,i,s,a,u=(0,r.c)(8),{className:o}=e;return u[0]!==o?(t=(0,c.cn)("flex shrink-0 text-teal-900",o),u[0]=o,u[1]=t):t=u[1],u[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,l.jsx)(k.A,{className:"h-3 w-3 fill-current"}),u[2]=n):n=u[2],u[3]!==t?(i=(0,l.jsx)(f.k$,{asChild:!0,children:(0,l.jsx)("span",{role:"img","aria-label":Z,className:t,children:n})}),u[3]=t,u[4]=i):i=u[4],u[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,l.jsx)(h.ZI,{children:Z}),u[5]=s):s=u[5],u[6]!==i?(a=(0,l.jsxs)(f.m_,{children:[i,s]}),u[6]=i,u[7]=a):a=u[7],a}function e0(e){return e.preventDefault()}function e1(e){return e.missing}function e2(e){return e.name}function e3(e){return e.preventDefault()}function e5(e){return e.preventDefault()}},39540:(e,t,n)=>{n.d(t,{p:()=>d});var l=n(58212),r=n(96040),i=n(61082),s=n(33505),a=n(60144),u=n(38853),o=n(24121);function d(e){let{account:t,isSaving:n,connect:d,disconnect:c,purpose:h}=e,[f,p]=(0,r.useState)(""),m=async()=>{try{var e;let t=await d(f);p(""),i.oR.success("Connected to Hugging Face as ".concat(null!=(e=null==t?void 0:t.username)?e:"your account"))}catch(e){i.oR.error("Could not connect that token",{description:e instanceof Error?e.message:"Unexpected error"})}},v=async()=>{try{await c(),i.oR.success("Disconnected from Hugging Face")}catch(e){i.oR.error("Could not disconnect",{description:e instanceof Error?e.message:"Unexpected error"})}};return t?(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border bg-neutral-50 px-3 py-2 text-[13px]",children:[(0,l.jsx)(a.A,{className:"h-4 w-4 shrink-0 text-emerald-600"}),(0,l.jsxs)("span",{className:"text-neutral-700",children:["Connected as ",(0,l.jsx)("span",{className:"font-medium text-neutral-900",children:t.username})]}),!t.can_write&&(0,l.jsx)("span",{className:"rounded bg-amber-100 px-1.5 py-0.5 text-[11px] font-medium text-amber-800",children:"read-only"}),(0,l.jsx)("button",{type:"button",onClick:()=>void v(),disabled:n,className:"ml-auto text-neutral-500 underline underline-offset-2 hover:text-neutral-900 disabled:opacity-50",children:"Disconnect"})]}):(0,l.jsxs)("div",{className:"space-y-2 rounded-lg border bg-neutral-50 px-3 py-3",children:[(0,l.jsx)("div",{className:"text-[13px] font-medium text-neutral-900",children:"Connect Hugging Face"}),(0,l.jsxs)("p",{className:"text-xs text-neutral-500",children:["publish"===h?"A token with write access lets Optima create the dataset under your account or one of your organizations.":"A token lets Optima read your private and gated datasets. Public datasets need no token."," ",(0,l.jsxs)("a",{href:"https://huggingface.co/settings/tokens",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-0.5 text-neutral-700 underline underline-offset-2 hover:text-neutral-900",children:["Create a token",(0,l.jsx)(u.A,{className:"h-3 w-3"})]})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("input",{type:"password",value:f,onChange:e=>p(e.target.value),placeholder:"hf_...",autoComplete:"off",className:"min-w-0 flex-1 rounded-lg border bg-background px-3 py-2 text-sm"}),(0,l.jsxs)(s.$,{onClick:()=>void m(),disabled:n||0===f.trim().length,className:"gap-1.5 bg-brand-mint text-black hover:bg-brand-mint/90",children:[n&&(0,l.jsx)(o.A,{className:"h-3.5 w-3.5 animate-spin"}),"Connect"]})]})]})}},46881:(e,t,n)=>{n.d(t,{GS:()=>d,M6:()=>a,ZX:()=>u,ey:()=>i,fq:()=>
1o,zP:()=>s});var l=n(21487),r=n(59514);let i=200,s=2e3;function a(e,t){let n=t.name.trim(),l=t.description.trim(),r={};if(n!==e.name.trim()){if(!n)return{update:null,error:"Give the benchmark a name."};if(n.length>i)return{update:null,error:"A name can be up to ".concat(i," characters.")};r.name=n}if(l!==e.description.trim()){if(l.length>s)return{update:null,error:"A description can be up to ".concat(s.toLocaleString("en-US")," characters.")};r.description=l}return{update:r,error:null}}async function u(e,t,n){await (0,l.LQ)(e,t,l=>fetch("".concat((0,r.Gn)(e),"/benchmarks/").concat(t),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,base_updated_at:l})}))}async function o(e,t,n){await (0,l.LQ)(e,t,l=>fetch("".concat((0,r.Gn)(e),"/benchmarks/").concat(t),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({shared_with_org:n,base_updated_at:l})}))}async function d(e,t,n){await (0,l.LQ)(e,t,l=>fetch("".concat((0,r.Gn)(e),"/benchmarks/").concat(t),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,base_updated_at:l})}))}},51744:(e,t,n)=>{n.d(t,{BT:()=>s,k$:()=>u,m_:()=>a});var l=n(58212),r=n(36772),i=n(16719);function s(e){let t,n=(0,r.c)(2),{children:s}=e;return n[0]!==s?(t=(0,l.jsx)(i.Kq,{delayDuration:400,skipDelayDuration:300,children:s}),n[0]=s,n[1]=t):t=n[1],t}function a(e){let t,n,s,a=(0,r.c)(6);a[0]!==e?({delayDuration:n,...t}=e,a[0]=e,a[1]=t,a[2]=n):(t=a[1],n=a[2]);let u=void 0===n?400:n;return a[3]!==u||a[4]!==t?(s=(0,l.jsx)(i.bL,{delayDuration:u,...t}),a[3]=u,a[4]=t,a[5]=s):s=a[5],s}let u=i.l9},60568:(e,t,n)=>{n.d(t,{AE:()=>C,Eh:()=>j,F1:()=>a,GZ:()=>u,HG:()=>K,Hh:()=>b,Hl:()=>O,Lv:()=>H,MF:()=>P,MG:()=>B,NU:()=>k,P6:()=>v,Q1:()=>M,SX:()=>o,WL:()=>g,X3:()=>L,YK:()=>R,Z8:()=>_,ax:()=>G,bM:()=>F,d2:()=>q,fu:()=>z,gp:()=>c,hK:()=>T,hP:()=>X,in:()=>D,nk:()=>N,p9:()=>I,qv:()=>h,ry:()=>Z,uQ:()=>W,wT:()=>A,wp:()=>E,ye:()=>d,yo:()=>S,yt:()=>y});var l=n(59838),r=n(25112),i=n(97774),s=n(65556);function a(e,t){return"agent"===(0,i.wN)(e,t)}function u(e,t){var n,r,s;let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o,d=null!=(r=null==(n=e.rubric)?void 0:n.dimensions)?r:[],c=d[0];if(null==c)return{kind:"empty",missing:t&&"user"!==(0,i.Fs)(e,"rubric")};let h=(0,l.ut)(e);return null!=h||"answer"===(0,i.Fs)(e,"rubric")?{kind:"answer",answer:null!=(s=null!=h?h:c.description)?s:""}:{kind:"criteria",first:m(c,u),more:d.length-1,agent:a(e,"rubric")}}let o="Must match",d={objective:"Answer criteria",subjective:"Preferred answer"},c={objective:"The answer a reply must match, or the criteria it is checked against.",subjective:"The judge weighs both answers against this. Every task needs one before launch."},h={objective:o,subjective:"Matches"},f="Meets the criterion: ",p=new Set(["User rubric","Overall quality"]);function m(e){var t,n,i;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o,a=(0,l.cY)(e);if(null!=a)return{label:s,text:a};let u=(0,l.Mg)(e.name.trim()),d=null!=(i=null==(t=e.levels.reduce((e,t)=>null==e||t.score>e.score?t:e,void 0))?void 0:t.description.trim())?i:"",c=(d.startsWith(f)?d.slice(f.length).trim():d)||(null==(n=e.description)?void 0:n.trim())||"";return""!==c&&e.name===(0,r.X6)(c)?{label:null,text:e.name}:""===c||c===e.name.trim()?{label:null,text:u}:""===u||p.has(e.name)?{label:null,text:c}:{label:u,text:c}}function v(e){let{label:t,text:n}=e;return null==t?n:"".concat(t,": ").concat(n)}function g(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;return(null!=(t=null==e?void 0:e.dimensions)?t:[]).map(e=>v(m(e,n))).join("\n")}let w={pdf:"PDF",xls:"XLS",xlsx:"XLS",csv:"CSV",doc:"DOC",docx:"DOC",png:"IMG",jpg:"IMG",jpeg:"IMG",gif:"IMG",webp:"IMG",txt:"TXT",md:"TXT",json:"JSON",jsonl:"JSON"},x=/\.(?:png|jpe?g|gif|webp)$/i;function b(e){return!e.missing&&x.test(e.name)}function y(e,t){let n=new Set((0,s.r8)(e,t));return e.reference_filenames.map(e=>{var t,l,r;return{name:e,badge:null!=(r=w[null!=(l=null==(t=e.split(".").at(-1))?void 0:t.toLowerCase())?l:""])?r:"FILE",missing:n.has(e)}})}function k(e,t){var n,l;return null==e?null:new Set(null!=(l=null==(n=e.issues.find(e=>e.field===t))?void 0:n.task_ids)?l:[])}function _(e){return e.some(e=>null!=e&&""!==e.category.trim()&&"general"!==e.category)}function j(e){return e.some(e=>null!=e&&e.reference_filenames.length>0)}function S(e,t){if(0===t.length)return{input:null,wanted:null};if(null!=e){let t=e.total_tasks,n=n=>{var l,r;return{have:t-(null!=(r=null==(l=k(e,n))?void 0:l.size)?r:0),total:t}};return{input:n("prompt"),wanted:n("rubric")}}if(t.some(e=>void 0===e))return{input:null,wanted:null};let n=t.filter(e=>null!=e);return{input:{have:n.filter(e=>""!==e.prompt.trim()).length,total:n.length},wanted:{have:n.filter(e=>{var t,n;return(null!=(n=null==(t=e.rubric)?void 0:t.dimensions.length)?n:0)>0}).length,total:n.length}}}function C(e,t){return e===t||null!=e&&null!=t&&e.have===t.have&&e.total===t.total}function N(e,t){return e===t||e.length===t.length&&e.every((e,n)=>e===t[n])}
1function E(e){return"".concat(e.toLocaleString("en-US")," ").concat(1===e?"row":"rows")}let R=1e4,O="An answer is at most ".concat(R.toLocaleString("en-US")," characters.");function D(e,t,n,i){var s,a,u;if("answer"===t){let t=i.trim();return t===(null!=(a=(0,l.ut)(e))?a:"")?{fields:null,problem:null}:{fields:{answer:t||null},problem:t.length>R?O:null}}let o=n.map(e=>{let t=(0,l.cY)(e);return null==t?e:(0,r.$s)(e,t.trim())});if(JSON.stringify(o)===JSON.stringify(null!=(u=null==(s=e.rubric)?void 0:s.dimensions)?u:[]))return{fields:null,problem:null};let d=n.some(e=>{var t;return!(null!=(t=(0,l.cY)(e))?t:(0,r.$N)(e).sentence).trim()})?"Write or delete the empty criterion.":n.some(e=>{var t,n;return(null!=(n=null==(t=(0,l.cY)(e))?void 0:t.trim().length)?n:0)>R})?O:n.some(e=>!e.name.trim())?"Name every criterion.":n.some(e=>e.levels.some(e=>!e.description.trim()))?"Describe every level.":null;return{fields:{rubric:o.length>0?{dimensions:o}:null},problem:d}}function M(e){return{rev:e.rev,rubric:U(e.rubric)}}function T(e,t){return null==t||U(e.rubric)===t.rubric?e.rev:t.rev}function A(e){return/[\r\n]/.test(e)}function I(e){return A(e)?null:""}function q(e){return e.split(/\r\n|\r|\n/).map(e=>e.trim()).filter(Boolean).join(" ")}function F(e,t){return null==t||e.prompt===t.prompt?e.rev:t.rev}function L(e,t){return{text:t,base:null==t?null:{rev:e.rev,prompt:e.prompt}}}function H(e){let t=new Map,n=new Map;return e.forEach((e,l)=>{if(null==e||(t.has(e.category)||t.set(e.category,l),!(0,i.e7)(e,"rubric")))return;let r=n.get(e.category);null==r?n.set(e.category,[e]):r.push(e)}),[...n].map(e=>{let[t,n]=e;return{category:t,tasks:n}}).sort((e,n)=>{var l,r;return(null!=(l=t.get(e.category))?l:0)-(null!=(r=t.get(n.category))?r:0)})}function K(e,t){return e.length===t.length&&e.every((e,n)=>{let l=t[n];return e.category===l.category&&e.tasks.length===l.tasks.length&&e.tasks.every((e,t)=>e.id_aa===l.tasks[t].id_aa&&e.rev===l.tasks[t].rev)})}function z(e,t){let n=e.tasks.filter(e=>null==t?void 0:t.has(e.id_aa));return n.length>0?n:e.tasks}function P(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.some(e=>void 0===e))return null;let n=e.filter(e=>null!=e),l=(0,i.Y5)(n),r=t?l.notChecked:0;if(0===n.length||l.missing>0||l.notChecked>r)return null;let s=[[l.accepted,"written by the agent and accepted","written by the agent and accepted"],[r,"written by the agent as agreed in chat","written by the agent as agreed in chat"],[l.fromAnswers,"comes from your answers","come from your answers"],[l.yours,"is your own","are your own"]].filter(e=>{let[t]=e;return t>0}),a=s.map((e,t)=>{let[n,l,r]=e;return"".concat(n).concat(0===t?1===n?" rubric":" rubrics":""," ").concat(1===n?l:r)}).join("; ");return{title:"".concat(n.length.toLocaleString("en-US")," ").concat(1===n.length?"task":"tasks",", ready to run."),detail:0===s.length?null:"".concat(a,".")}}function B(e,t){if(e===t)return"A change didn't save: a task changed or was deleted elsewhere. Check it, then launch.";if(0===e)return"Some of the agent's scoring changed. Check it, then launch.";let n=t-e;return"Accepted ".concat(e," of the agent's ").concat(t," rubrics; ").concat(n," had changed. Check ").concat(1===n?"it":"them",", then launch.")}function W(e,t,n){return!n&&(null==e?void 0:e.mode)!=="build"&&(t?(null==e?void 0:e.mode)==="completion":null)}function G(e,t){return e===t||null!=e&&null!=t&&e.title===t.title&&e.detail===t.detail}function U(e){let t=e&&{...e,dimensions:e.dimensions.map($)};return JSON.stringify(null!=t?t:null,(e,t)=>null==t||"object"!=typeof t||Array.isArray(t)?t:Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return null!=t}).sort((e,t)=>{let[n]=e,[l]=t;return n<l?-1:+(n>l)})))}function $(e){let t=e.description||e.name;return e.levels.length>0||!t.trim()?e:{...e,levels:(0,l.Ew)(t)}}let Z="No data? Describe your model's tasks and our agent will fill in the gaps.";function X(e){let{importing:t,taskCount:n,showVerdict:l,verdictReady:r,awaitingGroups:i,ready:s,gridUnscored:a}=e;return!t&&n>0&&l&&null==s&&!(r&&i>0)&&!(r&&a)}},63806:(e,t,n)=>{n.d(t,{CK:()=>v,Fj:()=>s,MT:()=>d,Ng:()=>h,O1:()=>o,Or:()=>p,ZV:()=>c,co:()=>u,dc:()=>f,mr:()=>g,rF:()=>a,rb:()=>w,th:()=>m});var l=n(30332),r=n(60568),i=n(59838);let s="general";function a(e){let t=new Map;for(let n of e){let e=null==n?void 0:n.category;if(null==e)continue;let r=(0,l.Zi)(e);
1""===r||t.has(r.toLowerCase())||t.set(r.toLowerCase(),{value:e,label:r})}return[...t.values()].sort((e,t)=>e.label.localeCompare(t.label))}function u(e,t){let n=t.trim().toLowerCase();return""===n?[...e]:[...e.filter(e=>e.label.toLowerCase().startsWith(n)),...e.filter(e=>!e.label.toLowerCase().startsWith(n)&&e.label.toLowerCase().includes(n))]}function o(e){return e.replace(/\s+/g," ").trim()}function d(e,t){var n;let l=o(t).toLowerCase();return null!=(n=e.find(e=>e.label.toLowerCase()===l))?n:null}function c(e,t,n,l,r){var i,a,u,c;if(!t)return null;if("key"===e){if(null!=r)return r.value;let e=o(n);return""===e?s:null!=(c=null==(u=l.find(t=>t.label.toLowerCase()===e.toLowerCase()))?void 0:u.value)?c:e}return null!=(a=null==(i=d(l,n))?void 0:i.value)?a:null}function h(e,t,n,l){if("input"===e)return t===n.prompt?null:{prompt:t};if("wanted"!==e||null!=g(t))return null;let i=(0,r.GZ)(n,l);if("criteria"===i.kind)return null;let s=t.trim()||null;return s===("answer"===i.kind?i.answer:null)?null:{answer:s}}function f(e){let t=(0,i.ut)(e);return null!=t?{answer:t}:{rubric:e.rubric}}function p(e,t){return"rubric"===t?f(e):{[t]:e[t]}}function m(e,t){return!e&&(null==t?void 0:t.isConnected)!==!0}function v(e){return e}function g(e){return e.trim().length>r.YK?r.Hl:null}function w(e,t,n,l){if(l)return"Home"===n?0:e.length;if("Home"===n)return e.lastIndexOf("\n",t-1)+1;let r=e.indexOf("\n",t);return -1===r?e.length:r}},64047:(e,t,n)=>{n.d(t,{C3:()=>o,DA:()=>s,OY:()=>u,RV:()=>d,Xx:()=>r,ev:()=>i,ip:()=>a,lu:()=>f,xo:()=>h});var l=n(67);function r(e,t,n){if((null==n?void 0:n.length)!==t)return{version:e,count:t,rows:Array.from({length:t}),stale:new Set};return{version:e,count:t,rows:[...n],stale:new Set}}function i(e,t){return e.version===t.version&&e.count===t.count&&e.rows.length===t.rows.length&&e.stale.size===t.stale.size&&e.rows.every((e,n)=>e===t.rows[n])}function s(e,t,n){if((null==t?void 0:t.length)!==e.count)return e;let l=e=>null!=n&&e>=n.from&&e<=n.to,r=e.rows.map((e,n)=>l(n)?e:t[n]);return{...e,rows:r,stale:new Set([...e.stale,...r.flatMap((e,t)=>null==e||l(t)?[]:[e])])}}function a(e,t,n){return{version:t,count:n,rows:Array.from({length:n},(t,n)=>{var l;return null!=(l=e.rows[n])?l:void 0}),stale:new Set(e.rows.filter(e=>null!=e))}}function u(e,t){var n,l;let r=t.updated_at!==e.version||t.task_count!==e.count?a(e,t.updated_at,t.task_count):e,i=[...r.rows],s=new Set(t.skipped),u=t.tasks.values(),o=Math.min(null!=(n=t.next_offset)?n:t.task_count,i.length);for(let e=t.offset;e<o;e+=1)i[e]=s.has(e)?null:null!=(l=u.next().value)?l:null;return{...r,rows:i}}function o(e,t,n,l){let r=Math.min(n,e.count-1);for(let n=Math.max(0,t);n<=r;n+=1){let t=e.rows[n];if((void 0===t||null!=t&&e.stale.has(t))&&(null==l||!(n>=l.offset)||!(n<l.offset+l.limit)))return{offset:n,limit:200}}return null}function d(e){return o(e,e.count-200,e.count-1,null)}let c="\0hole:";function h(e,t,n){let r=e.rows.map((e,t)=>{var n,l;return null!=e?e:(n=t,l=null===e,{id_aa:"".concat(c).concat(n,":").concat(l?"x":""),prompt:"",title:null,category:"",system_prompt:null,user_persona:null,expected_deliverables:[],reference_filenames:[],rubric:null,flags:[]})}),i=(0,l.XH)(r,t,n),s=i.tasks.map(e=>e.id_aa.startsWith(c)?e.id_aa.endsWith(":x")?null:void 0:e),u=n.base_updated_at!==e.version||i.conflicts.length>0||i.notFound.length>0||s.length!==n.task_count,o={...e,version:n.updated_at,rows:s,count:s.length};return{state:u?a(o,n.updated_at,n.task_count):o,folded:i,external:u}}function f(e,t,n){var r;if(e.updated_at===n.updated_at)return e;let i=e.draft_tasks;if(null==i||e.updated_at!==n.base_updated_at||null!=e.error||(null==(r=e.gap_report)?void 0:r.error_code)!=null||null==e.gap_report&&null!=n.completeness)return null;let s=(0,l.XH)(i,t,n);if(s.conflicts.length>0||s.notFound.length>0||s.tasks.length!==n.task_count)return null;let a=e=>e.some(e=>e.reference_filenames.length>0);return t.some(e=>"insert"===e.op||"delete"===e.op||"move"===e.op||"detach"===e.op||"set"===e.op&&"reference_filenames"in e.fields)&&(a(i)||a(s.tasks))?null:{...e,draft_tasks:s.tasks,task_count:n.task_count,updated_at:n.updated_at,gap_report:e.gap_report&&{...e.gap_report,completeness:n.completeness}}}}
1,68312:(e,t,n)=>{n.d(t,{Cw:()=>k,Du:()=>j,E1:()=>S,Ee:()=>N,FK:()=>T,Im:()=>u,JU:()=>o,LK:()=>c,NS:()=>_,NX:()=>O,OQ:()=>R,OU:()=>E,Sc:()=>C,Sp:()=>y,XA:()=>m,Y7:()=>s,YB:()=>f,Zj:()=>g,Zs:()=>H,a7:()=>i,ah:()=>a,fT:()=>p,gs:()=>A,hr:()=>M,jG:()=>h,lC:()=>x,m3:()=>b,mr:()=>F,ns:()=>D,ny:()=>w,pL:()=>q,rU:()=>v,wT:()=>d});var l=n(67),r=n(97774);let i="new:",s=5e3,a=600,u=Symbol("last row");function o(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:(0,l.GM)();return[...e,{kind:"insert",key:t,idAa:r,after:n,fields:{},due:1/0}]}function d(e,t,n,l,r){if(e.some(e=>"delete"===e.kind&&e.id===t))return[...e];let i=D(e,t);if(null!=i&&!i.resend){let{invalid:t,...r}=i,s={...c(i.fields,n),...n};return e.map(e=>e===i?{...r,fields:s,due:l}:e)}return Object.keys(n).reduce((e,i)=>{var s;let a="answer"===i?"rubric":i,u={[i]:n[i]},o="prompt"!==i&&"answer"!==i||(null==(s=n[i])?void 0:s.trim())?{due:l}:{due:1/0,untilKept:!0},d=e.findIndex(e=>"set"===e.kind&&e.id===t&&e.field===a&&!e.resend),c=e[d];if((null==c?void 0:c.kind)!=="set")return[...e,{kind:"set",id:t,field:a,fields:u,...o,...null!=r&&{baseRev:r}}];let{invalid:h,untilKept:f,due:p,...m}={...c,fields:u};return e.map((e,t)=>t===d?{...m,...c.held?{due:1/0}:o}:e)},[...e])}function c(e,t){if(!("answer"in t)&&!("rubric"in t))return e;let{answer:n,rubric:l,...r}=e;return r}function h(e,t,n,l,r){let i=D(e,t),s=(null==i?void 0:i.resend)?void 0:i,a=null!=s?s.after:l,u=e.filter(e=>{var n,l;return e!==s&&!("set"===e.kind&&e.id===t&&!e.resend)&&(n=e,l=t,"detach"!==n.kind||n.id!==l)}).map(e=>"insert"===e.kind&&e.after===t?{...e,after:a}:e),o=e.find(e=>"set"===e.kind&&e.id===t&&e.resend),d=null!=r?r:(null==o?void 0:o.kind)==="set"?o.baseRev:void 0;return null!=s?u:[...u,{kind:"delete",id:t,due:n,...null!=d&&{baseRev:d}}]}function f(e,t,n){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:["rubric"];return 0===t.length?[...e]:[...e,{kind:"review",tasks:[...t],fields:l,due:n}]}function p(e,t,n){return e.map(e=>{if("review"===e.kind||("insert"===e.kind?e.key:e.id)!==t)return e;if("set"===e.kind&&e.untilKept&&!e.held){let{untilKept:t,...l}=e;return{...l,due:n}}return Number.isFinite(e.due)?{...e,due:Math.min(e.due,n)}:e})}function m(e,t){let n=e=>"set"===e.kind&&!0===e.untilKept&&!e.held&&(null==t||e.id===t);return e.some(n)?e.filter(e=>!n(e)):[...e]}function v(e,t,n,l){return e.map(e=>{if("set"!==e.kind||!e.held||null!=t&&e.id!==t||null!=l&&e.field!==l)return e;let{kind:r,id:i,field:s,fields:a,baseRev:u}=e;return{kind:r,id:i,field:s,fields:a,due:n,...null!=u&&{baseRev:u}}})}function g(e,t,n){return e.filter(e=>"set"!==e.kind||!e.held||null!=t&&e.id!==t||null!=n&&e.field!==n)}function w(e,t,n){let l=new Set(e.filter(e=>{if("delete"===e.kind||"review"===e.kind||"detach"===e.kind||null==e.invalid)return!1;let l="insert"===e.kind?e.key:e.id;return(null==t||l===t)&&(null==n||"insert"===e.kind||e.field===n)})),r=new Map;for(let e of l)"insert"===e.kind&&r.set(e.key,e.after);let i=e=>{var t;return"string"==typeof e&&r.has(e)?i(null!=(t=r.get(e))?t:null):e};return e.filter(e=>!l.has(e)&&!(("set"===e.kind||"delete"===e.kind)&&r.has(e.id))).map(e=>{let t="insert"===e.kind?i(e.after):null;return"insert"===e.kind&&t!==e.after?{...e,after:t}:e})}function x(e,t,n){return e.filter(e=>"set"!==e.kind||e.id!==t||null!=n&&e.field!==n)}function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Set,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>void 0,l=Math.min(...e.map(e=>N(e,t,n)?1/0:e.due));return Number.isFinite(l)?l:null}function y(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set,i={edits:[],opOf:[],ops:[],keys:[],rest:[]},a=new Map,o=new Set,d=new Set,c=!1,h=0;for(let m of e){var f,p;if(m.due>t||c||N(m,r,n)||("set"!==m.kind||!a.has(null!=(f=n(m.id))?f:""))&&h+("review"===m.kind?m.tasks.length:1)>s){i.rest.push(m);continue}if("review"===m.kind){i.ops.length>0?i.rest.push(m):(i.edits.push(m),i.opOf.push(i.ops.length),i.ops.push((0,l.C9)(m.tasks,m.fields)),i.keys.push(null),h+=m.tasks.length,c=!0);continue}if("insert"===m.kind){let r=function e(t,n,l,r){if(null==t||t===u)return t;let i=r(t);if(null!=i)return i;let s=D(n,t);if(null!=s&&s.due>l)return e(s.after,n,l,r)}(m.after,e,t,n);
1void 0===r?i.rest.push(m):(i.edits.push(m),i.opOf.push(i.ops.length),i.ops.push(r===u?(0,l.SL)(m.fields,m.idAa):(0,l.ve)(r,m.fields,m.idAa)),i.keys.push(m.key),h+=1);continue}let v=n(m.id);if(null==v||"detach"!==m.kind&&d.has(v)){i.rest.push(m);continue}if("detach"===m.kind){i.edits.push(m),i.opOf.push(i.ops.length),i.ops.push({op:"detach",id_aa:v,filename:m.name}),i.keys.push(null),d.add(v),h+=1;continue}let g=null!=(p=m.baseRev)?p:"";if("delete"===m.kind&&o.has(v)){i.rest.push(m);continue}if("delete"===m.kind){i.edits.push(m),i.opOf.push(i.ops.length),i.ops.push({op:"delete",id_aa:v,base_rev:g}),i.keys.push(null),h+=1;continue}if(o.has(v)&&!m.resend){i.rest.push(m);continue}let w=a.get(v),x=null==w?void 0:i.ops[w];if((null==x?void 0:x.op)==="set"&&x.base_rev!==g){i.rest.push(m);continue}if(m.resend&&o.add(v),i.edits.push(m),null!=w&&(null==x?void 0:x.op)==="set"){i.opOf.push(w),i.ops[w]={...x,fields:{...x.fields,...m.fields}};continue}i.opOf.push(i.ops.length),a.set(v,i.ops.length),i.ops.push({op:"set",id_aa:v,fields:m.fields,base_rev:g}),i.keys.push(null),h+=1}return i}function k(e,t,n,l){if(!e.some(e=>null==e.rev))return e;let r=new Map;for(let{i:e,id_aa:l,rev:i,status:s}of n){let n=t.ops[e];(null==n?void 0:n.op)==="set"&&"applied"===s&&null!=i?r.set(n.id_aa,i):(null==n?void 0:n.op)==="set"&&"conflict"===s?r.set(n.id_aa,n.base_rev):(null==n?void 0:n.op)==="insert"&&"applied"===s&&null!=l&&null!=i?r.set(l,i):(null==n?void 0:n.op)==="detach"&&"applied"===s&&null!=i&&r.set(n.id_aa,i)}return e.map(e=>{var t;let n=null==e.rev?r.get(null!=(t=l(e.id))?t:e.id):void 0;return null==n?e:{...e,rev:n}})}function _(e,t,n){return t.reduce((e,t)=>h(e,t.id,n,t.before,t.rev),[...e])}function j(e,t,n){return[...e,...t.map(e=>{let{id:t,name:l}=e;return{kind:"detach",id:t,name:l,due:n}})]}function S(e,t,n){let l=new Map,r=new Map;for(let{i:a,rev:u,status:o}of t){var i,s;let t=e[a];if((null==t?void 0:t.op)!=="set"&&(null==t?void 0:t.op)!=="detach")continue;let d=l.has(t.id_aa)?l.get(t.id_aa):n(t.id_aa),c="applied"===o&&null!=u?u:void 0;l.set(t.id_aa,c),"detach"===t.op&&null!=d&&null!=c&&d!==c&&r.set(t.id_aa,{from:null!=(s=null==(i=r.get(t.id_aa))?void 0:i.from)?s:d,to:c})}return r}function C(e,t,n,l){if(0===n.size)return{queue:[...e],holds:t};let r=(e,t)=>{var r;let i=n.get(null!=(r=l(e))?r:e);return null!=i&&t===i.from?i.to:null};return{queue:e.map(e=>{if("set"!==e.kind&&"delete"!==e.kind)return e;let t=r(e.id,e.baseRev);return null==t?e:{...e,baseRev:t}}),holds:t.map(e=>{let t=r(e.id,e.rev);return null==t?e:{...e,rev:t}})}}function N(e,t,n){var l;return 0!==t.size&&("insert"===e.kind?t.has(e.key):("set"===e.kind||"detach"===e.kind)&&(t.has(e.id)||t.has(null!=(l=n(e.id))?l:e.id)))}function E(e,t){return new Set(e.flatMap(e=>{var n;return[e.id,null!=(n=t(e.id))?n:e.id]}))}function R(e){var t,n;return!(null==(t=e.prompt)?void 0:t.trim())&&!(null==(n=e.answer)?void 0:n.trim())&&null==e.rubric&&(null==e.category||"general"===e.category)}function O(e,t,n,r,i){if(e.some(e=>"set"===e.kind&&(e.held||null!=e.invalid)&&e.id===t&&e.field===n))return{kind:"queue",queue:w(g(e,t,n),t,n)};if(null!=D(e,t)){let n=function(e,t,n){let l=D(e,t);if(null==l)return[...e];let r=d(e,t,n,l.due),i=D(r,t);return null!=i&&R(i.fields)?null:r}(e,t,r);return null==n?{kind:"remove"}:{kind:"queue",queue:n}}return null!=i&&(0,l.Nd)(i,n,r)?{kind:"queue",queue:x(e,t,n)}:{kind:"send"}}function D(e,t){return e.find(e=>"insert"===e.kind&&e.key===t)}function M(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!1;return[...e.flatMap(e=>n(e)?[]:["set"===e.kind||"insert"===e.kind?{...e,resend:!0}:e]),...t]}function T(e){let t="object"==typeof e&&null!=e&&"detail"in e?e.detail:null;return Array.isArray(t)?t.flatMap(e=>{if("object"!=typeof e||null==e||!("loc"in e)||!Array.isArray(e.loc))return[];let t=e.loc,n=t.indexOf("ops"),l=t[n+1];if(n<0||"number"!=typeof l)return[];let r=t[n+4];return[{i:l,field:"string"==typeof r?r:null,message:"msg"in e&&"string"==typeof e.msg?e.msg:"Invalid value"}]}):[]}function A(e,t,n){let l=Map.groupBy(t,e=>e.i),r=t=>e.edits.filter((n,l)=>e.opOf[l]===t);for(let[e,t]of l){let n=r(e);
1if(0===n.length||!t.every(e=>n.some(t=>I(t,e))))return null}let i=[],s=[...n];return{queue:[...e.edits.flatMap((t,n)=>{var r,a,u;let o=null==(a=l.get(null!=(u=e.opOf[n])?u:-1))||null==(r=a.find(e=>I(t,e)))?void 0:r.message;if(null==o)return[t];if("delete"===t.kind||"review"===t.kind||"detach"===t.kind)return i.push(o),[];if("set"===t.kind){let e=s.some(e=>"set"===e.kind&&e.id===t.id&&e.field===t.field&&!e.resend),{resend:n,...l}=t;return e?[]:[{...l,due:1/0,invalid:o}]}if(s.some(e=>"delete"===e.kind&&e.id===t.key))return s=s.filter(e=>"insert"===e.kind||"review"===e.kind||e.id!==t.key),[];let{resend:d,invalid:h,...f}=t,p=s.filter(e=>"set"===e.kind&&e.id===t.key);if(0===p.length)return[{...f,due:1/0,invalid:o}];s=s.filter(e=>!p.includes(e));let m=p.reduce((e,t)=>"set"===t.kind?{...c(e,t.fields),...t.fields}:e,t.fields);return[{...f,fields:m,due:Math.min(...p.map(e=>e.due))}]}),...s],lost:i}}function I(e,t){return null==t.field||"set"!==e.kind||Object.keys(e.fields).includes(t.field)}function q(e,t,n,l){let r=new Map,i=new Map,s=new Set,a=new Map,u=0;for(let n of t.results){var o,c,h,f;let l=e.ops[n.i];if((null==l?void 0:l.op)==="insert"&&"applied"===n.status&&null!=n.id_aa&&null!=n.rev)r.set(n.id_aa,{from:void 0,to:n.rev});else if((null==l?void 0:l.op)==="insert"&&"conflict"===n.status&&null!=n.id_aa){let e=t.conflicts[n.id_aa];i.set(n.id_aa,{rev:null!=(c=null!=(o=null==e?void 0:e.rev)?o:n.rev)?c:"",fields:l.task})}else if((null==l?void 0:l.op)==="insert"&&"not_found"===n.status&&n.id_aa===l.id_aa){s.add(n.id_aa);let t=e.keys[n.i],l=null==t?void 0:D(e.edits,t);null!=t&&s.add(t),null!=t&&null!=l&&a.set(t,l.after),u+=1}else(null==l?void 0:l.op)==="delete"&&"conflict"===n.status?u+=1:(null==l?void 0:l.op)==="set"&&"applied"===n.status&&null!=n.rev?r.set(l.id_aa,{from:l.base_rev,to:n.rev}):(null==l?void 0:l.op)==="set"&&"conflict"===n.status?i.set(l.id_aa,{rev:null!=(f=null==(h=t.conflicts[l.id_aa])?void 0:h.rev)?f:l.base_rev,fields:l.fields}):(null==l?void 0:l.op)==="set"&&"not_found"===n.status?(s.add(l.id_aa),u+=1):(null==l?void 0:l.op)==="review"&&"applied"!==n.status&&(u+=1)}let p=e=>{var t;return"insert"===e.kind||"review"===e.kind?void 0:null!=(t=l(e.id))?t:e.id},m=e=>{var t;return"string"==typeof e&&a.has(e)?m(null!=(t=a.get(e))?t:null):e},v=n.filter(e=>{var t;return!s.has(null!=(t=p(e))?t:"")}).map(e=>{let t="insert"===e.kind?m(e.after):null;return"insert"===e.kind&&t!==e.after?{...e,after:t}:e});for(let[e,{rev:t,fields:n}]of i){let l=new Set(v.flatMap(t=>"set"===t.kind&&p(t)===e?[t.field]:[]));v=[...d([],e,n,1/0,t).filter(e=>"set"===e.kind&&!l.has(e.field)),...v]}return{queue:v=v.map(e=>{let t=p(e);if(null==t||"insert"===e.kind||"review"===e.kind||"detach"===e.kind)return e;let n=i.get(t);if("set"===e.kind&&null!=n)return{...e,id:t,baseRev:n.rev,due:1/0,held:!0};let l=r.get(t);return null!=l&&e.baseRev===l.from?{...e,baseRev:l.to}:e}),dropped:u}}function F(e,t,n){let r={minted:[],unplaced:[]};for(let s of t){var i;let t=e.keys[s.i],a=e.ops[s.i];null!=t&&(null==a?void 0:a.op)==="insert"&&(("applied"===s.status||"conflict"===s.status)&&null!=s.id_aa?r.minted.push([t,s.id_aa]):"not_found"===s.status&&s.id_aa!==a.id_aa&&r.unplaced.push({kind:"insert",key:t,idAa:null!=(i=a.id_aa)?i:(0,l.GM)(),after:u,fields:a.task,due:n}))}return r}let L={prompt:"",title:null,category:"general",system_prompt:null,user_persona:null,expected_deliverables:[],reference_filenames:[],rubric:null,flags:[],origins:{"*":"user"}};function H(e,t,n){let i=[...e],s=null,a=new Map,o=null,d=0,c=!1,h=e=>{var t,l,r;let s=null!=(l=null!=(t=n(e))?t:a.get(e))?l:e;if(null==o&&(d+=1)<=K)return i.findIndex(e=>null!=e&&e!==z&&e.id_aa===s);if(null==o)for(let[e,t]of(o=new Map,i.entries()))null==t||t===z||o.has(t.id_aa)||o.set(t.id_aa,e);return null!=(r=o.get(s))?r:-1};for(let n of t){if("insert"===n.kind){if(null!=s||(s=new Set(e.map(e=>null==e?void 0:e.id_aa))),s.has(n.idAa)){a.set(n.key,n.idAa);continue}let t=null==n.after?-1:n.after===u?i.length-1:h(n.after),r=null!=n.after&&-1===t?i.length:t+1;i.splice(r,0,{...L,...(0,l.FB)(n.fields),id_aa:n.key}),r===i.length-1?null==o||o.set(n.key,r):o=null;continue}if("review"===n.kind){for(let e of n.tasks){let t=h(e.id_aa),l=i[t];null!=l&&l!==z&&(i[t]=(0,r.bT)(l,n.fields,!0))}continue}let t=h(n.id),d=i[t];
1null!=d&&d!==z&&("delete"===n.kind?(i[t]=z,null==o||o.delete(d.id_aa),c=!0):"detach"===n.kind?i[t]=(0,l.BQ)(d,n.name):i[t]=(0,l.QC)(d,n.fields))}return c?i.filter(e=>e!==z):i}let K=8,z=Symbol("gone")},76736:(e,t,n)=>{n.d(t,{q:()=>a,y:()=>u});var l=n(58212),r=n(36772),i=n(92515),s=n(84762);let a="Build a benchmark";function u(e){let t,n,a=(0,r.c)(6),{done:u,id:o}=e,d=null==o?"span":"h2";return a[0]!==u?(t=u?(0,l.jsx)("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-brand-mint","aria-label":"Done",children:(0,l.jsx)(i.A,{className:"h-3 w-3"})}):(0,l.jsx)(s.E,{variant:"brandSecondary",className:"h-5 rounded px-1.5 text-[11px] font-medium",children:"Required"}),a[0]=u,a[1]=t):t=a[1],a[2]!==d||a[3]!==o||a[4]!==t?(n=(0,l.jsxs)(d,{id:o,className:"flex items-center gap-2 font-brand-sans text-[15px] font-medium",children:["What models are tested on",t]}),a[2]=d,a[3]=o,a[4]=t,a[5]=n):n=a[5],n}},83305:(e,t,n)=>{n.d(t,{Dd:()=>f,Ml:()=>h,e6:()=>m,iJ:()=>v,ru:()=>p});var l=n(58212),r=n(36772),i=n(96040),s=n(90989),a=n(89474),u=n(60441),o=n(27724),d=n(97245),c=n(51744);let h=[{value:"qa",label:"Q&A"},{value:"agentic",label:"Agentic"},{value:"interaction",label:"Interaction"}];function f(e){return h.find(t=>t.value===(0,d.gU)(e)).label}let p=()=>Promise.all([n.e(27588),n.e(78008)]).then(n.bind(n,78008)).then(e=>e.TypeCardContent),m=(0,s.default)(p,{loading:()=>null});function v(e){let t,n,s,d,h,f,p,m,v,g,w,x=(0,r.c)(33),{label:b,about:y,lock:k,amber:_,marker:j,warm:S,card:C,children:N}=e,E=void 0!==_&&_,[R,O]=(0,i.useState)(!1),[D,M]=(0,i.useState)(!1),[T,A]=(0,i.useState)(!1);!D&&T&&A(!1);let I=(0,i.useRef)(null);x[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{M(e),e&&O(!0)},x[0]=t):t=x[0];let q=t,F=null!=k?a.A:u.A,L=E?"text-amber-700":"text-muted-foreground";x[1]!==b||x[2]!==L?(n=(0,l.jsx)("span",{className:L,children:b}),x[1]=b,x[2]=L,x[3]=n):n=x[3];let H=null!=k?"".concat(b," is locked. ").concat(k):y,K=D?"text-black":E?"text-amber-700":"text-neutral-500";return x[4]!==K?(s=(0,o.cn)("flex h-5 w-5 items-center justify-center rounded-sm hover:text-black",K),x[4]=K,x[5]=s):s=x[5],x[6]!==D?(d=e=>{I.current={touch:"touch"===e.pointerType,wasOpen:D},"touch"!==e.pointerType&&e.preventDefault()},x[6]=D,x[7]=d):d=x[7],x[8]===Symbol.for("react.memo_cache_sentinel")?(h=e=>{var t;e.preventDefault();let n=(null==(t=I.current)?void 0:t.touch)===!0&&I.current.wasOpen;I.current=null,q(!n),A(!n)},x[8]=h):h=x[8],x[9]!==F?(f=(0,l.jsx)(F,{className:"h-4 w-4","aria-hidden":!0}),x[9]=F,x[10]=f):f=x[10],x[11]!==f||x[12]!==H||x[13]!==s||x[14]!==d?(p=(0,l.jsx)("button",{type:"button","aria-label":H,className:s,onPointerDown:d,onClick:h,children:f}),x[11]=f,x[12]=H,x[13]=s,x[14]=d,x[15]=p):p=x[15],x[16]!==j?(m=null!=j&&(0,l.jsx)("span",{className:"pointer-events-none absolute right-0 top-full mt-0.5 text-[11px] leading-3 text-neutral-500",children:j}),x[16]=j,x[17]=m):m=x[17],x[18]!==N||x[19]!==b||x[20]!==p||x[21]!==m||x[22]!==n||x[23]!==S?(v=(0,l.jsx)(c.k$,{asChild:!0,children:(0,l.jsxs)("div",{"data-setup-toggle":b,className:"relative inline-flex items-center gap-2 whitespace-nowrap text-sm",onPointerEnter:S,onFocus:S,children:[n,p,N,m]})}),x[18]=N,x[19]=b,x[20]=p,x[21]=m,x[22]=n,x[23]=S,x[24]=v):v=x[24],x[25]!==C||x[26]!==R||x[27]!==T?(g=R&&C(T),x[25]=C,x[26]=R,x[27]=T,x[28]=g):g=x[28],x[29]!==D||x[30]!==v||x[31]!==g?(w=(0,l.jsxs)(c.m_,{open:D,onOpenChange:q,children:[v,g]}),x[29]=D,x[30]=v,x[31]=g,x[32]=w):w=x[32],w}},84762:(e,t,n)=>{n.d(t,{E:()=>u});var l=n(58212),r=n(36772);n(96040);var i=n(77059),s=n(27724);let a=(0,i.F)("font-brand-sans inline-flex items-center whitespace-nowrap leading-none rounded border transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-brand-purple text-white shadow hover:bg-brand-purple/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",brandOutline:"border border-neutral-100 bg-white",brandSecondary:"border-none bg-black text-white",brandDark:"border border-white/10 bg-white/5 text-white",brandDefault:"border-none bg-brand-purple text-white"},size:{default:"text-xs font-semibold h-6 px-2.5 py-0.5",brandDefault:"text-xs font-normal rounded-md h-6 px-2 py-1 [&_svg]:w-3 [&_svg]:h-3 [&_svg]:shrink-0",brandRounded:"text-xs font-normal rounded-3xl h-6 px-2 py-1 [&_svg]:w-3 [&_svg]:h-3 [&_svg]:shrink-0",brandRoundedSmall:"text-[10px] font-normal rounded-3xl h-6 px-2 py-1 [&_svg]:w-3 [&_svg]:h-3 [&_svg]:shrink-0"}},defaultVariants:{variant:"brandDefault",size:"brandDefault"}});function u(e){let t,n,i,u,o,d,c=(0,r.c)(12);return c[0]!==e?({className:t,variant:u,size:i,...n}=e,c[0]=e,c[1]=t,c[2]=n,c[3]=i,c[4]=u):(t=c[1],n=c[2],i=c[3],u=c[4]),c[5]!==t||c[6]!==i||c[7]!==u?(o=(0,s.cn)(a({variant:u,size:i}),t),c[5]=t,c[6]=i,c[7]=u,c[8]=o):o=c[8],c[9]!==n||c[10]!==o?(d=(0,l.jsx)("div",{className:o,...n}
1),c[9]=n,c[10]=o,c[11]=d):d=c[11],d}},89324:(e,t,n)=>{n.d(t,{C0:()=>i,Fq:()=>a,i0:()=>u,m8:()=>o,ot:()=>s});let l=null,r=new WeakMap;function i(e,t,n){r.set(e,{cursor:t,scroller:n})}function s(e,t){var n;let i=r.get(t),s=null==i?void 0:i.scroller(),a=null==s?null:{width:s.offsetWidth,height:s.offsetHeight};l={benchmarkId:e,grid:t,cursor:null!=(n=null==i?void 0:i.cursor)?n:null,rect:a,focus:null,taken:!1}}function a(e){return(null==l?void 0:l.benchmarkId)!==e?null:(l.taken=!0,l)}function u(e,t){let n=l;return(null==n?void 0:n.grid)===e&&(n.taken?(n.focus=t,queueMicrotask(()=>{l===n&&(l=null)}),!0):(l=null,!1))}function o(e){return null==e||l!==e?null:(l=null,e.focus)}},93957:(e,t,n)=>{n.d(t,{Ce:()=>c,Fi:()=>h,M8:()=>i,Mu:()=>p,N:()=>o,RG:()=>a,WG:()=>d,XB:()=>u,XM:()=>l,f9:()=>s,kl:()=>g,u3:()=>r,wS:()=>f,yA:()=>v});let l={sections:320,panel:400};function r(e){switch(e.kind){case"sections":return{width:l.sections,showsSections:!0,panel:null};case"panel":return{width:l.panel,showsSections:!1,panel:e.panel}}}function i(e){return Math.max(0,...e.split(",").map(e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?e.trim().endsWith("ms")?t:1e3*t:0}))}function s(e,t){return e<=t?{now:e,settle:null}:{now:t,settle:e}}function a(e,t){return"open"===t?e?null:"open":e?"close":null}function u(e,t,n){return t&&!n?null:e}function o(e,t){return e&&t}function d(e,t){return e&&t?"ask":"go"}function c(e,t){return"".concat(e,":").concat(t)}function h(e,t,n){return null==n.seed&&e.id===t&&e.field===n.field}function f(e){return{field:e.field,seed:null}}function p(e,t,n){var l;return{id:t,cell:n,n:(null!=(l=null==e?void 0:e.n)?l:0)+1}}let m="panel_hold";function v(e){return null==e?null:{message:e,code:m}}function g(e,t){return null==t&&(null==e?void 0:e.code)===m?null:e}},97774:(e,t,n)=>{n.d(t,{Fs:()=>i,Jv:()=>c,Y5:()=>o,bT:()=>d,e7:()=>u,wN:()=>s});var l=n(59838);let r=["prompt","title","category","system_prompt","user_persona","expected_deliverables","reference_filenames","rubric"];function i(e,t){var n,l,r,i;return null!=(i=null!=(r=null==(n=e.origins)?void 0:n[t])?r:null==(l=e.origins)?void 0:l["*"])?i:null}function s(e,t){let n=e[t];return("string"==typeof n?""!==n.trim():Array.isArray(n)?n.length>0:null!=n&&n.dimensions.length>0)?i(e,t):null}function a(e,t){let n=s(e,t);return"agent"===n||"guessed"===n}function u(e,t){var n;return a(e,t)&&!(null==(n=e.reviewed)?void 0:n.includes(t))}function o(e){let t={fromAnswers:0,accepted:0,notChecked:0,yours:0,unknown:0,missing:0};for(let r of e){var n;let e=s(r,"rubric"),i="agent"===e||"guessed"===e;(null==(n=r.rubric)?void 0:n.dimensions.length)?"answer"!==e&&(i||null==(0,l.Sj)(r.rubric))?null==e?t.unknown+=1:i?u(r,"rubric")?t.notChecked+=1:t.accepted+=1:t.yours+=1:t.fromAnswers+=1:t.missing+=1}return t}function d(e,t,n){var l;let i=new Set(null!=(l=e.reviewed)?l:[]);for(let l of t)n?a(e,l)&&i.add(l):i.delete(l);return{...e,reviewed:r.filter(e=>i.has(e))}}function c(e,t){var n;let l=r.filter(e=>t.includes(e));return 0===l.length?e:{...e,origins:{...e.origins,...Object.fromEntries(l.map(e=>[e,"user"]))},reviewed:null==(n=e.reviewed)?void 0:n.filter(e=>!l.includes(e))}}}}]);
2//# chunkId=01a0fa55-41e5-7942-934d-20deaea9f2b1

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.