PageSourceSearch

https://app.middleware.io/static/CY8PZuh2.production.bundle.min.js

js middleware.io collected 2026-10-02 03:34:45 UTC 62,125 bytes, 1 lines download raw bytes

1import{R as le,r as o,j as e,a4 as Dt,J as H,M as pt,ak as Vt,S as De,O as Ye,B as K,C as je,ad as mt,W as Ge,b as Ut,v as Yt,d as Bt,aC as Ft}from"./CZzrexQa.production.bundle.min.js";import{co as Ce,L as Me,cf as g,v as x,T as I,e4 as He,e5 as Kt,w as ce,e1 as de,jA as Wt,jB as Re,jC as Gt,cF as Ht,cD as $t,jD as qt,ci as Jt,cj as Qt,jE as zt,e3 as Xt,jF as ht,jG as Zt,hX as es,p as $e,jH as k,jI as ts,cc as ft,cd as yt,ck as ss,cS as ns,cT as as,aw as os,jJ as rs,jK as is,aO as ls,jL as cs,jM as Se,jN as Et,jO as ds,cC as us,d1 as ps,cZ as ms,jP as hs,jQ as fs,jR as ys,jS as nt,jT as Es,jU as Ts,jV as at,jW as Ns,jX as _s,jY as xs,d8 as we,bh as gs,jZ as Tt,j_ as Ss,aI as js,aJ as Cs,bX as As,t as bs,j$ as Is,k0 as Ps,k1 as vs,k2 as Ms,k3 as Rs,k4 as ws,e0 as Os,k5 as ot,k6 as Ls,u as ks,a as Ds,ch as Vs}from"./DeceMiF-.production.bundle.min.js";import{B as Ie}from"./YCM_kEyP.production.bundle.min.js";import{N as Nt}from"./DWUNlcjA.production.bundle.min.js";import{u as Oe,s as ne}from"./9eHdvLN4.production.bundle.min.js";import{G as Te}from"./CJIgguc4.production.bundle.min.js";import{T as Le,J as Be,P as Us}from"./Y4Ob0Is8.production.bundle.min.js";import{S as Ys}from"./BcqlwH-H.production.bundle.min.js";import{aD as Bs,a7 as _t,a8 as ve,aa as Fs,a5 as Ks}from"./b2Mkg01q.production.bundle.min.js";import{c as qe,af as xt,ag as gt,S as St,b as ge,L as Ws,I as Gs}from"./C_cH1u9D.production.bundle.min.js";import{A as rt}from"./DwmhJbxl.production.bundle.min.js";import{P as it}from"./D-90pMQ7.production.bundle.min.js";import{c as Hs,r as jt,L as Ve,h as Ct}from"./DQegFpUo.production.bundle.min.js";import{S as Je}from"./D0x1Z4HE.production.bundle.min.js";import{T as Qe}from"./oN3AJijl.production.bundle.min.js";import{D as Fe,a as $s}from"./D8sKcCdJ.production.bundle.min.js";import{u as Pe}from"./DvLd3evF.production.bundle.min.js";import{P as ze,q as qs,D as Js}from"./3wIbuO__.production.bundle.min.js";import{H as Qs,k as zs,r as Xs}from"./CUZmxn9S.production.bundle.min.js";import{h as Zs,E as en}from"./7LcJfZNO.production.bundle.min.js";import{F as tn}from"./B0uEge7d.production.bundle.min.js";import At from"./C0FQPya7.production.bundle.min.js";import{A as sn}from"./CXT9N8xZ.production.bundle.min.js";import{r as nn}from"./E4gGKtkj.production.bundle.min.js";import{I as an}from"./B7Fri_dM.production.bundle.min.js";import{L as on,a as re}from"./_f-l9BU7.production.bundle.min.js";import{S as rn}from"./CNsPFEJO.production.bundle.min.js";import{G as ln}from"./B2jjARHc.production.bundle.min.js";import{P as cn}from"./CHClG9UV.production.bundle.min.js";import"./DGYQp8fe.production.bundle.min.js";import"./BmBjCq8D.production.bundle.min.js";import"./Dsqj8S3w.production.bundle.min.js";import"./D4lvmK5r.production.bundle.min.js";import"./kkIr59yR.production.bundle.min.js";import"./DGAisTA8.production.bundle.min.js";import"./DFn2u8qh.production.bundle.min.js";import"./Bm1LOIPR.production.bundle.min.js";import"./DtpVAsok.production.bundle.min.js";import"./2mZBARql.production.bundle.min.js";import"./vhNSgALD.production.bundle.min.js";import"./C_Ln3svq.production.bundle.min.js";import"./E6csxmgU.production.bundle.min.js";import"./CpVN2k6O.production.bundle.min.js";import"./Ci_hGDFV.production.bundle.min.js";import"./CLBsRoPD.production.bundle.min.js";import"./Ch78CD0x.production.bundle.min.js";import"./tkddr5kZ.production.bundle.min.js";import"./D1TNtnEv.production.bundle.min.js";import"./DnQqxH0F.production.bundle.min.js";import"./CiD4UJCU.production.bundle.min.js";import"./zzLyrqbE.production.bundle.min.js";import"./DS1fZd27.production.bundle.min.js";import"./Bylw-B_Y.production.bundle.min.js";import"./DaNdIQwd.production.bundle.min.js";import"./9saacImM.production.bundle.min.js";const dn=s=>{const t=[];return!s.responses||typeof s.responses!="object"?t:(Object.keys(s.responses).forEach((a,c)=>{const l=s.responses[a],i=(l==null?void 0:l.description)||Bs(a)||a;t.push({statusCode:a,description:i,mw_table_row_key:`response-${c}-${a}`,responseData:l?{content:l.content,schema:l.schema}:void 0})}),t.sort((a,c)=>{const l=parseInt(a.statusCode,10),i=parseInt(c.statusCode,10);return!isNaN(l)&&!isNaN(i)?l-i:a.statusCode.localeCompare(c.statusCode)}))},un=s=>{if(!s)return["application/json"];
1if(s.content){const t=Object.keys(s.content);return t.length>0?t:["application/json"]}return["application/json"]},Ke=(s,t,r)=>{if(!s)return null;if(s.startsWith("#/definitions/")){const a=s.replace("#/definitions/","");return(t==null?void 0:t[a])||null}if(s.startsWith("#/components/schemas/")){const a=s.replace("#/components/schemas/","");return(r==null?void 0:r[a])||null}return null},Ue=s=>s.type?s.type:s.$ref?"object":s.oneOf||s.anyOf?"union":"string",pn=s=>s.schema?Ue(s.schema):s.type||"string",lt=(s,t,r,a)=>{if(s.$ref&&t){const c=Ke(s.$ref,r,a);return c&&typeof c=="object"?Ae(c,t,r,a):{$ref:s.$ref}}return s.type==="object"&&s.properties?Ae(s,t,r,a):s.$ref?{$ref:s.$ref}:s.type?{type:s.type}:{}},Ae=(s,t,r,a)=>{if(!s||typeof s!="object")return{};if(s.$ref){if(t){const l=Ke(s.$ref,r,a);if(l&&typeof l=="object")return Ae(l,t,r,a)}return{$ref:s.$ref}}if(s.type==="object"){const l={type:"object"},i={};return s.properties&&Object.keys(s.properties).forEach(d=>{const n=s.properties[d];if(n.$ref&&t){const u=Ke(n.$ref,r,a);u&&typeof u=="object"?i[d]=Ae(u,t,r,a):i[d]={$ref:n.$ref}}else if(n.type==="object"&&n.properties)i[d]=Ae(n,t,r,a);else if(n.type==="array"&&n.items)i[d]={type:"array",items:lt(n.items,t,r,a),...n.description?{description:n.description}:{}};else if(n.$ref)i[d]={$ref:n.$ref};else{const u={};n.type&&(u.type=n.type),n.description&&(u.description=n.description),n.format&&(u.format=n.format),i[d]=Object.keys(u).length>0?u:{type:n.type||"string"}}}),l.properties=i,s.description&&(l.description=s.description),l}if(s.type==="array"&&s.items)return{type:"array",items:lt(s.items,t,r,a)};const c={};return s.type&&(c.type=s.type),s.description&&(c.description=s.description),c},mn=(s,t="application/json",r,a,c=!0)=>{var i,d;if(!s)return null;const l=((d=(i=s.content)==null?void 0:i[t])==null?void 0:d.schema)||s.schema;return l?Ae(l,c,r,a):null},hn=s=>{if(!s)return{};const t=a=>{const c={};for(const l in a){const i=a[l];if(!i||typeof i!="object"){c[l]={type:"unknown"};continue}if(i.type==="object"&&i.properties&&typeof i.properties=="object")c[l]=t(i.properties);else if(i.type==="array"&&i.items&&typeof i.items=="object"){const d=i.items;d.type==="object"&&d.properties&&typeof d.properties=="object"?c[l]=[t(d.properties)]:d.type?c[l]=[{type:d.type}]:c[l]=[{type:"unknown"}]}else i.type?c[l]={type:i.type}:c[l]={type:"unknown"}}return c},r={};if(s.type==="array"&&s.items&&typeof s.items=="object"){const a=s.items;return a.type==="object"&&a.properties&&typeof a.properties=="object"?r.items=t(a.properties):r.items={type:"unknown"},r.type={type:"unknown"},r}return s.type==="object"&&s.properties&&typeof s.properties=="object"?t(s.properties):{}},bt=(s,t,r,a)=>r==="none"||!t?s:[...s].sort((l,i)=>{const d=a(l,t),n=a(i,t);return r==="asc"?d<n?-1:d>n?1:0:d>n?-1:d<n?1:0}),fn=(s,t)=>{if(!(s!=null&&s.startsWith("#/components/schemas/")))return null;const r=s.split("/").pop();return!r||!(t!=null&&t.schemas)?null:t.schemas[r]||null},It=(s,t)=>{if(s.properties&&typeof s.properties=="object")return s.properties;if(s.$ref){const r=fn(s.$ref,t);if(r&&typeof r=="object"&&!Array.isArray(r))return It(r,t)}return null},yn=s=>{const t=[],r=s==null?void 0:s.components;if(Array.isArray(s.parameters)&&s.parameters.forEach((a,c)=>{var n;if(!a||typeof a!="object")return;const l=((n=a.in)==null?void 0:n.toLowerCase())||"",i=a.name||"";if(!i||l!=="path"&&l!=="query"&&l!=="body")return;const d=l==="path"?"path":l==="query"?"query":"body";t.push({name:i,type:pn(a),description:a.description||"",category:d,mw_table_row_key:`param-${l}-${c}-${i}`})}),s.requestBody){const a=s.requestBody;let c=!1,l="object",i=a.description||"";if(a.content&&typeof a.content=="object"&&Object.keys(a.content).forEach(d=>{var f;const n=(f=a.content)==null?void 0:f[d];if(!(n!=null&&n.schema)){l="object";return}const u=n.schema;l=Ue(u),i=i||u.description||"";const p=It(u,r);p&&typeof p=="object"&&(c=!0,Object.keys(p).forEach((m,N)=>{const E=p[m];t.push({name:m,type:Ue(E),description:E.description||"",category:"body",mw_table_row_key:`body-${d}-${N}-${m}`})}))}),!c&&a.content&&typeof a.content=="object"){const d=Object.keys(a.content);if(d.length>0){const n=a.content[d[0]];if(n!=null&&n.schema){const u=n.schema;l=Ue(u),i=i||u.description||""}}t.push({name:"request",type:l,description:i,category:"body",mw_table_row_key:"body-default"})}}return t},ct=(s,t,r,a,c)=>{a&&a(),setTimeout(()=>{try{const l=atob(s),i=l.trim();let d,n="JSON";if(i.startsWith("{")||i.startsWith("["))try{d=JSON.parse(l),n="JSON"}catch{d=Ce.load(l),n="YAML"}else d=Ce.load(l),n="YAML";if(typeof d!="object"||d===null||Array.isArray(d))throw new Error("Parsed content must be a JSON object");t(d,n)}catch(l){r(l)}finally{c&&c()}},0)},Pt=(s,t)=>{var r,a;if(!s)return{tags:[],title:"",description:""};try{let c=s.trim().replace(/\s/g,"");for(;c.length%4!==0;)c+="=";const l=atob(c);let i;if(t==="YAML")i=Ce.load(l);else if(t==="JSON")i=JSON.parse(l);else if(l.trim().startsWith("{")||l.trim().startsWith("["))try{i=JSON.parse(l)}catch{i=Ce.load(l)}else i=Ce.load(l);if(!i||typeof i!="object"||Array.isArray(i))return{tags:[],title:"",description:""};const d=i,n=new Set;
1Array.isArray(d.tags)&&d.tags.forEach(f=>{f!=null&&f.name&&n.add(f.name)});const u=d.paths||{},p=["get","post","put","patch","delete","options","head"];return Object.values(u).forEach(f=>{!f||typeof f!="object"||p.forEach(m=>{const N=f[m];N!=null&&N.tags&&Array.isArray(N.tags)&&N.tags.forEach(E=>{typeof E=="string"&&n.add(E)})})}),{tags:Array.from(n).sort(),title:((r=d==null?void 0:d.info)==null?void 0:r.title)??"",description:((a=d==null?void 0:d.info)==null?void 0:a.description)??""}}catch(c){return console.error("Error parsing OpenAPI spec:",c),{tags:[],title:"",description:""}}},En=(s,t,r)=>{const a={description:"",parameters:[],requestBody:null,responses:{},method:"",path:"",summary:"",tags:[],deprecated:!1};if(!s||!r)return a;try{let c=s.trim().replace(/\s/g,"");for(;c.length%4!==0;)c+="=";const l=atob(c);let i;t==="YAML"?i=Ce.load(l):i=JSON.parse(l);const d=(i==null?void 0:i.paths)||{};let n=null,u="",p="";const f=r.http_method.toLowerCase();for(const[T,h]of Object.entries(d)){if(!h||typeof h!="object")continue;if(T===r.route_template||T.replace(/\{[^}]+\}/g,"{}")===r.route_template.replace(/\{[^}]+\}/g,"{}")){const _=h[f];if(_&&(_.operationId===r.operation||r.operation===_.operationId||!r.operation)){n=_,u=r.http_method,p=T;break}}}if(!n)for(const[T,h]of Object.entries(d)){if(!h||typeof h!="object")continue;const v=["get","post","put","patch","delete","options","head"];for(const _ of v){const P=h[_];if(P&&P.operationId===r.operation){n=P,u=_.toUpperCase(),p=T;break}}if(n)break}if(!n&&r.route_template)for(const[T,h]of Object.entries(d)){if(!h||typeof h!="object")continue;if(T===r.route_template||T.replace(/\{[^}]+\}/g,"{}")===r.route_template.replace(/\{[^}]+\}/g,"{}")){const _=h[f];if(_){n=_,u=r.http_method,p=T;break}}}if(!n)return{...a,description:r.summary||"",summary:r.summary||"",method:r.http_method,path:r.route_template,deprecated:r.deprecated||!1};const m=d[p],N=(m==null?void 0:m.parameters)||[],E=n.parameters||[],y=[],b=new Set;return Array.isArray(N)&&N.forEach(T=>{if(T!=null&&T.name&&(T!=null&&T.in)){const h=`${T.in}:${T.name}`;b.has(h)||(y.push(T),b.add(h))}}),Array.isArray(E)&&E.forEach(T=>{if(T!=null&&T.name&&(T!=null&&T.in)){const h=`${T.in}:${T.name}`,v=y.findIndex(_=>_.name===T.name&&_.in===T.in);v>=0?y[v]=T:(y.push(T),b.add(h))}}),{description:n.description||n.summary||r.summary||"",summary:n.summary||r.summary||"",parameters:y,requestBody:n.requestBody||null,responses:n.responses||{},method:u||r.http_method,path:p||r.route_template,tags:n.tags||[],deprecated:n.deprecated||r.deprecated||!1,components:i.components||void 0,definitions:i.definitions||void 0}}catch(c){return console.error("Error parsing operation details:",c),{...a,description:r.summary||"",summary:r.summary||"",method:r.http_method,path:r.route_template,deprecated:r.deprecated||!1}}},Ne={TOTAL_TIME_SPENT:"Total Time Spent",AVG_TIME_PER_REQUEST:"Avg Time per Request",MAX_LATENCY:"Max Latency",P95_LATENCY:"P95 Latency"},Tn={[Ne.TOTAL_TIME_SPENT]:[g.SUM_RESPONSE_TIME_MS],[Ne.AVG_TIME_PER_REQUEST]:[g.AVG_RESPONSE_TIME_MS],[Ne.MAX_LATENCY]:[g.MAX_RESPONSE_TIME_MS],[Ne.P95_LATENCY]:[g.P95_LATENCY]},be={TYPE:"Span Type",DOWNSTREAM:"Downstream Services",INFERRED:"Downstream & Inferred Services"},Nn={[be.TYPE]:[x.MW_SPAN_TYPE],[be.DOWNSTREAM]:[I.SERVICE_NAME],[be.INFERRED]:[x.MW_SPAN_TYPE,I.SERVICE_NAME]},_n=Ne.AVG_TIME_PER_REQUEST,xn=be.TYPE,gn=[g.SUM_RESPONSE_TIME_MS],Sn=[I.SERVICE_NAME],jn="api-catalogue-connected-graph",vt=le.memo(({filters:s})=>{const[t,r]=Me("api-catalogue-connected-graph-selected-time-key",_n),[a,c]=Me("api-catalogue-connected-graph-selected-graph-key",xn),l=o.useMemo(()=>`${jn}-${t}`,[t]),i=o.useMemo(()=>Tn[t]??gn,[t]),d=o.useMemo(()=>Nn[a]??Sn,[a]),n=o.useMemo(()=>Object.keys(Ne),[]),u=o.useMemo(()=>Object.keys(be),[]),p=o.useMemo(()=>[s],[s]),f=o.useCallback(y=>{r(y)},[r]),m=o.useCallback(y=>{c(y)},[c]),N=o.useMemo(()=>n.map(y=>{const b=Ne[y];return e.jsx(it,{selected:t===b,onClick:()=>f(b),children:b},y)}),[n,t,f]),E=o.useMemo(()=>u.map(y=>{const b=be[y];return e.jsx(it,{selected:a===b,onClick:()=>m(b),children:b},y)}),[u,a,m]);return e.jsx("div",{className:"connected-graph",children:e.jsx(He,{title:t,name:l,column:i,chartType:Dt,widgetAppId:Hs,groupBy:d,columnConfig:Kt,allowAllLegend:!0,filters:p,titleChild:e.jsxs("div",{className:"connected-graph-title-control
1s",children:[e.jsx(rt,{text:t,downArrow:!0,buttonType:"small",children:N}),e.jsx("span",{className:"by-separator",children:" By "}),e.jsx(rt,{text:a,downArrow:!0,buttonType:"small",children:E})]})})})});vt.displayName="ConnectedGraph";const ie={ALL:0,BODY:1,PATH:2,QUERY:3},Cn=({parameters:s,isExpanded:t,onToggleExpand:r})=>{const[a,c]=o.useState(ie.ALL),[l,i]=o.useState(""),[d,n]=o.useState(""),[u,p]=o.useState(H.Asc),f=o.useMemo(()=>s||[],[s]),m=o.useMemo(()=>{let h=f;if(a===ie.BODY?h=h.filter(_=>_.category==="body"):a===ie.PATH?h=h.filter(_=>_.category==="path"):a===ie.QUERY&&(h=h.filter(_=>_.category==="query")),l.trim()){const _=l.toLowerCase().trim();h=h.filter(P=>{var R,O,Y;return((R=P==null?void 0:P.name)==null?void 0:R.toLowerCase().includes(_))||((O=P==null?void 0:P.type)==null?void 0:O.toLowerCase().includes(_))||((Y=P==null?void 0:P.description)==null?void 0:Y.toLowerCase().includes(_))})}const v=u===H.Asc?"asc":u===H.Desc?"desc":"none";return bt(h,d,v,(_,P)=>{var R,O;return P==="name"?((R=_==null?void 0:_.name)==null?void 0:R.toLowerCase())||"":P==="type"?((O=_==null?void 0:_.type)==null?void 0:O.toLowerCase())||"":P==="description"?((_==null?void 0:_.description)||"").toLowerCase():""})},[f,a,l,d,u]),N=o.useMemo(()=>m.map(h=>({name:h.name,type:h.type,description:h.description,category:h.category,mw_table_row_key:h.mw_table_row_key})),[m]),E=o.useMemo(()=>[{columnKey:"name",title:"Name",width:100,defaultSortOrder:d==="name"?u:H.None,render:(h,v)=>{const _=(v==null?void 0:v.category)||"";return e.jsxs("div",{className:"parameter-name-cell",children:[h,_&&e.jsxs("span",{className:"parameter-category-label",children:[" (",_,")"]})]})}},{columnKey:"type",title:"Type",width:80,defaultSortOrder:d==="type"?u:H.None,render:h=>e.jsx("div",{className:"parameter-type-cell",children:h})},{columnKey:"description",title:"Description",width:200,defaultSortOrder:d==="description"?u:H.None,render:h=>e.jsx("div",{className:"parameter-description-cell",children:h||"-"})}],[d,u]),y=o.useMemo(()=>{const h=f.filter(R=>R.category==="body").length,v=f.filter(R=>R.category==="path").length,_=f.filter(R=>R.category==="query").length,P=[{label:`All (${f.length})`,value:ie.ALL}];return h>0&&P.push({label:`Body (${h})`,value:ie.BODY}),v>0&&P.push({label:`Path (${v})`,value:ie.PATH}),_>0&&P.push({label:`Query (${_})`,value:ie.QUERY}),P},[f]);if(le.useEffect(()=>{y.map(v=>v.value).includes(a)||c(ie.ALL)},[y,a]),f.length===0)return null;const b=e.jsxs("div",{className:"parameters-title-wrapper",onClick:r,children:[t?e.jsx(xt,{className:"parameters-expand-icon"}):e.jsx(gt,{className:"parameters-expand-icon"}),e.jsx("div",{className:"parameters-title",children:"Parameters"})]}),T=e.jsxs("div",{className:"parameters-header-controls",children:[e.jsx("div",{className:"parameters-tabs-container",children:e.jsx(Le,{tabs:y,selectedTab:a,onTabChange:h=>c(h.value)})}),e.jsx("div",{className:"parameters-search-container",children:e.jsx(Je,{placeholder:"Search by name",value:l,onChange:h=>i(h),width:150})})]});return e.jsx("div",{className:"parameters-section",children:e.jsx(Qe,{titleChild:b,actionElements:T,showOnlyTitle:!t,children:t&&e.jsx("div",{className:"parameters-table-container",children:e.jsx(qe,{uniqId:"parameters-table-v1",columns:E,dataProvider:N,loading:!1,onSortingChange:(h,v)=>{v===H.None?(n(""),p(H.Asc)):(n(h),p(v))}})})})})},An=s=>{const t=parseInt(s,10);return isNaN(t)?ge.Other:t>=200&&t<300?ge.Success:t>=300&&t<400?ge.Secondary:t>=400&&t<500?ge.Warning:t>=500?ge.Error:ge.Other},bn=({record:s,responses:t,operationDetails:r})=>{var b;const a=o.useMemo(()=>t.find(T=>T.statusCode===s.statusCode),[t,s.statusCode]),c=o.useMemo(()=>un(a==null?void 0:a.responseData),[a]),[l,i]=o.useState(c[0]||"application/json"),[d,n]=o.useState(0),u=r.definitions,p=(b=r.components)==null?void 0:b.schemas,f=o.useMemo(()=>mn(a==null?void 0:a.responseData,l,u,p,!0),[a,l,u,p]),m=o.useMemo(()=>[{label:"Condensed",value:0},{label:"Raw",value:1}],[]),N=o.useMemo(()=>c.map(T=>({label:T,value:T})),[c]),E=o.useMemo(()=>f,[f]),y=o.useMemo(()=>hn(f),[f]);return e.jsxs("div",{className:"response-expanded-content",children:[e.jsxs("div",{className:"response-expanded-header",children:[e.jsx(Fe,{options:N,selectedValues:[l],onChange:T=>{const h=Array.isArray(T)?T[0]:T;i(h||"application/json")},placeholder:"application/json"}),e.jsx(Le,{tabs:m,selectedTab:d,onTabChange:({value:T})=>n(T)})]}),e.jsx("div",{className:"response-expanded-body",children:d===0?e.jsx(Be,{jsonValue:y||{},applyFilter:()=>{}}):e.jsx(Be,{jsonValue:E||{},applyFilter:()=>{}})})]})}
1,In=({responses:s,operationDetails:t,isExpanded:r,onToggleExpand:a})=>{const[c,l]=o.useState(""),[i,d]=o.useState(H.Asc),n=o.useMemo(()=>{const m=i===H.Asc?"asc":i===H.Desc?"desc":"none";return bt(s,c,m,(N,E)=>{if(E==="statusCode"){const y=parseInt(N.statusCode,10);return isNaN(y)?N.statusCode:y}else if(E==="description")return(N.description||"").toLowerCase();return""})},[s,c,i]),u=o.useMemo(()=>n.map(m=>{const N={statusCode:m.statusCode,description:m.description,mw_table_row_key:m.mw_table_row_key};return m.responseData&&(N.responseData=m.responseData),N}),[n]),p=o.useMemo(()=>[{columnKey:"statusCode",title:"STATUS CODE",width:100,defaultSortOrder:c==="statusCode"?i:H.None,render:m=>{const N=m;return e.jsx(St,{labelText:N,type:An(N)})}},{columnKey:"description",title:"DESCRIPTION",width:200,defaultSortOrder:c==="description"?i:H.None,render:m=>e.jsx("div",{className:"response-description-cell",children:m||"-"})}],[c,i]);if(s.length===0)return null;const f=e.jsxs("div",{className:"responses-title-wrapper",onClick:a,children:[r?e.jsx(xt,{className:"responses-expand-icon"}):e.jsx(gt,{className:"responses-expand-icon"}),e.jsx("div",{className:"responses-title",children:"Responses"})]});return e.jsx("div",{className:"responses-section",children:e.jsx(Qe,{titleChild:f,actionElements:null,showOnlyTitle:!r,children:r&&e.jsx("div",{className:"responses-table-container",children:e.jsx(qe,{uniqId:"responses-table-v1",columns:p,dataProvider:u,expandable:{expandedRowRender:m=>e.jsx(bn,{record:m,responses:s,operationDetails:t})},loading:!1,onSortingChange:(m,N)=>{N===H.None?(l(""),d(H.Asc)):(l(m),d(N))}})})})})},Pn=200,vn=s=>{const t=Oe(),r=o.useContext(pt),{fromTs:a,toTs:c}=(r==null?void 0:r.params.dateRange)||{}
1,l=r==null?void 0:r.params.debug,[i,d]=o.useState([]),[n,u]=o.useState(!0),p=JSON.stringify(s),f=s&&Object.keys(s).length>0,m=o.useCallback(()=>{if(!a||!c||!f)return;u(!0);const N=[{key:Ye.FromTs,value:a},{key:Ye.ToTs,value:c},de.QUICKWIT,...l?[de.DEBUG]:[]],E=K.getValues(s),y={label:"endpoint-trace-ids",builderId:0,scopeId:0,widgetAppId:Ve,builderViewOptions:{},params:N,builderConfig:[{columns:[I.TRACE_ID],with:[{key:Vt,value:{offset:0,n:Pn},is_arg:!0},{key:De,value:[I.SERVICE_NAME,I.TRACE_ID],is_arg:!0},...E?[E]:[]],source:{name:ce,alias:"",dataset_id:0}}]};t(jt([y],(b,T,h)=>{var P,R;if(T)return;if(u(!1),!b||h.length<1){d([]);return}const v=((R=(P=h[0])==null?void 0:P.chart_data)==null?void 0:R.data)||[],_=Array.from(new Set(v.map(O=>String(O[I.TRACE_ID]??"")).filter(Boolean)));d(_)}))},[t,a,c,l,f,p]);return o.useEffect(()=>{a&&c&&f&&m()},[a,c,f,m]),{traceIds:i,isLoading:n}},Xe=s=>s.length>0?K.In(I.TRACE_ID,s):K.Equal(I.TRACE_ID,""),Mn=({api:s,apiFilters:t,traceIds:r,onOpenAddAPIPanel:a,onOpenAPIDetailsPanel:c})=>{var M;const l=o.useMemo(()=>Xe(r),[r]),i=s[x.MW_API_SPEC_ID],d=s[x.MW_API_OPERATION_ID],[n,u]=o.useState(null),p=Pe(Wt),f=n!=null&&n.id?p===n.id:!1,[m,N]=o.useState(null),[E,y]=o.useState(!1),b=d?parseInt(d,10):null;o.useEffect(()=>{if(!i){u(null),y(!1);return}const w=parseInt(i,10);if(isNaN(w)){console.error("Invalid API spec ID:",i),u(null),y(!1);return}y(!0),Re(w,C=>{y(!1),(C==null?void 0:C.status)===200&&(C!=null&&C.data)?u(C.data):u(null)})},[i]),o.useEffect(()=>{if(!b||isNaN(b)){N(null);return}Gt(b,w=>{(w==null?void 0:w.status)===200&&(w!=null&&w.data)?N(w.data):N(null)})},[b]);const T=le.useMemo(()=>Pt(n==null?void 0:n.raw_spec,n==null?void 0:n.spec_format),[n==null?void 0:n.raw_spec,n==null?void 0:n.spec_format]),h=le.useMemo(()=>En(n==null?void 0:n.raw_spec,n==null?void 0:n.spec_format,m),[n==null?void 0:n.raw_spec,n==null?void 0:n.spec_format,m]),v=le.useMemo(()=>yn(h),[h]),_=le.useMemo(()=>dn(h),[h]),[P,R]=Me("endpoints-parameters-expanded",!0),[O,Y]=Me("endpoints-responses-expanded",!0),z=T.title||((M=n==null?void 0:n.metadata)==null?void 0:M.user_file_name)||(n==null?void 0:n.spec_name)||"Unknown API",W=le.useMemo(()=>h.description?h.description:h.summary?h.summary:m!=null&&m.summary?m.summary:m!=null&&m.operation?m.operation:m!=null&&m.route_template?`${m.http_method} ${m.route_template}`:T.description||"No description available",[h,m,T.description]);return e.jsxs("div",{className:"definition-info-tab",children:[e.jsxs("div",{className:"definition-section",children:[e.jsx("div",{className:"section-title",children:"Definition"}),E?e.jsx("div",{className:"definition-loading-container",children:e.jsx(je,{})}):!i||!n?e.jsxs("div",{className:"definition-registration-prompt",children:[e.jsx("div",{className:"registration-icon",children:e.jsx(Ht,{className:"api-icon"})}),e.jsx("div",{className:"text-container",children:e.jsx("div",{className:"registration-text",children:"Register this endpoint to a new or existing API to gain better management capabilities."})}),e.jsx("div",{className:"registration-button-wrapper",children:e.jsx(Ie,{secondary:!0,prefixicon:e.jsx(ze,{color:"var(--color-primary)"}),onClick:()=>{a&&a()},children:"Add New API"})})]}):e.jsxs("div",{className:"definition-cards",children:[e.jsxs("div",{className:"definition-card api-card",children:[e.jsx("div",{className:"card-label",children:"API"}),e.jsxs("div",{className:"card-value",children:[e.jsx("div",{className:"api-icon-region",children:e.jsx($t,{className:"api-icon"})}),e.jsxs("div",{className:"api-value-text-container",children:[e.jsx("div",{className:"api-value-text",children:z}),e.jsx("div",{className:"external-link-icon-wrapper",onClick:()=>{n!=null&&n.id&&c&&c(n.id)},children:f?e.jsx(je,{}):e.jsx(Ws,{className:"external-link-icon",color:"var(--color-text)"})})]})]})]}),e.jsxs("div",{className:"definition-card description-card",children:[e.jsx("div",{className:"card-label",children:"Description"}),e.jsx("div",{className:"card-value",children:e.jsx("div",{className:"description-text-container",children:e.jsx(qt,{data:W})})})]})]}),n&&m&&v.length>0&&e.jsx(Cn,{parameters:v,isExpanded:P,onToggleExpand:()=>R(!P)}),n&&m&&_.length>
10&&e.jsx(In,{responses:_,operationDetails:h,isExpanded:O,onToggleExpand:()=>Y(!O)})]}),e.jsxs("div",{className:"endpoint-summary-section",children:[e.jsx("div",{className:"section-title",children:"Endpoint Summary"}),e.jsx(Jt,{uniqName:"endpoint-summary-stats",filter:t,children:e.jsx(Qt,{})}),e.jsx(vt,{filters:l})]})]})},Rn=({api:s,apiFilters:t,traceIds:r})=>{const a=s==null?void 0:s[x.APP_VERSION],c=a!==""&&a!==void 0,l=o.useMemo(()=>Xe(r),[r]);return e.jsxs("div",{className:"deployment-dependencies-tab",children:[e.jsxs("div",{className:"section-container",children:[e.jsx("div",{className:"section-title",children:"Deployments"}),c?e.jsx(zt,{filters:t,tableConfigKeySuffix:"endpoint",limit:2}):e.jsx(Nt,{exmpySpaceText:e.jsxs("span",{children:["Deployments not found. Ensure"," ",e.jsx("span",{className:"highlight-text",children:"app.version"})," is added as an attribute in your service span."]})})]}),e.jsxs("div",{className:"section-container",children:[e.jsx("div",{className:"section-title",children:"Dependencies"}),e.jsx("div",{className:"dependencies-section",children:e.jsx("div",{className:"map-container",children:e.jsx(Xt,{disableDrilldown:!0,showServiceTable:!0,filters:l,disableInferredServices:!0,disableContextualNodes:!0,disableClusterMap:!0})})})]})]})},wn=({apiFilters:s,traceIds:t})=>{const r=o.useMemo(()=>Xe(t),[t]);return e.jsxs("div",{className:"errors-tab",children:[e.jsx("div",{className:"apm-graph-card",children:e.jsx(He,{title:"Error Traces",name:"endpoint-panel-errors",titleChild:e.jsx("div",{className:"title-child-container",children:e.jsx("span",{className:"title-child-text",children:"Error Traces Over Time"})}),column:[g.ERROR_COUNT],chartType:mt,filters:[r],widgetAppId:Ct,columnConfig:ht,extraParams:[de.QUICKWIT]})}),e.jsx("div",{className:"errors-trace-events",children:e.jsx(Zt,{filter:r,limit:100,displayNoData:!0,showDefaultExpanded:!0})})]})},Ze=[I.SERVICE_NAME,I.SPAN_NAME,x.MW_SPAN_TYPE,g.AVG_RESPONSE_TIME_MS,g.ERROR_RATE,g.MAX_RESPONSE_TIME_MS,x.TELEMETRY_SDK_LANGUAGE,x.LIBRARY_LANGUAGE],We={[I.SERVICE_NAME]:{order:0,title:"Service Name",width:180,metricKey:I.SERVICE_NAME,defaultSelected:!0,renderType:k.SERVICE,tooltipContent:""},[I.SPAN_NAME]:{order:1,title:"Span",width:250,metricKey:I.SPAN_NAME,defaultSelected:!0,renderType:k.API_NAME,tooltipContent:""},[x.MW_SPAN_TYPE]:{order:2,title:"Type",width:100,metricKey:x.MW_SPAN_TYPE,defaultSelected:!0,renderType:k.TYPE,tooltipContent:""},[g.AVG_RESPONSE_TIME_MS]:{order:3,title:"Avg Duration",width:120,metricKey:g.AVG_RESPONSE_TIME_MS,defaultSelected:!0,renderType:k.LATENCY,nanoseconds:!1,maxValueFallback:1e9,tooltipContent:""},[g.ERROR_RATE]:{order:4,title:"Error Rate",width:100,metricKey:g.ERROR_RATE,defaultSelected:!0,renderType:k.PROGRESS,tooltipContent:""}},On=ts({columnDefinitions:We,allKeys:Ze}),Ln=On.generateColumns(Ze.map(s=>{var t,r;return{label:((t=We[s])==null?void 0:t.title)||s,value:s,defaultSelected:((r=We[s])==null?void 0:r.defaultSelected)??!1}})),kn=[{label:"All",value:"All"},{label:"Downstream",value:"Downstream"},{label:"Upstream",value:"Upstream"}],Dn="summary-table-direction",Vn=[I.SERVICE_NAME,I.SPAN_NAME],Un={showOnlyTitle:!0,resource:ce,cellClassName:"summary-table-cell",onRowClick:s=>{},pagination:{noOfRecordsPerPage:10,limit:10,showPrevNextPagination:!0}},dt=(s,t,r)=>{const a=new Set,c=[s];for(;c.length>0;){const l=c.shift(),i=t.get(l);i&&i.forEach(d=>{!a.has(d)&&d!==s&&(a.add(d),c.push(d))})}return Array.from(a)},Yn=({api:s,traceIds:t})=>{const r=Oe(),a=o.useContext(pt),c=o.useRef(""),[l,i]=Me(Dn,"All"),[d,n]=o.useState(0),[u,p]=o.useState([]),[f,m]=o.useState(""),[N,E]=o.useState([]),[y,b]=o.useState([]),{fromTs:T,toTs:h}=(a==null?void 0:a.params.dateRange)||{},v=a==null?void 0:a.params.debug,_=s[I.SERVICE_NAME],P=o.useCallback(M=>{const w=Array.isArray(M)?M[0]:M;i(w)},[i]),R=o.useMemo(()=>es(u),[u]),O=o.useMemo(()=>{const M=[];if(t.length>0&&M.push(K.In(I.TRACE_ID,t)),l==="Downstream"?N.length>0&&M.push(K.In(I.SERVICE_NAME,N)):l==="Upstream"&&(y.length>0?M.push(K.In(I.SERVICE_NAME,y)):M.push(K.Equal(I.SERVICE_NAME,""))),d!==0){const w=R.find(C=>C.value===d);w&&w.type!=="all"&&M.push(K.Equal(x.MW_SPAN_TYPE,w.type))}
1return f.trim()&&M.push(K.Like(I.SPAN_NAME,f.trim())),M},[l,N,y,R,d,f,t]),Y=o.useCallback(()=>{if(!T||!h||t.length===0)return;const M=[{key:Ye.FromTs,value:T},{key:Ye.ToTs,value:h},de.QUICKWIT,...v?[de.DEBUG]:[]],w=K.In(I.TRACE_ID,t),C=w?K.getValues(w):void 0,G=C?[C]:[],j=[{label:"span-types",builderId:0,scopeId:0,widgetAppId:Ve,builderViewOptions:{},params:M,builderConfig:[{columns:[x.MW_SPAN_TYPE],with:[{key:De,value:[x.MW_SPAN_TYPE],is_arg:!0},...G],source:{name:ce,alias:"",dataset_id:0}}]},{label:"next-links",builderId:0,scopeId:0,widgetAppId:Ve,builderViewOptions:{},params:M,builderConfig:[{columns:[I.SERVICE_NAME,x.MW_NEXT_SERVICE],with:[{key:De,value:[I.SERVICE_NAME,x.MW_NEXT_SERVICE],is_arg:!0},...G],source:{name:ce,alias:"",dataset_id:0}}]},{label:"prev-links",builderId:0,scopeId:0,widgetAppId:Ve,builderViewOptions:{},params:M,builderConfig:[{columns:[I.SERVICE_NAME,x.MW_PREV_SERVICE],with:[{key:De,value:[I.SERVICE_NAME,x.MW_PREV_SERVICE],is_arg:!0},...G],source:{name:ce,alias:"",dataset_id:0}}]}];r(jt(j,($,se,ae)=>{var D,A,V,X,te,J;if(se||!$||ae.length<3)return;const ue=((A=(D=ae[0])==null?void 0:D.chart_data)==null?void 0:A.data)||[],pe=new Set(ue.map(L=>String(L[x.MW_SPAN_TYPE]||"").toLowerCase())),me=Array.from(pe).filter(Boolean).sort(),he=me.join(",");c.current!==he&&(c.current=he,p(me));const Z=new Map,q=new Map;(((X=(V=ae[1])==null?void 0:V.chart_data)==null?void 0:X.data)||[]).forEach(L=>{const B=L[I.SERVICE_NAME],F=L[x.MW_NEXT_SERVICE];B&&F&&(Z.has(B)||Z.set(B,new Set),Z.get(B).add(F))}),(((J=(te=ae[2])==null?void 0:te.chart_data)==null?void 0:J.data)||[]).forEach(L=>{const B=L[I.SERVICE_NAME],F=L[x.MW_PREV_SERVICE];F&&B&&(Z.has(F)||Z.set(F,new Set),Z.get(F).add(B),q.has(B)||q.set(B,new Set),q.get(B).add(F))}),Z.forEach((L,B)=>{L.forEach(F=>{q.has(F)||q.set(F,new Set),q.get(F).add(B)})});const ye=dt(_,Z),_e=dt(_,q);E([_,...ye]),b(_e)}))},[r,T,h,v,_,t]);o.useEffect(()=>{t.length>0&&Y()},[t,Y]);const z=o.useMemo(()=>e.jsxs("div",{className:"summary-table-header",children:[e.jsx("div",{className:"summary-table-title",children:"SPAN SUMMARY"}),e.jsxs("div",{className:"summary-table-header-content",children:[e.jsxs("div",{className:"summary-table-header-left",children:[e.jsx(Fe,{options:kn,selectedValues:[l],onChange:P,placeholder:"Select",mode:$s.Default,showSearch:!1}),e.jsx("div",{className:"header-separator"}),e.jsx("div",{className:"span-type-tabs",children:e.jsx(Le,{tabs:R,selectedTab:d,onTabChange:({value:M})=>n(M)})})]}),e.jsx("div",{className:"summary-table-header-right",children:e.jsx(Je,{placeholder:"Search by span name",onChange:M=>m(M||"")})})]})]}),[d,l,R,P]),W=o.useMemo(()=>({groupBy:Vn,filters:O,extraParams:[de.DEBUG],nestedProps:{columnConfig:Ln,titleChild:z,tableOptions:Un}}),[O,z]);return e.jsx("div",{className:"summary-table-container",children:t.length===0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"summary-table-header",children:e.jsx("div",{className:"summary-table-title",children:"SPAN SUMMARY"})}),e.jsx("div",{className:"summary-table-empty",children:"No spans found"})]}):e.jsx($e,{chartType:Ge,columns:Ze,resource:ce,uniqName:"span-summary-endpoints-table",builderProps:W},`span-summary-table-${l}-${t.length}`)})},Bn=({api:s,apiFilters:t,traceIds:r})=>{const a=Pe(ft),c=Pe(yt),[l,i]=o.useState(0),d=o.useMemo(()=>l===0?"Linear":"Logarithmic",[l]),n=o.useMemo(()=>a?c.filters:[t],[t,a,c]),u=o.useMemo(()=>e.jsxs("div",{className:"title-child-container",children:[e.jsx("span",{className:"title-child-text",children:"Traces"}),e.jsx(Le,{tabs:[{label:"Linear",value:0},{label:"Log",value:1}],selectedTab:l,onTabChange:f=>{i(f.value)}})]}),[l]),p=o.useMemo(()=>e.jsx("div",{className:"apm-graph-card",children:e.jsx(He,{title:"Traces",name:"endpoint-panel-requests-errors",yTitle:"Traces over time",titleChild:u,column:[g.TOTAL_REQUESTS,g.ERROR_COUNT],chartType:mt,filters:n,widgetAppId:Ct,columnConfig:ht,extraParams:[de.QUICKWIT],yAxisType:d})}),[n,d,u]);return e.jsxs("div",{className:"spans-summary-tab",children:[e.jsx("div",{className:"spans-summary-traces",children:e.jsx(ss,{otherFilters:t,customHeaderElements:p,recordPerPage:10})}),e.jsx("div",{className:"spans-summary-services",children:e.jsx(Yn,{api:s,traceIds:r})})]})},ut=[{title:"Definition & Info",prefixIcon:e.jsx(ns,{}),component:Mn},{title:"Deployment & Dependencies",prefixIcon:e.jsx(Qs,{}),component:Rn},{title:"Traces & Span Summary",prefixIcon:e.jsx(Zs,{}),component:Bn},{title:"Errors",prefixIcon:e.jsx(en,{}),component:wn}],Fn=({api:s,onOpenAddAPIPanel:t,onOpenAPIDetailsPanel:r})=>{const[a,c]=o.useState(0),l=o.useMemo(()=>{const p=K.Equal(x.MW_HTTP_ENDPOINT,s[x.MW_HTTP_ENDPOINT]),f=K.Equal(x.HTTP_REQUEST_METHOD,s[x.HTTP_REQUEST_METHOD]),m=K.Equal(I.SERVICE_NAME,s[I.SERVICE_NAME]);return p&&f&&m?K.And([p,f,m]):p},[s]),{traceIds:i,isLoading:d}=vn(l),n=p=>{c(p)},u=ut[a].component;return e.jsx("div",{className:"endpoint-panel",children:e.jsx("div",{className:"endpoint-panel-body",children:e.jsxs("div",{className:"nav-tabs",children:[e.jsx(_t,{classname:"apm-endpoint-panel-tabs",targetIndex:a,onTabChange:p=>n(p),showBorderBottom:!0,children:ut.map(p=>e.jsx(ve,{title:p.title,prefixIcon:p.prefixIcon},p.title))}),e.jsx("div",{className:"main-content",children:d?e.jsx("div",{className:"endpoint-panel-loading",children:e.jsx(je,{})}):e.jsx(u,{api:s,apiFilters:l,traceIds:i,onOpenAddAPIPanel:t,onOpenAPIDetailsPanel:r})})]})})})},Mt=s=>{var ee,fe,ye,_e;const{setAddAPIPanel:t,fetchAPIListAndOperations:r}
1=s,a=o.useContext(sn),c=Oe(),l=Ut(),[i,d]=o.useState(0),[n,u]=o.useState(""),[p,f]=o.useState(null),[m,N]=o.useState([]),[E,y]=o.useState(!1),[b,T]=o.useState(!1),[h,v]=o.useState(!1),[_,P]=o.useState(!1),[R,O]=o.useState(!1),[Y,z]=o.useState(null),[W,M]=o.useState(""),[w,C]=o.useState(null),[G,j]=o.useState("JSON"),[$,se]=o.useState(""),ae=((_e=(ye=(fe=(ee=a.user)==null?void 0:ee.settings)==null?void 0:fe.github_integration_app)==null?void 0:ye.value)==null?void 0:_e.apps)??{},ue=o.useMemo(()=>{const D=new Map;return Object.values(ae).flatMap(A=>{var V;return((V=A.repo_detail)==null?void 0:V.repositories)??[]}).forEach(A=>{const V=A.id.toString();D.has(V)||D.set(V,{label:A.name,value:V})}),Array.from(D.values())},[ae]),pe=o.useCallback(D=>{u(D.toLowerCase().replace(/[^a-z0-9-]/g,""))},[]),me=o.useMemo(()=>{if(!W)return"";try{return atob(W)}catch{return""}},[W]),he=le.memo(Be),Z=le.memo(At),q=o.useMemo(()=>!w||R||b||_?null:e.jsx("div",{className:`file-content-container ${i===1?"upload-section":""} ${$?"error-present":""}`,children:G==="YAML"?e.jsx(Z,{value:me,height:i===1?$?window.innerHeight-420:window.innerHeight-370:$?window.innerHeight-490:window.innerHeight-440}):e.jsx(he,{jsonValue:w})}),[me,G,i,w,R,b,_,$]);return e.jsxs("div",{className:"add-api-container",children:[e.jsxs("div",{className:"add-api-fields",children:[e.jsx("div",{className:"api-name-input",children:e.jsx(tn,{id:"api-name",label:"Name",placeholder:"Enter a spec name (e.g. prod-app)...",value:n,required:!0,sanitizeInput:!1,onChange:pe})}),e.jsx(Le,{tabs:[{label:"Connect to Github",value:0},{label:"Upload OpenAPI File",value:1}],onTabChange:D=>{d(D.value),f(null),M(""),C(null),j("JSON"),z(null),se(""),P(!1),O(!1)}}),i===0?e.jsx("div",{className:"github-connect-container",children:ue.length===0?e.jsxs("div",{className:"no-github-repos",children:[e.jsx(as,{}),e.jsx("div",{className:"no-github-repos-content",children:"No GitHub Repositories Connected"}),e.jsx("p",{children:"We couldn’t find any GitHub repositories in your account. Install the GitHub integration to connect your repositories and start syncing data."}),e.jsx(Ie,{primary:!0,prefixicon:e.jsx(os,{size:18}),onClick:()=>{l("/installation/integrations/github")},secondary:!0,children:"Install Integration"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"repo-selection-container",children:[e.jsxs("div",{className:"label",children:["Repository",e.jsx("span",{className:"asterisk",children:"*"})]}),e.jsx(Fe,{selectedValues:p==null?void 0:p.repo,onChange:D=>{f(A=>({repo:D,path:(A==null?void 0:A.path)??""})),y(!0),rs({repo_id:Number(D),path_type:"jsonyml"},A=>{var V,X;(V=A==null?void 0:A.data)!=null&&V.status?N(((X=A==null?void 0:A.data)==null?void 0:X.data)??[]):(console.warn(">>> error in fetching paths"),N([]))}).finally(()=>{y(!1)})},options:ue,placeholder:"Select Repo"})]}),e.jsxs("div",{className:"open-ai-path",children:[e.jsxs("div",{className:"label",children:["OpenAPI Path",e.jsx("span",{className:"asterisk",children:"*"})]}),e.jsx(Fe,{options:m??[],selectedValues:p==null?void 0:p.path,isLoading:E,disabled:E||!(p!=null&&p.repo),notFoundContent:"No paths for json/yaml files found in the repository",onChange:D=>{f(A=>({repo:(A==null?void 0:A.repo)??"",path:D})),M(""),C(null),j("JSON"),se(""),p&&!isNaN(Number(p==null?void 0:p.repo))&&D.length&&(T(!0),is({repo_id:Number(p==null?void 0:p.repo),path:D},A=>{var V,X,te;if((V=A==null?void 0:A.data)!=null&&V.status){const J=((te=(X=A==null?void 0:A.data)==null?void 0:X.data)==null?void 0:te.content)??"";M(J);const L=D;(L.endsWith(".yaml")||L.endsWith(".yml"))&&j("YAML"),C(null),ct(J,(F,ke)=>{C(F),j(ke)},F=>{console.error("Failed to parse JSON/YAML:",F),se("Invalid JSON/YAML format"),c(ne("error","Failed to parse JSON/YAML file"))},()=>O(!0),()=>O(!1)),c(ne("success","GitHub file fetched"))}else c(ne("error","Something went wrong while fetching github content!"))}).finally(()=>{T(!1)}))},placeholder:"Select path"})]})]})}):e.jsxs("div",{className:`open-api-file-uploader ${W?"file-content-present":""}`,children:[!Y&&!W&&e.jsxs("div",{className:"no-file-uploaded",children:[e.jsx(qs,{size:48,color:"var(--color-neutrals-400)"}),e.jsx("div",{className:"no-file-uploaded-content",children:"Upload OpenAPI File"}),e.jsx("p",{children:"Upload a JSON or YAML file containing your OpenAPI specification. Supported formats: .json, .yaml, .yml"})]}),e.jsx(ls,{name:"dashboard-file",onFileUpload:async D=>{const A=D[0];if(!(A!=null&&A.originFileObj)||!A)return;const V=A.name.toLowerCase();if(!(A.type==="application/json"||V.endsWith(".json")||V.endsWith(".yaml")||V.endsWith(".yml"))){c(ne("error","Only JSON or YAML files are allowed"));return}z(A),P(!0);try{const J=await nn(A.originFileObj);M(J),C(null),ct(J,L=>{C(L)},L=>{console.error("Failed to parse JSON/YAML:",L),se("Invalid JSON/YAML format"),c(ne("error","Failed to parse JSON/YAML file"))},()=>O(!0),()=>O(!1))}catch{c(ne("error","Unable to read file"))}finally{P(!1)}},multiple:!1,fileList:Y?[Y]:[],onRemove:()=>{z(null),M(""),C(null),j("JSON"),se(""),P(!1),O(!1)},onReUpload:()=>{z(null),M(""),C(null),j("JSON"),se(""),P(!1),O(!1)}})]})]}),$&&e.jsxs("div",{className:"validation-err-msg",children:[e.jsx("div",{className:"icon-container",children:e.jsx(an,{color:"var(--color-theme-bg)",size:13})}),e.jsx("div",{className:"err-msg",children:$})]}),b&&i===0&&e.jsxs("div",{className:`content-loading-container ${$?"error-present":""}`,children:[e.jsx(je,{}),e.jsx("span",{children:"Fetching File Content..."})]}),_&&i===1&&e.jsxs("div",{className:`content-loading-container upload-section ${$?"error-present":""}`,children:[e.jsx(je,{}),e.jsx("span",{children:"Reading file..."})]}),R&&W&&!b&&!_&&e.jsxs("div",{className:`content-loading-container ${i===1?"upload-section":""} ${$?"error-present":""}`,children:[e.jsx(je,{}),e.jsx("span",{children:"Parsing file content..."})]}),q,e.jsx("div",{className:"save-btn-container",children:e.jsx(Ie,{primary:!0,loading:h,disabled:!W||!n||h,onClick:async()=>{var D,A;try{v(!0);const V=Y==null?void 0:Y.originFileObj,X=V?V.name.endsWith(".yaml")||V.name.endsWith(".yml"):"JSON",te=i===0,J=te?ue.find(L=>
1L.value===(p==null?void 0:p.repo)):null;cs({project_id:((A=(D=a.user)==null?void 0:D.account)==null?void 0:A.project_id)??0,raw_spec:W,spec_format:X?"YAML":"JSON",upload_source:te?"GITHUB":"UPLOAD",metadata:{...n&&{user_file_name:n},...te&&{github_repo_name:J==null?void 0:J.label,github_repo_id:Number(p==null?void 0:p.repo),github_file_path:p==null?void 0:p.path}}},L=>{var B;(L==null?void 0:L.status)===201?(c(ne("success","OpenAPI file uploaded successfully")),r==null||r(),t(!1)):(se(((B=L==null?void 0:L.data)==null?void 0:B.error)??""),c(ne("error","Failed to upload OpenAPI file")))}).finally(()=>{v(!1)})}catch{v(!1),c(ne("error","Unable to read file"))}},children:"Add API"})})]})},Kn=({operations:s,apiDetail:t,filters:r})=>{const a=o.useMemo(()=>[x.MW_API_OPERATION_ID],[]),c=o.useCallback(n=>{const u=new Map;(n.data||[]).forEach(m=>{const N=String(m[x.MW_API_OPERATION_ID]||"");N&&u.set(N,m)});const p=new Map;s.forEach(m=>{p.set(m.id,m)});let f=[];return u.forEach((m,N)=>{var E,y;f.push({...m,[x.HTTP_REQUEST_METHOD]:((E=p.get(Number(N)))==null?void 0:E.http_method)||null,[x.MW_HTTP_ENDPOINT]:((y=p.get(Number(N)))==null?void 0:y.route_template)||null}),p.delete(Number(N))}),p.forEach((m,N)=>{f.push({[x.MW_API_OPERATION_ID]:m.id,[x.HTTP_REQUEST_METHOD]:m.http_method,[x.MW_HTTP_ENDPOINT]:m.route_template,[x.MW_API_SPEC_ID]:t!=null&&t.id?String(t.id):null,[I.SERVICE_NAME]:null,[g.TOTAL_REQUESTS]:null,[g.ERROR_RATE]:null,[g.P95_LATENCY]:null,[x.TELEMETRY_SDK_LANGUAGE]:null,[x.LIBRARY_LANGUAGE]:null})}),{...n,data:f,total_count:f.length}},[s,t==null?void 0:t.id]),l=o.useMemo(()=>[x.MW_API_OPERATION_ID,x.MW_API_SPEC_ID,I.SERVICE_NAME,g.TOTAL_REQUESTS,g.ERROR_RATE,g.P95_LATENCY,x.TELEMETRY_SDK_LANGUAGE,x.LIBRARY_LANGUAGE],[]),i=o.useMemo(()=>({[x.MW_API_SPEC_ID]:{isHidden:!0},[x.MW_API_OPERATION_ID]:{title:"Endpoint",width:400,clickActionDisabled:!0,customRender:Se(k.ENDPOINT),order:1},[I.SERVICE_NAME]:{title:"Service",width:150,customRender:(n,u)=>{const p=n;return p==null?"-":Se(k.SERVICE)(p,u)},order:2},[g.TOTAL_REQUESTS]:{title:"Requests",width:120,customRender:n=>{const u=n;return u==null?"-":Se(k.NUMBER)(u)},order:3},[g.ERROR_RATE]:{title:"Error Rate",width:120,customRender:n=>{const u=n;return u==null?"-":Se(k.PROGRESS)(u)},order:4},[g.P95_LATENCY]:{title:"P95 Latency",width:150,customRender:(n,u)=>{const p=n;return p==null?"-":Se(k.LATENCY)(p,u)},order:5},[x.TELEMETRY_SDK_LANGUAGE]:{isHidden:!0},[x.LIBRARY_LANGUAGE]:{isHidden:!0},[g.MAX_RESPONSE_TIME_NS]:{isHidden:!0}}),[]);if(!t)return e.jsx("div",{children:"No API details found"});const d=o.useMemo(()=>e.jsx("div",{className:"scope-table-header",children:e.jsx("div",{className:"scope-dropdown",children:e.jsx("span",{className:"label-text",children:"Scope to "})})}),[]);return e.jsx("div",{className:"scope-table-container",children:e.jsx($e,{resource:ce,columns:l,chartType:Ge,builderProps:{filters:r,groupBy:a,nestedProps:{columnConfig:i,titleChild:d,tableOptions:{transformTableData:c,resource:ce,filtersOptions:[{label:"Service",value:I.SERVICE_NAME}],onRowClick:n=>{}}}}},Et("scope-table-v1","trace"))})},Wn=({apiName:s,componentCount:t})=>{const r=Pe(zs),a=nt("--react-flow-color"),c=nt("--react-flow-background-color"),l=o.useMemo(()=>({customNode:Es}),[]),i=[{id:"api-node",type:"customNode",position:{x:0,y:0},data:{label:e.jsxs("div",{className:"api-name-container",children:[e.jsx("div",{className:"api-icon",children:e.jsx(we,{size:24,color:"var(--color-secondary)"})}),s]}),handleOrientation:"vertical",showBottomHandle:!0,isolateAndViewDetailButtonsVisible:!1,type:at.NONE,hideIconAndMetrics:!0}},{id:"component-node",type:"customNode",position:{x:0,y:220},data:{label:e.jsxs("div",{className:"components-count",children:[e.jsx(Xs,{color:"var(--color-primary)"}),t," Components"]}),handleOrientation:"vertical",showTopHandle:!0,isolateAndViewDetailButtonsVisible:!1,type:at.NONE,hideIconAndMetrics:!0}}],d=[{id:"api-to-components",source:"component-node",target:"api-node",sourceHandle:"top",targetHandle:"bottom",type:"smoothstep"}];return e.jsx("div",{className:"reactflow-service-wrapper",children:e.jsxs(Ts,{nodes:i,edges:d,nodeTypes:l,colorMode:r,fitView:!0,fitViewOptions:{padding:.4},minZoom:.1,maxZoom:2,zoomOnScroll:!0,zoomActivationKeyCode:"Shift",elementsSelectable:!1,nodesConnectable:!1,attributionPosition:"top-right",proOptions:{account:"paid-pro",hideAttribution:!0},children:[e.jsx(Ns,{style:{height:120},zoomable:!0,pannable:!0,color:a,bgColor:c}),e.jsx(_s,{}),e.jsx(xs,{color:a,bgColor:c,gap:20,size:3})]})})},Gn=s=>{if(!s)return"N/A";const t=Yt(s);return t.isValid()?t.format("DD MMM YYYY, hh:mm A"):"N/A"},Hn=(s,t,r)=>{var c,l,i,d;const a=[{label:"Name",value:((c=s==null?void 0:s.metadata)==null?void 0:c.user_file_name)||(s==null?void 0:s.spec_name)||"N/A",color:re.Orange},{label:"API",value:r.title??"N/A",color:re.Blue},{label:"Version",value:(s==null?void 0:s.spec_version)??"N/A",color:re.Teal},{label:"Source",value:(s==null?void 0:s.upload_source)??"N/A",color:re.Blue},{label:"Format",value:(s==null?void 0:s.spec_format)??"N/A",color:re.Grey},{label:"Last Updated",value:Gn(s==null?void 0:s.created_at),color:re.DeepSage},{label:"Tags",value:r.tags.length>0?r.tags.slice(0,10).join(", ")+(r.tags.length>10?` +${r.tags.length-3}`:""):"None",color:re.Peach},{label:"Components",value:t>0?t.toString():"N/A",color:re.Teal}];return(s==null?void 0:s.upload_source)==="GITHUB"&&(a.push({label:e.jsx(Ks,{}),value:((l=s.metadata)==null?void 0:l.github_repo_name)??"GitHub Repo",color:re.Grey}),(i=s.metadata)!=null&&i.github_file_path&&a.push({label:"File Path",value:((d=s.metadata)==null?void 0:d.github_file_path)??"N
1/A",color:re.Peach})),a},Rt=s=>{var N;const{selectedApiDetail:t}=s,[r,a]=o.useState(0),[c,l]=o.useState(""),[i,d]=o.useState([]);o.useEffect(()=>{t!=null&&t.id?ds(t.id,E=>{(E==null?void 0:E.status)===200&&(E!=null&&E.data)&&d(E.data||[])}):d([])},[t==null?void 0:t.id]);const n=o.useMemo(()=>Pt(t==null?void 0:t.raw_spec,t==null?void 0:t.spec_format),[t==null?void 0:t.raw_spec,t==null?void 0:t.spec_format]),u=o.useMemo(()=>Hn(t,(i==null?void 0:i.length)??0,n),[t,n,i]),p=E=>r===E?"var(--color-primary)":"var(--color-text)",f=o.useMemo(()=>{var y;const E=[];if(t!=null&&t.id){const b=K.Equal(x.MW_API_SPEC_ID,((y=t==null?void 0:t.id)==null?void 0:y.toString())??"");b&&E.push(b)}return E},[t==null?void 0:t.id]),m=o.useMemo(()=>{const E=[];for(const y of i){const b=K.Like("body",y==null?void 0:y.route_template);b&&E.push(b)}return[K.Or(E)]},[i]);return e.jsx("div",{className:"open-api-detail-container",children:e.jsxs(_t,{targetIndex:r,onTabChange:a,showBorderBottom:!0,children:[e.jsx(ve,{title:"Detail",prefixIcon:e.jsx(us,{color:p(0)}
1),children:e.jsxs("div",{className:"api-details-container",children:[e.jsxs("div",{className:"metadata-container",children:[e.jsx("div",{className:"title",children:"Metadata"}),e.jsx("div",{className:"metadata-details",children:u.map((E,y)=>e.jsx(on,{value:E.value,label:E.label,color:E.color},y))})]}),e.jsxs("div",{className:"endpoints-container",children:[e.jsx("div",{className:"title",children:"Endpoints"}),e.jsx(Kn,{operations:i,apiDetail:t,filters:f})]})]})}),e.jsx(ve,{title:"Relationship",prefixIcon:e.jsx(ps,{color:p(1)}),children:e.jsxs("div",{className:"relationship-tab-container",children:[e.jsx("div",{className:"service-map-container",children:e.jsx(Wn,{apiName:(t==null?void 0:t.spec_name)??"",componentCount:(t==null?void 0:t.component_count)??(i==null?void 0:i.length)??0})}),e.jsxs("div",{className:"right-section-container",children:[e.jsx("div",{className:"search-wrapper",children:e.jsx(Je,{placeholder:"Search",value:c,onChange:E=>l(E)})}),e.jsx("div",{className:"entities-container",children:e.jsx("div",{className:"child-entity-container",children:e.jsx(Fs,{title:"Entities",defaultExpanded:!0,showBorder:!1,children:(N=i==null?void 0:i.filter(E=>{var y;return(y=E.route_template)==null?void 0:y.toLowerCase().includes(c.toLowerCase())}))==null?void 0:N.map((E,y)=>e.jsxs("div",{className:"entity-container",children:[e.jsx(St,{type:E.http_method.toLowerCase(),labelText:E.http_method.toUpperCase()}),e.jsx("span",{className:"route-template-content",children:E.route_template})]},y))})})})]})]})}),e.jsx(ve,{title:"OpenAPI Preview",prefixIcon:e.jsx(ms,{color:p(2)}),children:e.jsxs("div",{className:"open-api-preview-container",children:[e.jsxs("div",{className:"validation-strip",children:[e.jsx("div",{className:"success-icon",children:e.jsx(rn,{size:13,color:"var(--color-theme-bg)"})}),"Valid OpenAPI file"]}),(t==null?void 0:t.spec_format)==="YAML"?e.jsx(At,{value:atob((t==null?void 0:t.raw_spec)??""),height:window.innerHeight-150}):e.jsx(Be,{jsonValue:JSON.parse(atob((t==null?void 0:t.raw_spec)??"").toString())})]})}),e.jsx(ve,{title:"Logs",prefixIcon:e.jsx(ys,{size:14,color:p(3)}),children:e.jsx("div",{className:"open-api-logs-container",children:e.jsx(hs,{tableColumns:fs,hasGraph:!0,multipleFilters:m})})})]})})},$n=s=>[{title:"Type",columnKey:"type",width:40,render:()=>e.jsx("div",{className:"api-icon",children:e.jsx(we,{color:"var(--color-secondary)"})})},{title:"Name",columnKey:"name",render:(t,r)=>{var l;const a=r,c=((l=a.metadata)==null?void 0:l.user_file_name)||a.spec_name||"N/A";return e.jsx(e.Fragment,{children:c})},width:200},{title:"API",columnKey:"api",render:(t,r)=>{const a=r,c=a.component_count??0;return e.jsxs("div",{className:"spec-name",children:[a.spec_name,e.jsxs("div",{className:"component-count",children:[c," components"]})]})},width:300},{title:"Spec",columnKey:"spec",render:()=>e.jsx("span",{className:"spec-badge",children:"OpenAPI"})},{title:"Source",columnKey:"upload_source",render:t=>e.jsx(e.Fragment,{children:t})},{title:"Schema Version",columnKey:"spec_version",render:t=>e.jsx(e.Fragment,{children:t})},{title:"",columnKey:Gs,render:(t,r)=>e.jsx("div",{onClick:a=>{a.stopPropagation(),s(r)},className:"delete-open-api-icon",children:e.jsx(Js,{color:"var(--color-error)"})})}],qn=({initialAction:s,initialSpecId:t,onActionComplete:r}={})=>{var W,M,w;const[a,c]=o.useState(!1),[l,i]=o.useState([]),[d,n]=o.useState(null),[u,p]=o.useState(null),[f,m]=o.useState(!1),[N,E]=o.useState(0),[y,b]=o.useState(1),[T,h]=o.useState(!1),v=Oe(),_=gs("api-list"),{searchParams:P}=_,R=P.search||"",O=20,Y=o.useCallback(()=>{h(!0),Tt(R,y,O,void 0,C=>{if(h(!1),(C==null?void 0:C.status)===200){const G=C.data;G!=null&&G.data&&typeof G.total_count=="number"&&(i(G.data||[]),E(G.total_count||0))}})},[R,y]),z=o.useCallback(()=>{u&&(m(!0),Ss(u.id,C=>{m(!1),C.status===200?(v(ne("success","Spec deleted successfully")),p(null),Y()):v(ne("error","Failed to delete spec"))}))},[u,v,Y]);return o.useEffect(()=>{b(1)},[R]),o.useEffect(()=>{Y()},[Y]),o.useEffect(()=>{s==="add"?(c(!0),r&&r()):s==="view"&&t&&Re(t,C=>{(C==null?void 0:C.status)===200&&(C!=null&&C.data)&&n(C.data),r&&r()},v)},[s,t,r]),e.jsxs("div",{className:"api-list-panel",children:[e.jsx("div",{className:"api-list-search-container",children:e.jsx(ln,{caller:"api-list",placeholder:"Search by Spec Name, API Name, or Source",extraJSXElement:e.jsx(Ie,{secondary:!0,prefixicon:e.jsx(ze,{color:"var(--color-primary)"}),onClick:()=>c(!0),children:"Add New API"})})}),a&&e.jsx(Te,{title:"Add New API",isOpen:a,onBackBtnClick:()=>c(!1),onClose:()=>c(!1),size:"xxs",datePicker:!1,bodyPadding:!1,shouldCloseOnOverlayClick:!1,children:e.jsx(Mt,{setAddAPIPanel:c,fetchAPIListAndOperations:Y})}
1),e.jsx(Qe,{customFilterProps:{filterOptions:[],resource:""},statsData:{filtered:l.length,total:N,label:"active of ",totalLabel:"Total"},children:e.jsx(qe,{uniqId:"app-api-listing-v1",loading:T,columns:$n(C=>p(C)),dataProvider:l,pagination:{totalRecords:N,page:y,recordsPerPage:O,onChange:C=>{b(C)}},rowOnClick:C=>{Re(C.id,j=>{(j==null?void 0:j.status)===200&&(j!=null&&j.data)&&n(j.data)},v)}})}),e.jsx(Te,{dialogContentClassName:"open-api-detail-panel",isOpen:d!==null,onClose:()=>n(null),onBackBtnClick:()=>n(null),bodyPadding:!1,datePicker:!1,headerElements:e.jsx(e.Fragment,{children:e.jsxs("div",{className:"open-api-panel-header",children:[e.jsx("div",{className:"icon-container",children:e.jsx(we,{size:18,color:"var(--color-secondary)"})}),d==null?void 0:d.spec_name]})}),children:e.jsx(Rt,{selectedApiDetail:d})}),e.jsx(js,{isOpen:u!==null,onClose:()=>{p(null)},type:Cs.Delete,headerIcon:e.jsx(As,{}),title:"Delete API Spec",description:e.jsxs(e.Fragment,{children:["Deleting this"," ",e.jsx("strong",{children:((W=u==null?void 0:u.metadata)==null?void 0:W.user_file_name)||(u==null?void 0:u.spec_name)})," ","is irreversible & permanent. Delete when you are sure"]}),entityName:((M=u==null?void 0:u.metadata)==null?void 0:M.user_file_name)||(u==null?void 0:u.spec_name)||"",entityType:"Spec",enableDoubleConfirmation:!0,confirmBtnText:"Yes, Delete",cancelBtnText:"No, Keep it",handleConfirmEvent:z,handleCancelEvent:()=>{p(null)},isLoading:f,inputPlaceholder:`${((w=u==null?void 0:u.metadata)==null?void 0:w.user_file_name)||(u==null?void 0:u.spec_name)||""}`})]})},Jn=({service:s})=>{var st;const t=Pe(ft),r=Pe(yt),a=Oe(),c=bs(),l=Bt(),i=ot("endpoint"),d=ot("syntheticTests"),n=o.useMemo(()=>Et("endpoints-list-v1","trace"),[]),u=o.useMemo(()=>c.selectors.getMetrics,[c.selectors.getMetrics]),p=o.useCallback((U,S,Q)=>{A({selected_url:U,selected_method:S,tags:Q||[]}),pe(!0)},[]),f=o.useCallback(()=>{q(!0)},[]),m=o.useCallback(U=>{Re(U,S=>{var Q,oe;(S==null?void 0:S.status)===200&&S!=null&&S.data&&((Q=S==null?void 0:S.data)!=null&&Q.message&&((oe=S==null?void 0:S.data)!=null&&oe.message.includes("spec not found"))?a(ne("warning","API Spec not found or deleted")):fe(S.data))},a)},[a]),[N,E]=o.useState(new Map),y=o.useMemo(()=>({[i]:{order:0,title:"Endpoint",width:400,metricKey:i,defaultSelected:!0,renderType:k.ENDPOINT,clickActionDisabled:!0,tooltipContent:""},[x.MW_HTTP_ENDPOINT]:{order:1,title:"HTTP Endpoint",width:200,metricKey:x.MW_HTTP_ENDPOINT,defaultSelected:!1,renderType:k.API_NAME,clickActionDisabled:!0,tooltipContent:""},[I.SERVICE_NAME]:{order:2,title:"Service",width:120,metricKey:I.SERVICE_NAME,defaultSelected:l.pathname.includes("endpoints"),renderType:k.SERVICE,clickActionDisabled:!0,tooltipContent:""},[g.TOTAL_REQUESTS]:{order:3,title:"Requests",width:60,metricKey:g.TOTAL_REQUESTS,defaultSelected:!0,skipApiCall:!0,renderType:k.NUMBER},[g.REQUEST_RATE]:{order:4,title:"Request Rate",width:60,metricKey:g.REQUEST_RATE,defaultSelected:!1,skipApiCall:!0,renderType:k.RATE},[g.ERROR_RATE]:{order:5,title:"Error Rate",width:60,metricKey:g.ERROR_RATE,defaultSelected:!0,skipApiCall:!0,renderType:k.PROGRESS},[g.SUCCESS_RATE]:{order:6,title:"Success Rate",width:60,metricKey:g.SUCCESS_RATE,defaultSelected:!1,skipApiCall:!0,renderType:k.PROGRESS,progressProps:{successMetric:!0}},[g.P50_LATENCY]:{order:7,title:"P50 Latency",width:80,metricKey:g.P50_LATENCY,defaultSelected:!1,skipApiCall:!0,renderType:k.LATENCY},[g.P75_LATENCY]:{order:8,title:"P75 Latency",width:80,metricKey:g.P75_LATENCY,defaultSelected:!1,skipApiCall:!0,renderType:k.LATENCY},[g.P90_LATENCY]:{order:9,title:"P90 Latency",width:80,metricKey:g.P90_LATENCY,defaultSelected:!1,skipApiCall:!0,renderType:k.LATENCY},[g.P95_LATENCY]:{order:10,title:"P95 Latency",width:80,metricKey:g.P95_LATENCY,defaultSelected:!0,skipApiCall:!0,renderType:k.LATENCY},[g.P99_LATENCY]:{order:11,title:"P99 Latency",width:80,metricKey:g.P99_LATENCY,defaultSelected:!0,skipApiCall:!0,renderType:k.LATENCY},[x.MW_API_SPEC_ID]:{order:12,title:"API",width:180,metricKey:x.MW_API_SPEC_ID,defaultSelected:!0,clickActionDisabled:!0,renderType:k.API_SPEC,onOpenAPIDetailsPanel:m,onOpenAddAPIPanel:f},[d]:{order:13,title:"Synthetic Tests",width:120,metricKey:d,defaultSelected:!1,skipApiCall:!0,clickActionDisabled:!0,renderType:k.SYNTHETIC_TESTS,onSetupClick:p},[g.MAX_RESPONSE_TIME_MS]:{order:14,title:"Max Response Time",width:120,metricKey:g.MAX_RESPONSE_TIME_MS,defaultSelected:!1,renderType:k.LATENCY},[g.SUCCESS_COUNT]:{order:15,title:"Success Count",width:120,metricKey:g.SUCCESS_COUNT,skipApiCall:!0,defaultSelected:!1,renderType:k.NUMBER},[g.ERROR_COUNT]:{order:16,title:"Error Count",width:120,metricKey:g.ERROR_COUNT,skipApiCall:!0,defaultSelected:!1,renderType:k.NUMBER}}),[l.pathname,p,m,f]),b=o.useMemo(()=>Object.entries(y).map(([U,S])=>({label:S.title,value:U,defaultSelected:S.defaultSelected??!1})),[y]),T=o.useMemo(()=>b.map(U=>U.value),[b]),{baseColumns:h,dropdownFilterOptions:v,loading:_,handleSearch:P}=Is(Us.TRACE,b,u),R=o.useMemo(()=>({apiSpecsMap:N}),[N]),{columnsFilterOptions:O,requestColumns:Y,columnsConfig:z}=Ps(y,Ls,n,h,R),W=o.useMemo(()=>Y,[JSON.stringify(Y)]),M=o.useMemo(()=>{const U=new Map(O.map(S=>[S.value,S.defaultSelected]));return v.map(S=>({...S,defaultSelected:U.get(S.value)??!1}))},[v,O]),w=vs(M,n,T),C=Ms(O,n),G=Rs(n),[j,$]=o.useState(null),[se,ae]=o.useState(!1),[ue,pe]=o.useState(!1),[me,he]=o.useState(!1),[Z,q]=o.useState(!1),[ee,fe]=o.useState(null),ye=o.useCallback(U=>{var S;if(!U.inflight&&!U.pollerInflight&&((S=U==null?void 0:U.gridviewData)!=null&&S.data)){const Q=U.gridviewData.data,oe=ws(Q.map(xe=>parseInt(xe[x.MW_API_SPEC_ID],10)));oe.length>0&&_e(oe)}},[]),_e=o.useCallback(U=>{Tt(void 0,void 0,void 0,U,S=>
1{if((S==null?void 0:S.status)===200&&(S!=null&&S.data)){const Q=S.data,oe=Q!=null&&Q.data&&Array.isArray(Q.data)?Q.data:Array.isArray(Q)?Q:[];if(oe.length>0){const xe=new Map;oe.forEach(Ee=>{Ee.id&&xe.set(Ee.id,Ee)}),E(xe)}}})},[]),[D,A]=o.useState({selected_url:"",selected_method:"",tags:[]}),V=o.useMemo(()=>{const U={},S=Ft(),oe=[I.SERVICE_NAME,x.MW_HTTP_ENDPOINT,x.HTTP_REQUEST_METHOD].map(Ee=>Ee===I.SERVICE_NAME&&s?S.Equal(Ee,s):S.NotEqual(Ee,"''")),xe=S.And([...oe]);return Object.assign(U,xe),U},[s]),X=o.useMemo(()=>t?r.filters:[],[t,r.filters]),te=o.useMemo(()=>t?r.groupBy:[x.MW_HTTP_ENDPOINT,x.HTTP_REQUEST_METHOD,I.SERVICE_NAME],[t,r.groupBy]),J=o.useMemo(()=>({noOfRecordsPerPage:t?r.pagination.noOfRecordsPerPage:50,limit:t?r.pagination.limit:500,showPrevNextPagination:!0}),[t,r.pagination]),L=o.useMemo(()=>[de.QUICKWIT,de.ZAP_MODE],[]),B=o.useMemo(()=>t?X:[V],[t,X,V]),F=o.useMemo(()=>e.jsxs("div",{className:"api-catalogue-table-title",children:["Endpoints",e.jsx("div",{children:e.jsx(Ie,{outlined:!0,prefixicon:e.jsx(we,{}),onClick:()=>he(!0),children:"View APIs"})})]}),[]),ke=o.useCallback(U=>{const S=U.row;$(S),ae(!0)},[]),wt=o.useMemo(()=>e.jsx(Nt,{exmpySpaceText:e.jsx("span",{children:"No endpoints found. Additional endpoints may appear with filters."})}),[]),et=o.useMemo(()=>({onRowClick:ke,columnsSelection:M,onColumnsChange:w,onColumnWidthOrderChange:C,onDefaultLabelClick:G,onSearch:P,searchLoading:_,pollerInflight:!0,cellClassName:"api-catalogue-cell",maxColumns:20,maxHeight:"calc(100vh - 270px)",pagination:J,firstClickSortDesc:!0,noDataLabel:wt}),[ke,M,w,C,G,P,_,J]),tt=o.useMemo(()=>({columnConfig:z,onDataReceived:ye,titleChild:F,tableOptions:et}),[z,ye,F,et]),Ot=o.useMemo(()=>[{key:g.TOTAL_REQUESTS,direction:H.Desc}],[]),Lt=o.useMemo(()=>({nestedProps:tt,quickWitTotalRowCol:Os.MW_HTTP_ENDPOINT,extraParams:L,filters:B,sortBy:Ot,groupBy:te}),[tt,L,B,te]),kt=o.useMemo(()=>e.jsxs("div",{className:"endpoints-header",children:[e.jsx("div",{className:"endpoints-title",children:j&&Se(k.ENDPOINT)({},j)}),e.jsx("div",{className:"endpoints-actions",children:e.jsx(Ie,{secondary:!0,prefixicon:e.jsx(ze,{color:"var(--color-primary)"}),onClick:()=>{pe(!0),A({selected_url:`https://[DOMAIN]${j==null?void 0:j[x.MW_HTTP_ENDPOINT]}`,selected_method:(j==null?void 0:j[x.HTTP_REQUEST_METHOD])||"",tags:[j!=null&&j[I.SERVICE_NAME]?`service:${j==null?void 0:j[I.SERVICE_NAME]}`:"",j!=null&&j[x.HTTP_REQUEST_METHOD]?`method:${j==null?void 0:j[x.HTTP_REQUEST_METHOD]}`:"",j!=null&&j[x.MW_HTTP_ENDPOINT]?`route:${j==null?void 0:j[x.MW_HTTP_ENDPOINT]}`:""].filter(Boolean)})},children:"Add API Test"})})]}),[j]);return e.jsxs("div",{className:"api-catalogue-list",children:[e.jsx($e,{chartType:Ge,columns:W,resource:ce,uniqName:n,builderProps:Lt},n),j&&se&&e.jsx(Te,{shouldCloseOnOverlayClick:!1,headerElements:kt,isOpen:se,dataTestIdBackAction:"panel-back-apm-api-catalogue",dataTestIdCloseAction:"panel-close-apm-api-catalogue",dataTestIdDatePicker:"panel-datepicker-apm-api-catalogue",dialogContentClassName:"endpoints-panel",onClose:()=>{ae(!1),$(null)},onBackBtnClick:()=>{ae(!1),$(null)},bodyPadding:!1,children:e.jsx(Fn,{api:j,onOpenAddAPIPanel:()=>{q(!0)},onOpenAPIDetailsPanel:U=>{Re(U,S=>{(S==null?void 0:S.status)===200&&(S!=null&&S.data)&&fe(S.data)},a)}})}),ue&&e.jsx(Te,{title:"Setup synthetic Test",isOpen:ue,onClose:()=>{pe(!1)},onBackBtnClick:()=>{pe(!1)},bodyPadding:!1,dataTestIdBackAction:"panel-back-apm-api-catalogue-synthetic-setup",dataTestIdCloseAction:"panel-close-apm-api-catalogue-synthetic-setup",dataTestIdDatePicker:"panel-datepicker-apm-api-catalogue-synthetic-setup",children:e.jsx(Ys,{url:D.selected_url,method:D.selected_method,additionalTags:D.tags})}),me&&e.jsx(Te,{isOpen:me,onClose:()=>he(!1),datePicker:!1,onBackBtnClick:()=>he(!1),title:"API List",children:e.jsx(qn,{})}),Z&&e.jsx(Te,{title:"Add New API",isOpen:Z,onBackBtnClick:()=>q(!1),onClose:()=>q(!1),size:"xxs",datePicker:!1,bodyPadding:!1,shouldCloseOnOverlayClick:!1,children:e.jsx(Mt,{setAddAPIPanel:q})}),ee&&e.jsx(Te,{dialogContentClassName:"open-api-detail-panel",isOpen:ee!==null,onClose:()=>fe(null),onBackBtnClick:()=>fe(null),bodyPadding:!1,datePicker:!1,headerElements:e.jsx(e.Fragment,{children:e.jsxs("div",{className:"open-api-panel-header",children:[e.jsx("div",{className:"icon-container",children:e.jsx(we,{size:18,color:"var(--color-secondary)"})}),((st=ee==null?void 0:ee.metadata)==null?void 0:st.user_file_name)||(ee==null?void 0:ee.spec_name)]})}),children:e.jsx(Rt,{selectedApiDetail:ee})})]})},za=()=>ks()(cn.APMEndpoints)?e.jsxs("div",{className:"apm-api-catalogue",children:[e.jsx("div",{className:"header-view",children:e.jsx(Vs,{placeholder:"Search by name, tag, label or annotation",regexSearch:x.MW_HTTP_ENDPOINT})}),e.jsx("div",{className:"api-catalogue-list",children:e.jsx(Jn,{})})]}):e.jsx(Ds,{});export{za as default};

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