MCPcopy Index your code
hub / github.com/google/adk-python / includes

Method includes

src/google/adk/cli/browser/main-3CUQG2IN.js:4163–4163  ·  view source on GitHub ↗
(A,t)

Source from the content-addressed store, hash-verified

4161`),this.testsService.rebuildTests(this.appName(),e).subscribe({next:()=>{A.next(`Successfully rebuilt tests.
4162`),this.isRebuilding.set(!1),this.loadTests(),A.complete()},error:t=>{A.next(`Error rebuilding tests: ${t.message||t}
4163`),this.isRebuilding.set(!1),A.complete()}})}clearConsole(){this.consoleOutput.set("")}static \u0275fac=function(A){return new(A||i)};static \u0275cmp=vA({type:i,selectors:[["app-tests-tab"]],inputs:{appName:[1,"appName"],sessionId:[1,"sessionId"],userId:[1,"userId"],isViewOnlySession:[1,"isViewOnlySession"]},outputs:{testSelected:"testSelected"},features:[ii],decls:20,vars:4,consts:[[1,"tests-container"],[1,"toolbar"],["mat-button","","color","primary",3,"click","disabled"],["mat-button","","color","accent",3,"click","disabled"],[1,"spacer"],["mat-icon-button","","matTooltip","Refresh",3,"click"],[1,"empty-state"],["mat-table","",1,"tests-table",3,"dataSource"],["matColumnDef","name"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","actions"],["mat-row","",3,"selected-row","click",4,"matRowDef","matRowDefColumns"],["mat-header-cell",""],["mat-cell",""],["mat-icon-button","","color","primary","matTooltip","Run Test",3,"click","disabled"],["mat-icon-button","","color","accent","matTooltip","Rebuild Test",3,"click","disabled"],["mat-icon-button","","color","primary","matTooltip","Rename Test",3,"click","disabled"],["mat-icon-button","","color","warn","matTooltip","Delete Test",3,"click","disabled"],["mat-row","",3,"click"]],template:function(A,t){A&1&&(I(0,"div",0)(1,"div",1)(2,"button",2),U("click",function(){return t.promoteCurrentSessionToTest()}),I(3,"mat-icon"),D(4,"add"),h(),D(5," From Current Session "),h(),I(6,"button",2),U("click",function(){return t.runAllTests()}),I(7,"mat-icon"),D(8,"playlist_play"),h(),D(9," Run All "),h(),I(10,"button",3),U("click",function(){return t.rebuildAllTests()}),I(11,"mat-icon"),D(12,"sync"),h(),D(13," Rebuild All "),h(),lA(14,"span",4),I(15,"button",5),U("click",function(){return t.loadTests()}),I(16,"mat-icon"),D(17,"refresh"),h()()(),T(18,obA,5,0,"div",6)(19,cbA,8,2,"table",7),h()),A&2&&(Q(2),H("disabled",!t.sessionId()||t.isViewOnlySession()),Q(4),H("disabled",t.isRunning()||t.isRebuilding()||t.dataSource.data.length===0),Q(4),H("disabled",t.isRunning()||t.isRebuilding()||t.dataSource.data.length===0),Q(8),O(t.dataSource.data.length===0?18:19))},dependencies:[li,qi,ki,yi,Un,zt,$X,t$,e$,i$,A$,n$,o$,a$,Ha,rn,l2,pE,Ls],styles:[".tests-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;box-sizing:border-box}.tests-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;height:48px;flex-shrink:0;padding:0 10px;background-color:var(--mat-sys-surface-container);border-bottom:1px solid var(--mat-sys-outline-variant);gap:8px}.tests-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] .spacer[_ngcontent-%COMP%]{flex:1 1 auto}.tests-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{height:32px!important;line-height:normal!important;border-radius:16px!important;font-size:13px!important;font-weight:500!important;display:inline-flex!important;align-items:center;justify-content:center}.tests-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button.mat-mdc-button[_ngcontent-%COMP%]{padding:0 12px!important}.tests-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button.mat-mdc-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{margin-right:4px!important}.tests-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button.mat-mdc-icon-button[_ngcontent-%COMP%]{width:32px!important;min-width:32px!important;padding:0!important;border-radius:50%!important}.tests-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button.mat-mdc-icon-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{margin-right:0!important}.tests-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button.mat-mdc-icon-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple{width:32px!important;height:32px!important;border-radius:50%!important}.tests-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px!important;width:20px!important;height:20px!important;line-height:20px!important;vertical-align:middle}.tests-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{vertical-align:middle}.tests-container[_ngcontent-%COMP%] .empty-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:32px;color:var(--mat-sys-on-surface-variant);font-style:italic;gap:8px}.tests-container[_ngcontent-%COMP%] .empty-state[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:48px;width:48px;height:48px}.tests-container[_ngcontent-%COMP%] .tests-table[_ngcontent-%COMP%]{width:100%;background:transparent;border-top:1px solid var(--mat-sys-outline-variant, #e0e0e0)}.tests-container[_ngcontent-%COMP%] .tests-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{font-weight:600}.tests-container[_ngcontent-%COMP%] .tests-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{vertical-align:middle;padding:6px 16px;border-bottom:1px solid var(--mat-sys-outline-variant, #e0e0e0)}.tests-container[_ngcontent-%COMP%] .tests-table[_ngcontent-%COMP%] tr.mat-header-row[_ngcontent-%COMP%]{display:none}.tests-container[_ngcontent-%COMP%] .tests-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]{cursor:pointer;background:transparent}.tests-container[_ngcontent-%COMP%] .tests-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-surface-container-low, #f5f5f5)}.tests-container[_ngcontent-%COMP%] .tests-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover td.mat-column-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{opacity:1}.tests-container[_ngcontent-%COMP%] .tests-table[_ngcontent-%COMP%] tr.selected-row[_ngcontent-%COMP%]{background-color:var(--mat-sys-surface-container-high, #e0e0e0)}.tests-container[_ngcontent-%COMP%] .tests-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] td.mat-column-actions[_ngcontent-%COMP%]{text-align:right}.tests-container[_ngcontent-%COMP%] .tests-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] td.mat-column-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{opacity:0;transition:opacity .2s ease-in-out}.tests-container[_ngcontent-%COMP%] .console-section[_ngcontent-%COMP%]{margin-top:16px;display:flex;flex-direction:column;gap:8px;flex:1;min-height:200px}.tests-container[_ngcontent-%COMP%] .console-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:1.1rem;font-weight:600}.tests-container[_ngcontent-%COMP%] .console-section[_ngcontent-%COMP%] .console-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;font-size:.9rem;color:var(--mat-sys-on-surface-variant)}.tests-container[_ngcontent-%COMP%] .console-section[_ngcontent-%COMP%] .console-actions[_ngcontent-%COMP%] .running-status[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_pulse 1.5s infinite}.tests-container[_ngcontent-%COMP%] .console-section[_ngcontent-%COMP%] .console-box[_ngcontent-%COMP%]{background-color:#1e1e1e;color:#d4d4d4;padding:12px;border-radius:4px;font-family:Courier New,Courier,monospace;font-size:.85rem;overflow:auto;flex:1;margin:0;white-space:pre-wrap;word-break:break-all;border:1px solid #333}.tests-container[_ngcontent-%COMP%] .console-section[_ngcontent-%COMP%] .console-box[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px;height:8px}.tests-container[_ngcontent-%COMP%] .console-section[_ngcontent-%COMP%] .console-box[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#555;border-radius:4px}.tests-container[_ngcontent-%COMP%] .console-section[_ngcontent-%COMP%] .console-box[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#777}.tests-container[_ngcontent-%COMP%] .console-section[_ngcontent-%COMP%] .console-box[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#1e1e1e}@keyframes _ngcontent-%COMP%_pulse{0%{opacity:.6}50%{opacity:1}to{opacity:.6}}"]})};var CbA={stateIsEmpty:"State is empty"},I$=new MA("State Tab Messages",{factory:()=>CbA});function dbA(i,e){if(i&1&&(I(0,"div",1),D(1),h()),i&2){let A=p();Q(),nA(A.i18n.stateIsEmpty)}}function IbA(i,e){if(i&1&&(I(0,"div"),lA(1,"app-custom-json-viewer",2),h()),i&2){let A=p();Q(),H("json",A.sessionState)}}var _y=class i{sessionState;i18n=w(I$);get isEmptyState(){return!this.sessionState||Object.keys(this.sessionState).length===0}static \u0275fac=function(A){return new(A||i)};static \u0275cmp=vA({type:i,selectors:[["app-state-tab"]],inputs:{sessionState:"sessionState"},decls:3,vars:1,consts:[[1,"state-wrapper"],[1,"empty-state"],[3,"json"]],template:function(A,t){A&1&&(I(0,"div",0),T(1,dbA,2,1,"div",1)(2,IbA,2,1,"div"),h()),A&2&&(Q(),O(t.isEmptyState?1:2))},dependencies:[fl],styles:[".state-wrapper[_ngcontent-%COMP%]{padding-left:25px;padding-right:25px;margin-top:16px}.state-wrapper[_ngcontent-%COMP%] .empty-state[_ngcontent-%COMP%]{text-align:center;font-style:italic}"]})};var BbA=(i,e)=>e.span_id;function hbA(i,e){if(i&1){let A=aA();I(0,"span",20)(1,"a",24),U("click",function(){let n;L(A);let o=p(3);return G(o.selectSpanById((n=o.selectedSpan())==null?null:n.parent_span_id))}),D(2),h(),I(3,"button",21),U("click",function(){let n;L(A);let o=p(3);return G(o.copyToClipboard((n=o.selectedSpan())==null?null:n.parent_span_id))}),I(4,"mat-icon"),D(5),h()()()}if(i&2){let A,t,n,o=p(3);Q(),H("matTooltip",((A=o.selectedSpan())==null?null:A.parent_span_id)||""),Q(),nA((t=o.selectedSpan())==null?null:t.parent_span_id),Q(3),nA(o.copiedId===((n=o.selectedSpan())==null?null:n.parent_span_id)?"check":"content_copy")}}function EbA(i,e){i&1&&D(0," None ")}function QbA(i,e){if(i&1){let A=aA();I(0,"tr")(1,"td"),D(2),h(),I(3,"td")(4,"span",20)(5,"a",24),U("click",function(){let n=L(A).$implicit,o=p(4);return G(o.selectSpanById(n.span_id))}),D(6),h(),I(7,"button",21),U("click",function(){let n=L(A).$implicit,o=p(4);return G(o.copyToClipboard(n.span_id))}),I(8,"mat-icon"),D(9),h()()()()()}if(i&2){let A=e.$implicit,t=p(4);Q(2),nA(A.name),Q(3),H("matTooltip",A.span_id),Q(),nA(A.span_id),Q(3),nA(t.copiedId===A.span_id?"check":"content_copy")}}function ubA(i,e){if(i&1&&(I(0,"table",22),ke(1,QbA,10,4,"tr",null,BbA),h()),i&2){let A=p(3);Q(),_e(A.selectedSpanChildren)}}function pbA(i,e){if(i&1){let A=aA();I(0,"table",23)(1,"tr")(2,"td"),D(3,"Event ID"),h(),I(4,"td")(5,"span",20)(6,"a",24),U("click",function(){L(A),p();let n=Ki(59),o=p(2);return G(o.switchToEvent.emit(n))}),D(7),h(),I(8,"button",21),U("click",function(){L(A),p();let n=Ki(59),o=p(2);return G(o.copyToClipboard(n))}),I(9,"mat-icon"),D(10),h()()()()()()}if(i&2){p();let A=Ki(59),t=p(2);Q(6),H("matTooltip",A||""),Q(),nA(A),Q(3),nA(t.copiedId===A?"check":"content_copy")}}function fbA(i,e){if(i&1){let A=aA();I(0,"div",13)(1,"table",15)(2,"tr")(3,"td"),D(4,"Name"),h(),I(5,"td")(6,"span",16)(7,"span",17),D(8),h(),I(9,"button",18),U("click",function(){let n;L(A);let o=p(2);return G(o.copyToClipboard((n=o.selectedSpan())==null?null:n.name))}),I(10,"mat-icon"),D(11),h()()()()(),I(12,"tr")(13,"td"),D(14,"Span ID"),h(),I(15,"td",19)(16,"span",20)(17,"span",17),D(18),h(),I(19,"button",21),U("click",function(){let n;L(A);let o=p(2);return G(o.copyToClipboard((n=o.selectedSpan())==null?null:n.span_id))}),I(20,"mat-icon"),D(21),h()()()()(),I(22,"tr")(23,"td"),D(24,"Parent ID"),h(),I(25,"td"),T(26,hbA,6,3,"span",20)(27,EbA,1,0),h()(),I(28,"tr")(29,"td"),D(30,"Trace ID"),h(),I(31,"td",19)(32,"span",20)(33,"span",17),D(34),h(),I(35,"button",21),U("click",function(){let n;L(A);let o=p(2);return G(o.copyToClipboard((n=o.selectedSpan())==null?null:n.trace_id))}),I(36,"mat-icon"),D(37),h()()()()(),I(38,"tr")(39,"td"),D(40,"Start Time"),h(),I(41,"td")(42,"span",16)(43,"span",17),D(44),h(),I(45,"button",18),U("click",function(){let n;L(A);let o=p(2);return G(o.copyToClipboard(o.formatTime((n=o.selectedSpan())==null?null:n.start_time),"startTime"))}),I(46,"mat-icon"),D(47),h()()()()(),I(48,"tr")(49,"td"),D(50,"End Time"),h(),I(51,"td")(52,"span",16)(53,"span",17),D(54),h(),I(55,"button",18),U("click",function(){let n;L(A);let o=p(2);return G(o.copyToClipboard(o.formatTime((n=o.selectedSpan())==null?null:n.end_time),"endTime"))}),I(56,"mat-icon"),D(57),h()()()()()(),T(58,ubA,3,0,"table",22),ro(59),T(60,pbA,11,3,"table",23),h()}if(i&2){let A,t,n,o,a,r,s,l,g,C,d,B,u,E,f=p(2);Q(7),H("matTooltip",((A=f.selectedSpan())==null?null:A.name)||""),Q(),nA((t=f.selectedSpan())==null?null:t.name),Q(3),nA(f.copiedId===((n=f.selectedSpan())==null?null:n.name)?"check":"content_copy"),Q(6),H("matTooltip",((o=f.selectedSpan())==null?null:o.span_id)||""),Q(),nA((a=f.selectedSpan())==null?null:a.span_id),Q(3),nA(f.copiedId===((r=f.selectedSpan())==null?null:r.span_id)?"check":"content_copy"),Q(5),O((s=f.selectedSpan())!=null&&s.parent_span_id?26:27),Q(7),H("matTooltip",((l=f.selectedSpan())==null?null:l.trace_id)||""),Q(),nA((g=f.selectedSpan())==null?null:g.trace_id),Q(3),nA(f.copiedId===((C=f.selectedSpan())==null?null:C.trace_id)?"check":"content_copy"),Q(6),H("matTooltip",f.formatTime((d=f.selectedSpan())==null?null:d.start_time)),Q(),nA(f.formatTime((B=f.selectedSpan())==null?null:B.start_time)),Q(3),nA(f.copiedId==="startTime"?"check":"content_copy"),Q(6),H("matTooltip",f.formatTime((u=f.selectedSpan())==null?null:u.end_time)),Q(),nA(f.formatTime((E=f.selectedSpan())==null?null:E.end_time)),Q(3),nA(f.copiedId==="endTime"?"check":"content_copy"),Q(),O(f.selectedSpanChildren.length>0?58:-1),Q();let m=so(f.getSelectedSpanEventId());Q(),O(m?60:-1)}}function mbA(i,e){if(i&1){let A=aA();I(0,"tr")(1,"td"),D(2),h(),I(3,"td")(4,"span",16)(5,"span"),D(6),h(),I(7,"button",18),U("click",function(){let n=L(A).$implicit;p(2);let o=Ki(1),a=p(2);return G(a.copyToClipboard(o[n]==null?null:o[n].toString()))}),I(8,"mat-icon"),D(9),h()()()()()}if(i&2){let A=e.$implicit;p(2);let t=Ki(1),n=p(2);Q(2),nA(A),Q(4),nA(t[A]),Q(3),nA(n.copiedId===(t[A]==null?null:t[A].toString())?"check":"content_copy")}}function wbA(i,e){if(i&1&&(I(0,"table",15),ke(1,mbA,10,3,"tr",null,ni),h()),i&2){p();let A=Ki(1),t=p(2);Q(),_e(t.Object.keys(A))}}function ybA(i,e){i&1&&(I(0,"div",1),D(1,"No attributes available"),h())}function DbA(i,e){if(i&1&&(I(0,"div",13),ro(1),T(2,wbA,3,0,"table",15)(3,ybA,2,0,"div",1),h()),i&2){let A=p(2);Q();let t=so(A.getSelectedSpanAttributesView());Q(),O(t&&A.Object.keys(t).length>0?2:3)}}function vbA(i,e){if(i&1){let A=aA();ro(0),I(1,"div",14),lA(2,"app-custom-json-viewer",25),I(3,"button",26),U("click",function(){L(A);let n=Ki(0),o=p(2);return G(o.copyJsonToClipboard(n,"raw"))}),I(4,"mat-icon"),D(5),h()()()}if(i&2){let A=p(2),t=so(A.getSelectedSpanRawView());Q(2),H("json",t),Q(3),nA(A.copiedId==="raw"?"check":"content_copy")}}function bbA(i,e){if(i&1){let A=aA();I(0,"div",0)(1,"div",2)(2,"mat-paginator",3),U("page",function(n){L(A);let o=p();return G(o.onPage(n))}),h(),I(3,"div",4),D(4),h(),lA(5,"div",5),I(6,"button",6),U("click",function(){L(A);let n=p();return G(n.traceService.selectedRow(void 0))}),I(7,"mat-icon"),D(8,"remove_selection"),h()()(),I(9,"div",7)(10,"div",8)(11,"button",9),U("click",function(){L(A);let n=p();return G(n.selectedDetailTab.set("info"))}),I(12,"mat-icon"),D(13,"info"),h()(),I(14,"button",10),U("click",function(){L(A);let n=p();return G(n.selectedDetailTab.set("attributes"))}),I(15,"mat-icon"),D(16,"list_alt"),h()(),I(17,"button",11),U("click",function(){L(A);let n=p();return G(n.selectedDetailTab.set("raw"))}),I(18,"mat-icon"),D(19,"data_object"),h()()(),I(20,"div",12),T(21,fbA,61,19,"div",13),T(22,DbA,4,2,"div",13),T(23,vbA,6,3,"div",14),h()()()}if(i&2){let A,t=p();Q(2),H("length",t.orderedTraceData.length)("pageSize",1)("pageIndex",t.selectedSpanIndex),Q(2),Ee(" ",(A=t.selectedSpan())==null?null:A.name," "),Q(7),_A("active",t.selectedDetailTab()==="info"),Q(3),_A("active",t.selectedDetailTab()==="attributes"),Q(3),_A("active",t.selectedDetailTab()==="raw"),Q(4),O(t.selectedDetailTab()==="info"?21:-1),Q(),O(t.selectedDetailTab()==="attributes"?22:-1),Q(),O(t.selectedDetailTab()==="raw"?23:-1)}}function MbA(i,e){i&1&&(I(0,"div",1),D(1,"Select a trace span to view its details"),h())}var RR=class i extends rd{nextPageLabel="Next Span";previousPageLabel="Previous Span";firstPageLabel="First Span";lastPageLabel="Last Span";getRangeLabel=(e,A,t)=>t===0?"Span 0 of 0":(t=Math.max(t,0),`Span ${e*A+1} of ${t}`);static \u0275fac=(()=>{let e;return function(t){return(e||(e=Li(i)))(t||i)}})();static \u0275prov=jA({token:i,factory:i.\u0275fac})},xy=class i{_traceData=[];orderedTraceData=[];set traceData(e){this._traceData=e||[],this.orderedTraceData=this.computeOrdered(this._traceData)}get traceData(){return this._traceData}computeOrdered(e){let A=e.map(a=>P({},a)),t=new Map,n=[];A.forEach(a=>t.set(String(a.span_id),a)),A.forEach(a=>{if(a.parent_span_id&&t.has(String(a.parent_span_id))){let r=t.get(String(a.parent_span_id));r.children=r.children||[],r.children.push(a)}else n.push(a)});let o=a=>a.flatMap(r=>[r,...r.children?o(r.children):[]]);return o(n)}traceService=w(ng);selectedSpan=sr(this.traceService.selectedTraceRow$);static getValidTraceTab(e){return e==="info"||e==="attributes"||e==="raw"?e:"info"}selectedDetailTab=mA(i.getValidTraceTab(window.localStorage.getItem("adk-trace-tab-selected-tab")));switchToEvent=Si();constructor(){Fn(()=>{window.localStorage.setItem("adk-trace-tab-selected-tab",this.selectedDetailTab())})}formatTime(e){return e?new Date(e/1e6).toLocaleString():"N/A"}get selectedSpanChildren(){let e=this.selectedSpan();return e?e.children&&e.children.length>0?e.children:this.traceData.filter(A=>A.parent_span_id&&String(A.parent_span_id)===String(e.span_id)):[]}selectSpanById(e){if(!e)return;let A=this.traceData.find(t=>String(t.span_id)===String(e));A&&this.traceService.selectedRow(A)}get selectedSpanIndex(){let e=this.selectedSpan();if(!e)return;let A=this.orderedTraceData.findIndex(t=>t.span_id===e.span_id);return A===-1?void 0:A}onPage(e){e.pageIndex>=0&&e.pageIndex<this.orderedTraceData.length&&this.traceService.selectedRow(this.orderedTraceData[e.pageIndex])}handleKeyboardNavigation(e){if(this.selectedSpanIndex===void 0)return;let A=document.activeElement;if(A&&(A.tagName==="INPUT"||A.tagName==="TEXTAREA"||A.isContentEditable)||e.key!=="ArrowUp"&&e.key!=="ArrowDown")return;e.preventDefault();let t;e.key==="ArrowDown"?t=this.selectedSpanIndex+1>=this.orderedTraceData.length?0:this.selectedSpanIndex+1:t=this.selectedSpanIndex-1<0?this.orderedTraceData.length-1:this.selectedSpanIndex-1,this.traceService.selectedRow(this.orderedTraceData[t])}Object=Object;copiedId=null;copyToClipboard(e,A){if(e==null||e==="")return;let t=String(e);navigator.clipboard.writeText(t).then(()=>{this.copiedId=A||t,setTimeout(()=>this.copiedId=null,2e3)})}getSelectedSpanEventId(){return this.selectedSpan()?.attrEventId}getSelectedSpanAttributesView(){return this.selectedSpan()?.rawAttributesUseThisFieldOnlyForDisplay??{}}getSelectedSpanRawView(){return this.selectedSpan()?.rawSpanUseThisFieldOnlyForDisplay}copyJsonToClipboard(e,A){if(!e)return;let t=JSON.stringify(e,null,2);navigator.clipboard.writeText(t).then(()=>{this.copiedId=A,setTimeout(()=>this.copiedId=null,2e3)})}static \u0275fac=function(A){return new(A||i)};static \u0275cmp=vA({type:i,selectors:[["app-trace-tab"]],hostBindings:function(A,t){A&1&&U("keydown",function(o){return t.handleKeyboardNavigation(o)},Fg)},inputs:{traceData:"traceData"},outputs:{switchToEvent:"switchToEvent"},features:[pt([{provide:rd,useClass:RR}])],decls:2,vars:1,consts:[[1,"event-details-container"],[1,"empty-state"],[1,"event-details-header"],["hidePageSize","","aria-label","Select span",1,"event-paginator",3,"page","length","pageSize","pageIndex"],[1,"span-title"],[2,"flex-grow","1"],["mat-icon-button","","matTooltip","Clear selection",3,"click"],[1,"event-details-content"],[1,"vertical-tabs-sidebar"],["mat-icon-button","","matTooltip","Info","matTooltipPosition","right",3,"click"],["mat-icon-button","","matTooltip","Attributes","matTooltipPosition","right",3,"click"],["mat-icon-button","","matTooltip","Raw JSON","matTooltipPosition","right",3,"click"],[1,"vertical-tabs-content"],[1,"info-tables-container"],[1,"json-viewer-container","json-viewer-wrapper"],["app-info-table",""],[1,"value-cell"],[3,"matTooltip"],["mat-icon-button","","matTooltip","Copy",1,"copy-value-button",3,"click"],[1,"id-text"],[1,"id-cell"],["mat-icon-button","","matTooltip","Copy",1,"copy-id-button",3,"click"],["app-info-table","","title","Children"],["app-info-table","","title","Events"],["href","javascript:void(0)",1,"span-link","id-text",3,"click","matTooltip"],[3,"json"],["mat-icon-button","","matTooltip","Copy JSON",1,"floating-copy-button",3,"click"]],template:function(A,t){A&1&&T(0,bbA,24,13,"div",0)(1,MbA,2,0,"div",1),A&2&&O(t.selectedSpan()!==void 0?0:1)},dependencies:[qi,yi,Un,zt,Ha,rn,fl,pm,u1],styles:["[_nghost-%COMP%]{display:block;height:100%}.json-viewer-container[_ngcontent-%COMP%]{margin:10px}.event-paginator[_ngcontent-%COMP%]{display:flex;justify-content:center;background-color:transparent}.event-paginator[_ngcontent-%COMP%] .mat-mdc-paginator-range-label{order:2;margin:0 0 0 8px}.span-title[_ngcontent-%COMP%]{font-weight:500;font-family:Google Sans Mono,monospace;font-size:13px;color:var(--mat-sys-on-surface);text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:300px;margin-left:16px}.event-details-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%}.event-details-content[_ngcontent-%COMP%]{display:flex;flex:1;overflow:hidden}.vertical-tabs-sidebar[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:48px;border-right:1px solid var(--mat-sys-outline-variant);padding-top:8px;align-items:center;gap:8px}.vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{border-radius:6px!important}.vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple, .vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .mat-mdc-button-ripple, .vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple:before, .vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .mat-mdc-focus-indicator{border-radius:6px!important}.vertical-tabs-sidebar[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]{background-color:var(--mat-sys-secondary-container)!important;color:var(--mat-sys-on-secondary-container)!important}.vertical-tabs-content[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;overflow:hidden;overflow-y:auto}.event-details-header[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;align-items:center;border-bottom:1px solid var(--mat-sys-outline-variant);height:48px;flex-shrink:0}.empty-state[_ngcontent-%COMP%]{padding:16px;text-align:center;color:var(--mat-sys-on-surface-variant);font-style:italic;font-size:14px}.info-tables-container[_ngcontent-%COMP%]{padding:16px;overflow-y:auto;display:flex;flex-direction:column;gap:24px}.span-link[_ngcontent-%COMP%]{color:var(--mat-sys-primary);text-decoration:none;cursor:pointer}.span-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.id-text[_ngcontent-%COMP%]{font-family:Google Sans Mono,monospace;font-size:11px}.id-cell[_ngcontent-%COMP%], .value-cell[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;overflow:hidden}.id-cell[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:first-child, .value-cell[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1}.id-cell[_ngcontent-%COMP%]:hover .copy-id-button[_ngcontent-%COMP%], .id-cell[_ngcontent-%COMP%]:hover .copy-value-button[_ngcontent-%COMP%], .value-cell[_ngcontent-%COMP%]:hover .copy-id-button[_ngcontent-%COMP%], .value-cell[_ngcontent-%COMP%]:hover .copy-value-button[_ngcontent-%COMP%]{opacity:1}.copy-id-button[_ngcontent-%COMP%], .copy-value-button[_ngcontent-%COMP%]{width:28px!important;height:28px!important;padding:0!important;line-height:28px!important;flex-shrink:0;margin:-4px 0!important;opacity:0;transition:opacity .2s ease-in-out;border-radius:4px!important;overflow:hidden!important}.copy-id-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple, .copy-id-button[_ngcontent-%COMP%] .mat-mdc-button-ripple, .copy-id-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple:before, .copy-id-button[_ngcontent-%COMP%] .mat-mdc-focus-indicator, .copy-value-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple, .copy-value-button[_ngcontent-%COMP%] .mat-mdc-button-ripple, .copy-value-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple:before, .copy-value-button[_ngcontent-%COMP%] .mat-mdc-focus-indicator{border-radius:4px!important}.copy-id-button[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%], .copy-value-button[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;line-height:16px}.json-viewer-wrapper[_ngcontent-%COMP%]{position:relative}.json-viewer-wrapper[_ngcontent-%COMP%]:hover .floating-copy-button[_ngcontent-%COMP%]{opacity:1}.floating-copy-button[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;z-index:10;opacity:0;transition:opacity .2s ease-in-out;background-color:var(--mat-sys-surface-container-high)!important;border-radius:4px!important;overflow:hidden!important;width:28px!important;height:28px!important;line-height:28px!important;padding:0!important}.floating-copy-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple, .floating-copy-button[_ngcontent-%COMP%] .mat-mdc-button-ripple, .floating-copy-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple:before, .floating-copy-button[_ngcontent-%COMP%] .mat-mdc-focus-indicator{border-radius:4px!important}.floating-copy-button[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;line-height:16px}.floating-copy-button[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-secondary-container)!important;color:var(--mat-sys-on-secondary-container)!important}"]})};var SbA={agentDevelopmentKitLabel:"Agent Development Kit",disclosureTooltip:"ADK Web is for development purposes. It has access to all the data and should not be used in production.",collapsePanelTooltip:"Collapse panel",eventsTabLabel:"Events",stateTabLabel:"State",artifactsTabLabel:"Artifacts",sessionsTabLabel:"Sessions",evalTabLabel:"Evals",testsTabLabel:"Tests",selectEventAriaLabel:"Select event",infoTabLabel:"Info",graphTabLabel:"Graph",requestDetailsTabLabel:"Request",responseDetailsTabLabel:"Response",responseIsNotAvailable:"Response is not available",requestIsNotAvailable:"Request is not available",clearSelectionButtonLabel:"Remove selection"},_E=new MA("Side Panel Messages",{factory:()=>SbA});var kbA=["eventMenuTrigger"],_bA=["graphContainer"],xbA=(i,e)=>e.span_id,RbA=(i,e)=>e.modality,B$=(i,e)=>e.key,NbA=(i,e)=>e.id;function FbA(i,e){if(i&1){let A=aA();I(0,"button",10),U("click",function(){L(A);let n=p();return G(n.selectedDetailTab="graph")}),I(1,"mat-icon"),D(2,"account_tree"),h()()}if(i&2){let A=p();_A("active",A.selectedDetailTab==="graph"),H("matTooltip",zC(A.i18n.graphTabLabel))}}function LbA(i,e){if(i&1){let A=aA();I(0,"div",31),lA(1,"app-custom-json-viewer",32),I(2,"button",33),U("click",function(){L(A);let n=p(3);return G(n.copyJsonToClipboard(n.selectedEvent().nodeInfo.outputFor,"nodeInfo.outputFor"))}),I(3,"mat-icon"),D(4),h()()()}if(i&2){let A=p(3);Q(),H("json",A.selectedEvent().nodeInfo.outputFor)("showMarkdown",!0),Q(3),nA(A.copiedId==="nodeInfo.outputFor"?"check":"content_copy")}}function GbA(i,e){i&1&&D(0," N/A ")}function KbA(i,e){if(i&1){let A=aA();I(0,"tr")(1,"td"),D(2,"Message As Output"),h(),I(3,"td")(4,"span",24)(5,"span",22),D(6),h(),I(7,"button",25),U("click",function(){L(A);let n=p(3);return G(n.copyToClipboard(n.selectedEvent().nodeInfo.messageAsOutput))}),I(8,"mat-icon"),D(9),h()()()()()}if(i&2){let A,t=p(3);Q(5),H("matTooltip",((A=t.selectedEvent().nodeInfo.messageAsOutput)==null?null:A.toString())||""),Q(),nA(t.selectedEvent().nodeInfo.messageAsOutput),Q(3),nA(t.copiedId===t.selectedEvent().nodeInfo.messageAsOutput?"check":"content_copy")}}function UbA(i,e){if(i&1){let A=aA();I(0,"table",26)(1,"tr")(2,"td"),D(3,"Node Path"),h(),I(4,"td")(5,"span",24)(6,"span",22),D(7),h(),I(8,"button",25),U("click",function(){L(A);let n=p(2);return G(n.copyToClipboard(n.selectedEvent().nodeInfo.path))}),I(9,"mat-icon"),D(10),h()()()()(),I(11,"tr")(12,"td"),D(13,"Output For"),h(),I(14,"td"),T(15,LbA,5,3,"div",31)(16,GbA,1,0),h()(),T(17,KbA,10,3,"tr"),h()}if(i&2){let A=p(2);Q(6),H("matTooltip",A.selectedEvent().nodeInfo.path||""),Q(),nA(A.selectedEvent().nodeInfo.path||"N/A"),Q(3),nA(A.copiedId===A.selectedEvent().nodeInfo.path?"check":"content_copy"),Q(5),O(A.selectedEvent().nodeInfo.outputFor?15:16),Q(2),O(A.selectedEvent().nodeInfo.messageAsOutput!==void 0?17:-1)}}function TbA(i,e){if(i&1){let A=aA();I(0,"div",31),lA(1,"app-custom-json-viewer",32),I(2,"button",33),U("click",function(){L(A);let n=p().$implicit,o=p(3);return G(o.copyJsonToClipboard(o.selectedEvent().actions[n],"action."+n))}),I(3,"mat-icon"),D(4),h()()()}if(i&2){let A=p().$implicit,t=p(3);Q(),H("json",t.selectedEvent().actions[A])("showMarkdown",!0),Q(3),nA(t.copiedId==="action."+A?"check":"content_copy")}}function ObA(i,e){if(i&1){let A=aA();I(0,"span",24)(1,"span",22),D(2),h(),I(3,"button",25),U("click",function(){let n;L(A);let o=p().$implicit,a=p(3);return G(a.copyToClipboard((n=a.selectedEvent().actions[o])==null?null:n.toString()))}),I(4,"mat-icon"),D(5),h()()()}if(i&2){let A,t,n=p().$implicit,o=p(3);Q(),H("matTooltip",((A=o.selectedEvent().actions[n])==null?null:A.toString())||""),Q(),nA(o.selectedEvent().actions[n]),Q(3),nA(o.copiedId===((t=o.selectedEvent().actions[n])==null?null:t.toString())?"check":"content_copy")}}function JbA(i,e){if(i&1&&(I(0,"tr")(1,"td"),D(2),h(),I(3,"td"),T(4,TbA,5,3,"div",31)(5,ObA,6,3,"span",24),h()()),i&2){let A=e.$implicit,t=p(3);Q(2),nA(A),Q(2),O(t.isObject(t.selectedEvent().actions[A])?4:5)}}function YbA(i,e){if(i&1&&(I(0,"table",27),ke(1,JbA,6,2,"tr",null,ni),h()),i&2){let A=p(2);Q(),_e(A.Object.keys(A.selectedEvent().actions))}}function HbA(i,e){if(i&1){let A=aA();I(0,"tr")(1,"td"),D(2),h(),I(3,"td")(4,"div",31),lA(5,"app-custom-json-viewer",32),I(6,"button",33),U("click",function(){let n=L(A),o=n.$implicit,a=n.$index,r=p(3);return G(r.copyJsonToClipboard(o,"fc."+a))}),I(7,"mat-icon"),D(8),h()()()()()}if(i&2){let A=e.$implicit,t=e.$index,n=p(3);Q(2),nA(A==null?null:A.name),Q(3),H("json",A)("showMarkdown",!0),Q(3),nA(n.copiedId==="fc."+t?"check":"content_copy")}}function zbA(i,e){if(i&1&&(I(0,"table",28),ke(1,HbA,9,4,"tr",null,Ja),h()),i&2){let A=p(2);Q(),_e(A.functionCalls())}}function PbA(i,e){if(i&1&&(I(0,"div",35),lA(1,"img",36),h()),i&2){let A=p().$implicit;Q(),H("src","data:"+A.inlineData.mimeType+";base64,"+A.inlineData.data,mo)}}function jbA(i,e){if(i&1&&(I(0,"div"),lA(1,"audio",37),h()),i&2){let A=p().$implicit;Q(),H("src","data:"+A.inlineData.mimeType+";base64,"+A.inlineData.data)}}function VbA(i,e){if(i&1&&(I(0,"div"),lA(1,"video",37),h()),i&2){let A=p().$implicit;Q(),H("src","data:"+A.inlineData.mimeType+";base64,"+A.inlineData.data,mo)}}function qbA(i,e){if(i&1&&(I(0,"div"),D(1),h()),i&2){let A=p().$implicit;Q(),Ee(" Unsupported media type: ",A.inlineData==null?null:A.inlineData.mimeType," ")}}function WbA(i,e){if(i&1&&T(0,PbA,2,1,"div",35)(1,jbA,2,1,"div")(2,VbA,2,1,"div")(3,qbA,2,1,"div"),i&2){let A=e.$implicit;O(!(A.inlineData==null||A.inlineData.mimeType==null)&&A.inlineData.mimeType.startsWith("image/")?0:!(A.inlineData==null||A.inlineData.mimeType==null)&&A.inlineData.mimeType.startsWith("audio/")?1:!(A.inlineData==null||A.inlineData.mimeType==null)&&A.inlineData.mimeType.startsWith("video/")?2:3)}}function ZbA(i,e){if(i&1&&(I(0,"div",34),ke(1,WbA,4,1,null,null,Ja),h()),i&2){let A=p().$implicit;Q(),_e(A.mediaParts)}}function XbA(i,e){if(i&1){let A=aA();I(0,"tr")(1,"td"),D(2),h(),I(3,"td"),T(4,ZbA,3,0,"div",34),I(5,"div",31),lA(6,"app-custom-json-viewer",32),I(7,"button",33),U("click",function(){let n=L(A),o=n.$implicit,a=n.$index,r=p(3);return G(r.copyJsonToClipboard(o.cleanedFr,"pfr."+a))}),I(8,"mat-icon"),D(9),h()()()()()}if(i&2){let A=e.$implicit,t=e.$index,n=p(3);Q(2),nA(A.name),Q(2),O(A.hasMedia?4:-1),Q(2),H("json",A.cleanedFr)("showMarkdown",!0),Q(3),nA(n.copiedId==="pfr."+t?"check":"content_copy")}}function $bA(i,e){if(i&1&&(I(0,"table",29),ke(1,XbA,10,5,"tr",null,Ja),h()),i&2){let A=p(2);Q(),_e(A.processedFunctionResponses())}}function A7A(i,e){if(i&1){let A=aA();I(0,"tr")(1,"td"),D(2),h(),I(3,"td")(4,"span",21)(5,"a",38),U("click",function(){let n=L(A).$implicit,o=p(3);return G(o.switchToSpan(n))}),D(6),h(),I(7,"button",23),U("click",function(){let n=L(A).$implicit,o=p(3);return G(o.copyToClipboard(n.span_id))}),I(8,"mat-icon"),D(9),h()()()()()}if(i&2){let A=e.$implicit,t=p(3);Q(2),nA(A.name),Q(3),H("matTooltip",A.span_id),Q(),nA(A.span_id),Q(3),nA(t.copiedId===A.span_id?"check":"content_copy")}}function e7A(i,e){if(i&1&&(I(0,"table",30),ke(1,A7A,10,4,"tr",null,xbA),h()),i&2){let A=p(2);Q(),_e(A.associatedSpans())}}function t7A(i,e){if(i&1){let A=aA();I(0,"div",16)(1,"table",19)(2,"tr")(3,"td"),D(4,"Event ID"),h(),I(5,"td",20)(6,"span",21)(7,"span",22),D(8),h(),I(9,"button",23),U("click",function(){let n;L(A);let o=p();return G(o.copyToClipboard((n=o.selectedEvent())==null?null:n.id))}),I(10,"mat-icon"),D(11),h()()()()(),I(12,"tr")(13,"td"),D(14,"Invocation ID"),h(),I(15,"td",20)(16,"span",21)(17,"span",22),D(18),h(),I(19,"button",23),U("click",function(){let n;L(A);let o=p();return G(o.copyToClipboard((n=o.selectedEvent())==null?null:n.invocationId))}),I(20,"mat-icon"),D(21),h()()()()(),I(22,"tr")(23,"td"),D(24,"Branch"),h(),I(25,"td")(26,"span",24)(27,"span",22),D(28),h(),I(29,"button",25),U("click",function(){let n;L(A);let o=p();return G(o.copyToClipboard((n=o.selectedEvent())==null?null:n.branch))}),I(30,"mat-icon"),D(31),h()()()()(),I(32,"tr")(33,"td"),D(34,"Timestamp"),h(),I(35,"td")(36,"span",24)(37,"span",22),D(38),h(),I(39,"button",25),U("click",function(){let n;L(A);let o=p();return G(o.copyToClipboard(o.formatTime((n=o.selectedEvent())==null?null:n.timestamp),"timestamp"))}),I(40,"mat-icon"),D(41),h()()()()(),I(42,"tr")(43,"td"),D(44,"Author"),h(),I(45,"td")(46,"span",24)(47,"span",22),D(48),h(),I(49,"button",25),U("click",function(){let n;L(A);let o=p();return G(o.copyToClipboard((n=o.selectedEvent())==null?null:n.author))}),I(50,"mat-icon"),D(51),h()()()()()(),T(52,UbA,18,5,"table",26),T(53,YbA,3,0,"table",27),T(54,zbA,3,0,"table",28),T(55,$bA,3,0,"table",29),T(56,e7A,3,0,"table",30),h()}if(i&2){let A,t,n,o,a,r,s,l,g,C,d,B,u,E,f,m,v=p();Q(7),H("matTooltip",((A=v.selectedEvent())==null?null:A.id)||""),Q(),nA((t=v.selectedEvent())==null?null:t.id),Q(3),nA(v.copiedId===((n=v.selectedEvent())==null?null:n.id)?"check":"content_copy"),Q(6),H("matTooltip",((o=v.selectedEvent())==null?null:o.invocationId)||""),Q(),nA(((a=v.selectedEvent())==null?null:a.invocationId)||"N/A"),Q(3),nA(v.copiedId===((r=v.selectedEvent())==null?null:r.invocationId)?"check":"content_copy"),Q(6),H("matTooltip",((s=v.selectedEvent())==null?null:s.branch)||""),Q(),nA(((l=v.selectedEvent())==null?null:l.branch)||"N/A"),Q(3),nA(v.copiedId===((g=v.selectedEvent())==null?null:g.branch)?"check":"content_copy"),Q(6),H("matTooltip",v.formatTime((C=v.selectedEvent())==null?null:C.timestamp)),Q(),nA(v.formatTime((d=v.selectedEvent())==null?null:d.timestamp)),Q(3),nA(v.copiedId==="timestamp"?"check":"content_copy"),Q(6),H("matTooltip",((B=v.selectedEvent())==null?null:B.author)||""),Q(),nA((u=v.selectedEvent())==null?null:u.author),Q(3),nA(v.copiedId===((E=v.selectedEvent())==null?null:E.author)?"check":"content_copy"),Q(),O((f=v.selectedEvent())!=null&&f.nodeInfo?52:-1),Q(),O((m=v.selectedEvent())!=null&&m.actions&&v.Object.keys(v.selectedEvent().actions).length>0?53:-1),Q(),O(v.functionCalls().length>0?54:-1),Q(),O(v.processedFunctionResponses().length>0?55:-1),Q(),O(v.associatedSpans().length>0?56:-1)}}function i7A(i,e){if(i&1&&(I(0,"div",42),mt(1,"number"),I(2,"span",43),D(3),h(),I(4,"span",44),D(5),mt(6,"number"),h()()),i&2){let A=e.$implicit;H("matTooltip",A.modality+": "+Ft(1,3,A.tokenCount)),Q(3),nA(A.modality),Q(2),nA(Ft(6,5,A.tokenCount))}}function n7A(i,e){if(i&1&&ke(0,i7A,7,7,"div",42,RbA),i&2){let A=p().$implicit,t=p(3);_e(t.selectedEvent().usageMetadata[A])}}function o7A(i,e){if(i&1&&(I(0,"span",22),mt(1,"number"),D(2),mt(3,"number"),h()),i&2){let A=p(2).$implicit,t=p(3);H("matTooltip",Ft(1,2,t.selectedEvent().usageMetadata[A])||""),Q(2),nA(Ft(3,4,t.selectedEvent().usageMetadata[A]))}}function a7A(i,e){if(i&1&&(I(0,"span",22),D(1),h()),i&2){let A,t=p(2).$implicit,n=p(3);H("matTooltip",((A=n.selectedEvent().usageMetadata[t])==null?null:A.toString())||""),Q(),nA(n.selectedEvent().usageMetadata[t])}}function r7A(i,e){if(i&1&&T(0,o7A,4,6,"span",22)(1,a7A,2,2,"span",22),i&2){let A=p().$implicit,t=p(3);O(t.isNumber(t.selectedEvent().usageMetadata[A])?0:1)}}function s7A(i,e){if(i&1&&(I(0,"tr")(1,"td"),D(2),h(),I(3,"td")(4,"span",24)(5,"span"),T(6,n7A,2,0)(7,r7A,2,1),h()()()()),i&2){let A=e.$implicit,t=p(3);Q(2),nA(A),Q(2),_A("numeric-cell",t.isNumericValue(A,t.selectedEvent().usageMetadata[A])),Q(2),O(A==="promptTokensDetails"||A==="promptTokenDetails"||A==="candidatesTokenDetails"||A==="candidatesTokensDetails"||A==="cacheTokensDetails"?6:7)}}function l7A(i,e){if(i&1&&(I(0,"table",39),ke(1,s7A,8,4,"tr",null,ni),h()),i&2){let A=p(2);Q(),_e(A.Object.keys(A.selectedEvent().usageMetadata))}}function g7A(i,e){i&1&&(I(0,"table",39)(1,"tr")(2,"td",45),D(3," Select an LLM response to see usage metadata. "),h()()())}function c7A(i,e){if(i&1&&(I(0,"div",16),T(1,l7A,3,0,"table",39)(2,g7A,4,0,"table",39),I(3,"table",40)(4,"tr")(5,"td"),D(6,"Total Prompt Tokens"),h(),I(7,"td",41),D(8),mt(9,"number"),h()(),I(10,"tr")(11,"td"),D(12,"Total Candidates Tokens"),h(),I(13,"td",41),D(14),mt(15,"number"),h()(),I(16,"tr")(17,"td"),D(18,"Total Tokens"),h(),I(19,"td",41),D(20),mt(21,"number"),h()()()()),i&2){let A,t=p();Q(),O((A=t.selectedEvent())!=null&&A.usageMetadata&&t.Object.keys(t.selectedEvent().usageMetadata).length>0?1:2),Q(7),nA(Ft(9,4,t.sessionUsageMetadata()["Prompt Tokens"])),Q(6),nA(Ft(15,6,t.sessionUsageMetadata()["Candidates Tokens"])),Q(6),nA(Ft(21,8,t.sessionUsageMetadata()["Total Tokens"]))}}function C7A(i,e){if(i&1){let A=aA();I(0,"div",17),lA(1,"app-custom-json-viewer",32),I(2,"button",33),U("click",function(){L(A);let n=p();return G(n.copyJsonToClipboard(n.filteredSelectedEvent(),"raw"))}),I(3,"mat-icon"),D(4),h()()()}if(i&2){let A=p();Q(),H("json",A.filteredSelectedEvent())("showMarkdown",!0),Q(3),nA(A.copiedId==="raw"?"check":"content_copy")}}function d7A(i,e){if(i&1&&lA(0,"app-custom-json-viewer",32),i&2){let A=p().$implicit;H("json",A.oldValue)("showMarkdown",!0)}}function I7A(i,e){if(i&1&&(I(0,"span"),D(1),h()),i&2){let A=p().$implicit;Q(),nA(A.oldValue)}}function B7A(i,e){if(i&1&&lA(0,"app-custom-json-viewer",32),i&2){let A=p().$implicit;H("json",A.newValue)("showMarkdown",!0)}}function h7A(i,e){if(i&1&&(I(0,"span"),D(1),h()),i&2){let A=p().$implicit;Q(),nA(A.newValue)}}function E7A(i,e){if(i&1&&(I(0,"div",47)(1,"div",48),D(2),h(),I(3,"div",49)(4,"div",50)(5,"div",51),D(6,"Old Value"),h(),I(7,"div",52),T(8,d7A,1,2,"app-custom-json-viewer",32)(9,I7A,2,1,"span"),h()(),I(10,"div",50)(11,"div",51),D(12,"New Value"),h(),I(13,"div",52),T(14,B7A,1,2,"app-custom-json-viewer",32)(15,h7A,2,1,"span"),h()()()()),i&2){let A=e.$implicit,t=p(3);Q(2),nA(A.key),Q(6),O(t.isObject(A.oldValue)?8:9),Q(6),O(t.isObject(A.newValue)?14:15)}}function Q7A(i,e){if(i&1&&ke(0,E7A,16,3,"div",47,B$),i&2){let A=p(2);_e(A.stateChanges())}}function u7A(i,e){i&1&&(I(0,"div",46),D(1," No state changes in this event. "),h())}function p7A(i,e){if(i&1&&(I(0,"div",16),T(1,Q7A,2,0)(2,u7A,2,0,"div",46),h()),i&2){let A=p();Q(),O(A.stateChanges().length>0?1:2)}}function f7A(i,e){i&1&&(I(0,"div",53)(1,"mat-icon",66),D(2,"warning"),h(),I(3,"span"),D(4,"The loaded session file was for a different app. The graph may not be accurate."),h()())}function m7A(i,e){if(i&1){let A=aA();I(0,"button",72),U("click",function(){let n=L(A).$implicit,o=p(3);return G(o.onInvocationSelected(n.key))}),I(1,"mat-icon",73),D(2,"check"),h(),D(3),h()}if(i&2){let A,t=e.$implicit,n=p(3);H("matTooltip",t.key),Q(),ft("visibility",((A=n.selectedEvent())==null?null:A.invocationId)===t.key?"visible":"hidden"),Q(2),Ee(" ",t.value," ")}}function w7A(i,e){if(i&1&&(I(0,"button",67)(1,"div",68)(2,"span",69),D(3),h(),I(4,"mat-icon",70),D(5,"arrow_drop_down"),h()()(),I(6,"mat-menu",null,3),ke(8,m7A,4,4,"button",71,B$),h()),i&2){let A,t=Bi(7),n=p(2);H("matMenuTriggerFor",t),Q(2),H("matTooltip",((A=n.selectedEvent())==null?null:A.invocationId)||""),Q(),Ee(" ",n.invocationDisplayMap().get(n.selectedEvent().invocationId)||n.selectedEvent().invocationId," "),Q(5),_e(n.invocationDisplayEntries())}}function y7A(i,e){if(i&1&&(I(0,"span",57),D(1),h()),i&2){let A,t,n=p(2);H("matTooltip",((A=n.selectedEvent())==null?null:A.invocationId)||""),Q(),nA((t=n.selectedEvent())!=null&&t.invocationId?n.invocationDisplayMap().get(n.selectedEvent().invocationId)||n.selectedEvent().invocationId:"N/A")}}function D7A(i,e){i&1&&(I(0,"mat-icon",75),D(1,"chevron_right"),h())}function v7A(i,e){i&1&&(I(0,"mat-icon",75),D(1,"chevron_right"),h())}function b7A(i,e){if(i&1&&(T(0,v7A,2,0,"mat-icon",75),I(1,"button",74),D(2),h()),i&2){let A=e.$implicit,t=e.$index,n=p(3);O(t>0?0:-1),Q(),_A("active",t===n.breadcrumbs().length-1),Q(),Ee(" ",A," ")}}function M7A(i,e){if(i&1&&(I(0,"div",58)(1,"button",74),D(2),h(),T(3,D7A,2,0,"mat-icon",75),ke(4,b7A,3,4,null,null,Ja),h()),i&2){let A=p(2);Q(2),nA(A.appName()),Q(),O(A.breadcrumbs().length>0?3:-1),Q(),_e(A.breadcrumbs())}}function S7A(i,e){if(i&1){let A=aA();I(0,"button",76),U("click",function(){L(A);let n=p(2);return G(n.showAgentStructureGraph.emit(!0))}),I(1,"mat-icon"),D(2,"fullscreen"),h()()}}function k7A(i,e){i&1&&(I(0,"div",61),D(1," Graph is not available for this agent. "),h())}function _7A(i,e){i&1&&(I(0,"div",62),lA(1,"mat-progress-spinner",77),h())}function x7A(i,e){if(i&1&&lA(0,"div",63),i&2){let A=p(2);H("innerHtml",A.renderedEventGraph(),Fc)}}function R7A(i,e){if(i&1){let A=aA();I(0,"button",78),U("click",function(){let n=L(A).$implicit,o=p(2);return G(o.handleMenuSelection(n))}),I(1,"span"),D(2),mt(3,"date"),h()()}if(i&2){let A=e.$implicit;Q(2),Ya("Run ",A.runIndex," (",G0(3,2,A.timestamp,"mediumTime"),")")}}function N7A(i,e){if(i&1&&(I(0,"div",18),T(1,f7A,5,0,"div",53),I(2,"div",54)(3,"div",55)(4,"span",56),D(5,"Invocation:"),h(),T(6,w7A,10,3)(7,y7A,2,2,"span",57),h()(),T(8,M7A,6,2,"div",58),I(9,"div",59,0),T(11,S7A,3,0,"button",60),T(12,k7A,2,0,"div",61)(13,_7A,2,0,"div",62)(14,x7A,1,1,"div",63),h(),lA(15,"div",64,1),I(17,"mat-menu",null,2),ke(19,R7A,4,5,"button",65,NbA),h()()),i&2){let A,t=Bi(18),n=p();Q(),O(n.isViewOnlyAppNameMismatch()?1:-1),Q(5),O(n.invocationDisplayMap().size>0&&((A=n.selectedEvent())!=null&&A.invocationId)?6:7),Q(2),O(n.hasSubWorkflows()&&(n.breadcrumbs().length>0||n.appName())?8:-1),Q(3),O(n.graphsAvailable()?11:-1),Q(),O(n.graphsAvailable()?n.renderedEventGraph()?14:13:12),Q(3),ft("left",n.menuPos.x+"px")("top",n.menuPos.y+"px"),H("matMenuTriggerFor",t),Q(4),_e(n.menuEvents)}}function F7A(i,e){i&1&&(I(0,"div",62),lA(1,"mat-progress-spinner",77),h())}function L7A(i,e){i&1&&(I(0,"div",61),D(1,"Select an LLM response to see request details."),h())}function G7A(i,e){if(i&1){let A=aA();I(0,"div",17),lA(1,"app-custom-json-viewer",32),I(2,"button",33),U("click",function(){L(A);let n=p(2);return G(n.copyJsonToClipboard(n.llmRequest(),"request"))}),I(3,"mat-icon"),D(4),h()()()}if(i&2){let A=p(2);Q(),H("json",A.llmRequest())("showMarkdown",!0),Q(3),nA(A.copiedId==="request"?"check":"content_copy")}}function K7A(i,e){if(i&1&&(T(0,F7A,2,0,"div",62),mt(1,"async"),S1(2,L7A,2,0,"div",61)(3,G7A,5,3,"div",17)),i&2){let A=p();O(Ft(1,1,A.uiStateService.isEventRequestResponseLoading())===!0?0:A.llmRequest()?3:2)}}function U7A(i,e){i&1&&(I(0,"div",62),lA(1,"mat-progress-spinner",77),h())}function T7A(i,e){i&1&&(I(0,"div",61),D(1,"Select an LLM response to see response details."),h())}function O7A(i,e){if(i&1){let A=aA();I(0,"div",17),lA(1,"app-custom-json-viewer",32),I(2,"button",33),U("click",function(){L(A);let n=p(2);return G(n.copyJsonToClipboard(n.llmResponse(),"response"))}),I(3,"mat-icon"),D(4),h()()()}if(i&2){let A=p(2);Q(),H("json",A.llmResponse())("showMarkdown",!0),Q(3),nA(A.copiedId==="response"?"check":"content_copy")}}function J7A(i,e){if(i&1&&(T(0,U7A,2,0,"div",62),mt(1,"async"),S1(2,T7A,2,0,"div",61)(3,O7A,5,3,"div",17)),i&2){let A=p();O(Ft(1,1,A.uiStateService.isEventRequestResponseLoading())===!0?0:A.llmResponse()?3:2)}}var Ry=class i{eventDataSize=ve.required();eventDataMap=ve(new Map);selectedEventIndex=ve();selectedEvent=ve.required();filteredSelectedEvent=ve();renderedEventGraph=ve();rawSvgString=ve(null);llmRequest=ve();llmResponse=ve();traceData=ve([]);appName=ve("");selectedEventGraphPath=ve("");hasSubWorkflows=ve(!1);graphsAvailable=ve(!0);invocationDisplayMap=ve(new Map);forceGraphTab=ve(!1);isViewOnlySession=ve(!1);isViewOnlyAppNameMismatch=ve(!1);invocationDisplayEntries=ye(()=>Array.from(this.invocationDisplayMap().entries()).map(([e,A])=>({key:e,value:A})));breadcrumbs=ye(()=>{let e=this.selectedEventGraphPath();return e?e.split("/").filter(A=>A):[]});functionCalls=ye(()=>(this.selectedEvent()?.content?.parts||[]).filter(A=>!!A.functionCall).map(A=>A.functionCall));functionResponses=ye(()=>(this.selectedEvent()?.content?.parts||[]).filter(A=>!!A.functionResponse).map(A=>A.functionResponse));processedFunctionResponses=ye(()=>this.functionResponses().map(A=>{if(!A)return null;if(A&&Array.isArray(A.parts)){let n=A.parts.filter(a=>!!a.inlineData).map(a=>a.inlineData&&a.inlineData.data?$A(P({},a),{inlineData:$A(P({},a.inlineData),{data:a.inlineData.data.replace(/-/g,"+").replace(/_/g,"/")})}):a),o=P({},A);return delete o.parts,{name:A.name,cleanedFr:o,mediaParts:n,hasMedia:n.length>0}}return{name:A.name,cleanedFr:A,mediaParts:[],hasMedia:!1}}).filter(A=>A!==null));page=Si();closeSelectedEvent=Si();openImageDialog=Si();switchToTraceView=Si();showAgentStructureGraph=Si();drillDownNodePath=Si();selectEventById=Si();jumpToInvocation=Si();onInvocationSelected(e){this.jumpToInvocation.emit(e)}eventMenuTrigger;graphContainer;menuEvents=[];menuPos={x:0,y:0};uiStateService=w(ag);traceService=w(ng);i18n=w(_E);isEventRequestResponseLoadingSignal=sr(this.uiStateService.isEventRequestResponseLoading(),{initialValue:!1});associatedSpans=ye(()=>{let e=this.selectedEvent();if(!e||!e.id)return[];let A=this.traceData();if(!A)return[];let t=o=>{let a=[];for(let r of o)a.push(r),r.children&&(a=a.concat(t(r.children)));return a};return t(A).filter(o=>o.attrEventId===e.id)});sessionUsageMetadata=ye(()=>{let e=Array.from(this.eventDataMap().values()),A=0,t=0,n=0;return e.forEach(o=>{let a=o.usageMetadata;if(a){let r=a.promptTokenCount??a.promptTokens??0,s=a.candidatesTokenCount??a.candidatesTokens??0,l=a.totalTokenCount??a.totalTokens??0;A+=Number(r),t+=Number(s),n+=Number(l)}}),{"Prompt Tokens":A,"Candidates Tokens":t,"Total Tokens":n}});_selectedDetailTab="event";get selectedDetailTab(){return this._selectedDetailTab}set selectedDetailTab(e){this._selectedDetailTab=e,window.localStorage.setItem("adk-event-tab-selected-tab",e),e==="graph"&&setTimeout(()=>{this.graphContainer?.nativeElement&&FB(this.graphContainer.nativeElement,(A,t)=>{this.handleNodeClick(A,t)})},50)}copiedId=null;copyToClipboard(e,A){e&&navigator.clipboard.writeText(e).then(()=>{this.copiedId=A||e,setTimeout(()=>this.copiedId=null,2e3)})}copyJsonToClipboard(e,A){if(!e)return;let t=JSON.stringify(e,null,2);navigator.clipboard.writeText(t).then(()=>{this.copiedId=A,setTimeout(()=>this.copiedId=null,2e3)})}switchToSpan(e){this.switchToTraceView.emit(),this.traceService.selectedRow(e)}stateChanges=ye(()=>{let e=this.selectedEvent();if(!e)return[];let A=Array.from(this.eventDataMap().values());A.sort((o,a)=>(o.timestamp||0)-(a.timestamp||0));let t={},n=[];for(let o of A){let a=o.actions?.stateDelta;if(o.id===e.id){if(a)for(let r of Object.keys(a))r!=="__llm_request_key__"&&n.push({key:r,oldValue:t[r]!==void 0?t[r]:"N/A",newValue:a[r]});break}if(a)for(let r of Object.keys(a))r!=="__llm_request_key__"&&(t[r]=a[r])}return n});constructor(){let e=window.localStorage.getItem("adk-event-tab-selected-tab");e&&["event","raw","request","response","graph","metadata","state"].includes(e)&&(this._selectedDetailTab=e),Fn(()=>{let t=this.renderedEventGraph(),n=this._selectedDetailTab;t&&n==="graph"&&setTimeout(()=>{this.graphContainer?.nativeElement&&FB(this.graphContainer.nativeElement,(o,a)=>{this.handleNodeClick(o,a)})},50)});let A=!1;Fn(()=>{let t=this.forceGraphTab(),n=this.selectedEvent();t&&!A&&(this.selectedDetailTab=this.graphsAvailable()?"graph":"event"),A=t})}formatTime(e){if(!e)return"N/A";let A=e<1e10?e*1e3:e;return new Date(A).toLocaleString()}isNumber(e){return typeof e=="number"}isNumericValue(e,A){return typeof A=="number"?!0:["promptTokensDetails","promptTokenDetails","candidatesTokenDetails","candidatesTokensDetails","cacheTokensDetails"].includes(e)}isObject(e){return e!==null&&typeof e=="object"}handleNodeClick(e,A){let t=Array.from(this.eventDataMap().values()),o=this.selectedEvent()?.invocationId;o&&(t=t.filter(l=>l.invocationId===o));let a=[],r=[],s="";t.forEach(l=>{let g=l.nodeInfo?.path;if(l.author==="user"&&(g="__START__"),!g)return;let C=g;g!=="__START__"&&(C=g.split("/").map(E=>E.split("@")[0]).join("/"));let d=C.split("/"),B=d[d.length-1],u="";if(d.length>=2&&d[d.length-1]==="call_llm"&&d[d.length-2]===l.author?(B=d[d.length-2],u=d.slice(1,-2).join("/")):u=d.slice(1,-1).join("/"),u===this.selectedEventGraphPath()){let E=g.split("/"),f=E[E.length-1],m=e.includes("@")?f:B;m!==s&&(s===e&&r.length>0&&a.push(r),s=m,r=[]),m===e&&r.push(l)}}),s===e&&r.length>0&&a.push(r),a.length!==0&&(a.length===1?this.selectEventById.emit(a[0][0].id):(this.menuEvents=a.map((l,g)=>({id:l[0].id,runIndex:g+1,timestamp:l[0].timestamp})),A&&(this.menuPos={x:A.clientX,y:A.clientY}),this.eventMenuTrigger.openMenu()))}handleMenuSelection(e){this.selectEventById.emit(e.id)}Object=Object;static \u0275fac=function(A){return new(A||i)};static \u0275cmp=vA({type:i,selectors:[["app-event-tab"]],viewQuery:function(A,t){if(A&1&&Wt(kbA,5)(_bA,5),A&2){let n;se(n=le())&&(t.eventMenuTrigger=n.first),se(n=le())&&(t.graphContainer=n.first)}},inputs:{eventDataSize:[1,"eventDataSize"],eventDataMap:[1,"eventDataMap"],selectedEventIndex:[1,"selectedEventIndex"],selectedEvent:[1,"selectedEvent"],filteredSelectedEvent:[1,"filteredSelectedEvent"],renderedEventGraph:[1,"renderedEventGraph"],rawSvgString:[1,"rawSvgString"],llmRequest:[1,"llmRequest"],llmResponse:[1,"llmResponse"],traceData:[1,"traceData"],appName:[1,"appName"],selectedEventGraphPath:[1,"selectedEventGraphPath"],hasSubWorkflows:[1,"hasSubWorkflows"],graphsAvailable:[1,"graphsAvailable"],invocationDisplayMap:[1,"invocationDisplayMap"],forceGraphTab:[1,"forceGraphTab"],isViewOnlySession:[1,"isViewOnlySession"],isViewOnlyAppNameMismatch:[1,"isViewOnlyAppNameMismatch"]},outputs:{page:"page",closeSelectedEvent:"closeSelectedEvent",openImageDialog:"openImageDialog",switchToTraceView:"switchToTraceView",showAgentStructureGraph:"showAgentStructureGraph",drillDownNodePath:"drillDownNodePath",selectEventById:"selectEventById",jumpToInvocation:"jumpToInvocation"},decls:35,vars:32,consts:[["graphContainer",""],["eventMenuTrigger","matMenuTrigger"],["eventMenu","matMenu"],["invocationSelectorMenu","matMenu"],[1,"event-details-container"],[1,"event-details-header"],["hidePageSize","",1,"event-paginator",3,"page","length","pageSize","pageIndex"],["mat-icon-button","",3,"click","matTooltip"],[1,"event-details-content"],[1,"vertical-tabs-sidebar"],["mat-icon-button","","matTooltipPosition","right",3,"click","matTooltip"],["mat-icon-button","","matTooltipPosition","right",3,"active","matTooltip"],["mat-icon-button","","matTooltip","Usage Metadata","matTooltipPosition","right",3,"click"],["mat-icon-button","","matTooltip","State Changes","matTooltipPosition","right",3,"click"],["mat-icon-button","","matTooltip","Raw JSON","matTooltipPosition","right",3,"click"],[1,"vertical-tabs-content"],[1,"info-tables-container"],[1,"json-viewer-container","json-viewer-wrapper"],[1,"event-graph-wrapper"],["app-info-table",""],[1,"id-text"],[1,"id-cell"],[3,"matTooltip"],["mat-icon-button","","matTooltip","Copy",1,"copy-id-button",3,"click"],[1,"value-cell"],["mat-icon-button","","matTooltip","Copy",1,"copy-value-button",3,"click"],["app-info-table","","title","Node Info"],["app-info-table","","title","Actions"],["app-info-table","","title","Function Calls"],["app-info-table","","title","Function Responses"],["app-info-table","","title","Associated Spans"],[1,"json-viewer-wrapper"],[3,"json","showMarkdown"],["mat-icon-button","","matTooltip","Copy JSON",1,"floating-copy-button",3,"click"],[1,"media-container"],[1,"generated-image-container"],["alt","image",3,"src"],["controls","",3,"src"],["href","javascript:void(0)",1,"span-link","id-text",3,"click","matTooltip"],["app-info-table","","title","Usage Summary for Event"],["app-info-table","","title","Usage Summary for Session"],[1,"numeric-cell"],[1,"detail-row",3,"matTooltip"],[1,"modality-label"],[1,"modality-value"],["colspan","2",2,"text-align","center","padding","20px","color","var(--mat-sys-on-surface-variant)"],[1,"empty-state"],[1,"state-change-card"],[1,"state-change-header"],[1,"state-change-values"],[1,"state-value-block"],[1,"state-value-label"],[1,"state-value-content"],[1,"warning-banner",2,"background-color","#fff3cd","color","#856404","padding","8px","margin-bottom","8px","border-radius","4px","display","flex","align-items","center"],[1,"graph-header",2,"justify-content","space-between"],[2,"display","flex","align-items","center","min-width","0","flex","1","width","100%"],[2,"white-space","nowrap","flex-shrink","0"],[2,"margin-left","8px","font-weight","normal",3,"matTooltip"],[1,"breadcrumb-container"],[1,"event-graph-container"],["mat-icon-button","","matTooltip","Full Screen",1,"fullscreen-graph-button"],[1,"request-response-empty-state"],[1,"request-response-loading-spinner-container"],[1,"svg-graph-wrapper",3,"innerHtml"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],["mat-menu-item",""],[2,"margin-right","8px"],["mat-button","",1,"invocation-selector-button",2,"margin-left","8px","padding","0 8px","min-width","0","flex","1","height","24px","line-height","24px","width","100%",3,"matMenuTriggerFor"],[2,"display","flex","align-items","center","width","100%","min-width","0","justify-content","space-between"],[2,"font-weight","normal","overflow","hidden","text-overflow","ellipsis","white-space","nowrap","flex","1","text-align","left",3,"matTooltip"],[2,"margin-left","4px","font-size","18px","width","18px","height","18px","flex-shrink","0"],["mat-menu-item","","matTooltipPosition","right",3,"matTooltip"],["mat-menu-item","","matTooltipPosition","right",3,"click","matTooltip"],[2,"font-size","16px","width","16px","height","16px","margin-right","8px","color","var(--mat-sys-primary)"],["disabled","",1,"breadcrumb-item"],[1,"breadcrumb-separator"],["mat-icon-button","","matTooltip","Full Screen",1,"fullscreen-graph-button",3,"click"],["mode","indeterminate","diameter","50"],["mat-menu-item","",3,"click"]],template:function(A,t){A&1&&(I(0,"div",4)(1,"div",5)(2,"mat-paginator",6),U("page",function(o){return t.page.emit(o)}),h(),I(3,"button",7),U("click",function(){return t.closeSelectedEvent.emit()}),I(4,"mat-icon"),D(5,"remove_selection"),h()()(),I(6,"div",8)(7,"div",9)(8,"button",10),U("click",function(){return t.selectedDetailTab="event"}),I(9,"mat-icon"),D(10,"info"),h()(),T(11,FbA,3,4,"button",11),I(12,"button",10),U("click",function(){return t.selectedDetailTab="request"}),I(13,"mat-icon"),D(14,"input"),h()(),I(15,"button",10),U("click",function(){return t.selectedDetailTab="response"}),I(16,"mat-icon"),D(17,"output"),h()(),I(18,"button",12),U("click",function(){return t.selectedDetailTab="metadata"}),I(19,"mat-icon"),D(20,"analytics"),h()(),I(21,"button",13),U("click",function(){return t.selectedDetailTab="state"}),I(22,"mat-icon"),D(23,"published_with_changes"),h()(),I(24,"button",14),U("click",function(){return t.selectedDetailTab="raw"}),I(25,"mat-icon"),D(26,"data_object"),h()()(),I(27,"div",15),T(28,t7A,57,20,"div",16),T(29,c7A,22,10,"div",16),T(30,C7A,5,3,"div",17),T(31,p7A,3,1,"div",16),T(32,N7A,21,10,"div",18),T(33,K7A,4,3),T(34,J7A,4,3),h()()()),A&2&&(Q(2),H("length",t.eventDataSize())("pageSize",1)("pageIndex",t.selectedEventIndex()),ie("aria-label",t.i18n.selectEventAriaLabel),Q(),H("matTooltip",zC(t.i18n.clearSelectionButtonLabel)),Q(5),_A("active",t.selectedDetailTab==="event"),H("matTooltip",zC(t.i18n.infoTabLabel)),Q(3),O(t.graphsAvailable()?11:-1),Q(),_A("active",t.selectedDetailTab==="request"),H("matTooltip",zC(t.i18n.requestDetailsTabLabel)),Q(3),_A("active",t.selectedDetailTab==="response"),H("matTooltip",zC(t.i18n.responseDetailsTabLabel)),Q(3),_A("active",t.selectedDetailTab==="metadata"),Q(3),_A("active",t.selectedDetailTab==="state"),Q(3),_A("active",t.selectedDetailTab==="raw"),Q(4),O(t.selectedDetailTab==="event"?28:-1),Q(),O(t.selectedDetailTab==="metadata"?29:-1),Q(),O(t.selectedDetailTab==="raw"?30:-1),Q(),O(t.selectedDetailTab==="state"?31:-1),Q(),O(t.selectedDetailTab==="graph"?32:-1),Q(),O(t.selectedDetailTab==="request"?33:-1),Q(),O(t.selectedDetailTab==="response"?34:-1))},dependencies:[qi,ki,yi,zt,pm,Es,rn,s2,hs,Gs,tg,fl,u1,gs,YN,bI],styles:["[_nghost-%COMP%]{display:block;height:100%}.json-viewer-container[_ngcontent-%COMP%]{margin:10px}.event-paginator[_ngcontent-%COMP%]{margin-right:auto;display:flex;justify-content:center;background-color:transparent}.event-paginator[_ngcontent-%COMP%] .mat-mdc-paginator-range-label{order:2;margin:0 0 0 8px}.event-details-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%}.event-details-content[_ngcontent-%COMP%]{display:flex;flex:1;overflow:hidden}.vertical-tabs-sidebar[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:48px;border-right:1px solid var(--mat-sys-outline-variant);padding-top:8px;align-items:center;gap:8px}.vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{border-radius:6px!important}.vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple, .vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .mat-mdc-button-ripple, .vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple:before, .vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .mat-mdc-focus-indicator{border-radius:6px!important}.vertical-tabs-sidebar[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]{background-color:var(--mat-sys-secondary-container)!important;color:var(--mat-sys-on-secondary-container)!important}.vertical-tabs-content[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;overflow:hidden;overflow-y:auto}.event-details-header[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;align-items:center;border-bottom:1px solid var(--mat-sys-outline-variant);height:48px;flex-shrink:0}.empty-state[_ngcontent-%COMP%]{padding:16px;text-align:center;color:var(--mat-sys-on-surface-variant);font-style:italic}.details-content[_ngcontent-%COMP%]{color:var(--side-panel-details-content-color);font-size:14px}.event-graph-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;width:100%}.breadcrumb-container[_ngcontent-%COMP%]{display:flex;align-items:center;font-size:13px;color:var(--mat-sys-on-surface-variant);padding:8px 12px}.breadcrumb-container[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-weight:500;margin-right:8px;color:var(--mat-sys-on-surface)}.breadcrumb-container[_ngcontent-%COMP%] .breadcrumb-item[_ngcontent-%COMP%]{background:none;border:none;color:var(--mat-sys-primary);font-size:13px;padding:2px 4px}.breadcrumb-container[_ngcontent-%COMP%] .breadcrumb-item.active[_ngcontent-%COMP%]{font-weight:500;color:var(--mat-sys-on-surface)}.breadcrumb-container[_ngcontent-%COMP%] .breadcrumb-item[_ngcontent-%COMP%]:disabled{color:var(--mat-sys-on-surface);font-weight:500}.breadcrumb-container[_ngcontent-%COMP%] .breadcrumb-separator[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;display:flex;align-items:center;justify-content:center;color:var(--mat-sys-on-surface-variant);margin:0 4px}.graph-header[_ngcontent-%COMP%]{display:flex;align-items:center;font-size:13px;color:var(--mat-sys-on-surface-variant);background-color:var(--mat-sys-surface-container-lowest);padding:8px 16px;border-bottom:1px solid var(--mat-sys-outline-variant)}.graph-header[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-weight:500;margin-right:8px;color:var(--mat-sys-on-surface)}.event-graph-container[_ngcontent-%COMP%]{flex:1;overflow:hidden;padding:16px;position:relative}.fullscreen-graph-button[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;z-index:10;width:48px!important;height:48px!important;padding:0!important;display:flex!important;justify-content:center!important;align-items:center!important}.fullscreen-graph-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:28px!important;width:28px!important;height:28px!important;line-height:28px!important;margin:0!important;padding:0!important}.event-graph-container[_ngcontent-%COMP%] .svg-graph-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.event-graph-container[_ngcontent-%COMP%] svg{max-width:100%;max-height:100%;width:auto;height:auto;display:block}.event-graph-container[_ngcontent-%COMP%] svg>g.graph>polygon:first-child{fill:transparent!important}.request-response-loading-spinner-container[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;margin-top:2em}.request-response-empty-state[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;margin-top:2em;font-style:italic}.id-text[_ngcontent-%COMP%]{font-family:Google Sans Mono,monospace;font-size:12px}.id-cell[_ngcontent-%COMP%], .value-cell[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;overflow:hidden}.id-cell[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:first-child, .value-cell[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1}.id-cell[_ngcontent-%COMP%]:hover .copy-id-button[_ngcontent-%COMP%], .id-cell[_ngcontent-%COMP%]:hover .copy-value-button[_ngcontent-%COMP%], .value-cell[_ngcontent-%COMP%]:hover .copy-id-button[_ngcontent-%COMP%], .value-cell[_ngcontent-%COMP%]:hover .copy-value-button[_ngcontent-%COMP%]{opacity:1}.numeric-cell[_ngcontent-%COMP%]{text-align:right!important}.value-cell.numeric-cell[_ngcontent-%COMP%]{justify-content:flex-end}.value-cell.numeric-cell[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:first-child{text-align:right;font-family:Google Sans Mono,monospace;font-size:13px;font-weight:500;color:var(--mat-sys-on-surface)}.value-cell.numeric-cell[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:first-child span[_ngcontent-%COMP%]{font-family:Google Sans Mono,monospace}td.numeric-cell[_ngcontent-%COMP%]{text-align:right!important;font-family:Google Sans Mono,monospace!important;font-size:13px!important;font-weight:500!important;color:var(--mat-sys-on-surface)!important}.detail-row[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;align-items:center;gap:8px;margin-bottom:4px;font-size:12px;transition:transform .15s ease-in-out}.detail-row[_ngcontent-%COMP%]:hover{transform:translate(-2px)}.detail-row[_ngcontent-%COMP%]:last-child{margin-bottom:0}.detail-row[_ngcontent-%COMP%] .modality-label[_ngcontent-%COMP%]{font-size:10px;font-weight:600;letter-spacing:.5px;text-transform:uppercase;padding:2px 6px;border-radius:4px;color:var(--mat-sys-primary);background-color:var(--mat-sys-primary-container);opacity:.85}.detail-row[_ngcontent-%COMP%] .modality-value[_ngcontent-%COMP%]{font-weight:500;font-family:Google Sans Mono,monospace;color:var(--mat-sys-on-surface)}.copy-id-button[_ngcontent-%COMP%], .copy-value-button[_ngcontent-%COMP%]{width:28px!important;height:28px!important;padding:0!important;line-height:28px!important;flex-shrink:0;margin:-4px 0!important;opacity:0;transition:opacity .2s ease-in-out;border-radius:4px!important;overflow:hidden!important}.copy-id-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple, .copy-id-button[_ngcontent-%COMP%] .mat-mdc-button-ripple, .copy-id-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple:before, .copy-id-button[_ngcontent-%COMP%] .mat-mdc-focus-indicator, .copy-value-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple, .copy-value-button[_ngcontent-%COMP%] .mat-mdc-button-ripple, .copy-value-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple:before, .copy-value-button[_ngcontent-%COMP%] .mat-mdc-focus-indicator{border-radius:4px!important}.copy-id-button[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%], .copy-value-button[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;line-height:16px}.info-tables-container[_ngcontent-%COMP%]{padding:16px;overflow-y:auto;display:flex;flex-direction:column;gap:24px}.invocation-selector-button[_ngcontent-%COMP%] .mdc-button__label{width:100%;flex:1;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center;justify-content:space-between}.media-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;margin-top:8px;margin-bottom:12px}.generated-image-container[_ngcontent-%COMP%]{max-width:100%;border-radius:8px;overflow:hidden;box-shadow:0 2px 4px #0000001a;border:1px solid var(--mat-sys-outline-variant)}.generated-image-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:auto;display:block}audio[_ngcontent-%COMP%], video[_ngcontent-%COMP%]{max-width:100%;border-radius:4px}.json-viewer-wrapper[_ngcontent-%COMP%]{position:relative}.json-viewer-wrapper[_ngcontent-%COMP%]:hover .floating-copy-button[_ngcontent-%COMP%]{opacity:1}.floating-copy-button[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;z-index:10;opacity:0;transition:opacity .2s ease-in-out;background-color:var(--mat-sys-surface-container-high)!important;border-radius:4px!important;overflow:hidden!important;width:28px!important;height:28px!important;line-height:28px!important;padding:0!important}.floating-copy-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple, .floating-copy-button[_ngcontent-%COMP%] .mat-mdc-button-ripple, .floating-copy-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple:before, .floating-copy-button[_ngcontent-%COMP%] .mat-mdc-focus-indicator{border-radius:4px!important}.floating-copy-button[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;line-height:16px}.floating-copy-button[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-secondary-container)!important;color:var(--mat-sys-on-secondary-container)!important}.state-change-card[_ngcontent-%COMP%]{border-radius:8px;padding:10px;display:flex;flex-direction:column;gap:8px}.state-change-header[_ngcontent-%COMP%]{font-weight:600;font-size:14px;color:var(--mat-sys-primary);padding-bottom:4px}.state-change-values[_ngcontent-%COMP%]{display:flex;gap:12px;flex-wrap:wrap}.state-value-block[_ngcontent-%COMP%]{flex:1;min-width:200px;background-color:var(--mat-sys-surface-container-highest);border-radius:6px;padding:8px;display:flex;flex-direction:column;gap:4px}.state-value-label[_ngcontent-%COMP%]{font-size:12px;font-weight:500;color:var(--mat-sys-on-surface-variant)}.state-value-content[_ngcontent-%COMP%]{font-family:Google Sans Mono,monospace;font-size:13px;color:var(--mat-sys-on-surface);word-break:break-all}"],changeDetection:0})};var Y7A=["evalTabContainer"];function H7A(i,e){}function z7A(i,e){i&1&&(I(0,"div",1),lA(1,"mat-progress-spinner",4),h())}function P7A(i,e){if(i&1&&(I(0,"span",11),D(1),h()),i&2){let A=p(2);Q(),nA(A.i18n.infoTabLabel)}}function j7A(i,e){if(i&1){let A=aA();I(0,"app-trace-tab",12),U("switchToEvent",function(n){L(A);let o=p(2);return G(o.switchToEvent.emit(n))}),h()}if(i&2){let A=p(2);H("traceData",A.traceData())}}function V7A(i,e){if(i&1){let A=aA();I(0,"app-event-tab",13),U("page",function(n){L(A);let o=p(2);return G(o.page.emit(n))})("closeSelectedEvent",function(){L(A);let n=p(2);return G(n.closeSelectedEvent.emit())})("openImageDialog",function(n){L(A);let o=p(2);return G(o.openImageDialog.emit(n))})("switchToTraceView",function(){L(A);let n=p(2);return G(n.switchToTraceView.emit())})("showAgentStructureGraph",function(n){L(A);let o=p(2);return G(o.showAgentStructureGraph.emit(n))})("drillDownNodePath",function(n){L(A);let o=p(2);return G(o.drillDownNodePath.emit(n))})("selectEventById",function(n){L(A);let o=p(2);return G(o.selectEventById.emit(n))})("jumpToInvocation",function(n){L(A);let o=p(2);return G(o.jumpToInvocation.emit(n))}),h()}if(i&2){let A=p(2);H("eventDataSize",A.eventData().size)("eventDataMap",A.eventData())("selectedEventIndex",A.selectedEventIndex())("selectedEvent",A.selectedEvent())("traceData",A.traceData())("filteredSelectedEvent",A.filteredSelectedEvent())("renderedEventGraph",A.renderedEventGraph())("rawSvgString",A.rawSvgString())("appName",A.appName())("selectedEventGraphPath",A.selectedEventGraphPath())("llmRequest",A.llmRequest())("llmResponse",A.llmResponse())("hasSubWorkflows",A.hasSubWorkflows())("graphsAvailable",A.graphsAvailable())("invocationDisplayMap",A.invocationDisplayMap())("forceGraphTab",A.forceGraphTab())("isViewOnlySession",A.isViewOnlySession())("isViewOnlyAppNameMismatch",A.isViewOnlyAppNameMismatch())}}function q7A(i,e){i&1&&(I(0,"div",9),D(1,"Select an event or trace span to view details"),h())}function W7A(i,e){if(i&1&&(I(0,"span",11),D(1),h()),i&2){let A=p(2);Q(),nA(A.i18n.stateTabLabel)}}function Z7A(i,e){if(i&1&&(I(0,"span",11),D(1),h()),i&2){let A=p(3);Q(),nA(A.i18n.artifactsTabLabel)}}function X7A(i,e){if(i&1&&(I(0,"mat-tab"),kt(1,Z7A,2,1,"ng-template",6),lA(2,"app-artifact-tab",14),h()),i&2){let A=p(2);Q(2),H("artifacts",A.artifacts())}}function $7A(i,e){if(i&1&&(I(0,"span",11),D(1),h()),i&2){let A=p(3);Q(),nA(A.i18n.testsTabLabel)}}function AMA(i,e){if(i&1){let A=aA();I(0,"mat-tab"),kt(1,$7A,2,1,"ng-template",6),I(2,"app-tests-tab",15),U("testSelected",function(n){L(A);let o=p(2);return G(o.testSelected.emit(n))}),h()()}if(i&2){let A=p(2);Q(2),H("appName",A.appName())("sessionId",A.sessionId())("userId",A.userId())("isViewOnlySession",A.isViewOnlySession())}}function eMA(i,e){if(i&1&&(I(0,"span",11),D(1),h()),i&2){let A=p(3);Q(),nA(A.i18n.evalTabLabel)}}function tMA(i,e){i&1&&(I(0,"mat-tab"),kt(1,eMA,2,1,"ng-template",6),dn(2,null,0),h())}function iMA(i,e){if(i&1){let A=aA();I(0,"div",2)(1,"mat-tab-group",5),Ni("selectedIndexChange",function(n){L(A);let o=p();return wi(o.selectedIndex,n)||(o.selectedIndex=n),G(n)}),U("selectedTabChange",function(n){L(A);let o=p();return G(o.onTabChange(n))}),I(2,"mat-tab"),kt(3,P7A,2,1,"ng-template",6),T(4,j7A,1,1,"app-trace-tab",7)(5,V7A,1,18,"app-event-tab",8)(6,q7A,2,0,"div",9),h(),I(7,"mat-tab"),kt(8,W7A,2,1,"ng-template",6),lA(9,"app-state-tab",10),h(),T(10,X7A,3,1,"mat-tab"),mt(11,"async"),T(12,AMA,3,4,"mat-tab"),mt(13,"async"),T(14,tMA,4,0,"mat-tab"),mt(15,"async"),h()()}if(i&2){let A=p(),t=Ki(2);H("hidden",t||!A.showSidePanel()),Q(),Ri("selectedIndex",A.selectedIndex),Q(3),O(A.selectedSpan()?4:A.selectedEvent()?5:6),Q(5),H("sessionState",A.currentSessionState()),Q(),O(Ft(11,7,A.isArtifactsTabEnabledObs)?10:-1),Q(2),O(Ft(13,9,A.isTestsEnabledObs)?12:-1),Q(2),O(Ft(15,11,A.isEvalEnabledObs)?14:-1)}}var xE=class i{Object=Object;appName=ve("");userId=ve("");sessionId=ve("");traceData=ve([]);eventData=ve(new Map);currentSessionState=ve();artifacts=ve([]);selectedEvent=ve();selectedEventIndex=ve();renderedEventGraph=ve();rawSvgString=ve(null);selectedEventGraphPath=ve("");llmRequest=ve();llmResponse=ve();showSidePanel=ve(!1);isApplicationSelectorEnabledObs=ve(oe(!1));isBuilderMode=ve(!1);disableBuilderIcon=ve(!1);hasSubWorkflows=ve(!1);graphsAvailable=ve(!0);invocationDisplayMap=ve(new Map);forceGraphTab=ve(!1);isViewOnlySession=ve(!1);isViewOnlyAppNameMismatch=ve(!1);closePanel=Si();tabChange=Si();sessionSelected=Si();sessionReloaded=Si();evalCaseSelected=Si();editEvalCaseRequested=Si();testSelected=Si();evalSetIdSelected=Si();returnToSession=Si();evalNotInstalled=Si();page=Si();switchToEvent=Si();closeSelectedEvent=Si();openImageDialog=Si();openAddItemDialog=Si();enterBuilderMode=Si();showAgentStructureGraph=Si();switchToTraceView=Si();drillDownNodePath=Si();selectEventById=Si();jumpToInvocation=Si();sessionTabComponent=void 0;evalTabComponent=Yo(Sc);evalTabContainer=Yo("evalTabContainer",{read:Jo});tabGroup=Yo(fE);logoComponent=w(wB,{optional:!0});i18n=w(_E);featureFlagService=w(Nr);evalTabComponentClass=w(My,{optional:!0});environmentInjector=w(Hr);uiStateService=w(ag);traceService=w(ng);selectedSpan=sr(this.traceService.selectedTraceRow$);selectedIndex=0;pendingEvalCaseSelection=mA(void 0);pendingEvalResultSelection=mA(void 0);evalTabRef=mA(null);constructor(){Fn(()=>{let e=this.selectedEvent(),A=this.selectedSpan(),t=this.tabGroup();(e||A)&&t&&t.selectedIndex!==0&&(this.selectedIndex=0)}),Fn(()=>{this.evalTabContainer()?this.initEvalTab():this.evalTabRef.set(null)}),Fn(()=>{let e=this.evalTabRef();e&&(e.setInput("appName",this.appName()),e.setInput("userId",this.userId()),e.setInput("sessionId",this.sessionId()))}),Fn(()=>{let e=this.evalTabRef(),A=this.pendingEvalCaseSelection();e&&A&&(e.instance.selectEvalSet(A.evalSetId),e.instance.selectedEvalTab.set("cases"),e.instance.selectedEvalCase.set(A.evalCase),this.pendingEvalCaseSelection.set(void 0))}),Fn(()=>{let e=this.evalTabRef(),A=this.pendingEvalResultSelection();e&&A&&(e.instance.selectEvalSet(A.evalSetId),e.instance.selectedHistoryRun.set(A.timestamp),A.evalCase?(e.instance.selectedEvalTab.set("cases"),e.instance.selectedEvalCase.set(A.evalCase)):e.instance.selectedEvalTab.set("history"),this.pendingEvalResultSelection.set(void 0))})}ngOnInit(){}onTabChange(e){this.tabChange.emit(e),this.selectedIndex=e.index}switchToEvalTab(){this.isEvalEnabledObs.pipe(oo()).subscribe(e=>{e&&JC([this.isArtifactsTabEnabledObs.pipe(oo()),this.isTestsEnabledObs.pipe(oo())]).subscribe(([A,t])=>{let n=2;A&&n++,t&&n++,this.selectedIndex=n})})}selectEvalCase(e,A){let t=this.evalTabComponent();t?(t.selectEvalSet(e),t.selectedEvalTab.set("cases"),t.selectedEvalCase.set(A)):this.pendingEvalCaseSelection.set({evalSetId:e,evalCase:A})}selectEvalResult(e,A,t){let n=this.evalTabComponent();n?(n.selectEvalSet(e),n.selectedHistoryRun.set(A),t?(n.selectedEvalTab.set("cases"),n.selectedEvalCase.set(t)):n.selectedEvalTab.set("history")):this.pendingEvalResultSelection.set({evalSetId:e,timestamp:A,evalCase:t})}isAlwaysOnSidePanelEnabledObs=this.featureFlagService.isAlwaysOnSidePanelEnabled();isTraceEnabledObs=this.featureFlagService.isTraceEnabled();isArtifactsTabEnabledObs=this.featureFlagService.isArtifactsTabEnabled();isEvalEnabledObs=this.featureFlagService.isEvalEnabled();isTestsEnabledObs=this.featureFlagService.isTestsEnabled();isTokenStreamingEnabledObs=this.featureFlagService.isTokenStreamingEnabled();isMessageFileUploadEnabledObs=this.featureFlagService.isMessageFileUploadEnabled();isManualStateUpdateEnabledObs=this.featureFlagService.isManualStateUpdateEnabled();isBidiStreamingEnabledObs=this.featureFlagService.isBidiStreamingEnabled;filteredSelectedEvent=ye(()=>this.selectedEvent());ngAfterViewInit(){}initEvalTab(){this.isEvalEnabledObs.pipe(oo()).subscribe(e=>{if(e){let A=this.evalTabContainer();if(!A)return;A.clear();let t=A.createComponent(this.evalTabComponentClass??Sc,{environmentInjector:this.environmentInjector});if(!t)return;t.instance.sessionSelected.subscribe(n=>{this.sessionSelected.emit(n)}),t.instance.evalCaseSelected.subscribe(n=>{this.evalCaseSelected.emit(n)}),t.instance.editEvalCaseRequested.subscribe(n=>{this.editEvalCaseRequested.emit(n)}),t.instance.evalSetIdSelected.subscribe(n=>{this.evalSetIdSelected.emit(n)}),t.instance.shouldReturnToSession.subscribe(n=>{this.returnToSession.emit(n)}),t.instance.evalNotInstalledMsg.subscribe(n=>{this.evalNotInstalled.emit(n)}),this.evalTabRef.set(t)}})}static \u0275fac=function(A){return new(A||i)};static \u0275cmp=vA({type:i,selectors:[["app-side-panel"]],viewQuery:function(A,t){A&1&&ls(t.evalTabComponent,Sc,5)(t.evalTabContainer,Y7A,5,Jo)(t.tabGroup,fE,5),A&2&&br(3)},inputs:{appName:[1,"appName"],userId:[1,"userId"],sessionId:[1,"sessionId"],traceData:[1,"traceData"],eventData:[1,"eventData"],currentSessionState:[1,"currentSessionState"],artifacts:[1,"artifacts"],selectedEvent:[1,"selectedEvent"],selectedEventIndex:[1,"selectedEventIndex"],renderedEventGraph:[1,"renderedEventGraph"],rawSvgString:[1,"rawSvgString"],selectedEventGraphPath:[1,"selectedEventGraphPath"],llmRequest:[1,"llmRequest"],llmResponse:[1,"llmResponse"],showSidePanel:[1,"showSidePanel"],isApplicationSelectorEnabledObs:[1,"isApplicationSelectorEnabledObs"],isBuilderMode:[1,"isBuilderMode"],disableBuilderIcon:[1,"disableBuilderIcon"],hasSubWorkflows:[1,"hasSubWorkflows"],graphsAvailable:[1,"graphsAvailable"],invocationDisplayMap:[1,"invocationDisplayMap"],forceGraphTab:[1,"forceGraphTab"],isViewOnlySession:[1,"isViewOnlySession"],isViewOnlyAppNameMismatch:[1,"isViewOnlyAppNameMismatch"]},outputs:{closePanel:"closePanel",tabChange:"tabChange",sessionSelected:"sessionSelected",sessionReloaded:"sessionReloaded",evalCaseSelected:"evalCaseSelected",editEvalCaseRequested:"editEvalCaseRequested",testSelected:"testSelected",evalSetIdSelected:"evalSetIdSelected",returnToSession:"returnToSession",evalNotInstalled:"evalNotInstalled",page:"page",switchToEvent:"switchToEvent",closeSelectedEvent:"closeSelectedEvent",openImageDialog:"openImageDialog",openAddItemDialog:"openAddItemDialog",enterBuilderMode:"enterBuilderMode",showAgentStructureGraph:"showAgentStructureGraph",switchToTraceView:"switchToTraceView",drillDownNodePath:"drillDownNodePath",selectEventById:"selectEventById",jumpToInvocation:"jumpToInvocation"},decls:7,vars:8,consts:[["evalTabContainer",""],[1,"loading-spinner-container"],[1,"tabs-container",3,"hidden"],[1,"resize-handler"],["mode","indeterminate","diameter","50"],["animationDuration","0ms",3,"selectedIndexChange","selectedTabChange","selectedIndex"],["mat-tab-label",""],[3,"traceData"],[3,"eventDataSize","eventDataMap","selectedEventIndex","selectedEvent","traceData","filteredSelectedEvent","renderedEventGraph","rawSvgString","appName","selectedEventGraphPath","llmRequest","llmResponse","hasSubWorkflows","graphsAvailable","invocationDisplayMap","forceGraphTab","isViewOnlySession","isViewOnlyAppNameMismatch"],[1,"empty-state"],[3,"sessionState"],[1,"tab-label"],[3,"switchToEvent","traceData"],[3,"page","closeSelectedEvent","openImageDialog","switchToTraceView","showAgentStructureGraph","drillDownNodePath","selectEventById","jumpToInvocation","eventDataSize","eventDataMap","selectedEventIndex","selectedEvent","traceData","filteredSelectedEvent","renderedEventGraph","rawSvgString","appName","selectedEventGraphPath","llmRequest","llmResponse","hasSubWorkflows","graphsAvailable","invocationDisplayMap","forceGraphTab","isViewOnlySession","isViewOnlyAppNameMismatch"],[3,"artifacts"],[3,"testSelected","appName","sessionId","userId","isViewOnlySession"]],template:function(A,t){if(A&1&&(T(0,H7A,0,0),mt(1,"async"),ro(2),mt(3,"async"),T(4,z7A,2,0,"div",1),T(5,iMA,16,13,"div",2),lA(6,"div",3)),A&2){O(Ft(1,3,t.isAlwaysOnSidePanelEnabledObs)===!1?0:-1),Q(2);let n=so(Ft(3,5,t.uiStateService.isSessionLoading()));Q(2),O(n?4:-1),Q(),O(t.appName()!=""?5:-1)}},dependencies:[fE,bp,vp,xy,_y,d6,Ry,Es,ky,gs],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;height:100%;position:relative}.drawer-header-wrapper[_ngcontent-%COMP%]{display:flex;height:48px;align-items:center;padding-left:20px}.drawer-header[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:space-between;align-items:center}.tabs-container[_ngcontent-%COMP%]{width:100%;flex:1;overflow:hidden;display:flex;flex-direction:column}.tab-label[_ngcontent-%COMP%]{font-size:14px}.resize-handler[_ngcontent-%COMP%]{width:6px;border-radius:4px;position:absolute;display:block;top:20px;bottom:20px;right:0;z-index:100;cursor:ew-resize}.resize-handler[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-outline-variant)}.empty-state[_ngcontent-%COMP%]{padding:16px;text-align:center;color:var(--mat-sys-on-surface-variant);font-style:italic}mat-tab-group[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;min-height:0}mat-tab-group[_ngcontent-%COMP%] .mdc-tab{padding:0 12px;min-width:48px} .mat-mdc-tab-body-wrapper{flex:1;min-height:0} .mat-mdc-tab-body-wrapper .mat-mdc-tab-body-content{overflow-x:hidden}.drawer-logo[_ngcontent-%COMP%]{margin-left:9px;display:flex;align-items:center}.drawer-logo[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{margin-right:6px}.drawer-logo[_ngcontent-%COMP%]{font-size:14px;font-style:normal;font-weight:500;line-height:20px;letter-spacing:.1px}.drawer-header-left[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.panel-toggle-icon[_ngcontent-%COMP%]{font-size:20px;width:24px;height:24px;color:var(--side-panel-mat-icon-color, #c4c7c5);cursor:pointer;display:flex;align-items:center;justify-content:center}.powered-by-adk[_ngcontent-%COMP%]{font-size:10px;color:var(--side-panel-powered-by-adk-color);text-align:right;margin-top:-5px}.adk-info-icon[_ngcontent-%COMP%]{font-size:14px;color:var(--side-panel-mat-icon-color, #bdc1c6);cursor:pointer;margin-left:4px;vertical-align:middle}.mode-toggle-container[_ngcontent-%COMP%]{display:flex;align-items:center}.build-mode-button[_ngcontent-%COMP%]{margin:0 4px}.app-actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.loading-spinner-container[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;height:100%}@media(max-width:768px){.resize-handler[_ngcontent-%COMP%]{display:none!important}.tab-label[_ngcontent-%COMP%]{font-size:12px!important} .mdc-tab{padding:0 8px!important}}"]})};var nMA=["editInput"];function oMA(i,e){if(i&1){let A=aA();I(0,"button",5),U("click",function(){L(A);let n=p();return G(n.startEdit())}),I(1,"mat-icon"),D(2,"edit"),h()()}}function aMA(i,e){if(i&1){let A=aA();I(0,"button",6),U("click",function(){L(A);let n=p();return G(n.saveEdit())}),I(1,"mat-icon"),D(2,"check"),h()(),I(3,"button",7),U("click",function(){L(A);let n=p();return G(n.cancelEdit())}),I(4,"mat-icon"),D(5,"close"),h()()}}var Ny=class i{value="";displayValue="";tooltip="";placeholder="";textClass="";save=new FA;isEditing=!1;draftValue="";editInput;startEdit(){this.draftValue=this.value,this.isEditing=!0,setTimeout(()=>{this.editInput.nativeElement.focus()})}cancelEdit(){this.isEditing=!1,this.draftValue=""}saveEdit(){this.save.emit(this.draftValue),this.isEditing=!1}handleKeydown(e){e.key==="Enter"?this.saveEdit():e.key==="Escape"&&this.cancelEdit()}get effectiveDisplayValue(){return this.displayValue||this.value}static \u0275fac=function(A){return new(A||i)};static \u0275cmp=vA({type:i,selectors:[["app-inline-edit"]],viewQuery:function(A,t){if(A&1&&Wt(nMA,5),A&2){let n;se(n=le())&&(t.editInput=n.first)}},inputs:{value:"value",displayValue:"displayValue",tooltip:"tooltip",placeholder:"placeholder",textClass:"textClass"},outputs:{save:"save"},decls:6,vars:10,consts:[["editInput",""],[1,"inline-edit-container"],[1,"inline-edit-text-wrapper"],[1,"inline-edit-input",3,"ngModelChange","keydown","readonly","ngClass","matTooltip","ngModel"],["mat-icon-button","","aria-label","Edit",1,"inline-edit-action-button"],["mat-icon-button","","aria-label","Edit",1,"inline-edit-action-button",3,"click"],["mat-icon-button","","aria-label","Save",1,"inline-edit-action-button",3,"click"],["mat-icon-button","","aria-label","Cancel",1,"inline-edit-action-button",3,"click"]],template:function(A,t){A&1&&(I(0,"div",1)(1,"div",2)(2,"input",3,0),U("ngModelChange",function(o){return t.draftValue=o})("keydown",function(o){return t.handleKeydown(o)}),h()(),T(4,oMA,3,0,"button",4)(5,aMA,6,0),h()),A&2&&(Q(2),_A("readonly",!t.isEditing),H("readonly",!t.isEditing)("ngClass",t.textClass)("matTooltip",t.isEditing?"":t.tooltip)("ngModel",t.isEditing?t.draftValue:t.effectiveDisplayValue),ie("placeholder",t.isEditing?t.placeholder:"")("aria-label",t.placeholder)("size",((t.isEditing?t.draftValue:t.effectiveDisplayValue)==null?null:(t.isEditing?t.draftValue:t.effectiveDisplayValue).length)||1),Q(2),O(t.isEditing?5:4))},dependencies:[li,Vl,fn,Gn,Kn,Ho,qi,yi,Un,zt,Ha,rn],styles:["[_nghost-%COMP%]{display:block;max-width:100%;min-width:0;width:100%}.inline-edit-container[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;width:100%;max-width:100%;min-width:0;box-sizing:border-box}.inline-edit-text-wrapper[_ngcontent-%COMP%]{flex:0 1 auto;min-width:0;display:flex;align-items:center}.inline-edit-input[_ngcontent-%COMP%]{min-width:48px;max-width:100%;padding:2px 6px;margin:-3px -7px;border:1px solid var(--chat-toolbar-session-text-color, #ccc);border-radius:4px;color:var(--chat-toolbar-session-id-color, inherit);font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;background:transparent;field-sizing:content;transition:all .2s ease}.inline-edit-input[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--primary-color, #1a73e8)}.inline-edit-input.readonly[_ngcontent-%COMP%]{min-width:0;border-color:transparent;cursor:inherit}.inline-edit-input.readonly[_ngcontent-%COMP%]:focus{outline:none;border-color:transparent}.inline-edit-action-button[_ngcontent-%COMP%]{flex-shrink:0;width:28px!important;height:28px!important;padding:0!important;display:flex;align-items:center;justify-content:center}.inline-edit-action-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;line-height:16px}"]})};var rMA={openPanelTooltip:"Open panel",retrieveLatestSessionTooltip:"Retrieve latest session and show",evalCaseIdLabel:"Eval Case ID",cancelButton:"Cancel",saveButton:"Save",editEvalCaseTooltip:"Edit current eval case",deleteEvalCaseTooltip:"Delete current eval case",sessionIdLabel:"Session",copySessionIdTooltip:"Copy session ID",sessionIdCopiedMessage:"Session ID copied",copySessionIdFailedMessage:"Failed to copy session ID",userIdLabel:"User ID",editUserIdTooltip:"Edit user ID",userIdInputPlaceholder:"Enter user ID",saveUserIdTooltip:"Save user ID",cancelUserIdEditTooltip:"Cancel editing user ID",invalidUserIdMessage:"User ID cannot be empty",loadingSessionLabel:"Loading session...",tokenStreamingLabel:"Token Streaming",moreOptionsTooltip:"More options",createNewSessionTooltip:"Create a new Session",newSessionButton:"New Session",deleteSessionTooltip:"Delete session",exportSessionTooltip:"Export session",importSessionTooltip:"Import session",viewSessionTooltip:"View session",loadingAgentsLabel:"Loading agents, please wait...",welcomeMessage:"Welcome to ADK!",selectAgentMessage:"Select an agent to begin.",failedToLoadAgentsMessage:"Failed to load agents. To get started, run",errorMessageLabel:"Error message:",noAgentsFoundWarning:"Warning: No agents found in current folder.",cannotEditSessionMessage:"Chat is disabled to prevent changes to the end user's session.",viewSessionReadOnlyMessage:'This is a read-only view of a session file. Use "Import Session" if you want to continue this session.',readOnlyBadgeLabel:"Read-only"},h$=new MA("Chat Messages",{factory:()=>rMA});var XA={};cAA(XA,{BRAND:()=>RMA,DIRTY:()=>II,EMPTY_PATH:()=>cMA,INVALID:()=>hi,NEVER:()=>E9A,OK:()=>Ss,ParseStatus:()=>rs,Schema:()=>hn,ZodAny:()=>Gy,ZodArray:()=>Gp,ZodBigInt:()=>GR,ZodBoolean:()=>KR,ZodBranded:()=>Kp,ZodCatch:()=>VR,ZodDate:()=>UR,ZodDefault:()=>jR,ZodDiscriminatedUnion:()=>Ky,ZodEffects:()=>KE,ZodEnum:()=>Jy,ZodError:()=>x0,ZodFirstPartyTypeKind:()=>_i,ZodFunction:()=>Ty,ZodIntersection:()=>YR,ZodIssueCode:()=>Ne,ZodLazy:()=>HR,ZodLiteral:()=>zR,ZodMap:()=>v$,ZodNaN:()=>S$,ZodNativeEnum:()=>PR,ZodNever:()=>BI,ZodNull:()=>OR,ZodNullable:()=>UE,ZodNumber:()=>LR,ZodObject:()=>LE,ZodOptional:()=>f1,ZodParsedType:()=>ht,ZodPipeline:()=>Up,ZodPromise:()=>Yy,ZodReadonly:()=>qR,ZodRecord:()=>Uy,ZodSchema:()=>hn,ZodSet:()=>b$,ZodString:()=>Oy,ZodSymbol:()=>y$,ZodTransformer:()=>KE,ZodTuple:()=>GE,ZodType:()=>hn,ZodUndefined:()=>TR,ZodUnion:()=>JR,ZodUnknown:()=>Lp,ZodVoid:()=>D$,addIssueToContext:()=>ot,any:()=>JMA,array:()=>PMA,bigint:()=>GMA,boolean:()=>R$,coerce:()=>h9A,custom:()=>k$,date:()=>KMA,datetimeRegex:()=>w$,defaultErrorMap:()=>TC,discriminatedUnion:()=>WMA,effect:()=>s9A,enum:()=>o9A,function:()=>t9A,getErrorMap:()=>RE,getParsedType:()=>_0,instanceof:()=>FMA,intersection:()=>ZMA,isAborted:()=>Fy,isAsync:()=>NE,isDirty:()=>Ly,isValid:()=>p1,late:()=>NMA,lazy:()=>i9A,literal:()=>n9A,makeIssue:()=>Fp,map:()=>A9A,nan:()=>LMA,nativeEnum:()=>a9A,never:()=>HMA,null:()=>OMA,nullable:()=>g9A,number:()=>x$,object:()=>jMA,objectUtil:()=>E$,oboolean:()=>B9A,onumber:()=>I9A,optional:()=>l9A,ostring:()=>d9A,pipeline:()=>C9A,preprocess:()=>c9A,promise:()=>r9A,quotelessJson:()=>sMA,record:()=>$MA,set:()=>e9A,setErrorMap:()=>gMA,strictObject:()=>VMA,string:()=>_$,symbol:()=>UMA,transformer:()=>s9A,tuple:()=>XMA,undefined:()=>TMA,union:()=>qMA,unknown:()=>YMA,util:()=>Mn,void:()=>zMA});var Mn;(function(i){i.assertEqual=n=>{};function e(n){}i.assertIs=e;function A(n){throw new Error}i.assertNever=A,i.arrayToEnum=n=>{let o={};for(let a of n)o[a]=a;return o},i.getValidEnumValues=n=>{let o=i.objectKeys(n).filter(r=>typeof n[n[r]]!="number"),a={};for(let r of o)a[r]=n[r];return i.objectValues(a)},i.objectValues=n=>i.objectKeys(n).map(function(o){return n[o]}),i.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let o=[];for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&o.push(a);return o},i.find=(n,o)=>{for(let a of n)if(o(a))return a},i.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function t(n,o=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}i.joinValues=t,i.jsonStringifyReplacer=(n,o)=>typeof o=="bigint"?o.toString():o})(Mn||(Mn={}));var E$=(function(i){return i.mergeShapes=(e,A)=>P(P({},e),A),i})(E$||{}),ht=Mn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_0=i=>{switch(typeof i){case"undefined":return ht.undefined;case"string":return ht.string;case"number":return Number.isNaN(i)?ht.nan:ht.number;case"boolean":return ht.boolean;case"function":return ht.function;case"bigint":return ht.bigint;case"symbol":return ht.symbol;case"object":return Array.isArray(i)?ht.array:i===null?ht.null:i.then&&typeof i.then=="function"&&i.catch&&typeof i.catch=="function"?ht.promise:typeof Map<"u"&&i instanceof Map?ht.map:typeof Set<"u"&&i instanceof Set?ht.set:typeof Date<"u"&&i instanceof Date?ht.date:ht.object;default:return ht.unknown}};var Ne=Mn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),sMA=i=>JSON.stringify(i,null,2).replace(/"([^"]+)":/g,"$1:"),x0=(()=>{class i extends Error{get errors(){return this.issues}constructor(A){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=A}format(A){let t=A||function(a){return a.message},n={_errors:[]},o=a=>{for(let r of a.issues)if(r.code==="invalid_union")r.unionErrors.map(o);else if(r.code==="invalid_return_type")o(r.returnTypeError);else if(r.code==="invalid_arguments")o(r.argumentsError);else if(r.path.length===0)n._errors.push(t(r));else{let s=n,l=0;for(;l<r.path.length;){let g=r.path[l];l===r.path.length-1?(s[g]=s[g]||{_errors:[]},s[g]._errors.push(t(r))):s[g]=s[g]||{_errors:[]},s=s[g],l++}}};return o(this),n}static assert(A){if(!(A instanceof i))throw new Error(`Not a ZodError: ${A}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Mn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(A=t=>t.message){let t={},n=[];for(let o of this.issues)if(o.path.length>0){let a=o.path[0];t[a]=t[a]||[],t[a].push(A(o))}else n.push(A(o));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}return i.create=e=>new i(e),i})();var lMA=(i,e)=>{let A;switch(i.code){case Ne.invalid_type:i.received===ht.undefined?A="Required":A=`Expected ${i.expected}, received ${i.received}`;break;case Ne.invalid_literal:A=`Invalid literal value, expected ${JSON.stringify(i.expected,Mn.jsonStringifyReplacer)}`;break;case Ne.unrecognized_keys:A=`Unrecognized key(s) in object: ${Mn.joinValues(i.keys,", ")}`;break;case Ne.invalid_union:A="Invalid input";break;case Ne.invalid_union_discriminator:A=`Invalid discriminator value. Expected ${Mn.joinValues(i.options)}`;break;case Ne.invalid_enum_value:A=`Invalid enum value. Expected ${Mn.joinValues(i.options)}, received '${i.received}'`;break;case Ne.invalid_arguments:A="Invalid function arguments";break;case Ne.invalid_return_type:A="Invalid function return type";break;case Ne.invalid_date:A="Invalid date";break;case Ne.invalid_string:typeof i.validation=="object"?"includes"in i.validation?(A=`Invalid input: must include "${i.validation.includes}"`,typeof i.validation.position=="number"&&(A=`${A} at one or more positions greater than or equal to ${i.validation.position}`)):"startsWith"in i.validation?A=`Invalid input: must start with "${i.validation.startsWith}"`:"endsWith"in i.validation?A=`Invalid input: must end with "${i.validation.endsWith}"`:Mn.assertNever(i.validation):i.validation!=="regex"?A=`Invalid ${i.validation}`:A="Invalid";break;case Ne.too_small:i.type==="array"?A=`Array must contain ${i.exact?"exactly":i.inclusive?"at least":"more than"} ${i.minimum} element(s)`:i.type==="string"?A=`String must contain ${i.exact?"exactly":i.inclusive?"at least":"over"} ${i.minimum} character(s)`:i.type==="number"?A=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="bigint"?A=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="date"?A=`Date must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(i.minimum))}`:A="Invalid input";break;case Ne.too_big:i.type==="array"?A=`Array must contain ${i.exact?"exactly":i.inclusive?"at most":"less than"} ${i.maximum} element(s)`:i.type==="string"?A=`String must contain ${i.exact?"exactly":i.inclusive?"at most":"under"} ${i.maximum} character(s)`:i.type==="number"?A=`Number must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="bigint"?A=`BigInt must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="date"?A=`Date must be ${i.exact?"exactly":i.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(i.maximum))}`:A="Invalid input";break;case Ne.custom:A="Invalid input";break;case Ne.invalid_intersection_types:A="Intersection results could not be merged";break;case Ne.not_multiple_of:A=`Number must be a multiple of ${i.multipleOf}`;break;case Ne.not_finite:A="Number must be finite";break;default:A=e.defaultError,Mn.assertNever(i)}return{message:A}},TC=lMA;var Q$=TC;function gMA(i){Q$=i}function RE(){return Q$}var Fp=i=>{let{data:e,path:A,errorMaps:t,issueData:n}=i,o=[...A,...n.path||[]],a=$A(P({},n),{path:o});if(n.message!==void 0)return $A(P({},n),{path:o,message:n.message});let r="",s=t.filter(l=>!!l).slice().reverse();for(let l of s)r=l(a,{data:e,defaultError:r}).message;return $A(P({},n),{path:o,message:r})},cMA=[];function ot(i,e){let A=RE(),t=Fp({issueData:e,data:i.data,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,A,A===TC?void 0:TC].filter(n=>!!n)});i.common.issues.push(t)}var rs=class i{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,A){let t=[];for(let n of A){if(n.status==="aborted")return hi;n.status==="dirty"&&e.dirty(),t.push(n.value)}return{status:e.value,value:t}}static mergeObjectAsync(e,A){return re(this,null,function*(){let t=[];for(let n of A){let o=yield n.key,a=yield n.value;t.push({key:o,value:a})}return i.mergeObjectSync(e,t)})}static mergeObjectSync(e,A){let t={};for(let n of A){let{key:o,value:a}=n;if(o.status==="aborted"||a.status==="aborted")return hi;o.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||n.alwaysSet)&&(t[o.value]=a.value)}return{status:e.value,value:t}}},hi=Object.freeze({status:"aborted"}),II=i=>({status:"dirty",value:i}),Ss=i=>({status:"valid",value:i}),Fy=i=>i.status==="aborted",Ly=i=>i.status==="dirty",p1=i=>i.status==="valid",NE=i=>typeof Promise<"u"&&i instanceof Promise;var Kt=(function(i){return i.errToObj=e=>typeof e=="string"?{message:e}:e||{},i.toString=e=>typeof e=="string"?e:e?.message,i})(Kt||{});var Mg=class{constructor(e,A,t,n){this._cachedPath=[],this.parent=e,this.data=A,this._path=t,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},u$=(i,e)=>{if(p1(e))return{success:!0,data:e.value};if(!i.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let A=new x0(i.common.issues);return this._error=A,this._error}}};function tn(i){if(!i)return{};let{errorMap:e,invalid_type_error:A,required_error:t,description:n}=i;if(e&&(A||t))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(a,r)=>{let{message:s}=i;return a.code==="invalid_enum_value"?{message:s??r.defaultError}:typeof r.data>"u"?{message:s??t??r.defaultError}:a.code!=="invalid_type"?{message:r.defaultError}:{message:s??A??r.defaultError}},description:n}}var hn=class{get description(){return this._def.description}_getType(e){return _0(e.data)}_getOrReturnCtx(e,A){return A||{common:e.parent.common,data:e.data,parsedType:_0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rs,ctx:{common:e.parent.common,data:e.data,parsedType:_0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let A=this._parse(e);if(NE(A))throw new Error("Synchronous parse encountered promise.");return A}_parseAsync(e){let A=this._parse(e);return Promise.resolve(A)}parse(e,A){let t=this.safeParse(e,A);if(t.success)return t.data;throw t.error}safeParse(e,A){let t={common:{issues:[],async:A?.async??!1,contextualErrorMap:A?.errorMap},path:A?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_0(e)},n=this._parseSync({data:e,path:t.path,parent:t});return u$(t,n)}"~validate"(e){let A={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_0(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:A});return p1(t)?{value:t.value}:{issues:A.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),A.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:A}).then(t=>p1(t)?{value:t.value}:{issues:A.common.issues})}parseAsync(e,A){return re(this,null,function*(){let t=yield this.safeParseAsync(e,A);if(t.success)return t.data;throw t.error})}safeParseAsync(e,A){return re(this,null,function*(){let t={common:{issues:[],contextualErrorMap:A?.errorMap,async:!0},path:A?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_0(e)},n=this._parse({data:e,path:t.path,parent:t}),o=yield NE(n)?n:Promise.resolve(n);return u$(t,o)})}refine(e,A){let t=n=>typeof A=="string"||typeof A>"u"?{message:A}:typeof A=="function"?A(n):A;return this._refinement((n,o)=>{let a=e(n),r=()=>o.addIssue(P({code:Ne.custom},t(n)));return typeof Promise<"u"&&a instanceof Promise?a.then(s=>s?!0:(r(),!1)):a?!0:(r(),!1)})}refinement(e,A){return this._refinement((t,n)=>e(t)?!0:(n.addIssue(typeof A=="function"?A(t,n):A),!1))}_refinement(e){return new KE({schema:this,typeName:_i.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:A=>this["~validate"](A)}}optional(){return f1.create(this,this._def)}nullable(){return UE.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Gp.create(this)}promise(){return Yy.create(this,this._def)}or(e){return JR.create([this,e],this._def)}and(e){return YR.create(this,e,this._def)}transform(e){return new KE($A(P({},tn(this._def)),{schema:this,typeName:_i.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){let A=typeof e=="function"?e:()=>e;return new jR($A(P({},tn(this._def)),{innerType:this,defaultValue:A,typeName:_i.ZodDefault}))}brand(){return new Kp(P({typeName:_i.ZodBranded,type:this},tn(this._def)))}catch(e){let A=typeof e=="function"?e:()=>e;return new VR($A(P({},tn(this._def)),{innerType:this,catchValue:A,typeName:_i.ZodCatch}))}describe(e){let A=this.constructor;return new A($A(P({},this._def),{description:e}))}pipe(e){return Up.create(this,e)}readonly(){return qR.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},CMA=/^c[^\s-]{8,}$/i,dMA=/^[0-9a-z]+$/,IMA=/^[0-9A-HJKMNP-TV-Z]{26}$/i,BMA=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,hMA=/^[a-z0-9_-]{21}$/i,EMA=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,QMA=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,uMA=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pMA="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",NR,fMA=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,mMA=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,wMA=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,yMA=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,DMA=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vMA=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,f$="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",bMA=new RegExp(`^${f$}$`);function m$(i){let e="[0-5]\\d";i.precision?e=`${e}\\.\\d{${i.precision}}`:i.precision==null&&(e=`${e}(\\.\\d+)?`);let A=i.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${A}`}function MMA(i){return new RegExp(`^${m$(i)}$`)}function w$(i){let e=`${f$}T${m$(i)}`,A=[];return A.push(i.local?"Z?":"Z"),i.offset&&A.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${A.join("|")})`,new RegExp(`^${e}$`)}function SMA(i,e){return!!((e==="v4"||!e)&&fMA.test(i)||(e==="v6"||!e)&&wMA.test(i))}function kMA(i,e){if(!EMA.test(i))return!1;try{let[A]=i.split(".");if(!A)return!1;let t=A.replace(/-/g,"+").replace(/_/g,"/").padEnd(A.length+(4-A.length%4)%4,"="),n=JSON.parse(atob(t));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch(A){return!1}}function _MA(i,e){return!!((e==="v4"||!e)&&mMA.test(i)||(e==="v6"||!e)&&yMA.test(i))}var Oy=(()=>{class i extends hn{_parse(A){if(this._def.coerce&&(A.data=String(A.data)),this._getType(A)!==ht.string){let a=this._getOrReturnCtx(A);return ot(a,{code:Ne.invalid_type,expected:ht.string,received:a.parsedType}),hi}let n=new rs,o;for(let a of this._def.checks)if(a.kind==="min")A.data.length<a.value&&(o=this._getOrReturnCtx(A,o),ot(o,{code:Ne.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")A.data.length>a.value&&(o=this._getOrReturnCtx(A,o),ot(o,{code:Ne.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let r=A.data.length>a.value,s=A.data.length<a.value;(r||s)&&(o=this._getOrReturnCtx(A,o),r?ot(o,{code:Ne.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&ot(o,{code:Ne.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")uMA.test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"email",code:Ne.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")NR||(NR=new RegExp(pMA,"u")),NR.test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"emoji",code:Ne.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")BMA.test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"uuid",code:Ne.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")hMA.test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"nanoid",code:Ne.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")CMA.test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"cuid",code:Ne.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")dMA.test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"cuid2",code:Ne.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")IMA.test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"ulid",code:Ne.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(A.data)}catch(r){o=this._getOrReturnCtx(A,o),ot(o,{validation:"url",code:Ne.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"regex",code:Ne.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?A.data=A.data.trim():a.kind==="includes"?A.data.includes(a.value,a.position)||(o=this._getOrReturnCtx(A,o),ot(o,{code:Ne.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?A.data=A.data.toLowerCase():a.kind==="toUpperCase"?A.data=A.data.toUpperCase():a.kind==="startsWith"?A.data.startsWith(a.value)||(o=this._getOrReturnCtx(A,o),ot(o,{code:Ne.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?A.data.endsWith(a.value)||(o=this._getOrReturnCtx(A,o),ot(o,{code:Ne.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?w$(a).test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{code:Ne.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?bMA.test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{code:Ne.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?MMA(a).test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{code:Ne.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?QMA.test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"duration",code:Ne.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?SMA(A.data,a.version)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"ip",code:Ne.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?kMA(A.data,a.alg)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"jwt",code:Ne.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?_MA(A.data,a.version)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"cidr",code:Ne.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?DMA.test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"base64",code:Ne.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?vMA.test(A.data)||(o=this._getOrReturnCtx(A,o),ot(o,{validation:"base64url",code:Ne.invalid_string,message:a.message}),n.dirty()):Mn.assertNever(a);return{status:n.value,value:A.data}}_regex(A,t,n){return this.refinement(o=>A.test(o),P({validation:t,code:Ne.invalid_string},Kt.errToObj(n)))}_addCheck(A){return new i($A(P({},this._def),{checks:[...this._def.checks,A]}))}email(A){return this._addCheck(P({kind:"email"},Kt.errToObj(A)))}url(A){return this._addCheck(P({kind:"url"},Kt.errToObj(A)))}emoji(A){return this._addCheck(P({kind:"emoji"},Kt.errToObj(A)))}uuid(A){return this._addCheck(P({kind:"uuid"},Kt.errToObj(A)))}nanoid(A){return this._addCheck(P({kind:"nanoid"},Kt.errToObj(A)))}cuid(A){return this._addCheck(P({kind:"cuid"},Kt.errToObj(A)))}cuid2(A){return this._addCheck(P({kind:"cuid2"},Kt.errToObj(A)))}ulid(A){return this._addCheck(P({kind:"ulid"},Kt.errToObj(A)))}base64(A){return this._addCheck(P({kind:"base64"},Kt.errToObj(A)))}base64url(A){return this._addCheck(P({kind:"base64url"},Kt.errToObj(A)))}jwt(A){return this._addCheck(P({kind:"jwt"},Kt.errToObj(A)))}ip(A){return this._addCheck(P({kind:"ip"},Kt.errToObj(A)))}cidr(A){return this._addCheck(P({kind:"cidr"},Kt.errToObj(A)))}datetime(A){return typeof A=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:A}):this._addCheck(P({kind:"datetime",precision:typeof A?.precision>"u"?null:A?.precision,offset:A?.offset??!1,local:A?.local??!1},Kt.errToObj(A?.message)))}date(A){return this._addCheck({kind:"date",message:A})}time(A){return typeof A=="string"?this._addCheck({kind:"time",precision:null,message:A}):this._addCheck(P({kind:"time",precision:typeof A?.precision>"u"?null:A?.precision},Kt.errToObj(A?.message)))}duration(A){return this._addCheck(P({kind:"duration"},Kt.errToObj(A)))}regex(A,t){return this._addCheck(P({kind:"regex",regex:A},Kt.errToObj(t)))}includes(A,t){return this._addCheck(P({kind:"includes",value:A,position:t?.position},Kt.errToObj(t?.message)))}startsWith(A,t){return this._addCheck(P({kind:"startsWith",value:A},Kt.errToObj(t)))}endsWith(A,t){return this._addCheck(P({kind:"endsWith",value:A},Kt.errToObj(t)))}min(A,t){return this._addCheck(P({kind:"min",value:A},Kt.errToObj(t)))}max(A,t){return this._addCheck(P({kind:"max",value:A},Kt.errToObj(t)))}length(A,t){return this._addCheck(P({kind:"length",value:A},Kt.errToObj(t)))}nonempty(A){return this.min(1,Kt.errToObj(A))}trim(){return new i($A(P({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new i($A(P({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new i($A(P({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(A=>A.kind==="datetime")}get isDate(){return!!this._def.checks.find(A=>A.kind==="date")}get isTime(){return!!this._def.checks.find(A=>A.kind==="time")}get isDuration(){return!!this._def.checks.find(A=>A.kind==="duration")}get isEmail(){return!!this._def.checks.find(A=>A.kind==="email")}get isURL(){return!!this._def.checks.find(A=>A.kind==="url")}get isEmoji(){return!!this._def.checks.find(A=>A.kind==="emoji")}get isUUID(){return!!this._def.checks.find(A=>A.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(A=>A.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(A=>A.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(A=>A.kind==="cuid2")}get isULID(){return!!this._def.checks.find(A=>A.kind==="ulid")}get isIP(){return!!this._def.checks.find(A=>A.kind==="ip")}get isCIDR(){return!!this._def.checks.find(A=>A.kind==="cidr")}get isBase64(){return!!this._def.checks.find(A=>A.kind==="base64")}get isBase64url(){return!!this._def.checks.find(A=>A.kind==="base64url")}get minLength(){let A=null;for(let t of this._def.checks)t.kind==="min"&&(A===null||t.value>A)&&(A=t.value);return A}get maxLength(){let A=null;for(let t of this._def.checks)t.kind==="max"&&(A===null||t.value<A)&&(A=t.value);return A}}return i.create=e=>new i(P({checks:[],typeName:_i.ZodString,coerce:e?.coerce??!1},tn(e))),i})();function xMA(i,e){let A=(i.toString().split(".")[1]||"").length,t=(e.toString().split(".")[1]||"").length,n=A>t?A:t,o=Number.parseInt(i.toFixed(n).replace(".","")),a=Number.parseInt(e.toFixed(n).replace(".",""));return o%a/10**n}var LR=(()=>{class i extends hn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(A){if(this._def.coerce&&(A.data=Number(A.data)),this._getType(A)!==ht.number){let a=this._getOrReturnCtx(A);return ot(a,{code:Ne.invalid_type,expected:ht.number,received:a.parsedType}),hi}let n,o=new rs;for(let a of this._def.checks)a.kind==="int"?Mn.isInteger(A.data)||(n=this._getOrReturnCtx(A,n),ot(n,{code:Ne.invalid_type,expected:"integer",received:"float",message:a.message}),o.dirty()):a.kind==="min"?(a.inclusive?A.data<a.value:A.data<=a.value)&&(n=this._getOrReturnCtx(A,n),ot(n,{code:Ne.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?A.data>a.value:A.data>=a.value)&&(n=this._getOrReturnCtx(A,n),ot(n,{code:Ne.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?xMA(A.data,a.value)!==0&&(n=this._getOrReturnCtx(A,n),ot(n,{code:Ne.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(A.data)||(n=this._getOrReturnCtx(A,n),ot(n,{code:Ne.not_finite,message:a.message}),o.dirty()):Mn.assertNever(a);return{status:o.value,value:A.data}}gte(A,t){return this.setLimit("min",A,!0,Kt.toString(t))}gt(A,t){return this.setLimit("min",A,!1,Kt.toString(t))}lte(A,t){return this.setLimit("max",A,!0,Kt.toString(t))}lt(A,t){return this.setLimit("max",A,!1,Kt.toString(t))}setLimit(A,t,n,o){return new i($A(P({},this._def),{checks:[...this._def.checks,{kind:A,value:t,inclusive:n,message:Kt.toString(o)}]}))}_addCheck(A){return new i($A(P({},this._def),{checks:[...this._def.checks,A]}))}int(A){return this._addCheck({kind:"int",message:Kt.toString(A)})}positive(A){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Kt.toString(A)})}negative(A){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Kt.toString(A)})}nonpositive(A){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Kt.toString(A)})}nonnegative(A){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Kt.toString(A)})}multipleOf(A,t){return this._addCheck({kind:"multipleOf",value:A,message:Kt.toString(t)})}finite(A){return this._addCheck({kind:"finite",message:Kt.toString(A)})}safe(A){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Kt.toString(A)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Kt.toString(A)})}get minValue(){let A=null;for(let t of this._def.checks)t.kind==="min"&&(A===null||t.value>A)&&(A=t.value);return A}get maxValue(){let A=null;for(let t of this._def.checks)t.kind==="max"&&(A===null||t.value<A)&&(A=t.value);return A}get isInt(){return!!this._def.checks.find(A=>A.kind==="int"||A.kind==="multipleOf"&&Mn.isInteger(A.value))}get isFinite(){let A=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(A===null||n.value<A)&&(A=n.value)}return Number.isFinite(t)&&Number.isFinite(A)}}return i.create=e=>new i(P({checks:[],typeName:_i.ZodNumber,coerce:e?.coerce||!1},tn(e))),i})(),GR=(()=>{class i extends hn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(A){if(this._def.coerce)try{A.data=BigInt(A.data)}catch(a){return this._getInvalidInput(A)}if(this._getType(A)!==ht.bigint)return this._getInvalidInput(A);let n,o=new rs;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?A.data<a.value:A.data<=a.value)&&(n=this._getOrReturnCtx(A,n),ot(n,{code:Ne.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?A.data>a.value:A.data>=a.value)&&(n=this._getOrReturnCtx(A,n),ot(n,{code:Ne.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="multipleOf"?A.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(A,n),ot(n,{code:Ne.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):Mn.assertNever(a);return{status:o.value,value:A.data}}_getInvalidInput(A){let t=this._getOrReturnCtx(A);return ot(t,{code:Ne.invalid_type,expected:ht.bigint,received:t.parsedType}),hi}gte(A,t){return this.setLimit("min",A,!0,Kt.toString(t))}gt(A,t){return this.setLimit("min",A,!1,Kt.toString(t))}lte(A,t){return this.setLimit("max",A,!0,Kt.toString(t))}lt(A,t){return this.setLimit("max",A,!1,Kt.toString(t))}setLimit(A,t,n,o){return new i($A(P({},this._def),{checks:[...this._def.checks,{kind:A,value:t,inclusive:n,message:Kt.toString(o)}]}))}_addCheck(A){return new i($A(P({},this._def),{checks:[...this._def.checks,A]}))}positive(A){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Kt.toString(A)})}negative(A){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Kt.toString(A)})}nonpositive(A){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Kt.toString(A)})}nonnegative(A){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Kt.toString(A)})}multipleOf(A,t){return this._addCheck({kind:"multipleOf",value:A,message:Kt.toString(t)})}get minValue(){let A=null;for(let t of this._def.checks)t.kind==="min"&&(A===null||t.value>A)&&(A=t.value);return A}get maxValue(){let A=null;for(let t of this._def.checks)t.kind==="max"&&(A===null||t.value<A)&&(A=t.value);return A}}return i.create=e=>new i(P({checks:[],typeName:_i.ZodBigInt,coerce:e?.coerce??!1},tn(e))),i})(),KR=(()=>{class i extends hn{_parse(A){if(this._def.coerce&&(A.data=!!A.data),this._getType(A)!==ht.boolean){let n=this._getOrReturnCtx(A);return ot(n,{code:Ne.invalid_type,expected:ht.boolean,received:n.parsedType}),hi}return Ss(A.data)}}return i.create=e=>new i(P({typeName:_i.ZodBoolean,coerce:e?.coerce||!1},tn(e))),i})(),UR=(()=>{class i extends hn{_parse(A){if(this._def.coerce&&(A.data=new Date(A.data)),this._getType(A)!==ht.date){let a=this._getOrReturnCtx(A);return ot(a,{code:Ne.invalid_type,expected:ht.date,received:a.parsedType}),hi}if(Number.isNaN(A.data.getTime())){let a=this._getOrReturnCtx(A);return ot(a,{code:Ne.invalid_date}),hi}let n=new rs,o;for(let a of this._def.checks)a.kind==="min"?A.data.getTime()<a.value&&(o=this._getOrReturnCtx(A,o),ot(o,{code:Ne.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?A.data.getTime()>a.value&&(o=this._getOrReturnCtx(A,o),ot(o,{code:Ne.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Mn.assertNever(a);return{status:n.value,value:new Date(A.data.getTime())}}_addCheck(A){return new i($A(P({},this._def),{checks:[...this._def.checks,A]}))}min(A,t){return this._addCheck({kind:"min",value:A.getTime(),message:Kt.toString(t)})}max(A,t){return this._addCheck({kind:"max",value:A.getTime(),message:Kt.toString(t)})}get minDate(){let A=null;for(let t of this._def.checks)t.kind==="min"&&(A===null||t.value>A)&&(A=t.value);return A!=null?new Date(A):null}get maxDate(){let A=null;for(let t of this._def.checks)t.kind==="max"&&(A===null||t.value<A)&&(A=t.value);return A!=null?new Date(A):null}}return i.create=e=>new i(P({checks:[],coerce:e?.coerce||!1,typeName:_i.ZodDate},tn(e))),i})(),y$=(()=>{class i extends hn{_parse(A){if(this._getType(A)!==ht.symbol){let n=this._getOrReturnCtx(A);return ot(n,{code:Ne.invalid_type,expected:ht.symbol,received:n.parsedType}),hi}return Ss(A.data)}}return i.create=e=>new i(P({typeName:_i.ZodSymbol},tn(e))),i})(),TR=(()=>{class i extends hn{_parse(A){if(this._getType(A)!==ht.undefined){let n=this._getOrReturnCtx(A);return ot(n,{code:Ne.invalid_type,expected:ht.undefined,received:n.parsedType}),hi}return Ss(A.data)}}return i.create=e=>new i(P({typeName:_i.ZodUndefined},tn(e))),i})(),OR=(()=>{class i extends hn{_parse(A){if(this._getType(A)!==ht.null){let n=this._getOrReturnCtx(A);return ot(n,{code:Ne.invalid_type,expected:ht.null,received:n.parsedType}),hi}return Ss(A.data)}}return i.create=e=>new i(P({typeName:_i.ZodNull},tn(e))),i})(),Gy=(()=>{class i extends hn{constructor(){super(...arguments),this._any=!0}_parse(A){return Ss(A.data)}}return i.create=e=>new i(P({typeName:_i.ZodAny},tn(e))),i})(),Lp=(()=>{class i extends hn{constructor(){super(...arguments),this._unknown=!0}_parse(A){return Ss(A.data)}}return i.create=e=>new i(P({typeName:_i.ZodUnknown},tn(e))),i})(),BI=(()=>{class i extends hn{_parse(A){let t=this._getOrReturnCtx(A);return ot(t,{code:Ne.invalid_type,expected:ht.never,received:t.parsedType}),hi}}return i.create=e=>new i(P({typeName:_i.ZodNever},tn(e))),i})(),D$=(()=>{class i extends hn{_parse(A){if(this._getType(A)!==ht.undefined){let n=this._getOrReturnCtx(A);return ot(n,{code:Ne.invalid_type,expected:ht.void,received:n.parsedType}),hi}return Ss(A.data)}}return i.create=e=>new i(P({typeName:_i.ZodVoid},tn(e))),i})(),Gp=(()=>{class i extends hn{_parse(A){let{ctx:t,status:n}=this._processInputParams(A),o=this._def;if(t.parsedType!==ht.array)return ot(t,{code:Ne.invalid_type,expected:ht.array,received:t.parsedType}),hi;if(o.exactLength!==null){let r=t.data.length>o.exactLength.value,s=t.data.length<o.exactLength.value;(r||s)&&(ot(t,{code:r?Ne.too_big:Ne.too_small,minimum:s?o.exactLength.value:void 0,maximum:r?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&t.data.length<o.minLength.value&&(ot(t,{code:Ne.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&t.data.length>o.maxLength.value&&(ot(t,{code:Ne.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((r,s)=>o.type._parseAsync(new Mg(t,r,t.path,s)))).then(r=>rs.mergeArray(n,r));let a=[...t.data].map((r,s)=>o.type._parseSync(new Mg(t,r,t.path,s)));return rs.mergeArray(n,a)}get element(){return this._def.type}min(A,t){return new i($A(P({},this._def),{minLength:{value:A,message:Kt.toString(t)}}))}max(A,t){return new i($A(P({},this._def),{maxLength:{value:A,message:Kt.toString(t)}}))}length(A,t){return new i($A(P({},this._def),{exactLength:{value:A,message:Kt.toString(t)}}))}nonempty(A){return this.min(1,A)}}return i.create=(e,A)=>new i(P({type:e,minLength:null,maxLength:null,exactLength:null,typeName:_i.ZodArray},tn(A))),i})();function FE(i){if(i instanceof LE){let e={};for(let A in i.shape){let t=i.shape[A];e[A]=f1.create(FE(t))}return new LE($A(P({},i._def),{shape:()=>e}))}else return i instanceof Gp?new Gp($A(P({},i._def),{type:FE(i.element)})):i instanceof f1?f1.create(FE(i.unwrap())):i instanceof UE?UE.create(FE(i.unwrap())):i instanceof GE?GE.create(i.items.map(e=>FE(e))):i}var LE=(()=>{class i extends hn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let A=this._def.shape(),t=Mn.objectKeys(A);return this._cached={shape:A,keys:t},this._cached}_parse(A){if(this._getType(A)!==ht.object){let g=this._getOrReturnCtx(A);return ot(g,{code:Ne.invalid_type,expected:ht.object,received:g.parsedType}),hi}let{status:n,ctx:o}=this._processInputParams(A),{shape:a,keys:r}=this._getCached(),s=[];if(!(this._def.catchall instanceof BI&&this._def.unknownKeys==="strip"))for(let g in o.data)r.includes(g)||s.push(g);let l=[];for(let g of r){let C=a[g],d=o.data[g];l.push({key:{status:"valid",value:g},value:C._parse(new Mg(o,d,o.path,g)),alwaysSet:g in o.data})}if(this._def.catchall instanceof BI){let g=this._def.unknownKeys;if(g==="passthrough")for(let C of s)l.push({key:{status:"valid",value:C},value:{status:"valid",value:o.data[C]}});else if(g==="strict")s.length>0&&(ot(o,{code:Ne.unrecognized_keys,keys:s}),n.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let g=this._def.catchall;for(let C of s){let d=o.data[C];l.push({key:{status:"valid",value:C},value:g._parse(new Mg(o,d,o.path,C)),alwaysSet:C in o.data})}}return o.common.async?Promise.resolve().then(()=>re(this,null,function*(){let g=[];for(let C of l){let d=yield C.key,B=yield C.value;g.push({key:d,value:B,alwaysSet:C.alwaysSet})}return g})).then(g=>rs.mergeObjectSync(n,g)):rs.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(A){return Kt.errToObj,new i(P($A(P({},this._def),{unknownKeys:"strict"}),A!==void 0?{errorMap:(t,n)=>{let o=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:Kt.errToObj(A).message??o}:{message:o}}}:{}))}strip(){return new i($A(P({},this._def),{unknownKeys:"strip"}))}passthrough(){return new i($A(P({},this._def),{unknownKeys:"passthrough"}))}extend(A){return new i($A(P({},this._def),{shape:()=>P(P({},this._def.shape()),A)}))}merge(A){return new i({unknownKeys:A._def.unknownKeys,catchall:A._def.catchall,shape:()=>P(P({},this._def.shape()),A._def.shape()),typeName:_i.ZodObject})}setKey(A,t){return this.augment({[A]:t})}catchall(A){return new i($A(P({},this._def),{catchall:A}))}pick(A){let t={};for(let n of Mn.objectKeys(A))A[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new i($A(P({},this._def),{shape:()=>t}))}omit(A){let t={};for(let n of Mn.objectKeys(this.shape))A[n]||(t[n]=this.shape[n]);return new i($A(P({},this._def),{shape:()=>t}))}deepPartial(){return FE(this)}partial(A){let t={};for(let n of Mn.objectKeys(this.shape)){let o=this.shape[n];A&&!A[n]?t[n]=o:t[n]=o.optional()}return new i($A(P({},this._def),{shape:()=>t}))}required(A){let t={};for(let n of Mn.objectKeys(this.shape))if(A&&!A[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof f1;)a=a._def.innerType;t[n]=a}return new i($A(P({},this._def),{shape:()=>t}))}keyof(){return M$(Mn.objectKeys(this.shape))}}return i.create=(e,A)=>new i(P({shape:()=>e,unknownKeys:"strip",catchall:BI.create(),typeName:_i.ZodObject},tn(A))),i.strictCreate=(e,A)=>new i(P({shape:()=>e,unknownKeys:"strict",catchall:BI.create(),typeName:_i.ZodObject},tn(A))),i.lazycreate=(e,A)=>new i(P({shape:e,unknownKeys:"strip",catchall:BI.create(),typeName:_i.ZodObject},tn(A))),i})(),JR=(()=>{class i extends hn{_parse(A){let{ctx:t}=this._processInputParams(A),n=this._def.options;function o(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let r=a.map(s=>new x0(s.ctx.common.issues));return ot(t,{code:Ne.invalid_union,unionErrors:r}),hi}if(t.common.async)return Promise.all(n.map(a=>re(this,null,function*(){let r=$A(P({},t),{common:$A(P({},t.common),{issues:[]}),parent:null});return{result:yield a._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then(o);{let a,r=[];for(let l of n){let g=$A(P({},t),{common:$A(P({},t.common),{issues:[]}),parent:null}),C=l._parseSync({data:t.data,path:t.path,parent:g});if(C.status==="valid")return C;C.status==="dirty"&&!a&&(a={result:C,ctx:g}),g.common.issues.length&&r.push(g.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let s=r.map(l=>new x0(l));return ot(t,{code:Ne.invalid_union,unionErrors:s}),hi}}get options(){return this._def.options}}return i.create=(e,A)=>new i(P({options:e,typeName:_i.ZodUnion},tn(A))),i})(),OC=i=>i instanceof HR?OC(i.schema):i instanceof KE?OC(i.innerType()):i instanceof zR?[i.value]:i instanceof Jy?i.options:i instanceof PR?Mn.objectValues(i.enum):i instanceof jR?OC(i._def.innerType):i instanceof TR?[void 0]:i instanceof OR?[null]:i instanceof f1?[void 0,...OC(i.unwrap())]:i instanceof UE?[null,...OC(i.unwrap())]:i instanceof Kp||i instanceof qR?OC(i.unwrap()):i instanceof VR?OC(i._def.innerType):[],Ky=class i extends hn{_parse(e){let{ctx:A}=this._processInputParams(e);if(A.parsedType!==ht.object)return ot(A,{code:Ne.invalid_type,expected:ht.object,received:A.parsedType}),hi;let t=this.discriminator,n=A.data[t],o=this.optionsMap.get(n);return o?A.common.async?o._parseAsync({data:A.data,path:A.path,parent:A}):o._parseSync({data:A.data,path:A.path,parent:A}):(ot(A,{code:Ne.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[t]}),hi)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,A,t){let n=new Map;for(let o of A){let a=OC(o.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let r of a){if(n.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);n.set(r,o)}}return new i(P({typeName:_i.ZodDiscriminatedUnion,discriminator:e,options:A,optionsMap:n},tn(t)))}};function FR(i,e){let A=_0(i),t=_0(e);if(i===e)return{valid:!0,data:i};if(A===ht.object&&t===ht.object){let n=Mn.objectKeys(e),o=Mn.objectKeys(i).filter(r=>n.indexOf(r)!==-1),a=P(P({},i),e);for(let r of o){let s=FR(i[r],e[r]);if(!s.valid)return{valid:!1};a[r]=s.data}return{valid:!0,data:a}}else if(A===ht.array&&t===ht.array){if(i.length!==e.length)return{valid:!1};let n=[];for(let o=0;o<i.length;o++){let a=i[o],r=e[o],s=FR(a,r);if(!s.valid)return{valid:!1};n.push(s.data)}return{valid:!0,data:n}}else return A===ht.date&&t===ht.date&&+i==+e?{valid:!0,data:i}:{valid:!1}}var YR=(()=>{class i extends hn{_parse(A){let{status:t,ctx:n}=this._processInputParams(A),o=(a,r)=>{if(Fy(a)||Fy(r))return hi;let s=FR(a.value,r.value);return s.valid?((Ly(a)||Ly(r))&&t.dirty(),{status:t.value,value:s.data}):(ot(n,{code:Ne.invalid_intersection_types}),hi)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,r])=>o(a,r)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}return i.create=(e,A,t)=>new i(P({left:e,right:A,typeName:_i.ZodIntersection},tn(t))),i})(),GE=(()=>{class i extends hn{_parse(A){let{status:t,ctx:n}=this._processInputParams(A);if(n.parsedType!==ht.array)return ot(n,{code:Ne.invalid_type,expected:ht.array,received:n.parsedType}),hi;if(n.data.length<this._def.items.length)return ot(n,{code:Ne.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),hi;!this._def.rest&&n.data.length>this._def.items.length&&(ot(n,{code:Ne.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...n.data].map((r,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new Mg(n,r,n.path,s)):null}).filter(r=>!!r);return n.common.async?Promise.all(a).then(r=>rs.mergeArray(t,r)):rs.mergeArray(t,a)}get items(){return this._def.items}rest(A){return new i($A(P({},this._def),{rest:A}))}}return i.create=(e,A)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new i(P({items:e,typeName:_i.ZodTuple,rest:null},tn(A)))},i})(),Uy=class i extends hn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:A,ctx:t}=this._processInputParams(e);if(t.parsedType!==ht.object)return ot(t,{code:Ne.invalid_type,expected:ht.object,received:t.parsedType}),hi;let n=[],o=this._def.keyType,a=this._def.valueType;for(let r in t.data)n.push({key:o._parse(new Mg(t,r,t.path,r)),value:a._parse(new Mg(t,t.data[r],t.path,r)),alwaysSet:r in t.data});return t.common.async?rs.mergeObjectAsync(A,n):rs.mergeObjectSync(A,n)}get element(){return this._def.valueType}static create(e,A,t){return A instanceof hn?new i(P({keyType:e,valueType:A,typeName:_i.ZodRecord},tn(t))):new i(P({keyType:Oy.create(),valueType:e,typeName:_i.ZodRecord},tn(A)))}},v$=(()=>{class i extends hn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(A){let{status:t,ctx:n}=this._processInputParams(A);if(n.parsedType!==ht.map)return ot(n,{code:Ne.invalid_type,expected:ht.map,received:n.parsedType}),hi;let o=this._def.keyType,a=this._def.valueType,r=[...n.data.entries()].map(([s,l],g)=>({key:o._parse(new Mg(n,s,n.path,[g,"key"])),value:a._parse(new Mg(n,l,n.path,[g,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(()=>re(this,null,function*(){for(let l of r){let g=yield l.key,C=yield l.value;if(g.status==="aborted"||C.status==="aborted")return hi;(g.status==="dirty"||C.status==="dirty")&&t.dirty(),s.set(g.value,C.value)}return{status:t.value,value:s}}))}else{let s=new Map;for(let l of r){let g=l.key,C=l.value;if(g.status==="aborted"||C.status==="aborted")return hi;(g.status==="dirty"||C.status==="dirty")&&t.dirty(),s.set(g.value,C.value)}return{status:t.value,value:s}}}}return i.create=(e,A,t)=>new i(P({valueType:A,keyType:e,typeName:_i.ZodMap},tn(t))),i})(),b$=(()=>{class i extends hn{_parse(A){let{status:t,ctx:n}=this._processInputParams(A);if(n.parsedType!==ht.set)return ot(n,{code:Ne.invalid_type,expected:ht.set,received:n.parsedType}),hi;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ot(n,{code:Ne.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),t.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(ot(n,{code:Ne.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty());let a=this._def.valueType;function r(l){let g=new Set;for(let C of l){if(C.status==="aborted")return hi;C.status==="dirty"&&t.dirty(),g.add(C.value)}return{status:t.value,value:g}}let s=[...n.data.values()].map((l,g)=>a._parse(new Mg(n,l,n.path,g)));return n.common.async?Promise.all(s).then(l=>r(l)):r(s)}min(A,t){return new i($A(P({},this._def),{minSize:{value:A,message:Kt.toString(t)}}))}max(A,t){return new i($A(P({},this._def),{maxSize:{value:A,message:Kt.toString(t)}}))}size(A,t){return this.min(A,t).max(A,t)}nonempty(A){return this.min(1,A)}}return i.create=(e,A)=>new i(P({valueType:e,minSize:null,maxSize:null,typeName:_i.ZodSet},tn(A))),i})(),Ty=class i extends hn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:A}=this._processInputParams(e);if(A.parsedType!==ht.function)return ot(A,{code:Ne.invalid_type,expected:ht.function,received:A.parsedType}),hi;function t(r,s){return Fp({data:r,path:A.path,errorMaps:[A.common.contextualErrorMap,A.schemaErrorMap,RE(),TC].filter(l=>!!l),issueData:{code:Ne.invalid_arguments,argumentsError:s}})}function n(r,s){return Fp({data:r,path:A.path,errorMaps:[A.common.contextualErrorMap,A.schemaErrorMap,RE(),TC].filter(l=>!!l),issueData:{code:Ne.invalid_return_type,returnTypeError:s}})}let o={errorMap:A.common.contextualErrorMap},a=A.data;if(this._def.returns instanceof Yy){let r=this;return Ss(function(...s){return re(this,null,function*(){let l=new x0([]),g=yield r._def.args.parseAsync(s,o).catch(B=>{throw l.addIssue(t(s,B)),l}),C=yield Reflect.apply(a,this,g);return yield r._def.returns._def.type.parseAsync(C,o).catch(B=>{throw l.addIssue(n(C,B)),l})})})}else{let r=this;return Ss(function(...s){let l=r._def.args.safeParse(s,o);if(!l.success)throw new x0([t(s,l.error)]);let g=Reflect.apply(a,this,l.data),C=r._def.returns.safeParse(g,o);if(!C.success)throw new x0([n(g,C.error)]);return C.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new i($A(P({},this._def),{args:GE.create(e).rest(Lp.create())}))}returns(e){return new i($A(P({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,A,t){return new i(P({args:e||GE.create([]).rest(Lp.create()),returns:A||Lp.create(),typeName:_i.ZodFunction},tn(t)))}},HR=(()=>{class i extends hn{get schema(){return this._def.getter()}_parse(A){let{ctx:t}=this._processInputParams(A);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}return i.create=(e,A)=>new i(P({getter:e,typeName:_i.ZodLazy},tn(A))),i})(),zR=(()=>{class i extends hn{_parse(A){if(A.data!==this._def.value){let t=this._getOrReturnCtx(A);return ot(t,{received:t.data,code:Ne.invalid_literal,expected:this._def.value}),hi}return{status:"valid",value:A.data}}get value(){return this._def.value}}return i.create=(e,A)=>new i(P({value:e,typeName:_i.ZodLiteral},tn(A))),i})();function M$(i,e){return new Jy(P({values:i,typeName:_i.ZodEnum},tn(e)))}var Jy=(()=>{class i extends hn{_parse(A){if(typeof A.data!="string"){let t=this._getOrReturnCtx(A),n=this._def.values;return ot(t,{expected:Mn.joinValues(n),received:t.parsedType,code:Ne.invalid_type}),hi}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(A.data)){let t=this._getOrReturnCtx(A),n=this._def.values;return ot(t,{received:t.data,code:Ne.invalid_enum_value,options:n}),hi}return Ss(A.data)}get options(){return this._def.values}get enum(){let A={};for(let t of this._def.values)A[t]=t;return A}get Values(){let A={};for(let t of this._def.values)A[t]=t;return A}get Enum(){let A={};for(let t of this._def.values)A[t]=t;return A}extract(A,t=this._def){return i.create(A,P(P({},this._def),t))}exclude(A,t=this._def){return i.create(this.options.filter(n=>!A.includes(n)),P(P({},this._def),t))}}return i.create=M$,i})(),PR=(()=>{class i extends hn{_parse(A){let t=Mn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(A);if(n.parsedType!==ht.string&&n.parsedType!==ht.number){let o=Mn.objectValues(t);return ot(n,{expected:Mn.joinValues(o),received:n.parsedType,code:Ne.invalid_type}),hi}if(this._cache||(this._cache=new Set(Mn.getValidEnumValues(this._def.values))),!this._cache.has(A.data)){let o=Mn.objectValues(t);return ot(n,{received:n.data,code:Ne.invalid_enum_value,options:o}),hi}return Ss(A.data)}get enum(){return this._def.values}}return i.create=(e,A)=>new i(P({values:e,typeName:_i.ZodNativeEnum},tn(A))),i})(),Yy=(()=>{class i extends hn{unwrap(){return this._def.type}_parse(A){let{ctx:t}=this._processInputParams(A);if(t.parsedType!==ht.promise&&t.common.async===!1)return ot(t,{code:Ne.invalid_type,expected:ht.promise,received:t.parsedType}),hi;let n=t.parsedType===ht.promise?t.data:Promise.resolve(t.data);return Ss(n.then(o=>this._def.type.parseAsync(o,{path:t.path,errorMap:t.common.contextualErrorMap})))}}return i.create=(e,A)=>new i(P({type:e,typeName:_i.ZodPromise},tn(A))),i})(),KE=(()=>{class i extends hn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_i.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(A){let{status:t,ctx:n}=this._processInputParams(A),o=this._def.effect||null,a={addIssue:r=>{ot(n,r),r.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),o.type==="preprocess"){let r=o.transform(n.data,a);if(n.common.async)return Promise.resolve(r).then(s=>re(this,null,function*(){if(t.value==="aborted")return hi;let l=yield this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?hi:l.status==="dirty"?II(l.value):t.value==="dirty"?II(l.value):l}));{if(t.value==="aborted")return hi;let s=this._def.schema._parseSync({data:r,path:n.path,parent:n});return s.status==="aborted"?hi:s.status==="dirty"?II(s.value):t.value==="dirty"?II(s.value):s}}if(o.type==="refinement"){let r=s=>{let l=o.refinement(s,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?hi:(s.status==="dirty"&&t.dirty(),r(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?hi:(s.status==="dirty"&&t.dirty(),r(s.value).then(()=>({status:t.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!p1(r))return hi;let s=o.transform(r.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(r=>p1(r)?Promise.resolve(o.transform(r.value,a)).then(s=>({status:t.value,value:s})):hi);Mn.assertNever(o)}}return i.create=(e,A,t)=>new i(P({schema:e,typeName:_i.ZodEffects,effect:A},tn(t))),i.createWithPreprocess=(e,A,t)=>new i(P({schema:A,effect:{type:"preprocess",transform:e},typeName:_i.ZodEffects},tn(t))),i})();var f1=(()=>{class i extends hn{_parse(A){return this._getType(A)===ht.undefined?Ss(void 0):this._def.innerType._parse(A)}unwrap(){return this._def.innerType}}return i.create=(e,A)=>new i(P({innerType:e,typeName:_i.ZodOptional},tn(A))),i})(),UE=(()=>{class i extends hn{_parse(A){return this._getType(A)===ht.null?Ss(null):this._def.innerType._parse(A)}unwrap(){return this._def.innerType}}return i.create=(e,A)=>new i(P({innerType:e,typeName:_i.ZodNullable},tn(A))),i})(),jR=(()=>{class i extends hn{_parse(A){let{ctx:t}=this._processInputParams(A),n=t.data;return t.parsedType===ht.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}return i.create=(e,A)=>new i(P({innerType:e,typeName:_i.ZodDefault,defaultValue:typeof A.default=="function"?A.default:()=>A.default},tn(A))),i})(),VR=(()=>{class i extends hn{_parse(A){let{ctx:t}=this._processInputParams(A),n=$A(P({},t),{common:$A(P({},t.common),{issues:[]})}),o=this._def.innerType._parse({data:n.data,path:n.path,parent:P({},n)});return NE(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new x0(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new x0(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}return i.create=(e,A)=>new i(P({innerType:e,typeName:_i.ZodCatch,catchValue:typeof A.catch=="function"?A.catch:()=>A.catch},tn(A))),i})(),S$=(()=>{class i extends hn{_parse(A){if(this._getType(A)!==ht.nan){let n=this._getOrReturnCtx(A);return ot(n,{code:Ne.invalid_type,expected:ht.nan,received:n.parsedType}),hi}return{status:"valid",value:A.data}}}return i.create=e=>new i(P({typeName:_i.ZodNaN},tn(e))),i})(),RMA=Symbol("zod_brand"),Kp=class extends hn{_parse(e){let{ctx:A}=this._processInputParams(e),t=A.data;return this._def.type._parse({data:t,path:A.path,parent:A})}unwrap(){return this._def.type}},Up=class i extends hn{_parse(e){let{status:A,ctx:t}=this._processInputParams(e);if(t.common.async)return re(this,null,function*(){let o=yield this._def.in._parseAsync({data:t.data,path:t.path,parent:t});return o.status==="aborted"?hi:o.status==="dirty"?(A.dirty(),II(o.value)):this._def.out._parseAsync({data:o.value,path:t.path,parent:t})});{let n=this._def.in._parseSync({data:t.data,path:t.path,parent:t});return n.status==="aborted"?hi:n.status==="dirty"?(A.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:t.path,parent:t})}}static create(e,A){return new i({in:e,out:A,typeName:_i.ZodPipeline})}},qR=(()=>{class i extends hn{_parse(A){let t=this._def.innerType._parse(A),n=o=>(p1(o)&&(o.value=Object.freeze(o.value)),o);return NE(t)?t.then(o=>n(o)):n(t)}unwrap(){return this._def.innerType}}return i.create=(e,A)=>new i(P({innerType:e,typeName:_i.ZodReadonly},tn(A))),i})();function p$(i,e){let A=typeof i=="function"?i(e):typeof i=="string"?{message:i}:i;return typeof A=="string"?{message:A}:A}function k$(i,e={},A){return i?Gy.create().superRefine((t,n)=>{let o=i(t);if(o instanceof Promise)return o.then(a=>{if(!a){let r=p$(e,t),s=r.fatal??A??!0;n.addIssue($A(P({code:"custom"},r),{fatal:s}))}});if(!o){let a=p$(e,t),r=a.fatal??A??!0;n.addIssue($A(P({code:"custom"},a),{fatal:r}))}}):Gy.create()}var NMA={object:LE.lazycreate},_i=(function(i){return i.ZodString="ZodString",i.ZodNumber="ZodNumber",i.ZodNaN="ZodNaN",i.ZodBigInt="ZodBigInt",i.ZodBoolean="ZodBoolean",i.ZodDate="ZodDate",i.ZodSymbol="ZodSymbol",i.ZodUndefined="ZodUndefined",i.ZodNull="ZodNull",i.ZodAny="ZodAny",i.ZodUnknown="ZodUnknown",i.ZodNever="ZodNever",i.ZodVoid="ZodVoid",i.ZodArray="ZodArray",i.ZodObject="ZodObject",i.ZodUnion="ZodUnion",i.ZodDiscriminatedUnion="ZodDiscriminatedUnion",i.ZodIntersection="ZodIntersection",i.ZodTuple="ZodTuple",i.ZodRecord="ZodRecord",i.ZodMap="ZodMap",i.ZodSet="ZodSet",i.ZodFunction="ZodFunction",i.ZodLazy="ZodLazy",i.ZodLiteral="ZodLiteral",i.ZodEnum="ZodEnum",i.ZodEffects="ZodEffects",i.ZodNativeEnum="ZodNativeEnum",i.ZodOptional="ZodOptional",i.ZodNullable="ZodNullable",i.ZodDefault="ZodDefault",i.ZodCatch="ZodCatch",i.ZodPromise="ZodPromise",i.ZodBranded="ZodBranded",i.ZodPipeline="ZodPipeline",i.ZodReadonly="ZodReadonly",i})(_i||{});var FMA=(i,e={message:`Input not instance of ${i.name}`})=>k$(A=>A instanceof i,e),_$=Oy.create,x$=LR.create,LMA=S$.create,GMA=GR.create,R$=KR.create,KMA=UR.create,UMA=y$.create,TMA=TR.create,OMA=OR.create,JMA=Gy.create,YMA=Lp.create,HMA=BI.create,zMA=D$.create,PMA=Gp.create,jMA=LE.create,VMA=LE.strictCreate,qMA=JR.create,WMA=Ky.create,ZMA=YR.create,XMA=GE.create,$MA=Uy.create,A9A=v$.create,e9A=b$.create,t9A=Ty.create,i9A=HR.create,n9A=zR.create,o9A=Jy.create,a9A=PR.create,r9A=Yy.create,s9A=KE.create,l9A=f1.create,g9A=UE.create,c9A=KE.createWithPreprocess,C9A=Up.create,d9A=()=>_$().optional(),I9A=()=>x$().optional(),B9A=()=>R$().optional(),h9A={string:i=>Oy.create($A(P({},i),{coerce:!0})),number:i=>LR.create($A(P({},i),{coerce:!0})),boolean:i=>KR.create($A(P({},i),{coerce:!0})),bigint:i=>GR.create($A(P({},i),{coerce:!0})),date:i=>UR.create($A(P({},i),{coerce:!0}))};var E9A=hi;var Q9A=XA.union([XA.string(),XA.number(),XA.boolean()]),Hy=XA.lazy(()=>XA.union([Q9A,XA.array(Hy),XA.record(XA.string(),Hy)]));function zy(i){return i.transform(e=>{if(!e||typeof e!="object")return e;let A={};for(let[t,n]of Object.entries(e))n!==null&&(A[t]=n);return A})}var WR=XA.string().transform((i,e)=>{try{return JSON.parse(i)}catch(A){return e.addIssue({code:"custom",message:"Invalid JSON string"}),XA.NEVER}}),Tp=i=>XA.union([i,WR.pipe(i)]);var Py="gen_ai.input.messages",jy="gen_ai.output.messages",Vy="gen_ai.system_instructions",qy="gen_ai.tool.definitions",Wy="gen_ai.response.finish_reasons",Zy="gen_ai.usage.input_tokens",Xy="gen_ai.usage.output_tokens",N$="function",Jp="gen_ai.client.inference.operation.details",u9A=XA.object({type:XA.literal("text"),content:XA.string()}),p9A=XA.object({type:XA.literal("blob"),mime_type:XA.string(),data:XA.any()}),f9A=XA.object({type:XA.literal("file_data"),mime_type:XA.string(),uri:XA.string()}),m9A=XA.object({type:XA.literal("tool_call"),id:XA.string().nullable().optional(),name:XA.string(),arguments:XA.record(XA.string(),XA.any()).nullable().optional()}),w9A=XA.object({type:XA.literal("tool_call_response"),id:XA.string().nullable().optional(),response:XA.record(XA.string(),XA.any()).nullable().optional()}),ZR=XA.discriminatedUnion("type",[u9A,p9A,f9A,m9A,w9A]),y9A=XA.object({role:XA.string(),parts:XA.array(ZR)}),D9A=XA.object({role:XA.string(),parts:XA.array(ZR),finish_reason:XA.string()}),v9A=XA.object({type:XA.literal(N$),name:XA.string(),description:XA.string().nullable().optional(),parameters:XA.record(XA.string(),XA.any()).nullable().optional()}),b9A=XA.object({name:XA.string(),type:XA.string()}),M9A=XA.union([v9A,b9A]),S9A=Tp(XA.array(y9A)),k9A=Tp(XA.array(D9A)),_9A=Tp(XA.array(ZR)),x9A=Tp(XA.array(M9A)),XR=XA.array(XA.string()),Op=XA.number(),R9A=XA.object({[Py]:S9A.optional(),[jy]:k9A.optional(),[Vy]:_9A.optional(),[qy]:x9A.optional(),[Wy]:XR.optional(),[Zy]:Op.optional(),[Xy]:Op.optional()}).passthrough(),F$=XA.object({event_name:XA.literal(Jp),body:XA.unknown().optional(),attributes:R9A.optional()});var $y="gen_ai.system.message",AD="gen_ai.user.message",eD="gen_ai.choice",N9A=zy(XA.object({id:XA.string().nullable().optional(),name:XA.string(),args:XA.record(XA.string(),XA.any()),needsResponse:XA.boolean().nullable().optional()})),F9A=zy(XA.object({id:XA.string().nullable().optional(),name:XA.string(),response:XA.record(XA.string(),XA.any())})),G$=zy(XA.object({text:XA.string().nullable().optional(),function_call:N9A.nullable().optional(),function_response:F9A.nullable().optional()})),L9A=XA.object({parts:XA.array(G$),role:XA.string()}),L$=XA.object({content:XA.object({parts:XA.array(G$),role:XA.string().optional()}),role:XA.string().optional()}).transform(i=>{let e=P({},i.content);return i.role!==void 0&&(e.role=i.role),{content:e}}).pipe(XA.object({content:L9A})),G9A=XA.object({content:XA.string()}),K9A=XA.object({event_name:XA.enum([AD,eD]),body:XA.union([L$,WR.pipe(L$)])}),U9A=XA.object({event_name:XA.literal($y),body:G9A}),K$=XA.union([U9A,K9A]);var T9A="gcp.vertex.agent.llm_request",O9A="gcp.vertex.agent.llm_response";function tD(i){let e=J9A(i);if(e!==void 0)return e;let A=Y9A(i);if(A!==void 0)return A;let t=H9A(i);if(t!==void 0)return t}function J9A(i){let e=(i.logs??[]).find(r=>r.event_name===Jp);if(e===void 0)return;let A=e.attributes??{},t=A[Vy],n=A[Py],o=A[qy],a=A[jy];if(!(t===void 0&&n===void 0&&o===void 0&&a===void 0))return{kind:"experimental",inputs:{system_instruction:t,user_messages:n,tool_definitions:o},outputs:a}}function Y9A(i){let e=i.logs??[],A,t=[],n;for(let o of e)switch(o.event_name){case $y:A=o.body;break;case AD:t.push(o.body);break;case eD:n=o.body;break;default:break}if(!(A===void 0&&t.length===0&&n===void 0))return{kind:"stable",inputs:{system_instruction:A,user_messages:t},outputs:n}}function H9A(i){let e=i.attributes??{},A=e[T9A],t=e[O9A];if(!(A===void 0&&t===void 0))return{kind:"legacy",inputs:U$(A),outputs:U$(t)}}function U$(i){if(typeof i!="string")return i;try{return JSON.parse(i)}catch(e){return i}}var z9A=XA.union([K$,F$]);var P9A="gen_ai.operation.name",T$="gen_ai.conversation.id",j9A="gen_ai.agent.name",V9A="gen_ai.agent.description",O$="gcp.vertex.agent.invocation_id",q9A="gcp.vertex.agent.associated_event_ids",J$="gcp.vertex.agent.event_id";var AN="invoke_agent",hI="generate_content",W9A=XA.object({name:XA.string(),start_time:XA.number(),end_time:XA.number(),trace_id:XA.union([XA.string(),XA.number()]),span_id:XA.union([XA.string(),XA.number()]),parent_span_id:XA.union([XA.string(),XA.number()]).nullable().optional(),attributes:XA.record(XA.string(),Hy).optional(),logs:XA.array(z9A).optional()}),Z9A=XA.object({attrConversationId:XA.string().optional(),attrInvocationId:XA.string().optional(),attrAssociatedEventIds:XA.array(XA.string()).optional(),attrAgentName:XA.string().optional(),attrAgentDescription:XA.string().optional(),attrEventId:XA.string().optional(),attrResponseFinishReasons:XR.optional(),attrUsageInputTokens:Op.optional(),attrUsageOutputTokens:Op.optional()});function X9A(i){let e=i.attributes??{},A={attrConversationId:e[T$],attrInvocationId:e[O$],attrAssociatedEventIds:e[q9A],attrAgentName:e[j9A],attrAgentDescription:e[V9A],attrEventId:e[J$],attrResponseFinishReasons:e[Wy],attrUsageInputTokens:e[Zy],attrUsageOutputTokens:e[Xy]};for(let t of Object.keys(A))A[t]===void 0&&delete A[t];return A}var $9A=XA.object({attrConversationId:XA.string({message:`'${T$}' is required on '${AN}' spans`})}),ASA=XA.object({attrEventId:XA.string({message:`'${J$}' is required on '${hI}' spans`}),attrInvocationId:XA.string({message:`'${O$}' is required on '${hI}' spans`})});function eN(i,e){for(let A of e)i.addIssue(A)}function $R(i,e,A){let t=X9A(i),n=Z9A.safeParse(t);if(!n.success)return eN(A,n.error.issues),null;if(e===null)return n.data;let o=e.safeParse(t);return o.success?P(P({},n.data),o.data):(eN(A,o.error.issues),null)}var Y$=XA.unknown().transform((i,e)=>{let A=W9A.safeParse(i);if(!A.success)return eN(e,A.error.issues),XA.NEVER;let t=A.data,n=t.attributes?.[P9A],B=t,{logs:o,attributes:a}=B,r=Pp(B,["logs","attributes"]),s=a!==void 0?{rawAttributesUseThisFieldOnlyForDisplay:a}:{rawAttributesUseThisFieldOnlyForDisplay:{}},l={rawSpanUseThisFieldOnlyForDisplay:i};if(n===AN){let u=$R(t,$9A,e);return u===null?XA.NEVER:$A(P(P(P(P({},r),s),l),u),{attrOperationName:AN})}if(n===hI){let u=$R(t,ASA,e);if(u===null)return XA.NEVER;let E=tD({attributes:t.attributes,logs:o});return P($A(P(P(P(P({},r),s),l),u),{attrOperationName:hI}),E!==void 0?{io:E}:{})}let g=$R(t,null,e);if(g===null)return XA.NEVER;let C=tD({attributes:t.attributes,logs:o});return P(P(P(P(P({},r),s),l),g),C!==void 0?{io:C}:{})});function tN(i){if(!i)return;let e=i.system_instruction;if(e===void 0&&i.systemInstruction&&(e=i.systemInstruction),e===void 0&&i.config&&(e=i.config.system_instruction!==void 0?i.config.system_instruction:i.config.systemInstruction),typeof e=="string")return e}var eSA=["sideDrawer"],tSA=["drawerSessionTab"],iSA=["appSearchInput"],nSA=["invChipMenuTrigger"],oSA=["nodeChipMenuTrigger"],aSA=["addMenuTrigger"],rSA=[[["","adk-web-chat-container-top",""]]],sSA=["[adk-web-chat-container-top]"],z$=()=>[],lSA=(i,e)=>e.metricName;function gSA(i,e){i&1&&dn(0)}function cSA(i,e){if(i&1&&kt(0,gSA,1,0,"ng-container",40),i&2){let A=p();H("ngComponentOutlet",A.logoComponent)}}function CSA(i,e){if(i&1&&(I(0,"span",45),D(1),h()),i&2){let A=p(2);Q(),Ee(" ",A.adkVersion())}}function dSA(i,e){if(i&1&&(I(0,"div",48)(1,"div",50)(2,"span",51),D(3,"Version:"),h(),I(4,"span",52),D(5),h()(),I(6,"div",50)(7,"span",51),D(8,"Language:"),h(),I(9,"span",52),D(10),h()(),I(11,"div",50)(12,"span",51),D(13,"Lang Version:"),h(),I(14,"span",52),D(15),h()()()),i&2){let A=p(2);Q(5),nA(A.versionInfo().version),Q(5),nA(A.versionInfo().language),Q(5),nA(A.versionInfo().language_version)}}function ISA(i,e){if(i&1&&(lA(0,"img",41),I(1,"div",42)(2,"div",43)(3,"span",44),D(4,"Agent Development Kit"),h(),T(5,CSA,2,1,"span",45),h(),I(6,"div",46)(7,"div",47),D(8),h(),T(9,dSA,16,3,"div",48),h()(),I(10,"span",49),D(11,"ADK"),h()),i&2){let A=p();Q(5),O(A.adkVersion()?5:-1),Q(3),nA(A.sidePanelI18n.disclosureTooltip),Q(),O(A.versionInfo()?9:-1)}}function BSA(i,e){i&1&&(I(0,"mat-icon",20),D(1,"warning"),h())}function hSA(i,e){if(i&1){let A=aA();I(0,"span",54)(1,"button",56),U("click",function(){L(A);let n=p(2);return G(n.openAgentStructureGraphDialog())}),I(2,"mat-icon"),D(3,"account_tree"),h()()()}if(i&2){let A=p(2);H("matTooltip",A.graphsAvailable()?"View Agent Structure Graph":"Agent structure graph is not available for this agent"),Q(),H("disabled",!A.graphsAvailable())}}function ESA(i,e){if(i&1){let A=aA();lA(0,"div",53),T(1,hSA,4,2,"span",54),I(2,"span",54)(3,"button",55),U("click",function(){L(A);let n=p();return G(n.enterBuilderMode())}),I(4,"mat-icon"),D(5,"edit"),h()()()}if(i&2){let A=p();Q(),O(A.graphsAvailable()?1:-1),Q(),H("matTooltip",A.disableBuilderSwitch?"Editing is not available for this agent because it was not built by the builder":"Edit in Builder Mode"),Q(),H("disabled",A.disableBuilderSwitch)}}function QSA(i,e){if(i&1){let A=aA();I(0,"div",57)(1,"mat-icon",62),D(2,"visibility"),h(),I(3,"span",63),D(4),h(),I(5,"button",64),U("click",function(){L(A);let n=p(2);return G(n.closeReadonlySession())}),I(6,"mat-icon",65),D(7,"close"),h()()()}if(i&2){let A=p(2);Q(4),Ya("",A.readonlySessionType(),": ",A.readonlySessionName())}}function uSA(i,e){if(i&1){let A=aA();I(0,"button",69),U("click",function(){L(A);let n=p(7);return G(n.onNewSessionClick())}),I(1,"mat-icon",18),D(2,"add_comment"),h(),I(3,"span"),D(4),h()()}if(i&2){let A=p(7);H("matTooltip",A.i18n.createNewSessionTooltip),Q(4),nA(A.i18n.newSessionButton)}}function pSA(i,e){if(i&1){let A=aA();I(0,"button",70),U("click",function(){L(A);let n=p(7);return G(n.onNewSessionClick())}),I(1,"mat-icon",18),D(2,"add_comment"),h()()}if(i&2){let A=p(7);H("matTooltip",A.i18n.createNewSessionTooltip)}}function fSA(i,e){if(i&1&&(lA(0,"div",53),T(1,uSA,5,2,"button",67)(2,pSA,3,1,"button",68)),i&2){let A=p(6);Q(),O(A.uiEvents().length>0&&!A.isMobile()?1:2)}}function mSA(i,e){if(i&1&&T(0,fSA,3,1),i&2){let A=p(5);O(A.sessionId?0:-1)}}function wSA(i,e){if(i&1&&(T(0,mSA,1,1),mt(1,"async")),i&2){let A=p(4);O(Ft(1,1,A.isNewSessionButtonEnabledObs)?0:-1)}}function ySA(i,e){if(i&1&&(ro(0),mt(1,"async"),T(2,wSA,2,3)),i&2){let A=Ft(1,1,p(3).uiStateService.isSessionLoading());Q(2),O(A===!1?2:-1)}}function DSA(i,e){if(i&1){let A=aA();I(0,"div",16)(1,"button",66),U("click",function(){L(A);let n=p(2);return G(n.toggleSessionSelectorDrawer())}),I(2,"mat-icon",18),D(3,"chat"),h(),I(4,"span",19),D(5),h(),I(6,"mat-icon",21),D(7,"arrow_drop_down"),h()(),T(8,ySA,3,3),h()}if(i&2){let A=p(2);Q(5),nA(A.getToolbarSessionId()),Q(3),O(A.evalCase?-1:8)}}function vSA(i,e){if(i&1&&(I(0,"div",57)(1,"span",63),D(2),h(),I(3,"span",71),D(4),h()()),i&2){let A=p(3);Q(2),nA(A.i18n.evalCaseIdLabel),Q(2),nA(A.evalCase.evalId)}}function bSA(i,e){if(i&1){let A=aA();I(0,"button",72),U("click",function(){L(A);let n=p(3);return G(n.cancelEditEvalCase())}),D(1),h(),I(2,"button",73),U("click",function(){L(A);let n=p(3);return G(n.saveEvalCase())}),D(3),h()}if(i&2){let A=p(3);Q(),Ee(" ",A.i18n.cancelButton," "),Q(),H("disabled",!A.hasEvalCaseChanged()||A.isEvalCaseEditing()),Q(),Ee(" ",A.i18n.saveButton," ")}}function MSA(i,e){}function SSA(i,e){if(i&1&&(T(0,vSA,5,2,"div",57),I(1,"div",60),T(2,bSA,4,3)(3,MSA,0,0),h()),i&2){let A=p(2);O(A.isViewOnlySession()?-1:0),Q(2),O(A.isEvalEditMode()?2:3)}}function kSA(i,e){}function _SA(i,e){if(i&1&&(I(0,"div",74),D(1),h()),i&2){let A=p(3);Q(),nA(A.i18n.loadingSessionLabel)}}function xSA(i,e){if(i&1&&(I(0,"div",59),ro(1),mt(2,"async"),T(3,kSA,0,0)(4,_SA,2,1,"div",74),h()),i&2){let A=Ft(2,1,p(2).uiStateService.isSessionLoading());Q(3),O(A===!1?3:4)}}function RSA(i,e){if(i&1){let A=aA();I(0,"button",75),U("click",function(){L(A);let n=p(2);return G(n.themeService==null?null:n.themeService.toggleTheme())}),I(1,"mat-icon"),D(2),h()()}if(i&2){let A=p(2);H("matTooltip",(A.themeService==null?null:A.themeService.currentTheme())==="dark"?"Switch to Light Mode":"Switch to Dark Mode"),Q(2),nA((A.themeService==null?null:A.themeService.currentTheme())==="dark"?"light_mode":"dark_mode")}}function NSA(i,e){if(i&1&&(I(0,"div",22),T(1,QSA,8,2,"div",57)(2,DSA,9,2,"div",16),I(3,"div",58),T(4,SSA,4,2)(5,xSA,5,3,"div",59),h(),I(6,"div",60),ro(7),mt(8,"async"),T(9,RSA,3,2,"button",61),h()()),i&2){let A=p();Q(),O(A.isViewOnlySession()?1:2),Q(3),O(A.evalCase?4:5);let t=Ft(8,3,A.uiStateService.isSessionLoading());Q(5),O(t===!1?9:-1)}}function FSA(i,e){i&1&&(I(0,"div",85),lA(1,"mat-progress-spinner",86),h())}function LSA(i,e){i&1&&(I(0,"mat-icon",92),D(1,"check"),h())}function GSA(i,e){if(i&1){let A=aA();I(0,"button",89),U("click",function(){let n=L(A).$implicit,o=p(3);return G(o.selectAppFromDrawer(n))}),I(1,"mat-icon",90),D(2,"robot_2"),h(),I(3,"span",91),D(4),h(),T(5,LSA,2,0,"mat-icon",92),h()}if(i&2){let A=e.$implicit,t=p(3);_A("selected",A===t.appName),Q(4),nA(A),Q(),O(A===t.appName?5:-1)}}function KSA(i,e){i&1&&(I(0,"div",88),D(1,"No apps found"),h())}function USA(i,e){i&1&&ke(0,GSA,6,4,"button",87,ni,!1,KSA,2,0,"div",88),i&2&&_e(e)}function TSA(i,e){if(i&1){let A=aA();I(0,"div",76)(1,"span",77),D(2,"Select an App"),h(),I(3,"div")(4,"button",78),U("click",function(){L(A);let n=p();return G(n.openAddItemDialog())}),I(5,"mat-icon"),D(6,"add"),h()(),I(7,"button",79),U("click",function(){L(A);let n=p();return G(n.toggleAppSelectorDrawer())}),I(8,"mat-icon"),D(9,"close"),h()()()(),I(10,"div",80)(11,"mat-form-field",81)(12,"mat-icon",82),D(13,"search"),h(),I(14,"input",83,3),U("keydown",function(n){L(A);let o=p();return G(o.handleAppSearchKeydown(n))}),h()()(),I(16,"div",84),U("keydown",function(n){L(A);let o=p();return G(o.handleAppListKeydown(n))}),T(17,FSA,2,0,"div",85),mt(18,"async"),S1(19,USA,3,1),h()}if(i&2){let A,t=p();Q(14),H("formControl",t.appDrawerSearchControl),Q(3),O(t.isLoadingApps()?17:(A=Ft(18,2,t.filteredDrawerApps$))?19:-1,A)}}function OSA(i,e){if(i&1){let A=aA();I(0,"button",95),U("click",function(){L(A);let n=p(2);return G(n.importSession())}),I(1,"mat-icon"),D(2,"upload"),h(),I(3,"span"),D(4,"Import"),h()()}if(i&2){let A=p(2);H("matTooltip",A.i18n.importSessionTooltip)}}function JSA(i,e){if(i&1){let A=aA();I(0,"button",108),U("click",function(){L(A);let n=p(3);return G(n.exportSession())}),I(1,"mat-icon"),D(2,"download"),h(),I(3,"span"),D(4,"Export"),h()()}if(i&2){let A=p(3);H("matTooltip",A.i18n.exportSessionTooltip)}}function YSA(i,e){if(i&1){let A=aA();I(0,"button",109),U("click",function(){L(A);let n=p(3);return G(n.deleteSession(n.sessionId))}),I(1,"mat-icon"),D(2,"delete"),h(),I(3,"span"),D(4,"Delete"),h()()}if(i&2){let A=p(3);H("matTooltip",A.i18n.deleteSessionTooltip)}}function HSA(i,e){if(i&1){let A=aA();I(0,"div",97)(1,"span",100),D(2,"Current Session"),h(),I(3,"div",101)(4,"app-inline-edit",102),U("save",function(n){L(A);let o=p(2);return G(o.saveSessionName(n))}),h()(),I(5,"div",103)(6,"span",104),D(7),h(),I(8,"button",105),U("click",function(){L(A);let n=p(2);return G(n.copySessionId())}),I(9,"mat-icon"),D(10,"content_copy"),h()(),T(11,JSA,5,1,"button",106),mt(12,"async"),T(13,YSA,5,1,"button",107),mt(14,"async"),h()()}if(i&2){let A=p(2);Q(4),H("value",A.sessionDisplayNameDraft)("displayValue",A.getCurrentSessionDisplayName())("tooltip",A.sessionId),Q(2),H("title",A.sessionId),Q(),nA(A.sessionId),Q(4),O(Ft(12,7,A.isExportSessionEnabledObs)?11:-1),Q(2),O(Ft(14,9,A.isDeleteSessionEnabledObs)?13:-1)}}function zSA(i,e){if(i&1){let A=aA();I(0,"div",76)(1,"span",77),D(2,"Select a Session"),h(),I(3,"div",93),T(4,OSA,5,1,"button",94),mt(5,"async"),I(6,"button",95),U("click",function(){L(A);let n=p();return G(n.viewSession())}),I(7,"mat-icon"),D(8,"visibility"),h(),I(9,"span"),D(10,"View"),h()(),I(11,"button",96),U("click",function(){L(A);let n=p();return G(n.toggleSessionSelectorDrawer())}),I(12,"mat-icon"),D(13,"close"),h()()()(),T(14,HSA,15,11,"div",97),I(15,"div",98)(16,"app-session-tab",99,4),U("sessionSelected",function(n){L(A);let o=p();return G(o.onSessionSelectedFromDrawer(n))})("sessionReloaded",function(n){L(A);let o=p();return G(o.onSessionReloadedFromDrawer(n))}),h()()}if(i&2){let A=p();Q(4),O(Ft(5,6,A.importSessionEnabledObs)?4:-1),Q(2),H("matTooltip",A.i18n.viewSessionTooltip),Q(8),O(A.sessionId?14:-1),Q(2),H("userId",A.userId)("appName",A.appName)("sessionId",A.sessionId)}}function PSA(i,e){if(i&1){let A=aA();I(0,"app-side-panel",110),U("jumpToInvocation",function(n){L(A);let o=p();return G(o.handleJumpToInvocation(n))})("closePanel",function(){L(A);let n=p();return G(n.toggleSidePanel())})("tabChange",function(n){L(A);let o=p();return G(o.handleTabChange(n))})("sessionSelected",function(n){L(A);let o=p();return G(o.updateWithSelectedSession(n))})("evalCaseSelected",function(n){L(A);let o=p();return G(o.updateWithSelectedEvalCase(n))})("editEvalCaseRequested",function(n){L(A);let o=p();return G(o.handleEditEvalCaseRequested(n))})("testSelected",function(n){L(A);let o=p();return G(o.updateWithSelectedTest(n.testName,n.events))})("evalSetIdSelected",function(n){L(A);let o=p();return G(o.updateSelectedEvalSetId(n))})("returnToSession",function(n){L(A);let o=p();return G(o.handleReturnToSession(n))})("evalNotInstalled",function(n){L(A);let o=p();return G(o.handleEvalNotInstalled(n))})("page",function(n){L(A);let o=p();return G(o.handlePageEvent(n))})("closeSelectedEvent",function(){L(A);let n=p();return G(n.closeSelectedEvent())})("openImageDialog",function(n){L(A);let o=p();return G(o.openViewImageDialog(n))})("openAddItemDialog",function(){L(A);let n=p();return G(n.openAddItemDialog())})("enterBuilderMode",function(){L(A);let n=p();return G(n.enterBuilderMode())})("showAgentStructureGraph",function(){L(A);let n=p();return G(n.openAgentStructureGraphDialog("event"))})("switchToEvent",function(n){L(A);let o=p();return G(o.selectEvent(n))})("switchToTraceView",function(){L(A);let n=p();return G(n.switchToTraceView())})("drillDownNodePath",function(n){L(A);let o=p();return G(o.onEventTabDrillDown(n))})("selectEventById",function(n){L(A);let o=p();return G(o.selectEvent(n))}),h()}if(i&2){let A=p();H("isApplicationSelectorEnabledObs",A.isApplicationSelectorEnabledObs)("showSidePanel",A.showSidePanel)("appName",A.appName)("userId",A.userId)("sessionId",A.sessionId)("isViewOnlySession",A.isViewOnlySession())("isViewOnlyAppNameMismatch",A.isViewOnlyAppNameMismatch())("traceData",A.traceData)("eventData",A.eventData)("currentSessionState",A.currentSessionState)("artifacts",A.artifacts)("selectedEvent",A.selectedEvent)("selectedEventIndex",A.selectedEventIndex)("renderedEventGraph",A.renderedEventGraph)("rawSvgString",A.rawSvgString)("selectedEventGraphPath",A.selectedEventGraphPath)("llmRequest",A.llmRequest)("llmResponse",A.llmResponse)("disableBuilderIcon",A.disableBuilderSwitch)("hasSubWorkflows",A.hasSubWorkflows)("graphsAvailable",A.graphsAvailable())("invocationDisplayMap",A.invocationDisplayMap())("forceGraphTab",A.autoSelectLatestEvent)}}function jSA(i,e){if(i&1){let A=aA();I(0,"app-builder-tabs",111),U("exitBuilderMode",function(){L(A);let n=p();return G(n.exitBuilderMode())})("closePanel",function(){L(A);let n=p();return G(n.toggleSidePanel())}),h(),lA(1,"div",112)}if(i&2){let A=p();H("appNameInput",A.appName)}}function VSA(i,e){if(i&1){let A=aA();I(0,"div",37)(1,"div",113)(2,"button",114),U("click",function(){L(A);let n=p();return G(n.saveAgentBuilder())}),I(3,"mat-icon"),D(4,"check"),h()(),I(5,"button",115),U("click",function(){L(A);let n=p();return G(n.exitBuilderMode())}),I(6,"mat-icon"),D(7,"close"),h()(),I(8,"button",116),U("click",function(){L(A);let n=p();return G(n.toggleBuilderAssistant())}),I(9,"mat-icon"),D(10,"assistant"),h()()(),I(11,"app-canvas",117),U("toggleSidePanelRequest",function(){L(A);let n=p();return G(n.toggleSidePanel())})("builderAssistantCloseRequest",function(){L(A);let n=p();return G(n.toggleBuilderAssistant())}),h()()}if(i&2){let A=p();Q(8),_A("active",A.showBuilderAssistant),Q(3),H("showSidePanel",A.showSidePanel)("showBuilderAssistant",A.showBuilderAssistant)("appNameInput",A.appName)}}function qSA(i,e){if(i&1&&(I(0,"div",119)(1,"span"),D(2),h()()),i&2){let A=p(3);Q(2),nA(A.i18n.loadingAgentsLabel)}}function WSA(i,e){if(i&1&&(I(0,"span"),D(1),lA(2,"br"),D(3),h()),i&2){let A=p(4);Q(),nA(A.i18n.welcomeMessage),Q(2),Ee(" ",A.i18n.selectAgentMessage)}}function ZSA(i,e){if(i&1&&(D(0),lA(1,"br"),I(2,"pre",121),D(3),h()),i&2){let A=p(5);Ee(" ",A.i18n.errorMessageLabel," "),Q(3),nA(A.loadingError())}}function XSA(i,e){if(i&1&&(I(0,"pre",120),D(1),h()),i&2){let A=p(5);Q(),nA(A.i18n.noAgentsFoundWarning)}}function $SA(i,e){if(i&1&&(I(0,"div"),D(1),I(2,"pre"),D(3,"adk web"),h(),D(4," in the folder that contains the agents."),lA(5,"br"),T(6,ZSA,4,2)(7,XSA,2,1,"pre",120),h()),i&2){let A=p(4);Q(),Ee(" ",A.i18n.failedToLoadAgentsMessage," "),Q(5),O(A.loadingError()?6:7)}}function AkA(i,e){if(i&1&&(I(0,"div",119),T(1,WSA,4,2,"span"),mt(2,"async"),S1(3,$SA,8,2,"div"),h()),i&2){let A=p(3);Q(),O((Ft(2,1,A.apps$)||Lc(3,z$)).length>0?1:3)}}function ekA(i,e){if(i&1&&(T(0,qSA,3,1,"div",119),mt(1,"async"),S1(2,AkA,4,4,"div",119)),i&2){let A=p(2);O(A.isLoadingApps()?0:Ft(1,1,A.isApplicationSelectorEnabledObs)?2:-1)}}function tkA(i,e){if(i&1){let A=aA();I(0,"div",145,8),U("click",function(n){return n.stopPropagation()}),I(2,"span",146),D(3),h(),I(4,"button",147),U("click",function(n){L(A);let o=p(4);return G(o.removeInvocationIdFilter(n))}),I(5,"mat-icon"),D(6,"close"),h()()()}if(i&2){p();let A=Bi(17),t=p(3);H("matMenuTriggerFor",A)("matTooltip",t.invocationIdFilter()?"Invocation: "+(t.invocationDisplayMap().get(t.invocationIdFilter())||t.invocationIdFilter()):"Filter events by a specific invocation"),Q(2),H("title",t.invocationIdFilter()?t.invocationDisplayMap().get(t.invocationIdFilter())||t.invocationIdFilter():"Invocation"),Q(),nA(t.invocationIdFilter()?t.invocationDisplayMap().get(t.invocationIdFilter())||t.invocationIdFilter():"Invocation")}}function ikA(i,e){if(i&1){let A=aA();I(0,"div",145,9),U("click",function(n){return n.stopPropagation()}),I(2,"span",63),D(3,"Node"),h(),I(4,"button",147),U("click",function(n){L(A);let o=p(4);return G(o.removeNodePathFilter(n))}),I(5,"mat-icon"),D(6,"close"),h()()()}if(i&2){p();let A=Bi(21),t=p(3);H("matMenuTriggerFor",A)("matTooltip",t.nodePathFilter()?"Node: "+t.nodePathFilter():"Filter events generated by a specific node")}}function nkA(i,e){if(i&1){let A=aA();I(0,"div",148),U("click",function(n){return n.stopPropagation()}),I(1,"span",63),D(2,"Final"),h(),I(3,"button",147),U("click",function(n){return L(A),p(4).toggleHideIntermediateEvents(),G(n.stopPropagation())}),I(4,"mat-icon"),D(5,"close"),h()()()}}function okA(i,e){if(i&1&&(I(0,"button",149,10),U("click",function(t){return t.stopPropagation()}),I(2,"mat-icon"),D(3,"add"),h(),I(4,"span"),D(5,"Filter"),h()()),i&2){p();let A=Bi(12);H("matMenuTriggerFor",A)}}function akA(i,e){if(i&1){let A=aA();I(0,"button",150),U("click",function(n){L(A);let o=p(4);return G(o.clearAllFilters(n))}),I(1,"mat-icon"),D(2,"clear_all"),h(),I(3,"span"),D(4,"Clear"),h()()}}function rkA(i,e){if(i&1){let A=aA();I(0,"button",151),U("click",function(){L(A);let n=p(4);return G(n.addInvocationIdFilter())}),D(1,"Invocation"),h()}}function skA(i,e){if(i&1){let A=aA();I(0,"button",152),U("click",function(){L(A);let n=p(4);return G(n.addNodePathFilter())}),D(1,"Node"),h()}}function lkA(i,e){if(i&1){let A=aA();I(0,"button",153),U("click",function(){L(A);let n=p(4);return G(n.toggleHideIntermediateEvents())}),D(1,"Final"),h()}}function gkA(i,e){if(i&1){let A=aA();I(0,"button",154),U("click",function(){let n=L(A).$implicit,o=p(4);return G(o.setInvocationIdFilter(n))}),I(1,"mat-icon",155),D(2,"check"),h(),D(3),h()}if(i&2){let A=e.$implicit,t=p(4);H("matTooltip",A),Q(),ft("visibility",t.invocationIdFilter()===A?"visible":"hidden"),Q(2),Ee(" ",t.invocationDisplayMap().get(A)||A," ")}}function ckA(i,e){if(i&1){let A=aA();I(0,"button",156),U("click",function(){let n=L(A).$implicit,o=p(4);return G(o.setNodePathFilter(n))}),I(1,"mat-icon",155),D(2,"check"),h(),D(3),h()}if(i&2){let A=e.$implicit,t=p(4);Q(),ft("visibility",t.nodePathFilter()===A?"visible":"hidden"),Q(2),Ee(" ",A," ")}}function CkA(i,e){if(i&1){let A=aA();I(0,"mat-button-toggle-group",130),U("change",function(n){L(A);let o=p(3);return G(o.onViewModeChange(n.value))}),I(1,"mat-button-toggle",131),D(2,"Events"),h(),I(3,"mat-button-toggle",132),D(4,"Traces"),h()(),I(5,"div",133),U("click",function(n){L(A);let o=p(3);return G(o.openAddFilterMenu(n))}),T(6,tkA,7,4,"div",134),T(7,ikA,7,2,"div",134),T(8,nkA,6,0,"div",135),T(9,okA,6,1,"button",136),T(10,akA,5,0,"button",137),h(),I(11,"mat-menu",138,5),T(13,rkA,2,0,"button",139),T(14,skA,2,0,"button",140),T(15,lkA,2,0,"button",141),h(),I(16,"mat-menu",142,6),U("closed",function(){L(A);let n=p(3);return G(n.onInvocationMenuClosed())}),ke(18,gkA,4,4,"button",143,ni),h(),I(20,"mat-menu",142,7),U("closed",function(){L(A);let n=p(3);return G(n.onNodePathMenuClosed())}),ke(22,ckA,4,3,"button",144,ni),h()}if(i&2){let A=p(3);H("value",A.viewMode()),Q(6),O(A.invocationIdFilterActive()?6:-1),Q(),O(A.nodePathFilterActive()?7:-1),Q(),O(A.hideIntermediateEvents()?8:-1),Q(),O(!A.invocationIdFilterActive()||!A.nodePathFilterActive()||!A.hideIntermediateEvents()?9:-1),Q(),O(A.invocationIdFilterActive()||A.nodePathFilterActive()||A.hideIntermediateEvents()?10:-1),Q(3),O(A.invocationIdFilterActive()?-1:13),Q(),O(A.nodePathFilterActive()?-1:14),Q(),O(A.hideIntermediateEvents()?-1:15),Q(3),_e(A.invocationIdOptions()),Q(4),_e(A.nodePathOptions())}}function dkA(i,e){i&1&&(I(0,"span",123),D(1,"README.md"),h())}function IkA(i,e){if(i&1){let A=aA();I(0,"button",157),U("click",function(){L(A);let n=p(3);return G(n.isSideBySide.set(!n.isSideBySide()))}),I(1,"mat-icon",158),D(2),h(),I(3,"span",159),D(4,"Compare"),h()()}if(i&2){let A=p(3);ft("color",A.isSideBySide()?"var(--mat-sys-primary)":"var(--mat-sys-on-surface-variant)"),Q(2),nA(A.isSideBySide()?"check_circle":"radio_button_unchecked")}}function BkA(i,e){if(i&1){let A=aA();I(0,"button",156),U("click",function(n){L(A);let o=p(4);return o.showBranches.set(!o.showBranches()),G(n.stopPropagation())}),I(1,"mat-icon",162),D(2),h(),I(3,"span",163),D(4,"Branches"),h()()}if(i&2){let A=p(4);Q(),ft("color",A.showBranches()?"var(--mat-sys-primary)":"var(--mat-sys-on-surface-variant)"),Q(),Ee(" ",A.showBranches()?"check_box":"check_box_outline_blank"," ")}}function hkA(i,e){if(i&1){let A=aA();I(0,"button",156),U("click",function(n){return L(A),p(4).toggleSse(),G(n.stopPropagation())}),I(1,"mat-icon",162),D(2),h(),I(3,"span",163),D(4,"Streaming"),h()()}if(i&2){let A=p(4);Q(),ft("color",A.useSse()?"var(--mat-sys-primary)":"var(--mat-sys-on-surface-variant)"),Q(),Ee(" ",A.useSse()?"check_box":"check_box_outline_blank"," ")}}function EkA(i,e){if(i&1&&(I(0,"button",160)(1,"mat-icon"),D(2,"more_vert"),h()(),I(3,"mat-menu",161,11),T(5,BkA,5,3,"button",144),T(6,hkA,5,3,"button",144),h()),i&2){let A=Bi(4);p();let t=Ki(10),n=Ki(11),o=p(2);H("matMenuTriggerFor",A)("matTooltip",o.i18n.moreOptionsTooltip),Q(5),O(t?5:-1),Q(),O(n?6:-1)}}function QkA(i,e){if(i&1){let A=aA();I(0,"app-chat-panel",164),mt(1,"async"),Ni("userInputChange",function(n){L(A);let o=p(3);return wi(o.userInput,n)||(o.userInput=n),G(n)}),U("toggleHideIntermediateEvents",function(){L(A);let n=p(3);return G(n.toggleHideIntermediateEvents())})("toggleSse",function(){L(A);let n=p(3);return G(n.toggleSse())})("clickEvent",function(n){L(A);let o=p(3);return G(o.clickEvent(n))})("handleKeydown",function(n){L(A);let o=p(3);return G(o.handleKeydown(n.event,n.message))})("cancelEditMessage",function(n){L(A);let o=p(3);return G(o.cancelEditMessage(n))})("saveEditMessage",function(n){L(A);let o=p(3);return G(o.saveEditMessage(n))})("openViewImageDialog",function(n){L(A);let o=p(3);return G(o.openViewImageDialog(n))})("openBase64InNewTab",function(n){L(A);let o=p(3);return G(o.openBase64InNewTab(n.data,n.mimeType))})("fileSelect",function(n){L(A);let o=p(3);return G(o.onFileSelect(n))})("removeFile",function(n){L(A);let o=p(3);return G(o.removeFile(n))})("removeStateUpdate",function(){L(A);let n=p(3);return G(n.removeStateUpdate())})("sendMessage",function(n){L(A);let o=p(3);return G(o.handleChatInput(n))})("stopMessage",function(){L(A);let n=p(3);return G(n.handleStopMessage())})("updateState",function(){L(A);let n=p(3);return G(n.updateState())})("toggleAudioRecording",function(n){L(A);let o=p(3);return G(o.toggleAudioRecording(n))})("toggleVideoRecording",function(){L(A);let n=p(3);return G(n.toggleVideoRecording())})("longRunningResponseComplete",function(n){L(A);let o=p(3);return G(o.sendMessage(n))})("manualScroll",function(){L(A);let n=p(3);return G(n.onManualScroll())}),h()}if(i&2){let A=p(3);H("appName",A.appName)("agentReadme",A.agentReadme),Ri("userInput",A.userInput),H("hideIntermediateEvents",A.hideIntermediateEvents())("uiEvents",A.filteredUiEvents())("showBranches",A.showBranches())("traceData",A.traceData)("isTokenStreamingEnabled",Ft(1,23,A.isTokenStreamingEnabledObs)??!1)("useSse",A.useSse())("isChatMode",!0)("selectedFiles",A.selectedFiles)("updatedSessionState",A.updatedSessionState())("agentGraphData",A.agentGraphData())("selectedMessageIndex",A.selectedMessageIndex)("isAudioRecording",A.isAudioRecording)("micVolume",A.micVolume())("isVideoRecording",A.isVideoRecording)("userId",A.userId)("sessionId",A.sessionId)("sessionName",A.sessionId)("invocationDisplayMap",A.invocationDisplayMap())("viewMode",A.viewMode())("shouldShowEvent",A.shouldShowEventFn)}}function ukA(i,e){if(i&1){let A=aA();I(0,"app-chat-panel",165),mt(1,"async"),Ni("userInputChange",function(n){L(A);let o=p(3);return wi(o.userInput,n)||(o.userInput=n),G(n)})("userEditEvalCaseMessageChange",function(n){L(A);let o=p(3);return wi(o.userEditEvalCaseMessage,n)||(o.userEditEvalCaseMessage=n),G(n)}),U("clickEvent",function(n){L(A);let o=p(3);return G(o.clickEvent(n))})("handleKeydown",function(n){L(A);let o=p(3);return G(o.handleKeydown(n.event,n.message))})("cancelEditMessage",function(n){L(A);let o=p(3);return G(o.cancelEditMessage(n))})("saveEditMessage",function(n){L(A);let o=p(3);return G(o.saveEditMessage(n))})("openViewImageDialog",function(n){L(A);let o=p(3);return G(o.openViewImageDialog(n))})("openBase64InNewTab",function(n){L(A);let o=p(3);return G(o.openBase64InNewTab(n.data,n.mimeType))})("editEvalCaseMessage",function(n){L(A);let o=p(3);return G(o.editEvalCaseMessage(n))})("deleteEvalCaseMessage",function(n){L(A);let o=p(3);return G(o.deleteEvalCaseMessage(n.message,n.index))})("editFunctionArgs",function(n){L(A);let o=p(3);return G(o.editFunctionArgs(n))}),h()}if(i&2){let A=p(3);H("appName",A.appName)("agentReadme",A.agentReadme)("hideIntermediateEvents",A.hideIntermediateEvents())("uiEvents",A.filteredUiEvents())("showBranches",A.showBranches())("isChatMode",!1)("evalCase",A.evalCase)("isEvalEditMode",A.isEvalEditMode())("isEvalCaseEditing",A.isEvalCaseEditing())("isEditFunctionArgsEnabled",Ft(1,20,A.isEditFunctionArgsEnabledObs)??!1),Ri("userInput",A.userInput)("userEditEvalCaseMessage",A.userEditEvalCaseMessage),H("agentGraphData",A.agentGraphData())("selectedMessageIndex",A.selectedMessageIndex)("userId",A.userId)("sessionId",A.sessionId)("sessionName",A.sessionId)("invocationDisplayMap",A.invocationDisplayMap())("viewMode",A.viewMode())("shouldShowEvent",A.shouldShowEventFn)}}function pkA(i,e){if(i&1&&(I(0,"div",179),D(1),h()),i&2){p();let A=Ki(40);Q(),Ee(" ",A)}}function fkA(i,e){if(i&1&&(I(0,"div",171)(1,"span",172),D(2),mt(3,"formatMetricName"),h(),I(4,"div",173)(5,"span",174),D(6),mt(7,"number"),h(),I(8,"span",175),D(9),mt(10,"number"),h()(),I(11,"div",176)(12,"div",177),D(13),mt(14,"formatMetricName"),h(),I(15,"div",178),D(16),h(),I(17,"div",48)(18,"div",50)(19,"span",51),D(20,"Actual:"),h(),I(21,"span",52),D(22),mt(23,"number"),h()(),I(24,"div",50)(25,"span",51),D(26,"Threshold:"),h(),I(27,"span",52),D(28),mt(29,"number"),h()(),I(30,"div",50)(31,"span",51),D(32,"Min:"),h(),I(33,"span",52),D(34),h()(),I(35,"div",50)(36,"span",51),D(37,"Max:"),h(),I(38,"span",52),D(39),h()()(),ro(40),T(41,pkA,2,1,"div",179),h()()),i&2){let A=e.$implicit,t=p(6);ft("border",A.evalStatus==1?"1px solid #2e7d32":"1px solid var(--mat-sys-error)"),Q(2),nA(Ft(3,16,A.metricName)),Q(3),ft("color",A.evalStatus==1?"#2e7d32":"var(--mat-sys-error)"),Q(),Ee(" ",A.score!=null?G0(7,18,A.score,"1.2-2"):"?"," "),Q(3),Ee(" / ",G0(10,21,A.threshold,"1.2-2")," "),Q(4),nA(Ft(14,24,A.metricName)),Q(3),nA(A.metricName),Q(5),ft("color",A.evalStatus==1?"#2e7d32":"var(--mat-sys-error)"),Q(),nA(A.score!=null?G0(23,26,A.score,"1.2-2"):"?"),Q(6),nA(G0(29,29,A.threshold,"1.2-2")),Q(6),nA(t.getMetricMin(A.metricName)),Q(5),nA(t.getMetricMax(A.metricName)),Q();let n=so(t.getMetricDescription(A.metricName));Q(),O(n?41:-1)}}function mkA(i,e){if(i&1&&(I(0,"div",169),ke(1,fkA,42,33,"div",170,lSA),h()),i&2){p();let A=Ki(0);Q(),_e(A.overallEvalMetricResults)}}function wkA(i,e){if(i&1&&(ro(0),I(1,"div",166),T(2,mkA,3,0,"div",169),h()),i&2){let A=so(p(4).evalCaseResult());Q(2),O(A.overallEvalMetricResults!=null&&A.overallEvalMetricResults.length?2:-1)}}function ykA(i,e){if(i&1){let A=aA();I(0,"div",167)(1,"div",180)(2,"div",181),D(3,"Expected"),h(),I(4,"app-chat-panel",182),U("manualScroll",function(){L(A);let n=p(4);return G(n.onManualScroll())}),h()(),I(5,"div",180)(6,"div",181),D(7,"Actual"),h(),I(8,"app-chat-panel",183),mt(9,"async"),mt(10,"async"),U("toggleHideIntermediateEvents",function(){L(A);let n=p(4);return G(n.toggleHideIntermediateEvents())})("toggleSse",function(){L(A);let n=p(4);return G(n.toggleSse())}),Ni("userInputChange",function(n){L(A);let o=p(4);return wi(o.userInput,n)||(o.userInput=n),G(n)})("userEditEvalCaseMessageChange",function(n){L(A);let o=p(4);return wi(o.userEditEvalCaseMessage,n)||(o.userEditEvalCaseMessage=n),G(n)}),U("clickEvent",function(n){L(A);let o=p(4);return G(o.clickEvent(n))})("handleKeydown",function(n){L(A);let o=p(4);return G(o.handleKeydown(n.event,n.message))})("cancelEditMessage",function(n){L(A);let o=p(4);return G(o.cancelEditMessage(n))})("saveEditMessage",function(n){L(A);let o=p(4);return G(o.saveEditMessage(n))})("openViewImageDialog",function(n){L(A);let o=p(4);return G(o.openViewImageDialog(n))})("openBase64InNewTab",function(n){L(A);let o=p(4);return G(o.openBase64InNewTab(n.data,n.mimeType))})("editEvalCaseMessage",function(n){L(A);let o=p(4);return G(o.editEvalCaseMessage(n))})("deleteEvalCaseMessage",function(n){L(A);let o=p(4);return G(o.deleteEvalCaseMessage(n.message,n.index))})("editFunctionArgs",function(n){L(A);let o=p(4);return G(o.editFunctionArgs(n))})("fileSelect",function(n){L(A);let o=p(4);return G(o.onFileSelect(n))})("removeFile",function(n){L(A);let o=p(4);return G(o.removeFile(n))})("removeStateUpdate",function(){L(A);let n=p(4);return G(n.removeStateUpdate())})("sendMessage",function(n){L(A);let o=p(4);return G(o.handleChatInput(n))})("updateState",function(){L(A);let n=p(4);return G(n.updateState())})("toggleAudioRecording",function(n){L(A);let o=p(4);return G(o.toggleAudioRecording(n))})("toggleVideoRecording",function(){L(A);let n=p(4);return G(n.toggleVideoRecording())})("longRunningResponseComplete",function(n){L(A);let o=p(4);return G(o.sendMessage(n))})("manualScroll",function(){L(A);let n=p(4);return G(n.onManualScroll())}),h()()()}if(i&2){let A=p(4);Q(4),H("appName",A.appName)("agentReadme",A.agentReadme)("hideIntermediateEvents",A.hideIntermediateEvents())("uiEvents",A.filteredExpectedUiEvents())("showBranches",A.showBranches())("isChatMode",!1)("evalCase",A.evalCase)("isEvalEditMode",!1)("isEvalCaseEditing",!1)("isEditFunctionArgsEnabled",!1)("userInput","")("selectedFiles",Lc(56,z$))("updatedSessionState",null)("agentGraphData",A.agentGraphData())("selectedMessageIndex",-1)("isAudioRecording",!1)("micVolume",0)("isVideoRecording",!1)("userId",A.userId)("sessionId",A.sessionId)("sessionName",A.sessionId)("invocationDisplayMap",A.invocationDisplayMap())("viewMode",A.viewMode())("shouldShowEvent",A.shouldShowEventFn),Q(4),H("appName",A.appName)("agentReadme",A.agentReadme)("hideIntermediateEvents",A.hideIntermediateEvents())("uiEvents",A.filteredUiEvents())("showBranches",A.showBranches())("traceData",A.traceData)("isTokenStreamingEnabled",Ft(9,52,A.isTokenStreamingEnabledObs)??!1)("useSse",A.useSse())("isChatMode",!1)("evalCase",A.evalCase)("isEvalEditMode",A.isEvalEditMode())("isEvalCaseEditing",A.isEvalCaseEditing())("isEditFunctionArgsEnabled",Ft(10,54,A.isEditFunctionArgsEnabledObs)??!1),Ri("userInput",A.userInput)("userEditEvalCaseMessage",A.userEditEvalCaseMessage),H("selectedFiles",A.selectedFiles)("updatedSessionState",A.updatedSessionState())("agentGraphData",A.agentGraphData())("selectedMessageIndex",A.selectedMessageIndex)("isAudioRecording",A.isAudioRecording)("micVolume",A.micVolume())("isVideoRecording",A.isVideoRecording)("userId",A.userId)("sessionId",A.sessionId)("sessionName",A.sessionId)("invocationDisplayMap",A.invocationDisplayMap())("viewMode",A.viewMode())("shouldShowEvent",A.shouldShowEventFn)}}function DkA(i,e){if(i&1){let A=aA();I(0,"app-chat-panel",184),U("manualScroll",function(){L(A);let n=p(4);return G(n.onManualScroll())}),h()}if(i&2){let A=p(4);H("appName",A.appName)("agentReadme",A.agentReadme)("hideIntermediateEvents",A.hideIntermediateEvents())("uiEvents",A.filteredUiEvents())("showBranches",A.showBranches())("traceData",A.traceData)("isChatMode",!1)("evalCase",A.evalCase)("agentGraphData",A.agentGraphData())("selectedMessageIndex",A.selectedMessageIndex)("userId",A.userId)("sessionId",A.sessionId)("sessionName",A.sessionId)("invocationDisplayMap",A.invocationDisplayMap())("viewMode",A.viewMode())("shouldShowEvent",A.shouldShowEventFn)}}function vkA(i,e){if(i&1&&(T(0,wkA,3,2,"div",166),T(1,ykA,11,57,"div",167)(2,DkA,1,16,"app-chat-panel",168)),i&2){let A=p(3);O(A.evalCaseResult()?0:-1),Q(),O(A.isSideBySide()?1:2)}}function bkA(i,e){i&1&&(I(0,"div",129)(1,"mat-icon",185),D(2,"insert_drive_file"),h(),I(3,"h3",186),D(4,"File View"),h(),I(5,"p",187),D(6,"File content lost on refresh. Please re-upload the file to view or use it."),h()())}function MkA(i,e){if(i&1){let A=aA();I(0,"div",122),T(1,CkA,24,9)(2,dkA,2,0,"span",123),lA(3,"div",124),I(4,"button",125),mt(5,"async"),U("click",function(){L(A);let n=p(2);return G(n.refreshLatestSession())}),I(6,"mat-icon",18),mt(7,"async"),D(8,"refresh"),h()(),T(9,IkA,5,3,"button",126),ro(10)(11),mt(12,"async"),T(13,EkA,7,4),h(),T(14,QkA,2,25,"app-chat-panel",127)(15,ukA,2,22,"app-chat-panel",128)(16,vkA,3,2)(17,bkA,7,0,"div",129)}if(i&2){let A,t=p(2);Q(),O(t.uiEvents().length===0&&t.agentReadme?2:1),Q(3),H("matTooltip",t.i18n.retrieveLatestSessionTooltip)("disabled",Ft(5,8,t.uiStateService.isSessionLoading())===!0),Q(2),_A("spinning",Ft(7,10,t.uiStateService.isSessionLoading())),Q(3),O(t.chatType()==="eval-result"?9:-1),Q();let n=so(t.viewMode()!=="traces");Q();let o=so(Ft(12,13,t.isTokenStreamingEnabledObs)&&t.canEditSession());Q(2),O(n||o?13:-1),Q(),O((A=t.chatType())==="session"?14:A==="eval-case"?15:A==="eval-result"?16:A==="file"?17:-1)}}function SkA(i,e){if(i&1&&(I(0,"div",38),Ze(1),I(2,"mat-card",118),T(3,ekA,3,3),T(4,MkA,18,16),h()()),i&2){let A=p();Q(2),_A("no-side-panel",!A.showSidePanel),Q(),O(A.selectedAppControl.value?-1:3),Q(),O(A.appName!=""?4:-1)}}function kkA(i,e){if(i&1){let A=aA();I(0,"app-agent-structure-graph-dialog",188),U("close",function(){L(A);let n=p();return G(n.showAgentStructureOverlay=!1)}),h()}if(i&2){let A=p();H("appName",A.appName)("preloadedAppData",A.agentGraphData())("preloadedLightGraphSvg",A.agentStructureOverlayMode==="event"?A.eventGraphSvgLight:A.sessionGraphSvgLight)("preloadedDarkGraphSvg",A.agentStructureOverlayMode==="event"?A.eventGraphSvgDark:A.sessionGraphSvgDark)("startPath",A.agentStructureOverlayMode==="event"?A.selectedEventGraphPath:"")}}var _kA="root_agent",iD="q",xkA="hideSidePanel",iN="<a2a_datapart_json>",nN="</a2a_datapart_json>",H$="application/json+a2ui";function oN(i){for(i=i.replace(/-/g,"+").replace(/_/g,"/");i.length%4!==0;)i+="=";return i}var aN=class i extends rd{nextPageLabel="Next Event";previousPageLabel="Previous Event";firstPageLabel="First Event";lastPageLabel="Last Event";getRangeLabel=(e,A,t)=>t===0?`Event 0 of ${t}`:(t=Math.max(t,0),`Event ${e*A+1} of ${t}`);static \u0275fac=(()=>{let e;return function(t){return(e||(e=Li(i)))(t||i)}})();static \u0275prov=jA({token:i,factory:i.\u0275fac})},RkA="Restarting bidirectional streaming is not currently supported. Please refresh the page or start a new session.",nD=class i{i18n=w(h$);sidePanelI18n=w(_E);_snackbarService=w(Xc);activatedRoute=w($s);agentService=w(el);artifactService=w(EB);changeDetectorRef=w(Mt);dialog=w(Xa);document=w(ci);downloadService=w(QB);evalService=w(A0);eventService=w(fm);featureFlagService=w(Nr);graphService=w(uB);localFileService=w(mm);location=w(vm);renderer=w(on);router=w(Is);safeValuesService=w(Qs);testsService=w(c2);sessionService=w(tl);streamChatService=w(ym);webSocketService=w(mB);audioRecordingService=w(pB);audioPlayingService=w(fB);stringToColorService=w(g2);traceService=w(ng);uiStateService=w(ag);agentBuilderService=w($c);themeService=w(og,{optional:!0});logoComponent=w(wB,{optional:!0});activeSseSubscription;chatPanel=Yo(h1);canvasComponent=Yo.required(QE);sideDrawer=Yo.required("sideDrawer");sidePanel=Yo.required(xE);drawerSessionTab=Yo("drawerSessionTab");evalTab=Yo(Sc);appSearchInput=Yo("appSearchInput");canChat=ye(()=>this.chatType()==="session");isEvalCaseEditing=mA(!1);hasEvalCaseChanged=mA(!1);isEvalEditMode=mA(!1);isBuilderMode=mA(!1);chatType=mA("session");currentEvalCaseId=null;currentEvalTimestamp=null;videoElement;currentMessage="";uiEvents=mA([]);invocationDisplayMap=ye(()=>{let e=new Map,A=1,t="";for(let n of this.uiEvents()){if(n.role==="user")if(n.text)t=n.text;else if(n.event?.content?.parts?.length){let o=n.event.content.parts.find(a=>a.text);o&&o.text&&(t=o.text)}else t="User Message";if(n.event?.invocationId){let o=n.event.invocationId;if(!e.has(o)){let a=t||"User Message";a.length>50&&(a=a.substring(0,47)+"..."),e.set(o,`#${A} (${a})`),A++}}}return e});artifacts=[];userInput="";userEditEvalCaseMessage="";userId="user";appName="";sessionId="";sessionIdOfLoadedMessages="";evalCase=null;evalCaseResult=mA(null);metricsInfo=this.evalService.metricsInfo;updatedEvalCase=null;adkVersion=mA("");versionInfo=mA(null);evalSetId="";isAudioRecording=!1;micVolume=this.audioRecordingService.volumeLevel;isVideoRecording=!1;longRunningEvents=[];functionCallEventId="";redirectUri=Rr.getBaseUrlWithoutPath();isMobile=mA(window.innerWidth<=768);showSidePanel=window.localStorage.getItem("adk-side-panel-visible")!=="false";showBuilderAssistant=!0;showAppSelectorDrawer=!1;showSessionSelectorDrawer=!1;useSse=mA(window.localStorage.getItem("adk-use-sse")==="true");currentSessionState={};root_agent=_kA;updatedSessionState=mA(null);canEditSession=mA(!0);isViewOnlySession=mA(!1);isViewOnlyAppNameMismatch=mA(!1);isLoadedAppUnavailable=mA(!1);unavailableAppName=mA("");readonlySessionType=mA("");readonlySessionName=mA("");isSideBySide=mA(!1);showBranches=mA(!1);expectedUiEvents=mA([]);viewMode=mA(window.localStorage.getItem("chat-view-mode")||"events");invocationIdFilterActive=mA(!1);nodePathFilterActive=mA(!1);invocationIdFilter=mA("");nodePathFilter=mA("");invocationIdOptions=ye(()=>{let e=new Set;for(let A of this.uiEvents())A.event?.invocationId&&e.add(A.event.invocationId);return Array.from(e)});nodePathOptions=ye(()=>{let e=new Set;for(let A of this.uiEvents()){let t=A.bareNodePath;t&&e.add(t)}return Array.from(e)});invChipMenuTrigger=Yo("invChipMenuTrigger");nodeChipMenuTrigger=Yo("nodeChipMenuTrigger");addMenuTrigger=Yo("addMenuTrigger");openAddFilterMenu(e){e.stopPropagation(),this.addMenuTrigger()?.openMenu()}addInvocationIdFilter(){this.invocationIdFilterActive.set(!0),setTimeout(()=>{this.invChipMenuTrigger()?.openMenu()})}addNodePathFilter(){this.nodePathFilterActive.set(!0),setTimeout(()=>{this.nodeChipMenuTrigger()?.openMenu()})}removeInvocationIdFilter(e){e.stopPropagation(),this.invocationIdFilterActive.set(!1),this.invocationIdFilter.set("")}removeNodePathFilter(e){e.stopPropagation(),this.nodePathFilterActive.set(!1),this.nodePathFilter.set("")}setInvocationIdFilter(e){this.invocationIdFilter.set(e)}setNodePathFilter(e){this.nodePathFilter.set(e)}onInvocationMenuClosed(){this.invocationIdFilter()||this.invocationIdFilterActive.set(!1)}onNodePathMenuClosed(){this.nodePathFilter()||this.nodePathFilterActive.set(!1)}clearAllFilters(e){e.stopPropagation(),this.invocationIdFilterActive()&&(this.invocationIdFilterActive.set(!1),this.invocationIdFilter.set("")),this.nodePathFilterActive()&&(this.nodePathFilterActive.set(!1),this.nodePathFilter.set("")),this.hideIntermediateEvents()&&this.toggleHideIntermediateEvents()}shouldShowEvent(e){let A=this.invocationIdFilter();if(A&&!(e.event?.invocationId||"").includes(A))return!1;let t=this.nodePathFilter();if(t&&!(e.bareNodePath||"").includes(t))return!1;if(!this.hideIntermediateEvents()||e.role==="user")return!0;if(e.event?.content!==void 0){let n=e.event.content.parts||[];if(n.length>0&&n.every(a=>a.functionCall||a.functionResponse)){if(n.some(r=>{let s=r.functionCall?.id||r.functionResponse?.id;return s&&e.event?.longRunningToolIds?.includes(s)}))return!0}else return!0}if(e.event?.output!==void 0){let n=e.event?.nodeInfo,o=!1,a=n?.outputFor;if(Array.isArray(a)?o=a.some(r=>!r.includes("/")):typeof a=="string"?o=!a.includes("/"):n?.path&&(o=!n.path.includes("/")),o)return!0}return!1}shouldShowEventFn=this.shouldShowEvent.bind(this);getMetricTooltip(e,A,t){let n=this.metricsInfo().find(g=>g.metricName===e),o=n?.description||"",a=n?.metricValueInfo?.interval?.minValue??"?",r=n?.metricValueInfo?.interval?.maxValue??"?",s=A!=null?parseFloat(A).toFixed(2):"?",l=t!=null?parseFloat(t).toFixed(2):"?";return`${o?o+" | ":""}Actual: ${s} | Threshold: ${l} | Min: ${a} | Max: ${r}`}getMetricDescription(e){return this.metricsInfo().find(t=>t.metricName===e)?.description||""}getMetricMin(e){let t=this.metricsInfo().find(n=>n.metricName===e)?.metricValueInfo?.interval?.minValue;return t!=null?t.toFixed(2):"?"}getMetricMax(e){let t=this.metricsInfo().find(n=>n.metricName===e)?.metricValueInfo?.interval?.maxValue;return t!=null?t.toFixed(2):"?"}getVersionTooltip(){let e=this.versionInfo();return e?`Version: ${e.version} | Language: ${e.language} | Language Version: ${e.language_version}`:""}getMergedTooltip(){let e=this.sidePanelI18n.disclosureTooltip||"",A=this.getVersionTooltip();return A?`${e} | ${A}`:e}filteredUiEvents=ye(()=>this.uiEvents().filter(e=>this.shouldShowEvent(e)));filteredExpectedUiEvents=ye(()=>this.expectedUiEvents().filter(e=>this.shouldShowEvent(e)));onViewModeChange(e){this.viewMode.set(e);try{window.localStorage.setItem("chat-view-mode",e)}catch(A){}}originalSessionId="";hideIntermediateEvents=mA(window.localStorage.getItem("adk-hide-intermediate-events")==="true");toggleHideIntermediateEvents(){let e=!this.hideIntermediateEvents();this.hideIntermediateEvents.set(e),window.localStorage.setItem("adk-hide-intermediate-events",String(e))}sessionHasUsedBidi=new Set;eventData=new Map;traceData=[];renderedEventGraph;rawSvgString=null;agentGraphData=mA(null);sessionGraphSvgLight={};sessionGraphSvgDark={};sessionGraphDot={};dynamicGraphDot={};agentReadme="";graphsAvailable=mA(!0);get hasSubWorkflows(){return Object.keys(this.sessionGraphSvgLight).length>1}selectedEvent=void 0;selectedEventIndex=void 0;selectedMessageIndex=void 0;llmRequest=void 0;llmResponse=void 0;getMediaTypeFromMimetype=I6;selectedFiles=[];MediaType=iC;selectedAppControl=new Ps("",{nonNullable:!0});appDrawerSearchControl=new Ps("",{nonNullable:!0});openBase64InNewTab(e,A){this.safeValuesService.openBase64InNewTab(e,A)}isLoadingApps=mA(!1);loadingError=mA("");apps$=oe([]).pipe(mi(()=>{this.isLoadingApps.set(!0),this.selectedAppControl.disable()}),Mi(()=>this.agentService.listApps().pipe(aa(e=>(this.loadingError.set(e.message),oe(void 0))))),Ro(1),mi(e=>{this.isLoadingApps.set(!1),this.selectedAppControl.enable(),e?.length==1&&this.router.navigate([],{relativeTo:this.activatedRoute,queryParams:{app:e[0]},queryParamsHandling:"merge"})}),Js());filteredDrawerApps$=this.apps$.pipe(Mi(e=>Dr([oe(e),this.appDrawerSearchControl.valueChanges.pipe(Yn(""))])),Se(([e,A])=>{if(!e||!A||A.trim()==="")return e;let t=A.toLowerCase().trim();return e.filter(n=>n.toLowerCase().includes(t))}));importSessionEnabledObs=this.featureFlagService.isImportSessionEnabled();isEditFunctionArgsEnabledObs=this.featureFlagService.isEditFunctionArgsEnabled();isSessionUrlEnabledObs=this.featureFlagService.isSessionUrlEnabled();isApplicationSelectorEnabledObs=this.featureFlagService.isApplicationSelectorEnabled();isTokenStreamingEnabledObs=this.featureFlagService.isTokenStreamingEnabled();isExportSessionEnabledObs=this.featureFlagService.isExportSessionEnabled();isNewSessionButtonEnabledObs=this.featureFlagService.isNewSessionButtonEnabled();isEventFilteringEnabled=sr(this.featureFlagService.isEventFilteringEnabled());isApplicationSelectorEnabled=sr(this.featureFlagService.isApplicationSelectorEnabled());isDeleteSessionEnabledObs=this.featureFlagService.isDeleteSessionEnabled();isUserIdOnToolbarEnabledObs=this.featureFlagService.isUserIdOnToolbarEnabled();isDeveloperUiDisclaimerEnabledObs=this.featureFlagService.isDeveloperUiDisclaimerEnabled();disableBuilderSwitch=!1;autoSelectLatestEvent=!1;constructor(){Fn(()=>{this.themeService?.currentTheme()&&this.updateRenderedGraph()})}ngOnInit(){if(this.checkScreenSize(),this.isMobile()?this.showSidePanel=!1:this.showSidePanel=window.localStorage.getItem("adk-side-panel-visible")!=="false",this.syncSelectedAppFromUrl(),this.updateSelectedAppUrl(),this.hideSidePanelIfNeeded(),this.agentService.getVersion().subscribe(t=>{this.adkVersion.set(t.version||""),this.versionInfo.set(t)}),Dr([this.agentService.getApp(),this.activatedRoute.queryParams]).pipe(Bt(([t,n])=>!!t&&!!n[iD]),oo(),Se(([,t])=>t[iD])).subscribe(t=>{setTimeout(()=>{this.userInput=t})}),this.streamChatService.onStreamClose().subscribe(t=>{let n=`Please check server log for full details:
4164`+t;this.openSnackBar(n,"OK")}),this.webSocketService.getMessages().subscribe(t=>{if(t)try{let n=JSON.parse(t);(n.interrupted||n.inputTranscription!==void 0&&n.partial)&&this.audioPlayingService.stopAudio(),this.appendEventRow(n),this.changeDetectorRef.detectChanges()}catch(n){}}),new URL(window.location.href).searchParams.has("code")){let t=window.location.href;window.opener?.postMessage({authResponseUrl:t},window.origin),window.close()}this.agentService.getApp().subscribe(t=>{this.appName=t,this.evalService.metricsInfo.set([])}),this.traceService.selectedTraceRow$.subscribe(t=>{t&&(this.selectedEvent=void 0,this.selectedEventIndex=void 0,this.selectedMessageIndex=void 0,this.showSidePanel||(this.showSidePanel=!0,window.localStorage.setItem("adk-side-panel-visible","true"),this.sideDrawer()?.open()),this.changeDetectorRef.detectChanges())}),this.featureFlagService.isInfinityMessageScrollingEnabled().pipe(oo()).subscribe(t=>{t&&(this.uiStateService.onNewMessagesLoaded().subscribe(n=>{this.populateMessages(n.items,!0,!n.isBackground),this.loadTraceData()}),this.uiStateService.onNewMessagesLoadingFailed().subscribe(n=>{this.openSnackBar(n.message,"OK")}))})}get sessionTab(){return this.drawerSessionTab()}switchToTraceView(){this.onViewModeChange("traces")}ngAfterViewInit(){this.showSidePanel&&this.sideDrawer()?.open(),this.isApplicationSelectorEnabled()||this.loadSessionByUrlOrReset()}selectApp(e){if(this.isLoadedAppUnavailable.set(!1),e!=this.appName){let A=!this.appName;this.agentService.setApp(e),A?this.loadSessionByUrlOrReset():this.createSessionAndReset()}}loadSessionByUrlOrReset(){this.isSessionUrlEnabledObs.subscribe(e=>{let A=this.activatedRoute.snapshot?.queryParams,t=A.session,n=A.userId,o=A.evalCase,a=A.evalResult,r=A.file;if(n&&(this.userId=n),o){this.chatType.set("eval-case");let s=o.split("/");if(s.length===2){let l=s[0],g=s[1];this.evalSetId=l,this.evalService.getEvalCase(this.appName,l,g).subscribe(C=>{C&&(this.updateWithSelectedEvalCase(C),setTimeout(()=>{let d=this.sidePanel();d.switchToEvalTab(),d.selectEvalCase(l,C)},600))})}return}if(a){this.chatType.set("eval-result");let s=a.split("/");if(console.log("loadSessionByUrlOrReset evalResultUrl parts:",s),s.length===3){let l=s[0],g=s[1],C=s[2];this.evalSetId=l;let d=`${this.appName}_${l}_${C}`;console.log("loadSessionByUrlOrReset runId:",d),this.evalService.getEvalResult(this.appName,d).subscribe(B=>{if(console.log("loadSessionByUrlOrReset runResult:",B),B){let u=B.evalCaseResults?.find(E=>E.evalId===g);if(console.log("loadSessionByUrlOrReset evalCaseResult:",u),u){let E=u.sessionId;this.evalService.getEvalCase(this.appName,l,g).subscribe(f=>{this.sessionService.getSession(this.userId,this.appName,E).subscribe(m=>{this.addEvalCaseResultToEvents(m,u);let v={id:m?.id??"",appName:m?.appName??"",userId:m?.userId??"",state:m?.state??[],events:m?.events??[],isEvalResult:!0,evalCase:f,evalCaseResult:u,timestamp:C};this.updateWithSelectedSession(v),setTimeout(()=>{let S=this.sidePanel();S.switchToEvalTab(),S.selectEvalResult(l,C,f)},600)})})}}})}return}if(r){this.chatType.set("file");return}if(!e||!t){this.chatType.set("session"),this.createSessionAndReset();return}t&&(this.chatType.set("session"),this.sessionId=t,this.loadSession(t,!0))})}loadSession(e,A=!1){this.uiStateService.setIsSessionLoading(!0),this.isViewOnlySession.set(!1),this.isViewOnlyAppNameMismatch.set(!1),Dr([this.sessionService.getSession(this.userId,this.appName,e).pipe(aa(t=>(A&&(this.openSnackBar("Cannot find specified session. Creating a new one.",void 0,3e3),this.createSessionAndReset()),oe(null)))),this.featureFlagService.isInfinityMessageScrollingEnabled()]).pipe(oo()).subscribe(([t,n])=>{this.uiStateService.setIsSessionLoading(!1),t&&(n&&t.id&&this.uiStateService.lazyLoadMessages(t.id,{pageSize:100,pageToken:""}).pipe(oo()).subscribe(),this.updateWithSelectedSession(t))})}hideSidePanelIfNeeded(){this.activatedRoute.queryParams.pipe(Bt(e=>e[xkA]==="true"),Ro(1)).subscribe(()=>{this.showSidePanel=!1,this.sideDrawer()?.close()})}createSessionAndReset(){this.resetToNewSession(),this.chatType.set("session"),this.isViewOnlySession.set(!1),this.isViewOnlyAppNameMismatch.set(!1),this.canEditSession.set(!0),this.chatPanel()?.canEditSession?.set(!0),this.eventData=new Map,this.uiEvents.set([]),this.artifacts=[],this.userInput="",this.longRunningEvents=[],this.selectedEvent=void 0,this.selectedEventIndex=void 0,this.selectedMessageIndex=void 0,this.traceService.resetTraceService()}resetToNewSession(){this.sessionId="",this.currentSessionState={},this.sessionTab?.refreshSession(),this.clearSessionUrl()}createSession(){this.uiStateService.setIsSessionListLoading(!0),this.sessionService.createSession(this.userId,this.appName).subscribe(e=>{this.currentSessionState=e.state,this.sessionId=e.id??"",this.sessionTab?.refreshSession(),this.sessionTab?.reloadSession(this.sessionId),this.isSessionUrlEnabledObs.subscribe(A=>{A&&this.updateSelectedSessionUrl()})},()=>{this.uiStateService.setIsSessionListLoading(!1)})}refreshLatestSession(){this.appName&&(this.uiStateService.setIsSessionLoading(!0),this.sessionService.listSessions(this.userId,this.appName).pipe(oo()).subscribe({next:e=>{if(e.items&&e.items.length>0){let t=e.items.sort((n,o)=>{let a=Number(n.lastUpdateTime||0);return Number(o.lastUpdateTime||0)-a})[0];t.id?this.loadSession(t.id):this.uiStateService.setIsSessionLoading(!1)}else this.uiStateService.setIsSessionLoading(!1),this.openSnackBar("No sessions found for this app.","OK");this.sessionTab?.refreshSession()},error:e=>{this.uiStateService.setIsSessionLoading(!1),this.openSnackBar("Failed to refresh sessions.","OK"),console.error("Error listing sessions:",e)}}))}handleChatInput(e){return re(this,null,function*(){if(e.preventDefault(),!this.userInput.trim()&&this.selectedFiles.length<=0||e instanceof KeyboardEvent&&(e.isComposing||e.keyCode===229))return;let A={role:"user",parts:yield this.getUserMessageParts()};this.userInput="",this.selectedFiles=[];let t=this.router.parseUrl(this.location.path());t.queryParams[iD]&&(delete t.queryParams[iD],this.location.replaceState(t.toString())),yield this.sendMessage(A)})}ensureSessionActive(e){return re(this,null,function*(){if(this.sessionId)return!0;try{let A="";e?.parts&&e.parts[0]?.text&&(A=e.parts[0].text,A.length>50&&(A=A.substring(0,47)+"..."));let t=A?{__session_metadata__:{displayName:A}}:void 0,n=yield Zp(this.sessionService.createSession(this.userId,this.appName,t));return this.currentSessionState=n.state||t||{},this.sessionId=n.id??"",this.sessionTab?.refreshSession(),this.sessionTab?.reloadSession(this.sessionId),this.drawerSessionTab()?.refreshSession(),this.drawerSessionTab()?.reloadSession(this.sessionId),this.isSessionUrlEnabledObs.pipe(oo()).subscribe(o=>{o&&this.updateSelectedSessionUrl()}),!0}catch(A){return this.openSnackBar("Failed to create session","OK"),!1}})}sendMessage(e){return re(this,null,function*(){if(!(yield this.ensureSessionActive(e)))return;let t=e.functionCallEventId;t&&delete e.functionCallEventId;let n=`user_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,o={id:n,author:e.role||"user",content:e},a=this.buildUiEventFromEvent(o);this.uiEvents.update(s=>[...s,a]),setTimeout(()=>this.changeDetectorRef.detectChanges(),0),this.eventData.set(n,o),this.eventData=new Map(this.eventData);let r={appName:this.appName,userId:this.userId,sessionId:this.sessionId,newMessage:e,streaming:this.useSse(),stateDelta:this.updatedSessionState()};t&&(r.functionCallEventId=t),this.submitAgentRunRequest(r),this.changeDetectorRef.detectChanges()})}submitAgentRunRequest(e){this.autoSelectLatestEvent=!0,this.activeSseSubscription=this.agentService.runSse(e).subscribe({next:A=>re(this,null,function*(){if(A.error){this.openSnackBar(A.error,"OK");return}this.appendEventRow(A);let t=this.sidePanel().selectedIndex===0;this.autoSelectLatestEvent&&A.id&&t&&this.selectEvent(A.id,void 0,!1),A.actions&&this.processActionStateDelta(A),this.changeDetectorRef.detectChanges()}),error:A=>{this.activeSseSubscription=void 0,console.error("Send message error:",A);let t=String(A);t.includes("aborted")||t.includes("AbortError")||this.openSnackBar(A,"OK")},complete:()=>{this.activeSseSubscription=void 0,this.updatedSessionState()&&(this.currentSessionState=this.updatedSessionState(),this.updatedSessionState.set(null)),this.featureFlagService.isSessionReloadOnNewMessageEnabled().pipe(oo()).subscribe(A=>{A&&this.sessionTab?.reloadSession(this.sessionId)}),this.loadTraceData()}})}handleStopMessage(){this.activeSseSubscription&&(this.activeSseSubscription.unsubscribe(),this.activeSseSubscription=void 0)}appendEventRow(e,A=!1){if(e.inputTranscription!==void 0?e.author="user":e.outputTranscription!==void 0&&(e.author="bot"),e.errorMessage&&e.id&&!this.eventData.has(e.id)&&(this.eventData.set(e.id,e),this.eventData=new Map(this.eventData)),e.id&&!this.eventData.has(e.id)&&(this.eventData.set(e.id,e),this.eventData=new Map(this.eventData)),this.traceService.setEventData(this.eventData),e?.longRunningToolIds&&e.longRunningToolIds.length>0){let t=this.longRunningEvents.length;this.getAsyncFunctionsFromParts(e.longRunningToolIds,e.content.parts,e.invocationId),this.functionCallEventId=e.id;for(let n=t;n<this.longRunningEvents.length;n++){let o=this.longRunningEvents[n].function;if(o.args.authConfig&&o.args.authConfig.exchangedAuthCredential&&o.args.authConfig.exchangedAuthCredential.oauth2){let a=o.args.authConfig.exchangedAuthCredential.oauth2.authUri,r=this.updateRedirectUri(a,this.redirectUri);this.openOAuthPopup(r).then(s=>{this.sendOAuthResponse(o,s,this.redirectUri)}).catch(s=>{console.error("OAuth Error:",s)});break}}}if(e.partial)this.uiEvents.update(t=>{if(t.length>0){let o=t.length-1,a=t[o],r=!!(a.event?.inputTranscription||a.event?.outputTranscription),s=!!(e.inputTranscription||e.outputTranscription);if(a.event?.partial&&a.role===(e.author==="user"?"user":"bot")&&r===s){let l=this.mergePartialEvent(a,e),g=[...t];return g[o]=l,g}}let n=this.buildUiEventFromEvent(e,A);return A?[n,...t]:[...t,n]});else{let t=this.buildUiEventFromEvent(e,A);this.uiEvents.update(n=>{let o=n.findIndex(a=>a.event?.id===e.id&&e.id);if(o<0&&n.length>0){let a=e.inputTranscription!==void 0,r=e.outputTranscription!==void 0,s=e.content?.parts?.some(l=>l.thought);if(a||r||s)if(A)for(let l=0;l<n.length;l++){let g=n[l].event;if(g?.partial){if(a&&g.inputTranscription!==void 0){o=l;break}if(r&&g.outputTranscription!==void 0){o=l;break}if(s&&(n[l].thought||g.content?.parts?.some(C=>C.thought))){o=l;break}}}else for(let l=n.length-1;l>=0;l--){let g=n[l].event;if(g?.partial){if(a&&g.inputTranscription!==void 0){o=l;break}if(r&&g.outputTranscription!==void 0){o=l;break}if(s&&(n[l].thought||g.content?.parts?.some(C=>C.thought))){o=l;break}}}else{let l=A?0:n.length-1,g=n[l];if(g.event?.partial){let C=!!(g.event?.inputTranscription||g.event?.outputTranscription),d=!!(e.inputTranscription||e.outputTranscription);C===d&&(o=l)}}}if(o>=0){let a=n[o];(!t.functionResponses||t.functionResponses.length===0)&&(t.functionResponses=a.functionResponses),(!t.functionCalls||t.functionCalls.length===0)&&(t.functionCalls=a.functionCalls);let r=[...n];return r[o]=t,r}else return A?[t,...n]:[...n,t]})}if(e.actions?.artifactDelta){let t=this.uiEvents().find(n=>n.event?.id===e.id);if(t)for(let n in e.actions.artifactDelta)e.actions.artifactDelta.hasOwnProperty(n)&&this.renderArtifact(n,e.actions.artifactDelta[n],t)}}mergePartialEvent(e,A){let t=new su($A(P({},e),{event:A,textParts:e.textParts?e.textParts.map(o=>P({},o)):void 0})),n=A.content?.parts||[];if(this.isEventA2aResponse(A)&&(n=this.combineA2uiDataParts(n)),n=this.combineTextParts(n),n.forEach(o=>{if(o.text!==void 0&&o.text!==null){let a=o.thought?this.processThoughtText(o.text):o.text;t.text=(t.text||"")+a;let r=!!o.thought;this.addTextToParts(t,a,r)}else this.processPartIntoMessage(o,A,t)}),t.thought=t.textParts?.every(o=>o.thought)??!1,A.inputTranscription){let o=e.event?.inputTranscription?.text||"";t.event.inputTranscription={text:o+(A.inputTranscription.text||"")}}if(A.outputTranscription){let o=e.event?.outputTranscription?.text||"";t.event.outputTranscription={text:o+(A.outputTranscription.text||"")}}return t}getUserMessageParts(){return re(this,null,function*(){let e=[];if(this.userInput.trim()&&e.push({text:`${this.userInput}`}),this.selectedFiles.length>0)for(let A of this.selectedFiles)e.push(yield this.localFileService.createMessagePartFromFile(A.file));return e})}processActionStateDelta(e){e.actions&&e.actions.stateDelta&&Object.keys(e.actions.stateDelta).length>0&&(this.currentSessionState=P(P({},this.currentSessionState||{}),e.actions.stateDelta))}combineTextParts(e){let A=[],t;for(let n of e)if(n.text){let o=!!n.thought;t&&t.text&&!!t.thought===o?t.text+=n.text:(t={text:n.text,thought:o},A.push(t))}else t=void 0,A.push(n);return A}isEventA2aResponse(e){return!!e?.customMetadata?.["a2a:response"]}isA2aDataPart(e){if(!e.inlineData||e.inlineData.mimeType!=="text/plain")return!1;let A=atob(oN(e.inlineData.data));return A.startsWith(iN)&&A.endsWith(nN)}isA2uiDataPart(e){let A=this.extractA2aDataPartJson(e);return A&&A.kind==="data"&&A.metadata?.mimeType===H$}extractA2aDataPartJson(e){if(!this.isA2aDataPart(e))return null;let A=atob(oN(e.inlineData.data)),t=A.substring(iN.length,A.length-nN.length),n;try{n=JSON.parse(t)}catch(o){return null}return n}combineA2uiDataParts(e){let A=[],t=[],n;for(let o of e)this.isA2uiDataPart(o)?(t.push(this.extractA2aDataPartJson(o)),n||(n={inlineData:{mimeType:"text/plain",data:o.inlineData.data}},A.push(n))):A.push(o);if(n?.inlineData){let a=iN+JSON.stringify({kind:"data",metadata:{mimeType:H$},data:t})+nN;n.inlineData.data=btoa(a)}return A}processA2uiPartIntoMessage(e){let A={};return e.a2ui.forEach(t=>{t.data.beginRendering?A.beginRendering=t.data:t.data.surfaceUpdate?A.surfaceUpdate=t.data:t.data.dataModelUpdate&&(A.dataModelUpdate=t.data)}),A}extractA2uiJsonFromText(e){if(!e.text)return;let A="<a2ui-json>",t="</a2ui-json>",n=e.text.indexOf(A);if(n===-1)return;let o=e.text.indexOf(t,n+A.length);if(o===-1)return;let a=e.text.substring(n+A.length,o).trim();try{let r=JSON.parse(a);Array.isArray(r)||(r=[r]);let s={};r.forEach(C=>{C.beginRendering?s.beginRendering=C:C.surfaceUpdate?s.surfaceUpdate=C:C.dataModelUpdate&&(s.dataModelUpdate=C)}),e.a2uiData=s;let l=e.text.substring(0,n),g=e.text.substring(o+t.length);if(e.text=(l+g).trim(),e.textParts){for(let C of e.textParts){let d=C.text.indexOf(A);if(d!==-1){let B=C.text.indexOf(t,d+A.length);if(B!==-1){let u=C.text.substring(0,d),E=C.text.substring(B+t.length);C.text=(u+E).trim()}}}e.textParts=e.textParts.filter(C=>C.text.trim().length>0)}}catch(r){console.warn("Failed to parse inline <a2ui-json> block from text:",r)}}updateRedirectUri(e,A){try{let t=new URL(e);return t.searchParams.set("redirect_uri",A),t.toString()}catch(t){return console.warn("Failed to update redirect URI: ",t),e}}formatBase64Data(e,A){let t=oN(e);return`data:${A};base64,${t}`}addTextToParts(e,A,t){if(!A)return;e.textParts||(e.textParts=[]);let n=e.textParts[e.textParts.length-1];n&&!!n.thought===t?n.text+=A:e.textParts.push({text:A,thought:t})}processPartIntoMessage(e,A,t){if(e)if(A&&(t.event=A,A.invocationIndex!==void 0&&(t.invocationIndex=A.invocationIndex),A.toolUseIndex!==void 0&&(t.toolUseIndex=A.toolUseIndex),A.finalResponsePartIndex!==void 0&&(t.finalResponsePartIndex=A.finalResponsePartIndex)),e.text){let n=e.thought?this.processThoughtText(e.text):e.text;t.text=(t.text||"")+n,this.addTextToParts(t,n,!!e.thought),t.thought=t.textParts?.every(o=>o.thought)??!1,A?.groundingMetadata&&A.groundingMetadata.searchEntryPoint&&A.groundingMetadata.searchEntryPoint.renderedContent&&(t.renderedContent=A.groundingMetadata.searchEntryPoint.renderedContent),A?.id&&(t.event=A)}else if(e.inlineData){let n=this.formatBase64Data(e.inlineData.data,e.inlineData.mimeType),o=I6(e.inlineData.mimeType);t.inlineData={displayName:e.inlineData.displayName,data:n,mimeType:e.inlineData.mimeType,mediaType:o},t.role==="user"&&A?.id&&(t.event=A)}else if(e.functionCall){t.functionCalls||(t.functionCalls=[]);let n=A?.longRunningToolIds?.includes(e.functionCall.id),o=e.functionCall;n&&(o=$A(P({},e.functionCall),{isLongRunning:!0,invocationId:A.invocationId,functionCallEventId:A.id,needsResponse:!0,responseStatus:e.functionCall.responseStatus||"pending",userResponse:e.functionCall.userResponse||""}));let a=t.functionCalls.findIndex(r=>r.id===e.functionCall.id);a>=0?t.functionCalls[a]=P(P({},t.functionCalls[a]),o):t.functionCalls.push(o),A?.id&&(t.event=A)}else e.functionResponse?(t.functionResponses||(t.functionResponses=[]),t.functionResponses.push(e.functionResponse),A?.id&&(t.event=A)):e.executableCode?t.executableCode=e.executableCode:e.codeExecutionResult?t.codeExecutionResult=e.codeExecutionResult:e.a2ui&&(t.a2uiData=this.processA2uiPartIntoMessage(e))}handleArtifactFetchFailure(e,A,t,n){this.openSnackBar("Failed to fetch artifact data","OK"),e.error={errorMessage:"Failed to fetch artifact data"+(n?": "+(n.message||n):"")},this.changeDetectorRef.detectChanges(),this.artifacts=this.artifacts.filter(o=>o.id!==A||o.versionId!==t)}renderArtifact(e,A,t){if(this.artifacts.some(a=>a.id===e&&a.versionId===A))return;t.inlineData={data:"",mimeType:"image/png"};let o={id:e,versionId:A,data:"",mimeType:"image/png",mediaType:"image"};this.artifacts=[...this.artifacts,o],this.artifactService.getArtifactVersion(this.userId,this.appName,this.sessionId,e,A).subscribe({next:a=>{let r=a.mimeType,s=a.data;if((!r||!s)&&a.inlineData&&(r=a.inlineData.mimeType,s=a.inlineData.data),!r&&!s&&a.text){r="text/plain";try{s=btoa(unescape(encodeURIComponent(a.text)))}catch(d){console.error("Failed to encode text to base64",d),this.handleArtifactFetchFailure(t,e,A,{message:"Failed to encode text data"});return}}if(!r||!s){this.handleArtifactFetchFailure(t,e,A,{message:"Invalid response data: missing mimeType or data or text"});return}let l=this.formatBase64Data(s,r),g=I6(r),C={name:this.createDefaultArtifactName(r),data:l,mimeType:r,mediaType:g};t.inlineData=C,this.changeDetectorRef.detectChanges(),this.artifacts=this.artifacts.map(d=>d.id===e&&d.versionId===A?{id:e,versionId:A,data:l,mimeType:r,mediaType:g}:d)},error:a=>{this.handleArtifactFetchFailure(t,e,A,a)}})}sendOAuthResponse(e,A,t){this.longRunningEvents.pop();var n=structuredClone(e.args.authConfig);n.exchangedAuthCredential.oauth2.authResponseUri=A,n.exchangedAuthCredential.oauth2.redirectUri=t;let o={role:"user",parts:[{functionResponse:{id:e.id,name:e.name,response:n}}],functionCallEventId:this.functionCallEventId};this.sendMessage(o)}clickEvent(e){let A=this.uiEvents()[e],t=A.event.id;if(t){if(this.selectedMessageIndex===e){this.sideDrawer()?.open(),this.showSidePanel=!0,window.localStorage.setItem("adk-side-panel-visible","true");return}if(A.role==="user"){this.selectedEvent=this.eventData.get(t),this.selectedEventIndex=this.getIndexOfKeyInMap(t),this.selectedMessageIndex=e,this.llmRequest=void 0,this.llmResponse=void 0,this.sideDrawer()?.open(),this.showSidePanel=!0,window.localStorage.setItem("adk-side-panel-visible","true"),this.updateRenderedGraph(),this.viewMode()!=="events"&&this.onViewModeChange("events");return}this.sideDrawer()?.open(),this.showSidePanel=!0,window.localStorage.setItem("adk-side-panel-visible","true"),this.selectEvent(t,e)}}handleJumpToInvocation(e){let A=this.uiEvents(),t=-1,n=-1;for(let o=0;o<A.length;o++){let a=A[o];if(a.role==="user"&&(n=o),a.event?.invocationId===e){n!==-1&&(t=n);break}}t!==-1&&(this.clickEvent(t),setTimeout(()=>{this.chatPanel()?.scrollToSelectedMessage(t)},100))}ngOnDestroy(){this.handleStopMessage(),this.streamChatService.closeStream()}onAppSelection(e){this.isAudioRecording&&(this.stopAudioRecording(),this.isAudioRecording=!1),this.isVideoRecording&&(this.stopVideoRecording(),this.isVideoRecording=!1),this.evalTab()?.resetEvalResults(),this.traceData=[]}toggleAudioRecording(e){return re(this,null,function*(){this.isAudioRecording?this.stopAudioRecording():yield this.startAudioRecording(e)})}startAudioRecording(e){return re(this,null,function*(){if(this.sessionId&&this.sessionHasUsedBidi.has(this.sessionId)){this.openSnackBar(RkA,"OK");return}(yield this.ensureSessionActive())&&(this.isAudioRecording=!0,this.streamChatService.startAudioChat({appName:this.appName,userId:this.userId,sessionId:this.sessionId,flags:e}),this.sessionHasUsedBidi.add(this.sessionId))})}stopAudioRecording(){this.audioPlayingService.stopAudio(),this.streamChatService.stopAudioChat(),this.isAudioRecording=!1,this.isVideoRecording&&this.stopVideoRecording()}toggleVideoRecording(){this.isVideoRecording?this.stopVideoRecording():this.startVideoRecording()}startVideoRecording(){let e=this.chatPanel()?.videoContainer;e&&(this.isVideoRecording=!0,this.streamChatService.startVideoStreaming(e))}stopVideoRecording(){let e=this.chatPanel()?.videoContainer;e&&(this.streamChatService.stopVideoStreaming(e),this.isVideoRecording=!1)}getAsyncFunctionsFromParts(e,A,t){for(let n of A)n.functionCall&&e.includes(n.functionCall.id)&&this.longRunningEvents.push({function:n.functionCall,invocationId:t})}openOAuthPopup(e){return new Promise((A,t)=>{if(!this.safeValuesService.windowOpen(window,e,"oauthPopup","width=600,height=700")){t("Popup blocked!");return}let o=a=>{if(a.origin!==window.location.origin)return;let{authResponseUrl:r}=a.data;r?(A(r),window.removeEventListener("message",o)):console.log("OAuth failed",a)};window.addEventListener("message",o)})}toggleSidePanel(){this.showSidePanel?(this.sideDrawer()?.close(),this.selectedEvent=void 0,this.selectedEventIndex=void 0,this.selectedMessageIndex=void 0):this.sideDrawer()?.open(),this.showSidePanel=!this.showSidePanel,window.localStorage.setItem("adk-side-panel-visible",this.showSidePanel.toString())}toggleAppSelectorDrawer(){this.showSessionSelectorDrawer=!1,this.showAppSelectorDrawer=!this.showAppSelectorDrawer,this.showAppSelectorDrawer&&this.appDrawerSearchControl.setValue("")}onSelectorDrawerOpened(){this.showAppSelectorDrawer&&this.appSearchInput()?.nativeElement.focus()}handleAppSearchKeydown(e){if(e.key==="ArrowDown"){e.preventDefault(),e.stopPropagation();let A=this.document.querySelector(".app-selector-list .app-selector-item");A&&A.focus()}}handleAppListKeydown(e){if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.stopPropagation();let A=Array.from(this.document.querySelectorAll(".app-selector-list .app-selector-item")),t=A.indexOf(this.document.activeElement);if(t>-1){if(e.preventDefault(),e.key==="ArrowDown"){let n=t+1;n<A.length&&A[n].focus()}else if(e.key==="ArrowUp"){let n=t-1;n>=0?A[n].focus():this.appSearchInput()?.nativeElement.focus()}}}onAppSelectorDrawerClosed(){this.showAppSelectorDrawer=!1}toggleSessionSelectorDrawer(){this.showAppSelectorDrawer=!1,this.showSessionSelectorDrawer=!this.showSessionSelectorDrawer}onSessionSelectorDrawerClosed(){this.showSessionSelectorDrawer=!1}onSelectorDrawerClosed(){this.showAppSelectorDrawer=!1,this.showSessionSelectorDrawer=!1}onSessionSelectedFromDrawer(e){this.showSessionSelectorDrawer=!1,this.loadSession(e)}onSessionReloadedFromDrawer(e){this.loadSession(e)}selectAppFromDrawer(e){this.selectedAppControl.setValue(e),this.showAppSelectorDrawer=!1}handleTabChange(e){this.canChat()||(this.resetEditEvalCaseVars(),this.handleReturnToSession(!0))}handleReturnToSession(e){this.sessionTab?.getSession(this.sessionId),this.evalTab()?.resetEvalCase(),this.chatType.set("session")}handleEvalNotInstalled(e){e&&this.openSnackBar(e,"OK")}resetEventsAndMessages({keepMessages:e}={}){e||(this.eventData.clear(),this.uiEvents.set([]),this.selectedEvent=void 0,this.selectedEventIndex=void 0,this.selectedMessageIndex=void 0),this.artifacts=[]}loadTraceData(){this.sessionId&&(this.uiStateService.setIsEventRequestResponseLoading(!0),this.eventService.getTrace(this.appName,this.sessionId).pipe(oo(),aa(e=>(console.error("[DEBUG] getTrace error:",e),oe([])))).subscribe(e=>{this.traceData=e,this.updateSystemInstructionFlags(),this.traceService.setEventData(this.eventData),this.traceService.setMessages(this.uiEvents()),this.selectedEvent&&this.populateLlmRequestResponse(),this.uiStateService.setIsEventRequestResponseLoading(!1),this.changeDetectorRef.detectChanges()}),this.changeDetectorRef.detectChanges())}updateSystemInstructionFlags(){if(!this.traceData||this.traceData.length===0||this.eventData.size===0)return;let e=n=>{let o=[];for(let a of n)o.push(a),a.children&&(o=o.concat(e(a.children)));return o},t=e(this.traceData).filter(n=>{let o=n.attrOperationName===hI,a=n.name==="call_llm";return(o||a)&&n.io?.inputs!==void 0}).sort((n,o)=>(n.start_time||0)-(o.start_time||0));for(let n of this.eventData.values())n.systemInstructionChanged=!1,n.precedingSystemInstruction=void 0,n.currentSystemInstruction=void 0;for(let n=1;n<t.length;n++){let o=t[n],a=t[n-1],r=tN(o.io?.inputs),s=tN(a.io?.inputs);if(r&&s&&r!==s){let l=o.attrEventId;if(l){let g=this.eventData.get(l);g&&(g.systemInstructionChanged=!0,g.precedingSystemInstruction=s,g.currentSystemInstruction=r)}}}}buildUiEventFromEvent(e,A=!1){let t=this.isEventA2aResponse(e),n=t?this.combineA2uiDataParts(e.content?.parts):e.content?.parts||[],o=this.combineTextParts(n),a=A?[...o].reverse():o,r=e.author==="user"?"user":"bot",s=new su({role:r,event:e});return(e.errorCode||e.errorMessage)&&(s.error={errorCode:e.errorCode,errorMessage:e.errorMessage}),e.inputTranscription!==void 0&&typeof e.inputTranscription=="string"&&(s.event.inputTranscription={text:e.inputTranscription}),e.outputTranscription!==void 0&&typeof e.outputTranscription=="string"&&(s.event.outputTranscription={text:e.outputTranscription}),a.forEach(l=>{r==="bot"&&t&&this.isA2uiDataPart(l)&&(l={a2ui:this.extractA2aDataPartJson(l).data}),this.processPartIntoMessage(l,e,s)}),this.extractA2uiJsonFromText(s),s}populateMessages(e,A=!1,t=!1){this.resetEventsAndMessages({keepMessages:t&&this.sessionIdOfLoadedMessages===this.sessionId}),e.forEach(n=>{this.appendEventRow(n,A)}),this.sessionIdOfLoadedMessages=this.sessionId}restorePendingLongRunningCalls(){let e=this.uiEvents(),A=new Set;this.uiEvents().forEach(t=>{t.functionResponses&&t.functionResponses.forEach(n=>{n.id&&A.add(n.id)})}),this.uiEvents().forEach(t=>{t.functionCalls&&t.functionCalls.forEach(n=>{let o=t.event.id?this.eventData.get(t.event.id):null;(n.isLongRunning||o?.longRunningToolIds?.includes(n.id))&&!A.has(n.id)&&(n.isLongRunning=!0,n.invocationId=o?.invocationId,n.functionCallEventId=t.event.id||"",n.needsResponse=!0,n.responseStatus="pending",n.userResponse=n.userResponse||"")})})}updateWithSelectedSession(e){if(!(!e||!e.id)){if(this.traceService.resetTraceService(),this.traceData=[],this.sessionId=e.id,this.currentSessionState=e.state||{},this.evalCase=null,this.resetEventsAndMessages(),e.isEvalResult){this.isViewOnlySession.set(!0),this.readonlySessionType.set("Eval Result");let A=e.evalCase?.evalId,t=e.timestamp;this.currentEvalCaseId=A,this.currentEvalTimestamp=t;let n=t;if(t){let o=Number(t);isNaN(o)||(n=new Date(o*1e3).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}))}this.readonlySessionName.set(A&&n?`${n} > ${A}`:e.id),this.canEditSession.set(!1),this.chatPanel()?.canEditSession?.set(!1)}else this.isViewOnlySession.set(!1);e.evalCase?this.expectedUiEvents.set(this.buildUiEventsFromEvalCase(e.evalCase)):this.expectedUiEvents.set([]),e.evalCaseResult?this.evalCaseResult.set(e.evalCaseResult):this.evalCaseResult.set(null),e.isEvalResult?this.chatType.set("eval-result"):(this.chatType.set("session"),this.isSideBySide.set(!1)),this.isSessionUrlEnabledObs.subscribe(A=>{A&&this.updateSelectedSessionUrl()}),e.events&&e.state&&(e.events.forEach(A=>{this.appendEventRow(A,!1)}),this.restorePendingLongRunningCalls()),this.changeDetectorRef.detectChanges(),this.loadTraceData(),e.isEvalResult||this.sessionService.canEdit(this.userId,e).pipe(oo(),aa(()=>oe(!0))).subscribe(A=>{this.chatPanel()?.canEditSession?.set(A),this.canEditSession.set(A)}),this.featureFlagService.isInfinityMessageScrollingEnabled().pipe(oo()).subscribe(A=>{A||this.populateMessages(e.events||[]),this.loadTraceData()})}}formatToolUses(e){if(!e||!Array.isArray(e))return[];let A=[];for(let t of e)A.push({name:t.name,args:t.args});return A}addEvalCaseResultToEvents(e,A){let t=A.evalMetricResultPerInvocation,n=-1;if(t)for(let o=0;o<e.events.length;o++){let a=e.events[o];if(a.author==="user")n++;else{let r=t[n],s=1,l="",g=1,C=1;if(r&&r.evalMetricResults){for(let d of r.evalMetricResults)if(d.evalStatus===2){s=2,l=d.metricName,g=d.score,C=d.threshold;break}}a.evalStatus=s,r&&(o===e.events.length-1||e.events[o+1].author==="user")&&this.addEvalFieldsToBotEvent(a,r,l,g,C)}}return e}addEvalFieldsToBotEvent(e,A,t,n,o){e.failedMetric=t,e.evalScore=n,e.evalThreshold=o,e.failedMetric==="tool_trajectory_avg_score"?(e.actualInvocationToolUses=this.formatToolUses(A.actualInvocation.intermediateData.toolUses),e.expectedInvocationToolUses=this.formatToolUses(A.expectedInvocation.intermediateData.toolUses)):e.failedMetric==="response_match_score"&&(e.actualFinalResponse=A.actualInvocation.finalResponse.parts[0].text,e.expectedFinalResponse=A.expectedInvocation.finalResponse.parts[0]?.text)}updateWithSelectedTest(e,A){this.traceService.resetTraceService(),this.traceData=[],this.isViewOnlySession()||(this.originalSessionId=this.sessionId),this.readonlySessionType.set("Test Case"),this.readonlySessionName.set(e),this.sessionId=e,this.currentSessionState={},this.evalCase=null,this.chatType.set("session"),this.resetEventsAndMessages(),A.forEach(t=>{this.appendEventRow(t,!1)}),this.canEditSession.set(!1),this.chatPanel()?.canEditSession?.set(!1),this.isViewOnlySession.set(!0),this.changeDetectorRef.detectChanges()}buildUiEventsFromEvalCase(e){let A=this.uiEvents(),t=this.eventData,n=this.chatType(),o=this.isViewOnlySession(),a=this.readonlySessionType(),r=this.readonlySessionName();this.uiEvents.set([]),this.eventData=new Map,this.updateWithSelectedEvalCase(e);let s=this.uiEvents();return this.uiEvents.set(A),this.eventData=t,this.chatType.set(n),this.isViewOnlySession.set(o),this.readonlySessionType.set(a),this.readonlySessionName.set(r),s}updateWithSelectedEvalCase(e){if(this.evalCase=e,this.chatType.set("eval-case"),this.isViewOnlySession.set(!0),this.readonlySessionType.set("Eval Case"),this.readonlySessionName.set(e.evalId),this.chatType.set("eval-case"),this.isSessionUrlEnabledObs.subscribe(A=>{A&&this.updateSelectedSessionUrl()}),this.resetEventsAndMessages(),e.events&&e.events.length>0)for(let A of e.events)this.appendEventRow(A,!1);else{e.events=[];let A=0;for(let t of e.conversation){if(t.userContent?.parts&&e.events.push({author:"user",content:t.userContent,invocationIndex:A}),t.intermediateData?.invocationEvents){let n=0;for(let o of t.intermediateData.invocationEvents)o.invocationIndex=A,o.content?.parts?.[0]?.functionCall&&(o.toolUseIndex=n,n++),e.events.push(o)}else if(t.intermediateData?.toolUses){let n=0;for(let o of t.intermediateData.toolUses)e.events.push({author:"bot",content:{parts:[{functionCall:{name:o.name,args:o.args}}]},invocationIndex:A,toolUseIndex:n}),n++,e.events.push({author:"bot",content:{parts:[{functionResponse:{name:o.name}}]},invocationIndex:A})}t.finalResponse?.parts&&e.events.push({author:"bot",content:t.finalResponse,invocationIndex:A}),A++}for(let t of e.events)this.appendEventRow(t,!1)}}handleEditEvalCaseRequested(e){this.updateWithSelectedEvalCase(e),this.editEvalCase()}updateSelectedEvalSetId(e){this.evalSetId=e}editEvalCaseMessage(e){this.isEvalCaseEditing.set(!0),this.userEditEvalCaseMessage=e.text,e.isEditing=!0,setTimeout(()=>{let A=this.chatPanel()?.textarea?.nativeElement;if(!A)return;A.focus();let t=A.value.length;e.text.charAt(t-1)===`
4165`&&t--,A.setSelectionRange(t,t)},0)}editFunctionArgs(e){this.isEvalCaseEditing.set(!0),this.dialog.open(CI,{maxWidth:"90vw",maxHeight:"90vh",data:{dialogHeader:"Edit function arguments",functionName:e.functionCall.name,jsonContent:e.functionCall.args}}).afterClosed().subscribe(t=>{this.isEvalCaseEditing.set(!1),t&&(this.hasEvalCaseChanged.set(!0),e.functionCall.args=t,this.updatedEvalCase=structuredClone(this.evalCase),this.updatedEvalCase.conversation[e.invocationIndex].intermediateData.toolUses[e.toolUseIndex].args=t)})}saveEvalCase(){this.evalService.updateEvalCase(this.appName,this.evalSetId,this.updatedEvalCase.evalId,this.updatedEvalCase).subscribe(e=>{this.openSnackBar("Eval case updated","OK"),this.resetEditEvalCaseVars()})}cancelEditEvalCase(){this.resetEditEvalCaseVars(),this.updateWithSelectedEvalCase(this.evalCase)}resetEditEvalCaseVars(){this.hasEvalCaseChanged.set(!1),this.isEvalCaseEditing.set(!1),this.isEvalEditMode.set(!1),this.updatedEvalCase=null}cancelEditMessage(e){e.isEditing=!1,this.isEvalCaseEditing.set(!1)}saveEditMessage(e){this.hasEvalCaseChanged.set(!0),this.isEvalCaseEditing.set(!1),e.isEditing=!1,e.text=this.userEditEvalCaseMessage?this.userEditEvalCaseMessage:" ",this.updatedEvalCase=structuredClone(this.evalCase),this.updatedEvalCase.conversation[e.invocationIndex].finalResponse.parts[e.finalResponsePartIndex]={text:this.userEditEvalCaseMessage},this.userEditEvalCaseMessage=""}handleKeydown(e,A){e.key==="Enter"&&!e.shiftKey?(e.preventDefault(),this.saveEditMessage(A)):e.key==="Escape"&&this.cancelEditMessage(A)}deleteEvalCaseMessage(e,A){this.hasEvalCaseChanged.set(!0),this.uiEvents.update(t=>t.filter((n,o)=>o!==A)),this.updatedEvalCase=structuredClone(this.evalCase),this.updatedEvalCase.conversation[e.invocationIndex].finalResponse.parts.splice(e.finalResponsePartIndex,1)}editEvalCase(){this.isEvalEditMode.set(!0),this.isViewOnlySession.set(!1)}deleteEvalCase(){let e={title:"Confirm delete",message:`Are you sure you want to delete ${this.evalCase.evalId}?`,confirmButtonText:"Delete",cancelButtonText:"Cancel"};this.dialog.open(Mc,{width:"600px",data:e}).afterClosed().subscribe(t=>{t&&(this.evalTab()?.deleteEvalCase(this.evalCase.evalId),this.openSnackBar("Eval case deleted","OK"))})}onNewSessionClick(){this.resetToNewSession(),this.eventData.clear(),this.uiEvents.set([]),this.artifacts=[],this.traceData=[],this.selectedEvent=void 0,this.selectedEventIndex=void 0,this.selectedMessageIndex=void 0,this.traceService.resetTraceService(),this.chatPanel()?.focusInput(),this.evalTab()?.showEvalHistory&&this.evalTab()?.toggleEvalHistoryButton()}getToolbarSessionId(){if(!this.sessionId)return"NEW SESSION";if(this.isViewOnlySession())return this.sessionId;let e=this.currentSessionState?.__session_metadata__;return e?.displayName?e.displayName:this.sessionId}getCurrentSessionDisplayName(){return this.sessionId?this.currentSessionState?.__session_metadata__?.displayName||this.sessionId:"NEW SESSION"}copySessionId(){return re(this,null,function*(){if(this.sessionId)try{yield navigator.clipboard.writeText(this.sessionId),this.openSnackBar(this.i18n.sessionIdCopiedMessage,"OK")}catch(e){this.openSnackBar(this.i18n.copySessionIdFailedMessage,"OK")}})}saveSessionName(e){if(!this.sessionId)return;let A={__session_metadata__:$A(P({},this.currentSessionState?.__session_metadata__||{}),{displayName:e})};this.currentSessionState=P(P({},this.currentSessionState),A),this.updatedSessionState.set(P(P({},this.updatedSessionState()),A)),this.sessionService.updateSession(this.userId,this.appName,this.sessionId,{stateDelta:A}).subscribe({next:()=>{this.sessionTab&&this.sessionTab.reloadSession(this.sessionId),this.drawerSessionTab()&&this.drawerSessionTab().reloadSession(this.sessionId)}})}get sessionDisplayNameDraft(){return this.currentSessionState?.__session_metadata__?.displayName||""}saveUserId(e){if(e=e.trim(),!e){this.openSnackBar(this.i18n.invalidUserIdMessage,"OK");return}this.userId=e,this.isSessionUrlEnabledObs.pipe(Ro(1)).subscribe(A=>{A&&this.updateSelectedSessionUrl()})}onFileSelect(e){let A=e.target;if(A.files)for(let t=0;t<A.files.length;t++){let n=A.files[t],o=this.safeValuesService.createObjectUrl(n);this.selectedFiles.push({file:n,url:o})}A.value=""}removeFile(e){URL.revokeObjectURL(this.selectedFiles[e].url),this.selectedFiles.splice(e,1)}toggleSse(){this.useSse.set(!this.useSse()),window.localStorage.setItem("adk-use-sse",String(this.useSse()))}enterBuilderMode(){let e=this.router.createUrlTree([],{queryParams:{mode:"builder"},queryParamsHandling:"merge"}).toString();this.location.replaceState(e),this.isBuilderMode.set(!0),this.appName&&this.loadExistingAgentConfiguration()}loadExistingAgentConfiguration(){this.agentService.getAgentBuilderTmp(this.appName).subscribe({next:e=>{e&&this.canvasComponent()?.loadFromYaml(e,this.appName)},error:e=>{console.error("Error loading agent configuration:",e),this.openSnackBar("Error loading agent configuration","OK")}})}exitBuilderMode(){let e=this.router.createUrlTree([],{queryParams:{mode:null},queryParamsHandling:"merge"}).toString();this.location.replaceState(e),this.isBuilderMode.set(!1),this.agentBuilderService.clear()}toggleBuilderAssistant(){this.showBuilderAssistant=!this.showBuilderAssistant}openAddItemDialog(){this.apps$.pipe(Ro(1)).subscribe(e=>{let A=this.dialog.open(l6,{width:"600px",data:{existingAppNames:e??[]}})})}eventGraphSvgLight={};eventGraphSvgDark={};selectedEventGraphPath="";showAgentStructureOverlay=!1;agentStructureOverlayMode="session";openAgentStructureGraphDialog(e="session"){this.agentStructureOverlayMode=e,this.showAgentStructureOverlay=!0}saveAgentBuilder(){this.canvasComponent()?.saveAgent(this.appName)}onEventTabDrillDown(e){this.updateRenderedGraph(void 0,e)}updateRenderedGraph(e,A){return re(this,null,function*(){let t=this.sessionGraphSvgLight,n=this.sessionGraphSvgDark;if(Object.keys(t).length===0||Object.keys(n).length===0){this.renderedEventGraph=void 0;return}let o=e||this.selectedEvent?.nodeInfo?.path;!e&&this.selectedEvent?.author==="user"&&(o="__START__");let a=o;o&&o!=="__START__"&&(a=o.split("/").map(m=>m.split("@")[0]).join("/"));let r=A!==void 0?A:"",s="";if(a&&A===void 0){let m=a.split("/");if(s=m[m.length-1],m.length>=2&&m[m.length-1]==="call_llm"&&m[m.length-2]===this.selectedEvent?.author?(s=m[m.length-2],r=m.slice(1,-2).join("/")):r=m.slice(1,-1).join("/"),r&&!(r in t&&!(r in this.dynamicGraphDot))){let S=this.tryGenerateDynamicGraph(r);if(S&&this.dynamicGraphDot[r]!==S)try{let k=yield this.graphService.render(S);this.sessionGraphSvgLight[r]=k,this.sessionGraphSvgDark[r]=k,this.dynamicGraphDot[r]=S}catch(k){console.error("Failed to render dynamic graph",k)}}for(;r&&!(r in t);){let v=r.split("/");v.pop(),r=v.join("/")}}let l=this.sessionGraphDot[r]||this.sessionGraphDot[""]||"",g=l,C=!1;if(this.selectedEvent){let m=this.getV1HighlightPairs(this.selectedEvent);for(let[v,S]of m)if(v&&S&&S===this.selectedEvent.author){let k=new RegExp(`("${S}"|${S})\\s*->\\s*("${v}"|${v})`,"g");k.test(l)&&(g=l.replace(k,"$& [dir=back]"),C=!0)}}let d="",B="";if(C)try{d=yield this.graphService.render(g),B=d}catch(m){console.error("Failed to render modified graph",m),d=t[r]||t[""]||"",B=n[r]||n[""]||""}else d=t[r]||t[""]||"",B=n[r]||n[""]||"";if(this.selectedEvent){let m=this.getV1HighlightPairs(this.selectedEvent);m.length>0&&(d=this.applyV1Highlighting(d,m,!1),B=this.applyV1Highlighting(B,m,!0))}let u=[],E=[];if(this.selectedEventIndex!==void 0){let m=Array.from(this.eventData.values()),S=m[this.selectedEventIndex]?.invocationId;for(let k=0;k<m.length;k++){let M=m[k];if(S&&M.invocationId!==S)continue;let x=M.nodeInfo?.path;M.author==="user"&&(x="__START__");let F=x;if(x&&x!=="__START__"&&(F=x.split("/").map(z=>z.split("@")[0]).join("/")),F){let z=F.split("/"),j=z[z.length-1],X="";z.length>=2&&z[z.length-1]==="call_llm"&&z[z.length-2]===M.author?(j=z[z.length-2],X=z.slice(1,-2).join("/")):X=z.slice(1,-1).join("/");let eA=r in this.dynamicGraphDot,Z=x?x.split("/"):[],CA=Z.length>0?Z[Z.length-1]:"",wA=eA?CA:j;X===r&&(k<=this.selectedEventIndex&&(u.length===0||u[u.length-1]!==wA)&&u.push(wA),(E.length===0||E[E.length-1]!==wA)&&E.push(wA))}}}if(this.selectedEvent){let m=this.getV1HighlightPairs(this.selectedEvent);for(let[v,S]of m)S&&S!==""&&(E.includes(S)||E.push(S),u.includes(S)||u.push(S)),v&&v!==""&&(E.includes(v)||E.push(v),u.includes(v)||u.push(v))}E.length>0&&d&&B&&(d=this.highlightExecutionPathInSvg(d,u,E,"light"),B=this.highlightExecutionPathInSvg(B,u,E,"dark")),this.selectedEventGraphPath=r,this.eventGraphSvgLight=$A(P({},t),{[r]:d}),this.eventGraphSvgDark=$A(P({},n),{[r]:B});let f=this.themeService?.currentTheme()==="dark"?B:d;this.rawSvgString=f,this.renderedEventGraph=this.safeValuesService.bypassSecurityTrustHtml(f),this.changeDetectorRef.detectChanges()})}tryGenerateDynamicGraph(e){let A=Array.from(this.eventData.values()),t=[];for(let l of A){let g=l.nodeInfo?.path;if(!g)continue;let C=g.split("/"),d=C.map(u=>u.split("@")[0]),B="";if(d.length>=2&&d[d.length-1]==="call_llm"&&d[d.length-2]===l.author?B=d.slice(1,-2).join("/"):B=d.slice(1,-1).join("/"),B===e){let u=C[C.length-1];t.push({run:u,branch:l.branch})}}if(t.length===0)return null;let n=new Set,o=new Map;for(let l of t)n.add(l.run),l.branch&&o.set(l.run,l.branch);if(n.size===0)return null;let a=`digraph G {
4166`;a+=` rankdir=TB;

Callers 15

chunk-TNJPXCAB.jsFile · 0.45
rtFunction · 0.45
hasClassMethod · 0.45
LaFunction · 0.45
GtFunction · 0.45
UtFunction · 0.45
m1Function · 0.45
handlerFunction · 0.45
_getExpansionMethod · 0.45
parseSymbolMethod · 0.45
addVertexMethod · 0.45
addSubGraphMethod · 0.45

Calls 2

_addCheckMethod · 0.95
PFunction · 0.90

Tested by

no test coverage detected