/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/jupyter-iframe-commands-host@0.3.0/lib/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
import{windowEndpoint,wrap,proxy}from"comlink";export function createBridge({iframeId:n}){const e=document.getElementById(n);if(!e)throw new Error(`Cannot create bridge: iframe with id "${n}" not found`);if(!e.contentWindow)throw new Error(`Cannot create bridge: iframe with id "${n}" has no content window`);const t=wrap(windowEndpoint(e.contentWindow)),o=new Promise((n=>{const e=new AbortController,o=e.signal;window.addEventListener("message",(t=>{"_JUPYTER_IFRAME_COMMANDS_LOADED"===t.data&&(e.abort(),n())}),{signal:o}),t.ready.then((()=>{e.abort(),n()})).catch((()=>{}))}));return new Proxy(t,{get:(n,e,t)=>"ready"===e?o:Reflect.get(n,e,t)})}export function createProxy(n){return proxy(n)}
//# sourceMappingURL=/sm/2cc002fb08d82dc61bfbb98de412e9a5d82a0417627dfc7c00fc87ca55f90235.map