arize-phoenix 11.6.0__py3-none-any.whl → 11.6.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of arize-phoenix might be problematic. Click here for more details.

@@ -1,4 +1,4 @@
1
- import{B as R,bn as Ae,bo as Ze,bp as tn,bq as gt,D as Ul,r as p,j as e,u as Hl,a$ as Ta,l as s,ad as J,S as Y,R as Kn,o as P,aL as Le,aM as sn,aO as _e,aP as ee,al as un,U as W,br as Ue,q as qe,ag as Qe,bs as fi,ak as G,V as ae,W as Ce,aK as Ra,G as K,bt as Gl,bu as fy,bv as hy,bw as ky,aU as je,ah as ml,bx as Dr,am as Ms,ai as Vs,aj as zs,by,aI as De,bz as Li,bA as ol,bB as Te,aF as St,bC as We,bD as Sy,aQ as _n,bE as vy,aT as Fy,bF as Cy,K as Lr,aS as be,b5 as gl,bG as An,b1 as ze,b0 as zn,bH as Sn,m as Ns,$ as Ky,T as Vl,H as _r,aZ as $s,J as Ty,bI as Py,bJ as ni,bK as ai,bL as Tl,aD as dl,t as Wl,bM as Iy,ba as zl,bN as xy,bO as Ar,bP as Dy,bQ as Ly,bR as _y,bS as Ay,bT as wy,bU as Ry,bV as Ey,bW as My,bX as Vy,bY as Pa,F as zy,bZ as Ny,g as js,b_ as $y,aH as vt,b$ as Os,c0 as Qs,c1 as jy,c2 as Oy,c3 as Qy,n as By}from"./vendor-DRWIRkSJ.js";import{r as Ea,C as q,d as qa,a as Ia,T as Xn,q as Ma,p as _i,D as pl,L as Ft,s as Ct,t as qy,k as Bs,P as Ai,E as Kt,m as Ja,n as Jl,b as yl,o as Tt,e as qs,v as Uy,w as wi,x as Hy,A as Ri,y as Us,u as Gy,z as wr,B as Wy}from"./vendor-arizeai-DUhQaeau.js";import{s as Jy,l as Zy,j as Ei,a as en,i as Mi,b as Xy,c as Yy,d as Jn,e as Yn,f as Hs,D as Gs,g as Fa,h as ll,C as pt,k as ef,m as Ee,T as xn,n as nf,o as Vi,p as Rr,q as af,r as Er,t as lf,u as tf,v as rf,P as Zl,w as sf,_ as ne,x as Z,y as X,z as re,A as se,B as oe,E as ue,F as me,G as v,H as xa,I as b,J as F,K as zi,L as E,M as D,N as Va,O as nn,Q as Ws,R as Js,S as ve,U as Fe,V as ke,W as ie,X as Mr,Y as Vr,Z as oa,$ as Je,a0 as Ca,a1 as an,a2 as ln,a3 as vn,a4 as ea,a5 as fl,a6 as Xe,a7 as gn,a8 as Re,a9 as de,aa as pe,ab as yn,ac as Xl,ad as Zs,ae as Oe,af as Xs,ag as Be,ah as we,ai as Ni,aj as jn,ak as Ys,al as eo,am as fn,an as ge,ao as he,ap as hn,aq as ft,ar as Ge,as as aa,at as of,au as df,av as no,aw as hi,ax as $i,ay as Pt,az as cf,aA as uf,aB as ki,aC as rt,aD as Se,aE as ao,aF as Me,aG as Ua,aH as qn,aI as Ya,aJ as mf,aK as gf,aL as lo,aM as Ke,aN as to,aO as zr,aP as Cn,aQ as dn,aR as Nl,aS as da,aT as Da,aU as In,aV as pf,aW as Yl,aX as Ha,aY as ma,aZ as Hn,a_ as kn,a$ as Mn,b0 as It,b1 as la,b2 as ya,b3 as io,b4 as ro,b5 as yf,b6 as ff,b7 as Vn,b8 as hf,b9 as Bn,ba as kf,bb as so,bc as xt,bd as za,be as ji,bf as Oi,bg as bf,bh as oo,bi as Sf,bj as vf,bk as Ff,bl as Cf,bm as Kf,bn as Tf,bo as Pf,bp as If,bq as xf,br as Df,bs as $l,bt as Lf,bu as Pe,bv as bi,bw as Ie,bx as xe,by as Dn,bz as _f,bA as Af,bB as wf,bC as wn,bD as Rf,bE as Ef,bF as Mf,bG as Dt,bH as Lt,bI as co,bJ as Vf,bK as zf,bL as Nf,bM as $f,bN as jf,bO as hl,bP as Of,bQ as uo,bR as _t,bS as Nn,bT as Qf,bU as Bf,bV as qf,bW as ca,bX as mo,bY as pn,bZ as Ye,b_ as go,b$ as ga,c0 as At,c1 as Za,c2 as po,c3 as $n,c4 as Qi,c5 as Qa,c6 as Uf,c7 as yo,c8 as Hf,c9 as Gf,ca as et,cb as Bi,cc as wt,cd as fa,ce as Rt,cf as Et,cg as Si,ch as bn,ci as Mt,cj as fo,ck as Vt,cl as On,cm as ho,cn as zt,co as Wf,cp as ko,cq as bo,cr as Nr,cs as $r,ct as Jf,cu as jl,cv as vi,cw as Nt,cx as cl,cy as Zf,cz as Xf,cA as kl,cB as Yf,cC as eh,cD as Ol,cE as So,cF as nh,cG as vo,cH as $t,cI as jt,cJ as ha,cK as ah,cL as lh,cM as Rn,cN as na,cO as Ga,cP as qi,cQ as Fo,cR as Ui,cS as th,cT as ih,cU as rh,cV as Co,cW as sh,cX as oh,cY as dh,cZ as ch,c_ as il,c$ as Hi,d0 as Ko,d1 as To,d2 as Po,d3 as Gi,d4 as rn,d5 as Io,d6 as xo,d7 as Fi,d8 as uh,d9 as mh,da as gh,db as Wi,dc as ph,dd as yh,de as fh,df as Ot,dg as hh,dh as Do,di as kh,dj as bh,dk as Sh,dl as vh,dm as Fh,dn as Ch,dp as Kh,dq as Th,dr as Ph,ds as Ih,dt as Lo,du as jr,dv as xh,dw as _o,dx as Ji,dy as Ao,dz as ta,dA as ka,dB as Zi,dC as wo,dD as Ro,dE as Or,dF as Qr,dG as Dh,dH as Lh,dI as ce,dJ as Qt,dK as bl,dL as Eo,dM as Sl,dN as vl,dO as Mo,dP as _h,dQ as Ah,dR as Xi,dS as wh,dT as Rh,dU as Eh,dV as Mh,dW as Vh,dX as Ql,dY as Vo,dZ as zo,d_ as zh,d$ as Nh,e0 as Br,e1 as $h,e2 as jh,e3 as Oh,e4 as Qh,e5 as Bh,e6 as qh,e7 as No,e8 as Uh,e9 as Hh,ea as Gh,eb as Wh,ec as Jh,ed as Bl,ee as Yi,ef as $o,eg as tl,eh as Zh,ei as Xh,ej as er,ek as Bt,el as Un,em as ht,en as jo,eo as Yh,ep as ek,eq as nk,er as Oo,es as Qo,et as ak,eu as Bo,ev as nr,ew as lk,ex as qr,ey as tk,ez as ik,eA as rk,eB as sk,eC as ok,eD as dk,eE as Ur,eF as qo,eG as Ci,eH as ck,eI as ar,eJ as lr,eK as uk,eL as rl,eM as mk,eN as gk,eO as pk,eP as Uo,eQ as ul,eR as yk,eS as fk,eT as hk,eU as kk,eV as Ho,eW as bk,eX as Sk,eY as vk,eZ as Fk,e_ as Ck,e$ as Hr,f0 as Gr,f1 as Kk,f2 as Tk,f3 as Go,f4 as Pk,f5 as Ik,f6 as xk,f7 as Wr,f8 as Jr}from"./components-mOUBHJ12.js";import{g as Na,i as $a,d as Dk,E as Wo,R as ja,k as tr,b as Lk,p as nt,n as Jo}from"./vendor-codemirror-D_6Q6Auv.js";import{P as Zo,C as Xo,T as ia,a as Yo,R as Qn,X as ra,Y as Tn,b as sa,B as La,c as qt,d as Fl,A as ql,e as ed,L as ir,f as _k}from"./vendor-recharts-BNBwj7vz.js";const Ak=4,wk="Unable to parse span input messages, expected messages which include a role and content.",Rk="Unable to parse span output messages, expected messages which include a role and content.",Ek="Unable to parse span output expected output.value to be present.",Mk="Unable to parse span attributes, attributes must be valid JSON.",Vk="Unable to parse model config, expected llm.model_name to be present.",zk="Unable to parse model config, expected llm.invocation_parameters JSON string to be present.",Nk="Unable to parse invocation parameters response_format, expected llm.invocation_parameters.response_format to be a well formed json object or undefined.",$k="Unable to parse tools, expected tools to be an array of valid tools.",jk="Unable to parse prompt template variables, expected prompt template variables to be a valid JSON object string.",Zr={AZURE_OPENAI:[],ANTHROPIC:["claude"],OPENAI:["gpt","o1"],GOOGLE:["gemini"],DEEPSEEK:["deepseek"],XAI:["grok"],OLLAMA:[],AWS:["nova","titan"]},Ka="TOOL_CHOICE",sl="tool_choice",Zn="RESPONSE_FORMAT",Gn="response_format",Ok=[Ka,Zn],Qk=R.object({tool_call:R.object({id:R.string().optional(),function:R.object({name:R.string(),arguments:R.string()}).partial()}).partial()}).partial(),nd=R.object({[Ae.message]:R.object({[Ze.role]:R.string(),[Ze.content]:R.union([R.string(),R.array(R.record(R.string(),R.unknown()))]).default(""),[Ze.contents]:R.array(R.object({message_content:R.record(R.string())})).optional(),[Ze.tool_calls]:R.array(Qk).optional(),[Ze.tool_call_id]:R.string().optional()})}),Bk=R.object({[Ae.llm]:R.object({[tn.input_messages]:R.array(nd)})}),qk=R.object({[Ae.llm]:R.object({[tn.output_messages]:R.array(nd)})}),Uk=R.object({[Ae.output]:R.object({value:R.string()})}),ad=Jy()(R.enum(["user","ai","system","tool"])),Hk=R.object({id:R.number(),role:ad,content:R.string().optional(),toolCallId:R.string().optional(),toolCalls:R.array(Zy).optional()}),Gk=R.array(Hk),ld=R.lazy(()=>R.record(Ei)),Wk=ld,td=R.string().transform((n,a)=>{const{json:l}=en(n);if(!Mi(l))return a.addIssue({code:R.ZodIssueCode.custom,message:"The invocation parameters must be a valid JSON object"}),R.NEVER;const{success:t,data:i}=Wk.safeParse(l);return t?i:(a.addIssue({code:R.ZodIssueCode.custom,message:"The invocation parameters must be a valid JSON object"}),R.NEVER)}).default("{}"),Jk=R.object({[Ae.llm]:R.object({[tn.provider]:R.string().optional(),[tn.model_name]:R.string()})}),id=R.object({[Ae.llm]:R.object({[tn.invocation_parameters]:td})}),Zk=R.object({[Ae.llm]:R.object({[tn.invocation_parameters]:td.pipe(R.object({response_format:ld.optional()}))})}),Xk=R.object({url:R.object({full:R.string(),path:R.string().optional()})}),Yk=R.string().transform((n,a)=>{const{json:l}=en(n);return l==null||!Mi(l)?(a.addIssue({code:R.ZodIssueCode.custom,message:"The tool JSON schema must be a valid JSON object"}),R.NEVER):l}).transform((n,a)=>{const{data:l,success:t}=Xy.safeParse(n);return t?l:(a.addIssue({code:R.ZodIssueCode.custom,message:"The tool JSON schema must be a valid tool schema"}),R.NEVER)}),e0=R.object({[Ae.llm]:R.object({[tn.tools]:R.array(R.object({[Ae.tool]:R.object({[gt.json_schema]:Yk})}).optional()).optional()}).optional()}).optional(),n0=R.lazy(()=>R.object({type:R.literal("json_schema"),json_schema:R.object({name:R.string().describe("The name of the schema"),schema:Yy.describe("The schema itself in JSON schema format"),strict:R.literal(!0).describe("The schema must be strict")})})),a0=Ul(n0,{removeAdditionalStrategy:"passthrough"}),l0=R.string().transform((n,a)=>{const{json:l}=en(n);return Jn(l)?Object.entries(l).reduce((i,[r,o])=>{if(typeof o=="string")i[r]=o;else{const{json:d}=Yn(o);d!=null&&(i[r]=d)}return i},{}):(a.addIssue({code:R.ZodIssueCode.custom,message:"The prompt template variables must be a valid JSON object"}),R.NEVER)}),t0=R.object({[Ae.llm]:R.object({[tn.prompt_template]:R.object({variables:l0}).optional()}).optional()}).optional();function rd(n){return ad.safeParse(n).success}function Sa(n){const a=n.toLowerCase();if(rd(a))return a;for(const[l,t]of Object.entries(pt))if(t.includes(a))return l;return ef}function i0({toolCalls:n,provider:a}){if(n!=null)return n.map(({tool_call:l})=>{var i,r,o,d;if(l==null)return null;let t={};if(((i=l.function)==null?void 0:i.arguments)!=null){const{json:c}=en(l.function.arguments);Jn(c)&&(t=c)}switch(a){case"OPENAI":case"AZURE_OPENAI":case"DEEPSEEK":case"XAI":case"AWS":case"OLLAMA":return{id:l.id??"",type:"function",function:{name:((r=l.function)==null?void 0:r.name)??"",arguments:t}};case"ANTHROPIC":return{id:l.id??"",type:"tool_use",name:((o=l.function)==null?void 0:o.name)??"",input:t};case"GOOGLE":return{id:l.id??"",function:{name:((d=l.function)==null?void 0:d.name)??"",arguments:t}};default:Ee()}}).filter(l=>l!=null)}function sd({messages:n,provider:a}){return n.map(({message:l})=>{var t,i;return{id:Fa(),role:l.tool_call_id!=null?Sa("tool"):Sa(l.role),content:Array.isArray(l.contents)?((i=(t=l.contents.find(r=>r.message_content.type==="text"))==null?void 0:t.message_content)==null?void 0:i.text)??void 0:typeof l.content=="string"?l.content:void 0,toolCalls:i0({provider:a,toolCalls:l.tool_calls}),toolCallId:l.tool_call_id}})}function r0({provider:n,parsedAttributes:a}){var t;const l=Bk.safeParse(a);if(!l.success)return{messageParsingErrors:[wk],messages:null};if(n==="ANTHROPIC"){const{success:i,data:r}=id.safeParse(a);if(i){const o=l.data.llm.input_messages,d=(t=r.llm.invocation_parameters)==null?void 0:t.system;typeof d=="string"&&d&&(!o||o[0].message.role!=="system")&&l.data.llm.input_messages.unshift({message:{role:"system",content:d}})}}return{messageParsingErrors:[],messages:sd({provider:n,messages:l.data.llm.input_messages})}}function s0({provider:n,parsedAttributes:a}){const l=[],t=qk.safeParse(a);if(t.success)return{output:sd({provider:n,messages:t.data.llm.output_messages}),outputParsingErrors:l};l.push(Rk);const i=Uk.safeParse(a);return i.success?{output:i.data.output.value,outputParsingErrors:l}:(l.push(Ek),{output:void 0,outputParsingErrors:l})}function od(n){if(n==null)return null;switch(n.toLowerCase()){case"openai":return"OPENAI";case"anthropic":return"ANTHROPIC";case"aws":return"AWS";case"google":return"GOOGLE";case"azure":return"AZURE_OPENAI";default:return null}}function o0(n){for(const a of Object.keys(Zr))if(Zr[a].some(t=>n.includes(t)))return a;return Gs}function d0(n){const{success:a,data:l}=Jk.safeParse(n);if(a){const t=od(l.llm.provider)||o0(l.llm.model_name),i=c0(n);return{modelConfig:{...Object.fromEntries(Object.entries(i).filter(([r,o])=>o!==null)),modelName:l.llm.model_name,provider:t,invocationParameters:[],supportedInvocationParameters:[]},parsingErrors:[]}}return{modelConfig:null,parsingErrors:[Vk]}}function c0(n){const{success:a,data:l}=Xk.safeParse(n);if(a)try{const t=new URL(l.url.full);let i=t;if(l.url.path)try{i=new URL(l.url.full.split(l.url.path)[0])}catch{}return{baseUrl:`${i.origin}${i.pathname}`,endpoint:t.origin,apiVersion:t.searchParams.get("api-version")||null}}catch{}return{baseUrl:null,apiVersion:null,endpoint:null}}function u0(n,a=[]){const{success:l,data:t}=id.safeParse(n),i=[];return l||i.push(zk),{invocationParameters:S0((t==null?void 0:t.llm.invocation_parameters)??{},a),parsingErrors:i}}function m0(n){const{success:a,data:l}=Zk.safeParse(n);return a?{responseFormat:l.llm.invocation_parameters.response_format,parsingErrors:[]}:{responseFormat:void 0,parsingErrors:[Nk]}}function g0(n){var a;return(((a=n==null?void 0:n.llm)==null?void 0:a.tools)??[]).map(l=>(l==null?void 0:l.tool)==null?null:{id:ll(),definition:l.tool.json_schema}).filter(l=>l!=null)}function p0(n){var t;const{data:a,success:l}=e0.safeParse(n);return l?((t=a==null?void 0:a.llm)==null?void 0:t.tools)==null?{tools:null,parsingErrors:[]}:{tools:g0(a),parsingErrors:[]}:{tools:null,parsingErrors:[$k]}}function y0(n){var t;const{success:a,data:l}=t0.safeParse(n);return a?((t=l==null?void 0:l.llm)==null?void 0:t.prompt_template)==null?{variables:null,parsingErrors:[]}:{variables:l.llm.prompt_template.variables,parsingErrors:[]}:{variables:null,parsingErrors:[jk]}}function f0(n){const{instance:a,instanceMessages:l}=Hs(),t={...a,template:{__type:"chat",messages:Object.values(l)}},{json:i,parseError:r}=en(n.attributes);if(r)return{playgroundInstance:{...t,spanId:(n==null?void 0:n.id)??null},parsingErrors:[Mk]};const o=n.invocationParameters,d=d0(i);let{modelConfig:c}=d;const{parsingErrors:u}=d,{messages:y,messageParsingErrors:g}=r0({provider:(c==null?void 0:c.provider)??t.model.provider,parsedAttributes:i}),{output:m,outputParsingErrors:f}=s0({provider:(c==null?void 0:c.provider)??t.model.provider,parsedAttributes:i}),{invocationParameters:h,parsingErrors:k}=u0(i,o),{variables:S,parsingErrors:C}=y0(i),{parsingErrors:T}=m0(i);c=c!=null?{...c,invocationParameters:T.length>0?h.filter(w=>w.invocationName!==Gn&&w.canonicalName!==Zn):h}:null;const{tools:_,parsingErrors:x}=p0(i),N=y==null?void 0:y.map(w=>({...w,content:w.role==="tool"?rr(w.content):w.content}));return{playgroundInstance:{...t,model:c??t.model,template:N!=null?{__type:"chat",messages:N}:t.template,output:m,spanId:n.id,tools:_??t.tools},playgroundInput:S!=null?{variablesValueCache:S}:void 0,parsingErrors:[...g,...f,...u,...x,...k,...T,...C]}}const h0=n=>Gk.safeParse(n).success,dd=({instance:n,templateFormat:a})=>{if(a==xn.NONE)return[];const l=new Set,t=n.template.__type,i=nf(a);switch(t){case"chat":{n.template.messages.forEach(r=>{(r.content==null?[]:i.extractVariables(r.content)).forEach(d=>{l.add(d)})});break}case"text_completion":{i.extractVariables(n.template.prompt).forEach(o=>{l.add(o)});break}default:Ee()}return Array.from(l)},k0=({instances:n,templateFormat:a})=>a==xn.NONE?[]:Array.from(new Set(n.flatMap(l=>dd({instance:l,templateFormat:a})))),cd=({instances:n,templateFormat:a,input:l})=>{if(a==xn.NONE)return{variablesMap:{},variableKeys:[]};const t=k0({instances:n,templateFormat:a}),i=l.variablesValueCache??{};return{variablesMap:t.reduce((o,d)=>(o[d]=i[d]||"",o),{}),variableKeys:t}};function _a(n,a){return n.invocationName===a.invocationName||n.canonicalName!=null&&a.canonicalName!=null&&n.canonicalName===a.canonicalName}const b0=(n,a)=>n.filter(l=>a.some(t=>_a(t,l))).map(l=>{var t;return{...l,invocationName:((t=a.find(i=>_a(i,l)))==null?void 0:t.invocationName)??l.invocationName}}),Cl=n=>n.replace(/_([a-z])/g,(a,l)=>l.toUpperCase()),S0=(n,a)=>Object.entries(n).map(([l,t])=>{const i=a.find(r=>r.canonicalName&&r.canonicalName.toLowerCase()===l.toLowerCase()||r.invocationName&&r.invocationName.toLowerCase()===l.toLowerCase());return i==null||i.invocationInputField==null||i.invocationName==null?null:{canonicalName:i.canonicalName,invocationName:i.invocationName,[Cl(i.invocationInputField)]:t}}).filter(l=>l!=null),ud=n=>{const{provider:a,validatedToolDefinition:l}=rf(n.definition);switch(a){case"OPENAI":case"AZURE_OPENAI":return l.function.name;case"ANTHROPIC":return l.name;case"AWS":return l.toolSpec.name;case"UNKNOWN":return null;default:Ee()}},v0=({provider:n,toolNumber:a})=>{switch(n){case"OPENAI":case"DEEPSEEK":case"XAI":case"OLLAMA":case"AZURE_OPENAI":return{id:ll(),definition:Er(a)};case"ANTHROPIC":return{id:ll(),definition:tf(a)};case"AWS":return{id:ll(),definition:lf(a)};case"GOOGLE":return{id:ll(),definition:Er(a)};default:Ee()}},F0=n=>{switch(n){case"OPENAI":case"AZURE_OPENAI":case"DEEPSEEK":case"XAI":case"AWS":case"OLLAMA":return Rr();case"ANTHROPIC":return af();case"GOOGLE":return Rr();default:Ee()}};function C0(n){return{content:n.content,role:K0(n.role),toolCalls:n.toolCalls,toolCallId:n.toolCallId}}function K0(n){switch(n){case"system":return"SYSTEM";case"user":return"USER";case"tool":return"TOOL";case"ai":return"AI";default:Ee()}}const md=({playgroundStore:n,instanceId:a,credentials:l})=>{var m;const{instances:t,allInstanceMessages:i}=n.getState(),r=t.find(f=>f.id===a);if(!r)throw new Error(`No instance found for id ${a}`);if(r.template.__type!=="chat")throw new Error("We only support chat templates for now");const o=r.template.messageIds.map(f=>i[f]).filter(f=>f!=null),d=r.model.supportedInvocationParameters;let c=[...r.model.invocationParameters];const u=Vi({toolChoice:r.toolChoice,targetProvider:r.model.provider});r.tools.length>0?(c=c.filter(f=>f.invocationName!==sl&&f.canonicalName!==Ka),c.push({canonicalName:Ka,invocationName:sl,valueJson:u})):c=c.filter(f=>f.invocationName!==sl&&f.canonicalName!==Ka),c=d.length?b0(c,d):c;const y=r.model.provider==="AZURE_OPENAI"?{endpoint:r.model.endpoint,apiVersion:r.model.apiVersion}:{},g=r.model.provider==="AWS"?{region:r.model.region}:{};return{messages:o.map(C0),model:{providerKey:r.model.provider,name:r.model.modelName||"",baseUrl:r.model.baseUrl,...y,...g},invocationParameters:pd(c,r.model.provider,r.model.modelName),tools:r.tools.length?r.tools.map(f=>f.definition):void 0,credentials:T0(l,r.model.provider),promptName:(m=r.prompt)==null?void 0:m.name}},Ut=(n,a)=>{if(n.template.__type==="chat"){const{messageIds:l,...t}=n.template;return{...n,template:{...t,messages:n.template.messageIds.map(i=>a[i])}}}return n};function T0(n,a){const l=n[a],t=Zl[a];return l?t.length===0?[]:t.map(i=>({envVarName:i.envVarName,value:l[i.envVarName]??""})):[]}const P0=({playgroundStore:n,instanceId:a,credentials:l})=>{const t=md({playgroundStore:n,instanceId:a,credentials:l}),{instances:i,templateFormat:r,input:o,allInstanceMessages:d}=n.getState(),c=i.map(y=>Ut(y,d)),{variablesMap:u}=cd({instances:c,input:o,templateFormat:r});return{...t,template:{variables:u,format:r}}},Xr=({playgroundStore:n,instanceId:a,credentials:l,datasetId:t})=>({...md({playgroundStore:n,instanceId:a,credentials:l}),templateFormat:n.getState().templateFormat,datasetId:t});function rr(n){if(typeof n=="string"){const a=n.startsWith('"{')||n.startsWith('"[')||n.startsWith('"\\"');try{if(a){const t=JSON.parse(n),i=typeof t=="string"?JSON.parse(t):t;return JSON.stringify(i,null,2)}}catch{}if(/^\s*[0-9{[]|true|false|null/.test(n))return n}return JSON.stringify(n,null,2)}function gd(n,a){return a.filter(l=>l.required).every(l=>n.some(t=>_a(t,l)))}const I0=n=>{for(const[a,l]of Object.entries(n))if(a.endsWith("DefaultValue")&&l!=null)return n[a]};function zP(n,a){const l=new Map(n.map(t=>[t.invocationName,t]));return a.forEach(t=>{var c;const i=t.invocationName,r=I0(t),o=Cl(t.invocationInputField||"");if(!t.invocationName||!t.invocationInputField||!i||r==null||((c=l.get(i))==null?void 0:c[o])!=null)return;const d={canonicalName:t.canonicalName,invocationName:t.invocationName,[o]:r};l.set(i,d)}),Array.from(l.values())}const x0=R.object({type:R.literal("enabled")}).passthrough(),D0=R.object({type:R.enum(["any","tool"])}).passthrough(),L0=(n,a)=>{if(!a)return n;const l=n.some(t=>t.canonicalName==="ANTHROPIC_EXTENDED_THINKING"&&t.valueJson&&x0.safeParse(t.valueJson).success);return n.filter(t=>{if(t.canonicalName==="ANTHROPIC_EXTENDED_THINKING"&&!t.valueJson)return!1;if(l){if(t.canonicalName==="TEMPERATURE"||t.canonicalName==="TOP_P")return!1;if(t.canonicalName===Ka)return!D0.safeParse(t.valueJson).success}return!0})},_0=["frequency_penalty","presence_penalty"],A0=n=>n.filter(l=>l.invocationName&&_0.includes(l.invocationName)?!(l.valueFloat==0||l.valueInt==0):!0),pd=(n,a,l)=>{const t=A0(n);return a==="ANTHROPIC"?L0(t,l):t},yd=p.createContext(null);function NP({children:n,...a}){const[l]=p.useState(()=>sf(a));return e(yd.Provider,{value:l,children:n})}function Wa(n,a){const l=p.useContext(yd);if(!l)throw new Error("Missing CredentialsContext.Provider in the tree");return Hl(l,n,a)}const fd="arize-phoenix-feature-flags",li={dashboards:!1,projectMetricsTab:!1};function w0(){const n=localStorage.getItem(fd);if(!n)return li;try{const a=JSON.parse(n);return Object.assign({},li,a)}catch{return li}}const hd=p.createContext(null);function kd(){const n=Kn.useContext(hd);if(n===null)throw new Error("useFeatureFlags must be used within a FeatureFlagsProvider");return n}function bd(n){const{featureFlags:a}=kd();return a[n]}function $P(n){const[a,l]=p.useState(w0()),t=i=>{localStorage.setItem(fd,JSON.stringify(i)),l(i)};return e(hd.Provider,{value:{featureFlags:a,setFeatureFlags:t},children:e(R0,{children:n.children})})}function R0(n){const{children:a}=n,{featureFlags:l,setFeatureFlags:t}=kd(),[i,r]=p.useState(!1);return Ta("ctrl+shift+f",()=>r(!0)),s(Y,{children:[a,e(J,{isOpen:i,onOpenChange:r,children:e(ne,{children:e(Z,{size:"S",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Feature Flags"}),e(ue,{children:e(me,{slot:"close"})})]}),e(v,{height:"size-1000",padding:"size-100",children:Object.keys(l).map(o=>e(Ea,{isSelected:l[o],onChange:d=>t({...l,[o]:d}),children:o},o))})]})})})})})]})}const Sd=p.createContext(null);function E0(){const n=p.useContext(Sd);if(n===null)throw new Error("useFunctionality must be used within a FunctionalityProvider");return n}function jP(n){return e(Sd.Provider,{value:{authenticationEnabled:window.Config.authenticationEnabled},children:n.children})}const vd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"GenerativeProvidersCard_data",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null},{alias:null,args:null,concreteType:"GenerativeProviderCredentialConfig",kind:"LinkedField",name:"credentialRequirements",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"envVarName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isRequired",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"credentialsSet",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};vd.hash="4062531cfa3f77e541172a44101f5331";function M0({query:n}){const a=Wa(d=>d),l=P.useFragment(vd,n),t=p.useMemo(()=>[...l.modelProviders],[l]),i=p.useMemo(()=>[{header:"Name",accessorKey:"name",cell:({row:d})=>s(b,{direction:"row",alignItems:"center",gap:"size-100",children:[e(xa,{provider:d.original.key,height:18}),d.original.name]})},{header:"Environment Variables",accessorKey:"apiKeyEnvVar",cell:({row:d})=>{const c=Zl[d.original.key],u=(c==null?void 0:c.map(y=>y.envVarName).join(", "))||d.original.credentialRequirements.map(y=>y.envVarName).join(", ")||"--";return e(F,{children:u})}},{header:"configuration",accessorKey:"credentialsSet",cell:({row:d})=>{if(!d.original.dependenciesInstalled)return e(F,{color:"warning",children:"missing dependencies"});const c=d.original.credentialRequirements;if(!zi(d.original.key))return e(F,{color:"warning",children:"unknown provider key"});const u=a[d.original.key];return c.every(({envVarName:g,isRequired:m})=>(u==null?void 0:u[g])!==void 0||!m)?e(F,{color:"success",children:"local"}):d.original.credentialsSet?e(F,{color:"success",children:"configured on the server"}):e(F,{color:"text-700",children:"not configured"})}},{header:"",accessorKey:"id",cell:({row:d})=>e(b,{direction:"row",justifyContent:"end",gap:"size-100",width:"100%",children:s(J,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(Va,{})})}),e(ne,{children:e(Z,{size:"M",children:e(V0,{provider:d.original})})})]})})}],[a]),r=Le({columns:i,data:t,getCoreRowModel:_e(),getSortedRowModel:sn()}),o=r.getRowModel().rows;return e(q,{title:"AI Providers",bodyStyle:{padding:0},variant:"compact",children:s("table",{css:nn,children:[e("thead",{children:r.getHeaderGroups().map(d=>e("tr",{children:d.headers.map(c=>e("th",{colSpan:c.colSpan,children:c.isPlaceholder?null:e("div",{children:ee(c.column.columnDef.header,c.getContext())})},c.id))},d.id))}),e("tbody",{children:o.map(d=>e("tr",{children:d.getVisibleCells().map(c=>e("td",{children:ee(c.column.columnDef.cell,c.getContext())},c.id))},d.id))})]})})}function V0({provider:n}){return e(X,{children:s(re,{children:[s(se,{children:[s(oe,{children:["Configure ",n.name," Credentials"]}),e(ue,{children:e(me,{slot:"close"})})]}),s(v,{padding:"size-200",children:[e(v,{paddingBottom:"size-100",children:s(F,{size:"XS",children:["Set the credentials for the ",n.name," API. These credentials will be stored entirely in your browser and will only be sent to the server during API requests."]})}),s(un,{children:[e(z0,{provider:n.key}),e(v,{paddingTop:"size-200",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",size:"S",slot:"close",children:"Cancel"}),e(E,{variant:"primary",size:"S",slot:"close",children:"Save Credentials"})]})})]})]})]})})}function z0({provider:n}){const a=Wa(i=>i.setCredential),l=Zl[n],t=Wa(i=>i[n]);return e(b,{direction:"column",gap:"size-100",children:l.map(i=>s(Js,{isRequired:i.isRequired,onChange:r=>{a({provider:n,envVarName:i.envVarName,value:r})},value:(t==null?void 0:t[i.envVarName])??void 0,children:[e(W,{children:i.envVarName}),e(Ws,{})]},i.envVarName))})}function OP(){const n=Ue();return qe(n),e(M0,{query:n})}const Fd={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"settingsAIProvidersPageLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"GenerativeProvidersCard_data"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"settingsAIProvidersPageLoaderQuery",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null},{alias:null,args:null,concreteType:"GenerativeProviderCredentialConfig",kind:"LinkedField",name:"credentialRequirements",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"envVarName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isRequired",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"credentialsSet",storageKey:null}],storageKey:null}]},params:{cacheID:"1238ea27e05b70fd2c203ab4be6a1209",id:null,metadata:{},name:"settingsAIProvidersPageLoaderQuery",operationKind:"query",text:`query settingsAIProvidersPageLoaderQuery {
1
+ import{B as R,bn as Ae,bo as Ze,bp as tn,bq as gt,D as Ul,r as p,j as e,u as Hl,a$ as Ta,l as s,ad as J,S as Y,R as Kn,o as T,aL as Le,aM as sn,aO as _e,aP as ee,al as un,U as W,br as Ue,q as qe,ag as Qe,bs as fi,ak as G,V as ae,W as Ce,aK as Ra,G as K,bt as Gl,bu as fy,bv as hy,bw as ky,aU as je,ah as ml,bx as Dr,am as Ms,ai as Vs,aj as zs,by,aI as De,bz as Li,bA as ol,bB as Te,aF as St,bC as We,bD as Sy,aQ as _n,bE as vy,aT as Fy,bF as Cy,K as Lr,aS as be,b5 as gl,bG as An,b1 as ze,b0 as zn,bH as Sn,m as Ns,$ as Ky,T as Vl,H as _r,aZ as $s,J as Ty,bI as Py,bJ as ni,bK as ai,bL as Tl,aD as dl,t as Wl,bM as Iy,ba as zl,bN as xy,bO as Ar,bP as Dy,bQ as Ly,bR as _y,bS as Ay,bT as wy,bU as Ry,bV as Ey,bW as My,bX as Vy,bY as Pa,F as zy,bZ as Ny,g as js,b_ as $y,aH as vt,b$ as Os,c0 as Qs,c1 as jy,c2 as Oy,c3 as Qy,n as By}from"./vendor-DRWIRkSJ.js";import{r as Ea,C as q,d as qa,a as Ia,T as Xn,q as Ma,p as _i,D as pl,L as Ft,s as Ct,t as qy,k as Bs,P as Ai,E as Kt,m as Ja,n as Jl,b as yl,o as Tt,e as qs,v as Uy,w as wi,x as Hy,A as Ri,y as Us,u as Gy,z as wr,B as Wy}from"./vendor-arizeai-DUhQaeau.js";import{s as Jy,l as Zy,j as Ei,a as en,i as Mi,b as Xy,c as Yy,d as Jn,e as Yn,f as Hs,D as Gs,g as Fa,h as ll,C as pt,k as ef,m as Ee,T as xn,n as nf,o as Vi,p as Rr,q as af,r as Er,t as lf,u as tf,v as rf,P as Zl,w as sf,_ as ne,x as Z,y as X,z as re,A as se,B as oe,E as ue,F as me,G as v,H as xa,I as b,J as F,K as zi,L as E,M as D,N as Va,O as nn,Q as Ws,R as Js,S as ve,U as Fe,V as ke,W as ie,X as Mr,Y as Vr,Z as oa,$ as Je,a0 as Ca,a1 as an,a2 as ln,a3 as vn,a4 as ea,a5 as fl,a6 as Xe,a7 as gn,a8 as Re,a9 as de,aa as pe,ab as yn,ac as Xl,ad as Zs,ae as Oe,af as Xs,ag as Be,ah as we,ai as Ni,aj as jn,ak as Ys,al as eo,am as fn,an as ge,ao as he,ap as hn,aq as ft,ar as Ge,as as aa,at as of,au as df,av as no,aw as hi,ax as $i,ay as Pt,az as cf,aA as uf,aB as ki,aC as rt,aD as Se,aE as ao,aF as Me,aG as Ua,aH as qn,aI as Ya,aJ as mf,aK as gf,aL as lo,aM as Ke,aN as to,aO as zr,aP as Cn,aQ as dn,aR as Nl,aS as da,aT as Da,aU as In,aV as pf,aW as Yl,aX as Ha,aY as ma,aZ as Hn,a_ as kn,a$ as Mn,b0 as It,b1 as la,b2 as ya,b3 as io,b4 as ro,b5 as yf,b6 as ff,b7 as Vn,b8 as hf,b9 as Bn,ba as kf,bb as so,bc as xt,bd as za,be as ji,bf as Oi,bg as bf,bh as oo,bi as Sf,bj as vf,bk as Ff,bl as Cf,bm as Kf,bn as Tf,bo as Pf,bp as If,bq as xf,br as Df,bs as $l,bt as Lf,bu as Pe,bv as bi,bw as Ie,bx as xe,by as Dn,bz as _f,bA as Af,bB as wf,bC as wn,bD as Rf,bE as Ef,bF as Mf,bG as Dt,bH as Lt,bI as co,bJ as Vf,bK as zf,bL as Nf,bM as $f,bN as jf,bO as hl,bP as Of,bQ as uo,bR as _t,bS as Nn,bT as Qf,bU as Bf,bV as qf,bW as ca,bX as mo,bY as pn,bZ as Ye,b_ as go,b$ as ga,c0 as At,c1 as Za,c2 as po,c3 as $n,c4 as Qi,c5 as Qa,c6 as Uf,c7 as yo,c8 as Hf,c9 as Gf,ca as et,cb as Bi,cc as wt,cd as fa,ce as Rt,cf as Et,cg as Si,ch as bn,ci as Mt,cj as fo,ck as Vt,cl as On,cm as ho,cn as zt,co as Wf,cp as ko,cq as bo,cr as Nr,cs as $r,ct as Jf,cu as jl,cv as vi,cw as Nt,cx as cl,cy as Zf,cz as Xf,cA as kl,cB as Yf,cC as eh,cD as Ol,cE as So,cF as nh,cG as vo,cH as $t,cI as jt,cJ as ha,cK as ah,cL as lh,cM as Rn,cN as na,cO as Ga,cP as qi,cQ as Fo,cR as Ui,cS as th,cT as ih,cU as rh,cV as Co,cW as sh,cX as oh,cY as dh,cZ as ch,c_ as il,c$ as Hi,d0 as Ko,d1 as To,d2 as Po,d3 as Gi,d4 as rn,d5 as Io,d6 as xo,d7 as Fi,d8 as uh,d9 as mh,da as gh,db as Wi,dc as ph,dd as yh,de as fh,df as Ot,dg as hh,dh as Do,di as kh,dj as bh,dk as Sh,dl as vh,dm as Fh,dn as Ch,dp as Kh,dq as Th,dr as Ph,ds as Ih,dt as Lo,du as jr,dv as xh,dw as _o,dx as Ji,dy as Ao,dz as ta,dA as ka,dB as Zi,dC as wo,dD as Ro,dE as Or,dF as Qr,dG as Dh,dH as Lh,dI as ce,dJ as Qt,dK as bl,dL as Eo,dM as Sl,dN as vl,dO as Mo,dP as _h,dQ as Ah,dR as Xi,dS as wh,dT as Rh,dU as Eh,dV as Mh,dW as Vh,dX as Ql,dY as Vo,dZ as zo,d_ as zh,d$ as Nh,e0 as Br,e1 as $h,e2 as jh,e3 as Oh,e4 as Qh,e5 as Bh,e6 as qh,e7 as No,e8 as Uh,e9 as Hh,ea as Gh,eb as Wh,ec as Jh,ed as Bl,ee as Yi,ef as $o,eg as tl,eh as Zh,ei as Xh,ej as er,ek as Bt,el as Un,em as ht,en as jo,eo as Yh,ep as ek,eq as nk,er as Oo,es as Qo,et as ak,eu as Bo,ev as nr,ew as lk,ex as qr,ey as tk,ez as ik,eA as rk,eB as sk,eC as ok,eD as dk,eE as Ur,eF as qo,eG as Ci,eH as ck,eI as ar,eJ as lr,eK as uk,eL as rl,eM as mk,eN as gk,eO as pk,eP as Uo,eQ as ul,eR as yk,eS as fk,eT as hk,eU as kk,eV as Ho,eW as bk,eX as Sk,eY as vk,eZ as Fk,e_ as Ck,e$ as Hr,f0 as Gr,f1 as Kk,f2 as Tk,f3 as Go,f4 as Pk,f5 as Ik,f6 as xk,f7 as Wr,f8 as Jr}from"./components-BZHttBll.js";import{g as Na,i as $a,d as Dk,E as Wo,R as ja,k as tr,b as Lk,p as nt,n as Jo}from"./vendor-codemirror-D_6Q6Auv.js";import{P as Zo,C as Xo,T as ia,a as Yo,R as Qn,X as ra,Y as Tn,b as sa,B as La,c as qt,d as Fl,A as ql,e as ed,L as ir,f as _k}from"./vendor-recharts-BNBwj7vz.js";const Ak=4,wk="Unable to parse span input messages, expected messages which include a role and content.",Rk="Unable to parse span output messages, expected messages which include a role and content.",Ek="Unable to parse span output expected output.value to be present.",Mk="Unable to parse span attributes, attributes must be valid JSON.",Vk="Unable to parse model config, expected llm.model_name to be present.",zk="Unable to parse model config, expected llm.invocation_parameters JSON string to be present.",Nk="Unable to parse invocation parameters response_format, expected llm.invocation_parameters.response_format to be a well formed json object or undefined.",$k="Unable to parse tools, expected tools to be an array of valid tools.",jk="Unable to parse prompt template variables, expected prompt template variables to be a valid JSON object string.",Zr={AZURE_OPENAI:[],ANTHROPIC:["claude"],OPENAI:["gpt","o1"],GOOGLE:["gemini"],DEEPSEEK:["deepseek"],XAI:["grok"],OLLAMA:[],AWS:["nova","titan"]},Ka="TOOL_CHOICE",sl="tool_choice",Zn="RESPONSE_FORMAT",Gn="response_format",Ok=[Ka,Zn],Qk=R.object({tool_call:R.object({id:R.string().optional(),function:R.object({name:R.string(),arguments:R.string()}).partial()}).partial()}).partial(),nd=R.object({[Ae.message]:R.object({[Ze.role]:R.string(),[Ze.content]:R.union([R.string(),R.array(R.record(R.string(),R.unknown()))]).default(""),[Ze.contents]:R.array(R.object({message_content:R.record(R.string())})).optional(),[Ze.tool_calls]:R.array(Qk).optional(),[Ze.tool_call_id]:R.string().optional()})}),Bk=R.object({[Ae.llm]:R.object({[tn.input_messages]:R.array(nd)})}),qk=R.object({[Ae.llm]:R.object({[tn.output_messages]:R.array(nd)})}),Uk=R.object({[Ae.output]:R.object({value:R.string()})}),ad=Jy()(R.enum(["user","ai","system","tool"])),Hk=R.object({id:R.number(),role:ad,content:R.string().optional(),toolCallId:R.string().optional(),toolCalls:R.array(Zy).optional()}),Gk=R.array(Hk),ld=R.lazy(()=>R.record(Ei)),Wk=ld,td=R.string().transform((n,a)=>{const{json:l}=en(n);if(!Mi(l))return a.addIssue({code:R.ZodIssueCode.custom,message:"The invocation parameters must be a valid JSON object"}),R.NEVER;const{success:t,data:i}=Wk.safeParse(l);return t?i:(a.addIssue({code:R.ZodIssueCode.custom,message:"The invocation parameters must be a valid JSON object"}),R.NEVER)}).default("{}"),Jk=R.object({[Ae.llm]:R.object({[tn.provider]:R.string().optional(),[tn.model_name]:R.string()})}),id=R.object({[Ae.llm]:R.object({[tn.invocation_parameters]:td})}),Zk=R.object({[Ae.llm]:R.object({[tn.invocation_parameters]:td.pipe(R.object({response_format:ld.optional()}))})}),Xk=R.object({url:R.object({full:R.string(),path:R.string().optional()})}),Yk=R.string().transform((n,a)=>{const{json:l}=en(n);return l==null||!Mi(l)?(a.addIssue({code:R.ZodIssueCode.custom,message:"The tool JSON schema must be a valid JSON object"}),R.NEVER):l}).transform((n,a)=>{const{data:l,success:t}=Xy.safeParse(n);return t?l:(a.addIssue({code:R.ZodIssueCode.custom,message:"The tool JSON schema must be a valid tool schema"}),R.NEVER)}),e0=R.object({[Ae.llm]:R.object({[tn.tools]:R.array(R.object({[Ae.tool]:R.object({[gt.json_schema]:Yk})}).optional()).optional()}).optional()}).optional(),n0=R.lazy(()=>R.object({type:R.literal("json_schema"),json_schema:R.object({name:R.string().describe("The name of the schema"),schema:Yy.describe("The schema itself in JSON schema format"),strict:R.literal(!0).describe("The schema must be strict")})})),a0=Ul(n0,{removeAdditionalStrategy:"passthrough"}),l0=R.string().transform((n,a)=>{const{json:l}=en(n);return Jn(l)?Object.entries(l).reduce((i,[r,o])=>{if(typeof o=="string")i[r]=o;else{const{json:d}=Yn(o);d!=null&&(i[r]=d)}return i},{}):(a.addIssue({code:R.ZodIssueCode.custom,message:"The prompt template variables must be a valid JSON object"}),R.NEVER)}),t0=R.object({[Ae.llm]:R.object({[tn.prompt_template]:R.object({variables:l0}).optional()}).optional()}).optional();function rd(n){return ad.safeParse(n).success}function Sa(n){const a=n.toLowerCase();if(rd(a))return a;for(const[l,t]of Object.entries(pt))if(t.includes(a))return l;return ef}function i0({toolCalls:n,provider:a}){if(n!=null)return n.map(({tool_call:l})=>{var i,r,o,d;if(l==null)return null;let t={};if(((i=l.function)==null?void 0:i.arguments)!=null){const{json:c}=en(l.function.arguments);Jn(c)&&(t=c)}switch(a){case"OPENAI":case"AZURE_OPENAI":case"DEEPSEEK":case"XAI":case"AWS":case"OLLAMA":return{id:l.id??"",type:"function",function:{name:((r=l.function)==null?void 0:r.name)??"",arguments:t}};case"ANTHROPIC":return{id:l.id??"",type:"tool_use",name:((o=l.function)==null?void 0:o.name)??"",input:t};case"GOOGLE":return{id:l.id??"",function:{name:((d=l.function)==null?void 0:d.name)??"",arguments:t}};default:Ee()}}).filter(l=>l!=null)}function sd({messages:n,provider:a}){return n.map(({message:l})=>{var t,i;return{id:Fa(),role:l.tool_call_id!=null?Sa("tool"):Sa(l.role),content:Array.isArray(l.contents)?((i=(t=l.contents.find(r=>r.message_content.type==="text"))==null?void 0:t.message_content)==null?void 0:i.text)??void 0:typeof l.content=="string"?l.content:void 0,toolCalls:i0({provider:a,toolCalls:l.tool_calls}),toolCallId:l.tool_call_id}})}function r0({provider:n,parsedAttributes:a}){var t;const l=Bk.safeParse(a);if(!l.success)return{messageParsingErrors:[wk],messages:null};if(n==="ANTHROPIC"){const{success:i,data:r}=id.safeParse(a);if(i){const o=l.data.llm.input_messages,d=(t=r.llm.invocation_parameters)==null?void 0:t.system;typeof d=="string"&&d&&(!o||o[0].message.role!=="system")&&l.data.llm.input_messages.unshift({message:{role:"system",content:d}})}}return{messageParsingErrors:[],messages:sd({provider:n,messages:l.data.llm.input_messages})}}function s0({provider:n,parsedAttributes:a}){const l=[],t=qk.safeParse(a);if(t.success)return{output:sd({provider:n,messages:t.data.llm.output_messages}),outputParsingErrors:l};l.push(Rk);const i=Uk.safeParse(a);return i.success?{output:i.data.output.value,outputParsingErrors:l}:(l.push(Ek),{output:void 0,outputParsingErrors:l})}function od(n){if(n==null)return null;switch(n.toLowerCase()){case"openai":return"OPENAI";case"anthropic":return"ANTHROPIC";case"aws":return"AWS";case"google":return"GOOGLE";case"azure":return"AZURE_OPENAI";default:return null}}function o0(n){for(const a of Object.keys(Zr))if(Zr[a].some(t=>n.includes(t)))return a;return Gs}function d0(n){const{success:a,data:l}=Jk.safeParse(n);if(a){const t=od(l.llm.provider)||o0(l.llm.model_name),i=c0(n);return{modelConfig:{...Object.fromEntries(Object.entries(i).filter(([r,o])=>o!==null)),modelName:l.llm.model_name,provider:t,invocationParameters:[],supportedInvocationParameters:[]},parsingErrors:[]}}return{modelConfig:null,parsingErrors:[Vk]}}function c0(n){const{success:a,data:l}=Xk.safeParse(n);if(a)try{const t=new URL(l.url.full);let i=t;if(l.url.path)try{i=new URL(l.url.full.split(l.url.path)[0])}catch{}return{baseUrl:`${i.origin}${i.pathname}`,endpoint:t.origin,apiVersion:t.searchParams.get("api-version")||null}}catch{}return{baseUrl:null,apiVersion:null,endpoint:null}}function u0(n,a=[]){const{success:l,data:t}=id.safeParse(n),i=[];return l||i.push(zk),{invocationParameters:S0((t==null?void 0:t.llm.invocation_parameters)??{},a),parsingErrors:i}}function m0(n){const{success:a,data:l}=Zk.safeParse(n);return a?{responseFormat:l.llm.invocation_parameters.response_format,parsingErrors:[]}:{responseFormat:void 0,parsingErrors:[Nk]}}function g0(n){var a;return(((a=n==null?void 0:n.llm)==null?void 0:a.tools)??[]).map(l=>(l==null?void 0:l.tool)==null?null:{id:ll(),definition:l.tool.json_schema}).filter(l=>l!=null)}function p0(n){var t;const{data:a,success:l}=e0.safeParse(n);return l?((t=a==null?void 0:a.llm)==null?void 0:t.tools)==null?{tools:null,parsingErrors:[]}:{tools:g0(a),parsingErrors:[]}:{tools:null,parsingErrors:[$k]}}function y0(n){var t;const{success:a,data:l}=t0.safeParse(n);return a?((t=l==null?void 0:l.llm)==null?void 0:t.prompt_template)==null?{variables:null,parsingErrors:[]}:{variables:l.llm.prompt_template.variables,parsingErrors:[]}:{variables:null,parsingErrors:[jk]}}function f0(n){const{instance:a,instanceMessages:l}=Hs(),t={...a,template:{__type:"chat",messages:Object.values(l)}},{json:i,parseError:r}=en(n.attributes);if(r)return{playgroundInstance:{...t,spanId:(n==null?void 0:n.id)??null},parsingErrors:[Mk]};const o=n.invocationParameters,d=d0(i);let{modelConfig:c}=d;const{parsingErrors:u}=d,{messages:y,messageParsingErrors:g}=r0({provider:(c==null?void 0:c.provider)??t.model.provider,parsedAttributes:i}),{output:m,outputParsingErrors:f}=s0({provider:(c==null?void 0:c.provider)??t.model.provider,parsedAttributes:i}),{invocationParameters:h,parsingErrors:k}=u0(i,o),{variables:S,parsingErrors:C}=y0(i),{parsingErrors:P}=m0(i);c=c!=null?{...c,invocationParameters:P.length>0?h.filter(w=>w.invocationName!==Gn&&w.canonicalName!==Zn):h}:null;const{tools:L,parsingErrors:x}=p0(i),N=y==null?void 0:y.map(w=>({...w,content:w.role==="tool"?rr(w.content):w.content}));return{playgroundInstance:{...t,model:c??t.model,template:N!=null?{__type:"chat",messages:N}:t.template,output:m,spanId:n.id,tools:L??t.tools},playgroundInput:S!=null?{variablesValueCache:S}:void 0,parsingErrors:[...g,...f,...u,...x,...k,...P,...C]}}const h0=n=>Gk.safeParse(n).success,dd=({instance:n,templateFormat:a})=>{if(a==xn.NONE)return[];const l=new Set,t=n.template.__type,i=nf(a);switch(t){case"chat":{n.template.messages.forEach(r=>{(r.content==null?[]:i.extractVariables(r.content)).forEach(d=>{l.add(d)})});break}case"text_completion":{i.extractVariables(n.template.prompt).forEach(o=>{l.add(o)});break}default:Ee()}return Array.from(l)},k0=({instances:n,templateFormat:a})=>a==xn.NONE?[]:Array.from(new Set(n.flatMap(l=>dd({instance:l,templateFormat:a})))),cd=({instances:n,templateFormat:a,input:l})=>{if(a==xn.NONE)return{variablesMap:{},variableKeys:[]};const t=k0({instances:n,templateFormat:a}),i=l.variablesValueCache??{};return{variablesMap:t.reduce((o,d)=>(o[d]=i[d]||"",o),{}),variableKeys:t}};function _a(n,a){return n.invocationName===a.invocationName||n.canonicalName!=null&&a.canonicalName!=null&&n.canonicalName===a.canonicalName}const b0=(n,a)=>n.filter(l=>a.some(t=>_a(t,l))).map(l=>{var t;return{...l,invocationName:((t=a.find(i=>_a(i,l)))==null?void 0:t.invocationName)??l.invocationName}}),Cl=n=>n.replace(/_([a-z])/g,(a,l)=>l.toUpperCase()),S0=(n,a)=>Object.entries(n).map(([l,t])=>{const i=a.find(r=>r.canonicalName&&r.canonicalName.toLowerCase()===l.toLowerCase()||r.invocationName&&r.invocationName.toLowerCase()===l.toLowerCase());return i==null||i.invocationInputField==null||i.invocationName==null?null:{canonicalName:i.canonicalName,invocationName:i.invocationName,[Cl(i.invocationInputField)]:t}}).filter(l=>l!=null),ud=n=>{const{provider:a,validatedToolDefinition:l}=rf(n.definition);switch(a){case"OPENAI":case"AZURE_OPENAI":return l.function.name;case"ANTHROPIC":return l.name;case"AWS":return l.toolSpec.name;case"UNKNOWN":return null;default:Ee()}},v0=({provider:n,toolNumber:a})=>{switch(n){case"OPENAI":case"DEEPSEEK":case"XAI":case"OLLAMA":case"AZURE_OPENAI":return{id:ll(),definition:Er(a)};case"ANTHROPIC":return{id:ll(),definition:tf(a)};case"AWS":return{id:ll(),definition:lf(a)};case"GOOGLE":return{id:ll(),definition:Er(a)};default:Ee()}},F0=n=>{switch(n){case"OPENAI":case"AZURE_OPENAI":case"DEEPSEEK":case"XAI":case"AWS":case"OLLAMA":return Rr();case"ANTHROPIC":return af();case"GOOGLE":return Rr();default:Ee()}};function C0(n){return{content:n.content,role:K0(n.role),toolCalls:n.toolCalls,toolCallId:n.toolCallId}}function K0(n){switch(n){case"system":return"SYSTEM";case"user":return"USER";case"tool":return"TOOL";case"ai":return"AI";default:Ee()}}const md=({playgroundStore:n,instanceId:a,credentials:l})=>{var m;const{instances:t,allInstanceMessages:i}=n.getState(),r=t.find(f=>f.id===a);if(!r)throw new Error(`No instance found for id ${a}`);if(r.template.__type!=="chat")throw new Error("We only support chat templates for now");const o=r.template.messageIds.map(f=>i[f]).filter(f=>f!=null),d=r.model.supportedInvocationParameters;let c=[...r.model.invocationParameters];const u=Vi({toolChoice:r.toolChoice,targetProvider:r.model.provider});r.tools.length>0?(c=c.filter(f=>f.invocationName!==sl&&f.canonicalName!==Ka),c.push({canonicalName:Ka,invocationName:sl,valueJson:u})):c=c.filter(f=>f.invocationName!==sl&&f.canonicalName!==Ka),c=d.length?b0(c,d):c;const y=r.model.provider==="AZURE_OPENAI"?{endpoint:r.model.endpoint,apiVersion:r.model.apiVersion}:{},g=r.model.provider==="AWS"?{region:r.model.region}:{};return{messages:o.map(C0),model:{providerKey:r.model.provider,name:r.model.modelName||"",baseUrl:r.model.baseUrl,...y,...g},invocationParameters:pd(c,r.model.provider,r.model.modelName),tools:r.tools.length?r.tools.map(f=>f.definition):void 0,credentials:T0(l,r.model.provider),promptName:(m=r.prompt)==null?void 0:m.name}},Ut=(n,a)=>{if(n.template.__type==="chat"){const{messageIds:l,...t}=n.template;return{...n,template:{...t,messages:n.template.messageIds.map(i=>a[i])}}}return n};function T0(n,a){const l=n[a],t=Zl[a];return l?t.length===0?[]:t.map(i=>({envVarName:i.envVarName,value:l[i.envVarName]??""})):[]}const P0=({playgroundStore:n,instanceId:a,credentials:l})=>{const t=md({playgroundStore:n,instanceId:a,credentials:l}),{instances:i,templateFormat:r,input:o,allInstanceMessages:d}=n.getState(),c=i.map(y=>Ut(y,d)),{variablesMap:u}=cd({instances:c,input:o,templateFormat:r});return{...t,template:{variables:u,format:r}}},Xr=({playgroundStore:n,instanceId:a,credentials:l,datasetId:t})=>({...md({playgroundStore:n,instanceId:a,credentials:l}),templateFormat:n.getState().templateFormat,datasetId:t});function rr(n){if(typeof n=="string"){const a=n.startsWith('"{')||n.startsWith('"[')||n.startsWith('"\\"');try{if(a){const t=JSON.parse(n),i=typeof t=="string"?JSON.parse(t):t;return JSON.stringify(i,null,2)}}catch{}if(/^\s*[0-9{[]|true|false|null/.test(n))return n}return JSON.stringify(n,null,2)}function gd(n,a){return a.filter(l=>l.required).every(l=>n.some(t=>_a(t,l)))}const I0=n=>{for(const[a,l]of Object.entries(n))if(a.endsWith("DefaultValue")&&l!=null)return n[a]};function zP(n,a){const l=new Map(n.map(t=>[t.invocationName,t]));return a.forEach(t=>{var c;const i=t.invocationName,r=I0(t),o=Cl(t.invocationInputField||"");if(!t.invocationName||!t.invocationInputField||!i||r==null||((c=l.get(i))==null?void 0:c[o])!=null)return;const d={canonicalName:t.canonicalName,invocationName:t.invocationName,[o]:r};l.set(i,d)}),Array.from(l.values())}const x0=R.object({type:R.literal("enabled")}).passthrough(),D0=R.object({type:R.enum(["any","tool"])}).passthrough(),L0=(n,a)=>{if(!a)return n;const l=n.some(t=>t.canonicalName==="ANTHROPIC_EXTENDED_THINKING"&&t.valueJson&&x0.safeParse(t.valueJson).success);return n.filter(t=>{if(t.canonicalName==="ANTHROPIC_EXTENDED_THINKING"&&!t.valueJson)return!1;if(l){if(t.canonicalName==="TEMPERATURE"||t.canonicalName==="TOP_P")return!1;if(t.canonicalName===Ka)return!D0.safeParse(t.valueJson).success}return!0})},_0=["frequency_penalty","presence_penalty"],A0=n=>n.filter(l=>l.invocationName&&_0.includes(l.invocationName)?!(l.valueFloat==0||l.valueInt==0):!0),pd=(n,a,l)=>{const t=A0(n);return a==="ANTHROPIC"?L0(t,l):t},yd=p.createContext(null);function NP({children:n,...a}){const[l]=p.useState(()=>sf(a));return e(yd.Provider,{value:l,children:n})}function Wa(n,a){const l=p.useContext(yd);if(!l)throw new Error("Missing CredentialsContext.Provider in the tree");return Hl(l,n,a)}const fd="arize-phoenix-feature-flags",li={dashboards:!1,projectMetricsTab:!1};function w0(){const n=localStorage.getItem(fd);if(!n)return li;try{const a=JSON.parse(n);return Object.assign({},li,a)}catch{return li}}const hd=p.createContext(null);function kd(){const n=Kn.useContext(hd);if(n===null)throw new Error("useFeatureFlags must be used within a FeatureFlagsProvider");return n}function bd(n){const{featureFlags:a}=kd();return a[n]}function $P(n){const[a,l]=p.useState(w0()),t=i=>{localStorage.setItem(fd,JSON.stringify(i)),l(i)};return e(hd.Provider,{value:{featureFlags:a,setFeatureFlags:t},children:e(R0,{children:n.children})})}function R0(n){const{children:a}=n,{featureFlags:l,setFeatureFlags:t}=kd(),[i,r]=p.useState(!1);return Ta("ctrl+shift+f",()=>r(!0)),s(Y,{children:[a,e(J,{isOpen:i,onOpenChange:r,children:e(ne,{children:e(Z,{size:"S",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Feature Flags"}),e(ue,{children:e(me,{slot:"close"})})]}),e(v,{height:"size-1000",padding:"size-100",children:Object.keys(l).map(o=>e(Ea,{isSelected:l[o],onChange:d=>t({...l,[o]:d}),children:o},o))})]})})})})})]})}const Sd=p.createContext(null);function E0(){const n=p.useContext(Sd);if(n===null)throw new Error("useFunctionality must be used within a FunctionalityProvider");return n}function jP(n){return e(Sd.Provider,{value:{authenticationEnabled:window.Config.authenticationEnabled},children:n.children})}const vd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"GenerativeProvidersCard_data",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null},{alias:null,args:null,concreteType:"GenerativeProviderCredentialConfig",kind:"LinkedField",name:"credentialRequirements",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"envVarName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isRequired",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"credentialsSet",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};vd.hash="4062531cfa3f77e541172a44101f5331";function M0({query:n}){const a=Wa(d=>d),l=T.useFragment(vd,n),t=p.useMemo(()=>[...l.modelProviders],[l]),i=p.useMemo(()=>[{header:"Name",accessorKey:"name",cell:({row:d})=>s(b,{direction:"row",alignItems:"center",gap:"size-100",children:[e(xa,{provider:d.original.key,height:18}),d.original.name]})},{header:"Environment Variables",accessorKey:"apiKeyEnvVar",cell:({row:d})=>{const c=Zl[d.original.key],u=(c==null?void 0:c.map(y=>y.envVarName).join(", "))||d.original.credentialRequirements.map(y=>y.envVarName).join(", ")||"--";return e(F,{children:u})}},{header:"configuration",accessorKey:"credentialsSet",cell:({row:d})=>{if(!d.original.dependenciesInstalled)return e(F,{color:"warning",children:"missing dependencies"});const c=d.original.credentialRequirements;if(!zi(d.original.key))return e(F,{color:"warning",children:"unknown provider key"});const u=a[d.original.key];return c.every(({envVarName:g,isRequired:m})=>(u==null?void 0:u[g])!==void 0||!m)?e(F,{color:"success",children:"local"}):d.original.credentialsSet?e(F,{color:"success",children:"configured on the server"}):e(F,{color:"text-700",children:"not configured"})}},{header:"",accessorKey:"id",cell:({row:d})=>e(b,{direction:"row",justifyContent:"end",gap:"size-100",width:"100%",children:s(J,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(Va,{})})}),e(ne,{children:e(Z,{size:"M",children:e(V0,{provider:d.original})})})]})})}],[a]),r=Le({columns:i,data:t,getCoreRowModel:_e(),getSortedRowModel:sn()}),o=r.getRowModel().rows;return e(q,{title:"AI Providers",bodyStyle:{padding:0},variant:"compact",children:s("table",{css:nn,children:[e("thead",{children:r.getHeaderGroups().map(d=>e("tr",{children:d.headers.map(c=>e("th",{colSpan:c.colSpan,children:c.isPlaceholder?null:e("div",{children:ee(c.column.columnDef.header,c.getContext())})},c.id))},d.id))}),e("tbody",{children:o.map(d=>e("tr",{children:d.getVisibleCells().map(c=>e("td",{children:ee(c.column.columnDef.cell,c.getContext())},c.id))},d.id))})]})})}function V0({provider:n}){return e(X,{children:s(re,{children:[s(se,{children:[s(oe,{children:["Configure ",n.name," Credentials"]}),e(ue,{children:e(me,{slot:"close"})})]}),s(v,{padding:"size-200",children:[e(v,{paddingBottom:"size-100",children:s(F,{size:"XS",children:["Set the credentials for the ",n.name," API. These credentials will be stored entirely in your browser and will only be sent to the server during API requests."]})}),s(un,{children:[e(z0,{provider:n.key}),e(v,{paddingTop:"size-200",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",size:"S",slot:"close",children:"Cancel"}),e(E,{variant:"primary",size:"S",slot:"close",children:"Save Credentials"})]})})]})]})]})})}function z0({provider:n}){const a=Wa(i=>i.setCredential),l=Zl[n],t=Wa(i=>i[n]);return e(b,{direction:"column",gap:"size-100",children:l.map(i=>s(Js,{isRequired:i.isRequired,onChange:r=>{a({provider:n,envVarName:i.envVarName,value:r})},value:(t==null?void 0:t[i.envVarName])??void 0,children:[e(W,{children:i.envVarName}),e(Ws,{})]},i.envVarName))})}function OP(){const n=Ue();return qe(n),e(M0,{query:n})}const Fd={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"settingsAIProvidersPageLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"GenerativeProvidersCard_data"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"settingsAIProvidersPageLoaderQuery",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null},{alias:null,args:null,concreteType:"GenerativeProviderCredentialConfig",kind:"LinkedField",name:"credentialRequirements",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"envVarName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isRequired",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"credentialsSet",storageKey:null}],storageKey:null}]},params:{cacheID:"1238ea27e05b70fd2c203ab4be6a1209",id:null,metadata:{},name:"settingsAIProvidersPageLoaderQuery",operationKind:"query",text:`query settingsAIProvidersPageLoaderQuery {
2
2
  ...GenerativeProvidersCard_data
3
3
  }
4
4
 
@@ -15,7 +15,7 @@ fragment GenerativeProvidersCard_data on Query {
15
15
  credentialsSet
16
16
  }
17
17
  }
18
- `}};Fd.hash="2c8eecb8897f8c7dadfdc3de4e2a41a8";async function QP(){return await P.fetchQuery(ve,Fd,{}).toPromise()}const Cd=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t=[l],i={kind:"InlineFragment",selections:t,type:"ContinuousAnnotationConfig",abstractKey:null},r={kind:"InlineFragment",selections:t,type:"CategoricalAnnotationConfig",abstractKey:null},o={kind:"InlineFragment",selections:t,type:"FreeformAnnotationConfig",abstractKey:null},d={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},m={kind:"InlineFragment",selections:t,type:"Node",abstractKey:"__isNode"};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SettingsAnnotationsPageUpdateAnnotationConfigMutation",selections:[{alias:null,args:a,concreteType:"UpdateAnnotationConfigPayload",kind:"LinkedField",name:"updateAnnotationConfig",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"AnnotationConfigTableFragment"}],storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"annotationConfig",plural:!1,selections:[i,r,o],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SettingsAnnotationsPageUpdateAnnotationConfigMutation",selections:[{alias:null,args:a,concreteType:"UpdateAnnotationConfigPayload",kind:"LinkedField",name:"updateAnnotationConfig",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"annotationConfig",args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[d,{kind:"InlineFragment",selections:[l,c,u,y,g,{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null}],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[l,c,u,y,g,{alias:null,args:null,kind:"ScalarField",name:"upperBound",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lowerBound",storageKey:null}],type:"ContinuousAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[l,c,u,y],type:"FreeformAnnotationConfig",abstractKey:null},m],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"annotationConfig",plural:!1,selections:[d,i,r,o,m],storageKey:null}],storageKey:null}]},params:{cacheID:"257070989d0363192027975755cb6b4a",id:null,metadata:{},name:"SettingsAnnotationsPageUpdateAnnotationConfigMutation",operationKind:"mutation",text:`mutation SettingsAnnotationsPageUpdateAnnotationConfigMutation(
18
+ `}};Fd.hash="2c8eecb8897f8c7dadfdc3de4e2a41a8";async function QP(){return await T.fetchQuery(ve,Fd,{}).toPromise()}const Cd=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t=[l],i={kind:"InlineFragment",selections:t,type:"ContinuousAnnotationConfig",abstractKey:null},r={kind:"InlineFragment",selections:t,type:"CategoricalAnnotationConfig",abstractKey:null},o={kind:"InlineFragment",selections:t,type:"FreeformAnnotationConfig",abstractKey:null},d={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},m={kind:"InlineFragment",selections:t,type:"Node",abstractKey:"__isNode"};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SettingsAnnotationsPageUpdateAnnotationConfigMutation",selections:[{alias:null,args:a,concreteType:"UpdateAnnotationConfigPayload",kind:"LinkedField",name:"updateAnnotationConfig",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"AnnotationConfigTableFragment"}],storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"annotationConfig",plural:!1,selections:[i,r,o],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SettingsAnnotationsPageUpdateAnnotationConfigMutation",selections:[{alias:null,args:a,concreteType:"UpdateAnnotationConfigPayload",kind:"LinkedField",name:"updateAnnotationConfig",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"annotationConfig",args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[d,{kind:"InlineFragment",selections:[l,c,u,y,g,{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null}],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[l,c,u,y,g,{alias:null,args:null,kind:"ScalarField",name:"upperBound",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lowerBound",storageKey:null}],type:"ContinuousAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[l,c,u,y],type:"FreeformAnnotationConfig",abstractKey:null},m],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"annotationConfig",plural:!1,selections:[d,i,r,o,m],storageKey:null}],storageKey:null}]},params:{cacheID:"257070989d0363192027975755cb6b4a",id:null,metadata:{},name:"SettingsAnnotationsPageUpdateAnnotationConfigMutation",operationKind:"mutation",text:`mutation SettingsAnnotationsPageUpdateAnnotationConfigMutation(
19
19
  $input: UpdateAnnotationConfigInput!
20
20
  ) {
21
21
  updateAnnotationConfig(input: $input) {
@@ -227,9 +227,9 @@ fragment AnnotationConfigTableFragment on Query {
227
227
  width: fit-content;
228
228
  `},n.original.id)},{id:"description",header:"Description",accessorKey:"description",sortUndefined:"last",accessorFn:n=>n.description??void 0,maxSize:150,cell:({row:n})=>e(Xe,{maxWidth:"100%",children:e(F,{children:n.original.description})})},{id:"annotationType",header:"Type",accessorKey:"annotationType",minSize:10,cell:({row:n})=>e(F,{children:n.original.annotationType.charAt(0).toUpperCase()+n.original.annotationType.slice(1).toLowerCase()})},{id:"values",header:"Values",enableSorting:!1,accessorFn:n=>{switch(n.annotationType){case"CATEGORICAL":{if(!n.values)return"";let a=n.values.map((l,t)=>e(gn,{title:l.label,children:e(Xe,{maxWidth:"40px",children:l.label})},t));return n.values.length>5&&(a=[...a.slice(-4),s(Xn,{delay:64,placement:"bottom right",children:[e(qa,{children:s(gn,{css:K`
229
229
  white-space: nowrap;
230
- `,children:["+ ",n.values.length-5," more"]},"ellipsis")}),e(Ia,{children:n.values.map(l=>l.label).join(", ")})]},"ellipsis")]),a}case"CONTINUOUS":return`from ${n.lowerBound} to ${n.upperBound}`;case"FREEFORM":return"";default:return""}},cell:({getValue:n})=>{const a=n();return e(b,{gap:"size-100",children:a})}}],Q0=({annotationConfigs:n,onDeleteAnnotationConfig:a,onEditAnnotationConfig:l})=>{const[t,i]=p.useState({}),r=P.useFragment(xd,n),o=p.useMemo(()=>r.annotationConfigs.edges.map(f=>f.annotationConfig),[r.annotationConfigs.edges]),d=Le({data:o,columns:O0,getCoreRowModel:_e(),getSortedRowModel:sn(),enableRowSelection:!0,onRowSelectionChange:i,enableMultiRowSelection:!1,state:{rowSelection:t}}),c=d.getRowCount()===0,u=d.getRowModel().rows,y=d.getSelectedRowModel().rows,g=y.map(f=>f.original),m=()=>{i({})};return s("div",{css:K`
230
+ `,children:["+ ",n.values.length-5," more"]},"ellipsis")}),e(Ia,{children:n.values.map(l=>l.label).join(", ")})]},"ellipsis")]),a}case"CONTINUOUS":return`from ${n.lowerBound} to ${n.upperBound}`;case"FREEFORM":return"";default:return""}},cell:({getValue:n})=>{const a=n();return e(b,{gap:"size-100",children:a})}}],Q0=({annotationConfigs:n,onDeleteAnnotationConfig:a,onEditAnnotationConfig:l})=>{const[t,i]=p.useState({}),r=T.useFragment(xd,n),o=p.useMemo(()=>r.annotationConfigs.edges.map(f=>f.annotationConfig),[r.annotationConfigs.edges]),d=Le({data:o,columns:O0,getCoreRowModel:_e(),getSortedRowModel:sn(),enableRowSelection:!0,onRowSelectionChange:i,enableMultiRowSelection:!1,state:{rowSelection:t}}),c=d.getRowCount()===0,u=d.getRowModel().rows,y=d.getSelectedRowModel().rows,g=y.map(f=>f.original),m=()=>{i({})};return s("div",{css:K`
231
231
  overflow: auto;
232
- `,children:[s("table",{css:nn,style:{width:d.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:d.getHeaderGroups().map(f=>e("tr",{children:f.headers.map(h=>e("th",{colSpan:h.colSpan,children:h.isPlaceholder?null:s("div",{className:h.column.getCanSort()?"sort":"",onClick:h.column.getToggleSortingHandler(),style:{left:h.getStart(),width:h.getSize()},children:[ee(h.column.columnDef.header,h.getContext()),h.column.getIsSorted()?e(D,{className:"sort-icon",svg:h.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},h.id))},f.id))}),c?e(vn,{message:"No Annotation Configs"}):e("tbody",{children:u.map(f=>e("tr",{onClick:()=>{i({[f.id]:!(t!=null&&t[f.id])})},children:f.getVisibleCells().map(h=>e("td",{style:{width:h.column.getSize(),maxWidth:h.column.getSize()},children:ee(h.column.columnDef.cell,h.getContext())},h.id))},f.id))})]}),y.length>0&&e(j0,{selectedConfig:g[0],onClearSelection:m,onEditAnnotationConfig:l,onDeleteAnnotationConfig:a})]})},BP=()=>{const n=Ue();return e(B0,{annotations:n})},B0=({annotations:n})=>{const{revalidate:a}=Gl(),l=P.useFragment(Pd,n),[t]=P.useMutation(Td),[i]=P.useMutation(Kd),r=y=>g=>{const m=Re(g);y==null||y((m==null?void 0:m[0])??"Failed to create annotation config")},o=(y,{onCompleted:g,onError:m}={})=>{const{id:f,annotationType:h,...k}=y,S=h.toLowerCase();i({variables:{input:{annotationConfig:{[S]:k}}},onCompleted:g,onError:r(m)}),a()},[d]=P.useMutation(Cd);return e(q,{title:"Annotation Configs",variant:"compact",bodyStyle:{padding:0},extra:s(J,{children:[s(E,{size:"S",children:[e(D,{svg:e(Ca,{})}),"New Configuration"]}),e(ne,{children:e(Z,{children:e(Id,{onAddAnnotationConfig:o})})})]}),children:e(Q0,{annotationConfigs:l,onEditAnnotationConfig:(y,{onCompleted:g,onError:m}={})=>{const{id:f,annotationType:h,...k}=y,S=h.toLowerCase();d({variables:{input:{id:f,annotationConfig:{[S]:k}}},onCompleted:g,onError:r(m)}),a()},onDeleteAnnotationConfig:(y,{onCompleted:g,onError:m}={})=>{t({variables:{input:{ids:[y]}},onCompleted:g,onError:r(m)}),a()}})})},Dd=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"settingsAnnotationsPageLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"SettingsAnnotationsPageFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"settingsAnnotationsPageLoaderQuery",selections:[{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"annotationConfig",args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[n,a,l,t,i,{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null}],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[n,a,l,t,i,{alias:null,args:null,kind:"ScalarField",name:"upperBound",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lowerBound",storageKey:null}],type:"ContinuousAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[n,a,l,t],type:"FreeformAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[n],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"38239699bb1676189730a7c5bfaf3e16",id:null,metadata:{},name:"settingsAnnotationsPageLoaderQuery",operationKind:"query",text:`query settingsAnnotationsPageLoaderQuery {
232
+ `,children:[s("table",{css:nn,style:{width:d.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:d.getHeaderGroups().map(f=>e("tr",{children:f.headers.map(h=>e("th",{colSpan:h.colSpan,children:h.isPlaceholder?null:s("div",{className:h.column.getCanSort()?"sort":"",onClick:h.column.getToggleSortingHandler(),style:{left:h.getStart(),width:h.getSize()},children:[ee(h.column.columnDef.header,h.getContext()),h.column.getIsSorted()?e(D,{className:"sort-icon",svg:h.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},h.id))},f.id))}),c?e(vn,{message:"No Annotation Configs"}):e("tbody",{children:u.map(f=>e("tr",{onClick:()=>{i({[f.id]:!(t!=null&&t[f.id])})},children:f.getVisibleCells().map(h=>e("td",{style:{width:h.column.getSize(),maxWidth:h.column.getSize()},children:ee(h.column.columnDef.cell,h.getContext())},h.id))},f.id))})]}),y.length>0&&e(j0,{selectedConfig:g[0],onClearSelection:m,onEditAnnotationConfig:l,onDeleteAnnotationConfig:a})]})},BP=()=>{const n=Ue();return e(B0,{annotations:n})},B0=({annotations:n})=>{const{revalidate:a}=Gl(),l=T.useFragment(Pd,n),[t]=T.useMutation(Td),[i]=T.useMutation(Kd),r=y=>g=>{const m=Re(g);y==null||y((m==null?void 0:m[0])??"Failed to create annotation config")},o=(y,{onCompleted:g,onError:m}={})=>{const{id:f,annotationType:h,...k}=y,S=h.toLowerCase();i({variables:{input:{annotationConfig:{[S]:k}}},onCompleted:g,onError:r(m)}),a()},[d]=T.useMutation(Cd);return e(q,{title:"Annotation Configs",variant:"compact",bodyStyle:{padding:0},extra:s(J,{children:[s(E,{size:"S",children:[e(D,{svg:e(Ca,{})}),"New Configuration"]}),e(ne,{children:e(Z,{children:e(Id,{onAddAnnotationConfig:o})})})]}),children:e(Q0,{annotationConfigs:l,onEditAnnotationConfig:(y,{onCompleted:g,onError:m}={})=>{const{id:f,annotationType:h,...k}=y,S=h.toLowerCase();d({variables:{input:{id:f,annotationConfig:{[S]:k}}},onCompleted:g,onError:r(m)}),a()},onDeleteAnnotationConfig:(y,{onCompleted:g,onError:m}={})=>{t({variables:{input:{ids:[y]}},onCompleted:g,onError:r(m)}),a()}})})},Dd=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"settingsAnnotationsPageLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"SettingsAnnotationsPageFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"settingsAnnotationsPageLoaderQuery",selections:[{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"annotationConfig",args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[n,a,l,t,i,{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null}],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[n,a,l,t,i,{alias:null,args:null,kind:"ScalarField",name:"upperBound",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lowerBound",storageKey:null}],type:"ContinuousAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[n,a,l,t],type:"FreeformAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[n],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"38239699bb1676189730a7c5bfaf3e16",id:null,metadata:{},name:"settingsAnnotationsPageLoaderQuery",operationKind:"query",text:`query settingsAnnotationsPageLoaderQuery {
233
233
  ...SettingsAnnotationsPageFragment
234
234
  }
235
235
 
@@ -276,7 +276,7 @@ fragment AnnotationConfigTableFragment on Query {
276
276
  fragment SettingsAnnotationsPageFragment on Query {
277
277
  ...AnnotationConfigTableFragment
278
278
  }
279
- `}}}();Dd.hash="b14c2976ebc78d4709a4e54aa2a20132";async function qP(){return await P.fetchQuery(ve,Dd,{}).toPromise()}const Ld=function(){var n={defaultValue:null,kind:"LocalArgument",name:"connectionId"},a={defaultValue:null,kind:"LocalArgument",name:"input"},l=[{kind:"Variable",name:"input",variableName:"input"}],t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"maxCount",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null},d=[t,i,{alias:null,args:null,kind:"ScalarField",name:"cronExpression",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[r],type:"TraceRetentionRuleMaxCount",abstractKey:null},{kind:"InlineFragment",selections:[o],type:"TraceRetentionRuleMaxDays",abstractKey:null},{kind:"InlineFragment",selections:[o,r],type:"TraceRetentionRuleMaxDaysOrCount",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ProjectConnection",kind:"LinkedField",name:"projects",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[i,t],storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:[n,a],kind:"Fragment",metadata:null,name:"CreateRetentionPolicyMutation",selections:[{alias:null,args:l,concreteType:"ProjectTraceRetentionPolicyMutationPayload",kind:"LinkedField",name:"createProjectTraceRetentionPolicy",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineDataFragmentSpread",name:"RetentionPoliciesTable_retentionPolicy",selections:d,args:null,argumentDefinitions:[]}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,n],kind:"Operation",name:"CreateRetentionPolicyMutation",selections:[{alias:null,args:l,concreteType:"ProjectTraceRetentionPolicyMutationPayload",kind:"LinkedField",name:"createProjectTraceRetentionPolicy",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:d,storageKey:null},{alias:null,args:null,filters:null,handle:"prependNode",key:"",kind:"LinkedHandle",name:"node",handleArgs:[{items:[{kind:"Variable",name:"connections.0",variableName:"connectionId"}],kind:"ListValue",name:"connections"},{kind:"Literal",name:"edgeTypeName",value:"ProjectTraceRetentionPolicyEdge"}]}],storageKey:null}]},params:{cacheID:"e0981aca4bdf8872ca8bb16aba1f9b5c",id:null,metadata:{},name:"CreateRetentionPolicyMutation",operationKind:"mutation",text:`mutation CreateRetentionPolicyMutation(
279
+ `}}}();Dd.hash="b14c2976ebc78d4709a4e54aa2a20132";async function qP(){return await T.fetchQuery(ve,Dd,{}).toPromise()}const Ld=function(){var n={defaultValue:null,kind:"LocalArgument",name:"connectionId"},a={defaultValue:null,kind:"LocalArgument",name:"input"},l=[{kind:"Variable",name:"input",variableName:"input"}],t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"maxCount",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null},d=[t,i,{alias:null,args:null,kind:"ScalarField",name:"cronExpression",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[r],type:"TraceRetentionRuleMaxCount",abstractKey:null},{kind:"InlineFragment",selections:[o],type:"TraceRetentionRuleMaxDays",abstractKey:null},{kind:"InlineFragment",selections:[o,r],type:"TraceRetentionRuleMaxDaysOrCount",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ProjectConnection",kind:"LinkedField",name:"projects",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[i,t],storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:[n,a],kind:"Fragment",metadata:null,name:"CreateRetentionPolicyMutation",selections:[{alias:null,args:l,concreteType:"ProjectTraceRetentionPolicyMutationPayload",kind:"LinkedField",name:"createProjectTraceRetentionPolicy",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineDataFragmentSpread",name:"RetentionPoliciesTable_retentionPolicy",selections:d,args:null,argumentDefinitions:[]}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,n],kind:"Operation",name:"CreateRetentionPolicyMutation",selections:[{alias:null,args:l,concreteType:"ProjectTraceRetentionPolicyMutationPayload",kind:"LinkedField",name:"createProjectTraceRetentionPolicy",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:d,storageKey:null},{alias:null,args:null,filters:null,handle:"prependNode",key:"",kind:"LinkedHandle",name:"node",handleArgs:[{items:[{kind:"Variable",name:"connections.0",variableName:"connectionId"}],kind:"ListValue",name:"connections"},{kind:"Literal",name:"edgeTypeName",value:"ProjectTraceRetentionPolicyEdge"}]}],storageKey:null}]},params:{cacheID:"e0981aca4bdf8872ca8bb16aba1f9b5c",id:null,metadata:{},name:"CreateRetentionPolicyMutation",operationKind:"mutation",text:`mutation CreateRetentionPolicyMutation(
280
280
  $input: CreateProjectTraceRetentionPolicyInput!
281
281
  ) {
282
282
  createProjectTraceRetentionPolicy(input: $input) {
@@ -313,7 +313,7 @@ fragment RetentionPoliciesTable_retentionPolicy on ProjectTraceRetentionPolicy {
313
313
  }
314
314
  }
315
315
  }
316
- `}}}();Ld.hash="a111dbcaa8facd112289cd919cca3a3b";const _d=({numberOfDays:n,numberOfTraces:a})=>{if(n===0&&!a)return"This policy will not delete any traces.";const l=typeof n=="number"?`older than ${n} days`:"",t=typeof a=="number"?`when there are more than ${a} traces`:"";return`This policy will delete traces ${l&&t?`${l} or ${t}`:l||t}`},sr=({schedule:n})=>{let a="unknown";try{fy.parse(n)}catch{return"invalid schedule"}try{a=hy.toString(n)}catch{return"invalid schedule"}return`${a} (UTC)`};function Ad(n){const{onSubmit:a,mode:l,isSubmitting:t,defaultValues:i}=n,{control:r,watch:o,handleSubmit:d}=Qe({defaultValues:i??{name:"New Policy",numberOfTraces:void 0,numberOfDays:400,schedule:"0 0 * * 0"},mode:"onChange"}),[c,u,y]=o(["numberOfDays","numberOfTraces","schedule"]);return s(un,{onSubmit:d(a),children:[s(v,{padding:"size-200",children:[e("p",{children:"A retention policy can be defined so that either a certain number of traces or traces for a certain amount of time is retained in certain projects. If both are defined, the policy will delete traces that are either older than the number of days or have more than the number of traces, whichever comes first."}),e("p",{children:"Once a retention policy is defined, you can associate multiple projects to the same policy."}),s(b,{direction:"row",gap:"size-100",children:[s(v,{flex:"1 1 auto",children:[e(G,{control:r,name:"name",rules:{required:"Name is required"},render:({field:g})=>s(ie,{...g,size:"S",value:g.value,children:[e(W,{children:"Name"}),e(ae,{}),e(F,{slot:"description",children:"The name of the retention policy"})]})}),e(G,{control:r,name:"numberOfDays",rules:{required:"Number of days is required. 0 means infinite.",min:{value:0,message:"Number of days must be at least 0"}},render:({field:g})=>s(oa,{step:1,size:"S",...g,children:[e(W,{children:"Number of Days"}),e(ae,{}),e(F,{slot:"description",children:"The number of days that will be kept"})]})}),e(G,{control:r,name:"numberOfTraces",rules:{min:{value:0,message:"Number of traces must be at least 0"}},render:({field:g})=>s(oa,{step:1,size:"S",value:g.value??void 0,onChange:g.onChange,onBlur:g.onBlur,children:[e(W,{children:"Number of Traces"}),e(ae,{}),e(F,{slot:"description",children:"The number of traces that will be kept"})]})}),e(G,{control:r,name:"schedule",rules:{required:"Schedule is required",validate:g=>{try{const m=ky.CronExpressionParser.parse(g);if(!m.fields.dayOfMonth.isWildcard)return"Cannot set day of month, must be *";if(!m.fields.month.isWildcard)return"Cannot set month, must be *";if(m.fields.minute.values.length>=1&&m.fields.minute.values[0]!==0)return"Cannot set minute, must be 0"}catch(m){return m instanceof Error?m.message:"Invalid cron expression"}}},render:({field:g,fieldState:m})=>s(ie,{...g,size:"S",...g,isInvalid:!!m.error,children:[e(W,{children:"Schedule"}),e(ae,{}),m.error?e(F,{slot:"errorMessage",color:"danger",children:m.error.message}):e(F,{slot:"description",children:"A cron expression for the hour of the week"})]})})]}),s(v,{width:"300px",paddingX:"size-200",children:[e(de,{level:2,children:"Retention Policy"}),e("br",{}),e(F,{color:"text-700",children:_d({numberOfDays:c,numberOfTraces:u})}),e("br",{}),e("br",{}),e(F,{color:"text-700",children:`Enforcement Schedule: ${sr({schedule:y})}`})]})]})]}),e(v,{paddingY:"size-100",paddingX:"size-200",borderTopWidth:"thin",borderColor:"dark",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{size:"S",slot:"close",onPress:n.onCancel,children:"Cancel"}),e(E,{size:"S",variant:"primary",type:"submit",isDisabled:t,children:t?"Submitting...":l==="create"?"Create":"Update"})]})})]})}function q0(n){const a=ke(),l=Fe(),[t,i]=P.useMutation(Ld);return e(Ad,{onSubmit:o=>{let d;if(o.numberOfDays&&o.numberOfTraces)d={maxDaysOrCount:{maxDays:o.numberOfDays,maxCount:o.numberOfTraces}};else if(o.numberOfDays)d={maxDays:{maxDays:o.numberOfDays}};else if(o.numberOfTraces)d={maxCount:{maxCount:o.numberOfTraces}};else throw new Error("Invalid retention policy rule");const c=P.ConnectionHandler.getConnectionID(n.queryId,"RetentionPoliciesTable_projectTraceRetentionPolicies");t({variables:{input:{cronExpression:o.schedule,rule:d,name:o.name},connectionId:c},onCompleted:()=>{a({title:"Retention policy created successfully",message:"The retention policy has been created. You can now add this policy to projects."}),n.onCreate()},onError:()=>{l({title:"Error creating retention policy",message:"Please try again."})}})},isSubmitting:i,mode:"create"})}const wd=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:1e3,kind:"LocalArgument",name:"first"}],a=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"maxCount",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"RetentionPoliciesTablePoliciesQuery",selections:[{args:a,kind:"FragmentSpread",name:"RetentionPoliciesTable_policies"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"RetentionPoliciesTablePoliciesQuery",selections:[{alias:null,args:a,concreteType:"ProjectTraceRetentionPolicyConnection",kind:"LinkedField",name:"projectTraceRetentionPolicies",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicyEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{alias:null,args:null,kind:"ScalarField",name:"cronExpression",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[i,{kind:"InlineFragment",selections:[r],type:"TraceRetentionRuleMaxCount",abstractKey:null},{kind:"InlineFragment",selections:[o],type:"TraceRetentionRuleMaxDays",abstractKey:null},{kind:"InlineFragment",selections:[o,r],type:"TraceRetentionRuleMaxDaysOrCount",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ProjectConnection",kind:"LinkedField",name:"projects",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[t,l],storageKey:null}],storageKey:null}],storageKey:null},i],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null},{kind:"ClientExtension",selections:[{alias:null,args:null,kind:"ScalarField",name:"__id",storageKey:null}]}],storageKey:null},{alias:null,args:a,filters:null,handle:"connection",key:"RetentionPoliciesTable_projectTraceRetentionPolicies",kind:"LinkedHandle",name:"projectTraceRetentionPolicies"}]},params:{cacheID:"67d653235070dbcfe47baecdadd89b38",id:null,metadata:{},name:"RetentionPoliciesTablePoliciesQuery",operationKind:"query",text:`query RetentionPoliciesTablePoliciesQuery(
316
+ `}}}();Ld.hash="a111dbcaa8facd112289cd919cca3a3b";const _d=({numberOfDays:n,numberOfTraces:a})=>{if(n===0&&!a)return"This policy will not delete any traces.";const l=typeof n=="number"?`older than ${n} days`:"",t=typeof a=="number"?`when there are more than ${a} traces`:"";return`This policy will delete traces ${l&&t?`${l} or ${t}`:l||t}`},sr=({schedule:n})=>{let a="unknown";try{fy.parse(n)}catch{return"invalid schedule"}try{a=hy.toString(n)}catch{return"invalid schedule"}return`${a} (UTC)`};function Ad(n){const{onSubmit:a,mode:l,isSubmitting:t,defaultValues:i}=n,{control:r,watch:o,handleSubmit:d}=Qe({defaultValues:i??{name:"New Policy",numberOfTraces:void 0,numberOfDays:400,schedule:"0 0 * * 0"},mode:"onChange"}),[c,u,y]=o(["numberOfDays","numberOfTraces","schedule"]);return s(un,{onSubmit:d(a),children:[s(v,{padding:"size-200",children:[e("p",{children:"A retention policy can be defined so that either a certain number of traces or traces for a certain amount of time is retained in certain projects. If both are defined, the policy will delete traces that are either older than the number of days or have more than the number of traces, whichever comes first."}),e("p",{children:"Once a retention policy is defined, you can associate multiple projects to the same policy."}),s(b,{direction:"row",gap:"size-100",children:[s(v,{flex:"1 1 auto",children:[e(G,{control:r,name:"name",rules:{required:"Name is required"},render:({field:g})=>s(ie,{...g,size:"S",value:g.value,children:[e(W,{children:"Name"}),e(ae,{}),e(F,{slot:"description",children:"The name of the retention policy"})]})}),e(G,{control:r,name:"numberOfDays",rules:{required:"Number of days is required. 0 means infinite.",min:{value:0,message:"Number of days must be at least 0"}},render:({field:g})=>s(oa,{step:1,size:"S",...g,children:[e(W,{children:"Number of Days"}),e(ae,{}),e(F,{slot:"description",children:"The number of days that will be kept"})]})}),e(G,{control:r,name:"numberOfTraces",rules:{min:{value:0,message:"Number of traces must be at least 0"}},render:({field:g})=>s(oa,{step:1,size:"S",value:g.value??void 0,onChange:g.onChange,onBlur:g.onBlur,children:[e(W,{children:"Number of Traces"}),e(ae,{}),e(F,{slot:"description",children:"The number of traces that will be kept"})]})}),e(G,{control:r,name:"schedule",rules:{required:"Schedule is required",validate:g=>{try{const m=ky.CronExpressionParser.parse(g);if(!m.fields.dayOfMonth.isWildcard)return"Cannot set day of month, must be *";if(!m.fields.month.isWildcard)return"Cannot set month, must be *";if(m.fields.minute.values.length>=1&&m.fields.minute.values[0]!==0)return"Cannot set minute, must be 0"}catch(m){return m instanceof Error?m.message:"Invalid cron expression"}}},render:({field:g,fieldState:m})=>s(ie,{...g,size:"S",...g,isInvalid:!!m.error,children:[e(W,{children:"Schedule"}),e(ae,{}),m.error?e(F,{slot:"errorMessage",color:"danger",children:m.error.message}):e(F,{slot:"description",children:"A cron expression for the hour of the week"})]})})]}),s(v,{width:"300px",paddingX:"size-200",children:[e(de,{level:2,children:"Retention Policy"}),e("br",{}),e(F,{color:"text-700",children:_d({numberOfDays:c,numberOfTraces:u})}),e("br",{}),e("br",{}),e(F,{color:"text-700",children:`Enforcement Schedule: ${sr({schedule:y})}`})]})]})]}),e(v,{paddingY:"size-100",paddingX:"size-200",borderTopWidth:"thin",borderColor:"dark",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{size:"S",slot:"close",onPress:n.onCancel,children:"Cancel"}),e(E,{size:"S",variant:"primary",type:"submit",isDisabled:t,children:t?"Submitting...":l==="create"?"Create":"Update"})]})})]})}function q0(n){const a=ke(),l=Fe(),[t,i]=T.useMutation(Ld);return e(Ad,{onSubmit:o=>{let d;if(o.numberOfDays&&o.numberOfTraces)d={maxDaysOrCount:{maxDays:o.numberOfDays,maxCount:o.numberOfTraces}};else if(o.numberOfDays)d={maxDays:{maxDays:o.numberOfDays}};else if(o.numberOfTraces)d={maxCount:{maxCount:o.numberOfTraces}};else throw new Error("Invalid retention policy rule");const c=T.ConnectionHandler.getConnectionID(n.queryId,"RetentionPoliciesTable_projectTraceRetentionPolicies");t({variables:{input:{cronExpression:o.schedule,rule:d,name:o.name},connectionId:c},onCompleted:()=>{a({title:"Retention policy created successfully",message:"The retention policy has been created. You can now add this policy to projects."}),n.onCreate()},onError:()=>{l({title:"Error creating retention policy",message:"Please try again."})}})},isSubmitting:i,mode:"create"})}const wd=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:1e3,kind:"LocalArgument",name:"first"}],a=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"maxCount",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"RetentionPoliciesTablePoliciesQuery",selections:[{args:a,kind:"FragmentSpread",name:"RetentionPoliciesTable_policies"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"RetentionPoliciesTablePoliciesQuery",selections:[{alias:null,args:a,concreteType:"ProjectTraceRetentionPolicyConnection",kind:"LinkedField",name:"projectTraceRetentionPolicies",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicyEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{alias:null,args:null,kind:"ScalarField",name:"cronExpression",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[i,{kind:"InlineFragment",selections:[r],type:"TraceRetentionRuleMaxCount",abstractKey:null},{kind:"InlineFragment",selections:[o],type:"TraceRetentionRuleMaxDays",abstractKey:null},{kind:"InlineFragment",selections:[o,r],type:"TraceRetentionRuleMaxDaysOrCount",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ProjectConnection",kind:"LinkedField",name:"projects",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[t,l],storageKey:null}],storageKey:null}],storageKey:null},i],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null},{kind:"ClientExtension",selections:[{alias:null,args:null,kind:"ScalarField",name:"__id",storageKey:null}]}],storageKey:null},{alias:null,args:a,filters:null,handle:"connection",key:"RetentionPoliciesTable_projectTraceRetentionPolicies",kind:"LinkedHandle",name:"projectTraceRetentionPolicies"}]},params:{cacheID:"67d653235070dbcfe47baecdadd89b38",id:null,metadata:{},name:"RetentionPoliciesTablePoliciesQuery",operationKind:"query",text:`query RetentionPoliciesTablePoliciesQuery(
317
317
  $after: String = null
318
318
  $first: Int = 1000
319
319
  ) {
@@ -498,7 +498,7 @@ fragment RetentionPoliciesTable_retentionPolicy on ProjectTraceRetentionPolicy {
498
498
  id
499
499
  }
500
500
  }
501
- `}}}();zd.hash="3bf941d551e8fb7a6940d8774075be73";function U0(n){var d,c;const a=ke(),l=Fe(),t=P.useLazyLoadQuery(zd,{id:n.policyId});if(!(t!=null&&t.retentionPolicy))throw new Error("Retention policy not found");const[i,r]=P.useMutation(Vd);return e(Ad,{onSubmit:u=>{let y;if(u.numberOfDays&&u.numberOfTraces)y={maxDaysOrCount:{maxDays:u.numberOfDays,maxCount:u.numberOfTraces}};else if(u.numberOfDays)y={maxDays:{maxDays:u.numberOfDays}};else if(u.numberOfTraces)y={maxCount:{maxCount:u.numberOfTraces}};else throw new Error("Invalid retention policy rule");i({variables:{input:{id:n.policyId,cronExpression:u.schedule,rule:y,name:u.name}},onCompleted:()=>{a({title:"Retention policy updated successfully",message:"The retention policy has been updated successfully."}),n.onEditCompleted()},onError:()=>{l({title:"Error updating retention policy",message:"Please try again."})}})},isSubmitting:r,mode:"edit",defaultValues:{name:t.retentionPolicy.name??"New Policy",schedule:t.retentionPolicy.cronExpression??"0 0 * * 0",numberOfDays:(d=t.retentionPolicy.rule)==null?void 0:d.maxDays,numberOfTraces:(c=t.retentionPolicy.rule)==null?void 0:c.maxCount},onCancel:n.onCancel})}const H0="Default",G0=({policyId:n,policyName:a,projectNames:l,onPolicyEdit:t,onPolicyDelete:i,connectionId:r})=>{const o=a!==H0,[d,c]=p.useState(!1),[u,y]=p.useState(!1),[g,m]=P.useMutation(Md);return s(Xl,{children:[s(Ma,{buttonSize:"compact",disabledKeys:o?[]:["deletePolicy"],align:"end",onAction:f=>{switch(f){case"editPolicy":return c(!0);case"deletePolicy":return y(!0)}},children:[e(je,{textValue:"Edit Policy",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Va,{})}),e(F,{children:"Edit"})]})},"editPolicy"),e(je,{textValue:"Delete Policy",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Je,{})}),e(F,{children:"Delete"})]})},"deletePolicy")]}),e(J,{isOpen:d,onOpenChange:c,children:e(ne,{children:e(Z,{size:"M",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Edit Retention Policy"}),e(ue,{children:e(me,{onPress:()=>c(!1),slot:"close"})})]}),e(p.Suspense,{fallback:e(pe,{}),children:e(U0,{policyId:n,onEditCompleted:()=>{t(),c(!1)},onCancel:()=>{c(!1)}})})]})})})})}),e(J,{isOpen:u,onOpenChange:y,children:e(ne,{children:e(Z,{size:"S",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Delete Retention Policy"}),e(ue,{children:e(me,{slot:"close"})})]}),s(v,{padding:"size-200",children:[e(F,{color:"danger",children:`Are you sure you want to delete retention policy "${a}"? This cannot be undone.`}),e("br",{}),l.length>0&&e(F,{color:"danger",children:`This policy is associated with the following projects: ${l.join(", ")}. These projects will fall back to the default policy.`})]}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",size:"M",slot:"close",isDisabled:m,children:"Cancel"}),e(E,{variant:"danger",size:"S",onPress:()=>{g({variables:{policyId:n,connectionId:r}}),y(!1),i()},isDisabled:m,leadingVisual:m?e(D,{svg:e(yn,{})}):void 0,children:m?"Deleting...":"Delete Policy"})]})})]})})})})})]})},W0=Ed,J0=({query:n})=>{const a=ke(),l=Zs(),{data:t}=P.usePaginationFragment(Rd,n),i=t.projectTraceRetentionPolicies.__id,r=t.projectTraceRetentionPolicies.edges.map(u=>{const y=u.node;return P.readInlineData(W0,y)}),o=p.useMemo(()=>{const u=[{header:"Name",accessorKey:"name"},{header:"Schedule",accessorKey:"cronExpression",cell:({row:y})=>sr({schedule:y.original.cronExpression})},{header:"Rule",accessorKey:"rule",cell:({row:y})=>{const g=y.original.rule;if(g.__typename==="TraceRetentionRuleMaxCount")return`${g.maxCount} traces`;if(g.__typename==="TraceRetentionRuleMaxDays")return g.maxDays===0?"Infinite":`${g.maxDays} days`;if(g.__typename==="TraceRetentionRuleMaxDaysOrCount")return`${g.maxDays} days or ${g.maxCount} traces`;if(g.__typename==="%other")return"Unknown";Ee()}},{header:"Projects",accessorKey:"projects",cell:({row:y})=>e("ul",{css:K`
501
+ `}}}();zd.hash="3bf941d551e8fb7a6940d8774075be73";function U0(n){var d,c;const a=ke(),l=Fe(),t=T.useLazyLoadQuery(zd,{id:n.policyId});if(!(t!=null&&t.retentionPolicy))throw new Error("Retention policy not found");const[i,r]=T.useMutation(Vd);return e(Ad,{onSubmit:u=>{let y;if(u.numberOfDays&&u.numberOfTraces)y={maxDaysOrCount:{maxDays:u.numberOfDays,maxCount:u.numberOfTraces}};else if(u.numberOfDays)y={maxDays:{maxDays:u.numberOfDays}};else if(u.numberOfTraces)y={maxCount:{maxCount:u.numberOfTraces}};else throw new Error("Invalid retention policy rule");i({variables:{input:{id:n.policyId,cronExpression:u.schedule,rule:y,name:u.name}},onCompleted:()=>{a({title:"Retention policy updated successfully",message:"The retention policy has been updated successfully."}),n.onEditCompleted()},onError:()=>{l({title:"Error updating retention policy",message:"Please try again."})}})},isSubmitting:r,mode:"edit",defaultValues:{name:t.retentionPolicy.name??"New Policy",schedule:t.retentionPolicy.cronExpression??"0 0 * * 0",numberOfDays:(d=t.retentionPolicy.rule)==null?void 0:d.maxDays,numberOfTraces:(c=t.retentionPolicy.rule)==null?void 0:c.maxCount},onCancel:n.onCancel})}const H0="Default",G0=({policyId:n,policyName:a,projectNames:l,onPolicyEdit:t,onPolicyDelete:i,connectionId:r})=>{const o=a!==H0,[d,c]=p.useState(!1),[u,y]=p.useState(!1),[g,m]=T.useMutation(Md);return s(Xl,{children:[s(Ma,{buttonSize:"compact",disabledKeys:o?[]:["deletePolicy"],align:"end",onAction:f=>{switch(f){case"editPolicy":return c(!0);case"deletePolicy":return y(!0)}},children:[e(je,{textValue:"Edit Policy",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Va,{})}),e(F,{children:"Edit"})]})},"editPolicy"),e(je,{textValue:"Delete Policy",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Je,{})}),e(F,{children:"Delete"})]})},"deletePolicy")]}),e(J,{isOpen:d,onOpenChange:c,children:e(ne,{children:e(Z,{size:"M",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Edit Retention Policy"}),e(ue,{children:e(me,{onPress:()=>c(!1),slot:"close"})})]}),e(p.Suspense,{fallback:e(pe,{}),children:e(U0,{policyId:n,onEditCompleted:()=>{t(),c(!1)},onCancel:()=>{c(!1)}})})]})})})})}),e(J,{isOpen:u,onOpenChange:y,children:e(ne,{children:e(Z,{size:"S",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Delete Retention Policy"}),e(ue,{children:e(me,{slot:"close"})})]}),s(v,{padding:"size-200",children:[e(F,{color:"danger",children:`Are you sure you want to delete retention policy "${a}"? This cannot be undone.`}),e("br",{}),l.length>0&&e(F,{color:"danger",children:`This policy is associated with the following projects: ${l.join(", ")}. These projects will fall back to the default policy.`})]}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",size:"M",slot:"close",isDisabled:m,children:"Cancel"}),e(E,{variant:"danger",size:"S",onPress:()=>{g({variables:{policyId:n,connectionId:r}}),y(!1),i()},isDisabled:m,leadingVisual:m?e(D,{svg:e(yn,{})}):void 0,children:m?"Deleting...":"Delete Policy"})]})})]})})})})})]})},W0=Ed,J0=({query:n})=>{const a=ke(),l=Zs(),{data:t}=T.usePaginationFragment(Rd,n),i=t.projectTraceRetentionPolicies.__id,r=t.projectTraceRetentionPolicies.edges.map(u=>{const y=u.node;return T.readInlineData(W0,y)}),o=p.useMemo(()=>{const u=[{header:"Name",accessorKey:"name"},{header:"Schedule",accessorKey:"cronExpression",cell:({row:y})=>sr({schedule:y.original.cronExpression})},{header:"Rule",accessorKey:"rule",cell:({row:y})=>{const g=y.original.rule;if(g.__typename==="TraceRetentionRuleMaxCount")return`${g.maxCount} traces`;if(g.__typename==="TraceRetentionRuleMaxDays")return g.maxDays===0?"Infinite":`${g.maxDays} days`;if(g.__typename==="TraceRetentionRuleMaxDaysOrCount")return`${g.maxDays} days or ${g.maxCount} traces`;if(g.__typename==="%other")return"Unknown";Ee()}},{header:"Projects",accessorKey:"projects",cell:({row:y})=>e("ul",{css:K`
502
502
  li {
503
503
  display: inline;
504
504
  }
@@ -624,7 +624,7 @@ fragment SystemAPIKeysTableFragment on Query {
624
624
  id
625
625
  }
626
626
  }
627
- `}}}();Od.hash="459f07f740e1b27f3839eedd3eff3083";const Qd={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:Od}},name:"SystemAPIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"SystemApiKey",kind:"LinkedField",name:"systemApiKeys",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"APIKeysTableFragment"}],storageKey:null}],type:"Query",abstractKey:null};Qd.hash="459f07f740e1b27f3839eedd3eff3083";function Z0({query:n}){const[a,l]=P.useRefetchableFragment(Qd,n),t=Fe(),i=ke(),[r]=P.useMutation(jd),o=p.useCallback(m=>{r({variables:{input:{id:m}},onCompleted:()=>{i({title:"System key deleted",message:"The system key has been deleted and is no longer active."}),p.startTransition(()=>{l({},{fetchPolicy:"network-only"})})},onError:f=>{const h=Re(f);t({title:"Error deleting system key",message:(h==null?void 0:h[0])??f.message})}})},[r,t,i,l]),d=p.useMemo(()=>[...a.systemApiKeys],[a]),c=p.useMemo(()=>[{header:"Name",accessorKey:"name"},{header:"Description",accessorKey:"description",cell:Be},{header:"Created At",accessorKey:"createdAt",cell:we},{header:"Expires At",accessorKey:"expiresAt",cell:we},{header:"",accessorKey:"id",size:10,cell:({row:f})=>e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(Ni,{handleDelete:()=>{o(f.original.id)}})}),meta:{textAlign:"right"}}],[o]),u=Le({columns:c,data:d,getCoreRowModel:_e()}),y=u.getRowModel().rows,g=u.getRowModel().rows.length===0;return s("table",{css:nn,children:[e("thead",{children:u.getHeaderGroups().map(m=>e("tr",{children:m.headers.map(f=>e("th",{colSpan:f.colSpan,children:f.isPlaceholder?null:s("div",{className:f.column.getCanSort()?"sort":"",onClick:f.column.getToggleSortingHandler(),style:{left:f.getStart(),width:f.getSize()},children:[ee(f.column.columnDef.header,f.getContext()),f.column.getIsSorted()?e(D,{className:"sort-icon",svg:f.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},f.id))},m.id))}),g?e(vn,{message:"No Keys"}):e("tbody",{children:y.map(m=>e("tr",{children:m.getVisibleCells().map(f=>e("td",{children:ee(f.column.columnDef.cell,f.getContext())},f.id))},m.id))})]})}const Bd=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"DeleteApiKeyMutationPayload",kind:"LinkedField",name:"deleteUserApiKey",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeyId",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UserAPIKeysTableDeleteAPIKeyMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UserAPIKeysTableDeleteAPIKeyMutation",selections:a},params:{cacheID:"d137498515ff43864f5525b3c1847376",id:null,metadata:{},name:"UserAPIKeysTableDeleteAPIKeyMutation",operationKind:"mutation",text:`mutation UserAPIKeysTableDeleteAPIKeyMutation(
627
+ `}}}();Od.hash="459f07f740e1b27f3839eedd3eff3083";const Qd={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:Od}},name:"SystemAPIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"SystemApiKey",kind:"LinkedField",name:"systemApiKeys",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"APIKeysTableFragment"}],storageKey:null}],type:"Query",abstractKey:null};Qd.hash="459f07f740e1b27f3839eedd3eff3083";function Z0({query:n}){const[a,l]=T.useRefetchableFragment(Qd,n),t=Fe(),i=ke(),[r]=T.useMutation(jd),o=p.useCallback(m=>{r({variables:{input:{id:m}},onCompleted:()=>{i({title:"System key deleted",message:"The system key has been deleted and is no longer active."}),p.startTransition(()=>{l({},{fetchPolicy:"network-only"})})},onError:f=>{const h=Re(f);t({title:"Error deleting system key",message:(h==null?void 0:h[0])??f.message})}})},[r,t,i,l]),d=p.useMemo(()=>[...a.systemApiKeys],[a]),c=p.useMemo(()=>[{header:"Name",accessorKey:"name"},{header:"Description",accessorKey:"description",cell:Be},{header:"Created At",accessorKey:"createdAt",cell:we},{header:"Expires At",accessorKey:"expiresAt",cell:we},{header:"",accessorKey:"id",size:10,cell:({row:f})=>e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(Ni,{handleDelete:()=>{o(f.original.id)}})}),meta:{textAlign:"right"}}],[o]),u=Le({columns:c,data:d,getCoreRowModel:_e()}),y=u.getRowModel().rows,g=u.getRowModel().rows.length===0;return s("table",{css:nn,children:[e("thead",{children:u.getHeaderGroups().map(m=>e("tr",{children:m.headers.map(f=>e("th",{colSpan:f.colSpan,children:f.isPlaceholder?null:s("div",{className:f.column.getCanSort()?"sort":"",onClick:f.column.getToggleSortingHandler(),style:{left:f.getStart(),width:f.getSize()},children:[ee(f.column.columnDef.header,f.getContext()),f.column.getIsSorted()?e(D,{className:"sort-icon",svg:f.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},f.id))},m.id))}),g?e(vn,{message:"No Keys"}):e("tbody",{children:y.map(m=>e("tr",{children:m.getVisibleCells().map(f=>e("td",{children:ee(f.column.columnDef.cell,f.getContext())},f.id))},m.id))})]})}const Bd=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"DeleteApiKeyMutationPayload",kind:"LinkedField",name:"deleteUserApiKey",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeyId",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UserAPIKeysTableDeleteAPIKeyMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UserAPIKeysTableDeleteAPIKeyMutation",selections:a},params:{cacheID:"d137498515ff43864f5525b3c1847376",id:null,metadata:{},name:"UserAPIKeysTableDeleteAPIKeyMutation",operationKind:"mutation",text:`mutation UserAPIKeysTableDeleteAPIKeyMutation(
628
628
  $input: DeleteApiKeyInput!
629
629
  ) {
630
630
  deleteUserApiKey(input: $input) {
@@ -649,7 +649,7 @@ fragment UserAPIKeysTableFragment on Query {
649
649
  }
650
650
  }
651
651
  }
652
- `}}}();qd.hash="c2b3a579bcb0ba915523ecb35cae3b44";const Ud={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:qd}},name:"UserAPIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"userApiKeys",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};Ud.hash="c2b3a579bcb0ba915523ecb35cae3b44";const es=70;function X0({query:n}){const[a,l]=P.useRefetchableFragment(Ud,n),t=Fe(),i=ke(),[r]=P.useMutation(Bd),o=p.useCallback(m=>{r({variables:{input:{id:m}},onCompleted:()=>{i({title:"User key deleted",message:"The user key has been deleted and is no longer active."}),p.startTransition(()=>{l({},{fetchPolicy:"network-only"})})},onError:f=>{const h=Re(f);t({title:"Error deleting user key",message:(h==null?void 0:h[0])??f.message})}})},[r,t,i,l]),d=p.useMemo(()=>[...a.userApiKeys],[a]),c=p.useMemo(()=>[{header:"Name",accessorKey:"name",size:100,cell:Be},{header:"Description",accessorKey:"description",cell:Be},{header:"Created At",accessorKey:"createdAt",size:es,cell:we},{header:"Expires At",accessorKey:"expiresAt",size:es,cell:we},{header:"User",size:120,accessorKey:"user.email",cell:Be},{header:"",accessorKey:"id",size:10,cell:({row:f})=>e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(Ni,{handleDelete:()=>{o(f.original.id)}})}),meta:{textAlign:"right"}}],[o]),u=Le({columns:c,data:d,getCoreRowModel:_e()}),y=u.getRowModel().rows,g=u.getRowModel().rows.length===0;return s("table",{css:nn,children:[e("thead",{children:u.getHeaderGroups().map(m=>e("tr",{children:m.headers.map(f=>e("th",{colSpan:f.colSpan,children:f.isPlaceholder?null:s("div",{className:f.column.getCanSort()?"sort":"",onClick:f.column.getToggleSortingHandler(),style:{left:f.getStart(),width:f.getSize()},children:[ee(f.column.columnDef.header,f.getContext()),f.column.getIsSorted()?e(D,{className:"sort-icon",svg:f.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},f.id))},m.id))}),g?e(vn,{message:"No Keys"}):e("tbody",{children:y.map(m=>e("tr",{children:m.getVisibleCells().map(f=>e("td",{children:ee(f.column.columnDef.cell,f.getContext())},f.id))},m.id))})]})}function Y0(){const n=P.useLazyLoadQuery($d,{},{fetchPolicy:"network-only"});return s(hn,{children:[s(fn,{children:[e(ge,{id:"system",children:"System Keys"}),e(ge,{id:"user",children:"User Keys"})]}),e(he,{id:"system",children:e(Z0,{query:n})}),e(he,{id:"user",children:e(X0,{query:n})})]})}function eb(){const[n,a]=p.useState(!1),[l,t]=p.useState(null),i=Fe(),[r,o]=P.useMutation(Nd),d=p.useCallback(c=>{var u;r({variables:{...c,expiresAt:((u=c.expiresAt)==null?void 0:u.toDate(ml()).toISOString())||null},onCompleted:y=>{a(!1),t(y.createSystemApiKey.jwt)},onError:y=>{i({title:"Error creating system key",message:y.message})}})},[r,i]);return s("div",{children:[e(_i,{title:"API Keys",variant:"compact",extra:s(J,{isOpen:n,onOpenChange:()=>a(!1),children:[e(E,{size:"S",onPress:()=>a(!0),leadingVisual:e(D,{svg:e(jn,{})}),children:"System Key"}),e(ne,{children:e(Z,{size:"M",children:e(Ys,{onSubmit:d,isCommitting:o,defaultName:"System"})})})]}),children:e(p.Suspense,{fallback:e(v,{padding:"size-100",children:e(pe,{})}),children:e(Y0,{})})}),e(J,{isOpen:!!l,onOpenChange:()=>t(null),children:e(ne,{children:e(Z,{size:"L",children:e(eo,{jwt:l??""})})})})]})}const Hd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DBUsagePieChart_data",selections:[{alias:null,args:null,concreteType:"DbTableStats",kind:"LinkedField",name:"dbTableStats",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"tableName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"numBytes",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dbStorageCapacityBytes",storageKey:null}],type:"Query",abstractKey:null};Hd.hash="922bf6de312a4be0c38025ffbb868d6d";function Gd(n,a){const{si:l=!1,decimalPlaces:t=1}={},i=l?1e3:1024;if(Math.abs(n)<i)return n+" B";const r=l?["kB","MB","GB","TB","PB","EB","ZB","YB"]:["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let o=-1;const d=10**t;do n/=i,++o;while(Math.round(Math.abs(n)*d)/d>=i&&o<r.length-1);return n.toFixed(t)+" "+r[o]}const ns="remaining";function nb({active:n,payload:a}){return n&&a&&a.length?e(aa,{children:e(Ge,{shape:"square",color:a[0].payload.fill||"transparent",name:a[0].name||"--",value:Gd(a[0].value||0)})}):null}function ab({query:n}){const a=P.useFragment(Hd,n),l=a.dbTableStats.reduce((r,o)=>r+o.numBytes,0),t=typeof a.dbStorageCapacityBytes=="number"?a.dbStorageCapacityBytes-l:null,i=p.useMemo(()=>{const r=[...a.dbTableStats];return t!==null&&r.push({tableName:ns,numBytes:t}),r},[a.dbTableStats,t]);return e(Qn,{width:"100%",height:245,children:s(Yo,{children:[e(Zo,{data:i,dataKey:"numBytes",nameKey:"tableName",cx:"50%",cy:"50%",innerRadius:70,outerRadius:110,strokeWidth:0,stroke:"transparent",children:i.map((r,o)=>e(Xo,{stroke:"0",fill:r.tableName===ns?"var(--ac-global-color-grey-200)":`${Dr[o%Dr.length]}`},`cell-${o}`))}),e(ia,{content:e(nb,{})}),e("text",{x:"50%",y:"50%",textAnchor:"middle",fill:"var(--ac-global-text-color-900",fontSize:"var(--ac-global-font-size-xl)",children:`${typeof a.dbStorageCapacityBytes=="number"?ft(l/a.dbStorageCapacityBytes*100):Gd(l)}`}),e("text",{x:"50%",y:"50%",dy:25,textAnchor:"middle",fill:"var(--ac-global-text-color-900",fontSize:"var(--ac-global-font-size-s)",children:"Used"}),e("g",{children:e("text",{x:"100%",y:"100%",dx:-80,dy:-2,textAnchor:"right",fill:"var(--ac-global-text-color-500)",fontSize:"var(--ac-global-font-size-xs)",children:"* approximate"})})]})})}const Wd=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"ProjectTraceRetentionPolicyMutationPayload",kind:"LinkedField",name:"patchProjectTraceRetentionPolicy",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null}],type:"TraceRetentionRuleMaxDays",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"GlobalRetentionPolicyCardMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"GlobalRetentionPolicyCardMutation",selections:a},params:{cacheID:"096e3d4c546229fc771e14be03b168a3",id:null,metadata:{},name:"GlobalRetentionPolicyCardMutation",operationKind:"mutation",text:`mutation GlobalRetentionPolicyCardMutation(
652
+ `}}}();qd.hash="c2b3a579bcb0ba915523ecb35cae3b44";const Ud={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:qd}},name:"UserAPIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"userApiKeys",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};Ud.hash="c2b3a579bcb0ba915523ecb35cae3b44";const es=70;function X0({query:n}){const[a,l]=T.useRefetchableFragment(Ud,n),t=Fe(),i=ke(),[r]=T.useMutation(Bd),o=p.useCallback(m=>{r({variables:{input:{id:m}},onCompleted:()=>{i({title:"User key deleted",message:"The user key has been deleted and is no longer active."}),p.startTransition(()=>{l({},{fetchPolicy:"network-only"})})},onError:f=>{const h=Re(f);t({title:"Error deleting user key",message:(h==null?void 0:h[0])??f.message})}})},[r,t,i,l]),d=p.useMemo(()=>[...a.userApiKeys],[a]),c=p.useMemo(()=>[{header:"Name",accessorKey:"name",size:100,cell:Be},{header:"Description",accessorKey:"description",cell:Be},{header:"Created At",accessorKey:"createdAt",size:es,cell:we},{header:"Expires At",accessorKey:"expiresAt",size:es,cell:we},{header:"User",size:120,accessorKey:"user.email",cell:Be},{header:"",accessorKey:"id",size:10,cell:({row:f})=>e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(Ni,{handleDelete:()=>{o(f.original.id)}})}),meta:{textAlign:"right"}}],[o]),u=Le({columns:c,data:d,getCoreRowModel:_e()}),y=u.getRowModel().rows,g=u.getRowModel().rows.length===0;return s("table",{css:nn,children:[e("thead",{children:u.getHeaderGroups().map(m=>e("tr",{children:m.headers.map(f=>e("th",{colSpan:f.colSpan,children:f.isPlaceholder?null:s("div",{className:f.column.getCanSort()?"sort":"",onClick:f.column.getToggleSortingHandler(),style:{left:f.getStart(),width:f.getSize()},children:[ee(f.column.columnDef.header,f.getContext()),f.column.getIsSorted()?e(D,{className:"sort-icon",svg:f.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},f.id))},m.id))}),g?e(vn,{message:"No Keys"}):e("tbody",{children:y.map(m=>e("tr",{children:m.getVisibleCells().map(f=>e("td",{children:ee(f.column.columnDef.cell,f.getContext())},f.id))},m.id))})]})}function Y0(){const n=T.useLazyLoadQuery($d,{},{fetchPolicy:"network-only"});return s(hn,{children:[s(fn,{children:[e(ge,{id:"system",children:"System Keys"}),e(ge,{id:"user",children:"User Keys"})]}),e(he,{id:"system",children:e(Z0,{query:n})}),e(he,{id:"user",children:e(X0,{query:n})})]})}function eb(){const[n,a]=p.useState(!1),[l,t]=p.useState(null),i=Fe(),[r,o]=T.useMutation(Nd),d=p.useCallback(c=>{var u;r({variables:{...c,expiresAt:((u=c.expiresAt)==null?void 0:u.toDate(ml()).toISOString())||null},onCompleted:y=>{a(!1),t(y.createSystemApiKey.jwt)},onError:y=>{i({title:"Error creating system key",message:y.message})}})},[r,i]);return s("div",{children:[e(_i,{title:"API Keys",variant:"compact",extra:s(J,{isOpen:n,onOpenChange:()=>a(!1),children:[e(E,{size:"S",onPress:()=>a(!0),leadingVisual:e(D,{svg:e(jn,{})}),children:"System Key"}),e(ne,{children:e(Z,{size:"M",children:e(Ys,{onSubmit:d,isCommitting:o,defaultName:"System"})})})]}),children:e(p.Suspense,{fallback:e(v,{padding:"size-100",children:e(pe,{})}),children:e(Y0,{})})}),e(J,{isOpen:!!l,onOpenChange:()=>t(null),children:e(ne,{children:e(Z,{size:"L",children:e(eo,{jwt:l??""})})})})]})}const Hd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DBUsagePieChart_data",selections:[{alias:null,args:null,concreteType:"DbTableStats",kind:"LinkedField",name:"dbTableStats",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"tableName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"numBytes",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dbStorageCapacityBytes",storageKey:null}],type:"Query",abstractKey:null};Hd.hash="922bf6de312a4be0c38025ffbb868d6d";function Gd(n,a){const{si:l=!1,decimalPlaces:t=1}={},i=l?1e3:1024;if(Math.abs(n)<i)return n+" B";const r=l?["kB","MB","GB","TB","PB","EB","ZB","YB"]:["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let o=-1;const d=10**t;do n/=i,++o;while(Math.round(Math.abs(n)*d)/d>=i&&o<r.length-1);return n.toFixed(t)+" "+r[o]}const ns="remaining";function nb({active:n,payload:a}){return n&&a&&a.length?e(aa,{children:e(Ge,{shape:"square",color:a[0].payload.fill||"transparent",name:a[0].name||"--",value:Gd(a[0].value||0)})}):null}function ab({query:n}){const a=T.useFragment(Hd,n),l=a.dbTableStats.reduce((r,o)=>r+o.numBytes,0),t=typeof a.dbStorageCapacityBytes=="number"?a.dbStorageCapacityBytes-l:null,i=p.useMemo(()=>{const r=[...a.dbTableStats];return t!==null&&t>0&&r.push({tableName:ns,numBytes:t}),r},[a.dbTableStats,t]);return e(Qn,{width:"100%",height:245,children:s(Yo,{children:[e(Zo,{data:i,dataKey:"numBytes",nameKey:"tableName",cx:"50%",cy:"50%",innerRadius:70,outerRadius:110,strokeWidth:0,stroke:"transparent",children:i.map((r,o)=>e(Xo,{stroke:"0",fill:r.tableName===ns?"var(--ac-global-color-grey-200)":`${Dr[o%Dr.length]}`},`cell-${o}`))}),e(ia,{content:e(nb,{})}),e("text",{x:"50%",y:"50%",textAnchor:"middle",fill:"var(--ac-global-text-color-900",fontSize:"var(--ac-global-font-size-xl)",children:`${typeof a.dbStorageCapacityBytes=="number"?ft(l/a.dbStorageCapacityBytes*100):Gd(l)}`}),e("text",{x:"50%",y:"50%",dy:25,textAnchor:"middle",fill:"var(--ac-global-text-color-900",fontSize:"var(--ac-global-font-size-s)",children:"Used"}),e("g",{children:e("text",{x:"100%",y:"100%",dx:-80,dy:-2,textAnchor:"right",fill:"var(--ac-global-text-color-500)",fontSize:"var(--ac-global-font-size-xs)",children:"* approximate"})})]})})}const Wd=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"ProjectTraceRetentionPolicyMutationPayload",kind:"LinkedField",name:"patchProjectTraceRetentionPolicy",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null}],type:"TraceRetentionRuleMaxDays",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"GlobalRetentionPolicyCardMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"GlobalRetentionPolicyCardMutation",selections:a},params:{cacheID:"096e3d4c546229fc771e14be03b168a3",id:null,metadata:{},name:"GlobalRetentionPolicyCardMutation",operationKind:"mutation",text:`mutation GlobalRetentionPolicyCardMutation(
653
653
  $input: PatchProjectTraceRetentionPolicyInput!
654
654
  ) {
655
655
  patchProjectTraceRetentionPolicy(input: $input) {
@@ -677,7 +677,7 @@ fragment UserAPIKeysTableFragment on Query {
677
677
  }
678
678
  }
679
679
  }
680
- `}}}();Jd.hash="15a513ac6f9c30b739810e2e18d6f0ab";const lb=()=>{var y,g,m;const n=ke(),a=Fe(),l=P.useLazyLoadQuery(Jd,{}),[t]=P.useMutation(Wd),{control:i,handleSubmit:r,formState:{isDirty:o},reset:d}=Qe({defaultValues:{maxDays:((g=(y=l.defaultProjectTraceRetentionPolicy)==null?void 0:y.rule)==null?void 0:g.__typename)==="TraceRetentionRuleMaxDays"?l.defaultProjectTraceRetentionPolicy.rule.maxDays:0}}),c=(m=l.defaultProjectTraceRetentionPolicy)==null?void 0:m.id,u=p.useCallback(f=>{t({variables:{input:{id:c,rule:{maxDays:{maxDays:f.maxDays}}}},onCompleted:h=>{var S,C,T;const k=((T=(C=(S=h.patchProjectTraceRetentionPolicy)==null?void 0:S.node)==null?void 0:C.rule)==null?void 0:T.__typename)==="TraceRetentionRuleMaxDays"?h.patchProjectTraceRetentionPolicy.node.rule.maxDays:null;k!==null&&d({maxDays:k}),n(k===0?{title:"Default retention policy disabled",expireMs:5e3}:{title:`Default retention policy has been set to ${k} ${k===1?"day":"days"}`,expireMs:5e3})},onError:()=>{a({title:"Failed to update default retention policy",expireMs:5e3})}})},[c,a,n,t,d]);return s(q,{title:"Default Project Retention Policy",variant:"compact",bodyStyle:{padding:0},children:[e(v,{padding:"size-200",children:s(b,{direction:"row",gap:"size-200",justifyContent:"space-between",children:[e(v,{paddingTop:"size-100",children:e(F,{children:"The default retention policy for all projects that do not have their own custom retention policy. Traces that are older than the specified number of days will be deleted automatically in order to free up storage space."})}),e(v,{width:"1000px",children:e(un,{onSubmit:r(u),children:s(b,{gap:"size-100",direction:"row",alignItems:"center",children:[e(G,{control:i,name:"maxDays",rules:{validate:f=>isNaN(f)?"Maximum trace retention is required. Set to 0 to disable.":!0,min:{value:0,message:"Maximum trace retention must be at least 0 days"},required:"Maximum trace retention is required. Set to 0 to disable."},render:({field:f,fieldState:h})=>{var k;return s(oa,{...f,minValue:0,isInvalid:!!h.error,children:[e(W,{children:"Maximum Trace Retention in Days"}),e(ae,{}),h.error?e(Ce,{children:(k=h.error)==null?void 0:k.message}):e(F,{slot:"description",children:"0 days is equal to no policy."})]})}}),e("div",{css:K`
680
+ `}}}();Jd.hash="15a513ac6f9c30b739810e2e18d6f0ab";const lb=()=>{var y,g,m;const n=ke(),a=Fe(),l=T.useLazyLoadQuery(Jd,{}),[t]=T.useMutation(Wd),{control:i,handleSubmit:r,formState:{isDirty:o},reset:d}=Qe({defaultValues:{maxDays:((g=(y=l.defaultProjectTraceRetentionPolicy)==null?void 0:y.rule)==null?void 0:g.__typename)==="TraceRetentionRuleMaxDays"?l.defaultProjectTraceRetentionPolicy.rule.maxDays:0}}),c=(m=l.defaultProjectTraceRetentionPolicy)==null?void 0:m.id,u=p.useCallback(f=>{t({variables:{input:{id:c,rule:{maxDays:{maxDays:f.maxDays}}}},onCompleted:h=>{var S,C,P;const k=((P=(C=(S=h.patchProjectTraceRetentionPolicy)==null?void 0:S.node)==null?void 0:C.rule)==null?void 0:P.__typename)==="TraceRetentionRuleMaxDays"?h.patchProjectTraceRetentionPolicy.node.rule.maxDays:null;k!==null&&d({maxDays:k}),n(k===0?{title:"Default retention policy disabled",expireMs:5e3}:{title:`Default retention policy has been set to ${k} ${k===1?"day":"days"}`,expireMs:5e3})},onError:()=>{a({title:"Failed to update default retention policy",expireMs:5e3})}})},[c,a,n,t,d]);return s(q,{title:"Default Project Retention Policy",variant:"compact",bodyStyle:{padding:0},children:[e(v,{padding:"size-200",children:s(b,{direction:"row",gap:"size-200",justifyContent:"space-between",children:[e(v,{paddingTop:"size-100",children:e(F,{children:"The default retention policy for all projects that do not have their own custom retention policy. Traces that are older than the specified number of days will be deleted automatically in order to free up storage space."})}),e(v,{width:"1000px",children:e(un,{onSubmit:r(u),children:s(b,{gap:"size-100",direction:"row",alignItems:"center",children:[e(G,{control:i,name:"maxDays",rules:{validate:f=>isNaN(f)?"Maximum trace retention is required. Set to 0 to disable.":!0,min:{value:0,message:"Maximum trace retention must be at least 0 days"},required:"Maximum trace retention is required. Set to 0 to disable."},render:({field:f,fieldState:h})=>{var k;return s(oa,{...f,minValue:0,isInvalid:!!h.error,children:[e(W,{children:"Maximum Trace Retention in Days"}),e(ae,{}),h.error?e(Ce,{children:(k=h.error)==null?void 0:k.message}):e(F,{slot:"description",children:"0 days is equal to no policy."})]})}}),e("div",{css:K`
681
681
  margin-top: 3px;
682
682
  `,children:e(E,{type:"submit",isDisabled:!o,children:"Update"})})]})})})]})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopWidth:"thin",borderColor:"dark",children:e(b,{direction:"row",justifyContent:"end",children:e(Oe,{to:"/settings/data",children:"All Retention Policies"})})})]})},Zd=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"UsersCardQuery",selections:[{args:null,kind:"FragmentSpread",name:"UsersTable_users"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"UsersCardQuery",selections:[{alias:null,args:null,concreteType:"UserConnection",kind:"LinkedField",name:"users",plural:!1,selections:[{alias:null,args:null,concreteType:"UserEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"user",args:null,concreteType:"User",kind:"LinkedField",name:"node",plural:!1,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"authMethod",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},{alias:null,args:null,concreteType:"UserRole",kind:"LinkedField",name:"role",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},n],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"7198a3944688637f02a72e35643511d0",id:null,metadata:{},name:"UsersCardQuery",operationKind:"query",text:`query UsersCardQuery {
683
683
  ...UsersTable_users
@@ -711,7 +711,7 @@ fragment UsersTable_users on Query {
711
711
  }
712
712
  }
713
713
  }
714
- `}}}();Xd.hash="97d1aefa41e8831e57b6bb0d1a078a7c";function tb({onNewUserCreated:n,onNewUserCreationError:a,onDismiss:l}){const[t,i]=P.useMutation(Xd),r=p.useCallback(d=>{t({variables:{input:{email:d.email,username:d.username,password:d.password,role:d.role,authMethod:"LOCAL",sendWelcomeEmail:!0}},onCompleted:c=>{n(c.createUser.user.email)},onError:c=>{a(c)}})},[t,n,a]),o=p.useCallback(d=>{t({variables:{input:{email:d.email,username:d.username,role:d.role,authMethod:"OAUTH2",sendWelcomeEmail:!0}},onCompleted:c=>{n(c.createUser.user.email)},onError:c=>{a(c)}})},[t,n,a]);return e(ne,{isOpen:!0,onOpenChange:d=>{d||l()},children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Add User"}),e(me,{})]}),window.Config.basicAuthDisabled?e(of,{onSubmit:o,isSubmitting:i},"oauth-form"):e(df,{onSubmit:r,isSubmitting:i},"user-form")]})})})})}const Yd=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"UsersTableQuery",selections:[{args:null,kind:"FragmentSpread",name:"UsersTable_users"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"UsersTableQuery",selections:[{alias:null,args:null,concreteType:"UserConnection",kind:"LinkedField",name:"users",plural:!1,selections:[{alias:null,args:null,concreteType:"UserEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"user",args:null,concreteType:"User",kind:"LinkedField",name:"node",plural:!1,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"authMethod",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},{alias:null,args:null,concreteType:"UserRole",kind:"LinkedField",name:"role",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},n],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"e5a1fa2cfeca95ac9f22b2c65d3a4548",id:null,metadata:{},name:"UsersTableQuery",operationKind:"query",text:`query UsersTableQuery {
714
+ `}}}();Xd.hash="97d1aefa41e8831e57b6bb0d1a078a7c";function tb({onNewUserCreated:n,onNewUserCreationError:a,onDismiss:l}){const[t,i]=T.useMutation(Xd),r=p.useCallback(d=>{t({variables:{input:{email:d.email,username:d.username,password:d.password,role:d.role,authMethod:"LOCAL",sendWelcomeEmail:!0}},onCompleted:c=>{n(c.createUser.user.email)},onError:c=>{a(c)}})},[t,n,a]),o=p.useCallback(d=>{t({variables:{input:{email:d.email,username:d.username,role:d.role,authMethod:"OAUTH2",sendWelcomeEmail:!0}},onCompleted:c=>{n(c.createUser.user.email)},onError:c=>{a(c)}})},[t,n,a]);return e(ne,{isOpen:!0,onOpenChange:d=>{d||l()},children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Add User"}),e(me,{})]}),window.Config.basicAuthDisabled?e(of,{onSubmit:o,isSubmitting:i},"oauth-form"):e(df,{onSubmit:r,isSubmitting:i},"user-form")]})})})})}const Yd=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"UsersTableQuery",selections:[{args:null,kind:"FragmentSpread",name:"UsersTable_users"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"UsersTableQuery",selections:[{alias:null,args:null,concreteType:"UserConnection",kind:"LinkedField",name:"users",plural:!1,selections:[{alias:null,args:null,concreteType:"UserEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"user",args:null,concreteType:"User",kind:"LinkedField",name:"node",plural:!1,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"authMethod",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},{alias:null,args:null,concreteType:"UserRole",kind:"LinkedField",name:"role",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},n],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"e5a1fa2cfeca95ac9f22b2c65d3a4548",id:null,metadata:{},name:"UsersTableQuery",operationKind:"query",text:`query UsersTableQuery {
715
715
  ...UsersTable_users
716
716
  }
717
717
 
@@ -738,21 +738,21 @@ fragment UsersTable_users on Query {
738
738
  ) {
739
739
  deleteUsers(input: $input)
740
740
  }
741
- `}}}();nc.hash="a718ceab0ec0a7d461f6cd5e5b178a1f";function ib({userId:n,onDeleted:a,onClose:l}){const[t,i]=P.useMutation(nc),r=ke(),o=Fe(),d=p.useCallback(()=>{t({variables:{input:{userIds:[n]}},onCompleted:()=>{r({title:"User deleted",message:"User has been deleted."}),a(),l()},onError:c=>{const u=Re(c);o({title:"Failed to delete user",message:(u==null?void 0:u[0])??c.message})}})},[t,o,r,l,a,n]);return e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Delete User"}),e(ue,{children:e(me,{onPress:l,slot:"close"})})]}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:"Are you sure you want to delete this user? This action cannot be undone."})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",onPress:l,children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{d()},isDisabled:i,children:"Delete user"})]})})]})})}const ac=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchUser",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ResetPasswordDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ResetPasswordDialogMutation",selections:a},params:{cacheID:"6ccff8dd53d97eeb41f656bcd2758da1",id:null,metadata:{},name:"ResetPasswordDialogMutation",operationKind:"mutation",text:`mutation ResetPasswordDialogMutation(
741
+ `}}}();nc.hash="a718ceab0ec0a7d461f6cd5e5b178a1f";function ib({userId:n,onDeleted:a,onClose:l}){const[t,i]=T.useMutation(nc),r=ke(),o=Fe(),d=p.useCallback(()=>{t({variables:{input:{userIds:[n]}},onCompleted:()=>{r({title:"User deleted",message:"User has been deleted."}),a(),l()},onError:c=>{const u=Re(c);o({title:"Failed to delete user",message:(u==null?void 0:u[0])??c.message})}})},[t,o,r,l,a,n]);return e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Delete User"}),e(ue,{children:e(me,{onPress:l,slot:"close"})})]}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:"Are you sure you want to delete this user? This action cannot be undone."})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",onPress:l,children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{d()},isDisabled:i,children:"Delete user"})]})})]})})}const ac=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchUser",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ResetPasswordDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ResetPasswordDialogMutation",selections:a},params:{cacheID:"6ccff8dd53d97eeb41f656bcd2758da1",id:null,metadata:{},name:"ResetPasswordDialogMutation",operationKind:"mutation",text:`mutation ResetPasswordDialogMutation(
742
742
  $input: PatchUserInput!
743
743
  ) {
744
744
  patchUser(input: $input) {
745
745
  __typename
746
746
  }
747
747
  }
748
- `}}}();ac.hash="85b22da61ec094c28e97db2759622b69";const Pl=4;function rb({userId:n,onClose:a}){const l=Fe(),t=ke(),[i,r]=P.useMutation(ac),{control:o,handleSubmit:d,formState:{isDirty:c}}=Qe({defaultValues:{newPassword:"",confirmPassword:""}}),u=p.useCallback(y=>{i({variables:{input:{userId:n,newPassword:y.newPassword}},onCompleted:()=>{t({title:"Password reset",message:"Users password has been reset."}),a()},onError:g=>{l({title:"Failed to reset password",message:g.message})}})},[i,l,t,a,n]);return e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Reset Password"}),e(ue,{children:e(me,{onPress:a,slot:"close"})})]}),e(un,{children:s(v,{padding:"size-200",children:[s(b,{direction:"column",gap:"size-100",children:[e(G,{name:"newPassword",control:o,rules:{required:"Password is required",minLength:{value:Pl,message:`Password must be at least ${Pl} characters`}},render:({field:{name:y,onChange:g,onBlur:m,value:f},fieldState:{invalid:h,error:k}})=>s(ie,{isInvalid:h,onChange:g,name:y,onBlur:m,value:f.toString(),type:"password",id:"new-password",autoComplete:"new-password",children:[e(W,{children:"New Password"}),e(ae,{placeholder:"New password"}),k!=null&&k.message?e(Ce,{children:k.message}):s(F,{slot:"description",children:["Password must be at least ",Pl," ","characters"]})]})}),e(G,{name:"confirmPassword",control:o,rules:{required:"Password is required",minLength:{value:Pl,message:`Password must be at least ${Pl} characters`},validate:(y,g)=>y===g.newPassword||"Passwords do not match"},render:({field:{name:y,onChange:g,onBlur:m,value:f},fieldState:{invalid:h,error:k}})=>s(ie,{isInvalid:h,onChange:g,name:y,onBlur:m,value:f.toString(),type:"password",children:[e(W,{children:"Confirm Password"}),e(ae,{placeholder:"Repeat new password"}),k!=null&&k.message?e(Ce,{children:k.message}):e(F,{slot:"description",children:"Repeat new password to confirm"})]})})]}),e(v,{paddingTop:"size-200",children:s(b,{direction:"row",gap:"size-100",justifyContent:"end",children:[e(E,{variant:"default",size:"S",onPress:a,isDisabled:r,children:"Cancel"}),e(E,{variant:c?"primary":"default",type:"submit",isDisabled:r,onPress:()=>d(u)(),children:r?"Resetting...":"Reset Password"})]})})]})})]})})}function sb(n){return n==="LOCAL"}function ob(n){const{userId:a,onUserDeleted:l,authMethod:t}=n,[i,r]=p.useState(!1),[o,d]=p.useState(!1),c=p.useMemo(()=>{const u=e(je,{children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Je,{})}),e(Y,{children:"Delete"})]})},"deleteUser"),y=e(je,{children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(no,{})}),e(Y,{children:"Reset Password"})]})},"resetPassword"),g=[u];return sb(t)&&g.push(y),g},[t]);return s("div",{onClick:u=>{u.preventDefault(),u.stopPropagation()},children:[e(Ma,{align:"end","aria-label":"User Actions",buttonSize:"compact",onAction:u=>{switch(u){case"deleteUser":r(!0);break;case"resetPassword":d(!0);break}},children:c}),e(J,{isOpen:i,onOpenChange:r,children:e(ne,{children:e(Z,{children:e(ib,{userId:a,onClose:()=>r(!1),onDeleted:()=>{l(),r(!1)}})})})}),e(J,{isOpen:o,onOpenChange:d,children:e(ne,{children:e(Z,{children:e(rb,{userId:a,onClose:()=>d(!1)})})})})]})}const lc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchUser",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UserRoleChangeDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UserRoleChangeDialogMutation",selections:a},params:{cacheID:"44e970c967f83a0b7a6bd1cbafc3a936",id:null,metadata:{},name:"UserRoleChangeDialogMutation",operationKind:"mutation",text:`mutation UserRoleChangeDialogMutation(
748
+ `}}}();ac.hash="85b22da61ec094c28e97db2759622b69";const Pl=4;function rb({userId:n,onClose:a}){const l=Fe(),t=ke(),[i,r]=T.useMutation(ac),{control:o,handleSubmit:d,formState:{isDirty:c}}=Qe({defaultValues:{newPassword:"",confirmPassword:""}}),u=p.useCallback(y=>{i({variables:{input:{userId:n,newPassword:y.newPassword}},onCompleted:()=>{t({title:"Password reset",message:"Users password has been reset."}),a()},onError:g=>{l({title:"Failed to reset password",message:g.message})}})},[i,l,t,a,n]);return e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Reset Password"}),e(ue,{children:e(me,{onPress:a,slot:"close"})})]}),e(un,{children:s(v,{padding:"size-200",children:[s(b,{direction:"column",gap:"size-100",children:[e(G,{name:"newPassword",control:o,rules:{required:"Password is required",minLength:{value:Pl,message:`Password must be at least ${Pl} characters`}},render:({field:{name:y,onChange:g,onBlur:m,value:f},fieldState:{invalid:h,error:k}})=>s(ie,{isInvalid:h,onChange:g,name:y,onBlur:m,value:f.toString(),type:"password",id:"new-password",autoComplete:"new-password",children:[e(W,{children:"New Password"}),e(ae,{placeholder:"New password"}),k!=null&&k.message?e(Ce,{children:k.message}):s(F,{slot:"description",children:["Password must be at least ",Pl," ","characters"]})]})}),e(G,{name:"confirmPassword",control:o,rules:{required:"Password is required",minLength:{value:Pl,message:`Password must be at least ${Pl} characters`},validate:(y,g)=>y===g.newPassword||"Passwords do not match"},render:({field:{name:y,onChange:g,onBlur:m,value:f},fieldState:{invalid:h,error:k}})=>s(ie,{isInvalid:h,onChange:g,name:y,onBlur:m,value:f.toString(),type:"password",children:[e(W,{children:"Confirm Password"}),e(ae,{placeholder:"Repeat new password"}),k!=null&&k.message?e(Ce,{children:k.message}):e(F,{slot:"description",children:"Repeat new password to confirm"})]})})]}),e(v,{paddingTop:"size-200",children:s(b,{direction:"row",gap:"size-100",justifyContent:"end",children:[e(E,{variant:"default",size:"S",onPress:a,isDisabled:r,children:"Cancel"}),e(E,{variant:c?"primary":"default",type:"submit",isDisabled:r,onPress:()=>d(u)(),children:r?"Resetting...":"Reset Password"})]})})]})})]})})}function sb(n){return n==="LOCAL"}function ob(n){const{userId:a,onUserDeleted:l,authMethod:t}=n,[i,r]=p.useState(!1),[o,d]=p.useState(!1),c=p.useMemo(()=>{const u=e(je,{children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Je,{})}),e(Y,{children:"Delete"})]})},"deleteUser"),y=e(je,{children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(no,{})}),e(Y,{children:"Reset Password"})]})},"resetPassword"),g=[u];return sb(t)&&g.push(y),g},[t]);return s("div",{onClick:u=>{u.preventDefault(),u.stopPropagation()},children:[e(Ma,{align:"end","aria-label":"User Actions",buttonSize:"compact",onAction:u=>{switch(u){case"deleteUser":r(!0);break;case"resetPassword":d(!0);break}},children:c}),e(J,{isOpen:i,onOpenChange:r,children:e(ne,{children:e(Z,{children:e(ib,{userId:a,onClose:()=>r(!1),onDeleted:()=>{l(),r(!1)}})})})}),e(J,{isOpen:o,onOpenChange:d,children:e(ne,{children:e(Z,{children:e(rb,{userId:a,onClose:()=>d(!1)})})})})]})}const lc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchUser",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UserRoleChangeDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UserRoleChangeDialogMutation",selections:a},params:{cacheID:"44e970c967f83a0b7a6bd1cbafc3a936",id:null,metadata:{},name:"UserRoleChangeDialogMutation",operationKind:"mutation",text:`mutation UserRoleChangeDialogMutation(
749
749
  $input: PatchUserInput!
750
750
  ) {
751
751
  patchUser(input: $input) {
752
752
  __typename
753
753
  }
754
754
  }
755
- `}}}();lc.hash="468eff05b42e39b55f9aa5b9a7d2c483";function db({userId:n,email:a,currentRole:l,newRole:t,onRoleChanged:i,onClose:r}){const[o,d]=P.useMutation(lc),c=ke(),u=Fe(),y=p.useCallback(()=>{o({variables:{input:{userId:n,newRole:t}},onCompleted:()=>{c({title:"Role Changed",message:"Users role has been changed."}),i(),r()},onError:g=>{u({title:"Failed to delete user",message:g.message})}})},[o,t,u,c,r,i,n]);return e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Confirm role change"}),e(ue,{children:e(me,{onPress:r,slot:"close"})})]}),e(v,{padding:"size-200",children:s(F,{children:[`Are you sure you want to change the role for ${a} from `," ",e("b",{children:hi(l)})," to"," ",e("b",{children:hi(t)}),"?"]})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{onPress:r,size:"S",children:"Cancel"}),e(E,{variant:"primary",size:"S",onPress:()=>{y()},isDisabled:d,children:"Change role"})]})})]})})}const cb=55,ub=K`
755
+ `}}}();lc.hash="468eff05b42e39b55f9aa5b9a7d2c483";function db({userId:n,email:a,currentRole:l,newRole:t,onRoleChanged:i,onClose:r}){const[o,d]=T.useMutation(lc),c=ke(),u=Fe(),y=p.useCallback(()=>{o({variables:{input:{userId:n,newRole:t}},onCompleted:()=>{c({title:"Role Changed",message:"Users role has been changed."}),i(),r()},onError:g=>{u({title:"Failed to delete user",message:g.message})}})},[o,t,u,c,r,i,n]);return e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Confirm role change"}),e(ue,{children:e(me,{onPress:r,slot:"close"})})]}),e(v,{padding:"size-200",children:s(F,{children:[`Are you sure you want to change the role for ${a} from `," ",e("b",{children:hi(l)})," to"," ",e("b",{children:hi(t)}),"?"]})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{onPress:r,size:"S",children:"Cancel"}),e(E,{variant:"primary",size:"S",onPress:()=>{y()},isDisabled:d,children:"Change role"})]})})]})})}const cb=55,ub=K`
756
756
  text-decoration: none;
757
757
  color: var(--ac-global-color-grey-600);
758
758
  font-size: 12px;
@@ -761,7 +761,7 @@ fragment UsersTable_users on Query {
761
761
  }
762
762
  `,mb=K`
763
763
  height: ${cb}px;
764
- `,as=n=>n.email==="admin@localhost"||n.username==="admin";function gb({query:n}){const[a,l]=p.useState(null),[t,i]=P.useRefetchableFragment(ec,n),r=p.useMemo(()=>t.users.edges.map(({user:m})=>({id:m.id,email:m.email,username:m.username,profilePictureUrl:m.profilePictureUrl,createdAt:m.createdAt,role:m.role.name,authMethod:m.authMethod})),[t]),o=p.useCallback(()=>{p.startTransition(()=>{i({},{fetchPolicy:"network-only"})})},[i]),{viewer:d}=$i(),c=p.useMemo(()=>[{header:"user",accessorKey:"username",cell:({row:m})=>s(b,{direction:"row",gap:"size-50",alignItems:"center",children:[e(Pt,{name:m.original.username,profilePictureUrl:m.original.profilePictureUrl,size:20}),e("span",{children:m.original.username}),e("a",{href:`mailto:${m.original.email}`,css:ub,children:m.original.email})]})},{header:"method",accessorKey:"authMethod",size:10,cell:({row:m})=>m.original.authMethod.toLowerCase()},{header:"role",accessorKey:"role",cell:({row:m})=>as(m.original)||d&&d.email==m.original.email?hi(m.original.role):e(uf,{includeLabel:!1,size:"S",onChange:f=>{f!==m.original.role&&l(e(db,{onClose:()=>l(null),onRoleChanged:o,currentRole:m.original.role,newRole:f,email:m.original.email,userId:m.original.id}))},role:cf(m.original.role)?m.original.role:void 0})},{header:"created at",accessorKey:"createdAt",cell:we},{header:"",accessorKey:"id",size:10,cell:({row:m})=>as(m.original)?null:e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(ob,{userId:m.original.id,onUserDeleted:o,authMethod:m.original.authMethod})}),meta:{textAlign:"right"}}],[o,d]),u=Le({columns:c,data:r,getCoreRowModel:_e(),getSortedRowModel:sn()}),y=u.getRowModel().rows,g=u.getRowModel().rows.length===0;return s("table",{css:nn,children:[e("thead",{children:u.getHeaderGroups().map(m=>e("tr",{children:m.headers.map(f=>e("th",{colSpan:f.colSpan,children:f.isPlaceholder?null:s("div",{className:f.column.getCanSort()?"sort":"",onClick:f.column.getToggleSortingHandler(),style:{left:f.getStart(),width:f.getSize()},children:[ee(f.column.columnDef.header,f.getContext()),f.column.getIsSorted()?e(D,{className:"sort-icon",svg:f.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},f.id))},m.id))}),g?e(vn,{}):e("tbody",{children:y.map(m=>e("tr",{css:mb,children:m.getVisibleCells().map(f=>e("td",{children:ee(f.column.columnDef.cell,f.getContext())},f.id))},m.id))}),e(pl,{onDismiss:()=>l(null),isDismissable:!0,type:"modal",children:a})]})}function pb(){const[n,a]=p.useState(0),[l,t]=p.useState(null),i=ke(),r=Fe(),o=P.useLazyLoadQuery(Zd,{},{fetchKey:n,fetchPolicy:"store-and-network"});return s(q,{title:"Users",variant:"compact",bodyStyle:{padding:0,overflowX:"auto"},extra:e(E,{onPress:()=>{t(e(tb,{onDismiss:()=>{t(null)},onNewUserCreated:d=>{t(null),i({title:"User added",message:`User ${d} has been added.`}),a(c=>c+1)},onNewUserCreationError:d=>{const c=Re(d);r({title:"Error adding user",message:(c==null?void 0:c[0])??d.message})}}))},size:"S",leadingVisual:e(D,{svg:e(jn,{})}),children:"Add User"}),children:[e(p.Suspense,{fallback:e(v,{padding:"size-200",children:e(pe,{})}),children:e(gb,{query:o})}),e(pl,{onDismiss:()=>{t(null)},children:l})]})}const yb=K`
764
+ `,as=n=>n.email==="admin@localhost"||n.username==="admin";function gb({query:n}){const[a,l]=p.useState(null),[t,i]=T.useRefetchableFragment(ec,n),r=p.useMemo(()=>t.users.edges.map(({user:m})=>({id:m.id,email:m.email,username:m.username,profilePictureUrl:m.profilePictureUrl,createdAt:m.createdAt,role:m.role.name,authMethod:m.authMethod})),[t]),o=p.useCallback(()=>{p.startTransition(()=>{i({},{fetchPolicy:"network-only"})})},[i]),{viewer:d}=$i(),c=p.useMemo(()=>[{header:"user",accessorKey:"username",cell:({row:m})=>s(b,{direction:"row",gap:"size-50",alignItems:"center",children:[e(Pt,{name:m.original.username,profilePictureUrl:m.original.profilePictureUrl,size:20}),e("span",{children:m.original.username}),e("a",{href:`mailto:${m.original.email}`,css:ub,children:m.original.email})]})},{header:"method",accessorKey:"authMethod",size:10,cell:({row:m})=>m.original.authMethod.toLowerCase()},{header:"role",accessorKey:"role",cell:({row:m})=>as(m.original)||d&&d.email==m.original.email?hi(m.original.role):e(uf,{includeLabel:!1,size:"S",onChange:f=>{f!==m.original.role&&l(e(db,{onClose:()=>l(null),onRoleChanged:o,currentRole:m.original.role,newRole:f,email:m.original.email,userId:m.original.id}))},role:cf(m.original.role)?m.original.role:void 0})},{header:"created at",accessorKey:"createdAt",cell:we},{header:"",accessorKey:"id",size:10,cell:({row:m})=>as(m.original)?null:e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(ob,{userId:m.original.id,onUserDeleted:o,authMethod:m.original.authMethod})}),meta:{textAlign:"right"}}],[o,d]),u=Le({columns:c,data:r,getCoreRowModel:_e(),getSortedRowModel:sn()}),y=u.getRowModel().rows,g=u.getRowModel().rows.length===0;return s("table",{css:nn,children:[e("thead",{children:u.getHeaderGroups().map(m=>e("tr",{children:m.headers.map(f=>e("th",{colSpan:f.colSpan,children:f.isPlaceholder?null:s("div",{className:f.column.getCanSort()?"sort":"",onClick:f.column.getToggleSortingHandler(),style:{left:f.getStart(),width:f.getSize()},children:[ee(f.column.columnDef.header,f.getContext()),f.column.getIsSorted()?e(D,{className:"sort-icon",svg:f.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},f.id))},m.id))}),g?e(vn,{}):e("tbody",{children:y.map(m=>e("tr",{css:mb,children:m.getVisibleCells().map(f=>e("td",{children:ee(f.column.columnDef.cell,f.getContext())},f.id))},m.id))}),e(pl,{onDismiss:()=>l(null),isDismissable:!0,type:"modal",children:a})]})}function pb(){const[n,a]=p.useState(0),[l,t]=p.useState(null),i=ke(),r=Fe(),o=T.useLazyLoadQuery(Zd,{},{fetchKey:n,fetchPolicy:"store-and-network"});return s(q,{title:"Users",variant:"compact",bodyStyle:{padding:0,overflowX:"auto"},extra:e(E,{onPress:()=>{t(e(tb,{onDismiss:()=>{t(null)},onNewUserCreated:d=>{t(null),i({title:"User added",message:`User ${d} has been added.`}),a(c=>c+1)},onNewUserCreationError:d=>{const c=Re(d);r({title:"Error adding user",message:(c==null?void 0:c[0])??d.message})}}))},size:"S",leadingVisual:e(D,{svg:e(jn,{})}),children:"Add User"}),children:[e(p.Suspense,{fallback:e(v,{padding:"size-200",children:e(pe,{})}),children:e(gb,{query:o})}),e(pl,{onDismiss:()=>{t(null)},children:l})]})}const yb=K`
765
765
  .ac-field {
766
766
  // Hacky solution to make the text fields fill the remaining space
767
767
  width: calc(100% - var(--ac-global-dimension-size-600));
@@ -790,7 +790,7 @@ fragment ModelsTable_generativeModels on Query {
790
790
  }
791
791
  }
792
792
  }
793
- `}}}();tc.hash="a0f3a13e85b11b62ee06f77c3efabae7";async function GP(n){const a=await P.fetchQuery(ve,tc,{}).toPromise();if(!a)throw new Error("Failed to load models");return a}const ic=function(){var n={alias:null,args:null,kind:"ScalarField",name:"kind",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SettingsModelsPageQuery",selections:[{args:null,kind:"FragmentSpread",name:"ModelsTable_generativeModels"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"SettingsModelsPageQuery",selections:[{alias:null,args:null,concreteType:"GenerativeModel",kind:"LinkedField",name:"generativeModels",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"provider",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"namePattern",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"providerKey",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"updatedAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lastUsedAt",storageKey:null},n,{alias:null,args:null,concreteType:"TokenPrice",kind:"LinkedField",name:"tokenPrices",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"tokenType",storageKey:null},n,{alias:null,args:null,kind:"ScalarField",name:"costPerMillionTokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"costPerToken",storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"789d7bd2923968a69db4e192ffa39b5b",id:null,metadata:{},name:"SettingsModelsPageQuery",operationKind:"query",text:`query SettingsModelsPageQuery {
793
+ `}}}();tc.hash="a0f3a13e85b11b62ee06f77c3efabae7";async function GP(n){const a=await T.fetchQuery(ve,tc,{}).toPromise();if(!a)throw new Error("Failed to load models");return a}const ic=function(){var n={alias:null,args:null,kind:"ScalarField",name:"kind",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SettingsModelsPageQuery",selections:[{args:null,kind:"FragmentSpread",name:"ModelsTable_generativeModels"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"SettingsModelsPageQuery",selections:[{alias:null,args:null,concreteType:"GenerativeModel",kind:"LinkedField",name:"generativeModels",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"provider",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"namePattern",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"providerKey",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"updatedAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lastUsedAt",storageKey:null},n,{alias:null,args:null,concreteType:"TokenPrice",kind:"LinkedField",name:"tokenPrices",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"tokenType",storageKey:null},n,{alias:null,args:null,kind:"ScalarField",name:"costPerMillionTokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"costPerToken",storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"789d7bd2923968a69db4e192ffa39b5b",id:null,metadata:{},name:"SettingsModelsPageQuery",operationKind:"query",text:`query SettingsModelsPageQuery {
794
794
  ...ModelsTable_generativeModels
795
795
  }
796
796
 
@@ -879,7 +879,7 @@ fragment ModelsTable_generativeModels on Query {
879
879
  & tbody td:not(:last-child) {
880
880
  padding-right: var(--ac-global-dimension-size-100);
881
881
  }
882
- `,children:[e("thead",{children:s("tr",{children:[e("th",{children:"Token type"}),e("th",{children:"Cost / 1M"}),e("th",{})]})}),s("tbody",{children:[l.map((c,u)=>s("tr",{children:[e("td",{children:e(G,{name:`${a}.${u}.tokenType`,control:t,rules:{required:"Token type is required"},render:({fieldState:{invalid:y,error:g},field:m})=>e(kb,{options:i,...m,invalid:y,error:g==null?void 0:g.message})})}),e("td",{children:e(G,{name:`${a}.${u}.costPerMillionTokens`,control:t,rules:{required:"Cost per 1M tokens is required"},render:({fieldState:{invalid:y,error:g},field:m})=>s(oa,{...m,isInvalid:y,minValue:0,isRequired:!0,size:"S",formatOptions:{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:6},children:[e(ae,{}),(g==null?void 0:g.message)&&e(Ce,{children:g.message})]})})}),e("td",{children:e(E,{leadingVisual:e(D,{svg:e(Je,{})}),onPress:()=>{o(u)},size:"S",isDisabled:u===0})})]},c.id)),s("tr",{children:[e("td",{}),e("td",{children:e(b,{justifyContent:"end",alignItems:"start",children:e(E,{onPress:()=>{r({kind:d,tokenType:"",costPerMillionTokens:0})},size:"S",variant:"quiet",children:"Add row"})})}),e("td",{})]})]})]})]})}const ti=[{key:"OPENAI",value:Ya("OPENAI"),label:qn("OPENAI")},{key:"AZURE_OPENAI",value:Ya("AZURE_OPENAI"),label:qn("AZURE_OPENAI")},{key:"ANTHROPIC",value:Ya("ANTHROPIC"),label:qn("ANTHROPIC")},{key:"GOOGLE",value:Ya("GOOGLE"),label:qn("GOOGLE")},{key:"DEEPSEEK",value:Ya("DEEPSEEK"),label:qn("DEEPSEEK")},{key:"XAI",value:Ya("XAI"),label:qn("XAI")}];function bb({value:n,onChange:a,onBlur:l,invalid:t,description:i}){var r;return e(Ua,{label:"Provider",placeholder:"Choose or enter a provider",selectedKey:((r=ti.find(o=>o.value===n))==null?void 0:r.key)||"",inputValue:n,onSelectionChange:o=>{const d=ti.find(c=>c.key===o);d&&a(d.value)},onInputChange:o=>{a(o==null?void 0:o.toLowerCase())},onBlur:l,isInvalid:t,size:"M",allowsCustomValue:!0,description:i,children:ti.map(o=>e(Me,{textValue:o.key,id:o.key,children:s(b,{alignItems:"center",gap:"size-50",children:[e(xa,{provider:o.key,height:18}),o.label]})},o.key))})}function or({modelName:n,modelProvider:a,modelNamePattern:l,modelCost:t,onSubmit:i,isSubmitting:r,submitButtonText:o,formMode:d,startDate:c}){const u=p.useMemo(()=>Array.isArray(t)&&t.length>0?t:[{kind:"PROMPT",tokenType:"input",costPerMillionTokens:0},{kind:"COMPLETION",tokenType:"output",costPerMillionTokens:0}],[t]),y=p.useMemo(()=>u.filter($=>$.kind==="PROMPT"),[u]),g=p.useMemo(()=>u.filter($=>$.kind==="COMPLETION"),[u]),m=p.useMemo(()=>c?Ms(new Date(c).toISOString()):"",[c]),{control:f,handleSubmit:h,formState:{isDirty:k}}=Qe({defaultValues:{name:n??"",provider:a||"",namePattern:l??"",promptCosts:y,completionCosts:g,startTime:m}}),{fields:S,append:C,remove:T}=fi({control:f,name:"promptCosts"}),{fields:_,append:x,remove:N}=fi({control:f,name:"completionCosts"}),w=mf({initialValue:l??""});return s(un,{onSubmit:h(i),children:[e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-200",children:[e(G,{name:"name",control:f,rules:{required:"Model name is required",minLength:{value:1,message:"Name must not be empty"}},render:({field:{onChange:$,onBlur:I,value:M},fieldState:{invalid:z,error:A}})=>s(ie,{isInvalid:z,onChange:$,onBlur:I,value:M,size:"S",children:[e(W,{children:"Model name*"}),e(ae,{placeholder:"e.g. gpt-4, claude-3-sonnet"}),(A==null?void 0:A.message)&&e(Ce,{children:A.message})]})}),e(G,{name:"namePattern",control:f,rules:{required:"Name pattern is required"},render:({field:{onChange:$,onBlur:I,value:M},fieldState:{invalid:z,error:A}})=>e(gf,{...w,value:M,isInvalid:z||w.isInvalid,error:(A==null?void 0:A.message)||w.error,onChange:V=>{$(V),w.onChange(V)},size:"S",onBlur:I,placeholder:"e.g. ^gpt-4$, ^claude-3-sonnet$",description:"Regular expression to match model names during trace ingestion.",label:"Name pattern*"})}),e(G,{name:"provider",control:f,render:({field:{onChange:$,onBlur:I,value:M},fieldState:{invalid:z,error:A}})=>e(bb,{value:M??"",onChange:$,onBlur:I,error:A==null?void 0:A.message,invalid:z,description:"Only models with this provider will be matched by the name pattern."})}),e(G,{name:"startTime",control:f,render:({field:{onChange:$,onBlur:I,value:M},fieldState:{invalid:z,error:A}})=>s(lo,{value:M,onChange:$,onBlur:I,isInvalid:z,granularity:"day",hideTimeZone:!0,children:[e(W,{children:"Start date"}),e(Vs,{style:{width:"100%"},children:V=>e(zs,{segment:V})}),A!=null&&A.message?e(Ce,{children:A.message}):e(F,{slot:"description",children:"Optional start date. If provided, traces ingested on or after this date will have this model's cost applied."})]})}),e(ts,{title:"Prompt tokens",namePrefix:"promptCosts",fields:S,control:f,tokenTypeOptions:fb,onAppend:C,onRemove:T,appendKind:"PROMPT"}),e(ts,{title:"Completion tokens",namePrefix:"completionCosts",fields:_,control:f,tokenTypeOptions:hb,onAppend:x,onRemove:N,appendKind:"COMPLETION"})]})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",position:"sticky",bottom:0,backgroundColor:"dark",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{isDisabled:(d==="edit"?!k:!1)||r,variant:k?"primary":"default",size:"S",type:"submit",children:o})})})]})}const dc=oc;function Sb({queryReference:n,onModelEdited:a,onClose:l}){const{revalidate:t}=Gl(),i=P.usePreloadedQuery(dc,n),[r,o]=P.useMutation(sc),d=ke(),c=Fe(),u=i==null?void 0:i.node;return u?e(or,{modelName:u.name,modelProvider:u.provider,modelNamePattern:u.namePattern,modelCost:u.tokenPrices,startDate:u.startTime,onSubmit:y=>{r({variables:{input:{id:u.id,name:y.name,provider:y.provider,namePattern:y.namePattern,startTime:y.startTime?y.startTime.toDate(ml()).toISOString():null,costs:[...y.promptCosts,...y.completionCosts].map(g=>({tokenType:g.tokenType,costPerMillionTokens:g.costPerMillionTokens,kind:g.kind}))}},onCompleted:()=>{l(),a&&a(y),d({title:"Model Updated",message:`Model "${y.name}" updated successfully`}),t()},onError:g=>{const m=Re(g);c({title:"Failed to update model",message:(m==null?void 0:m[0])??"Failed to update model"})}})},isSubmitting:o,submitButtonText:"Save Changes",formMode:"edit"}):e(Ke,{variant:"danger",children:"Model not found"})}function vb({modelId:n,onModelEdited:a}){const[l,t]=p.useState(!1),[i,r,o]=P.useQueryLoader(dc),d=()=>{r({id:n},{fetchPolicy:"network-only"}),t(!0)},c=()=>{t(!1),o()};return s(J,{isOpen:l,onOpenChange:u=>{u||c()},children:[e(E,{variant:"default",leadingVisual:e(D,{svg:e(Va,{})}),"aria-label":"Edit model",onPress:d,size:"S"}),e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Edit Model"}),e(ue,{children:e(me,{slot:"close"})})]}),e(p.Suspense,{fallback:e(pe,{}),children:i?e(Sb,{queryReference:i,onModelEdited:a,onClose:c}):e(pe,{})})]})})})})]})}const cc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l={alias:null,args:null,kind:"ScalarField",name:"kind",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"CloneModelButtonMutation",selections:[{alias:null,args:a,concreteType:"CreateModelMutationPayload",kind:"LinkedField",name:"createModel",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"ModelsTable_generativeModels"}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"CloneModelButtonMutation",selections:[{alias:null,args:a,concreteType:"CreateModelMutationPayload",kind:"LinkedField",name:"createModel",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:null,concreteType:"GenerativeModel",kind:"LinkedField",name:"generativeModels",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"provider",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"namePattern",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"providerKey",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"updatedAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lastUsedAt",storageKey:null},l,{alias:null,args:null,concreteType:"TokenPrice",kind:"LinkedField",name:"tokenPrices",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"tokenType",storageKey:null},l,{alias:null,args:null,kind:"ScalarField",name:"costPerMillionTokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"costPerToken",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"c4f5dfd5217a0e899dca2d0933f3d00f",id:null,metadata:{},name:"CloneModelButtonMutation",operationKind:"mutation",text:`mutation CloneModelButtonMutation(
882
+ `,children:[e("thead",{children:s("tr",{children:[e("th",{children:"Token type"}),e("th",{children:"Cost / 1M"}),e("th",{})]})}),s("tbody",{children:[l.map((c,u)=>s("tr",{children:[e("td",{children:e(G,{name:`${a}.${u}.tokenType`,control:t,rules:{required:"Token type is required"},render:({fieldState:{invalid:y,error:g},field:m})=>e(kb,{options:i,...m,invalid:y,error:g==null?void 0:g.message})})}),e("td",{children:e(G,{name:`${a}.${u}.costPerMillionTokens`,control:t,rules:{required:"Cost per 1M tokens is required"},render:({fieldState:{invalid:y,error:g},field:m})=>s(oa,{...m,isInvalid:y,minValue:0,isRequired:!0,size:"S",formatOptions:{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:6},children:[e(ae,{}),(g==null?void 0:g.message)&&e(Ce,{children:g.message})]})})}),e("td",{children:e(E,{leadingVisual:e(D,{svg:e(Je,{})}),onPress:()=>{o(u)},size:"S",isDisabled:u===0})})]},c.id)),s("tr",{children:[e("td",{}),e("td",{children:e(b,{justifyContent:"end",alignItems:"start",children:e(E,{onPress:()=>{r({kind:d,tokenType:"",costPerMillionTokens:0})},size:"S",variant:"quiet",children:"Add row"})})}),e("td",{})]})]})]})]})}const ti=[{key:"OPENAI",value:Ya("OPENAI"),label:qn("OPENAI")},{key:"AZURE_OPENAI",value:Ya("AZURE_OPENAI"),label:qn("AZURE_OPENAI")},{key:"ANTHROPIC",value:Ya("ANTHROPIC"),label:qn("ANTHROPIC")},{key:"GOOGLE",value:Ya("GOOGLE"),label:qn("GOOGLE")},{key:"DEEPSEEK",value:Ya("DEEPSEEK"),label:qn("DEEPSEEK")},{key:"XAI",value:Ya("XAI"),label:qn("XAI")}];function bb({value:n,onChange:a,onBlur:l,invalid:t,description:i}){var r;return e(Ua,{label:"Provider",placeholder:"Choose or enter a provider",selectedKey:((r=ti.find(o=>o.value===n))==null?void 0:r.key)||"",inputValue:n,onSelectionChange:o=>{const d=ti.find(c=>c.key===o);d&&a(d.value)},onInputChange:o=>{a(o==null?void 0:o.toLowerCase())},onBlur:l,isInvalid:t,size:"M",allowsCustomValue:!0,description:i,children:ti.map(o=>e(Me,{textValue:o.key,id:o.key,children:s(b,{alignItems:"center",gap:"size-50",children:[e(xa,{provider:o.key,height:18}),o.label]})},o.key))})}function or({modelName:n,modelProvider:a,modelNamePattern:l,modelCost:t,onSubmit:i,isSubmitting:r,submitButtonText:o,formMode:d,startDate:c}){const u=p.useMemo(()=>Array.isArray(t)&&t.length>0?t:[{kind:"PROMPT",tokenType:"input",costPerMillionTokens:0},{kind:"COMPLETION",tokenType:"output",costPerMillionTokens:0}],[t]),y=p.useMemo(()=>u.filter($=>$.kind==="PROMPT"),[u]),g=p.useMemo(()=>u.filter($=>$.kind==="COMPLETION"),[u]),m=p.useMemo(()=>c?Ms(new Date(c).toISOString()):"",[c]),{control:f,handleSubmit:h,formState:{isDirty:k}}=Qe({defaultValues:{name:n??"",provider:a||"",namePattern:l??"",promptCosts:y,completionCosts:g,startTime:m}}),{fields:S,append:C,remove:P}=fi({control:f,name:"promptCosts"}),{fields:L,append:x,remove:N}=fi({control:f,name:"completionCosts"}),w=mf({initialValue:l??""});return s(un,{onSubmit:h(i),children:[e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-200",children:[e(G,{name:"name",control:f,rules:{required:"Model name is required",minLength:{value:1,message:"Name must not be empty"}},render:({field:{onChange:$,onBlur:I,value:M},fieldState:{invalid:z,error:A}})=>s(ie,{isInvalid:z,onChange:$,onBlur:I,value:M,size:"S",children:[e(W,{children:"Model name*"}),e(ae,{placeholder:"e.g. gpt-4, claude-3-sonnet"}),(A==null?void 0:A.message)&&e(Ce,{children:A.message})]})}),e(G,{name:"namePattern",control:f,rules:{required:"Name pattern is required"},render:({field:{onChange:$,onBlur:I,value:M},fieldState:{invalid:z,error:A}})=>e(gf,{...w,value:M,isInvalid:z||w.isInvalid,error:(A==null?void 0:A.message)||w.error,onChange:V=>{$(V),w.onChange(V)},size:"S",onBlur:I,placeholder:"e.g. ^gpt-4$, ^claude-3-sonnet$",description:"Regular expression to match model names during trace ingestion.",label:"Name pattern*"})}),e(G,{name:"provider",control:f,render:({field:{onChange:$,onBlur:I,value:M},fieldState:{invalid:z,error:A}})=>e(bb,{value:M??"",onChange:$,onBlur:I,error:A==null?void 0:A.message,invalid:z,description:"Only models with this provider will be matched by the name pattern."})}),e(G,{name:"startTime",control:f,render:({field:{onChange:$,onBlur:I,value:M},fieldState:{invalid:z,error:A}})=>s(lo,{value:M,onChange:$,onBlur:I,isInvalid:z,granularity:"day",hideTimeZone:!0,children:[e(W,{children:"Start date"}),e(Vs,{style:{width:"100%"},children:V=>e(zs,{segment:V})}),A!=null&&A.message?e(Ce,{children:A.message}):e(F,{slot:"description",children:"Optional start date. If provided, traces ingested on or after this date will have this model's cost applied."})]})}),e(ts,{title:"Prompt tokens",namePrefix:"promptCosts",fields:S,control:f,tokenTypeOptions:fb,onAppend:C,onRemove:P,appendKind:"PROMPT"}),e(ts,{title:"Completion tokens",namePrefix:"completionCosts",fields:L,control:f,tokenTypeOptions:hb,onAppend:x,onRemove:N,appendKind:"COMPLETION"})]})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",position:"sticky",bottom:0,backgroundColor:"dark",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{isDisabled:(d==="edit"?!k:!1)||r,variant:k?"primary":"default",size:"S",type:"submit",children:o})})})]})}const dc=oc;function Sb({queryReference:n,onModelEdited:a,onClose:l}){const{revalidate:t}=Gl(),i=T.usePreloadedQuery(dc,n),[r,o]=T.useMutation(sc),d=ke(),c=Fe(),u=i==null?void 0:i.node;return u?e(or,{modelName:u.name,modelProvider:u.provider,modelNamePattern:u.namePattern,modelCost:u.tokenPrices,startDate:u.startTime,onSubmit:y=>{r({variables:{input:{id:u.id,name:y.name,provider:y.provider,namePattern:y.namePattern,startTime:y.startTime?y.startTime.toDate(ml()).toISOString():null,costs:[...y.promptCosts,...y.completionCosts].map(g=>({tokenType:g.tokenType,costPerMillionTokens:g.costPerMillionTokens,kind:g.kind}))}},onCompleted:()=>{l(),a&&a(y),d({title:"Model Updated",message:`Model "${y.name}" updated successfully`}),t()},onError:g=>{const m=Re(g);c({title:"Failed to update model",message:(m==null?void 0:m[0])??"Failed to update model"})}})},isSubmitting:o,submitButtonText:"Save Changes",formMode:"edit"}):e(Ke,{variant:"danger",children:"Model not found"})}function vb({modelId:n,onModelEdited:a}){const[l,t]=p.useState(!1),[i,r,o]=T.useQueryLoader(dc),d=()=>{r({id:n},{fetchPolicy:"network-only"}),t(!0)},c=()=>{t(!1),o()};return s(J,{isOpen:l,onOpenChange:u=>{u||c()},children:[e(E,{variant:"default",leadingVisual:e(D,{svg:e(Va,{})}),"aria-label":"Edit model",onPress:d,size:"S"}),e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Edit Model"}),e(ue,{children:e(me,{slot:"close"})})]}),e(p.Suspense,{fallback:e(pe,{}),children:i?e(Sb,{queryReference:i,onModelEdited:a,onClose:c}):e(pe,{})})]})})})})]})}const cc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l={alias:null,args:null,kind:"ScalarField",name:"kind",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"CloneModelButtonMutation",selections:[{alias:null,args:a,concreteType:"CreateModelMutationPayload",kind:"LinkedField",name:"createModel",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"ModelsTable_generativeModels"}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"CloneModelButtonMutation",selections:[{alias:null,args:a,concreteType:"CreateModelMutationPayload",kind:"LinkedField",name:"createModel",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:null,concreteType:"GenerativeModel",kind:"LinkedField",name:"generativeModels",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"provider",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"namePattern",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"providerKey",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"updatedAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lastUsedAt",storageKey:null},l,{alias:null,args:null,concreteType:"TokenPrice",kind:"LinkedField",name:"tokenPrices",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"tokenType",storageKey:null},l,{alias:null,args:null,kind:"ScalarField",name:"costPerMillionTokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"costPerToken",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"c4f5dfd5217a0e899dca2d0933f3d00f",id:null,metadata:{},name:"CloneModelButtonMutation",operationKind:"mutation",text:`mutation CloneModelButtonMutation(
883
883
  $input: CreateModelMutationInput!
884
884
  ) {
885
885
  createModel(input: $input) {
@@ -931,7 +931,7 @@ fragment ModelsTable_generativeModels on Query {
931
931
  id
932
932
  }
933
933
  }
934
- `}}}();uc.hash="cba8eee925e486e55b778eeea3ee350c";const mc=uc;function Fb({queryReference:n,onModelCloned:a,onClose:l}){const{revalidate:t}=Gl(),i=P.usePreloadedQuery(mc,n),[r,o]=P.useMutation(cc),d=ke(),c=Fe(),u=i==null?void 0:i.node;return u?e(or,{modelName:`${u.name} (override)`,modelProvider:u.provider,modelNamePattern:u.namePattern,modelCost:u.tokenPrices,startDate:u.startTime,onSubmit:y=>{r({variables:{input:{name:y.name,provider:y.provider,namePattern:y.namePattern,startTime:y.startTime?y.startTime.toDate(ml()).toISOString():null,costs:[...y.promptCosts,...y.completionCosts].map(g=>({tokenType:g.tokenType,costPerMillionTokens:g.costPerMillionTokens,kind:g.kind}))}},onCompleted:()=>{l(),a&&a(y),d({title:"Model Cloned",message:`Model "${y.name}" cloned successfully`}),t()},onError:g=>{const m=Re(g);c({title:"Failed to clone model",message:(m==null?void 0:m[0])??"Failed to clone model"})}})},isSubmitting:o,submitButtonText:"Save Changes",formMode:"create"}):e(Ke,{variant:"danger",children:"Model not found"})}function Cb({modelId:n,onModelCloned:a}){const[l,t]=p.useState(!1),[i,r,o]=P.useQueryLoader(mc),d=()=>{r({id:n},{fetchPolicy:"network-only"}),t(!0)},c=()=>{t(!1),o()};return s(J,{isOpen:l,onOpenChange:u=>{u||c()},children:[e(E,{variant:"default",leadingVisual:e(D,{svg:e(to,{})}),"aria-label":"Clone model",onPress:d,size:"S"}),e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Clone Model"}),e(ue,{children:e(me,{slot:"close"})})]}),e(p.Suspense,{fallback:e(pe,{}),children:i?e(Fb,{queryReference:i,onModelCloned:a,onClose:c}):e(pe,{})})]})})})})]})}const gc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l={alias:null,args:null,kind:"ScalarField",name:"kind",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DeleteModelButtonMutation",selections:[{alias:null,args:a,concreteType:"DeleteModelMutationPayload",kind:"LinkedField",name:"deleteModel",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"ModelsTable_generativeModels"}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DeleteModelButtonMutation",selections:[{alias:null,args:a,concreteType:"DeleteModelMutationPayload",kind:"LinkedField",name:"deleteModel",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:null,concreteType:"GenerativeModel",kind:"LinkedField",name:"generativeModels",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"provider",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"namePattern",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"providerKey",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"updatedAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lastUsedAt",storageKey:null},l,{alias:null,args:null,concreteType:"TokenPrice",kind:"LinkedField",name:"tokenPrices",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"tokenType",storageKey:null},l,{alias:null,args:null,kind:"ScalarField",name:"costPerMillionTokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"costPerToken",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"a1de6e911b9cf52a1773fa3f5dd4cb57",id:null,metadata:{},name:"DeleteModelButtonMutation",operationKind:"mutation",text:`mutation DeleteModelButtonMutation(
934
+ `}}}();uc.hash="cba8eee925e486e55b778eeea3ee350c";const mc=uc;function Fb({queryReference:n,onModelCloned:a,onClose:l}){const{revalidate:t}=Gl(),i=T.usePreloadedQuery(mc,n),[r,o]=T.useMutation(cc),d=ke(),c=Fe(),u=i==null?void 0:i.node;return u?e(or,{modelName:`${u.name} (override)`,modelProvider:u.provider,modelNamePattern:u.namePattern,modelCost:u.tokenPrices,startDate:u.startTime,onSubmit:y=>{r({variables:{input:{name:y.name,provider:y.provider,namePattern:y.namePattern,startTime:y.startTime?y.startTime.toDate(ml()).toISOString():null,costs:[...y.promptCosts,...y.completionCosts].map(g=>({tokenType:g.tokenType,costPerMillionTokens:g.costPerMillionTokens,kind:g.kind}))}},onCompleted:()=>{l(),a&&a(y),d({title:"Model Cloned",message:`Model "${y.name}" cloned successfully`}),t()},onError:g=>{const m=Re(g);c({title:"Failed to clone model",message:(m==null?void 0:m[0])??"Failed to clone model"})}})},isSubmitting:o,submitButtonText:"Save Changes",formMode:"create"}):e(Ke,{variant:"danger",children:"Model not found"})}function Cb({modelId:n,onModelCloned:a}){const[l,t]=p.useState(!1),[i,r,o]=T.useQueryLoader(mc),d=()=>{r({id:n},{fetchPolicy:"network-only"}),t(!0)},c=()=>{t(!1),o()};return s(J,{isOpen:l,onOpenChange:u=>{u||c()},children:[e(E,{variant:"default",leadingVisual:e(D,{svg:e(to,{})}),"aria-label":"Clone model",onPress:d,size:"S"}),e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Clone Model"}),e(ue,{children:e(me,{slot:"close"})})]}),e(p.Suspense,{fallback:e(pe,{}),children:i?e(Fb,{queryReference:i,onModelCloned:a,onClose:c}):e(pe,{})})]})})})})]})}const gc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l={alias:null,args:null,kind:"ScalarField",name:"kind",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DeleteModelButtonMutation",selections:[{alias:null,args:a,concreteType:"DeleteModelMutationPayload",kind:"LinkedField",name:"deleteModel",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"ModelsTable_generativeModels"}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DeleteModelButtonMutation",selections:[{alias:null,args:a,concreteType:"DeleteModelMutationPayload",kind:"LinkedField",name:"deleteModel",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:null,concreteType:"GenerativeModel",kind:"LinkedField",name:"generativeModels",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"provider",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"namePattern",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"providerKey",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"updatedAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lastUsedAt",storageKey:null},l,{alias:null,args:null,concreteType:"TokenPrice",kind:"LinkedField",name:"tokenPrices",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"tokenType",storageKey:null},l,{alias:null,args:null,kind:"ScalarField",name:"costPerMillionTokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"costPerToken",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"a1de6e911b9cf52a1773fa3f5dd4cb57",id:null,metadata:{},name:"DeleteModelButtonMutation",operationKind:"mutation",text:`mutation DeleteModelButtonMutation(
935
935
  $input: DeleteModelMutationInput!
936
936
  ) {
937
937
  deleteModel(input: $input) {
@@ -961,7 +961,7 @@ fragment ModelsTable_generativeModels on Query {
961
961
  }
962
962
  }
963
963
  }
964
- `}}}();gc.hash="e9d96c88779253d2bd9260a3e62801aa";function Kb({modelId:n,modelName:a,onClose:l}){const{revalidate:t}=Gl(),[i,r]=P.useMutation(gc),o=ke(),d=Fe(),c=p.useCallback(()=>{i({variables:{input:{id:n}},onCompleted:()=>{o({title:"Model Deleted",message:`The "${a}" model has been deleted.`}),l(),t()},onError:u=>{const y=Re(u);d({title:"Failed to delete model",message:(y==null?void 0:y[0])||"Failed to delete model"})}})},[i,n,a,d,o,l,t]);return s("div",{children:[e(v,{padding:"size-200",children:e(F,{color:"danger",children:`Are you sure you want to delete the "${a}" model? This action cannot be undone and all services dependent on this model, including associated costs, will be affected.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",onPress:l,size:"S",children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{c()},size:"S",isDisabled:r,children:"Delete Model"})]})})]})}function Tb({modelId:n,modelName:a}){const[l,t]=p.useState(!1),i=()=>{t(!0)},r=()=>{t(!1)};return s(J,{isOpen:l,onOpenChange:o=>{o||r()},children:[e(E,{variant:"danger",leadingVisual:e(D,{svg:e(Je,{})}),"aria-label":"Delete model",onPress:i,size:"S"}),e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Delete Model"}),e(ue,{children:e(me,{slot:"close"})})]}),e(Kb,{modelId:n,modelName:a,onClose:r})]})})})})]})}function st(n){return n!=null?new Date(n).toLocaleString([],pf):void 0}function Ki(n,a){var t,i;return(i=(t=n.tokenPrices)==null?void 0:t.find(r=>r.tokenType===a))==null?void 0:i.costPerMillionTokens}function ot(n,a){const l=Ki(n,a);return l!=null?`${In(l)}`:"--"}const is=(n,a,l)=>{const t=Ki(n.original,l),i=Ki(a.original,l);return t==null||i==null?0:t-i};function Pb({modelsRef:n,kindFilter:a,search:l}){const i=P.useFragment(rc,n).generativeModels,r=p.useMemo(()=>i??[],[i]),o=p.useMemo(()=>[{id:"kind",enableHiding:!0,accessorFn:m=>m.kind},{header:"name",accessorKey:"name",size:300,cell:({row:m})=>{const f=m.original;return s(b,{direction:"row",gap:"size-100",alignItems:"center",justifyContent:"space-between",children:[e(Xe,{maxWidth:"100%",title:f.name,children:f.name}),e(v,{flex:"none",children:m.original.kind==="CUSTOM"?e(gn,{children:"custom"}):e(gn,{color:"var(--ac-global-color-blue-500)",children:"built-in"})})]})}},{header:"provider",accessorFn:m=>m.provider??void 0,sortUndefined:"last",cell:({row:m})=>{const f=m.original.providerKey;return f?s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(xa,{provider:f,height:18}),e("span",{children:qn(f)})]}):e("span",{children:m.original.provider||"--"})}},{header:"match pattern",accessorKey:"namePattern",cell:({row:m})=>{const f=m.original.namePattern,h=m.original.providerKey;return s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("span",{children:e(Xe,{maxWidth:"100%",title:f,children:f})}),h&&s(De,{delay:0,children:[e(Li,{children:e(gn,{role:"button",color:"var(--ac-global-color-grey-300)",children:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(xa,{provider:h,height:18}),e("span",{children:qn(h)})]})})}),s(Cn,{children:[e(dn,{}),"The preceding name pattern match will only be applied on incoming traces with ",qn(h)," set as the provider."]})]})]})}},{header:"prompt cost",id:"input",accessorFn:m=>ot(m,"input"),meta:{textAlign:"right"},sortingFn:is,sortUndefined:"last",cell:({row:m})=>{var h;const f=ot(m.original,"input");return s(b,{justifyContent:"end",alignItems:"center",gap:"size-100",children:[e("span",{children:f}),s(De,{delay:0,children:[e(da,{size:"S","aria-label":"Input cost details",children:e(D,{svg:e(Nl,{})})}),s(Da,{children:[e(dn,{}),e(de,{level:4,weight:"heavy",children:"Input Cost Breakdown"}),e(v,{paddingTop:"size-100",children:((h=m.original.tokenPrices)==null?void 0:h.filter(k=>k.kind==="PROMPT").map(k=>s(b,{direction:"row",gap:"size-100",justifyContent:"space-between",width:"100%",children:[e("span",{children:k.tokenType.toLocaleLowerCase()}),e("span",{children:k.costPerMillionTokens!=null?`${In(k.costPerMillionTokens)} / 1M`:"--"})]},k.tokenType)))??null})]})]})]})}},{header:"completion cost",id:"output",accessorFn:m=>ot(m,"output"),meta:{textAlign:"right"},sortingFn:is,sortUndefined:"last",cell:({row:m})=>{var h;const f=ot(m.original,"output");return s(b,{justifyContent:"end",alignItems:"center",gap:"size-100",children:[e("span",{children:f}),s(De,{delay:0,children:[e(da,{size:"S","aria-label":"Output cost details",children:e(D,{svg:e(Nl,{})})}),s(Da,{children:[e(dn,{}),e(de,{level:4,weight:"heavy",children:"Output Cost Breakdown"}),e(v,{paddingTop:"size-100",children:((h=m.original.tokenPrices)==null?void 0:h.filter(k=>k.kind==="COMPLETION").map(k=>s(b,{direction:"row",gap:"size-100",justifyContent:"space-between",width:"100%",children:[e("span",{children:k.tokenType.toLocaleLowerCase()}),e("span",{children:k.costPerMillionTokens!=null?`${In(k.costPerMillionTokens)} / 1M`:"--"})]},k.tokenType)))??null})]})]})]})}},{header:"start date",sortUndefined:"last",accessorFn:m=>st(m.startTime),cell:m=>e(we,{...m,format:{year:"numeric",month:"numeric",day:"numeric"}})},{header:"created at",accessorFn:m=>st(m.createdAt),sortUndefined:"last",cell:we},{header:"updated at",accessorFn:m=>st(m.updatedAt),sortUndefined:"last",cell:we},{header:"last used at",accessorFn:m=>st(m.lastUsedAt),sortUndefined:"last",cell:we},{id:"actions",header:"",accessorKey:"id",cell:({row:m})=>{const f=m.original.kind==="CUSTOM";return s(b,{direction:"row",gap:"size-50",width:"100%",justifyContent:"end",children:[f&&s(De,{children:[e(vb,{modelId:m.original.id}),s(Cn,{children:[e(dn,{}),"Edit model"]})]}),s(De,{children:[e(Cb,{modelId:m.original.id}),s(Cn,{children:[e(dn,{}),"Clone model"]})]}),f&&s(De,{children:[e(Tb,{modelId:m.original.id,modelName:m.original.name}),s(Cn,{children:[e(dn,{}),"Delete model"]})]})]})}}],[]),d=p.useMemo(()=>[{id:"kind",value:a==="ALL"?"":a}],[a]),c=Le({columns:o,data:r,state:{columnVisibility:{kind:!1,provider:!1},columnPinning:{left:["name"],right:["actions"]},globalFilter:l==null?void 0:l.trim(),columnFilters:d},getCoreRowModel:_e(),getSortedRowModel:sn(),getFilteredRowModel:by()}),u=c.getRowModel().rows;return u.length===0?e(b,{width:"100%",justifyContent:"center",alignItems:"center",children:e("p",{children:"No models found"})}):e("div",{css:K`
964
+ `}}}();gc.hash="e9d96c88779253d2bd9260a3e62801aa";function Kb({modelId:n,modelName:a,onClose:l}){const{revalidate:t}=Gl(),[i,r]=T.useMutation(gc),o=ke(),d=Fe(),c=p.useCallback(()=>{i({variables:{input:{id:n}},onCompleted:()=>{o({title:"Model Deleted",message:`The "${a}" model has been deleted.`}),l(),t()},onError:u=>{const y=Re(u);d({title:"Failed to delete model",message:(y==null?void 0:y[0])||"Failed to delete model"})}})},[i,n,a,d,o,l,t]);return s("div",{children:[e(v,{padding:"size-200",children:e(F,{color:"danger",children:`Are you sure you want to delete the "${a}" model? This action cannot be undone and all services dependent on this model, including associated costs, will be affected.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",onPress:l,size:"S",children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{c()},size:"S",isDisabled:r,children:"Delete Model"})]})})]})}function Tb({modelId:n,modelName:a}){const[l,t]=p.useState(!1),i=()=>{t(!0)},r=()=>{t(!1)};return s(J,{isOpen:l,onOpenChange:o=>{o||r()},children:[e(E,{variant:"danger",leadingVisual:e(D,{svg:e(Je,{})}),"aria-label":"Delete model",onPress:i,size:"S"}),e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Delete Model"}),e(ue,{children:e(me,{slot:"close"})})]}),e(Kb,{modelId:n,modelName:a,onClose:r})]})})})})]})}function st(n){return n!=null?new Date(n).toLocaleString([],pf):void 0}function Ki(n,a){var t,i;return(i=(t=n.tokenPrices)==null?void 0:t.find(r=>r.tokenType===a))==null?void 0:i.costPerMillionTokens}function ot(n,a){const l=Ki(n,a);return l!=null?`${In(l)}`:"--"}const is=(n,a,l)=>{const t=Ki(n.original,l),i=Ki(a.original,l);return t==null||i==null?0:t-i};function Pb({modelsRef:n,kindFilter:a,search:l}){const i=T.useFragment(rc,n).generativeModels,r=p.useMemo(()=>i??[],[i]),o=p.useMemo(()=>[{id:"kind",enableHiding:!0,accessorFn:m=>m.kind},{header:"name",accessorKey:"name",size:300,cell:({row:m})=>{const f=m.original;return s(b,{direction:"row",gap:"size-100",alignItems:"center",justifyContent:"space-between",children:[e(Xe,{maxWidth:"100%",title:f.name,children:f.name}),e(v,{flex:"none",children:m.original.kind==="CUSTOM"?e(gn,{children:"custom"}):e(gn,{color:"var(--ac-global-color-blue-500)",children:"built-in"})})]})}},{header:"provider",accessorFn:m=>m.provider??void 0,sortUndefined:"last",cell:({row:m})=>{const f=m.original.providerKey;return f?s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(xa,{provider:f,height:18}),e("span",{children:qn(f)})]}):e("span",{children:m.original.provider||"--"})}},{header:"match pattern",accessorKey:"namePattern",cell:({row:m})=>{const f=m.original.namePattern,h=m.original.providerKey;return s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("span",{children:e(Xe,{maxWidth:"100%",title:f,children:f})}),h&&s(De,{delay:0,children:[e(Li,{children:e(gn,{role:"button",color:"var(--ac-global-color-grey-300)",children:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(xa,{provider:h,height:18}),e("span",{children:qn(h)})]})})}),s(Cn,{children:[e(dn,{}),"The preceding name pattern match will only be applied on incoming traces with ",qn(h)," set as the provider."]})]})]})}},{header:"prompt cost",id:"input",accessorFn:m=>ot(m,"input"),meta:{textAlign:"right"},sortingFn:is,sortUndefined:"last",cell:({row:m})=>{var h;const f=ot(m.original,"input");return s(b,{justifyContent:"end",alignItems:"center",gap:"size-100",children:[e("span",{children:f}),s(De,{delay:0,children:[e(da,{size:"S","aria-label":"Input cost details",children:e(D,{svg:e(Nl,{})})}),s(Da,{children:[e(dn,{}),e(de,{level:4,weight:"heavy",children:"Input Cost Breakdown"}),e(v,{paddingTop:"size-100",children:((h=m.original.tokenPrices)==null?void 0:h.filter(k=>k.kind==="PROMPT").map(k=>s(b,{direction:"row",gap:"size-100",justifyContent:"space-between",width:"100%",children:[e("span",{children:k.tokenType.toLocaleLowerCase()}),e("span",{children:k.costPerMillionTokens!=null?`${In(k.costPerMillionTokens)} / 1M`:"--"})]},k.tokenType)))??null})]})]})]})}},{header:"completion cost",id:"output",accessorFn:m=>ot(m,"output"),meta:{textAlign:"right"},sortingFn:is,sortUndefined:"last",cell:({row:m})=>{var h;const f=ot(m.original,"output");return s(b,{justifyContent:"end",alignItems:"center",gap:"size-100",children:[e("span",{children:f}),s(De,{delay:0,children:[e(da,{size:"S","aria-label":"Output cost details",children:e(D,{svg:e(Nl,{})})}),s(Da,{children:[e(dn,{}),e(de,{level:4,weight:"heavy",children:"Output Cost Breakdown"}),e(v,{paddingTop:"size-100",children:((h=m.original.tokenPrices)==null?void 0:h.filter(k=>k.kind==="COMPLETION").map(k=>s(b,{direction:"row",gap:"size-100",justifyContent:"space-between",width:"100%",children:[e("span",{children:k.tokenType.toLocaleLowerCase()}),e("span",{children:k.costPerMillionTokens!=null?`${In(k.costPerMillionTokens)} / 1M`:"--"})]},k.tokenType)))??null})]})]})]})}},{header:"start date",sortUndefined:"last",accessorFn:m=>st(m.startTime),cell:m=>e(we,{...m,format:{year:"numeric",month:"numeric",day:"numeric"}})},{header:"created at",accessorFn:m=>st(m.createdAt),sortUndefined:"last",cell:we},{header:"updated at",accessorFn:m=>st(m.updatedAt),sortUndefined:"last",cell:we},{header:"last used at",accessorFn:m=>st(m.lastUsedAt),sortUndefined:"last",cell:we},{id:"actions",header:"",accessorKey:"id",cell:({row:m})=>{const f=m.original.kind==="CUSTOM";return s(b,{direction:"row",gap:"size-50",width:"100%",justifyContent:"end",children:[f&&s(De,{children:[e(vb,{modelId:m.original.id}),s(Cn,{children:[e(dn,{}),"Edit model"]})]}),s(De,{children:[e(Cb,{modelId:m.original.id}),s(Cn,{children:[e(dn,{}),"Clone model"]})]}),f&&s(De,{children:[e(Tb,{modelId:m.original.id,modelName:m.original.name}),s(Cn,{children:[e(dn,{}),"Delete model"]})]})]})}}],[]),d=p.useMemo(()=>[{id:"kind",value:a==="ALL"?"":a}],[a]),c=Le({columns:o,data:r,state:{columnVisibility:{kind:!1,provider:!1},columnPinning:{left:["name"],right:["actions"]},globalFilter:l==null?void 0:l.trim(),columnFilters:d},getCoreRowModel:_e(),getSortedRowModel:sn(),getFilteredRowModel:by()}),u=c.getRowModel().rows;return u.length===0?e(b,{width:"100%",justifyContent:"center",alignItems:"center",children:e("p",{children:"No models found"})}):e("div",{css:K`
965
965
  flex: 1 1 auto;
966
966
  overflow: auto;
967
967
  `,children:s("table",{css:nn,style:{width:c.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:c.getHeaderGroups().map(g=>e("tr",{children:g.headers.map(m=>{var f;return e("th",{colSpan:m.colSpan,style:{...zr(m.column),boxSizing:"border-box",minWidth:m.column.getSize(),maxWidth:m.column.getSize()},children:m.isPlaceholder?null:s("div",{className:m.column.getCanSort()?"sort":"",onClick:m.column.getToggleSortingHandler(),style:{textWrap:"nowrap",textAlign:(f=m.column.columnDef.meta)==null?void 0:f.textAlign},children:[ee(m.column.columnDef.header,m.getContext()),m.column.getIsSorted()?e(D,{className:"sort-icon",svg:m.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},m.id)})},g.id))}),e("tbody",{children:u.map(g=>e("tr",{children:g.getVisibleCells().map(m=>{var f;return e("td",{align:(f=m.column.columnDef.meta)==null?void 0:f.textAlign,style:{...zr(m.column)},children:ee(m.column.columnDef.cell,m.getContext())},m.id)})},g.id))})]})})}const pc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"kind",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"NewModelButtonCreateModelMutation",selections:[{alias:null,args:a,concreteType:"CreateModelMutationPayload",kind:"LinkedField",name:"createModel",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:null,concreteType:"GenerativeModel",kind:"LinkedField",name:"generativeModels",plural:!0,selections:[l],storageKey:null},{args:null,kind:"FragmentSpread",name:"ModelsTable_generativeModels"}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"NewModelButtonCreateModelMutation",selections:[{alias:null,args:a,concreteType:"CreateModelMutationPayload",kind:"LinkedField",name:"createModel",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:null,concreteType:"GenerativeModel",kind:"LinkedField",name:"generativeModels",plural:!0,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"provider",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"namePattern",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"providerKey",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"updatedAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lastUsedAt",storageKey:null},t,{alias:null,args:null,concreteType:"TokenPrice",kind:"LinkedField",name:"tokenPrices",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"tokenType",storageKey:null},t,{alias:null,args:null,kind:"ScalarField",name:"costPerMillionTokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"costPerToken",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"978c0dccdacaa8f56202c6ce03b69170",id:null,metadata:{},name:"NewModelButtonCreateModelMutation",operationKind:"mutation",text:`mutation NewModelButtonCreateModelMutation(
@@ -997,7 +997,7 @@ fragment ModelsTable_generativeModels on Query {
997
997
  }
998
998
  }
999
999
  }
1000
- `}}}();pc.hash="c1c3e531076c830bf86ff1c7f5ae6128";function Ib({onModelCreated:n}){const{revalidate:a}=Gl(),[l,t]=p.useState(null),[i,r]=p.useState(!1),o=ke(),d=Fe(),[c,u]=P.useMutation(pc);return s(J,{isOpen:i,onOpenChange:y=>{t(null),r(y)},children:[e(E,{variant:"primary",size:"S",leadingVisual:e(D,{svg:e(jn,{})}),"aria-label":"Create a new model",onPress:()=>{t(null),r(!0)},isDisabled:u,children:u?"Adding Model...":"Add Model"}),e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Create New Model"}),e(ue,{children:e(me,{slot:"close"})})]}),l?e(Ke,{variant:"danger",children:l}):null,e(or,{onSubmit:y=>{t(null),r(!1),c({variables:{input:{name:y.name,provider:y.provider,namePattern:y.namePattern,startTime:y.startTime?y.startTime.toDate(ml()).toISOString():null,costs:[...y.promptCosts,...y.completionCosts].map(g=>({tokenType:g.tokenType,costPerMillionTokens:g.costPerMillionTokens,kind:g.kind}))}},onCompleted:()=>{n&&n(y),o({title:"Model Created",message:`Model "${y.name}" added successfully`}),a()},onError:g=>{const m=Re(g);d({title:"An error occurred",message:`Failed to add model: ${(m==null?void 0:m[0])??g.message}`})}})},isSubmitting:!1,submitButtonText:"Create Model",formMode:"create"})]})})})})]})}const rs=[{label:"All",value:"ALL"},{label:"Custom",value:"CUSTOM"},{label:"Built-in",value:"BUILT_IN"}];function WP(){var r;const[n,a]=p.useState("ALL"),[l,t]=p.useState(""),i=P.useLazyLoadQuery(ic,{});return s(b,{direction:"column",gap:"size-200",children:[s(b,{gap:"size-200",alignItems:"center",justifyContent:"space-between",children:[e(ie,{"aria-label":"Search models",defaultValue:l,onChange:o=>{p.startTransition(()=>{t(o)})},children:e(ae,{placeholder:"Search models"})}),s(Yl,{selectedKey:n,onSelectionChange:o=>{p.startTransition(()=>{a(o)})},children:[s(E,{children:[e("span",{css:K`
1000
+ `}}}();pc.hash="c1c3e531076c830bf86ff1c7f5ae6128";function Ib({onModelCreated:n}){const{revalidate:a}=Gl(),[l,t]=p.useState(null),[i,r]=p.useState(!1),o=ke(),d=Fe(),[c,u]=T.useMutation(pc);return s(J,{isOpen:i,onOpenChange:y=>{t(null),r(y)},children:[e(E,{variant:"primary",size:"S",leadingVisual:e(D,{svg:e(jn,{})}),"aria-label":"Create a new model",onPress:()=>{t(null),r(!0)},isDisabled:u,children:u?"Adding Model...":"Add Model"}),e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Create New Model"}),e(ue,{children:e(me,{slot:"close"})})]}),l?e(Ke,{variant:"danger",children:l}):null,e(or,{onSubmit:y=>{t(null),r(!1),c({variables:{input:{name:y.name,provider:y.provider,namePattern:y.namePattern,startTime:y.startTime?y.startTime.toDate(ml()).toISOString():null,costs:[...y.promptCosts,...y.completionCosts].map(g=>({tokenType:g.tokenType,costPerMillionTokens:g.costPerMillionTokens,kind:g.kind}))}},onCompleted:()=>{n&&n(y),o({title:"Model Created",message:`Model "${y.name}" added successfully`}),a()},onError:g=>{const m=Re(g);d({title:"An error occurred",message:`Failed to add model: ${(m==null?void 0:m[0])??g.message}`})}})},isSubmitting:!1,submitButtonText:"Create Model",formMode:"create"})]})})})})]})}const rs=[{label:"All",value:"ALL"},{label:"Custom",value:"CUSTOM"},{label:"Built-in",value:"BUILT_IN"}];function WP(){var r;const[n,a]=p.useState("ALL"),[l,t]=p.useState(""),i=T.useLazyLoadQuery(ic,{});return s(b,{direction:"column",gap:"size-200",children:[s(b,{gap:"size-200",alignItems:"center",justifyContent:"space-between",children:[e(ie,{"aria-label":"Search models",defaultValue:l,onChange:o=>{p.startTransition(()=>{t(o)})},children:e(ae,{placeholder:"Search models"})}),s(Yl,{selectedKey:n,onSelectionChange:o=>{p.startTransition(()=>{a(o)})},children:[s(E,{children:[e("span",{css:K`
1001
1001
  text-transform: capitalize;
1002
1002
  `,children:(r=rs.find(o=>o.value===n))==null?void 0:r.label}),e(Ha,{})]}),e(kn,{children:e(ma,{children:rs.map(o=>e(Hn,{id:o.value,children:o.label},o.value))})})]})]}),e(q,{title:"Models",variant:"compact",extra:s(b,{direction:"row",gap:"size-200",alignItems:"center",children:[e(F,{color:"text-500",size:"S",children:"All costs shown in USD per 1M tokens"}),e(Ib,{})]}),bodyStyle:{padding:0},children:e(Pb,{modelsRef:i,kindFilter:n,search:l})})]})}const xb=[{name:"Page A",uv:4e3,pv:2400,amt:2400},{name:"Page B",uv:3e3,pv:1398,amt:2210},{name:"Page C",uv:2e3,pv:9800,amt:2290},{name:"Page D",uv:2780,pv:3908,amt:2e3},{name:"Page E",uv:1890,pv:4800,amt:2181},{name:"Page F",uv:2390,pv:3800,amt:2500},{name:"Page G",uv:3490,pv:4300,amt:2100}],ss="#8884d8";function El(){return e(Qn,{children:s(qt,{data:xb,margin:{top:25,right:18,left:18,bottom:50},children:[e("defs",{children:s("linearGradient",{id:"dashboardBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:ss,stopOpacity:1}),e("stop",{offset:"95%",stopColor:ss,stopOpacity:.5})]})}),e(ra,{dataKey:"name",style:{fill:"var(--ac-global-text-color-700)"}}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"Value",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(La,{dataKey:"pv",fill:"url(#dashboardBarColor)",spacing:15})]})})}function Db({title:n,subtitle:a}){return s("div",{css:K`
1003
1003
  padding: var(--ac-global-dimension-size-100)
@@ -1037,7 +1037,7 @@ fragment ModelsTable_generativeModels on Query {
1037
1037
  id
1038
1038
  }
1039
1039
  }
1040
- `}}}();yc.hash="0db45a204ecd1b95387ed3978ab69779";async function XP(n){const{projectId:a}=n.params,l=await P.fetchQuery(ve,yc,{projectId:a}).toPromise();return qe(l),l}const fc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:50,kind:"LocalArgument",name:"first"}],a=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectDashboardsTableProjectsQuery",selections:[{args:a,kind:"FragmentSpread",name:"ProjectDashboardsTable_projects"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectDashboardsTableProjectsQuery",selections:[{alias:null,args:a,concreteType:"ProjectConnection",kind:"LinkedField",name:"projects",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"project",args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:a,filters:null,handle:"connection",key:"ProjectDashboardsTable_projects",kind:"LinkedHandle",name:"projects"}]},params:{cacheID:"b1c0d4dac4422f3e6fa1eefe59401c76",id:null,metadata:{},name:"ProjectDashboardsTableProjectsQuery",operationKind:"query",text:`query ProjectDashboardsTableProjectsQuery(
1040
+ `}}}();yc.hash="0db45a204ecd1b95387ed3978ab69779";async function XP(n){const{projectId:a}=n.params,l=await T.fetchQuery(ve,yc,{projectId:a}).toPromise();return qe(l),l}const fc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:50,kind:"LocalArgument",name:"first"}],a=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectDashboardsTableProjectsQuery",selections:[{args:a,kind:"FragmentSpread",name:"ProjectDashboardsTable_projects"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectDashboardsTableProjectsQuery",selections:[{alias:null,args:a,concreteType:"ProjectConnection",kind:"LinkedField",name:"projects",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"project",args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:a,filters:null,handle:"connection",key:"ProjectDashboardsTable_projects",kind:"LinkedHandle",name:"projects"}]},params:{cacheID:"b1c0d4dac4422f3e6fa1eefe59401c76",id:null,metadata:{},name:"ProjectDashboardsTableProjectsQuery",operationKind:"query",text:`query ProjectDashboardsTableProjectsQuery(
1041
1041
  $after: String = null
1042
1042
  $first: Int = 50
1043
1043
  ) {
@@ -1063,7 +1063,7 @@ fragment ProjectDashboardsTable_projects_2HEEH6 on Query {
1063
1063
  }
1064
1064
  }
1065
1065
  }
1066
- `}}}();fc.hash="7230783e4ba2832dc8133869d816638c";const hc=function(){var n=["projects"];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:50,kind:"LocalArgument",name:"first"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:[],operation:fc}},name:"ProjectDashboardsTable_projects",selections:[{alias:"projects",args:null,concreteType:"ProjectConnection",kind:"LinkedField",name:"__ProjectDashboardsTable_projects_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"project",args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null}}();hc.hash="7230783e4ba2832dc8133869d816638c";const Eb=50;function Mb({query:n}){const a=p.useRef(null),{data:l,loadNext:t,hasNext:i,isLoadingNext:r}=P.usePaginationFragment(hc,n),o=p.useMemo(()=>l.projects.edges.map(m=>m.project),[l]),d=p.useCallback(m=>{if(m){const{scrollHeight:f,scrollTop:h,clientHeight:k}=m;f-h-k<300&&!r&&i&&t(Eb)}},[i,r,t]),c=p.useMemo(()=>[{header:"Project",accessorKey:"name",cell:({row:m})=>e(Oe,{to:`/dashboards/projects/${m.original.id}`,children:m.original.name})}],[]),u=Le({columns:c,data:o,getCoreRowModel:_e(),getSortedRowModel:sn()}),y=u.getRowModel().rows,g=y.length===0;return e("div",{css:K`
1066
+ `}}}();fc.hash="7230783e4ba2832dc8133869d816638c";const hc=function(){var n=["projects"];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:50,kind:"LocalArgument",name:"first"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:[],operation:fc}},name:"ProjectDashboardsTable_projects",selections:[{alias:"projects",args:null,concreteType:"ProjectConnection",kind:"LinkedField",name:"__ProjectDashboardsTable_projects_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"project",args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null}}();hc.hash="7230783e4ba2832dc8133869d816638c";const Eb=50;function Mb({query:n}){const a=p.useRef(null),{data:l,loadNext:t,hasNext:i,isLoadingNext:r}=T.usePaginationFragment(hc,n),o=p.useMemo(()=>l.projects.edges.map(m=>m.project),[l]),d=p.useCallback(m=>{if(m){const{scrollHeight:f,scrollTop:h,clientHeight:k}=m;f-h-k<300&&!r&&i&&t(Eb)}},[i,r,t]),c=p.useMemo(()=>[{header:"Project",accessorKey:"name",cell:({row:m})=>e(Oe,{to:`/dashboards/projects/${m.original.id}`,children:m.original.name})}],[]),u=Le({columns:c,data:o,getCoreRowModel:_e(),getSortedRowModel:sn()}),y=u.getRowModel().rows,g=y.length===0;return e("div",{css:K`
1067
1067
  flex: 1 1 auto;
1068
1068
  overflow: auto;
1069
1069
  `,onScroll:m=>d(m.target),ref:a,children:s("table",{css:la,children:[e("thead",{children:u.getHeaderGroups().map(m=>e("tr",{children:m.headers.map(f=>e("th",{colSpan:f.colSpan,children:f.isPlaceholder?null:e("div",{children:ee(f.column.columnDef.header,f.getContext())})},f.id))},m.id))}),g?e(vn,{}):e("tbody",{children:y.map(m=>e("tr",{children:m.getVisibleCells().map(f=>{var h;return e("td",{align:(h=f.column.columnDef.meta)==null?void 0:h.textAlign,children:ee(f.column.columnDef.cell,f.getContext())},f.id)})},m.id))})]})})}function Vb({dashboards:n}){const a=p.useRef(null),l=p.useMemo(()=>[{header:"name",accessorKey:"name",cell:({row:o})=>e(Oe,{to:`/dashboards/${o.original.id}`,children:o.original.name})},{header:"description",accessorKey:"description"},{header:"created at",accessorKey:"createdAt",cell:we},{header:"last updated",accessorKey:"lastUpdatedAt",cell:we}],[]),t=Le({columns:l,data:n,getCoreRowModel:_e(),getSortedRowModel:sn()}),i=t.getRowModel().rows,r=i.length===0;return e("div",{css:K`
@@ -1094,7 +1094,7 @@ fragment ProjectDashboardsTable_projects on Query {
1094
1094
  }
1095
1095
  }
1096
1096
  }
1097
- `}}}();kc.hash="93dabaadd9674b38d8c9c7051a25a8b1";async function eI(){const n=await P.fetchQuery(ve,kc,{}).toPromise();return qe(n),n}function nI(){return e(ro,{children:e(Te,{})})}const zb=K`
1097
+ `}}}();kc.hash="93dabaadd9674b38d8c9c7051a25a8b1";async function eI(){const n=await T.fetchQuery(ve,kc,{}).toPromise();return qe(n),n}function nI(){return e(ro,{children:e(Te,{})})}const zb=K`
1098
1098
  display: flex;
1099
1099
  direction: row;
1100
1100
  height: 100vh;
@@ -1275,7 +1275,7 @@ fragment ProjectAnnotationConfigCardContent_project_annotations on Project {
1275
1275
  }
1276
1276
  `}}}();Pc.hash="57a24bc659f8d1c2e7e761194c83231d";const qb=n=>s(q,{title:"Project Annotations",variant:"compact",bodyStyle:{padding:0},children:[e(Ke,{variant:"info",banner:!0,children:"Annotation Configs are configured globally and can be associated with multiple projects. Select the annotation configs you want to use for this project."}),e(p.Suspense,{fallback:e(xf,{}),children:e(Hb,{projectId:n.projectId})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopWidth:"thin",borderColor:"dark",children:e(b,{direction:"row",justifyContent:"end",children:e(Oe,{to:"/settings/annotations",children:"Configure Annotation Configs"})})})]}),Ub=[{id:"select",maxSize:10,header:()=>null,cell:({row:n})=>e(ea,{checked:n.original.isEnabled,disabled:n.original.isLoading,onChange:a=>{const l=n.original.id;if(!l)throw new Error("Annotation config ID is required");a.target.checked?n.original.onAdd(l):n.original.onRemove(l)}})},{id:"name",header:"Name",accessorKey:"name",cell:({row:n})=>e(fl,{annotation:{name:n.original.name||""},annotationDisplayPreference:"none",css:K`
1277
1277
  width: fit-content;
1278
- `},n.original.name)},{id:"type",header:"Type",accessorKey:"annotationType",cell:({row:n})=>{var a,l;return e(F,{children:((a=n.original.annotationType)==null?void 0:a.charAt(0).toUpperCase())+((l=n.original.annotationType)==null?void 0:l.slice(1).toLowerCase())})}}],Hb=n=>{const{projectId:a}=n,[l,t]=p.useState({}),i=ke(),r=Fe(),o=P.useLazyLoadQuery(Pc,{projectId:a}),[d]=P.useRefetchableFragment(Tc,o.project),[c]=P.useMutation(Cc),[u]=P.useMutation(Fc),y=p.useCallback(k=>{t(S=>({...S,[k]:!0})),p.startTransition(()=>{c({variables:{projectId:a,annotationConfigId:k},onCompleted:()=>{t(S=>({...S,[k]:!1})),i({title:"Annotation config added",message:"The annotation config has been added to the project."})},onError:S=>{t(C=>({...C,[k]:!1})),r({title:"Failed to add annotation config",message:S.message||"An unknown error occurred"})}})})},[a,c,i,r]),g=p.useCallback(k=>{t(S=>({...S,[k]:!0})),u({variables:{projectId:a,annotationConfigId:k},onCompleted:()=>{t(S=>({...S,[k]:!1})),i({title:"Annotation config removed",message:"The annotation config has been removed from the project."})},onError:S=>{t(C=>({...C,[k]:!1})),r({title:"Failed to remove annotation config",message:S.message||"An unknown error occurred"})}})},[a,u,i,r]),{allAnnotationConfigs:m}=o,f=p.useMemo(()=>{var S;const k=((S=d==null?void 0:d.annotationConfigs)==null?void 0:S.edges.map(C=>{var T;return(T=C==null?void 0:C.node)==null?void 0:T.name}))||[];return m.edges.map(C=>({id:C.node.id||"",name:C.node.name||"",annotationType:C.node.annotationType||"",isEnabled:k.includes(C.node.name),isLoading:l[C.node.id||""],onAdd:y,onRemove:g}))},[m.edges,d,l,y,g]),h=Le({data:f,columns:Ub,getCoreRowModel:_e()});return m.edges.length===0?e(b,{direction:"row",justifyContent:"center",children:e(F,{children:"No annotation configurations available."})}):e("div",{css:K`
1278
+ `},n.original.name)},{id:"type",header:"Type",accessorKey:"annotationType",cell:({row:n})=>{var a,l;return e(F,{children:((a=n.original.annotationType)==null?void 0:a.charAt(0).toUpperCase())+((l=n.original.annotationType)==null?void 0:l.slice(1).toLowerCase())})}}],Hb=n=>{const{projectId:a}=n,[l,t]=p.useState({}),i=ke(),r=Fe(),o=T.useLazyLoadQuery(Pc,{projectId:a}),[d]=T.useRefetchableFragment(Tc,o.project),[c]=T.useMutation(Cc),[u]=T.useMutation(Fc),y=p.useCallback(k=>{t(S=>({...S,[k]:!0})),p.startTransition(()=>{c({variables:{projectId:a,annotationConfigId:k},onCompleted:()=>{t(S=>({...S,[k]:!1})),i({title:"Annotation config added",message:"The annotation config has been added to the project."})},onError:S=>{t(C=>({...C,[k]:!1})),r({title:"Failed to add annotation config",message:S.message||"An unknown error occurred"})}})})},[a,c,i,r]),g=p.useCallback(k=>{t(S=>({...S,[k]:!0})),u({variables:{projectId:a,annotationConfigId:k},onCompleted:()=>{t(S=>({...S,[k]:!1})),i({title:"Annotation config removed",message:"The annotation config has been removed from the project."})},onError:S=>{t(C=>({...C,[k]:!1})),r({title:"Failed to remove annotation config",message:S.message||"An unknown error occurred"})}})},[a,u,i,r]),{allAnnotationConfigs:m}=o,f=p.useMemo(()=>{var S;const k=((S=d==null?void 0:d.annotationConfigs)==null?void 0:S.edges.map(C=>{var P;return(P=C==null?void 0:C.node)==null?void 0:P.name}))||[];return m.edges.map(C=>({id:C.node.id||"",name:C.node.name||"",annotationType:C.node.annotationType||"",isEnabled:k.includes(C.node.name),isLoading:l[C.node.id||""],onAdd:y,onRemove:g}))},[m.edges,d,l,y,g]),h=Le({data:f,columns:Ub,getCoreRowModel:_e()});return m.edges.length===0?e(b,{direction:"row",justifyContent:"center",children:e(F,{children:"No annotation configurations available."})}):e("div",{css:K`
1279
1279
  overflow: auto;
1280
1280
  `,children:s("table",{css:nn,style:{width:h.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:h.getHeaderGroups().map(k=>e("tr",{children:k.headers.map(S=>e("th",{colSpan:S.colSpan,children:S.isPlaceholder?null:e("div",{style:{left:S.getStart(),width:S.getSize()},children:ee(S.column.columnDef.header,S.getContext())})},S.id))},k.id))}),e("tbody",{children:h.getRowModel().rows.map(k=>e("tr",{children:k.getVisibleCells().map(S=>e("td",{style:{width:S.column.getSize(),maxWidth:S.column.getSize()},children:ee(S.column.columnDef.cell,S.getContext())},S.id))},k.id))})]})})},Ic=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"cronExpression",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null},d={kind:"InlineFragment",selections:[o],type:"TraceRetentionRuleMaxDays",abstractKey:null},c={alias:null,args:null,kind:"ScalarField",name:"maxCount",storageKey:null},u={kind:"InlineFragment",selections:[c],type:"TraceRetentionRuleMaxCount",abstractKey:null},y={kind:"InlineFragment",selections:[o,c],type:"TraceRetentionRuleMaxDaysOrCount",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectPageQueriesProjectConfigQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{args:null,kind:"FragmentSpread",name:"ProjectConfigPage_projectConfigCard"},{args:null,kind:"FragmentSpread",name:"ProjectRetentionPolicyCard_policy"}],storageKey:null},{args:null,kind:"FragmentSpread",name:"ProjectRetentionPolicyCard_query"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectPageQueriesProjectConfigQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,l,{kind:"InlineFragment",selections:[i,{alias:null,args:null,kind:"ScalarField",name:"gradientStartColor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"gradientEndColor",storageKey:null},{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"traceRetentionPolicy",plural:!1,selections:[l,i,r,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[t,d,u,y],storageKey:null}],storageKey:null}],type:"Project",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicyConnection",kind:"LinkedField",name:"projectTraceRetentionPolicies",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicyEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:[l,i,r,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[t,u,d,y],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"21b6f510ef6ac701854b1c2f750f30ad",id:null,metadata:{},name:"ProjectPageQueriesProjectConfigQuery",operationKind:"query",text:`query ProjectPageQueriesProjectConfigQuery(
1281
1281
  $id: ID!
@@ -1532,7 +1532,7 @@ fragment SpansTable_spans on Project {
1532
1532
  }
1533
1533
  id
1534
1534
  }
1535
- `}}}();Dc.hash="6c31b031cf07047b2f02307de192ee3c";const Lc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r=[{kind:"Literal",name:"first",value:30},{kind:"Literal",name:"rootSpansOnly",value:!0},{kind:"Literal",name:"sort",value:{col:"startTime",dir:"desc"}},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],o={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},y=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],g={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:y,storageKey:null},m={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:y,storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},C={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[t,i,k,S,{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},t],storageKey:null}],storageKey:null},T={alias:null,args:null,concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummaries",plural:!0,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null},k],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null},i],storageKey:null},_={alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[t,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[t,i,{alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[k,S],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[t],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},x={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectPageQueriesTracesQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"TracesTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectPageQueriesTracesQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[i,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:"rootSpans",args:r,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[t,o,i,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"statusCode",storageKey:null},d,c,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},u,g,m,f,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,h,{alias:null,args:null,kind:"ScalarField",name:"numSpans",storageKey:null},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},C,T,_,x,{alias:null,args:[{kind:"Literal",name:"first",value:50}],concreteType:"SpanConnection",kind:"LinkedField",name:"descendants",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[t,o,i,{alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},d,c,u,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},g,m,f,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,h],storageKey:null},C,_,T,x],storageKey:null}],storageKey:null}],storageKey:"descendants(first:50)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"rootSpans",args:r,filters:["sort","rootSpansOnly","filterCondition","timeRange"],handle:"connection",key:"TracesTable_rootSpans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"39bcac09eddd27e9899b2c89d44d7ae8",id:null,metadata:{},name:"ProjectPageQueriesTracesQuery",operationKind:"query",text:`query ProjectPageQueriesTracesQuery(
1535
+ `}}}();Dc.hash="6c31b031cf07047b2f02307de192ee3c";const Lc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r=[{kind:"Literal",name:"first",value:30},{kind:"Literal",name:"rootSpansOnly",value:!0},{kind:"Literal",name:"sort",value:{col:"startTime",dir:"desc"}},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],o={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},y=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],g={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:y,storageKey:null},m={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:y,storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},C={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[t,i,k,S,{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},t],storageKey:null}],storageKey:null},P={alias:null,args:null,concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummaries",plural:!0,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null},k],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null},i],storageKey:null},L={alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[t,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[t,i,{alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[k,S],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[t],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},x={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectPageQueriesTracesQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"TracesTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectPageQueriesTracesQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[i,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:"rootSpans",args:r,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[t,o,i,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"statusCode",storageKey:null},d,c,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},u,g,m,f,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,h,{alias:null,args:null,kind:"ScalarField",name:"numSpans",storageKey:null},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},C,P,L,x,{alias:null,args:[{kind:"Literal",name:"first",value:50}],concreteType:"SpanConnection",kind:"LinkedField",name:"descendants",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[t,o,i,{alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},d,c,u,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},g,m,f,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,h],storageKey:null},C,L,P,x],storageKey:null}],storageKey:null}],storageKey:"descendants(first:50)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"rootSpans",args:r,filters:["sort","rootSpansOnly","filterCondition","timeRange"],handle:"connection",key:"TracesTable_rootSpans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"39bcac09eddd27e9899b2c89d44d7ae8",id:null,metadata:{},name:"ProjectPageQueriesTracesQuery",operationKind:"query",text:`query ProjectPageQueriesTracesQuery(
1536
1536
  $id: ID!
1537
1537
  $timeRange: TimeRange!
1538
1538
  ) {
@@ -1751,7 +1751,7 @@ fragment ProjectRetentionPolicyCard_policy on Project {
1751
1751
  }
1752
1752
  }
1753
1753
  }
1754
- `}}}();Mc.hash="7b5534147b50d4a3232a2d5d94705212";const Vc=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"maxCount",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ProjectRetentionPolicyCard_policy",selections:[n,a,{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"traceRetentionPolicy",plural:!1,selections:[n,a,{alias:null,args:null,kind:"ScalarField",name:"cronExpression",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[{kind:"InlineFragment",selections:[l],type:"TraceRetentionRuleMaxDays",abstractKey:null},{kind:"InlineFragment",selections:[t],type:"TraceRetentionRuleMaxCount",abstractKey:null},{kind:"InlineFragment",selections:[l,t],type:"TraceRetentionRuleMaxDaysOrCount",abstractKey:null}],storageKey:null}],storageKey:null}],type:"Project",abstractKey:null}}();Vc.hash="6069a92b50f5083a8c8fbeee6982b6b5";const zc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ProjectRetentionPolicyCard_query",selections:[{args:null,kind:"FragmentSpread",name:"ProjectTraceRetentionPolicySelectFragment"}],type:"Query",abstractKey:null};zc.hash="ae8f95394a5ca83acf7326a90809b351";const Gb=({project:n,query:a})=>{var g,m,f,h,k,S;const l=Zs(),t=ke(),i=Fe(),r=P.useFragment(zc,a),o=P.useFragment(Vc,n),[d,c]=P.useMutation(Mc),u=p.useMemo(()=>{var C;return sr({schedule:((C=o.traceRetentionPolicy)==null?void 0:C.cronExpression)||""})},[(g=o.traceRetentionPolicy)==null?void 0:g.cronExpression]),y=C=>{d({variables:{projectId:o.id,policyId:C},onCompleted:()=>{t({title:"Project retention policy updated",message:"The new policy will take effect at the configured schedule."})},onError:()=>{i({title:"Failed to update retention policy",message:"Please try again."})}})};return s(q,{title:"Data Retention",variant:"compact",bodyStyle:{padding:0},children:[e(v,{paddingX:"size-200",paddingY:"size-100",children:s(b,{direction:"row",gap:"size-400",alignItems:"center",children:[e("section",{children:e(Df,{defaultValue:(m=o.traceRetentionPolicy)==null?void 0:m.id,onChange:y,query:r,isDisabled:c||!l})}),e("section",{children:s(b,{direction:"column",gap:"size-100",children:[e(F,{children:_d({numberOfDays:(h=(f=o.traceRetentionPolicy)==null?void 0:f.rule)==null?void 0:h.maxDays,numberOfTraces:(S=(k=o.traceRetentionPolicy)==null?void 0:k.rule)==null?void 0:S.maxCount})}),s(F,{children:[e("b",{children:"Schedule:"})," ",u]})]})})]})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopWidth:"thin",borderColor:"dark",children:e(b,{direction:"row",justifyContent:"end",children:e(Oe,{to:"/settings/data",children:"Configure Retention Policies"})})})]})},Wb=K`
1754
+ `}}}();Mc.hash="7b5534147b50d4a3232a2d5d94705212";const Vc=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"maxCount",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ProjectRetentionPolicyCard_policy",selections:[n,a,{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"traceRetentionPolicy",plural:!1,selections:[n,a,{alias:null,args:null,kind:"ScalarField",name:"cronExpression",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[{kind:"InlineFragment",selections:[l],type:"TraceRetentionRuleMaxDays",abstractKey:null},{kind:"InlineFragment",selections:[t],type:"TraceRetentionRuleMaxCount",abstractKey:null},{kind:"InlineFragment",selections:[l,t],type:"TraceRetentionRuleMaxDaysOrCount",abstractKey:null}],storageKey:null}],storageKey:null}],type:"Project",abstractKey:null}}();Vc.hash="6069a92b50f5083a8c8fbeee6982b6b5";const zc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ProjectRetentionPolicyCard_query",selections:[{args:null,kind:"FragmentSpread",name:"ProjectTraceRetentionPolicySelectFragment"}],type:"Query",abstractKey:null};zc.hash="ae8f95394a5ca83acf7326a90809b351";const Gb=({project:n,query:a})=>{var g,m,f,h,k,S;const l=Zs(),t=ke(),i=Fe(),r=T.useFragment(zc,a),o=T.useFragment(Vc,n),[d,c]=T.useMutation(Mc),u=p.useMemo(()=>{var C;return sr({schedule:((C=o.traceRetentionPolicy)==null?void 0:C.cronExpression)||""})},[(g=o.traceRetentionPolicy)==null?void 0:g.cronExpression]),y=C=>{d({variables:{projectId:o.id,policyId:C},onCompleted:()=>{t({title:"Project retention policy updated",message:"The new policy will take effect at the configured schedule."})},onError:()=>{i({title:"Failed to update retention policy",message:"Please try again."})}})};return s(q,{title:"Data Retention",variant:"compact",bodyStyle:{padding:0},children:[e(v,{paddingX:"size-200",paddingY:"size-100",children:s(b,{direction:"row",gap:"size-400",alignItems:"center",children:[e("section",{children:e(Df,{defaultValue:(m=o.traceRetentionPolicy)==null?void 0:m.id,onChange:y,query:r,isDisabled:c||!l})}),e("section",{children:s(b,{direction:"column",gap:"size-100",children:[e(F,{children:_d({numberOfDays:(h=(f=o.traceRetentionPolicy)==null?void 0:f.rule)==null?void 0:h.maxDays,numberOfTraces:(S=(k=o.traceRetentionPolicy)==null?void 0:k.rule)==null?void 0:S.maxCount})}),s(F,{children:[e("b",{children:"Schedule:"})," ",u]})]})})]})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopWidth:"thin",borderColor:"dark",children:e(b,{direction:"row",justifyContent:"end",children:e(Oe,{to:"/settings/data",children:"Configure Retention Policies"})})})]})},Wb=K`
1755
1755
  overflow-y: auto;
1756
1756
  `,Jb=K`
1757
1757
  padding: var(--ac-global-dimension-size-400);
@@ -1767,7 +1767,7 @@ fragment ProjectRetentionPolicyCard_policy on Project {
1767
1767
  flex: none;
1768
1768
  border-radius: 50%;
1769
1769
  margin-top: var(--ac-global-dimension-size-100);
1770
- `,lI=()=>{const{projectConfigQueryReference:n}=Ht();return n?e("main",{css:Wb,children:e("div",{css:Jb,children:e(p.Suspense,{fallback:e(pe,{}),children:e(Xb,{project:n})})})}):null},Xb=({project:n})=>{const a=P.usePreloadedQuery(Rc,n);return s(b,{direction:"column",gap:"size-200",children:[e(Yb,{project:a.project}),e(qb,{projectId:a.project.id}),e(Gb,{project:a.project,query:a})]})},Yb=({project:n})=>{const[a]=P.useRefetchableFragment(Sc,n),{defaultTab:l,setDefaultTab:t}=$l(i=>({defaultTab:i.defaultTab,setDefaultTab:i.setDefaultTab}));return e(q,{title:"Project Settings",variant:"compact",children:s(b,{direction:"row",gap:"size-200",children:[e("div",{css:[Zb,{background:`linear-gradient(136.27deg, ${a.gradientStartColor} 14.03%, ${a.gradientEndColor} 84.38%)`}]}),e("div",{css:K`
1770
+ `,lI=()=>{const{projectConfigQueryReference:n}=Ht();return n?e("main",{css:Wb,children:e("div",{css:Jb,children:e(p.Suspense,{fallback:e(pe,{}),children:e(Xb,{project:n})})})}):null},Xb=({project:n})=>{const a=T.usePreloadedQuery(Rc,n);return s(b,{direction:"column",gap:"size-200",children:[e(Yb,{project:a.project}),e(qb,{projectId:a.project.id}),e(Gb,{project:a.project,query:a})]})},Yb=({project:n})=>{const[a]=T.useRefetchableFragment(Sc,n),{defaultTab:l,setDefaultTab:t}=$l(i=>({defaultTab:i.defaultTab,setDefaultTab:i.setDefaultTab}));return e(q,{title:"Project Settings",variant:"compact",children:s(b,{direction:"row",gap:"size-200",children:[e("div",{css:[Zb,{background:`linear-gradient(136.27deg, ${a.gradientStartColor} 14.03%, ${a.gradientEndColor} 84.38%)`}]}),e("div",{css:K`
1771
1771
  width: 100%;
1772
1772
  .ac-dropdown,
1773
1773
  .ac-dropdown-button {
@@ -1796,7 +1796,7 @@ fragment PromptVersionTagsConfigCard_data on Prompt {
1796
1796
  promptVersionId
1797
1797
  }
1798
1798
  }
1799
- `}}}();Nc.hash="14c6b4bb4ca5f20cce70677746b16459";const iI=async({params:n})=>{const a=n.promptId;if(!a)throw new Error("Prompt ID is required");return await P.fetchQuery(ve,Nc,{id:a}).toPromise()},$c={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptIndexPage__aside",selections:[{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptLatestVersionsListFragment"},{args:null,kind:"FragmentSpread",name:"EditPromptButton_data"}],type:"Prompt",abstractKey:null};$c.hash="a77263d84d9add47173ed2e3d0243952";const jc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptIndexPage__main",selections:[{alias:null,args:null,concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"PromptInvocationParameters__main"},{args:null,kind:"FragmentSpread",name:"PromptChatMessagesCard__main"},{args:null,kind:"FragmentSpread",name:"PromptCodeExportCard__main"},{args:null,kind:"FragmentSpread",name:"PromptModelConfigurationCard__main"}],storageKey:null}],storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptIndexPage__aside"}],type:"Prompt",abstractKey:null};jc.hash="a883b83f574448623a2b02a60d899d41";const Oc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptModelConfigurationCard__main",selections:[{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptLLM__main"},{args:null,kind:"FragmentSpread",name:"PromptInvocationParameters__main"},{args:null,kind:"FragmentSpread",name:"PromptTools__main"},{args:null,kind:"FragmentSpread",name:"PromptResponseFormatFragment"}],type:"PromptVersion",abstractKey:null};Oc.hash="1c4202299f1f881250b17b75244fac54";const Qc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptInvocationParameters__main",selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null}],type:"PromptVersion",abstractKey:null};Qc.hash="4f00ab4f0396fffb81a1b068e544cfcf";function e1({keyName:n,value:a}){const{json:l,stringifyError:t}=Yn(a);return t?null:e(v,{paddingStart:"size-100",paddingEnd:"size-100",children:s(b,{direction:"row",justifyContent:"space-between",children:[e(F,{size:"XS",color:"text-700",children:n}),e(F,{size:"XS",children:l})]})})}function n1({promptVersion:n}){const{invocationParameters:a}=P.useFragment(Qc,n),l=p.useMemo(()=>Sy(a)?Object.entries(a).map(([t,i])=>({key:t,value:i})):[],[a]);return l.length===0?e(v,{padding:"size-200",children:e(b,{justifyContent:"center",alignItems:"center",children:e(F,{color:"text-300",children:"No parameters saved for this prompt"})})}):e(Ct,{listSize:"small",children:l.map(({key:t,value:i},r)=>e(Ft,{children:e(e1,{keyName:t,value:i})},`${t}-${r}`))})}const Bc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptLLM__main",selections:[{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null}],type:"PromptVersion",abstractKey:null};Bc.hash="acc90da43126218472d2fc19cd8d0512";const os=({keyName:n,children:a})=>e(Ft,{listSize:"small",children:e(v,{paddingStart:"size-100",paddingEnd:"size-100",children:s(b,{direction:"row",justifyContent:"space-between",children:[e(F,{size:"XS",color:"text-700",children:n}),e(F,{size:"XS",children:a})]})})});function a1({promptVersion:n}){const a=P.useFragment(Bc,n);return s(xe,{id:"llm",children:[e(Pe,{children:"LLM"}),e(Ie,{children:s(Ct,{listSize:"small",children:[e(os,{keyName:"Model",children:a.model}),e(os,{keyName:"Provider",children:bi[a.provider]??a.provider})]})})]})}const qc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptResponseFormatFragment",selections:[{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],storageKey:null}],type:"PromptVersion",abstractKey:null};qc.hash="154d745ec5e978e0dfc811ebfb9faa8c";function l1({promptVersion:n}){const{responseFormat:a}=P.useFragment(qc,n),l=p.useMemo(()=>typeof(a==null?void 0:a.definition)=="string"?Yn(en(a==null?void 0:a.definition).json||"",null,2).json||"":Yn(a==null?void 0:a.definition,null,2).json||"",[a==null?void 0:a.definition]);return l?s(xe,{id:"response-format",children:[e(Pe,{children:"Response Format"}),e(Ie,{children:e(Dn,{value:l})})]}):s(xe,{id:"response-format",children:[e(Pe,{children:"Response Format"}),e(Ie,{children:e(v,{padding:"size-200",children:e(b,{justifyContent:"center",alignItems:"center",children:e(F,{color:"text-300",children:"No response format specified for this prompt"})})})})]})}const Uc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptTools__main",selections:[{alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],storageKey:null}],type:"PromptVersion",abstractKey:null};Uc.hash="aa512d962d83a58b70ae0e17f01242b3";function t1({promptVersion:n}){const{tools:a}=P.useFragment(Uc,n),l=p.useMemo(()=>a.map((t,i)=>{const r=t.definition;return{name:Af(r)||`Tool ${i+1}`,description:_f(r)||void 0,definition:Yn(r,null,2).json||"{}"}}),[a]);return l.length===0?s(xe,{id:"tools",children:[e(Pe,{children:"Tools"}),e(Ie,{children:e(v,{padding:"size-200",children:e(b,{justifyContent:"center",alignItems:"center",children:e(F,{color:"text-300",children:"No tools specified for this prompt"})})})})]}):s(b,{direction:"column",children:[e(wf,{bordered:!1,children:"Tools"}),e(wn,{css:K`
1799
+ `}}}();Nc.hash="14c6b4bb4ca5f20cce70677746b16459";const iI=async({params:n})=>{const a=n.promptId;if(!a)throw new Error("Prompt ID is required");return await T.fetchQuery(ve,Nc,{id:a}).toPromise()},$c={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptIndexPage__aside",selections:[{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptLatestVersionsListFragment"},{args:null,kind:"FragmentSpread",name:"EditPromptButton_data"}],type:"Prompt",abstractKey:null};$c.hash="a77263d84d9add47173ed2e3d0243952";const jc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptIndexPage__main",selections:[{alias:null,args:null,concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"PromptInvocationParameters__main"},{args:null,kind:"FragmentSpread",name:"PromptChatMessagesCard__main"},{args:null,kind:"FragmentSpread",name:"PromptCodeExportCard__main"},{args:null,kind:"FragmentSpread",name:"PromptModelConfigurationCard__main"}],storageKey:null}],storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptIndexPage__aside"}],type:"Prompt",abstractKey:null};jc.hash="a883b83f574448623a2b02a60d899d41";const Oc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptModelConfigurationCard__main",selections:[{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptLLM__main"},{args:null,kind:"FragmentSpread",name:"PromptInvocationParameters__main"},{args:null,kind:"FragmentSpread",name:"PromptTools__main"},{args:null,kind:"FragmentSpread",name:"PromptResponseFormatFragment"}],type:"PromptVersion",abstractKey:null};Oc.hash="1c4202299f1f881250b17b75244fac54";const Qc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptInvocationParameters__main",selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null}],type:"PromptVersion",abstractKey:null};Qc.hash="4f00ab4f0396fffb81a1b068e544cfcf";function e1({keyName:n,value:a}){const{json:l,stringifyError:t}=Yn(a);return t?null:e(v,{paddingStart:"size-100",paddingEnd:"size-100",children:s(b,{direction:"row",justifyContent:"space-between",children:[e(F,{size:"XS",color:"text-700",children:n}),e(F,{size:"XS",children:l})]})})}function n1({promptVersion:n}){const{invocationParameters:a}=T.useFragment(Qc,n),l=p.useMemo(()=>Sy(a)?Object.entries(a).map(([t,i])=>({key:t,value:i})):[],[a]);return l.length===0?e(v,{padding:"size-200",children:e(b,{justifyContent:"center",alignItems:"center",children:e(F,{color:"text-300",children:"No parameters saved for this prompt"})})}):e(Ct,{listSize:"small",children:l.map(({key:t,value:i},r)=>e(Ft,{children:e(e1,{keyName:t,value:i})},`${t}-${r}`))})}const Bc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptLLM__main",selections:[{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null}],type:"PromptVersion",abstractKey:null};Bc.hash="acc90da43126218472d2fc19cd8d0512";const os=({keyName:n,children:a})=>e(Ft,{listSize:"small",children:e(v,{paddingStart:"size-100",paddingEnd:"size-100",children:s(b,{direction:"row",justifyContent:"space-between",children:[e(F,{size:"XS",color:"text-700",children:n}),e(F,{size:"XS",children:a})]})})});function a1({promptVersion:n}){const a=T.useFragment(Bc,n);return s(xe,{id:"llm",children:[e(Pe,{children:"LLM"}),e(Ie,{children:s(Ct,{listSize:"small",children:[e(os,{keyName:"Model",children:a.model}),e(os,{keyName:"Provider",children:bi[a.provider]??a.provider})]})})]})}const qc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptResponseFormatFragment",selections:[{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],storageKey:null}],type:"PromptVersion",abstractKey:null};qc.hash="154d745ec5e978e0dfc811ebfb9faa8c";function l1({promptVersion:n}){const{responseFormat:a}=T.useFragment(qc,n),l=p.useMemo(()=>typeof(a==null?void 0:a.definition)=="string"?Yn(en(a==null?void 0:a.definition).json||"",null,2).json||"":Yn(a==null?void 0:a.definition,null,2).json||"",[a==null?void 0:a.definition]);return l?s(xe,{id:"response-format",children:[e(Pe,{children:"Response Format"}),e(Ie,{children:e(Dn,{value:l})})]}):s(xe,{id:"response-format",children:[e(Pe,{children:"Response Format"}),e(Ie,{children:e(v,{padding:"size-200",children:e(b,{justifyContent:"center",alignItems:"center",children:e(F,{color:"text-300",children:"No response format specified for this prompt"})})})})]})}const Uc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptTools__main",selections:[{alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],storageKey:null}],type:"PromptVersion",abstractKey:null};Uc.hash="aa512d962d83a58b70ae0e17f01242b3";function t1({promptVersion:n}){const{tools:a}=T.useFragment(Uc,n),l=p.useMemo(()=>a.map((t,i)=>{const r=t.definition;return{name:Af(r)||`Tool ${i+1}`,description:_f(r)||void 0,definition:Yn(r,null,2).json||"{}"}}),[a]);return l.length===0?s(xe,{id:"tools",children:[e(Pe,{children:"Tools"}),e(Ie,{children:e(v,{padding:"size-200",children:e(b,{justifyContent:"center",alignItems:"center",children:e(F,{color:"text-300",children:"No tools specified for this prompt"})})})})]}):s(b,{direction:"column",children:[e(wf,{bordered:!1,children:"Tools"}),e(wn,{css:K`
1800
1800
  & {
1801
1801
  > .ac-disclosure:last-child {
1802
1802
  &[data-expanded="true"] {
@@ -1804,7 +1804,7 @@ fragment PromptVersionTagsConfigCard_data on Prompt {
1804
1804
  }
1805
1805
  }
1806
1806
  }
1807
- `,children:l.map((t,i)=>s(xe,{id:`tool-${i}`,children:[s(Pe,{arrowPosition:"start",justifyContent:"space-between",children:[e(F,{children:t.name}),e(F,{children:t.description})]}),e(Ie,{children:e(Dn,{value:t.definition})})]},`${t.name}-${i}`))})]})}function Hc({promptVersion:n}){const a=P.useFragment(Oc,n);return e(q,{title:"Model Configuration",variant:"compact",bodyStyle:{padding:0},collapsible:!0,children:s(wn,{defaultExpandedKeys:["llm","invocation-parameters","tools","response-format"],children:[e(a1,{promptVersion:a}),s(xe,{id:"invocation-parameters",children:[e(Pe,{children:"Invocation Parameters"}),e(Ie,{children:e(n1,{promptVersion:a})})]}),e(t1,{promptVersion:a}),e(l1,{promptVersion:a})]})})}const Gc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},o=[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],d={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"EditPromptButtonPatchPromptMutation",selections:[{alias:null,args:a,concreteType:"Prompt",kind:"LinkedField",name:"patchPrompt",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"PromptIndexPage__main"}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"EditPromptButtonPatchPromptMutation",selections:[{alias:null,args:a,concreteType:"Prompt",kind:"LinkedField",name:"patchPrompt",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[t,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null},i],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null},r,{alias:null,args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:o,storageKey:null},{alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:o,storageKey:null},{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},d,{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:5}],concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[r,d,{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[r,i],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:"promptVersions(first:5)"},r],storageKey:null}]},params:{cacheID:"4c43e7052f5f6b399aee596f0f14da1b",id:null,metadata:{},name:"EditPromptButtonPatchPromptMutation",operationKind:"mutation",text:`mutation EditPromptButtonPatchPromptMutation(
1807
+ `,children:l.map((t,i)=>s(xe,{id:`tool-${i}`,children:[s(Pe,{arrowPosition:"start",justifyContent:"space-between",children:[e(F,{children:t.name}),e(F,{children:t.description})]}),e(Ie,{children:e(Dn,{value:t.definition})})]},`${t.name}-${i}`))})]})}function Hc({promptVersion:n}){const a=T.useFragment(Oc,n);return e(q,{title:"Model Configuration",variant:"compact",bodyStyle:{padding:0},collapsible:!0,children:s(wn,{defaultExpandedKeys:["llm","invocation-parameters","tools","response-format"],children:[e(a1,{promptVersion:a}),s(xe,{id:"invocation-parameters",children:[e(Pe,{children:"Invocation Parameters"}),e(Ie,{children:e(n1,{promptVersion:a})})]}),e(t1,{promptVersion:a}),e(l1,{promptVersion:a})]})})}const Gc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},o=[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],d={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"EditPromptButtonPatchPromptMutation",selections:[{alias:null,args:a,concreteType:"Prompt",kind:"LinkedField",name:"patchPrompt",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"PromptIndexPage__main"}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"EditPromptButtonPatchPromptMutation",selections:[{alias:null,args:a,concreteType:"Prompt",kind:"LinkedField",name:"patchPrompt",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[t,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null},i],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null},r,{alias:null,args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:o,storageKey:null},{alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:o,storageKey:null},{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},d,{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:5}],concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[r,d,{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[r,i],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:"promptVersions(first:5)"},r],storageKey:null}]},params:{cacheID:"4c43e7052f5f6b399aee596f0f14da1b",id:null,metadata:{},name:"EditPromptButtonPatchPromptMutation",operationKind:"mutation",text:`mutation EditPromptButtonPatchPromptMutation(
1808
1808
  $input: PatchPromptInput!
1809
1809
  ) {
1810
1810
  patchPrompt(input: $input) {
@@ -1994,7 +1994,7 @@ fragment PromptVersionTagsList_data on PromptVersion {
1994
1994
  name
1995
1995
  }
1996
1996
  }
1997
- `}}}();Gc.hash="3ce25c8fbe5598ec1ee037a9778a6957";const Wc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EditPromptButton_data",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null}],type:"Prompt",abstractKey:null};Wc.hash="24788aacf7830c0e5037befe576f4968";function i1(n){const[a,l]=p.useState(!1),t=ke(),i=Fe(),r=P.useFragment(Wc,n.prompt),[o,d]=P.useMutation(Gc),{control:c,handleSubmit:u}=Qe({defaultValues:{description:r.description??""}}),y=p.useCallback(g=>{o({variables:{input:{promptId:r.id,description:g.description}},onCompleted:()=>{l(!1),t({title:"Prompt updated",message:"The prompt has been updated successfully"})},onError:m=>{var f;i({title:"Error updating prompt",message:(f=Re(m))==null?void 0:f[0]})}})},[r.id,o,i,t]);return s(J,{isOpen:a,onOpenChange:l,children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(oo,{})}),variant:"quiet","aria-label":"configure prompt",onPress:()=>l(!0)}),e(Z,{size:"S",isDismissable:!0,children:s(X,{children:[e(de,{slot:"title",children:"Edit Prompt Details"}),s(un,{children:[e(v,{padding:"size-200",children:e(G,{name:"description",control:c,render:({field:g})=>s(ie,{value:g.value,onChange:g.onChange,children:[e(W,{children:"Prompt Description"}),e(Ra,{placeholder:"Enter a description for the prompt"}),e(F,{slot:"description",children:"A description of the prompt"})]})})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",gap:"size-100",justifyContent:"end",children:[e(E,{slot:"close",size:"S",children:"Cancel"}),e(E,{variant:"primary",size:"S",isDisabled:d,onPress:()=>u(y)(),children:d?"Saving...":"Save"})]})})]})]})})]})}const Jc=function(){var n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptChatMessagesCard__main",selections:[{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[a,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null}],type:"PromptVersion",abstractKey:null}}();Jc.hash="e0d9c12926330e5e774cbc64de158a82";const cr=R.object({text:R.object({text:R.string()})}),ur=R.object({toolCall:R.object({toolCallId:R.string(),toolCall:R.object({name:R.string(),arguments:R.string()})})}),mr=R.object({toolResult:R.object({toolCallId:R.string(),result:Ei})}),Gt=n=>{const a=cr.safeParse(n);return a.success?a.data:null},Zc=n=>{const a={text:{text:n}},l=cr.safeParse(a);return l.success?l.data:null},gr=n=>{const a=ur.safeParse(n);return a.success?a.data:null},Xc=n=>{const a=Rf(n),l=Ef(n),t=Mf(n);if(!a)return null;const i=Yn(t).json||"",r={toolCall:{toolCallId:a,toolCall:{name:l||a,arguments:i}}},o=ur.safeParse(r);return o.success?o.data:null},pr=n=>{const a=mr.safeParse(n);return a.success?a.data:null},Yc=(n,a)=>{const l={toolResult:{toolCallId:n,result:a}},t=mr.safeParse(l);return t.success?t.data:null};function at(n){return p.useMemo(()=>{const a=n.toLowerCase();return pt.user.includes(a)?{backgroundColor:"grey-200",borderColor:"grey-500"}:pt.ai.includes(a)?{backgroundColor:"blue-100",borderColor:"blue-700"}:pt.system.includes(a)?{backgroundColor:"indigo-100",borderColor:"indigo-700"}:["function","tool"].includes(a)?{backgroundColor:"yellow-100",borderColor:"yellow-700"}:{backgroundColor:"grey-100",borderColor:"grey-700"}},[n])}const Wt={text:"Text",toolCall:"Tool Call",toolResult:"Tool Result"},r1=Object.values(Wt);function s1({toolResult:n,isOnlyChild:a}){const l=p.useMemo(()=>{const t=n.toolResult.result;return rr(t)},[n]);return e(yr,{title:Wt.toolResult,isOnlyChild:a,children:s(b,{direction:"column",children:[e(v,{paddingX:"size-200",paddingTop:"size-100",children:s(b,{direction:"column",justifyContent:"start",gap:"size-100",children:[e(F,{weight:"heavy",size:"XS",children:"Tool ID"}),e(v,{paddingX:"size-300",children:e(F,{size:"XS",children:n.toolResult.toolCallId})})]})}),s(b,{direction:"column",children:[e(v,{paddingX:"size-200",paddingTop:"size-100",children:e(F,{weight:"heavy",size:"XS",children:"Tool Result"})}),e(Dt,{readOnly:!0,children:e(Lt,{readOnly:!0,height:"100%",defaultValue:l,templateFormat:xn.NONE})})]})]})})}function o1({provider:n,toolCall:a,isOnlyChild:l}){const t=p.useMemo(()=>{const i=co(a,n);return Yn(i,null,2).json||""},[n,a]);return e(yr,{title:Wt.toolCall,isOnlyChild:l,children:e(Dt,{readOnly:!0,children:e(Lt,{readOnly:!0,height:"100%",defaultValue:t,templateFormat:xn.NONE})})})}function d1(n){const{text:a,templateFormat:l,isOnlyChild:t}=n;return e(yr,{title:Wt.text,isOnlyChild:t,children:e(Dt,{readOnly:!0,children:e(Lt,{readOnly:!0,height:"100%",defaultValue:a,templateFormat:l})})})}function yr({title:n,children:a,isOnlyChild:l}){return l?e(Y,{children:a}):s(xe,{id:n,children:[e(Pe,{children:e(F,{weight:"heavy",size:"S",children:n})}),e(Ie,{children:a})]})}function c1(n){const{role:a,children:l}=n,t=at(a);return e(q,{title:a,variant:"compact",...t,bodyStyle:{padding:0},collapsible:!0,children:e(wn,{defaultExpandedKeys:r1,children:l})})}function u1({promptVersion:n}){const{template:a,templateFormat:l,provider:t}=P.useFragment(Jc,n);if(a.__typename==="PromptStringTemplate")return e(F,{children:a.template});if(a.__typename==="PromptChatTemplate")return e(g1,{template:a,templateFormat:l,provider:od(t)||Gs});if(a.__typename==="%other")throw new Error("Unknown template type"+a.__typename)}function m1({part:n,templateFormat:a,provider:l,isOnlyChild:t}){let i=Gt(n);return i?e(d1,{text:i.text.text,templateFormat:a,isOnlyChild:t}):(i=gr(n),i?e(o1,{toolCall:i,provider:l,isOnlyChild:t}):(i=pr(n),i?e(s1,{toolResult:i,isOnlyChild:t}):null))}function g1({template:n,templateFormat:a,provider:l}){const{messages:t}=n;return e(b,{direction:"column",gap:"size-100","data-testid":"chat-messages",children:t.map((i,r)=>{const o=i.content.length===1&&i.content.find(Gt)!=null;return e(c1,{role:i.role,children:i.content.map((d,c)=>e(m1,{part:d,templateFormat:a,provider:l,isOnlyChild:o},`${c}-${d.__typename}`))},r)})})}function eu({title:n="Prompt",promptVersion:a}){return e(q,{title:n,variant:"compact",collapsible:!0,"data-testid":"prompt-chat-messages-card",children:e(u1,{promptVersion:a})})}const nu=function(){var n=[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],a={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptCodeExportCard__main",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:n,storageKey:null},{alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:n,storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[a,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[l,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null}],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null}],type:"PromptVersion",abstractKey:null}}();nu.hash="3fa95713c234bb0cfa4c36e8e4f9cea0";const p1=R.enum(["system","user","assistant","developer","tool","function"]),lt=R.object({role:p1,content:R.string().nullable(),name:R.string().optional(),tool_call_id:R.string().optional(),tool_calls:R.array(Vf).optional()}).passthrough(),y1=R.array(lt);Ul(y1,{removeAdditionalStrategy:"passthrough"});const f1=R.object({role:R.enum(["user","assistant","tool"]),content:R.array(R.unknown()),tool_call_id:R.string().optional(),tool_calls:R.array(zf).optional()}).passthrough(),h1=R.array(f1);Ul(h1,{removeAdditionalStrategy:"passthrough"});const k1=R.enum(["user","assistant","tool"]),b1=Nf.extend({type:R.string(),text:R.string().optional(),id:R.string().optional(),tool_use_id:R.string().optional(),name:R.string().optional(),input:R.record(R.unknown()).optional(),source:R.object({type:R.string(),media_type:R.string().optional(),data:R.string().optional()}).optional()}),au=R.object({role:k1,content:R.union([R.string(),R.array(b1)])}),S1=R.array(au);Ul(S1,{removeAdditionalStrategy:"passthrough"});const v1=R.enum(["SYSTEM","USER","AI","TOOL"]),F1=R.object({image:R.object({url:R.string()})}),C1=R.discriminatedUnion("__typename",[cr.extend({__typename:R.literal("TextContentPart")}),F1.extend({__typename:R.literal("ImageContentPart")}),ur.extend({__typename:R.literal("ToolCallContentPart")}),mr.extend({__typename:R.literal("ToolResultContentPart")})]),Jt=R.object({role:v1,content:R.array(C1)}).passthrough(),K1=R.array(Jt);Ul(K1,{removeAdditionalStrategy:"passthrough"});const T1=lt.transform(n=>{const a={role:n.role==="assistant"?"assistant":"user",content:n.content?[{type:"text",text:n.content}]:[]};return n.tool_calls?{role:n.role==="assistant"?"assistant":"user",content:n.content?[{type:"text",text:n.content}]:[],tool_calls:n.tool_calls.map(l=>$f.parse(l))}:a}),lu=lt.transform(n=>{const a={role:n.role==="assistant"?"assistant":"user",content:n.content?[{type:"text",text:n.content}]:[]};return n.tool_calls?{...a,content:[...a.content,...n.tool_calls.map(l=>jf.parse(l))]}:n.tool_call_id?{...a,content:[{type:"tool_result",tool_use_id:n.tool_call_id,content:n.content}]}:a}),tu=Jt.transform(n=>{if(n.role==="TOOL"){const t=n.content.map(i=>pr(i)).find(i=>!!i);if(!t)throw new Error("TOOL role message must have a ToolResultContentPart");return{role:"tool",content:rr(t.toolResult.result),tool_call_id:t.toolResult.toolCallId}}const a={role:{SYSTEM:"system",USER:"user",AI:"assistant",TOOL:"tool"}[n.role],content:n.content.map(t=>Gt(t)).filter(t=>!!t).map(t=>t.text.text).join(`
1997
+ `}}}();Gc.hash="3ce25c8fbe5598ec1ee037a9778a6957";const Wc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EditPromptButton_data",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null}],type:"Prompt",abstractKey:null};Wc.hash="24788aacf7830c0e5037befe576f4968";function i1(n){const[a,l]=p.useState(!1),t=ke(),i=Fe(),r=T.useFragment(Wc,n.prompt),[o,d]=T.useMutation(Gc),{control:c,handleSubmit:u}=Qe({defaultValues:{description:r.description??""}}),y=p.useCallback(g=>{o({variables:{input:{promptId:r.id,description:g.description}},onCompleted:()=>{l(!1),t({title:"Prompt updated",message:"The prompt has been updated successfully"})},onError:m=>{var f;i({title:"Error updating prompt",message:(f=Re(m))==null?void 0:f[0]})}})},[r.id,o,i,t]);return s(J,{isOpen:a,onOpenChange:l,children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(oo,{})}),variant:"quiet","aria-label":"configure prompt",onPress:()=>l(!0)}),e(Z,{size:"S",isDismissable:!0,children:s(X,{children:[e(de,{slot:"title",children:"Edit Prompt Details"}),s(un,{children:[e(v,{padding:"size-200",children:e(G,{name:"description",control:c,render:({field:g})=>s(ie,{value:g.value,onChange:g.onChange,children:[e(W,{children:"Prompt Description"}),e(Ra,{placeholder:"Enter a description for the prompt"}),e(F,{slot:"description",children:"A description of the prompt"})]})})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",gap:"size-100",justifyContent:"end",children:[e(E,{slot:"close",size:"S",children:"Cancel"}),e(E,{variant:"primary",size:"S",isDisabled:d,onPress:()=>u(y)(),children:d?"Saving...":"Save"})]})})]})]})})]})}const Jc=function(){var n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptChatMessagesCard__main",selections:[{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[a,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null}],type:"PromptVersion",abstractKey:null}}();Jc.hash="e0d9c12926330e5e774cbc64de158a82";const cr=R.object({text:R.object({text:R.string()})}),ur=R.object({toolCall:R.object({toolCallId:R.string(),toolCall:R.object({name:R.string(),arguments:R.string()})})}),mr=R.object({toolResult:R.object({toolCallId:R.string(),result:Ei})}),Gt=n=>{const a=cr.safeParse(n);return a.success?a.data:null},Zc=n=>{const a={text:{text:n}},l=cr.safeParse(a);return l.success?l.data:null},gr=n=>{const a=ur.safeParse(n);return a.success?a.data:null},Xc=n=>{const a=Rf(n),l=Ef(n),t=Mf(n);if(!a)return null;const i=Yn(t).json||"",r={toolCall:{toolCallId:a,toolCall:{name:l||a,arguments:i}}},o=ur.safeParse(r);return o.success?o.data:null},pr=n=>{const a=mr.safeParse(n);return a.success?a.data:null},Yc=(n,a)=>{const l={toolResult:{toolCallId:n,result:a}},t=mr.safeParse(l);return t.success?t.data:null};function at(n){return p.useMemo(()=>{const a=n.toLowerCase();return pt.user.includes(a)?{backgroundColor:"grey-200",borderColor:"grey-500"}:pt.ai.includes(a)?{backgroundColor:"blue-100",borderColor:"blue-700"}:pt.system.includes(a)?{backgroundColor:"indigo-100",borderColor:"indigo-700"}:["function","tool"].includes(a)?{backgroundColor:"yellow-100",borderColor:"yellow-700"}:{backgroundColor:"grey-100",borderColor:"grey-700"}},[n])}const Wt={text:"Text",toolCall:"Tool Call",toolResult:"Tool Result"},r1=Object.values(Wt);function s1({toolResult:n,isOnlyChild:a}){const l=p.useMemo(()=>{const t=n.toolResult.result;return rr(t)},[n]);return e(yr,{title:Wt.toolResult,isOnlyChild:a,children:s(b,{direction:"column",children:[e(v,{paddingX:"size-200",paddingTop:"size-100",children:s(b,{direction:"column",justifyContent:"start",gap:"size-100",children:[e(F,{weight:"heavy",size:"XS",children:"Tool ID"}),e(v,{paddingX:"size-300",children:e(F,{size:"XS",children:n.toolResult.toolCallId})})]})}),s(b,{direction:"column",children:[e(v,{paddingX:"size-200",paddingTop:"size-100",children:e(F,{weight:"heavy",size:"XS",children:"Tool Result"})}),e(Dt,{readOnly:!0,children:e(Lt,{readOnly:!0,height:"100%",defaultValue:l,templateFormat:xn.NONE})})]})]})})}function o1({provider:n,toolCall:a,isOnlyChild:l}){const t=p.useMemo(()=>{const i=co(a,n);return Yn(i,null,2).json||""},[n,a]);return e(yr,{title:Wt.toolCall,isOnlyChild:l,children:e(Dt,{readOnly:!0,children:e(Lt,{readOnly:!0,height:"100%",defaultValue:t,templateFormat:xn.NONE})})})}function d1(n){const{text:a,templateFormat:l,isOnlyChild:t}=n;return e(yr,{title:Wt.text,isOnlyChild:t,children:e(Dt,{readOnly:!0,children:e(Lt,{readOnly:!0,height:"100%",defaultValue:a,templateFormat:l})})})}function yr({title:n,children:a,isOnlyChild:l}){return l?e(Y,{children:a}):s(xe,{id:n,children:[e(Pe,{children:e(F,{weight:"heavy",size:"S",children:n})}),e(Ie,{children:a})]})}function c1(n){const{role:a,children:l}=n,t=at(a);return e(q,{title:a,variant:"compact",...t,bodyStyle:{padding:0},collapsible:!0,children:e(wn,{defaultExpandedKeys:r1,children:l})})}function u1({promptVersion:n}){const{template:a,templateFormat:l,provider:t}=T.useFragment(Jc,n);if(a.__typename==="PromptStringTemplate")return e(F,{children:a.template});if(a.__typename==="PromptChatTemplate")return e(g1,{template:a,templateFormat:l,provider:od(t)||Gs});if(a.__typename==="%other")throw new Error("Unknown template type"+a.__typename)}function m1({part:n,templateFormat:a,provider:l,isOnlyChild:t}){let i=Gt(n);return i?e(d1,{text:i.text.text,templateFormat:a,isOnlyChild:t}):(i=gr(n),i?e(o1,{toolCall:i,provider:l,isOnlyChild:t}):(i=pr(n),i?e(s1,{toolResult:i,isOnlyChild:t}):null))}function g1({template:n,templateFormat:a,provider:l}){const{messages:t}=n;return e(b,{direction:"column",gap:"size-100","data-testid":"chat-messages",children:t.map((i,r)=>{const o=i.content.length===1&&i.content.find(Gt)!=null;return e(c1,{role:i.role,children:i.content.map((d,c)=>e(m1,{part:d,templateFormat:a,provider:l,isOnlyChild:o},`${c}-${d.__typename}`))},r)})})}function eu({title:n="Prompt",promptVersion:a}){return e(q,{title:n,variant:"compact",collapsible:!0,"data-testid":"prompt-chat-messages-card",children:e(u1,{promptVersion:a})})}const nu=function(){var n=[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],a={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptCodeExportCard__main",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:n,storageKey:null},{alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:n,storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[a,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[l,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null}],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null}],type:"PromptVersion",abstractKey:null}}();nu.hash="3fa95713c234bb0cfa4c36e8e4f9cea0";const p1=R.enum(["system","user","assistant","developer","tool","function"]),lt=R.object({role:p1,content:R.string().nullable(),name:R.string().optional(),tool_call_id:R.string().optional(),tool_calls:R.array(Vf).optional()}).passthrough(),y1=R.array(lt);Ul(y1,{removeAdditionalStrategy:"passthrough"});const f1=R.object({role:R.enum(["user","assistant","tool"]),content:R.array(R.unknown()),tool_call_id:R.string().optional(),tool_calls:R.array(zf).optional()}).passthrough(),h1=R.array(f1);Ul(h1,{removeAdditionalStrategy:"passthrough"});const k1=R.enum(["user","assistant","tool"]),b1=Nf.extend({type:R.string(),text:R.string().optional(),id:R.string().optional(),tool_use_id:R.string().optional(),name:R.string().optional(),input:R.record(R.unknown()).optional(),source:R.object({type:R.string(),media_type:R.string().optional(),data:R.string().optional()}).optional()}),au=R.object({role:k1,content:R.union([R.string(),R.array(b1)])}),S1=R.array(au);Ul(S1,{removeAdditionalStrategy:"passthrough"});const v1=R.enum(["SYSTEM","USER","AI","TOOL"]),F1=R.object({image:R.object({url:R.string()})}),C1=R.discriminatedUnion("__typename",[cr.extend({__typename:R.literal("TextContentPart")}),F1.extend({__typename:R.literal("ImageContentPart")}),ur.extend({__typename:R.literal("ToolCallContentPart")}),mr.extend({__typename:R.literal("ToolResultContentPart")})]),Jt=R.object({role:v1,content:R.array(C1)}).passthrough(),K1=R.array(Jt);Ul(K1,{removeAdditionalStrategy:"passthrough"});const T1=lt.transform(n=>{const a={role:n.role==="assistant"?"assistant":"user",content:n.content?[{type:"text",text:n.content}]:[]};return n.tool_calls?{role:n.role==="assistant"?"assistant":"user",content:n.content?[{type:"text",text:n.content}]:[],tool_calls:n.tool_calls.map(l=>$f.parse(l))}:a}),lu=lt.transform(n=>{const a={role:n.role==="assistant"?"assistant":"user",content:n.content?[{type:"text",text:n.content}]:[]};return n.tool_calls?{...a,content:[...a.content,...n.tool_calls.map(l=>jf.parse(l))]}:n.tool_call_id?{...a,content:[{type:"tool_result",tool_use_id:n.tool_call_id,content:n.content}]}:a}),tu=Jt.transform(n=>{if(n.role==="TOOL"){const t=n.content.map(i=>pr(i)).find(i=>!!i);if(!t)throw new Error("TOOL role message must have a ToolResultContentPart");return{role:"tool",content:rr(t.toolResult.result),tool_call_id:t.toolResult.toolCallId}}const a={role:{SYSTEM:"system",USER:"user",AI:"assistant",TOOL:"tool"}[n.role],content:n.content.map(t=>Gt(t)).filter(t=>!!t).map(t=>t.text.text).join(`
1998
1998
  `)},l=n.content.map(t=>gr(t)).filter(t=>!!t).map(t=>({id:t.toolCall.toolCallId,type:"function",function:{name:t.toolCall.toolCall.name,arguments:typeof t.toolCall.toolCall.arguments=="string"?JSON.parse(t.toolCall.toolCall.arguments):t.toolCall.toolCall.arguments}}));return l.length>0?{...a,tool_calls:l}:a});lt.transform(n=>{const a=[];if(n.role==="tool"&&n.tool_call_id){const t=Yc(n.tool_call_id,n.content);return t&&a.push({__typename:"ToolResultContentPart",...t}),{role:"TOOL",content:a}}if(n.content){const t=Zc(n.content);t&&a.push({__typename:"TextContentPart",...t})}return n.tool_calls&&n.tool_calls.forEach(t=>{const i=Xc({id:t.id,name:t.function.name,arguments:t.function.arguments});i&&a.push({__typename:"ToolCallContentPart",...i})}),{role:{system:"SYSTEM",user:"USER",assistant:"AI",tool:"TOOL",developer:"SYSTEM",function:"TOOL"}[n.role],content:a}});const P1=({message:n,targetProvider:a})=>{switch(a){case"AZURE_OPENAI":case"OPENAI":case"DEEPSEEK":case"XAI":case"OLLAMA":return n;case"ANTHROPIC":return lu.parse(n);case"AWS":return T1.parse(n);case"GOOGLE":return n;default:return Ee()}};R.union([lt,au,Jt,Ei]);Jt.transform(n=>lu.parse(tu.parse(n)));const Wn=" ",dt=({json:n,level:a,removeKeyQuotes:l=!1})=>{const t=Wn.repeat(a);let i=JSON.stringify(n,null,Wn);return i=i.split(`
1999
1999
  `).map((r,o)=>o>0?t+r:r).join(`
2000
2000
  `),l&&(i=i.replace(/"([a-zA-Z_$][a-zA-Z0-9_$]*)"\s*:/g,"$1:")),i},I1=_n.template(`
@@ -2123,10 +2123,10 @@ const response = await anthropic.messages.create({
2123
2123
  });
2124
2124
 
2125
2125
  console.log(response.content);
2126
- `.trim()),va={python:{openai:{assignmentOperator:"=",removeKeyQuotes:!1,stringQuote:'"',sdkTemplate:I1,clientTemplate:D1},anthropic:{assignmentOperator:"=",removeKeyQuotes:!1,stringQuote:'"',sdkTemplate:_1,clientTemplate:w1}},typescript:{openai:{assignmentOperator:": ",removeKeyQuotes:!0,stringQuote:'"',sdkTemplate:x1,clientTemplate:L1},anthropic:{assignmentOperator:": ",removeKeyQuotes:!0,stringQuote:'"',sdkTemplate:A1,clientTemplate:R1}}},ct=(n,a)=>{if(!("messages"in n.template))throw new Error("Prompt template does not contain messages");const l=[],{assignmentOperator:t,removeKeyQuotes:i,stringQuote:r}=a;if(n.modelName&&l.push(`model${t}${r}${n.modelName}${r}`),n.invocationParameters){const d=Object.entries(n.invocationParameters).map(([c,u])=>typeof u=="string"?`${c}${t}${r}${u}${r}`:Mi(u)?`${c}${t}${dt({json:u,level:1,removeKeyQuotes:i})}`:`${c}${t}${u}`);l.push(...d)}let o="";if(n.template.messages.length>0&&(o=dt({json:n.template.messages,level:0,removeKeyQuotes:i}),l.push(t==="="?"messages=messages":"messages")),n.tools&&n.tools.length>0){const d=dt({json:n.tools.map(c=>c.definition),level:1,removeKeyQuotes:i});l.push(`tools${t}${d}`)}if(n.responseFormat&&"definition"in n.responseFormat){const d=dt({json:n.responseFormat.definition,level:1,removeKeyQuotes:i});l.push(`response_format${t}${d}`)}return{args:l,messages:o}},ds=n=>"tool_calls"in n&&n.tool_calls?{...n,tool_calls:n.tool_calls.map(a=>({...a,function:{...a.function,arguments:JSON.stringify(a.function.arguments)}}))}:n,E1={python:{openai:n=>{const a=va.python.openai,l={...n,template:{...n.template,messages:n.template.messages.map(r=>ds(r))}},{args:t,messages:i}=ct(l,a);return a.sdkTemplate({tab:Wn,args:t,messages:i})},anthropic:n=>{const a=va.python.anthropic,{args:l,messages:t}=ct(n,a);return a.sdkTemplate({tab:Wn,args:l,messages:t})}},typescript:{openai:n=>{const a=va.typescript.openai,l={...n,template:{...n.template,messages:n.template.messages.map(r=>ds(r))}},{args:t,messages:i}=ct(l,a);return a.sdkTemplate({tab:Wn,args:t,messages:i})},anthropic:n=>{const a=va.typescript.anthropic,{args:l,messages:t}=ct(n,a);return a.sdkTemplate({tab:Wn,args:l,messages:t})}}},M1={python:{openai:n=>va.python.openai.clientTemplate({tab:Wn,versionId:n.versionId}),anthropic:n=>va.python.openai.clientTemplate({tab:Wn,versionId:n.versionId})},typescript:{openai:n=>va.typescript.openai.clientTemplate({tab:Wn,versionId:n.versionId}),anthropic:n=>va.typescript.anthropic.clientTemplate({tab:Wn,versionId:n.versionId})}},V1=({promptVersion:n,language:a})=>{var i;const l=E1[a.toLocaleLowerCase()][(i=n.modelProvider)==null?void 0:i.toLocaleLowerCase()];if(!l||!("messages"in n.template))return null;const t={...n,template:{...n.template,messages:n.template.messages.map(r=>{try{return P1({message:tu.parse(r),targetProvider:n.modelProvider})}catch(o){return console.warn("Cannot convert message"),console.error(o),null}}).filter(Boolean)}};return l(t)};function z1({promptVersion:n,language:a}){var i;const l=M1[a.toLocaleLowerCase()][(i=n.modelProvider)==null?void 0:i.toLocaleLowerCase()];if(!l)return null;const t={versionId:n.id};return l(t)}function iu({promptVersion:n}){const[a,l]=p.useState("Python"),t=P.useFragment(nu,n),i=p.useMemo(()=>V1({promptVersion:t,language:a}),[t,a]),r=p.useMemo(()=>z1({promptVersion:t,language:a}),[t,a]);return e(q,{title:"Code",variant:"compact",bodyStyle:{padding:0},extra:e(b,{gap:"size-100",alignItems:"center",children:e(hl,{language:a,onChange:l,size:"S"})}),children:s(wn,{defaultExpandedKeys:["sdk-inline","client"],children:[s(xe,{id:"sdk-inline",children:[e(Pe,{arrowPosition:"start",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:"size-100",width:"100%",children:[e(F,{children:"SDK Inline"}),i?e(Se,{text:i}):null]})}),e(Ie,{children:i==null?e(v,{width:"100%",padding:"size-200",children:e(F,{color:"text-300",children:"No code snippet available for this prompt"})}):e(cs,{language:a,value:i})})]}),s(xe,{id:"client",children:[e(Pe,{arrowPosition:"start",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:"size-100",children:[e(F,{children:"Using the Client"}),r?e(Se,{text:r}):null]})}),e(Ie,{children:r==null?e(v,{width:"100%",padding:"size-200",children:e(F,{color:"text-300",children:"No client code snippet available for this prompt"})}):e(cs,{language:a,value:r})})]})]})})}function cs({language:n,value:a}){switch(n){case"Python":return e(uo,{value:a,basicSetup:{lineNumbers:!0}});case"TypeScript":return e(Of,{value:a,basicSetup:{lineNumbers:!0}});default:Ee()}}const ru={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptLatestVersionsListFragment",selections:[{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:5}],concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptVersionSummaryFragment"}],storageKey:null}],storageKey:null}],storageKey:"promptVersions(first:5)"}],type:"Prompt",abstractKey:null};ru.hash="a473a6f0d927379542694312449a4c63";const su=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptVersionSummaryFragment",selections:[n,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptVersionTagsList_data"}],type:"PromptVersion",abstractKey:null}}();su.hash="80901eff49852a413f643ee876638174";const ou={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptVersionTagsList_data",selections:[{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],type:"PromptVersion",abstractKey:null};ou.hash="25265fbc7ea915534615a56b4331236e";function du({promptVersion:n}){const a=P.useFragment(ou,n);return e(b,{direction:"row",gap:"size-50",alignItems:"center",wrap:"wrap",children:a.tags.map(l=>e(N1,{children:l.name},l.id))})}function N1({children:n}){const a=p.useMemo(()=>{switch(n){case"production":return"var(--ac-global-color-green-1000)";case"staging":return"var(--ac-global-color-yellow-1000)";case"development":return"var(--ac-global-color-blue-1000)";default:return"var(--ac-global-color-grey-900)"}},[n]);return e(gn,{color:a,children:n})}function cu(n){const a=P.useFragment(su,n.promptVersion);return s(b,{direction:"column",gap:"size-50",children:[e(v,{width:"100%",children:e(b,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(gn,{color:"var(--ac-global-color-blue-900)",children:a.sequenceNumber}),e("span",{children:`${a.id}`})]})})}),e(v,{"data-testid":"prompt-version-item-description",paddingStart:"size-400",children:s(b,{direction:"column",gap:"size-100",children:[e(Xe,{maxWidth:"100%",children:e(F,{color:"text-700",size:"XS",children:a.description||"No Description"})}),s(b,{justifyContent:"space-between",alignItems:"center",gap:"size-100",children:[e(du,{promptVersion:a}),s(b,{direction:"row",gap:"size-100",alignItems:"center",flex:"none",children:[a.user&&s(b,{direction:"row",gap:"size-50",alignItems:"center",children:[e(Pt,{size:14,name:a.user.username,profilePictureUrl:a.user.profilePictureUrl}),e(F,{size:"XS",children:a.user.username})]}),e(F,{color:"text-300",size:"XS",children:vy(a.createdAt,Date.now())})]})]})]})})]})}const $1=5,j1=K`
2126
+ `.trim()),va={python:{openai:{assignmentOperator:"=",removeKeyQuotes:!1,stringQuote:'"',sdkTemplate:I1,clientTemplate:D1},anthropic:{assignmentOperator:"=",removeKeyQuotes:!1,stringQuote:'"',sdkTemplate:_1,clientTemplate:w1}},typescript:{openai:{assignmentOperator:": ",removeKeyQuotes:!0,stringQuote:'"',sdkTemplate:x1,clientTemplate:L1},anthropic:{assignmentOperator:": ",removeKeyQuotes:!0,stringQuote:'"',sdkTemplate:A1,clientTemplate:R1}}},ct=(n,a)=>{if(!("messages"in n.template))throw new Error("Prompt template does not contain messages");const l=[],{assignmentOperator:t,removeKeyQuotes:i,stringQuote:r}=a;if(n.modelName&&l.push(`model${t}${r}${n.modelName}${r}`),n.invocationParameters){const d=Object.entries(n.invocationParameters).map(([c,u])=>typeof u=="string"?`${c}${t}${r}${u}${r}`:Mi(u)?`${c}${t}${dt({json:u,level:1,removeKeyQuotes:i})}`:`${c}${t}${u}`);l.push(...d)}let o="";if(n.template.messages.length>0&&(o=dt({json:n.template.messages,level:0,removeKeyQuotes:i}),l.push(t==="="?"messages=messages":"messages")),n.tools&&n.tools.length>0){const d=dt({json:n.tools.map(c=>c.definition),level:1,removeKeyQuotes:i});l.push(`tools${t}${d}`)}if(n.responseFormat&&"definition"in n.responseFormat){const d=dt({json:n.responseFormat.definition,level:1,removeKeyQuotes:i});l.push(`response_format${t}${d}`)}return{args:l,messages:o}},ds=n=>"tool_calls"in n&&n.tool_calls?{...n,tool_calls:n.tool_calls.map(a=>({...a,function:{...a.function,arguments:JSON.stringify(a.function.arguments)}}))}:n,E1={python:{openai:n=>{const a=va.python.openai,l={...n,template:{...n.template,messages:n.template.messages.map(r=>ds(r))}},{args:t,messages:i}=ct(l,a);return a.sdkTemplate({tab:Wn,args:t,messages:i})},anthropic:n=>{const a=va.python.anthropic,{args:l,messages:t}=ct(n,a);return a.sdkTemplate({tab:Wn,args:l,messages:t})}},typescript:{openai:n=>{const a=va.typescript.openai,l={...n,template:{...n.template,messages:n.template.messages.map(r=>ds(r))}},{args:t,messages:i}=ct(l,a);return a.sdkTemplate({tab:Wn,args:t,messages:i})},anthropic:n=>{const a=va.typescript.anthropic,{args:l,messages:t}=ct(n,a);return a.sdkTemplate({tab:Wn,args:l,messages:t})}}},M1={python:{openai:n=>va.python.openai.clientTemplate({tab:Wn,versionId:n.versionId}),anthropic:n=>va.python.openai.clientTemplate({tab:Wn,versionId:n.versionId})},typescript:{openai:n=>va.typescript.openai.clientTemplate({tab:Wn,versionId:n.versionId}),anthropic:n=>va.typescript.anthropic.clientTemplate({tab:Wn,versionId:n.versionId})}},V1=({promptVersion:n,language:a})=>{var i;const l=E1[a.toLocaleLowerCase()][(i=n.modelProvider)==null?void 0:i.toLocaleLowerCase()];if(!l||!("messages"in n.template))return null;const t={...n,template:{...n.template,messages:n.template.messages.map(r=>{try{return P1({message:tu.parse(r),targetProvider:n.modelProvider})}catch(o){return console.warn("Cannot convert message"),console.error(o),null}}).filter(Boolean)}};return l(t)};function z1({promptVersion:n,language:a}){var i;const l=M1[a.toLocaleLowerCase()][(i=n.modelProvider)==null?void 0:i.toLocaleLowerCase()];if(!l)return null;const t={versionId:n.id};return l(t)}function iu({promptVersion:n}){const[a,l]=p.useState("Python"),t=T.useFragment(nu,n),i=p.useMemo(()=>V1({promptVersion:t,language:a}),[t,a]),r=p.useMemo(()=>z1({promptVersion:t,language:a}),[t,a]);return e(q,{title:"Code",variant:"compact",bodyStyle:{padding:0},extra:e(b,{gap:"size-100",alignItems:"center",children:e(hl,{language:a,onChange:l,size:"S"})}),children:s(wn,{defaultExpandedKeys:["sdk-inline","client"],children:[s(xe,{id:"sdk-inline",children:[e(Pe,{arrowPosition:"start",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:"size-100",width:"100%",children:[e(F,{children:"SDK Inline"}),i?e(Se,{text:i}):null]})}),e(Ie,{children:i==null?e(v,{width:"100%",padding:"size-200",children:e(F,{color:"text-300",children:"No code snippet available for this prompt"})}):e(cs,{language:a,value:i})})]}),s(xe,{id:"client",children:[e(Pe,{arrowPosition:"start",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:"size-100",children:[e(F,{children:"Using the Client"}),r?e(Se,{text:r}):null]})}),e(Ie,{children:r==null?e(v,{width:"100%",padding:"size-200",children:e(F,{color:"text-300",children:"No client code snippet available for this prompt"})}):e(cs,{language:a,value:r})})]})]})})}function cs({language:n,value:a}){switch(n){case"Python":return e(uo,{value:a,basicSetup:{lineNumbers:!0}});case"TypeScript":return e(Of,{value:a,basicSetup:{lineNumbers:!0}});default:Ee()}}const ru={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptLatestVersionsListFragment",selections:[{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:5}],concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptVersionSummaryFragment"}],storageKey:null}],storageKey:null}],storageKey:"promptVersions(first:5)"}],type:"Prompt",abstractKey:null};ru.hash="a473a6f0d927379542694312449a4c63";const su=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptVersionSummaryFragment",selections:[n,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptVersionTagsList_data"}],type:"PromptVersion",abstractKey:null}}();su.hash="80901eff49852a413f643ee876638174";const ou={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptVersionTagsList_data",selections:[{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],type:"PromptVersion",abstractKey:null};ou.hash="25265fbc7ea915534615a56b4331236e";function du({promptVersion:n}){const a=T.useFragment(ou,n);return e(b,{direction:"row",gap:"size-50",alignItems:"center",wrap:"wrap",children:a.tags.map(l=>e(N1,{children:l.name},l.id))})}function N1({children:n}){const a=p.useMemo(()=>{switch(n){case"production":return"var(--ac-global-color-green-1000)";case"staging":return"var(--ac-global-color-yellow-1000)";case"development":return"var(--ac-global-color-blue-1000)";default:return"var(--ac-global-color-grey-900)"}},[n]);return e(gn,{color:a,children:n})}function cu(n){const a=T.useFragment(su,n.promptVersion);return s(b,{direction:"column",gap:"size-50",children:[e(v,{width:"100%",children:e(b,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(gn,{color:"var(--ac-global-color-blue-900)",children:a.sequenceNumber}),e("span",{children:`${a.id}`})]})})}),e(v,{"data-testid":"prompt-version-item-description",paddingStart:"size-400",children:s(b,{direction:"column",gap:"size-100",children:[e(Xe,{maxWidth:"100%",children:e(F,{color:"text-700",size:"XS",children:a.description||"No Description"})}),s(b,{justifyContent:"space-between",alignItems:"center",gap:"size-100",children:[e(du,{promptVersion:a}),s(b,{direction:"row",gap:"size-100",alignItems:"center",flex:"none",children:[a.user&&s(b,{direction:"row",gap:"size-50",alignItems:"center",children:[e(Pt,{size:14,name:a.user.username,profilePictureUrl:a.user.profilePictureUrl}),e(F,{size:"XS",children:a.user.username})]}),e(F,{color:"text-300",size:"XS",children:vy(a.createdAt,Date.now())})]})]})]})})]})}const $1=5,j1=K`
2127
2127
  padding-bottom: var(--ac-global-dimension-size-200);
2128
2128
  position: relative;
2129
- `;function O1(n){const{prompt:a}=n,l=P.useFragment(ru,a),t=p.useMemo(()=>{var i,r;return(r=(i=l==null?void 0:l.latestVersions)==null?void 0:i.edges)==null?void 0:r.map(o=>o.version)},[l]);if(!t)throw new Error("Expected prompt versions to be defined");return s("div",{children:[e("ul",{children:t.map((i,r)=>{const o=r===$1-1;return s("li",{css:j1,children:[e(cu,{promptVersion:i}),i.sequenceNumber!=1?e(B1,{isLastConnector:o}):null]},i.id)})}),e(b,{direction:"row",justifyContent:"end",children:e(Oe,{to:"versions",children:"View all versions"})})]})}const Q1=K`
2129
+ `;function O1(n){const{prompt:a}=n,l=T.useFragment(ru,a),t=p.useMemo(()=>{var i,r;return(r=(i=l==null?void 0:l.latestVersions)==null?void 0:i.edges)==null?void 0:r.map(o=>o.version)},[l]);if(!t)throw new Error("Expected prompt versions to be defined");return s("div",{children:[e("ul",{children:t.map((i,r)=>{const o=r===$1-1;return s("li",{css:j1,children:[e(cu,{promptVersion:i}),i.sequenceNumber!=1?e(B1,{isLastConnector:o}):null]},i.id)})}),e(b,{direction:"row",justifyContent:"end",children:e(Oe,{to:"versions",children:"View all versions"})})]})}const Q1=K`
2130
2130
  position: absolute;
2131
2131
  top: 25px;
2132
2132
  left: 11px;
@@ -2150,14 +2150,14 @@ console.log(response.content);
2150
2150
  ),
2151
2151
  linear-gradient(to bottom, var(--connector-color), transparent);
2152
2152
  }
2153
- `;function B1({isLastConnector:n}){return e("div",{css:Q1,"data-last":n})}const fr=()=>{const a=Fy().find(l=>l.pathname.split("/prompts/").length===2);if(!a)throw new Error("usePromptIdLoader must be used within a /prompts/:promptId route");return Cy(a.id)};function rI(){const n=fr();return e(q1,{prompt:n.prompt})}function q1({prompt:n}){var t,i,r;const a=P.useFragment(jc,n),l=(r=(i=(t=a==null?void 0:a.promptVersions)==null?void 0:t.edges)==null?void 0:i[0])==null?void 0:r.node;return s(b,{direction:"row",height:"100%",children:[e(v,{height:"100%",overflow:"auto",width:"100%","data-testid":"scroll-container",children:e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-200",marginStart:"auto",marginEnd:"auto",maxWidth:900,children:[e(eu,{title:"Prompt Template",promptVersion:l}),e(Hc,{promptVersion:l}),e(iu,{promptVersion:l})]})})}),e(U1,{prompt:a})]})}function U1({prompt:n}){const a=P.useFragment($c,n),l=!!(a!=null&&a.description);return e(v,{flex:"none",width:400,borderStartColor:"dark",borderStartWidth:"thin",children:s(v,{paddingStart:"size-200",paddingEnd:"size-200",children:[s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(Lr,{level:3,children:"Description"}),e(i1,{prompt:a})]}),e(F,{color:l?"text-900":"text-700",children:a.description||"No Description"}),s("section",{children:[e(Lr,{level:3,children:"Latest Versions"}),e(O1,{prompt:a})]})]})})}const uu=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptLayout__main",selections:[n,a,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,concreteType:"Prompt",kind:"LinkedField",name:"sourcePrompt",plural:!1,selections:[n,a],storageKey:null},{alias:null,args:null,concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[n],storageKey:null}],storageKey:null}],storageKey:null}],type:"Prompt",abstractKey:null}}();uu.hash="3f2a7eb87a4a433362def455a9151d45";const mu=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"Prompt",kind:"LinkedField",name:"clonePrompt",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ClonePromptDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ClonePromptDialogMutation",selections:a},params:{cacheID:"6ad0382f6acd0f00125307c887c0f4f2",id:null,metadata:{},name:"ClonePromptDialogMutation",operationKind:"mutation",text:`mutation ClonePromptDialogMutation(
2153
+ `;function B1({isLastConnector:n}){return e("div",{css:Q1,"data-last":n})}const fr=()=>{const a=Fy().find(l=>l.pathname.split("/prompts/").length===2);if(!a)throw new Error("usePromptIdLoader must be used within a /prompts/:promptId route");return Cy(a.id)};function rI(){const n=fr();return e(q1,{prompt:n.prompt})}function q1({prompt:n}){var t,i,r;const a=T.useFragment(jc,n),l=(r=(i=(t=a==null?void 0:a.promptVersions)==null?void 0:t.edges)==null?void 0:i[0])==null?void 0:r.node;return s(b,{direction:"row",height:"100%",children:[e(v,{height:"100%",overflow:"auto",width:"100%","data-testid":"scroll-container",children:e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-200",marginStart:"auto",marginEnd:"auto",maxWidth:900,children:[e(eu,{title:"Prompt Template",promptVersion:l}),e(Hc,{promptVersion:l}),e(iu,{promptVersion:l})]})})}),e(U1,{prompt:a})]})}function U1({prompt:n}){const a=T.useFragment($c,n),l=!!(a!=null&&a.description);return e(v,{flex:"none",width:400,borderStartColor:"dark",borderStartWidth:"thin",children:s(v,{paddingStart:"size-200",paddingEnd:"size-200",children:[s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(Lr,{level:3,children:"Description"}),e(i1,{prompt:a})]}),e(F,{color:l?"text-900":"text-700",children:a.description||"No Description"}),s("section",{children:[e(Lr,{level:3,children:"Latest Versions"}),e(O1,{prompt:a})]})]})})}const uu=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptLayout__main",selections:[n,a,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,concreteType:"Prompt",kind:"LinkedField",name:"sourcePrompt",plural:!1,selections:[n,a],storageKey:null},{alias:null,args:null,concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[n],storageKey:null}],storageKey:null}],storageKey:null}],type:"Prompt",abstractKey:null}}();uu.hash="3f2a7eb87a4a433362def455a9151d45";const mu=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"Prompt",kind:"LinkedField",name:"clonePrompt",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ClonePromptDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ClonePromptDialogMutation",selections:a},params:{cacheID:"6ad0382f6acd0f00125307c887c0f4f2",id:null,metadata:{},name:"ClonePromptDialogMutation",operationKind:"mutation",text:`mutation ClonePromptDialogMutation(
2154
2154
  $input: ClonePromptInput!
2155
2155
  ) {
2156
2156
  clonePrompt(input: $input) {
2157
2157
  id
2158
2158
  }
2159
2159
  }
2160
- `}}}();mu.hash="081b8cf05c35b46579fe5cbb85f7a761";const H1=({promptId:n,promptName:a,promptDescription:l})=>{const t=ke(),i=be(),[r,o]=P.useMutation(mu),d=Qe({disabled:o,reValidateMode:"onBlur",mode:"onChange",defaultValues:{name:`${a}-clone`,description:l}}),{control:c,handleSubmit:u,formState:{isValid:y,errors:g},setError:m}=d,f=h=>u(k=>{r({variables:{input:{promptId:n,name:k.name,description:k.description}},onCompleted:S=>{t({title:"Prompt cloned successfully",action:{text:"View Prompt",onClick:()=>{i(`/prompts/${S.clonePrompt.id}`)}}}),h()},onError:S=>{var T;const C=Re(S);(T=C==null?void 0:C[0])!=null&&T.includes("already exists")?m("name",{message:C==null?void 0:C[0]}):m("root",{message:C==null?void 0:C[0]})}})});return e(X,{children:({close:h})=>{var k;return s(re,{children:[s(se,{children:[e(oe,{children:"Clone Prompt"}),e(ue,{children:e(me,{slot:"close"})})]}),e(p.Suspense,{fallback:e(pe,{}),children:e(v,{padding:"size-200",children:s("form",{onSubmit:f(h),children:[e(G,{control:c,name:"name",rules:{required:{message:"Name is required",value:!0},validate:{unique:S=>S.trim()===a.trim()?"Name must be different from the original prompt name":!0}},render:({field:{onChange:S,onBlur:C,value:T,disabled:_},fieldState:{error:x}})=>s(ie,{isInvalid:!!(x!=null&&x.message),children:[e(W,{children:"Name"}),e(ae,{name:"name",type:"text",onChange:S,onBlur:C,value:T,disabled:_}),!x&&e(F,{slot:"description",children:"A name for the cloned prompt."}),e(Ce,{children:x==null?void 0:x.message})]})}),e(G,{control:c,name:"description",render:({field:{onChange:S,onBlur:C,value:T,disabled:_},fieldState:{error:x}})=>s(ie,{isInvalid:!!(x!=null&&x.message),isDisabled:_,value:T,onChange:S,onBlur:C,children:[e(W,{children:"Description"}),e(Ra,{name:"description"}),!x&&e(F,{slot:"description",children:"A description for the cloned prompt."}),e(Ce,{children:x==null?void 0:x.message})]})}),(g==null?void 0:g.root)&&e(F,{color:"danger",children:(k=g==null?void 0:g.root)==null?void 0:k.message}),s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{slot:"close",variant:"default",isDisabled:o,children:"Cancel"}),e(E,{type:"submit",variant:"primary",isDisabled:!y,isPending:o,children:"Clone"})]})]})})})]})}})},G1=K`
2160
+ `}}}();mu.hash="081b8cf05c35b46579fe5cbb85f7a761";const H1=({promptId:n,promptName:a,promptDescription:l})=>{const t=ke(),i=be(),[r,o]=T.useMutation(mu),d=Qe({disabled:o,reValidateMode:"onBlur",mode:"onChange",defaultValues:{name:`${a}-clone`,description:l}}),{control:c,handleSubmit:u,formState:{isValid:y,errors:g},setError:m}=d,f=h=>u(k=>{r({variables:{input:{promptId:n,name:k.name,description:k.description}},onCompleted:S=>{t({title:"Prompt cloned successfully",action:{text:"View Prompt",onClick:()=>{i(`/prompts/${S.clonePrompt.id}`)}}}),h()},onError:S=>{var P;const C=Re(S);(P=C==null?void 0:C[0])!=null&&P.includes("already exists")?m("name",{message:C==null?void 0:C[0]}):m("root",{message:C==null?void 0:C[0]})}})});return e(X,{children:({close:h})=>{var k;return s(re,{children:[s(se,{children:[e(oe,{children:"Clone Prompt"}),e(ue,{children:e(me,{slot:"close"})})]}),e(p.Suspense,{fallback:e(pe,{}),children:e(v,{padding:"size-200",children:s("form",{onSubmit:f(h),children:[e(G,{control:c,name:"name",rules:{required:{message:"Name is required",value:!0},validate:{unique:S=>S.trim()===a.trim()?"Name must be different from the original prompt name":!0}},render:({field:{onChange:S,onBlur:C,value:P,disabled:L},fieldState:{error:x}})=>s(ie,{isInvalid:!!(x!=null&&x.message),children:[e(W,{children:"Name"}),e(ae,{name:"name",type:"text",onChange:S,onBlur:C,value:P,disabled:L}),!x&&e(F,{slot:"description",children:"A name for the cloned prompt."}),e(Ce,{children:x==null?void 0:x.message})]})}),e(G,{control:c,name:"description",render:({field:{onChange:S,onBlur:C,value:P,disabled:L},fieldState:{error:x}})=>s(ie,{isInvalid:!!(x!=null&&x.message),isDisabled:L,value:P,onChange:S,onBlur:C,children:[e(W,{children:"Description"}),e(Ra,{name:"description"}),!x&&e(F,{slot:"description",children:"A description for the cloned prompt."}),e(Ce,{children:x==null?void 0:x.message})]})}),(g==null?void 0:g.root)&&e(F,{color:"danger",children:(k=g==null?void 0:g.root)==null?void 0:k.message}),s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{slot:"close",variant:"default",isDisabled:o,children:"Cancel"}),e(E,{type:"submit",variant:"primary",isDisabled:!y,isPending:o,children:"Clone"})]})]})})})]})}})},G1=K`
2161
2161
  flex: 1 1 auto;
2162
2162
  display: flex;
2163
2163
  flex-direction: column;
@@ -2183,7 +2183,7 @@ console.log(response.content);
2183
2183
  }
2184
2184
  }
2185
2185
  }
2186
- `;function sI(){const[n,a]=p.useState(null),l=fr(),t=be(),{pathname:i}=gl();let r="prompt";i.includes("versions")?r="versions":i.includes("config")&&(r="config");const o=P.useFragment(uu,l.prompt);return s("main",{css:G1,children:[e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",flex:"none",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[s(b,{direction:"column",children:[e(de,{level:1,children:l.prompt.name}),o.sourcePrompt&&s(F,{color:"text-700",children:["cloned from"," ",e(Oe,{to:`/prompts/${o.sourcePrompt.id}`,children:o.sourcePrompt.name})]})]}),s(b,{direction:"row",gap:"size-100",children:[s(J,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(to,{})}),children:"Clone"}),e(ne,{children:e(Z,{size:"M",children:e(H1,{promptId:o.id,promptName:o.name,promptDescription:o.description??void 0})})})]}),e(E,{size:"S",leadingVisual:e(D,{svg:e(_t,{})}),onPress:()=>{t(`/prompts/${l.prompt.id}/playground`)},children:"Edit in Playground"})]})]})}),s(hn,{defaultSelectedKey:r,onSelectionChange:d=>{let c;d==="versions"?c=`/prompts/${l.prompt.id}/versions`:d==="config"?c=`/prompts/${l.prompt.id}/config`:c=`/prompts/${l.prompt.id}`,t(c)},children:[s(fn,{children:[e(ge,{id:"prompt",children:"Prompt"}),s(ge,{id:"versions",children:["Versions ",e(Nn,{children:o.promptVersions.edges.length})]}),e(ge,{id:"config",children:"Config"})]}),e(he,{id:"prompt",children:e(Te,{})}),e(he,{id:"versions",children:e(Te,{})}),e(he,{id:"config",children:e(Te,{})})]}),e(pl,{onDismiss:()=>a(null),children:n})]})}const gu=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"modelsInput"}],a={alias:null,args:null,kind:"ScalarField",name:"invocationInputField",storageKey:null},l={alias:"floatDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},t=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"modelsInput"}],concreteType:null,kind:"LinkedField",name:"modelInvocationParameters",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"canonicalName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"required",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],type:"InvocationParameterBase",abstractKey:"__isInvocationParameterBase"},{kind:"InlineFragment",selections:[{alias:"booleanDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"BooleanInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[l,a,{alias:null,args:null,kind:"ScalarField",name:"minValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxValue",storageKey:null}],type:"BoundedFloatInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[l,a],type:"FloatInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"intDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"IntInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"jsonDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"JSONInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"stringDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"StringInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"stringListDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"StringListInvocationParameter",abstractKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"fetchPlaygroundPromptSupportedInvocationParametersQuery",selections:t,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"fetchPlaygroundPromptSupportedInvocationParametersQuery",selections:t},params:{cacheID:"530366c9a8cc3b47d685ca0600a39bb5",id:null,metadata:{},name:"fetchPlaygroundPromptSupportedInvocationParametersQuery",operationKind:"query",text:`query fetchPlaygroundPromptSupportedInvocationParametersQuery(
2186
+ `;function sI(){const[n,a]=p.useState(null),l=fr(),t=be(),{pathname:i}=gl();let r="prompt";i.includes("versions")?r="versions":i.includes("config")&&(r="config");const o=T.useFragment(uu,l.prompt);return s("main",{css:G1,children:[e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",flex:"none",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[s(b,{direction:"column",children:[e(de,{level:1,children:l.prompt.name}),o.sourcePrompt&&s(F,{color:"text-700",children:["cloned from"," ",e(Oe,{to:`/prompts/${o.sourcePrompt.id}`,children:o.sourcePrompt.name})]})]}),s(b,{direction:"row",gap:"size-100",children:[s(J,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(to,{})}),children:"Clone"}),e(ne,{children:e(Z,{size:"M",children:e(H1,{promptId:o.id,promptName:o.name,promptDescription:o.description??void 0})})})]}),e(E,{size:"S",leadingVisual:e(D,{svg:e(_t,{})}),onPress:()=>{t(`/prompts/${l.prompt.id}/playground`)},children:"Edit in Playground"})]})]})}),s(hn,{defaultSelectedKey:r,onSelectionChange:d=>{let c;d==="versions"?c=`/prompts/${l.prompt.id}/versions`:d==="config"?c=`/prompts/${l.prompt.id}/config`:c=`/prompts/${l.prompt.id}`,t(c)},children:[s(fn,{children:[e(ge,{id:"prompt",children:"Prompt"}),s(ge,{id:"versions",children:["Versions ",e(Nn,{children:o.promptVersions.edges.length})]}),e(ge,{id:"config",children:"Config"})]}),e(he,{id:"prompt",children:e(Te,{})}),e(he,{id:"versions",children:e(Te,{})}),e(he,{id:"config",children:e(Te,{})})]}),e(pl,{onDismiss:()=>a(null),children:n})]})}const gu=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"modelsInput"}],a={alias:null,args:null,kind:"ScalarField",name:"invocationInputField",storageKey:null},l={alias:"floatDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},t=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"modelsInput"}],concreteType:null,kind:"LinkedField",name:"modelInvocationParameters",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"canonicalName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"required",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],type:"InvocationParameterBase",abstractKey:"__isInvocationParameterBase"},{kind:"InlineFragment",selections:[{alias:"booleanDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"BooleanInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[l,a,{alias:null,args:null,kind:"ScalarField",name:"minValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxValue",storageKey:null}],type:"BoundedFloatInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[l,a],type:"FloatInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"intDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"IntInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"jsonDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"JSONInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"stringDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"StringInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"stringListDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"StringListInvocationParameter",abstractKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"fetchPlaygroundPromptSupportedInvocationParametersQuery",selections:t,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"fetchPlaygroundPromptSupportedInvocationParametersQuery",selections:t},params:{cacheID:"530366c9a8cc3b47d685ca0600a39bb5",id:null,metadata:{},name:"fetchPlaygroundPromptSupportedInvocationParametersQuery",operationKind:"query",text:`query fetchPlaygroundPromptSupportedInvocationParametersQuery(
2187
2187
  $modelsInput: ModelsInput!
2188
2188
  ) {
2189
2189
  modelInvocationParameters(input: $modelsInput) {
@@ -2287,7 +2287,7 @@ console.log(response.content);
2287
2287
  id
2288
2288
  }
2289
2289
  }
2290
- `}}}();pu.hash="5b21b9860cae9ec899aaa18ba9c73787";const W1=n=>{switch(n){case"user":return"USER";case"ai":return"AI";case"system":return"SYSTEM";case"tool":return"TOOL";default:return"USER"}},J1=(n,a)=>{const l=a.length>0?a.reduce((t,i)=>(i.invocationName&&(t[i.invocationName]=i),t),{}):{};return Object.entries(n).map(([t,i])=>{const r=l[t];return!r||!r.invocationInputField?{invocationName:t,valueJson:i}:{invocationName:t,canonicalName:r.canonicalName,[Cl(r.invocationInputField)]:i}})},Z1=({promptId:n,promptName:a,promptVersion:l,supportedInvocationParameters:t})=>{var c,u;const i={...Qf(),prompt:{id:n,name:a}},r=l.modelName,o=l.modelProvider,d=Vi({toolChoice:(c=l.invocationParameters)==null?void 0:c.tool_choice,targetProvider:o})??void 0;return{...i,model:{...i.model,modelName:r,provider:o,supportedInvocationParameters:t||[],invocationParameters:J1({...l.invocationParameters,...(u=l.responseFormat)!=null&&u.definition?{response_format:l.responseFormat.definition}:{}},t||[])},template:{__type:"chat",messages:"messages"in l.template?l.template.messages.map(y=>{const g=y.content.map(Gt).filter(Boolean).map(S=>S.text.text).join(""),m=y.content.filter(gr).filter(Boolean),h=y.content.filter(pr).filter(Boolean).at(0),k=Sa(y.role);return k==="tool"&&h?{id:Fa(),role:Sa(y.role),content:typeof h.toolResult.result=="string"?h.toolResult.result:Yn(h.toolResult.result,null,2).json||"",toolCallId:h.toolResult.toolCallId}:k==="ai"&&m.length>0?{id:Fa(),role:Sa(y.role),toolCalls:m.map(S=>co(S,o))}:{id:Fa(),role:Sa(y.role),content:g}}):[]},tools:l.tools.map(y=>({id:ll(),definition:y.definition})),toolChoice:d}},X1=(n,a)=>{const l=a.length>0?a.reduce((t,i)=>((i.canonicalName||i.invocationName)&&(t[i.canonicalName||i.invocationName]=i),t),{}):{};return n.reduce((t,i)=>{const r=l[i.canonicalName||i.invocationName];return r&&(t[i.invocationName]=i[Cl(r.invocationInputField)]),t},{})},Y1=[{invocationName:sl,canonicalName:Ka},{invocationName:Gn,canonicalName:Zn}],eS=n=>{if(n.template.__type==="text_completion")return console.warn("Instance to prompt version conversion not supported for text completion"),null;const a=n.template.messages.map(t=>{var d;let i=[t.content?Zc(t.content):null];const r=((d=t.toolCalls)==null?void 0:d.map(Xc))||[],o=t.toolCallId?[Yc(t.toolCallId,t.content)]:[];return(r.length>0||o.length>0)&&(i=[]),{content:[...i,...r,...o].filter(c=>c!==null),role:W1(t.role)}});return{modelName:n.model.modelName||Bf,modelProvider:n.model.provider,template:{messages:a},tools:n.tools.map(t=>({definition:t.definition})),responseFormat:n.model.invocationParameters.filter(t=>t.canonicalName===Zn||t.invocationName===Gn).map(t=>({definition:t.valueJson})).at(0)||void 0,invocationParameters:X1(pd(n.model.invocationParameters.filter(t=>!Y1.some(i=>_a(i,t))).concat(n.toolChoice?[{invocationName:sl,valueJson:n.toolChoice,canonicalName:Ka}]:[]),n.model.provider,n.model.modelName),n.model.supportedInvocationParameters)}},nS=pu,aS=gu,lS=async({modelName:n,providerKey:a})=>{const l=await P.fetchQuery(ve,aS,{modelsInput:{modelName:n,providerKey:a}}).toPromise();return l==null?void 0:l.modelInvocationParameters},tS=async n=>P.fetchQuery(ve,nS,{promptId:n}).toPromise(),iS=n=>n?n==null?void 0:n.version:null,yu=async n=>{var t;if(!n)return null;const a=await tS(n),l=iS(a==null?void 0:a.prompt);if(l&&l.templateType==="CHAT"){const i=await lS({modelName:l.modelName,providerKey:l.modelProvider}),r=(t=a==null?void 0:a.prompt)==null?void 0:t.name;if(!r)throw new Error("Prompt name is required");return{instance:Z1({promptId:n,promptName:r,promptVersion:l,supportedInvocationParameters:i}),promptVersion:l}}return null},oI=async({params:n})=>{const{promptId:a}=n;if(!a)throw new Error("Prompt ID is required");const l=await yu(a);if(!l)throw new Error("Prompt not found");return{instanceWithPrompt:l.instance,templateFormat:l.promptVersion.templateFormat}},fu=function(){var n=[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PlaygroundQuery",selections:n,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"PlaygroundQuery",selections:n},params:{cacheID:"f19ebe151a3a9794fa2566c66751d259",id:null,metadata:{},name:"PlaygroundQuery",operationKind:"query",text:`query PlaygroundQuery {
2290
+ `}}}();pu.hash="5b21b9860cae9ec899aaa18ba9c73787";const W1=n=>{switch(n){case"user":return"USER";case"ai":return"AI";case"system":return"SYSTEM";case"tool":return"TOOL";default:return"USER"}},J1=(n,a)=>{const l=a.length>0?a.reduce((t,i)=>(i.invocationName&&(t[i.invocationName]=i),t),{}):{};return Object.entries(n).map(([t,i])=>{const r=l[t];return!r||!r.invocationInputField?{invocationName:t,valueJson:i}:{invocationName:t,canonicalName:r.canonicalName,[Cl(r.invocationInputField)]:i}})},Z1=({promptId:n,promptName:a,promptVersion:l,supportedInvocationParameters:t})=>{var c,u;const i={...Qf(),prompt:{id:n,name:a}},r=l.modelName,o=l.modelProvider,d=Vi({toolChoice:(c=l.invocationParameters)==null?void 0:c.tool_choice,targetProvider:o})??void 0;return{...i,model:{...i.model,modelName:r,provider:o,supportedInvocationParameters:t||[],invocationParameters:J1({...l.invocationParameters,...(u=l.responseFormat)!=null&&u.definition?{response_format:l.responseFormat.definition}:{}},t||[])},template:{__type:"chat",messages:"messages"in l.template?l.template.messages.map(y=>{const g=y.content.map(Gt).filter(Boolean).map(S=>S.text.text).join(""),m=y.content.filter(gr).filter(Boolean),h=y.content.filter(pr).filter(Boolean).at(0),k=Sa(y.role);return k==="tool"&&h?{id:Fa(),role:Sa(y.role),content:typeof h.toolResult.result=="string"?h.toolResult.result:Yn(h.toolResult.result,null,2).json||"",toolCallId:h.toolResult.toolCallId}:k==="ai"&&m.length>0?{id:Fa(),role:Sa(y.role),toolCalls:m.map(S=>co(S,o))}:{id:Fa(),role:Sa(y.role),content:g}}):[]},tools:l.tools.map(y=>({id:ll(),definition:y.definition})),toolChoice:d}},X1=(n,a)=>{const l=a.length>0?a.reduce((t,i)=>((i.canonicalName||i.invocationName)&&(t[i.canonicalName||i.invocationName]=i),t),{}):{};return n.reduce((t,i)=>{const r=l[i.canonicalName||i.invocationName];return r&&(t[i.invocationName]=i[Cl(r.invocationInputField)]),t},{})},Y1=[{invocationName:sl,canonicalName:Ka},{invocationName:Gn,canonicalName:Zn}],eS=n=>{if(n.template.__type==="text_completion")return console.warn("Instance to prompt version conversion not supported for text completion"),null;const a=n.template.messages.map(t=>{var d;let i=[t.content?Zc(t.content):null];const r=((d=t.toolCalls)==null?void 0:d.map(Xc))||[],o=t.toolCallId?[Yc(t.toolCallId,t.content)]:[];return(r.length>0||o.length>0)&&(i=[]),{content:[...i,...r,...o].filter(c=>c!==null),role:W1(t.role)}});return{modelName:n.model.modelName||Bf,modelProvider:n.model.provider,template:{messages:a},tools:n.tools.map(t=>({definition:t.definition})),responseFormat:n.model.invocationParameters.filter(t=>t.canonicalName===Zn||t.invocationName===Gn).map(t=>({definition:t.valueJson})).at(0)||void 0,invocationParameters:X1(pd(n.model.invocationParameters.filter(t=>!Y1.some(i=>_a(i,t))).concat(n.toolChoice?[{invocationName:sl,valueJson:n.toolChoice,canonicalName:Ka}]:[]),n.model.provider,n.model.modelName),n.model.supportedInvocationParameters)}},nS=pu,aS=gu,lS=async({modelName:n,providerKey:a})=>{const l=await T.fetchQuery(ve,aS,{modelsInput:{modelName:n,providerKey:a}}).toPromise();return l==null?void 0:l.modelInvocationParameters},tS=async n=>T.fetchQuery(ve,nS,{promptId:n}).toPromise(),iS=n=>n?n==null?void 0:n.version:null,yu=async n=>{var t;if(!n)return null;const a=await tS(n),l=iS(a==null?void 0:a.prompt);if(l&&l.templateType==="CHAT"){const i=await lS({modelName:l.modelName,providerKey:l.modelProvider}),r=(t=a==null?void 0:a.prompt)==null?void 0:t.name;if(!r)throw new Error("Prompt name is required");return{instance:Z1({promptId:n,promptName:r,promptVersion:l,supportedInvocationParameters:i}),promptVersion:l}}return null},oI=async({params:n})=>{const{promptId:a}=n;if(!a)throw new Error("Prompt ID is required");const l=await yu(a);if(!l)throw new Error("Prompt not found");return{instanceWithPrompt:l.instance,templateFormat:l.promptVersion.templateFormat}},fu=function(){var n=[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PlaygroundQuery",selections:n,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"PlaygroundQuery",selections:n},params:{cacheID:"f19ebe151a3a9794fa2566c66751d259",id:null,metadata:{},name:"PlaygroundQuery",operationKind:"query",text:`query PlaygroundQuery {
2291
2291
  modelProviders {
2292
2292
  name
2293
2293
  dependenciesInstalled
@@ -2374,7 +2374,7 @@ fragment ExampleExperimentRunsTableFragment on DatasetExample {
2374
2374
  __typename
2375
2375
  }
2376
2376
  }
2377
- `}}}();ku.hash="a5e0e601ed24ffaa37a99ba358f960d3";const ii={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function sS(n){const{exampleId:a,onCompleted:l}=n,[t,i]=p.useState(null),[r,o]=P.useMutation(ku),{control:d,setError:c,handleSubmit:u,formState:{isValid:y}}=Qe({defaultValues:n.currentRevision}),g=p.useCallback((m,f)=>{if(i(null),!ca(m==null?void 0:m.input))return c("input",{message:"Input must be a valid JSON object"});if(!ca(m==null?void 0:m.output))return c("output",{message:"Output must be a valid JSON object"});if(!ca(m==null?void 0:m.metadata))return c("metadata",{message:"Metadata must be a valid JSON object"});r({variables:{input:{patches:[{exampleId:a,input:JSON.parse(m.input),output:JSON.parse(m.output),metadata:JSON.parse(m.metadata)}],versionDescription:m.description}},onCompleted:()=>{l(),f()},onError:h=>{i(h.message)}})},[r,a,c,l]);return e(X,{children:({close:m})=>s(re,{children:[s(se,{children:[s(oe,{children:["Edit Example: ",a]}),s(ue,{children:[e(E,{variant:"primary",size:"S",isDisabled:!y||o,leadingVisual:e(D,{svg:o?e(yn,{}):e(mo,{})}),onPress:()=>u(f=>g(f,m))(),children:"Save Changes"}),e(me,{})]})]}),e("div",{css:K`
2377
+ `}}}();ku.hash="a5e0e601ed24ffaa37a99ba358f960d3";const ii={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function sS(n){const{exampleId:a,onCompleted:l}=n,[t,i]=p.useState(null),[r,o]=T.useMutation(ku),{control:d,setError:c,handleSubmit:u,formState:{isValid:y}}=Qe({defaultValues:n.currentRevision}),g=p.useCallback((m,f)=>{if(i(null),!ca(m==null?void 0:m.input))return c("input",{message:"Input must be a valid JSON object"});if(!ca(m==null?void 0:m.output))return c("output",{message:"Output must be a valid JSON object"});if(!ca(m==null?void 0:m.metadata))return c("metadata",{message:"Metadata must be a valid JSON object"});r({variables:{input:{patches:[{exampleId:a,input:JSON.parse(m.input),output:JSON.parse(m.output),metadata:JSON.parse(m.metadata)}],versionDescription:m.description}},onCompleted:()=>{l(),f()},onError:h=>{i(h.message)}})},[r,a,c,l]);return e(X,{children:({close:m})=>s(re,{children:[s(se,{children:[s(oe,{children:["Edit Example: ",a]}),s(ue,{children:[e(E,{variant:"primary",size:"S",isDisabled:!y||o,leadingVisual:e(D,{svg:o?e(yn,{}):e(mo,{})}),onPress:()=>u(f=>g(f,m))(),children:"Save Changes"}),e(me,{})]})]}),e("div",{css:K`
2378
2378
  overflow-y: auto;
2379
2379
  padding: var(--ac-global-dimension-size-400);
2380
2380
  /* Make widths configurable */
@@ -2452,10 +2452,10 @@ fragment ExampleExperimentRunsTableFragment_2HEEH6 on DatasetExample {
2452
2452
  align-items: center;
2453
2453
  color: var(--ac-global-color-primary);
2454
2454
  gap: var(--ac-global-dimension-size-50);
2455
- `;function mS({example:n}){const a=p.useRef(null),l=be(),{data:t,loadNext:i,hasNext:r,isLoadingNext:o}=P.usePaginationFragment(Su,n),d=p.useMemo(()=>t.experimentRuns.edges.map(f=>{let h=null;return f.run.startTime&&f.run.endTime&&(h=new Date(f.run.endTime).getTime()-new Date(f.run.startTime).getTime()),{...f.run,output:JSON.stringify(f.run.output),latencyMs:h}}),[t]),u=Le({columns:[{header:"start time",accessorKey:"startTime",cell:we},{header:"output",accessorKey:"output",cell:f=>{var k;const h=(k=f.row.original)==null?void 0:k.error;return h!==null?e(F,{color:"danger",children:h}):e(Be,{...f})}},{header:"latency",accessorKey:"latencyMs",cell:({getValue:f})=>{const h=f();return h===null||typeof h!="number"?"--":e(Ye,{latencyMs:h})}},{header:"evaluations",accessorKey:"annotations",cell:({row:f})=>e(b,{direction:"row",gap:"size-50",wrap:"wrap",children:f.original.annotations.edges.map((h,k)=>{const S=h.annotation;return e(go,{annotation:S,extra:S.trace&&e(v,{paddingTop:"size-100",children:s("div",{css:uS,children:[e(D,{svg:e(ga,{})}),e("span",{children:"Click to view evaluator trace"})]})}),children:e(fl,{annotation:S,onClick:()=>{S.trace&&l(`/projects/${S.trace.projectId}/traces/${S.trace.traceId}`)}},k)},k)})})},{id:"actions",cell:({row:f})=>{const h=f.original.trace;if(h)return e(E,{size:"S",leadingVisual:e(D,{svg:e(At,{})}),onPress:()=>{l(`/projects/${h.projectId}/traces/${h.traceId}`)},"aria-label":"view trace"})}}],data:d,getCoreRowModel:_e()}),y=u.getRowModel().rows,g=y.length===0,m=p.useCallback(f=>{if(f){const{scrollHeight:h,scrollTop:k,clientHeight:S}=f;h-k-S<300&&!o&&r&&i(dS)}},[r,o,i]);return e("div",{css:K`
2455
+ `;function mS({example:n}){const a=p.useRef(null),l=be(),{data:t,loadNext:i,hasNext:r,isLoadingNext:o}=T.usePaginationFragment(Su,n),d=p.useMemo(()=>t.experimentRuns.edges.map(f=>{let h=null;return f.run.startTime&&f.run.endTime&&(h=new Date(f.run.endTime).getTime()-new Date(f.run.startTime).getTime()),{...f.run,output:JSON.stringify(f.run.output),latencyMs:h}}),[t]),u=Le({columns:[{header:"start time",accessorKey:"startTime",cell:we},{header:"output",accessorKey:"output",cell:f=>{var k;const h=(k=f.row.original)==null?void 0:k.error;return h!==null?e(F,{color:"danger",children:h}):e(Be,{...f})}},{header:"latency",accessorKey:"latencyMs",cell:({getValue:f})=>{const h=f();return h===null||typeof h!="number"?"--":e(Ye,{latencyMs:h})}},{header:"evaluations",accessorKey:"annotations",cell:({row:f})=>e(b,{direction:"row",gap:"size-50",wrap:"wrap",children:f.original.annotations.edges.map((h,k)=>{const S=h.annotation;return e(go,{annotation:S,extra:S.trace&&e(v,{paddingTop:"size-100",children:s("div",{css:uS,children:[e(D,{svg:e(ga,{})}),e("span",{children:"Click to view evaluator trace"})]})}),children:e(fl,{annotation:S,onClick:()=>{S.trace&&l(`/projects/${S.trace.projectId}/traces/${S.trace.traceId}`)}},k)},k)})})},{id:"actions",cell:({row:f})=>{const h=f.original.trace;if(h)return e(E,{size:"S",leadingVisual:e(D,{svg:e(At,{})}),onPress:()=>{l(`/projects/${h.projectId}/traces/${h.traceId}`)},"aria-label":"view trace"})}}],data:d,getCoreRowModel:_e()}),y=u.getRowModel().rows,g=y.length===0,m=p.useCallback(f=>{if(f){const{scrollHeight:h,scrollTop:k,clientHeight:S}=f;h-k-S<300&&!o&&r&&i(dS)}},[r,o,i]);return e("div",{css:K`
2456
2456
  flex: 1 1 auto;
2457
2457
  overflow: auto;
2458
- `,ref:a,onScroll:f=>m(f.target),children:s("table",{css:la,children:[e("thead",{children:u.getHeaderGroups().map(f=>e("tr",{children:f.headers.map(h=>e("th",{children:e("div",{children:ee(h.column.columnDef.header,h.getContext())})},h.id))},f.id))}),g?e(cS,{}):e("tbody",{children:y.map(f=>e("tr",{children:f.getVisibleCells().map(h=>e("td",{children:ee(h.column.columnDef.cell,h.getContext())},h.id))},f.id))})]})})}function kr({exampleId:n}){const[a,l]=p.useState(0),t=P.useLazyLoadQuery(hu,{exampleId:n},{fetchKey:a,fetchPolicy:"store-and-network"}),i=p.useMemo(()=>{const y=t.example.latestRevision;return{input:JSON.stringify(y==null?void 0:y.input,null,2),output:JSON.stringify(y==null?void 0:y.output,null,2),metadata:JSON.stringify(y==null?void 0:y.metadata,null,2)}},[t]),r=p.useMemo(()=>{const y=t.example.span;return y?{id:y.id,traceId:y.trace.traceId,projectId:y.trace.project.id}:null},[t]),{input:o,output:d,metadata:c}=i,u=ke();return e(X,{children:s(re,{children:[s(se,{children:[s(oe,{children:["Example: ",n]}),s(ue,{children:[r?e(ya,{size:"S",to:`/projects/${r.projectId}/traces/${r.traceId}?${Pn}=${r.id}`,children:"View Source Span"}):null,e(oS,{exampleId:n,currentRevision:i,onCompleted:()=>{u({title:"Example updated",message:`Example ${n} has been updated.`}),l(y=>y+1)}}),e(me,{})]})]}),s(An,{direction:"vertical",autoSaveId:"example-panel-group",children:[e(ze,{defaultSize:65,children:e("div",{css:K`
2458
+ `,ref:a,onScroll:f=>m(f.target),children:s("table",{css:la,children:[e("thead",{children:u.getHeaderGroups().map(f=>e("tr",{children:f.headers.map(h=>e("th",{children:e("div",{children:ee(h.column.columnDef.header,h.getContext())})},h.id))},f.id))}),g?e(cS,{}):e("tbody",{children:y.map(f=>e("tr",{children:f.getVisibleCells().map(h=>e("td",{children:ee(h.column.columnDef.cell,h.getContext())},h.id))},f.id))})]})})}function kr({exampleId:n}){const[a,l]=p.useState(0),t=T.useLazyLoadQuery(hu,{exampleId:n},{fetchKey:a,fetchPolicy:"store-and-network"}),i=p.useMemo(()=>{const y=t.example.latestRevision;return{input:JSON.stringify(y==null?void 0:y.input,null,2),output:JSON.stringify(y==null?void 0:y.output,null,2),metadata:JSON.stringify(y==null?void 0:y.metadata,null,2)}},[t]),r=p.useMemo(()=>{const y=t.example.span;return y?{id:y.id,traceId:y.trace.traceId,projectId:y.trace.project.id}:null},[t]),{input:o,output:d,metadata:c}=i,u=ke();return e(X,{children:s(re,{children:[s(se,{children:[s(oe,{children:["Example: ",n]}),s(ue,{children:[r?e(ya,{size:"S",to:`/projects/${r.projectId}/traces/${r.traceId}?${Pn}=${r.id}`,children:"View Source Span"}):null,e(oS,{exampleId:n,currentRevision:i,onCompleted:()=>{u({title:"Example updated",message:`Example ${n} has been updated.`}),l(y=>y+1)}}),e(me,{})]})]}),s(An,{direction:"vertical",autoSaveId:"example-panel-group",children:[e(ze,{defaultSize:65,children:e("div",{css:K`
2459
2459
  overflow-y: auto;
2460
2460
  height: 100%;
2461
2461
  `,children:e(b,{direction:"row",justifyContent:"center",children:e(v,{width:"900px",padding:"size-200",children:s(b,{direction:"column",gap:"size-200",children:[e(q,{title:"Input",...ri,extra:e(Se,{text:o}),children:e(Dn,{value:o})}),e(q,{title:"Output",...ri,extra:e(Se,{text:d}),children:e(Dn,{value:d})}),e(q,{title:"Metadata",...ri,extra:e(Se,{text:c}),children:e(Dn,{value:c})})]})})})})}),e(zn,{css:Za}),e(ze,{defaultSize:35,children:s(b,{direction:"column",height:"100%",children:[e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:e(de,{level:3,children:"Experiment Runs"})}),e(mS,{example:t.example})]})})]})]})})}const ri={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0,bodyStyle:{padding:0}};function gS(){const[n,a]=Sn(),l=n.get("exampleId"),t=n.get("datasetId");return!l||!t?null:e(J,{isOpen:!0,onOpenChange:i=>{i||a(r=>(r.delete("exampleId"),r))},children:e(ne,{children:e(Z,{variant:"slideover",size:"L",children:e(p.Suspense,{fallback:e(pe,{}),children:e(kr,{exampleId:l})})})})})}const pS=`
@@ -2677,7 +2677,7 @@ fragment PlaygroundDatasetExamplesTableFragment on Dataset {
2677
2677
  id
2678
2678
  }
2679
2679
  }
2680
- `}}}();xu.hash="e2203e071e6fce91c764fa6fee48dfc1";function vS({runId:n}){var d,c,u;const l=P.useLazyLoadQuery(xu,{runId:n}).run,t=(d=l.example)==null?void 0:d.id,i=(c=l.example)==null?void 0:c.revision,r=i==null?void 0:i.input,o=i==null?void 0:i.output;return e(X,{children:s(re,{children:[s(se,{children:[s(oe,{children:["Experiment Run for Example: ",t]}),e(ue,{children:e(me,{})})]}),s(An,{direction:"vertical",autoSaveId:"example-compare-panel-group",children:[e(ze,{defaultSize:33,children:e(v,{overflow:"auto",height:"100%",padding:"size-200",children:s(b,{direction:"row",gap:"size-200",flex:"1 1 auto",children:[e(v,{width:"50%",children:e(q,{title:"Input",...us,bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},extra:e(Se,{text:JSON.stringify(r)}),children:e(Dn,{value:JSON.stringify(r,null,2)})})}),e(v,{width:"50%",children:e(q,{title:"Reference Output",...us,extra:e(Se,{text:JSON.stringify(o)}),bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},children:e(Dn,{value:JSON.stringify(o,null,2)})})})]})})}),e(zn,{css:Za}),e(ze,{defaultSize:67,children:s(b,{direction:"column",height:"100%",children:[e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:e(de,{level:2,children:"Experiment Run Output"})}),e("div",{css:K`
2680
+ `}}}();xu.hash="e2203e071e6fce91c764fa6fee48dfc1";function vS({runId:n}){var d,c,u;const l=T.useLazyLoadQuery(xu,{runId:n}).run,t=(d=l.example)==null?void 0:d.id,i=(c=l.example)==null?void 0:c.revision,r=i==null?void 0:i.input,o=i==null?void 0:i.output;return e(X,{children:s(re,{children:[s(se,{children:[s(oe,{children:["Experiment Run for Example: ",t]}),e(ue,{children:e(me,{})})]}),s(An,{direction:"vertical",autoSaveId:"example-compare-panel-group",children:[e(ze,{defaultSize:33,children:e(v,{overflow:"auto",height:"100%",padding:"size-200",children:s(b,{direction:"row",gap:"size-200",flex:"1 1 auto",children:[e(v,{width:"50%",children:e(q,{title:"Input",...us,bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},extra:e(Se,{text:JSON.stringify(r)}),children:e(Dn,{value:JSON.stringify(r,null,2)})})}),e(v,{width:"50%",children:e(q,{title:"Reference Output",...us,extra:e(Se,{text:JSON.stringify(o)}),bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},children:e(Dn,{value:JSON.stringify(o,null,2)})})})]})})}),e(zn,{css:Za}),e(ze,{defaultSize:67,children:s(b,{direction:"column",height:"100%",children:[e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:e(de,{level:2,children:"Experiment Run Output"})}),e("div",{css:K`
2681
2681
  overflow-y: auto;
2682
2682
  height: 100%;
2683
2683
  padding: var(--ac-global-dimension-static-size-200);
@@ -2742,7 +2742,7 @@ fragment PlaygroundDatasetExamplesTableFragment on Dataset {
2742
2742
  id
2743
2743
  }
2744
2744
  }
2745
- `}}}();Du.hash="2c97785cc9a789cbebe59a993e72529d";const Lu=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},r={alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},c={alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"statusMessage",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},k=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"mimeType",storageKey:null}],S={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:k,storageKey:null},C={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:k,storageKey:null},T={alias:null,args:null,kind:"ScalarField",name:"attributes",storageKey:null},_={alias:null,args:null,concreteType:"SpanEvent",kind:"LinkedField",name:"events",plural:!0,selections:[o,{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null}],storageKey:null},x={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null},N={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},w={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},$={alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},I={alias:null,args:null,concreteType:"DocumentEvaluation",kind:"LinkedField",name:"documentEvaluations",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"documentPosition",storageKey:null},o,N,w,$],storageKey:null},M={kind:"InlineFragment",selections:[t],type:"Node",abstractKey:"__isNode"},z={alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null},A={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},V={alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[N,w],storageKey:null},O={alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},H={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"lowerBound",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"upperBound",storageKey:null},O],type:"ContinuousAnnotationConfig",abstractKey:null},te={kind:"InlineFragment",selections:[o],type:"FreeformAnnotationConfig",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanDetailsQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[t,i,r,o,d,c,u,y,g,m,f,h,S,C,T,{kind:"RequiredField",field:_,action:"THROW"},x,I,{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[t,o],storageKey:null},{args:null,kind:"FragmentSpread",name:"SpanHeader_span"},{args:null,kind:"FragmentSpread",name:"SpanFeedback_annotations"},{args:null,kind:"FragmentSpread",name:"SpanAside_span"}],type:"Span",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanDetailsQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[i,r,o,d,c,u,y,g,m,f,h,S,C,T,_,x,I,{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[t,o,N,w,$,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"identifier",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"source",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"updatedAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null}],storageKey:null},{alias:"code",args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[t,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,M,{kind:"InlineFragment",selections:[o,z,A],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[V,t,o,O],type:"CategoricalAnnotationConfig",abstractKey:null},H,te],storageKey:null}],storageKey:null},{alias:"configs",args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"config",args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,M,{kind:"InlineFragment",selections:[o,A,z],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[V],type:"CategoricalAnnotationConfig",abstractKey:null},H,te],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummaries",plural:!0,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null},N],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null},o],storageKey:null}],type:"Span",abstractKey:null}],storageKey:null}]},params:{cacheID:"78ec23fb5e2d379bbb6b37072a90d653",id:null,metadata:{},name:"SpanDetailsQuery",operationKind:"query",text:`query SpanDetailsQuery(
2745
+ `}}}();Du.hash="2c97785cc9a789cbebe59a993e72529d";const Lu=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},r={alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},c={alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"statusMessage",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},k=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"mimeType",storageKey:null}],S={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:k,storageKey:null},C={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:k,storageKey:null},P={alias:null,args:null,kind:"ScalarField",name:"attributes",storageKey:null},L={alias:null,args:null,concreteType:"SpanEvent",kind:"LinkedField",name:"events",plural:!0,selections:[o,{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null}],storageKey:null},x={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null},N={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},w={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},$={alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},I={alias:null,args:null,concreteType:"DocumentEvaluation",kind:"LinkedField",name:"documentEvaluations",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"documentPosition",storageKey:null},o,N,w,$],storageKey:null},M={kind:"InlineFragment",selections:[t],type:"Node",abstractKey:"__isNode"},z={alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null},A={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},V={alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[N,w],storageKey:null},O={alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},H={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"lowerBound",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"upperBound",storageKey:null},O],type:"ContinuousAnnotationConfig",abstractKey:null},te={kind:"InlineFragment",selections:[o],type:"FreeformAnnotationConfig",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanDetailsQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[t,i,r,o,d,c,u,y,g,m,f,h,S,C,P,{kind:"RequiredField",field:L,action:"THROW"},x,I,{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[t,o],storageKey:null},{args:null,kind:"FragmentSpread",name:"SpanHeader_span"},{args:null,kind:"FragmentSpread",name:"SpanFeedback_annotations"},{args:null,kind:"FragmentSpread",name:"SpanAside_span"}],type:"Span",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanDetailsQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[i,r,o,d,c,u,y,g,m,f,h,S,C,P,L,x,I,{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[t,o,N,w,$,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"identifier",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"source",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"updatedAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null}],storageKey:null},{alias:"code",args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[t,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,M,{kind:"InlineFragment",selections:[o,z,A],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[V,t,o,O],type:"CategoricalAnnotationConfig",abstractKey:null},H,te],storageKey:null}],storageKey:null},{alias:"configs",args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"config",args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,M,{kind:"InlineFragment",selections:[o,A,z],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[V],type:"CategoricalAnnotationConfig",abstractKey:null},H,te],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummaries",plural:!0,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null},N],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null},o],storageKey:null}],type:"Span",abstractKey:null}],storageKey:null}]},params:{cacheID:"78ec23fb5e2d379bbb6b37072a90d653",id:null,metadata:{},name:"SpanDetailsQuery",operationKind:"query",text:`query SpanDetailsQuery(
2746
2746
  $id: ID!
2747
2747
  ) {
2748
2748
  span: node(id: $id) {
@@ -3008,7 +3008,7 @@ fragment TraceHeaderRootSpanAnnotationsFragment on Span {
3008
3008
  overflow: hidden;
3009
3009
  text-overflow: ellipsis;
3010
3010
  }
3011
- `;function Ln(n){const{name:a,metric:l,k:t,score:i}=n,r=typeof t=="number"?`${l}@${t}`:l,o=p.useMemo(()=>l==="hit"?i?"true":"false":typeof i=="number"&&yo(i)||"--",[i,l]);return s(De,{delay:500,children:[e(et,{children:e("div",{css:Hf,children:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Gf,{color:"var(--ac-global-color-seafoam-1000)"}),a?e("div",{css:si,children:e(F,{weight:"heavy",size:"XS",color:"inherit",children:a})}):null,e("div",{css:si,children:e(F,{size:"XS",color:"inherit",children:r})}),e("div",{css:si,children:e(F,{size:"XS",children:o})})]})})}),e(Cn,{offset:3,placement:"bottom",children:s(b,{direction:"row",gap:"size-100",children:[s(F,{weight:"heavy",color:"inherit",children:[a," ",r]}),e(F,{color:"inherit",children:o})]})})]})}const _u={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SpanHeader_span",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},{alias:"code",args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null}],type:"Span",abstractKey:null};_u.hash="2ba518744a1e825cf02818bfbf16b7a5";function DS(n){var t,i;const a=P.useFragment(_u,n.span),l=p.useMemo(()=>new Date(a.startTime),[a.startTime]);return e(b,{direction:"row",gap:"size-100",width:"100%",height:"100%",alignItems:"center",children:s(b,{direction:"column",gap:"size-50",children:[s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Bi,{spanKind:a.spanKind}),e(F,{size:"L",children:a.name}),e(wt,{statusCode:a.code,css:K`
3011
+ `;function Ln(n){const{name:a,metric:l,k:t,score:i}=n,r=typeof t=="number"?`${l}@${t}`:l,o=p.useMemo(()=>l==="hit"?i?"true":"false":typeof i=="number"&&yo(i)||"--",[i,l]);return s(De,{delay:500,children:[e(et,{children:e("div",{css:Hf,children:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Gf,{color:"var(--ac-global-color-seafoam-1000)"}),a?e("div",{css:si,children:e(F,{weight:"heavy",size:"XS",color:"inherit",children:a})}):null,e("div",{css:si,children:e(F,{size:"XS",color:"inherit",children:r})}),e("div",{css:si,children:e(F,{size:"XS",children:o})})]})})}),e(Cn,{offset:3,placement:"bottom",children:s(b,{direction:"row",gap:"size-100",children:[s(F,{weight:"heavy",color:"inherit",children:[a," ",r]}),e(F,{color:"inherit",children:o})]})})]})}const _u={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SpanHeader_span",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},{alias:"code",args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null}],type:"Span",abstractKey:null};_u.hash="2ba518744a1e825cf02818bfbf16b7a5";function DS(n){var t,i;const a=T.useFragment(_u,n.span),l=p.useMemo(()=>new Date(a.startTime),[a.startTime]);return e(b,{direction:"row",gap:"size-100",width:"100%",height:"100%",alignItems:"center",children:s(b,{direction:"column",gap:"size-50",children:[s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Bi,{spanKind:a.spanKind}),e(F,{size:"L",children:a.name}),e(wt,{statusCode:a.code,css:K`
3012
3012
  font-size: var(--ac-global-font-size-m);
3013
3013
  `})]}),s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[typeof a.latencyMs=="number"?e(Ye,{latencyMs:a.latencyMs,size:"S"}):null,s(F,{color:"text-500",size:"S",children:["at ",fa(l)]}),a.tokenCountTotal?e(Rt,{tokenCountTotal:a.tokenCountTotal,nodeId:a.id,size:"S"}):null,(i=(t=a.costSummary)==null?void 0:t.total)!=null&&i.cost?e(Et,{totalCost:a.costSummary.total.cost,spanNodeId:a.id,size:"S"}):null]})]})})}function LS(n){const{spanId:a,traceId:l}=n,t=ke();return s(J,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(Nl,{})})}),e(kn,{children:e(X,{children:({close:i})=>s(ma,{style:{minHeight:"auto"},onAction:r=>{switch(r){case"COPY_SPAN_ID":{_r(a),t({title:"Span ID Copied",message:`The Span ID ${a} has been copied to your clipboard`});break}case"COPY_TRACE_ID":{_r(l),t({title:"Trace ID Copied",message:`The Trace ID ${l} has been copied to your clipboard`});break}default:Ee()}i()},children:[e(Vl,{id:"COPY_SPAN_ID",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Si,{})}),e(F,{children:"Copy Span ID"})]})}),e(Vl,{id:"COPY_TRACE_ID",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Si,{})}),e(F,{children:"Copy Trace ID"})]})})]})})})]})}const Au=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a=[n];return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SpanAsideAnnotationList_span",selections:[{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[n,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:"configs",args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"config",args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:a,type:"Node",abstractKey:"__isNode"},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:a,storageKey:null},{args:null,kind:"FragmentSpread",name:"AnnotationSummaryGroup"}],type:"Span",abstractKey:null}}();Au.hash="8db090103425204eda8bf8e16580f622";const wu=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SpanAside_span",selections:[n,{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[n,{args:null,kind:"FragmentSpread",name:"AnnotationConfigListProjectAnnotationConfigFragment"},{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:"configs",args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"config",args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[n],type:"Node",abstractKey:"__isNode"},{kind:"InlineFragment",selections:[a,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null}],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"lowerBound",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"upperBound",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null}],type:"ContinuousAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[a],type:"FreeformAnnotationConfig",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:"code",args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{args:null,kind:"FragmentSpread",name:"TraceHeaderRootSpanAnnotationsFragment"},{args:null,kind:"FragmentSpread",name:"SpanAsideAnnotationList_span"},{args:null,kind:"FragmentSpread",name:"AnnotationSummaryGroup"}],type:"Span",abstractKey:null}}();wu.hash="eddd0b1c2288899c1d97948a29207944";const Ru=p.createContext(null);function Zt(){const n=p.useContext(Ru);if(n===null)throw new Error("useSpanFilterCondition must be used within a SpanFilterConditionProvider");return n}function Sr(n){const[a,l]=p.useState(""),t=p.useCallback(r=>{p.startTransition(()=>{l(r)})},[]),i=p.useCallback(r=>{p.startTransition(()=>{a.length>0?l(a+" and "+r):l(r)})},[a]);return e(Ru.Provider,{value:{filterCondition:a,setFilterCondition:t,appendFilterCondition:i},children:n.children})}function dI(n){const{appendFilterCondition:a}=Zt(),{annotation:l,className:t}=n,{name:i,label:r,score:o}=l,d=p.useMemo(()=>{const c=[];return typeof o=="number"?(c.push({filterName:"greater than",filterCondition:`annotations['${i}'].score > ${o}`}),c.push({filterName:"less than",filterCondition:`annotations['${i}'].score < ${o}`}),c.push({filterName:"equals",filterCondition:`annotations['${i}'].score == ${o}`})):r!=null&&(c.push({filterName:"match",filterCondition:`annotations['${i}'].label == "${r}"`}),c.push({filterName:"exclude",filterCondition:`annotations['${i}'].label != "${r}"`})),c},[i,r,o]);return d.length===0?null:e("ul",{className:t,css:K`
3014
3014
  display: flex;
@@ -3113,7 +3113,7 @@ fragment AnnotationSummaryValueFragment_4BTVrq on Project {
3113
3113
  }
3114
3114
  id
3115
3115
  }
3116
- `}}}();Vu.hash="3853ce97f7a810755cb61812e309942d";const zu=p.createContext(null);function Xa(){const n=p.useContext(zu);if(n===null)throw new Error("useStreamState must be used within a StreamStateProvider");return n}function _S({initialFetchKey:n="initial",children:a}){const l=bn(d=>d.traceStreamingEnabled),t=bn(d=>d.setTraceStreamingEnabled),[i,r]=p.useState(n),o=p.useCallback(d=>{p.startTransition(()=>{r(d)})},[r]);return e(zu.Provider,{value:{isStreaming:l,setIsStreaming:t,fetchKey:i,setFetchKey:o},children:a})}function AS({annotationName:n}){var i,r;const{projectId:a}=We(),{timeRange:l}=zt(),t=P.useLazyLoadQuery(Vu,{annotationName:n,id:a,timeRange:{start:(i=l==null?void 0:l.start)==null?void 0:i.toISOString(),end:(r=l==null?void 0:l.end)==null?void 0:r.toISOString()}});return e(RS,{name:n,children:e(wS,{annotationName:n,project:t.project})})}function wS(n){var o,d,c,u;const{project:a,annotationName:l}=n,{fetchKey:t}=Xa(),[i,r]=P.useRefetchableFragment(Mu,a);return p.useEffect(()=>{p.startTransition(()=>{r({},{fetchPolicy:"store-and-network"})})},[t,r]),e(ES,{name:l,meanScore:(o=i==null?void 0:i.spanAnnotationSummary)==null?void 0:o.meanScore,labelFractions:(d=i==null?void 0:i.spanAnnotationSummary)==null?void 0:d.labelFractions,annotationConfig:(u=(c=i==null?void 0:i.annotationConfigs)==null?void 0:c.edges.find(y=>y.node.name===l))==null?void 0:u.node})}function RS({children:n,name:a}){return s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:e(Xe,{maxWidth:"120px",children:a})}),e(p.Suspense,{fallback:e(F,{size:"L",children:"--"}),children:n})]})}const gs={M:{chart:{width:24,height:24},pie:{innerRadius:8,outerRadius:11}},S:{chart:{width:16,height:16},pie:{innerRadius:6,outerRadius:8}},L:{chart:{width:32,height:32},pie:{innerRadius:10,outerRadius:13}}};function Nu(n,a,l,t){if(!t||t.annotationType!=="CATEGORICAL"||!t.values)return n[a%n.length];const r=[...t.values].sort((o,d)=>{const c=o.score??0,u=d.score??0;return(t.optimizationDirection==="MAXIMIZE"?-1:1)*(c-u)}).map(o=>o.label).indexOf(l);return n[r%n.length]}function $u(n){const a=On();return[ho(n),a.default,a.gray600,a.gray400,a.gray200]}function ES({name:n,meanScore:a,labelFractions:l,size:t="M",disableAnimation:i=!1,meanScoreFallback:r,annotationConfig:o}){const d=typeof a=="number",c=Array.isArray(l)&&l.length>0;return!d&&!c?e(F,{size:"L",children:"--"}):s(De,{delay:0,children:[e(et,{children:e(MS,{name:n,meanScore:a,labelFractions:l,size:t,disableAnimation:i,meanScoreFallback:r,annotationConfig:o})}),e(Da,{placement:"bottom",children:e(ju,{annotationName:n,labelFractions:l,meanScore:a,annotationConfig:o})})]})}function MS({name:n,meanScore:a,labelFractions:l,size:t="M",disableAnimation:i,meanScoreFallback:r,annotationConfig:o}){const d=$u(n),c=typeof a=="number",u=l&&l.length>0;if(!c&&!u)return e(F,{size:"L",children:"--"});const y=gs[t].chart,g=gs[t].pie;return s(b,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:"size-100",children:[u?e(Yo,{...y,children:e(Zo,{data:l,dataKey:"fraction",nameKey:"label",cx:"50%",cy:"50%",...g,strokeWidth:0,stroke:"transparent",animationDuration:i?0:void 0,children:l.map((m,f)=>e(Xo,{fill:Nu(d,f,m.label,o)},`cell-${f}`))})}):null,e(Mt,{fallback:r,value:a,size:t==="S"?t:"L"})]})}function ju({annotationName:n,labelFractions:a,meanScore:l,annotationConfig:t}){const i=$u(n),r=typeof l=="number"&&!isNaN(l),o=a&&a.length>0;return e(v,{width:"size-2400",children:s(b,{direction:"column",gap:"size-50",children:[o&&e("ul",{children:a.map((d,c)=>e("li",{children:e(Ge,{color:Nu(i,c,d.label,t),name:d.label,shape:"square",value:fo(d.fraction*100)})},d.label))}),o&&r?e(Vt,{}):null,r?s(b,{direction:"row",justifyContent:"space-between",children:[e(F,{children:"mean score"}),e(Mt,{value:l})]}):null]})})}function Ou({name:n,labelFractions:a,annotationConfig:l}){var d;const t=a.reduce((c,u)=>Math.max(c,u.fraction),0),i=(d=a.find(c=>c.fraction===t))==null?void 0:d.label,r=a.length-1,o=r>0;return i?s(De,{delay:0,children:[e(et,{children:s(b,{direction:"row",alignItems:"center",gap:"size-50",maxWidth:o?"80%":"99%",children:[e(gn,{style:{maxWidth:"100%"},children:e(Xe,{maxWidth:"100%",children:i})}),o&&s(gn,{children:["+ ",r]})]})}),e(Da,{placement:"bottom",children:e(ju,{annotationName:n,labelFractions:a,annotationConfig:l})})]}):null}const cI=n=>Object.values(n.reduce((a,l)=>(a[l.name]?new Date(a[l.name].createdAt)<new Date(l.createdAt)&&(a[l.name]=l):a[l.name]=l,a),{})),Qu=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"annotationInput",variableName:"input"}],concreteType:"SpanAnnotationMutationPayload",kind:"LinkedField",name:"createSpanNote",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanNotesEditorAddNoteMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanNotesEditorAddNoteMutation",selections:a},params:{cacheID:"855aa00f68b36e86f375e7765413ac81",id:null,metadata:{},name:"SpanNotesEditorAddNoteMutation",operationKind:"mutation",text:`mutation SpanNotesEditorAddNoteMutation(
3116
+ `}}}();Vu.hash="3853ce97f7a810755cb61812e309942d";const zu=p.createContext(null);function Xa(){const n=p.useContext(zu);if(n===null)throw new Error("useStreamState must be used within a StreamStateProvider");return n}function _S({initialFetchKey:n="initial",children:a}){const l=bn(d=>d.traceStreamingEnabled),t=bn(d=>d.setTraceStreamingEnabled),[i,r]=p.useState(n),o=p.useCallback(d=>{p.startTransition(()=>{r(d)})},[r]);return e(zu.Provider,{value:{isStreaming:l,setIsStreaming:t,fetchKey:i,setFetchKey:o},children:a})}function AS({annotationName:n}){var i,r;const{projectId:a}=We(),{timeRange:l}=zt(),t=T.useLazyLoadQuery(Vu,{annotationName:n,id:a,timeRange:{start:(i=l==null?void 0:l.start)==null?void 0:i.toISOString(),end:(r=l==null?void 0:l.end)==null?void 0:r.toISOString()}});return e(RS,{name:n,children:e(wS,{annotationName:n,project:t.project})})}function wS(n){var o,d,c,u;const{project:a,annotationName:l}=n,{fetchKey:t}=Xa(),[i,r]=T.useRefetchableFragment(Mu,a);return p.useEffect(()=>{p.startTransition(()=>{r({},{fetchPolicy:"store-and-network"})})},[t,r]),e(ES,{name:l,meanScore:(o=i==null?void 0:i.spanAnnotationSummary)==null?void 0:o.meanScore,labelFractions:(d=i==null?void 0:i.spanAnnotationSummary)==null?void 0:d.labelFractions,annotationConfig:(u=(c=i==null?void 0:i.annotationConfigs)==null?void 0:c.edges.find(y=>y.node.name===l))==null?void 0:u.node})}function RS({children:n,name:a}){return s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:e(Xe,{maxWidth:"120px",children:a})}),e(p.Suspense,{fallback:e(F,{size:"L",children:"--"}),children:n})]})}const gs={M:{chart:{width:24,height:24},pie:{innerRadius:8,outerRadius:11}},S:{chart:{width:16,height:16},pie:{innerRadius:6,outerRadius:8}},L:{chart:{width:32,height:32},pie:{innerRadius:10,outerRadius:13}}};function Nu(n,a,l,t){if(!t||t.annotationType!=="CATEGORICAL"||!t.values)return n[a%n.length];const r=[...t.values].sort((o,d)=>{const c=o.score??0,u=d.score??0;return(t.optimizationDirection==="MAXIMIZE"?-1:1)*(c-u)}).map(o=>o.label).indexOf(l);return n[r%n.length]}function $u(n){const a=On();return[ho(n),a.default,a.gray600,a.gray400,a.gray200]}function ES({name:n,meanScore:a,labelFractions:l,size:t="M",disableAnimation:i=!1,meanScoreFallback:r,annotationConfig:o}){const d=typeof a=="number",c=Array.isArray(l)&&l.length>0;return!d&&!c?e(F,{size:"L",children:"--"}):s(De,{delay:0,children:[e(et,{children:e(MS,{name:n,meanScore:a,labelFractions:l,size:t,disableAnimation:i,meanScoreFallback:r,annotationConfig:o})}),e(Da,{placement:"bottom",children:e(ju,{annotationName:n,labelFractions:l,meanScore:a,annotationConfig:o})})]})}function MS({name:n,meanScore:a,labelFractions:l,size:t="M",disableAnimation:i,meanScoreFallback:r,annotationConfig:o}){const d=$u(n),c=typeof a=="number",u=l&&l.length>0;if(!c&&!u)return e(F,{size:"L",children:"--"});const y=gs[t].chart,g=gs[t].pie;return s(b,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:"size-100",children:[u?e(Yo,{...y,children:e(Zo,{data:l,dataKey:"fraction",nameKey:"label",cx:"50%",cy:"50%",...g,strokeWidth:0,stroke:"transparent",animationDuration:i?0:void 0,children:l.map((m,f)=>e(Xo,{fill:Nu(d,f,m.label,o)},`cell-${f}`))})}):null,e(Mt,{fallback:r,value:a,size:t==="S"?t:"L"})]})}function ju({annotationName:n,labelFractions:a,meanScore:l,annotationConfig:t}){const i=$u(n),r=typeof l=="number"&&!isNaN(l),o=a&&a.length>0;return e(v,{width:"size-2400",children:s(b,{direction:"column",gap:"size-50",children:[o&&e("ul",{children:a.map((d,c)=>e("li",{children:e(Ge,{color:Nu(i,c,d.label,t),name:d.label,shape:"square",value:fo(d.fraction*100)})},d.label))}),o&&r?e(Vt,{}):null,r?s(b,{direction:"row",justifyContent:"space-between",children:[e(F,{children:"mean score"}),e(Mt,{value:l})]}):null]})})}function Ou({name:n,labelFractions:a,annotationConfig:l}){var d;const t=a.reduce((c,u)=>Math.max(c,u.fraction),0),i=(d=a.find(c=>c.fraction===t))==null?void 0:d.label,r=a.length-1,o=r>0;return i?s(De,{delay:0,children:[e(et,{children:s(b,{direction:"row",alignItems:"center",gap:"size-50",maxWidth:o?"80%":"99%",children:[e(gn,{style:{maxWidth:"100%"},children:e(Xe,{maxWidth:"100%",children:i})}),o&&s(gn,{children:["+ ",r]})]})}),e(Da,{placement:"bottom",children:e(ju,{annotationName:n,labelFractions:a,annotationConfig:l})})]}):null}const cI=n=>Object.values(n.reduce((a,l)=>(a[l.name]?new Date(a[l.name].createdAt)<new Date(l.createdAt)&&(a[l.name]=l):a[l.name]=l,a),{})),Qu=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"annotationInput",variableName:"input"}],concreteType:"SpanAnnotationMutationPayload",kind:"LinkedField",name:"createSpanNote",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanNotesEditorAddNoteMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanNotesEditorAddNoteMutation",selections:a},params:{cacheID:"855aa00f68b36e86f375e7765413ac81",id:null,metadata:{},name:"SpanNotesEditorAddNoteMutation",operationKind:"mutation",text:`mutation SpanNotesEditorAddNoteMutation(
3117
3117
  $input: CreateSpanNoteInput!
3118
3118
  ) {
3119
3119
  createSpanNote(annotationInput: $input) {
@@ -3182,9 +3182,9 @@ fragment SpanFeedback_annotations on Span {
3182
3182
  li {
3183
3183
  width: 100%;
3184
3184
  }
3185
- `;function zS(n){var y;const[a,l]=p.useState(0),t=p.useRef(null),i=P.useLazyLoadQuery(Bu,{spanNodeId:n.spanNodeId},{fetchKey:a,fetchPolicy:"store-and-network"}),[r,o]=P.useMutation(Qu),d=g=>{p.startTransition(()=>{r({variables:{input:{note:g,spanId:n.spanNodeId}}}),l(a+1)})},u=(((y=i.span)==null?void 0:y.spanAnnotations)||[]).filter(g=>g.name==="note");return p.useEffect(()=>{t.current&&t.current.scrollIntoView({behavior:"smooth"})},[u]),s(b,{direction:"column",height:"100%",justifyContent:"space-between",children:[s("ul",{css:VS,children:[u.map(g=>{var m,f,h,k;return e("li",{children:e(Wf,{text:g.explanation||"",timestamp:new Date(g.createdAt),userName:((m=g.user)==null?void 0:m.username)||"system",userPicture:(f=g.user)==null?void 0:f.profilePictureUrl,isOutgoing:((h=g.user)==null?void 0:h.id)===((k=i.viewer)==null?void 0:k.id)})},g.id)}),e("div",{ref:t,"aria-hidden":"true"})]}),s($s,{restoreFocus:!0,children:[e(ko,{hotkey:Ti}),e(bo,{onSendMessage:d,placeholder:"Add a note",isSending:o})]})]})}function NS(){return s(b,{direction:"column",height:"100%",justifyContent:"space-between",children:[e(v,{padding:"size-100",children:s(b,{direction:"column",gap:"size-100",height:"100%",children:[e(Nr,{isOutgoing:!1,height:70}),e(Nr,{isOutgoing:!0,height:40})]})}),e(bo,{onSendMessage:()=>{},placeholder:"Add a note"})]})}const oi="s";function $S(n){const a=P.useFragment(wu,n.span),l=p.useRef(null),t=p.useRef(null);return Ta($r,()=>{l.current&&l.current.isCollapsed()&&l.current.expand(50)}),Ta(Ti,()=>{t.current&&t.current.isCollapsed()&&t.current.expand(50)}),s(An,{direction:"vertical",autoSaveId:"span-aside-layout",children:[e(p.Suspense,{children:e(jS,{span:a})}),e(vi,{ref:l,resizable:!0,title:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("span",{children:"Edit Annotations"}),e(jl,{children:$r})]}),panelProps:{order:2,minSize:10},children:e(v,{height:"100%",maxHeight:"100%",children:e(Jf,{projectId:a.project.id,spanNodeId:a.id},a.id)})}),e(vi,{ref:t,resizable:!0,title:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("span",{children:"Notes"}),e(jl,{children:Ti})]}),panelProps:{order:3,minSize:10},children:e(v,{height:"100%",maxHeight:"100%",padding:"size-100",children:e(p.Suspense,{fallback:e(NS,{}),children:e(zS,{spanNodeId:a.id})})})})]})}function jS(n){const a=P.useFragment(Au,n.span),l=p.useRef(null);Ta(oi,()=>{l.current&&l.current.isCollapsed()&&l.current.expand(50)});const t=a.spanAnnotations.length>0;return e(vi,{ref:l,title:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("span",{children:"Annotation Summary"}),e(jl,{children:oi})]}),disabled:!t,panelProps:{order:1,defaultSize:t?20:0,minSize:t?20:0},children:s($s,{children:[e(ko,{hotkey:oi}),e(v,{paddingY:"size-200",paddingX:"size-200",overflow:"auto",maxHeight:"100%",children:e(Nt,{span:a})})]})})}const qu=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SpanFeedback_annotations",selections:[n,{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"identifier",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"source",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"updatedAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null}],storageKey:null}],type:"Span",abstractKey:null}}();qu.hash="9a73b57370acadba7a0398c1439e9893";function OS(){return e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-100",alignItems:"center",children:[e(Kt,{graphicKey:"documents"}),e(F,{children:"No annotations for this span"}),e(cl,{leadingVisual:e(D,{svg:e(_t,{})}),href:"https://arize.com/docs/phoenix/tracing/concepts-tracing/how-to-evaluate-traces",size:"S",children:"How to Annotate"})]})})}const QS=K`
3185
+ `;function zS(n){var y;const[a,l]=p.useState(0),t=p.useRef(null),i=T.useLazyLoadQuery(Bu,{spanNodeId:n.spanNodeId},{fetchKey:a,fetchPolicy:"store-and-network"}),[r,o]=T.useMutation(Qu),d=g=>{p.startTransition(()=>{r({variables:{input:{note:g,spanId:n.spanNodeId}}}),l(a+1)})},u=(((y=i.span)==null?void 0:y.spanAnnotations)||[]).filter(g=>g.name==="note");return p.useEffect(()=>{t.current&&t.current.scrollIntoView({behavior:"smooth"})},[u]),s(b,{direction:"column",height:"100%",justifyContent:"space-between",children:[s("ul",{css:VS,children:[u.map(g=>{var m,f,h,k;return e("li",{children:e(Wf,{text:g.explanation||"",timestamp:new Date(g.createdAt),userName:((m=g.user)==null?void 0:m.username)||"system",userPicture:(f=g.user)==null?void 0:f.profilePictureUrl,isOutgoing:((h=g.user)==null?void 0:h.id)===((k=i.viewer)==null?void 0:k.id)})},g.id)}),e("div",{ref:t,"aria-hidden":"true"})]}),s($s,{restoreFocus:!0,children:[e(ko,{hotkey:Ti}),e(bo,{onSendMessage:d,placeholder:"Add a note",isSending:o})]})]})}function NS(){return s(b,{direction:"column",height:"100%",justifyContent:"space-between",children:[e(v,{padding:"size-100",children:s(b,{direction:"column",gap:"size-100",height:"100%",children:[e(Nr,{isOutgoing:!1,height:70}),e(Nr,{isOutgoing:!0,height:40})]})}),e(bo,{onSendMessage:()=>{},placeholder:"Add a note"})]})}const oi="s";function $S(n){const a=T.useFragment(wu,n.span),l=p.useRef(null),t=p.useRef(null);return Ta($r,()=>{l.current&&l.current.isCollapsed()&&l.current.expand(50)}),Ta(Ti,()=>{t.current&&t.current.isCollapsed()&&t.current.expand(50)}),s(An,{direction:"vertical",autoSaveId:"span-aside-layout",children:[e(p.Suspense,{children:e(jS,{span:a})}),e(vi,{ref:l,resizable:!0,title:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("span",{children:"Edit Annotations"}),e(jl,{children:$r})]}),panelProps:{order:2,minSize:10},children:e(v,{height:"100%",maxHeight:"100%",children:e(Jf,{projectId:a.project.id,spanNodeId:a.id},a.id)})}),e(vi,{ref:t,resizable:!0,title:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("span",{children:"Notes"}),e(jl,{children:Ti})]}),panelProps:{order:3,minSize:10},children:e(v,{height:"100%",maxHeight:"100%",padding:"size-100",children:e(p.Suspense,{fallback:e(NS,{}),children:e(zS,{spanNodeId:a.id})})})})]})}function jS(n){const a=T.useFragment(Au,n.span),l=p.useRef(null);Ta(oi,()=>{l.current&&l.current.isCollapsed()&&l.current.expand(50)});const t=a.spanAnnotations.length>0;return e(vi,{ref:l,title:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("span",{children:"Annotation Summary"}),e(jl,{children:oi})]}),disabled:!t,panelProps:{order:1,defaultSize:t?20:0,minSize:t?20:0},children:s($s,{children:[e(ko,{hotkey:oi}),e(v,{paddingY:"size-200",paddingX:"size-200",overflow:"auto",maxHeight:"100%",children:e(Nt,{span:a})})]})})}const qu=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SpanFeedback_annotations",selections:[n,{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"identifier",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"source",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"updatedAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null}],storageKey:null}],type:"Span",abstractKey:null}}();qu.hash="9a73b57370acadba7a0398c1439e9893";function OS(){return e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-100",alignItems:"center",children:[e(Kt,{graphicKey:"documents"}),e(F,{children:"No annotations for this span"}),e(cl,{leadingVisual:e(D,{svg:e(_t,{})}),href:"https://arize.com/docs/phoenix/tracing/concepts-tracing/how-to-evaluate-traces",size:"S",children:"How to Annotate"})]})})}const QS=K`
3186
3186
  overflow: auto;
3187
- `;function BS({annotations:n,spanNodeId:a}){const l=p.useMemo(()=>n.map(g=>({...g,spanNodeId:a})),[n,a]),t=ke(),i=Fe(),r=p.useMemo(()=>[{header:"name",accessorKey:"name",size:100},{header:"annotator kind",accessorKey:"annotatorKind",size:100,cell:({row:g})=>{const m=g.original.annotatorKind;return e(Xf,{kind:m})}},{header:"user",accessorKey:"user",size:100,cell:({row:g})=>{const m=g.original.user,f=(m==null?void 0:m.username)||"system";return s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Pt,{name:f,profilePictureUrl:(m==null?void 0:m.profilePictureUrl)||null,size:18}),e("span",{children:f})]})}},{header:"label",accessorKey:"label",size:100},{header:"score",accessorKey:"score",size:100},{header:"explanation",accessorKey:"explanation",cell:Zf,size:400},{header:"source",accessorKey:"source",size:100},{header:"identifier",accessorKey:"identifier",size:100},{header:"metadata",accessorKey:"metadata",minSize:100,cell:({row:g})=>{const m=g.original.metadata;return m?e(kl,{json:m,collapseSingleKey:!1}):"--"}},{header:"created at",accessorKey:"createdAt",size:100,cell:we},{header:"updated at",accessorKey:"updatedAt",size:100,cell:we},{header:"",accessorKey:"actions",size:100,cell:({row:g})=>e(Yf,{annotationId:g.original.id,spanNodeId:g.original.spanNodeId,annotationName:g.original.name,onSpanAnnotationActionSuccess:t,onSpanAnnotationActionError:m=>{i({title:"Failed to update span annotation",message:m.message})}})}],[i,t]),[o,d]=p.useState([{id:"createdAt",desc:!0}]),c=Le({columns:r,data:l,getCoreRowModel:_e(),getSortedRowModel:sn(),onSortingChange:d,state:{sorting:o}}),y=c.getRowModel().rows.length===0;return e("div",{css:QS,children:s("table",{css:nn,"data-testid":"span-annotations-table",children:[e("thead",{children:c.getHeaderGroups().map(g=>e("tr",{children:g.headers.map(m=>e("th",{colSpan:m.colSpan,children:m.isPlaceholder?null:e(Y,{children:s("div",{className:m.column.getCanSort()?"sort":"",onClick:m.column.getToggleSortingHandler(),style:{display:"flex",alignItems:"center",left:m.getStart(),width:m.getSize()},children:[e(Xe,{maxWidth:"100%",children:ee(m.column.columnDef.header,m.getContext())}),m.column.getIsSorted()?e(D,{className:"sort-icon",svg:m.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})})},m.id))},g.id))}),y?e(vn,{}):e("tbody",{children:c.getRowModel().rows.map(g=>e("tr",{children:g.getVisibleCells().map(m=>e("td",{style:{width:m.column.getSize()},children:ee(m.column.columnDef.cell,m.getContext())},m.id))},g.id))})]})})}function qS({span:n}){const a=P.useFragment(qu,n),l=a.spanAnnotations;return a.spanAnnotations.length>0?e(BS,{annotations:l,spanNodeId:a.id}):e(OS,{})}function US(n){return n==="__REDACTED__"}const HS=K`
3187
+ `;function BS({annotations:n,spanNodeId:a}){const l=p.useMemo(()=>n.map(g=>({...g,spanNodeId:a})),[n,a]),t=ke(),i=Fe(),r=p.useMemo(()=>[{header:"name",accessorKey:"name",size:100},{header:"annotator kind",accessorKey:"annotatorKind",size:100,cell:({row:g})=>{const m=g.original.annotatorKind;return e(Xf,{kind:m})}},{header:"user",accessorKey:"user",size:100,cell:({row:g})=>{const m=g.original.user,f=(m==null?void 0:m.username)||"system";return s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Pt,{name:f,profilePictureUrl:(m==null?void 0:m.profilePictureUrl)||null,size:18}),e("span",{children:f})]})}},{header:"label",accessorKey:"label",size:100},{header:"score",accessorKey:"score",size:100},{header:"explanation",accessorKey:"explanation",cell:Zf,size:400},{header:"source",accessorKey:"source",size:100},{header:"identifier",accessorKey:"identifier",size:100},{header:"metadata",accessorKey:"metadata",minSize:100,cell:({row:g})=>{const m=g.original.metadata;return m?e(kl,{json:m,collapseSingleKey:!1}):"--"}},{header:"created at",accessorKey:"createdAt",size:100,cell:we},{header:"updated at",accessorKey:"updatedAt",size:100,cell:we},{header:"",accessorKey:"actions",size:100,cell:({row:g})=>e(Yf,{annotationId:g.original.id,spanNodeId:g.original.spanNodeId,annotationName:g.original.name,onSpanAnnotationActionSuccess:t,onSpanAnnotationActionError:m=>{i({title:"Failed to update span annotation",message:m.message})}})}],[i,t]),[o,d]=p.useState([{id:"createdAt",desc:!0}]),c=Le({columns:r,data:l,getCoreRowModel:_e(),getSortedRowModel:sn(),onSortingChange:d,state:{sorting:o}}),y=c.getRowModel().rows.length===0;return e("div",{css:QS,children:s("table",{css:nn,"data-testid":"span-annotations-table",children:[e("thead",{children:c.getHeaderGroups().map(g=>e("tr",{children:g.headers.map(m=>e("th",{colSpan:m.colSpan,children:m.isPlaceholder?null:e(Y,{children:s("div",{className:m.column.getCanSort()?"sort":"",onClick:m.column.getToggleSortingHandler(),style:{display:"flex",alignItems:"center",left:m.getStart(),width:m.getSize()},children:[e(Xe,{maxWidth:"100%",children:ee(m.column.columnDef.header,m.getContext())}),m.column.getIsSorted()?e(D,{className:"sort-icon",svg:m.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})})},m.id))},g.id))}),y?e(vn,{}):e("tbody",{children:c.getRowModel().rows.map(g=>e("tr",{children:g.getVisibleCells().map(m=>e("td",{style:{width:m.column.getSize()},children:ee(m.column.columnDef.cell,m.getContext())},m.id))},g.id))})]})})}function qS({span:n}){const a=T.useFragment(qu,n),l=a.spanAnnotations;return a.spanAnnotations.length>0?e(BS,{annotations:l,spanNodeId:a.id}):e(OS,{})}function US(n){return n==="__REDACTED__"}const HS=K`
3188
3188
  position: relative;
3189
3189
  overflow: hidden;
3190
3190
  width: 200px;
@@ -3247,14 +3247,14 @@ fragment SpanFeedback_annotations on Span {
3247
3247
  id
3248
3248
  }
3249
3249
  }
3250
- `}}}();Hu.hash="9ff195bb3e4302feb10eb48b22dfdcb1";const di={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function JS({spanId:n,onCompleted:a}){const[l,t]=p.useState(null),i=P.useLazyLoadQuery(Hu,{spanId:n},{fetchPolicy:"store-and-network"}),{span:{revision:r}}=i,[o,d]=P.useMutation(Uu),{control:c,setError:u,handleSubmit:y,formState:{isValid:g}}=Qe({defaultValues:{input:JSON.stringify(r==null?void 0:r.input,null,2),output:JSON.stringify(r==null?void 0:r.output,null,2),metadata:JSON.stringify(r==null?void 0:r.metadata,null,2),datasetId:""}}),m=p.useCallback(f=>{if(t(null),!ca(f==null?void 0:f.input))return u("input",{message:"Input must be a valid JSON object"});if(!ca(f==null?void 0:f.output))return u("output",{message:"Output must be a valid JSON object"});if(!ca(f==null?void 0:f.metadata))return u("metadata",{message:"Metadata must be a valid JSON object"});if(!(f!=null&&f.datasetId))return u("datasetId",{message:"Dataset is required"});o({variables:{input:{datasetId:f.datasetId,examples:[{input:JSON.parse(f.input),output:JSON.parse(f.output),metadata:JSON.parse(f.metadata),spanId:n}]}},onCompleted:()=>{a(f.datasetId)},onError:h=>{const k=Re(h);t((k==null?void 0:k[0])??h.message)}})},[o,u,n,a]);return e(X,{children:({close:f})=>s(re,{children:[s(se,{children:[e(oe,{children:"Add Example to Dataset"}),s(ue,{children:[e(E,{variant:"primary",size:"S",isDisabled:!g||d,onPress:()=>{y(m)(),f()},leadingVisual:e(D,{svg:d?e(yn,{}):e(Ca,{})}),children:"Add Example"}),e(me,{slot:"close"})]})]}),e("div",{css:K`
3250
+ `}}}();Hu.hash="9ff195bb3e4302feb10eb48b22dfdcb1";const di={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function JS({spanId:n,onCompleted:a}){const[l,t]=p.useState(null),i=T.useLazyLoadQuery(Hu,{spanId:n},{fetchPolicy:"store-and-network"}),{span:{revision:r}}=i,[o,d]=T.useMutation(Uu),{control:c,setError:u,handleSubmit:y,formState:{isValid:g}}=Qe({defaultValues:{input:JSON.stringify(r==null?void 0:r.input,null,2),output:JSON.stringify(r==null?void 0:r.output,null,2),metadata:JSON.stringify(r==null?void 0:r.metadata,null,2),datasetId:""}}),m=p.useCallback(f=>{if(t(null),!ca(f==null?void 0:f.input))return u("input",{message:"Input must be a valid JSON object"});if(!ca(f==null?void 0:f.output))return u("output",{message:"Output must be a valid JSON object"});if(!ca(f==null?void 0:f.metadata))return u("metadata",{message:"Metadata must be a valid JSON object"});if(!(f!=null&&f.datasetId))return u("datasetId",{message:"Dataset is required"});o({variables:{input:{datasetId:f.datasetId,examples:[{input:JSON.parse(f.input),output:JSON.parse(f.output),metadata:JSON.parse(f.metadata),spanId:n}]}},onCompleted:()=>{a(f.datasetId)},onError:h=>{const k=Re(h);t((k==null?void 0:k[0])??h.message)}})},[o,u,n,a]);return e(X,{children:({close:f})=>s(re,{children:[s(se,{children:[e(oe,{children:"Add Example to Dataset"}),s(ue,{children:[e(E,{variant:"primary",size:"S",isDisabled:!g||d,onPress:()=>{y(m)(),f()},leadingVisual:e(D,{svg:d?e(yn,{}):e(Ca,{})}),children:"Add Example"}),e(me,{slot:"close"})]})]}),e("div",{css:K`
3251
3251
  overflow-y: auto;
3252
3252
  padding: var(--ac-global-dimension-size-400);
3253
3253
  /* Make widths configurable */
3254
3254
  .dataset-picker {
3255
3255
  width: 100%;
3256
3256
  }
3257
- `,children:e(b,{direction:"row",justifyContent:"center",children:e(v,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:s(b,{direction:"column",gap:"size-200",children:[l?e(Ke,{variant:"danger",children:l}):null,e(G,{control:c,name:"datasetId",render:({field:{onChange:h,onBlur:k},fieldState:{invalid:S,error:C}})=>s(b,{direction:"row",gap:"size-100",alignItems:"end",children:[e(So,{isRequired:!0,onSelectionChange:h,onBlur:k,validationState:S?"invalid":"valid",errorMessage:C==null?void 0:C.message,label:"Dataset"}),e(nh,{})]})}),e(G,{control:c,name:"input",render:({field:{onChange:h,onBlur:k,value:S},fieldState:{invalid:C,error:T}})=>s(q,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...di,children:[C?e(Ke,{variant:"danger",banner:!0,children:T==null?void 0:T.message}):null,e(pn,{value:S,onChange:h,onBlur:k})]})}),e(G,{control:c,name:"output",render:({field:{onChange:h,onBlur:k,value:S},fieldState:{invalid:C,error:T}})=>s(q,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...di,backgroundColor:"green-100",borderColor:"green-700",children:[C?e(Ke,{variant:"danger",banner:!0,children:T==null?void 0:T.message}):null,e(pn,{value:S,onChange:h,onBlur:k})]})}),e(G,{control:c,name:"metadata",render:({field:{onChange:h,onBlur:k,value:S},fieldState:{invalid:C,error:T}})=>s(q,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...di,children:[C?e(Ke,{variant:"danger",banner:!0,children:T==null?void 0:T.message}):null,e(pn,{value:S,onChange:h,onBlur:k})]})})]})})})})]})})}const ZS=n=>p.useMemo(()=>en(n),[n]),XS=n=>n.events.some(a=>a.name==="exception"),Ne={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0,bodyStyle:{padding:0}},YS=900,ci=33,ps="e";function ev({spanNodeId:n}){const a=bn(u=>u.isAnnotatingSpans),l=bn(u=>u.setIsAnnotatingSpans),t=p.useRef(null),i=p.useRef(null),r=IS(i),o=r!=null&&r.width?r.width<YS:!0,{span:d}=P.useLazyLoadQuery(Lu,{id:n});if(d.__typename!=="Span")throw new Error("Expected a span, but got a different type"+d.__typename);Ta(ps,()=>{a||l(!0)},{preventDefault:!0});const c=p.useMemo(()=>XS(d),[d]);return s(An,{direction:"horizontal",autoSaveId:"span-details-layout",children:[e(ze,{order:1,children:s(b,{direction:"column",flex:"1 1 auto",height:"100%",ref:i,children:[e(v,{paddingTop:"size-100",paddingBottom:"size-50",paddingStart:"size-150",paddingEnd:"size-200",flex:"none",children:s(b,{direction:"row",alignItems:"center","data-testid":"span-header-row",children:[e(DS,{span:d}),s(b,{flex:"none",direction:"row",alignItems:"center",gap:"size-100",children:[e(ya,{variant:d.spanKind!=="llm"?"default":"primary",leadingVisual:e(D,{svg:e(za,{})}),isDisabled:d.spanKind!=="llm",to:`/playground/spans/${d.id}`,size:"S","aria-label":"Prompt Playground",children:o?null:"Playground"}),e(lv,{span:d,buttonText:o?null:"Add to Dataset"}),e(Mn,{size:"S",isSelected:a,onPress:()=>{l(!a);const u=t.current;u&&u.getSize()<ci&&u.resize(ci)},leadingVisual:e(D,{svg:e(_t,{})}),trailingVisual:!o&&!a&&e(vo,{children:ps}),children:o?null:"Annotate"}),e(LS,{traceId:d.trace.traceId,spanId:d.spanId})]})]})}),s(hn,{children:[s(fn,{children:[e(ge,{id:"info",children:"Info"}),s(ge,{id:"annotations",children:["Annotations ",e(Nn,{children:d.spanAnnotations.length})]}),e(ge,{id:"attributes",children:"Attributes"}),s(ge,{id:"events",children:["Events"," ",e(Nn,{variant:c?"danger":"default",children:d.events.length})]})]}),e(he,{id:"info",children:e(b,{direction:"row",height:"100%",children:e(av,{children:e($t,{children:e(tv,{span:d})})})})}),e(he,{id:"annotations",children:e(qS,{span:d})}),e(he,{id:"attributes",children:e(v,{padding:"size-200",height:"100%",maxHeight:"100%",overflow:"auto",children:e(q,{title:"All Attributes",...Ne,titleExtra:Ju,extra:e(Se,{text:d.attributes}),children:e(Aa,{children:d.attributes})})})}),e(he,{id:"events",children:e(vv,{events:d.events})})]})]})}),a&&e(zn,{css:jt}),a&&e(ze,{order:2,ref:t,defaultSize:ci,minSize:10,collapsible:!0,onCollapse:()=>{l(!1)},children:e($S,{span:d})})]})}const nv=K`
3257
+ `,children:e(b,{direction:"row",justifyContent:"center",children:e(v,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:s(b,{direction:"column",gap:"size-200",children:[l?e(Ke,{variant:"danger",children:l}):null,e(G,{control:c,name:"datasetId",render:({field:{onChange:h,onBlur:k},fieldState:{invalid:S,error:C}})=>s(b,{direction:"row",gap:"size-100",alignItems:"end",children:[e(So,{isRequired:!0,onSelectionChange:h,onBlur:k,validationState:S?"invalid":"valid",errorMessage:C==null?void 0:C.message,label:"Dataset"}),e(nh,{})]})}),e(G,{control:c,name:"input",render:({field:{onChange:h,onBlur:k,value:S},fieldState:{invalid:C,error:P}})=>s(q,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...di,children:[C?e(Ke,{variant:"danger",banner:!0,children:P==null?void 0:P.message}):null,e(pn,{value:S,onChange:h,onBlur:k})]})}),e(G,{control:c,name:"output",render:({field:{onChange:h,onBlur:k,value:S},fieldState:{invalid:C,error:P}})=>s(q,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...di,backgroundColor:"green-100",borderColor:"green-700",children:[C?e(Ke,{variant:"danger",banner:!0,children:P==null?void 0:P.message}):null,e(pn,{value:S,onChange:h,onBlur:k})]})}),e(G,{control:c,name:"metadata",render:({field:{onChange:h,onBlur:k,value:S},fieldState:{invalid:C,error:P}})=>s(q,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...di,children:[C?e(Ke,{variant:"danger",banner:!0,children:P==null?void 0:P.message}):null,e(pn,{value:S,onChange:h,onBlur:k})]})})]})})})})]})})}const ZS=n=>p.useMemo(()=>en(n),[n]),XS=n=>n.events.some(a=>a.name==="exception"),Ne={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0,bodyStyle:{padding:0}},YS=900,ci=33,ps="e";function ev({spanNodeId:n}){const a=bn(u=>u.isAnnotatingSpans),l=bn(u=>u.setIsAnnotatingSpans),t=p.useRef(null),i=p.useRef(null),r=IS(i),o=r!=null&&r.width?r.width<YS:!0,{span:d}=T.useLazyLoadQuery(Lu,{id:n});if(d.__typename!=="Span")throw new Error("Expected a span, but got a different type"+d.__typename);Ta(ps,()=>{a||l(!0)},{preventDefault:!0});const c=p.useMemo(()=>XS(d),[d]);return s(An,{direction:"horizontal",autoSaveId:"span-details-layout",children:[e(ze,{order:1,children:s(b,{direction:"column",flex:"1 1 auto",height:"100%",ref:i,children:[e(v,{paddingTop:"size-100",paddingBottom:"size-50",paddingStart:"size-150",paddingEnd:"size-200",flex:"none",children:s(b,{direction:"row",alignItems:"center","data-testid":"span-header-row",children:[e(DS,{span:d}),s(b,{flex:"none",direction:"row",alignItems:"center",gap:"size-100",children:[e(ya,{variant:d.spanKind!=="llm"?"default":"primary",leadingVisual:e(D,{svg:e(za,{})}),isDisabled:d.spanKind!=="llm",to:`/playground/spans/${d.id}`,size:"S","aria-label":"Prompt Playground",children:o?null:"Playground"}),e(lv,{span:d,buttonText:o?null:"Add to Dataset"}),e(Mn,{size:"S",isSelected:a,onPress:()=>{l(!a);const u=t.current;u&&u.getSize()<ci&&u.resize(ci)},leadingVisual:e(D,{svg:e(_t,{})}),trailingVisual:!o&&!a&&e(vo,{children:ps}),children:o?null:"Annotate"}),e(LS,{traceId:d.trace.traceId,spanId:d.spanId})]})]})}),s(hn,{children:[s(fn,{children:[e(ge,{id:"info",children:"Info"}),s(ge,{id:"annotations",children:["Annotations ",e(Nn,{children:d.spanAnnotations.length})]}),e(ge,{id:"attributes",children:"Attributes"}),s(ge,{id:"events",children:["Events"," ",e(Nn,{variant:c?"danger":"default",children:d.events.length})]})]}),e(he,{id:"info",children:e(b,{direction:"row",height:"100%",children:e(av,{children:e($t,{children:e(tv,{span:d})})})})}),e(he,{id:"annotations",children:e(qS,{span:d})}),e(he,{id:"attributes",children:e(v,{padding:"size-200",height:"100%",maxHeight:"100%",overflow:"auto",children:e(q,{title:"All Attributes",...Ne,titleExtra:Ju,extra:e(Se,{text:d.attributes}),children:e(Aa,{children:d.attributes})})})}),e(he,{id:"events",children:e(vv,{events:d.events})})]})]})}),a&&e(zn,{css:jt}),a&&e(ze,{order:2,ref:t,defaultSize:ci,minSize:10,collapsible:!0,onCollapse:()=>{l(!1)},children:e($S,{span:d})})]})}const nv=K`
3258
3258
  flex: 1 1 auto;
3259
3259
  overflow-y: auto;
3260
3260
  // Overflow fails to take into account padding
@@ -3263,7 +3263,7 @@ fragment SpanFeedback_annotations on Span {
3263
3263
  display: block;
3264
3264
  height: var(--ac-global-dimension-static-size-400);
3265
3265
  }
3266
- `;function av({children:n}){return e("div",{css:nv,"data-testid":"span-info-wrap",children:n})}function lv({span:n,buttonText:a}){const l=ke(),t=be();return s(J,{children:[e(E,{variant:"default",size:"S",leadingVisual:e(D,{svg:e(xt,{})}),children:a}),e(ne,{children:e(Z,{variant:"slideover",size:"L",children:e(p.Suspense,{fallback:e(pe,{}),children:e(JS,{spanId:n.id,onCompleted:i=>{l({title:"Span Added to Dataset",message:"Successfully added span to dataset",action:{text:"View Dataset",onClick:()=>{t(`/datasets/${i}/examples`)}}})}})})})})]})}function tv({span:n}){const{spanKind:a,attributes:l}=n,{json:t,parseError:i}=ZS(l),r=p.useMemo(()=>n.statusMessage?e(Ke,{variant:"danger",title:"Status Description",children:n.statusMessage}):null,[n]);if(i||!t)return e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-200",children:[r,e(Ke,{variant:"warning",title:"Un-parsable attributes",children:`Failed to parse span attributes. ${i instanceof Error?i.message:""}`}),e(q,{...Ne,title:"Attributes",children:e(v,{padding:"size-100",children:l})})]})});let o;switch(a){case"llm":{o=e(iv,{span:n,spanAttributes:t});break}case"retriever":{o=e(rv,{span:n,spanAttributes:t});break}case"reranker":{o=e(sv,{span:n,spanAttributes:t});break}case"embedding":{o=e(ov,{span:n,spanAttributes:t});break}case"tool":{o=e(dv,{span:n,spanAttributes:t});break}default:o=e(Gu,{span:n})}return e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-200",children:[r,o,t!=null&&t.metadata?e(q,{...Ne,title:"Metadata",children:e(Aa,{children:JSON.stringify(t.metadata)})}):null]})})}function iv(n){const{spanAttributes:a,span:l}=n,{input:t,output:i}=l,r=p.useMemo(()=>a[Ae.llm]||null,[a]),o=r==null?void 0:r[tn.provider],d=p.useMemo(()=>{if(r==null)return null;const I=r[tn.model_name];return typeof I=="string"?I:null},[r]),c=p.useMemo(()=>{if(r==null)return[];const I=r[tn.input_messages];return ms(I)?(I==null?void 0:I.map(M=>M[Ae.message]).filter(Boolean))||[]:[]},[r]),u=p.useMemo(()=>{if(r==null)return[];const I=r[tn.tools];return Array.isArray(I)?I==null?void 0:I.map(z=>z[Ae.tool]).filter(Boolean):[]},[r]),y=p.useMemo(()=>u.reduce((I,M)=>(M!=null&&M.json_schema&&I.push(M.json_schema),I),[]),[u]),g=p.useMemo(()=>{if(r==null)return[];const I=r[tn.output_messages];return ms(I)?I.map(M=>M[Ae.message]).filter(Boolean)||[]:[]},[r]),m=p.useMemo(()=>{if(r==null)return[];const I=r[tn.prompts];return lh(I)?I:[]},[r]),f=p.useMemo(()=>{if(r==null)return null;const I=r[tn.prompt_template];return I??null},[r]),h=p.useMemo(()=>r==null?"{}":r[tn.invocation_parameters]||"{}",[r]),k=p.useMemo(()=>{if(d==null)return null;let I=e(Ui,{spanKind:"llm"});const M=o==null?void 0:o.toUpperCase();return typeof M=="string"&&zi(M)&&(I=e(xa,{provider:M})),s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[I,e(F,{size:"M",weight:"heavy",children:d})]})},[d,o]),S=t!=null&&t.value!=null,C=c.length>0,T=y.length>0,_=i!=null&&i.value!=null,x=g.length>0,N=m.length>0,w=Object.keys(en(h).json||{}).length>0,$=f!=null;return s(b,{direction:"column",gap:"size-200",children:[e(q,{collapsible:!0,backgroundColor:"light",borderColor:"light",bodyStyle:{padding:0},titleSeparator:!1,variant:"compact",title:k,children:s(hn,{children:[s(fn,{children:[C&&e(ge,{id:"input-messages",children:"Input Messages"}),T&&e(ge,{id:"tools",children:"Tools"}),S&&e(ge,{id:"input",children:"Input"}),$&&e(ge,{id:"prompt-template",children:"Prompt Template"}),N&&e(ge,{id:"prompts",children:"Prompts"}),w&&e(ge,{id:"invocation-params",children:"Invocation Params"})]}),C&&e(he,{id:"input-messages",children:e(ys,{messages:c})}),T&&e(he,{id:"tools",children:e(gv,{toolSchemas:y})}),S&&e(he,{id:"input",children:e(v,{padding:"size-200",children:e(Rn,{children:e(q,{...Ne,title:"LLM Input",extra:s(b,{direction:"row",gap:"size-100",children:[e(na,{}),e(Se,{text:t.value})]}),children:e(pa,{...t})})})})}),$&&e(he,{id:"prompt-template",children:e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-100",children:[e(v,{borderRadius:"medium",borderColor:"light",backgroundColor:"light",borderWidth:"thin",padding:"size-200",children:s(yt,{text:f.template,children:[e(F,{color:"text-700",fontStyle:"italic",children:"prompt template"}),e(Wu,{children:f.template})]})}),e(v,{borderRadius:"medium",borderColor:"light",backgroundColor:"light",borderWidth:"thin",padding:"size-200",children:s(yt,{text:JSON.stringify(f.variables),children:[e(F,{color:"text-700",fontStyle:"italic",children:"template variables"}),e(Aa,{children:JSON.stringify(f.variables)})]})})]})})}),N&&e(he,{id:"prompts",children:e(pv,{prompts:m})}),w&&e(he,{id:"invocation-params",children:e(yt,{text:h,padding:"size-100",children:e(Aa,{children:h})})})]})}),_||x?e(_i,{...Ne,children:s(hn,{children:[s(fn,{children:[x&&e(ge,{id:"output-messages",children:"Output Messages"}),_&&e(ge,{id:"output",children:"Output"})]}),x&&e(he,{id:"output-messages",children:e(ys,{messages:g})}),_&&e(he,{id:"output",children:e(v,{padding:"size-200",children:e(Rn,{children:e(q,{...Ne,title:"LLM Output",extra:s(b,{direction:"row",gap:"size-100",children:[e(na,{}),e(Se,{text:i.value})]}),children:e(pa,{...i})})})})})]})}):null]})}function rv(n){const{spanAttributes:a,span:l}=n,{input:t}=l,i=p.useMemo(()=>a[Ae.retrieval]||null,[a]),r=p.useMemo(()=>{var g;return i==null?[]:((g=i[Py.documents])==null?void 0:g.map(m=>m[Ae.document]).filter(Boolean))||[]},[i]),o=p.useMemo(()=>l.documentEvaluations.reduce((m,f)=>{const h=f.documentPosition,k=m[h]||[];return{...m,[h]:[...k,f]}},{}),[l.documentEvaluations]),d=t!=null&&t.value!=null,c=d&&t.mimeType==="text",u=r.length>0,y=l.documentRetrievalMetrics.length>0;return s(b,{direction:"column",gap:"size-200",children:[d?e(Rn,{children:e(q,{title:"Input",...Ne,extra:e(b,{direction:"row",gap:"size-100",alignItems:"center",children:c?e(na,{}):e(Se,{text:t.value})}),children:e(pa,{...t})})}):null,u?e(Rn,{children:e(q,{title:"Documents",...Ne,titleExtra:y&&e(b,{direction:"row",alignItems:"center",gap:"size-100",children:l.documentRetrievalMetrics.map(g=>s(Y,{children:[e(Ln,{name:g.evaluationName,metric:"ndcg",score:g.ndcg},"ndcg"),e(Ln,{name:g.evaluationName,metric:"precision",score:g.precision},"precision"),e(Ln,{name:g.evaluationName,metric:"hit",score:g.hit},"hit")]}))}),extra:e(na,{}),children:e("ul",{css:K`
3266
+ `;function av({children:n}){return e("div",{css:nv,"data-testid":"span-info-wrap",children:n})}function lv({span:n,buttonText:a}){const l=ke(),t=be();return s(J,{children:[e(E,{variant:"default",size:"S",leadingVisual:e(D,{svg:e(xt,{})}),children:a}),e(ne,{children:e(Z,{variant:"slideover",size:"L",children:e(p.Suspense,{fallback:e(pe,{}),children:e(JS,{spanId:n.id,onCompleted:i=>{l({title:"Span Added to Dataset",message:"Successfully added span to dataset",action:{text:"View Dataset",onClick:()=>{t(`/datasets/${i}/examples`)}}})}})})})})]})}function tv({span:n}){const{spanKind:a,attributes:l}=n,{json:t,parseError:i}=ZS(l),r=p.useMemo(()=>n.statusMessage?e(Ke,{variant:"danger",title:"Status Description",children:n.statusMessage}):null,[n]);if(i||!t)return e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-200",children:[r,e(Ke,{variant:"warning",title:"Un-parsable attributes",children:`Failed to parse span attributes. ${i instanceof Error?i.message:""}`}),e(q,{...Ne,title:"Attributes",children:e(v,{padding:"size-100",children:l})})]})});let o;switch(a){case"llm":{o=e(iv,{span:n,spanAttributes:t});break}case"retriever":{o=e(rv,{span:n,spanAttributes:t});break}case"reranker":{o=e(sv,{span:n,spanAttributes:t});break}case"embedding":{o=e(ov,{span:n,spanAttributes:t});break}case"tool":{o=e(dv,{span:n,spanAttributes:t});break}default:o=e(Gu,{span:n})}return e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-200",children:[r,o,t!=null&&t.metadata?e(q,{...Ne,title:"Metadata",children:e(Aa,{children:JSON.stringify(t.metadata)})}):null]})})}function iv(n){const{spanAttributes:a,span:l}=n,{input:t,output:i}=l,r=p.useMemo(()=>a[Ae.llm]||null,[a]),o=r==null?void 0:r[tn.provider],d=p.useMemo(()=>{if(r==null)return null;const I=r[tn.model_name];return typeof I=="string"?I:null},[r]),c=p.useMemo(()=>{if(r==null)return[];const I=r[tn.input_messages];return ms(I)?(I==null?void 0:I.map(M=>M[Ae.message]).filter(Boolean))||[]:[]},[r]),u=p.useMemo(()=>{if(r==null)return[];const I=r[tn.tools];return Array.isArray(I)?I==null?void 0:I.map(z=>z[Ae.tool]).filter(Boolean):[]},[r]),y=p.useMemo(()=>u.reduce((I,M)=>(M!=null&&M.json_schema&&I.push(M.json_schema),I),[]),[u]),g=p.useMemo(()=>{if(r==null)return[];const I=r[tn.output_messages];return ms(I)?I.map(M=>M[Ae.message]).filter(Boolean)||[]:[]},[r]),m=p.useMemo(()=>{if(r==null)return[];const I=r[tn.prompts];return lh(I)?I:[]},[r]),f=p.useMemo(()=>{if(r==null)return null;const I=r[tn.prompt_template];return I??null},[r]),h=p.useMemo(()=>r==null?"{}":r[tn.invocation_parameters]||"{}",[r]),k=p.useMemo(()=>{if(d==null)return null;let I=e(Ui,{spanKind:"llm"});const M=o==null?void 0:o.toUpperCase();return typeof M=="string"&&zi(M)&&(I=e(xa,{provider:M})),s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[I,e(F,{size:"M",weight:"heavy",children:d})]})},[d,o]),S=t!=null&&t.value!=null,C=c.length>0,P=y.length>0,L=i!=null&&i.value!=null,x=g.length>0,N=m.length>0,w=Object.keys(en(h).json||{}).length>0,$=f!=null;return s(b,{direction:"column",gap:"size-200",children:[e(q,{collapsible:!0,backgroundColor:"light",borderColor:"light",bodyStyle:{padding:0},titleSeparator:!1,variant:"compact",title:k,children:s(hn,{children:[s(fn,{children:[C&&e(ge,{id:"input-messages",children:"Input Messages"}),P&&e(ge,{id:"tools",children:"Tools"}),S&&e(ge,{id:"input",children:"Input"}),$&&e(ge,{id:"prompt-template",children:"Prompt Template"}),N&&e(ge,{id:"prompts",children:"Prompts"}),w&&e(ge,{id:"invocation-params",children:"Invocation Params"})]}),C&&e(he,{id:"input-messages",children:e(ys,{messages:c})}),P&&e(he,{id:"tools",children:e(gv,{toolSchemas:y})}),S&&e(he,{id:"input",children:e(v,{padding:"size-200",children:e(Rn,{children:e(q,{...Ne,title:"LLM Input",extra:s(b,{direction:"row",gap:"size-100",children:[e(na,{}),e(Se,{text:t.value})]}),children:e(pa,{...t})})})})}),$&&e(he,{id:"prompt-template",children:e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-100",children:[e(v,{borderRadius:"medium",borderColor:"light",backgroundColor:"light",borderWidth:"thin",padding:"size-200",children:s(yt,{text:f.template,children:[e(F,{color:"text-700",fontStyle:"italic",children:"prompt template"}),e(Wu,{children:f.template})]})}),e(v,{borderRadius:"medium",borderColor:"light",backgroundColor:"light",borderWidth:"thin",padding:"size-200",children:s(yt,{text:JSON.stringify(f.variables),children:[e(F,{color:"text-700",fontStyle:"italic",children:"template variables"}),e(Aa,{children:JSON.stringify(f.variables)})]})})]})})}),N&&e(he,{id:"prompts",children:e(pv,{prompts:m})}),w&&e(he,{id:"invocation-params",children:e(yt,{text:h,padding:"size-100",children:e(Aa,{children:h})})})]})}),L||x?e(_i,{...Ne,children:s(hn,{children:[s(fn,{children:[x&&e(ge,{id:"output-messages",children:"Output Messages"}),L&&e(ge,{id:"output",children:"Output"})]}),x&&e(he,{id:"output-messages",children:e(ys,{messages:g})}),L&&e(he,{id:"output",children:e(v,{padding:"size-200",children:e(Rn,{children:e(q,{...Ne,title:"LLM Output",extra:s(b,{direction:"row",gap:"size-100",children:[e(na,{}),e(Se,{text:i.value})]}),children:e(pa,{...i})})})})})]})}):null]})}function rv(n){const{spanAttributes:a,span:l}=n,{input:t}=l,i=p.useMemo(()=>a[Ae.retrieval]||null,[a]),r=p.useMemo(()=>{var g;return i==null?[]:((g=i[Py.documents])==null?void 0:g.map(m=>m[Ae.document]).filter(Boolean))||[]},[i]),o=p.useMemo(()=>l.documentEvaluations.reduce((m,f)=>{const h=f.documentPosition,k=m[h]||[];return{...m,[h]:[...k,f]}},{}),[l.documentEvaluations]),d=t!=null&&t.value!=null,c=d&&t.mimeType==="text",u=r.length>0,y=l.documentRetrievalMetrics.length>0;return s(b,{direction:"column",gap:"size-200",children:[d?e(Rn,{children:e(q,{title:"Input",...Ne,extra:e(b,{direction:"row",gap:"size-100",alignItems:"center",children:c?e(na,{}):e(Se,{text:t.value})}),children:e(pa,{...t})})}):null,u?e(Rn,{children:e(q,{title:"Documents",...Ne,titleExtra:y&&e(b,{direction:"row",alignItems:"center",gap:"size-100",children:l.documentRetrievalMetrics.map(g=>s(Y,{children:[e(Ln,{name:g.evaluationName,metric:"ndcg",score:g.ndcg},"ndcg"),e(Ln,{name:g.evaluationName,metric:"precision",score:g.precision},"precision"),e(Ln,{name:g.evaluationName,metric:"hit",score:g.hit},"hit")]}))}),extra:e(na,{}),children:e("ul",{css:K`
3267
3267
  display: flex;
3268
3268
  flex-direction: column;
3269
3269
  gap: var(--ac-global-dimension-static-size-200);
@@ -3444,7 +3444,7 @@ fragment AnnotationSummaryGroup on Span {
3444
3444
  fragment TraceHeaderRootSpanAnnotationsFragment on Span {
3445
3445
  ...AnnotationSummaryGroup
3446
3446
  }
3447
- `}}}();Xu.hash="1b00ac674154cf26ad588b2f17f82305";function Fv({spanId:n}){const a=P.useLazyLoadQuery(Xu,{spanId:n},{fetchPolicy:"store-and-network"}),l=P.useFragment(Zu,a.span);return e(th,{span:l,renderEmptyState:()=>null})}function Cv(n){const a=n.find(i=>i.parentId==null);if(a)return a;const l=new Set(n.map(i=>i.spanId)),t=n.filter(i=>i.parentId!=null&&!l.has(i.parentId));return t.length===1?t[0]:null}function vr(n){var m,f,h,k;const{traceId:a,projectId:l}=n,[t,i]=Sn(),r=P.useLazyLoadQuery(Du,{traceId:a,id:l},{fetchPolicy:"store-and-network"}),o=((m=r.project.trace)==null?void 0:m.latencyMs)!=null?r.project.trace.latencyMs:null,d=(h=(f=r==null?void 0:r.project)==null?void 0:f.trace)==null?void 0:h.costSummary,c=p.useMemo(()=>{var C;return(((C=r.project.trace)==null?void 0:C.spans.edges)||[]).map(T=>T.span)},[r]),y=t.get(Pn)??c[0].id,g=p.useMemo(()=>Cv(c),[c]);return s("main",{css:K`
3447
+ `}}}();Xu.hash="1b00ac674154cf26ad588b2f17f82305";function Fv({spanId:n}){const a=T.useLazyLoadQuery(Xu,{spanId:n},{fetchPolicy:"store-and-network"}),l=T.useFragment(Zu,a.span);return e(th,{span:l,renderEmptyState:()=>null})}function Cv(n){const a=n.find(i=>i.parentId==null);if(a)return a;const l=new Set(n.map(i=>i.spanId)),t=n.filter(i=>i.parentId!=null&&!l.has(i.parentId));return t.length===1?t[0]:null}function vr(n){var m,f,h,k;const{traceId:a,projectId:l}=n,[t,i]=Sn(),r=T.useLazyLoadQuery(Du,{traceId:a,id:l},{fetchPolicy:"store-and-network"}),o=((m=r.project.trace)==null?void 0:m.latencyMs)!=null?r.project.trace.latencyMs:null,d=(h=(f=r==null?void 0:r.project)==null?void 0:f.trace)==null?void 0:h.costSummary,c=p.useMemo(()=>{var C;return(((C=r.project.trace)==null?void 0:C.spans.edges)||[]).map(P=>P.span)},[r]),y=t.get(Pn)??c[0].id,g=p.useMemo(()=>Cv(c),[c]);return s("main",{css:K`
3448
3448
  flex: 1 1 auto;
3449
3449
  overflow: hidden;
3450
3450
  display: flex;
@@ -3521,15 +3521,15 @@ fragment TraceHeaderRootSpanAnnotationsFragment on Span {
3521
3521
  max-height: 300px;
3522
3522
  overflow-y: auto;
3523
3523
  padding: var(--ac-global-dimension-static-size-200);
3524
- `,children:n})}function _v({getValue:n,collapseSingleKey:a}){const l=n();return e(tm,{children:e(kl,{json:l,space:2,collapseSingleKey:a})})}function Av({isRunning:n,instanceVariables:a,datasetExampleInput:l}){const t=p.useMemo(()=>{const i=Jn(l)?l:{};return a.filter(r=>i[r]==null)},[l,a]);return n?e(pe,{}):t.length===0?null:e(br,{children:`Missing input for variable${t.length>1?"s":""}: ${t.join(", ")}`})}function wv({exampleData:n}){var u,y;const{span:a,content:l,toolCalls:t,errorMessage:i,experimentRunId:r}=n,o=a!=null,d=r!=null,c=p.useMemo(()=>{if(o||d)return s(Y,{children:[d&&s(J,{children:[s(De,{children:[e(da,{size:"S","aria-label":"View experiment run details",children:e(D,{svg:e(Ol,{})})}),s(Cn,{children:[e(dn,{}),"view experiment run"]})]}),e(ne,{children:e(Z,{variant:"slideover",size:"L",children:e(vS,{runId:r})})})]}),o&&e(Y,{children:s(J,{children:[s(De,{children:[e(da,{size:"S","aria-label":"View run trace",children:e(D,{svg:e(At,{})})}),s(Cn,{children:[e(dn,{}),"view run trace"]})]}),e(ne,{children:e(Z,{size:"fullscreen",variant:"slideover",children:e(am,{traceId:a.context.traceId,projectId:a.project.id,title:"Experiment Run Trace"})})})]})})]})},[r,d,o,a]);return s(b,{direction:"column",height:"100%",children:[e(il,{extra:c,children:a?s(b,{direction:"row",gap:"size-100",alignItems:"center",height:"100%",children:[e(Ye,{latencyMs:a.latencyMs||0,size:"S"}),e(Rt,{tokenCountTotal:a.tokenCountTotal||0,nodeId:a.id}),e(Et,{totalCost:((y=(u=a.costSummary)==null?void 0:u.total)==null?void 0:y.cost)||0,spanNodeId:a.id})]}):e(F,{color:"text-500",fontStyle:"italic",children:"generating..."})}),e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-100",children:[i!=null?e(br,{children:i},"error-message"):null,l!=null?e(F,{children:l},"content"):null,t!=null?Object.values(t).map(g=>g==null?null:e(lm,{toolCall:g},g.id)):null]},"content-wrap")})]})}const Rv=p.memo(function({isRunning:a,instanceId:l,exampleId:t,instanceVariables:i,datasetExampleInput:r}){const o=nl(d=>{var c;return(c=d.exampleResponsesMap[l])==null?void 0:c[t]});return o==null?e(Av,{isRunning:a,instanceVariables:i,datasetExampleInput:r}):e(wv,{exampleData:o})});function im({table:n}){return e("tbody",{children:n.getRowModel().rows.map(a=>e("tr",{children:a.getVisibleCells().map(l=>e("td",{style:{padding:0,verticalAlign:"top",width:`calc(var(--col-${l.column.id}-size) * 1px)`,maxWidth:`calc(var(--col-${l.column.id}-size) * 1px)`,minWidth:0,wordBreak:"break-all"},children:ee(l.column.columnDef.cell,l.getContext())},l.id))},a.id))})}const Ev=Kn.memo(im,(n,a)=>n.table.options.data===a.table.options.data);function Mv({datasetId:n}){const a=P.useRelayEnvironment(),l=Q(B=>B.instances),t=Q(B=>B.allInstanceMessages),i=Q(B=>B.templateFormat),r=Q(B=>B.updateInstance),o=nl(B=>B.updateExampleData),d=nl(B=>B.setExampleDataForInstance),c=nl(B=>B.resetExampleData),u=nl(B=>B.appendExampleDataToolCallChunk),y=nl(B=>B.appendExampleDataTextChunk),[g,m]=p.useState(null),[,f]=Sn(),h=l.some(B=>B.activeRunId!==null),k=Wa(B=>B),S=Q(B=>B.markPlaygroundInstanceComplete),C=Kl(),T=Fe(),_=p.useCallback(B=>ye=>{var $e;if(ye==null)return;const fe=ye.chatCompletionOverDataset;switch(fe.__typename){case"ChatCompletionSubscriptionExperiment":r({instanceId:B,patch:{experimentId:fe.experiment.id},dirty:null});break;case"ChatCompletionSubscriptionResult":if(fe.datasetExampleId==null)return;o({instanceId:B,exampleId:fe.datasetExampleId,patch:{span:fe.span,experimentRunId:($e=fe.experimentRun)==null?void 0:$e.id}});break;case"ChatCompletionSubscriptionError":if(fe.datasetExampleId==null)return;o({instanceId:B,exampleId:fe.datasetExampleId,patch:{errorMessage:fe.message}});break;case"TextChunk":if(fe.datasetExampleId==null)return;y({instanceId:B,exampleId:fe.datasetExampleId,textChunk:fe.content});break;case"ToolCallChunk":{if(fe.datasetExampleId==null)return;u({instanceId:B,exampleId:fe.datasetExampleId,toolCallChunk:fe});break}case"%other":return;default:return Ee()}},[y,u,o,r]),[x]=P.useMutation(Fu),N=p.useCallback(B=>(ye,fe)=>{if(S(B),fe){T({title:"Chat completion failed",message:fe[0].message});return}r({instanceId:B,patch:{experimentId:ye.chatCompletionOverDataset.experimentId},dirty:null}),d({instanceId:B,data:Lv(ye.chatCompletionOverDataset)})},[S,T,d,r]);p.useEffect(()=>{if(!h)return;const{instances:B,streaming:ye,updateInstance:fe}=C.getState();if(c(),ye){const $e=[];for(const Ve of B){const{activeRunId:L}=Ve;if(fe({instanceId:Ve.id,patch:{experimentId:null},dirty:null}),L===null)continue;const j={input:Xr({credentials:k,instanceId:Ve.id,playgroundStore:C,datasetId:n})},U={subscription:Cu,variables:j,onNext:_(Ve.id),onCompleted:()=>{S(Ve.id)},onError:on=>{S(Ve.id);const ei=To(on);ei!=null&&ei.length>0?T({title:"Failed to get output",message:ei.join(`
3525
- `),expireMs:1e4}):T({title:"Failed to get output",message:on.message,expireMs:1e4})}},le=Wl.requestSubscription(a,U);$e.push(le)}return()=>{for(const Ve of $e)Ve.dispose()}}else{const $e=[];for(const Ve of B){const{activeRunId:L}=Ve;if(L===null)continue;fe({instanceId:Ve.id,patch:{experimentId:null},dirty:null});const j={input:Xr({credentials:k,instanceId:Ve.id,playgroundStore:C,datasetId:n})},U=x({variables:j,onCompleted:N(Ve.id),onError(le){S(Ve.id);const on=Re(le);on!=null&&on.length>0?T({title:"Failed to get output",message:on.join(`
3526
- `),expireMs:1e4}):T({title:"Failed to get output",message:le.message,expireMs:1e4})}});$e.push(U)}return()=>{for(const Ve of $e)Ve.dispose()}}},[k,n,a,x,h,S,T,N,_,C,c]);const{dataset:w}=P.useLazyLoadQuery(Pu,{datasetId:n}),$=p.useRef(null),{data:I,loadNext:M,hasNext:z,isLoadingNext:A}=P.usePaginationFragment(Tu,w),V=p.useMemo(()=>I.examples.edges.map(B=>{const ye=B.example,fe=ye.revision;return{id:ye.id,input:fe.input,output:fe.output}}),[I]),O=p.useMemo(()=>l.map((B,ye)=>{const fe=Ut(B,t),$e=dd({instance:fe,templateFormat:i});return{id:`instance-${B.id}`,header:()=>s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Hi,{index:ye}),e("span",{children:"Output"})]}),cell:({row:Ve})=>e(Rv,{instanceId:B.id,exampleId:Ve.original.id,isRunning:h,instanceVariables:$e,datasetExampleInput:Ve.original.input}),size:500}}),[h,l,i,t]),H=[{header:"input",accessorKey:"input",cell:({row:B})=>s(Y,{children:[e(il,{extra:s(De,{children:[e(da,{size:"S","aria-label":"View example details",onPress:()=>{f(ye=>(ye.set("exampleId",B.original.id),ye))},children:e(D,{svg:e(Ol,{})})}),s(Cn,{children:[e(dn,{}),"view example"]})]}),children:e(F,{color:"text-500",css:K`
3524
+ `,children:n})}function _v({getValue:n,collapseSingleKey:a}){const l=n();return e(tm,{children:e(kl,{json:l,space:2,collapseSingleKey:a})})}function Av({isRunning:n,instanceVariables:a,datasetExampleInput:l}){const t=p.useMemo(()=>{const i=Jn(l)?l:{};return a.filter(r=>i[r]==null)},[l,a]);return n?e(pe,{}):t.length===0?null:e(br,{children:`Missing input for variable${t.length>1?"s":""}: ${t.join(", ")}`})}function wv({exampleData:n}){var u,y;const{span:a,content:l,toolCalls:t,errorMessage:i,experimentRunId:r}=n,o=a!=null,d=r!=null,c=p.useMemo(()=>{if(o||d)return s(Y,{children:[d&&s(J,{children:[s(De,{children:[e(da,{size:"S","aria-label":"View experiment run details",children:e(D,{svg:e(Ol,{})})}),s(Cn,{children:[e(dn,{}),"view experiment run"]})]}),e(ne,{children:e(Z,{variant:"slideover",size:"L",children:e(vS,{runId:r})})})]}),o&&e(Y,{children:s(J,{children:[s(De,{children:[e(da,{size:"S","aria-label":"View run trace",children:e(D,{svg:e(At,{})})}),s(Cn,{children:[e(dn,{}),"view run trace"]})]}),e(ne,{children:e(Z,{size:"fullscreen",variant:"slideover",children:e(am,{traceId:a.context.traceId,projectId:a.project.id,title:"Experiment Run Trace"})})})]})})]})},[r,d,o,a]);return s(b,{direction:"column",height:"100%",children:[e(il,{extra:c,children:a?s(b,{direction:"row",gap:"size-100",alignItems:"center",height:"100%",children:[e(Ye,{latencyMs:a.latencyMs||0,size:"S"}),e(Rt,{tokenCountTotal:a.tokenCountTotal||0,nodeId:a.id}),e(Et,{totalCost:((y=(u=a.costSummary)==null?void 0:u.total)==null?void 0:y.cost)||0,spanNodeId:a.id})]}):e(F,{color:"text-500",fontStyle:"italic",children:"generating..."})}),e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-100",children:[i!=null?e(br,{children:i},"error-message"):null,l!=null?e(F,{children:l},"content"):null,t!=null?Object.values(t).map(g=>g==null?null:e(lm,{toolCall:g},g.id)):null]},"content-wrap")})]})}const Rv=p.memo(function({isRunning:a,instanceId:l,exampleId:t,instanceVariables:i,datasetExampleInput:r}){const o=nl(d=>{var c;return(c=d.exampleResponsesMap[l])==null?void 0:c[t]});return o==null?e(Av,{isRunning:a,instanceVariables:i,datasetExampleInput:r}):e(wv,{exampleData:o})});function im({table:n}){return e("tbody",{children:n.getRowModel().rows.map(a=>e("tr",{children:a.getVisibleCells().map(l=>e("td",{style:{padding:0,verticalAlign:"top",width:`calc(var(--col-${l.column.id}-size) * 1px)`,maxWidth:`calc(var(--col-${l.column.id}-size) * 1px)`,minWidth:0,wordBreak:"break-all"},children:ee(l.column.columnDef.cell,l.getContext())},l.id))},a.id))})}const Ev=Kn.memo(im,(n,a)=>n.table.options.data===a.table.options.data);function Mv({datasetId:n}){const a=T.useRelayEnvironment(),l=Q(B=>B.instances),t=Q(B=>B.allInstanceMessages),i=Q(B=>B.templateFormat),r=Q(B=>B.updateInstance),o=nl(B=>B.updateExampleData),d=nl(B=>B.setExampleDataForInstance),c=nl(B=>B.resetExampleData),u=nl(B=>B.appendExampleDataToolCallChunk),y=nl(B=>B.appendExampleDataTextChunk),[g,m]=p.useState(null),[,f]=Sn(),h=l.some(B=>B.activeRunId!==null),k=Wa(B=>B),S=Q(B=>B.markPlaygroundInstanceComplete),C=Kl(),P=Fe(),L=p.useCallback(B=>ye=>{var $e;if(ye==null)return;const fe=ye.chatCompletionOverDataset;switch(fe.__typename){case"ChatCompletionSubscriptionExperiment":r({instanceId:B,patch:{experimentId:fe.experiment.id},dirty:null});break;case"ChatCompletionSubscriptionResult":if(fe.datasetExampleId==null)return;o({instanceId:B,exampleId:fe.datasetExampleId,patch:{span:fe.span,experimentRunId:($e=fe.experimentRun)==null?void 0:$e.id}});break;case"ChatCompletionSubscriptionError":if(fe.datasetExampleId==null)return;o({instanceId:B,exampleId:fe.datasetExampleId,patch:{errorMessage:fe.message}});break;case"TextChunk":if(fe.datasetExampleId==null)return;y({instanceId:B,exampleId:fe.datasetExampleId,textChunk:fe.content});break;case"ToolCallChunk":{if(fe.datasetExampleId==null)return;u({instanceId:B,exampleId:fe.datasetExampleId,toolCallChunk:fe});break}case"%other":return;default:return Ee()}},[y,u,o,r]),[x]=T.useMutation(Fu),N=p.useCallback(B=>(ye,fe)=>{if(S(B),fe){P({title:"Chat completion failed",message:fe[0].message});return}r({instanceId:B,patch:{experimentId:ye.chatCompletionOverDataset.experimentId},dirty:null}),d({instanceId:B,data:Lv(ye.chatCompletionOverDataset)})},[S,P,d,r]);p.useEffect(()=>{if(!h)return;const{instances:B,streaming:ye,updateInstance:fe}=C.getState();if(c(),ye){const $e=[];for(const Ve of B){const{activeRunId:_}=Ve;if(fe({instanceId:Ve.id,patch:{experimentId:null},dirty:null}),_===null)continue;const j={input:Xr({credentials:k,instanceId:Ve.id,playgroundStore:C,datasetId:n})},U={subscription:Cu,variables:j,onNext:L(Ve.id),onCompleted:()=>{S(Ve.id)},onError:on=>{S(Ve.id);const ei=To(on);ei!=null&&ei.length>0?P({title:"Failed to get output",message:ei.join(`
3525
+ `),expireMs:1e4}):P({title:"Failed to get output",message:on.message,expireMs:1e4})}},le=Wl.requestSubscription(a,U);$e.push(le)}return()=>{for(const Ve of $e)Ve.dispose()}}else{const $e=[];for(const Ve of B){const{activeRunId:_}=Ve;if(_===null)continue;fe({instanceId:Ve.id,patch:{experimentId:null},dirty:null});const j={input:Xr({credentials:k,instanceId:Ve.id,playgroundStore:C,datasetId:n})},U=x({variables:j,onCompleted:N(Ve.id),onError(le){S(Ve.id);const on=Re(le);on!=null&&on.length>0?P({title:"Failed to get output",message:on.join(`
3526
+ `),expireMs:1e4}):P({title:"Failed to get output",message:le.message,expireMs:1e4})}});$e.push(U)}return()=>{for(const Ve of $e)Ve.dispose()}}},[k,n,a,x,h,S,P,N,L,C,c]);const{dataset:w}=T.useLazyLoadQuery(Pu,{datasetId:n}),$=p.useRef(null),{data:I,loadNext:M,hasNext:z,isLoadingNext:A}=T.usePaginationFragment(Tu,w),V=p.useMemo(()=>I.examples.edges.map(B=>{const ye=B.example,fe=ye.revision;return{id:ye.id,input:fe.input,output:fe.output}}),[I]),O=p.useMemo(()=>l.map((B,ye)=>{const fe=Ut(B,t),$e=dd({instance:fe,templateFormat:i});return{id:`instance-${B.id}`,header:()=>s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Hi,{index:ye}),e("span",{children:"Output"})]}),cell:({row:Ve})=>e(Rv,{instanceId:B.id,exampleId:Ve.original.id,isRunning:h,instanceVariables:$e,datasetExampleInput:Ve.original.input}),size:500}}),[h,l,i,t]),H=[{header:"input",accessorKey:"input",cell:({row:B})=>s(Y,{children:[e(il,{extra:s(De,{children:[e(da,{size:"S","aria-label":"View example details",onPress:()=>{f(ye=>(ye.set("exampleId",B.original.id),ye))},children:e(D,{svg:e(Ol,{})})}),s(Cn,{children:[e(dn,{}),"view example"]})]}),children:e(F,{color:"text-500",css:K`
3527
3527
  white-space: nowrap;
3528
3528
  `,children:`Example ${B.original.id}`})}),e(tm,{children:e(kl,{json:B.original.input,disableTitle:!0,space:2,collapseSingleKey:!1})})]}),size:200},{header:"reference output",accessorKey:"output",cell:B=>s(Y,{children:[e(il,{children:e(F,{color:"text-500",children:"reference output"})}),e(_v,{...B,collapseSingleKey:!0})]}),size:200},...O],te=Le({columns:H,data:V,getCoreRowModel:_e(),columnResizeMode:"onChange"}),Fn=te.getRowModel().rows.length===0,mn=p.useCallback(B=>{if(B){const{scrollHeight:ye,scrollTop:fe,clientHeight:$e}=B;ye-fe-$e<300&&!A&&z&&M(Dv)}},[z,A,M]),En=Kn.useMemo(()=>{const B=te.getFlatHeaders(),ye={};for(let fe=0;fe<B.length;fe++){const $e=B[fe];ye[`--header-${$e.id}-size`]=$e.getSize(),ye[`--col-${$e.column.id}-size`]=$e.column.getSize()}return ye},[te.getState().columnSizingInfo,te.getState().columnSizing,H.length]);return s("div",{css:K`
3529
3529
  flex: 1 1 auto;
3530
3530
  overflow: auto;
3531
3531
  height: 100%;
3532
- `,ref:$,onScroll:B=>mn(B.target),children:[s("table",{css:K(nn,Ko),style:{...En,width:te.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:te.getHeaderGroups().map(B=>e("tr",{children:B.headers.map(ye=>s("th",{style:{width:`calc(var(--header-${ye==null?void 0:ye.id}-size) * 1px)`},children:[e("div",{children:ee(ye.column.columnDef.header,ye.getContext())}),e("div",{onMouseDown:ye.getResizeHandler(),onTouchStart:ye.getResizeHandler(),className:`resizer ${ye.column.getIsResizing()?"isResizing":""}`})]},ye.id))},B.id))}),Fn?e(vn,{}):te.getState().columnSizingInfo.isResizingColumn?e(Ev,{table:te}):e(im,{table:te})]}),e(pl,{isDismissable:!0,type:"slideOver",onDismiss:()=>{m(null),f(B=>(B.delete(Pn),B))},children:g})]})}function Vv({datasetId:n}){const a=Q(o=>o.instances),l=a.some(o=>o.activeRunId!=null),t=p.useMemo(()=>a.map(o=>o.experimentId).filter(o=>o!=null),[a]),i=be(),r=P.useLazyLoadQuery(vu,{datasetId:n});return s(b,{direction:"column",height:"100%",children:[e(v,{flex:"none",backgroundColor:"dark",paddingX:"size-200",paddingY:"size-100",borderBottomColor:"light",borderBottomWidth:"thin",height:50,children:s(b,{justifyContent:"space-between",alignItems:"center",height:"100%",children:[s(b,{gap:"size-100",children:[s(F,{children:[r.dataset.name??"Dataset"," results"]}),r.dataset.exampleCount!=null?s(F,{fontStyle:"italic",color:"text-700",children:[r.dataset.exampleCount," examples"]}):null]}),t.length>0&&s(E,{size:"S",isDisabled:l,leadingVisual:e(D,{svg:l?e(yn,{}):e(Po,{})}),onPress:()=>{const o=t[0],d=t.slice(1),c=d.length>0?`?${d.map(u=>`experimentId=${u}`).join("&")}`:"";i(`/datasets/${n}/compare/${o}${c}`)},children:["View Experiment",a.length>1?"s":""]})]})}),e(SS,{children:e(Mv,{datasetId:n})})]})}const bs=30,zv=K`
3532
+ `,ref:$,onScroll:B=>mn(B.target),children:[s("table",{css:K(nn,Ko),style:{...En,width:te.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:te.getHeaderGroups().map(B=>e("tr",{children:B.headers.map(ye=>s("th",{style:{width:`calc(var(--header-${ye==null?void 0:ye.id}-size) * 1px)`},children:[e("div",{children:ee(ye.column.columnDef.header,ye.getContext())}),e("div",{onMouseDown:ye.getResizeHandler(),onTouchStart:ye.getResizeHandler(),className:`resizer ${ye.column.getIsResizing()?"isResizing":""}`})]},ye.id))},B.id))}),Fn?e(vn,{}):te.getState().columnSizingInfo.isResizingColumn?e(Ev,{table:te}):e(im,{table:te})]}),e(pl,{isDismissable:!0,type:"slideOver",onDismiss:()=>{m(null),f(B=>(B.delete(Pn),B))},children:g})]})}function Vv({datasetId:n}){const a=Q(o=>o.instances),l=a.some(o=>o.activeRunId!=null),t=p.useMemo(()=>a.map(o=>o.experimentId).filter(o=>o!=null),[a]),i=be(),r=T.useLazyLoadQuery(vu,{datasetId:n});return s(b,{direction:"column",height:"100%",children:[e(v,{flex:"none",backgroundColor:"dark",paddingX:"size-200",paddingY:"size-100",borderBottomColor:"light",borderBottomWidth:"thin",height:50,children:s(b,{justifyContent:"space-between",alignItems:"center",height:"100%",children:[s(b,{gap:"size-100",children:[s(F,{children:[r.dataset.name??"Dataset"," results"]}),r.dataset.exampleCount!=null?s(F,{fontStyle:"italic",color:"text-700",children:[r.dataset.exampleCount," examples"]}):null]}),t.length>0&&s(E,{size:"S",isDisabled:l,leadingVisual:e(D,{svg:l?e(yn,{}):e(Po,{})}),onPress:()=>{const o=`?${t.map(d=>`experimentId=${d}`).join("&")}`;i(`/datasets/${n}/compare${o}`)},children:["View Experiment",a.length>1?"s":""]})]})}),e(SS,{children:e(Mv,{datasetId:n})})]})}const bs=30,zv=K`
3533
3533
  display: flex;
3534
3534
  direction: row;
3535
3535
  align-items: center;
@@ -3619,9 +3619,9 @@ fragment TraceHeaderRootSpanAnnotationsFragment on Span {
3619
3619
  }
3620
3620
  }
3621
3621
  }
3622
- `}}}();om.hash="ea9edc5ec856a42e5e53663d6a570de1";function Uv({spanId:n}){var r,o;const[,a]=Sn(),l=P.useLazyLoadQuery(om,{spanId:n},{fetchPolicy:"store-and-network"});if(!l.span||!l.span.trace||!l.span.trace.project)return null;const{trace:t}=l.span,i=(o=(r=l.span.costSummary)==null?void 0:r.total)==null?void 0:o.cost;return e(v,{borderTopColor:"light",borderTopWidth:"thin",paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",children:s(b,{direction:"row",gap:"size-200",justifyContent:"space-between",children:[s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Ye,{size:"S",latencyMs:l.span.latencyMs||0}),e(Rt,{tokenCountTotal:l.span.tokenCountTotal||0,nodeId:l.span.id,size:"S"}),i!=null&&e(Et,{totalCost:i,spanNodeId:l.span.id,size:"S"})]}),s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[s(J,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(Va,{})}),children:"Annotate"}),e(ne,{children:e(Z,{variant:"slideover",size:"S",children:e(xo,{spanNodeId:n,projectId:t.project.id})})})]}),s(J,{onOpenChange:d=>{d||a(c=>(c.delete(Pn),c))},children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(At,{})}),children:"View Trace"}),e(ne,{children:e(Z,{variant:"slideover",size:"fullscreen",children:e(p.Suspense,{fallback:e(pe,{}),children:e(am,{traceId:t.traceId,projectId:t.project.id,title:"Playground Trace"})})})})]})]})]})})}function Hv({index:n,title:a}){return s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Hi,{index:n}),e("span",{children:a})]})}const Gv=n=>Jn(n)&&"id"in n&&(typeof n.id=="string"||typeof n.id=="number")?n.id:Jn(n)&&"toolUse"in n&&Jn(n.toolUse)&&"toolUseId"in n.toolUse&&(typeof n.toolUse.toolUseId=="string"||typeof n.toolUse.toolUseId=="number")?n.toolUse.toolUseId:JSON.stringify(n);function Ss({message:n}){const{role:a,content:l,toolCalls:t}=n,i=at(a);return s(q,{title:a,...i,variant:"compact",extra:e(na,{}),bodyStyle:{padding:0},children:[l!=null&&!Array.isArray(l)&&e(Ga,{children:l}),e(v,{paddingX:"size-200",paddingY:"size-200",borderTopWidth:"thin",borderTopColor:"blue-500",children:t&&t.length>0?t.map(r=>e(lm,{toolCall:r},Gv(r))):null})]})}function Wv({content:n,partialToolCalls:a}){return h0(n)?n.map((l,t)=>e(Ss,{message:l},t)):typeof n=="string"||a.length>0?e(Ss,{message:{id:Fa(),content:n,role:"ai",toolCalls:a}}):"click run to see output"}function Jv(n){const a=n.playgroundInstanceId,l=Q(z=>z.instances),t=Q(z=>z.streaming),i=Wa(z=>z),r=Q(z=>z.instances.findIndex(A=>A.id===a)),o=l.find(z=>z.id===a),d=Q(z=>z.updateInstance),[c,u]=p.useState(null),y=Q(z=>z.markPlaygroundInstanceComplete),g=P.useRelayEnvironment(),m=Kl();if(!o)throw new Error(`No instance found for id ${a}`);if(o.template.__type!=="chat")throw new Error("We only support chat templates for now");const[f,h]=p.useState(!1),[k]=P.useMutation(rm),S=(o==null?void 0:o.activeRunId)!=null,C=Fe(),T=p.useCallback(({title:z,message:A,...V})=>{u({title:z,message:A}),C({title:z,message:A,...V})},[C]),[_,x]=p.useState(o.output),[N,w]=p.useState([]),$=p.useCallback(({chatCompletion:z})=>{if(h(!1),z.__typename==="TextChunk"){const A=z.content;x(V=>V!=null?V+A:A);return}else if(z.__typename==="ToolCallChunk"){w(A=>{let V=!1;const O=A.map(H=>H.id===z.id?(V=!0,{...H,function:{...H.function,arguments:H.function.arguments+z.function.arguments}}):H);return V||O.push({id:z.id,function:{name:z.function.name,arguments:z.function.arguments}}),O});return}if(z.__typename==="ChatCompletionSubscriptionResult"&&z.span!=null){d({instanceId:a,patch:{spanId:z.span.id},dirty:null});return}z.__typename==="ChatCompletionSubscriptionError"&&(y(n.playgroundInstanceId),z.message!=null&&T({title:"Chat completion failed",message:z.message}))},[a,y,T,n.playgroundInstanceId,d]),I=p.useCallback((z,A)=>{if(h(!1),y(n.playgroundInstanceId),d({instanceId:a,patch:{spanId:z.chatCompletion.span.id},dirty:null}),A){T({title:"Chat completion failed",message:A[0].message});return}if(z.chatCompletion.errorMessage!=null){T({title:"Chat completion failed",message:z.chatCompletion.errorMessage});return}x(z.chatCompletion.content??void 0),w(z.chatCompletion.toolCalls)},[a,y,T,n.playgroundInstanceId,d]),M=p.useCallback(()=>{x(void 0),w([]),u(null),d({instanceId:a,patch:{spanId:null},dirty:null})},[a,d]);return p.useEffect(()=>{if(!S){h(!1);return}h(!0),M();const z=P0({playgroundStore:m,instanceId:a,credentials:i});if(t){const V={subscription:sm,variables:{input:z},onNext:H=>{H&&$(H)},onCompleted:()=>{h(!1),y(n.playgroundInstanceId)},onError:H=>{h(!1),y(n.playgroundInstanceId);const te=To(H);te!=null&&te.length>0?T({title:"Failed to get output",message:te.join(`
3623
- `)}):T({title:"Failed to get output",message:H.message})}};return Wl.requestSubscription(g,V).dispose}return k({variables:{input:z},onCompleted:I,onError(V){h(!1),y(n.playgroundInstanceId);const O=Re(V);O!=null&&O.length>0?T({title:"Failed to get output",message:O.join(`
3624
- `)}):T({title:"Failed to get output",message:V.message})}}).dispose},[M,i,g,k,S,a,y,T,I,$,m,n.playgroundInstanceId,t,d]),e(q,{title:e(Hv,{index:r,title:"Output"}),extra:_!=null||(N==null?void 0:N.length)>0?e(qv,{outputContent:_,toolCalls:N,instance:o,cleanupOutput:M}):null,titleSeparator:!0,collapsible:!0,variant:"compact",bodyStyle:{padding:0},children:f?e(v,{padding:"size-200",children:e(pe,{message:"Running..."})}):c?e(v,{padding:"size-200",children:e(br,{children:c.message})}):s(Y,{children:[e(v,{padding:"size-200",children:e(Rn,{children:e(Wv,{content:_,partialToolCalls:N})})}),e(p.Suspense,{children:o.spanId?e(Uv,{spanId:o.spanId}):null})]})})}function Zv(){return p.useMemo(()=>window.navigator.userAgent.toLowerCase().includes("mac")?"Cmd":"Ctrl",[])}function Xv(){const n=Zv(),a=Q(r=>r.runPlaygroundInstances),l=Q(r=>r.cancelPlaygroundInstances),t=Q(r=>r.instances.some(o=>o.activeRunId!=null)),i=p.useCallback(()=>{t?l():a()},[t,l,a]);return Ta("mod+enter",r=>{r.preventDefault(),r.stopPropagation(),i()},{enableOnFormTags:!0,enableOnContentEditable:!0,preventDefault:!0}),e(E,{variant:"primary",leadingVisual:e(D,{svg:t?e(yn,{}):e(za,{})}),size:"S",onPress:()=>{i()},trailingVisual:s(vo,{children:[e(Fi,{children:n}),e("span",{"aria-hidden":"true",children:n==="Cmd"?"⌘":"Ctrl"}),e(Fi,{children:"enter"}),e("span",{"aria-hidden":"true",children:"⏎"})]}),children:t?"Cancel":"Run"})}function Yv(){const n=Q(i=>i.streaming),a=Q(i=>i.setStreaming),l=bn(i=>i.setPlaygroundStreamingEnabled),t=Q(i=>i.instances.some(r=>r.activeRunId!=null));return e(Ea,{labelPlacement:"start",isSelected:n,onChange:()=>{a(!n),l(!n)},isDisabled:t,children:"Stream"})}const dm=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"Prompt",kind:"LinkedField",name:"createChatPromptVersion",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UpsertPromptFromTemplateDialogUpdateMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UpsertPromptFromTemplateDialogUpdateMutation",selections:a},params:{cacheID:"5560d38314208ef482b716e9817358fe",id:null,metadata:{},name:"UpsertPromptFromTemplateDialogUpdateMutation",operationKind:"mutation",text:`mutation UpsertPromptFromTemplateDialogUpdateMutation(
3622
+ `}}}();om.hash="ea9edc5ec856a42e5e53663d6a570de1";function Uv({spanId:n}){var r,o;const[,a]=Sn(),l=T.useLazyLoadQuery(om,{spanId:n},{fetchPolicy:"store-and-network"});if(!l.span||!l.span.trace||!l.span.trace.project)return null;const{trace:t}=l.span,i=(o=(r=l.span.costSummary)==null?void 0:r.total)==null?void 0:o.cost;return e(v,{borderTopColor:"light",borderTopWidth:"thin",paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",children:s(b,{direction:"row",gap:"size-200",justifyContent:"space-between",children:[s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Ye,{size:"S",latencyMs:l.span.latencyMs||0}),e(Rt,{tokenCountTotal:l.span.tokenCountTotal||0,nodeId:l.span.id,size:"S"}),i!=null&&e(Et,{totalCost:i,spanNodeId:l.span.id,size:"S"})]}),s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[s(J,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(Va,{})}),children:"Annotate"}),e(ne,{children:e(Z,{variant:"slideover",size:"S",children:e(xo,{spanNodeId:n,projectId:t.project.id})})})]}),s(J,{onOpenChange:d=>{d||a(c=>(c.delete(Pn),c))},children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(At,{})}),children:"View Trace"}),e(ne,{children:e(Z,{variant:"slideover",size:"fullscreen",children:e(p.Suspense,{fallback:e(pe,{}),children:e(am,{traceId:t.traceId,projectId:t.project.id,title:"Playground Trace"})})})})]})]})]})})}function Hv({index:n,title:a}){return s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Hi,{index:n}),e("span",{children:a})]})}const Gv=n=>Jn(n)&&"id"in n&&(typeof n.id=="string"||typeof n.id=="number")?n.id:Jn(n)&&"toolUse"in n&&Jn(n.toolUse)&&"toolUseId"in n.toolUse&&(typeof n.toolUse.toolUseId=="string"||typeof n.toolUse.toolUseId=="number")?n.toolUse.toolUseId:JSON.stringify(n);function Ss({message:n}){const{role:a,content:l,toolCalls:t}=n,i=at(a);return s(q,{title:a,...i,variant:"compact",extra:e(na,{}),bodyStyle:{padding:0},children:[l!=null&&!Array.isArray(l)&&e(Ga,{children:l}),e(v,{paddingX:"size-200",paddingY:"size-200",borderTopWidth:"thin",borderTopColor:"blue-500",children:t&&t.length>0?t.map(r=>e(lm,{toolCall:r},Gv(r))):null})]})}function Wv({content:n,partialToolCalls:a}){return h0(n)?n.map((l,t)=>e(Ss,{message:l},t)):typeof n=="string"||a.length>0?e(Ss,{message:{id:Fa(),content:n,role:"ai",toolCalls:a}}):"click run to see output"}function Jv(n){const a=n.playgroundInstanceId,l=Q(z=>z.instances),t=Q(z=>z.streaming),i=Wa(z=>z),r=Q(z=>z.instances.findIndex(A=>A.id===a)),o=l.find(z=>z.id===a),d=Q(z=>z.updateInstance),[c,u]=p.useState(null),y=Q(z=>z.markPlaygroundInstanceComplete),g=T.useRelayEnvironment(),m=Kl();if(!o)throw new Error(`No instance found for id ${a}`);if(o.template.__type!=="chat")throw new Error("We only support chat templates for now");const[f,h]=p.useState(!1),[k]=T.useMutation(rm),S=(o==null?void 0:o.activeRunId)!=null,C=Fe(),P=p.useCallback(({title:z,message:A,...V})=>{u({title:z,message:A}),C({title:z,message:A,...V})},[C]),[L,x]=p.useState(o.output),[N,w]=p.useState([]),$=p.useCallback(({chatCompletion:z})=>{if(h(!1),z.__typename==="TextChunk"){const A=z.content;x(V=>V!=null?V+A:A);return}else if(z.__typename==="ToolCallChunk"){w(A=>{let V=!1;const O=A.map(H=>H.id===z.id?(V=!0,{...H,function:{...H.function,arguments:H.function.arguments+z.function.arguments}}):H);return V||O.push({id:z.id,function:{name:z.function.name,arguments:z.function.arguments}}),O});return}if(z.__typename==="ChatCompletionSubscriptionResult"&&z.span!=null){d({instanceId:a,patch:{spanId:z.span.id},dirty:null});return}z.__typename==="ChatCompletionSubscriptionError"&&(y(n.playgroundInstanceId),z.message!=null&&P({title:"Chat completion failed",message:z.message}))},[a,y,P,n.playgroundInstanceId,d]),I=p.useCallback((z,A)=>{if(h(!1),y(n.playgroundInstanceId),d({instanceId:a,patch:{spanId:z.chatCompletion.span.id},dirty:null}),A){P({title:"Chat completion failed",message:A[0].message});return}if(z.chatCompletion.errorMessage!=null){P({title:"Chat completion failed",message:z.chatCompletion.errorMessage});return}x(z.chatCompletion.content??void 0),w(z.chatCompletion.toolCalls)},[a,y,P,n.playgroundInstanceId,d]),M=p.useCallback(()=>{x(void 0),w([]),u(null),d({instanceId:a,patch:{spanId:null},dirty:null})},[a,d]);return p.useEffect(()=>{if(!S){h(!1);return}h(!0),M();const z=P0({playgroundStore:m,instanceId:a,credentials:i});if(t){const V={subscription:sm,variables:{input:z},onNext:H=>{H&&$(H)},onCompleted:()=>{h(!1),y(n.playgroundInstanceId)},onError:H=>{h(!1),y(n.playgroundInstanceId);const te=To(H);te!=null&&te.length>0?P({title:"Failed to get output",message:te.join(`
3623
+ `)}):P({title:"Failed to get output",message:H.message})}};return Wl.requestSubscription(g,V).dispose}return k({variables:{input:z},onCompleted:I,onError(V){h(!1),y(n.playgroundInstanceId);const O=Re(V);O!=null&&O.length>0?P({title:"Failed to get output",message:O.join(`
3624
+ `)}):P({title:"Failed to get output",message:V.message})}}).dispose},[M,i,g,k,S,a,y,P,I,$,m,n.playgroundInstanceId,t,d]),e(q,{title:e(Hv,{index:r,title:"Output"}),extra:L!=null||(N==null?void 0:N.length)>0?e(qv,{outputContent:L,toolCalls:N,instance:o,cleanupOutput:M}):null,titleSeparator:!0,collapsible:!0,variant:"compact",bodyStyle:{padding:0},children:f?e(v,{padding:"size-200",children:e(pe,{message:"Running..."})}):c?e(v,{padding:"size-200",children:e(br,{children:c.message})}):s(Y,{children:[e(v,{padding:"size-200",children:e(Rn,{children:e(Wv,{content:L,partialToolCalls:N})})}),e(p.Suspense,{children:o.spanId?e(Uv,{spanId:o.spanId}):null})]})})}function Zv(){return p.useMemo(()=>window.navigator.userAgent.toLowerCase().includes("mac")?"Cmd":"Ctrl",[])}function Xv(){const n=Zv(),a=Q(r=>r.runPlaygroundInstances),l=Q(r=>r.cancelPlaygroundInstances),t=Q(r=>r.instances.some(o=>o.activeRunId!=null)),i=p.useCallback(()=>{t?l():a()},[t,l,a]);return Ta("mod+enter",r=>{r.preventDefault(),r.stopPropagation(),i()},{enableOnFormTags:!0,enableOnContentEditable:!0,preventDefault:!0}),e(E,{variant:"primary",leadingVisual:e(D,{svg:t?e(yn,{}):e(za,{})}),size:"S",onPress:()=>{i()},trailingVisual:s(vo,{children:[e(Fi,{children:n}),e("span",{"aria-hidden":"true",children:n==="Cmd"?"⌘":"Ctrl"}),e(Fi,{children:"enter"}),e("span",{"aria-hidden":"true",children:"⏎"})]}),children:t?"Cancel":"Run"})}function Yv(){const n=Q(i=>i.streaming),a=Q(i=>i.setStreaming),l=bn(i=>i.setPlaygroundStreamingEnabled),t=Q(i=>i.instances.some(r=>r.activeRunId!=null));return e(Ea,{labelPlacement:"start",isSelected:n,onChange:()=>{a(!n),l(!n)},isDisabled:t,children:"Stream"})}const dm=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"Prompt",kind:"LinkedField",name:"createChatPromptVersion",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UpsertPromptFromTemplateDialogUpdateMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UpsertPromptFromTemplateDialogUpdateMutation",selections:a},params:{cacheID:"5560d38314208ef482b716e9817358fe",id:null,metadata:{},name:"UpsertPromptFromTemplateDialogUpdateMutation",operationKind:"mutation",text:`mutation UpsertPromptFromTemplateDialogUpdateMutation(
3625
3625
  $input: CreateChatPromptVersionInput!
3626
3626
  ) {
3627
3627
  createChatPromptVersion(input: $input) {
@@ -3658,7 +3658,7 @@ fragment TraceHeaderRootSpanAnnotationsFragment on Span {
3658
3658
  }
3659
3659
  }
3660
3660
  }
3661
- `}}}();mm.hash="42af63a75d1f1b2184518e94395121cd";function gm({onChange:n,container:a,promptId:l,...t}){const r=P.useLazyLoadQuery(mm,{},{fetchPolicy:"store-and-network",fetchKey:l??void 0}).prompts.edges,o=p.useMemo(()=>r.map(d=>d.prompt),[r]);return e(Ua,{size:"M","data-testid":"prompt-picker",selectedKey:l??null,"aria-label":"prompt picker",width:"100%",menuTrigger:"focus",stopPropagation:!0,container:a,defaultItems:o,placeholder:"Select a prompt...",renderEmptyState:()=>e("div",{children:"No prompts found"}),onSelectionChange:d=>{if(!(typeof d!="string"&&d!=null)){if(d===l){n(null);return}n(d)}},...t,children:d=>e(Me,{textValue:d.name,id:d.id,children:d.name},d.id)})}const eF=/^[a-z0-9]([_a-z0-9-]*[a-z0-9])?$/,pm={value:eF,message:"Invalid identifier. Must be alphanumeric and with dashes or underscores"};function nF({onCreate:n,onUpdate:a,isSubmitting:l=!1,defaultSelectedPromptId:t,onClose:i}){var x,N,w,$;const r=p.useRef(null),o=P.useLazyLoadQuery(um,{},{fetchPolicy:"network-only"}),[d,c]=p.useState(t??null),u=(N=(x=o==null?void 0:o.prompts)==null?void 0:x.edges)==null?void 0:N.find(I=>{var M;return((M=I==null?void 0:I.prompt)==null?void 0:M.id)===d}),[y,g]=p.useState(((w=u==null?void 0:u.prompt)==null?void 0:w.name)??""),m=u?"update":"create",f=m==="create"?"Create Prompt":"Update Prompt",{control:h,handleSubmit:k,formState:{isDirty:S,isValid:C},trigger:T}=Qe({values:{promptId:d??void 0,name:m==="update"&&u?($=u==null?void 0:u.prompt)==null?void 0:$.name:y},defaultValues:{description:""},reValidateMode:"onChange",resetOptions:{keepDefaultValues:!0}}),_=p.useCallback(I=>{m==="create"?n(I,i):a(I,i)},[n,a,m,i]);return s(b,{direction:"column",gap:"size-100",ref:r,children:[e(v,{paddingX:"size-200",paddingTop:"size-200",children:e(G,{name:"name",control:h,rules:{required:{message:"Prompt is required",value:!0},pattern:pm},render:({field:{onBlur:I,onChange:M},fieldState:z})=>{var A;return e(gm,{label:"Prompt",description:"The prompt to update, or prompt name to create",placeholder:"Select or enter new prompt name",isRequired:!0,onBlur:I,defaultInputValue:y,onInputChange:V=>{g(V),M(V),T("name")},container:r.current??void 0,errorMessage:(A=z.error)==null?void 0:A.message,allowsCustomValue:!0,onChange:V=>{M(V),c(V)},promptId:d})}})}),s(un,{onSubmit:k(_),children:[e(v,{paddingX:"size-200",paddingBottom:"size-200",children:e(G,{name:"description",control:h,render:({field:{onChange:I,onBlur:M,value:z},fieldState:{invalid:A,error:V}})=>s(ie,{isInvalid:A,onChange:I,onBlur:M,value:z,size:"S",children:[e(W,{children:m==="create"?"Prompt Description":"Change Description"}),e(Ra,{}),V?e(Ce,{children:V.message}):e(F,{slot:"description",children:m==="create"?"A description of your prompt (optional)":"A description of your changes to the prompt (optional)"})]})})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:S?"primary":"default",size:"S",isDisabled:l||!C,type:"submit",children:f})})})]})]})}const vs=(n,a)=>{const l=a.getState(),t=l.allInstanceMessages,i=l.instances.find(c=>c.id===n);if(!i)throw new Error(`Instance ${n} not found`);const r=Ut(i,t),o=eS(r);if(!o)throw new Error(`Could not convert instance ${n} to prompt`);const d=l.templateFormat;return{promptInput:o,templateFormat:d}},aF=({instanceId:n,selectedPromptId:a})=>{const l=be(),t=ke(),i=Fe(),r=Kl(),[o,d]=P.useMutation(cm),[c,u]=P.useMutation(dm),y=p.useCallback((f,h)=>{const k=r.getState();k.instances.find(C=>C.id===n)&&k.updateInstance({instanceId:n,patch:{prompt:{id:f,name:h}},dirty:!1})},[r,n]),g=p.useCallback((f,h)=>{const{promptInput:k,templateFormat:S}=vs(n,r);o({variables:{input:{name:f.name,description:f.description,promptVersion:{...k,templateFormat:S}}},onCompleted:C=>{t({title:"Prompt successfully created",action:{text:"View Prompt",onClick:()=>{l(`/prompts/${C.createChatPrompt.id}`)}}}),y(C.createChatPrompt.id,C.createChatPrompt.name),h()},onError:C=>{const T=Re(C);i({title:"Error creating prompt",message:T==null?void 0:T[0]})}})},[o,n,l,i,t,y,r]),m=p.useCallback((f,h)=>{if(!f.promptId)throw new Error("Prompt ID is required");const{promptInput:k,templateFormat:S}=vs(n,r);c({variables:{input:{promptId:f.promptId,promptVersion:{...k,templateFormat:S,description:f.description}}},onCompleted:C=>{t({title:"Prompt successfully updated",action:{text:"View Prompt",onClick:()=>{l(`/prompts/${C.createChatPromptVersion.id}`)}}}),y(C.createChatPromptVersion.id,C.createChatPromptVersion.name),h()},onError:C=>{const T=Re(C);i({title:"Error updating prompt",message:T==null?void 0:T[0]})}})},[n,l,i,t,r,c,y]);return e(X,{children:({close:f})=>s(re,{children:[s(se,{children:[e(oe,{children:"Create Prompt from Template"}),e(ue,{children:e(me,{})})]}),e(p.Suspense,{fallback:e(pe,{}),children:e(nF,{onClose:f,onCreate:g,onUpdate:m,isSubmitting:d||u,defaultSelectedPromptId:a})})]})})},ym={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ModelConfigButtonDialogQuery",selections:[{args:null,kind:"FragmentSpread",name:"ModelProviderSelectFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"ModelConfigButtonDialogQuery",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null}],storageKey:null}]},params:{cacheID:"f6e033b9adc17b674922615d30065fbc",id:null,metadata:{},name:"ModelConfigButtonDialogQuery",operationKind:"query",text:`query ModelConfigButtonDialogQuery {
3661
+ `}}}();mm.hash="42af63a75d1f1b2184518e94395121cd";function gm({onChange:n,container:a,promptId:l,...t}){const r=T.useLazyLoadQuery(mm,{},{fetchPolicy:"store-and-network",fetchKey:l??void 0}).prompts.edges,o=p.useMemo(()=>r.map(d=>d.prompt),[r]);return e(Ua,{size:"M","data-testid":"prompt-picker",selectedKey:l??null,"aria-label":"prompt picker",width:"100%",menuTrigger:"focus",stopPropagation:!0,container:a,defaultItems:o,placeholder:"Select a prompt...",renderEmptyState:()=>e("div",{children:"No prompts found"}),onSelectionChange:d=>{if(!(typeof d!="string"&&d!=null)){if(d===l){n(null);return}n(d)}},...t,children:d=>e(Me,{textValue:d.name,id:d.id,children:d.name},d.id)})}const eF=/^[a-z0-9]([_a-z0-9-]*[a-z0-9])?$/,pm={value:eF,message:"Invalid identifier. Must be alphanumeric and with dashes or underscores"};function nF({onCreate:n,onUpdate:a,isSubmitting:l=!1,defaultSelectedPromptId:t,onClose:i}){var x,N,w,$;const r=p.useRef(null),o=T.useLazyLoadQuery(um,{},{fetchPolicy:"network-only"}),[d,c]=p.useState(t??null),u=(N=(x=o==null?void 0:o.prompts)==null?void 0:x.edges)==null?void 0:N.find(I=>{var M;return((M=I==null?void 0:I.prompt)==null?void 0:M.id)===d}),[y,g]=p.useState(((w=u==null?void 0:u.prompt)==null?void 0:w.name)??""),m=u?"update":"create",f=m==="create"?"Create Prompt":"Update Prompt",{control:h,handleSubmit:k,formState:{isDirty:S,isValid:C},trigger:P}=Qe({values:{promptId:d??void 0,name:m==="update"&&u?($=u==null?void 0:u.prompt)==null?void 0:$.name:y},defaultValues:{description:""},reValidateMode:"onChange",resetOptions:{keepDefaultValues:!0}}),L=p.useCallback(I=>{m==="create"?n(I,i):a(I,i)},[n,a,m,i]);return s(b,{direction:"column",gap:"size-100",ref:r,children:[e(v,{paddingX:"size-200",paddingTop:"size-200",children:e(G,{name:"name",control:h,rules:{required:{message:"Prompt is required",value:!0},pattern:pm},render:({field:{onBlur:I,onChange:M},fieldState:z})=>{var A;return e(gm,{label:"Prompt",description:"The prompt to update, or prompt name to create",placeholder:"Select or enter new prompt name",isRequired:!0,onBlur:I,defaultInputValue:y,onInputChange:V=>{g(V),M(V),P("name")},container:r.current??void 0,errorMessage:(A=z.error)==null?void 0:A.message,allowsCustomValue:!0,onChange:V=>{M(V),c(V)},promptId:d})}})}),s(un,{onSubmit:k(L),children:[e(v,{paddingX:"size-200",paddingBottom:"size-200",children:e(G,{name:"description",control:h,render:({field:{onChange:I,onBlur:M,value:z},fieldState:{invalid:A,error:V}})=>s(ie,{isInvalid:A,onChange:I,onBlur:M,value:z,size:"S",children:[e(W,{children:m==="create"?"Prompt Description":"Change Description"}),e(Ra,{}),V?e(Ce,{children:V.message}):e(F,{slot:"description",children:m==="create"?"A description of your prompt (optional)":"A description of your changes to the prompt (optional)"})]})})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:S?"primary":"default",size:"S",isDisabled:l||!C,type:"submit",children:f})})})]})]})}const vs=(n,a)=>{const l=a.getState(),t=l.allInstanceMessages,i=l.instances.find(c=>c.id===n);if(!i)throw new Error(`Instance ${n} not found`);const r=Ut(i,t),o=eS(r);if(!o)throw new Error(`Could not convert instance ${n} to prompt`);const d=l.templateFormat;return{promptInput:o,templateFormat:d}},aF=({instanceId:n,selectedPromptId:a})=>{const l=be(),t=ke(),i=Fe(),r=Kl(),[o,d]=T.useMutation(cm),[c,u]=T.useMutation(dm),y=p.useCallback((f,h)=>{const k=r.getState();k.instances.find(C=>C.id===n)&&k.updateInstance({instanceId:n,patch:{prompt:{id:f,name:h}},dirty:!1})},[r,n]),g=p.useCallback((f,h)=>{const{promptInput:k,templateFormat:S}=vs(n,r);o({variables:{input:{name:f.name,description:f.description,promptVersion:{...k,templateFormat:S}}},onCompleted:C=>{t({title:"Prompt successfully created",action:{text:"View Prompt",onClick:()=>{l(`/prompts/${C.createChatPrompt.id}`)}}}),y(C.createChatPrompt.id,C.createChatPrompt.name),h()},onError:C=>{const P=Re(C);i({title:"Error creating prompt",message:P==null?void 0:P[0]})}})},[o,n,l,i,t,y,r]),m=p.useCallback((f,h)=>{if(!f.promptId)throw new Error("Prompt ID is required");const{promptInput:k,templateFormat:S}=vs(n,r);c({variables:{input:{promptId:f.promptId,promptVersion:{...k,templateFormat:S,description:f.description}}},onCompleted:C=>{t({title:"Prompt successfully updated",action:{text:"View Prompt",onClick:()=>{l(`/prompts/${C.createChatPromptVersion.id}`)}}}),y(C.createChatPromptVersion.id,C.createChatPromptVersion.name),h()},onError:C=>{const P=Re(C);i({title:"Error updating prompt",message:P==null?void 0:P[0]})}})},[n,l,i,t,r,c,y]);return e(X,{children:({close:f})=>s(re,{children:[s(se,{children:[e(oe,{children:"Create Prompt from Template"}),e(ue,{children:e(me,{})})]}),e(p.Suspense,{fallback:e(pe,{}),children:e(nF,{onClose:f,onCreate:g,onUpdate:m,isSubmitting:d||u,defaultSelectedPromptId:a})})]})})},ym={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ModelConfigButtonDialogQuery",selections:[{args:null,kind:"FragmentSpread",name:"ModelProviderSelectFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"ModelConfigButtonDialogQuery",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null}],storageKey:null}]},params:{cacheID:"f6e033b9adc17b674922615d30065fbc",id:null,metadata:{},name:"ModelConfigButtonDialogQuery",operationKind:"query",text:`query ModelConfigButtonDialogQuery {
3662
3662
  ...ModelProviderSelectFragment
3663
3663
  }
3664
3664
 
@@ -3681,7 +3681,7 @@ fragment ModelProviderSelectFragment on Query {
3681
3681
  name
3682
3682
  }
3683
3683
  }
3684
- `}}}();Cr.hash="1e812293e1547b594275780290b294be";function cF({onChange:n,container:a,modelName:l,queryReference:t,...i}){const r=P.usePreloadedQuery(Cr,t),o=p.useMemo(()=>r.playgroundModels.map(g=>({name:g.name,id:g.name})),[r.playgroundModels]),[d,c]=p.useState({selectedKey:l??null,inputValue:l??""}),u=g=>{if(typeof g=="string"){const m=o.find(f=>f.id===g);(m==null?void 0:m.name)!=null&&n(m.name)}},y=g=>{c(m=>({inputValue:g,selectedKey:m.selectedKey}))};return p.useEffect(()=>{c({selectedKey:l??null,inputValue:l??""})},[l]),e(Ua,{size:"L",label:"Model",isRequired:!0,"data-testid":"model-picker",selectedKey:d.selectedKey,"aria-label":"model picker",onInputChange:y,inputValue:d.inputValue,onSelectionChange:u,width:"100%",allowsCustomValue:!0,onBlur:()=>{d.inputValue!==""&&n(d.inputValue)},onKeyUp:g=>{g.key==="Enter"&&n(d.inputValue)},menuTrigger:"focus",container:a,description:"Choose a model from the list, or enter a custom model name",defaultItems:o,...i,children:g=>e(Me,{textValue:g.name,id:g.id,children:g.name},g.id)})}function fm(n){const[a,l,t]=P.useQueryLoader(Cr);return p.useEffect(()=>(l({providerKey:n.provider}),()=>t()),[t,l,n.provider]),a!=null?e(cF,{queryReference:a,...n}):null}const hm={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ModelProviderSelectFragment",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};hm.hash="fa50b98980c4687ef0574fa47c3ef4be";function uF({onChange:n,query:a,...l}){const t=P.useFragment(hm,a),i=t.modelProviders.filter(d=>d.dependenciesInstalled),r=i.length!==t.modelProviders.length,o=l.provider&&!i.some(d=>d.key===l.provider);return s(b,{direction:"row",gap:"size-100",children:[e(v,{flex:1,children:Iy(Yl,{...l,key:"model-provider-select","data-testid":"model-provider-picker",selectedKey:l.provider??void 0,"aria-label":"Model Provider",placeholder:"Select a provider",onSelectionChange:d=>{const c=d;zi(c)&&n(c)}},e(W,{children:"Provider"}),s(E,{children:[e(St,{}),e(Ha,{})]}),e(kn,{children:e(ma,{children:t.modelProviders.map(d=>e(Hn,{id:d.key,textValue:d.name,children:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(xa,{provider:d.key,height:16}),e(F,{children:d.name})]})},d.key))})}))}),o?e(D,{color:"red-700",svg:e(ga,{})}):r?e(D,{svg:e(ga,{})}):null]})}const mF=150,gF=K`
3684
+ `}}}();Cr.hash="1e812293e1547b594275780290b294be";function cF({onChange:n,container:a,modelName:l,queryReference:t,...i}){const r=T.usePreloadedQuery(Cr,t),o=p.useMemo(()=>r.playgroundModels.map(g=>({name:g.name,id:g.name})),[r.playgroundModels]),[d,c]=p.useState({selectedKey:l??null,inputValue:l??""}),u=g=>{if(typeof g=="string"){const m=o.find(f=>f.id===g);(m==null?void 0:m.name)!=null&&n(m.name)}},y=g=>{c(m=>({inputValue:g,selectedKey:m.selectedKey}))};return p.useEffect(()=>{c({selectedKey:l??null,inputValue:l??""})},[l]),e(Ua,{size:"L",label:"Model",isRequired:!0,"data-testid":"model-picker",selectedKey:d.selectedKey,"aria-label":"model picker",onInputChange:y,inputValue:d.inputValue,onSelectionChange:u,width:"100%",allowsCustomValue:!0,onBlur:()=>{d.inputValue!==""&&n(d.inputValue)},onKeyUp:g=>{g.key==="Enter"&&n(d.inputValue)},menuTrigger:"focus",container:a,description:"Choose a model from the list, or enter a custom model name",defaultItems:o,...i,children:g=>e(Me,{textValue:g.name,id:g.id,children:g.name},g.id)})}function fm(n){const[a,l,t]=T.useQueryLoader(Cr);return p.useEffect(()=>(l({providerKey:n.provider}),()=>t()),[t,l,n.provider]),a!=null?e(cF,{queryReference:a,...n}):null}const hm={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ModelProviderSelectFragment",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};hm.hash="fa50b98980c4687ef0574fa47c3ef4be";function uF({onChange:n,query:a,...l}){const t=T.useFragment(hm,a),i=t.modelProviders.filter(d=>d.dependenciesInstalled),r=i.length!==t.modelProviders.length,o=l.provider&&!i.some(d=>d.key===l.provider);return s(b,{direction:"row",gap:"size-100",children:[e(v,{flex:1,children:Iy(Yl,{...l,key:"model-provider-select","data-testid":"model-provider-picker",selectedKey:l.provider??void 0,"aria-label":"Model Provider",placeholder:"Select a provider",onSelectionChange:d=>{const c=d;zi(c)&&n(c)}},e(W,{children:"Provider"}),s(E,{children:[e(St,{}),e(Ha,{})]}),e(kn,{children:e(ma,{children:t.modelProviders.map(d=>e(Hn,{id:d.key,textValue:d.name,children:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(xa,{provider:d.key,height:16}),e(F,{children:d.name})]})},d.key))})}))}),o?e(D,{color:"red-700",svg:e(ga,{})}):r?e(D,{svg:e(ga,{})}):null]})}const mF=150,gF=K`
3685
3685
  display: flex;
3686
3686
  flex-direction: column;
3687
3687
  gap: var(--ac-global-dimension-size-200);
@@ -3697,7 +3697,7 @@ fragment ModelProviderSelectFragment on Query {
3697
3697
  }
3698
3698
  padding: var(--ac-global-dimension-size-200);
3699
3699
  overflow: auto;
3700
- `;function pF(n){return n==="OPENAI"||n==="OLLAMA"}function yF({instance:n,container:a}){const l=Q(o=>o.updateModel),t=p.useCallback(({configKey:o,value:d})=>{l({instanceId:n.id,patch:{...n.model,[o]:d}})},[n.id,n.model,l]),i=p.useMemo(()=>zl(o=>{t({configKey:"modelName",value:o})},250),[t]),r=p.useMemo(()=>zl(o=>{t({configKey:"baseUrl",value:o})},250),[t]);return s(Y,{children:[e(fm,{modelName:n.model.modelName,provider:n.model.provider,onChange:o=>{i(o)},container:a??void 0}),s(ie,{defaultValue:n.model.baseUrl??"",onChange:o=>{r(o)},children:[e(W,{children:"Base URL"}),e(ae,{placeholder:"e.x. https://my-llm.com/v1"})]},`${n.id}-baseUrl-${n.model.baseUrl}`)]})}function fF({instance:n,container:a}){const l=Q(r=>r.updateModel),t=p.useCallback(({configKey:r,value:o})=>{l({instanceId:n.id,patch:{...n.model,[r]:o}})},[n.id,n.model,l]),i=p.useMemo(()=>zl(r=>{t({configKey:"modelName",value:r})},250),[t]);return s(Y,{children:[s(ie,{defaultValue:n.model.modelName??"",onChange:r=>{i(r)},children:[e(W,{children:"Deployment Name"}),e(ae,{placeholder:"e.x. azure-openai-deployment-name"})]},`${n.id}-modelName-${n.model.modelName}`),s(ie,{value:n.model.endpoint??"",onChange:r=>{t({configKey:"endpoint",value:r})},children:[e(W,{children:"Endpoint"}),e(ae,{placeholder:"e.x. https://my.openai.azure.com"})]}),e(Ua,{container:a??void 0,size:"L",label:"API Version","data-testid":"azure-api-version-combobox",selectedKey:n.model.apiVersion??void 0,"aria-label":"api version picker",placeholder:"Select an AzureOpenAI API Version",inputValue:n.model.apiVersion??"",onInputChange:r=>{t({configKey:"apiVersion",value:r})},onSelectionChange:r=>{typeof r=="string"&&t({configKey:"apiVersion",value:r})},allowsCustomValue:!0,children:gh.map(r=>e(Me,{textValue:r,id:r,children:r},r))})]})}function hF({instance:n,container:a}){const l=Q(i=>i.updateModel),t=p.useCallback(({configKey:i,value:r})=>{l({instanceId:n.id,patch:{...n.model,[i]:r}})},[n.id,n.model,l]);return s(Y,{children:[s(Ua,{container:a??void 0,size:"L",label:"Region","data-testid":"bedrock-region-combobox",selectedKey:n.model.region??"us-east-1","aria-label":"region picker",isRequired:!0,placeholder:"Select an Amazon Region",inputValue:n.model.region??"us-east-1",onInputChange:i=>{t({configKey:"region",value:i})},onSelectionChange:i=>{typeof i=="string"&&t({configKey:"region",value:i})},allowsCustomValue:!0,children:[e(Me,{textValue:"us-east-1",id:"us-east-1",children:"N. Virginia (us-east-1)"},"us-east-1"),e(Me,{textValue:"us-east-2",id:"us-east-2",children:"Ohio (us-east-2)"},"us-east-2"),e(Me,{textValue:"us-west-1",id:"us-west-1",children:"N. California (us-west-1)"},"us-west-1"),e(Me,{textValue:"us-west-2",id:"us-west-2",children:"Oregon (us-west-2)"},"us-west-2"),e(Me,{textValue:"ap-south-1",id:"ap-south-1",children:"Asia Pacific (Mumbai) (ap-south-1)"},"ap-south-1"),e(Me,{textValue:"ap-northeast-3",id:"ap-northeast-3",children:"Asia Pacific (Osaka) (ap-northeast-3)"},"ap-northeast-3"),e(Me,{textValue:"ap-northeast-2",id:"ap-northeast-2",children:"Asia Pacific (Seoul) (ap-northeast-2)"},"ap-northeast-2"),e(Me,{textValue:"ap-southeast-1",id:"ap-southeast-1",children:"Asia Pacific (Singapore) (ap-southeast-1)"},"ap-southeast-1"),e(Me,{textValue:"ap-southeast-2",id:"ap-southeast-2",children:"Asia Pacific (Sydney) (ap-southeast-2)"},"ap-southeast-2"),e(Me,{textValue:"ap-east-2",id:"ap-east-2",children:"Asia Pacific (Taipei) (ap-east-2)"},"ap-east-2"),e(Me,{textValue:"ap-northeast-1",id:"ap-northeast-1",children:"Asia Pacific (Tokyo) (ap-northeast-1)"},"ap-northeast-1"),e(Me,{textValue:"ca-central-1",id:"ca-central-1",children:"Canada (Central) (ca-central-1)"},"ca-central-1"),e(Me,{textValue:"eu-central-1",id:"eu-central-1",children:"Europe (Frankfurt) (eu-central-1)"},"eu-central-1"),e(Me,{textValue:"eu-west-1",id:"eu-west-1",children:"Europe (Ireland) (eu-west-1)"},"eu-west-1"),e(Me,{textValue:"eu-west-2",id:"eu-west-2",children:"Europe (London) (eu-west-2)"},"eu-west-2"),e(Me,{textValue:"eu-west-3",id:"eu-west-3",children:"Europe (Paris) (eu-west-3)"},"eu-west-3"),e(Me,{textValue:"eu-north-1",id:"eu-north-1",children:"Europe (Stockholm) (eu-north-1)"},"eu-north-1"),e(Me,{textValue:"sa-east-1",id:"sa-east-1",children:"South America (São Paulo) (sa-east-1)"},"sa-east-1")]}),e(Ua,{container:a??void 0,size:"L",label:"API","data-testid":"bedrock-api-combobox",selectedKey:n.model.apiVersion??void 0,"aria-label":"api picker",isDisabled:!0,placeholder:"Select an Bedrock API",inputValue:"converse",children:e(Me,{textValue:"converse",id:"converse",children:"Converse"},"converse")})]})}function kF(n){const a=Q(r=>r.instances.find(o=>o.id===n.playgroundInstanceId));if(!a)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);const l=a.model.supportedInvocationParameters,t=a.model.invocationParameters,i=gd(t,l);return s(J,{children:[e(E,{size:"S",leadingVisual:e(xa,{provider:a.model.provider,height:16}),children:s(b,{direction:"row",gap:"size-100",alignItems:"center",height:"100%",children:[e(Xe,{maxWidth:mF,children:e(F,{children:a.model.modelName||"--"})}),i?null:s(De,{delay:0,children:[e("span",{children:e(D,{color:"danger",svg:e(ga,{})})}),e(dl,{children:"Some required invocation parameters are not configured."})]})]})}),e(ne,{children:e(Z,{variant:"slideover",size:"S",children:e(bF,{...n})})})]})}function bF(n){const a=Q(r=>r.instances.find(o=>o.id===n.playgroundInstanceId));if(!a)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);const l=bn(r=>r.setModelConfigForProvider),t=ke(),i=p.useCallback(()=>{const{supportedInvocationParameters:r,...o}=a.model;l({provider:a.model.provider,modelConfig:o}),t({title:"Model Configuration Saved",message:`${bi[a.model.provider]} model configuration saved as default for later use.`,expireMs:3e3})},[a.model,t,l]);return e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Model Configuration"}),s(ue,{children:[s(De,{delay:0,closeDelay:0,children:[e(E,{size:"S",variant:"default",onPress:i,leadingVisual:e(D,{svg:e(mo,{})}),children:"Save as Default"}),e(dl,{placement:"bottom",offset:5,children:s(v,{padding:"size-100",backgroundColor:"light",borderColor:"dark",borderWidth:"thin",borderRadius:"small",width:"200px",children:["Saves the current configuration as the default for"," ",bi[a.model.provider]??"this provider","."]})})]}),e(me,{})]})]}),e(p.Suspense,{children:e(SF,{...n})})]})})}function SF(n){const{playgroundInstanceId:a}=n,l=Q(f=>f.instances.find(h=>h.id===a));if(!l)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);const t=bn(f=>f.modelConfigByProvider),i=Q(f=>f.updateProvider),r=Q(f=>f.updateModel),o=l.model.supportedInvocationParameters,d=l.model.invocationParameters,c=gd(d,o),u=P.useLazyLoadQuery(ym,{}),y=p.useCallback(f=>{r({instanceId:a,patch:{modelName:f}})},[a,r]),[g,m]=p.useState();return s("form",{css:gF,children:[c?null:s(b,{direction:"row",gap:"size-100",children:[e(D,{color:"danger",svg:e(ga,{})}),e(F,{color:"danger",children:"Some required invocation parameters are not configured."})]}),e(uF,{provider:l.model.provider,query:u,onChange:f=>{i({instanceId:a,provider:f,modelConfigByProvider:t})}}),pF(l.model.provider)?e(yF,{instance:l,container:g??null}):l.model.provider==="AZURE_OPENAI"?e(fF,{instance:l,container:g??null}):e(fm,{modelName:l.model.modelName,provider:l.model.provider,onChange:y,container:g??void 0}),l.model.provider==="AWS"?e(hF,{instance:l,container:g??null}):null,e(p.Suspense,{children:e(dF,{instanceId:a})}),e("div",{ref:m})]})}const km=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a={alias:null,args:null,kind:"ScalarField",name:"invocationInputField",storageKey:null},l={alias:"floatDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},t=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:null,kind:"LinkedField",name:"modelInvocationParameters",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"canonicalName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"required",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],type:"InvocationParameterBase",abstractKey:"__isInvocationParameterBase"},{kind:"InlineFragment",selections:[{alias:"booleanDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"BooleanInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[l,a,{alias:null,args:null,kind:"ScalarField",name:"minValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxValue",storageKey:null}],type:"BoundedFloatInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[l,a],type:"FloatInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"intDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"IntInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"jsonDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"JSONInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"stringDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"StringInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"stringListDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"StringListInvocationParameter",abstractKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ModelSupportedParamsFetcherQuery",selections:t,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ModelSupportedParamsFetcherQuery",selections:t},params:{cacheID:"8f18509b17f3f97c2413ef8b6557d972",id:null,metadata:{},name:"ModelSupportedParamsFetcherQuery",operationKind:"query",text:`query ModelSupportedParamsFetcherQuery(
3700
+ `;function pF(n){return n==="OPENAI"||n==="OLLAMA"}function yF({instance:n,container:a}){const l=Q(o=>o.updateModel),t=p.useCallback(({configKey:o,value:d})=>{l({instanceId:n.id,patch:{...n.model,[o]:d}})},[n.id,n.model,l]),i=p.useMemo(()=>zl(o=>{t({configKey:"modelName",value:o})},250),[t]),r=p.useMemo(()=>zl(o=>{t({configKey:"baseUrl",value:o})},250),[t]);return s(Y,{children:[e(fm,{modelName:n.model.modelName,provider:n.model.provider,onChange:o=>{i(o)},container:a??void 0}),s(ie,{defaultValue:n.model.baseUrl??"",onChange:o=>{r(o)},children:[e(W,{children:"Base URL"}),e(ae,{placeholder:"e.x. https://my-llm.com/v1"})]},`${n.id}-baseUrl-${n.model.baseUrl}`)]})}function fF({instance:n,container:a}){const l=Q(r=>r.updateModel),t=p.useCallback(({configKey:r,value:o})=>{l({instanceId:n.id,patch:{...n.model,[r]:o}})},[n.id,n.model,l]),i=p.useMemo(()=>zl(r=>{t({configKey:"modelName",value:r})},250),[t]);return s(Y,{children:[s(ie,{defaultValue:n.model.modelName??"",onChange:r=>{i(r)},children:[e(W,{children:"Deployment Name"}),e(ae,{placeholder:"e.x. azure-openai-deployment-name"})]},`${n.id}-modelName-${n.model.modelName}`),s(ie,{value:n.model.endpoint??"",onChange:r=>{t({configKey:"endpoint",value:r})},children:[e(W,{children:"Endpoint"}),e(ae,{placeholder:"e.x. https://my.openai.azure.com"})]}),e(Ua,{container:a??void 0,size:"L",label:"API Version","data-testid":"azure-api-version-combobox",selectedKey:n.model.apiVersion??void 0,"aria-label":"api version picker",placeholder:"Select an AzureOpenAI API Version",inputValue:n.model.apiVersion??"",onInputChange:r=>{t({configKey:"apiVersion",value:r})},onSelectionChange:r=>{typeof r=="string"&&t({configKey:"apiVersion",value:r})},allowsCustomValue:!0,children:gh.map(r=>e(Me,{textValue:r,id:r,children:r},r))})]})}function hF({instance:n,container:a}){const l=Q(i=>i.updateModel),t=p.useCallback(({configKey:i,value:r})=>{l({instanceId:n.id,patch:{...n.model,[i]:r}})},[n.id,n.model,l]);return s(Y,{children:[s(Ua,{container:a??void 0,size:"L",label:"Region","data-testid":"bedrock-region-combobox",selectedKey:n.model.region??"us-east-1","aria-label":"region picker",isRequired:!0,placeholder:"Select an Amazon Region",inputValue:n.model.region??"us-east-1",onInputChange:i=>{t({configKey:"region",value:i})},onSelectionChange:i=>{typeof i=="string"&&t({configKey:"region",value:i})},allowsCustomValue:!0,children:[e(Me,{textValue:"us-east-1",id:"us-east-1",children:"N. Virginia (us-east-1)"},"us-east-1"),e(Me,{textValue:"us-east-2",id:"us-east-2",children:"Ohio (us-east-2)"},"us-east-2"),e(Me,{textValue:"us-west-1",id:"us-west-1",children:"N. California (us-west-1)"},"us-west-1"),e(Me,{textValue:"us-west-2",id:"us-west-2",children:"Oregon (us-west-2)"},"us-west-2"),e(Me,{textValue:"ap-south-1",id:"ap-south-1",children:"Asia Pacific (Mumbai) (ap-south-1)"},"ap-south-1"),e(Me,{textValue:"ap-northeast-3",id:"ap-northeast-3",children:"Asia Pacific (Osaka) (ap-northeast-3)"},"ap-northeast-3"),e(Me,{textValue:"ap-northeast-2",id:"ap-northeast-2",children:"Asia Pacific (Seoul) (ap-northeast-2)"},"ap-northeast-2"),e(Me,{textValue:"ap-southeast-1",id:"ap-southeast-1",children:"Asia Pacific (Singapore) (ap-southeast-1)"},"ap-southeast-1"),e(Me,{textValue:"ap-southeast-2",id:"ap-southeast-2",children:"Asia Pacific (Sydney) (ap-southeast-2)"},"ap-southeast-2"),e(Me,{textValue:"ap-east-2",id:"ap-east-2",children:"Asia Pacific (Taipei) (ap-east-2)"},"ap-east-2"),e(Me,{textValue:"ap-northeast-1",id:"ap-northeast-1",children:"Asia Pacific (Tokyo) (ap-northeast-1)"},"ap-northeast-1"),e(Me,{textValue:"ca-central-1",id:"ca-central-1",children:"Canada (Central) (ca-central-1)"},"ca-central-1"),e(Me,{textValue:"eu-central-1",id:"eu-central-1",children:"Europe (Frankfurt) (eu-central-1)"},"eu-central-1"),e(Me,{textValue:"eu-west-1",id:"eu-west-1",children:"Europe (Ireland) (eu-west-1)"},"eu-west-1"),e(Me,{textValue:"eu-west-2",id:"eu-west-2",children:"Europe (London) (eu-west-2)"},"eu-west-2"),e(Me,{textValue:"eu-west-3",id:"eu-west-3",children:"Europe (Paris) (eu-west-3)"},"eu-west-3"),e(Me,{textValue:"eu-north-1",id:"eu-north-1",children:"Europe (Stockholm) (eu-north-1)"},"eu-north-1"),e(Me,{textValue:"sa-east-1",id:"sa-east-1",children:"South America (São Paulo) (sa-east-1)"},"sa-east-1")]}),e(Ua,{container:a??void 0,size:"L",label:"API","data-testid":"bedrock-api-combobox",selectedKey:n.model.apiVersion??void 0,"aria-label":"api picker",isDisabled:!0,placeholder:"Select an Bedrock API",inputValue:"converse",children:e(Me,{textValue:"converse",id:"converse",children:"Converse"},"converse")})]})}function kF(n){const a=Q(r=>r.instances.find(o=>o.id===n.playgroundInstanceId));if(!a)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);const l=a.model.supportedInvocationParameters,t=a.model.invocationParameters,i=gd(t,l);return s(J,{children:[e(E,{size:"S",leadingVisual:e(xa,{provider:a.model.provider,height:16}),children:s(b,{direction:"row",gap:"size-100",alignItems:"center",height:"100%",children:[e(Xe,{maxWidth:mF,children:e(F,{children:a.model.modelName||"--"})}),i?null:s(De,{delay:0,children:[e("span",{children:e(D,{color:"danger",svg:e(ga,{})})}),e(dl,{children:"Some required invocation parameters are not configured."})]})]})}),e(ne,{children:e(Z,{variant:"slideover",size:"S",children:e(bF,{...n})})})]})}function bF(n){const a=Q(r=>r.instances.find(o=>o.id===n.playgroundInstanceId));if(!a)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);const l=bn(r=>r.setModelConfigForProvider),t=ke(),i=p.useCallback(()=>{const{supportedInvocationParameters:r,...o}=a.model;l({provider:a.model.provider,modelConfig:o}),t({title:"Model Configuration Saved",message:`${bi[a.model.provider]} model configuration saved as default for later use.`,expireMs:3e3})},[a.model,t,l]);return e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Model Configuration"}),s(ue,{children:[s(De,{delay:0,closeDelay:0,children:[e(E,{size:"S",variant:"default",onPress:i,leadingVisual:e(D,{svg:e(mo,{})}),children:"Save as Default"}),e(dl,{placement:"bottom",offset:5,children:s(v,{padding:"size-100",backgroundColor:"light",borderColor:"dark",borderWidth:"thin",borderRadius:"small",width:"200px",children:["Saves the current configuration as the default for"," ",bi[a.model.provider]??"this provider","."]})})]}),e(me,{})]})]}),e(p.Suspense,{children:e(SF,{...n})})]})})}function SF(n){const{playgroundInstanceId:a}=n,l=Q(f=>f.instances.find(h=>h.id===a));if(!l)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);const t=bn(f=>f.modelConfigByProvider),i=Q(f=>f.updateProvider),r=Q(f=>f.updateModel),o=l.model.supportedInvocationParameters,d=l.model.invocationParameters,c=gd(d,o),u=T.useLazyLoadQuery(ym,{}),y=p.useCallback(f=>{r({instanceId:a,patch:{modelName:f}})},[a,r]),[g,m]=p.useState();return s("form",{css:gF,children:[c?null:s(b,{direction:"row",gap:"size-100",children:[e(D,{color:"danger",svg:e(ga,{})}),e(F,{color:"danger",children:"Some required invocation parameters are not configured."})]}),e(uF,{provider:l.model.provider,query:u,onChange:f=>{i({instanceId:a,provider:f,modelConfigByProvider:t})}}),pF(l.model.provider)?e(yF,{instance:l,container:g??null}):l.model.provider==="AZURE_OPENAI"?e(fF,{instance:l,container:g??null}):e(fm,{modelName:l.model.modelName,provider:l.model.provider,onChange:y,container:g??void 0}),l.model.provider==="AWS"?e(hF,{instance:l,container:g??null}):null,e(p.Suspense,{children:e(dF,{instanceId:a})}),e("div",{ref:m})]})}const km=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a={alias:null,args:null,kind:"ScalarField",name:"invocationInputField",storageKey:null},l={alias:"floatDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},t=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:null,kind:"LinkedField",name:"modelInvocationParameters",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"canonicalName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"required",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],type:"InvocationParameterBase",abstractKey:"__isInvocationParameterBase"},{kind:"InlineFragment",selections:[{alias:"booleanDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"BooleanInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[l,a,{alias:null,args:null,kind:"ScalarField",name:"minValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxValue",storageKey:null}],type:"BoundedFloatInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[l,a],type:"FloatInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"intDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"IntInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"jsonDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"JSONInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"stringDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"StringInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"stringListDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"StringListInvocationParameter",abstractKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ModelSupportedParamsFetcherQuery",selections:t,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ModelSupportedParamsFetcherQuery",selections:t},params:{cacheID:"8f18509b17f3f97c2413ef8b6557d972",id:null,metadata:{},name:"ModelSupportedParamsFetcherQuery",operationKind:"query",text:`query ModelSupportedParamsFetcherQuery(
3701
3701
  $input: ModelsInput!
3702
3702
  ) {
3703
3703
  modelInvocationParameters(input: $input) {
@@ -3741,19 +3741,19 @@ fragment ModelProviderSelectFragment on Query {
3741
3741
  }
3742
3742
  }
3743
3743
  }
3744
- `}}}();km.hash="8bf1a32724929bdc4a02d32809ba59d7";const vF=({instanceId:n})=>{var u;const l=Q(y=>y.instances).find(y=>y.id===n);if(!l)throw new Error("Instance not found");const t=l.model.provider,i=l.model.modelName,r=bn(y=>y.modelConfigByProvider),o=Q(y=>y.updateModelSupportedInvocationParameters),{modelInvocationParameters:d}=P.useLazyLoadQuery(km,{input:{providerKey:t,modelName:i}}),c=(u=l.prompt)==null?void 0:u.id;return p.useEffect(()=>{o({instanceId:n,supportedInvocationParameters:d,modelConfigByProvider:r})},[d,n,o,r,c]),null},bm=n=>a=>a.instances.find(l=>l.id===n),Ii=n=>a=>a.allInstanceMessages[n];function FF({playgroundInstanceId:n,messageId:a}){const l=p.useMemo(()=>bm(n),[n]),t=Q(l);if(t==null)throw new Error(`Instance ${n} not found`);const i=t.model.provider,r=Kl(),o=p.useMemo(()=>Ii(a),[a]),d=Q(o);if(d==null)throw new Error(`Message ${a} not found`);const c=d.toolCalls,u=Q(h=>h.updateMessage),[y,g]=p.useState(()=>JSON.stringify(c,null,2));p.useEffect(()=>{const h=r.getState();if(h.instances.find(_=>_.id===n)==null)return;const S=Ii(a)(h);if(S==null)return;const C=S.toolCalls,T=JSON.stringify(C,null,2);Wi({str:T,excludeNull:!0})&&g(T)},[i,r,n,a]);const m=p.useCallback(h=>{const{json:k}=en(h);u({instanceId:n,messageId:a,patch:{toolCalls:k}})},[n,a,u]),f=p.useMemo(()=>{switch(t.model.provider){case"OPENAI":case"AZURE_OPENAI":case"DEEPSEEK":case"XAI":case"OLLAMA":return fh;case"ANTHROPIC":return yh;case"AWS":return ph;case"GOOGLE":return null}},[t.model.provider]);return e(pn,{value:y,jsonSchema:f,onChange:m})}function CF(n){return n==="text"||n==="toolCalls"}function KF({messageMode:n,onChange:a}){return s(Ot,{selectedKeys:[n],size:"S","aria-label":"Message Mode",onSelectionChange:l=>{if(l.size===0)return;const t=l.keys().next().value;CF(t)&&a(t)},children:[s(Xn,{placement:"top",delay:0,offset:10,children:[e(Mn,{"aria-label":"text input",id:"text",children:e(D,{svg:e(ji,{})})}),e(Ia,{children:"Text input"})]}),s(Xn,{placement:"top",delay:0,offset:10,children:[e(Mn,{"aria-label":"tool calling",id:"toolCalls",children:e(D,{svg:e(Oi,{})})}),e(Ia,{children:"Tool calling"})]})]})}const TF=K`
3744
+ `}}}();km.hash="8bf1a32724929bdc4a02d32809ba59d7";const vF=({instanceId:n})=>{var u;const l=Q(y=>y.instances).find(y=>y.id===n);if(!l)throw new Error("Instance not found");const t=l.model.provider,i=l.model.modelName,r=bn(y=>y.modelConfigByProvider),o=Q(y=>y.updateModelSupportedInvocationParameters),{modelInvocationParameters:d}=T.useLazyLoadQuery(km,{input:{providerKey:t,modelName:i}}),c=(u=l.prompt)==null?void 0:u.id;return p.useEffect(()=>{o({instanceId:n,supportedInvocationParameters:d,modelConfigByProvider:r})},[d,n,o,r,c]),null},bm=n=>a=>a.instances.find(l=>l.id===n),Ii=n=>a=>a.allInstanceMessages[n];function FF({playgroundInstanceId:n,messageId:a}){const l=p.useMemo(()=>bm(n),[n]),t=Q(l);if(t==null)throw new Error(`Instance ${n} not found`);const i=t.model.provider,r=Kl(),o=p.useMemo(()=>Ii(a),[a]),d=Q(o);if(d==null)throw new Error(`Message ${a} not found`);const c=d.toolCalls,u=Q(h=>h.updateMessage),[y,g]=p.useState(()=>JSON.stringify(c,null,2));p.useEffect(()=>{const h=r.getState();if(h.instances.find(L=>L.id===n)==null)return;const S=Ii(a)(h);if(S==null)return;const C=S.toolCalls,P=JSON.stringify(C,null,2);Wi({str:P,excludeNull:!0})&&g(P)},[i,r,n,a]);const m=p.useCallback(h=>{const{json:k}=en(h);u({instanceId:n,messageId:a,patch:{toolCalls:k}})},[n,a,u]),f=p.useMemo(()=>{switch(t.model.provider){case"OPENAI":case"AZURE_OPENAI":case"DEEPSEEK":case"XAI":case"OLLAMA":return fh;case"ANTHROPIC":return yh;case"AWS":return ph;case"GOOGLE":return null}},[t.model.provider]);return e(pn,{value:y,jsonSchema:f,onChange:m})}function CF(n){return n==="text"||n==="toolCalls"}function KF({messageMode:n,onChange:a}){return s(Ot,{selectedKeys:[n],size:"S","aria-label":"Message Mode",onSelectionChange:l=>{if(l.size===0)return;const t=l.keys().next().value;CF(t)&&a(t)},children:[s(Xn,{placement:"top",delay:0,offset:10,children:[e(Mn,{"aria-label":"text input",id:"text",children:e(D,{svg:e(ji,{})})}),e(Ia,{children:"Text input"})]}),s(Xn,{placement:"top",delay:0,offset:10,children:[e(Mn,{"aria-label":"tool calling",id:"toolCalls",children:e(D,{svg:e(Oi,{})})}),e(Ia,{children:"Tool calling"})]})]})}const TF=K`
3745
3745
  .ac-field-label {
3746
3746
  display: none;
3747
3747
  }
3748
- `;function PF({role:n,includeLabel:a=!0,onChange:l}){return s(Yl,{selectedKey:n,css:a?void 0:TF,"data-testid":"messages-role-picker","aria-label":"Role for the chat message",size:"S",onSelectionChange:t=>{if(!rd(t))throw new Error(`Invalid chat message role: ${t}`);l(t)},children:[a&&e(W,{children:"Role"}),s(E,{children:[e(St,{}),e(Ha,{})]}),e(kn,{placement:"bottom start",offset:4,shouldFlip:!0,containerPadding:8,children:s(ma,{children:[e(Hn,{id:"system",children:"System"}),e(Hn,{id:"user",children:"User"}),e(Hn,{id:"ai",children:"AI"}),e(Hn,{id:"tool",children:"Tool"})]})})]})}const IF=32;function xF({instanceId:n,hasResponseFormat:a}){const l=Q(g=>g.instances),t=Q(g=>g.updateInstance),i=Q(g=>g.addMessage),r=Q(g=>g.upsertInvocationParameterInput),o=l.find(g=>g.id===n);if(!o)throw new Error(`Playground instance ${n} not found`);const{template:d}=o;if(d.__type!=="chat")throw new Error(`Invalid template type ${d.__type}`);const c=o.model.supportedInvocationParameters,u=c==null?void 0:c.some(g=>_a(g,{canonicalName:Zn,invocationName:Gn})),y=c==null?void 0:c.some(g=>_a(g,{canonicalName:Ka,invocationName:sl}));return s(b,{direction:"row",justifyContent:"end",gap:"size-100",minHeight:IF,children:[u?e(E,{size:"S","aria-label":"response format",leadingVisual:e(D,{svg:e(Ca,{})}),isDisabled:a,onPress:()=>{r({instanceId:n,invocationParameterInput:{valueJson:hh(),invocationName:Gn,canonicalName:Zn}})},children:"Response Format"}):null,y?e(E,{"aria-label":"add tool",size:"S",leadingVisual:e(D,{svg:e(Ca,{})}),onPress:()=>{const g={tools:[...o.tools,v0({provider:o.model.provider,toolNumber:o.tools.length+1})]};if(o.tools.length===0){const m=Vi({toolChoice:"auto",targetProvider:o.model.provider});m&&(g.toolChoice=m)}t({instanceId:n,patch:g,dirty:!0})},children:"Tool"}):null,e(E,{"aria-label":"add message",size:"S",leadingVisual:e(D,{svg:e(Ca,{})}),onPress:()=>{i({playgroundInstanceId:n,messages:[{id:Fa(),role:"user",content:""}]})},children:"Message"})]})}const DF=400;function LF({playgroundInstanceId:n}){const a=Q(g=>g.deleteInvocationParameterInput),l=Q(g=>g.instances.find(m=>m.id===n)),t=l==null?void 0:l.model.provider,i=Q(g=>g.upsertInvocationParameterInput);if(!l)throw new Error(`Instance ${n} not found`);const r=l.model.invocationParameters.find(g=>g.invocationName===Gn||g.canonicalName===Zn),[o,d]=p.useState(()=>JSON.stringify((r==null?void 0:r.valueJson)??{},null,2)),c=p.useRef(o),u=Kl();p.useEffect(()=>{const m=u.getState().instances.find(k=>k.id===n);if(m==null)return;const f=m.model.invocationParameters.find(k=>k.invocationName===Gn||k.canonicalName===Zn);if(f==null)return;const h=JSON.stringify(f.valueJson,null,2);Wi({str:h,excludeNull:!0})&&d(h)},[t,u,n]);const y=p.useCallback(g=>{c.current=g;const{json:m}=en(g);i({instanceId:n,invocationParameterInput:{invocationName:Gn,valueJson:m,canonicalName:Zn}})},[n,i]);return s(xe,{id:"response-format",children:[e(Pe,{arrowPosition:"start",children:"Response Format"}),e(Ie,{children:e(v,{padding:"size-200",children:e(q,{variant:"compact",title:"Schema",bodyStyle:{padding:0},extra:s(b,{direction:"row",gap:"size-100",children:[e(Se,{text:c}),e(E,{"aria-label":"Delete Response Format",leadingVisual:e(D,{svg:e(Je,{})}),size:"S",onPress:()=>{a({instanceId:n,invocationParameterInputInvocationName:Gn})}})]}),children:e(Do,{preInitializationMinHeight:DF,children:e(pn,{value:o,onChange:y,jsonSchema:a0})})})})})]})}const _F=400;function AF({playgroundInstanceId:n,toolId:a}){const l=Kl(),t=Q(h=>h.updateInstance),i=Q(h=>h.instances.find(k=>k.id===n));if(i==null)throw new Error(`Playground instance ${n} not found`);const r=i.model.provider,o=i.tools,d=o.find(h=>h.id===a);if(d==null)throw new Error(`Tool ${a} not found`);const[c,u]=p.useState(()=>JSON.stringify(d.definition,null,2)),y=p.useRef(c);p.useEffect(()=>{const k=l.getState().instances.find(T=>T.id===n);if(k==null)return;const S=k.tools.find(T=>T.id===a);if(S==null)return;const C=JSON.stringify(S.definition,null,2);Wi({str:C,excludeNull:!0})&&u(C)},[r,l,n,a]);const g=p.useCallback(h=>{y.current=h;const{json:k}=en(h);t({instanceId:n,patch:{tools:o.map(S=>S.id===d.id?{...S,definition:k}:S)},dirty:!0})},[o,n,d.id,t]),m=p.useMemo(()=>ud(d),[d]),f=p.useMemo(()=>{switch(i.model.provider){case"OPENAI":case"AZURE_OPENAI":case"DEEPSEEK":case"XAI":case"OLLAMA":return Sh;case"ANTHROPIC":return bh;case"AWS":return kh;case"GOOGLE":return null}},[i.model.provider]);return e(q,{collapsible:!0,backgroundColor:"yellow-100",borderColor:"yellow-700",variant:"compact",title:s(b,{direction:"row",gap:"size-100",children:[e(Ui,{spanKind:"tool"}),e(F,{children:m??"Tool"})]}),bodyStyle:{padding:0},extra:s(b,{direction:"row",gap:"size-100",children:[e(Se,{text:y}),e(E,{"aria-label":"Delete tool",leadingVisual:e(D,{svg:e(Je,{})}),size:"S",onPress:()=>{const h=o.filter(C=>C.id!==d.id),k=typeof i.toolChoice=="object"&&m!=null&&vh(i.toolChoice)===m;let S=i.toolChoice;h.length===0?S=void 0:k&&(S="auto"),t({instanceId:n,patch:{tools:h,toolChoice:S},dirty:!0})}})]}),children:e(Do,{preInitializationMinHeight:_F,children:e(pn,{value:c,onChange:g,jsonSchema:f})})})}function wF(n){const a=n.playgroundInstanceId,l=Q(d=>d.instances.find(c=>c.id===n.playgroundInstanceId)),t=Q(d=>d.updateInstance);if(l==null)throw new Error(`Playground instance ${a} not found`);const{tools:i}=l;if(i==null)throw new Error(`Playground instance ${a} does not have tools`);const r=p.useMemo(()=>i.map(d=>ud(d)).filter(d=>d!=null),[i]),o=l.model.provider;return Fh(o)?s(xe,{id:"tools",children:[s(Pe,{arrowPosition:"start",children:["Tools",e(Nn,{children:i.length})]}),e(Ie,{children:e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-200",children:[e(Tt,{children:e(Ch,{provider:o,choice:l.toolChoice,onChange:d=>{t({instanceId:a,patch:{toolChoice:d},dirty:!0})},toolNames:r})}),e(b,{direction:"column",gap:"size-200",children:i.map(d=>e(AF,{playgroundInstanceId:a,toolId:d.id},d.id))})]})})})]}):null}const Sm=1,RF=Sm+1;function EF(n){const a=n.playgroundInstanceId,l=Q(g=>g.templateFormat),t=Q(g=>g.updateInstance),i=p.useMemo(()=>bm(a),[a]),r=Q(i);if(!r)throw new Error(`Playground instance ${a} not found`);const o=r.tools.length>0,d=r.model.invocationParameters.find(g=>_a(g,{canonicalName:Zn,invocationName:Gn}))!=null,{template:c}=r;if(c.__type!=="chat")throw new Error(`Invalid template type ${c.__type}`);const u=c.messageIds,y=xy(Ar(Ry),Ar(wy,{coordinateGetter:Ay}));return s(_y,{sensors:y,onDragEnd:({active:g,over:m})=>{if(!m||g.id===m.id)return;const f=u.findIndex(S=>S===g.id),h=u.findIndex(S=>S===m.id),k=Ly(u,f,h);t({instanceId:a,patch:{template:{__type:"chat",messageIds:k}},dirty:!0})},children:[e(Dy,{items:u,children:e("ul",{css:K`
3748
+ `;function PF({role:n,includeLabel:a=!0,onChange:l}){return s(Yl,{selectedKey:n,css:a?void 0:TF,"data-testid":"messages-role-picker","aria-label":"Role for the chat message",size:"S",onSelectionChange:t=>{if(!rd(t))throw new Error(`Invalid chat message role: ${t}`);l(t)},children:[a&&e(W,{children:"Role"}),s(E,{children:[e(St,{}),e(Ha,{})]}),e(kn,{placement:"bottom start",offset:4,shouldFlip:!0,containerPadding:8,children:s(ma,{children:[e(Hn,{id:"system",children:"System"}),e(Hn,{id:"user",children:"User"}),e(Hn,{id:"ai",children:"AI"}),e(Hn,{id:"tool",children:"Tool"})]})})]})}const IF=32;function xF({instanceId:n,hasResponseFormat:a}){const l=Q(g=>g.instances),t=Q(g=>g.updateInstance),i=Q(g=>g.addMessage),r=Q(g=>g.upsertInvocationParameterInput),o=l.find(g=>g.id===n);if(!o)throw new Error(`Playground instance ${n} not found`);const{template:d}=o;if(d.__type!=="chat")throw new Error(`Invalid template type ${d.__type}`);const c=o.model.supportedInvocationParameters,u=c==null?void 0:c.some(g=>_a(g,{canonicalName:Zn,invocationName:Gn})),y=c==null?void 0:c.some(g=>_a(g,{canonicalName:Ka,invocationName:sl}));return s(b,{direction:"row",justifyContent:"end",gap:"size-100",minHeight:IF,children:[u?e(E,{size:"S","aria-label":"response format",leadingVisual:e(D,{svg:e(Ca,{})}),isDisabled:a,onPress:()=>{r({instanceId:n,invocationParameterInput:{valueJson:hh(),invocationName:Gn,canonicalName:Zn}})},children:"Response Format"}):null,y?e(E,{"aria-label":"add tool",size:"S",leadingVisual:e(D,{svg:e(Ca,{})}),onPress:()=>{const g={tools:[...o.tools,v0({provider:o.model.provider,toolNumber:o.tools.length+1})]};if(o.tools.length===0){const m=Vi({toolChoice:"auto",targetProvider:o.model.provider});m&&(g.toolChoice=m)}t({instanceId:n,patch:g,dirty:!0})},children:"Tool"}):null,e(E,{"aria-label":"add message",size:"S",leadingVisual:e(D,{svg:e(Ca,{})}),onPress:()=>{i({playgroundInstanceId:n,messages:[{id:Fa(),role:"user",content:""}]})},children:"Message"})]})}const DF=400;function LF({playgroundInstanceId:n}){const a=Q(g=>g.deleteInvocationParameterInput),l=Q(g=>g.instances.find(m=>m.id===n)),t=l==null?void 0:l.model.provider,i=Q(g=>g.upsertInvocationParameterInput);if(!l)throw new Error(`Instance ${n} not found`);const r=l.model.invocationParameters.find(g=>g.invocationName===Gn||g.canonicalName===Zn),[o,d]=p.useState(()=>JSON.stringify((r==null?void 0:r.valueJson)??{},null,2)),c=p.useRef(o),u=Kl();p.useEffect(()=>{const m=u.getState().instances.find(k=>k.id===n);if(m==null)return;const f=m.model.invocationParameters.find(k=>k.invocationName===Gn||k.canonicalName===Zn);if(f==null)return;const h=JSON.stringify(f.valueJson,null,2);Wi({str:h,excludeNull:!0})&&d(h)},[t,u,n]);const y=p.useCallback(g=>{c.current=g;const{json:m}=en(g);i({instanceId:n,invocationParameterInput:{invocationName:Gn,valueJson:m,canonicalName:Zn}})},[n,i]);return s(xe,{id:"response-format",children:[e(Pe,{arrowPosition:"start",children:"Response Format"}),e(Ie,{children:e(v,{padding:"size-200",children:e(q,{variant:"compact",title:"Schema",bodyStyle:{padding:0},extra:s(b,{direction:"row",gap:"size-100",children:[e(Se,{text:c}),e(E,{"aria-label":"Delete Response Format",leadingVisual:e(D,{svg:e(Je,{})}),size:"S",onPress:()=>{a({instanceId:n,invocationParameterInputInvocationName:Gn})}})]}),children:e(Do,{preInitializationMinHeight:DF,children:e(pn,{value:o,onChange:y,jsonSchema:a0})})})})})]})}const _F=400;function AF({playgroundInstanceId:n,toolId:a}){const l=Kl(),t=Q(h=>h.updateInstance),i=Q(h=>h.instances.find(k=>k.id===n));if(i==null)throw new Error(`Playground instance ${n} not found`);const r=i.model.provider,o=i.tools,d=o.find(h=>h.id===a);if(d==null)throw new Error(`Tool ${a} not found`);const[c,u]=p.useState(()=>JSON.stringify(d.definition,null,2)),y=p.useRef(c);p.useEffect(()=>{const k=l.getState().instances.find(P=>P.id===n);if(k==null)return;const S=k.tools.find(P=>P.id===a);if(S==null)return;const C=JSON.stringify(S.definition,null,2);Wi({str:C,excludeNull:!0})&&u(C)},[r,l,n,a]);const g=p.useCallback(h=>{y.current=h;const{json:k}=en(h);t({instanceId:n,patch:{tools:o.map(S=>S.id===d.id?{...S,definition:k}:S)},dirty:!0})},[o,n,d.id,t]),m=p.useMemo(()=>ud(d),[d]),f=p.useMemo(()=>{switch(i.model.provider){case"OPENAI":case"AZURE_OPENAI":case"DEEPSEEK":case"XAI":case"OLLAMA":return Sh;case"ANTHROPIC":return bh;case"AWS":return kh;case"GOOGLE":return null}},[i.model.provider]);return e(q,{collapsible:!0,backgroundColor:"yellow-100",borderColor:"yellow-700",variant:"compact",title:s(b,{direction:"row",gap:"size-100",children:[e(Ui,{spanKind:"tool"}),e(F,{children:m??"Tool"})]}),bodyStyle:{padding:0},extra:s(b,{direction:"row",gap:"size-100",children:[e(Se,{text:y}),e(E,{"aria-label":"Delete tool",leadingVisual:e(D,{svg:e(Je,{})}),size:"S",onPress:()=>{const h=o.filter(C=>C.id!==d.id),k=typeof i.toolChoice=="object"&&m!=null&&vh(i.toolChoice)===m;let S=i.toolChoice;h.length===0?S=void 0:k&&(S="auto"),t({instanceId:n,patch:{tools:h,toolChoice:S},dirty:!0})}})]}),children:e(Do,{preInitializationMinHeight:_F,children:e(pn,{value:c,onChange:g,jsonSchema:f})})})}function wF(n){const a=n.playgroundInstanceId,l=Q(d=>d.instances.find(c=>c.id===n.playgroundInstanceId)),t=Q(d=>d.updateInstance);if(l==null)throw new Error(`Playground instance ${a} not found`);const{tools:i}=l;if(i==null)throw new Error(`Playground instance ${a} does not have tools`);const r=p.useMemo(()=>i.map(d=>ud(d)).filter(d=>d!=null),[i]),o=l.model.provider;return Fh(o)?s(xe,{id:"tools",children:[s(Pe,{arrowPosition:"start",children:["Tools",e(Nn,{children:i.length})]}),e(Ie,{children:e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-200",children:[e(Tt,{children:e(Ch,{provider:o,choice:l.toolChoice,onChange:d=>{t({instanceId:a,patch:{toolChoice:d},dirty:!0})},toolNames:r})}),e(b,{direction:"column",gap:"size-200",children:i.map(d=>e(AF,{playgroundInstanceId:a,toolId:d.id},d.id))})]})})})]}):null}const Sm=1,RF=Sm+1;function EF(n){const a=n.playgroundInstanceId,l=Q(g=>g.templateFormat),t=Q(g=>g.updateInstance),i=p.useMemo(()=>bm(a),[a]),r=Q(i);if(!r)throw new Error(`Playground instance ${a} not found`);const o=r.tools.length>0,d=r.model.invocationParameters.find(g=>_a(g,{canonicalName:Zn,invocationName:Gn}))!=null,{template:c}=r;if(c.__type!=="chat")throw new Error(`Invalid template type ${c.__type}`);const u=c.messageIds,y=xy(Ar(Ry),Ar(wy,{coordinateGetter:Ay}));return s(_y,{sensors:y,onDragEnd:({active:g,over:m})=>{if(!m||g.id===m.id)return;const f=u.findIndex(S=>S===g.id),h=u.findIndex(S=>S===m.id),k=Ly(u,f,h);t({instanceId:a,patch:{template:{__type:"chat",messageIds:k}},dirty:!0})},children:[e(Dy,{items:u,children:e("ul",{css:K`
3749
3749
  display: flex;
3750
3750
  flex-direction: column;
3751
3751
  gap: var(--ac-global-dimension-size-200);
3752
3752
  padding: var(--ac-global-dimension-size-200);
3753
- `,children:u.map(g=>e(VF,{playgroundInstanceId:a,templateFormat:l,messageId:g},g))})}),e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderColor:"dark",borderTopWidth:"thin",borderBottomWidth:o||d?"thin":void 0,children:e(xF,{instanceId:a,hasResponseFormat:d})}),o||d?s(wn,{defaultExpandedKeys:["tools","response-format"],children:[o?e(wF,{...n}):null,d?e(LF,{...n}):null]}):null]})}function MF({message:n,updateMessage:a,templateFormat:l,playgroundInstanceId:t,messageMode:i}){const r=p.useCallback(o=>{a({content:o})},[a]);return i==="toolCalls"?e(v,{paddingTop:"size-100",paddingStart:"size-250",paddingEnd:"size-250",paddingBottom:"size-200",children:e(yl,{label:"Tool Calls",children:e(rn,{width:"100%",children:e(FF,{playgroundInstanceId:t,messageId:n.id})})})}):n.role==="tool"?s(Tt,{onSubmit:o=>{o.preventDefault()},children:[e(v,{paddingX:"size-200",paddingY:"size-100",borderColor:"yellow-700",borderBottomWidth:"thin",children:e(ie,{value:n.toolCallId,onChange:o=>a({toolCallId:o}),"aria-label":"Tool Call ID",size:"S",children:e(ae,{placeholder:"Tool Call ID"})})}),e(pn,{value:n.content??'""',"aria-label":"tool message content",height:"100%",onChange:o=>a({content:o})})]}):e(Dt,{children:e(Lt,{height:"100%",defaultValue:n.content||"","aria-label":"Message content",templateFormat:l,onChange:r})})}function VF({playgroundInstanceId:n,templateFormat:a,messageId:l}){const t=Q(z=>z.updateMessage),i=Q(z=>z.deleteMessage),{attributes:r,listeners:o,setNodeRef:d,transform:c,transition:u,setActivatorNodeRef:y,isDragging:g}=Ey({id:l}),m=p.useMemo(()=>z=>{var A;return(A=z.instances.find(V=>V.id===n))==null?void 0:A.model},[n]),f=Q(m);if(!f)throw new Error(`Instance model not found for instance ${n}`);const h=p.useMemo(()=>Ii(l),[l]),k=Q(h),S=at(k.role),C={transform:My.Translate.toString(c),transition:u,zIndex:g?RF:Sm},T=k.toolCalls!=null&&k.toolCalls.length>0,[_,x]=p.useState(T?"toolCalls":"text"),[N,w]=p.useState(k.content),[$,I]=p.useState(k.toolCalls),M=p.useCallback(z=>{t({instanceId:n,messageId:l,patch:z})},[n,l,t]);return e("li",{ref:d,style:C,children:e(q,{collapsible:!0,variant:"compact",bodyStyle:{padding:0},...S,title:e("div",{css:K`
3753
+ `,children:u.map(g=>e(VF,{playgroundInstanceId:a,templateFormat:l,messageId:g},g))})}),e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderColor:"dark",borderTopWidth:"thin",borderBottomWidth:o||d?"thin":void 0,children:e(xF,{instanceId:a,hasResponseFormat:d})}),o||d?s(wn,{defaultExpandedKeys:["tools","response-format"],children:[o?e(wF,{...n}):null,d?e(LF,{...n}):null]}):null]})}function MF({message:n,updateMessage:a,templateFormat:l,playgroundInstanceId:t,messageMode:i}){const r=p.useCallback(o=>{a({content:o})},[a]);return i==="toolCalls"?e(v,{paddingTop:"size-100",paddingStart:"size-250",paddingEnd:"size-250",paddingBottom:"size-200",children:e(yl,{label:"Tool Calls",children:e(rn,{width:"100%",children:e(FF,{playgroundInstanceId:t,messageId:n.id})})})}):n.role==="tool"?s(Tt,{onSubmit:o=>{o.preventDefault()},children:[e(v,{paddingX:"size-200",paddingY:"size-100",borderColor:"yellow-700",borderBottomWidth:"thin",children:e(ie,{value:n.toolCallId,onChange:o=>a({toolCallId:o}),"aria-label":"Tool Call ID",size:"S",children:e(ae,{placeholder:"Tool Call ID"})})}),e(pn,{value:n.content??'""',"aria-label":"tool message content",height:"100%",onChange:o=>a({content:o})})]}):e(Dt,{children:e(Lt,{height:"100%",defaultValue:n.content||"","aria-label":"Message content",templateFormat:l,onChange:r})})}function VF({playgroundInstanceId:n,templateFormat:a,messageId:l}){const t=Q(z=>z.updateMessage),i=Q(z=>z.deleteMessage),{attributes:r,listeners:o,setNodeRef:d,transform:c,transition:u,setActivatorNodeRef:y,isDragging:g}=Ey({id:l}),m=p.useMemo(()=>z=>{var A;return(A=z.instances.find(V=>V.id===n))==null?void 0:A.model},[n]),f=Q(m);if(!f)throw new Error(`Instance model not found for instance ${n}`);const h=p.useMemo(()=>Ii(l),[l]),k=Q(h),S=at(k.role),C={transform:My.Translate.toString(c),transition:u,zIndex:g?RF:Sm},P=k.toolCalls!=null&&k.toolCalls.length>0,[L,x]=p.useState(P?"toolCalls":"text"),[N,w]=p.useState(k.content),[$,I]=p.useState(k.toolCalls),M=p.useCallback(z=>{t({instanceId:n,messageId:l,patch:z})},[n,l,t]);return e("li",{ref:d,style:C,children:e(q,{collapsible:!0,variant:"compact",bodyStyle:{padding:0},...S,title:e("div",{css:K`
3754
3754
  // Align the role picker with the prompt picker in PlaygroundTemplate header
3755
3755
  margin-left: var(--ac-global-dimension-size-150);
3756
- `,children:e(PF,{includeLabel:!1,role:k.role,onChange:z=>{let A=k.content,V=k.toolCalls;z!=="ai"&&(V=void 0,x("text")),z==="tool"&&(A='""'),t({instanceId:n,messageId:l,patch:{role:z,toolCalls:V,content:A}})}})}),extra:s(b,{direction:"row",gap:"size-100",children:[k.role==="ai"?e(KF,{messageMode:_,onChange:z=>{switch(x(z),z){case"text":I(k.toolCalls),t({instanceId:n,messageId:l,patch:{content:N,toolCalls:void 0}});break;case"toolCalls":w(k.content),t({instanceId:n,messageId:l,patch:{content:"",toolCalls:$!=null?Io({toolCalls:$,provider:f.provider}):[F0(f.provider)]}});break;default:Ee()}}}):null,e(Se,{text:_==="toolCalls"?Yn(k.toolCalls).json??"":k.content??""}),e(E,{"aria-label":"Delete message",leadingVisual:e(D,{svg:e(Je,{})}),size:"S",onPress:()=>{i({instanceId:n,messageId:l})}}),e(Kh,{ref:y,listeners:o,attributes:r})]}),children:e("div",{children:e(MF,{message:k,messageMode:_,playgroundInstanceId:n,templateFormat:a,updateMessage:M})})})})}function zF(n){const a=n.playgroundInstanceId,l=Q(f=>f.updateInstance),t=Q(f=>f.addMessage),i=Q(f=>f.setDirty),r=Q(f=>f.instances),o=r.find(f=>f.id===a),d=r.findIndex(f=>f.id===a),c=o==null?void 0:o.prompt,u=c==null?void 0:c.id,y=Q(f=>f.dirtyInstances[a]),g=p.useCallback(async f=>{if(!f){l({instanceId:a,patch:{prompt:null},dirty:!1});return}const h=await yu(f);h&&(l({instanceId:a,patch:{...h.instance,template:{__type:"chat",messageIds:[]}},dirty:!1}),t({playgroundInstanceId:a,messages:h.instance.template.messages}),i(a,!1))},[a,l,t,i]);if(!o)throw new Error(`Playground instance ${a} not found`);const{template:m}=o;return e(Y,{children:e(q,{title:s(b,{direction:"row",gap:"size-100",alignItems:"center",marginEnd:"size-100",children:[e(Hi,{index:d}),e(gm,{promptId:u,onChange:g})]}),collapsible:!0,variant:"compact",bodyStyle:{padding:0},extra:s(b,{direction:"row",gap:"size-100",children:[e(p.Suspense,{fallback:e("div",{children:e(pe,{size:"S"})}),children:e(vF,{instanceId:a})}),e(kF,{...n}),e($F,{instanceId:a,dirty:y}),r.length>1?e(NF,{...n}):null]}),children:m.__type==="chat"?e(p.Suspense,{children:e(EF,{...n})}):"Completion Template"})})}function NF(n){const a=Q(l=>l.deleteInstance);return s(Xn,{children:[e(qa,{children:e(E,{size:"S","aria-label":"Delete this instance of the playground",leadingVisual:e(D,{svg:e(Je,{})}),onPress:()=>{a(n.playgroundInstanceId)}})}),e(Ia,{children:e(Ja,{children:"Delete this instance of the playground"})})]})}function $F({instanceId:n,dirty:a}){var t;const l=Q(i=>i.instances.find(r=>r.id===n));if(!l)throw new Error(`Instance ${n} not found`);return s(J,{children:[s(Xn,{delay:100,offset:5,placement:"top",children:[e(qa,{children:e(E,{variant:a?"primary":void 0,size:"S",children:"Save"})}),e(Ia,{children:e(Ja,{children:"Save this prompt"})})]}),e(ne,{children:e(Z,{children:e(aF,{instanceId:n,selectedPromptId:(t=l.prompt)==null?void 0:t.id})})})]})}function jF({size:n}){const a=Q(t=>t.templateFormat),l=Q(t=>t.setTemplateFormat);return e("div",{css:K`
3756
+ `,children:e(PF,{includeLabel:!1,role:k.role,onChange:z=>{let A=k.content,V=k.toolCalls;z!=="ai"&&(V=void 0,x("text")),z==="tool"&&(A='""'),t({instanceId:n,messageId:l,patch:{role:z,toolCalls:V,content:A}})}})}),extra:s(b,{direction:"row",gap:"size-100",children:[k.role==="ai"?e(KF,{messageMode:L,onChange:z=>{switch(x(z),z){case"text":I(k.toolCalls),t({instanceId:n,messageId:l,patch:{content:N,toolCalls:void 0}});break;case"toolCalls":w(k.content),t({instanceId:n,messageId:l,patch:{content:"",toolCalls:$!=null?Io({toolCalls:$,provider:f.provider}):[F0(f.provider)]}});break;default:Ee()}}}):null,e(Se,{text:L==="toolCalls"?Yn(k.toolCalls).json??"":k.content??""}),e(E,{"aria-label":"Delete message",leadingVisual:e(D,{svg:e(Je,{})}),size:"S",onPress:()=>{i({instanceId:n,messageId:l})}}),e(Kh,{ref:y,listeners:o,attributes:r})]}),children:e("div",{children:e(MF,{message:k,messageMode:L,playgroundInstanceId:n,templateFormat:a,updateMessage:M})})})})}function zF(n){const a=n.playgroundInstanceId,l=Q(f=>f.updateInstance),t=Q(f=>f.addMessage),i=Q(f=>f.setDirty),r=Q(f=>f.instances),o=r.find(f=>f.id===a),d=r.findIndex(f=>f.id===a),c=o==null?void 0:o.prompt,u=c==null?void 0:c.id,y=Q(f=>f.dirtyInstances[a]),g=p.useCallback(async f=>{if(!f){l({instanceId:a,patch:{prompt:null},dirty:!1});return}const h=await yu(f);h&&(l({instanceId:a,patch:{...h.instance,template:{__type:"chat",messageIds:[]}},dirty:!1}),t({playgroundInstanceId:a,messages:h.instance.template.messages}),i(a,!1))},[a,l,t,i]);if(!o)throw new Error(`Playground instance ${a} not found`);const{template:m}=o;return e(Y,{children:e(q,{title:s(b,{direction:"row",gap:"size-100",alignItems:"center",marginEnd:"size-100",children:[e(Hi,{index:d}),e(gm,{promptId:u,onChange:g})]}),collapsible:!0,variant:"compact",bodyStyle:{padding:0},extra:s(b,{direction:"row",gap:"size-100",children:[e(p.Suspense,{fallback:e("div",{children:e(pe,{size:"S"})}),children:e(vF,{instanceId:a})}),e(kF,{...n}),e($F,{instanceId:a,dirty:y}),r.length>1?e(NF,{...n}):null]}),children:m.__type==="chat"?e(p.Suspense,{children:e(EF,{...n})}):"Completion Template"})})}function NF(n){const a=Q(l=>l.deleteInstance);return s(Xn,{children:[e(qa,{children:e(E,{size:"S","aria-label":"Delete this instance of the playground",leadingVisual:e(D,{svg:e(Je,{})}),onPress:()=>{a(n.playgroundInstanceId)}})}),e(Ia,{children:e(Ja,{children:"Delete this instance of the playground"})})]})}function $F({instanceId:n,dirty:a}){var t;const l=Q(i=>i.instances.find(r=>r.id===n));if(!l)throw new Error(`Instance ${n} not found`);return s(J,{children:[s(Xn,{delay:100,offset:5,placement:"top",children:[e(qa,{children:e(E,{variant:a?"primary":void 0,size:"S",children:"Save"})}),e(Ia,{children:e(Ja,{children:"Save this prompt"})})]}),e(ne,{children:e(Z,{children:e(aF,{instanceId:n,selectedPromptId:(t=l.prompt)==null?void 0:t.id})})})]})}function jF({size:n}){const a=Q(t=>t.templateFormat),l=Q(t=>t.setTemplateFormat);return e("div",{css:K`
3757
3757
  & * {
3758
3758
  white-space: nowrap;
3759
3759
  }
@@ -3762,7 +3762,7 @@ fragment ModelProviderSelectFragment on Query {
3762
3762
  overflow: hidden;
3763
3763
  flex-direction: column;
3764
3764
  height: 100%;
3765
- `;function Kr(n){const{modelProviders:a}=P.useLazyLoadQuery(fu,{}),l=bn(r=>r.modelConfigByProvider),t=bn(r=>r.playgroundStreamingEnabled);return a.some(r=>r.dependenciesInstalled)?s(rS,{...n,streaming:t,modelConfigByProvider:l,children:[s("div",{css:OF,children:[e(v,{borderBottomColor:"dark",borderBottomWidth:"thin",padding:"size-200",flex:"none",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(de,{level:1,children:"Playground"}),s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Yv,{}),e(Nv,{}),e(hS,{}),e(Xv,{})]})]})}),e(JF,{})]}),e(p.Suspense,{children:e(gS,{})})]}):e(fS,{availableProviders:a})}function QF(){const n=Q(i=>i.addInstance),a=Q(i=>i.instances),l=a.length,t=a.some(i=>i.activeRunId!=null);return e(E,{size:"S","aria-label":"add prompt",leadingVisual:e(D,{svg:e(jn,{})}),isDisabled:l>=Ak||t,onPress:()=>{n()},children:"Compare"})}const BF=K`
3765
+ `;function Kr(n){const{modelProviders:a}=T.useLazyLoadQuery(fu,{}),l=bn(r=>r.modelConfigByProvider),t=bn(r=>r.playgroundStreamingEnabled);return a.some(r=>r.dependenciesInstalled)?s(rS,{...n,streaming:t,modelConfigByProvider:l,children:[s("div",{css:OF,children:[e(v,{borderBottomColor:"dark",borderBottomWidth:"thin",padding:"size-200",flex:"none",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(de,{level:1,children:"Playground"}),s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Yv,{}),e(Nv,{}),e(hS,{}),e(Xv,{})]})]})}),e(JF,{})]}),e(p.Suspense,{children:e(gS,{})})]}):e(fS,{availableProviders:a})}function QF(){const n=Q(i=>i.addInstance),a=Q(i=>i.instances),l=a.length,t=a.some(i=>i.activeRunId!=null);return e(E,{size:"S","aria-label":"add prompt",leadingVisual:e(D,{svg:e(jn,{})}),isDisabled:l>=Ak||t,onPress:()=>{n()},children:"Compare"})}const BF=K`
3766
3766
  display: flex;
3767
3767
  flex-direction: column;
3768
3768
  height: 100%;
@@ -3896,9 +3896,9 @@ fragment PromptVersionTagsList_data on PromptVersion {
3896
3896
  name
3897
3897
  }
3898
3898
  }
3899
- `}}}();Cm.hash="a6e4352854be2ab5fd0c10368a3469ad";function ZF({onNewTagCreated:n,promptVersionId:a,onDismiss:l}){const{control:t,handleSubmit:i,formState:{isDirty:r}}=Qe({defaultValues:{name:"",description:""}}),[o,d]=p.useState(null),[c,u]=P.useMutation(Cm);return e(ne,{children:e(Z,{size:"M",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"New Prompt Tag"}),e(ue,{children:e(me,{onPress:l,slot:"close"})})]}),o?e(Ke,{variant:"danger",banner:!0,children:o}):null,s(un,{onSubmit:i(g=>{d(null),c({variables:{input:{name:g.name,description:g.description,promptVersionId:a},promptVersionId:a},onCompleted:()=>{n(g),l()},onError:m=>{d(m.message)}})}),children:[s(v,{padding:"size-200",children:[e(G,{name:"name",control:t,rules:{required:"Name is required",pattern:pm},render:({field:{name:g,onChange:m,onBlur:f,value:h},fieldState:{invalid:k,error:S}})=>s(ie,{isInvalid:k,onChange:m,onBlur:f,name:g,value:h.toString(),children:[e(W,{children:"Tag Name"}),e(ae,{placeholder:"e.x. prod"}),S!=null&&S.message?e(Ce,{children:S.message}):e(F,{slot:"description",children:"The identifier of the tag"})]})}),e(G,{name:"description",control:t,render:({field:{name:g,onChange:m,onBlur:f,value:h},fieldState:{invalid:k,error:S}})=>s(ie,{isInvalid:k,onChange:m,name:g,onBlur:f,value:h.toString(),children:[e(W,{children:"Description"}),e(Ra,{placeholder:"A description of the tag"}),S!=null&&S.message?e(Ce,{children:S.message}):e(F,{slot:"description",children:"A description of the tag (optional)"})]})})]}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopColor:"dark",borderTopWidth:"thin",children:s(b,{gap:"size-100",justifyContent:"end",children:[e(E,{variant:"default",size:"S",onPress:l,isDisabled:u,children:"Cancel"}),e(E,{variant:r?"primary":"default",size:"S",type:"submit",isDisabled:u,children:"Create Tag"})]})})]})]})})})})}function XF(){const[n,a]=p.useState(!1),[l,t]=p.useState(!1),[i,r]=p.useState(0),o=ke(),{promptId:d,versionId:c}=We();if(!d)throw new Error("Expected promptId to be defined");if(!c)throw new Error("Expected versionId to be defined");return s("div",{children:[s(J,{isOpen:n,onOpenChange:a,children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(Ih,{})}),children:"Tag Version"}),s(kn,{placement:"bottom end",children:[e(Lo,{}),s(X,{children:[e(p.Suspense,{fallback:e(v,{padding:"size-100",children:e(pe,{size:"S"})}),children:e(YF,{promptId:d,versionId:c,fetchKey:i,onTagSet:u=>{r(y=>y+1),o({title:"Tag Set",message:`The tag ${u} has been set on the version`})}})}),e(v,{padding:"size-100",width:"250px",children:e(E,{leadingVisual:e(D,{svg:e(Ca,{})}),size:"S",css:K`
3899
+ `}}}();Cm.hash="a6e4352854be2ab5fd0c10368a3469ad";function ZF({onNewTagCreated:n,promptVersionId:a,onDismiss:l}){const{control:t,handleSubmit:i,formState:{isDirty:r}}=Qe({defaultValues:{name:"",description:""}}),[o,d]=p.useState(null),[c,u]=T.useMutation(Cm);return e(ne,{children:e(Z,{size:"M",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"New Prompt Tag"}),e(ue,{children:e(me,{onPress:l,slot:"close"})})]}),o?e(Ke,{variant:"danger",banner:!0,children:o}):null,s(un,{onSubmit:i(g=>{d(null),c({variables:{input:{name:g.name,description:g.description,promptVersionId:a},promptVersionId:a},onCompleted:()=>{n(g),l()},onError:m=>{d(m.message)}})}),children:[s(v,{padding:"size-200",children:[e(G,{name:"name",control:t,rules:{required:"Name is required",pattern:pm},render:({field:{name:g,onChange:m,onBlur:f,value:h},fieldState:{invalid:k,error:S}})=>s(ie,{isInvalid:k,onChange:m,onBlur:f,name:g,value:h.toString(),children:[e(W,{children:"Tag Name"}),e(ae,{placeholder:"e.x. prod"}),S!=null&&S.message?e(Ce,{children:S.message}):e(F,{slot:"description",children:"The identifier of the tag"})]})}),e(G,{name:"description",control:t,render:({field:{name:g,onChange:m,onBlur:f,value:h},fieldState:{invalid:k,error:S}})=>s(ie,{isInvalid:k,onChange:m,name:g,onBlur:f,value:h.toString(),children:[e(W,{children:"Description"}),e(Ra,{placeholder:"A description of the tag"}),S!=null&&S.message?e(Ce,{children:S.message}):e(F,{slot:"description",children:"A description of the tag (optional)"})]})})]}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopColor:"dark",borderTopWidth:"thin",children:s(b,{gap:"size-100",justifyContent:"end",children:[e(E,{variant:"default",size:"S",onPress:l,isDisabled:u,children:"Cancel"}),e(E,{variant:r?"primary":"default",size:"S",type:"submit",isDisabled:u,children:"Create Tag"})]})})]})]})})})})}function XF(){const[n,a]=p.useState(!1),[l,t]=p.useState(!1),[i,r]=p.useState(0),o=ke(),{promptId:d,versionId:c}=We();if(!d)throw new Error("Expected promptId to be defined");if(!c)throw new Error("Expected versionId to be defined");return s("div",{children:[s(J,{isOpen:n,onOpenChange:a,children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(Ih,{})}),children:"Tag Version"}),s(kn,{placement:"bottom end",children:[e(Lo,{}),s(X,{children:[e(p.Suspense,{fallback:e(v,{padding:"size-100",children:e(pe,{size:"S"})}),children:e(YF,{promptId:d,versionId:c,fetchKey:i,onTagSet:u=>{r(y=>y+1),o({title:"Tag Set",message:`The tag ${u} has been set on the version`})}})}),e(v,{padding:"size-100",width:"250px",children:e(E,{leadingVisual:e(D,{svg:e(Ca,{})}),size:"S",css:K`
3900
3900
  width: 100%;
3901
- `,onPress:()=>{a(!1),t(!0)},children:"New Tag"})})]})]})]}),e(J,{isOpen:l,onOpenChange:u=>{t(u)},children:e(ZF,{promptVersionId:c,onDismiss:()=>t(!1),onNewTagCreated:u=>{r(y=>y+1),o({title:"Tag Created",message:`The tag ${u.name} has been created and set on the prompt version`})}})})]})}function YF({promptId:n,versionId:a,fetchKey:l,onTagSet:t}){var y,g;const i=P.useLazyLoadQuery(Fm,{promptId:n,versionId:a},{fetchKey:l,fetchPolicy:"store-and-network"}),r=p.useMemo(()=>{var m,f;return((f=(m=i==null?void 0:i.prompt)==null?void 0:m.versionTags)==null?void 0:f.map(h=>h.name))||[]},[(y=i==null?void 0:i.prompt)==null?void 0:y.versionTags]),o=p.useMemo(()=>{var m,f;return((f=(m=i==null?void 0:i.promptVersion)==null?void 0:m.tags)==null?void 0:f.map(h=>h.name))||[]},[(g=i==null?void 0:i.promptVersion)==null?void 0:g.tags]),d=p.useMemo(()=>Array.from(new Set([...jr.map(m=>m.name),...r])),[r]),[c,u]=P.useMutation(vm);return e("ul",{children:d.map(m=>{const f=o.includes(m);return e("li",{children:e(v,{paddingY:"size-100",paddingX:"size-200",borderBottomColor:"light",borderBottomWidth:"thin",children:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("input",{type:"checkbox",name:m,checked:f,disabled:f||u,onChange:h=>{if(h.target.checked){const k=!o.includes(m);let S="";if(k){const C=jr.find(T=>T.name===m);S=(C==null?void 0:C.description)||""}c({variables:{input:{name:m,promptVersionId:a,description:S},promptId:n},onCompleted:()=>{t(m)}})}}}),e("span",{children:m})]})})},m)})})}function gI(){const n=Ue();return qe(n),e(eC,{promptVersion:n.promptVersion})}function eC({promptVersion:n}){return e(v,{width:"100%",overflow:"auto",elementType:"section",children:e(v,{padding:"size-200",width:"100%",overflow:"auto",children:s(b,{direction:"column",gap:"size-200",maxWidth:900,marginStart:"auto",marginEnd:"auto",children:[s(b,{direction:"row",justifyContent:"space-between",children:[s(b,{direction:"row",gap:"size-100",children:[e(de,{level:2,children:`Version: ${n.id}`}),e(du,{promptVersion:n})]}),s(b,{direction:"row",gap:"size-100",children:[e(Se,{text:n.id,children:"Version ID"}),e(XF,{})]})]}),e(eu,{promptVersion:n}),e(Hc,{promptVersion:n}),e(iu,{promptVersion:n})]})})})}const Km=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"modelName",storageKey:null},d=[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],c={alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:d,storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"promptVersionLoaderQuery",selections:[{alias:"promptVersion",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[{args:null,kind:"FragmentSpread",name:"PromptInvocationParameters__main"},{args:null,kind:"FragmentSpread",name:"PromptChatMessagesCard__main"},{args:null,kind:"FragmentSpread",name:"PromptCodeExportCard__main"},{args:null,kind:"FragmentSpread",name:"PromptModelConfigurationCard__main"},{args:null,kind:"FragmentSpread",name:"PromptVersionTagsList_data"},i,r,o,c,{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[u],storageKey:null}],type:"PromptVersion",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"promptVersionLoaderQuery",selections:[{alias:"promptVersion",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[r,{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[y,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null},u],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[y,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null},o,{alias:null,args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:d,storageKey:null},c,{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[t,u],storageKey:null},i],type:"PromptVersion",abstractKey:null}],storageKey:null}]},params:{cacheID:"4f37a4d04a5a5999d2f9f42875519473",id:null,metadata:{},name:"promptVersionLoaderQuery",operationKind:"query",text:`query promptVersionLoaderQuery(
3901
+ `,onPress:()=>{a(!1),t(!0)},children:"New Tag"})})]})]})]}),e(J,{isOpen:l,onOpenChange:u=>{t(u)},children:e(ZF,{promptVersionId:c,onDismiss:()=>t(!1),onNewTagCreated:u=>{r(y=>y+1),o({title:"Tag Created",message:`The tag ${u.name} has been created and set on the prompt version`})}})})]})}function YF({promptId:n,versionId:a,fetchKey:l,onTagSet:t}){var y,g;const i=T.useLazyLoadQuery(Fm,{promptId:n,versionId:a},{fetchKey:l,fetchPolicy:"store-and-network"}),r=p.useMemo(()=>{var m,f;return((f=(m=i==null?void 0:i.prompt)==null?void 0:m.versionTags)==null?void 0:f.map(h=>h.name))||[]},[(y=i==null?void 0:i.prompt)==null?void 0:y.versionTags]),o=p.useMemo(()=>{var m,f;return((f=(m=i==null?void 0:i.promptVersion)==null?void 0:m.tags)==null?void 0:f.map(h=>h.name))||[]},[(g=i==null?void 0:i.promptVersion)==null?void 0:g.tags]),d=p.useMemo(()=>Array.from(new Set([...jr.map(m=>m.name),...r])),[r]),[c,u]=T.useMutation(vm);return e("ul",{children:d.map(m=>{const f=o.includes(m);return e("li",{children:e(v,{paddingY:"size-100",paddingX:"size-200",borderBottomColor:"light",borderBottomWidth:"thin",children:s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("input",{type:"checkbox",name:m,checked:f,disabled:f||u,onChange:h=>{if(h.target.checked){const k=!o.includes(m);let S="";if(k){const C=jr.find(P=>P.name===m);S=(C==null?void 0:C.description)||""}c({variables:{input:{name:m,promptVersionId:a,description:S},promptId:n},onCompleted:()=>{t(m)}})}}}),e("span",{children:m})]})})},m)})})}function gI(){const n=Ue();return qe(n),e(eC,{promptVersion:n.promptVersion})}function eC({promptVersion:n}){return e(v,{width:"100%",overflow:"auto",elementType:"section",children:e(v,{padding:"size-200",width:"100%",overflow:"auto",children:s(b,{direction:"column",gap:"size-200",maxWidth:900,marginStart:"auto",marginEnd:"auto",children:[s(b,{direction:"row",justifyContent:"space-between",children:[s(b,{direction:"row",gap:"size-100",children:[e(de,{level:2,children:`Version: ${n.id}`}),e(du,{promptVersion:n})]}),s(b,{direction:"row",gap:"size-100",children:[e(Se,{text:n.id,children:"Version ID"}),e(XF,{})]})]}),e(eu,{promptVersion:n}),e(Hc,{promptVersion:n}),e(iu,{promptVersion:n})]})})})}const Km=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"modelName",storageKey:null},d=[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],c={alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:d,storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"promptVersionLoaderQuery",selections:[{alias:"promptVersion",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[{args:null,kind:"FragmentSpread",name:"PromptInvocationParameters__main"},{args:null,kind:"FragmentSpread",name:"PromptChatMessagesCard__main"},{args:null,kind:"FragmentSpread",name:"PromptCodeExportCard__main"},{args:null,kind:"FragmentSpread",name:"PromptModelConfigurationCard__main"},{args:null,kind:"FragmentSpread",name:"PromptVersionTagsList_data"},i,r,o,c,{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[u],storageKey:null}],type:"PromptVersion",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"promptVersionLoaderQuery",selections:[{alias:"promptVersion",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[r,{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[y,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null},u],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[y,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null},o,{alias:null,args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:d,storageKey:null},c,{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[t,u],storageKey:null},i],type:"PromptVersion",abstractKey:null}],storageKey:null}]},params:{cacheID:"4f37a4d04a5a5999d2f9f42875519473",id:null,metadata:{},name:"promptVersionLoaderQuery",operationKind:"query",text:`query promptVersionLoaderQuery(
3902
3902
  $id: ID!
3903
3903
  ) {
3904
3904
  promptVersion: node(id: $id) {
@@ -4052,7 +4052,7 @@ fragment PromptVersionTagsList_data on PromptVersion {
4052
4052
  name
4053
4053
  }
4054
4054
  }
4055
- `}}}();Km.hash="df4fcaf877c81b47d2b61098c91e6771";async function pI(n){const{versionId:a}=n.params;return await P.fetchQuery(ve,Km,{id:a}).toPromise().catch(()=>{throw new Error("Prompt version not found")})}const Tm=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Literal",name:"first",value:1}],concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"promptVersion",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[l],storageKey:null}],storageKey:null}],storageKey:"promptVersions(first:1)"}],type:"Prompt",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"promptVersionsLoaderQuery",selections:[{alias:"prompt",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"promptVersionsLoaderQuery",selections:[{alias:"prompt",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t,l],storageKey:null}]},params:{cacheID:"72451f81ebdef0195b7338c67ae5f327",id:null,metadata:{},name:"promptVersionsLoaderQuery",operationKind:"query",text:`query promptVersionsLoaderQuery(
4055
+ `}}}();Km.hash="df4fcaf877c81b47d2b61098c91e6771";async function pI(n){const{versionId:a}=n.params;return await T.fetchQuery(ve,Km,{id:a}).toPromise().catch(()=>{throw new Error("Prompt version not found")})}const Tm=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Literal",name:"first",value:1}],concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"promptVersion",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[l],storageKey:null}],storageKey:null}],storageKey:"promptVersions(first:1)"}],type:"Prompt",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"promptVersionsLoaderQuery",selections:[{alias:"prompt",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"promptVersionsLoaderQuery",selections:[{alias:"prompt",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t,l],storageKey:null}]},params:{cacheID:"72451f81ebdef0195b7338c67ae5f327",id:null,metadata:{},name:"promptVersionsLoaderQuery",operationKind:"query",text:`query promptVersionsLoaderQuery(
4056
4056
  $id: ID!
4057
4057
  ) {
4058
4058
  prompt: node(id: $id) {
@@ -4082,7 +4082,7 @@ fragment PromptVersionTagsList_data on PromptVersion {
4082
4082
  text-decoration: none;
4083
4083
  color: inherit;
4084
4084
  }
4085
- `,aC=({version:n,active:a})=>e("div",{css:nC,"data-active":a,children:e(zy,{to:`${n.id}`,children:e(v,{width:"100%",paddingY:"size-100",paddingX:"size-200",children:e(cu,{promptVersion:n})})})}),Fs=400,lC=({prompt:n,itemActive:a})=>{const{promptVersions:l}=P.useFragment(Im,n);return e(v,{height:"100%",overflow:"auto",width:Fs,minWidth:Fs,borderRightWidth:"thin",borderColor:"grey-300",children:e(b,{direction:"column",children:l.edges.map(({version:t})=>e(aC,{version:t,active:a==null?void 0:a(t)},t.id))})})};function fI(){const{prompt:n}=fr(),{versionId:a}=We();return e(tC,{prompt:n,promptVersionId:a})}function tC({prompt:n,promptVersionId:a}){const l=P.useFragment(Pm,n),t=p.useCallback(i=>i.id===a,[a]);return e(v,{height:"100%",children:s(b,{direction:"row",height:"100%",children:[e(lC,{prompt:l,itemActive:t}),e(Te,{})]})})}const xm=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"sessionOtelId"}],a=[{alias:"session",args:[{kind:"Variable",name:"sessionId",variableName:"sessionOtelId"}],concreteType:"ProjectSession",kind:"LinkedField",name:"getProjectSessionByOtelId",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"projectId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"sessionRedirectLoaderQuery",selections:a,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"sessionRedirectLoaderQuery",selections:a},params:{cacheID:"4bb8960df96b198310aada6cff07b536",id:null,metadata:{},name:"sessionRedirectLoaderQuery",operationKind:"query",text:`query sessionRedirectLoaderQuery(
4085
+ `,aC=({version:n,active:a})=>e("div",{css:nC,"data-active":a,children:e(zy,{to:`${n.id}`,children:e(v,{width:"100%",paddingY:"size-100",paddingX:"size-200",children:e(cu,{promptVersion:n})})})}),Fs=400,lC=({prompt:n,itemActive:a})=>{const{promptVersions:l}=T.useFragment(Im,n);return e(v,{height:"100%",overflow:"auto",width:Fs,minWidth:Fs,borderRightWidth:"thin",borderColor:"grey-300",children:e(b,{direction:"column",children:l.edges.map(({version:t})=>e(aC,{version:t,active:a==null?void 0:a(t)},t.id))})})};function fI(){const{prompt:n}=fr(),{versionId:a}=We();return e(tC,{prompt:n,promptVersionId:a})}function tC({prompt:n,promptVersionId:a}){const l=T.useFragment(Pm,n),t=p.useCallback(i=>i.id===a,[a]);return e(v,{height:"100%",children:s(b,{direction:"row",height:"100%",children:[e(lC,{prompt:l,itemActive:t}),e(Te,{})]})})}const xm=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"sessionOtelId"}],a=[{alias:"session",args:[{kind:"Variable",name:"sessionId",variableName:"sessionOtelId"}],concreteType:"ProjectSession",kind:"LinkedField",name:"getProjectSessionByOtelId",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"projectId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"sessionRedirectLoaderQuery",selections:a,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"sessionRedirectLoaderQuery",selections:a},params:{cacheID:"4bb8960df96b198310aada6cff07b536",id:null,metadata:{},name:"sessionRedirectLoaderQuery",operationKind:"query",text:`query sessionRedirectLoaderQuery(
4086
4086
  $sessionOtelId: String!
4087
4087
  ) {
4088
4088
  session: getProjectSessionByOtelId(sessionId: $sessionOtelId) {
@@ -4090,7 +4090,7 @@ fragment PromptVersionTagsList_data on PromptVersion {
4090
4090
  id
4091
4091
  }
4092
4092
  }
4093
- `}}}();xm.hash="a5fa7aeac5b76471c9ac7fcf2ae8e05f";async function hI({params:n}){const{session_otel_id:a}=n;if(!a)throw new Error("Session redirect requires a session ID");const l=await P.fetchQuery(ve,xm,{sessionOtelId:a}).toPromise();if(l!=null&&l.session){const{projectId:t,id:i}=l.session;return Pa(`/projects/${t}/sessions/${i}`)}else throw new Error(`Session with id "${a}" not found`)}const Dm=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"spanOtelId"}],a=[{kind:"Variable",name:"spanId",variableName:"spanOtelId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},i={alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[l],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"spanRedirectLoaderQuery",selections:[{alias:"span",args:a,concreteType:"Span",kind:"LinkedField",name:"getSpanByOtelId",plural:!1,selections:[l,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t],storageKey:null},i],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"spanRedirectLoaderQuery",selections:[{alias:"span",args:a,concreteType:"Span",kind:"LinkedField",name:"getSpanByOtelId",plural:!1,selections:[l,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,l],storageKey:null},i],storageKey:null}]},params:{cacheID:"2985bb05472ca7556d8aa675123a98e3",id:null,metadata:{},name:"spanRedirectLoaderQuery",operationKind:"query",text:`query spanRedirectLoaderQuery(
4093
+ `}}}();xm.hash="a5fa7aeac5b76471c9ac7fcf2ae8e05f";async function hI({params:n}){const{session_otel_id:a}=n;if(!a)throw new Error("Session redirect requires a session ID");const l=await T.fetchQuery(ve,xm,{sessionOtelId:a}).toPromise();if(l!=null&&l.session){const{projectId:t,id:i}=l.session;return Pa(`/projects/${t}/sessions/${i}`)}else throw new Error(`Session with id "${a}" not found`)}const Dm=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"spanOtelId"}],a=[{kind:"Variable",name:"spanId",variableName:"spanOtelId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},i={alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[l],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"spanRedirectLoaderQuery",selections:[{alias:"span",args:a,concreteType:"Span",kind:"LinkedField",name:"getSpanByOtelId",plural:!1,selections:[l,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t],storageKey:null},i],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"spanRedirectLoaderQuery",selections:[{alias:"span",args:a,concreteType:"Span",kind:"LinkedField",name:"getSpanByOtelId",plural:!1,selections:[l,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,l],storageKey:null},i],storageKey:null}]},params:{cacheID:"2985bb05472ca7556d8aa675123a98e3",id:null,metadata:{},name:"spanRedirectLoaderQuery",operationKind:"query",text:`query spanRedirectLoaderQuery(
4094
4094
  $spanOtelId: String!
4095
4095
  ) {
4096
4096
  span: getSpanByOtelId(spanId: $spanOtelId) {
@@ -4104,7 +4104,7 @@ fragment PromptVersionTagsList_data on PromptVersion {
4104
4104
  }
4105
4105
  }
4106
4106
  }
4107
- `}}}();Dm.hash="a80ec47ffd0bc1b23a4641393a324120";async function kI({params:n}){const{span_otel_id:a}=n;if(!a)throw new Error("Span redirect requires a span ID");const l=await P.fetchQuery(ve,Dm,{spanOtelId:a}).toPromise();if(l!=null&&l.span){const{id:t,trace:i,project:r}=l.span;return Pa(`/projects/${r.id}/spans/${i.traceId}?selectedSpanNodeId=${t}`)}else throw new Error(`Span with id "${a}" not found`)}const Lm=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"traceOtelId"}],a=[{kind:"Variable",name:"traceId",variableName:"traceOtelId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[l],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"traceRedirectLoaderQuery",selections:[{alias:"trace",args:a,concreteType:"Trace",kind:"LinkedField",name:"getTraceByOtelId",plural:!1,selections:[t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"traceRedirectLoaderQuery",selections:[{alias:"trace",args:a,concreteType:"Trace",kind:"LinkedField",name:"getTraceByOtelId",plural:!1,selections:[t,l],storageKey:null}]},params:{cacheID:"6e8acff3fd035f125c0a261b55f43015",id:null,metadata:{},name:"traceRedirectLoaderQuery",operationKind:"query",text:`query traceRedirectLoaderQuery(
4107
+ `}}}();Dm.hash="a80ec47ffd0bc1b23a4641393a324120";async function kI({params:n}){const{span_otel_id:a}=n;if(!a)throw new Error("Span redirect requires a span ID");const l=await T.fetchQuery(ve,Dm,{spanOtelId:a}).toPromise();if(l!=null&&l.span){const{id:t,trace:i,project:r}=l.span;return Pa(`/projects/${r.id}/spans/${i.traceId}?selectedSpanNodeId=${t}`)}else throw new Error(`Span with id "${a}" not found`)}const Lm=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"traceOtelId"}],a=[{kind:"Variable",name:"traceId",variableName:"traceOtelId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[l],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"traceRedirectLoaderQuery",selections:[{alias:"trace",args:a,concreteType:"Trace",kind:"LinkedField",name:"getTraceByOtelId",plural:!1,selections:[t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"traceRedirectLoaderQuery",selections:[{alias:"trace",args:a,concreteType:"Trace",kind:"LinkedField",name:"getTraceByOtelId",plural:!1,selections:[t,l],storageKey:null}]},params:{cacheID:"6e8acff3fd035f125c0a261b55f43015",id:null,metadata:{},name:"traceRedirectLoaderQuery",operationKind:"query",text:`query traceRedirectLoaderQuery(
4108
4108
  $traceOtelId: String!
4109
4109
  ) {
4110
4110
  trace: getTraceByOtelId(traceId: $traceOtelId) {
@@ -4114,7 +4114,7 @@ fragment PromptVersionTagsList_data on PromptVersion {
4114
4114
  id
4115
4115
  }
4116
4116
  }
4117
- `}}}();Lm.hash="4453100bcd3c636081232e19ee101eb9";async function bI({params:n}){const{trace_otel_id:a}=n;if(!a)throw new Error("Trace redirect requires a trace ID");const l=await P.fetchQuery(ve,Lm,{traceOtelId:a}).toPromise();if(l!=null&&l.trace){const{project:t}=l.trace;return Pa(`/projects/${t.id}/traces/${a}`)}else throw new Error(`Trace with id "${a}" not found`)}const _m=function(){var n={kind:"ClientExtension",selections:[{alias:null,args:null,kind:"ScalarField",name:"__id",storageKey:null}]},a=[{kind:"Literal",name:"first",value:1e3}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"maxCount",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"settingsDataPageLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"RetentionPoliciesTable_policies"},n],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"settingsDataPageLoaderQuery",selections:[{alias:null,args:a,concreteType:"ProjectTraceRetentionPolicyConnection",kind:"LinkedField",name:"projectTraceRetentionPolicies",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicyEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{alias:null,args:null,kind:"ScalarField",name:"cronExpression",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[i,{kind:"InlineFragment",selections:[r],type:"TraceRetentionRuleMaxCount",abstractKey:null},{kind:"InlineFragment",selections:[o],type:"TraceRetentionRuleMaxDays",abstractKey:null},{kind:"InlineFragment",selections:[o,r],type:"TraceRetentionRuleMaxDaysOrCount",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ProjectConnection",kind:"LinkedField",name:"projects",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[t,l],storageKey:null}],storageKey:null}],storageKey:null},i],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null},n],storageKey:"projectTraceRetentionPolicies(first:1000)"},{alias:null,args:a,filters:null,handle:"connection",key:"RetentionPoliciesTable_projectTraceRetentionPolicies",kind:"LinkedHandle",name:"projectTraceRetentionPolicies"},n]},params:{cacheID:"f9f28f0c1f07a912207e1a17f4a46292",id:null,metadata:{},name:"settingsDataPageLoaderQuery",operationKind:"query",text:`query settingsDataPageLoaderQuery {
4117
+ `}}}();Lm.hash="4453100bcd3c636081232e19ee101eb9";async function bI({params:n}){const{trace_otel_id:a}=n;if(!a)throw new Error("Trace redirect requires a trace ID");const l=await T.fetchQuery(ve,Lm,{traceOtelId:a}).toPromise();if(l!=null&&l.trace){const{project:t}=l.trace;return Pa(`/projects/${t.id}/traces/${a}`)}else throw new Error(`Trace with id "${a}" not found`)}const _m=function(){var n={kind:"ClientExtension",selections:[{alias:null,args:null,kind:"ScalarField",name:"__id",storageKey:null}]},a=[{kind:"Literal",name:"first",value:1e3}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"maxCount",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"settingsDataPageLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"RetentionPoliciesTable_policies"},n],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"settingsDataPageLoaderQuery",selections:[{alias:null,args:a,concreteType:"ProjectTraceRetentionPolicyConnection",kind:"LinkedField",name:"projectTraceRetentionPolicies",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicyEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{alias:null,args:null,kind:"ScalarField",name:"cronExpression",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[i,{kind:"InlineFragment",selections:[r],type:"TraceRetentionRuleMaxCount",abstractKey:null},{kind:"InlineFragment",selections:[o],type:"TraceRetentionRuleMaxDays",abstractKey:null},{kind:"InlineFragment",selections:[o,r],type:"TraceRetentionRuleMaxDaysOrCount",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ProjectConnection",kind:"LinkedField",name:"projects",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[t,l],storageKey:null}],storageKey:null}],storageKey:null},i],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null},n],storageKey:"projectTraceRetentionPolicies(first:1000)"},{alias:null,args:a,filters:null,handle:"connection",key:"RetentionPoliciesTable_projectTraceRetentionPolicies",kind:"LinkedHandle",name:"projectTraceRetentionPolicies"},n]},params:{cacheID:"f9f28f0c1f07a912207e1a17f4a46292",id:null,metadata:{},name:"settingsDataPageLoaderQuery",operationKind:"query",text:`query settingsDataPageLoaderQuery {
4118
4118
  ...RetentionPoliciesTable_policies
4119
4119
  }
4120
4120
 
@@ -4161,7 +4161,7 @@ fragment RetentionPoliciesTable_retentionPolicy on ProjectTraceRetentionPolicy {
4161
4161
  }
4162
4162
  }
4163
4163
  }
4164
- `}}}();_m.hash="17d72dfe84adde031abd0890b21bdea6";async function SI(){return await P.fetchQuery(ve,_m,{}).toPromise()}const Am=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"sessionId",storageKey:null}],type:"ProjectSession",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"sessionLoaderQuery",selections:[{alias:"session",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"sessionLoaderQuery",selections:[{alias:"session",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,t],storageKey:null}]},params:{cacheID:"e24902c01f282294437ffeec0084a2af",id:null,metadata:{},name:"sessionLoaderQuery",operationKind:"query",text:`query sessionLoaderQuery(
4164
+ `}}}();_m.hash="17d72dfe84adde031abd0890b21bdea6";async function SI(){return await T.fetchQuery(ve,_m,{}).toPromise()}const Am=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"sessionId",storageKey:null}],type:"ProjectSession",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"sessionLoaderQuery",selections:[{alias:"session",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"sessionLoaderQuery",selections:[{alias:"session",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,t],storageKey:null}]},params:{cacheID:"e24902c01f282294437ffeec0084a2af",id:null,metadata:{},name:"sessionLoaderQuery",operationKind:"query",text:`query sessionLoaderQuery(
4165
4165
  $id: ID!
4166
4166
  ) {
4167
4167
  session: node(id: $id) {
@@ -4172,7 +4172,7 @@ fragment RetentionPoliciesTable_retentionPolicy on ProjectTraceRetentionPolicy {
4172
4172
  }
4173
4173
  }
4174
4174
  }
4175
- `}}}();Am.hash="ddb30651beeea59f8543ce916b705810";async function vI(n){const{sessionId:a}=n.params;return await P.fetchQuery(ve,Am,{id:a}).toPromise()}const wm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"first"},a={defaultValue:null,kind:"LocalArgument",name:"id"},l=[{kind:"Variable",name:"id",variableName:"id"}],t={alias:null,args:null,kind:"ScalarField",name:"numTraces",storageKey:null},i={alias:null,args:null,concreteType:"TokenUsage",kind:"LinkedField",name:"tokenUsage",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"total",storageKey:null}],storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null},o=[r,{alias:null,args:null,kind:"ScalarField",name:"tokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"costPerToken",storageKey:null}],d={alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:o,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"prompt",plural:!1,selections:o,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"completion",plural:!1,selections:o,storageKey:null}],storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"sessionId",storageKey:null},u={alias:"latencyP50",args:[{kind:"Literal",name:"probability",value:.5}],kind:"ScalarField",name:"traceLatencyMsQuantile",storageKey:"traceLatencyMsQuantile(probability:0.5)"},y=[{kind:"Variable",name:"first",variableName:"first"}],g={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},S=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"mimeType",storageKey:null}];return{fragment:{argumentDefinitions:[n,a],kind:"Fragment",metadata:null,name:"SessionDetailsQuery",selections:[{alias:"session",args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[t,i,d,c,u,{args:y,kind:"FragmentSpread",name:"SessionDetailsTraceList_traces"}],type:"ProjectSession",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,n],kind:"Operation",name:"SessionDetailsQuery",selections:[{alias:"session",args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[g,m,{kind:"InlineFragment",selections:[t,i,d,c,u,{alias:null,args:y,concreteType:"TraceConnection",kind:"LinkedField",name:"traces",plural:!1,selections:[{alias:null,args:null,concreteType:"TraceEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"trace",args:null,concreteType:"Trace",kind:"LinkedField",name:"node",plural:!1,selections:[m,{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"rootSpan",plural:!1,selections:[{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[m,{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[r],storageKey:null}],storageKey:null}],storageKey:null},m,{alias:null,args:null,kind:"ScalarField",name:"attributes",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[m,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[g,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[m,f,{alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[h,k],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[m],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:S,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:S,storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[m,f,h,k,{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},m],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummaries",plural:!0,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null},h],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null},f],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"node",plural:!1,selections:[g,m],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:y,filters:null,handle:"connection",key:"SessionDetailsTraceList_traces",kind:"LinkedHandle",name:"traces"}],type:"ProjectSession",abstractKey:null}],storageKey:null}]},params:{cacheID:"84c30e348a46bf4a66c53c5d949c4343",id:null,metadata:{},name:"SessionDetailsQuery",operationKind:"query",text:`query SessionDetailsQuery(
4175
+ `}}}();Am.hash="ddb30651beeea59f8543ce916b705810";async function vI(n){const{sessionId:a}=n.params;return await T.fetchQuery(ve,Am,{id:a}).toPromise()}const wm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"first"},a={defaultValue:null,kind:"LocalArgument",name:"id"},l=[{kind:"Variable",name:"id",variableName:"id"}],t={alias:null,args:null,kind:"ScalarField",name:"numTraces",storageKey:null},i={alias:null,args:null,concreteType:"TokenUsage",kind:"LinkedField",name:"tokenUsage",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"total",storageKey:null}],storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null},o=[r,{alias:null,args:null,kind:"ScalarField",name:"tokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"costPerToken",storageKey:null}],d={alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:o,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"prompt",plural:!1,selections:o,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"completion",plural:!1,selections:o,storageKey:null}],storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"sessionId",storageKey:null},u={alias:"latencyP50",args:[{kind:"Literal",name:"probability",value:.5}],kind:"ScalarField",name:"traceLatencyMsQuantile",storageKey:"traceLatencyMsQuantile(probability:0.5)"},y=[{kind:"Variable",name:"first",variableName:"first"}],g={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},S=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"mimeType",storageKey:null}];return{fragment:{argumentDefinitions:[n,a],kind:"Fragment",metadata:null,name:"SessionDetailsQuery",selections:[{alias:"session",args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[t,i,d,c,u,{args:y,kind:"FragmentSpread",name:"SessionDetailsTraceList_traces"}],type:"ProjectSession",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,n],kind:"Operation",name:"SessionDetailsQuery",selections:[{alias:"session",args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[g,m,{kind:"InlineFragment",selections:[t,i,d,c,u,{alias:null,args:y,concreteType:"TraceConnection",kind:"LinkedField",name:"traces",plural:!1,selections:[{alias:null,args:null,concreteType:"TraceEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"trace",args:null,concreteType:"Trace",kind:"LinkedField",name:"node",plural:!1,selections:[m,{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"rootSpan",plural:!1,selections:[{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[m,{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[r],storageKey:null}],storageKey:null}],storageKey:null},m,{alias:null,args:null,kind:"ScalarField",name:"attributes",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[m,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[g,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[m,f,{alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[h,k],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[m],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:S,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:S,storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[m,f,h,k,{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},m],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummaries",plural:!0,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null},h],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null},f],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"node",plural:!1,selections:[g,m],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:y,filters:null,handle:"connection",key:"SessionDetailsTraceList_traces",kind:"LinkedHandle",name:"traces"}],type:"ProjectSession",abstractKey:null}],storageKey:null}]},params:{cacheID:"84c30e348a46bf4a66c53c5d949c4343",id:null,metadata:{},name:"SessionDetailsQuery",operationKind:"query",text:`query SessionDetailsQuery(
4176
4176
  $id: ID!
4177
4177
  $first: Int
4178
4178
  ) {
@@ -4418,11 +4418,11 @@ fragment SessionDetailsTraceList_traces_2HEEH6 on ProjectSession {
4418
4418
  }
4419
4419
  id
4420
4420
  }
4421
- `}}}();Em.hash="d93b35659e600ca4438d4c1da87a24d5";const Mm=function(){var n=["traces"],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"mimeType",storageKey:null}];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:50,kind:"LocalArgument",name:"first"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:["node"],operation:Em,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"SessionDetailsTraceList_traces",selections:[{alias:"traces",args:null,concreteType:"TraceConnection",kind:"LinkedField",name:"__SessionDetailsTraceList_traces_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"TraceEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"trace",args:null,concreteType:"Trace",kind:"LinkedField",name:"node",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"rootSpan",plural:!1,selections:[{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[a,{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},a,{alias:null,args:null,kind:"ScalarField",name:"attributes",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[a],storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:l,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:l,storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{args:null,kind:"FragmentSpread",name:"AnnotationSummaryGroup"}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},a],type:"ProjectSession",abstractKey:null}}();Mm.hash="d93b35659e600ca4438d4c1da87a24d5";function iC({spanNodeId:n,projectId:a,size:l="M",buttonText:t="Annotate"}){return s(J,{children:[e(E,{size:l,"aria-label":"Edit Span Annotations",leadingVisual:e(D,{svg:e(Va,{})}),children:t}),e(ne,{children:e(Z,{variant:"slideover",size:"L",children:e(xo,{spanNodeId:n,projectId:a})})})]})}const rC=n=>{const{json:a}=en(n);if(a==null||!Jn(a))return null;const l=a[Ae.user];if(l==null||!Jn(l))return null;const t=l[Ny.id];return _n.isString(t)||_n.isNumber(t)?t:null};function Cs({role:n,value:a,mimeType:l}){const t=p.useMemo(()=>{if(l!=="json")return String(a);const r=en(a);return r.json==null?"--":JSON.stringify(r.json,null,2)},[a,l]),i=at(n==="HUMAN"?"user":"assistant");return e(v,{alignSelf:n==="HUMAN"?"start":"end",borderRadius:"medium",borderColor:"dark",borderWidth:"thin",padding:"size-200",maxWidth:"70%",...i,children:s(b,{direction:"column",gap:"size-50",children:[e(F,{color:"text-700",children:n}),l==="json"?e(Dn,{value:t}):e(F,{children:t})]})})}function sC({traceId:n,rootSpan:a,index:l}){var r,o;const t=p.useMemo(()=>new Date(a.startTime),[a.startTime]),i=p.useMemo(()=>rC(a.attributes),[a.attributes]);return e(v,{height:"100%",children:s(b,{direction:"column",justifyContent:"space-between",height:"100%",children:[s(b,{direction:"column",gap:"size-200",children:[s(b,{direction:"row",justifyContent:"space-between",children:[s(F,{children:["Trace #",l+1]}),e(Oe,{to:`/projects/${a.project.id}/traces/${n}?${Pn}=${a.id}`,children:s(b,{alignItems:"center",children:["View Trace",e(D,{svg:e(xh,{})})]})})]}),s(b,{direction:"row",justifyContent:"space-between",children:[i!=null?s(F,{color:"text-700",children:["user: ",i]}):null,e(F,{color:"text-700",flex:"end",marginStart:"auto",children:fa(t)})]}),s(b,{direction:"row",gap:"size-100",children:[e(_o,{tokenCountTotal:a.cumulativeTokenCountTotal||0,nodeId:a.id}),((o=(r=a.trace.costSummary)==null?void 0:r.total)==null?void 0:o.cost)!=null&&e(Ji,{totalCost:a.trace.costSummary.total.cost,nodeId:a.trace.id}),a.latencyMs!=null?e(Ye,{latencyMs:a.latencyMs}):"--"]})]}),s(b,{direction:"row",justifyContent:"space-between",alignItems:"end",children:[s(b,{direction:"column",gap:"size-100",maxWidth:"50%",children:[e(F,{children:"Feedback"}),e(b,{gap:"size-50",direction:"column",children:e(Nt,{span:a,renderEmptyState:()=>"--"})})]}),e("span",{children:e(iC,{size:"S",spanNodeId:a.id,projectId:a.project.id,buttonText:"Annotate"})})]})]})})}function oC({rootSpan:n}){var a,l,t,i;return s(b,{direction:"column",gap:"size-100",children:[e(Cs,{role:"HUMAN",value:(a=n.input)==null?void 0:a.value,mimeType:(l=n.input)==null?void 0:l.mimeType}),e(Cs,{role:"AI",value:(t=n.output)==null?void 0:t.value,mimeType:(i=n.output)==null?void 0:i.mimeType})]})}function dC({tracesRef:n}){const{data:a,loadNext:l,isLoadingNext:t,hasNext:i}=P.usePaginationFragment(Mm,n),r=p.useMemo(()=>{var c;return(c=a.traces)==null?void 0:c.edges.filter(u=>u.trace.rootSpan!==null).map(({trace:u})=>u)},[a]),o=p.useCallback(c=>{if(c){const{scrollHeight:u,scrollTop:y,clientHeight:g}=c;u-y-g<1024&&!t&&i&&l(Rm)}},[i,t,l]),d=p.useMemo(()=>_n.throttle(o,100),[o]);return s("div",{css:K`
4421
+ `}}}();Em.hash="d93b35659e600ca4438d4c1da87a24d5";const Mm=function(){var n=["traces"],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"mimeType",storageKey:null}];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:50,kind:"LocalArgument",name:"first"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:["node"],operation:Em,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"SessionDetailsTraceList_traces",selections:[{alias:"traces",args:null,concreteType:"TraceConnection",kind:"LinkedField",name:"__SessionDetailsTraceList_traces_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"TraceEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"trace",args:null,concreteType:"Trace",kind:"LinkedField",name:"node",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"rootSpan",plural:!1,selections:[{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[a,{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},a,{alias:null,args:null,kind:"ScalarField",name:"attributes",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[a],storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:l,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:l,storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{args:null,kind:"FragmentSpread",name:"AnnotationSummaryGroup"}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},a],type:"ProjectSession",abstractKey:null}}();Mm.hash="d93b35659e600ca4438d4c1da87a24d5";function iC({spanNodeId:n,projectId:a,size:l="M",buttonText:t="Annotate"}){return s(J,{children:[e(E,{size:l,"aria-label":"Edit Span Annotations",leadingVisual:e(D,{svg:e(Va,{})}),children:t}),e(ne,{children:e(Z,{variant:"slideover",size:"L",children:e(xo,{spanNodeId:n,projectId:a})})})]})}const rC=n=>{const{json:a}=en(n);if(a==null||!Jn(a))return null;const l=a[Ae.user];if(l==null||!Jn(l))return null;const t=l[Ny.id];return _n.isString(t)||_n.isNumber(t)?t:null};function Cs({role:n,value:a,mimeType:l}){const t=p.useMemo(()=>{if(l!=="json")return String(a);const r=en(a);return r.json==null?"--":JSON.stringify(r.json,null,2)},[a,l]),i=at(n==="HUMAN"?"user":"assistant");return e(v,{alignSelf:n==="HUMAN"?"start":"end",borderRadius:"medium",borderColor:"dark",borderWidth:"thin",padding:"size-200",maxWidth:"70%",...i,children:s(b,{direction:"column",gap:"size-50",children:[e(F,{color:"text-700",children:n}),l==="json"?e(Dn,{value:t}):e(F,{children:t})]})})}function sC({traceId:n,rootSpan:a,index:l}){var r,o;const t=p.useMemo(()=>new Date(a.startTime),[a.startTime]),i=p.useMemo(()=>rC(a.attributes),[a.attributes]);return e(v,{height:"100%",children:s(b,{direction:"column",justifyContent:"space-between",height:"100%",children:[s(b,{direction:"column",gap:"size-200",children:[s(b,{direction:"row",justifyContent:"space-between",children:[s(F,{children:["Trace #",l+1]}),e(Oe,{to:`/projects/${a.project.id}/traces/${n}?${Pn}=${a.id}`,children:s(b,{alignItems:"center",children:["View Trace",e(D,{svg:e(xh,{})})]})})]}),s(b,{direction:"row",justifyContent:"space-between",children:[i!=null?s(F,{color:"text-700",children:["user: ",i]}):null,e(F,{color:"text-700",flex:"end",marginStart:"auto",children:fa(t)})]}),s(b,{direction:"row",gap:"size-100",children:[e(_o,{tokenCountTotal:a.cumulativeTokenCountTotal||0,nodeId:a.id}),((o=(r=a.trace.costSummary)==null?void 0:r.total)==null?void 0:o.cost)!=null&&e(Ji,{totalCost:a.trace.costSummary.total.cost,nodeId:a.trace.id}),a.latencyMs!=null?e(Ye,{latencyMs:a.latencyMs}):"--"]})]}),s(b,{direction:"row",justifyContent:"space-between",alignItems:"end",children:[s(b,{direction:"column",gap:"size-100",maxWidth:"50%",children:[e(F,{children:"Feedback"}),e(b,{gap:"size-50",direction:"column",children:e(Nt,{span:a,renderEmptyState:()=>"--"})})]}),e("span",{children:e(iC,{size:"S",spanNodeId:a.id,projectId:a.project.id,buttonText:"Annotate"})})]})]})})}function oC({rootSpan:n}){var a,l,t,i;return s(b,{direction:"column",gap:"size-100",children:[e(Cs,{role:"HUMAN",value:(a=n.input)==null?void 0:a.value,mimeType:(l=n.input)==null?void 0:l.mimeType}),e(Cs,{role:"AI",value:(t=n.output)==null?void 0:t.value,mimeType:(i=n.output)==null?void 0:i.mimeType})]})}function dC({tracesRef:n}){const{data:a,loadNext:l,isLoadingNext:t,hasNext:i}=T.usePaginationFragment(Mm,n),r=p.useMemo(()=>{var c;return(c=a.traces)==null?void 0:c.edges.filter(u=>u.trace.rootSpan!==null).map(({trace:u})=>u)},[a]),o=p.useCallback(c=>{if(c){const{scrollHeight:u,scrollTop:y,clientHeight:g}=c;u-y-g<1024&&!t&&i&&l(Rm)}},[i,t,l]),d=p.useMemo(()=>_n.throttle(o,100),[o]);return s("div",{css:K`
4422
4422
  height: 100%;
4423
4423
  flex: 1 1 auto;
4424
4424
  overflow: auto;
4425
- `,onScroll:c=>d(c.target),children:[r.map(({traceId:c,rootSpan:u},y)=>e(v,{borderBottomColor:"dark",borderBottomWidth:"thin",children:s(b,{direction:"row",children:[e(v,{borderRightWidth:"thin",borderEndColor:"dark",padding:"size-200",flex:"1 1 auto",children:e(oC,{rootSpan:u})}),e(v,{width:350,padding:"size-200",flex:"none",children:e(sC,{traceId:c,rootSpan:u,index:y})})]})},u.spanId)),t&&e(v,{borderBottomColor:"dark",borderBottomWidth:"thin",padding:"size-200",children:e(pe,{})})]})}function cC({traceCount:n,costSummary:a,tokenUsage:l,latencyP50:t,sessionId:i}){var r,o,d,c;return e(v,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",children:s(b,{direction:"row",gap:"size-400",children:[s(b,{direction:"column",children:[e(F,{elementType:"h3",color:"text-700",children:"Traces Count"}),e(F,{size:"L",children:n})]}),l!=null?s(b,{direction:"column",children:[e(F,{elementType:"h3",color:"text-700",children:"Total Tokens"}),e(Ao,{tokenCountTotal:l.total,nodeId:i,size:"L"})]}):null,a!=null?s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Total Cost"}),s(Xn,{delay:0,placement:"bottom",children:[e(qa,{children:e(F,{size:"L",children:In(((r=a.total)==null?void 0:r.cost)??0)})}),e(qs,{children:e(v,{width:"size-2400",children:s(b,{direction:"column",children:[s(b,{justifyContent:"space-between",children:[e(F,{children:"Prompt Cost"}),e(F,{children:In(((o=a.prompt)==null?void 0:o.cost)??0)})]}),s(b,{justifyContent:"space-between",children:[e(F,{children:"Completion Cost"}),e(F,{children:In(((d=a.completion)==null?void 0:d.cost)??0)})]}),s(b,{justifyContent:"space-between",children:[e(F,{children:"Total Cost"}),e(F,{children:In(((c=a.total)==null?void 0:c.cost)??0)})]})]})})})]})]}):null,t!=null?s(b,{direction:"column",children:[e(F,{elementType:"h3",color:"text-700",children:"Latency P50"}),e(Ye,{latencyMs:t,size:"L"})]}):null]})})}function uC(n){const{sessionId:a}=n,l=P.useLazyLoadQuery(wm,{id:a,first:Rm},{fetchPolicy:"store-and-network"});if(l.session==null)throw new Error("Session not found");return s("main",{css:K`
4425
+ `,onScroll:c=>d(c.target),children:[r.map(({traceId:c,rootSpan:u},y)=>e(v,{borderBottomColor:"dark",borderBottomWidth:"thin",children:s(b,{direction:"row",children:[e(v,{borderRightWidth:"thin",borderEndColor:"dark",padding:"size-200",flex:"1 1 auto",children:e(oC,{rootSpan:u})}),e(v,{width:350,padding:"size-200",flex:"none",children:e(sC,{traceId:c,rootSpan:u,index:y})})]})},u.spanId)),t&&e(v,{borderBottomColor:"dark",borderBottomWidth:"thin",padding:"size-200",children:e(pe,{})})]})}function cC({traceCount:n,costSummary:a,tokenUsage:l,latencyP50:t,sessionId:i}){var r,o,d,c;return e(v,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",children:s(b,{direction:"row",gap:"size-400",children:[s(b,{direction:"column",children:[e(F,{elementType:"h3",color:"text-700",children:"Traces Count"}),e(F,{size:"L",children:n})]}),l!=null?s(b,{direction:"column",children:[e(F,{elementType:"h3",color:"text-700",children:"Total Tokens"}),e(Ao,{tokenCountTotal:l.total,nodeId:i,size:"L"})]}):null,a!=null?s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Total Cost"}),s(Xn,{delay:0,placement:"bottom",children:[e(qa,{children:e(F,{size:"L",children:In(((r=a.total)==null?void 0:r.cost)??0)})}),e(qs,{children:e(v,{width:"size-2400",children:s(b,{direction:"column",children:[s(b,{justifyContent:"space-between",children:[e(F,{children:"Prompt Cost"}),e(F,{children:In(((o=a.prompt)==null?void 0:o.cost)??0)})]}),s(b,{justifyContent:"space-between",children:[e(F,{children:"Completion Cost"}),e(F,{children:In(((d=a.completion)==null?void 0:d.cost)??0)})]}),s(b,{justifyContent:"space-between",children:[e(F,{children:"Total Cost"}),e(F,{children:In(((c=a.total)==null?void 0:c.cost)??0)})]})]})})})]})]}):null,t!=null?s(b,{direction:"column",children:[e(F,{elementType:"h3",color:"text-700",children:"Latency P50"}),e(Ye,{latencyMs:t,size:"L"})]}):null]})})}function uC(n){const{sessionId:a}=n,l=T.useLazyLoadQuery(wm,{id:a,first:Rm},{fetchPolicy:"store-and-network"});if(l.session==null)throw new Error("Session not found");return s("main",{css:K`
4426
4426
  flex: 1 1 auto;
4427
4427
  display: flex;
4428
4428
  flex-direction: column;
@@ -4433,7 +4433,7 @@ fragment SessionDetailsTraceList_traces_2HEEH6 on ProjectSession {
4433
4433
  modelInferences
4434
4434
  }
4435
4435
  }
4436
- `}}}();Vm.hash="a248736e236c8d5348e0ecfbe9440ca2";async function CI(n){const a=await P.fetchQuery(ve,Vm,{}).toPromise();return a!=null&&a.functionality.modelInferences?Pa("/model"):Pa("/projects")}const zm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"endTime"},a={defaultValue:null,kind:"LocalArgument",name:"startTime"},l=[{kind:"Variable",name:"endTime",variableName:"endTime"},{kind:"Variable",name:"startTime",variableName:"startTime"}],t=[{kind:"Literal",name:"first",value:50}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},o={fields:[{kind:"Variable",name:"end",variableName:"endTime"},{kind:"Variable",name:"start",variableName:"startTime"}],kind:"ObjectValue",name:"timeRange"},d={alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},c=[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i],u={alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:[n,a],kind:"Fragment",metadata:null,name:"ModelInferencesPageQuery",selections:[{args:l,kind:"FragmentSpread",name:"ModelSchemaTable_dimensions"},{args:l,kind:"FragmentSpread",name:"ModelEmbeddingsTable_embeddingDimensions"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,n],kind:"Operation",name:"ModelInferencesPageQuery",selections:[{alias:null,args:null,concreteType:"InferenceModel",kind:"LinkedField",name:"model",plural:!1,selections:[{alias:null,args:t,concreteType:"DimensionConnection",kind:"LinkedField",name:"dimensions",plural:!1,selections:[{alias:null,args:null,concreteType:"DimensionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"dimension",args:null,concreteType:"Dimension",kind:"LinkedField",name:"node",plural:!1,selections:[i,r,{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dataType",storageKey:null},{alias:"cardinality",args:[{kind:"Literal",name:"metric",value:"cardinality"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"percentEmpty",args:[{kind:"Literal",name:"metric",value:"percentEmpty"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"min",args:[{kind:"Literal",name:"metric",value:"min"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"mean",args:[{kind:"Literal",name:"metric",value:"mean"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"max",args:[{kind:"Literal",name:"metric",value:"max"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"psi",args:[{kind:"Literal",name:"metric",value:"psi"},o],kind:"ScalarField",name:"driftMetric",storageKey:null}],storageKey:null},d,{alias:null,args:null,concreteType:"Dimension",kind:"LinkedField",name:"node",plural:!1,selections:c,storageKey:null}],storageKey:null},u],storageKey:"dimensions(first:50)"},{alias:null,args:t,filters:null,handle:"connection",key:"ModelSchemaTable_dimensions",kind:"LinkedHandle",name:"dimensions"},{alias:null,args:t,concreteType:"EmbeddingDimensionConnection",kind:"LinkedField",name:"embeddingDimensions",plural:!1,selections:[{alias:null,args:null,concreteType:"EmbeddingDimensionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"embedding",args:null,concreteType:"EmbeddingDimension",kind:"LinkedField",name:"node",plural:!1,selections:[i,r,{alias:"euclideanDistance",args:[{kind:"Literal",name:"metric",value:"euclideanDistance"},o],kind:"ScalarField",name:"driftMetric",storageKey:null}],storageKey:null},d,{alias:null,args:null,concreteType:"EmbeddingDimension",kind:"LinkedField",name:"node",plural:!1,selections:c,storageKey:null}],storageKey:null},u],storageKey:"embeddingDimensions(first:50)"},{alias:null,args:t,filters:null,handle:"connection",key:"ModelEmbeddingsTable_embeddingDimensions",kind:"LinkedHandle",name:"embeddingDimensions"}],storageKey:null}]},params:{cacheID:"d4ce45828b9b8ab1f08d7bf38299a533",id:null,metadata:{},name:"ModelInferencesPageQuery",operationKind:"query",text:`query ModelInferencesPageQuery(
4436
+ `}}}();Vm.hash="a248736e236c8d5348e0ecfbe9440ca2";async function CI(n){const a=await T.fetchQuery(ve,Vm,{}).toPromise();return a!=null&&a.functionality.modelInferences?Pa("/model"):Pa("/projects")}const zm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"endTime"},a={defaultValue:null,kind:"LocalArgument",name:"startTime"},l=[{kind:"Variable",name:"endTime",variableName:"endTime"},{kind:"Variable",name:"startTime",variableName:"startTime"}],t=[{kind:"Literal",name:"first",value:50}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},o={fields:[{kind:"Variable",name:"end",variableName:"endTime"},{kind:"Variable",name:"start",variableName:"startTime"}],kind:"ObjectValue",name:"timeRange"},d={alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},c=[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i],u={alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:[n,a],kind:"Fragment",metadata:null,name:"ModelInferencesPageQuery",selections:[{args:l,kind:"FragmentSpread",name:"ModelSchemaTable_dimensions"},{args:l,kind:"FragmentSpread",name:"ModelEmbeddingsTable_embeddingDimensions"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,n],kind:"Operation",name:"ModelInferencesPageQuery",selections:[{alias:null,args:null,concreteType:"InferenceModel",kind:"LinkedField",name:"model",plural:!1,selections:[{alias:null,args:t,concreteType:"DimensionConnection",kind:"LinkedField",name:"dimensions",plural:!1,selections:[{alias:null,args:null,concreteType:"DimensionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"dimension",args:null,concreteType:"Dimension",kind:"LinkedField",name:"node",plural:!1,selections:[i,r,{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dataType",storageKey:null},{alias:"cardinality",args:[{kind:"Literal",name:"metric",value:"cardinality"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"percentEmpty",args:[{kind:"Literal",name:"metric",value:"percentEmpty"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"min",args:[{kind:"Literal",name:"metric",value:"min"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"mean",args:[{kind:"Literal",name:"metric",value:"mean"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"max",args:[{kind:"Literal",name:"metric",value:"max"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"psi",args:[{kind:"Literal",name:"metric",value:"psi"},o],kind:"ScalarField",name:"driftMetric",storageKey:null}],storageKey:null},d,{alias:null,args:null,concreteType:"Dimension",kind:"LinkedField",name:"node",plural:!1,selections:c,storageKey:null}],storageKey:null},u],storageKey:"dimensions(first:50)"},{alias:null,args:t,filters:null,handle:"connection",key:"ModelSchemaTable_dimensions",kind:"LinkedHandle",name:"dimensions"},{alias:null,args:t,concreteType:"EmbeddingDimensionConnection",kind:"LinkedField",name:"embeddingDimensions",plural:!1,selections:[{alias:null,args:null,concreteType:"EmbeddingDimensionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"embedding",args:null,concreteType:"EmbeddingDimension",kind:"LinkedField",name:"node",plural:!1,selections:[i,r,{alias:"euclideanDistance",args:[{kind:"Literal",name:"metric",value:"euclideanDistance"},o],kind:"ScalarField",name:"driftMetric",storageKey:null}],storageKey:null},d,{alias:null,args:null,concreteType:"EmbeddingDimension",kind:"LinkedField",name:"node",plural:!1,selections:c,storageKey:null}],storageKey:null},u],storageKey:"embeddingDimensions(first:50)"},{alias:null,args:t,filters:null,handle:"connection",key:"ModelEmbeddingsTable_embeddingDimensions",kind:"LinkedHandle",name:"embeddingDimensions"}],storageKey:null}]},params:{cacheID:"d4ce45828b9b8ab1f08d7bf38299a533",id:null,metadata:{},name:"ModelInferencesPageQuery",operationKind:"query",text:`query ModelInferencesPageQuery(
4437
4437
  $startTime: DateTime!
4438
4438
  $endTime: DateTime!
4439
4439
  ) {
@@ -4493,7 +4493,7 @@ fragment ModelSchemaTable_dimensions_3uKjWt on Query {
4493
4493
  }
4494
4494
  }
4495
4495
  }
4496
- `}}}();zm.hash="b4f2409b23d3c72afd3d9f43e813f1c9";function KI(n){const{referenceInferences:a}=ta(),{timeRange:l}=ka(),t=P.useLazyLoadQuery(zm,{startTime:l.start.toISOString(),endTime:l.end.toISOString()});return s("main",{children:[s(Zi,{children:[e(wo,{}),a?e(Ro,{inferencesRole:"reference",timeRange:{start:new Date(a.startTime),end:new Date(a.endTime)}}):null]}),e("section",{css:K`
4496
+ `}}}();zm.hash="b4f2409b23d3c72afd3d9f43e813f1c9";function KI(n){const{referenceInferences:a}=ta(),{timeRange:l}=ka(),t=T.useLazyLoadQuery(zm,{startTime:l.start.toISOString(),endTime:l.end.toISOString()});return s("main",{children:[s(Zi,{children:[e(wo,{}),a?e(Ro,{inferencesRole:"reference",timeRange:{start:new Date(a.startTime),end:new Date(a.endTime)}}):null]}),e("section",{css:K`
4497
4497
  margin: var(--ac-global-dimension-static-size-200);
4498
4498
  `,children:e(_i,{title:"Model Schema",variant:"compact",bodyStyle:{padding:0},children:s(hn,{children:[s(fn,{children:[e(ge,{id:"all",children:"All"}),e(ge,{id:"embeddings",children:"Embeddings"}),e(ge,{id:"dimensions",children:"Dimensions"})]}),e(he,{id:"all",children:s(wn,{defaultExpandedKeys:["embeddings","dimensions"],children:[s(xe,{id:"embeddings",children:[e(Pe,{children:"Embeddings"}),e(Ie,{children:e(Or,{model:t})})]}),s(xe,{id:"dimensions",children:[e(Pe,{children:"Dimensions"}),e(Ie,{children:e(Qr,{model:t})})]})]})}),e(he,{id:"embeddings",children:e(Or,{model:t})}),e(he,{id:"dimensions",children:e(Qr,{model:t})})]})})}),e(Te,{})]})}const Nm={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EmbeddingPageModelQuery",selections:[{alias:null,args:null,concreteType:"InferenceModel",kind:"LinkedField",name:"model",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"MetricSelector_dimensions"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"EmbeddingPageModelQuery",selections:[{alias:null,args:null,concreteType:"InferenceModel",kind:"LinkedField",name:"model",plural:!1,selections:[{alias:"numericDimensions",args:[{kind:"Literal",name:"include",value:{dataTypes:["numeric"]}}],concreteType:"DimensionConnection",kind:"LinkedField",name:"dimensions",plural:!1,selections:[{alias:null,args:null,concreteType:"DimensionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Dimension",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:'dimensions(include:{"dataTypes":["numeric"]})'}],storageKey:null}]},params:{cacheID:"fd9d393b5de6aab89ac3f91ac93def55",id:null,metadata:{},name:"EmbeddingPageModelQuery",operationKind:"query",text:`query EmbeddingPageModelQuery {
4499
4499
  model {
@@ -4512,7 +4512,7 @@ fragment MetricSelector_dimensions on InferenceModel {
4512
4512
  }
4513
4513
  }
4514
4514
  }
4515
- `}};Nm.hash="374499f7f8ce6919e4a0a4ecbe380c52";const $m=function(){var n={defaultValue:null,kind:"LocalArgument",name:"clusterMinSamples"},a={defaultValue:null,kind:"LocalArgument",name:"clusterSelectionEpsilon"},l={defaultValue:null,kind:"LocalArgument",name:"dataQualityMetricColumnName"},t={defaultValue:null,kind:"LocalArgument",name:"fetchDataQualityMetric"},i={defaultValue:null,kind:"LocalArgument",name:"fetchPerformanceMetric"},r={defaultValue:null,kind:"LocalArgument",name:"id"},o={defaultValue:null,kind:"LocalArgument",name:"minClusterSize"},d={defaultValue:null,kind:"LocalArgument",name:"minDist"},c={defaultValue:null,kind:"LocalArgument",name:"nNeighbors"},u={defaultValue:null,kind:"LocalArgument",name:"nSamples"},y={defaultValue:null,kind:"LocalArgument",name:"performanceMetric"},g={defaultValue:null,kind:"LocalArgument",name:"timeRange"},m=[{kind:"Variable",name:"id",variableName:"id"}],f={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"x",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"y",storageKey:null},C=[f,{alias:null,args:null,kind:"ScalarField",name:"eventId",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"coordinates",plural:!1,selections:[h,{kind:"InlineFragment",selections:[k,S,{alias:null,args:null,kind:"ScalarField",name:"z",storageKey:null}],type:"Point3D",abstractKey:null},{kind:"InlineFragment",selections:[k,S],type:"Point2D",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"EmbeddingMetadata",kind:"LinkedField",name:"embeddingMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"linkToData",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"rawData",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"EventMetadata",kind:"LinkedField",name:"eventMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"predictionId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualScore",storageKey:null}],storageKey:null}],T=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"referenceValue",storageKey:null}],_={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"clusterMinSamples",variableName:"clusterMinSamples"},{kind:"Variable",name:"clusterSelectionEpsilon",variableName:"clusterSelectionEpsilon"},{kind:"Variable",name:"minClusterSize",variableName:"minClusterSize"},{kind:"Variable",name:"minDist",variableName:"minDist"},{kind:"Variable",name:"nNeighbors",variableName:"nNeighbors"},{kind:"Variable",name:"nSamples",variableName:"nSamples"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"UMAPPoints",kind:"LinkedField",name:"UMAPPoints",plural:!1,selections:[{alias:null,args:null,concreteType:"UMAPPoint",kind:"LinkedField",name:"data",plural:!0,selections:C,storageKey:null},{alias:null,args:null,concreteType:"UMAPPoint",kind:"LinkedField",name:"referenceData",plural:!0,selections:C,storageKey:null},{alias:null,args:null,concreteType:"UMAPPoint",kind:"LinkedField",name:"corpusData",plural:!0,selections:C,storageKey:null},{alias:null,args:null,concreteType:"Cluster",kind:"LinkedField",name:"clusters",plural:!0,selections:[f,{alias:null,args:null,kind:"ScalarField",name:"eventIds",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"driftRatio",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"primaryToCorpusRatio",storageKey:null},{condition:"fetchDataQualityMetric",kind:"Condition",passingValue:!0,selections:[{alias:null,args:[{fields:[{kind:"Variable",name:"columnName",variableName:"dataQualityMetricColumnName"},{kind:"Literal",name:"metric",value:"mean"}],kind:"ObjectValue",name:"metric"}],concreteType:"DatasetValues",kind:"LinkedField",name:"dataQualityMetric",plural:!1,selections:T,storageKey:null}]},{condition:"fetchPerformanceMetric",kind:"Condition",passingValue:!0,selections:[{alias:null,args:[{fields:[{kind:"Variable",name:"metric",variableName:"performanceMetric"}],kind:"ObjectValue",name:"metric"}],concreteType:"DatasetValues",kind:"LinkedField",name:"performanceMetric",plural:!1,selections:T,storageKey:null}]}],storageKey:null},{alias:null,args:null,concreteType:"Retrieval",kind:"LinkedField",name:"contextRetrievals",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"queryId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"documentId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"relevance",storageKey:null}],storageKey:null}],storageKey:null}],type:"EmbeddingDimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o,d,c,u,y,g],kind:"Fragment",metadata:null,name:"EmbeddingPageUMAPQuery",selections:[{alias:"embedding",args:m,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[_],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[r,g,d,c,u,o,n,a,t,l,i,y],kind:"Operation",name:"EmbeddingPageUMAPQuery",selections:[{alias:"embedding",args:m,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[h,_,f],storageKey:null}]},params:{cacheID:"d9999f636a5bf081cc90ab4c726f82ab",id:null,metadata:{},name:"EmbeddingPageUMAPQuery",operationKind:"query",text:`query EmbeddingPageUMAPQuery(
4515
+ `}};Nm.hash="374499f7f8ce6919e4a0a4ecbe380c52";const $m=function(){var n={defaultValue:null,kind:"LocalArgument",name:"clusterMinSamples"},a={defaultValue:null,kind:"LocalArgument",name:"clusterSelectionEpsilon"},l={defaultValue:null,kind:"LocalArgument",name:"dataQualityMetricColumnName"},t={defaultValue:null,kind:"LocalArgument",name:"fetchDataQualityMetric"},i={defaultValue:null,kind:"LocalArgument",name:"fetchPerformanceMetric"},r={defaultValue:null,kind:"LocalArgument",name:"id"},o={defaultValue:null,kind:"LocalArgument",name:"minClusterSize"},d={defaultValue:null,kind:"LocalArgument",name:"minDist"},c={defaultValue:null,kind:"LocalArgument",name:"nNeighbors"},u={defaultValue:null,kind:"LocalArgument",name:"nSamples"},y={defaultValue:null,kind:"LocalArgument",name:"performanceMetric"},g={defaultValue:null,kind:"LocalArgument",name:"timeRange"},m=[{kind:"Variable",name:"id",variableName:"id"}],f={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"x",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"y",storageKey:null},C=[f,{alias:null,args:null,kind:"ScalarField",name:"eventId",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"coordinates",plural:!1,selections:[h,{kind:"InlineFragment",selections:[k,S,{alias:null,args:null,kind:"ScalarField",name:"z",storageKey:null}],type:"Point3D",abstractKey:null},{kind:"InlineFragment",selections:[k,S],type:"Point2D",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"EmbeddingMetadata",kind:"LinkedField",name:"embeddingMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"linkToData",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"rawData",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"EventMetadata",kind:"LinkedField",name:"eventMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"predictionId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualScore",storageKey:null}],storageKey:null}],P=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"referenceValue",storageKey:null}],L={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"clusterMinSamples",variableName:"clusterMinSamples"},{kind:"Variable",name:"clusterSelectionEpsilon",variableName:"clusterSelectionEpsilon"},{kind:"Variable",name:"minClusterSize",variableName:"minClusterSize"},{kind:"Variable",name:"minDist",variableName:"minDist"},{kind:"Variable",name:"nNeighbors",variableName:"nNeighbors"},{kind:"Variable",name:"nSamples",variableName:"nSamples"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"UMAPPoints",kind:"LinkedField",name:"UMAPPoints",plural:!1,selections:[{alias:null,args:null,concreteType:"UMAPPoint",kind:"LinkedField",name:"data",plural:!0,selections:C,storageKey:null},{alias:null,args:null,concreteType:"UMAPPoint",kind:"LinkedField",name:"referenceData",plural:!0,selections:C,storageKey:null},{alias:null,args:null,concreteType:"UMAPPoint",kind:"LinkedField",name:"corpusData",plural:!0,selections:C,storageKey:null},{alias:null,args:null,concreteType:"Cluster",kind:"LinkedField",name:"clusters",plural:!0,selections:[f,{alias:null,args:null,kind:"ScalarField",name:"eventIds",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"driftRatio",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"primaryToCorpusRatio",storageKey:null},{condition:"fetchDataQualityMetric",kind:"Condition",passingValue:!0,selections:[{alias:null,args:[{fields:[{kind:"Variable",name:"columnName",variableName:"dataQualityMetricColumnName"},{kind:"Literal",name:"metric",value:"mean"}],kind:"ObjectValue",name:"metric"}],concreteType:"DatasetValues",kind:"LinkedField",name:"dataQualityMetric",plural:!1,selections:P,storageKey:null}]},{condition:"fetchPerformanceMetric",kind:"Condition",passingValue:!0,selections:[{alias:null,args:[{fields:[{kind:"Variable",name:"metric",variableName:"performanceMetric"}],kind:"ObjectValue",name:"metric"}],concreteType:"DatasetValues",kind:"LinkedField",name:"performanceMetric",plural:!1,selections:P,storageKey:null}]}],storageKey:null},{alias:null,args:null,concreteType:"Retrieval",kind:"LinkedField",name:"contextRetrievals",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"queryId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"documentId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"relevance",storageKey:null}],storageKey:null}],storageKey:null}],type:"EmbeddingDimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o,d,c,u,y,g],kind:"Fragment",metadata:null,name:"EmbeddingPageUMAPQuery",selections:[{alias:"embedding",args:m,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[L],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[r,g,d,c,u,o,n,a,t,l,i,y],kind:"Operation",name:"EmbeddingPageUMAPQuery",selections:[{alias:"embedding",args:m,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[h,L,f],storageKey:null}]},params:{cacheID:"d9999f636a5bf081cc90ab4c726f82ab",id:null,metadata:{},name:"EmbeddingPageUMAPQuery",operationKind:"query",text:`query EmbeddingPageUMAPQuery(
4516
4516
  $id: ID!
4517
4517
  $timeRange: TimeRange!
4518
4518
  $minDist: Float!
@@ -4673,11 +4673,11 @@ fragment MetricSelector_dimensions on InferenceModel {
4673
4673
  font-size: var(--ac-global-dimension-static-font-size-75);
4674
4674
  font-weight: var(--px-font-weight-heavy);
4675
4675
  }
4676
- `;function kC({model:n}){const[,a]=p.useTransition(),l=P.useFragment(Om,n),{referenceInferences:t,corpusInferences:i}=ta(),r=!!t,o=!!i,d=ce(h=>h.metric),c=ce(h=>h.loading),u=ce(h=>h.setMetric),y=l.numericDimensions.edges.map(h=>h.node),g=y.length>0,m=p.useCallback(h=>{if(!h)return;const k=fC({metricKey:h,dimensions:y});a(()=>{u(k)})},[u,y,a]),f=[];return r&&f.push({key:Il({type:"drift",metric:"euclideanDistance"}),label:"Euclidean Distance"}),o&&f.push({key:Il({type:"retrieval",metric:"queryDistance"}),label:"Query Distance"}),f.push({key:Il({type:"performance",metric:"accuracyScore"}),label:"Accuracy Score"}),g&&y.forEach(h=>{f.push({key:Il({type:"dataQuality",metric:"average",dimension:h}),label:`${h.name} avg`})}),s(Xn,{delay:0,children:[e(qa,{children:s(Yl,{selectedKey:d?Il(d):void 0,onSelectionChange:m,placeholder:"Select a metric...",isDisabled:c,"aria-label":"Analysis metric",css:hC,children:[e(W,{children:"Metric"}),s(E,{children:[e(St,{}),e(Ha,{})]}),e(kn,{children:e(ma,{children:f.map(h=>e(Hn,{id:h.key,children:h.label},h.key))})})]})}),e(Ia,{children:s("section",{css:K`
4676
+ `;function kC({model:n}){const[,a]=p.useTransition(),l=T.useFragment(Om,n),{referenceInferences:t,corpusInferences:i}=ta(),r=!!t,o=!!i,d=ce(h=>h.metric),c=ce(h=>h.loading),u=ce(h=>h.setMetric),y=l.numericDimensions.edges.map(h=>h.node),g=y.length>0,m=p.useCallback(h=>{if(!h)return;const k=fC({metricKey:h,dimensions:y});a(()=>{u(k)})},[u,y,a]),f=[];return r&&f.push({key:Il({type:"drift",metric:"euclideanDistance"}),label:"Euclidean Distance"}),o&&f.push({key:Il({type:"retrieval",metric:"queryDistance"}),label:"Query Distance"}),f.push({key:Il({type:"performance",metric:"accuracyScore"}),label:"Accuracy Score"}),g&&y.forEach(h=>{f.push({key:Il({type:"dataQuality",metric:"average",dimension:h}),label:`${h.name} avg`})}),s(Xn,{delay:0,children:[e(qa,{children:s(Yl,{selectedKey:d?Il(d):void 0,onSelectionChange:m,placeholder:"Select a metric...",isDisabled:c,"aria-label":"Analysis metric",css:hC,children:[e(W,{children:"Metric"}),s(E,{children:[e(St,{}),e(Ha,{})]}),e(kn,{children:e(ma,{children:f.map(h=>e(Hn,{id:h.key,children:h.label},h.key))})})]})}),e(Ia,{children:s("section",{css:K`
4677
4677
  h4 {
4678
4678
  margin-bottom: 0.5rem;
4679
4679
  }
4680
- `,children:[e(de,{level:4,children:"Analysis Metric"}),e(F,{children:"Select a metric to drive the analysis of your embeddings."}),e(F,{children:"To analyze the the drift between your two inferences, select a drift metric and the UI will highlight areas of high drift."}),e(F,{children:"To analyze the quality of your embeddings, select a dimension data quality metric by which to analyze the point cloud. The UI will highlight areas where the data quality is degrading."})]})})]})}const Qm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"countGranularity"},a={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},l={defaultValue:null,kind:"LocalArgument",name:"embeddingDimensionId"},t={defaultValue:null,kind:"LocalArgument",name:"fetchDataQuality"},i={defaultValue:null,kind:"LocalArgument",name:"fetchDrift"},r={defaultValue:null,kind:"LocalArgument",name:"fetchPerformance"},o={defaultValue:null,kind:"LocalArgument",name:"fetchQueryDistance"},d={defaultValue:null,kind:"LocalArgument",name:"metricGranularity"},c={defaultValue:null,kind:"LocalArgument",name:"performanceMetric"},u={defaultValue:null,kind:"LocalArgument",name:"timeRange"},y=[{kind:"Variable",name:"id",variableName:"embeddingDimensionId"}],g={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},m={kind:"Variable",name:"granularity",variableName:"metricGranularity"},f={kind:"Variable",name:"timeRange",variableName:"timeRange"},h=[m,{kind:"Literal",name:"metric",value:"euclideanDistance"},f],k=[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],S={kind:"InlineFragment",selections:[{condition:"fetchDrift",kind:"Condition",passingValue:!0,selections:[{alias:"euclideanDistanceTimeSeries",args:h,concreteType:"DriftTimeSeries",kind:"LinkedField",name:"driftTimeSeries",plural:!1,selections:k,storageKey:null}]},{condition:"fetchQueryDistance",kind:"Condition",passingValue:!0,selections:[{alias:null,args:h,concreteType:"DriftTimeSeries",kind:"LinkedField",name:"retrievalMetricTimeSeries",plural:!1,selections:k,storageKey:null}]},{alias:"trafficTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"countGranularity"},{kind:"Literal",name:"metric",value:"count"},f],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:k,storageKey:null}],type:"EmbeddingDimension",abstractKey:null},C=[{kind:"Variable",name:"id",variableName:"dimensionId"}],T={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:[m,{kind:"Literal",name:"metric",value:"mean"},f],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:k,storageKey:null}],type:"Dimension",abstractKey:null},_={alias:null,args:null,concreteType:"InferenceModel",kind:"LinkedField",name:"model",plural:!1,selections:[{condition:"fetchPerformance",kind:"Condition",passingValue:!0,selections:[{alias:null,args:[m,{fields:[{kind:"Variable",name:"metric",variableName:"performanceMetric"}],kind:"ObjectValue",name:"metric"},f],concreteType:"PerformanceTimeSeries",kind:"LinkedField",name:"performanceTimeSeries",plural:!1,selections:k,storageKey:null}]}],storageKey:null},x={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o,d,c,u],kind:"Fragment",metadata:null,name:"MetricTimeSeriesQuery",selections:[{alias:"embedding",args:y,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[g,S],storageKey:null},{condition:"fetchDataQuality",kind:"Condition",passingValue:!0,selections:[{alias:"dimension",args:C,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[T],storageKey:null}]},_],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,u,d,n,i,o,t,a,r,c],kind:"Operation",name:"MetricTimeSeriesQuery",selections:[{alias:"embedding",args:y,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[x,g,S],storageKey:null},{condition:"fetchDataQuality",kind:"Condition",passingValue:!0,selections:[{alias:"dimension",args:C,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[x,T,g],storageKey:null}]},_]},params:{cacheID:"752d4bce509b4932d2511c656378a7bf",id:null,metadata:{},name:"MetricTimeSeriesQuery",operationKind:"query",text:`query MetricTimeSeriesQuery(
4680
+ `,children:[e(de,{level:4,children:"Analysis Metric"}),e(F,{children:"Select a metric to drive the analysis of your embeddings."}),e(F,{children:"To analyze the the drift between your two inferences, select a drift metric and the UI will highlight areas of high drift."}),e(F,{children:"To analyze the quality of your embeddings, select a dimension data quality metric by which to analyze the point cloud. The UI will highlight areas where the data quality is degrading."})]})})]})}const Qm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"countGranularity"},a={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},l={defaultValue:null,kind:"LocalArgument",name:"embeddingDimensionId"},t={defaultValue:null,kind:"LocalArgument",name:"fetchDataQuality"},i={defaultValue:null,kind:"LocalArgument",name:"fetchDrift"},r={defaultValue:null,kind:"LocalArgument",name:"fetchPerformance"},o={defaultValue:null,kind:"LocalArgument",name:"fetchQueryDistance"},d={defaultValue:null,kind:"LocalArgument",name:"metricGranularity"},c={defaultValue:null,kind:"LocalArgument",name:"performanceMetric"},u={defaultValue:null,kind:"LocalArgument",name:"timeRange"},y=[{kind:"Variable",name:"id",variableName:"embeddingDimensionId"}],g={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},m={kind:"Variable",name:"granularity",variableName:"metricGranularity"},f={kind:"Variable",name:"timeRange",variableName:"timeRange"},h=[m,{kind:"Literal",name:"metric",value:"euclideanDistance"},f],k=[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],S={kind:"InlineFragment",selections:[{condition:"fetchDrift",kind:"Condition",passingValue:!0,selections:[{alias:"euclideanDistanceTimeSeries",args:h,concreteType:"DriftTimeSeries",kind:"LinkedField",name:"driftTimeSeries",plural:!1,selections:k,storageKey:null}]},{condition:"fetchQueryDistance",kind:"Condition",passingValue:!0,selections:[{alias:null,args:h,concreteType:"DriftTimeSeries",kind:"LinkedField",name:"retrievalMetricTimeSeries",plural:!1,selections:k,storageKey:null}]},{alias:"trafficTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"countGranularity"},{kind:"Literal",name:"metric",value:"count"},f],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:k,storageKey:null}],type:"EmbeddingDimension",abstractKey:null},C=[{kind:"Variable",name:"id",variableName:"dimensionId"}],P={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:[m,{kind:"Literal",name:"metric",value:"mean"},f],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:k,storageKey:null}],type:"Dimension",abstractKey:null},L={alias:null,args:null,concreteType:"InferenceModel",kind:"LinkedField",name:"model",plural:!1,selections:[{condition:"fetchPerformance",kind:"Condition",passingValue:!0,selections:[{alias:null,args:[m,{fields:[{kind:"Variable",name:"metric",variableName:"performanceMetric"}],kind:"ObjectValue",name:"metric"},f],concreteType:"PerformanceTimeSeries",kind:"LinkedField",name:"performanceTimeSeries",plural:!1,selections:k,storageKey:null}]}],storageKey:null},x={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o,d,c,u],kind:"Fragment",metadata:null,name:"MetricTimeSeriesQuery",selections:[{alias:"embedding",args:y,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[g,S],storageKey:null},{condition:"fetchDataQuality",kind:"Condition",passingValue:!0,selections:[{alias:"dimension",args:C,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[P],storageKey:null}]},L],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,u,d,n,i,o,t,a,r,c],kind:"Operation",name:"MetricTimeSeriesQuery",selections:[{alias:"embedding",args:y,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[x,g,S],storageKey:null},{condition:"fetchDataQuality",kind:"Condition",passingValue:!0,selections:[{alias:"dimension",args:C,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[x,P,g],storageKey:null}]},L]},params:{cacheID:"752d4bce509b4932d2511c656378a7bf",id:null,metadata:{},name:"MetricTimeSeriesQuery",operationKind:"query",text:`query MetricTimeSeriesQuery(
4681
4681
  $embeddingDimensionId: ID!
4682
4682
  $timeRange: TimeRange!
4683
4683
  $metricGranularity: Granularity!
@@ -4743,7 +4743,7 @@ fragment MetricSelector_dimensions on InferenceModel {
4743
4743
  gap: var(--ac-global-dimension-static-size-50);
4744
4744
 
4745
4745
  margin-top: var(--ac-global-dimension-static-size-50);
4746
- `,children:[e(D,{svg:e(ga,{})}),e("span",{children:"Click to view the point cloud at this time"})]})]})}return null}function SC(n){switch(n.type){case"drift":return"Embedding Drift";case"performance":return"Model Performance";case"dataQuality":return"Data Quality";case"retrieval":return"Query Distance";default:Ee()}}function vC(n){if(n)switch(n.type){case"drift":return Ba(n.metric);case"performance":return Ba(n.metric);case"dataQuality":return`${n.dimension.name} avg`;case"retrieval":return Ba(n.metric);default:Ee()}else return"Count"}function FC(n){switch(n.type){case"drift":return ui(n.metric);case"performance":return ui(n.metric);case"dataQuality":return null;case"retrieval":return ui(n.metric);default:Ee()}}function CC({embeddingDimensionId:n}){const a=ce(N=>N.metric),l=a.type==="drift",t=a.type==="retrieval",i=a.type==="dataQuality",r=a.type==="performance",{timeRange:o}=ka(),{selectedTimestamp:d,setSelectedTimestamp:c}=Qt(),u=bl(o),y=P.useLazyLoadQuery(Qm,{embeddingDimensionId:n,timeRange:{start:o.start.toISOString(),end:o.end.toISOString()},metricGranularity:Eo(o),countGranularity:u,fetchDrift:l,fetchQueryDistance:t,fetchDataQuality:i,fetchPerformance:r,dimensionId:a.type==="dataQuality"?a.dimension.id:n,performanceMetric:a.type==="performance"?a.metric:"accuracyScore"}),g=Sl({samplingIntervalMinutes:u.samplingIntervalMinutes}),m=p.useCallback(N=>{const{activePayload:w}=N;if(w!=null&&w.length>0){const $=w[0].payload;c(new Date($.timestamp))}},[c]),f=KC({data:y,metric:a}),k=TC(y).reduce((N,w)=>(N[w.timestamp]=w.value,N),{})??{},S=f.map(N=>{const w=k[N.timestamp];return{...N,traffic:w,timestamp:new Date(N.timestamp).getTime()}}),C=vC(a),T=FC(a),{color:_,barColor:x}=Bm();return s("section",{css:K`
4746
+ `,children:[e(D,{svg:e(ga,{})}),e("span",{children:"Click to view the point cloud at this time"})]})]})}return null}function SC(n){switch(n.type){case"drift":return"Embedding Drift";case"performance":return"Model Performance";case"dataQuality":return"Data Quality";case"retrieval":return"Query Distance";default:Ee()}}function vC(n){if(n)switch(n.type){case"drift":return Ba(n.metric);case"performance":return Ba(n.metric);case"dataQuality":return`${n.dimension.name} avg`;case"retrieval":return Ba(n.metric);default:Ee()}else return"Count"}function FC(n){switch(n.type){case"drift":return ui(n.metric);case"performance":return ui(n.metric);case"dataQuality":return null;case"retrieval":return ui(n.metric);default:Ee()}}function CC({embeddingDimensionId:n}){const a=ce(N=>N.metric),l=a.type==="drift",t=a.type==="retrieval",i=a.type==="dataQuality",r=a.type==="performance",{timeRange:o}=ka(),{selectedTimestamp:d,setSelectedTimestamp:c}=Qt(),u=bl(o),y=T.useLazyLoadQuery(Qm,{embeddingDimensionId:n,timeRange:{start:o.start.toISOString(),end:o.end.toISOString()},metricGranularity:Eo(o),countGranularity:u,fetchDrift:l,fetchQueryDistance:t,fetchDataQuality:i,fetchPerformance:r,dimensionId:a.type==="dataQuality"?a.dimension.id:n,performanceMetric:a.type==="performance"?a.metric:"accuracyScore"}),g=Sl({samplingIntervalMinutes:u.samplingIntervalMinutes}),m=p.useCallback(N=>{const{activePayload:w}=N;if(w!=null&&w.length>0){const $=w[0].payload;c(new Date($.timestamp))}},[c]),f=KC({data:y,metric:a}),k=TC(y).reduce((N,w)=>(N[w.timestamp]=w.value,N),{})??{},S=f.map(N=>{const w=k[N.timestamp];return{...N,traffic:w,timestamp:new Date(N.timestamp).getTime()}}),C=vC(a),P=FC(a),{color:L,barColor:x}=Bm();return s("section",{css:K`
4747
4747
  width: 100%;
4748
4748
  height: 100%;
4749
4749
  display: flex;
@@ -4764,7 +4764,7 @@ fragment MetricSelector_dimensions on InferenceModel {
4764
4764
  width: 100%;
4765
4765
  overflow: hidden;
4766
4766
  }
4767
- `,children:[s(de,{level:3,children:[SC(a),T!=null?s(Jl,{children:[e(de,{level:4,children:C}),e(Ja,{children:T})]}):null]}),e("div",{children:e(Qn,{width:"100%",height:"100%",children:s(Fl,{data:S,margin:{top:25,right:18,left:18,bottom:10},onClick:m,children:[s("defs",{children:[s("linearGradient",{id:"colorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:_,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:_,stopOpacity:0})]}),s("linearGradient",{id:"barColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:x,stopOpacity:.3}),e("stop",{offset:"95%",stopColor:x,stopOpacity:0})]})]}),e(ra,{...vl,tickFormatter:N=>g(new Date(N)),style:{fill:"var(--ac-global-text-color-700)"}}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:C,angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(Tn,{yAxisId:"right",orientation:"right",label:{value:"Count",angle:90,position:"insideRight",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{content:e(bC,{})}),e(La,{yAxisId:"right",dataKey:"traffic",fill:"url(#barColor)",spacing:5}),e(ql,{type:"monotone",dataKey:"value",stroke:_,fillOpacity:1,fill:"url(#colorUv)"}),d!=null?e(ed,{...Mo,x:d.getTime()}):null]})})})]})}function KC({data:n,metric:a}){var l,t,i,r,o,d;if(((l=n.embedding.euclideanDistanceTimeSeries)==null?void 0:l.data)!=null&&n.embedding.euclideanDistanceTimeSeries.data.length>0)return n.embedding.euclideanDistanceTimeSeries.data.map(c=>({metricName:Ba(a.metric),...c}));if(((t=n.embedding.retrievalMetricTimeSeries)==null?void 0:t.data)!=null&&n.embedding.retrievalMetricTimeSeries.data.length>0)return n.embedding.retrievalMetricTimeSeries.data.map(c=>({metricName:Ba(a.metric),...c}));if(n.dimension&&((r=(i=n.dimension)==null?void 0:i.dataQualityTimeSeries)==null?void 0:r.data)!=null&&n.dimension.dataQualityTimeSeries.data.length>0){const c=n.dimension.name||"unknown";return n.dimension.dataQualityTimeSeries.data.map(u=>({metricName:`${c} avg`,...u}))}else{if(n.model&&((o=n.model.performanceTimeSeries)==null?void 0:o.data)!=null&&n.model.performanceTimeSeries.data.length>0)return n.model.performanceTimeSeries.data.map(c=>({metricName:Ba(a.metric),...c}));if(((d=n.embedding.trafficTimeSeries)==null?void 0:d.data)!=null)return n.embedding.trafficTimeSeries.data.map(c=>({metricName:"Count",...c}))}return[]}function TC(n){var a;return((a=n.embedding.trafficTimeSeries)==null?void 0:a.data)!=null?[...n.embedding.trafficTimeSeries.data]:[]}const qm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"corpusEventIds"},a={defaultValue:null,kind:"LocalArgument",name:"primaryEventIds"},l={defaultValue:null,kind:"LocalArgument",name:"referenceEventIds"},t=[{kind:"Variable",name:"eventIds",variableName:"primaryEventIds"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},c={alias:null,args:null,concreteType:"EventMetadata",kind:"LinkedField",name:"eventMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"predictionId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualScore",storageKey:null}],storageKey:null},u={alias:null,args:null,concreteType:"PromptResponse",kind:"LinkedField",name:"promptAndResponse",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"prompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"response",storageKey:null}],storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"documentText",storageKey:null},g=[i,{alias:null,args:null,concreteType:"DimensionWithValue",kind:"LinkedField",name:"dimensions",plural:!0,selections:[{alias:null,args:null,concreteType:"Dimension",kind:"LinkedField",name:"dimension",plural:!1,selections:[r,o],storageKey:null},d],storageKey:null},c,u,y],m=[{kind:"Variable",name:"eventIds",variableName:"referenceEventIds"}],f=[{kind:"Variable",name:"eventIds",variableName:"corpusEventIds"}],h=[i,{alias:null,args:null,concreteType:"DimensionWithValue",kind:"LinkedField",name:"dimensions",plural:!0,selections:[{alias:null,args:null,concreteType:"Dimension",kind:"LinkedField",name:"dimension",plural:!1,selections:[r,o,i],storageKey:null},d],storageKey:null},c,u,y];return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"PointSelectionPanelContentQuery",selections:[{alias:null,args:null,concreteType:"InferenceModel",kind:"LinkedField",name:"model",plural:!1,selections:[{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"primaryInferences",plural:!1,selections:[{alias:null,args:t,concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:g,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"referenceInferences",plural:!1,selections:[{alias:null,args:m,concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:g,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"corpusInferences",plural:!1,selections:[{alias:null,args:f,concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:g,storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,l,n],kind:"Operation",name:"PointSelectionPanelContentQuery",selections:[{alias:null,args:null,concreteType:"InferenceModel",kind:"LinkedField",name:"model",plural:!1,selections:[{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"primaryInferences",plural:!1,selections:[{alias:null,args:t,concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:h,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"referenceInferences",plural:!1,selections:[{alias:null,args:m,concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:h,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"corpusInferences",plural:!1,selections:[{alias:null,args:f,concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:h,storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"12c88e562048659c9ca654fccf693fb2",id:null,metadata:{},name:"PointSelectionPanelContentQuery",operationKind:"query",text:`query PointSelectionPanelContentQuery(
4767
+ `,children:[s(de,{level:3,children:[SC(a),P!=null?s(Jl,{children:[e(de,{level:4,children:C}),e(Ja,{children:P})]}):null]}),e("div",{children:e(Qn,{width:"100%",height:"100%",children:s(Fl,{data:S,margin:{top:25,right:18,left:18,bottom:10},onClick:m,children:[s("defs",{children:[s("linearGradient",{id:"colorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:L,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:L,stopOpacity:0})]}),s("linearGradient",{id:"barColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:x,stopOpacity:.3}),e("stop",{offset:"95%",stopColor:x,stopOpacity:0})]})]}),e(ra,{...vl,tickFormatter:N=>g(new Date(N)),style:{fill:"var(--ac-global-text-color-700)"}}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:C,angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(Tn,{yAxisId:"right",orientation:"right",label:{value:"Count",angle:90,position:"insideRight",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{content:e(bC,{})}),e(La,{yAxisId:"right",dataKey:"traffic",fill:"url(#barColor)",spacing:5}),e(ql,{type:"monotone",dataKey:"value",stroke:L,fillOpacity:1,fill:"url(#colorUv)"}),d!=null?e(ed,{...Mo,x:d.getTime()}):null]})})})]})}function KC({data:n,metric:a}){var l,t,i,r,o,d;if(((l=n.embedding.euclideanDistanceTimeSeries)==null?void 0:l.data)!=null&&n.embedding.euclideanDistanceTimeSeries.data.length>0)return n.embedding.euclideanDistanceTimeSeries.data.map(c=>({metricName:Ba(a.metric),...c}));if(((t=n.embedding.retrievalMetricTimeSeries)==null?void 0:t.data)!=null&&n.embedding.retrievalMetricTimeSeries.data.length>0)return n.embedding.retrievalMetricTimeSeries.data.map(c=>({metricName:Ba(a.metric),...c}));if(n.dimension&&((r=(i=n.dimension)==null?void 0:i.dataQualityTimeSeries)==null?void 0:r.data)!=null&&n.dimension.dataQualityTimeSeries.data.length>0){const c=n.dimension.name||"unknown";return n.dimension.dataQualityTimeSeries.data.map(u=>({metricName:`${c} avg`,...u}))}else{if(n.model&&((o=n.model.performanceTimeSeries)==null?void 0:o.data)!=null&&n.model.performanceTimeSeries.data.length>0)return n.model.performanceTimeSeries.data.map(c=>({metricName:Ba(a.metric),...c}));if(((d=n.embedding.trafficTimeSeries)==null?void 0:d.data)!=null)return n.embedding.trafficTimeSeries.data.map(c=>({metricName:"Count",...c}))}return[]}function TC(n){var a;return((a=n.embedding.trafficTimeSeries)==null?void 0:a.data)!=null?[...n.embedding.trafficTimeSeries.data]:[]}const qm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"corpusEventIds"},a={defaultValue:null,kind:"LocalArgument",name:"primaryEventIds"},l={defaultValue:null,kind:"LocalArgument",name:"referenceEventIds"},t=[{kind:"Variable",name:"eventIds",variableName:"primaryEventIds"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},c={alias:null,args:null,concreteType:"EventMetadata",kind:"LinkedField",name:"eventMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"predictionId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualScore",storageKey:null}],storageKey:null},u={alias:null,args:null,concreteType:"PromptResponse",kind:"LinkedField",name:"promptAndResponse",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"prompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"response",storageKey:null}],storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"documentText",storageKey:null},g=[i,{alias:null,args:null,concreteType:"DimensionWithValue",kind:"LinkedField",name:"dimensions",plural:!0,selections:[{alias:null,args:null,concreteType:"Dimension",kind:"LinkedField",name:"dimension",plural:!1,selections:[r,o],storageKey:null},d],storageKey:null},c,u,y],m=[{kind:"Variable",name:"eventIds",variableName:"referenceEventIds"}],f=[{kind:"Variable",name:"eventIds",variableName:"corpusEventIds"}],h=[i,{alias:null,args:null,concreteType:"DimensionWithValue",kind:"LinkedField",name:"dimensions",plural:!0,selections:[{alias:null,args:null,concreteType:"Dimension",kind:"LinkedField",name:"dimension",plural:!1,selections:[r,o,i],storageKey:null},d],storageKey:null},c,u,y];return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"PointSelectionPanelContentQuery",selections:[{alias:null,args:null,concreteType:"InferenceModel",kind:"LinkedField",name:"model",plural:!1,selections:[{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"primaryInferences",plural:!1,selections:[{alias:null,args:t,concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:g,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"referenceInferences",plural:!1,selections:[{alias:null,args:m,concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:g,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"corpusInferences",plural:!1,selections:[{alias:null,args:f,concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:g,storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,l,n],kind:"Operation",name:"PointSelectionPanelContentQuery",selections:[{alias:null,args:null,concreteType:"InferenceModel",kind:"LinkedField",name:"model",plural:!1,selections:[{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"primaryInferences",plural:!1,selections:[{alias:null,args:t,concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:h,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"referenceInferences",plural:!1,selections:[{alias:null,args:m,concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:h,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"corpusInferences",plural:!1,selections:[{alias:null,args:f,concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:h,storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"12c88e562048659c9ca654fccf693fb2",id:null,metadata:{},name:"PointSelectionPanelContentQuery",operationKind:"query",text:`query PointSelectionPanelContentQuery(
4768
4768
  $primaryEventIds: [ID!]!
4769
4769
  $referenceEventIds: [ID!]!
4770
4770
  $corpusEventIds: [ID!]!
@@ -4924,7 +4924,7 @@ dataframe`,wC=K`
4924
4924
  .cm-content {
4925
4925
  padding: var(--ac-global-dimension-static-size-100);
4926
4926
  }
4927
- `;function RC({value:n}){const{theme:a}=ha(),l=a==="light"?Na:$a;return e(ja,{value:n,basicSetup:!1,extensions:[nt()],editable:!1,theme:l,css:wC})}function EC(){const n=ce(u=>u.selectedEventIds),[a,l]=P.useMutation(Hm),[t,i]=p.useState(null),[r,o]=p.useState(!1),d=p.useCallback(()=>{a({variables:{eventIds:[...n]},onCompleted:u=>{i(u.exportEvents),o(!0)}})},[a,n]);return s(Y,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:l?e(yn,{}):e(Xi,{})}),"aria-label":"Export selection / cluster",isDisabled:l,onPress:d,children:l?"Exporting":"Export"}),e(J,{isOpen:r&&t!==null,onOpenChange:u=>{o(u),!u&&!t&&i(null)},children:e(ne,{isDismissable:!0,children:e(Z,{variant:"slideover",size:"M",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Cluster Exports"}),e(ue,{children:e(me,{})})]}),t&&s(Y,{children:[e(Ke,{variant:"success",banner:!0,title:"Export succeeded",extra:e(E,{variant:"success",size:"S",onPress:()=>{window.open(`/exports?filename=${t.fileName}`,"_self")},children:"Download"})}),s("div",{css:K`
4927
+ `;function RC({value:n}){const{theme:a}=ha(),l=a==="light"?Na:$a;return e(ja,{value:n,basicSetup:!1,extensions:[nt()],editable:!1,theme:l,css:wC})}function EC(){const n=ce(u=>u.selectedEventIds),[a,l]=T.useMutation(Hm),[t,i]=p.useState(null),[r,o]=p.useState(!1),d=p.useCallback(()=>{a({variables:{eventIds:[...n]},onCompleted:u=>{i(u.exportEvents),o(!0)}})},[a,n]);return s(Y,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:l?e(yn,{}):e(Xi,{})}),"aria-label":"Export selection / cluster",isDisabled:l,onPress:d,children:l?"Exporting":"Export"}),e(J,{isOpen:r&&t!==null,onOpenChange:u=>{o(u),!u&&!t&&i(null)},children:e(ne,{isDismissable:!0,children:e(Z,{variant:"slideover",size:"M",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Cluster Exports"}),e(ue,{children:e(me,{})})]}),t&&s(Y,{children:[e(Ke,{variant:"success",banner:!0,title:"Export succeeded",extra:e(E,{variant:"success",size:"S",onPress:()=>{window.open(`/exports?filename=${t.fileName}`,"_self")},children:"Download"})}),s("div",{css:K`
4928
4928
  display: flex;
4929
4929
  flex-direction: column;
4930
4930
  justify-content: space-between;
@@ -4934,7 +4934,7 @@ dataframe`,wC=K`
4934
4934
  `,children:[e("p",{css:K`
4935
4935
  margin: 0;
4936
4936
  flex: 1 1 auto;
4937
- `,children:"You can retrieve your export in your notebook via"}),e(v,{borderColor:"light",borderWidth:"thin",borderRadius:"medium",children:e(RC,{value:AC})})]}),e(wn,{defaultExpandedKeys:["all-exports"],children:s(xe,{id:"all-exports",children:[e(Pe,{children:"Latest Exports"}),e(Ie,{children:e(p.Suspense,{fallback:e(pe,{}),children:e(MC,{})})})]})})]})]})})})})})]})}function MC(){const n=P.useLazyLoadQuery(Um,{},{fetchPolicy:"network-only"});return e(Ct,{children:n.model.exportedFiles.map((a,l)=>e(Ft,{children:s("div",{css:K`
4937
+ `,children:"You can retrieve your export in your notebook via"}),e(v,{borderColor:"light",borderWidth:"thin",borderRadius:"medium",children:e(RC,{value:AC})})]}),e(wn,{defaultExpandedKeys:["all-exports"],children:s(xe,{id:"all-exports",children:[e(Pe,{children:"Latest Exports"}),e(Ie,{children:e(p.Suspense,{fallback:e(pe,{}),children:e(MC,{})})})]})})]})]})})})})})]})}function MC(){const n=T.useLazyLoadQuery(Um,{},{fetchPolicy:"network-only"});return e(Ct,{children:n.model.exportedFiles.map((a,l)=>e(Ft,{children:s("div",{css:K`
4938
4938
  display: flex;
4939
4939
  flex-direction: row;
4940
4940
  justify-content: space-between;
@@ -4968,7 +4968,7 @@ dataframe`,wC=K`
4968
4968
  min-width: var(--grid-item-min-width);
4969
4969
  height: var(--grid-item-height);
4970
4970
  }
4971
- `,children:l.map((u,y)=>{const g=i.get(u.id),{rawData:m=null,linkToData:f=null}=(g==null?void 0:g.embeddingMetadata)??{},{predictionLabel:h=null,actualLabel:k=null}=(g==null?void 0:g.eventMetadata)??{},S=wh(u.id),C=a(S),T=r[u.id],_=o[T];return e("li",{children:e(Rh,{rawData:m,linkToData:f,inferencesName:C,group:T,onClick:()=>{t(u.id)},onMouseOver:()=>{c(u.id)},onMouseOut:()=>{c(null)},color:_,size:d,predictionLabel:h,actualLabel:k,promptAndResponse:u.promptAndResponse,documentText:u.documentText,autoPlay:!1})},y)})})})}function zC({data:n,onPointSelected:a}){const{primaryInferences:l,referenceInferences:t}=ta(),i=ce(y=>y.metric),[r,o]=p.useState([]),{columns:d,tableData:c}=p.useMemo(()=>{const y=n.filter(_=>_.id.includes("CORPUS")===!1);let g=!1,m=!1,f=!1,h=!1,k=!1;n.forEach(_=>{_.linkToData&&(g=!0),_.rawData&&(m=!0),(_.prompt||_.response)&&(f=!0),_.predictionLabel&&(h=!0),_.actualLabel&&(k=!0)});const S=[];t&&S.push({header:"Inference Set",accessorKey:"id",size:50,cell:({getValue:_})=>e(NC,{id:_(),primaryInferencesName:l.name,referenceInferencesName:(t==null?void 0:t.name)??"reference"})}),g&&S.push({header:"Link",accessorKey:"linkToData",cell:({getValue:_})=>{const x=_();if(typeof x=="string"){const N=x.split("/").pop();return e($n,{href:x,children:N})}return null}}),f?(S.push({header:"Prompt",accessorKey:"prompt",cell:Be,size:200}),S.push({header:"Response",accessorKey:"response",cell:Be,size:200})):m&&S.push({header:"Raw Data",accessorKey:"rawData"}),h&&S.push({header:"Prediction Label",accessorKey:"predictionLabel",size:50}),k&&S.push({header:"Actual Label",accessorKey:"actualLabel",size:50});const C=[];if(i&&i.type==="dataQuality"){const _=i.dimension.name;C.push({header:i.dimension.name,accessorKey:"metric",cell:Eh,sortingFn:"basic"}),y.forEach(x=>{var w;const N=(w=x.dimensions.find($=>$.dimension.name===_))==null?void 0:w.value;x.metric=N!=null?Number(N):null})}return{columns:[...S,...C,{header:"",id:"view-details",size:50,cell:({row:_})=>e(E,{"aria-label":"view point details",size:"S",onPress:()=>{a(_.original.id)},children:"view details"})}],tableData:y}},[n,a,l,t,i]),u=Le({columns:d,data:c,state:{sorting:r},getCoreRowModel:_e(),onSortingChange:o,getSortedRowModel:sn()});return s("table",{css:nn,children:[e("thead",{children:u.getHeaderGroups().map(y=>e("tr",{children:y.headers.map(g=>s("th",{children:[g.isPlaceholder?null:s("div",{className:g.column.getCanSort()?"sort":"",onClick:g.column.getToggleSortingHandler(),children:[ee(g.column.columnDef.header,g.getContext()),g.column.getIsSorted()?e(D,{className:"sort-icon",svg:g.column.getIsSorted()==="asc"?e(ln,{}):e(an,{})}):null]}),e("div",{onMouseDown:g.getResizeHandler(),onTouchStart:g.getResizeHandler(),className:`resizer ${g.column.getIsResizing()?"isResizing":""}`,style:{transform:g.column.getIsResizing()?`translateX(${u.getState().columnSizingInfo.deltaOffset}px)`:""}})]},g.id))},y.id))}),e("tbody",{children:u.getRowModel().rows.map(y=>e("tr",{children:y.getVisibleCells().map(g=>e("td",{style:{width:g.column.getSize()},children:ee(g.column.columnDef.cell,g.getContext())},g.id))},y.id))})]})}function NC({id:n,primaryInferencesName:a,referenceInferencesName:l}){const t=n.includes("PRIMARY"),i=mC();return s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Vh,{shape:Mh.circle,color:i[t?0:1]}),t?a:l]})}const $C=K`
4971
+ `,children:l.map((u,y)=>{const g=i.get(u.id),{rawData:m=null,linkToData:f=null}=(g==null?void 0:g.embeddingMetadata)??{},{predictionLabel:h=null,actualLabel:k=null}=(g==null?void 0:g.eventMetadata)??{},S=wh(u.id),C=a(S),P=r[u.id],L=o[P];return e("li",{children:e(Rh,{rawData:m,linkToData:f,inferencesName:C,group:P,onClick:()=>{t(u.id)},onMouseOver:()=>{c(u.id)},onMouseOut:()=>{c(null)},color:L,size:d,predictionLabel:h,actualLabel:k,promptAndResponse:u.promptAndResponse,documentText:u.documentText,autoPlay:!1})},y)})})})}function zC({data:n,onPointSelected:a}){const{primaryInferences:l,referenceInferences:t}=ta(),i=ce(y=>y.metric),[r,o]=p.useState([]),{columns:d,tableData:c}=p.useMemo(()=>{const y=n.filter(L=>L.id.includes("CORPUS")===!1);let g=!1,m=!1,f=!1,h=!1,k=!1;n.forEach(L=>{L.linkToData&&(g=!0),L.rawData&&(m=!0),(L.prompt||L.response)&&(f=!0),L.predictionLabel&&(h=!0),L.actualLabel&&(k=!0)});const S=[];t&&S.push({header:"Inference Set",accessorKey:"id",size:50,cell:({getValue:L})=>e(NC,{id:L(),primaryInferencesName:l.name,referenceInferencesName:(t==null?void 0:t.name)??"reference"})}),g&&S.push({header:"Link",accessorKey:"linkToData",cell:({getValue:L})=>{const x=L();if(typeof x=="string"){const N=x.split("/").pop();return e($n,{href:x,children:N})}return null}}),f?(S.push({header:"Prompt",accessorKey:"prompt",cell:Be,size:200}),S.push({header:"Response",accessorKey:"response",cell:Be,size:200})):m&&S.push({header:"Raw Data",accessorKey:"rawData"}),h&&S.push({header:"Prediction Label",accessorKey:"predictionLabel",size:50}),k&&S.push({header:"Actual Label",accessorKey:"actualLabel",size:50});const C=[];if(i&&i.type==="dataQuality"){const L=i.dimension.name;C.push({header:i.dimension.name,accessorKey:"metric",cell:Eh,sortingFn:"basic"}),y.forEach(x=>{var w;const N=(w=x.dimensions.find($=>$.dimension.name===L))==null?void 0:w.value;x.metric=N!=null?Number(N):null})}return{columns:[...S,...C,{header:"",id:"view-details",size:50,cell:({row:L})=>e(E,{"aria-label":"view point details",size:"S",onPress:()=>{a(L.original.id)},children:"view details"})}],tableData:y}},[n,a,l,t,i]),u=Le({columns:d,data:c,state:{sorting:r},getCoreRowModel:_e(),onSortingChange:o,getSortedRowModel:sn()});return s("table",{css:nn,children:[e("thead",{children:u.getHeaderGroups().map(y=>e("tr",{children:y.headers.map(g=>s("th",{children:[g.isPlaceholder?null:s("div",{className:g.column.getCanSort()?"sort":"",onClick:g.column.getToggleSortingHandler(),children:[ee(g.column.columnDef.header,g.getContext()),g.column.getIsSorted()?e(D,{className:"sort-icon",svg:g.column.getIsSorted()==="asc"?e(ln,{}):e(an,{})}):null]}),e("div",{onMouseDown:g.getResizeHandler(),onTouchStart:g.getResizeHandler(),className:`resizer ${g.column.getIsResizing()?"isResizing":""}`,style:{transform:g.column.getIsResizing()?`translateX(${u.getState().columnSizingInfo.deltaOffset}px)`:""}})]},g.id))},y.id))}),e("tbody",{children:u.getRowModel().rows.map(y=>e("tr",{children:y.getVisibleCells().map(g=>e("td",{style:{width:g.column.getSize()},children:ee(g.column.columnDef.cell,g.getContext())},g.id))},y.id))})]})}function NC({id:n,primaryInferencesName:a,referenceInferencesName:l}){const t=n.includes("PRIMARY"),i=mC();return s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Vh,{shape:Mh.circle,color:i[t?0:1]}),t?a:l]})}const $C=K`
4972
4972
  width: 100%;
4973
4973
  height: 100%;
4974
4974
  position: relative;
@@ -4998,21 +4998,21 @@ dataframe`,wC=K`
4998
4998
  }
4999
4999
  }
5000
5000
  }
5001
- `;function jC({event:n,relevance:a}){return{id:n.eventMetadata.predictionId||"unknown id",text:n.documentText??"empty document",relevance:a}}function OC(){const n=ce(w=>w.selectedEventIds),a=ce(w=>w.setSelectedEventIds),l=ce(w=>w.setSelectedClusterId),t=ce(w=>w.selectionDisplay),[i,r]=p.useState(null),{primaryEventIds:o,referenceEventIds:d,corpusEventIds:c}=p.useMemo(()=>{const w=[],$=[],I=[];return n.forEach(M=>{M.includes("PRIMARY")?w.push(M):M.includes("CORPUS")?I.push(M):$.push(M)}),{primaryEventIds:w,referenceEventIds:$,corpusEventIds:I}},[n]),u=P.useLazyLoadQuery(qm,{primaryEventIds:[...o],referenceEventIds:[...d],corpusEventIds:[...c]}),y=p.useMemo(()=>{var M,z,A,V,O,H;const w=((z=(M=u.model)==null?void 0:M.primaryInferences)==null?void 0:z.events)??[],$=((V=(A=u.model)==null?void 0:A.referenceInferences)==null?void 0:V.events)??[],I=((H=(O=u.model)==null?void 0:O.corpusInferences)==null?void 0:H.events)??[];return[...w,...$,...I]},[u]),g=()=>{a(new Set),l(null)},m=ce(w=>w.eventIdToDataMap),f=ce(w=>w.pointData),h=ce(w=>w.selectionSearchText),k=p.useMemo(()=>y.map(w=>{var M,z,A,V,O,H,te;const $=m.get(w.id),I=[];return f!=null&&($==null?void 0:$.retrievals)!=null&&$.retrievals.forEach(({documentId:He,relevance:Fn})=>{const mn=f[He];mn!=null&&I.push(jC({event:mn,relevance:Fn}))}),{id:w.id,predictionId:((M=w.eventMetadata)==null?void 0:M.predictionId)??null,actualLabel:((z=w.eventMetadata)==null?void 0:z.actualLabel)??null,actualScore:((A=w.eventMetadata)==null?void 0:A.actualScore)??null,predictionLabel:((V=w.eventMetadata)==null?void 0:V.predictionLabel)??null,predictionScore:((O=w.eventMetadata)==null?void 0:O.predictionScore)??null,rawData:($==null?void 0:$.embeddingMetadata.rawData)??null,linkToData:($==null?void 0:$.embeddingMetadata.linkToData)??null,dimensions:w.dimensions,prompt:((H=w.promptAndResponse)==null?void 0:H.prompt)??null,response:((te=w.promptAndResponse)==null?void 0:te.response)??null,retrievedDocuments:I,documentText:w.documentText??null}}),[y,m,f]),S=p.useMemo(()=>{if(h){const w=h.toLowerCase();return k.filter($=>{var I,M,z,A;return $.id.includes(w)||((I=$.documentText)==null?void 0:I.toLowerCase().includes(w))||((M=$.predictionId)==null?void 0:M.includes(w))||((z=$.prompt)==null?void 0:z.toLowerCase().includes(w))||((A=$.response)==null?void 0:A.toLowerCase().includes(w))})}return k},[k,h]),C=p.useMemo(()=>{if(h){const w=h.toLowerCase();return y.filter($=>{var I,M,z,A,V,O,H;return $.id.includes(w)||((I=$.documentText)==null?void 0:I.toLowerCase().includes(w))||((z=(M=$.eventMetadata)==null?void 0:M.predictionId)==null?void 0:z.includes(w))||((V=(A=$.promptAndResponse)==null?void 0:A.prompt)==null?void 0:V.toLowerCase().includes(w))||((H=(O=$.promptAndResponse)==null?void 0:O.response)==null?void 0:H.toLowerCase().includes(w))})}return y},[y,h]),T=p.useMemo(()=>i?k.find($=>$.id===i)??null:null,[k,i]),_=y.length,x=C.length,N=w=>{w||r(null)};return s("section",{css:$C,children:[s("div",{role:"toolbar",css:K`
5001
+ `;function jC({event:n,relevance:a}){return{id:n.eventMetadata.predictionId||"unknown id",text:n.documentText??"empty document",relevance:a}}function OC(){const n=ce(w=>w.selectedEventIds),a=ce(w=>w.setSelectedEventIds),l=ce(w=>w.setSelectedClusterId),t=ce(w=>w.selectionDisplay),[i,r]=p.useState(null),{primaryEventIds:o,referenceEventIds:d,corpusEventIds:c}=p.useMemo(()=>{const w=[],$=[],I=[];return n.forEach(M=>{M.includes("PRIMARY")?w.push(M):M.includes("CORPUS")?I.push(M):$.push(M)}),{primaryEventIds:w,referenceEventIds:$,corpusEventIds:I}},[n]),u=T.useLazyLoadQuery(qm,{primaryEventIds:[...o],referenceEventIds:[...d],corpusEventIds:[...c]}),y=p.useMemo(()=>{var M,z,A,V,O,H;const w=((z=(M=u.model)==null?void 0:M.primaryInferences)==null?void 0:z.events)??[],$=((V=(A=u.model)==null?void 0:A.referenceInferences)==null?void 0:V.events)??[],I=((H=(O=u.model)==null?void 0:O.corpusInferences)==null?void 0:H.events)??[];return[...w,...$,...I]},[u]),g=()=>{a(new Set),l(null)},m=ce(w=>w.eventIdToDataMap),f=ce(w=>w.pointData),h=ce(w=>w.selectionSearchText),k=p.useMemo(()=>y.map(w=>{var M,z,A,V,O,H,te;const $=m.get(w.id),I=[];return f!=null&&($==null?void 0:$.retrievals)!=null&&$.retrievals.forEach(({documentId:He,relevance:Fn})=>{const mn=f[He];mn!=null&&I.push(jC({event:mn,relevance:Fn}))}),{id:w.id,predictionId:((M=w.eventMetadata)==null?void 0:M.predictionId)??null,actualLabel:((z=w.eventMetadata)==null?void 0:z.actualLabel)??null,actualScore:((A=w.eventMetadata)==null?void 0:A.actualScore)??null,predictionLabel:((V=w.eventMetadata)==null?void 0:V.predictionLabel)??null,predictionScore:((O=w.eventMetadata)==null?void 0:O.predictionScore)??null,rawData:($==null?void 0:$.embeddingMetadata.rawData)??null,linkToData:($==null?void 0:$.embeddingMetadata.linkToData)??null,dimensions:w.dimensions,prompt:((H=w.promptAndResponse)==null?void 0:H.prompt)??null,response:((te=w.promptAndResponse)==null?void 0:te.response)??null,retrievedDocuments:I,documentText:w.documentText??null}}),[y,m,f]),S=p.useMemo(()=>{if(h){const w=h.toLowerCase();return k.filter($=>{var I,M,z,A;return $.id.includes(w)||((I=$.documentText)==null?void 0:I.toLowerCase().includes(w))||((M=$.predictionId)==null?void 0:M.includes(w))||((z=$.prompt)==null?void 0:z.toLowerCase().includes(w))||((A=$.response)==null?void 0:A.toLowerCase().includes(w))})}return k},[k,h]),C=p.useMemo(()=>{if(h){const w=h.toLowerCase();return y.filter($=>{var I,M,z,A,V,O,H;return $.id.includes(w)||((I=$.documentText)==null?void 0:I.toLowerCase().includes(w))||((z=(M=$.eventMetadata)==null?void 0:M.predictionId)==null?void 0:z.includes(w))||((V=(A=$.promptAndResponse)==null?void 0:A.prompt)==null?void 0:V.toLowerCase().includes(w))||((H=(O=$.promptAndResponse)==null?void 0:O.response)==null?void 0:H.toLowerCase().includes(w))})}return y},[y,h]),P=p.useMemo(()=>i?k.find($=>$.id===i)??null:null,[k,i]),L=y.length,x=C.length,N=w=>{w||r(null)};return s("section",{css:$C,children:[s("div",{role:"toolbar",css:K`
5002
5002
  position: absolute;
5003
5003
  top: var(--ac-global-dimension-static-size-100);
5004
5004
  right: var(--ac-global-dimension-static-size-200);
5005
5005
  display: flex;
5006
5006
  flex-direction: row-reverse;
5007
5007
  gap: var(--ac-global-dimension-static-size-100);
5008
- `,children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(Gi,{})}),"aria-label":"Clear selection",onPress:g}),e(EC,{})]}),s(hn,{children:[e(fn,{children:e(ge,{id:"selection",children:"Selection"})}),s(Ql,{id:"selection",children:[e(QC,{numSelectedEvents:_,numMatchingEvents:x,searchText:h}),t===Vo.list?e("div",{css:K`
5008
+ `,children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(Gi,{})}),"aria-label":"Clear selection",onPress:g}),e(EC,{})]}),s(hn,{children:[e(fn,{children:e(ge,{id:"selection",children:"Selection"})}),s(Ql,{id:"selection",children:[e(QC,{numSelectedEvents:L,numMatchingEvents:x,searchText:h}),t===Vo.list?e("div",{css:K`
5009
5009
  flex: 1 1 auto;
5010
5010
  overflow-y: auto;
5011
- `,children:e(zC,{data:S,onPointSelected:r})}):e(VC,{events:C,onItemSelected:r})]})]}),e(J,{isOpen:T!==null,onOpenChange:N,children:e(ne,{children:e(Z,{variant:"slideover",size:"L",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Embedding Details"}),e(ue,{children:e(me,{})})]}),T&&e(PC,{event:T})]})})})})})]})}function QC({numSelectedEvents:n,numMatchingEvents:a,searchText:l}){const t=ce(u=>u.selectionDisplay),i=ce(u=>u.setSelectionDisplay),r=ce(u=>u.selectionGridSize),o=ce(u=>u.setSelectionGridSize),d=ce(u=>u.setSelectionSearchText),c=p.useMemo(()=>l?`${a}/${n} match "${l}"`:`${n} selected`,[n,a,l]);return e(Zi,{extra:s("div",{css:K`
5011
+ `,children:e(zC,{data:S,onPointSelected:r})}):e(VC,{events:C,onItemSelected:r})]})]}),e(J,{isOpen:P!==null,onOpenChange:N,children:e(ne,{children:e(Z,{variant:"slideover",size:"L",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Embedding Details"}),e(ue,{children:e(me,{})})]}),P&&e(PC,{event:P})]})})})})})]})}function QC({numSelectedEvents:n,numMatchingEvents:a,searchText:l}){const t=ce(u=>u.selectionDisplay),i=ce(u=>u.setSelectionDisplay),r=ce(u=>u.selectionGridSize),o=ce(u=>u.setSelectionGridSize),d=ce(u=>u.setSelectionSearchText),c=p.useMemo(()=>l?`${a}/${n} match "${l}"`:`${n} selected`,[n,a,l]);return e(Zi,{extra:s("div",{css:K`
5012
5012
  display: flex;
5013
5013
  flex-direction: row;
5014
5014
  gap: var(--ac-global-dimension-static-size-100);
5015
- `,children:[e(zo,{size:"S",onChange:u=>{d(u)},children:e(ae,{placeholder:"Search by text or ID"})}),t===Vo.gallery&&e(zh,{size:r,onChange:o}),e(Nh,{mode:t,onChange:u=>{i(u)}})]}),children:e(F,{children:c})})}const Gm=$m;function TI(){const{referenceInferences:n,corpusInferences:a}=ta(),{timeRange:l}=ka(),t=p.useMemo(()=>{let i={};return a!=null?i=Oh():n!=null?i=Qh():i=Bh(),i={...i,umapParameters:{...window.Config.UMAP}},i},[a,n]);return e(No,{initialTimestamp:l.end,children:e(qh,{...t,children:e(BC,{})})})}function BC(){const n=gC(),{primaryInferences:a,referenceInferences:l}=ta(),t=ce(C=>C.umapParameters),i=ce(C=>C.getHDSCANParameters),r=ce(C=>C.getMetric),o=ce(C=>C.reset),d=ce(C=>C.setLoading),[c,u]=p.useState(!0),[y,g,m]=P.useQueryLoader(Gm),{selectedTimestamp:f}=Qt(),h=p.useMemo(()=>f??new Date(a.endTime),[f,a.endTime]),k=p.useMemo(()=>({start:js(h,2).toISOString(),end:h.toISOString()}),[h]),S=P.useLazyLoadQuery(Nm,{});return p.useEffect(()=>{o(),d(!0);const C=r();return g({id:n,timeRange:k,...t,...i(),fetchDataQualityMetric:C.type==="dataQuality",fetchPerformanceMetric:C.type==="performance",dataQualityMetricColumnName:C.type==="dataQuality"?C.dimension.name:null,performanceMetric:C.type==="performance"?C.metric:"accuracyScore"},{fetchPolicy:"network-only"}),()=>{m()}},[d,o,n,g,m,t,i,r,k]),s("main",{css:K`
5015
+ `,children:[e(zo,{size:"S",onChange:u=>{d(u)},children:e(ae,{placeholder:"Search by text or ID"})}),t===Vo.gallery&&e(zh,{size:r,onChange:o}),e(Nh,{mode:t,onChange:u=>{i(u)}})]}),children:e(F,{children:c})})}const Gm=$m;function TI(){const{referenceInferences:n,corpusInferences:a}=ta(),{timeRange:l}=ka(),t=p.useMemo(()=>{let i={};return a!=null?i=Oh():n!=null?i=Qh():i=Bh(),i={...i,umapParameters:{...window.Config.UMAP}},i},[a,n]);return e(No,{initialTimestamp:l.end,children:e(qh,{...t,children:e(BC,{})})})}function BC(){const n=gC(),{primaryInferences:a,referenceInferences:l}=ta(),t=ce(C=>C.umapParameters),i=ce(C=>C.getHDSCANParameters),r=ce(C=>C.getMetric),o=ce(C=>C.reset),d=ce(C=>C.setLoading),[c,u]=p.useState(!0),[y,g,m]=T.useQueryLoader(Gm),{selectedTimestamp:f}=Qt(),h=p.useMemo(()=>f??new Date(a.endTime),[f,a.endTime]),k=p.useMemo(()=>({start:js(h,2).toISOString(),end:h.toISOString()}),[h]),S=T.useLazyLoadQuery(Nm,{});return p.useEffect(()=>{o(),d(!0);const C=r();return g({id:n,timeRange:k,...t,...i(),fetchDataQualityMetric:C.type==="dataQuality",fetchPerformanceMetric:C.type==="performance",dataQualityMetricColumnName:C.type==="dataQuality"?C.dimension.name:null,performanceMetric:C.type==="performance"?C.metric:"accuracyScore"},{fetchPolicy:"network-only"}),()=>{m()}},[d,o,n,g,m,t,i,r,k]),s("main",{css:K`
5016
5016
  flex: 1 1 auto;
5017
5017
  display: flex;
5018
5018
  flex-direction: column;
@@ -5021,7 +5021,7 @@ dataframe`,wC=K`
5021
5021
  width: 100%;
5022
5022
  height: 100%;
5023
5023
  position: relative;
5024
- `,children:e(p.Suspense,{fallback:e(Uh,{}),children:y?e(UC,{queryReference:y}):null})})})]})]})}function qC(n){if(n.__typename!=="Point3D")throw new Error(`Expected Point3D but got ${n.__typename} for coordinates`);return[n.x,n.y,n.z]}function UC({queryReference:n}){const a=P.usePreloadedQuery(Gm,n),l=p.useMemo(()=>{var u,y;return((y=(u=a.embedding)==null?void 0:u.UMAPPoints)==null?void 0:y.data)??[]},[a]),t=p.useMemo(()=>{var u,y;return((y=(u=a.embedding)==null?void 0:u.UMAPPoints)==null?void 0:y.referenceData)??[]},[a]),i=p.useMemo(()=>{var u,y;return((y=(u=a.embedding)==null?void 0:u.UMAPPoints)==null?void 0:y.corpusData)??[]},[a]),r=p.useMemo(()=>{var u,y;return((y=(u=a.embedding)==null?void 0:u.UMAPPoints)==null?void 0:y.contextRetrievals)??[]},[a]),o=p.useMemo(()=>[...l,...t,...i].map(y=>({...y,position:qC(y.coordinates),metaData:{id:y.eventId}})),[t,l,i]),d=ce(u=>u.setInitialData),c=ce(u=>u.setClusters);return $y(()=>{var y,g;const u=((g=(y=a.embedding)==null?void 0:y.UMAPPoints)==null?void 0:g.clusters)||[];d({points:o,clusters:u,retrievals:r})},[o,n,r,d,c]),e("div",{css:K`
5024
+ `,children:e(p.Suspense,{fallback:e(Uh,{}),children:y?e(UC,{queryReference:y}):null})})})]})]})}function qC(n){if(n.__typename!=="Point3D")throw new Error(`Expected Point3D but got ${n.__typename} for coordinates`);return[n.x,n.y,n.z]}function UC({queryReference:n}){const a=T.usePreloadedQuery(Gm,n),l=p.useMemo(()=>{var u,y;return((y=(u=a.embedding)==null?void 0:u.UMAPPoints)==null?void 0:y.data)??[]},[a]),t=p.useMemo(()=>{var u,y;return((y=(u=a.embedding)==null?void 0:u.UMAPPoints)==null?void 0:y.referenceData)??[]},[a]),i=p.useMemo(()=>{var u,y;return((y=(u=a.embedding)==null?void 0:u.UMAPPoints)==null?void 0:y.corpusData)??[]},[a]),r=p.useMemo(()=>{var u,y;return((y=(u=a.embedding)==null?void 0:u.UMAPPoints)==null?void 0:y.contextRetrievals)??[]},[a]),o=p.useMemo(()=>[...l,...t,...i].map(y=>({...y,position:qC(y.coordinates),metaData:{id:y.eventId}})),[t,l,i]),d=ce(u=>u.setInitialData),c=ce(u=>u.setClusters);return $y(()=>{var y,g;const u=((g=(y=a.embedding)==null?void 0:y.UMAPPoints)==null?void 0:g.clusters)||[];d({points:o,clusters:u,retrievals:r})},[o,n,r,d,c]),e("div",{css:K`
5025
5025
  flex: 1 1 auto;
5026
5026
  display: flex;
5027
5027
  flex-direction: row;
@@ -5090,7 +5090,7 @@ dataframe`,wC=K`
5090
5090
  id
5091
5091
  }
5092
5092
  }
5093
- `}}}();Wm.hash="96d029150ec0c7e5419c2efa0ee67fc5";async function PI(n){const{embeddingDimensionId:a}=n.params;return P.fetchQuery(ve,Wm,{id:a}).toPromise()}const Jm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},a={defaultValue:null,kind:"LocalArgument",name:"hasReference"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"dimensionId"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={kind:"Variable",name:"timeRange",variableName:"timeRange"},o=[r],d=[{kind:"Variable",name:"hasReference",variableName:"hasReference"},r],c={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},u=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null}],y={kind:"Literal",name:"metric",value:"cardinality"},g={kind:"Literal",name:"metric",value:"percentEmpty"},m={kind:"Literal",name:"inferencesRole",value:"reference"};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionPageQuery",selections:[{alias:"dimension",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[i,{args:o,kind:"FragmentSpread",name:"DimensionSegmentsBarChart_dimension"},{args:o,kind:"FragmentSpread",name:"DimensionCountStats_dimension"},{args:o,kind:"FragmentSpread",name:"DimensionDriftStats_dimension"},{args:d,kind:"FragmentSpread",name:"DimensionCardinalityStats_dimension"},{args:d,kind:"FragmentSpread",name:"DimensionPercentEmptyStats_dimension"},{args:o,kind:"FragmentSpread",name:"DimensionQuantilesStats_dimension"}],type:"Dimension",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"DimensionPageQuery",selections:[{alias:"dimension",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[c,i,{kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"primaryTimeRange",variableName:"timeRange"}],concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[c,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"NumericRange",kind:"LinkedField",name:"range",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"start",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"end",storageKey:null}],storageKey:null}],type:"IntervalBin",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"counts",plural:!1,selections:u,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"totalCounts",plural:!1,selections:u,storageKey:null}],storageKey:null},{alias:"count",args:[{kind:"Literal",name:"metric",value:"count"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"psi",args:[{kind:"Literal",name:"metric",value:"psi"},r],kind:"ScalarField",name:"driftMetric",storageKey:null},{alias:"cardinality",args:[y,r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"percentEmpty",args:[g,r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p99",args:[{kind:"Literal",name:"metric",value:"p99"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p75",args:[{kind:"Literal",name:"metric",value:"p75"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p50",args:[{kind:"Literal",name:"metric",value:"p50"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p25",args:[{kind:"Literal",name:"metric",value:"p25"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p1",args:[{kind:"Literal",name:"metric",value:"p01"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{condition:"hasReference",kind:"Condition",passingValue:!0,selections:[{alias:"referenceCardinality",args:[m,y],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"cardinality")'},{alias:"referencePercentEmpty",args:[m,g],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"percentEmpty")'}]}],type:"Dimension",abstractKey:null}],storageKey:null}]},params:{cacheID:"39ebdc3f16bc7a35f11f82fbe817bae7",id:null,metadata:{},name:"DimensionPageQuery",operationKind:"query",text:`query DimensionPageQuery(
5093
+ `}}}();Wm.hash="96d029150ec0c7e5419c2efa0ee67fc5";async function PI(n){const{embeddingDimensionId:a}=n.params;return T.fetchQuery(ve,Wm,{id:a}).toPromise()}const Jm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},a={defaultValue:null,kind:"LocalArgument",name:"hasReference"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"dimensionId"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={kind:"Variable",name:"timeRange",variableName:"timeRange"},o=[r],d=[{kind:"Variable",name:"hasReference",variableName:"hasReference"},r],c={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},u=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null}],y={kind:"Literal",name:"metric",value:"cardinality"},g={kind:"Literal",name:"metric",value:"percentEmpty"},m={kind:"Literal",name:"inferencesRole",value:"reference"};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionPageQuery",selections:[{alias:"dimension",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[i,{args:o,kind:"FragmentSpread",name:"DimensionSegmentsBarChart_dimension"},{args:o,kind:"FragmentSpread",name:"DimensionCountStats_dimension"},{args:o,kind:"FragmentSpread",name:"DimensionDriftStats_dimension"},{args:d,kind:"FragmentSpread",name:"DimensionCardinalityStats_dimension"},{args:d,kind:"FragmentSpread",name:"DimensionPercentEmptyStats_dimension"},{args:o,kind:"FragmentSpread",name:"DimensionQuantilesStats_dimension"}],type:"Dimension",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"DimensionPageQuery",selections:[{alias:"dimension",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[c,i,{kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"primaryTimeRange",variableName:"timeRange"}],concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[c,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"NumericRange",kind:"LinkedField",name:"range",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"start",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"end",storageKey:null}],storageKey:null}],type:"IntervalBin",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"counts",plural:!1,selections:u,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"totalCounts",plural:!1,selections:u,storageKey:null}],storageKey:null},{alias:"count",args:[{kind:"Literal",name:"metric",value:"count"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"psi",args:[{kind:"Literal",name:"metric",value:"psi"},r],kind:"ScalarField",name:"driftMetric",storageKey:null},{alias:"cardinality",args:[y,r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"percentEmpty",args:[g,r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p99",args:[{kind:"Literal",name:"metric",value:"p99"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p75",args:[{kind:"Literal",name:"metric",value:"p75"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p50",args:[{kind:"Literal",name:"metric",value:"p50"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p25",args:[{kind:"Literal",name:"metric",value:"p25"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p1",args:[{kind:"Literal",name:"metric",value:"p01"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{condition:"hasReference",kind:"Condition",passingValue:!0,selections:[{alias:"referenceCardinality",args:[m,y],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"cardinality")'},{alias:"referencePercentEmpty",args:[m,g],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"percentEmpty")'}]}],type:"Dimension",abstractKey:null}],storageKey:null}]},params:{cacheID:"39ebdc3f16bc7a35f11f82fbe817bae7",id:null,metadata:{},name:"DimensionPageQuery",operationKind:"query",text:`query DimensionPageQuery(
5094
5094
  $dimensionId: ID!
5095
5095
  $timeRange: TimeRange!
5096
5096
  $hasReference: Boolean!
@@ -5170,7 +5170,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
5170
5170
  }
5171
5171
  }
5172
5172
  }
5173
- `}}}();Jm.hash="667ef1a20e42077fcd704bf788c9357c";const Zm=function(){var n={kind:"Literal",name:"metric",value:"cardinality"};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"hasReference"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionCardinalityStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"cardinality",args:[n,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{condition:"hasReference",kind:"Condition",passingValue:!0,selections:[{alias:"referenceCardinality",args:[{kind:"Literal",name:"inferencesRole",value:"reference"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"cardinality")'}]}],type:"Dimension",abstractKey:null}}();Zm.hash="8b4edef350e4df49e799afa70ca34918";function XC(n){const a=P.useFragment(Zm,n.dimension);return s(Y,{children:[e(F,{elementType:"h3",size:"XS",color:"text-700",children:"Cardinality"}),e(F,{children:Bl(a.cardinality)}),a.referenceCardinality!=null&&e(F,{size:"S",color:"purple-800",children:Bl(a.referenceCardinality)})]})}const Xm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},a={defaultValue:null,kind:"LocalArgument",name:"granularity"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"dimensionId"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={kind:"InlineFragment",selections:[{alias:"cardinalityTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"granularity"},{kind:"Literal",name:"metric",value:"cardinality"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionCardinalityTimeSeriesQuery",selections:[{alias:"dimension",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,r],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"DimensionCardinalityTimeSeriesQuery",selections:[{alias:"dimension",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i,r],storageKey:null}]},params:{cacheID:"3c329f10094fdfe6dfbc0c7742bcffc4",id:null,metadata:{},name:"DimensionCardinalityTimeSeriesQuery",operationKind:"query",text:`query DimensionCardinalityTimeSeriesQuery(
5173
+ `}}}();Jm.hash="667ef1a20e42077fcd704bf788c9357c";const Zm=function(){var n={kind:"Literal",name:"metric",value:"cardinality"};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"hasReference"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionCardinalityStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"cardinality",args:[n,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{condition:"hasReference",kind:"Condition",passingValue:!0,selections:[{alias:"referenceCardinality",args:[{kind:"Literal",name:"inferencesRole",value:"reference"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"cardinality")'}]}],type:"Dimension",abstractKey:null}}();Zm.hash="8b4edef350e4df49e799afa70ca34918";function XC(n){const a=T.useFragment(Zm,n.dimension);return s(Y,{children:[e(F,{elementType:"h3",size:"XS",color:"text-700",children:"Cardinality"}),e(F,{children:Bl(a.cardinality)}),a.referenceCardinality!=null&&e(F,{size:"S",color:"purple-800",children:Bl(a.referenceCardinality)})]})}const Xm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},a={defaultValue:null,kind:"LocalArgument",name:"granularity"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"dimensionId"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={kind:"InlineFragment",selections:[{alias:"cardinalityTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"granularity"},{kind:"Literal",name:"metric",value:"cardinality"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionCardinalityTimeSeriesQuery",selections:[{alias:"dimension",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,r],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"DimensionCardinalityTimeSeriesQuery",selections:[{alias:"dimension",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i,r],storageKey:null}]},params:{cacheID:"3c329f10094fdfe6dfbc0c7742bcffc4",id:null,metadata:{},name:"DimensionCardinalityTimeSeriesQuery",operationKind:"query",text:`query DimensionCardinalityTimeSeriesQuery(
5174
5174
  $dimensionId: ID!
5175
5175
  $timeRange: TimeRange!
5176
5176
  $granularity: Granularity!
@@ -5188,7 +5188,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
5188
5188
  }
5189
5189
  }
5190
5190
  }
5191
- `}}}();Xm.hash="54017cf4e3febc3e99e1d95c98800ef7";const tt={top:25,right:18,left:18,bottom:5},YC=new Intl.NumberFormat([],{maximumFractionDigits:2}),Ym=()=>{const{gray300:n}=On();return{color:n}};function eK({active:n,payload:a,label:l}){var i;const{color:t}=Ym();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?YC.format(r):"--";return s(aa,{children:[e(F,{weight:"heavy",size:"S",children:`${fa(new Date(l))}`}),e(Ge,{color:t,name:"Cardinality",value:o}),e(Vt,{})]})}return null}function nK({dimensionId:n}){var d;const{timeRange:a}=ka(),l=bl(a),t=P.useLazyLoadQuery(Xm,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}),{color:i}=Ym(),r=((d=t.dimension.cardinalityTimeSeries)==null?void 0:d.data.map(c=>({timestamp:new Date(c.timestamp).valueOf(),value:c.value})))||[],o=Sl({samplingIntervalMinutes:l.samplingIntervalMinutes});return e(Qn,{width:"100%",height:"100%",children:s(Fl,{data:r,margin:tt,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"cardinalityColorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:i,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:i,stopOpacity:0})]})}),e(ra,{...vl,tickFormatter:c=>o(new Date(c))}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"Cardinality",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{content:e(eK,{})}),e(ql,{type:"monotone",dataKey:"value",stroke:i,fillOpacity:1,fill:"url(#cardinalityColorUv)"})]})})}const eg={argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionCountStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"count",args:[{kind:"Literal",name:"metric",value:"count"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"dataQualityMetric",storageKey:null}],type:"Dimension",abstractKey:null};eg.hash="6dccac51f3fb0853276677c692af5a43";function aK(n){const l=P.useFragment(eg,n.dimension).count??0;return s(Y,{children:[e(F,{elementType:"h3",size:"XS",color:"text-700",children:"Total Count"}),e(F,{size:"L",children:Bl(l)})]})}const ng=function(){var n={defaultValue:null,kind:"LocalArgument",name:"countGranularity"},a={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"dimensionId"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={kind:"InlineFragment",selections:[{alias:"trafficTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"countGranularity"},{kind:"Literal",name:"metric",value:"count"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionCountTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,r],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,l,n],kind:"Operation",name:"DimensionCountTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i,r],storageKey:null}]},params:{cacheID:"695a044545346c5b69438bef3d905a3e",id:null,metadata:{},name:"DimensionCountTimeSeriesQuery",operationKind:"query",text:`query DimensionCountTimeSeriesQuery(
5191
+ `}}}();Xm.hash="54017cf4e3febc3e99e1d95c98800ef7";const tt={top:25,right:18,left:18,bottom:5},YC=new Intl.NumberFormat([],{maximumFractionDigits:2}),Ym=()=>{const{gray300:n}=On();return{color:n}};function eK({active:n,payload:a,label:l}){var i;const{color:t}=Ym();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?YC.format(r):"--";return s(aa,{children:[e(F,{weight:"heavy",size:"S",children:`${fa(new Date(l))}`}),e(Ge,{color:t,name:"Cardinality",value:o}),e(Vt,{})]})}return null}function nK({dimensionId:n}){var d;const{timeRange:a}=ka(),l=bl(a),t=T.useLazyLoadQuery(Xm,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}),{color:i}=Ym(),r=((d=t.dimension.cardinalityTimeSeries)==null?void 0:d.data.map(c=>({timestamp:new Date(c.timestamp).valueOf(),value:c.value})))||[],o=Sl({samplingIntervalMinutes:l.samplingIntervalMinutes});return e(Qn,{width:"100%",height:"100%",children:s(Fl,{data:r,margin:tt,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"cardinalityColorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:i,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:i,stopOpacity:0})]})}),e(ra,{...vl,tickFormatter:c=>o(new Date(c))}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"Cardinality",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{content:e(eK,{})}),e(ql,{type:"monotone",dataKey:"value",stroke:i,fillOpacity:1,fill:"url(#cardinalityColorUv)"})]})})}const eg={argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionCountStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"count",args:[{kind:"Literal",name:"metric",value:"count"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"dataQualityMetric",storageKey:null}],type:"Dimension",abstractKey:null};eg.hash="6dccac51f3fb0853276677c692af5a43";function aK(n){const l=T.useFragment(eg,n.dimension).count??0;return s(Y,{children:[e(F,{elementType:"h3",size:"XS",color:"text-700",children:"Total Count"}),e(F,{size:"L",children:Bl(l)})]})}const ng=function(){var n={defaultValue:null,kind:"LocalArgument",name:"countGranularity"},a={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"dimensionId"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={kind:"InlineFragment",selections:[{alias:"trafficTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"countGranularity"},{kind:"Literal",name:"metric",value:"count"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionCountTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,r],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,l,n],kind:"Operation",name:"DimensionCountTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i,r],storageKey:null}]},params:{cacheID:"695a044545346c5b69438bef3d905a3e",id:null,metadata:{},name:"DimensionCountTimeSeriesQuery",operationKind:"query",text:`query DimensionCountTimeSeriesQuery(
5192
5192
  $dimensionId: ID!
5193
5193
  $timeRange: TimeRange!
5194
5194
  $countGranularity: Granularity!
@@ -5206,7 +5206,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
5206
5206
  }
5207
5207
  }
5208
5208
  }
5209
- `}}}();ng.hash="0e3c417502e042a162e263efd78e1877";const lK=new Intl.NumberFormat([],{maximumFractionDigits:2}),ag=()=>{const{gray300:n}=On();return{barColor:n}};function tK({active:n,payload:a,label:l}){var i;const{barColor:t}=ag();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?lK.format(r):"--";return s(aa,{children:[e(F,{weight:"heavy",size:"S",children:`${fa(new Date(l))}`}),e(Ge,{color:t,shape:"square",name:"Count",value:o})]})}return null}function iK({dimensionId:n}){var c;const{timeRange:a}=ka(),l=bl(a),r=(((c=P.useLazyLoadQuery(ng,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},countGranularity:l}).embedding.trafficTimeSeries)==null?void 0:c.data)||[]).map(u=>({...u,timestamp:new Date(u.timestamp).valueOf()})),o=Sl({samplingIntervalMinutes:l.samplingIntervalMinutes}),{barColor:d}=ag();return e(Qn,{width:"100%",height:"100%",children:s(qt,{data:r,margin:tt,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"countBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:d,stopOpacity:1}),e("stop",{offset:"95%",stopColor:d,stopOpacity:.5})]})}),e(ra,{...vl,tickFormatter:u=>o(new Date(u))}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"Count",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{...Yi,content:e(tK,{})}),e(La,{dataKey:"value",fill:"url(#countBarColor)",spacing:5})]})})}const lg=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"dimensionId"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"dimensionId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t=[{kind:"Variable",name:"primaryTimeRange",variableName:"timeRange"}],i={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},o={alias:null,args:null,concreteType:"NumericRange",kind:"LinkedField",name:"range",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"start",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"end",storageKey:null}],storageKey:null},d=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"referenceValue",storageKey:null}],c={alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"counts",plural:!1,selections:d,storageKey:null},u={alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"totalCounts",plural:!1,selections:d,storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DimensionDriftBreakdownSegmentBarChartQuery",selections:[{alias:"dimension",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{kind:"RequiredField",field:{alias:null,args:t,concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[{kind:"InlineFragment",selections:[i,r],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[i,o],type:"IntervalBin",abstractKey:null},{kind:"InlineFragment",selections:[i],type:"MissingValueBin",abstractKey:null}],storageKey:null},c],storageKey:null},u],storageKey:null},action:"THROW"}],type:"Dimension",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DimensionDriftBreakdownSegmentBarChartQuery",selections:[{alias:"dimension",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,l,{kind:"InlineFragment",selections:[{alias:null,args:t,concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[i,{kind:"InlineFragment",selections:[r],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[o],type:"IntervalBin",abstractKey:null}],storageKey:null},c],storageKey:null},u],storageKey:null}],type:"Dimension",abstractKey:null}],storageKey:null}]},params:{cacheID:"2e05d1ca13480861b72938edd162c36f",id:null,metadata:{},name:"DimensionDriftBreakdownSegmentBarChartQuery",operationKind:"query",text:`query DimensionDriftBreakdownSegmentBarChartQuery(
5209
+ `}}}();ng.hash="0e3c417502e042a162e263efd78e1877";const lK=new Intl.NumberFormat([],{maximumFractionDigits:2}),ag=()=>{const{gray300:n}=On();return{barColor:n}};function tK({active:n,payload:a,label:l}){var i;const{barColor:t}=ag();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?lK.format(r):"--";return s(aa,{children:[e(F,{weight:"heavy",size:"S",children:`${fa(new Date(l))}`}),e(Ge,{color:t,shape:"square",name:"Count",value:o})]})}return null}function iK({dimensionId:n}){var c;const{timeRange:a}=ka(),l=bl(a),r=(((c=T.useLazyLoadQuery(ng,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},countGranularity:l}).embedding.trafficTimeSeries)==null?void 0:c.data)||[]).map(u=>({...u,timestamp:new Date(u.timestamp).valueOf()})),o=Sl({samplingIntervalMinutes:l.samplingIntervalMinutes}),{barColor:d}=ag();return e(Qn,{width:"100%",height:"100%",children:s(qt,{data:r,margin:tt,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"countBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:d,stopOpacity:1}),e("stop",{offset:"95%",stopColor:d,stopOpacity:.5})]})}),e(ra,{...vl,tickFormatter:u=>o(new Date(u))}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"Count",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{...Yi,content:e(tK,{})}),e(La,{dataKey:"value",fill:"url(#countBarColor)",spacing:5})]})})}const lg=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"dimensionId"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"dimensionId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t=[{kind:"Variable",name:"primaryTimeRange",variableName:"timeRange"}],i={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},o={alias:null,args:null,concreteType:"NumericRange",kind:"LinkedField",name:"range",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"start",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"end",storageKey:null}],storageKey:null},d=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"referenceValue",storageKey:null}],c={alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"counts",plural:!1,selections:d,storageKey:null},u={alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"totalCounts",plural:!1,selections:d,storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DimensionDriftBreakdownSegmentBarChartQuery",selections:[{alias:"dimension",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{kind:"RequiredField",field:{alias:null,args:t,concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[{kind:"InlineFragment",selections:[i,r],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[i,o],type:"IntervalBin",abstractKey:null},{kind:"InlineFragment",selections:[i],type:"MissingValueBin",abstractKey:null}],storageKey:null},c],storageKey:null},u],storageKey:null},action:"THROW"}],type:"Dimension",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DimensionDriftBreakdownSegmentBarChartQuery",selections:[{alias:"dimension",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,l,{kind:"InlineFragment",selections:[{alias:null,args:t,concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[i,{kind:"InlineFragment",selections:[r],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[o],type:"IntervalBin",abstractKey:null}],storageKey:null},c],storageKey:null},u],storageKey:null}],type:"Dimension",abstractKey:null}],storageKey:null}]},params:{cacheID:"2e05d1ca13480861b72938edd162c36f",id:null,metadata:{},name:"DimensionDriftBreakdownSegmentBarChartQuery",operationKind:"query",text:`query DimensionDriftBreakdownSegmentBarChartQuery(
5210
5210
  $dimensionId: ID!
5211
5211
  $timeRange: TimeRange!
5212
5212
  ) {
@@ -5246,7 +5246,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
5246
5246
  }
5247
5247
  }
5248
5248
  }
5249
- `}}}();lg.hash="f42c6bfff21c628edc1e297e0a0462d4";const Ps=vt(".2f"),tg=()=>{const{primary:n,reference:a}=On();return{primaryBarColor:n,referenceBarColor:a}};function rK({active:n,payload:a,label:l}){var r,o,d,c,u,y;const{primaryBarColor:t,referenceBarColor:i}=tg();if(n&&a&&a.length){const g=(o=(r=a[0])==null?void 0:r.payload)==null?void 0:o.primaryName,m=(d=a[0])==null?void 0:d.value,f=(u=(c=a[0])==null?void 0:c.payload)==null?void 0:u.referenceName,h=(y=a[1])==null?void 0:y.value;return s(aa,{children:[e(F,{elementType:"h3",size:"S",weight:"heavy",children:l}),e(Ge,{color:t,shape:"square",name:g,value:m!=null?`${Ps(m)}%`:"--"}),e(Ge,{color:i,shape:"square",name:f,value:h!=null?`${Ps(h)}%`:"--"})]})}return null}function sK(n){var m,f,h,k,S;const{primaryInferences:a,referenceInferences:l}=ta(),t=a.name,i=(l==null?void 0:l.name)||"reference",{selectedTimestamp:r}=Qt(),o=p.useMemo(()=>r??new Date(a.endTime),[r,a.endTime]),d=p.useMemo(()=>({start:js(o,2).toISOString(),end:o.toISOString()}),[o]),c=P.useLazyLoadQuery(lg,{dimensionId:n.dimensionId,timeRange:d}),u=p.useMemo(()=>{var x,N,w,$,I;const C=((x=c.dimension.segmentsComparison)==null?void 0:x.segments)??[],T=((w=(N=c.dimension.segmentsComparison)==null?void 0:N.totalCounts)==null?void 0:w.primaryValue)??0,_=((I=($=c.dimension.segmentsComparison)==null?void 0:$.totalCounts)==null?void 0:I.referenceValue)??0;return C.map(M=>{var te,He;const z=((te=M.counts)==null?void 0:te.primaryValue)??0,A=((He=M.counts)==null?void 0:He.referenceValue)??0,V=$o(M.bin),O=z/T*100,H=A/_*100;return{name:V,primaryName:t,referenceName:i,primaryPercent:O,referencePercent:H}})},[(m=c.dimension.segmentsComparison)==null?void 0:m.segments,(h=(f=c.dimension.segmentsComparison)==null?void 0:f.totalCounts)==null?void 0:h.primaryValue,(S=(k=c.dimension.segmentsComparison)==null?void 0:k.totalCounts)==null?void 0:S.referenceValue,t,i]),{primaryBarColor:y,referenceBarColor:g}=tg();return s(b,{direction:"column",height:"100%",children:[e(v,{flex:"none",paddingTop:"size-100",paddingStart:"size-200",children:e(F,{elementType:"h3",size:"S",color:"text-700",children:`Distribution comparison at ${fa(new Date(d.end))}`})}),e(v,{flex:!0,children:e(Qn,{children:s(qt,{data:u,margin:{top:15,right:18,left:18,bottom:5},children:[s("defs",{children:[s("linearGradient",{id:"dimensionPrimarySegmentsBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:y,stopOpacity:1}),e("stop",{offset:"95%",stopColor:y,stopOpacity:.5})]}),s("linearGradient",{id:"dimensionReferenceSegmentsBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:g,stopOpacity:1}),e("stop",{offset:"95%",stopColor:g,stopOpacity:.5})]})]}),e(ra,{dataKey:"name",style:{fill:"var(--ac-global-text-color-700)"}}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"Percent",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)"}),e(ia,{...Yi,content:e(rK,{})}),e(La,{dataKey:"primaryPercent",fill:"url(#dimensionPrimarySegmentsBarColor)"}),e(La,{dataKey:"referencePercent",fill:"url(#dimensionReferenceSegmentsBarColor)"})]})})})]})}const ig={argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionDriftStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"psi",args:[{kind:"Literal",name:"metric",value:"psi"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"driftMetric",storageKey:null}],type:"Dimension",abstractKey:null};ig.hash="f8a9fb08a14f63906e38bc247d50b189";const oK=s(Jl,{variant:"info",placement:"top end",children:[e(de,{weight:"heavy",level:4,children:"Population Stability Index"}),e(Ja,{children:e(F,{children:"PSI is a symmetric metric that measures the relative entropy, or difference in information represented by two distributions. It can be thought of as measuring the distance between two data distributions showing how different the two distributions are from each other."})}),e("footer",{children:e($n,{href:"https://arize.com/blog-course/population-stability-index-psi/#:~:text=Population%20Stability%20Index%20(PSI)%20Overview,distributions%20are%20from%20each%20other.",children:"Learn more"})})]});function dK(n){const a=P.useFragment(ig,n.dimension);return s(Y,{children:[s(b,{direction:"row",alignItems:"center",gap:"size-25",children:[e(F,{elementType:"h3",size:"XS",color:"text-700",children:"PSI"}),oK]}),e(F,{size:"L",children:tl(a.psi)})]})}const rg=function(){var n={defaultValue:null,kind:"LocalArgument",name:"countGranularity"},a={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},l={defaultValue:null,kind:"LocalArgument",name:"driftGranularity"},t={defaultValue:null,kind:"LocalArgument",name:"timeRange"},i=[{kind:"Variable",name:"id",variableName:"dimensionId"}],r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},o={kind:"Variable",name:"timeRange",variableName:"timeRange"},d=[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],c={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"granularity",variableName:"driftGranularity"},{kind:"Literal",name:"metric",value:"psi"},o],concreteType:"DriftTimeSeries",kind:"LinkedField",name:"driftTimeSeries",plural:!1,selections:d,storageKey:null},{alias:"trafficTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"countGranularity"},{kind:"Literal",name:"metric",value:"count"},o],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:d,storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l,t],kind:"Fragment",metadata:null,name:"DimensionDriftTimeSeriesQuery",selections:[{alias:"embedding",args:i,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[r,c],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,t,l,n],kind:"Operation",name:"DimensionDriftTimeSeriesQuery",selections:[{alias:"embedding",args:i,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r,c],storageKey:null}]},params:{cacheID:"76a27456cd1f545ddb16fc0d9ef09fc1",id:null,metadata:{},name:"DimensionDriftTimeSeriesQuery",operationKind:"query",text:`query DimensionDriftTimeSeriesQuery(
5249
+ `}}}();lg.hash="f42c6bfff21c628edc1e297e0a0462d4";const Ps=vt(".2f"),tg=()=>{const{primary:n,reference:a}=On();return{primaryBarColor:n,referenceBarColor:a}};function rK({active:n,payload:a,label:l}){var r,o,d,c,u,y;const{primaryBarColor:t,referenceBarColor:i}=tg();if(n&&a&&a.length){const g=(o=(r=a[0])==null?void 0:r.payload)==null?void 0:o.primaryName,m=(d=a[0])==null?void 0:d.value,f=(u=(c=a[0])==null?void 0:c.payload)==null?void 0:u.referenceName,h=(y=a[1])==null?void 0:y.value;return s(aa,{children:[e(F,{elementType:"h3",size:"S",weight:"heavy",children:l}),e(Ge,{color:t,shape:"square",name:g,value:m!=null?`${Ps(m)}%`:"--"}),e(Ge,{color:i,shape:"square",name:f,value:h!=null?`${Ps(h)}%`:"--"})]})}return null}function sK(n){var m,f,h,k,S;const{primaryInferences:a,referenceInferences:l}=ta(),t=a.name,i=(l==null?void 0:l.name)||"reference",{selectedTimestamp:r}=Qt(),o=p.useMemo(()=>r??new Date(a.endTime),[r,a.endTime]),d=p.useMemo(()=>({start:js(o,2).toISOString(),end:o.toISOString()}),[o]),c=T.useLazyLoadQuery(lg,{dimensionId:n.dimensionId,timeRange:d}),u=p.useMemo(()=>{var x,N,w,$,I;const C=((x=c.dimension.segmentsComparison)==null?void 0:x.segments)??[],P=((w=(N=c.dimension.segmentsComparison)==null?void 0:N.totalCounts)==null?void 0:w.primaryValue)??0,L=((I=($=c.dimension.segmentsComparison)==null?void 0:$.totalCounts)==null?void 0:I.referenceValue)??0;return C.map(M=>{var te,He;const z=((te=M.counts)==null?void 0:te.primaryValue)??0,A=((He=M.counts)==null?void 0:He.referenceValue)??0,V=$o(M.bin),O=z/P*100,H=A/L*100;return{name:V,primaryName:t,referenceName:i,primaryPercent:O,referencePercent:H}})},[(m=c.dimension.segmentsComparison)==null?void 0:m.segments,(h=(f=c.dimension.segmentsComparison)==null?void 0:f.totalCounts)==null?void 0:h.primaryValue,(S=(k=c.dimension.segmentsComparison)==null?void 0:k.totalCounts)==null?void 0:S.referenceValue,t,i]),{primaryBarColor:y,referenceBarColor:g}=tg();return s(b,{direction:"column",height:"100%",children:[e(v,{flex:"none",paddingTop:"size-100",paddingStart:"size-200",children:e(F,{elementType:"h3",size:"S",color:"text-700",children:`Distribution comparison at ${fa(new Date(d.end))}`})}),e(v,{flex:!0,children:e(Qn,{children:s(qt,{data:u,margin:{top:15,right:18,left:18,bottom:5},children:[s("defs",{children:[s("linearGradient",{id:"dimensionPrimarySegmentsBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:y,stopOpacity:1}),e("stop",{offset:"95%",stopColor:y,stopOpacity:.5})]}),s("linearGradient",{id:"dimensionReferenceSegmentsBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:g,stopOpacity:1}),e("stop",{offset:"95%",stopColor:g,stopOpacity:.5})]})]}),e(ra,{dataKey:"name",style:{fill:"var(--ac-global-text-color-700)"}}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"Percent",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)"}),e(ia,{...Yi,content:e(rK,{})}),e(La,{dataKey:"primaryPercent",fill:"url(#dimensionPrimarySegmentsBarColor)"}),e(La,{dataKey:"referencePercent",fill:"url(#dimensionReferenceSegmentsBarColor)"})]})})})]})}const ig={argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionDriftStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"psi",args:[{kind:"Literal",name:"metric",value:"psi"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"driftMetric",storageKey:null}],type:"Dimension",abstractKey:null};ig.hash="f8a9fb08a14f63906e38bc247d50b189";const oK=s(Jl,{variant:"info",placement:"top end",children:[e(de,{weight:"heavy",level:4,children:"Population Stability Index"}),e(Ja,{children:e(F,{children:"PSI is a symmetric metric that measures the relative entropy, or difference in information represented by two distributions. It can be thought of as measuring the distance between two data distributions showing how different the two distributions are from each other."})}),e("footer",{children:e($n,{href:"https://arize.com/blog-course/population-stability-index-psi/#:~:text=Population%20Stability%20Index%20(PSI)%20Overview,distributions%20are%20from%20each%20other.",children:"Learn more"})})]});function dK(n){const a=T.useFragment(ig,n.dimension);return s(Y,{children:[s(b,{direction:"row",alignItems:"center",gap:"size-25",children:[e(F,{elementType:"h3",size:"XS",color:"text-700",children:"PSI"}),oK]}),e(F,{size:"L",children:tl(a.psi)})]})}const rg=function(){var n={defaultValue:null,kind:"LocalArgument",name:"countGranularity"},a={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},l={defaultValue:null,kind:"LocalArgument",name:"driftGranularity"},t={defaultValue:null,kind:"LocalArgument",name:"timeRange"},i=[{kind:"Variable",name:"id",variableName:"dimensionId"}],r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},o={kind:"Variable",name:"timeRange",variableName:"timeRange"},d=[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],c={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"granularity",variableName:"driftGranularity"},{kind:"Literal",name:"metric",value:"psi"},o],concreteType:"DriftTimeSeries",kind:"LinkedField",name:"driftTimeSeries",plural:!1,selections:d,storageKey:null},{alias:"trafficTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"countGranularity"},{kind:"Literal",name:"metric",value:"count"},o],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:d,storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l,t],kind:"Fragment",metadata:null,name:"DimensionDriftTimeSeriesQuery",selections:[{alias:"embedding",args:i,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[r,c],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,t,l,n],kind:"Operation",name:"DimensionDriftTimeSeriesQuery",selections:[{alias:"embedding",args:i,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r,c],storageKey:null}]},params:{cacheID:"76a27456cd1f545ddb16fc0d9ef09fc1",id:null,metadata:{},name:"DimensionDriftTimeSeriesQuery",operationKind:"query",text:`query DimensionDriftTimeSeriesQuery(
5250
5250
  $dimensionId: ID!
5251
5251
  $timeRange: TimeRange!
5252
5252
  $driftGranularity: Granularity!
@@ -5279,7 +5279,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
5279
5279
  gap: var(--ac-global-dimension-static-size-50);
5280
5280
 
5281
5281
  margin-top: var(--ac-global-dimension-static-size-50);
5282
- `,children:[e(D,{svg:e(ga,{})}),e("span",{children:"Click to view details"})]})]})}return null}function uK({dimensionId:n}){var f,h;const{timeRange:a}=ka(),{selectedTimestamp:l,setSelectedTimestamp:t}=Qt(),i=bl(a),r=P.useLazyLoadQuery(rg,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},driftGranularity:Eo(a),countGranularity:i}),o=((f=r.embedding.driftTimeSeries)==null?void 0:f.data)||[],d=((h=r.embedding.trafficTimeSeries)==null?void 0:h.data.reduce((k,S)=>(k[S.timestamp]=S.value,k),{}))??{},c=o.map(k=>{const S=d[k.timestamp];return{...k,traffic:S,timestamp:new Date(k.timestamp).valueOf()}}),u=Sl({samplingIntervalMinutes:i.samplingIntervalMinutes}),y=p.useCallback(k=>{const{activePayload:S}=k;if(S!=null&&S.length>0){const C=S[0].payload;t(new Date(C.timestamp))}},[t]),{color:g,barColor:m}=sg();return e(Qn,{width:"100%",height:"100%",children:s(Fl,{data:c,margin:tt,onClick:y,syncId:"dimensionDetails",children:[s("defs",{children:[s("linearGradient",{id:"dimensionDriftColorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:g,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:g,stopOpacity:0})]}),s("linearGradient",{id:"barColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:m,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:m,stopOpacity:0})]})]}),e(ra,{...vl,tickFormatter:k=>u(new Date(k))}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"PSI",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-color-grey-500)"}}),e(Tn,{yAxisId:"right",orientation:"right",tick:!1,tickLine:!1,width:0}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{content:e(cK,{})}),e(La,{yAxisId:"right",dataKey:"traffic",fill:"url(#barColor)",spacing:5}),e(ql,{type:"monotone",dataKey:"value",stroke:g,fillOpacity:1,fill:"url(#dimensionDriftColorUv)"}),l!=null?e(ed,{...Mo,x:l.getTime()}):null]})})}const og=function(){var n={kind:"Literal",name:"metric",value:"percentEmpty"};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"hasReference"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionPercentEmptyStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"percentEmpty",args:[n,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{condition:"hasReference",kind:"Condition",passingValue:!0,selections:[{alias:"referencePercentEmpty",args:[{kind:"Literal",name:"inferencesRole",value:"reference"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"percentEmpty")'}]}],type:"Dimension",abstractKey:null}}();og.hash="1e10d0449d6607d9292f355548c41c78";function mK(n){const a=P.useFragment(og,n.dimension);return s(Y,{children:[e(F,{elementType:"h3",size:"XS",color:"text-700",children:"% Empty"}),e(F,{size:"L",children:ft(a.percentEmpty)}),a.referencePercentEmpty!=null&&e(F,{size:"M",color:"purple-800",children:ft(a.referencePercentEmpty)})]})}const dg=function(){var n={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},a={defaultValue:null,kind:"LocalArgument",name:"granularity"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"dimensionId"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={kind:"InlineFragment",selections:[{alias:"percentEmptyTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"granularity"},{kind:"Literal",name:"metric",value:"percentEmpty"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionPercentEmptyTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,r],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"DimensionPercentEmptyTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i,r],storageKey:null}]},params:{cacheID:"85842391b76ccca79e3b6f506fb1d78d",id:null,metadata:{},name:"DimensionPercentEmptyTimeSeriesQuery",operationKind:"query",text:`query DimensionPercentEmptyTimeSeriesQuery(
5282
+ `,children:[e(D,{svg:e(ga,{})}),e("span",{children:"Click to view details"})]})]})}return null}function uK({dimensionId:n}){var f,h;const{timeRange:a}=ka(),{selectedTimestamp:l,setSelectedTimestamp:t}=Qt(),i=bl(a),r=T.useLazyLoadQuery(rg,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},driftGranularity:Eo(a),countGranularity:i}),o=((f=r.embedding.driftTimeSeries)==null?void 0:f.data)||[],d=((h=r.embedding.trafficTimeSeries)==null?void 0:h.data.reduce((k,S)=>(k[S.timestamp]=S.value,k),{}))??{},c=o.map(k=>{const S=d[k.timestamp];return{...k,traffic:S,timestamp:new Date(k.timestamp).valueOf()}}),u=Sl({samplingIntervalMinutes:i.samplingIntervalMinutes}),y=p.useCallback(k=>{const{activePayload:S}=k;if(S!=null&&S.length>0){const C=S[0].payload;t(new Date(C.timestamp))}},[t]),{color:g,barColor:m}=sg();return e(Qn,{width:"100%",height:"100%",children:s(Fl,{data:c,margin:tt,onClick:y,syncId:"dimensionDetails",children:[s("defs",{children:[s("linearGradient",{id:"dimensionDriftColorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:g,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:g,stopOpacity:0})]}),s("linearGradient",{id:"barColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:m,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:m,stopOpacity:0})]})]}),e(ra,{...vl,tickFormatter:k=>u(new Date(k))}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"PSI",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-color-grey-500)"}}),e(Tn,{yAxisId:"right",orientation:"right",tick:!1,tickLine:!1,width:0}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{content:e(cK,{})}),e(La,{yAxisId:"right",dataKey:"traffic",fill:"url(#barColor)",spacing:5}),e(ql,{type:"monotone",dataKey:"value",stroke:g,fillOpacity:1,fill:"url(#dimensionDriftColorUv)"}),l!=null?e(ed,{...Mo,x:l.getTime()}):null]})})}const og=function(){var n={kind:"Literal",name:"metric",value:"percentEmpty"};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"hasReference"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionPercentEmptyStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"percentEmpty",args:[n,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{condition:"hasReference",kind:"Condition",passingValue:!0,selections:[{alias:"referencePercentEmpty",args:[{kind:"Literal",name:"inferencesRole",value:"reference"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"percentEmpty")'}]}],type:"Dimension",abstractKey:null}}();og.hash="1e10d0449d6607d9292f355548c41c78";function mK(n){const a=T.useFragment(og,n.dimension);return s(Y,{children:[e(F,{elementType:"h3",size:"XS",color:"text-700",children:"% Empty"}),e(F,{size:"L",children:ft(a.percentEmpty)}),a.referencePercentEmpty!=null&&e(F,{size:"M",color:"purple-800",children:ft(a.referencePercentEmpty)})]})}const dg=function(){var n={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},a={defaultValue:null,kind:"LocalArgument",name:"granularity"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"dimensionId"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={kind:"InlineFragment",selections:[{alias:"percentEmptyTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"granularity"},{kind:"Literal",name:"metric",value:"percentEmpty"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionPercentEmptyTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,r],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"DimensionPercentEmptyTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i,r],storageKey:null}]},params:{cacheID:"85842391b76ccca79e3b6f506fb1d78d",id:null,metadata:{},name:"DimensionPercentEmptyTimeSeriesQuery",operationKind:"query",text:`query DimensionPercentEmptyTimeSeriesQuery(
5283
5283
  $dimensionId: ID!
5284
5284
  $timeRange: TimeRange!
5285
5285
  $granularity: Granularity!
@@ -5297,7 +5297,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
5297
5297
  }
5298
5298
  }
5299
5299
  }
5300
- `}}}();dg.hash="c04e7d788249ceb6f9f7a9ff50a28efd";const gK=new Intl.NumberFormat([],{maximumFractionDigits:2}),cg=()=>{const{gray100:n}=On();return{color:n}};function pK({active:n,payload:a,label:l}){var i;const{color:t}=cg();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?gK.format(r):"--";return s(aa,{children:[e(F,{weight:"heavy",size:"S",children:`${fa(new Date(l))}`}),e(Ge,{color:t,name:"% Empty",value:o})]})}return null}function yK({dimensionId:n}){var d;const{timeRange:a}=ka(),l=bl(a),i=((d=P.useLazyLoadQuery(dg,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}).embedding.percentEmptyTimeSeries)==null?void 0:d.data.map(c=>({timestamp:new Date(c.timestamp).valueOf(),value:c.value})))||[],r=Sl({samplingIntervalMinutes:l.samplingIntervalMinutes}),{color:o}=cg();return e(Qn,{width:"100%",height:"100%",children:s(Fl,{data:i,margin:tt,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"percentEmptyColorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:o,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:o,stopOpacity:0})]})}),e(ra,{...vl,tickFormatter:c=>r(new Date(c))}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"% Empty",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{content:e(pK,{})}),e(ir,{type:"monotone",dataKey:"value",stroke:o,fillOpacity:1,fill:"url(#percentEmptyColorUv)"})]})})}const ug=function(){var n={kind:"Variable",name:"timeRange",variableName:"timeRange"};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionQuantilesStats_dimension",selections:[{alias:"p99",args:[{kind:"Literal",name:"metric",value:"p99"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p75",args:[{kind:"Literal",name:"metric",value:"p75"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p50",args:[{kind:"Literal",name:"metric",value:"p50"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p25",args:[{kind:"Literal",name:"metric",value:"p25"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p1",args:[{kind:"Literal",name:"metric",value:"p01"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null}],type:"Dimension",abstractKey:null}}();ug.hash="c306c8eafb1d34be464d3a658d5f94a7";function fK(n){const a=P.useFragment(ug,n.dimension);return e("ul",{css:K`
5300
+ `}}}();dg.hash="c04e7d788249ceb6f9f7a9ff50a28efd";const gK=new Intl.NumberFormat([],{maximumFractionDigits:2}),cg=()=>{const{gray100:n}=On();return{color:n}};function pK({active:n,payload:a,label:l}){var i;const{color:t}=cg();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?gK.format(r):"--";return s(aa,{children:[e(F,{weight:"heavy",size:"S",children:`${fa(new Date(l))}`}),e(Ge,{color:t,name:"% Empty",value:o})]})}return null}function yK({dimensionId:n}){var d;const{timeRange:a}=ka(),l=bl(a),i=((d=T.useLazyLoadQuery(dg,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}).embedding.percentEmptyTimeSeries)==null?void 0:d.data.map(c=>({timestamp:new Date(c.timestamp).valueOf(),value:c.value})))||[],r=Sl({samplingIntervalMinutes:l.samplingIntervalMinutes}),{color:o}=cg();return e(Qn,{width:"100%",height:"100%",children:s(Fl,{data:i,margin:tt,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"percentEmptyColorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:o,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:o,stopOpacity:0})]})}),e(ra,{...vl,tickFormatter:c=>r(new Date(c))}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"% Empty",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{content:e(pK,{})}),e(ir,{type:"monotone",dataKey:"value",stroke:o,fillOpacity:1,fill:"url(#percentEmptyColorUv)"})]})})}const ug=function(){var n={kind:"Variable",name:"timeRange",variableName:"timeRange"};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionQuantilesStats_dimension",selections:[{alias:"p99",args:[{kind:"Literal",name:"metric",value:"p99"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p75",args:[{kind:"Literal",name:"metric",value:"p75"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p50",args:[{kind:"Literal",name:"metric",value:"p50"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p25",args:[{kind:"Literal",name:"metric",value:"p25"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p1",args:[{kind:"Literal",name:"metric",value:"p01"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null}],type:"Dimension",abstractKey:null}}();ug.hash="c306c8eafb1d34be464d3a658d5f94a7";function fK(n){const a=T.useFragment(ug,n.dimension);return e("ul",{css:K`
5301
5301
  display: flex;
5302
5302
  flex-direction: column;
5303
5303
  gap: var(--ac-global-dimension-static-size-50);
@@ -5347,7 +5347,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
5347
5347
  }
5348
5348
  }
5349
5349
  }
5350
- `}}}();mg.hash="83342058bb8f50dad5bec299b4bc034d";const hK=vt("~s");var gg=(n=>(n.p99_p01="p99_p01",n.p75_p25="p75_p25",n.p50="p50",n))(gg||{});const kK=new Intl.NumberFormat([],{maximumFractionDigits:2});function Dl(n){return typeof n=="number"?kK.format(n):"--"}const pg=()=>{const n=On();return{outerColor:n.gray500,innerColor:n.gray300,lineColor:n.default}};function bK({active:n,payload:a,label:l}){const{outerColor:t,innerColor:i,lineColor:r}=pg();if(n&&a&&a.length){const o=a[0].payload;return s(aa,{children:[e(F,{weight:"heavy",size:"S",children:`${fa(new Date(l))}`}),e(Ge,{color:t,name:"p99",value:Dl(o.p99_p01[0])}),e(Ge,{color:i,name:"p75",value:Dl(o.p75_p25[0])}),e(Ge,{color:r,name:"p50",value:Dl(o.p50)}),e(Ge,{color:i,name:"p25",value:Dl(o.p75_p25[1])}),e(Ge,{color:t,name:"p01",value:Dl(o.p99_p01[1])})]})}return null}function SK({dimensionId:n}){var _,x,N,w,$;const{timeRange:a}=ka(),l=bl(a),t=P.useLazyLoadQuery(mg,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}),i=((_=t.dimension.p99TimeSeries)==null?void 0:_.data.map(I=>I))||[],r=((x=t.dimension.p01TimeSeries)==null?void 0:x.data.map(I=>I))||[],o=((N=t.dimension.p75TimeSeries)==null?void 0:N.data.map(I=>I))||[],d=((w=t.dimension.p25TimeSeries)==null?void 0:w.data.map(I=>I))||[],c=(($=t.dimension.p50TimeSeries)==null?void 0:$.data.map(I=>I))||[],u=i.map((I,M)=>({timestamp:new Date(I.timestamp).valueOf(),p99_p01:[I.value,r[M].value],p75_p25:[o[M].value,d[M].value],p50:c[M].value})),y=Sl({samplingIntervalMinutes:l.samplingIntervalMinutes}),[g,m]=p.useState(Object.keys(gg).reduce((I,M)=>(I[M]=!1,I),{})),f=I=>{g[I.dataKey]||m({...g})},h=()=>{m({...g})},k=I=>{m({...g,[String(I.dataKey)]:!g[I.dataKey]})},{outerColor:S,innerColor:C,lineColor:T}=pg();return e(Qn,{width:"100%",height:"100%",children:s(Fl,{data:u,margin:tt,syncId:"dimensionDetails",children:[s("defs",{children:[s("linearGradient",{id:"p99_p01ColorUV",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"10%",stopColor:S,stopOpacity:.7}),e("stop",{offset:"50%",stopColor:S,stopOpacity:.3}),e("stop",{offset:"90%",stopColor:S,stopOpacity:.7})]}),s("linearGradient",{id:"p75_p25ColorUV",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"10%",stopColor:C,stopOpacity:.7}),e("stop",{offset:"50%",stopColor:C,stopOpacity:.3}),e("stop",{offset:"90%",stopColor:C,stopOpacity:.7})]})]}),e(ra,{...vl,tickFormatter:I=>y(new Date(I))}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"Value",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},tickFormatter:I=>hK(I),style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{content:e(bK,{})}),e(_k,{onClick:k,onMouseOver:f,onMouseOut:h}),e(ql,{type:"monotone",dataKey:"p99_p01",name:"p99 - p01",fillOpacity:1,fill:"url(#p99_p01ColorUV)",stroke:S,hide:g.p99_p01===!0}),e(ql,{type:"monotone",dataKey:"p75_p25",name:"p75 - p25",fillOpacity:1,stroke:C,fill:"url(#p75_p25ColorUV)",hide:g.p75_p25===!0}),e(ir,{type:"monotone",dataKey:"p50",stroke:T,hide:g.p50===!0})]})})}const yg=function(){var n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},a=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null}];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionSegmentsBarChart_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:[{kind:"Variable",name:"primaryTimeRange",variableName:"timeRange"}],concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[{kind:"InlineFragment",selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[n,{alias:null,args:null,concreteType:"NumericRange",kind:"LinkedField",name:"range",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"start",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"end",storageKey:null}],storageKey:null}],type:"IntervalBin",abstractKey:null},{kind:"InlineFragment",selections:[n],type:"MissingValueBin",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"counts",plural:!1,selections:a,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"totalCounts",plural:!1,selections:a,storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null}}();yg.hash="8cef9841e9a5bd7d0d50acb5db9028b0";const vK=vt(".2f"),fg=()=>{const{primary:n}=On();return{color:n}};function FK({active:n,payload:a,label:l}){var i;const{color:t}=fg();if(n&&a&&a.length){const r=(i=a[0])==null?void 0:i.value;return e(aa,{children:e(Ge,{color:t,shape:"square",name:l,value:r!=null?`${vK(r)}%`:"--"})})}return null}function CK(n){const a=P.useFragment(yg,n.dimension),l=p.useMemo(()=>{var o,d,c;const i=((o=a.segmentsComparison)==null?void 0:o.segments)??[],r=((c=(d=a.segmentsComparison)==null?void 0:d.totalCounts)==null?void 0:c.primaryValue)??0;return i.map(u=>{var f;const y=((f=u.counts)==null?void 0:f.primaryValue)??0,g=$o(u.bin),m=y/r*100;return{name:g,percent:m}})},[a]),{color:t}=fg();return e(Qn,{children:s(qt,{data:l,margin:{top:25,right:18,left:18,bottom:5},children:[e("defs",{children:s("linearGradient",{id:"dimensionSegmentsBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:t,stopOpacity:1}),e("stop",{offset:"95%",stopColor:t,stopOpacity:.5})]})}),e(ra,{dataKey:"name",style:{fill:"var(--ac-global-text-color-700)"}}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"% Volume",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{...Yi,content:e(FK,{})}),e(La,{dataKey:"percent",fill:"url(#dimensionSegmentsBarColor)",spacing:15})]})})}function II(){const{dimensionId:n}=We(),a=be(),[l,t]=p.useState(!0),{timeRange:i}=ka(),r=Ue();qe(r);const{referenceInferences:o}=ta(),d=o!==null,c=d,u=r.dimension.shape!=="continuous",y=r.dimension.dataType==="numeric",g=P.useLazyLoadQuery(Jm,{dimensionId:n,timeRange:{start:i.start.toISOString(),end:i.end.toISOString()},hasReference:d});if(!n)throw new Error("Dimension ID is required to display a dimension");const m=f=>{t(f),f||a("/model")};return e(No,{initialTimestamp:new Date(i.end),children:e(J,{isOpen:l,onOpenChange:m,children:e(ne,{isDismissable:!0,children:e(Z,{variant:"slideover",size:"L",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:r.dimension.name}),e(ue,{children:e(me,{})})]}),e("main",{css:K`
5350
+ `}}}();mg.hash="83342058bb8f50dad5bec299b4bc034d";const hK=vt("~s");var gg=(n=>(n.p99_p01="p99_p01",n.p75_p25="p75_p25",n.p50="p50",n))(gg||{});const kK=new Intl.NumberFormat([],{maximumFractionDigits:2});function Dl(n){return typeof n=="number"?kK.format(n):"--"}const pg=()=>{const n=On();return{outerColor:n.gray500,innerColor:n.gray300,lineColor:n.default}};function bK({active:n,payload:a,label:l}){const{outerColor:t,innerColor:i,lineColor:r}=pg();if(n&&a&&a.length){const o=a[0].payload;return s(aa,{children:[e(F,{weight:"heavy",size:"S",children:`${fa(new Date(l))}`}),e(Ge,{color:t,name:"p99",value:Dl(o.p99_p01[0])}),e(Ge,{color:i,name:"p75",value:Dl(o.p75_p25[0])}),e(Ge,{color:r,name:"p50",value:Dl(o.p50)}),e(Ge,{color:i,name:"p25",value:Dl(o.p75_p25[1])}),e(Ge,{color:t,name:"p01",value:Dl(o.p99_p01[1])})]})}return null}function SK({dimensionId:n}){var L,x,N,w,$;const{timeRange:a}=ka(),l=bl(a),t=T.useLazyLoadQuery(mg,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}),i=((L=t.dimension.p99TimeSeries)==null?void 0:L.data.map(I=>I))||[],r=((x=t.dimension.p01TimeSeries)==null?void 0:x.data.map(I=>I))||[],o=((N=t.dimension.p75TimeSeries)==null?void 0:N.data.map(I=>I))||[],d=((w=t.dimension.p25TimeSeries)==null?void 0:w.data.map(I=>I))||[],c=(($=t.dimension.p50TimeSeries)==null?void 0:$.data.map(I=>I))||[],u=i.map((I,M)=>({timestamp:new Date(I.timestamp).valueOf(),p99_p01:[I.value,r[M].value],p75_p25:[o[M].value,d[M].value],p50:c[M].value})),y=Sl({samplingIntervalMinutes:l.samplingIntervalMinutes}),[g,m]=p.useState(Object.keys(gg).reduce((I,M)=>(I[M]=!1,I),{})),f=I=>{g[I.dataKey]||m({...g})},h=()=>{m({...g})},k=I=>{m({...g,[String(I.dataKey)]:!g[I.dataKey]})},{outerColor:S,innerColor:C,lineColor:P}=pg();return e(Qn,{width:"100%",height:"100%",children:s(Fl,{data:u,margin:tt,syncId:"dimensionDetails",children:[s("defs",{children:[s("linearGradient",{id:"p99_p01ColorUV",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"10%",stopColor:S,stopOpacity:.7}),e("stop",{offset:"50%",stopColor:S,stopOpacity:.3}),e("stop",{offset:"90%",stopColor:S,stopOpacity:.7})]}),s("linearGradient",{id:"p75_p25ColorUV",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"10%",stopColor:C,stopOpacity:.7}),e("stop",{offset:"50%",stopColor:C,stopOpacity:.3}),e("stop",{offset:"90%",stopColor:C,stopOpacity:.7})]})]}),e(ra,{...vl,tickFormatter:I=>y(new Date(I))}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"Value",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},tickFormatter:I=>hK(I),style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{content:e(bK,{})}),e(_k,{onClick:k,onMouseOver:f,onMouseOut:h}),e(ql,{type:"monotone",dataKey:"p99_p01",name:"p99 - p01",fillOpacity:1,fill:"url(#p99_p01ColorUV)",stroke:S,hide:g.p99_p01===!0}),e(ql,{type:"monotone",dataKey:"p75_p25",name:"p75 - p25",fillOpacity:1,stroke:C,fill:"url(#p75_p25ColorUV)",hide:g.p75_p25===!0}),e(ir,{type:"monotone",dataKey:"p50",stroke:P,hide:g.p50===!0})]})})}const yg=function(){var n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},a=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null}];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionSegmentsBarChart_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:[{kind:"Variable",name:"primaryTimeRange",variableName:"timeRange"}],concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[{kind:"InlineFragment",selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[n,{alias:null,args:null,concreteType:"NumericRange",kind:"LinkedField",name:"range",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"start",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"end",storageKey:null}],storageKey:null}],type:"IntervalBin",abstractKey:null},{kind:"InlineFragment",selections:[n],type:"MissingValueBin",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"counts",plural:!1,selections:a,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"totalCounts",plural:!1,selections:a,storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null}}();yg.hash="8cef9841e9a5bd7d0d50acb5db9028b0";const vK=vt(".2f"),fg=()=>{const{primary:n}=On();return{color:n}};function FK({active:n,payload:a,label:l}){var i;const{color:t}=fg();if(n&&a&&a.length){const r=(i=a[0])==null?void 0:i.value;return e(aa,{children:e(Ge,{color:t,shape:"square",name:l,value:r!=null?`${vK(r)}%`:"--"})})}return null}function CK(n){const a=T.useFragment(yg,n.dimension),l=p.useMemo(()=>{var o,d,c;const i=((o=a.segmentsComparison)==null?void 0:o.segments)??[],r=((c=(d=a.segmentsComparison)==null?void 0:d.totalCounts)==null?void 0:c.primaryValue)??0;return i.map(u=>{var f;const y=((f=u.counts)==null?void 0:f.primaryValue)??0,g=$o(u.bin),m=y/r*100;return{name:g,percent:m}})},[a]),{color:t}=fg();return e(Qn,{children:s(qt,{data:l,margin:{top:25,right:18,left:18,bottom:5},children:[e("defs",{children:s("linearGradient",{id:"dimensionSegmentsBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:t,stopOpacity:1}),e("stop",{offset:"95%",stopColor:t,stopOpacity:.5})]})}),e(ra,{dataKey:"name",style:{fill:"var(--ac-global-text-color-700)"}}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"% Volume",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ia,{...Yi,content:e(FK,{})}),e(La,{dataKey:"percent",fill:"url(#dimensionSegmentsBarColor)",spacing:15})]})})}function II(){const{dimensionId:n}=We(),a=be(),[l,t]=p.useState(!0),{timeRange:i}=ka(),r=Ue();qe(r);const{referenceInferences:o}=ta(),d=o!==null,c=d,u=r.dimension.shape!=="continuous",y=r.dimension.dataType==="numeric",g=T.useLazyLoadQuery(Jm,{dimensionId:n,timeRange:{start:i.start.toISOString(),end:i.end.toISOString()},hasReference:d});if(!n)throw new Error("Dimension ID is required to display a dimension");const m=f=>{t(f),f||a("/model")};return e(No,{initialTimestamp:new Date(i.end),children:e(J,{isOpen:l,onOpenChange:m,children:e(ne,{isDismissable:!0,children:e(Z,{variant:"slideover",size:"L",children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:r.dimension.name}),e(ue,{children:e(me,{})})]}),e("main",{css:K`
5351
5351
  padding: var(--ac-global-dimension-static-size-100);
5352
5352
  display: flex;
5353
5353
  flex-direction: column;
@@ -5368,7 +5368,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
5368
5368
  id
5369
5369
  }
5370
5370
  }
5371
- `}}}();hg.hash="00f0d45ac038a51b4b30d9c5251f701e";async function xI(n){const{dimensionId:a}=n.params;return P.fetchQuery(ve,hg,{id:a}).toPromise()}const DI=()=>{const n=$l(a=>a.defaultTab);return e(Os,{to:n,replace:!0})},kg=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={kind:"Variable",name:"timeRange",variableName:"timeRange"},t=[l],i=[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectPageQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"ProjectPageHeader_stats"},{args:null,kind:"FragmentSpread",name:"StreamToggle_data"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectPageQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:t,kind:"ScalarField",name:"traceCount",storageKey:null},{alias:null,args:t,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:i,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"prompt",plural:!1,selections:i,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"completion",plural:!1,selections:i,storageKey:null}],storageKey:null},{alias:"latencyMsP50",args:[{kind:"Literal",name:"probability",value:.5},l],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:"latencyMsP99",args:[{kind:"Literal",name:"probability",value:.99},l],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"documentEvaluationNames",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"streamingLastUpdatedAt",storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"bf0392b6f20783d10af768eb720d4918",id:null,metadata:{},name:"ProjectPageQuery",operationKind:"query",text:`query ProjectPageQuery(
5371
+ `}}}();hg.hash="00f0d45ac038a51b4b30d9c5251f701e";async function xI(n){const{dimensionId:a}=n.params;return T.fetchQuery(ve,hg,{id:a}).toPromise()}const DI=()=>{const n=$l(a=>a.defaultTab);return e(Os,{to:n,replace:!0})},kg=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={kind:"Variable",name:"timeRange",variableName:"timeRange"},t=[l],i=[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectPageQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"ProjectPageHeader_stats"},{args:null,kind:"FragmentSpread",name:"StreamToggle_data"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectPageQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:t,kind:"ScalarField",name:"traceCount",storageKey:null},{alias:null,args:t,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:i,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"prompt",plural:!1,selections:i,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"completion",plural:!1,selections:i,storageKey:null}],storageKey:null},{alias:"latencyMsP50",args:[{kind:"Literal",name:"probability",value:.5},l],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:"latencyMsP99",args:[{kind:"Literal",name:"probability",value:.99},l],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"documentEvaluationNames",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"streamingLastUpdatedAt",storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"bf0392b6f20783d10af768eb720d4918",id:null,metadata:{},name:"ProjectPageQuery",operationKind:"query",text:`query ProjectPageQuery(
5372
5372
  $id: ID!
5373
5373
  $timeRange: TimeRange!
5374
5374
  ) {
@@ -5476,7 +5476,7 @@ fragment DocumentEvaluationSummaryValueFragment_1dJL9N on Project {
5476
5476
  }
5477
5477
  id
5478
5478
  }
5479
- `}}}();Cg.hash="6ec982057cc21ad195aa215a2118c5bc";function KK({evaluationName:n}){var i,r;const{projectId:a}=We(),{timeRange:l}=zt(),t=P.useLazyLoadQuery(Cg,{id:a,evaluationName:n,timeRange:{start:(i=l==null?void 0:l.start)==null?void 0:i.toISOString(),end:(r=l==null?void 0:l.end)==null?void 0:r.toISOString()}});return s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:n}),e(p.Suspense,{fallback:e(F,{size:"L",children:"--"}),children:e(TK,{evaluationName:n,project:t==null?void 0:t.project})})]})}function TK(n){var c,u,y;const{project:a}=n,{fetchKey:l}=Xa(),[t,i]=P.useRefetchableFragment(Fg,a);p.useEffect(()=>{p.startTransition(()=>{i({},{fetchPolicy:"store-and-network"})})},[l,i]);const r=(c=t==null?void 0:t.documentEvaluationSummary)==null?void 0:c.averageNdcg,o=(u=t==null?void 0:t.documentEvaluationSummary)==null?void 0:u.averagePrecision,d=(y=t==null?void 0:t.documentEvaluationSummary)==null?void 0:y.hitRate;return e(b,{direction:"row",alignItems:"center",gap:"size-50",height:"28px",children:s(Y,{children:[e(Ln,{metric:"ndcg",score:r},"ndcg"),e(Ln,{metric:"precision",score:o},"precision"),e(Ln,{metric:"hit rate",score:d},"hit")]})})}function PK(n){var u,y,g,m,f,h,k,S,C;const{extra:a}=n,{fetchKey:l}=Xa(),[t,i]=P.useRefetchableFragment(Sg,n.project);p.useEffect(()=>{p.startTransition(()=>{i({},{fetchPolicy:"store-and-network"})})},[l,i]);const r=t==null?void 0:t.latencyMsP50,o=t==null?void 0:t.latencyMsP99,d=(u=t==null?void 0:t.spanAnnotationNames)==null?void 0:u.filter(T=>T!=="note"),c=t==null?void 0:t.documentEvaluationNames;return e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-200",paddingBottom:"size-50",flex:"none",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e("div",{css:K`
5479
+ `}}}();Cg.hash="6ec982057cc21ad195aa215a2118c5bc";function KK({evaluationName:n}){var i,r;const{projectId:a}=We(),{timeRange:l}=zt(),t=T.useLazyLoadQuery(Cg,{id:a,evaluationName:n,timeRange:{start:(i=l==null?void 0:l.start)==null?void 0:i.toISOString(),end:(r=l==null?void 0:l.end)==null?void 0:r.toISOString()}});return s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:n}),e(p.Suspense,{fallback:e(F,{size:"L",children:"--"}),children:e(TK,{evaluationName:n,project:t==null?void 0:t.project})})]})}function TK(n){var c,u,y;const{project:a}=n,{fetchKey:l}=Xa(),[t,i]=T.useRefetchableFragment(Fg,a);p.useEffect(()=>{p.startTransition(()=>{i({},{fetchPolicy:"store-and-network"})})},[l,i]);const r=(c=t==null?void 0:t.documentEvaluationSummary)==null?void 0:c.averageNdcg,o=(u=t==null?void 0:t.documentEvaluationSummary)==null?void 0:u.averagePrecision,d=(y=t==null?void 0:t.documentEvaluationSummary)==null?void 0:y.hitRate;return e(b,{direction:"row",alignItems:"center",gap:"size-50",height:"28px",children:s(Y,{children:[e(Ln,{metric:"ndcg",score:r},"ndcg"),e(Ln,{metric:"precision",score:o},"precision"),e(Ln,{metric:"hit rate",score:d},"hit")]})})}function PK(n){var u,y,g,m,f,h,k,S,C;const{extra:a}=n,{fetchKey:l}=Xa(),[t,i]=T.useRefetchableFragment(Sg,n.project);p.useEffect(()=>{p.startTransition(()=>{i({},{fetchPolicy:"store-and-network"})})},[l,i]);const r=t==null?void 0:t.latencyMsP50,o=t==null?void 0:t.latencyMsP99,d=(u=t==null?void 0:t.spanAnnotationNames)==null?void 0:u.filter(P=>P!=="note"),c=t==null?void 0:t.documentEvaluationNames;return e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-200",paddingBottom:"size-50",flex:"none",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e("div",{css:K`
5480
5480
  overflow-x: auto;
5481
5481
  overflow-y: hidden;
5482
5482
  flex: 1 1 auto;
@@ -5512,7 +5512,7 @@ fragment DocumentEvaluationSummaryValueFragment_1dJL9N on Project {
5512
5512
  left center,
5513
5513
  right center;
5514
5514
  background-attachment: local, local, scroll, scroll;
5515
- `,children:s(b,{direction:"row",gap:"size-400",alignItems:"center",children:[s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Total Traces"}),e(F,{size:"L",children:Bl(t==null?void 0:t.traceCount)})]}),s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Total Cost"}),s(De,{delay:0,children:[e(Li,{children:e(F,{size:"L",children:In(((g=(y=t==null?void 0:t.costSummary)==null?void 0:y.total)==null?void 0:g.cost)??0)})}),s(Da,{placement:"bottom",children:[e(dn,{}),e(v,{width:"size-3600",children:e(Co,{valueLabel:"cost",totalValue:((f=(m=t==null?void 0:t.costSummary)==null?void 0:m.total)==null?void 0:f.cost)??0,formatter:In,segments:[{name:"Prompt",value:((k=(h=t==null?void 0:t.costSummary)==null?void 0:h.prompt)==null?void 0:k.cost)??0,color:"rgba(254, 119, 99, 1)"},{name:"Completion",value:((C=(S=t==null?void 0:t.costSummary)==null?void 0:S.completion)==null?void 0:C.cost)??0,color:"rgba(98, 104, 239, 1)"}]})})]})]})]}),s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Latency P50"}),r!=null?e(Ye,{latencyMs:r,size:"L"}):e(F,{size:"L",children:"--"})]}),s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Latency P99"}),o!=null?e(Ye,{latencyMs:o,size:"L"}):e(F,{size:"L",children:"--"})]}),d.map(T=>e($t,{fallback:Zh,children:e(AS,{annotationName:T},T)},T)),c.map(T=>e(KK,{evaluationName:T},`document-${T}`))]})}),e(v,{flex:"none",paddingStart:"size-100",children:a})]})})}const Kg=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"StreamToggleRefetchQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"StreamToggle_data"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"StreamToggleRefetchQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"streamingLastUpdatedAt",storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"70bebe4abe808b13c94decf17c7cd90d",id:null,metadata:{},name:"StreamToggleRefetchQuery",operationKind:"query",text:`query StreamToggleRefetchQuery(
5515
+ `,children:s(b,{direction:"row",gap:"size-400",alignItems:"center",children:[s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Total Traces"}),e(F,{size:"L",children:Bl(t==null?void 0:t.traceCount)})]}),s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Total Cost"}),s(De,{delay:0,children:[e(Li,{children:e(F,{size:"L",children:In(((g=(y=t==null?void 0:t.costSummary)==null?void 0:y.total)==null?void 0:g.cost)??0)})}),s(Da,{placement:"bottom",children:[e(dn,{}),e(v,{width:"size-3600",children:e(Co,{valueLabel:"cost",totalValue:((f=(m=t==null?void 0:t.costSummary)==null?void 0:m.total)==null?void 0:f.cost)??0,formatter:In,segments:[{name:"Prompt",value:((k=(h=t==null?void 0:t.costSummary)==null?void 0:h.prompt)==null?void 0:k.cost)??0,color:"rgba(254, 119, 99, 1)"},{name:"Completion",value:((C=(S=t==null?void 0:t.costSummary)==null?void 0:S.completion)==null?void 0:C.cost)??0,color:"rgba(98, 104, 239, 1)"}]})})]})]})]}),s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Latency P50"}),r!=null?e(Ye,{latencyMs:r,size:"L"}):e(F,{size:"L",children:"--"})]}),s(b,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Latency P99"}),o!=null?e(Ye,{latencyMs:o,size:"L"}):e(F,{size:"L",children:"--"})]}),d.map(P=>e($t,{fallback:Zh,children:e(AS,{annotationName:P},P)},P)),c.map(P=>e(KK,{evaluationName:P},`document-${P}`))]})}),e(v,{flex:"none",paddingStart:"size-100",children:a})]})})}const Kg=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"StreamToggleRefetchQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"StreamToggle_data"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"StreamToggleRefetchQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"streamingLastUpdatedAt",storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"70bebe4abe808b13c94decf17c7cd90d",id:null,metadata:{},name:"StreamToggleRefetchQuery",operationKind:"query",text:`query StreamToggleRefetchQuery(
5516
5516
  $id: ID!
5517
5517
  ) {
5518
5518
  node(id: $id) {
@@ -5526,7 +5526,7 @@ fragment StreamToggle_data on Project {
5526
5526
  streamingLastUpdatedAt
5527
5527
  id
5528
5528
  }
5529
- `}}}();Kg.hash="30a8f0bcf1aa6021b2c9a47866f5dc49";const Tg={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:Kg,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"StreamToggle_data",selections:[{alias:null,args:null,kind:"ScalarField",name:"streamingLastUpdatedAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],type:"Project",abstractKey:null};Tg.hash="30a8f0bcf1aa6021b2c9a47866f5dc49";const IK=2e3,xK=["spans","traces","sessions"];function DK(n){const{isStreaming:a,setIsStreaming:l,setFetchKey:t}=Xa(),r=gl().pathname.split("/").pop()||"",o=xK.includes(r)&&a,[d,c]=P.useRefetchableFragment(Tg,n.project),u=p.useRef(d.streamingLastUpdatedAt),y=p.useCallback(()=>{o&&p.startTransition(()=>{c({},{fetchPolicy:"store-and-network"})})},[o,c]),g=d.streamingLastUpdatedAt;return p.useEffect(()=>{g!=null&&(u.current==null||u.current<g)&&(u.current=g,t(`fetch-traces-${g}`))},[t,g]),TS(y,IK),e(Ea,{labelPlacement:"start",isSelected:a,onChange:()=>{l(!a)},children:"Stream"})}const LK=K`
5529
+ `}}}();Kg.hash="30a8f0bcf1aa6021b2c9a47866f5dc49";const Tg={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:Kg,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"StreamToggle_data",selections:[{alias:null,args:null,kind:"ScalarField",name:"streamingLastUpdatedAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],type:"Project",abstractKey:null};Tg.hash="30a8f0bcf1aa6021b2c9a47866f5dc49";const IK=2e3,xK=["spans","traces","sessions"];function DK(n){const{isStreaming:a,setIsStreaming:l,setFetchKey:t}=Xa(),r=gl().pathname.split("/").pop()||"",o=xK.includes(r)&&a,[d,c]=T.useRefetchableFragment(Tg,n.project),u=p.useRef(d.streamingLastUpdatedAt),y=p.useCallback(()=>{o&&p.startTransition(()=>{c({},{fetchPolicy:"store-and-network"})})},[o,c]),g=d.streamingLastUpdatedAt;return p.useEffect(()=>{g!=null&&(u.current==null||u.current<g)&&(u.current=g,t(`fetch-traces-${g}`))},[t,g]),TS(y,IK),e(Ea,{labelPlacement:"start",isSelected:a,onChange:()=>{l(!a)},children:"Stream"})}const LK=K`
5530
5530
  flex: 1 1 auto;
5531
5531
  display: flex;
5532
5532
  flex-direction: column;
@@ -5552,7 +5552,7 @@ fragment StreamToggle_data on Project {
5552
5552
  }
5553
5553
  }
5554
5554
  }
5555
- `;function LI(){const{projectId:n}=We(),{timeRange:a}=zt();return e(p.Suspense,{fallback:e(pe,{}),children:e(AK,{projectId:n,timeRange:a})})}const _K=["spans","traces","sessions","config","metrics"],Is=n=>_K.includes(n),xs={spans:0,traces:1,sessions:2,config:3,metrics:4};function AK({projectId:n,timeRange:a}){const l=$l($=>$.treatOrphansAsRoots),t=p.useMemo(()=>{var $,I;return{start:($=a==null?void 0:a.start)==null?void 0:$.toISOString(),end:(I=a==null?void 0:a.end)==null?void 0:I.toISOString()}},[a]),i=be(),{rootPath:r,tab:o}=Xt(),d=P.useLazyLoadQuery(kg,{id:n,timeRange:t},{fetchPolicy:"store-and-network",fetchKey:`${n}-${t.start}-${t.end}`}),[c,u,y]=P.useQueryLoader(_c),[g,m,f]=P.useQueryLoader(Ac),[h,k,S]=P.useQueryLoader(wc),[C,T,_]=P.useQueryLoader(Rc),x=Is(o)?xs[o]:0,N=bd("projectMetricsTab");p.useEffect(()=>(x===0?m({id:n,timeRange:t,orphanSpanAsRootSpan:l}):x===1?u({id:n,timeRange:t}):x===2?k({id:n,timeRange:t}):x===3&&T({id:n}),()=>{f(),S(),y(),_()}),[u,n,t,x,f,S,y,m,k,T,_,l]);const w=p.useCallback($=>{p.startTransition(()=>{i($===1?`${r}/traces`:$===2?`${r}/sessions`:$===3?`${r}/config`:$===4?`${r}/metrics`:`${r}/spans`)})},[i,r]);return e(_S,{children:s("main",{css:LK,children:[e(PK,{project:d.project,extra:s(b,{direction:"row",alignItems:"center",gap:"size-100",children:[e(DK,{project:d.project}),e(It,{})]})}),e(Ec.Provider,{value:{spansQueryReference:g??null,sessionsQueryReference:h??null,tracesQueryReference:c??null,projectConfigQueryReference:C??null},children:s(hn,{onSelectionChange:$=>{typeof $=="string"&&Is($)&&w(xs[$])},selectedKey:o,children:[s(fn,{children:[e(ge,{id:"spans",children:"Spans"}),e(ge,{id:"traces",children:"Traces"}),e(ge,{id:"sessions",children:"Sessions"}),e(ge,{id:"config",children:"Config"}),N?e(ge,{id:"metrics",children:"Metrics"}):null]}),e(he,{padded:!1,id:"spans",children:e(Te,{})}),e(he,{padded:!1,id:"traces",children:e(Te,{})}),e(he,{padded:!1,id:"sessions",children:e(Te,{})}),e(he,{padded:!1,id:"config",children:e(Te,{})}),e(he,{padded:!1,id:"metrics",children:e(Te,{})})]})})]})})}const Pg=p.createContext(null);function Ig(){const n=p.useContext(Pg);if(n===null)throw new Error("useSessionSubstring must be used within a SessionSubstringProvider");return n}function wK(n){const[a,l]=p.useState(""),t=p.useCallback(i=>{p.startTransition(()=>{l(i)})},[]);return e(Pg.Provider,{value:{filterIoSubstringOrSessionId:a,setFilterIoSubstringOrSessionId:t},children:n.children})}const xg=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterIoSubstring"},l={defaultValue:30,kind:"LocalArgument",name:"first"},t={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:null,kind:"LocalArgument",name:"sessionId"},r={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},o={defaultValue:null,kind:"LocalArgument",name:"timeRange"},d=[{kind:"Variable",name:"id",variableName:"id"}],c={kind:"Variable",name:"after",variableName:"after"},u={kind:"Variable",name:"filterIoSubstring",variableName:"filterIoSubstring"},y={kind:"Variable",name:"first",variableName:"first"},g={kind:"Variable",name:"sessionId",variableName:"sessionId"},m={kind:"Variable",name:"sort",variableName:"sort"},f={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},k=[c,u,y,g,m,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],S=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}];return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o],kind:"Fragment",metadata:null,name:"SessionsTableQuery",selections:[{alias:null,args:d,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[c,u,y,g,m],kind:"FragmentSpread",name:"SessionsTable_sessions"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,l,i,r,o,t],kind:"Operation",name:"SessionsTableQuery",selections:[{alias:null,args:d,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[f,h,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:k,concreteType:"ProjectSessionConnection",kind:"LinkedField",name:"sessions",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectSessionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"session",args:null,concreteType:"ProjectSession",kind:"LinkedField",name:"node",plural:!1,selections:[h,{alias:null,args:null,kind:"ScalarField",name:"sessionId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"numTraces",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"firstInput",plural:!1,selections:S,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"lastOutput",plural:!1,selections:S,storageKey:null},{alias:null,args:null,concreteType:"TokenUsage",kind:"LinkedField",name:"tokenUsage",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"total",storageKey:null}],storageKey:null},{alias:"traceLatencyMsP50",args:[{kind:"Literal",name:"probability",value:.5}],kind:"ScalarField",name:"traceLatencyMsQuantile",storageKey:"traceLatencyMsQuantile(probability:0.5)"},{alias:"traceLatencyMsP99",args:[{kind:"Literal",name:"probability",value:.99}],kind:"ScalarField",name:"traceLatencyMsQuantile",storageKey:"traceLatencyMsQuantile(probability:0.99)"},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"ProjectSession",kind:"LinkedField",name:"node",plural:!1,selections:[f,h],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:k,filters:["sort","filterIoSubstring","timeRange","sessionId"],handle:"connection",key:"SessionsTable_sessions",kind:"LinkedHandle",name:"sessions"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"2fe7b0cf89da6d717037618e7b910e49",id:null,metadata:{},name:"SessionsTableQuery",operationKind:"query",text:`query SessionsTableQuery(
5555
+ `;function LI(){const{projectId:n}=We(),{timeRange:a}=zt();return e(p.Suspense,{fallback:e(pe,{}),children:e(AK,{projectId:n,timeRange:a})})}const _K=["spans","traces","sessions","config","metrics"],Is=n=>_K.includes(n),xs={spans:0,traces:1,sessions:2,config:3,metrics:4};function AK({projectId:n,timeRange:a}){const l=$l($=>$.treatOrphansAsRoots),t=p.useMemo(()=>{var $,I;return{start:($=a==null?void 0:a.start)==null?void 0:$.toISOString(),end:(I=a==null?void 0:a.end)==null?void 0:I.toISOString()}},[a]),i=be(),{rootPath:r,tab:o}=Xt(),d=T.useLazyLoadQuery(kg,{id:n,timeRange:t},{fetchPolicy:"store-and-network",fetchKey:`${n}-${t.start}-${t.end}`}),[c,u,y]=T.useQueryLoader(_c),[g,m,f]=T.useQueryLoader(Ac),[h,k,S]=T.useQueryLoader(wc),[C,P,L]=T.useQueryLoader(Rc),x=Is(o)?xs[o]:0,N=bd("projectMetricsTab");p.useEffect(()=>(x===0?m({id:n,timeRange:t,orphanSpanAsRootSpan:l}):x===1?u({id:n,timeRange:t}):x===2?k({id:n,timeRange:t}):x===3&&P({id:n}),()=>{f(),S(),y(),L()}),[u,n,t,x,f,S,y,m,k,P,L,l]);const w=p.useCallback($=>{p.startTransition(()=>{i($===1?`${r}/traces`:$===2?`${r}/sessions`:$===3?`${r}/config`:$===4?`${r}/metrics`:`${r}/spans`)})},[i,r]);return e(_S,{children:s("main",{css:LK,children:[e(PK,{project:d.project,extra:s(b,{direction:"row",alignItems:"center",gap:"size-100",children:[e(DK,{project:d.project}),e(It,{})]})}),e(Ec.Provider,{value:{spansQueryReference:g??null,sessionsQueryReference:h??null,tracesQueryReference:c??null,projectConfigQueryReference:C??null},children:s(hn,{onSelectionChange:$=>{typeof $=="string"&&Is($)&&w(xs[$])},selectedKey:o,children:[s(fn,{children:[e(ge,{id:"spans",children:"Spans"}),e(ge,{id:"traces",children:"Traces"}),e(ge,{id:"sessions",children:"Sessions"}),e(ge,{id:"config",children:"Config"}),N?e(ge,{id:"metrics",children:"Metrics"}):null]}),e(he,{padded:!1,id:"spans",children:e(Te,{})}),e(he,{padded:!1,id:"traces",children:e(Te,{})}),e(he,{padded:!1,id:"sessions",children:e(Te,{})}),e(he,{padded:!1,id:"config",children:e(Te,{})}),e(he,{padded:!1,id:"metrics",children:e(Te,{})})]})})]})})}const Pg=p.createContext(null);function Ig(){const n=p.useContext(Pg);if(n===null)throw new Error("useSessionSubstring must be used within a SessionSubstringProvider");return n}function wK(n){const[a,l]=p.useState(""),t=p.useCallback(i=>{p.startTransition(()=>{l(i)})},[]);return e(Pg.Provider,{value:{filterIoSubstringOrSessionId:a,setFilterIoSubstringOrSessionId:t},children:n.children})}const xg=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterIoSubstring"},l={defaultValue:30,kind:"LocalArgument",name:"first"},t={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:null,kind:"LocalArgument",name:"sessionId"},r={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},o={defaultValue:null,kind:"LocalArgument",name:"timeRange"},d=[{kind:"Variable",name:"id",variableName:"id"}],c={kind:"Variable",name:"after",variableName:"after"},u={kind:"Variable",name:"filterIoSubstring",variableName:"filterIoSubstring"},y={kind:"Variable",name:"first",variableName:"first"},g={kind:"Variable",name:"sessionId",variableName:"sessionId"},m={kind:"Variable",name:"sort",variableName:"sort"},f={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},k=[c,u,y,g,m,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],S=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}];return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o],kind:"Fragment",metadata:null,name:"SessionsTableQuery",selections:[{alias:null,args:d,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[c,u,y,g,m],kind:"FragmentSpread",name:"SessionsTable_sessions"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,l,i,r,o,t],kind:"Operation",name:"SessionsTableQuery",selections:[{alias:null,args:d,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[f,h,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:k,concreteType:"ProjectSessionConnection",kind:"LinkedField",name:"sessions",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectSessionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"session",args:null,concreteType:"ProjectSession",kind:"LinkedField",name:"node",plural:!1,selections:[h,{alias:null,args:null,kind:"ScalarField",name:"sessionId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"numTraces",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"firstInput",plural:!1,selections:S,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"lastOutput",plural:!1,selections:S,storageKey:null},{alias:null,args:null,concreteType:"TokenUsage",kind:"LinkedField",name:"tokenUsage",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"total",storageKey:null}],storageKey:null},{alias:"traceLatencyMsP50",args:[{kind:"Literal",name:"probability",value:.5}],kind:"ScalarField",name:"traceLatencyMsQuantile",storageKey:"traceLatencyMsQuantile(probability:0.5)"},{alias:"traceLatencyMsP99",args:[{kind:"Literal",name:"probability",value:.99}],kind:"ScalarField",name:"traceLatencyMsQuantile",storageKey:"traceLatencyMsQuantile(probability:0.99)"},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"ProjectSession",kind:"LinkedField",name:"node",plural:!1,selections:[f,h],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:k,filters:["sort","filterIoSubstring","timeRange","sessionId"],handle:"connection",key:"SessionsTable_sessions",kind:"LinkedHandle",name:"sessions"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"2fe7b0cf89da6d717037618e7b910e49",id:null,metadata:{},name:"SessionsTableQuery",operationKind:"query",text:`query SessionsTableQuery(
5556
5556
  $after: String = null
5557
5557
  $filterIoSubstring: String = null
5558
5558
  $first: Int = 30
@@ -5766,10 +5766,10 @@ await assistant({
5766
5766
  .ac-dropdown-button {
5767
5767
  min-width: var(--ac-global-dimension-static-size-300);
5768
5768
  }
5769
- `,Ds=dr,_g=({table:n})=>{const a=be();return e("tbody",{children:n.getRowModel().rows.map(l=>e("tr",{onClick:()=>a(`${encodeURIComponent(l.id)}`),children:l.getVisibleCells().map(t=>e("td",{style:{width:`calc(var(--col-${t.column.id}-size) * 1px)`,maxWidth:`calc(var(--col-${t.column.id}-size) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ee(t.column.columnDef.cell,t.getContext())},t.id))},l.id))})},UK=Kn.memo(_g,(n,a)=>n.table.options.data===a.table.options.data);function HK(n){const a=p.useRef(null),[l,t]=p.useState([]),{filterIoSubstringOrSessionId:i}=Ig(),{fetchKey:r}=Xa(),{data:o,loadNext:d,hasNext:c,isLoadingNext:u,refetch:y}=P.usePaginationFragment(Dg,n.project),g=p.useMemo(()=>o.sessions.edges.map(({session:A})=>{var V,O;return{...A,tokenCountTotal:A.tokenUsage.total,costTotal:((O=(V=A.costSummary)==null?void 0:V.total)==null?void 0:O.cost)??null}}),[o.sessions]),m=[{header:"session id",accessorKey:"sessionId",enableSorting:!1,cell:Be},{header:"first input",accessorKey:"firstInput.value",enableSorting:!1,cell:Be},{header:"last output",accessorKey:"lastOutput.value",enableSorting:!1,cell:Be},{header:"start time",accessorKey:"startTime",enableSorting:!0,cell:we},{header:"end time",accessorKey:"endTime",enableSorting:!0,cell:we},{header:"p50 latency",accessorKey:"traceLatencyMsP50",enableSorting:!1,cell:({getValue:A})=>{const V=A();return V===null||typeof V!="number"?null:e(Ye,{latencyMs:V})}},{header:"p99 latency",accessorKey:"traceLatencyMsP99",enableSorting:!1,cell:({getValue:A})=>{const V=A();return V===null||typeof V!="number"?null:e(Ye,{latencyMs:V})}},{header:"total tokens",accessorKey:"tokenCountTotal",enableSorting:!0,minSize:80,cell:({getValue:A,row:V})=>{const O=A();if(O==null||typeof O!="number")return"--";const H=V.original;return e(Ao,{tokenCountTotal:O,nodeId:H.id,size:"S"})}},{header:"total cost",accessorKey:"costSummary.total.cost",id:"costTotal",enableSorting:!0,minSize:80,cell:({row:A,getValue:V})=>{const O=V();if(O===null||typeof O!="number")return"--";const H=A.original;return e(Yh,{totalCost:O,nodeId:H.id})}},{header:"total traces",accessorKey:"numTraces",enableSorting:!0,cell:jo}];p.useEffect(()=>{const A=l[0];p.startTransition(()=>{y({sort:A?{col:A.id,dir:A.desc?"desc":"asc"}:{col:"startTime",dir:"desc"},after:null,first:Ds,filterIoSubstring:i,sessionId:i},{fetchPolicy:"store-and-network"})})},[l,y,i,r]);const f=Kn.useCallback(A=>{if(A){const{scrollHeight:V,scrollTop:O,clientHeight:H}=A;V-O-H<300&&!u&&c&&d(Ds)}},[c,u,d]),[h,k]=p.useState({}),S=cn(A=>A.columnVisibility),C=cn(A=>A.columnSizing),T=cn(A=>A.setColumnSizing),_=Le({columns:m,data:g,onExpandedChange:k,manualSorting:!0,state:{sorting:l,expanded:h,columnVisibility:S,columnSizing:C},columnResizeMode:"onChange",onColumnSizingChange:T,enableSubRowSelection:!1,onSortingChange:t,getCoreRowModel:_e(),getSortedRowModel:sn(),getExpandedRowModel:Qs(),getRowId:A=>A.id}),N=_.getRowModel().rows.length===0,{columnSizingInfo:w,columnSizing:$}=_.getState(),I=_.getFlatHeaders,M=m.length,z=Kn.useMemo(()=>{const A=I(),V={};for(let O=0;O<A.length;O++){const H=A[O];V[`--header-${H.id}-size`]=H.getSize(),V[`--col-${H.column.id}-size`]=H.column.getSize()}return V},[I,w,$,M]);return s("div",{css:Tr,children:[e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:e(VK,{})}),e("div",{css:K`
5769
+ `,Ds=dr,_g=({table:n})=>{const a=be();return e("tbody",{children:n.getRowModel().rows.map(l=>e("tr",{onClick:()=>a(`${encodeURIComponent(l.id)}`),children:l.getVisibleCells().map(t=>e("td",{style:{width:`calc(var(--col-${t.column.id}-size) * 1px)`,maxWidth:`calc(var(--col-${t.column.id}-size) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ee(t.column.columnDef.cell,t.getContext())},t.id))},l.id))})},UK=Kn.memo(_g,(n,a)=>n.table.options.data===a.table.options.data);function HK(n){const a=p.useRef(null),[l,t]=p.useState([]),{filterIoSubstringOrSessionId:i}=Ig(),{fetchKey:r}=Xa(),{data:o,loadNext:d,hasNext:c,isLoadingNext:u,refetch:y}=T.usePaginationFragment(Dg,n.project),g=p.useMemo(()=>o.sessions.edges.map(({session:A})=>{var V,O;return{...A,tokenCountTotal:A.tokenUsage.total,costTotal:((O=(V=A.costSummary)==null?void 0:V.total)==null?void 0:O.cost)??null}}),[o.sessions]),m=[{header:"session id",accessorKey:"sessionId",enableSorting:!1,cell:Be},{header:"first input",accessorKey:"firstInput.value",enableSorting:!1,cell:Be},{header:"last output",accessorKey:"lastOutput.value",enableSorting:!1,cell:Be},{header:"start time",accessorKey:"startTime",enableSorting:!0,cell:we},{header:"end time",accessorKey:"endTime",enableSorting:!0,cell:we},{header:"p50 latency",accessorKey:"traceLatencyMsP50",enableSorting:!1,cell:({getValue:A})=>{const V=A();return V===null||typeof V!="number"?null:e(Ye,{latencyMs:V})}},{header:"p99 latency",accessorKey:"traceLatencyMsP99",enableSorting:!1,cell:({getValue:A})=>{const V=A();return V===null||typeof V!="number"?null:e(Ye,{latencyMs:V})}},{header:"total tokens",accessorKey:"tokenCountTotal",enableSorting:!0,minSize:80,cell:({getValue:A,row:V})=>{const O=A();if(O==null||typeof O!="number")return"--";const H=V.original;return e(Ao,{tokenCountTotal:O,nodeId:H.id,size:"S"})}},{header:"total cost",accessorKey:"costSummary.total.cost",id:"costTotal",enableSorting:!0,minSize:80,cell:({row:A,getValue:V})=>{const O=V();if(O===null||typeof O!="number")return"--";const H=A.original;return e(Yh,{totalCost:O,nodeId:H.id})}},{header:"total traces",accessorKey:"numTraces",enableSorting:!0,cell:jo}];p.useEffect(()=>{const A=l[0];p.startTransition(()=>{y({sort:A?{col:A.id,dir:A.desc?"desc":"asc"}:{col:"startTime",dir:"desc"},after:null,first:Ds,filterIoSubstring:i,sessionId:i},{fetchPolicy:"store-and-network"})})},[l,y,i,r]);const f=Kn.useCallback(A=>{if(A){const{scrollHeight:V,scrollTop:O,clientHeight:H}=A;V-O-H<300&&!u&&c&&d(Ds)}},[c,u,d]),[h,k]=p.useState({}),S=cn(A=>A.columnVisibility),C=cn(A=>A.columnSizing),P=cn(A=>A.setColumnSizing),L=Le({columns:m,data:g,onExpandedChange:k,manualSorting:!0,state:{sorting:l,expanded:h,columnVisibility:S,columnSizing:C},columnResizeMode:"onChange",onColumnSizingChange:P,enableSubRowSelection:!1,onSortingChange:t,getCoreRowModel:_e(),getSortedRowModel:sn(),getExpandedRowModel:Qs(),getRowId:A=>A.id}),N=L.getRowModel().rows.length===0,{columnSizingInfo:w,columnSizing:$}=L.getState(),I=L.getFlatHeaders,M=m.length,z=Kn.useMemo(()=>{const A=I(),V={};for(let O=0;O<A.length;O++){const H=A[O];V[`--header-${H.id}-size`]=H.getSize(),V[`--col-${H.column.id}-size`]=H.column.getSize()}return V},[I,w,$,M]);return s("div",{css:Tr,children:[e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:e(VK,{})}),e("div",{css:K`
5770
5770
  flex: 1 1 auto;
5771
5771
  overflow: auto;
5772
- `,onScroll:A=>f(A.target),ref:a,children:s("table",{css:la,style:{...z,width:_.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:_.getHeaderGroups().map(A=>e("tr",{children:A.headers.map(V=>e("th",{style:{width:`calc(var(--header-${V.id}-size) * 1px)`},children:V.isPlaceholder?null:s(Y,{children:[s("div",{"data-sortable":V.column.getCanSort(),className:V.column.getCanSort()?"sort":"",onClick:V.column.getToggleSortingHandler(),style:{left:V.getStart(),width:V.getSize()},children:[ee(V.column.columnDef.header,V.getContext()),V.column.getIsSorted()?e(D,{className:"sort-icon",svg:V.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]}),e("div",{onMouseDown:V.getResizeHandler(),onTouchStart:V.getResizeHandler(),className:`resizer ${V.column.getIsResizing()?"isResizing":""}`})]})},V.id))},A.id))}),N?e(qK,{}):w.isResizingColumn?e(UK,{table:_}):e(_g,{table:_})]})})]})}function Pr({children:n}){const{projectId:a}=We();if(!a)throw new Error("projectId is required");const{tab:l}=Xt();if(!vc(l))throw new Error(`Invalid tab: ${l}`);return e(RK,{projectId:a,tableId:l||"table",children:n})}function GK({queryReference:n}){const a=P.usePreloadedQuery(wc,n);return e(wK,{children:e(HK,{project:a.project})})}const _I=()=>{const{sessionsQueryReference:n}=Ht();return n?s(Pr,{children:[e(Sr,{children:e(p.Suspense,{fallback:e(pe,{}),children:e(GK,{queryReference:n})})}),e(p.Suspense,{children:e(Te,{})})]}):null},Ag=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterCondition"},l={defaultValue:30,kind:"LocalArgument",name:"first"},t={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:null,kind:"LocalArgument",name:"orphanSpanAsRootSpan"},r={defaultValue:!0,kind:"LocalArgument",name:"rootSpansOnly"},o={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},d={defaultValue:null,kind:"LocalArgument",name:"timeRange"},c=[{kind:"Variable",name:"id",variableName:"id"}],u={kind:"Variable",name:"after",variableName:"after"},y={kind:"Variable",name:"filterCondition",variableName:"filterCondition"},g={kind:"Variable",name:"first",variableName:"first"},m={kind:"Variable",name:"rootSpansOnly",variableName:"rootSpansOnly"},f={kind:"Variable",name:"sort",variableName:"sort"},h={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},C=[u,y,g,{kind:"Variable",name:"orphanSpanAsRootSpan",variableName:"orphanSpanAsRootSpan"},m,f,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],T={alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null},_=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],x={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},N={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o,d],kind:"Fragment",metadata:null,name:"SpansTableSpansQuery",selections:[{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[u,y,g,m,f],kind:"FragmentSpread",name:"SpansTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,l,i,r,o,d,t],kind:"Operation",name:"SpansTableSpansQuery",selections:[{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[h,k,{kind:"InlineFragment",selections:[S,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:null,args:C,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"span",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[k,{alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},S,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},{condition:"rootSpansOnly",kind:"Condition",passingValue:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},T]},{condition:"rootSpansOnly",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null}]},{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[k,{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{condition:"rootSpansOnly",kind:"Condition",passingValue:!0,selections:[T]}],storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:_,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:_,storageKey:null},{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[k,S,x,N,{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},k],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummaries",plural:!0,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null},x],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null},S],storageKey:null},{alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[k,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[h,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[k,S,{alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[x,N],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[k],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[h,k],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:C,filters:["sort","rootSpansOnly","filterCondition","orphanSpanAsRootSpan","timeRange"],handle:"connection",key:"SpansTable_spans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"50df80de2e7d5548f9f9e9ecf7e1f59f",id:null,metadata:{},name:"SpansTableSpansQuery",operationKind:"query",text:`query SpansTableSpansQuery(
5772
+ `,onScroll:A=>f(A.target),ref:a,children:s("table",{css:la,style:{...z,width:L.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:L.getHeaderGroups().map(A=>e("tr",{children:A.headers.map(V=>e("th",{style:{width:`calc(var(--header-${V.id}-size) * 1px)`},children:V.isPlaceholder?null:s(Y,{children:[s("div",{"data-sortable":V.column.getCanSort(),className:V.column.getCanSort()?"sort":"",onClick:V.column.getToggleSortingHandler(),style:{left:V.getStart(),width:V.getSize()},children:[ee(V.column.columnDef.header,V.getContext()),V.column.getIsSorted()?e(D,{className:"sort-icon",svg:V.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]}),e("div",{onMouseDown:V.getResizeHandler(),onTouchStart:V.getResizeHandler(),className:`resizer ${V.column.getIsResizing()?"isResizing":""}`})]})},V.id))},A.id))}),N?e(qK,{}):w.isResizingColumn?e(UK,{table:L}):e(_g,{table:L})]})})]})}function Pr({children:n}){const{projectId:a}=We();if(!a)throw new Error("projectId is required");const{tab:l}=Xt();if(!vc(l))throw new Error(`Invalid tab: ${l}`);return e(RK,{projectId:a,tableId:l||"table",children:n})}function GK({queryReference:n}){const a=T.usePreloadedQuery(wc,n);return e(wK,{children:e(HK,{project:a.project})})}const _I=()=>{const{sessionsQueryReference:n}=Ht();return n?s(Pr,{children:[e(Sr,{children:e(p.Suspense,{fallback:e(pe,{}),children:e(GK,{queryReference:n})})}),e(p.Suspense,{children:e(Te,{})})]}):null},Ag=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterCondition"},l={defaultValue:30,kind:"LocalArgument",name:"first"},t={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:null,kind:"LocalArgument",name:"orphanSpanAsRootSpan"},r={defaultValue:!0,kind:"LocalArgument",name:"rootSpansOnly"},o={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},d={defaultValue:null,kind:"LocalArgument",name:"timeRange"},c=[{kind:"Variable",name:"id",variableName:"id"}],u={kind:"Variable",name:"after",variableName:"after"},y={kind:"Variable",name:"filterCondition",variableName:"filterCondition"},g={kind:"Variable",name:"first",variableName:"first"},m={kind:"Variable",name:"rootSpansOnly",variableName:"rootSpansOnly"},f={kind:"Variable",name:"sort",variableName:"sort"},h={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},C=[u,y,g,{kind:"Variable",name:"orphanSpanAsRootSpan",variableName:"orphanSpanAsRootSpan"},m,f,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],P={alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null},L=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],x={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},N={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o,d],kind:"Fragment",metadata:null,name:"SpansTableSpansQuery",selections:[{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[u,y,g,m,f],kind:"FragmentSpread",name:"SpansTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,l,i,r,o,d,t],kind:"Operation",name:"SpansTableSpansQuery",selections:[{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[h,k,{kind:"InlineFragment",selections:[S,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:null,args:C,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"span",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[k,{alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},S,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},{condition:"rootSpansOnly",kind:"Condition",passingValue:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},P]},{condition:"rootSpansOnly",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null}]},{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[k,{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{condition:"rootSpansOnly",kind:"Condition",passingValue:!0,selections:[P]}],storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:L,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:L,storageKey:null},{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[k,S,x,N,{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},k],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummaries",plural:!0,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null},x],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null},S],storageKey:null},{alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[k,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[h,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[k,S,{alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[x,N],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[k],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[h,k],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:C,filters:["sort","rootSpansOnly","filterCondition","orphanSpanAsRootSpan","timeRange"],handle:"connection",key:"SpansTable_spans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"50df80de2e7d5548f9f9e9ecf7e1f59f",id:null,metadata:{},name:"SpansTableSpansQuery",operationKind:"query",text:`query SpansTableSpansQuery(
5773
5773
  $after: String = null
5774
5774
  $filterCondition: String = null
5775
5775
  $first: Int = 30
@@ -5972,7 +5972,7 @@ fragment SpansTable_spans_xYL0c on Project {
5972
5972
  `;function l2(n){const{columns:a}=n,l=cn(c=>c.columnVisibility),t=cn(c=>c.setColumnVisibility),i=p.useMemo(()=>a.filter(c=>!a2.includes(c.id)),[a]),r=p.useMemo(()=>i.every(c=>{const u=l[c.id];return u??!0}),[i,l]),o=p.useCallback(c=>{const{name:u,checked:y}=c.target;t({...l,[u]:y})},[l,t]),d=p.useCallback(c=>{const{checked:u}=c.target,y=i.reduce((g,m)=>({...g,[m.id]:u}),{});t(y)},[i,t]);return e("div",{css:K`
5973
5973
  overflow-y: auto;
5974
5974
  max-height: calc(100vh - 200px);
5975
- `,children:s(v,{paddingTop:"size-50",paddingBottom:"size-50",children:[e(v,{borderBottomColor:"dark",borderBottomWidth:"thin",paddingBottom:"size-50",children:e("div",{css:kt,children:s("label",{children:[e("input",{type:"checkbox",name:"toggle-all",checked:r,onChange:d}),"span columns"]})})}),e("ul",{children:i.map(c=>{const u=l[c.id],y=u??!0,g=typeof c.columnDef.header=="string"?c.columnDef.header:c.id;return e("li",{css:kt,children:s("label",{children:[e("input",{type:"checkbox",name:c.id,checked:y,onChange:o}),g]})},c.id)})}),e(t2,{...n})]})})}function t2({query:n}){const a=P.useFragment(Vg,n),l=cn(o=>o.annotationColumnVisibility),t=cn(o=>o.setAnnotationColumnVisibility),i=p.useMemo(()=>a.spanAnnotationNames.every(o=>l[o]||!1),[a.spanAnnotationNames,l]),r=p.useCallback(()=>{const o=a.spanAnnotationNames.reduce((d,c)=>({...d,[c]:!i}),{});t(o)},[a.spanAnnotationNames,t,i]);return s("section",{children:[e(v,{paddingTop:"size-50",paddingBottom:"size-50",borderColor:"dark",borderTopWidth:"thin",borderBottomWidth:"thin",children:e("div",{css:kt,children:s("label",{children:[e("input",{type:"checkbox",name:"toggle-annotations-all",checked:i,onChange:r}),"annotations"]})})}),e("ul",{children:a.spanAnnotationNames.map(o=>{const d=l[o]??!1;return e("li",{css:kt,children:s("label",{children:[e("input",{type:"checkbox",name:o,checked:d,onChange:()=>{t({...l,[o]:!d})}}),o]})},o)})})]})}const Ng=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"condition"},{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"condition",variableName:"condition"}],concreteType:"ValidationResult",kind:"LinkedField",name:"validateSpanFilterCondition",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isValid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"errorMessage",storageKey:null}],storageKey:null}],type:"Project",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanFilterConditionFieldValidationQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanFilterConditionFieldValidationQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}]},params:{cacheID:"38e5e2288d5746b32b21632854cc7c82",id:null,metadata:{},name:"SpanFilterConditionFieldValidationQuery",operationKind:"query",text:`query SpanFilterConditionFieldValidationQuery(
5975
+ `,children:s(v,{paddingTop:"size-50",paddingBottom:"size-50",children:[e(v,{borderBottomColor:"dark",borderBottomWidth:"thin",paddingBottom:"size-50",children:e("div",{css:kt,children:s("label",{children:[e("input",{type:"checkbox",name:"toggle-all",checked:r,onChange:d}),"span columns"]})})}),e("ul",{children:i.map(c=>{const u=l[c.id],y=u??!0,g=typeof c.columnDef.header=="string"?c.columnDef.header:c.id;return e("li",{css:kt,children:s("label",{children:[e("input",{type:"checkbox",name:c.id,checked:y,onChange:o}),g]})},c.id)})}),e(t2,{...n})]})})}function t2({query:n}){const a=T.useFragment(Vg,n),l=cn(o=>o.annotationColumnVisibility),t=cn(o=>o.setAnnotationColumnVisibility),i=p.useMemo(()=>a.spanAnnotationNames.every(o=>l[o]||!1),[a.spanAnnotationNames,l]),r=p.useCallback(()=>{const o=a.spanAnnotationNames.reduce((d,c)=>({...d,[c]:!i}),{});t(o)},[a.spanAnnotationNames,t,i]);return s("section",{children:[e(v,{paddingTop:"size-50",paddingBottom:"size-50",borderColor:"dark",borderTopWidth:"thin",borderBottomWidth:"thin",children:e("div",{css:kt,children:s("label",{children:[e("input",{type:"checkbox",name:"toggle-annotations-all",checked:i,onChange:r}),"annotations"]})})}),e("ul",{children:a.spanAnnotationNames.map(o=>{const d=l[o]??!1;return e("li",{css:kt,children:s("label",{children:[e("input",{type:"checkbox",name:o,checked:d,onChange:()=>{t({...l,[o]:!d})}}),o]})},o)})})]})}const Ng=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"condition"},{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"condition",variableName:"condition"}],concreteType:"ValidationResult",kind:"LinkedField",name:"validateSpanFilterCondition",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isValid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"errorMessage",storageKey:null}],storageKey:null}],type:"Project",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanFilterConditionFieldValidationQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanFilterConditionFieldValidationQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}]},params:{cacheID:"38e5e2288d5746b32b21632854cc7c82",id:null,metadata:{},name:"SpanFilterConditionFieldValidationQuery",operationKind:"query",text:`query SpanFilterConditionFieldValidationQuery(
5976
5976
  $condition: String!
5977
5977
  $id: ID!
5978
5978
  ) {
@@ -6074,11 +6074,11 @@ fragment DatasetSelectorPopoverContent_datasets on Query {
6074
6074
  }
6075
6075
  }
6076
6076
  }
6077
- `}};Hg.hash="7cd8a13144d97d2b5294f2a09c9e1351";function d2(n){const{onCreateNewDataset:a,onDatasetSelected:l}=n,[t,i]=p.useState(""),r=P.useLazyLoadQuery(Hg,{},{fetchPolicy:"network-only"});return s(q,{title:"Add to Dataset",variant:"compact",backgroundColor:"light",borderColor:"light",bodyStyle:{padding:0},extra:e(E,{variant:"default",size:"S",onPress:a,children:"New Dataset"}),children:[e(v,{padding:"size-100",children:e(zo,{onChange:o=>{i(o)},children:e(ae,{placeholder:"Search datasets"})})}),e(v,{borderTopWidth:"thin",borderColor:"light",children:e("div",{css:K`
6077
+ `}};Hg.hash="7cd8a13144d97d2b5294f2a09c9e1351";function d2(n){const{onCreateNewDataset:a,onDatasetSelected:l}=n,[t,i]=p.useState(""),r=T.useLazyLoadQuery(Hg,{},{fetchPolicy:"network-only"});return s(q,{title:"Add to Dataset",variant:"compact",backgroundColor:"light",borderColor:"light",bodyStyle:{padding:0},extra:e(E,{variant:"default",size:"S",onPress:a,children:"New Dataset"}),children:[e(v,{padding:"size-100",children:e(zo,{onChange:o=>{i(o)},children:e(ae,{placeholder:"Search datasets"})})}),e(v,{borderTopWidth:"thin",borderColor:"light",children:e("div",{css:K`
6078
6078
  height: 400px;
6079
6079
  overflow-y: auto;
6080
6080
  min-width: 300px;
6081
- `,children:e(c2,{query:r,search:t,onDatasetSelected:l})})})]})}function c2(n){const{search:a,onDatasetSelected:l}=n,[t]=P.useRefetchableFragment(Ug,n.query),i=p.useMemo(()=>{let o=t.datasets.edges.map(d=>d.dataset);return a&&(o=o.filter(d=>d.name.toLowerCase().includes(a.toLowerCase()))),o},[a,t]);return i.length===0?e(v,{padding:"size-200",children:e(b,{direction:"column",justifyContent:"center",alignItems:"center",flex:"1 1 auto",children:e(F,{children:"No datasets found"})})}):e(wi,{selectionMode:"single",onSelectionChange:o=>{if(typeof o=="object"){const d=Array.from(o);l(d[0])}},children:i.map(o=>e(je,{children:o.name},o.id))})}function Gg(n){const a=be(),l=ke(),t=Fe(),[i,r]=p.useState(!1),[o,d]=p.useState(!1),[c,u]=p.useState(!1),{selectedSpans:y,onClearSelection:g}=n,[m,f]=P.useMutation(Bg),[h,k]=P.useMutation(Qg),S=y.length!==1,C=p.useCallback(x=>{m({variables:{input:{datasetId:x,spanIds:y.map(N=>N.id)}},onCompleted:()=>{l({title:"Examples added to dataset",message:`${y.length} example${S?"s have":" has"} been added to the dataset.`,action:{text:"View dataset",onClick:()=>{a(`/datasets/${x}/examples`)}}}),g()},onError:N=>{const w=Re(N);t({title:"An error occurred",message:`Failed to add spans to dataset: ${(w==null?void 0:w[0])??N.message}`})}})},[m,y,l,S,g,a,t]),T=p.useCallback(()=>{const x=[...new Set(y.map(N=>N.traceId))];h({variables:{traceIds:x},onCompleted:()=>{l({title:"Traces deleted",message:`${x.length} trace${x.length!==1?"s have":" has"} been deleted.`}),g()},onError:N=>{const w=Re(N);t({title:"An error occurred",message:`Failed to delete traces: ${(w==null?void 0:w[0])??N.message}`})}})},[h,y,l,g,t]),_=()=>{u(!0)};return e("div",{css:K`
6081
+ `,children:e(c2,{query:r,search:t,onDatasetSelected:l})})})]})}function c2(n){const{search:a,onDatasetSelected:l}=n,[t]=T.useRefetchableFragment(Ug,n.query),i=p.useMemo(()=>{let o=t.datasets.edges.map(d=>d.dataset);return a&&(o=o.filter(d=>d.name.toLowerCase().includes(a.toLowerCase()))),o},[a,t]);return i.length===0?e(v,{padding:"size-200",children:e(b,{direction:"column",justifyContent:"center",alignItems:"center",flex:"1 1 auto",children:e(F,{children:"No datasets found"})})}):e(wi,{selectionMode:"single",onSelectionChange:o=>{if(typeof o=="object"){const d=Array.from(o);l(d[0])}},children:i.map(o=>e(je,{children:o.name},o.id))})}function Gg(n){const a=be(),l=ke(),t=Fe(),[i,r]=p.useState(!1),[o,d]=p.useState(!1),[c,u]=p.useState(!1),{selectedSpans:y,onClearSelection:g}=n,[m,f]=T.useMutation(Bg),[h,k]=T.useMutation(Qg),S=y.length!==1,C=p.useCallback(x=>{m({variables:{input:{datasetId:x,spanIds:y.map(N=>N.id)}},onCompleted:()=>{l({title:"Examples added to dataset",message:`${y.length} example${S?"s have":" has"} been added to the dataset.`,action:{text:"View dataset",onClick:()=>{a(`/datasets/${x}/examples`)}}}),g()},onError:N=>{const w=Re(N);t({title:"An error occurred",message:`Failed to add spans to dataset: ${(w==null?void 0:w[0])??N.message}`})}})},[m,y,l,S,g,a,t]),P=p.useCallback(()=>{const x=[...new Set(y.map(N=>N.traceId))];h({variables:{traceIds:x},onCompleted:()=>{l({title:"Traces deleted",message:`${x.length} trace${x.length!==1?"s have":" has"} been deleted.`}),g()},onError:N=>{const w=Re(N);t({title:"An error occurred",message:`Failed to delete traces: ${(w==null?void 0:w[0])??N.message}`})}})},[h,y,l,g,t]),L=()=>{u(!0)};return e("div",{css:K`
6082
6082
  position: absolute;
6083
6083
  bottom: var(--ac-global-dimension-size-600);
6084
6084
  left: 50%;
@@ -6086,10 +6086,10 @@ fragment DatasetSelectorPopoverContent_datasets on Query {
6086
6086
  z-index: 10;
6087
6087
  box-shadow: 8px 8px 20px 0 rgba(0, 0, 0, 0.4);
6088
6088
  border-radius: var(--ac-global-rounding-medium);
6089
- `,children:e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(F,{children:`${y.length} span${S?"s":""} selected`}),s(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"default",size:"S",onPress:g,children:"Cancel"}),s(J,{isOpen:o,onOpenChange:x=>{d(x)},children:[e(E,{variant:"default",size:"S",leadingVisual:f?e(yn,{}):e(xt,{}),onPress:()=>{d(!0)},isDisabled:f,children:f?"Adding...":"Add to Dataset"}),e(p.Suspense,{children:e(kn,{placement:"top end",crossOffset:300,children:e(d2,{onDatasetSelected:x=>{C(x),d(!1)},onCreateNewDataset:()=>{d(!1),r(!0)}})})})]}),e(J,{isOpen:i,onOpenChange:r,children:e(kn,{children:e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"New Dataset"}),e(ue,{children:e(E,{variant:"default",size:"S",onPress:()=>{r(!1)},leadingVisual:e(D,{svg:e(Gi,{})})})})]}),e(Bo,{onDatasetCreateError:x=>{const N=Re(x);t({title:"Dataset creation failed",message:`Failed to create dataset: ${(N==null?void 0:N[0])??x.message}`})},onDatasetCreated:x=>{r(!1),l({title:"Dataset created",message:`${x.name} has been successfully created.`}),d(!0)}})]})})})})})}),e(E,{variant:"danger",size:"S",leadingVisual:e(D,{svg:k?e(yn,{}):e(Je,{})}),isDisabled:k,onPress:_,children:k?"Deleting...":"Delete"}),e(J,{isOpen:c,onOpenChange:u,children:e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[e(se,{children:e(oe,{children:"Delete Traces"})}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:"Are you sure you want to delete the selected spans and their traces?"})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",onPress:()=>{u(!1)},children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{T(),u(!1)},children:"Delete Traces"})]})})]})})})})})]})]})})})}const Wg="annotations",xi="-",Jg={col:"startTime",dir:"desc"};function Zg(n){let a=null,l=null;if(n.id&&n.id.startsWith(Wg)){const[,t,i]=n.id.split(xi);l={attr:t,name:i}}else a=n.id;return{col:a,evalResultKey:l,dir:n.desc?"desc":"asc"}}function bt(n,a){return`${Wg}${xi}${a}${xi}${n}`.replace(/[^a-zA-Z0-9]/g,"-")}const ut=dr,u2={minSize:100};function m2(n){return n==="root"||n==="all"}const Xg=({table:n,hasNext:a,onLoadNext:l,isLoadingNext:t})=>{const i=be(),[r]=Sn(),{traceId:o}=We(),d=r.get(Pn);return s("tbody",{children:[n.getRowModel().rows.map(c=>{const u=d===c.original.id||!d&&c.original.trace.traceId===o;return e("tr",{"data-selected":u,onClick:()=>i(`${c.original.trace.traceId}?${Pn}=${c.original.id}`),children:c.getVisibleCells().map(y=>{const g=`--col-${y.column.id}-size`;return e("td",{style:{width:`calc(var(${g}) * 1px)`,maxWidth:`calc(var(${g}) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ee(y.column.columnDef.cell,y.getContext())},y.id)})},c.id)}),a?e(nr,{onLoadMore:l,isLoadingNext:t},"load-more"):null]})},g2=Kn.memo(Xg,(n,a)=>n.table.options.data===a.table.options.data);function p2(n){const{fetchKey:a}=Xa(),l=p.useRef(null),t=p.useRef(!0),[i,r]=p.useState({}),[o,d]=p.useState([]),[c,u]=p.useState(""),[y,g]=p.useState(!0),m=cn(L=>L.columnVisibility),{data:f,loadNext:h,hasNext:k,isLoadingNext:S,refetch:C}=P.usePaginationFragment(wg,n.project),T=Fr(),_=T==null?void 0:T.setTraceSequence;p.useEffect(()=>{if(_)return _(f.spans.edges.map(({span:L})=>({traceId:L.trace.traceId,spanId:L.id}))),()=>{_([])}},[f.spans.edges,_]);const x=cn(L=>L.annotationColumnVisibility),N=p.useMemo(()=>Object.keys(x).filter(L=>x[L]),[x]),w=p.useMemo(()=>f.spans.edges.map(({span:j})=>j),[f]),$=N.map(L=>({header:L,columns:[{header:"labels",accessorKey:bt(L,"label"),cell:({row:j})=>{const U=j.original.spanAnnotationSummaries.find(le=>le.name===L);return U?e(Ou,{name:L,labelFractions:U.labelFractions}):null}},{header:"mean score",accessorKey:bt(L,"score"),cell:({row:j})=>{const U=j.original.spanAnnotationSummaries.find(le=>le.name===L);return U?e(Mt,{value:U.meanScore,fallback:null}):null}}]})),I=[{header:()=>s(b,{direction:"row",gap:"size-50",children:[e("span",{children:"annotations"}),s(Jl,{children:[e(de,{level:3,weight:"heavy",children:"Annotations"}),e(Ja,{children:"Evaluations and human annotations logged via the API or set via the UI."})]})]}),id:"annotations",accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:L})=>s(b,{direction:"row",gap:"size-50",wrap:"wrap",children:[e(Nt,{span:L.original,showFilterActions:!0}),L.original.documentRetrievalMetrics.map(j=>s(Y,{children:[e(Ln,{name:j.evaluationName,metric:"ndcg",score:j.ndcg},"ndcg"),e(Ln,{name:j.evaluationName,metric:"precision",score:j.precision},"precision"),e(Ln,{name:j.evaluationName,metric:"hit",score:j.hit},"hit")]}))]})},...$],M=[{id:"select",maxSize:10,header:({table:L})=>e(ea,{checked:L.getIsAllRowsSelected(),indeterminate:L.getIsSomeRowsSelected(),onChange:L.getToggleAllRowsSelectedHandler()}),cell:({row:L})=>e(ea,{checked:L.getIsSelected(),disabled:!L.getCanSelect(),indeterminate:L.getIsSomeSelected(),onChange:L.getToggleSelectedHandler()})},{header:"status",accessorKey:"statusCode",maxSize:30,enableSorting:!1,cell:({getValue:L})=>{const j=L();return e(b,{direction:"row",gap:"size-50",alignItems:"center",children:e(wt,{statusCode:j})})}},{header:"kind",accessorKey:"spanKind",maxSize:100,enableSorting:!1,cell:({getValue:L})=>e(Bi,{spanKind:L()})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:L,row:j})=>{const U=j.original,{traceId:le}=U.trace;return e(Oe,{to:`${le}?${Pn}=${U.id}`,children:L()})}},{header:"input",accessorKey:"input.value",cell:Be,enableSorting:!1},{header:"output",accessorKey:"output.value",cell:Be,enableSorting:!1},{header:"metadata",accessorKey:"metadata",cell:({row:L})=>e(Eg,{metadata:L.original.metadata}),enableSorting:!1},...I,{header:"start time",accessorKey:"startTime",cell:we},{header:"latency",accessorKey:"latencyMs",cell:({getValue:L})=>{const j=L();return j===null||typeof j!="number"?null:e(Ye,{latencyMs:j})}},{header:y?"cumulative tokens":"total tokens",accessorKey:y?"cumulativeTokenCountTotal":"tokenCountTotal",cell:({row:L,getValue:j})=>{if(j()===null)return"--";const le=L.original,on=y?le.cumulativeTokenCountTotal:le.tokenCountTotal;return y?e(_o,{tokenCountTotal:on||0,nodeId:le.id}):e(Rt,{tokenCountTotal:on||0,nodeId:le.id})}},{header:y?"cumulative cost":"total cost",accessorKey:y?"trace.costSummary.total.cost":"costSummary.total.cost",id:y?"cumulativeTokenCostTotal":"tokenCostTotal",cell:({row:L,getValue:j})=>{const U=j();if(U===null||typeof U!="number")return"--";const le=L.original;return y?e(Ji,{totalCost:U,nodeId:le.trace.id,size:"S"}):e(Et,{totalCost:U,spanNodeId:le.id,size:"S"})}}];p.useEffect(()=>{if(t.current===!0){t.current=!1;return}p.startTransition(()=>{const L=o[0];C({sort:L?Zg(L):Jg,after:null,first:ut,filterCondition:c,rootSpansOnly:y},{fetchPolicy:"store-and-network"})})},[o,C,c,a,y]);const z=p.useCallback(L=>{if(L){const{scrollHeight:j,scrollTop:U,clientHeight:le}=L;j-U-le<300&&!S&&k&&h(ut)}},[k,S,h]),A=cn(L=>L.setColumnSizing),V=cn(L=>L.columnSizing),O=Le({columns:M,data:w,state:{sorting:o,columnVisibility:m,rowSelection:i,columnSizing:V},defaultColumn:u2,columnResizeMode:"onChange",manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:r,onSortingChange:d,onColumnSizingChange:A,getCoreRowModel:_e(),getSortedRowModel:sn()}),H=O.getRowModel().rows,te=O.getSelectedRowModel().rows,He=te.map(L=>({id:L.original.id,traceId:L.original.trace.id})),Fn=p.useCallback(()=>{r({})},[r]),mn=H.length===0,En=O.getAllColumns().filter(L=>L.columns.length===0),{columnSizingInfo:B,columnSizing:ye}=O.getState(),fe=O.getFlatHeaders,$e=En.length,[Ve]=p.useMemo(()=>{const L=fe(),j={};for(let U=0;U<L.length;U++){const le=L[U];j[`--header-${le.id}-size`]=le.getSize(),j[`--col-${le.column.id}-size`]=le.column.getSize()}return[j]},[fe,B,ye,$e]);return s("div",{css:Tr,children:[e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:s(b,{direction:"row",gap:"size-100",width:"100%",alignItems:"center",children:[e(Og,{onValidCondition:u}),s(Ot,{"aria-label":"Toggle between root and all spans",selectionMode:"single",selectedKeys:[y?"root":"all"],onSelectionChange:L=>{if(L.size===0)return;const j=L.keys().next().value;if(m2(j))g(j==="root");else throw new Error(`Unknown root span filter selection: ${j}`)},children:[e(Mn,{"aria-label":"root spans",id:"root",children:"Root Spans"}),e(Mn,{"aria-label":"all spans",id:"all",children:"All"})]}),e(zg,{columns:En,query:f}),e(e2,{})]})}),e("div",{css:K`
6089
+ `,children:e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(F,{children:`${y.length} span${S?"s":""} selected`}),s(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"default",size:"S",onPress:g,children:"Cancel"}),s(J,{isOpen:o,onOpenChange:x=>{d(x)},children:[e(E,{variant:"default",size:"S",leadingVisual:f?e(yn,{}):e(xt,{}),onPress:()=>{d(!0)},isDisabled:f,children:f?"Adding...":"Add to Dataset"}),e(p.Suspense,{children:e(kn,{placement:"top end",crossOffset:300,children:e(d2,{onDatasetSelected:x=>{C(x),d(!1)},onCreateNewDataset:()=>{d(!1),r(!0)}})})})]}),e(J,{isOpen:i,onOpenChange:r,children:e(kn,{children:e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"New Dataset"}),e(ue,{children:e(E,{variant:"default",size:"S",onPress:()=>{r(!1)},leadingVisual:e(D,{svg:e(Gi,{})})})})]}),e(Bo,{onDatasetCreateError:x=>{const N=Re(x);t({title:"Dataset creation failed",message:`Failed to create dataset: ${(N==null?void 0:N[0])??x.message}`})},onDatasetCreated:x=>{r(!1),l({title:"Dataset created",message:`${x.name} has been successfully created.`}),d(!0)}})]})})})})})}),e(E,{variant:"danger",size:"S",leadingVisual:e(D,{svg:k?e(yn,{}):e(Je,{})}),isDisabled:k,onPress:L,children:k?"Deleting...":"Delete"}),e(J,{isOpen:c,onOpenChange:u,children:e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[e(se,{children:e(oe,{children:"Delete Traces"})}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:"Are you sure you want to delete the selected spans and their traces?"})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",onPress:()=>{u(!1)},children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{P(),u(!1)},children:"Delete Traces"})]})})]})})})})})]})]})})})}const Wg="annotations",xi="-",Jg={col:"startTime",dir:"desc"};function Zg(n){let a=null,l=null;if(n.id&&n.id.startsWith(Wg)){const[,t,i]=n.id.split(xi);l={attr:t,name:i}}else a=n.id;return{col:a,evalResultKey:l,dir:n.desc?"desc":"asc"}}function bt(n,a){return`${Wg}${xi}${a}${xi}${n}`.replace(/[^a-zA-Z0-9]/g,"-")}const ut=dr,u2={minSize:100};function m2(n){return n==="root"||n==="all"}const Xg=({table:n,hasNext:a,onLoadNext:l,isLoadingNext:t})=>{const i=be(),[r]=Sn(),{traceId:o}=We(),d=r.get(Pn);return s("tbody",{children:[n.getRowModel().rows.map(c=>{const u=d===c.original.id||!d&&c.original.trace.traceId===o;return e("tr",{"data-selected":u,onClick:()=>i(`${c.original.trace.traceId}?${Pn}=${c.original.id}`),children:c.getVisibleCells().map(y=>{const g=`--col-${y.column.id}-size`;return e("td",{style:{width:`calc(var(${g}) * 1px)`,maxWidth:`calc(var(${g}) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ee(y.column.columnDef.cell,y.getContext())},y.id)})},c.id)}),a?e(nr,{onLoadMore:l,isLoadingNext:t},"load-more"):null]})},g2=Kn.memo(Xg,(n,a)=>n.table.options.data===a.table.options.data);function p2(n){const{fetchKey:a}=Xa(),l=p.useRef(null),t=p.useRef(!0),[i,r]=p.useState({}),[o,d]=p.useState([]),[c,u]=p.useState(""),[y,g]=p.useState(!0),m=cn(_=>_.columnVisibility),{data:f,loadNext:h,hasNext:k,isLoadingNext:S,refetch:C}=T.usePaginationFragment(wg,n.project),P=Fr(),L=P==null?void 0:P.setTraceSequence;p.useEffect(()=>{if(L)return L(f.spans.edges.map(({span:_})=>({traceId:_.trace.traceId,spanId:_.id}))),()=>{L([])}},[f.spans.edges,L]);const x=cn(_=>_.annotationColumnVisibility),N=p.useMemo(()=>Object.keys(x).filter(_=>x[_]),[x]),w=p.useMemo(()=>f.spans.edges.map(({span:j})=>j),[f]),$=N.map(_=>({header:_,columns:[{header:"labels",accessorKey:bt(_,"label"),cell:({row:j})=>{const U=j.original.spanAnnotationSummaries.find(le=>le.name===_);return U?e(Ou,{name:_,labelFractions:U.labelFractions}):null}},{header:"mean score",accessorKey:bt(_,"score"),cell:({row:j})=>{const U=j.original.spanAnnotationSummaries.find(le=>le.name===_);return U?e(Mt,{value:U.meanScore,fallback:null}):null}}]})),I=[{header:()=>s(b,{direction:"row",gap:"size-50",children:[e("span",{children:"annotations"}),s(Jl,{children:[e(de,{level:3,weight:"heavy",children:"Annotations"}),e(Ja,{children:"Evaluations and human annotations logged via the API or set via the UI."})]})]}),id:"annotations",accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:_})=>s(b,{direction:"row",gap:"size-50",wrap:"wrap",children:[e(Nt,{span:_.original,showFilterActions:!0}),_.original.documentRetrievalMetrics.map(j=>s(Y,{children:[e(Ln,{name:j.evaluationName,metric:"ndcg",score:j.ndcg},"ndcg"),e(Ln,{name:j.evaluationName,metric:"precision",score:j.precision},"precision"),e(Ln,{name:j.evaluationName,metric:"hit",score:j.hit},"hit")]}))]})},...$],M=[{id:"select",maxSize:10,header:({table:_})=>e(ea,{checked:_.getIsAllRowsSelected(),indeterminate:_.getIsSomeRowsSelected(),onChange:_.getToggleAllRowsSelectedHandler()}),cell:({row:_})=>e(ea,{checked:_.getIsSelected(),disabled:!_.getCanSelect(),indeterminate:_.getIsSomeSelected(),onChange:_.getToggleSelectedHandler()})},{header:"status",accessorKey:"statusCode",maxSize:30,enableSorting:!1,cell:({getValue:_})=>{const j=_();return e(b,{direction:"row",gap:"size-50",alignItems:"center",children:e(wt,{statusCode:j})})}},{header:"kind",accessorKey:"spanKind",maxSize:100,enableSorting:!1,cell:({getValue:_})=>e(Bi,{spanKind:_()})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:_,row:j})=>{const U=j.original,{traceId:le}=U.trace;return e(Oe,{to:`${le}?${Pn}=${U.id}`,children:_()})}},{header:"input",accessorKey:"input.value",cell:Be,enableSorting:!1},{header:"output",accessorKey:"output.value",cell:Be,enableSorting:!1},{header:"metadata",accessorKey:"metadata",cell:({row:_})=>e(Eg,{metadata:_.original.metadata}),enableSorting:!1},...I,{header:"start time",accessorKey:"startTime",cell:we},{header:"latency",accessorKey:"latencyMs",cell:({getValue:_})=>{const j=_();return j===null||typeof j!="number"?null:e(Ye,{latencyMs:j})}},{header:y?"cumulative tokens":"total tokens",accessorKey:y?"cumulativeTokenCountTotal":"tokenCountTotal",cell:({row:_,getValue:j})=>{if(j()===null)return"--";const le=_.original,on=y?le.cumulativeTokenCountTotal:le.tokenCountTotal;return y?e(_o,{tokenCountTotal:on||0,nodeId:le.id}):e(Rt,{tokenCountTotal:on||0,nodeId:le.id})}},{header:y?"cumulative cost":"total cost",accessorKey:y?"trace.costSummary.total.cost":"costSummary.total.cost",id:y?"cumulativeTokenCostTotal":"tokenCostTotal",cell:({row:_,getValue:j})=>{const U=j();if(U===null||typeof U!="number")return"--";const le=_.original;return y?e(Ji,{totalCost:U,nodeId:le.trace.id,size:"S"}):e(Et,{totalCost:U,spanNodeId:le.id,size:"S"})}}];p.useEffect(()=>{if(t.current===!0){t.current=!1;return}p.startTransition(()=>{const _=o[0];C({sort:_?Zg(_):Jg,after:null,first:ut,filterCondition:c,rootSpansOnly:y},{fetchPolicy:"store-and-network"})})},[o,C,c,a,y]);const z=p.useCallback(_=>{if(_){const{scrollHeight:j,scrollTop:U,clientHeight:le}=_;j-U-le<300&&!S&&k&&h(ut)}},[k,S,h]),A=cn(_=>_.setColumnSizing),V=cn(_=>_.columnSizing),O=Le({columns:M,data:w,state:{sorting:o,columnVisibility:m,rowSelection:i,columnSizing:V},defaultColumn:u2,columnResizeMode:"onChange",manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:r,onSortingChange:d,onColumnSizingChange:A,getCoreRowModel:_e(),getSortedRowModel:sn()}),H=O.getRowModel().rows,te=O.getSelectedRowModel().rows,He=te.map(_=>({id:_.original.id,traceId:_.original.trace.id})),Fn=p.useCallback(()=>{r({})},[r]),mn=H.length===0,En=O.getAllColumns().filter(_=>_.columns.length===0),{columnSizingInfo:B,columnSizing:ye}=O.getState(),fe=O.getFlatHeaders,$e=En.length,[Ve]=p.useMemo(()=>{const _=fe(),j={};for(let U=0;U<_.length;U++){const le=_[U];j[`--header-${le.id}-size`]=le.getSize(),j[`--col-${le.column.id}-size`]=le.column.getSize()}return[j]},[fe,B,ye,$e]);return s("div",{css:Tr,children:[e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:s(b,{direction:"row",gap:"size-100",width:"100%",alignItems:"center",children:[e(Og,{onValidCondition:u}),s(Ot,{"aria-label":"Toggle between root and all spans",selectionMode:"single",selectedKeys:[y?"root":"all"],onSelectionChange:_=>{if(_.size===0)return;const j=_.keys().next().value;if(m2(j))g(j==="root");else throw new Error(`Unknown root span filter selection: ${j}`)},children:[e(Mn,{"aria-label":"root spans",id:"root",children:"Root Spans"}),e(Mn,{"aria-label":"all spans",id:"all",children:"All"})]}),e(zg,{columns:En,query:f}),e(e2,{})]})}),e("div",{css:K`
6090
6090
  flex: 1 1 auto;
6091
6091
  overflow: auto;
6092
- `,onScroll:L=>z(L.target),ref:l,children:s("table",{css:la,style:{...Ve,width:O.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:O.getHeaderGroups().map(L=>e("tr",{children:L.headers.map(j=>e("th",{colSpan:j.colSpan,style:{width:`calc(var(--header-${j.id}-size) * 1px)`},children:j.isPlaceholder?null:s(Y,{children:[s("div",{className:j.column.getCanSort()?"sort":"",onClick:j.column.getToggleSortingHandler(),style:{left:j.getStart(),width:j.getSize()},children:[e(Xe,{maxWidth:"100%",children:ee(j.column.columnDef.header,j.getContext())}),j.column.getIsSorted()?e(D,{className:"sort-icon",svg:j.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]}),e("div",{onMouseDown:j.getResizeHandler(),onTouchStart:j.getResizeHandler(),className:`resizer ${j.column.getIsResizing()?"isResizing":""}`})]})},j.id))},L.id))}),mn?e(Mg,{projectName:f.name}):B.isResizingColumn?e(g2,{table:O,hasNext:k,onLoadNext:()=>h(ut),isLoadingNext:S}):e(Xg,{table:O,hasNext:k,onLoadNext:()=>h(ut),isLoadingNext:S})]})}),te.length?e(Gg,{selectedSpans:He,onClearSelection:Fn}):null]})}function y2({queryReference:n}){const a=P.usePreloadedQuery(Ac,n);return e(p2,{project:a.project})}const AI=()=>{const{spansQueryReference:n}=Ht();return n?e(Pr,{children:s(nm,{children:[e(Sr,{children:e(p.Suspense,{fallback:e(pe,{}),children:e(y2,{queryReference:n})})}),e(p.Suspense,{children:e(Te,{})})]})}):null},Yg=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterCondition"},l={defaultValue:30,kind:"LocalArgument",name:"first"},t={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},r={defaultValue:null,kind:"LocalArgument",name:"timeRange"},o=[{kind:"Variable",name:"id",variableName:"id"}],d={kind:"Variable",name:"after",variableName:"after"},c={kind:"Variable",name:"filterCondition",variableName:"filterCondition"},u={kind:"Variable",name:"first",variableName:"first"},y={kind:"Variable",name:"sort",variableName:"sort"},g={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},h=[d,c,u,{kind:"Literal",name:"rootSpansOnly",value:!0},y,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],k={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},C={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},T={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},_=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],x={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:_,storageKey:null},N={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:_,storageKey:null},w={alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},$={alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},I={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},M={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},z={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[m,f,I,M,{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},m],storageKey:null}],storageKey:null},A={alias:null,args:null,concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummaries",plural:!0,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null},I],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null},f],storageKey:null},V={alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[m,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[g,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[m,f,{alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[I,M],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[m],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},O={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r],kind:"Fragment",metadata:null,name:"TracesTableQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[d,c,u,y],kind:"FragmentSpread",name:"TracesTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,l,i,r,t],kind:"Operation",name:"TracesTableQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[g,m,{kind:"InlineFragment",selections:[f,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:"rootSpans",args:h,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[m,k,f,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"statusCode",storageKey:null},S,C,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},T,x,N,w,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[m,$,{alias:null,args:null,kind:"ScalarField",name:"numSpans",storageKey:null},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},z,A,V,O,{alias:null,args:[{kind:"Literal",name:"first",value:50}],concreteType:"SpanConnection",kind:"LinkedField",name:"descendants",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[m,k,f,{alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},S,C,T,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},x,N,w,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[m,$],storageKey:null},z,V,A,O],storageKey:null}],storageKey:null}],storageKey:"descendants(first:50)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[g,m],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"rootSpans",args:h,filters:["sort","rootSpansOnly","filterCondition","timeRange"],handle:"connection",key:"TracesTable_rootSpans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"422bbc4ee6cd6a8c1b859da55e370cb0",id:null,metadata:{},name:"TracesTableQuery",operationKind:"query",text:`query TracesTableQuery(
6092
+ `,onScroll:_=>z(_.target),ref:l,children:s("table",{css:la,style:{...Ve,width:O.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:O.getHeaderGroups().map(_=>e("tr",{children:_.headers.map(j=>e("th",{colSpan:j.colSpan,style:{width:`calc(var(--header-${j.id}-size) * 1px)`},children:j.isPlaceholder?null:s(Y,{children:[s("div",{className:j.column.getCanSort()?"sort":"",onClick:j.column.getToggleSortingHandler(),style:{left:j.getStart(),width:j.getSize()},children:[e(Xe,{maxWidth:"100%",children:ee(j.column.columnDef.header,j.getContext())}),j.column.getIsSorted()?e(D,{className:"sort-icon",svg:j.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]}),e("div",{onMouseDown:j.getResizeHandler(),onTouchStart:j.getResizeHandler(),className:`resizer ${j.column.getIsResizing()?"isResizing":""}`})]})},j.id))},_.id))}),mn?e(Mg,{projectName:f.name}):B.isResizingColumn?e(g2,{table:O,hasNext:k,onLoadNext:()=>h(ut),isLoadingNext:S}):e(Xg,{table:O,hasNext:k,onLoadNext:()=>h(ut),isLoadingNext:S})]})}),te.length?e(Gg,{selectedSpans:He,onClearSelection:Fn}):null]})}function y2({queryReference:n}){const a=T.usePreloadedQuery(Ac,n);return e(p2,{project:a.project})}const AI=()=>{const{spansQueryReference:n}=Ht();return n?e(Pr,{children:s(nm,{children:[e(Sr,{children:e(p.Suspense,{fallback:e(pe,{}),children:e(y2,{queryReference:n})})}),e(p.Suspense,{children:e(Te,{})})]})}):null},Yg=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterCondition"},l={defaultValue:30,kind:"LocalArgument",name:"first"},t={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},r={defaultValue:null,kind:"LocalArgument",name:"timeRange"},o=[{kind:"Variable",name:"id",variableName:"id"}],d={kind:"Variable",name:"after",variableName:"after"},c={kind:"Variable",name:"filterCondition",variableName:"filterCondition"},u={kind:"Variable",name:"first",variableName:"first"},y={kind:"Variable",name:"sort",variableName:"sort"},g={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},h=[d,c,u,{kind:"Literal",name:"rootSpansOnly",value:!0},y,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],k={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},C={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},P={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},L=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],x={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:L,storageKey:null},N={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:L,storageKey:null},w={alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},$={alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},I={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},M={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},z={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[m,f,I,M,{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},m],storageKey:null}],storageKey:null},A={alias:null,args:null,concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummaries",plural:!0,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null},I],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null},f],storageKey:null},V={alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[m,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[g,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[m,f,{alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[I,M],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[m],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},O={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r],kind:"Fragment",metadata:null,name:"TracesTableQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[d,c,u,y],kind:"FragmentSpread",name:"TracesTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,l,i,r,t],kind:"Operation",name:"TracesTableQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[g,m,{kind:"InlineFragment",selections:[f,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:"rootSpans",args:h,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[m,k,f,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"statusCode",storageKey:null},S,C,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},P,x,N,w,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[m,$,{alias:null,args:null,kind:"ScalarField",name:"numSpans",storageKey:null},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},z,A,V,O,{alias:null,args:[{kind:"Literal",name:"first",value:50}],concreteType:"SpanConnection",kind:"LinkedField",name:"descendants",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[m,k,f,{alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},S,C,P,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},x,N,w,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[m,$],storageKey:null},z,V,A,O],storageKey:null}],storageKey:null}],storageKey:"descendants(first:50)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[g,m],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"rootSpans",args:h,filters:["sort","rootSpansOnly","filterCondition","timeRange"],handle:"connection",key:"TracesTable_rootSpans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"422bbc4ee6cd6a8c1b859da55e370cb0",id:null,metadata:{},name:"TracesTableQuery",operationKind:"query",text:`query TracesTableQuery(
6093
6093
  $after: String = null
6094
6094
  $filterCondition: String = null
6095
6095
  $first: Int = 30
@@ -6277,22 +6277,22 @@ fragment TracesTable_spans_1XEuU on Project {
6277
6277
  &[data-is-additional-row="true"] {
6278
6278
  box-shadow: inset 0 -10px 20px var(--ac-global-color-grey-100);
6279
6279
  }
6280
- `;function ap(n){const{children:a}=n,l=[];for(const t of a){const i={...t.span,children:ap({children:t.children})};l.push(i)}return l}function S2(n){const a=p.useRef(null),l=p.useRef(!0),[t,i]=p.useState({}),[r,o]=p.useState([]),[d,c]=p.useState(""),{fetchKey:u}=Xa(),{data:y,loadNext:g,hasNext:m,isLoadingNext:f,refetch:h}=P.usePaginationFragment(ep,n.project),k=cn(L=>L.annotationColumnVisibility),S=p.useMemo(()=>Object.keys(k).filter(L=>k[L]),[k]),C=p.useMemo(()=>y.rootSpans.edges.map(({rootSpan:L})=>{const j=lk([L,...L.descendants.edges.map(({node:on})=>on)]),[U]=ap({children:j}),le=L.trace.numSpans-f2-1;return le>0&&(U.children=[...U.children,{...U,__additionalRow:!0,name:`+ ${le} more span${le>1?"s":""}`,id:`additional-${U.id}`,input:{value:""},output:{value:""},metadata:null,spanAnnotations:[],documentRetrievalMetrics:[],children:[]}]),U}),[y]),T=p.useMemo(()=>S.map(L=>({header:L,columns:[{header:"labels",accessorKey:bt(L,"label"),cell:({row:j})=>{var le;const U=(le=j.original.spanAnnotationSummaries)==null?void 0:le.find(on=>on.name===L);return U?e(Ou,{name:L,labelFractions:U.labelFractions}):null}},{header:"mean score",accessorKey:bt(L,"score"),cell:({row:j})=>{var le;const U=(le=j.original.spanAnnotationSummaries)==null?void 0:le.find(on=>on.name===L);return U?e(Mt,{value:U.meanScore,fallback:null}):null}}]})),[S]),_=p.useMemo(()=>[{header:()=>s(b,{direction:"row",gap:"size-50",children:[e("span",{children:"Annotations"}),s(Jl,{children:[e(de,{level:3,weight:"heavy",children:"Annotations"}),e(Ja,{children:"Evaluations and human annotations logged via the API or set via the UI."})]})]}),id:"annotations",accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:L})=>{if(L.original.__additionalRow)return null;const j=L.original.spanAnnotations.length===0&&L.original.documentRetrievalMetrics.length===0;return s(b,{direction:"row",gap:"size-50",wrap:"wrap",children:[e(Nt,{span:L.original,showFilterActions:!0}),L.original.documentRetrievalMetrics.map(U=>s(p.Fragment,{children:[e(Ln,{name:U.evaluationName,metric:"ndcg",score:U.ndcg},"ndcg"),e(Ln,{name:U.evaluationName,metric:"precision",score:U.precision},"precision"),e(Ln,{name:U.evaluationName,metric:"hit",score:U.hit},"hit")]},"doc-evals")),j?"--":null]})}},...T],[T]),x=p.useMemo(()=>[{id:"select",maxSize:10,header:({table:L})=>e(ea,{checked:L.getIsAllRowsSelected(),indeterminate:L.getIsSomeRowsSelected(),onChange:L.getToggleAllRowsSelectedHandler()}),cell:({row:L})=>L.original.__additionalRow?null:e(ea,{checked:L.getIsSelected(),disabled:!L.getCanSelect(),indeterminate:L.getIsSomeSelected(),onChange:L.getToggleSelectedHandler()})},{header:"status",accessorKey:"statusCode",maxSize:30,enableSorting:!1,cell:({getValue:L,row:j})=>{if(j.original.__additionalRow)return null;const U=L();return e(wt,{statusCode:U})}},{header:({table:L})=>s(b,{gap:"size-50",direction:"row",alignItems:"center",children:[e(qr,{isExpanded:L.getIsAllRowsExpanded(),onClick:L.getToggleAllRowsExpandedHandler(),"aria-label":"Expand all rows"}),"kind"]}),enableSorting:!1,accessorKey:"spanKind",maxSize:100,cell:L=>L.row.original.__additionalRow?e("div",{css:K`
6280
+ `;function ap(n){const{children:a}=n,l=[];for(const t of a){const i={...t.span,children:ap({children:t.children})};l.push(i)}return l}function S2(n){const a=p.useRef(null),l=p.useRef(!0),[t,i]=p.useState({}),[r,o]=p.useState([]),[d,c]=p.useState(""),{fetchKey:u}=Xa(),{data:y,loadNext:g,hasNext:m,isLoadingNext:f,refetch:h}=T.usePaginationFragment(ep,n.project),k=cn(_=>_.annotationColumnVisibility),S=p.useMemo(()=>Object.keys(k).filter(_=>k[_]),[k]),C=p.useMemo(()=>y.rootSpans.edges.map(({rootSpan:_})=>{const j=lk([_,..._.descendants.edges.map(({node:on})=>on)]),[U]=ap({children:j}),le=_.trace.numSpans-f2-1;return le>0&&(U.children=[...U.children,{...U,__additionalRow:!0,name:`+ ${le} more span${le>1?"s":""}`,id:`additional-${U.id}`,input:{value:""},output:{value:""},metadata:null,spanAnnotations:[],documentRetrievalMetrics:[],children:[]}]),U}),[y]),P=p.useMemo(()=>S.map(_=>({header:_,columns:[{header:"labels",accessorKey:bt(_,"label"),cell:({row:j})=>{var le;const U=(le=j.original.spanAnnotationSummaries)==null?void 0:le.find(on=>on.name===_);return U?e(Ou,{name:_,labelFractions:U.labelFractions}):null}},{header:"mean score",accessorKey:bt(_,"score"),cell:({row:j})=>{var le;const U=(le=j.original.spanAnnotationSummaries)==null?void 0:le.find(on=>on.name===_);return U?e(Mt,{value:U.meanScore,fallback:null}):null}}]})),[S]),L=p.useMemo(()=>[{header:()=>s(b,{direction:"row",gap:"size-50",children:[e("span",{children:"Annotations"}),s(Jl,{children:[e(de,{level:3,weight:"heavy",children:"Annotations"}),e(Ja,{children:"Evaluations and human annotations logged via the API or set via the UI."})]})]}),id:"annotations",accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:_})=>{if(_.original.__additionalRow)return null;const j=_.original.spanAnnotations.length===0&&_.original.documentRetrievalMetrics.length===0;return s(b,{direction:"row",gap:"size-50",wrap:"wrap",children:[e(Nt,{span:_.original,showFilterActions:!0}),_.original.documentRetrievalMetrics.map(U=>s(p.Fragment,{children:[e(Ln,{name:U.evaluationName,metric:"ndcg",score:U.ndcg},"ndcg"),e(Ln,{name:U.evaluationName,metric:"precision",score:U.precision},"precision"),e(Ln,{name:U.evaluationName,metric:"hit",score:U.hit},"hit")]},"doc-evals")),j?"--":null]})}},...P],[P]),x=p.useMemo(()=>[{id:"select",maxSize:10,header:({table:_})=>e(ea,{checked:_.getIsAllRowsSelected(),indeterminate:_.getIsSomeRowsSelected(),onChange:_.getToggleAllRowsSelectedHandler()}),cell:({row:_})=>_.original.__additionalRow?null:e(ea,{checked:_.getIsSelected(),disabled:!_.getCanSelect(),indeterminate:_.getIsSomeSelected(),onChange:_.getToggleSelectedHandler()})},{header:"status",accessorKey:"statusCode",maxSize:30,enableSorting:!1,cell:({getValue:_,row:j})=>{if(j.original.__additionalRow)return null;const U=_();return e(wt,{statusCode:U})}},{header:({table:_})=>s(b,{gap:"size-50",direction:"row",alignItems:"center",children:[e(qr,{isExpanded:_.getIsAllRowsExpanded(),onClick:_.getToggleAllRowsExpandedHandler(),"aria-label":"Expand all rows"}),"kind"]}),enableSorting:!1,accessorKey:"spanKind",maxSize:100,cell:_=>_.row.original.__additionalRow?e("div",{css:K`
6281
6281
  // Since rows are flattened by default,
6282
6282
  // we can use the row.depth property
6283
6283
  // and paddingLeft to visually indicate the depth
6284
6284
  // of the row
6285
- padding-left: ${L.row.depth*2}rem;
6285
+ padding-left: ${_.row.depth*2}rem;
6286
6286
  `,children:e(D,{svg:e(Nl,{})})}):e("div",{css:K`
6287
6287
  // Since rows are flattened by default,
6288
6288
  // we can use the row.depth property
6289
6289
  // and paddingLeft to visually indicate the depth
6290
6290
  // of the row
6291
- padding-left: ${L.row.depth*2}rem;
6292
- `,children:s(b,{gap:"size-50",children:[L.row.getCanExpand()?e(qr,{isExpanded:L.row.getIsExpanded(),onClick:L.row.getToggleExpandedHandler(),"aria-label":"Expand row"}):null,e(Bi,{spanKind:L.getValue()})]})})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:L,row:j})=>{const{traceId:U}=j.original.trace,le=j.original.isAdditionalSpansRow?null:j.original.id;return e(Oe,{to:`${U}${le?`?${Pn}=${le}`:""}`,children:L()})}},{header:"input",accessorKey:"input.value",enableSorting:!1,cell:Be},{header:"output",accessorKey:"output.value",enableSorting:!1,cell:Be},{header:"metadata",accessorKey:"metadata",enableSorting:!1,cell:k2},..._,{header:"start time",accessorKey:"startTime",cell:L=>L.row.original.__additionalRow?null:e(we,{...L})},{header:"latency",accessorKey:"latencyMs",cell:({getValue:L,row:j})=>{const U=L();return U===null||typeof U!="number"||j.original.__additionalRow?null:e(Ye,{latencyMs:U})}},{header:"total tokens",minSize:80,accessorKey:"cumulativeTokenCountTotal",cell:({row:L,getValue:j})=>{if(L.original.__additionalRow)return null;const U=j();return U===null?"--":e(tk,{tokenCountTotal:U,nodeId:L.original.trace.id})}},{header:"total cost",minSize:80,accessorKey:"trace.costSummary.total.cost",id:"cumulativeTokenCostTotal",cell:({row:L,getValue:j})=>{const U=j();if(U===null||typeof U!="number")return"--";const le=L.original;return e(Ji,{totalCost:U,nodeId:le.trace.id,size:"S"})}}],[_]);p.useEffect(()=>{if(l.current===!0){l.current=!1;return}const L=r[0];p.startTransition(()=>{h({sort:L?Zg(L):Jg,after:null,first:Ls,filterCondition:d},{fetchPolicy:"store-and-network"})})},[r,h,d,u]);const N=p.useCallback(L=>{if(L){const{scrollHeight:j,scrollTop:U,clientHeight:le}=L;j-U-le<300&&!f&&m&&g(Ls)}},[m,f,g]),w=Fr(),$=w==null?void 0:w.setTraceSequence;p.useEffect(()=>{if($)return $(y.rootSpans.edges.map(({rootSpan:L})=>({traceId:L.trace.traceId,spanId:L.id}))),()=>{$([])}},[y.rootSpans.edges,$]);const[I,M]=p.useState({}),z=cn(L=>L.columnVisibility),A=cn(L=>L.setColumnSizing),V=cn(L=>L.columnSizing),O=Le({columns:x,data:C,onExpandedChange:M,manualSorting:!0,getSubRows:L=>L.children,state:{sorting:r,expanded:I,columnVisibility:z,rowSelection:t,columnSizing:V},columnResizeMode:"onChange",onRowSelectionChange:i,enableSubRowSelection:!1,onSortingChange:o,onColumnSizingChange:A,getCoreRowModel:_e(),getSortedRowModel:sn(),getExpandedRowModel:Qs(),getRowId:L=>L.id}),H=O.getRowModel().rows,te=O.getSelectedRowModel().flatRows,He=te.map(L=>({id:L.original.id,traceId:L.original.trace.id})),Fn=p.useCallback(()=>{i({})},[i]),mn=H.length===0,En=O.getAllColumns().filter(L=>L.columns.length===0),{columnSizingInfo:B,columnSizing:ye}=O.getState(),fe=O.getFlatHeaders,$e=En.length,Ve=Kn.useMemo(()=>{const L=fe(),j={};for(let U=0;U<L.length;U++){const le=L[U];j[`--header-${le.id}-size`]=le.getSize(),j[`--col-${le.column.id}-size`]=le.column.getSize()}return j},[fe,B,ye,$e]);return s("div",{css:Tr,children:[e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:s(b,{direction:"row",gap:"size-100",width:"100%",alignItems:"center",children:[e(Og,{onValidCondition:c}),e(zg,{columns:En,query:y})]})}),e("div",{css:K`
6291
+ padding-left: ${_.row.depth*2}rem;
6292
+ `,children:s(b,{gap:"size-50",children:[_.row.getCanExpand()?e(qr,{isExpanded:_.row.getIsExpanded(),onClick:_.row.getToggleExpandedHandler(),"aria-label":"Expand row"}):null,e(Bi,{spanKind:_.getValue()})]})})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:_,row:j})=>{const{traceId:U}=j.original.trace,le=j.original.isAdditionalSpansRow?null:j.original.id;return e(Oe,{to:`${U}${le?`?${Pn}=${le}`:""}`,children:_()})}},{header:"input",accessorKey:"input.value",enableSorting:!1,cell:Be},{header:"output",accessorKey:"output.value",enableSorting:!1,cell:Be},{header:"metadata",accessorKey:"metadata",enableSorting:!1,cell:k2},...L,{header:"start time",accessorKey:"startTime",cell:_=>_.row.original.__additionalRow?null:e(we,{..._})},{header:"latency",accessorKey:"latencyMs",cell:({getValue:_,row:j})=>{const U=_();return U===null||typeof U!="number"||j.original.__additionalRow?null:e(Ye,{latencyMs:U})}},{header:"total tokens",minSize:80,accessorKey:"cumulativeTokenCountTotal",cell:({row:_,getValue:j})=>{if(_.original.__additionalRow)return null;const U=j();return U===null?"--":e(tk,{tokenCountTotal:U,nodeId:_.original.trace.id})}},{header:"total cost",minSize:80,accessorKey:"trace.costSummary.total.cost",id:"cumulativeTokenCostTotal",cell:({row:_,getValue:j})=>{const U=j();if(U===null||typeof U!="number")return"--";const le=_.original;return e(Ji,{totalCost:U,nodeId:le.trace.id,size:"S"})}}],[L]);p.useEffect(()=>{if(l.current===!0){l.current=!1;return}const _=r[0];p.startTransition(()=>{h({sort:_?Zg(_):Jg,after:null,first:Ls,filterCondition:d},{fetchPolicy:"store-and-network"})})},[r,h,d,u]);const N=p.useCallback(_=>{if(_){const{scrollHeight:j,scrollTop:U,clientHeight:le}=_;j-U-le<300&&!f&&m&&g(Ls)}},[m,f,g]),w=Fr(),$=w==null?void 0:w.setTraceSequence;p.useEffect(()=>{if($)return $(y.rootSpans.edges.map(({rootSpan:_})=>({traceId:_.trace.traceId,spanId:_.id}))),()=>{$([])}},[y.rootSpans.edges,$]);const[I,M]=p.useState({}),z=cn(_=>_.columnVisibility),A=cn(_=>_.setColumnSizing),V=cn(_=>_.columnSizing),O=Le({columns:x,data:C,onExpandedChange:M,manualSorting:!0,getSubRows:_=>_.children,state:{sorting:r,expanded:I,columnVisibility:z,rowSelection:t,columnSizing:V},columnResizeMode:"onChange",onRowSelectionChange:i,enableSubRowSelection:!1,onSortingChange:o,onColumnSizingChange:A,getCoreRowModel:_e(),getSortedRowModel:sn(),getExpandedRowModel:Qs(),getRowId:_=>_.id}),H=O.getRowModel().rows,te=O.getSelectedRowModel().flatRows,He=te.map(_=>({id:_.original.id,traceId:_.original.trace.id})),Fn=p.useCallback(()=>{i({})},[i]),mn=H.length===0,En=O.getAllColumns().filter(_=>_.columns.length===0),{columnSizingInfo:B,columnSizing:ye}=O.getState(),fe=O.getFlatHeaders,$e=En.length,Ve=Kn.useMemo(()=>{const _=fe(),j={};for(let U=0;U<_.length;U++){const le=_[U];j[`--header-${le.id}-size`]=le.getSize(),j[`--col-${le.column.id}-size`]=le.column.getSize()}return j},[fe,B,ye,$e]);return s("div",{css:Tr,children:[e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:s(b,{direction:"row",gap:"size-100",width:"100%",alignItems:"center",children:[e(Og,{onValidCondition:c}),e(zg,{columns:En,query:y})]})}),e("div",{css:K`
6293
6293
  flex: 1 1 auto;
6294
6294
  overflow: auto;
6295
- `,onScroll:L=>N(L.target),ref:a,children:s("table",{css:la,style:{...Ve,width:O.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:O.getHeaderGroups().map(L=>e("tr",{children:L.headers.map(j=>e("th",{style:{width:`calc(var(--header-${j.id}-size) * 1px)`},colSpan:j.colSpan,children:j.isPlaceholder?null:s(Y,{children:[s("div",{"data-sortable":j.column.getCanSort(),className:j.column.getCanSort()?"sort":"",onClick:j.column.getToggleSortingHandler(),style:{left:j.getStart(),width:j.getSize()},children:[e(Xe,{maxWidth:"100%",children:ee(j.column.columnDef.header,j.getContext())}),j.column.getIsSorted()?e(D,{className:"sort-icon",svg:j.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]}),e("div",{onMouseDown:j.getResizeHandler(),onTouchStart:j.getResizeHandler(),className:`resizer ${j.column.getIsResizing()?"isResizing":""}`})]})},j.id))},L.id))}),mn?e(Mg,{projectName:y.name}):B.isResizingColumn?e(h2,{table:O}):e(np,{table:O})]})}),te.length?e(Gg,{selectedSpans:He,onClearSelection:Fn}):null]})}const v2=({tracesQueryReference:n})=>{const a=P.usePreloadedQuery(_c,n);return e(S2,{project:a.project})},wI=()=>{const{tracesQueryReference:n}=Ht();return n?e(Pr,{children:s(nm,{children:[e(Sr,{children:e(p.Suspense,{fallback:e(pe,{}),children:e(v2,{tracesQueryReference:n})})}),e(p.Suspense,{children:e(Te,{})})]})}):null},lp=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"Project",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"projectLoaderQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"projectLoaderQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,t],storageKey:null}]},params:{cacheID:"146b6f58a3f2f95565821ff5d976155d",id:null,metadata:{},name:"projectLoaderQuery",operationKind:"query",text:`query projectLoaderQuery(
6295
+ `,onScroll:_=>N(_.target),ref:a,children:s("table",{css:la,style:{...Ve,width:O.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:O.getHeaderGroups().map(_=>e("tr",{children:_.headers.map(j=>e("th",{style:{width:`calc(var(--header-${j.id}-size) * 1px)`},colSpan:j.colSpan,children:j.isPlaceholder?null:s(Y,{children:[s("div",{"data-sortable":j.column.getCanSort(),className:j.column.getCanSort()?"sort":"",onClick:j.column.getToggleSortingHandler(),style:{left:j.getStart(),width:j.getSize()},children:[e(Xe,{maxWidth:"100%",children:ee(j.column.columnDef.header,j.getContext())}),j.column.getIsSorted()?e(D,{className:"sort-icon",svg:j.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]}),e("div",{onMouseDown:j.getResizeHandler(),onTouchStart:j.getResizeHandler(),className:`resizer ${j.column.getIsResizing()?"isResizing":""}`})]})},j.id))},_.id))}),mn?e(Mg,{projectName:y.name}):B.isResizingColumn?e(h2,{table:O}):e(np,{table:O})]})}),te.length?e(Gg,{selectedSpans:He,onClearSelection:Fn}):null]})}const v2=({tracesQueryReference:n})=>{const a=T.usePreloadedQuery(_c,n);return e(S2,{project:a.project})},wI=()=>{const{tracesQueryReference:n}=Ht();return n?e(Pr,{children:s(nm,{children:[e(Sr,{children:e(p.Suspense,{fallback:e(pe,{}),children:e(v2,{tracesQueryReference:n})})}),e(p.Suspense,{children:e(Te,{})})]})}):null},lp=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"Project",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"projectLoaderQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"projectLoaderQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,t],storageKey:null}]},params:{cacheID:"146b6f58a3f2f95565821ff5d976155d",id:null,metadata:{},name:"projectLoaderQuery",operationKind:"query",text:`query projectLoaderQuery(
6296
6296
  $id: ID!
6297
6297
  ) {
6298
6298
  project: node(id: $id) {
@@ -6303,7 +6303,7 @@ fragment TracesTable_spans_1XEuU on Project {
6303
6303
  }
6304
6304
  }
6305
6305
  }
6306
- `}}}();lp.hash="3e1dc1a02098a23c327567a7fcf393fd";async function RI(n){const{projectId:a}=n.params;return await P.fetchQuery(ve,lp,{id:a}).toPromise()}const F2=ol.WidthProvider(ol.Responsive),C2={lg:[{i:"feedback",x:0,y:0,w:6,h:4},{i:"traces",x:6,y:0,w:6,h:4},{i:"duration",x:0,y:4,w:6,h:4},{i:"tokens",x:6,y:4,w:6,h:4},{i:"cost",x:0,y:8,w:12,h:4}]};function K2({title:n,subtitle:a}){return s("div",{css:K`
6306
+ `}}}();lp.hash="3e1dc1a02098a23c327567a7fcf393fd";async function RI(n){const{projectId:a}=n.params;return await T.fetchQuery(ve,lp,{id:a}).toPromise()}const F2=ol.WidthProvider(ol.Responsive),C2={lg:[{i:"feedback",x:0,y:0,w:6,h:4},{i:"traces",x:6,y:0,w:6,h:4},{i:"duration",x:0,y:4,w:6,h:4},{i:"tokens",x:6,y:4,w:6,h:4},{i:"cost",x:0,y:8,w:12,h:4}]};function K2({title:n,subtitle:a}){return s("div",{css:K`
6307
6307
  padding: var(--ac-global-dimension-size-100)
6308
6308
  var(--ac-global-dimension-size-200);
6309
6309
  border-bottom: 1px solid var(--ac-global-color-grey-200);
@@ -6370,7 +6370,7 @@ fragment TracesTable_spans_1XEuU on Project {
6370
6370
  }
6371
6371
  }
6372
6372
  }
6373
- `}}}();tp.hash="b73d8f3f532a0c6f88863f3c6dd5734f";const I2=tp;function VI(){const n=P.useLazyLoadQuery(I2,{}),{model:{primaryInferences:a,referenceInferences:l,corpusInferences:t}}=n;return e(rk,{primaryInferences:a,referenceInferences:l??null,corpusInferences:t??null,children:e(ik,{timeRangeBounds:{start:new Date(a.startTime),end:new Date(a.endTime)},children:e(Te,{})})})}function zI(){return e(ro,{children:e(Te,{})})}const ip=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={kind:"Variable",name:"timeRange",variableName:"timeRange"},t={kind:"InlineFragment",selections:[{alias:null,args:[l],kind:"ScalarField",name:"traceCount",storageKey:null},{alias:"latencyMsP50",args:[{kind:"Literal",name:"probability",value:.5},l],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null}],type:"Project",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectsPageProjectMetricsQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectsPageProjectMetricsQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}]},params:{cacheID:"fe700bb5c4a22149fbc01725d5fd0c27",id:null,metadata:{},name:"ProjectsPageProjectMetricsQuery",operationKind:"query",text:`query ProjectsPageProjectMetricsQuery(
6373
+ `}}}();tp.hash="b73d8f3f532a0c6f88863f3c6dd5734f";const I2=tp;function VI(){const n=T.useLazyLoadQuery(I2,{}),{model:{primaryInferences:a,referenceInferences:l,corpusInferences:t}}=n;return e(rk,{primaryInferences:a,referenceInferences:l??null,corpusInferences:t??null,children:e(ik,{timeRangeBounds:{start:new Date(a.startTime),end:new Date(a.endTime)},children:e(Te,{})})})}function zI(){return e(ro,{children:e(Te,{})})}const ip=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={kind:"Variable",name:"timeRange",variableName:"timeRange"},t={kind:"InlineFragment",selections:[{alias:null,args:[l],kind:"ScalarField",name:"traceCount",storageKey:null},{alias:"latencyMsP50",args:[{kind:"Literal",name:"probability",value:.5},l],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null}],type:"Project",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectsPageProjectMetricsQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectsPageProjectMetricsQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}]},params:{cacheID:"fe700bb5c4a22149fbc01725d5fd0c27",id:null,metadata:{},name:"ProjectsPageProjectMetricsQuery",operationKind:"query",text:`query ProjectsPageProjectMetricsQuery(
6374
6374
  $id: ID!
6375
6375
  $timeRange: TimeRange!
6376
6376
  ) {
@@ -6471,17 +6471,17 @@ fragment ProjectsPageProjectsFragment_1bvy9D on Query {
6471
6471
  __typename
6472
6472
  }
6473
6473
  }
6474
- `}}}();up.hash="212501fe2d6367ec1503bd7a00c1730f";function A2(n){const{projectId:a}=n,l=PS(),t=p.useRef(null),[i,r]=P.useMutation(up),{control:o,handleSubmit:d,setError:c,formState:{isValid:u}}=Qe({defaultValues:{endDate:Ms(new Date(Date.now()-dk).toISOString())}}),y=p.useCallback(g=>{const m=g.endDate.toDate(ml());if(!Oy(m))return c("endDate",{message:"Date is not in a valid format"});i({variables:{input:{id:a,endTime:new Date(m).toISOString()}},onCompleted:()=>{n.onComplete()},onError:f=>{alert("Failed to clear project traces: "+f)}})},[i,a,n,c]);return s("form",{onSubmit:d(y),ref:t,children:[s(v,{padding:"size-200",children:[e(F,{color:"danger",children:" This will remove all data before the following date. This cannot be undone."}),e(G,{name:"endDate",control:o,rules:{required:"field is required"},render:({field:{name:g,onChange:m,onBlur:f,value:h},fieldState:{invalid:k,error:S}})=>s(lo,{isInvalid:k,onChange:m,name:g,onBlur:f,value:h,granularity:"second",hideTimeZone:!0,css:K`
6474
+ `}}}();up.hash="212501fe2d6367ec1503bd7a00c1730f";function A2(n){const{projectId:a}=n,l=PS(),t=p.useRef(null),[i,r]=T.useMutation(up),{control:o,handleSubmit:d,setError:c,formState:{isValid:u}}=Qe({defaultValues:{endDate:Ms(new Date(Date.now()-dk).toISOString())}}),y=p.useCallback(g=>{const m=g.endDate.toDate(ml());if(!Oy(m))return c("endDate",{message:"Date is not in a valid format"});i({variables:{input:{id:a,endTime:new Date(m).toISOString()}},onCompleted:()=>{n.onComplete()},onError:f=>{alert("Failed to clear project traces: "+f)}})},[i,a,n,c]);return s("form",{onSubmit:d(y),ref:t,children:[s(v,{padding:"size-200",children:[e(F,{color:"danger",children:" This will remove all data before the following date. This cannot be undone."}),e(G,{name:"endDate",control:o,rules:{required:"field is required"},render:({field:{name:g,onChange:m,onBlur:f,value:h},fieldState:{invalid:k,error:S}})=>s(lo,{isInvalid:k,onChange:m,name:g,onBlur:f,value:h,granularity:"second",hideTimeZone:!0,css:K`
6475
6475
  .react-aria-DateInput {
6476
6476
  width: 100%;
6477
6477
  }
6478
- `,children:[e(W,{children:"End Date"}),e(Vs,{children:C=>e(zs,{segment:C})}),S?e(Ce,{children:S.message}):e(F,{slot:"description",children:`The date up to which you want to remove data. The format is ${l}.`})]})})]}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{type:"submit",variant:"danger",isDisabled:!u||r,size:"S",leadingVisual:r?e(D,{svg:e(yn,{})}):void 0,onPress:()=>{var g;(g=t.current)==null||g.requestSubmit()},children:r?"Removing...":"Remove Data"})})})]})}function mp({projectId:n,projectName:a,onProjectDelete:l,onProjectClear:t,onProjectRemoveData:i,variant:r="quiet"}){const[o,d]=p.useState(!1),[c,u]=p.useState(!1),[y,g]=p.useState(!1),m=a!=="default",[f]=P.useMutation(cp),[h]=P.useMutation(dp),k=p.useCallback(()=>{p.startTransition(()=>{f({variables:{projectId:n}}),l()})},[f,n,l]),S=p.useCallback(()=>{p.startTransition(()=>{h({variables:{input:{id:n}},onCompleted:()=>{t()},onError:x=>{alert("Failed to clear project: "+x)}})})},[h,n,t]),C=p.useCallback(()=>{d(!0)},[]),T=p.useCallback(()=>{u(!0)},[]),_=p.useCallback(()=>{g(!0)},[]);return s("div",{onClick:x=>{x.preventDefault(),x.stopPropagation()},children:[s(Ma,{buttonVariant:r,buttonSize:"compact",align:"end",onAction:x=>{switch(x){case"copyName":{navigator.clipboard.writeText(a);return}case"deleteProject":return C();case"clearProject":return T();case"removeProjectData":return _()}},disabledKeys:m?[]:["deleteProject"],children:[e(je,{textValue:"Copy Name",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Si,{})}),e(F,{children:"Copy Name"})]})},"copyName"),e(je,{textValue:"Clear All Traces",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(no,{})}),e(F,{children:"Clear All Data"})]})},"clearProject"),e(je,{textValue:"Remove Data",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Bt,{})}),e(F,{children:"Remove Data"})]})},"removeProjectData"),m?e(je,{children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Je,{})}),e(F,{children:"Delete"})]})},"deleteProject"):null]}),e(J,{isOpen:o,onOpenChange:d,children:e(ne,{children:e(Z,{size:"M",children:e(X,{children:({close:x})=>s(re,{children:[s(se,{children:[e(oe,{children:"Delete Project"}),e(ue,{children:e(me,{slot:"close"})})]}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:`Are you sure you want to delete project ${a}? This cannot be undone.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{k(),x()},children:"Delete Project"})})})]})})})})}),e(J,{isOpen:c,onOpenChange:u,children:e(ne,{children:e(Z,{size:"M",children:e(X,{children:({close:x})=>s(re,{children:[s(se,{children:[e(oe,{children:"Clear Project"}),e(ue,{children:e(me,{slot:"close"})})]}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:`Are you sure you want to clear project ${a}? All traces and evaluations for this project will be deleted. This cannot be undone.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{S(),x()},children:"Clear"})})})]})})})})}),e(J,{isOpen:y,onOpenChange:g,children:e(ne,{children:e(Z,{size:"M",children:e(X,{children:({close:x})=>s(re,{children:[s(se,{children:[e(oe,{children:"Remove Data"}),e(ue,{children:e(me,{slot:"close"})})]}),e(A2,{projectId:n,onComplete:()=>{i(),x()}})]})})})})})]})}const w2=200;function R2({onChange:n}){const a=p.useMemo(()=>zl(t=>{p.startTransition(()=>{n(t)})},w2),[n]),l=p.useCallback(t=>{a(t)},[a]);return e(ie,{size:"S",css:K`
6478
+ `,children:[e(W,{children:"End Date"}),e(Vs,{children:C=>e(zs,{segment:C})}),S?e(Ce,{children:S.message}):e(F,{slot:"description",children:`The date up to which you want to remove data. The format is ${l}.`})]})})]}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{type:"submit",variant:"danger",isDisabled:!u||r,size:"S",leadingVisual:r?e(D,{svg:e(yn,{})}):void 0,onPress:()=>{var g;(g=t.current)==null||g.requestSubmit()},children:r?"Removing...":"Remove Data"})})})]})}function mp({projectId:n,projectName:a,onProjectDelete:l,onProjectClear:t,onProjectRemoveData:i,variant:r="quiet"}){const[o,d]=p.useState(!1),[c,u]=p.useState(!1),[y,g]=p.useState(!1),m=a!=="default",[f]=T.useMutation(cp),[h]=T.useMutation(dp),k=p.useCallback(()=>{p.startTransition(()=>{f({variables:{projectId:n}}),l()})},[f,n,l]),S=p.useCallback(()=>{p.startTransition(()=>{h({variables:{input:{id:n}},onCompleted:()=>{t()},onError:x=>{alert("Failed to clear project: "+x)}})})},[h,n,t]),C=p.useCallback(()=>{d(!0)},[]),P=p.useCallback(()=>{u(!0)},[]),L=p.useCallback(()=>{g(!0)},[]);return s("div",{onClick:x=>{x.preventDefault(),x.stopPropagation()},children:[s(Ma,{buttonVariant:r,buttonSize:"compact",align:"end",onAction:x=>{switch(x){case"copyName":{navigator.clipboard.writeText(a);return}case"deleteProject":return C();case"clearProject":return P();case"removeProjectData":return L()}},disabledKeys:m?[]:["deleteProject"],children:[e(je,{textValue:"Copy Name",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Si,{})}),e(F,{children:"Copy Name"})]})},"copyName"),e(je,{textValue:"Clear All Traces",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(no,{})}),e(F,{children:"Clear All Data"})]})},"clearProject"),e(je,{textValue:"Remove Data",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Bt,{})}),e(F,{children:"Remove Data"})]})},"removeProjectData"),m?e(je,{children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Je,{})}),e(F,{children:"Delete"})]})},"deleteProject"):null]}),e(J,{isOpen:o,onOpenChange:d,children:e(ne,{children:e(Z,{size:"M",children:e(X,{children:({close:x})=>s(re,{children:[s(se,{children:[e(oe,{children:"Delete Project"}),e(ue,{children:e(me,{slot:"close"})})]}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:`Are you sure you want to delete project ${a}? This cannot be undone.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{k(),x()},children:"Delete Project"})})})]})})})})}),e(J,{isOpen:c,onOpenChange:u,children:e(ne,{children:e(Z,{size:"M",children:e(X,{children:({close:x})=>s(re,{children:[s(se,{children:[e(oe,{children:"Clear Project"}),e(ue,{children:e(me,{slot:"close"})})]}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:`Are you sure you want to clear project ${a}? All traces and evaluations for this project will be deleted. This cannot be undone.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{S(),x()},children:"Clear"})})})]})})})})}),e(J,{isOpen:y,onOpenChange:g,children:e(ne,{children:e(Z,{size:"M",children:e(X,{children:({close:x})=>s(re,{children:[s(se,{children:[e(oe,{children:"Remove Data"}),e(ue,{children:e(me,{slot:"close"})})]}),e(A2,{projectId:n,onComplete:()=>{i(),x()}})]})})})})})]})}const w2=200;function R2({onChange:n}){const a=p.useMemo(()=>zl(t=>{p.startTransition(()=>{n(t)})},w2),[n]),l=p.useCallback(t=>{a(t)},[a]);return e(ie,{size:"S",css:K`
6479
6479
  flex-basis: 100%;
6480
- `,"aria-label":"Search projects by name",name:"filter",type:"search",onChange:l,children:e(ae,{placeholder:"Search projects by name"})})}const Di=10,Ir=()=>{const{projectSortOrder:n}=bn(l=>({projectViewMode:l.projectViewMode,projectSortOrder:l.projectSortOrder}));return p.useMemo(()=>({sort:{col:n.column,dir:n.direction}}),[n])};function NI(){const{timeRange:n}=zt(),a=Ir(),[l]=p.useState(()=>a),t=P.useLazyLoadQuery(op,{first:Di,filter:{value:"",col:"name"},...l});return e(p.Suspense,{fallback:e(pe,{}),children:e(E2,{timeRange:n,query:t})})}function E2({timeRange:n,query:a}){const{projectViewMode:l}=bn(I=>({projectViewMode:I.projectViewMode})),t=Ir(),[i,r]=p.useState(""),[o,d]=Gy(),c=p.useMemo(()=>{var I,M;return{start:(I=n==null?void 0:n.start)==null?void 0:I.toISOString(),end:(M=n==null?void 0:n.end)==null?void 0:M.toISOString()}},[n]),{data:u,loadNext:y,hasNext:g,isLoadingNext:m,refetch:f}=P.usePaginationFragment(sp,a),h=p.useMemo(()=>({...t,filter:{value:i,col:"name"}}),[t,i]),k=p.useCallback(({vars:I,onComplete:M})=>{p.startTransition(()=>{f({...h,...I},{fetchPolicy:"store-and-network",onComplete:()=>{M==null||M()}})})},[f,h]),S=u==null?void 0:u.projects.edges.map(I=>I.project),C=p.useRef(null),T=p.useCallback(I=>{if(I){const{scrollHeight:M,scrollTop:z,clientHeight:A}=I;M-z-A<300&&!m&&g&&y(Di,{UNSTABLE_extraVariables:h})}},[g,m,y,h]),_=p.useCallback(I=>{k({vars:{sort:I}})},[k]),x=p.useCallback(I=>{p.startTransition(()=>{k({onComplete:()=>{o({variant:"success",title:"Project Deleted",message:`Project ${I} has been deleted.`})}})})},[o,k]),N=p.useCallback(I=>{p.startTransition(()=>{k({onComplete:()=>{o({variant:"success",title:"Project Cleared",message:`Project ${I} has been cleared of traces.`})}})})},[o,k]),w=p.useCallback(I=>{p.startTransition(()=>{k({onComplete:()=>{o({variant:"success",title:"Project Data Removed",message:`Old data from project ${I} have been removed.`})}})})},[o,k]),$=p.useCallback(()=>{y(Di,{UNSTABLE_extraVariables:h})},[y,h]);return s("div",{css:K`
6480
+ `,"aria-label":"Search projects by name",name:"filter",type:"search",onChange:l,children:e(ae,{placeholder:"Search projects by name"})})}const Di=10,Ir=()=>{const{projectSortOrder:n}=bn(l=>({projectViewMode:l.projectViewMode,projectSortOrder:l.projectSortOrder}));return p.useMemo(()=>({sort:{col:n.column,dir:n.direction}}),[n])};function NI(){const{timeRange:n}=zt(),a=Ir(),[l]=p.useState(()=>a),t=T.useLazyLoadQuery(op,{first:Di,filter:{value:"",col:"name"},...l});return e(p.Suspense,{fallback:e(pe,{}),children:e(E2,{timeRange:n,query:t})})}function E2({timeRange:n,query:a}){const{projectViewMode:l}=bn(I=>({projectViewMode:I.projectViewMode})),t=Ir(),[i,r]=p.useState(""),[o,d]=Gy(),c=p.useMemo(()=>{var I,M;return{start:(I=n==null?void 0:n.start)==null?void 0:I.toISOString(),end:(M=n==null?void 0:n.end)==null?void 0:M.toISOString()}},[n]),{data:u,loadNext:y,hasNext:g,isLoadingNext:m,refetch:f}=T.usePaginationFragment(sp,a),h=p.useMemo(()=>({...t,filter:{value:i,col:"name"}}),[t,i]),k=p.useCallback(({vars:I,onComplete:M})=>{p.startTransition(()=>{f({...h,...I},{fetchPolicy:"store-and-network",onComplete:()=>{M==null||M()}})})},[f,h]),S=u==null?void 0:u.projects.edges.map(I=>I.project),C=p.useRef(null),P=p.useCallback(I=>{if(I){const{scrollHeight:M,scrollTop:z,clientHeight:A}=I;M-z-A<300&&!m&&g&&y(Di,{UNSTABLE_extraVariables:h})}},[g,m,y,h]),L=p.useCallback(I=>{k({vars:{sort:I}})},[k]),x=p.useCallback(I=>{p.startTransition(()=>{k({onComplete:()=>{o({variant:"success",title:"Project Deleted",message:`Project ${I} has been deleted.`})}})})},[o,k]),N=p.useCallback(I=>{p.startTransition(()=>{k({onComplete:()=>{o({variant:"success",title:"Project Cleared",message:`Project ${I} has been cleared of traces.`})}})})},[o,k]),w=p.useCallback(I=>{p.startTransition(()=>{k({onComplete:()=>{o({variant:"success",title:"Project Data Removed",message:`Old data from project ${I} have been removed.`})}})})},[o,k]),$=p.useCallback(()=>{y(Di,{UNSTABLE_extraVariables:h})},[y,h]);return s("div",{css:K`
6481
6481
  display: flex;
6482
6482
  flex-direction: column;
6483
6483
  overflow: auto;
6484
- `,onScroll:I=>T(I.target),ref:C,children:[e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",width:"100%",borderBottomColor:"grey-200",borderBottomWidth:"thin",flex:"none",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:"size-100",children:[e(R2,{onChange:I=>{r(I),k({vars:{filter:{value:I,col:"name"}}})}}),s(b,{direction:"row",justifyContent:"end",alignItems:"center",gap:"size-100",css:K`
6484
+ `,onScroll:I=>P(I.target),ref:C,children:[e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",width:"100%",borderBottomColor:"grey-200",borderBottomWidth:"thin",flex:"none",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:"size-100",children:[e(R2,{onChange:I=>{r(I),k({vars:{filter:{value:I,col:"name"}}})}}),s(b,{direction:"row",justifyContent:"end",alignItems:"center",gap:"size-100",css:K`
6485
6485
  button {
6486
6486
  text-wrap: nowrap;
6487
6487
  }
@@ -6489,11 +6489,11 @@ fragment ProjectsPageProjectsFragment_1bvy9D on Query {
6489
6489
  display: flex;
6490
6490
  flex-direction: column;
6491
6491
  flex: 1 1 auto;
6492
- `,children:e(M2,{projects:S,onDelete:x,onClear:N,onRemove:w,timeRangeVariable:c,hasNext:g,loadNext:$,isLoadingNext:m,onSort:_})}):e("div",{css:K`
6492
+ `,children:e(M2,{projects:S,onDelete:x,onClear:N,onRemove:w,timeRangeVariable:c,hasNext:g,loadNext:$,isLoadingNext:m,onSort:L})}):e("div",{css:K`
6493
6493
  display: flex;
6494
6494
  flex-direction: column;
6495
6495
  flex: 1 1 auto;
6496
- `,children:e(O2,{projects:S,onDelete:x,onClear:N,onRemove:w,timeRangeVariable:c,hasNext:g,loadNext:$,isLoadingNext:m,onSort:_})}),d]})}function M2({projects:n,onDelete:a,onClear:l,onRemove:t,timeRangeVariable:i,hasNext:r,loadNext:o,isLoadingNext:d}){return s(v,{padding:"size-200",width:"100%",children:[e("ul",{css:K`
6496
+ `,children:e(O2,{projects:S,onDelete:x,onClear:N,onRemove:w,timeRangeVariable:c,hasNext:g,loadNext:$,isLoadingNext:m,onSort:L})}),d]})}function M2({projects:n,onDelete:a,onClear:l,onRemove:t,timeRangeVariable:i,hasNext:r,loadNext:o,isLoadingNext:d}){return s(v,{padding:"size-200",width:"100%",children:[e("ul",{css:K`
6497
6497
  display: grid;
6498
6498
  grid-template-columns: repeat(
6499
6499
  auto-fill,
@@ -6545,13 +6545,13 @@ fragment ProjectsPageProjectsFragment_1bvy9D on Query {
6545
6545
  -webkit-box-orient: vertical;
6546
6546
  -webkit-line-clamp: 1;
6547
6547
  overflow: hidden;
6548
- `,children:n.name}),e(F,{color:"text-700",size:"XS",fontStyle:"italic",children:c})]})]}),e(mp,{projectId:n.id,projectName:n.name,onProjectDelete:a,onProjectClear:l,onProjectRemoveData:t})]}),e(pp,{projectId:n.id,timeRange:i})]})}const z2=ip;function N2(){return s(b,{direction:"row",justifyContent:"space-between",minHeight:"size-600",children:[s(b,{direction:"column",flex:"none",gap:"size-100",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Total Traces"}),e(Ur,{width:60,height:20,animation:"wave"})]}),s(b,{direction:"column",flex:"none",gap:"size-100",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Latency P50"}),e(Ur,{width:60,height:20,animation:"wave"})]})]})}const pp=p.memo(function({projectId:a,timeRange:l,flexProps:t}){const i=P.useRelayEnvironment(),r=p.useRef(null),[o,d]=p.useState(null),c=p.useCallback(()=>(d(null),P.fetchQuery(i,z2,{id:a,timeRange:l}).subscribe({next:g=>{d(g)},error:()=>{d(null)}})),[a,l,i]);return p.useEffect(()=>(r.current=c(),()=>{var u;(u=r.current)==null||u.unsubscribe(),r.current=null}),[c]),o==null?e(N2,{}):e($2,{project:o,flexProps:t})});function $2({project:n,flexProps:a}){const{project:{traceCount:l,latencyMsP50:t}}=n;return s(b,{direction:"row",justifyContent:"space-between",minHeight:"size-600",...a,children:[s(b,{direction:"column",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Total Traces"}),e(F,{size:"L",children:Bl(l)})]}),s(b,{direction:"column",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Latency P50"}),t!=null?e(Ye,{latencyMs:t,size:"L"}):e(F,{size:"L",children:"--"})]})]})}const j2=["name","endTime"];function O2({projects:n,onDelete:a,onClear:l,onRemove:t,timeRangeVariable:i,hasNext:r,loadNext:o,isLoadingNext:d,onSort:c}){const u=be(),y=p.useMemo(()=>[{header:"name",accessorKey:"name",maxSize:135,cell:({row:T})=>s(b,{direction:"row",gap:"size-200",alignItems:"center",children:[e(gp,{gradientStartColor:T.original.gradientStartColor,gradientEndColor:T.original.gradientEndColor}),e(Oe,{to:`/projects/${T.original.id}`,children:e(Xe,{maxWidth:"300px",children:T.original.name})})]})},{header:"last updated at",accessorKey:"endTime",maxSize:30,cell:we},{header:"metrics",id:"metrics",enableSorting:!1,cell:({row:T})=>e("div",{css:K`
6548
+ `,children:n.name}),e(F,{color:"text-700",size:"XS",fontStyle:"italic",children:c})]})]}),e(mp,{projectId:n.id,projectName:n.name,onProjectDelete:a,onProjectClear:l,onProjectRemoveData:t})]}),e(pp,{projectId:n.id,timeRange:i})]})}const z2=ip;function N2(){return s(b,{direction:"row",justifyContent:"space-between",minHeight:"size-600",children:[s(b,{direction:"column",flex:"none",gap:"size-100",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Total Traces"}),e(Ur,{width:60,height:20,animation:"wave"})]}),s(b,{direction:"column",flex:"none",gap:"size-100",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Latency P50"}),e(Ur,{width:60,height:20,animation:"wave"})]})]})}const pp=p.memo(function({projectId:a,timeRange:l,flexProps:t}){const i=T.useRelayEnvironment(),r=p.useRef(null),[o,d]=p.useState(null),c=p.useCallback(()=>(d(null),T.fetchQuery(i,z2,{id:a,timeRange:l}).subscribe({next:g=>{d(g)},error:()=>{d(null)}})),[a,l,i]);return p.useEffect(()=>(r.current=c(),()=>{var u;(u=r.current)==null||u.unsubscribe(),r.current=null}),[c]),o==null?e(N2,{}):e($2,{project:o,flexProps:t})});function $2({project:n,flexProps:a}){const{project:{traceCount:l,latencyMsP50:t}}=n;return s(b,{direction:"row",justifyContent:"space-between",minHeight:"size-600",...a,children:[s(b,{direction:"column",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Total Traces"}),e(F,{size:"L",children:Bl(l)})]}),s(b,{direction:"column",children:[e(F,{elementType:"h3",size:"S",color:"text-700",children:"Latency P50"}),t!=null?e(Ye,{latencyMs:t,size:"L"}):e(F,{size:"L",children:"--"})]})]})}const j2=["name","endTime"];function O2({projects:n,onDelete:a,onClear:l,onRemove:t,timeRangeVariable:i,hasNext:r,loadNext:o,isLoadingNext:d,onSort:c}){const u=be(),y=p.useMemo(()=>[{header:"name",accessorKey:"name",maxSize:135,cell:({row:P})=>s(b,{direction:"row",gap:"size-200",alignItems:"center",children:[e(gp,{gradientStartColor:P.original.gradientStartColor,gradientEndColor:P.original.gradientEndColor}),e(Oe,{to:`/projects/${P.original.id}`,children:e(Xe,{maxWidth:"300px",children:P.original.name})})]})},{header:"last updated at",accessorKey:"endTime",maxSize:30,cell:we},{header:"metrics",id:"metrics",enableSorting:!1,cell:({row:P})=>e("div",{css:K`
6549
6549
  max-width: 100%;
6550
- `,children:e(pp,{flexProps:{justifyContent:"start",gap:"size-800",rowGap:"size-100"},projectId:T.original.id,timeRange:i})})},{header:"",id:"actions",enableSorting:!1,size:10,maxSize:10,minSize:10,cell:({row:T})=>e(mp,{variant:"default",projectId:T.original.id,projectName:T.original.name,onProjectClear:()=>l(T.original.name),onProjectRemoveData:()=>t(T.original.name),onProjectDelete:()=>a(T.original.name)})}],[i,l,a,t]),g=Ir(),{setProjectSortOrder:m}=bn(T=>({setProjectSortOrder:T.setProjectSortOrder})),f=p.useMemo(()=>[{id:g.sort.col,desc:g.sort.dir==="desc"}],[g.sort.col,g.sort.dir]),h=p.useCallback(T=>{if(typeof T=="function"){const _=T(f),[x]=_;if(x==null)return;const N=x.id;if(!j2.includes(N))return;c({col:N,dir:x.desc?"desc":"asc"}),m({column:N,direction:x.desc?"desc":"asc"})}},[m,f,c]),k=Le({data:n,columns:y,getCoreRowModel:_e(),state:{sorting:f},enableSortingRemoval:!1,onSortingChange:h}),C=k.getRowModel().rows.length===0;return e(v,{flex:"none",height:"100%",width:"100%",children:s("div",{css:K`
6550
+ `,children:e(pp,{flexProps:{justifyContent:"start",gap:"size-800",rowGap:"size-100"},projectId:P.original.id,timeRange:i})})},{header:"",id:"actions",enableSorting:!1,size:10,maxSize:10,minSize:10,cell:({row:P})=>e(mp,{variant:"default",projectId:P.original.id,projectName:P.original.name,onProjectClear:()=>l(P.original.name),onProjectRemoveData:()=>t(P.original.name),onProjectDelete:()=>a(P.original.name)})}],[i,l,a,t]),g=Ir(),{setProjectSortOrder:m}=bn(P=>({setProjectSortOrder:P.setProjectSortOrder})),f=p.useMemo(()=>[{id:g.sort.col,desc:g.sort.dir==="desc"}],[g.sort.col,g.sort.dir]),h=p.useCallback(P=>{if(typeof P=="function"){const L=P(f),[x]=L;if(x==null)return;const N=x.id;if(!j2.includes(N))return;c({col:N,dir:x.desc?"desc":"asc"}),m({column:N,direction:x.desc?"desc":"asc"})}},[m,f,c]),k=Le({data:n,columns:y,getCoreRowModel:_e(),state:{sorting:f},enableSortingRemoval:!1,onSortingChange:h}),C=k.getRowModel().rows.length===0;return e(v,{flex:"none",height:"100%",width:"100%",children:s("div",{css:K`
6551
6551
  flex: 1 1 auto;
6552
6552
  height: 100%;
6553
6553
  width: 100%;
6554
- `,children:[s("table",{css:nn,"data-testid":"projects-table",children:[e("thead",{children:k.getHeaderGroups().map(T=>e("tr",{children:T.headers.map(_=>e("th",{colSpan:_.colSpan,style:{width:_.getSize()},children:_.isPlaceholder?null:s("div",{className:_.column.getCanSort()?"sort":"",onClick:_.column.getToggleSortingHandler(),style:{left:_.getStart(),width:_.getSize(),textWrap:"nowrap"},children:[ee(_.column.columnDef.header,_.getContext()),_.column.getIsSorted()?e(D,{className:"sort-icon",svg:_.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},_.id))},T.id))}),C?e(vn,{}):e("tbody",{children:k.getRowModel().rows.map(T=>e("tr",{onClick:()=>{u(`/projects/${T.original.id}`)},children:T.getVisibleCells().map(_=>e("td",{style:{width:_.column.getSize(),maxWidth:_.column.getSize()},children:ee(_.column.columnDef.cell,_.getContext())},_.id))},T.id))})]}),r?e(v,{paddingY:"size-200",children:e(b,{direction:"row",justifyContent:"center",alignItems:"center",width:"100%",children:e(qo,{onLoadMore:o,isLoadingNext:d})})}):null]})})}const yp=function(){var n=[{kind:"Literal",name:"first",value:100},{kind:"Literal",name:"sort",value:{col:"createdAt",dir:"desc"}}];return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DatasetsPageQuery",selections:[{args:null,kind:"FragmentSpread",name:"DatasetsTable_datasets"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"DatasetsPageQuery",selections:[{alias:null,args:n,concreteType:"DatasetConnection",kind:"LinkedField",name:"datasets",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Dataset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"exampleCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimentCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:'datasets(first:100,sort:{"col":"createdAt","dir":"desc"})'},{alias:null,args:n,filters:["sort","filter"],handle:"connection",key:"DatasetsTable_datasets",kind:"LinkedHandle",name:"datasets"}]},params:{cacheID:"695b221e981c4795492d79faa7d007e4",id:null,metadata:{},name:"DatasetsPageQuery",operationKind:"query",text:`query DatasetsPageQuery {
6554
+ `,children:[s("table",{css:nn,"data-testid":"projects-table",children:[e("thead",{children:k.getHeaderGroups().map(P=>e("tr",{children:P.headers.map(L=>e("th",{colSpan:L.colSpan,style:{width:L.getSize()},children:L.isPlaceholder?null:s("div",{className:L.column.getCanSort()?"sort":"",onClick:L.column.getToggleSortingHandler(),style:{left:L.getStart(),width:L.getSize(),textWrap:"nowrap"},children:[ee(L.column.columnDef.header,L.getContext()),L.column.getIsSorted()?e(D,{className:"sort-icon",svg:L.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},L.id))},P.id))}),C?e(vn,{}):e("tbody",{children:k.getRowModel().rows.map(P=>e("tr",{onClick:()=>{u(`/projects/${P.original.id}`)},children:P.getVisibleCells().map(L=>e("td",{style:{width:L.column.getSize(),maxWidth:L.column.getSize()},children:ee(L.column.columnDef.cell,L.getContext())},L.id))},P.id))})]}),r?e(v,{paddingY:"size-200",children:e(b,{direction:"row",justifyContent:"center",alignItems:"center",width:"100%",children:e(qo,{onLoadMore:o,isLoadingNext:d})})}):null]})})}const yp=function(){var n=[{kind:"Literal",name:"first",value:100},{kind:"Literal",name:"sort",value:{col:"createdAt",dir:"desc"}}];return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DatasetsPageQuery",selections:[{args:null,kind:"FragmentSpread",name:"DatasetsTable_datasets"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"DatasetsPageQuery",selections:[{alias:null,args:n,concreteType:"DatasetConnection",kind:"LinkedField",name:"datasets",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Dataset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"exampleCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimentCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:'datasets(first:100,sort:{"col":"createdAt","dir":"desc"})'},{alias:null,args:n,filters:["sort","filter"],handle:"connection",key:"DatasetsTable_datasets",kind:"LinkedHandle",name:"datasets"}]},params:{cacheID:"695b221e981c4795492d79faa7d007e4",id:null,metadata:{},name:"DatasetsPageQuery",operationKind:"query",text:`query DatasetsPageQuery {
6555
6555
  ...DatasetsTable_datasets
6556
6556
  }
6557
6557
 
@@ -6587,7 +6587,7 @@ fragment DatasetsTable_datasets on Query {
6587
6587
  flex-direction: column;
6588
6588
  gap: var(--ac-global-dimension-size-50);
6589
6589
  margin-bottom: var(--ac-global-dimension-size-200);
6590
- `),children:[e(W,{children:"CSV file"}),e("input",{...h,onChange:k=>{var C;f(k.target.files),d("input_keys"),d("output_keys"),d("metadata_keys");const S=(C=k.target.files)==null?void 0:C[0];if(S){const T=S.name.split(".")[0],_=new FileReader;_.onload=function(x){if(!x.target)return;const N=x.target.result,w=Q2(N);i(w),c("name",T)},_.readAsText(S)}},type:"file",id:"file",accept:".csv"})]})}),e(G,{name:"name",control:r,rules:{required:"field is required"},render:({field:{onChange:m,onBlur:f,value:h},fieldState:{invalid:k,error:S}})=>s(ie,{isInvalid:k,onChange:m,onBlur:f,value:h.toString(),children:[e(W,{children:"Dataset Name"}),e(ae,{placeholder:"e.x. Golden Dataset"}),S!=null&&S.message?e(Ce,{children:S.message}):e(F,{slot:"description",children:"The name of the dataset"})]})}),e(G,{name:"description",control:r,render:({field:{onChange:m,onBlur:f,value:h},fieldState:{invalid:k,error:S}})=>s(ie,{isInvalid:k,onChange:m,onBlur:f,value:h.toString(),children:[e(W,{children:"Description"}),e(Ra,{placeholder:"e.x. A dataset for structured data extraction"}),S!=null&&S.message?e(Ce,{children:S.message}):e(F,{slot:"description",children:"The description of the dataset"})]})}),e(G,{name:"input_keys",control:r,rules:{required:"field is required"},render:({field:{value:m,onChange:f},fieldState:{invalid:h,error:k}})=>e(mi,{label:"input keys",validationState:h?"invalid":"valid",description:"the columns to use as input",columns:t,selectedColumns:m,onChange:f,errorMessage:k==null?void 0:k.message})}),e(G,{name:"output_keys",control:r,render:({field:{value:m,onChange:f},fieldState:{invalid:h,error:k}})=>e(mi,{label:"output keys",validationState:h?"invalid":"valid",description:"the columns to use as output",columns:t,selectedColumns:m,onChange:f,errorMessage:k==null?void 0:k.message})}),e(G,{name:"metadata_keys",control:r,render:({field:{value:m,onChange:f},fieldState:{invalid:h,error:k}})=>e(mi,{label:"metadata keys",validationState:h?"invalid":"valid",description:"the columns to use as metadata",columns:t,selectedColumns:m,onChange:f,errorMessage:k==null?void 0:k.message})})]}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{type:"submit",isDisabled:!y,variant:u?"primary":"default",size:"S",children:"Create Dataset"})})})]})}function mi(n){const{columns:a,selectedColumns:l,onChange:t,label:i,validationState:r,description:o,errorMessage:d,...c}=n,u=a.length===0,y=p.useMemo(()=>u?"No columns to select":l.length>0?`${l.join(", ")}`:"No columns selected",[l,u]);return e(yl,{label:i,isDisabled:u,validationState:r,description:o,errorMessage:d,children:e(Us,{isDisabled:u,...c,menu:e(wi,{selectionMode:"multiple",onSelectionChange:g=>{t(Array.from(g))},selectedKeys:new Set(l),children:a.map(g=>e(je,{children:g},g))}),triggerProps:{placement:"bottom end"},children:y})})}const q2=200;function U2({onChange:n,value:a}){const[l,t]=p.useState(a);p.useEffect(()=>{t(a)},[a]);const i=p.useMemo(()=>zl(o=>{p.startTransition(()=>{n(o)})},q2),[n]),r=p.useCallback(o=>{t(o),i(o)},[i]);return e(ie,{size:"S",css:K`
6590
+ `),children:[e(W,{children:"CSV file"}),e("input",{...h,onChange:k=>{var C;f(k.target.files),d("input_keys"),d("output_keys"),d("metadata_keys");const S=(C=k.target.files)==null?void 0:C[0];if(S){const P=S.name.split(".")[0],L=new FileReader;L.onload=function(x){if(!x.target)return;const N=x.target.result,w=Q2(N);i(w),c("name",P)},L.readAsText(S)}},type:"file",id:"file",accept:".csv"})]})}),e(G,{name:"name",control:r,rules:{required:"field is required"},render:({field:{onChange:m,onBlur:f,value:h},fieldState:{invalid:k,error:S}})=>s(ie,{isInvalid:k,onChange:m,onBlur:f,value:h.toString(),children:[e(W,{children:"Dataset Name"}),e(ae,{placeholder:"e.x. Golden Dataset"}),S!=null&&S.message?e(Ce,{children:S.message}):e(F,{slot:"description",children:"The name of the dataset"})]})}),e(G,{name:"description",control:r,render:({field:{onChange:m,onBlur:f,value:h},fieldState:{invalid:k,error:S}})=>s(ie,{isInvalid:k,onChange:m,onBlur:f,value:h.toString(),children:[e(W,{children:"Description"}),e(Ra,{placeholder:"e.x. A dataset for structured data extraction"}),S!=null&&S.message?e(Ce,{children:S.message}):e(F,{slot:"description",children:"The description of the dataset"})]})}),e(G,{name:"input_keys",control:r,rules:{required:"field is required"},render:({field:{value:m,onChange:f},fieldState:{invalid:h,error:k}})=>e(mi,{label:"input keys",validationState:h?"invalid":"valid",description:"the columns to use as input",columns:t,selectedColumns:m,onChange:f,errorMessage:k==null?void 0:k.message})}),e(G,{name:"output_keys",control:r,render:({field:{value:m,onChange:f},fieldState:{invalid:h,error:k}})=>e(mi,{label:"output keys",validationState:h?"invalid":"valid",description:"the columns to use as output",columns:t,selectedColumns:m,onChange:f,errorMessage:k==null?void 0:k.message})}),e(G,{name:"metadata_keys",control:r,render:({field:{value:m,onChange:f},fieldState:{invalid:h,error:k}})=>e(mi,{label:"metadata keys",validationState:h?"invalid":"valid",description:"the columns to use as metadata",columns:t,selectedColumns:m,onChange:f,errorMessage:k==null?void 0:k.message})})]}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{type:"submit",isDisabled:!y,variant:u?"primary":"default",size:"S",children:"Create Dataset"})})})]})}function mi(n){const{columns:a,selectedColumns:l,onChange:t,label:i,validationState:r,description:o,errorMessage:d,...c}=n,u=a.length===0,y=p.useMemo(()=>u?"No columns to select":l.length>0?`${l.join(", ")}`:"No columns selected",[l,u]);return e(yl,{label:i,isDisabled:u,validationState:r,description:o,errorMessage:d,children:e(Us,{isDisabled:u,...c,menu:e(wi,{selectionMode:"multiple",onSelectionChange:g=>{t(Array.from(g))},selectedKeys:new Set(l),children:a.map(g=>e(je,{children:g},g))}),triggerProps:{placement:"bottom end"},children:y})})}const q2=200;function U2({onChange:n,value:a}){const[l,t]=p.useState(a);p.useEffect(()=>{t(a)},[a]);const i=p.useMemo(()=>zl(o=>{p.startTransition(()=>{n(o)})},q2),[n]),r=p.useCallback(o=>{t(o),i(o)},[i]);return e(ie,{size:"S",css:K`
6591
6591
  width: 100%;
6592
6592
  `,"aria-label":"Search datasets by name",name:"filter",type:"search",value:l,onChange:r,children:e(ae,{placeholder:"Search datasets by name"})})}const fp=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:null,kind:"LocalArgument",name:"filter"},{defaultValue:100,kind:"LocalArgument",name:"first"},{defaultValue:{col:"createdAt",dir:"desc"},kind:"LocalArgument",name:"sort"}],a=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"filter",variableName:"filter"},{kind:"Variable",name:"first",variableName:"first"},{kind:"Variable",name:"sort",variableName:"sort"}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DatasetsTableDatasetsQuery",selections:[{args:a,kind:"FragmentSpread",name:"DatasetsTable_datasets"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DatasetsTableDatasetsQuery",selections:[{alias:null,args:a,concreteType:"DatasetConnection",kind:"LinkedField",name:"datasets",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Dataset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"exampleCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimentCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:a,filters:["sort","filter"],handle:"connection",key:"DatasetsTable_datasets",kind:"LinkedHandle",name:"datasets"}]},params:{cacheID:"08daa0d1d804707d650c0b689bcbd156",id:null,metadata:{},name:"DatasetsTableDatasetsQuery",operationKind:"query",text:`query DatasetsTableDatasetsQuery(
6593
6593
  $after: String = null
@@ -6626,10 +6626,10 @@ fragment DatasetsTable_datasets_3JsJJ3 on Query {
6626
6626
  __typename
6627
6627
  }
6628
6628
  }
6629
- `}}}();kp.hash="bd97316dd472eec18504f66e16088abc";function H2({datasetId:n,datasetName:a,onDatasetDelete:l,onDatasetDeleteError:t,isOpen:i,onOpenChange:r}){const[o,d]=P.useMutation(kp),c=p.useCallback(()=>{p.startTransition(()=>{o({variables:{datasetId:n},onCompleted:()=>{l(),r&&r(!1)},onError:u=>{t(u)}})})},[o,n,l,t,r]);return e(J,{isOpen:i,onOpenChange:r,children:e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Delete Dataset"}),e(ue,{children:e(me,{})})]}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:`Are you sure you want to delete dataset ${a}? This will also delete all associated experiments and traces, and it cannot be undone.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{size:"S",onPress:()=>r==null?void 0:r(!1),children:"Cancel"}),e(E,{variant:"danger",size:"S",onPress:()=>{c()},isDisabled:d,leadingVisual:e(D,{svg:d?e(yn,{}):e(Je,{})}),children:"Delete Dataset"})]})})]})})})})})}function G2({datasetName:n,datasetId:a,datasetDescription:l,datasetMetadata:t,onDatasetEdited:i,onDatasetEditError:r,isOpen:o,onOpenChange:d}){return e(J,{isOpen:o,onOpenChange:d,children:e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Edit Dataset"}),e(ue,{children:e(me,{})})]}),e(ck,{datasetName:n,datasetId:a,datasetDescription:l,datasetMetadata:t,onDatasetEdited:()=>{i(),d&&d(!1)},onDatasetEditError:r})]})})})})})}function W2(n){const{datasetId:a,datasetName:l,datasetDescription:t,datasetMetadata:i,onDatasetDelete:r,onDatasetDeleteError:o,onDatasetEdit:d,onDatasetEditError:c}=n,[u,y]=p.useState(!1),[g,m]=p.useState(!1);return s("div",{onClick:f=>{f.preventDefault(),f.stopPropagation()},children:[s(Ma,{align:"end",buttonSize:"compact",onAction:f=>{switch(f){case"deleteDataset":y(!0);break;case"editDataset":m(!0);break}},children:[e(je,{children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(_t,{})}),e(F,{children:"Edit"})]})},"editDataset"),e(je,{children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Je,{})}),e(F,{children:"Delete"})]})},"deleteDataset")]}),e(H2,{datasetId:a,datasetName:l,onDatasetDelete:r,onDatasetDeleteError:o,isOpen:u,onOpenChange:y}),e(G2,{datasetId:a,datasetName:l,datasetDescription:t,datasetMetadata:i,onDatasetEdited:d,onDatasetEditError:c,isOpen:g,onOpenChange:m})]})}function J2(){return e(v,{width:"100%",paddingY:"size-400",children:e(b,{direction:"column",width:"100%",alignItems:"center",justifyContent:"center",children:e(v,{width:"100%",maxWidth:"780px",children:s(b,{direction:"column",gap:"size-400",alignItems:"center",children:[e(F,{size:"XL",children:"Create datasets for testing prompts, experimentation, and fine-tuning."}),e(ar,{src:"https://storage.googleapis.com/arize-phoenix-assets/assets/videos/datasets.mp4",autoPlay:!0,muted:!0,loop:!0}),s(b,{direction:"row",gap:"size-200",children:[e(cl,{href:"https://arize.com/docs/phoenix/datasets-and-experiments/overview-datasets",target:"_blank",leadingVisual:e(D,{svg:e(lr,{})}),children:"Documentation"}),e(cl,{href:"https://colab.research.google.com/github/arize-ai/phoenix/blob/main/tutorials/experiments/datasets_and_experiments_quickstart.ipynb",target:"_blank",leadingVisual:e(D,{svg:e(uk,{})}),children:"Quickstart"})]})]})})})})}const _s=100;function Z2(n){const a=n.id;if(a!=="createdAt"&&a!=="name")throw new Error("Invalid sort column");return{col:a,dir:n.desc?"desc":"asc"}}function X2(n){const{filter:a}=n,[l,t]=p.useState([]),i=p.useRef(null),r=be(),o=ke(),d=Fe(),{data:c,loadNext:u,hasNext:y,isLoadingNext:g,refetch:m}=P.usePaginationFragment(hp,n.query),f=p.useMemo(()=>c.datasets.edges.map(T=>T.node),[c]),h=p.useCallback(T=>{if(T){const{scrollHeight:_,scrollTop:x,clientHeight:N}=T;_-x-N<300&&!g&&y&&u(_s,{UNSTABLE_extraVariables:{filter:a?{col:"name",value:a}:null}})}},[y,g,u,a]),k=Le({columns:[{header:"name",accessorKey:"name",cell:({row:T})=>{const x=T.original.experimentCount>0?`${T.original.id}/experiments`:`${T.original.id}/examples`;return e(Oe,{to:x,children:T.original.name})}},{header:"description",accessorKey:"description",enableSorting:!1},{header:"created at",accessorKey:"createdAt",cell:we},{header:"example count",accessorKey:"exampleCount",enableSorting:!1,meta:{textAlign:"right"}},{header:"experiment count",accessorKey:"experimentCount",enableSorting:!1,meta:{textAlign:"right"}},{header:"metadata",accessorKey:"metadata",enableSorting:!1,cell:rl},{header:"",id:"actions",enableSorting:!1,size:10,cell:({row:T})=>e(W2,{datasetId:T.original.id,datasetName:T.original.name,datasetDescription:T.original.description,datasetMetadata:T.original.metadata,onDatasetEdit:()=>{o({title:"Dataset updated",message:`${T.original.name} has been successfully updated.`}),m({filter:a?{col:"name",value:a}:null},{fetchPolicy:"store-and-network"})},onDatasetEditError:_=>{const x=Re(_);d({title:"Dataset update failed",message:(x==null?void 0:x[0])??_.message})},onDatasetDelete:()=>{o({title:"Dataset deleted",message:`${T.original.name} has been successfully deleted.`}),m({filter:a?{col:"name",value:a}:null},{fetchPolicy:"store-and-network"})},onDatasetDeleteError:_=>{const x=Re(_);d({title:"Dataset deletion failed",message:(x==null?void 0:x[0])??_.message})}})}],data:f,state:{sorting:l},getCoreRowModel:_e(),getSortedRowModel:sn(),onSortingChange:t,manualSorting:!0});p.useEffect(()=>{const T=l[0];p.startTransition(()=>{m({sort:T?Z2(T):{col:"createdAt",dir:"desc"},after:null,first:_s,filter:a?{col:"name",value:a}:null},{fetchPolicy:"store-and-network"})})},[l,m,a]);const S=k.getRowModel().rows,C=S.length===0;return e("div",{css:K`
6629
+ `}}}();kp.hash="bd97316dd472eec18504f66e16088abc";function H2({datasetId:n,datasetName:a,onDatasetDelete:l,onDatasetDeleteError:t,isOpen:i,onOpenChange:r}){const[o,d]=T.useMutation(kp),c=p.useCallback(()=>{p.startTransition(()=>{o({variables:{datasetId:n},onCompleted:()=>{l(),r&&r(!1)},onError:u=>{t(u)}})})},[o,n,l,t,r]);return e(J,{isOpen:i,onOpenChange:r,children:e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Delete Dataset"}),e(ue,{children:e(me,{})})]}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:`Are you sure you want to delete dataset ${a}? This will also delete all associated experiments and traces, and it cannot be undone.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{size:"S",onPress:()=>r==null?void 0:r(!1),children:"Cancel"}),e(E,{variant:"danger",size:"S",onPress:()=>{c()},isDisabled:d,leadingVisual:e(D,{svg:d?e(yn,{}):e(Je,{})}),children:"Delete Dataset"})]})})]})})})})})}function G2({datasetName:n,datasetId:a,datasetDescription:l,datasetMetadata:t,onDatasetEdited:i,onDatasetEditError:r,isOpen:o,onOpenChange:d}){return e(J,{isOpen:o,onOpenChange:d,children:e(ne,{children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Edit Dataset"}),e(ue,{children:e(me,{})})]}),e(ck,{datasetName:n,datasetId:a,datasetDescription:l,datasetMetadata:t,onDatasetEdited:()=>{i(),d&&d(!1)},onDatasetEditError:r})]})})})})})}function W2(n){const{datasetId:a,datasetName:l,datasetDescription:t,datasetMetadata:i,onDatasetDelete:r,onDatasetDeleteError:o,onDatasetEdit:d,onDatasetEditError:c}=n,[u,y]=p.useState(!1),[g,m]=p.useState(!1);return s("div",{onClick:f=>{f.preventDefault(),f.stopPropagation()},children:[s(Ma,{align:"end",buttonSize:"compact",onAction:f=>{switch(f){case"deleteDataset":y(!0);break;case"editDataset":m(!0);break}},children:[e(je,{children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(_t,{})}),e(F,{children:"Edit"})]})},"editDataset"),e(je,{children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Je,{})}),e(F,{children:"Delete"})]})},"deleteDataset")]}),e(H2,{datasetId:a,datasetName:l,onDatasetDelete:r,onDatasetDeleteError:o,isOpen:u,onOpenChange:y}),e(G2,{datasetId:a,datasetName:l,datasetDescription:t,datasetMetadata:i,onDatasetEdited:d,onDatasetEditError:c,isOpen:g,onOpenChange:m})]})}function J2(){return e(v,{width:"100%",paddingY:"size-400",children:e(b,{direction:"column",width:"100%",alignItems:"center",justifyContent:"center",children:e(v,{width:"100%",maxWidth:"780px",children:s(b,{direction:"column",gap:"size-400",alignItems:"center",children:[e(F,{size:"XL",children:"Create datasets for testing prompts, experimentation, and fine-tuning."}),e(ar,{src:"https://storage.googleapis.com/arize-phoenix-assets/assets/videos/datasets.mp4",autoPlay:!0,muted:!0,loop:!0}),s(b,{direction:"row",gap:"size-200",children:[e(cl,{href:"https://arize.com/docs/phoenix/datasets-and-experiments/overview-datasets",target:"_blank",leadingVisual:e(D,{svg:e(lr,{})}),children:"Documentation"}),e(cl,{href:"https://colab.research.google.com/github/arize-ai/phoenix/blob/main/tutorials/experiments/datasets_and_experiments_quickstart.ipynb",target:"_blank",leadingVisual:e(D,{svg:e(uk,{})}),children:"Quickstart"})]})]})})})})}const _s=100;function Z2(n){const a=n.id;if(a!=="createdAt"&&a!=="name")throw new Error("Invalid sort column");return{col:a,dir:n.desc?"desc":"asc"}}function X2(n){const{filter:a}=n,[l,t]=p.useState([]),i=p.useRef(null),r=be(),o=ke(),d=Fe(),{data:c,loadNext:u,hasNext:y,isLoadingNext:g,refetch:m}=T.usePaginationFragment(hp,n.query),f=p.useMemo(()=>c.datasets.edges.map(P=>P.node),[c]),h=p.useCallback(P=>{if(P){const{scrollHeight:L,scrollTop:x,clientHeight:N}=P;L-x-N<300&&!g&&y&&u(_s,{UNSTABLE_extraVariables:{filter:a?{col:"name",value:a}:null}})}},[y,g,u,a]),k=Le({columns:[{header:"name",accessorKey:"name",cell:({row:P})=>{const x=P.original.experimentCount>0?`${P.original.id}/experiments`:`${P.original.id}/examples`;return e(Oe,{to:x,children:P.original.name})}},{header:"description",accessorKey:"description",enableSorting:!1},{header:"created at",accessorKey:"createdAt",cell:we},{header:"example count",accessorKey:"exampleCount",enableSorting:!1,meta:{textAlign:"right"}},{header:"experiment count",accessorKey:"experimentCount",enableSorting:!1,meta:{textAlign:"right"}},{header:"metadata",accessorKey:"metadata",enableSorting:!1,cell:rl},{header:"",id:"actions",enableSorting:!1,size:10,cell:({row:P})=>e(W2,{datasetId:P.original.id,datasetName:P.original.name,datasetDescription:P.original.description,datasetMetadata:P.original.metadata,onDatasetEdit:()=>{o({title:"Dataset updated",message:`${P.original.name} has been successfully updated.`}),m({filter:a?{col:"name",value:a}:null},{fetchPolicy:"store-and-network"})},onDatasetEditError:L=>{const x=Re(L);d({title:"Dataset update failed",message:(x==null?void 0:x[0])??L.message})},onDatasetDelete:()=>{o({title:"Dataset deleted",message:`${P.original.name} has been successfully deleted.`}),m({filter:a?{col:"name",value:a}:null},{fetchPolicy:"store-and-network"})},onDatasetDeleteError:L=>{const x=Re(L);d({title:"Dataset deletion failed",message:(x==null?void 0:x[0])??L.message})}})}],data:f,state:{sorting:l},getCoreRowModel:_e(),getSortedRowModel:sn(),onSortingChange:t,manualSorting:!0});p.useEffect(()=>{const P=l[0];p.startTransition(()=>{m({sort:P?Z2(P):{col:"createdAt",dir:"desc"},after:null,first:_s,filter:a?{col:"name",value:a}:null},{fetchPolicy:"store-and-network"})})},[l,m,a]);const S=k.getRowModel().rows,C=S.length===0;return e("div",{css:K`
6630
6630
  flex: 1 1 auto;
6631
6631
  overflow: auto;
6632
- `,onScroll:T=>h(T.target),ref:i,children:s("table",{css:la,children:[e("thead",{children:k.getHeaderGroups().map(T=>e("tr",{children:T.headers.map(_=>{var x;return e("th",{colSpan:_.colSpan,children:_.isPlaceholder?null:s("div",{className:_.column.getCanSort()?"sort":"",onClick:_.column.getToggleSortingHandler(),style:{textAlign:(x=_.column.columnDef.meta)==null?void 0:x.textAlign},children:[ee(_.column.columnDef.header,_.getContext()),_.column.getIsSorted()?e(D,{className:"sort-icon",svg:_.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},_.id)})},T.id))}),C?e(mk,{children:e(J2,{})}):e("tbody",{children:S.map(T=>e("tr",{onClick:()=>{const x=T.original.experimentCount>0?`${T.original.id}/experiments`:`${T.original.id}/examples`;r(x)},children:T.getVisibleCells().map(_=>{var x;return e("td",{align:(x=_.column.columnDef.meta)==null?void 0:x.textAlign,children:ee(_.column.columnDef.cell,_.getContext())},_.id)})},T.id))})]})})}function $I(){return e(p.Suspense,{fallback:e(pe,{}),children:e(Y2,{})})}function Y2(){const[n,a]=p.useState(0),l=P.useLazyLoadQuery(yp,{},{fetchKey:n,fetchPolicy:"store-and-network"}),t=p.useCallback(()=>{a(i=>i+1)},[a]);return s(b,{direction:"column",height:"100%",children:[e(v,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",flex:"none",children:e(b,{direction:"column",gap:"size-200",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(de,{level:1,children:"Datasets"}),e(nT,{onDatasetCreated:t})]})})}),e(eT,{query:l})]})}function eT({query:n}){const[a,l]=p.useState("");return s(Y,{children:[e(v,{padding:"size-200",flex:"none",borderBottomWidth:"thin",borderBottomColor:"dark",children:e(U2,{onChange:l,value:a})}),e(X2,{query:n,filter:a})]})}function nT({onDatasetCreated:n}){const a=be(),l=ke(),t=Fe(),[i,r]=p.useState(null),o=()=>{r(e(wr,{size:"S",title:"New Dataset",children:e(Bo,{onDatasetCreated:c=>{l({title:"Dataset created",message:`${c.name} has been successfully created.`,action:{text:"Go to Dataset",onClick:()=>{a(`/datasets/${c.id}`)}}}),r(null),n()},onDatasetCreateError:c=>{const u=Re(c);t({title:"Dataset creation failed",message:(u==null?void 0:u[0])??c.message})}})}))},d=()=>{r(e(wr,{size:"M",title:"New Dataset from CSV",children:e(B2,{onDatasetCreated:c=>{l({title:"Dataset created",message:`${c.name} has been successfully created.`,action:{text:"Go to Dataset",onClick:()=>{a(`/datasets/${c.id}`)}}}),r(null),n()},onDatasetCreateError:c=>{const u=Re(c);t({title:"Dataset creation failed",message:(u==null?void 0:u[0])??c.message})}})}))};return s(Y,{children:[s(Ma,{buttonText:"Create Dataset",align:"end",icon:e(D,{svg:e(xt,{})}),onAction:c=>{switch(c){case"newDataset":o();break;case"datasetFromCSV":d();break}},children:[e(je,{children:"New Dataset"},"newDataset"),e(je,{children:"Dataset from CSV"},"datasetFromCSV")]}),e(pl,{type:"modal",isDismissable:!0,onDismiss:()=>r(null),children:i})]})}const bp=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"datasetId"}],a=[{kind:"Variable",name:"id",variableName:"datasetId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:1},{kind:"Literal",name:"sort",value:{col:"createdAt",dir:"desc"}}],concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"versions",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"DatasetVersion",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:'versions(first:1,sort:{"col":"createdAt","dir":"desc"})'}],type:"Dataset",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"datasetStore_latestVersionQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"datasetStore_latestVersionQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,t],storageKey:null}]},params:{cacheID:"8d1b89f8e5b4cd2774b9862c9aff1d3e",id:null,metadata:{},name:"datasetStore_latestVersionQuery",operationKind:"query",text:`query datasetStore_latestVersionQuery(
6632
+ `,onScroll:P=>h(P.target),ref:i,children:s("table",{css:la,children:[e("thead",{children:k.getHeaderGroups().map(P=>e("tr",{children:P.headers.map(L=>{var x;return e("th",{colSpan:L.colSpan,children:L.isPlaceholder?null:s("div",{className:L.column.getCanSort()?"sort":"",onClick:L.column.getToggleSortingHandler(),style:{textAlign:(x=L.column.columnDef.meta)==null?void 0:x.textAlign},children:[ee(L.column.columnDef.header,L.getContext()),L.column.getIsSorted()?e(D,{className:"sort-icon",svg:L.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},L.id)})},P.id))}),C?e(mk,{children:e(J2,{})}):e("tbody",{children:S.map(P=>e("tr",{onClick:()=>{const x=P.original.experimentCount>0?`${P.original.id}/experiments`:`${P.original.id}/examples`;r(x)},children:P.getVisibleCells().map(L=>{var x;return e("td",{align:(x=L.column.columnDef.meta)==null?void 0:x.textAlign,children:ee(L.column.columnDef.cell,L.getContext())},L.id)})},P.id))})]})})}function $I(){return e(p.Suspense,{fallback:e(pe,{}),children:e(Y2,{})})}function Y2(){const[n,a]=p.useState(0),l=T.useLazyLoadQuery(yp,{},{fetchKey:n,fetchPolicy:"store-and-network"}),t=p.useCallback(()=>{a(i=>i+1)},[a]);return s(b,{direction:"column",height:"100%",children:[e(v,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",flex:"none",children:e(b,{direction:"column",gap:"size-200",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(de,{level:1,children:"Datasets"}),e(nT,{onDatasetCreated:t})]})})}),e(eT,{query:l})]})}function eT({query:n}){const[a,l]=p.useState("");return s(Y,{children:[e(v,{padding:"size-200",flex:"none",borderBottomWidth:"thin",borderBottomColor:"dark",children:e(U2,{onChange:l,value:a})}),e(X2,{query:n,filter:a})]})}function nT({onDatasetCreated:n}){const a=be(),l=ke(),t=Fe(),[i,r]=p.useState(null),o=()=>{r(e(wr,{size:"S",title:"New Dataset",children:e(Bo,{onDatasetCreated:c=>{l({title:"Dataset created",message:`${c.name} has been successfully created.`,action:{text:"Go to Dataset",onClick:()=>{a(`/datasets/${c.id}`)}}}),r(null),n()},onDatasetCreateError:c=>{const u=Re(c);t({title:"Dataset creation failed",message:(u==null?void 0:u[0])??c.message})}})}))},d=()=>{r(e(wr,{size:"M",title:"New Dataset from CSV",children:e(B2,{onDatasetCreated:c=>{l({title:"Dataset created",message:`${c.name} has been successfully created.`,action:{text:"Go to Dataset",onClick:()=>{a(`/datasets/${c.id}`)}}}),r(null),n()},onDatasetCreateError:c=>{const u=Re(c);t({title:"Dataset creation failed",message:(u==null?void 0:u[0])??c.message})}})}))};return s(Y,{children:[s(Ma,{buttonText:"Create Dataset",align:"end",icon:e(D,{svg:e(xt,{})}),onAction:c=>{switch(c){case"newDataset":o();break;case"datasetFromCSV":d();break}},children:[e(je,{children:"New Dataset"},"newDataset"),e(je,{children:"Dataset from CSV"},"datasetFromCSV")]}),e(pl,{type:"modal",isDismissable:!0,onDismiss:()=>r(null),children:i})]})}const bp=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"datasetId"}],a=[{kind:"Variable",name:"id",variableName:"datasetId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:1},{kind:"Literal",name:"sort",value:{col:"createdAt",dir:"desc"}}],concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"versions",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"DatasetVersion",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:'versions(first:1,sort:{"col":"createdAt","dir":"desc"})'}],type:"Dataset",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"datasetStore_latestVersionQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"datasetStore_latestVersionQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,t],storageKey:null}]},params:{cacheID:"8d1b89f8e5b4cd2774b9862c9aff1d3e",id:null,metadata:{},name:"datasetStore_latestVersionQuery",operationKind:"query",text:`query datasetStore_latestVersionQuery(
6633
6633
  $datasetId: ID!
6634
6634
  ) {
6635
6635
  dataset: node(id: $datasetId) {
@@ -6648,14 +6648,14 @@ fragment DatasetsTable_datasets_3JsJJ3 on Query {
6648
6648
  }
6649
6649
  }
6650
6650
  }
6651
- `}}}();bp.hash="55c5e6b728d6f3e3088308750a4e43f7";const aT=n=>{const a=(l,t)=>({...n,isRefreshingLatestVersion:!1,refreshLatestVersion:async()=>{const i=t();l({isRefreshingLatestVersion:!0});const r=await lT({datasetId:i.datasetId});l({latestVersion:r,isRefreshingLatestVersion:!1})}});return Ns()(By(a))};async function lT({datasetId:n}){var i;const a=await P.fetchQuery(ve,bp,{datasetId:n}).toPromise(),l=(i=a==null?void 0:a.dataset.latestVersions)==null?void 0:i.edges;return l&&l.length&&l[0].version||null}const Sp=p.createContext(null);function tT({children:n,...a}){const[l]=p.useState(()=>aT(a));return e(Sp.Provider,{value:l,children:n})}function wa(n,a){const l=p.useContext(Sp);if(!l)throw new Error("Missing DatasetContext.Provider in the tree");return Hl(l,n,a)}const vp=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"DatasetMutationPayload",kind:"LinkedField",name:"addExamplesToDataset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"AddDatasetExampleDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"AddDatasetExampleDialogMutation",selections:a},params:{cacheID:"718cf02ccb39b279132822bf503e51e6",id:null,metadata:{},name:"AddDatasetExampleDialogMutation",operationKind:"mutation",text:`mutation AddDatasetExampleDialogMutation(
6651
+ `}}}();bp.hash="55c5e6b728d6f3e3088308750a4e43f7";const aT=n=>{const a=(l,t)=>({...n,isRefreshingLatestVersion:!1,refreshLatestVersion:async()=>{const i=t();l({isRefreshingLatestVersion:!0});const r=await lT({datasetId:i.datasetId});l({latestVersion:r,isRefreshingLatestVersion:!1})}});return Ns()(By(a))};async function lT({datasetId:n}){var i;const a=await T.fetchQuery(ve,bp,{datasetId:n}).toPromise(),l=(i=a==null?void 0:a.dataset.latestVersions)==null?void 0:i.edges;return l&&l.length&&l[0].version||null}const Sp=p.createContext(null);function tT({children:n,...a}){const[l]=p.useState(()=>aT(a));return e(Sp.Provider,{value:l,children:n})}function wa(n,a){const l=p.useContext(Sp);if(!l)throw new Error("Missing DatasetContext.Provider in the tree");return Hl(l,n,a)}const vp=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"DatasetMutationPayload",kind:"LinkedField",name:"addExamplesToDataset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"AddDatasetExampleDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"AddDatasetExampleDialogMutation",selections:a},params:{cacheID:"718cf02ccb39b279132822bf503e51e6",id:null,metadata:{},name:"AddDatasetExampleDialogMutation",operationKind:"mutation",text:`mutation AddDatasetExampleDialogMutation(
6652
6652
  $input: AddExamplesToDatasetInput!
6653
6653
  ) {
6654
6654
  addExamplesToDataset(input: $input) {
6655
6655
  __typename
6656
6656
  }
6657
6657
  }
6658
- `}}}();vp.hash="8d99470f590cd5d28701fa6e3c0330e6";const gi={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function iT(n){const{datasetId:a,onCompleted:l}=n,[t,i]=p.useState(null),[r,o]=P.useMutation(vp),{control:d,setError:c,handleSubmit:u,formState:{isValid:y}}=Qe({defaultValues:{input:"{}",output:"{}",metadata:"{}"}}),g=p.useCallback((m,f)=>{if(i(null),!ca(m==null?void 0:m.input))return c("input",{message:"Input must be a valid JSON object"});if(!ca(m==null?void 0:m.output))return c("output",{message:"Output must be a valid JSON object"});if(!ca(m==null?void 0:m.metadata))return c("metadata",{message:"Metadata must be a valid JSON object"});r({variables:{input:{datasetId:a,examples:[{input:JSON.parse(m.input),output:JSON.parse(m.output),metadata:JSON.parse(m.metadata)}],datasetVersionDescription:m.description}},onCompleted:()=>{f(),l()},onError:h=>{const k=Re(h);i((k==null?void 0:k[0])??h.message)}})},[r,a,c,l]);return e(X,{children:({close:m})=>s(re,{children:[s(se,{children:[e(oe,{children:"Add Example"}),e(ue,{children:e(me,{slot:"close"})})]}),e("div",{css:K`
6658
+ `}}}();vp.hash="8d99470f590cd5d28701fa6e3c0330e6";const gi={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function iT(n){const{datasetId:a,onCompleted:l}=n,[t,i]=p.useState(null),[r,o]=T.useMutation(vp),{control:d,setError:c,handleSubmit:u,formState:{isValid:y}}=Qe({defaultValues:{input:"{}",output:"{}",metadata:"{}"}}),g=p.useCallback((m,f)=>{if(i(null),!ca(m==null?void 0:m.input))return c("input",{message:"Input must be a valid JSON object"});if(!ca(m==null?void 0:m.output))return c("output",{message:"Output must be a valid JSON object"});if(!ca(m==null?void 0:m.metadata))return c("metadata",{message:"Metadata must be a valid JSON object"});r({variables:{input:{datasetId:a,examples:[{input:JSON.parse(m.input),output:JSON.parse(m.output),metadata:JSON.parse(m.metadata)}],datasetVersionDescription:m.description}},onCompleted:()=>{f(),l()},onError:h=>{const k=Re(h);i((k==null?void 0:k[0])??h.message)}})},[r,a,c,l]);return e(X,{children:({close:m})=>s(re,{children:[s(se,{children:[e(oe,{children:"Add Example"}),e(ue,{children:e(me,{slot:"close"})})]}),e("div",{css:K`
6659
6659
  overflow-y: auto;
6660
6660
  padding: var(--ac-global-dimension-size-400);
6661
6661
  `,children:e(b,{direction:"row",justifyContent:"center",children:e(v,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:s(b,{direction:"column",gap:"size-200",children:[t?e(Ke,{variant:"danger",children:t}):null,e(G,{control:d,name:"input",render:({field:{onChange:f,onBlur:h,value:k},fieldState:{invalid:S,error:C}})=>s(q,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...gi,children:[S?e(Ke,{variant:"danger",banner:!0,children:C==null?void 0:C.message}):null,e(pn,{value:k,onChange:f,onBlur:h})]})}),e(G,{control:d,name:"output",render:({field:{onChange:f,onBlur:h,value:k},fieldState:{invalid:S,error:C}})=>s(q,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...gi,backgroundColor:"green-100",borderColor:"green-700",children:[S?e(Ke,{variant:"danger",banner:!0,children:C==null?void 0:C.message}):null,e(pn,{value:k,onChange:f,onBlur:h})]})}),e(G,{control:d,name:"metadata",render:({field:{onChange:f,onBlur:h,value:k},fieldState:{invalid:S,error:C}})=>s(q,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...gi,children:[S?e(Ke,{variant:"danger",banner:!0,children:C==null?void 0:C.message}):null,e(pn,{value:k,onChange:f,onBlur:h})]})}),e(G,{control:d,name:"description",render:({field:{onChange:f,onBlur:h,value:k},fieldState:{invalid:S,error:C}})=>s(ie,{value:k,onChange:f,onBlur:h,isInvalid:S,children:[e(W,{children:"Version Description"}),e(Ra,{}),C?e(Ce,{children:C.message}):e(F,{slot:"description",children:"A description of the changes made. Will be displayed in the version history."})]})})]})})})}),e(v,{padding:"size-200",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",gap:"size-100",children:e(E,{variant:"primary",size:"S",isDisabled:!y||o,leadingVisual:o?e(D,{svg:e(yn,{})}):null,onPress:()=>u(f=>g(f,m))(),children:o?"Adding Example...":"Add Example"})})})]})})}function rT(n){const{datasetId:a,onAddExampleCompleted:l}=n;return s(J,{children:[e(E,{leadingVisual:e(D,{svg:e(jn,{})}),size:"S","aria-label":"Add Dataset Example",children:"Add Example"}),e(ne,{children:e(Z,{size:"L",children:e(iT,{datasetId:a,onCompleted:()=>{l()}})})})]})}function sT(n){return`import { getDataset } from "@arizeai/phoenix-client/datasets";
@@ -6726,10 +6726,10 @@ fragment DatasetHistoryTable_versions_2HEEH6 on Dataset {
6726
6726
  }
6727
6727
  id
6728
6728
  }
6729
- `}}}();Cp.hash="37e453bc58759a1e89bc5862c460de6b";const Kp=function(){var n=["versions"],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:["node"],operation:Cp,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"DatasetHistoryTable_versions",selections:[{alias:"versions",args:null,concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"__DatasetHistoryTable_versions_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"DatasetVersion",kind:"LinkedField",name:"node",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},a],type:"Dataset",abstractKey:null}}();Kp.hash="37e453bc58759a1e89bc5862c460de6b";const cT=100;function uT(n){const a=p.useRef(null),{data:l,loadNext:t,hasNext:i,isLoadingNext:r}=P.usePaginationFragment(Kp,n.dataset),o=p.useMemo(()=>l.versions.edges.map(g=>g.node),[l]),d=p.useCallback(g=>{if(g){const{scrollHeight:m,scrollTop:f,clientHeight:h}=g;m-f-h<300&&!r&&i&&t(cT)}},[i,r,t]),c=Le({columns:[{header:"version ID",accessorKey:"id"},{header:"description",accessorKey:"description"},{header:"created at",accessorKey:"createdAt",cell:we}],data:o,getCoreRowModel:_e(),getSortedRowModel:sn()}),u=c.getRowModel().rows,y=u.length===0;return e("div",{css:K`
6729
+ `}}}();Cp.hash="37e453bc58759a1e89bc5862c460de6b";const Kp=function(){var n=["versions"],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:["node"],operation:Cp,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"DatasetHistoryTable_versions",selections:[{alias:"versions",args:null,concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"__DatasetHistoryTable_versions_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"DatasetVersion",kind:"LinkedField",name:"node",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},a],type:"Dataset",abstractKey:null}}();Kp.hash="37e453bc58759a1e89bc5862c460de6b";const cT=100;function uT(n){const a=p.useRef(null),{data:l,loadNext:t,hasNext:i,isLoadingNext:r}=T.usePaginationFragment(Kp,n.dataset),o=p.useMemo(()=>l.versions.edges.map(g=>g.node),[l]),d=p.useCallback(g=>{if(g){const{scrollHeight:m,scrollTop:f,clientHeight:h}=g;m-f-h<300&&!r&&i&&t(cT)}},[i,r,t]),c=Le({columns:[{header:"version ID",accessorKey:"id"},{header:"description",accessorKey:"description"},{header:"created at",accessorKey:"createdAt",cell:we}],data:o,getCoreRowModel:_e(),getSortedRowModel:sn()}),u=c.getRowModel().rows,y=u.length===0;return e("div",{css:K`
6730
6730
  flex: 1 1 auto;
6731
6731
  overflow: auto;
6732
- `,onScroll:g=>d(g.target),ref:a,children:s("table",{css:nn,children:[e("thead",{children:c.getHeaderGroups().map(g=>e("tr",{children:g.headers.map(m=>e("th",{colSpan:m.colSpan,children:m.isPlaceholder?null:s("div",{className:m.column.getCanSort()?"sort":"",onClick:m.column.getToggleSortingHandler(),style:{left:m.getStart(),width:m.getSize()},children:[ee(m.column.columnDef.header,m.getContext()),m.column.getIsSorted()?e(D,{className:"sort-icon",svg:m.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},m.id))},g.id))}),y?e(vn,{}):e("tbody",{children:u.map(g=>e("tr",{children:g.getVisibleCells().map(m=>e("td",{children:ee(m.column.columnDef.cell,m.getContext())},m.id))},g.id))})]})})}function mT(n){const{datasetId:a,isOpen:l,onOpenChange:t}=n,i=P.useLazyLoadQuery(Fp,{datasetId:a});return e(J,{isOpen:l,onOpenChange:t,children:e(ne,{isDismissable:!0,children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Dataset History"}),e(ue,{children:e(me,{slot:"close"})})]}),e("div",{css:K`
6732
+ `,onScroll:g=>d(g.target),ref:a,children:s("table",{css:nn,children:[e("thead",{children:c.getHeaderGroups().map(g=>e("tr",{children:g.headers.map(m=>e("th",{colSpan:m.colSpan,children:m.isPlaceholder?null:s("div",{className:m.column.getCanSort()?"sort":"",onClick:m.column.getToggleSortingHandler(),style:{left:m.getStart(),width:m.getSize()},children:[ee(m.column.columnDef.header,m.getContext()),m.column.getIsSorted()?e(D,{className:"sort-icon",svg:m.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},m.id))},g.id))}),y?e(vn,{}):e("tbody",{children:u.map(g=>e("tr",{children:g.getVisibleCells().map(m=>e("td",{children:ee(m.column.columnDef.cell,m.getContext())},m.id))},g.id))})]})})}function mT(n){const{datasetId:a,isOpen:l,onOpenChange:t}=n,i=T.useLazyLoadQuery(Fp,{datasetId:a});return e(J,{isOpen:l,onOpenChange:t,children:e(ne,{isDismissable:!0,children:e(Z,{children:e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Dataset History"}),e(ue,{children:e(me,{slot:"close"})})]}),e("div",{css:K`
6733
6733
  height: 500px;
6734
6734
  `,children:e(uT,{dataset:i.dataset})})]})})})})})}function gT(n){const{datasetId:a}=n,[l,t]=p.useState(!1);return s(Y,{children:[s(Xn,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(gk,{})}),"aria-label":"Version History",onPress:()=>t(!0)}),e(Ia,{children:"Dataset Version History"})]}),e(p.Suspense,{fallback:null,children:e(mT,{datasetId:a,isOpen:l,onOpenChange:t})})]})}const pT=`pip install arize-phoenix>=${window.Config.platformVersion}`;function yT({isAuthEnabled:n}){let a=`import os
6735
6735
  # Set the phoenix collector endpoint. Commonly http://localhost:6006
@@ -6845,7 +6845,7 @@ dataset = client.get_dataset(name="${n}"${a?`, version_id="${a.id}"`:""})`,[n,a]
6845
6845
  }
6846
6846
  }
6847
6847
  }
6848
- `}}}();Pp.hash="5ff18bc8372a865b84a24396d3b3782a";async function OI(n){const{datasetId:a}=n.params;return await P.fetchQuery(ve,Pp,{id:a}).toPromise()}function QI(){const{exampleId:n,datasetId:a}=We(),l=be();return e(J,{isOpen:!0,onOpenChange:t=>{t||l(`/datasets/${a}/examples`)},children:e(ne,{children:e(Z,{variant:"slideover",size:"L",children:e(p.Suspense,{fallback:e(pe,{}),children:e(kr,{exampleId:n})})})})})}const Ip=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i=[{kind:"Literal",name:"first",value:100}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"examplesLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{args:null,kind:"FragmentSpread",name:"ExamplesTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"examplesLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,l,{kind:"InlineFragment",selections:[{alias:null,args:i,concreteType:"DatasetExampleConnection",kind:"LinkedField",name:"examples",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetExampleEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"example",args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,concreteType:"DatasetExampleRevision",kind:"LinkedField",name:"revision",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"input",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"node",plural:!1,selections:[t,l],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:"examples(first:100)"},{alias:null,args:i,filters:["datasetVersionId"],handle:"connection",key:"ExamplesTable_examples",kind:"LinkedHandle",name:"examples"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"3199afe500e1707d9a6eda312c67b0f1",id:null,metadata:{},name:"examplesLoaderQuery",operationKind:"query",text:`query examplesLoaderQuery(
6848
+ `}}}();Pp.hash="5ff18bc8372a865b84a24396d3b3782a";async function OI(n){const{datasetId:a}=n.params;return await T.fetchQuery(ve,Pp,{id:a}).toPromise()}function QI(){const{exampleId:n,datasetId:a}=We(),l=be();return e(J,{isOpen:!0,onOpenChange:t=>{t||l(`/datasets/${a}/examples`)},children:e(ne,{children:e(Z,{variant:"slideover",size:"L",children:e(p.Suspense,{fallback:e(pe,{}),children:e(kr,{exampleId:n})})})})})}const Ip=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i=[{kind:"Literal",name:"first",value:100}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"examplesLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{args:null,kind:"FragmentSpread",name:"ExamplesTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"examplesLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,l,{kind:"InlineFragment",selections:[{alias:null,args:i,concreteType:"DatasetExampleConnection",kind:"LinkedField",name:"examples",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetExampleEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"example",args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,concreteType:"DatasetExampleRevision",kind:"LinkedField",name:"revision",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"input",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"node",plural:!1,selections:[t,l],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:"examples(first:100)"},{alias:null,args:i,filters:["datasetVersionId"],handle:"connection",key:"ExamplesTable_examples",kind:"LinkedHandle",name:"examples"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"3199afe500e1707d9a6eda312c67b0f1",id:null,metadata:{},name:"examplesLoaderQuery",operationKind:"query",text:`query examplesLoaderQuery(
6849
6849
  $id: ID!
6850
6850
  ) {
6851
6851
  dataset: node(id: $id) {
@@ -6879,7 +6879,7 @@ fragment ExamplesTableFragment on Dataset {
6879
6879
  }
6880
6880
  id
6881
6881
  }
6882
- `}}}();Ip.hash="87c9a24e8d6450699d9fd403b3653108";async function BI(n){const{datasetId:a}=n.params;return await P.fetchQuery(ve,Ip,{id:a}).toPromise()}const xp=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:null,kind:"LocalArgument",name:"datasetVersionId"},{defaultValue:100,kind:"LocalArgument",name:"first"},{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"datasetVersionId",variableName:"datasetVersionId"},{kind:"Variable",name:"first",variableName:"first"}],t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExamplesTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:l,kind:"FragmentSpread",name:"ExamplesTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExamplesTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,i,{kind:"InlineFragment",selections:[{alias:null,args:l,concreteType:"DatasetExampleConnection",kind:"LinkedField",name:"examples",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetExampleEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"example",args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"node",plural:!1,selections:[i,{alias:null,args:null,concreteType:"DatasetExampleRevision",kind:"LinkedField",name:"revision",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"input",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"node",plural:!1,selections:[t,i],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:l,filters:["datasetVersionId"],handle:"connection",key:"ExamplesTable_examples",kind:"LinkedHandle",name:"examples"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"fd22f70774f5ca11a13a0dabba9adf65",id:null,metadata:{},name:"ExamplesTableQuery",operationKind:"query",text:`query ExamplesTableQuery(
6882
+ `}}}();Ip.hash="87c9a24e8d6450699d9fd403b3653108";async function BI(n){const{datasetId:a}=n.params;return await T.fetchQuery(ve,Ip,{id:a}).toPromise()}const xp=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:null,kind:"LocalArgument",name:"datasetVersionId"},{defaultValue:100,kind:"LocalArgument",name:"first"},{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"datasetVersionId",variableName:"datasetVersionId"},{kind:"Variable",name:"first",variableName:"first"}],t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExamplesTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:l,kind:"FragmentSpread",name:"ExamplesTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExamplesTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,i,{kind:"InlineFragment",selections:[{alias:null,args:l,concreteType:"DatasetExampleConnection",kind:"LinkedField",name:"examples",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetExampleEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"example",args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"node",plural:!1,selections:[i,{alias:null,args:null,concreteType:"DatasetExampleRevision",kind:"LinkedField",name:"revision",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"input",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"node",plural:!1,selections:[t,i],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:l,filters:["datasetVersionId"],handle:"connection",key:"ExamplesTable_examples",kind:"LinkedHandle",name:"examples"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"fd22f70774f5ca11a13a0dabba9adf65",id:null,metadata:{},name:"ExamplesTableQuery",operationKind:"query",text:`query ExamplesTableQuery(
6883
6883
  $after: String = null
6884
6884
  $datasetVersionId: ID
6885
6885
  $first: Int = 100
@@ -6925,15 +6925,15 @@ fragment ExamplesTableFragment_4a6F8Z on Dataset {
6925
6925
  }
6926
6926
  }
6927
6927
  }
6928
- `}}}();Lp.hash="455bf9e5dc4b9cc655095dc829ef7e12";function TT(n){const a=wa(f=>f.refreshLatestVersion),{selectedExamples:l,onExamplesDeleted:t,onClearSelection:i}=n,[r,o]=p.useState(null),d=ke(),c=Fe(),[u,y]=P.useMutation(Lp),g=l.length!==1,m=p.useCallback(()=>{u({variables:{input:{exampleIds:l.map(f=>f.id)}},onCompleted:()=>{d({title:"Examples Deleted",message:`${l.length} example${g?"s":""} have been deleted.`}),t(),i(),a()},onError:f=>{const h=Re(f);c({title:"An error occurred",message:`Failed to delete examples: ${(h==null?void 0:h[0])??f.message}`})}})},[u,l,d,g,t,i,a,c]);return s("div",{css:K`
6928
+ `}}}();Lp.hash="455bf9e5dc4b9cc655095dc829ef7e12";function TT(n){const a=wa(f=>f.refreshLatestVersion),{selectedExamples:l,onExamplesDeleted:t,onClearSelection:i}=n,[r,o]=p.useState(null),d=ke(),c=Fe(),[u,y]=T.useMutation(Lp),g=l.length!==1,m=p.useCallback(()=>{u({variables:{input:{exampleIds:l.map(f=>f.id)}},onCompleted:()=>{d({title:"Examples Deleted",message:`${l.length} example${g?"s":""} have been deleted.`}),t(),i(),a()},onError:f=>{const h=Re(f);c({title:"An error occurred",message:`Failed to delete examples: ${(h==null?void 0:h[0])??f.message}`})}})},[u,l,d,g,t,i,a,c]);return s("div",{css:K`
6929
6929
  position: absolute;
6930
6930
  bottom: var(--ac-global-dimension-size-400);
6931
6931
  left: 50%;
6932
6932
  transform: translateX(-50%);
6933
- `,children:[e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(F,{children:`${l.length} example${g?"s":""} selected`}),s(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"default",size:"S",onPress:i,children:"Cancel"}),e(E,{variant:"danger",size:"S",leadingVisual:e(D,{svg:y?e(yn,{}):e(Je,{})}),isDisabled:y,onPress:m,children:y?"Deleting...":"Delete Example"+(g?"s":"")})]})]})}),e(pl,{onDismiss:()=>{o(null)},children:r})]})}const PT=100;function IT({dataset:n}){const a=wa(x=>x.latestVersion),l=p.useRef(null),[t,i]=p.useState({}),{data:r,loadNext:o,hasNext:d,isLoadingNext:c,refetch:u}=P.usePaginationFragment(Dp,n);p.useEffect(()=>{p.startTransition(()=>{u({datasetVersionId:(a==null?void 0:a.id)||null},{fetchPolicy:"store-and-network"})})},[a,u]);const y=p.useMemo(()=>r.examples.edges.map(x=>{const N=x.example,w=N.revision;return{id:N.id,input:w.input,output:w.output,metadata:w.metadata}}),[r]),m=Le({columns:[{id:"select",header:({table:x})=>e(ea,{checked:x.getIsAllRowsSelected(),indeterminate:x.getIsSomeRowsSelected(),onChange:x.getToggleAllRowsSelectedHandler()}),cell:({row:x})=>e(ea,{checked:x.getIsSelected(),disabled:!x.getCanSelect(),indeterminate:x.getIsSomeSelected(),onChange:x.getToggleSelectedHandler()})},{header:"example id",accessorKey:"id",cell:({getValue:x,row:N})=>{const w=N.original.id;return e(Oe,{to:`${w}`,children:x()})}},{header:"input",accessorKey:"input",cell:rl},{header:"output",accessorKey:"output",cell:rl},{header:"metadata",accessorKey:"metadata",cell:rl}],data:y,state:{rowSelection:t},onRowSelectionChange:i,getCoreRowModel:_e()}),f=m.getRowModel().rows,h=f.length===0,k=m.getSelectedRowModel().rows,S=k.map(x=>x.original),C=p.useCallback(()=>{i({})},[i]),T=p.useCallback(x=>{if(x){const{scrollHeight:N,scrollTop:w,clientHeight:$}=x;N-w-$<300&&!c&&d&&o(PT)}},[d,c,o]),_=be();return s("div",{css:K`
6933
+ `,children:[e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(F,{children:`${l.length} example${g?"s":""} selected`}),s(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"default",size:"S",onPress:i,children:"Cancel"}),e(E,{variant:"danger",size:"S",leadingVisual:e(D,{svg:y?e(yn,{}):e(Je,{})}),isDisabled:y,onPress:m,children:y?"Deleting...":"Delete Example"+(g?"s":"")})]})]})}),e(pl,{onDismiss:()=>{o(null)},children:r})]})}const PT=100;function IT({dataset:n}){const a=wa(x=>x.latestVersion),l=p.useRef(null),[t,i]=p.useState({}),{data:r,loadNext:o,hasNext:d,isLoadingNext:c,refetch:u}=T.usePaginationFragment(Dp,n);p.useEffect(()=>{p.startTransition(()=>{u({datasetVersionId:(a==null?void 0:a.id)||null},{fetchPolicy:"store-and-network"})})},[a,u]);const y=p.useMemo(()=>r.examples.edges.map(x=>{const N=x.example,w=N.revision;return{id:N.id,input:w.input,output:w.output,metadata:w.metadata}}),[r]),m=Le({columns:[{id:"select",header:({table:x})=>e(ea,{checked:x.getIsAllRowsSelected(),indeterminate:x.getIsSomeRowsSelected(),onChange:x.getToggleAllRowsSelectedHandler()}),cell:({row:x})=>e(ea,{checked:x.getIsSelected(),disabled:!x.getCanSelect(),indeterminate:x.getIsSomeSelected(),onChange:x.getToggleSelectedHandler()})},{header:"example id",accessorKey:"id",cell:({getValue:x,row:N})=>{const w=N.original.id;return e(Oe,{to:`${w}`,children:x()})}},{header:"input",accessorKey:"input",cell:rl},{header:"output",accessorKey:"output",cell:rl},{header:"metadata",accessorKey:"metadata",cell:rl}],data:y,state:{rowSelection:t},onRowSelectionChange:i,getCoreRowModel:_e()}),f=m.getRowModel().rows,h=f.length===0,k=m.getSelectedRowModel().rows,S=k.map(x=>x.original),C=p.useCallback(()=>{i({})},[i]),P=p.useCallback(x=>{if(x){const{scrollHeight:N,scrollTop:w,clientHeight:$}=x;N-w-$<300&&!c&&d&&o(PT)}},[d,c,o]),L=be();return s("div",{css:K`
6934
6934
  flex: 1 1 auto;
6935
6935
  overflow: auto;
6936
- `,ref:l,onScroll:x=>T(x.target),children:[s("table",{css:la,children:[e("thead",{children:m.getHeaderGroups().map(x=>e("tr",{children:x.headers.map(N=>e("th",{children:e("div",{children:ee(N.column.columnDef.header,N.getContext())})},N.id))},x.id))}),h?e(vn,{}):e("tbody",{children:f.map(x=>e("tr",{onClick:()=>{_(`${x.original.id}`)},children:x.getVisibleCells().map(N=>e("td",{children:ee(N.column.columnDef.cell,N.getContext())},N.id))},x.id))})]}),k.length?e(TT,{selectedExamples:S,onClearSelection:C,onExamplesDeleted:()=>{u({},{fetchPolicy:"store-and-network"})}}):null]})}function qI(){const n=Ue();return qe(n),s(Y,{children:[e(IT,{dataset:n.dataset})," ",e(p.Suspense,{children:e(Te,{})})]})}const _p=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t=[l],i={alias:"firstExperiment",args:[{kind:"Literal",name:"first",value:1}],concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:t,storageKey:null}],storageKey:null}],storageKey:"experiments(first:1)"},r={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"annotationName",storageKey:null},d=[{kind:"Literal",name:"first",value:100}],c=[{alias:null,args:null,kind:"ScalarField",name:"tokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"experimentsLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{args:null,kind:"FragmentSpread",name:"ExperimentsTableFragment"},i],type:"Dataset",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"experimentsLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[r,l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"experimentAnnotationSummaries",plural:!0,selections:[o,{alias:null,args:null,kind:"ScalarField",name:"minScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxScore",storageKey:null}],storageKey:null},{alias:null,args:d,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"errorRate",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"runCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"averageRunLatencyMs",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:t,storageKey:null},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:c,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"prompt",plural:!1,selections:c,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"completion",plural:!1,selections:c,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"annotationSummaries",plural:!0,selections:[o,{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[r,l],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:"experiments(first:100)"},{alias:null,args:d,filters:null,handle:"connection",key:"ExperimentsTable_experiments",kind:"LinkedHandle",name:"experiments"},i],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"6eef09cdb83b93063583483d4c2e2469",id:null,metadata:{},name:"experimentsLoaderQuery",operationKind:"query",text:`query experimentsLoaderQuery(
6936
+ `,ref:l,onScroll:x=>P(x.target),children:[s("table",{css:la,children:[e("thead",{children:m.getHeaderGroups().map(x=>e("tr",{children:x.headers.map(N=>e("th",{children:e("div",{children:ee(N.column.columnDef.header,N.getContext())})},N.id))},x.id))}),h?e(vn,{}):e("tbody",{children:f.map(x=>e("tr",{onClick:()=>{L(`${x.original.id}`)},children:x.getVisibleCells().map(N=>e("td",{children:ee(N.column.columnDef.cell,N.getContext())},N.id))},x.id))})]}),k.length?e(TT,{selectedExamples:S,onClearSelection:C,onExamplesDeleted:()=>{u({},{fetchPolicy:"store-and-network"})}}):null]})}function qI(){const n=Ue();return qe(n),s(Y,{children:[e(IT,{dataset:n.dataset})," ",e(p.Suspense,{children:e(Te,{})})]})}const _p=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t=[l],i={alias:"firstExperiment",args:[{kind:"Literal",name:"first",value:1}],concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:t,storageKey:null}],storageKey:null}],storageKey:"experiments(first:1)"},r={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"annotationName",storageKey:null},d=[{kind:"Literal",name:"first",value:100}],c=[{alias:null,args:null,kind:"ScalarField",name:"tokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"experimentsLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{args:null,kind:"FragmentSpread",name:"ExperimentsTableFragment"},i],type:"Dataset",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"experimentsLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[r,l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"experimentAnnotationSummaries",plural:!0,selections:[o,{alias:null,args:null,kind:"ScalarField",name:"minScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxScore",storageKey:null}],storageKey:null},{alias:null,args:d,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"errorRate",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"runCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"averageRunLatencyMs",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:t,storageKey:null},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:c,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"prompt",plural:!1,selections:c,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"completion",plural:!1,selections:c,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"annotationSummaries",plural:!0,selections:[o,{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[r,l],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:"experiments(first:100)"},{alias:null,args:d,filters:null,handle:"connection",key:"ExperimentsTable_experiments",kind:"LinkedHandle",name:"experiments"},i],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"6eef09cdb83b93063583483d4c2e2469",id:null,metadata:{},name:"experimentsLoaderQuery",operationKind:"query",text:`query experimentsLoaderQuery(
6937
6937
  $id: ID!
6938
6938
  ) {
6939
6939
  dataset: node(id: $id) {
@@ -7005,7 +7005,7 @@ fragment ExperimentsTableFragment on Dataset {
7005
7005
  }
7006
7006
  id
7007
7007
  }
7008
- `}}}();_p.hash="c59bc7ec0e8d304bf7c2c46cee4e82d2";async function UI(n){const{datasetId:a}=n.params;return await P.fetchQuery(ve,_p,{id:a}).toPromise()}const Ap=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Literal",name:"first",value:50}],concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"averageRunLatencyMs",storageKey:null},{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"annotationSummaries",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"annotationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:"experiments(first:50)"}],type:"Dataset",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExperimentsLineChartQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExperimentsLineChartQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t,l],storageKey:null}]},params:{cacheID:"b4d31338866ff8be645d6601e1e15dc2",id:null,metadata:{},name:"ExperimentsLineChartQuery",operationKind:"query",text:`query ExperimentsLineChartQuery(
7008
+ `}}}();_p.hash="c59bc7ec0e8d304bf7c2c46cee4e82d2";async function UI(n){const{datasetId:a}=n.params;return await T.fetchQuery(ve,_p,{id:a}).toPromise()}const Ap=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Literal",name:"first",value:50}],concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"averageRunLatencyMs",storageKey:null},{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"annotationSummaries",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"annotationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:"experiments(first:50)"}],type:"Dataset",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExperimentsLineChartQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExperimentsLineChartQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t,l],storageKey:null}]},params:{cacheID:"b4d31338866ff8be645d6601e1e15dc2",id:null,metadata:{},name:"ExperimentsLineChartQuery",operationKind:"query",text:`query ExperimentsLineChartQuery(
7009
7009
  $id: ID!
7010
7010
  ) {
7011
7011
  dataset: node(id: $id) {
@@ -7028,7 +7028,7 @@ fragment ExperimentsTableFragment on Dataset {
7028
7028
  id
7029
7029
  }
7030
7030
  }
7031
- `}}}();Ap.hash="3eade40b47d598c5387d90e7740a457a";const xT={top:8,right:18,left:18,bottom:58},DT=new Intl.NumberFormat([],{maximumFractionDigits:4}),wp=n=>typeof n!="number"?"--":`${vt(".1f")(n/1e3)}s`;function LT({active:n,payload:a,label:l}){const{gray300:t}=On();if(n&&a&&a.length){const i=a.filter(r=>r.dataKey!=="avgLatency"&&typeof r.value=="number");return s(aa,{children:[s(b,{direction:"row",alignItems:"center",gap:"size-100",children:[e(F,{weight:"heavy",size:"S",children:"experiment"}),e(ul,{sequenceNumber:Number(l)})]}),i.map(r=>e(Ge,{color:Uo(String(r.dataKey)),shape:"line",name:String(r.dataKey),value:typeof r.value=="number"?DT.format(r.value):"--"},String(r.dataKey))),(()=>{const r=a.find(o=>o.dataKey==="avgLatency");return r?e(Ge,{color:t,shape:"square",name:"avg latency",value:wp(r.value)},"avgLatency"):null})()]})}return null}function _T({datasetId:n}){var d,c;const a=P.useLazyLoadQuery(Ap,{id:n}),{chartData:l,scoreKeys:t}=p.useMemo(()=>{var g,m;const u=new Set;return{chartData:(((m=(g=a.dataset)==null?void 0:g.experiments)==null?void 0:m.edges)??[]).map(f=>{const h=f.experiment,k={},S=h.annotationSummaries;for(const C of S)u.add(C.annotationName),k[C.annotationName]=C.meanScore??void 0;return{iteration:h.sequenceNumber,avgLatency:h.averageRunLatencyMs??void 0,...k}}).filter(f=>f!==null).sort((f,h)=>f.iteration-h.iteration),scoreKeys:Array.from(u)}},[(c=(d=a.dataset)==null?void 0:d.experiments)==null?void 0:c.edges]),{gray300:i}=On(),r=p.useMemo(()=>{const u={};for(const y of t)u[y]=Uo(y);return u},[t]),o=p.useMemo(()=>{let u=1/0,y=-1/0;for(const g of l)for(const m of t){const f=g[m];typeof f=="number"&&(f<u&&(u=f),f>y&&(y=f))}return u>=0&&y<=1?[0,1]:void 0},[l,t]);return e(Qn,{width:"100%",height:"100%",children:s(Fl,{data:l,margin:xT,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"latencyBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:i,stopOpacity:.3}),e("stop",{offset:"95%",stopColor:i,stopOpacity:0})]})}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ra,{dataKey:"iteration",tick:{fontSize:12,fill:"var(--ac-global-text-color-700)"}}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"Score",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"},domain:o}),e(Tn,{yAxisId:"right",orientation:"right",stroke:"var(--ac-global-color-grey-500)",label:{value:"avg latency",angle:90,position:"insideRight",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"},tickFormatter:wp}),e(La,{yAxisId:"right",dataKey:"avgLatency",fill:"url(#latencyBarColor)",spacing:3}),t.map(u=>e(ir,{type:"monotone",dataKey:u,stroke:r[u],strokeWidth:2,dot:{r:3},activeDot:{r:5},yAxisId:0},u)),e(ia,{content:e(LT,{})})]})})}function AT({datasetId:n}){return e(p.Suspense,{fallback:e(pe,{}),children:e(_T,{datasetId:n})})}function wT(){return e(v,{width:"100%",paddingY:"size-400",children:e(b,{direction:"column",width:"100%",alignItems:"center",justifyContent:"center",children:e(v,{width:"100%",maxWidth:"780px",children:s(b,{direction:"column",gap:"size-400",alignItems:"center",children:[e(F,{size:"XL",children:"Run experiments to evaluate and improve your AI applications."}),e(ar,{src:"https://storage.googleapis.com/arize-phoenix-assets/assets/videos/experiments.mp4",autoPlay:!0,muted:!0,loop:!0}),s(b,{direction:"row",gap:"size-200",children:[e(cl,{href:"https://docs.arize.com/phoenix/datasets-and-experiments/how-to-experiments/run-experiments",target:"_blank",leadingVisual:e(D,{svg:e(lr,{})}),children:"Documentation"}),e(cl,{href:"https://docs.arize.com/phoenix/cookbook/datasets-and-experiments/summarization",target:"_blank",leadingVisual:e(D,{svg:e(yk,{})}),children:"Example"}),e(Tp,{variant:"primary"})]})]})})})})}const Rp=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"},{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"}],t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"annotationName",storageKey:null},o=[{alias:null,args:null,kind:"ScalarField",name:"tokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExperimentsTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:l,kind:"FragmentSpread",name:"ExperimentsTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExperimentsTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,i,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"experimentAnnotationSummaries",plural:!0,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"minScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxScore",storageKey:null}],storageKey:null},{alias:null,args:l,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"errorRate",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"runCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"averageRunLatencyMs",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[i],storageKey:null},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:o,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"prompt",plural:!1,selections:o,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"completion",plural:!1,selections:o,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"annotationSummaries",plural:!0,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[t,i],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:l,filters:null,handle:"connection",key:"ExperimentsTable_experiments",kind:"LinkedHandle",name:"experiments"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"71600dd65428d25ce1b2d41c72e5568b",id:null,metadata:{},name:"ExperimentsTableQuery",operationKind:"query",text:`query ExperimentsTableQuery(
7031
+ `}}}();Ap.hash="3eade40b47d598c5387d90e7740a457a";const xT={top:8,right:18,left:18,bottom:58},DT=new Intl.NumberFormat([],{maximumFractionDigits:4}),wp=n=>typeof n!="number"?"--":`${vt(".1f")(n/1e3)}s`;function LT({active:n,payload:a,label:l}){const{gray300:t}=On();if(n&&a&&a.length){const i=a.filter(r=>r.dataKey!=="avgLatency"&&typeof r.value=="number");return s(aa,{children:[s(b,{direction:"row",alignItems:"center",gap:"size-100",children:[e(F,{weight:"heavy",size:"S",children:"experiment"}),e(ul,{sequenceNumber:Number(l)})]}),i.map(r=>e(Ge,{color:Uo(String(r.dataKey)),shape:"line",name:String(r.dataKey),value:typeof r.value=="number"?DT.format(r.value):"--"},String(r.dataKey))),(()=>{const r=a.find(o=>o.dataKey==="avgLatency");return r?e(Ge,{color:t,shape:"square",name:"avg latency",value:wp(r.value)},"avgLatency"):null})()]})}return null}function _T({datasetId:n}){var d,c;const a=T.useLazyLoadQuery(Ap,{id:n}),{chartData:l,scoreKeys:t}=p.useMemo(()=>{var g,m;const u=new Set;return{chartData:(((m=(g=a.dataset)==null?void 0:g.experiments)==null?void 0:m.edges)??[]).map(f=>{const h=f.experiment,k={},S=h.annotationSummaries;for(const C of S)u.add(C.annotationName),k[C.annotationName]=C.meanScore??void 0;return{iteration:h.sequenceNumber,avgLatency:h.averageRunLatencyMs??void 0,...k}}).filter(f=>f!==null).sort((f,h)=>f.iteration-h.iteration),scoreKeys:Array.from(u)}},[(c=(d=a.dataset)==null?void 0:d.experiments)==null?void 0:c.edges]),{gray300:i}=On(),r=p.useMemo(()=>{const u={};for(const y of t)u[y]=Uo(y);return u},[t]),o=p.useMemo(()=>{let u=1/0,y=-1/0;for(const g of l)for(const m of t){const f=g[m];typeof f=="number"&&(f<u&&(u=f),f>y&&(y=f))}return u>=0&&y<=1?[0,1]:void 0},[l,t]);return e(Qn,{width:"100%",height:"100%",children:s(Fl,{data:l,margin:xT,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"latencyBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:i,stopOpacity:.3}),e("stop",{offset:"95%",stopColor:i,stopOpacity:0})]})}),e(sa,{strokeDasharray:"4 4",stroke:"var(--ac-global-color-grey-500)",strokeOpacity:.5}),e(ra,{dataKey:"iteration",tick:{fontSize:12,fill:"var(--ac-global-text-color-700)"}}),e(Tn,{stroke:"var(--ac-global-color-grey-500)",label:{value:"Score",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"},domain:o}),e(Tn,{yAxisId:"right",orientation:"right",stroke:"var(--ac-global-color-grey-500)",label:{value:"avg latency",angle:90,position:"insideRight",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"},tickFormatter:wp}),e(La,{yAxisId:"right",dataKey:"avgLatency",fill:"url(#latencyBarColor)",spacing:3}),t.map(u=>e(ir,{type:"monotone",dataKey:u,stroke:r[u],strokeWidth:2,dot:{r:3},activeDot:{r:5},yAxisId:0},u)),e(ia,{content:e(LT,{})})]})})}function AT({datasetId:n}){return e(p.Suspense,{fallback:e(pe,{}),children:e(_T,{datasetId:n})})}function wT(){return e(v,{width:"100%",paddingY:"size-400",children:e(b,{direction:"column",width:"100%",alignItems:"center",justifyContent:"center",children:e(v,{width:"100%",maxWidth:"780px",children:s(b,{direction:"column",gap:"size-400",alignItems:"center",children:[e(F,{size:"XL",children:"Run experiments to evaluate and improve your AI applications."}),e(ar,{src:"https://storage.googleapis.com/arize-phoenix-assets/assets/videos/experiments.mp4",autoPlay:!0,muted:!0,loop:!0}),s(b,{direction:"row",gap:"size-200",children:[e(cl,{href:"https://docs.arize.com/phoenix/datasets-and-experiments/how-to-experiments/run-experiments",target:"_blank",leadingVisual:e(D,{svg:e(lr,{})}),children:"Documentation"}),e(cl,{href:"https://docs.arize.com/phoenix/cookbook/datasets-and-experiments/summarization",target:"_blank",leadingVisual:e(D,{svg:e(yk,{})}),children:"Example"}),e(Tp,{variant:"primary"})]})]})})})})}const Rp=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"},{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"}],t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"annotationName",storageKey:null},o=[{alias:null,args:null,kind:"ScalarField",name:"tokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExperimentsTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:l,kind:"FragmentSpread",name:"ExperimentsTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExperimentsTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,i,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"experimentAnnotationSummaries",plural:!0,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"minScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxScore",storageKey:null}],storageKey:null},{alias:null,args:l,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"errorRate",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"runCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"averageRunLatencyMs",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[i],storageKey:null},{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:o,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"prompt",plural:!1,selections:o,storageKey:null},{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"completion",plural:!1,selections:o,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"annotationSummaries",plural:!0,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[t,i],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:l,filters:null,handle:"connection",key:"ExperimentsTable_experiments",kind:"LinkedHandle",name:"experiments"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"71600dd65428d25ce1b2d41c72e5568b",id:null,metadata:{},name:"ExperimentsTableQuery",operationKind:"query",text:`query ExperimentsTableQuery(
7032
7032
  $after: String = null
7033
7033
  $first: Int = 100
7034
7034
  $id: ID!
@@ -7100,17 +7100,17 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
7100
7100
  __typename
7101
7101
  }
7102
7102
  }
7103
- `}}}();Mp.hash="4ab310746eb51c6a3fcb799d2c972762";function MT(n){const a=be(),[l,t]=p.useState(null),[i,r]=P.useMutation(Mp),{datasetId:o,selectedExperiments:d,onClearSelection:c,onExperimentsDeleted:u}=n,y=d.length!==1,g=ke(),m=Fe(),f=p.useCallback(()=>{i({variables:{input:{experimentIds:d.map(k=>k.id)}},onCompleted:()=>{g({title:"Experiments Deleted",message:`${d.length} experiment${y?"s":""} have been deleted.`}),u(),c()},onError:k=>{const S=Re(k);m({title:"An error occurred",message:`Failed to delete experiments: ${(S==null?void 0:S[0])??k.message}`})}})},[i,y,m,g,c,u,d]),h=p.useCallback(()=>{t(e(X,{children:s(re,{children:[e(se,{children:e(oe,{children:"Delete Experiments"})}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:"Are you sure you want to delete these experiments? This will also delete all associated annotations and traces, and it cannot be undone."})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{f(),t(null)},children:"Delete Experiments"})})})]})}))},[f]);return s("div",{css:K`
7103
+ `}}}();Mp.hash="4ab310746eb51c6a3fcb799d2c972762";function MT(n){const a=be(),[l,t]=p.useState(null),[i,r]=T.useMutation(Mp),{datasetId:o,selectedExperiments:d,onClearSelection:c,onExperimentsDeleted:u}=n,y=d.length!==1,g=ke(),m=Fe(),f=p.useCallback(()=>{i({variables:{input:{experimentIds:d.map(k=>k.id)}},onCompleted:()=>{g({title:"Experiments Deleted",message:`${d.length} experiment${y?"s":""} have been deleted.`}),u(),c()},onError:k=>{const S=Re(k);m({title:"An error occurred",message:`Failed to delete experiments: ${(S==null?void 0:S[0])??k.message}`})}})},[i,y,m,g,c,u,d]),h=p.useCallback(()=>{t(e(X,{children:s(re,{children:[e(se,{children:e(oe,{children:"Delete Experiments"})}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:"Are you sure you want to delete these experiments? This will also delete all associated annotations and traces, and it cannot be undone."})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{f(),t(null)},children:"Delete Experiments"})})})]})}))},[f]);return s("div",{css:K`
7104
7104
  position: absolute;
7105
7105
  bottom: var(--ac-global-dimension-size-400);
7106
7106
  left: 50%;
7107
7107
  transform: translateX(-50%);
7108
- `,children:[e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:"size-100",children:[e(F,{children:`${d.length} experiment${y?"s":""} selected`}),s(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"default",size:"S",onPress:c,children:"Cancel"}),e(E,{variant:"danger",size:"S",leadingVisual:e(D,{svg:r?e(yn,{}):e(Je,{})}),isDisabled:r,onPress:h,children:r?"Deleting...":"Delete"}),e(E,{variant:"primary",size:"S",onPress:()=>{const k=d[d.length-1].id,S=d.slice(0,-1).map(T=>T.id),C=S.length>0?`?${S.map(T=>`experimentId=${T}`).join("&")}`:"";a(`/datasets/${o}/compare/${k}${C}`)},leadingVisual:e(D,{svg:e(fk,{})}),children:"Compare Experiments"})]})]})}),l]})}const pi=100,VT={minSize:100},Vp=({table:n,hasNext:a,onLoadNext:l,isLoadingNext:t,dataset:i})=>{const r=be();return s("tbody",{children:[n.getRowModel().rows.map(o=>e("tr",{onClick:()=>{r(`/datasets/${i.id}/compare/${o.original.id}`)},children:o.getVisibleCells().map(d=>{const c=`--col-${ua(d.column.id)}-size`;return e("td",{style:{width:`calc(var(${c}) * 1px)`,maxWidth:`calc(var(${c}) * 1px)`},children:ee(d.column.columnDef.cell,d.getContext())},d.id)})},o.id)),a?e(nr,{onLoadMore:l,isLoadingNext:t},"load-more"):null]})},zT=p.memo(Vp,(n,a)=>n.table.options.data===a.table.options.data);function NT({dataset:n}){const a=p.useRef(null),[l,t]=p.useState({}),[i,r]=p.useState({}),{data:o,loadNext:d,hasNext:c,isLoadingNext:u,refetch:y}=P.usePaginationFragment(Ep,n),g=p.useMemo(()=>o.experiments.edges.map(I=>{const M=I.experiment.annotationSummaries.reduce((z,A)=>(z[A.annotationName]=A,z),{});return{...I.experiment,annotationSummaryMap:M}}),[o.experiments.edges]),m=[{id:"select",maxSize:50,header:({table:I})=>e(ea,{checked:I.getIsAllRowsSelected(),indeterminate:I.getIsSomeRowsSelected(),onChange:I.getToggleAllRowsSelectedHandler()}),cell:({row:I})=>e(ea,{checked:I.getIsSelected(),disabled:!I.getCanSelect(),indeterminate:I.getIsSomeSelected(),onChange:I.getToggleSelectedHandler()})},{header:"name",accessorKey:"name",minSize:200,cell:({getValue:I,row:M})=>{const z=M.original.id,A=M.original.sequenceNumber;return s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(ul,{sequenceNumber:A}),e(Oe,{to:`/datasets/${n.id}/compare/${z}`,children:I()})]})}},{header:"description",accessorKey:"description",minSize:300,cell:Be},{header:"created at",accessorKey:"createdAt",cell:we}],f=o.experimentAnnotationSummaries.map(I=>{const{annotationName:M,minScore:z,maxScore:A}=I;return{header:()=>s(b,{direction:"row",gap:"size-100",alignItems:"center",justifyContent:"end",children:[e(F,{children:M}),e(hk,{annotationName:M})]}),id:`annotation-${M}`,meta:{textAlign:"right"},cell:({row:V})=>{const O=V.original.annotationSummaryMap[M];return!O||O.meanScore==null?e("span",{css:K`
7108
+ `,children:[e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:"size-100",children:[e(F,{children:`${d.length} experiment${y?"s":""} selected`}),s(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"default",size:"S",onPress:c,children:"Cancel"}),e(E,{variant:"danger",size:"S",leadingVisual:e(D,{svg:r?e(yn,{}):e(Je,{})}),isDisabled:r,onPress:h,children:r?"Deleting...":"Delete"}),e(E,{variant:"primary",size:"S",onPress:()=>{const k=d[d.length-1].id,S=d.slice(0,-1).map(L=>L.id),P=`?${[k,...S].map(L=>`experimentId=${L}`).join("&")}`;a(`/datasets/${o}/compare${P}`)},leadingVisual:e(D,{svg:e(fk,{})}),children:"Compare Experiments"})]})]})}),l]})}const pi=100,VT={minSize:100},Vp=({table:n,hasNext:a,onLoadNext:l,isLoadingNext:t,dataset:i})=>{const r=be();return s("tbody",{children:[n.getRowModel().rows.map(o=>e("tr",{onClick:()=>{r(`/datasets/${i.id}/compare?experimentId=${o.original.id}`)},children:o.getVisibleCells().map(d=>{const c=`--col-${ua(d.column.id)}-size`;return e("td",{style:{width:`calc(var(${c}) * 1px)`,maxWidth:`calc(var(${c}) * 1px)`},children:ee(d.column.columnDef.cell,d.getContext())},d.id)})},o.id)),a?e(nr,{onLoadMore:l,isLoadingNext:t},"load-more"):null]})},zT=p.memo(Vp,(n,a)=>n.table.options.data===a.table.options.data);function NT({dataset:n}){const a=p.useRef(null),[l,t]=p.useState({}),[i,r]=p.useState({}),{data:o,loadNext:d,hasNext:c,isLoadingNext:u,refetch:y}=T.usePaginationFragment(Ep,n),g=p.useMemo(()=>o.experiments.edges.map(I=>{const M=I.experiment.annotationSummaries.reduce((z,A)=>(z[A.annotationName]=A,z),{});return{...I.experiment,annotationSummaryMap:M}}),[o.experiments.edges]),m=[{id:"select",maxSize:50,header:({table:I})=>e(ea,{checked:I.getIsAllRowsSelected(),indeterminate:I.getIsSomeRowsSelected(),onChange:I.getToggleAllRowsSelectedHandler()}),cell:({row:I})=>e(ea,{checked:I.getIsSelected(),disabled:!I.getCanSelect(),indeterminate:I.getIsSomeSelected(),onChange:I.getToggleSelectedHandler()})},{header:"name",accessorKey:"name",minSize:200,cell:({getValue:I,row:M})=>{const z=M.original.id,A=M.original.sequenceNumber;return s(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(ul,{sequenceNumber:A}),e(Oe,{to:`/datasets/${n.id}/compare?experimentId=${z}`,children:I()})]})}},{header:"description",accessorKey:"description",minSize:300,cell:Be},{header:"created at",accessorKey:"createdAt",cell:we}],f=o.experimentAnnotationSummaries.map(I=>{const{annotationName:M,minScore:z,maxScore:A}=I;return{header:()=>s(b,{direction:"row",gap:"size-100",alignItems:"center",justifyContent:"end",children:[e(F,{children:M}),e(hk,{annotationName:M})]}),id:`annotation-${M}`,meta:{textAlign:"right"},cell:({row:V})=>{const O=V.original.annotationSummaryMap[M];return!O||O.meanScore==null?e("span",{css:K`
7109
7109
  float: right;
7110
- `,children:"--"}):e($T,{annotationName:M,value:O.meanScore,min:z,max:A})}}}),h=[{header:"run count",accessorKey:"runCount",meta:{textAlign:"right"},cell:jo},{header:"avg latency",accessorKey:"averageRunLatencyMs",meta:{textAlign:"right"},cell:({getValue:I})=>{const M=I();return M===null||typeof M!="number"?"--":e(Ye,{latencyMs:M})}},{header:"total cost",accessorKey:"costSummary.total.cost",meta:{textAlign:"right"},cell:({getValue:I})=>{const M=I();return M===null||typeof M!="number"?"--":e(F,{children:`${In(M)}`})}},{header:"total tokens",accessorKey:"costSummary.total.tokens",meta:{textAlign:"right"},cell:({getValue:I,row:M})=>{const z=I(),A=M.original.id;return e(kk,{tokenCountTotal:z,experimentId:A,size:"S"})}},{header:"error rate",accessorKey:"errorRate",meta:{textAlign:"right"},cell:ET},{header:"metadata",accessorKey:"metadata",minSize:200,cell:rl},{id:"actions",maxSize:120,cell:({row:I})=>{const M=I.original.project,z=I.original.metadata;return s(b,{direction:"row",gap:"size-100",children:[e(RT,{experimentId:I.original.id}),e(Ho,{projectId:(M==null?void 0:M.id)||null,experimentId:I.original.id,metadata:z,canDeleteExperiment:!0,onExperimentDeleted:()=>{y({},{fetchPolicy:"store-and-network"})}})]})}}],k=Le({columns:[...m,...f,...h],data:g,state:{rowSelection:l,columnSizing:i},defaultColumn:VT,columnResizeMode:"onChange",onRowSelectionChange:t,onColumnSizingChange:r,getCoreRowModel:_e()}),S=k.getSelectedRowModel().rows,C=S.map(I=>I.original),T=p.useCallback(()=>{t({})},[t]),_=p.useCallback(I=>{if(I){const{scrollHeight:M,scrollTop:z,clientHeight:A}=I;M-z-A<300&&!u&&c&&d(pi)}},[c,u,d]),{columnSizingInfo:x,columnSizing:N}=k.getState(),w=k.getFlatHeaders,[$]=p.useMemo(()=>{const I=w(),M={};for(let z=0;z<I.length;z++){const A=I[z];M[`--header-${ua(A.id)}-size`]=A.getSize(),M[`--col-${ua(A.column.id)}-size`]=A.column.getSize()}return[M]},[w,x,N]);return s("div",{css:K`
7110
+ `,children:"--"}):e($T,{annotationName:M,value:O.meanScore,min:z,max:A})}}}),h=[{header:"run count",accessorKey:"runCount",meta:{textAlign:"right"},cell:jo},{header:"avg latency",accessorKey:"averageRunLatencyMs",meta:{textAlign:"right"},cell:({getValue:I})=>{const M=I();return M===null||typeof M!="number"?"--":e(Ye,{latencyMs:M})}},{header:"total cost",accessorKey:"costSummary.total.cost",meta:{textAlign:"right"},cell:({getValue:I})=>{const M=I();return M===null||typeof M!="number"?"--":e(F,{children:`${In(M)}`})}},{header:"total tokens",accessorKey:"costSummary.total.tokens",meta:{textAlign:"right"},cell:({getValue:I,row:M})=>{const z=I(),A=M.original.id;return e(kk,{tokenCountTotal:z,experimentId:A,size:"S"})}},{header:"error rate",accessorKey:"errorRate",meta:{textAlign:"right"},cell:ET},{header:"metadata",accessorKey:"metadata",minSize:200,cell:rl},{id:"actions",maxSize:120,cell:({row:I})=>{const M=I.original.project,z=I.original.metadata;return s(b,{direction:"row",gap:"size-100",children:[e(RT,{experimentId:I.original.id}),e(Ho,{projectId:(M==null?void 0:M.id)||null,experimentId:I.original.id,metadata:z,canDeleteExperiment:!0,onExperimentDeleted:()=>{y({},{fetchPolicy:"store-and-network"})}})]})}}],k=Le({columns:[...m,...f,...h],data:g,state:{rowSelection:l,columnSizing:i},defaultColumn:VT,columnResizeMode:"onChange",onRowSelectionChange:t,onColumnSizingChange:r,getCoreRowModel:_e()}),S=k.getSelectedRowModel().rows,C=S.map(I=>I.original),P=p.useCallback(()=>{t({})},[t]),L=p.useCallback(I=>{if(I){const{scrollHeight:M,scrollTop:z,clientHeight:A}=I;M-z-A<300&&!u&&c&&d(pi)}},[c,u,d]),{columnSizingInfo:x,columnSizing:N}=k.getState(),w=k.getFlatHeaders,[$]=p.useMemo(()=>{const I=w(),M={};for(let z=0;z<I.length;z++){const A=I[z];M[`--header-${ua(A.id)}-size`]=A.getSize(),M[`--col-${ua(A.column.id)}-size`]=A.column.getSize()}return[M]},[w,x,N]);return s("div",{css:K`
7111
7111
  height: 100%;
7112
7112
  overflow: auto;
7113
- `,ref:a,onScroll:I=>_(I.target),children:[s("table",{css:la,style:{...$,width:k.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:k.getHeaderGroups().map(I=>e("tr",{children:I.headers.map(M=>{var z,A;return e("th",{colSpan:M.colSpan,style:{width:`calc(var(--header-${ua(M.id)}-size) * 1px)`},align:(A=(z=M.column.columnDef)==null?void 0:z.meta)==null?void 0:A.textAlign,children:M.isPlaceholder?null:s(Y,{children:[e("div",{children:e(Xe,{maxWidth:"100%",children:ee(M.column.columnDef.header,M.getContext())})}),e("div",{onMouseDown:M.getResizeHandler(),onTouchStart:M.getResizeHandler(),className:`resizer ${M.column.getIsResizing()?"isResizing":""}`})]})},M.id)})},I.id))}),x.isResizingColumn?e(zT,{table:k,hasNext:c,onLoadNext:()=>d(pi),isLoadingNext:u,dataset:n}):e(Vp,{table:k,hasNext:c,onLoadNext:()=>d(pi),isLoadingNext:u,dataset:n})]}),S.length?e(MT,{datasetId:n.id,selectedExperiments:C,onClearSelection:T,onExperimentsDeleted:()=>{y({},{fetchPolicy:"store-and-network"})}}):null]})}function $T({annotationName:n,value:a,min:l,max:t}){const i=ho(n),r=p.useMemo(()=>{const o=typeof l=="number"?l:0,d=typeof t=="number"?t:1;if(o===d&&d===a)return 100;const c=d-o||1;return(a-o)/c*100},[a,l,t]);return s(De,{children:[e(et,{children:s("div",{css:K`
7113
+ `,ref:a,onScroll:I=>L(I.target),children:[s("table",{css:la,style:{...$,width:k.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:k.getHeaderGroups().map(I=>e("tr",{children:I.headers.map(M=>{var z,A;return e("th",{colSpan:M.colSpan,style:{width:`calc(var(--header-${ua(M.id)}-size) * 1px)`},align:(A=(z=M.column.columnDef)==null?void 0:z.meta)==null?void 0:A.textAlign,children:M.isPlaceholder?null:s(Y,{children:[e("div",{children:e(Xe,{maxWidth:"100%",children:ee(M.column.columnDef.header,M.getContext())})}),e("div",{onMouseDown:M.getResizeHandler(),onTouchStart:M.getResizeHandler(),className:`resizer ${M.column.getIsResizing()?"isResizing":""}`})]})},M.id)})},I.id))}),x.isResizingColumn?e(zT,{table:k,hasNext:c,onLoadNext:()=>d(pi),isLoadingNext:u,dataset:n}):e(Vp,{table:k,hasNext:c,onLoadNext:()=>d(pi),isLoadingNext:u,dataset:n})]}),S.length?e(MT,{datasetId:n.id,selectedExperiments:C,onClearSelection:P,onExperimentsDeleted:()=>{y({},{fetchPolicy:"store-and-network"})}}):null]})}function $T({annotationName:n,value:a,min:l,max:t}){const i=ho(n),r=p.useMemo(()=>{const o=typeof l=="number"?l:0,d=typeof t=="number"?t:1;if(o===d&&d===a)return 100;const c=d-o||1;return(a-o)/c*100},[a,l,t]);return s(De,{children:[e(et,{children:s("div",{css:K`
7114
7114
  float: right;
7115
7115
  --mod-barloader-fill-color: ${i};
7116
7116
  display: flex;
@@ -7250,7 +7250,7 @@ fragment ExperimentCompareTable_comparisons_1EMHxr on Query {
7250
7250
  border-color: var(--ac-global-color-danger);
7251
7251
  }
7252
7252
  box-sizing: border-box;
7253
- `;function QT(n){const a=n.matchBefore(/\w*/);return!a||a.from==a.to&&!n.explicit?null:{from:a.from,options:[{label:"input",type:"variable",info:"The input of the dataset example"},{label:"reference_output",type:"variable",info:"The reference output of the dataset example"},{label:"metadata",type:"variable",info:"The metadata of the dataset example"},{label:"output",type:"variable",info:"The output of the experiment run"},{label:"error",type:"variable",info:"The error message of the experiment run (if exists)"},{label:"latency_ms",type:"variable",info:"The duration of the experiment run in milliseconds"},{label:"evals",type:"variable",info:"The evaluations of the experiment run"},{label:"search input",type:"text",apply:"'' in input",detail:"macro"},{label:"search reference output",type:"text",apply:"'' in reference_output",detail:"macro"},{label:"search output",type:"text",apply:"'' in output",detail:"macro"},{label:"has error",type:"text",apply:"error is not None",detail:"macro"},{label:"Latency >= 10s",type:"text",apply:"latency_ms >= 10_000",detail:"macro"},{label:"Hallucinations",type:"text",apply:"evals['hallucination'].label == 'hallucinated'",detail:"macro"},{label:"Metadata",type:"text",apply:"metadata['category'] == 'hard_examples'",detail:"macro"}]}}async function BT(n,a){if(!n)return{isValid:!0,errorMessage:null};const l=await Wl.fetchQuery(ve,$p,{condition:n,experimentIds:a}).toPromise();if(!l)throw new Error("Filter condition validation is null");return l.validateExperimentRunFilterCondition}const qT=[tr.of([{key:"Enter",run:n=>!0}]),nt(),Jo({override:[QT]})];function UT(n){const{onValidCondition:a,placeholder:l=`filter condition (e.g., evals["Hallucination"].label == 'hallucinated')`}=n,[t,i]=p.useState(!1),[r,o]=p.useState(""),{filterCondition:d,setFilterCondition:c,appendFilterCondition:u}=jT(),y=p.useDeferredValue(d),{theme:g}=ha(),m=g==="light"?Na:$a,[f]=Sn(),h=f.getAll("experimentId"),k=p.useRef(null);p.useEffect(()=>{BT(y,h).then(T=>{T!=null&&T.isValid?(o(""),p.startTransition(()=>{a(y)})):o((T==null?void 0:T.errorMessage)??"Invalid filter condition")})},[a,y,h]);const S=r!=="";return s("div",{"data-is-focused":t,"data-is-invalid":S,css:Qp,ref:k,children:[s(b,{direction:"row",children:[e(Ri,{children:e(D,{svg:e(er,{})})}),e(ja,{css:Op,indentWithTab:!1,basicSetup:{lineNumbers:!1,foldGutter:!1,bracketMatching:!0,syntaxHighlighting:!0,highlightActiveLine:!1,highlightActiveLineGutter:!1,defaultKeymap:!1},onFocus:()=>i(!0),onBlur:()=>i(!1),value:d,onChange:c,height:"36px",width:"100%",theme:m,placeholder:l,extensions:qT}),e("button",{css:K`
7253
+ `;function QT(n){const a=n.matchBefore(/\w*/);return!a||a.from==a.to&&!n.explicit?null:{from:a.from,options:[{label:"input",type:"variable",info:"The input of the dataset example"},{label:"reference_output",type:"variable",info:"The reference output of the dataset example"},{label:"metadata",type:"variable",info:"The metadata of the dataset example"},{label:"output",type:"variable",info:"The output of the experiment run"},{label:"error",type:"variable",info:"The error message of the experiment run (if exists)"},{label:"latency_ms",type:"variable",info:"The duration of the experiment run in milliseconds"},{label:"evals",type:"variable",info:"The evaluations of the experiment run"},{label:"search input",type:"text",apply:"'' in input",detail:"macro"},{label:"search reference output",type:"text",apply:"'' in reference_output",detail:"macro"},{label:"search output",type:"text",apply:"'' in output",detail:"macro"},{label:"has error",type:"text",apply:"error is not None",detail:"macro"},{label:"Latency >= 10s",type:"text",apply:"latency_ms >= 10_000",detail:"macro"},{label:"Hallucinations",type:"text",apply:"evals['hallucination'].label == 'hallucinated'",detail:"macro"},{label:"Metadata",type:"text",apply:"metadata['category'] == 'hard_examples'",detail:"macro"}]}}async function BT(n,a){if(!n)return{isValid:!0,errorMessage:null};const l=await Wl.fetchQuery(ve,$p,{condition:n,experimentIds:a}).toPromise();if(!l)throw new Error("Filter condition validation is null");return l.validateExperimentRunFilterCondition}const qT=[tr.of([{key:"Enter",run:n=>!0}]),nt(),Jo({override:[QT]})];function UT(n){const{onValidCondition:a,placeholder:l=`filter condition (e.g., evals["Hallucination"].label == 'hallucinated')`}=n,[t,i]=p.useState(!1),[r,o]=p.useState(""),{filterCondition:d,setFilterCondition:c,appendFilterCondition:u}=jT(),y=p.useDeferredValue(d),{theme:g}=ha(),m=g==="light"?Na:$a,[f]=Sn(),h=f.getAll("experimentId"),k=p.useRef(null);p.useEffect(()=>{BT(y,h).then(P=>{P!=null&&P.isValid?(o(""),p.startTransition(()=>{a(y)})):o((P==null?void 0:P.errorMessage)??"Invalid filter condition")})},[a,y,h]);const S=r!=="";return s("div",{"data-is-focused":t,"data-is-invalid":S,css:Qp,ref:k,children:[s(b,{direction:"row",children:[e(Ri,{children:e(D,{svg:e(er,{})})}),e(ja,{css:Op,indentWithTab:!1,basicSetup:{lineNumbers:!1,foldGutter:!1,bracketMatching:!0,syntaxHighlighting:!0,highlightActiveLine:!1,highlightActiveLineGutter:!1,defaultKeymap:!1},onFocus:()=>i(!0),onBlur:()=>i(!1),value:d,onChange:c,height:"36px",width:"100%",theme:m,placeholder:l,extensions:qT}),e("button",{css:K`
7254
7254
  margin-right: var(--ac-global-dimension-static-size-100);
7255
7255
  color: var(--ac-global-text-color-700);
7256
7256
  visibility: ${d!==""?"visible":"hidden"};
@@ -7278,7 +7278,7 @@ fragment ExperimentCompareTable_comparisons_1EMHxr on Query {
7278
7278
  align-items: center;
7279
7279
  color: var(--ac-global-color-primary);
7280
7280
  gap: var(--ac-global-dimension-size-50);
7281
- `;function JT(n){const[a,l]=p.useState(null),{datasetId:t,baselineExperimentId:i,compareExperimentIds:r,displayFullText:o}=n,[d,c]=p.useState(""),u=p.useRef(null),[y,g]=Sn(),{data:m,loadNext:f,hasNext:h,isLoadingNext:k,refetch:S}=P.usePaginationFragment(Np,n.query),C=p.useMemo(()=>{var A,V;return((V=(A=m.dataset)==null?void 0:A.experiments)==null?void 0:V.edges.reduce((O,H)=>{var te,He;return O[H.experiment.id]={...H.experiment,projectId:((He=(te=H.experiment)==null?void 0:te.project)==null?void 0:He.id)||null},O},{}))||{}},[m]),T=p.useMemo(()=>m.compareExperiments.edges.map(A=>{const V=A.comparison,O=V.runComparisonItems.reduce((H,te)=>(H[te.experimentId]=te,H),{});return{...V,id:V.example.id,input:V.example.revision.input,referenceOutput:V.example.revision.referenceOutput,runComparisonMap:O}}),[m]),_=p.useMemo(()=>[{header:"input",accessorKey:"input",cell:({row:A})=>s(Y,{children:[e(il,{extra:s(De,{children:[e(da,{size:"S",onPress:()=>{l(e(kr,{exampleId:A.original.example.id}))},children:e(D,{svg:e(Ol,{})})}),s(Cn,{children:[e(dn,{}),"view example"]})]}),children:e(F,{size:"S",color:"text-500",children:`example ${A.original.example.id}`})}),e(mt,{children:e(xr,{children:e(kl,{json:A.original.input,disableTitle:!0,space:o?2:0})})})]})},{header:"reference output",accessorKey:"referenceOutput",cell:A=>s(Y,{children:[e(il,{children:e(F,{size:"S",color:"text-500",children:"reference"})}),e(mt,{children:o?nP(A):rl(A)})]})}],[o,l]),x=p.useMemo(()=>[i,...r].map(A=>({header:()=>{var He,Fn,mn,En;const V=(He=C[A])==null?void 0:He.name,O=(Fn=C[A])==null?void 0:Fn.metadata,H=(mn=C[A])==null?void 0:mn.projectId,te=((En=C[A])==null?void 0:En.sequenceNumber)||0;return s(b,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",justifyContent:"space-between",children:[s(b,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",children:[e(ul,{sequenceNumber:te}),e(F,{children:V})]}),e(Ho,{experimentId:A,metadata:O,isQuiet:!0,projectId:H,canDeleteExperiment:!1})]})},accessorKey:A,minSize:500,cell:({row:V})=>{var B,ye;const O=V.original.runComparisonMap[A],H=(O==null?void 0:O.runs.length)||0;if(H===0)return e(As,{});if(H>1)return e(F,{color:"warning",children:`${H} runs`});const te=O==null?void 0:O.runs[0];let He=null;const Fn=(B=te==null?void 0:te.trace)==null?void 0:B.traceId,mn=(ye=te==null?void 0:te.trace)==null?void 0:ye.projectId;return Fn&&mn&&(He=s(De,{children:[e(da,{className:"trace-button",size:"S","aria-label":"View run trace",onPress:()=>{l(e(Hp,{traceId:Fn,projectId:mn,title:"Experiment Run Trace"}))},children:e(D,{svg:e(At,{})})}),s(Cn,{children:[e(dn,{}),"view run trace"]})]})),te?s(Y,{children:[e(il,{extra:s(Y,{children:[s(De,{children:[e(da,{className:"expand-button",size:"S","aria-label":"View example run details",onPress:()=>{l(e(aP,{selectedExample:V.original,datasetId:t,experimentInfoById:C}))},children:e(D,{svg:e(Ol,{})})}),s(Cn,{children:[e(dn,{}),"view experiment run"]})]}),He]}),children:e(YT,{...te})}),e(mt,{children:e(eP,{...te,displayFullText:o,setDialog:l})})]}):e(mt,{children:e(As,{})})}})),[i,r,C,t,o]),N=p.useMemo(()=>[..._,...x],[_,x]),w=Le({columns:N,data:T,getCoreRowModel:_e(),columnResizeMode:"onChange"}),$=Kn.useMemo(()=>{const A=w.getFlatHeaders(),V={};for(let O=0;O<A.length;O++){const H=A[O];V[`--header-${ua(H.id)}-size`]=H.getSize(),V[`--col-${ua(H.column.id)}-size`]=H.column.getSize()}return V},[w.getState().columnSizingInfo,w.getState().columnSizing]),M=w.getRowModel().rows.length===0,z=p.useCallback(A=>{if(A){const{scrollHeight:V,scrollTop:O,clientHeight:H}=A;V-O-H<300&&!k&&h&&f(50)}},[h,k,f]);return p.useEffect(()=>{p.startTransition(()=>{S({after:null,first:50,filterCondition:d,baselineExperimentId:i,compareExperimentIds:r,datasetId:t},{fetchPolicy:"store-and-network"})})},[t,i,r,d,S]),s(v,{overflow:"auto",children:[s(b,{direction:"column",height:"100%",children:[e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:e(UT,{onValidCondition:c})}),e("div",{css:GT,onScroll:A=>z(A.target),ref:u,children:s("table",{css:K(nn,Ko),style:{...$,width:w.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:w.getHeaderGroups().map(A=>e("tr",{children:A.headers.map(V=>e("th",{colSpan:V.colSpan,style:{width:`calc(var(--header-${ua(V==null?void 0:V.id)}-size) * 1px)`},children:V.isPlaceholder?null:s(Y,{children:[s("div",{className:V.column.getCanSort()?"sort":"",onClick:V.column.getToggleSortingHandler(),style:{left:V.getStart(),width:"100%"},children:[e(Xe,{maxWidth:"100%",children:ee(V.column.columnDef.header,V.getContext())}),V.column.getIsSorted()?e(D,{className:"sort-icon",svg:V.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]}),e("div",{onMouseDown:V.getResizeHandler(),onTouchStart:V.getResizeHandler(),className:`resizer ${V.column.getIsResizing()?"isResizing":""}`})]})},V.id))},A.id))}),M?e(vn,{}):w.getState().columnSizingInfo.isResizingColumn?e(ZT,{table:w,hasNext:h,onLoadNext:()=>f(50),isLoadingNext:k}):e(Bp,{table:w,hasNext:h,onLoadNext:()=>f(50),isLoadingNext:k})]})})]}),e(ne,{isOpen:!!a,onOpenChange:()=>{y.delete("selectedSpanNodeId"),g(y,{replace:!0}),l(null)},children:e(Z,{variant:"slideover",size:"fullscreen",children:e(p.Suspense,{children:a})})})]})}function Bp({table:n,hasNext:a,onLoadNext:l,isLoadingNext:t}){return s("tbody",{children:[n.getRowModel().rows.map(i=>e("tr",{children:i.getVisibleCells().map(r=>e("td",{style:{width:`calc(var(--col-${ua(r.column.id)}-size) * 1px)`,maxWidth:`calc(var(--col-${ua(r.column.id)}-size) * 1px)`,padding:0},children:ee(r.column.columnDef.cell,r.getContext())},r.id))},i.id)),a?e(nr,{onLoadMore:l,isLoadingNext:t},"load-more"):null]})}const ZT=Kn.memo(Bp,(n,a)=>n.table.options.data===a.table.options.data);function XT(n){const{datasetId:a,exampleId:l}=n,t=be();return e("div",{onClick:i=>{i.preventDefault(),i.stopPropagation()},children:s(J,{children:[s(De,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(Nl,{})})}),s(Cn,{children:[e(dn,{}),"More actions"]})]}),e(kn,{children:e(X,{children:({close:i})=>e(ma,{style:{minHeight:"auto"},onAction:r=>{switch(r){case"gotoExample":{t(`/datasets/${a}/examples/${l}`);break}default:Ee()}i()},children:e(Vl,{id:"gotoExample",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Ck,{})}),e(F,{children:"Go to example"})]})})})})})]})})}function YT(n){var d,c;const{id:a,startTime:l,endTime:t,costSummary:i}=n,r=(d=i==null?void 0:i.total)==null?void 0:d.tokens,o=(c=i==null?void 0:i.total)==null?void 0:c.cost;return s(b,{direction:"row",gap:"size-100",children:[e(Up,{startTime:l,endTime:t}),r!=null&&a?e(Sk,{tokenCountTotal:r,experimentRunId:a,size:"S"}):e(vk,{size:"S",children:r}),o!=null&&a?e(Fk,{totalCost:o,experimentRunId:a,size:"S"}):null]})}function eP(n){const{output:a,error:l,annotations:t,displayFullText:i,setDialog:r}=n;if(l)return e(qp,{error:l});const o=t!=null&&t.edges.length?t.edges.map(d=>d.annotation):[];return s(b,{direction:"column",gap:"size-100",height:"100%",justifyContent:"space-between",children:[e(xr,{children:e(kl,{json:a,disableTitle:!0,space:i?2:0})}),e("ul",{css:K`
7281
+ `;function JT(n){const[a,l]=p.useState(null),{datasetId:t,baselineExperimentId:i,compareExperimentIds:r,displayFullText:o}=n,[d,c]=p.useState(""),u=p.useRef(null),[y,g]=Sn(),{data:m,loadNext:f,hasNext:h,isLoadingNext:k,refetch:S}=T.usePaginationFragment(Np,n.query),C=p.useMemo(()=>{var A,V;return((V=(A=m.dataset)==null?void 0:A.experiments)==null?void 0:V.edges.reduce((O,H)=>{var te,He;return O[H.experiment.id]={...H.experiment,projectId:((He=(te=H.experiment)==null?void 0:te.project)==null?void 0:He.id)||null},O},{}))||{}},[m]),P=p.useMemo(()=>m.compareExperiments.edges.map(A=>{const V=A.comparison,O=V.runComparisonItems.reduce((H,te)=>(H[te.experimentId]=te,H),{});return{...V,id:V.example.id,input:V.example.revision.input,referenceOutput:V.example.revision.referenceOutput,runComparisonMap:O}}),[m]),L=p.useMemo(()=>[{header:"input",accessorKey:"input",cell:({row:A})=>s(Y,{children:[e(il,{extra:s(De,{children:[e(da,{size:"S",onPress:()=>{l(e(kr,{exampleId:A.original.example.id}))},children:e(D,{svg:e(Ol,{})})}),s(Cn,{children:[e(dn,{}),"view example"]})]}),children:e(F,{size:"S",color:"text-500",children:`example ${A.original.example.id}`})}),e(mt,{children:e(xr,{children:e(kl,{json:A.original.input,disableTitle:!0,space:o?2:0})})})]})},{header:"reference output",accessorKey:"referenceOutput",cell:A=>s(Y,{children:[e(il,{children:e(F,{size:"S",color:"text-500",children:"reference"})}),e(mt,{children:o?nP(A):rl(A)})]})}],[o,l]),x=p.useMemo(()=>[i,...r].map(A=>({header:()=>{var He,Fn,mn,En;const V=(He=C[A])==null?void 0:He.name,O=(Fn=C[A])==null?void 0:Fn.metadata,H=(mn=C[A])==null?void 0:mn.projectId,te=((En=C[A])==null?void 0:En.sequenceNumber)||0;return s(b,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",justifyContent:"space-between",children:[s(b,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",children:[e(ul,{sequenceNumber:te}),e(F,{children:V})]}),e(Ho,{experimentId:A,metadata:O,isQuiet:!0,projectId:H,canDeleteExperiment:!1})]})},accessorKey:A,minSize:500,cell:({row:V})=>{var B,ye;const O=V.original.runComparisonMap[A],H=(O==null?void 0:O.runs.length)||0;if(H===0)return e(As,{});if(H>1)return e(F,{color:"warning",children:`${H} runs`});const te=O==null?void 0:O.runs[0];let He=null;const Fn=(B=te==null?void 0:te.trace)==null?void 0:B.traceId,mn=(ye=te==null?void 0:te.trace)==null?void 0:ye.projectId;return Fn&&mn&&(He=s(De,{children:[e(da,{className:"trace-button",size:"S","aria-label":"View run trace",onPress:()=>{l(e(Hp,{traceId:Fn,projectId:mn,title:"Experiment Run Trace"}))},children:e(D,{svg:e(At,{})})}),s(Cn,{children:[e(dn,{}),"view run trace"]})]})),te?s(Y,{children:[e(il,{extra:s(Y,{children:[s(De,{children:[e(da,{className:"expand-button",size:"S","aria-label":"View example run details",onPress:()=>{l(e(aP,{selectedExample:V.original,datasetId:t,experimentInfoById:C}))},children:e(D,{svg:e(Ol,{})})}),s(Cn,{children:[e(dn,{}),"view experiment run"]})]}),He]}),children:e(YT,{...te})}),e(mt,{children:e(eP,{...te,displayFullText:o,setDialog:l})})]}):e(mt,{children:e(As,{})})}})),[i,r,C,t,o]),N=p.useMemo(()=>[...L,...x],[L,x]),w=Le({columns:N,data:P,getCoreRowModel:_e(),columnResizeMode:"onChange"}),$=Kn.useMemo(()=>{const A=w.getFlatHeaders(),V={};for(let O=0;O<A.length;O++){const H=A[O];V[`--header-${ua(H.id)}-size`]=H.getSize(),V[`--col-${ua(H.column.id)}-size`]=H.column.getSize()}return V},[w.getState().columnSizingInfo,w.getState().columnSizing]),M=w.getRowModel().rows.length===0,z=p.useCallback(A=>{if(A){const{scrollHeight:V,scrollTop:O,clientHeight:H}=A;V-O-H<300&&!k&&h&&f(50)}},[h,k,f]);return p.useEffect(()=>{p.startTransition(()=>{S({after:null,first:50,filterCondition:d,baselineExperimentId:i,compareExperimentIds:r,datasetId:t},{fetchPolicy:"store-and-network"})})},[t,i,r,d,S]),s(v,{overflow:"auto",children:[s(b,{direction:"column",height:"100%",children:[e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:e(UT,{onValidCondition:c})}),e("div",{css:GT,onScroll:A=>z(A.target),ref:u,children:s("table",{css:K(nn,Ko),style:{...$,width:w.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:w.getHeaderGroups().map(A=>e("tr",{children:A.headers.map(V=>e("th",{colSpan:V.colSpan,style:{width:`calc(var(--header-${ua(V==null?void 0:V.id)}-size) * 1px)`},children:V.isPlaceholder?null:s(Y,{children:[s("div",{className:V.column.getCanSort()?"sort":"",onClick:V.column.getToggleSortingHandler(),style:{left:V.getStart(),width:"100%"},children:[e(Xe,{maxWidth:"100%",children:ee(V.column.columnDef.header,V.getContext())}),V.column.getIsSorted()?e(D,{className:"sort-icon",svg:V.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]}),e("div",{onMouseDown:V.getResizeHandler(),onTouchStart:V.getResizeHandler(),className:`resizer ${V.column.getIsResizing()?"isResizing":""}`})]})},V.id))},A.id))}),M?e(vn,{}):w.getState().columnSizingInfo.isResizingColumn?e(ZT,{table:w,hasNext:h,onLoadNext:()=>f(50),isLoadingNext:k}):e(Bp,{table:w,hasNext:h,onLoadNext:()=>f(50),isLoadingNext:k})]})})]}),e(ne,{isOpen:!!a,onOpenChange:()=>{y.delete("selectedSpanNodeId"),g(y,{replace:!0}),l(null)},children:e(Z,{variant:"slideover",size:"fullscreen",children:e(p.Suspense,{children:a})})})]})}function Bp({table:n,hasNext:a,onLoadNext:l,isLoadingNext:t}){return s("tbody",{children:[n.getRowModel().rows.map(i=>e("tr",{children:i.getVisibleCells().map(r=>e("td",{style:{width:`calc(var(--col-${ua(r.column.id)}-size) * 1px)`,maxWidth:`calc(var(--col-${ua(r.column.id)}-size) * 1px)`,padding:0},children:ee(r.column.columnDef.cell,r.getContext())},r.id))},i.id)),a?e(nr,{onLoadMore:l,isLoadingNext:t},"load-more"):null]})}const ZT=Kn.memo(Bp,(n,a)=>n.table.options.data===a.table.options.data);function XT(n){const{datasetId:a,exampleId:l}=n,t=be();return e("div",{onClick:i=>{i.preventDefault(),i.stopPropagation()},children:s(J,{children:[s(De,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(Nl,{})})}),s(Cn,{children:[e(dn,{}),"More actions"]})]}),e(kn,{children:e(X,{children:({close:i})=>e(ma,{style:{minHeight:"auto"},onAction:r=>{switch(r){case"gotoExample":{t(`/datasets/${a}/examples/${l}`);break}default:Ee()}i()},children:e(Vl,{id:"gotoExample",children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Ck,{})}),e(F,{children:"Go to example"})]})})})})})]})})}function YT(n){var d,c;const{id:a,startTime:l,endTime:t,costSummary:i}=n,r=(d=i==null?void 0:i.total)==null?void 0:d.tokens,o=(c=i==null?void 0:i.total)==null?void 0:c.cost;return s(b,{direction:"row",gap:"size-100",children:[e(Up,{startTime:l,endTime:t}),r!=null&&a?e(Sk,{tokenCountTotal:r,experimentRunId:a,size:"S"}):e(vk,{size:"S",children:r}),o!=null&&a?e(Fk,{totalCost:o,experimentRunId:a,size:"S"}):null]})}function eP(n){const{output:a,error:l,annotations:t,displayFullText:i,setDialog:r}=n;if(l)return e(qp,{error:l});const o=t!=null&&t.edges.length?t.edges.map(d=>d.annotation):[];return s(b,{direction:"column",gap:"size-100",height:"100%",justifyContent:"space-between",children:[e(xr,{children:e(kl,{json:a,disableTitle:!0,space:i?2:0})}),e("ul",{css:K`
7282
7282
  display: flex;
7283
7283
  flex-direction: row;
7284
7284
  gap: var(--ac-global-dimension-static-size-100);
@@ -7309,25 +7309,18 @@ fragment ExperimentCompareTable_comparisons_1EMHxr on Query {
7309
7309
  gap: var(
7310
7310
  --ac-global-dimension-static-size-100
7311
7311
  );
7312
- `,children:(d=r.annotations)==null?void 0:d.edges.map(c=>e("li",{children:e(fl,{annotation:c.annotation})},c.annotation.id))})]})]})},o)})})})},t.experimentId)})})})]})})]})]})})}function Hp({traceId:n,projectId:a,title:l}){const t=be();return e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:l}),s(ue,{children:[e(E,{size:"S",onPress:()=>t(`/projects/${a}/traces/${n}`),children:"View Trace in Project"}),e(me,{})]})]}),e(p.Suspense,{fallback:e(pe,{}),children:e(vr,{traceId:n,projectId:a})})]})})}function mt({children:n}){return e(v,{paddingX:"size-200",paddingY:"size-100",children:n})}const Gp=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null};return{argumentDefinitions:[{kind:"RootArgument",name:"baselineExperimentId"},{kind:"RootArgument",name:"datasetId"},{defaultValue:null,kind:"LocalArgument",name:"hasBaselineExperimentId"}],kind:"Fragment",metadata:null,name:"ExperimentMultiSelector__data",selections:[{alias:"dataset",args:[{kind:"Variable",name:"id",variableName:"datasetId"}],concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[n,{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[n,a,{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Dataset",abstractKey:null}],storageKey:null},{condition:"hasBaselineExperimentId",kind:"Condition",passingValue:!0,selections:[{alias:"baselineExperiment",args:[{kind:"Variable",name:"id",variableName:"baselineExperimentId"}],concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[n,a],type:"Experiment",abstractKey:null}],storageKey:null}]}],type:"Query",abstractKey:null}}();Gp.hash="0339567f8094904cd05e8fc4e8a5ef1a";function lP(n){const{selectedBaselineExperimentId:a,selectedCompareExperimentIds:l,onChange:t,dataRef:i}=n,r=P.useFragment(Gp,i),o=p.useMemo(()=>{var u;return((u=r.dataset.experiments)==null?void 0:u.edges.map(y=>y.experiment))??[]},[r]),d=p.useMemo(()=>{var u;return((u=r.baselineExperiment)==null?void 0:u.name)??"No baseline selected"},[r.baselineExperiment]),c=p.useMemo(()=>{const u=l.length;return u>0?`${u} experiment${u>1?"s":""}`:"No experiments selected"},[l]);return s(b,{direction:"row",gap:"size-100",children:[s("div",{css:K(Ci,Gr),children:[e(W,{children:"baseline experiment"}),s(J,{children:[e(E,{size:"M",trailingVisual:e(Ha,{}),children:d}),e(kn,{placement:"bottom start",children:e(X,{children:e(ma,{selectionMode:"single",selectionBehavior:"replace",selectedKeys:new Set(a?[a]:[]),onSelectionChange:u=>{const[y]=u;qe(typeof y!="number");const g=[...a?[a]:[],...l.filter(m=>m!==y)];t(y,g)},children:o.map(u=>e(Vl,{id:u.id,children:({isSelected:y})=>s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[s(b,{direction:"column",gap:"size-50",children:[s(b,{direction:"row",gap:"size-100",children:[e(ul,{sequenceNumber:u.sequenceNumber}),e(F,{children:u.name})]}),e(F,{size:"XS",color:"text-700",children:new Date(u.createdAt).toLocaleString()})]}),y&&e(D,{svg:e(Hr,{})})]})},u.id))})})})]})]}),a&&s("div",{css:K(Ci,Gr),children:[e(W,{children:"compare experiments"}),s(J,{children:[e(E,{size:"M",trailingVisual:e(Ha,{}),children:c}),e(kn,{placement:"bottom start",children:e(X,{children:e(ma,{selectionMode:"multiple",selectedKeys:new Set(l),onSelectionChange:u=>{u==="all"?t(a,o.map(y=>y.id)):t(a,Array.from(u))},children:o.filter(u=>u.id!==a).map(u=>e(Vl,{id:u.id,children:({isSelected:y})=>s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[s(b,{direction:"column",gap:"size-50",children:[s(b,{direction:"row",gap:"size-100",children:[e(ul,{sequenceNumber:u.sequenceNumber}),e(F,{children:u.name})]}),e(F,{size:"XS",color:"text-700",children:new Date(u.createdAt).toLocaleString()})]}),y&&e(D,{svg:e(Hr,{})})]})},u.id))})})})]})]})]})}function GI(){const n=Ue();qe(n);const[a,l]=p.useState(!1),{datasetId:t,baselineExperimentId:i}=We();qe(t!=null);const[r]=Sn(),o=r.getAll("experimentId"),d=be();return s("main",{css:K`
7312
+ `,children:(d=r.annotations)==null?void 0:d.edges.map(c=>e("li",{children:e(fl,{annotation:c.annotation})},c.annotation.id))})]})]})},o)})})})},t.experimentId)})})})]})})]})]})})}function Hp({traceId:n,projectId:a,title:l}){const t=be();return e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:l}),s(ue,{children:[e(E,{size:"S",onPress:()=>t(`/projects/${a}/traces/${n}`),children:"View Trace in Project"}),e(me,{})]})]}),e(p.Suspense,{fallback:e(pe,{}),children:e(vr,{traceId:n,projectId:a})})]})})}function mt({children:n}){return e(v,{paddingX:"size-200",paddingY:"size-100",children:n})}const Gp=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null};return{argumentDefinitions:[{kind:"RootArgument",name:"baselineExperimentId"},{kind:"RootArgument",name:"datasetId"},{defaultValue:null,kind:"LocalArgument",name:"hasBaselineExperimentId"}],kind:"Fragment",metadata:null,name:"ExperimentMultiSelector__data",selections:[{alias:"dataset",args:[{kind:"Variable",name:"id",variableName:"datasetId"}],concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[n,{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[n,a,{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Dataset",abstractKey:null}],storageKey:null},{condition:"hasBaselineExperimentId",kind:"Condition",passingValue:!0,selections:[{alias:"baselineExperiment",args:[{kind:"Variable",name:"id",variableName:"baselineExperimentId"}],concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[n,a],type:"Experiment",abstractKey:null}],storageKey:null}]}],type:"Query",abstractKey:null}}();Gp.hash="0339567f8094904cd05e8fc4e8a5ef1a";function lP(n){const{selectedBaselineExperimentId:a,selectedCompareExperimentIds:l,onChange:t,dataRef:i}=n,r=T.useFragment(Gp,i),o=p.useMemo(()=>{var u;return((u=r.dataset.experiments)==null?void 0:u.edges.map(y=>y.experiment))??[]},[r]),d=p.useMemo(()=>{var u;return((u=r.baselineExperiment)==null?void 0:u.name)??"No baseline selected"},[r.baselineExperiment]),c=p.useMemo(()=>{const u=l.length;return u>0?`${u} experiment${u>1?"s":""}`:"No experiments selected"},[l]);return s(b,{direction:"row",gap:"size-100",children:[s("div",{css:K(Ci,Gr),children:[e(W,{children:"baseline experiment"}),s(J,{children:[e(E,{size:"M",trailingVisual:e(Ha,{}),children:d}),e(kn,{placement:"bottom start",children:e(X,{children:e(ma,{selectionMode:"single",selectionBehavior:"replace",selectedKeys:new Set(a?[a]:[]),onSelectionChange:u=>{const[y]=u;qe(typeof y!="number");const g=[...a?[a]:[],...l.filter(m=>m!==y)];t(y,g)},children:o.map(u=>e(Vl,{id:u.id,children:({isSelected:y})=>s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[s(b,{direction:"column",gap:"size-50",children:[s(b,{direction:"row",gap:"size-100",children:[e(ul,{sequenceNumber:u.sequenceNumber}),e(F,{children:u.name})]}),e(F,{size:"XS",color:"text-700",children:new Date(u.createdAt).toLocaleString()})]}),y&&e(D,{svg:e(Hr,{})})]})},u.id))})})})]})]}),a&&s("div",{css:K(Ci,Gr),children:[e(W,{children:"compare experiments"}),s(J,{children:[e(E,{size:"M",trailingVisual:e(Ha,{}),children:c}),e(kn,{placement:"bottom start",children:e(X,{children:e(ma,{selectionMode:"multiple",selectedKeys:new Set(l),onSelectionChange:u=>{u==="all"?t(a,o.map(y=>y.id)):t(a,Array.from(u))},children:o.filter(u=>u.id!==a).map(u=>e(Vl,{id:u.id,children:({isSelected:y})=>s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[s(b,{direction:"column",gap:"size-50",children:[s(b,{direction:"row",gap:"size-100",children:[e(ul,{sequenceNumber:u.sequenceNumber}),e(F,{children:u.name})]}),e(F,{size:"XS",color:"text-700",children:new Date(u.createdAt).toLocaleString()})]}),y&&e(D,{svg:e(Hr,{})})]})},u.id))})})})]})]})]})}function GI(){const n=Ue();qe(n);const[a,l]=p.useState(!1),{datasetId:t}=We();qe(t!=null);const[i]=Sn(),[r=void 0,...o]=i.getAll("experimentId"),d=be();return s("main",{css:K`
7313
7313
  height: 100%;
7314
7314
  display: flex;
7315
7315
  flex-direction: column;
7316
7316
  overflow: hidden;
7317
- `,children:[e(v,{padding:"size-200",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"end",children:[e(lP,{dataRef:n,selectedBaselineExperimentId:i,selectedCompareExperimentIds:o,onChange:(c,u)=>{p.startTransition(()=>{if(c==null)d(`/datasets/${t}/compare`);else{const y=u.length>0?`?${u.map(g=>`experimentId=${g}`).join("&")}`:"";d(`/datasets/${t}/compare/${c}${y}`)}})}}),e(Ea,{onChange:c=>{l(c)},defaultSelected:!1,labelPlacement:"start",children:"Full Text"})]})}),i!=null?e(OT,{children:e(p.Suspense,{fallback:e(pe,{}),children:e(JT,{query:n,datasetId:t,baselineExperimentId:i,compareExperimentIds:o,displayFullText:a})})}):e(v,{padding:"size-200",children:e(Ke,{variant:"info",title:"No Baseline Experiment Selected",children:"Please select a baseline experiment."})})]})}const Wp=function(){var n={defaultValue:null,kind:"LocalArgument",name:"baselineExperimentId"},a={defaultValue:null,kind:"LocalArgument",name:"compareExperimentIds"},l={defaultValue:null,kind:"LocalArgument",name:"datasetId"},t={defaultValue:null,kind:"LocalArgument",name:"hasBaselineExperimentId"},i={kind:"Variable",name:"baselineExperimentId",variableName:"baselineExperimentId"},r={kind:"Variable",name:"compareExperimentIds",variableName:"compareExperimentIds"},o=[{kind:"Variable",name:"id",variableName:"baselineExperimentId"}],d={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},c={kind:"InlineFragment",selections:[d],type:"Experiment",abstractKey:null},u=[{kind:"Variable",name:"id",variableName:"datasetId"}],y={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},m=[i,r,{kind:"Literal",name:"first",value:50}],f={alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"projectId",storageKey:null},g],storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t],kind:"Fragment",metadata:null,name:"experimentCompareLoaderQuery",selections:[{condition:"hasBaselineExperimentId",kind:"Condition",passingValue:!0,selections:[{args:[i,r,{kind:"Variable",name:"datasetId",variableName:"datasetId"}],kind:"FragmentSpread",name:"ExperimentCompareTable_comparisons"},{alias:"baselineExperiment",args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[c],storageKey:null}]},{args:[{kind:"Variable",name:"hasBaselineExperimentId",variableName:"hasBaselineExperimentId"}],kind:"FragmentSpread",name:"ExperimentMultiSelector__data"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,n,a,t],kind:"Operation",name:"experimentCompareLoaderQuery",selections:[{alias:"dataset",args:u,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[y,g,{kind:"InlineFragment",selections:[d,{alias:null,args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[g,d,{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Dataset",abstractKey:null}],storageKey:null},{condition:"hasBaselineExperimentId",kind:"Condition",passingValue:!0,selections:[{alias:null,args:m,concreteType:"ExperimentComparisonConnection",kind:"LinkedField",name:"compareExperiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentComparisonEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"comparison",args:null,concreteType:"ExperimentComparison",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"example",plural:!1,selections:[g,{alias:null,args:null,concreteType:"DatasetExampleRevision",kind:"LinkedField",name:"revision",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"input",storageKey:null},{alias:"referenceOutput",args:null,kind:"ScalarField",name:"output",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"RunComparisonItem",kind:"LinkedField",name:"runComparisonItems",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"experimentId",storageKey:null},{alias:null,args:null,concreteType:"ExperimentRun",kind:"LinkedField",name:"runs",plural:!0,selections:[g,{alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"error",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},f,{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"tokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ExperimentRunAnnotationConnection",kind:"LinkedField",name:"annotations",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentRunAnnotationEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"annotation",args:null,concreteType:"ExperimentRunAnnotation",kind:"LinkedField",name:"node",plural:!1,selections:[g,d,{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},f],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},g],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"ExperimentComparison",kind:"LinkedField",name:"node",plural:!1,selections:[y,g],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:m,filters:["baselineExperimentId","compareExperimentIds","filterCondition"],handle:"connection",key:"ExperimentCompareTable_compareExperiments",kind:"LinkedHandle",name:"compareExperiments"},{alias:"dataset",args:u,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[g],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Dataset",abstractKey:null}],storageKey:null},{alias:"baselineExperiment",args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[y,g,c],storageKey:null}]}]},params:{cacheID:"c7ef581fd9d69823c7f08acfb8c83ee7",id:null,metadata:{},name:"experimentCompareLoaderQuery",operationKind:"query",text:`query experimentCompareLoaderQuery(
7317
+ `,children:[e(v,{padding:"size-200",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"end",children:[e(lP,{dataRef:n,selectedBaselineExperimentId:r,selectedCompareExperimentIds:o,onChange:(c,u)=>{p.startTransition(()=>{if(c==null)d(`/datasets/${t}/compare`);else{const y=`?${[c,...u].map(g=>`experimentId=${g}`).join("&")}`;d(`/datasets/${t}/compare${y}`)}})}}),e(Ea,{onChange:c=>{l(c)},defaultSelected:!1,labelPlacement:"start",children:"Full Text"})]})}),r!=null?e(OT,{children:e(p.Suspense,{fallback:e(pe,{}),children:e(JT,{query:n,datasetId:t,baselineExperimentId:r,compareExperimentIds:o,displayFullText:a})})}):e(v,{padding:"size-200",children:e(Ke,{variant:"info",title:"No Baseline Experiment Selected",children:"Please select a baseline experiment."})})]})}const Wp=function(){var n={defaultValue:null,kind:"LocalArgument",name:"baselineExperimentId"},a={defaultValue:null,kind:"LocalArgument",name:"compareExperimentIds"},l={defaultValue:null,kind:"LocalArgument",name:"datasetId"},t={defaultValue:null,kind:"LocalArgument",name:"hasBaselineExperimentId"},i={kind:"Variable",name:"baselineExperimentId",variableName:"baselineExperimentId"},r={kind:"Variable",name:"compareExperimentIds",variableName:"compareExperimentIds"},o=[{kind:"Variable",name:"id",variableName:"datasetId"}],d={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},y=[i,r,{kind:"Literal",name:"first",value:50}],g={alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"projectId",storageKey:null},c],storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t],kind:"Fragment",metadata:null,name:"experimentCompareLoaderQuery",selections:[{condition:"hasBaselineExperimentId",kind:"Condition",passingValue:!0,selections:[{args:[i,r,{kind:"Variable",name:"datasetId",variableName:"datasetId"}],kind:"FragmentSpread",name:"ExperimentCompareTable_comparisons"}]},{args:[{kind:"Variable",name:"hasBaselineExperimentId",variableName:"hasBaselineExperimentId"}],kind:"FragmentSpread",name:"ExperimentMultiSelector__data"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,n,a,t],kind:"Operation",name:"experimentCompareLoaderQuery",selections:[{alias:"dataset",args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[d,c,{kind:"InlineFragment",selections:[u,{alias:null,args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[c,u,{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Dataset",abstractKey:null}],storageKey:null},{condition:"hasBaselineExperimentId",kind:"Condition",passingValue:!0,selections:[{alias:null,args:y,concreteType:"ExperimentComparisonConnection",kind:"LinkedField",name:"compareExperiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentComparisonEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"comparison",args:null,concreteType:"ExperimentComparison",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"example",plural:!1,selections:[c,{alias:null,args:null,concreteType:"DatasetExampleRevision",kind:"LinkedField",name:"revision",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"input",storageKey:null},{alias:"referenceOutput",args:null,kind:"ScalarField",name:"output",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"RunComparisonItem",kind:"LinkedField",name:"runComparisonItems",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"experimentId",storageKey:null},{alias:null,args:null,concreteType:"ExperimentRun",kind:"LinkedField",name:"runs",plural:!0,selections:[c,{alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"error",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},g,{alias:null,args:null,concreteType:"SpanCostSummary",kind:"LinkedField",name:"costSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"CostBreakdown",kind:"LinkedField",name:"total",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"tokens",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cost",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ExperimentRunAnnotationConnection",kind:"LinkedField",name:"annotations",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentRunAnnotationEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"annotation",args:null,concreteType:"ExperimentRunAnnotation",kind:"LinkedField",name:"node",plural:!1,selections:[c,u,{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},g],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},c],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"ExperimentComparison",kind:"LinkedField",name:"node",plural:!1,selections:[d,c],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:y,filters:["baselineExperimentId","compareExperimentIds","filterCondition"],handle:"connection",key:"ExperimentCompareTable_compareExperiments",kind:"LinkedHandle",name:"compareExperiments"},{alias:"dataset",args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[c],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Dataset",abstractKey:null}],storageKey:null},{alias:"baselineExperiment",args:[{kind:"Variable",name:"id",variableName:"baselineExperimentId"}],concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[d,c,{kind:"InlineFragment",selections:[u],type:"Experiment",abstractKey:null}],storageKey:null}]}]},params:{cacheID:"765038edac9643ad74cad2eff79477cc",id:null,metadata:{},name:"experimentCompareLoaderQuery",operationKind:"query",text:`query experimentCompareLoaderQuery(
7318
7318
  $datasetId: ID!
7319
7319
  $baselineExperimentId: ID!
7320
7320
  $compareExperimentIds: [ID!]!
7321
7321
  $hasBaselineExperimentId: Boolean!
7322
7322
  ) {
7323
7323
  ...ExperimentCompareTable_comparisons_2O4hHE @include(if: $hasBaselineExperimentId)
7324
- baselineExperiment: node(id: $baselineExperimentId) @include(if: $hasBaselineExperimentId) {
7325
- __typename
7326
- ... on Experiment {
7327
- name
7328
- }
7329
- id
7330
- }
7331
7324
  ...ExperimentMultiSelector__data_3q3odj
7332
7325
  }
7333
7326
 
@@ -7442,7 +7435,7 @@ fragment ExperimentMultiSelector__data_3q3odj on Query {
7442
7435
  id
7443
7436
  }
7444
7437
  }
7445
- `}}}();Wp.hash="d6d2ed1ea1ac8160ca37924f62ce8088";async function WI(n){const{datasetId:a,baselineExperimentId:l}=n.params;if(a==null)throw new Error("Dataset ID is required");const i=new URL(n.request.url).searchParams.getAll("experimentId");return await P.fetchQuery(ve,Wp,{datasetId:a,baselineExperimentId:l??"",compareExperimentIds:i,hasBaselineExperimentId:l!=null}).toPromise()}const tP=K`
7438
+ `}}}();Wp.hash="3fccd82dfc1884660b29ab003799fe1e";async function WI(n){const{datasetId:a}=n.params;if(a==null)throw new Error("Dataset ID is required");const l=new URL(n.request.url),[t=void 0,...i]=l.searchParams.getAll("experimentId");return await T.fetchQuery(ve,Wp,{datasetId:a,baselineExperimentId:t??"",compareExperimentIds:i,hasBaselineExperimentId:t!=null}).toPromise()}const tP=K`
7446
7439
  overflow-y: auto;
7447
7440
  height: 100%;
7448
7441
  `,iP=K`
@@ -7464,7 +7457,7 @@ fragment DBUsagePieChart_data on Query {
7464
7457
  }
7465
7458
  dbStorageCapacityBytes
7466
7459
  }
7467
- `}};Jp.hash="567b82d32463e4ba410f49c53bc9dcf2";async function ZI(){return await P.fetchQuery(ve,Jp,{}).toPromise()}const ws=window.Config.basename,Rs={width:"100%",height:"100%",border:"none",backgroundColor:"white"};function XI(){return s("div",{css:K`
7460
+ `}};Jp.hash="567b82d32463e4ba410f49c53bc9dcf2";async function ZI(){return await T.fetchQuery(ve,Jp,{}).toPromise()}const ws=window.Config.basename,Rs={width:"100%",height:"100%",border:"none",backgroundColor:"white"};function XI(){return s("div",{css:K`
7468
7461
  display: flex;
7469
7462
  flex-direction: column;
7470
7463
  flex: 1 1 auto;
@@ -7577,7 +7570,7 @@ fragment DBUsagePieChart_data on Query {
7577
7570
  __typename
7578
7571
  }
7579
7572
  }
7580
- `}}}();Xp.hash="f8f5c30b0e00c17cdda7557c73c3c2d3";const Yp={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ResetPasswordFormQuery",selections:[{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};Yp.hash="1161643b76edb6ef437d8f136038cf21";const _l=4;function uP(n){var u;const a=be(),l=Fe(),t=P.useFragment(Yp,n.query),[i,r]=P.useMutation(Xp),{control:o,handleSubmit:d}=Qe({defaultValues:{currentPassword:"",newPassword:"",confirmPassword:""}}),c=p.useCallback(y=>{i({variables:{input:{currentPassword:y.currentPassword,newPassword:y.newPassword}},onCompleted:()=>{const g=Go({path:"/login",searchParams:{message:"Password has been reset."}});a(g)},onError:g=>{l({title:"Failed to reset password",message:g.message})}})},[i,a,l]);return s(Tt,{onSubmit:d(c),children:[e(Fi,{children:s(ie,{name:"email",type:"email",autoComplete:"email",isRequired:!0,isReadOnly:!0,value:(u=t.viewer)==null?void 0:u.email,children:[e(W,{children:"Email"}),e(ae,{})]})}),e(G,{name:"currentPassword",control:o,rules:{required:"the current is required"},render:({field:{name:y,onChange:g,onBlur:m,value:f},fieldState:{invalid:h,error:k}})=>s(ie,{type:"password",name:y,isRequired:!0,isInvalid:h,onChange:g,onBlur:m,value:f,id:"current-password",autoComplete:"current-password",children:[e(W,{children:"Old Password"}),e(ae,{}),k?e(Ce,{children:k==null?void 0:k.message}):e(F,{slot:"description",children:"The current password"})]})}),e(G,{name:"newPassword",control:o,rules:{required:"Password is required",minLength:{value:_l,message:`Password must be at least ${_l} characters`},validate:(y,g)=>y!==g.currentPassword||"New password must be different"},render:({field:{name:y,onChange:g,onBlur:m,value:f},fieldState:{invalid:h,error:k}})=>s(ie,{type:"password",isRequired:!0,name:y,isInvalid:h,onChange:g,onBlur:m,defaultValue:f,id:"new-password",autoComplete:"new-password",children:[e(W,{children:"New Password"}),e(ae,{}),k?e(Ce,{children:k==null?void 0:k.message}):s(F,{slot:"description",children:["Password must be at least ",_l," characters"]})]})}),e(G,{name:"confirmPassword",control:o,rules:{required:"Password is required",minLength:{value:_l,message:`Password must be at least ${_l} characters`},validate:(y,g)=>y===g.newPassword||"Passwords do not match"},render:({field:{name:y,onChange:g,onBlur:m,value:f},fieldState:{invalid:h,error:k}})=>s(ie,{isRequired:!0,type:"password",name:y,isInvalid:h,onChange:g,onBlur:m,defaultValue:f,autoComplete:"new-password",children:[e(W,{children:"Confirm Password"}),e(ae,{}),k?e(Ce,{children:k==null?void 0:k.message}):e(F,{slot:"description",children:"Confirm the new password"})]})}),s("div",{css:K`
7573
+ `}}}();Xp.hash="f8f5c30b0e00c17cdda7557c73c3c2d3";const Yp={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ResetPasswordFormQuery",selections:[{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};Yp.hash="1161643b76edb6ef437d8f136038cf21";const _l=4;function uP(n){var u;const a=be(),l=Fe(),t=T.useFragment(Yp,n.query),[i,r]=T.useMutation(Xp),{control:o,handleSubmit:d}=Qe({defaultValues:{currentPassword:"",newPassword:"",confirmPassword:""}}),c=p.useCallback(y=>{i({variables:{input:{currentPassword:y.currentPassword,newPassword:y.newPassword}},onCompleted:()=>{const g=Go({path:"/login",searchParams:{message:"Password has been reset."}});a(g)},onError:g=>{l({title:"Failed to reset password",message:g.message})}})},[i,a,l]);return s(Tt,{onSubmit:d(c),children:[e(Fi,{children:s(ie,{name:"email",type:"email",autoComplete:"email",isRequired:!0,isReadOnly:!0,value:(u=t.viewer)==null?void 0:u.email,children:[e(W,{children:"Email"}),e(ae,{})]})}),e(G,{name:"currentPassword",control:o,rules:{required:"the current is required"},render:({field:{name:y,onChange:g,onBlur:m,value:f},fieldState:{invalid:h,error:k}})=>s(ie,{type:"password",name:y,isRequired:!0,isInvalid:h,onChange:g,onBlur:m,value:f,id:"current-password",autoComplete:"current-password",children:[e(W,{children:"Old Password"}),e(ae,{}),k?e(Ce,{children:k==null?void 0:k.message}):e(F,{slot:"description",children:"The current password"})]})}),e(G,{name:"newPassword",control:o,rules:{required:"Password is required",minLength:{value:_l,message:`Password must be at least ${_l} characters`},validate:(y,g)=>y!==g.currentPassword||"New password must be different"},render:({field:{name:y,onChange:g,onBlur:m,value:f},fieldState:{invalid:h,error:k}})=>s(ie,{type:"password",isRequired:!0,name:y,isInvalid:h,onChange:g,onBlur:m,defaultValue:f,id:"new-password",autoComplete:"new-password",children:[e(W,{children:"New Password"}),e(ae,{}),k?e(Ce,{children:k==null?void 0:k.message}):s(F,{slot:"description",children:["Password must be at least ",_l," characters"]})]})}),e(G,{name:"confirmPassword",control:o,rules:{required:"Password is required",minLength:{value:_l,message:`Password must be at least ${_l} characters`},validate:(y,g)=>y===g.newPassword||"Passwords do not match"},render:({field:{name:y,onChange:g,onBlur:m,value:f},fieldState:{invalid:h,error:k}})=>s(ie,{isRequired:!0,type:"password",name:y,isInvalid:h,onChange:g,onBlur:m,defaultValue:f,autoComplete:"new-password",children:[e(W,{children:"Confirm Password"}),e(ae,{}),k?e(Ce,{children:k==null?void 0:k.message}):e(F,{slot:"description",children:"Confirm the new password"})]})}),s("div",{css:K`
7581
7574
  display: flex;
7582
7575
  flex-direction: row;
7583
7576
  gap: var(--ac-global-dimension-size-200);
@@ -7605,7 +7598,7 @@ fragment ResetPasswordFormQuery on Query {
7605
7598
  id
7606
7599
  }
7607
7600
  }
7608
- `}}}();ey.hash="17bb397eaa3a44dd33996854e538f2ef";async function ax(){const n=await P.fetchQuery(ve,ey,{}).toPromise();return n!=null&&n.viewer?n:Pa("/login")}function pP({onResetSent:n}){const[a,l]=p.useState(null),[t,i]=p.useState(!1),r=p.useCallback(async c=>{l(null),i(!0);try{const u=await fetch(Vn("/auth/password-reset-email"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok){const y=await u.text();l(y);return}n()}finally{i(()=>!1)}},[n,l]),{control:o,handleSubmit:d}=Qe({defaultValues:{email:""}});return s(Y,{children:[a?e(v,{paddingBottom:"size-100",children:e(Ke,{variant:"danger",children:a})}):null,s(un,{onSubmit:d(r),children:[e(G,{name:"email",control:o,render:({field:{onChange:c,value:u}})=>s(ie,{name:"email",isRequired:!0,type:"email",onChange:c,value:u,children:[e(W,{children:"Email"}),e(ae,{placeholder:"your email address"}),e(F,{slot:"description",children:"Enter the email address associated with your account."})]})}),e("div",{css:K`
7601
+ `}}}();ey.hash="17bb397eaa3a44dd33996854e538f2ef";async function ax(){const n=await T.fetchQuery(ve,ey,{}).toPromise();return n!=null&&n.viewer?n:Pa("/login")}function pP({onResetSent:n}){const[a,l]=p.useState(null),[t,i]=p.useState(!1),r=p.useCallback(async c=>{l(null),i(!0);try{const u=await fetch(Vn("/auth/password-reset-email"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok){const y=await u.text();l(y);return}n()}finally{i(()=>!1)}},[n,l]),{control:o,handleSubmit:d}=Qe({defaultValues:{email:""}});return s(Y,{children:[a?e(v,{paddingBottom:"size-100",children:e(Ke,{variant:"danger",children:a})}):null,s(un,{onSubmit:d(r),children:[e(G,{name:"email",control:o,render:({field:{onChange:c,value:u}})=>s(ie,{name:"email",isRequired:!0,type:"email",onChange:c,value:u,children:[e(W,{children:"Email"}),e(ae,{placeholder:"your email address"}),e(F,{slot:"description",children:"Enter the email address associated with your account."})]})}),e("div",{css:K`
7609
7602
  margin-top: var(--ac-global-dimension-size-200);
7610
7603
  margin-bottom: var(--ac-global-dimension-size-50);
7611
7604
  button {
@@ -7696,14 +7689,14 @@ fragment APIKeysTableFragment on User {
7696
7689
  }
7697
7690
  id
7698
7691
  }
7699
- `}}}();ly.hash="6c32098d55e4cba859dcec73f3ccd28c";const ty=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:ly,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"APIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"apiKeys",plural:!0,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null},n],type:"User",abstractKey:null}}();ty.hash="6c32098d55e4cba859dcec73f3ccd28c";const Es=70;function fP({query:n}){const[a,l]=P.useRefetchableFragment(ty,n),t=ke(),[i]=P.useMutation(ay),r=p.useCallback(g=>{i({variables:{input:{id:g}},onCompleted:()=>{t({title:"API key deleted",message:"The key has been deleted and is no longer active."}),p.startTransition(()=>{l({},{fetchPolicy:"network-only"})})}})},[i,t,l]),o=p.useMemo(()=>[...a.apiKeys],[a]),d=p.useMemo(()=>[{header:"Name",accessorKey:"name",size:100,cell:Be},{header:"Description",accessorKey:"description",cell:Be},{header:"Created At",accessorKey:"createdAt",size:Es,cell:we},{header:"Expires At",accessorKey:"expiresAt",size:Es,cell:we},{header:"",accessorKey:"id",size:10,cell:({row:m})=>e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(Ni,{handleDelete:()=>{r(m.original.id)}})}),meta:{textAlign:"right"}}],[r]),c=Le({columns:d,data:o,getCoreRowModel:_e()}),u=c.getRowModel().rows,y=c.getRowModel().rows.length===0;return s("table",{css:nn,children:[e("thead",{children:c.getHeaderGroups().map(g=>e("tr",{children:g.headers.map(m=>e("th",{colSpan:m.colSpan,children:m.isPlaceholder?null:s("div",{className:m.column.getCanSort()?"sort":"",onClick:m.column.getToggleSortingHandler(),style:{left:m.getStart(),width:m.getSize()},children:[ee(m.column.columnDef.header,m.getContext()),m.column.getIsSorted()?e(D,{className:"sort-icon",svg:m.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},m.id))},g.id))}),y?e(vn,{message:"No Keys"}):e("tbody",{children:u.map(g=>e("tr",{children:g.getVisibleCells().map(m=>e("td",{children:ee(m.column.columnDef.cell,m.getContext())},m.id))},g.id))})]})}function hP({viewer:n}){var d;const[a,l]=p.useState(null),t=Fe(),[i,r]=P.useMutation(ny),o=p.useCallback((c,u)=>{var y;i({variables:{input:{...c,expiresAt:((y=c.expiresAt)==null?void 0:y.toDate(ml()).toISOString())||null}},onCompleted:g=>{u(),l(g)},onError:g=>{t({title:"Error creating API key",message:g.message})}})},[i,t]);return s(Y,{children:[e(q,{title:"API Keys",variant:"compact",bodyStyle:{padding:0},extra:s(J,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(jn,{})}),children:"New Key"}),e(ne,{children:e(Z,{size:"M",children:e(Ys,{onSubmit:o,isCommitting:r})})})]}),children:e(fP,{query:n})}),e(J,{isOpen:!!a,onOpenChange:()=>l(null),children:e(ne,{children:e(Z,{size:"L",children:e(eo,{jwt:((d=a==null?void 0:a.createUserApiKey)==null?void 0:d.jwt)??""})})})})]})}const iy=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchViewer",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ViewerProfileCardMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ViewerProfileCardMutation",selections:a},params:{cacheID:"03f161df42c71b5924a8ee665e01cdce",id:null,metadata:{},name:"ViewerProfileCardMutation",operationKind:"mutation",text:`mutation ViewerProfileCardMutation(
7692
+ `}}}();ly.hash="6c32098d55e4cba859dcec73f3ccd28c";const ty=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:ly,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"APIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"apiKeys",plural:!0,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null},n],type:"User",abstractKey:null}}();ty.hash="6c32098d55e4cba859dcec73f3ccd28c";const Es=70;function fP({query:n}){const[a,l]=T.useRefetchableFragment(ty,n),t=ke(),[i]=T.useMutation(ay),r=p.useCallback(g=>{i({variables:{input:{id:g}},onCompleted:()=>{t({title:"API key deleted",message:"The key has been deleted and is no longer active."}),p.startTransition(()=>{l({},{fetchPolicy:"network-only"})})}})},[i,t,l]),o=p.useMemo(()=>[...a.apiKeys],[a]),d=p.useMemo(()=>[{header:"Name",accessorKey:"name",size:100,cell:Be},{header:"Description",accessorKey:"description",cell:Be},{header:"Created At",accessorKey:"createdAt",size:Es,cell:we},{header:"Expires At",accessorKey:"expiresAt",size:Es,cell:we},{header:"",accessorKey:"id",size:10,cell:({row:m})=>e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(Ni,{handleDelete:()=>{r(m.original.id)}})}),meta:{textAlign:"right"}}],[r]),c=Le({columns:d,data:o,getCoreRowModel:_e()}),u=c.getRowModel().rows,y=c.getRowModel().rows.length===0;return s("table",{css:nn,children:[e("thead",{children:c.getHeaderGroups().map(g=>e("tr",{children:g.headers.map(m=>e("th",{colSpan:m.colSpan,children:m.isPlaceholder?null:s("div",{className:m.column.getCanSort()?"sort":"",onClick:m.column.getToggleSortingHandler(),style:{left:m.getStart(),width:m.getSize()},children:[ee(m.column.columnDef.header,m.getContext()),m.column.getIsSorted()?e(D,{className:"sort-icon",svg:m.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},m.id))},g.id))}),y?e(vn,{message:"No Keys"}):e("tbody",{children:u.map(g=>e("tr",{children:g.getVisibleCells().map(m=>e("td",{children:ee(m.column.columnDef.cell,m.getContext())},m.id))},g.id))})]})}function hP({viewer:n}){var d;const[a,l]=p.useState(null),t=Fe(),[i,r]=T.useMutation(ny),o=p.useCallback((c,u)=>{var y;i({variables:{input:{...c,expiresAt:((y=c.expiresAt)==null?void 0:y.toDate(ml()).toISOString())||null}},onCompleted:g=>{u(),l(g)},onError:g=>{t({title:"Error creating API key",message:g.message})}})},[i,t]);return s(Y,{children:[e(q,{title:"API Keys",variant:"compact",bodyStyle:{padding:0},extra:s(J,{children:[e(E,{size:"S",leadingVisual:e(D,{svg:e(jn,{})}),children:"New Key"}),e(ne,{children:e(Z,{size:"M",children:e(Ys,{onSubmit:o,isCommitting:r})})})]}),children:e(fP,{query:n})}),e(J,{isOpen:!!a,onOpenChange:()=>l(null),children:e(ne,{children:e(Z,{size:"L",children:e(eo,{jwt:((d=a==null?void 0:a.createUserApiKey)==null?void 0:d.jwt)??""})})})})]})}const iy=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchViewer",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ViewerProfileCardMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ViewerProfileCardMutation",selections:a},params:{cacheID:"03f161df42c71b5924a8ee665e01cdce",id:null,metadata:{},name:"ViewerProfileCardMutation",operationKind:"mutation",text:`mutation ViewerProfileCardMutation(
7700
7693
  $input: PatchViewerInput!
7701
7694
  ) {
7702
7695
  patchViewer(input: $input) {
7703
7696
  __typename
7704
7697
  }
7705
7698
  }
7706
- `}}}();iy.hash="4a11ca65151d84fe95f636763c91dc68";function kP(){const{viewer:n,refetchViewer:a}=$i(),l=Fe(),t=ke(),[i,r]=P.useMutation(iy),{control:o,handleSubmit:d,formState:{isDirty:c},reset:u}=Qe({defaultValues:{username:(n==null?void 0:n.username)||""}}),y=p.useCallback(g=>{i({variables:{input:{newUsername:g.username}},onCompleted:()=>{t({title:"Profile updated",message:"Your profile has been updated"}),u({username:g.username}),a()},onError:m=>{l({title:"Failed update profile",message:m.message})}})},[i,t,u,a,l]);return n?s(q,{title:"Profile",variant:"compact",bodyStyle:{padding:0},extra:n.authMethod==="LOCAL"&&e(ya,{size:"S",to:"/reset-password",children:"Reset Password"}),children:[e(v,{paddingTop:"size-200",paddingStart:"size-200",paddingEnd:"size-200",children:s(b,{direction:"row",gap:"size-200",alignItems:"center",children:[e(Pt,{name:n.username||n.email,profilePictureUrl:n.profilePictureUrl}),s(b,{direction:"column",gap:"size-50",children:[e(de,{level:2,weight:"heavy",children:n.username||n.email}),e(F,{children:n.role.name.toLocaleLowerCase()})]})]})}),e(v,{children:s(un,{onSubmit:d(y),children:[e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-100",children:[s(ie,{value:n.email,isReadOnly:!0,size:"S",children:[e(W,{children:"Email"}),e(ae,{})]}),e(G,{name:"username",control:o,rules:{required:"A username is required as it needs to be unique"},render:({field:{name:g,onChange:m,onBlur:f,value:h},fieldState:{invalid:k,error:S}})=>s(ie,{isRequired:!0,name:g,isInvalid:k,onChange:m,onBlur:f,defaultValue:h,size:"S",children:[e(W,{children:"Username"}),e(ae,{}),S?e(Ce,{children:S.message}):e(F,{slot:"description",children:"A unique username"})]})})]})}),e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderTopColor:"dark",borderTopWidth:"thin",children:e(b,{direction:"row",gap:"size-100",justifyContent:"end",children:e(E,{variant:c?"primary":"default",size:"S",isDisabled:!c,onPress:()=>{d(y)()},children:r?"Saving...":"Save"})})})]})})]}):null}const bP=K`
7699
+ `}}}();iy.hash="4a11ca65151d84fe95f636763c91dc68";function kP(){const{viewer:n,refetchViewer:a}=$i(),l=Fe(),t=ke(),[i,r]=T.useMutation(iy),{control:o,handleSubmit:d,formState:{isDirty:c},reset:u}=Qe({defaultValues:{username:(n==null?void 0:n.username)||""}}),y=p.useCallback(g=>{i({variables:{input:{newUsername:g.username}},onCompleted:()=>{t({title:"Profile updated",message:"Your profile has been updated"}),u({username:g.username}),a()},onError:m=>{l({title:"Failed update profile",message:m.message})}})},[i,t,u,a,l]);return n?s(q,{title:"Profile",variant:"compact",bodyStyle:{padding:0},extra:n.authMethod==="LOCAL"&&e(ya,{size:"S",to:"/reset-password",children:"Reset Password"}),children:[e(v,{paddingTop:"size-200",paddingStart:"size-200",paddingEnd:"size-200",children:s(b,{direction:"row",gap:"size-200",alignItems:"center",children:[e(Pt,{name:n.username||n.email,profilePictureUrl:n.profilePictureUrl}),s(b,{direction:"column",gap:"size-50",children:[e(de,{level:2,weight:"heavy",children:n.username||n.email}),e(F,{children:n.role.name.toLocaleLowerCase()})]})]})}),e(v,{children:s(un,{onSubmit:d(y),children:[e(v,{padding:"size-200",children:s(b,{direction:"column",gap:"size-100",children:[s(ie,{value:n.email,isReadOnly:!0,size:"S",children:[e(W,{children:"Email"}),e(ae,{})]}),e(G,{name:"username",control:o,rules:{required:"A username is required as it needs to be unique"},render:({field:{name:g,onChange:m,onBlur:f,value:h},fieldState:{invalid:k,error:S}})=>s(ie,{isRequired:!0,name:g,isInvalid:k,onChange:m,onBlur:f,defaultValue:h,size:"S",children:[e(W,{children:"Username"}),e(ae,{}),S?e(Ce,{children:S.message}):e(F,{slot:"description",children:"A unique username"})]})})]})}),e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderTopColor:"dark",borderTopWidth:"thin",children:e(b,{direction:"row",gap:"size-100",justifyContent:"end",children:e(E,{variant:c?"primary":"default",size:"S",isDisabled:!c,onPress:()=>{d(y)()},children:r?"Saving...":"Save"})})})]})})]}):null}const bP=K`
7707
7700
  overflow-y: auto;
7708
7701
  `,SP=K`
7709
7702
  padding: var(--ac-global-dimension-size-400);
@@ -7763,7 +7756,7 @@ fragment APIKeysTableFragment on User {
7763
7756
  id
7764
7757
  }
7765
7758
  }
7766
- `}}}();ry.hash="ab0e72402c34ac0eaf7cf39a14427121";async function ox(n){const{spanId:a}=n.params;if(!a||typeof a!="string")throw new Error("Invalid spanId");return await P.fetchQuery(ve,ry,{spanId:a}).toPromise()}const sy=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"}],a=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"PromptsTablePromptsQuery",selections:[{args:a,kind:"FragmentSpread",name:"PromptsTable_prompts"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"PromptsTablePromptsQuery",selections:[{alias:null,args:a,concreteType:"PromptConnection",kind:"LinkedField",name:"prompts",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"prompt",args:null,concreteType:"Prompt",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},t,{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"version",plural:!1,selections:[t,l],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Prompt",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:a,filters:null,handle:"connection",key:"PromptsTable_prompts",kind:"LinkedHandle",name:"prompts"}]},params:{cacheID:"d34de7b5cd9490100a935debc9b71892",id:null,metadata:{},name:"PromptsTablePromptsQuery",operationKind:"query",text:`query PromptsTablePromptsQuery(
7759
+ `}}}();ry.hash="ab0e72402c34ac0eaf7cf39a14427121";async function ox(n){const{spanId:a}=n.params;if(!a||typeof a!="string")throw new Error("Invalid spanId");return await T.fetchQuery(ve,ry,{spanId:a}).toPromise()}const sy=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"}],a=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"PromptsTablePromptsQuery",selections:[{args:a,kind:"FragmentSpread",name:"PromptsTable_prompts"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"PromptsTablePromptsQuery",selections:[{alias:null,args:a,concreteType:"PromptConnection",kind:"LinkedField",name:"prompts",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"prompt",args:null,concreteType:"Prompt",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},t,{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"version",plural:!1,selections:[t,l],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Prompt",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:a,filters:null,handle:"connection",key:"PromptsTable_prompts",kind:"LinkedHandle",name:"prompts"}]},params:{cacheID:"d34de7b5cd9490100a935debc9b71892",id:null,metadata:{},name:"PromptsTablePromptsQuery",operationKind:"query",text:`query PromptsTablePromptsQuery(
7767
7760
  $after: String = null
7768
7761
  $first: Int = 100
7769
7762
  ) {
@@ -7830,7 +7823,7 @@ fragment PromptsTable_prompts on Query {
7830
7823
  }
7831
7824
  }
7832
7825
  }
7833
- `}}}();dy.hash="af218c6f8442ad552dd44771a2d55275";function FP({promptId:n,onDeleted:a}){const[l,t]=P.useMutation(dy),i=ke(),r=Fe(),o=p.useCallback(()=>{l({variables:{promptId:n},onCompleted:()=>{i({title:"Delete Successful",message:"Prompt has been deleted."}),a()},onError:d=>{r({title:"Failed to delete prompt",message:d.message})}})},[l,r,i,a,n]);return e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Delete Prompt"}),e(ue,{children:e(me,{slot:"close"})})]}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:"Are you sure you want to delete this prompt? This action cannot be undone and all services dependent on this prompt will be affected."})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",slot:"close",size:"S",children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{o()},size:"S",isDisabled:t,children:"Delete Prompt"})]})})]})})}function CP({onDeleted:n,promptId:a}){const[l,t]=p.useState(!1),i=p.useCallback(()=>{t(!0)},[]);return s(Xl,{children:[e(Ma,{align:"end","aria-label":"User Actions",buttonSize:"compact",onAction:r=>{switch(r){case"DELETE":i();break}},children:e(je,{children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Je,{})}),e(Y,{children:"Delete"})]})},"DELETE")}),e(J,{isOpen:l,onOpenChange:t,children:e(Z,{children:e(FP,{promptId:a,onDeleted:()=>{n(),t(!1)}})})})]})}function KP(){const n=be();return e(v,{width:"100%",paddingY:"size-400",children:e(b,{direction:"column",width:"100%",alignItems:"center",justifyContent:"center",children:e(v,{width:"100%",maxWidth:"780px",children:s(b,{direction:"column",gap:"size-400",alignItems:"center",children:[e(F,{size:"XL",children:"Create and manage prompt templates for your AI applications."}),e(ar,{src:"https://storage.googleapis.com/arize-phoenix-assets/assets/videos/prompts.mp4",autoPlay:!0,muted:!0,loop:!0}),s(b,{direction:"row",gap:"size-200",children:[e(cl,{href:"https://arize.com/docs/phoenix/prompt-engineering/quickstart-prompts/quickstart-prompts-ui",target:"_blank",leadingVisual:e(D,{svg:e(lr,{})}),children:"Documentation"}),e(E,{variant:"primary",leadingVisual:e(D,{svg:e(za,{})}),onPress:()=>n("/playground"),children:"Playground"})]})]})})})})}const TP=100;function PP(n){const a=be(),l=p.useRef(null),{data:t,loadNext:i,hasNext:r,isLoadingNext:o,refetch:d}=P.usePaginationFragment(oy,n.query),c=p.useMemo(()=>t.prompts.edges.map(h=>({lastUpdatedAt:h.prompt.version.createdAt,...h.prompt})),[t]),u=p.useCallback(h=>{if(h){const{scrollHeight:k,scrollTop:S,clientHeight:C}=h;k-S-C<300&&!o&&r&&i(TP)}},[r,o,i]),y=p.useMemo(()=>[{header:"name",accessorKey:"name",cell:({row:k})=>e(Oe,{to:`${k.original.id}`,children:k.original.name})},{header:"description",accessorKey:"description",cell:Be},{header:"created at",accessorKey:"createdAt",cell:we},{header:"last updated",accessorKey:"lastUpdatedAt",cell:we},{id:"actions",header:"",size:5,accessorKey:"id",cell:({row:k})=>s(b,{direction:"row",gap:"size-100",justifyContent:"end",width:"100%",children:[e(Xl,{children:e(ya,{leadingVisual:e(D,{svg:e(za,{})}),size:"S","aria-label":"Open in playground",to:`${k.original.id}/playground`,children:"Playground"})}),e(CP,{promptId:k.original.id,onDeleted:()=>{d({},{fetchPolicy:"network-only"})}})]})}],[d]),g=Le({columns:y,data:c,getCoreRowModel:_e(),getSortedRowModel:sn()}),m=g.getRowModel().rows;return m.length===0?e(KP,{}):e("div",{css:K`
7826
+ `}}}();dy.hash="af218c6f8442ad552dd44771a2d55275";function FP({promptId:n,onDeleted:a}){const[l,t]=T.useMutation(dy),i=ke(),r=Fe(),o=p.useCallback(()=>{l({variables:{promptId:n},onCompleted:()=>{i({title:"Delete Successful",message:"Prompt has been deleted."}),a()},onError:d=>{r({title:"Failed to delete prompt",message:d.message})}})},[l,r,i,a,n]);return e(X,{children:s(re,{children:[s(se,{children:[e(oe,{children:"Delete Prompt"}),e(ue,{children:e(me,{slot:"close"})})]}),e(v,{padding:"size-200",children:e(F,{color:"danger",children:"Are you sure you want to delete this prompt? This action cannot be undone and all services dependent on this prompt will be affected."})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",slot:"close",size:"S",children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{o()},size:"S",isDisabled:t,children:"Delete Prompt"})]})})]})})}function CP({onDeleted:n,promptId:a}){const[l,t]=p.useState(!1),i=p.useCallback(()=>{t(!0)},[]);return s(Xl,{children:[e(Ma,{align:"end","aria-label":"User Actions",buttonSize:"compact",onAction:r=>{switch(r){case"DELETE":i();break}},children:e(je,{children:s(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(D,{svg:e(Je,{})}),e(Y,{children:"Delete"})]})},"DELETE")}),e(J,{isOpen:l,onOpenChange:t,children:e(Z,{children:e(FP,{promptId:a,onDeleted:()=>{n(),t(!1)}})})})]})}function KP(){const n=be();return e(v,{width:"100%",paddingY:"size-400",children:e(b,{direction:"column",width:"100%",alignItems:"center",justifyContent:"center",children:e(v,{width:"100%",maxWidth:"780px",children:s(b,{direction:"column",gap:"size-400",alignItems:"center",children:[e(F,{size:"XL",children:"Create and manage prompt templates for your AI applications."}),e(ar,{src:"https://storage.googleapis.com/arize-phoenix-assets/assets/videos/prompts.mp4",autoPlay:!0,muted:!0,loop:!0}),s(b,{direction:"row",gap:"size-200",children:[e(cl,{href:"https://arize.com/docs/phoenix/prompt-engineering/quickstart-prompts/quickstart-prompts-ui",target:"_blank",leadingVisual:e(D,{svg:e(lr,{})}),children:"Documentation"}),e(E,{variant:"primary",leadingVisual:e(D,{svg:e(za,{})}),onPress:()=>n("/playground"),children:"Playground"})]})]})})})})}const TP=100;function PP(n){const a=be(),l=p.useRef(null),{data:t,loadNext:i,hasNext:r,isLoadingNext:o,refetch:d}=T.usePaginationFragment(oy,n.query),c=p.useMemo(()=>t.prompts.edges.map(h=>({lastUpdatedAt:h.prompt.version.createdAt,...h.prompt})),[t]),u=p.useCallback(h=>{if(h){const{scrollHeight:k,scrollTop:S,clientHeight:C}=h;k-S-C<300&&!o&&r&&i(TP)}},[r,o,i]),y=p.useMemo(()=>[{header:"name",accessorKey:"name",cell:({row:k})=>e(Oe,{to:`${k.original.id}`,children:k.original.name})},{header:"description",accessorKey:"description",cell:Be},{header:"created at",accessorKey:"createdAt",cell:we},{header:"last updated",accessorKey:"lastUpdatedAt",cell:we},{id:"actions",header:"",size:5,accessorKey:"id",cell:({row:k})=>s(b,{direction:"row",gap:"size-100",justifyContent:"end",width:"100%",children:[e(Xl,{children:e(ya,{leadingVisual:e(D,{svg:e(za,{})}),size:"S","aria-label":"Open in playground",to:`${k.original.id}/playground`,children:"Playground"})}),e(CP,{promptId:k.original.id,onDeleted:()=>{d({},{fetchPolicy:"network-only"})}})]})}],[d]),g=Le({columns:y,data:c,getCoreRowModel:_e(),getSortedRowModel:sn()}),m=g.getRowModel().rows;return m.length===0?e(KP,{}):e("div",{css:K`
7834
7827
  flex: 1 1 auto;
7835
7828
  overflow: auto;
7836
7829
  `,onScroll:h=>u(h.target),ref:l,children:s("table",{css:la,children:[e("thead",{children:g.getHeaderGroups().map(h=>e("tr",{children:h.headers.map(k=>{var S;return e("th",{colSpan:k.colSpan,children:k.isPlaceholder?null:s("div",{className:k.column.getCanSort()?"sort":"","aria-role":k.column.getCanSort()?"button":null,onClick:k.column.getToggleSortingHandler(),style:{textAlign:(S=k.column.columnDef.meta)==null?void 0:S.textAlign},children:[ee(k.column.columnDef.header,k.getContext()),k.column.getIsSorted()?e(D,{className:"sort-icon",svg:k.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},k.id)})},h.id))}),e("tbody",{children:m.map(h=>e("tr",{onClick:()=>{a(`${h.original.id}`)},children:h.getVisibleCells().map(k=>{var S;return e("td",{align:(S=k.column.columnDef.meta)==null?void 0:S.textAlign,children:ee(k.column.columnDef.cell,k.getContext())},k.id)})},h.id))})]})})}function dx(){const n=Ue();return qe(n),s(b,{direction:"column",height:"100%",children:[e(v,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",flex:"none",children:s(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(de,{level:1,children:"Prompts"}),e(ya,{size:"M",leadingVisual:e(D,{svg:e(ji,{})}),variant:"primary",to:"/playground",children:"Create Prompt"})]})}),e(PP,{query:n})]})}const cy=function(){var n=[{kind:"Literal",name:"first",value:100}],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"promptsLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"PromptsTable_prompts"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"promptsLoaderQuery",selections:[{alias:null,args:n,concreteType:"PromptConnection",kind:"LinkedField",name:"prompts",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"prompt",args:null,concreteType:"Prompt",kind:"LinkedField",name:"node",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},l,{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"version",plural:!1,selections:[l,a],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Prompt",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},a],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:"prompts(first:100)"},{alias:null,args:n,filters:null,handle:"connection",key:"PromptsTable_prompts",kind:"LinkedHandle",name:"prompts"}]},params:{cacheID:"9a3e6a185a7a63d9d2c115e80e22b495",id:null,metadata:{},name:"promptsLoaderQuery",operationKind:"query",text:`query promptsLoaderQuery {
@@ -7862,7 +7855,7 @@ fragment PromptsTable_prompts on Query {
7862
7855
  }
7863
7856
  }
7864
7857
  }
7865
- `}}}();cy.hash="ed4295f193bd2a6d2402a82966d45a7f";async function cx(n){return await P.fetchQuery(ve,cy,{}).toPromise()}const uy=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null},o=[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],d={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},y={alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null},g=[t,i],m={alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:g,storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"promptLoaderQuery",selections:[{alias:"prompt",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[i,{args:null,kind:"FragmentSpread",name:"PromptIndexPage__main"},{args:null,kind:"FragmentSpread",name:"PromptVersionsPageContent__main"},{args:null,kind:"FragmentSpread",name:"PromptLayout__main"}],type:"Prompt",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"promptLoaderQuery",selections:[{alias:"prompt",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[i,{alias:null,args:null,concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[r,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null},i],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null},t,{alias:null,args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:o,storageKey:null},{alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:o,storageKey:null},{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null}],storageKey:null},{alias:"version",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[t,d,c,u,y,m],storageKey:null}],storageKey:null}],storageKey:null},d,{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:5}],concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[t,d,u,c,y,m],storageKey:null}],storageKey:null}],storageKey:"promptVersions(first:5)"},{alias:null,args:null,concreteType:"Prompt",kind:"LinkedField",name:"sourcePrompt",plural:!1,selections:g,storageKey:null}],type:"Prompt",abstractKey:null}],storageKey:null}]},params:{cacheID:"24ab780c15f1ca153edf38dc98d48034",id:null,metadata:{},name:"promptLoaderQuery",operationKind:"query",text:`query promptLoaderQuery(
7858
+ `}}}();cy.hash="ed4295f193bd2a6d2402a82966d45a7f";async function cx(n){return await T.fetchQuery(ve,cy,{}).toPromise()}const uy=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null},o=[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],d={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},y={alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null},g=[t,i],m={alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:g,storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"promptLoaderQuery",selections:[{alias:"prompt",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[i,{args:null,kind:"FragmentSpread",name:"PromptIndexPage__main"},{args:null,kind:"FragmentSpread",name:"PromptVersionsPageContent__main"},{args:null,kind:"FragmentSpread",name:"PromptLayout__main"}],type:"Prompt",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"promptLoaderQuery",selections:[{alias:"prompt",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[i,{alias:null,args:null,concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[r,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null},i],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null},t,{alias:null,args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:o,storageKey:null},{alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:o,storageKey:null},{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null}],storageKey:null},{alias:"version",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[t,d,c,u,y,m],storageKey:null}],storageKey:null}],storageKey:null},d,{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:5}],concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[t,d,u,c,y,m],storageKey:null}],storageKey:null}],storageKey:"promptVersions(first:5)"},{alias:null,args:null,concreteType:"Prompt",kind:"LinkedField",name:"sourcePrompt",plural:!1,selections:g,storageKey:null}],type:"Prompt",abstractKey:null}],storageKey:null}]},params:{cacheID:"24ab780c15f1ca153edf38dc98d48034",id:null,metadata:{},name:"promptLoaderQuery",operationKind:"query",text:`query promptLoaderQuery(
7866
7859
  $id: ID!
7867
7860
  ) {
7868
7861
  prompt: node(id: $id) {
@@ -8090,7 +8083,7 @@ fragment PromptVersionsList__main on Prompt {
8090
8083
  fragment PromptVersionsPageContent__main on Prompt {
8091
8084
  ...PromptVersionsList__main
8092
8085
  }
8093
- `}}}();uy.hash="c19209c9d3b9df985746493df3a97b49";async function ux(n){const{promptId:a}=n.params;return await P.fetchQuery(ve,uy,{id:a}).toPromise().catch(()=>{throw new Error("Prompt not found")})}const my=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptVersionTagsConfigCard_data",selections:[n,{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"versionTags",plural:!0,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"promptVersionId",storageKey:null}],storageKey:null}],type:"Prompt",abstractKey:null}}();my.hash="3650e60f18eb8d95b707df7bdbce99a9";const gy=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"},{defaultValue:null,kind:"LocalArgument",name:"promptId"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l=[{kind:"Variable",name:"id",variableName:"promptId"}],t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DeletePromptVersionTagButtonMutation",selections:[{alias:null,args:a,concreteType:"PromptVersionTagMutationPayload",kind:"LinkedField",name:"deletePromptVersionTag",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"PromptVersionTagsConfigCard_data"}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DeletePromptVersionTagButtonMutation",selections:[{alias:null,args:a,concreteType:"PromptVersionTagMutationPayload",kind:"LinkedField",name:"deletePromptVersionTag",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"versionTags",plural:!0,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"promptVersionId",storageKey:null}],storageKey:null}],type:"Prompt",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"387e2e286ff86ad049a2b4afbd189b22",id:null,metadata:{},name:"DeletePromptVersionTagButtonMutation",operationKind:"mutation",text:`mutation DeletePromptVersionTagButtonMutation(
8086
+ `}}}();uy.hash="c19209c9d3b9df985746493df3a97b49";async function ux(n){const{promptId:a}=n.params;return await T.fetchQuery(ve,uy,{id:a}).toPromise().catch(()=>{throw new Error("Prompt not found")})}const my=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptVersionTagsConfigCard_data",selections:[n,{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"versionTags",plural:!0,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"promptVersionId",storageKey:null}],storageKey:null}],type:"Prompt",abstractKey:null}}();my.hash="3650e60f18eb8d95b707df7bdbce99a9";const gy=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"},{defaultValue:null,kind:"LocalArgument",name:"promptId"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l=[{kind:"Variable",name:"id",variableName:"promptId"}],t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DeletePromptVersionTagButtonMutation",selections:[{alias:null,args:a,concreteType:"PromptVersionTagMutationPayload",kind:"LinkedField",name:"deletePromptVersionTag",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"PromptVersionTagsConfigCard_data"}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DeletePromptVersionTagButtonMutation",selections:[{alias:null,args:a,concreteType:"PromptVersionTagMutationPayload",kind:"LinkedField",name:"deletePromptVersionTag",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"versionTags",plural:!0,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"promptVersionId",storageKey:null}],storageKey:null}],type:"Prompt",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"387e2e286ff86ad049a2b4afbd189b22",id:null,metadata:{},name:"DeletePromptVersionTagButtonMutation",operationKind:"mutation",text:`mutation DeletePromptVersionTagButtonMutation(
8094
8087
  $input: DeletePromptVersionTagInput!
8095
8088
  $promptId: ID!
8096
8089
  ) {
@@ -8114,7 +8107,7 @@ fragment PromptVersionTagsConfigCard_data on Prompt {
8114
8107
  promptVersionId
8115
8108
  }
8116
8109
  }
8117
- `}}}();gy.hash="58fa5b2b6e7af186229c70b90082644a";function IP({promptVersionTagId:n,promptId:a}){const[l,t]=p.useState(!1),i=ke(),[r,o]=P.useMutation(gy);return s(J,{isOpen:l,onOpenChange:t,children:[e(E,{"aria-label":"Delete tag",size:"S",leadingVisual:e(D,{svg:e(Je,{})})}),e(ne,{children:e(Z,{size:"S",children:s(X,{children:[e(de,{slot:"title",children:"Delete Tag"}),e(v,{padding:"size-200",children:e(v,{paddingBottom:"size-100",children:e(F,{color:"danger",size:"XS",children:"Are you sure you want to delete this tag? This will make pulling prompts by this tag no longer possible. Make sure this tag is not used before deleting."})})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopWidth:"thin",borderColor:"light",children:s(b,{gap:"size-100",justifyContent:"end",children:[e(E,{size:"S",onPress:()=>t(!1),children:"Cancel"}),e(E,{variant:"danger",size:"S",onPress:()=>r({variables:{input:{promptVersionTagId:n},promptId:a},onCompleted:()=>{i({title:"Tag Deleted",message:"The tag has been deleted"})}}),children:o?"Deleting...":"Delete Tag"})]})})]})})})]})}function xP({prompt:n}){const a=P.useFragment(my,n),l=p.useMemo(()=>[{header:"Name",accessorKey:"name"},{header:"Description",accessorKey:"description",cell:Be},{header:"Version",accessorKey:"promptVersionId",cell:({row:d})=>{const{promptId:c,promptVersionId:u}=d.original;return e(Oe,{to:`/prompts/${c}/versions/${u}`,children:d.original.promptVersionId})}},{id:"actions",header:"",size:5,accessorKey:"id",cell:({row:d})=>e(b,{direction:"row",gap:"size-100",justifyContent:"end",width:"100%",children:e(IP,{promptVersionTagId:d.original.id,promptId:d.original.promptId},d.original.id)})}],[]),t=p.useMemo(()=>a.versionTags.map(d=>({id:d.id,name:d.name,description:d.description,promptId:a.id,promptVersionId:d.promptVersionId})),[a]),i=Le({columns:l,data:t,getCoreRowModel:_e(),getSortedRowModel:sn()}),r=i.getRowModel().rows,o=r.length===0;return e(q,{title:"Tags",variant:"compact",bodyStyle:{padding:0},children:s("table",{css:nn,children:[e("thead",{children:i.getHeaderGroups().map(d=>e("tr",{children:d.headers.map(c=>e("th",{colSpan:c.colSpan,children:c.isPlaceholder?null:s("div",{className:c.column.getCanSort()?"sort":"",onClick:c.column.getToggleSortingHandler(),style:{left:c.getStart(),width:c.getSize()},children:[ee(c.column.columnDef.header,c.getContext()),c.column.getIsSorted()?e(D,{className:"sort-icon",svg:c.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},c.id))},d.id))}),o?e(vn,{message:"No Tags"}):e("tbody",{children:r.map(d=>e("tr",{children:d.getVisibleCells().map(c=>e("td",{children:ee(c.column.columnDef.cell,c.getContext())},c.id))},d.id))})]})})}function mx(){const n=Ue();return qe(n),e(b,{direction:"row",height:"100%",children:e(v,{height:"100%",overflow:"auto",width:"100%","data-testid":"scroll-container",children:e(v,{padding:"size-200",children:e(b,{direction:"column",gap:"size-200",marginStart:"auto",marginEnd:"auto",maxWidth:900,children:e(xP,{prompt:n.prompt})})})})})}function py(){return"FS"in window}function DP(n){if(window.Config.basename){let a=window.Config.basename;return a=a.replace(/^\/+|\/+$/g,"").replace(/\//g,"-"),`${a}-${n}`}return n}function LP(n){if(py())try{FS("setIdentity",{uid:DP(n.uid),properties:{displayName:n.displayName,email:n.email}})}catch(a){console.error("Error setting FullStory identity",a)}}function gx(){const n=Ue();return qe(n),p.useEffect(()=>{py()&&n.viewer&&LP({uid:n.viewer.id,displayName:n.viewer.username,email:n.viewer.email})},[n]),e(Ik,{query:n,children:e(Te,{})})}const yy=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"passwordNeedsReset",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"authenticatedRootLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"ViewerContext_viewer"},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[n,a,l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"authenticatedRootLoaderQuery",selections:[{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[n,a,l,{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isManagementUser",storageKey:null},{alias:null,args:null,concreteType:"UserRole",kind:"LinkedField",name:"role",plural:!1,selections:[i,n],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"authMethod",storageKey:null},{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"apiKeys",plural:!0,selections:[n,i,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null},t],storageKey:null}]},params:{cacheID:"909f2b392805d784bcac384c6d208692",id:null,metadata:{},name:"authenticatedRootLoaderQuery",operationKind:"query",text:`query authenticatedRootLoaderQuery {
8110
+ `}}}();gy.hash="58fa5b2b6e7af186229c70b90082644a";function IP({promptVersionTagId:n,promptId:a}){const[l,t]=p.useState(!1),i=ke(),[r,o]=T.useMutation(gy);return s(J,{isOpen:l,onOpenChange:t,children:[e(E,{"aria-label":"Delete tag",size:"S",leadingVisual:e(D,{svg:e(Je,{})})}),e(ne,{children:e(Z,{size:"S",children:s(X,{children:[e(de,{slot:"title",children:"Delete Tag"}),e(v,{padding:"size-200",children:e(v,{paddingBottom:"size-100",children:e(F,{color:"danger",size:"XS",children:"Are you sure you want to delete this tag? This will make pulling prompts by this tag no longer possible. Make sure this tag is not used before deleting."})})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopWidth:"thin",borderColor:"light",children:s(b,{gap:"size-100",justifyContent:"end",children:[e(E,{size:"S",onPress:()=>t(!1),children:"Cancel"}),e(E,{variant:"danger",size:"S",onPress:()=>r({variables:{input:{promptVersionTagId:n},promptId:a},onCompleted:()=>{i({title:"Tag Deleted",message:"The tag has been deleted"})}}),children:o?"Deleting...":"Delete Tag"})]})})]})})})]})}function xP({prompt:n}){const a=T.useFragment(my,n),l=p.useMemo(()=>[{header:"Name",accessorKey:"name"},{header:"Description",accessorKey:"description",cell:Be},{header:"Version",accessorKey:"promptVersionId",cell:({row:d})=>{const{promptId:c,promptVersionId:u}=d.original;return e(Oe,{to:`/prompts/${c}/versions/${u}`,children:d.original.promptVersionId})}},{id:"actions",header:"",size:5,accessorKey:"id",cell:({row:d})=>e(b,{direction:"row",gap:"size-100",justifyContent:"end",width:"100%",children:e(IP,{promptVersionTagId:d.original.id,promptId:d.original.promptId},d.original.id)})}],[]),t=p.useMemo(()=>a.versionTags.map(d=>({id:d.id,name:d.name,description:d.description,promptId:a.id,promptVersionId:d.promptVersionId})),[a]),i=Le({columns:l,data:t,getCoreRowModel:_e(),getSortedRowModel:sn()}),r=i.getRowModel().rows,o=r.length===0;return e(q,{title:"Tags",variant:"compact",bodyStyle:{padding:0},children:s("table",{css:nn,children:[e("thead",{children:i.getHeaderGroups().map(d=>e("tr",{children:d.headers.map(c=>e("th",{colSpan:c.colSpan,children:c.isPlaceholder?null:s("div",{className:c.column.getCanSort()?"sort":"",onClick:c.column.getToggleSortingHandler(),style:{left:c.getStart(),width:c.getSize()},children:[ee(c.column.columnDef.header,c.getContext()),c.column.getIsSorted()?e(D,{className:"sort-icon",svg:c.column.getIsSorted()==="asc"?e(an,{}):e(ln,{})}):null]})},c.id))},d.id))}),o?e(vn,{message:"No Tags"}):e("tbody",{children:r.map(d=>e("tr",{children:d.getVisibleCells().map(c=>e("td",{children:ee(c.column.columnDef.cell,c.getContext())},c.id))},d.id))})]})})}function mx(){const n=Ue();return qe(n),e(b,{direction:"row",height:"100%",children:e(v,{height:"100%",overflow:"auto",width:"100%","data-testid":"scroll-container",children:e(v,{padding:"size-200",children:e(b,{direction:"column",gap:"size-200",marginStart:"auto",marginEnd:"auto",maxWidth:900,children:e(xP,{prompt:n.prompt})})})})})}function py(){return"FS"in window}function DP(n){if(window.Config.basename){let a=window.Config.basename;return a=a.replace(/^\/+|\/+$/g,"").replace(/\//g,"-"),`${a}-${n}`}return n}function LP(n){if(py())try{FS("setIdentity",{uid:DP(n.uid),properties:{displayName:n.displayName,email:n.email}})}catch(a){console.error("Error setting FullStory identity",a)}}function gx(){const n=Ue();return qe(n),p.useEffect(()=>{py()&&n.viewer&&LP({uid:n.viewer.id,displayName:n.viewer.username,email:n.viewer.email})},[n]),e(Ik,{query:n,children:e(Te,{})})}const yy=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"passwordNeedsReset",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"authenticatedRootLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"ViewerContext_viewer"},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[n,a,l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"authenticatedRootLoaderQuery",selections:[{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[n,a,l,{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isManagementUser",storageKey:null},{alias:null,args:null,concreteType:"UserRole",kind:"LinkedField",name:"role",plural:!1,selections:[i,n],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"authMethod",storageKey:null},{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"apiKeys",plural:!0,selections:[n,i,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null},t],storageKey:null}]},params:{cacheID:"909f2b392805d784bcac384c6d208692",id:null,metadata:{},name:"authenticatedRootLoaderQuery",operationKind:"query",text:`query authenticatedRootLoaderQuery {
8118
8111
  ...ViewerContext_viewer
8119
8112
  viewer {
8120
8113
  id
@@ -8150,7 +8143,7 @@ fragment ViewerContext_viewer on Query {
8150
8143
  ...APIKeysTableFragment
8151
8144
  }
8152
8145
  }
8153
- `}}}();yy.hash="7df3b0168622116913f7d14b4a0a6a0a";async function px(){var a;const n=await P.fetchQuery(ve,yy,{}).toPromise();if((a=n==null?void 0:n.viewer)!=null&&a.passwordNeedsReset){const l=Go({path:"/reset-password"});return Pa(l)}return n}const _P=K`
8146
+ `}}}();yy.hash="7df3b0168622116913f7d14b4a0a6a0a";async function px(){var a;const n=await T.fetchQuery(ve,yy,{}).toPromise();if((a=n==null?void 0:n.viewer)!=null&&a.passwordNeedsReset){const l=Go({path:"/reset-password"});return Pa(l)}return n}const _P=K`
8154
8147
  display: grid;
8155
8148
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
8156
8149
  gap: var(--ac-global-dimension-size-200);