"use strict";(self.webpackChunk_kb_labs_commit_entry=self.webpackChunk_kb_labs_commit_entry||[]).push([["50"],{6026(e,s){var t=Symbol.for("react.transitional.element");function r(e,s,r){var i=null;if(void 0!==r&&(i=""+r),void 0!==s.key&&(i=""+s.key),"key"in s)for(var o in r={},s)"key"!==o&&(r[o]=s[o]);else r=s;return{$$typeof:t,type:e,key:i,ref:void 0!==(s=r.ref)?s:null,props:r}}s.Fragment=Symbol.for("react.fragment"),s.jsx=r,s.jsxs=r},4552(e,s,t){e.exports=t(6026)},4332(e,s,t){t.r(s),t.d(s,{EventBusProvider:()=>u,StudioEventBus:()=>o,eventBus:()=>n,useEventBusContext:()=>h});var r=t(2913),i=t(4552),o=class{subscriptions=new Map;history=[];devToolsObserver;subscribe(e,s,t,r){let i={event:e,handler:s,pluginId:t,pageId:r};return this.subscriptions.has(e)||this.subscriptions.set(e,new Set),this.subscriptions.get(e).add(i),()=>{this.subscriptions.get(e)?.delete(i)}}publish(e,s,t,r){let i={sourcePluginId:t,sourcePageId:r,timestamp:Date.now()},o={event:e,payload:s,meta:i};this.history.push(o),this.history.length>100&&this.history.shift(),this.devToolsObserver?.(o);let n=this.subscriptions.get(e);if(n)for(let t of n)try{t.handler(s,i)}catch(s){console.error(`[StudioEventBus] Handler error for "${e}" in ${t.pluginId}:${t.pageId}:`,s)}}unsubscribeAll(e,s){for(let[,t]of this.subscriptions)for(let r of t)r.pluginId===e&&r.pageId===s&&t.delete(r)}getHistory(){return this.history}setDevToolsObserver(e){this.devToolsObserver=e}clearDevToolsObserver(){this.devToolsObserver=void 0}reset(){this.subscriptions.clear(),this.history=[]}},n=new o,l=(0,r.createContext)(n);function u({children:e,bus:s}){return(0,i.jsx)(l.Provider,{value:s??n,children:e})}function h(){return(0,r.useContext)(l)}}}]);
//# sourceMappingURL=50.js.map