UNPKG

mongoku

Version:

[![CI](https://github.com/huggingface/Mongoku/actions/workflows/ci.yml/badge.svg)](https://github.com/huggingface/Mongoku/actions/workflows/ci.yml)

2 lines (1 loc) 706 B
import{L as u,P as c,Q as i,a4 as p,aa as d,O as h}from"./IwGwbOe7.js";function y(a,e,t){u(()=>{var r=c(()=>e(a,t?.())||{});if(t&&r?.update){var n=!1,f={};i(()=>{var s=t();p(s),n&&d(f,s)&&(f=s,r.update(s))}),n=!0}if(r?.destroy)return()=>r.destroy()})}const o=new Map;function m(a,e="default"){const t=`$$portal.${e}`;if(o.has(t))throw`duplicate portal key "${e}"`;return o.set(t,a),{destroy:o.delete.bind(o,t)}}function l(a,e){if(!o.has(e))throw`unknown portal ${e}`;const t=o.get(e);return t.insertBefore(a,null),()=>t.contains(a)&&t.removeChild(a)}function k(a,e="default"){let t;const r=`$$portal.${e}`;return o.has(r)?t=l(a,r):h().then(()=>{t=l(a,r)}),{destroy:()=>t?.()}}export{y as a,m as c,k as p};