try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`8defc3b4-2cb6-45ff-b364-b7a7a9fd0c8e`,e._sentryDebugIdIdentifier=`sentry-dbid-8defc3b4-2cb6-45ff-b364-b7a7a9fd0c8e`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{Ag as t,Bm as n,Dg as r,Ig as i,Jm as a,Sr as o,X as s,Ym as c,Z as l,sh as u,th as d,tp as f}from"./entry.client-dr7r6s9a.js";import{r as p,t as m}from"./openDialogSchema-jdirgrus.js";var h=o(),g=e(i(),1);function _(e){return()=>{let t=[];return e.isFeatureEnabled||t.push(`enableOutofStreamPurchase feature gate is off`),e.isFullySignedIn||t.push(`user is not fully signed in  `),{canOpen:t.length===0,blockers:t}}}function v(){let{authentication:e,configuration:t}=u(),{data:n}=r(e.queries.authenticationState.getOptions()),{data:i}=r(t.queries.configuration.getOptions(`enableOutofStreamPurchase`)),a=t.castAsConfiguration(i,`enableOutofStreamPurchase`)??!1,o=n===f.FullySignedIn;return(0,g.useMemo)(()=>_({isFeatureEnabled:a,isFullySignedIn:o}),[a,o])}function y(){let e=v();return(0,g.useMemo)(()=>({[s.purchase.fullPath]:e}),[e])}var b=t(),x=()=>{let e=(0,h.c)(10),{getLogger:t}=d(),n=(0,g.useRef)(null),[r,i]=a(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={location:`OpenDialogLayout`},e[0]=o):o=e[0];let s=l(o),c=y(),u;e[1]===i?u=e[2]:(u=()=>{i(e=>{let t=new URLSearchParams(e);return t.delete(m),t},{replace:!0})},e[1]=i,e[2]=u);let f=u,_,v;return e[3]!==r||e[4]!==t||e[5]!==c||e[6]!==s||e[7]!==f?(_=()=>{let e=r.get(m);if(!e||e===n.current)return;let i=p(r);if(!i)return;let a=t(`OpenDialogLayout`),o=c[i.key];if(o){let e=o();if(!e.canOpen){a.info(`Dialog "${i.key}" cannot open yet. Blockers: [${e.blockers.join(`; `)}]`);return}}n.current=e,a.info(`Opening dialog "${i.key}"${o?``:` (no guard registered)`}.`),s(i),f()},v=[t,c,s,r,f],e[3]=r,e[4]=t,e[5]=c,e[6]=s,e[7]=f,e[8]=_,e[9]=v):(_=e[8],v=e[9]),(0,g.useEffect)(_,v),null},S=c(()=>{let e=(0,h.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(x,{}),(0,b.jsx)(n,{})]}),e[0]=t):t=e[0],t});export{S as default};