import{r}from"./react-DAXU6W__.js";import{a as n,_ as e}from"./tslib-Bc9CN1Ef.js";function t(r){return r}function i(r){void 0===r&&(r={});var e=function(r,n){void 0===n&&(n=t);var e=[],i=!1;return{read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return e.length?e[e.length-1]:r},useMedium:function(r){var t=n(r,i);return e.push(t),function(){e=e.filter(function(r){return r!==t})}},assignSyncMedium:function(r){for(i=!0;e.length;){var n=e;e=[],n.forEach(r)}e={push:function(n){return r(n)},filter:function(){return e}}},assignMedium:function(r){i=!0;var n=[];if(e.length){var t=e;e=[],t.forEach(r),n=e}var o=function(){var e=n;n=[],e.forEach(r)},u=function(){return Promise.resolve().then(o)};u(),e={push:function(r){n.push(r),u()},filter:function(r){return n=n.filter(r),e}}}}}(null);return e.options=n({async:!0,ssr:!1},r),e}var o=function(t){var i=t.sideCar,o=e(t,["sideCar"]);if(!i)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var u=i.read();if(!u)throw new Error("Sidecar medium not found");return r.createElement(u,n({},o))};function u(r,n){return r.useMedium(n),o}o.isSideCarExport=!0;export{i as c,u as e};
