import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{Mn as i,Un as a,ba as o,c as s,kn as c}from"./index-qNrVJp-y.js";var l=n(),u=e(t(),1),d=r();function f(){let e=(0,l.c)(26),{extensionId:t,pageId:n}=o(),r=c(),f=a(m),g=a(p),_,v,y;e[0]!==t||e[1]!==r||e[2]!==n?(_=t?r.find(e=>e.id===t&&i(e)):void 0,v=_?.ui?.contributions?.pages,y=t&&v?.length?n?v.find(e=>e.id===n||e.id===`${t}.${n}`):v[0]:void 0,e[0]=t,e[1]=r,e[2]=n,e[3]=_,e[4]=v,e[5]=y):(_=e[3],v=e[4],y=e[5]);let b=y,x,S;if(e[6]!==g||e[7]!==_||e[8]!==t||e[9]!==b||e[10]!==f?(x=()=>{if(!t||!_||!b)return g(),()=>g();let e=b.title?.trim()||_.name||t;return f({startExtra:null,main:(0,d.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,d.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,title:e,children:e})}),end:null}),()=>g()},S=[g,_,t,b,f],e[6]=g,e[7]=_,e[8]=t,e[9]=b,e[10]=f,e[11]=x,e[12]=S):(x=e[11],S=e[12]),(0,u.useLayoutEffect)(x,S),!t){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,d.jsx)(h,{message:`No extension ID provided.`}),e[13]=t):t=e[13],t}if(!_){let n=`Extension "${t}" not found or has no UI.`,r;return e[14]===n?r=e[15]:(r=(0,d.jsx)(h,{message:n}),e[14]=n,e[15]=r),r}if(!v?.length){let n=`Extension "${t}" has no page contributions.`,r;return e[16]===n?r=e[17]:(r=(0,d.jsx)(h,{message:n}),e[16]=n,e[17]=r),r}if(!b){let r=`Page "${n}" not found in extension "${t}".`,i;return e[18]===r?i=e[19]:(i=(0,d.jsx)(h,{message:r}),e[18]=r,e[19]=i),i}let C=_.ui?.permissions,w;return e[20]!==_.name||e[21]!==t||e[22]!==b.entrypoint||e[23]!==b.title||e[24]!==C?(w=(0,d.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,d.jsx)(s,{extensionId:t,extensionName:_.name,entrypoint:b.entrypoint,permissions:C,title:b.title,className:`min-h-0 flex-1`,fixedHeight:void 0,maxHeight:99999})}),e[20]=_.name,e[21]=t,e[22]=b.entrypoint,e[23]=b.title,e[24]=C,e[25]=w):w=e[25],w}function p(e){return e.clearPageHeader}function m(e){return e.setPageHeader}function h(e){let t=(0,l.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,d.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-1 items-center justify-center`,children:(0,d.jsx)(`div`,{className:`text-center`,children:(0,d.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})})}),t[0]=n,t[1]=r),r}export{f as ExtensionPage};