import"./CWj6FrbW.js";import{o as j}from"./CB3MYTwM.js";import{p as q,q as K,a as M,b,c as R,h as t,i as L,l as c,f as W,d as T,r as k,t as B,j as F}from"./BRMnbBOX.js";import{i as G}from"./BFchB-2I.js";import{c as N,s as H}from"./3HVf2z3Q.js";import{b as h}from"./CmatTLDp.js";import{p as i}from"./DCT4VKzQ.js";import{P as I}from"./Cob_zFH5.js";var J=W('<div class="popover svelte-1fd3ybn" role="dialog" aria-modal="true"><div class="popover svelte-1fd3ybn" role="dialog" aria-modal="true"><!></div></div>');function te(e,n){q(n,!0);let p=i(n,"open",3,!1),d=i(n,"anchorEl",3,null),w=i(n,"id",3,""),O=i(n,"placement",3,"bottom-start"),x=i(n,"offset",19,()=>[0,2]),z=i(n,"flip",3,!0),A=i(n,"preventOverflow",3,!0),y=i(n,"onClose",3,()=>{}),a=L(null),l=L(null);function g(){y()()}function C(o){if(p()&&t(a)&&d()){const s=o.target;!t(a).contains(s)&&!d().contains(s)&&g()}}function E(o){o.key==="Escape"&&p()&&g()}j(()=>{document.addEventListener("click",C,!0),document.addEventListener("keydown",E);const o=()=>{t(l)&&t(l).update()},s=()=>{t(l)&&t(l).update()};return window.addEventListener("resize",o),window.addEventListener("scroll",s,!0),()=>{document.removeEventListener("click",C,!0),document.removeEventListener("keydown",E),window.removeEventListener("resize",o),window.removeEventListener("scroll",s,!0)}});var _=K(),D=M(_);{var P=o=>{h(I(o,{get referenceEl(){return d()},get placement(){return O()},get offset(){return x()},get flip(){return z()},get preventOverflow(){return A()},children:v=>{var f=J(),u=T(f),S=T(u);n.children(S),k(u),h(u,r=>c(a,r),()=>t(a)),k(f),h(f,r=>c(a,r),()=>t(a)),B(()=>{var r;N(f,"id",w()),N(u,"id",w()),H(u,`min-width:${((r=d())==null?void 0:r.offsetWidth)??0}px`)}),b(v,f)},$$slots:{default:!0}}),v=>c(l,v,!0),()=>t(l))};G(D,o=>{p()&&d()&&o(P)})}b(e,_),R()}let m=F([]);function ie(e){return!Q(e)&&!U(e)}function Q(e){return"operationName"in e&&"method"in e&&"path"in e}function U(e){return"eventName"in e&&"role"in e&&"medium"in e&&"content"in e}function ae(e){m.push(e)}function le(e){console.log("[chat-content] addApiCallTrace",e==null?void 0:e.operationName,e==null?void 0:e.method,e==null?void 0:e.path,e),m.push(e)}function se(e){console.log("[chat-content] addConversationalTrace",e==null?void 0:e.eventName,e==null?void 0:e.role,e==null?void 0:e.medium,e),m.push(e)}function re(){m.length=0}export{te as D,U as a,ie as b,m as c,re as d,ae as e,le as f,se as g,Q as i};
