import{c as h,e as S,j as o,A as x,S as d,f as j,h as b,a as g,d as y,O as N,N as p}from"./index-oE_2MbI2.js";function R(e){const t=h.c(5),{appName:l}=e;let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const n=g(s);let a;if(t[1]!==n){const r=new URLSearchParams;for(const[_,u]of Object.entries(n))u!=null&&r.set(_,String(u));a=r.toString(),t[1]=n,t[2]=a}else a=t[2];const f=a,c=`/store/${encodeURIComponent(l)}${f?`?${f}`:""}`;let i;return t[3]!==c?(i=o.jsx(p,{to:"/login",search:{next:c},replace:!0}),t[3]=c,t[4]=i):i=t[4],i}function $(){const e=h.c(10);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={strict:!1},e[0]=t):t=e[0];const{appName:l}=S(t);let s;e[1]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},e[1]=s):s=e[1];const n=g(s),{data:a,isPending:f}=y.useListOrganizations();if(f){let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(d,{}),e[2]=r):r=e[2],r}const m=a?.[0];if(!m){let r;return e[3]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(p,{to:"/",replace:!0}),e[3]=r):r=e[3],r}let c;e[4]!==l||e[5]!==m.slug?(c={org:m.slug,project:N,appName:l},e[4]=l,e[5]=m.slug,e[6]=c):c=e[6];let i;return e[7]!==n||e[8]!==c?(i=o.jsx(p,{to:"/$org/$project/store/$appName",params:c,search:n,replace:!0}),e[7]=n,e[8]=c,e[9]=i):i=e[9],i}function v(){const e=h.c(5);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={strict:!1},e[0]=t):t=e[0];const{appName:l}=S(t);let s;e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(x,{children:o.jsx(d,{})}),e[1]=s):s=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(j,{children:o.jsx($,{})}),e[2]=n):n=e[2];let a;return e[3]!==l?(a=o.jsxs(o.Fragment,{children:[s,n,o.jsx(b,{children:o.jsx(R,{appName:l})})]}),e[3]=l,e[4]=a):a=e[4],a}export{v as default};
