const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/swagger-ui-react-BlFjEb7-.js","assets/rolldown-runtime-Cyuzqnbw.js","assets/index-BVrdu45I.js","assets/vendor-datadog-Bq_0f1ke.js","assets/vendor-ui-BjvqsBPj.js","assets/vendor-core-BIhSIGPv.js","assets/vendor-react-BqTNj-ZI.js","assets/vendor-tanstack-CnTDU3TP.js","assets/createLucideIcon-D6HmSa4x.js","assets/button-CwKyGWmW.js","assets/index-4SnhgI3C.css","assets/with-selector-DZDEkpbZ.js"])))=>i.map(i=>d[i]);
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{t}from"./button-CwKyGWmW.js";import{A as n,C as r,M as i,h as a}from"./vendor-tanstack-CnTDU3TP.js";import{a as o,i as s}from"./vendor-datadog-Bq_0f1ke.js";import{r as c}from"./vendor-react-BqTNj-ZI.js";import{F as l,I as u,Zt as d,an as f,gn as p,gt as m,ht as h,z as g}from"./index-BVrdu45I.js";import{t as _}from"./useEntityRestURL-BIjLbV9n.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 n({queryKey:[e,`OpenAPI`],queryFn:async()=>{let{data:e}=await t.get(`/api/openapi/rest`);return e}})}var x=e(o(),1),S=c(),C=(0,x.lazy)(()=>s(()=>import(`./swagger-ui-react-BlFjEb7-.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])));function w(){let{instanceId:e,clusterId:n}=r({strict:!1}),a=d(),{data:o,isLoading:s}=i(u(a)),{data:c,isLoading:w}=i(l(a)),T=_(),{data:E,isLoading:D,error:O}=i(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 ${n&&!e?`cluster`:`instance`} has CORS disabled currently, so you won't be able to execute API requests from the browser.`:M&&(A=`This ${n&&!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}=g(),F=(0,x.useCallback)(()=>{N({...j?{http_cors:!0}:{},...M?{http_corsAccessList:[...k?.corsAccessList??[],window.location.origin]}:{}})},[j,k?.corsAccessList,M,N]);if(s||w||D)return(0,S.jsx)(m,{centered:!0,text:`Looking up your instance configuration, one moment.`});if(O){let e;return e=c?.version&&!h(`4.7.0-beta.7`,c?.version)?`API Docs are only available starting in version '4.7.0-beta.7' of Harper, please update your version ${c.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)(f,{title:`API Docs Unavailable`,error:{message:e},showReturnToHome:!1})}return(0,S.jsxs)(`div`,{className:`pt-6`,children:[A&&(0,S.jsx)(f,{title:`CORS Disabled: HTTP API Not Accessible`,className:`mt-0 mx-4 mb-4 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)(p,{}),P?`Enabling CORS...`:`Enable CORS for ${window.location.origin}`]})}),(0,S.jsx)(x.Suspense,{fallback:(0,S.jsx)(m,{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=a(`/apis`)({component:w});export{T as route};
//# sourceMappingURL=index.lazy-MBZ9J3-b.js.map