import{Qi as e,ct as t,gt as n,na as r,nt as i,pt as a}from"./src-BOCweS1p.js";import{o}from"./use-plugins-C_eNkElf.js";var s=r({openInstallModal:e(!0).optional(),openedFromPluginsPage:e(!0).optional()}).passthrough();function c(e,n){return t({hostId:n?.hostId,pluginId:e.plugin.id,...o(e),source:n?.source})}function l({explicitMarketplacePath:e,explicitPluginName:t,explicitRemoteMarketplaceName:n,routeParams:r}){let i=e!=null||n!=null;return{directMarketplacePath:i?e??null:r?.marketplacePath??null,directPluginName:t??r?.pluginName??null,directRemoteMarketplaceName:i?n??null:r?.remoteMarketplaceName??null}}function u({fallbackRequestedPluginId:e,plugins:t,requestedPluginId:n}){if(a(n)){let e=t.find(e=>v(e,n));if(e!=null)return e}let r=t.find(e=>_(e,n))??null;return r!=null||e==null||e===n?r:u({plugins:t,requestedPluginId:e})}function d(e){let t=new URLSearchParams(e),n=t.get(`marketplacePath`)?.trim(),r=t.get(`remoteMarketplaceName`)?.trim(),a=t.get(`pluginName`)?.trim(),o=t.get(`hostId`)?.trim()||null,s=t.get(`source`)?.trim(),c=!!n||!!r;return n&&r||c&&!a||!c&&a?null:{marketplacePath:n||null,pluginName:a||null,remoteMarketplaceName:r||null,hostId:o,source:s===`manage`?i:null}}function f(e){if(typeof e!=`object`||!e)return null;let t=Reflect.get(e,`pluginDetailDeepLinkMode`);return t===`share`||t===`view`?t:null}function p(){return{openedFromPluginsPage:!0}}function m(){return{openInstallModal:!0}}function h(e){let t=s.safeParse(e);return t.success&&t.data.openedFromPluginsPage===!0}function g(e){let t=s.safeParse(e);return t.success&&t.data.openInstallModal===!0}function _(e,t){return a(t)?e.plugin.source.type===`remote`&&e.plugin.remotePluginId!=null&&n(e.plugin.remotePluginId,t):e.plugin.id===t}function v(e,t){return e.plugin.source.type===`local`&&e.plugin.shareContext?.remotePluginId!=null&&n(e.plugin.shareContext.remotePluginId,t)}export{h as a,d as c,f as i,g as l,p as n,c as o,l as r,u as s,m as t};
//# sourceMappingURL=plugin-detail-route-utils-B0r1BKuR.js.map