const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-react-DSi8mF-Y.js","assets/rolldown-runtime-BYbx6iT9.js","assets/vendor-datadog-eWvmqSO2.js","assets/vendor-core-D9powGyb.js","assets/vendor-misc-Ca8iItyG.js","assets/vendor-markdown-DeC1X8Ke.js","assets/vendor-html-jhAE4vhH.js","assets/vendor-monaco-BjKaEiEl.js","assets/vendor-charts-DtHP1WJd.js","assets/vendor-react-CrIa5r46.css"])))=>i.map(i=>d[i]);
import{a as e}from"./rolldown-runtime-BYbx6iT9.js";import{t}from"./button-Nyh_djVh.js";import{Br as n,Ca as r,Fa as i,Pa as a,ga as o,ja as s,ka as c}from"./vendor-react-DSi8mF-Y.js";import{i as l}from"./vendor-datadog-eWvmqSO2.js";import{L as u,a as d,b as f,i as p,o as m,r as h,y as g,z as _}from"./index-CWeBJPXe.js";var v=[{fn:{requestSnippetGenerator_fetch:e=>{let t=new URL(e.get(`url`)),n=!1,r=e.get(`headers`);r&&r.size&&r.map((e,t)=>{n||=/^content-type$/i.test(t)&&/^multipart\/form-data$/i.test(e)});let i=e.get(`body`),a=e.get(`method`);if(i){if(n&&[`POST`,`PUT`,`PATCH`].includes(a))return`throw new Error("Currently unsupported content-type: /^multipart\\/form-data$/i");`;typeof i!=`string`&&(i=JSON.stringify(i,null,`	`))}else !i&&a===`POST`&&(i=``);let o="`"+(i||``).replace(/\\n/g,`
`).replace(/`/g,"\\`")+"`";return`const response = await fetch("${t.toString()}", {
\tmethod: "${e.get(`method`)}",${r&&r.size?`
\theaders: {
\t\t${r.map((e,t)=>`"${t}": "${e}"`).valueSeq().join(`,
		`)}
\t},`:``}${i?`
\tbody: ${o},`:``}
});
const data = await response.json();
console.log(data);
`}}}],y={generators:{fetch:{title:`Fetch`,syntax:`javascript`}}};function b({entityId:e,instanceClient:t}){return c({queryKey:[e,`OpenAPI`],queryFn:async()=>{let{data:e}=await t.get(`/api/openapi/rest`);return e}})}var x=e(i(),1),S=a(),C=(0,x.lazy)(()=>l(()=>import(`./vendor-react-DSi8mF-Y.js`).then(e=>e.x),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function w(){let{instanceId:e,clusterId:i}=r({strict:!1}),a=u(),{data:o,isLoading:c}=s(p(a)),{data:l,isLoading:w}=s(h(a)),T=m(),{data:E,isLoading:D,error:O}=s(b(a));E?.servers?.length&&(E.servers[0].url=T);let k=o?.http,A=``,j=k?.cors===!1,M=k?.corsAccessList?.length!==void 0&&!k.corsAccessList.includes(`*`)&&!k.corsAccessList.includes(`null`)&&!k.corsAccessList.includes(window.location.origin);j?A=`This ${i&&!e?`cluster`:`instance`} has CORS disabled currently, so you won't be able to execute API requests from the browser.`:M&&(A=`This ${i&&!e?`cluster`:`instance`} has CORS enabled, but ${window.location.origin} is not allowed, so you won't be able to execute API requests from the browser.`);let{onConfigUpdate:N,isPending:P}=d(),F=(0,x.useCallback)(()=>{N({...j?{http_cors:!0}:{},...M?{http_corsAccessList:[...k?.corsAccessList??[],window.location.origin]}:{}})},[j,k?.corsAccessList,M,N]);if(c||w||D)return(0,S.jsx)(f,{centered:!0,text:`Looking up your instance configuration, one moment.`});if(O){let e;return e=l?.version&&!g(`4.7.0-beta.7`,l?.version)?`API Docs are only available starting in version '4.7.0-beta.7' of Harper, please update your version ${l.version}!`:`We weren't able to look up your docs. Please check the Network tab of your developer tools to see why the docs were not accessible to Studio.`,(0,S.jsx)(_,{title:`API Docs Unavailable`,error:{message:e},showReturnToHome:!1})}return(0,S.jsxs)(S.Fragment,{children:[A&&(0,S.jsx)(_,{title:`CORS Disabled: HTTP API Not Accessible`,className:`mt-0 mx-4 m-0 border-yellow text-yellow`,error:{message:A},showReturnToHome:!1,children:(0,S.jsxs)(t,{type:`button`,disabled:P,variant:`warning`,className:`rounded-full`,onClick:F,children:[(0,S.jsx)(n,{}),P?`Enabling CORS...`:`Enable CORS for ${window.location.origin}`]})}),(0,S.jsx)(x.Suspense,{fallback:(0,S.jsx)(f,{centered:!0,text:`Loading API documentation...`}),children:(0,S.jsx)(C,{spec:E,persistAuthorization:!0,withCredentials:!0,requestSnippetsEnabled:!0,defaultModelRendering:`model`,requestSnippets:y,plugins:v,tryItOutEnabled:!0})})]})}var T=o(`/apis`)({component:w});export{T as route};
//# sourceMappingURL=index.lazy-DI14kJT2.js.map