import{at as e,lt as t}from"./vscode-api-DjORcpSo.js";import{n}from"./react-0SBwfqBm.js";var r=t(),i=e({kind:`closed`});function a(){let e=(0,r.c)(26),[t,a]=n(i),c;e[0]===a?c=e[1]:(c=(e,t)=>{let n=t===void 0?{}:t;a({kind:`installing`,installStarted:!1,origin:n.origin,postInstallComposerPrefill:n.postInstallComposerPrefill,plugin:e})},e[0]=a,e[1]=c);let l=c,u;e[2]===a?u=e[3]:(u=(e,t)=>{let n=t===void 0?{}:t;a({kind:`details`,origin:n.origin,postInstallComposerPrefill:n.postInstallComposerPrefill,plugin:e})},e[2]=a,e[3]=u);let d=u,f;e[4]===a?f=e[5]:(f=()=>{a({kind:`closed`})},e[4]=a,e[5]=f);let p=f,m;e[6]===a?m=e[7]:(m=e=>{let{apps:t,browserExtensions:n,connectingAppId:r,options:i,plugin:o}=e,c=t.map(s),l=c.find(e=>e.app.id===r);if(l==null){a({kind:`needsApps`,origin:i?.origin,postInstallComposerPrefill:i?.postInstallComposerPrefill,plugin:o,requiredApps:c,requiredBrowserExtensions:n});return}a({kind:`connectApp`,origin:i?.origin,postInstallComposerPrefill:i?.postInstallComposerPrefill,plugin:o,app:l.app,requiredApps:c,requiredBrowserExtensions:n})},e[6]=a,e[7]=m);let h=m,g;e[8]===a?g=e[9]:(g=e=>{a(t=>{if(t.kind!==`needsApps`)return t;let n=t.requiredApps.find(t=>t.app.id===e);return n==null?t:{kind:`connectApp`,origin:t.origin,postInstallComposerPrefill:t.postInstallComposerPrefill,plugin:t.plugin,app:n.app,requiredApps:t.requiredApps,requiredBrowserExtensions:t.requiredBrowserExtensions}})},e[8]=a,e[9]=g);let _=g,v;e[10]===a?v=e[11]:(v=()=>{a(o)},e[10]=a,e[11]=v);let y=v,b;e[12]===a?b=e[13]:(b=e=>{a(t=>t.kind!==`installing`||t.plugin.plugin.id!==e||t.installStarted?t:{...t,installStarted:!0})},e[12]=a,e[13]=b);let x=b,S;e[14]===a?S=e[15]:(S=e=>{let{appId:t,status:n}=e;a(e=>e.kind!==`needsApps`&&e.kind!==`connectApp`?e:{...e,requiredApps:e.requiredApps.map(e=>e.app.id===t?{...e,status:n}:e)})},e[14]=a,e[15]=S);let C=S,w;return e[16]!==p||e[17]!==y||e[18]!==x||e[19]!==C||e[20]!==l||e[21]!==d||e[22]!==_||e[23]!==t||e[24]!==h?(w={closePluginInstallAppConnect:y,closePluginInstall:p,markPluginInstallStarted:x,markRequiredAppStatus:C,openPluginInstallDetails:d,openPluginInstall:l,openRequiredAppConnect:_,session:t,setPluginInstallNeedsApps:h},e[16]=p,e[17]=y,e[18]=x,e[19]=C,e[20]=l,e[21]=d,e[22]=_,e[23]=t,e[24]=h,e[25]=w):w=e[25],w}function o(e){return e.kind===`connectApp`?e.requiredApps.length===1&&e.requiredBrowserExtensions.length===0&&e.requiredApps[0]?.status!==`connected`?{kind:`closed`}:{kind:`needsApps`,origin:e.origin,postInstallComposerPrefill:e.postInstallComposerPrefill,plugin:e.plugin,requiredApps:e.requiredApps,requiredBrowserExtensions:e.requiredBrowserExtensions}:e}function s(e){return{app:e,status:`pending`}}export{a as t};
//# sourceMappingURL=plugin-install-store-CHc59NhL.js.map