@helpai/elements 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ var hu=Object.defineProperty;var bu=(e,t,n)=>t in e?hu(e,t,{enumerable:!0,config
4
4
  `;var rs=`.__P__-standalone-page{margin:0;height:100vh;background:var(--__P__-bg, #fff);display:grid;place-items:stretch}
5
5
  `;var os=`:host([data-mode="page"]){min-height:0}:host([data-mode="page"]) .__P__-page-shell{display:grid;grid-template-columns:280px 1fr;width:100%;height:100%;min-height:0;background:var(--__P__-bg);color:var(--__P__-fg);transition:grid-template-columns var(--__P__-dur-base) var(--__P__-ease-in-out)}:host([data-mode="page"]) .__P__-page-shell[data-sidebar-collapsed=true]{grid-template-columns:48px 1fr}:host([data-mode="page"]) .__P__-page-chat{display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}:host([data-mode="page"]) .__P__-anchor{position:static;inset:auto;padding:0;align-items:stretch;width:100%;height:100%;min-width:0;min-height:0;flex:1 1 0}:host([data-mode="page"]) .__P__-panel{width:100%;height:100%;min-width:0;min-height:0;max-width:none;max-height:none;border-radius:0;border:0;box-shadow:none;animation:none}:host([data-mode="page"]) .__P__-sidebar{border-inline-end:1px solid var(--__P__-border);display:flex;flex-direction:column;overflow:hidden;background:var(--__P__-surface)}:host([data-mode="page"]) .__P__-sidebar-header{padding:var(--__P__-space-4) var(--__P__-space-5);border-bottom:1px solid var(--__P__-border);display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-2);min-height:56px;box-sizing:border-box}:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-header{padding:var(--__P__-space-4) var(--__P__-space-2);justify-content:center}:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-logo,:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-title{display:none}:host([data-mode="page"]) .__P__-sidebar-toggle{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:1px solid var(--__P__-border);border-radius:6px;background:transparent;color:var(--__P__-fg);cursor:pointer;transition:background .12s,border-color .12s}:host([data-mode="page"]) .__P__-sidebar-toggle:hover{background:var(--__P__-hover);border-color:var(--__P__-accent)}:host([data-mode="page"]) .__P__-sidebar-toggle:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}:host([data-mode="page"]) .__P__-sidebar-logo{height:32px;display:block}:host([data-mode="page"]) .__P__-sidebar-title{font-size:var(--__P__-text-md);font-weight:600}:host([data-mode="page"]) .__P__-sidebar-section{padding:var(--__P__-space-3) var(--__P__-space-4);border-bottom:1px solid var(--__P__-border)}:host([data-mode="page"]) .__P__-sidebar-nav{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}:host([data-mode="page"]) .__P__-sidebar-nav-item{display:flex;align-items:center;gap:10px;padding:var(--__P__-space-2) var(--__P__-space-3);border-radius:var(--__P__-radius-sm);color:var(--__P__-fg);text-decoration:none;font-size:calc(14px * var(--__P__-text-scale));transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}:host([data-mode="page"]) .__P__-sidebar-nav-item:hover{background:var(--__P__-hover)}:host([data-mode="page"]) .__P__-sidebar-nav-item:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}:host([data-mode="page"]) .__P__-sidebar-cards{display:grid;grid-template-columns:1fr;gap:var(--__P__-space-2)}:host([data-mode="page"]) .__P__-sidebar-card{display:block;padding:10px 12px;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-sm);text-decoration:none;color:var(--__P__-fg);transition:border-color var(--__P__-dur-quick) var(--__P__-ease-out)}:host([data-mode="page"]) .__P__-sidebar-card:hover{border-color:var(--__P__-accent)}:host([data-mode="page"]) .__P__-sidebar-card:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}:host([data-mode="page"]) .__P__-sidebar-card-label{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}:host([data-mode="page"]) .__P__-sidebar-card-desc{font-size:var(--__P__-text-xs);color:var(--__P__-muted);margin-top:2px}:host([data-mode="page"]) .__P__-sidebar-conversations{flex:1 1 auto;overflow-y:auto;padding:var(--__P__-space-3) var(--__P__-space-4)}:host([data-mode="page"]) .__P__-page-chat{display:flex;flex-direction:column;overflow:hidden}@media(max-width:768px){:host([data-mode="page"]) .__P__-page-shell{grid-template-columns:1fr}:host([data-mode="page"]) .__P__-sidebar{display:none}}
6
6
  `;var f_="helpai",m_="#5B5BD6",g_="#FFFFFF",v_="12px",h_="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",Zo=[es,ts,ns,rs,os].join(`
7
- `).replace(/__P__/g,f_).replaceAll("__BRAND_ACCENT_TEXT__",g_).replaceAll("__BRAND_ACCENT__",m_).replaceAll("__BRAND_RADIUS__",v_).replaceAll("__BRAND_FONT__",h_);var b_=ee.scope("mount"),as=new WeakMap,is={floating:"all: initial; position: fixed; z-index: 2147483600;",flow:"all: initial; display: block; position: relative; width: 100%; height: 100%; z-index: 1; contain: size;",viewport:"all: initial; display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;"};function ss(e,t){e.style.cssText=is[t]}function br(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function ls(e={}){let t=e.position??"flow";b_.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${C.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let r;e.existingHost?r=e.existingHost:(r=document.createElement(n),(e.target??document.body).appendChild(r)),r.setAttribute("data-brand",C.id),r.style.cssText=is[t];let o=r.shadowRoot??r.attachShadow({mode:"open"}),i=r.ownerDocument;if(!y_(o,i)){let l=i.createElement("style");l.textContent=Zo,o.appendChild(l)}let s=document.createElement("div");return s.className=`${C.cssPrefix}-app`,o.appendChild(s),{appRoot:s,destroy:()=>r.remove(),hostElement:r,shadowRoot:o}}function y_(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let r=as.get(t);if(!r)try{r=new n.CSSStyleSheet,r.replaceSync(Zo),as.set(t,r)}catch{return!1}try{return e.adoptedStyleSheets=[r],!0}catch{return!1}}function P_(e,t){let n=C.cssPrefix;t.accent&&e.style.setProperty(`--${n}-accent-user`,t.accent),t.accentText&&e.style.setProperty(`--${n}-accent-text-user`,t.accentText),t.radius&&e.style.setProperty(`--${n}-radius`,t.radius),t.fontFamily&&e.style.setProperty(`--${n}-font`,t.fontFamily),t.contentMaxWidth&&e.style.setProperty(`--${n}-conversation-max`,t.contentMaxWidth)}function x_(e,t){e.dataset.theme=t}function S_(e,t){let n=C.cssPrefix;t.width!==void 0&&e.style.setProperty(`--${n}-panel-w`,t.width),t.height!==void 0&&e.style.setProperty(`--${n}-panel-h`,t.height),t.expanded?.width!==void 0&&e.style.setProperty(`--${n}-expanded-w`,t.expanded.width),t.expanded?.height!==void 0&&e.style.setProperty(`--${n}-expanded-h`,t.expanded.height),t.inset!==void 0&&e.style.setProperty(`--${n}-panel-inset`,t.inset)}function k_(e,t){e.dataset.position=t}function yr(e,t){e.dataset.mode=t}function cs(e,t){x_(e,t.themeMode),P_(e,t.themeOverrides),k_(e,t.position),S_(e,t.size)}var _n,Oe,ea,ds,On=0,hs=[],Fe=Y,us=Fe.__b,_s=Fe.__r,ps=Fe.diffed,fs=Fe.__c,ms=Fe.unmount,gs=Fe.__;function xr(e,t){Fe.__h&&Fe.__h(Oe,e,On||t),On=0;var n=Oe.__H||(Oe.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function D(e){return On=1,bs(ys,e)}function bs(e,t,n){var r=xr(_n++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ys(void 0,t),function(l){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,l);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=Oe,!Oe.__f)){var o=function(l,c,u){if(!r.__c.__H)return!0;var _=!1,p=r.__c.props!==l;if(r.__c.__H.__.some(function(f){if(f.__N){_=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(p=!0)}}),i){var d=i.call(this,l,c,u);return _?d||p:d}return!_||p};Oe.__f=!0;var i=Oe.shouldComponentUpdate,s=Oe.componentWillUpdate;Oe.componentWillUpdate=function(l,c,u){if(this.__e){var _=i;i=void 0,o(l,c,u),i=_}s&&s.call(this,l,c,u)},Oe.shouldComponentUpdate=o}return r.__N||r.__}function E(e,t){var n=xr(_n++,3);!Fe.__s&&na(n.__H,t)&&(n.__=e,n.u=t,Oe.__H.__h.push(n))}function pt(e,t){var n=xr(_n++,4);!Fe.__s&&na(n.__H,t)&&(n.__=e,n.u=t,Oe.__h.push(n))}function M(e){return On=5,Z(function(){return{current:e}},[])}function Z(e,t){var n=xr(_n++,7);return na(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function O(e,t){return On=8,Z(function(){return e},t)}function w_(){for(var e;e=hs.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Pr),t.__h.some(ta),t.__h=[]}catch(n){t.__h=[],Fe.__e(n,e.__v)}}}Fe.__b=function(e){Oe=null,us&&us(e)},Fe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),gs&&gs(e,t)},Fe.__r=function(e){_s&&_s(e),_n=0;var t=(Oe=e.__c).__H;t&&(ea===Oe?(t.__h=[],Oe.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Pr),t.__h.some(ta),t.__h=[],_n=0)),ea=Oe},Fe.diffed=function(e){ps&&ps(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(hs.push(t)!==1&&ds===Fe.requestAnimationFrame||((ds=Fe.requestAnimationFrame)||C_)(w_)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),ea=Oe=null},Fe.__c=function(e,t){t.some(function(n){try{n.__h.some(Pr),n.__h=n.__h.filter(function(r){return!r.__||ta(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],Fe.__e(r,n.__v)}}),fs&&fs(e,t)},Fe.unmount=function(e){ms&&ms(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{Pr(r)}catch(o){t=o}}),n.__H=void 0,t&&Fe.__e(t,n.__v))};var vs=typeof requestAnimationFrame=="function";function C_(e){var t,n=function(){clearTimeout(r),vs&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);vs&&(t=requestAnimationFrame(n))}function Pr(e){var t=Oe,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Oe=t}function ta(e){var t=Oe;e.__c=e.__(),Oe=t}function na(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function ys(e,t){return typeof t=="function"?t(e):t}var R_=Symbol.for("preact-signals");function Cr(){if(kt>1)kt--;else{var e,t=!1;for((function(){var o=kr;for(kr=void 0;o!==void 0;){var i=o.S;if(i.v===o.v)for(var s=i.t;s!==void 0;s=s.x)s.i===o.i&&(s.i=i.i);o=o.o}})();Dn!==void 0;){var n=Dn;for(Dn=void 0,Sr++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&xs(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(Sr=0,kt--,t)throw e}}function it(e){if(kt>0)return e();ra=++T_,kt++;try{return e()}finally{Cr()}}var Nn,Re=void 0;function $n(e){var t=Re,n=Nn;Re=void 0,Nn=void 0;try{return e()}finally{Re=t,Nn=n}}var Dn=void 0,kt=0,Sr=0,T_=0,ra=0,kr=void 0,wr=0;function Ps(e){if(Re!==void 0){var t=e.n;if(t===void 0||t.t!==Re)return t={i:0,S:e,p:Re.s,n:void 0,t:Re,e:void 0,x:void 0,r:t},Re.s!==void 0&&(Re.s.n=t),Re.s=t,e.n=t,32&Re.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Re.s,t.n=void 0,Re.s.n=t,Re.s=t),t}}function Ve(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Ve.prototype.brand=R_;Ve.prototype.h=function(){return!0};Ve.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:$n(function(){var r;(r=t.W)==null||r.call(t)}))};Ve.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&$n(function(){var o;(o=t.Z)==null||o.call(t)}))}};Ve.prototype.subscribe=function(e){var t=this;return wt(function(){var n=t.value;$n(function(){return e(n)})},{name:"sub"})};Ve.prototype.valueOf=function(){return this.value};Ve.prototype.toString=function(){return this.value+""};Ve.prototype.toJSON=function(){return this.value};Ve.prototype.peek=function(){var e=this;return $n(function(){return e.value})};Object.defineProperty(Ve.prototype,"value",{get:function(){var e=Ps(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Sr>100)throw new Error("Cycle detected");(function(n){kt!==0&&Sr===0&&n.l!==ra&&(n.l=ra,kr={S:n,v:n.v,i:n.i,o:kr})})(this),this.v=e,this.i++,wr++,kt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Cr()}}}});function J(e,t){return new Ve(e,t)}function xs(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Ss(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function ks(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Vt(e,t){Ve.call(this,void 0,t),this.x=e,this.s=void 0,this.g=wr-1,this.f=4}Vt.prototype=new Ve;Vt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===wr))return!0;if(this.g=wr,this.f|=1,this.i>0&&!xs(this))return this.f&=-2,!0;var e=Re;try{Ss(this),Re=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return Re=e,ks(this),this.f&=-2,!0};Vt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Ve.prototype.S.call(this,e)};Vt.prototype.U=function(e){if(this.t!==void 0&&(Ve.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Vt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Vt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Ps(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function pe(e,t){return new Vt(e,t)}function ws(e){var t=e.m;if(e.m=void 0,typeof t=="function"){kt++;var n=Re;Re=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,oa(e),r}finally{Re=n,Cr()}}}function oa(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ws(e)}function I_(e){if(Re!==this)throw new Error("Out-of-order effect");ks(this),Re=e,this.f&=-2,8&this.f&&oa(this),Cr()}function pn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Nn&&Nn.push(this)}pn.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};pn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ws(this),Ss(this),kt++;var e=Re;return Re=this,I_.bind(this,e)};pn.prototype.N=function(){2&this.f||(this.f|=2,this.u=Dn,Dn=this)};pn.prototype.d=function(){this.f|=8,1&this.f||oa(this)};pn.prototype.dispose=function(){this.d()};function wt(e,t){var n=new pn(e,t);try{n.c()}catch(o){throw n.d(),o}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Cs,Ir,Rr,E_=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Rs=[];wt(function(){Cs=this.N})();function fn(e,t){Y[e]=t.bind(null,Y[e]||function(){})}function Tr(e){if(Rr){var t=Rr;Rr=void 0,t()}Rr=e&&e.S()}function Ts(e){var t=this,n=e.data,r=dt(n);r.value=n;var o=Z(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var u=pe(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),_=pe(function(){return!Array.isArray(u.value)&&!$o(u.value)}),p=wt(function(){if(this.N=Is,_.value){var f=u.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=f)}}),d=t.__$u.d;return t.__$u.d=function(){p(),d.call(this)},[_,u]},[]),i=o[0],s=o[1];return i.value?s.peek():s.value}Ts.displayName="ReactiveTextNode";Object.defineProperties(Ve.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Ts},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});fn("__b",function(e,t){if(typeof t.type=="string"){var n,r=t.props;for(var o in r)if(o!=="children"){var i=r[o];i instanceof Ve&&(n||(t.__np=n={}),n[o]=i,r[o]=i.peek())}}e(t)});fn("__r",function(e,t){if(e(t),t.type!==ce){Tr();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(o,i){var s;return wt(function(){s=this},{name:i}),s.c=o,s})(function(){var o;E_&&((o=n.y)==null||o.call(n)),r.__$f|=1,r.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),Ir=r,Tr(n)}});fn("__e",function(e,t,n,r){Tr(),Ir=void 0,e(t,n,r)});fn("diffed",function(e,t){Tr(),Ir=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var r=t.__np,o=t.props,i=n.U;if(i)for(var s in i){var l=i[s];l===void 0||r&&s in r||(l.d(),i[s]=void 0)}if(r){i||(i={},n.U=i);for(var c in r){var u=i[c],_=r[c];u===void 0?(u=A_(n,c,_,o),i[c]=u):u.o(_,o)}}}e(t)});function A_(e,t,n,r){var o=t in e&&e.ownerSVGElement===void 0,i=J(n);return{o:function(s,l){i.value=s,r=l},d:wt(function(){this.N=Is;var s=i.value.value;r[t]!==s&&(r[t]=s,o?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}fn("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var o in r){var i=r[o];i&&i.d()}}}var s=t.__np;if(s){var l=t.props;for(var c in s)l[c]=s[c]}t.__np=void 0}else{var u=t.__c;if(u){var _=u.__$u;_&&(u.__$u=void 0,_.d())}}e(t)});fn("__h",function(e,t,n,r){(r<3||r===9)&&(t.__$f|=2),e(t,n,r)});et.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var o in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var i=2&this.__$f;if(!(r||i||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var l in this.props)if(!(l in e))return!0;return!1};function dt(e,t){return Z(function(){return J(e,t)},[])}function ut(e,t){var n=M(e);return n.current=e,Ir.__$f|=4,Z(function(){return pe(function(){return n.current()},t)},[])}var M_=function(e){queueMicrotask(function(){queueMicrotask(e)})};function L_(){it(function(){for(var e;e=Rs.shift();)Cs.call(e)})}function Is(){Rs.push(this)===1&&(Y.requestAnimationFrame||M_)(L_)}function Es(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function As(e){return Es(e)}function Ms(e){return!(!Es(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function O_(e){return`${C.cssPrefix}:${e}`}function Ls(e,t){let r=Object.entries(t).map(([o,i])=>{let s=O_(o),l=c=>i(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[o,i]of r)e.removeEventListener(o,i)}}function Er(e,t,n){return e==="page"?"page":e==="standalone"?"standalone":e==="inline"?t==="fullscreen"?"fullscreen":"inline":e==="modal"||e==="drawer"?n?t==="fullscreen"?"fullscreen":e:"closed":n?t==="fullscreen"?"fullscreen":t==="expanded"?"expanded":"open":"closed"}var N_=900,D_=640;function aa(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let r=t.initialSize;return r==="expanded"||r==="fullscreen"||r==="normal"?r:n>0&&n<D_?"fullscreen":n>=(t.autoSizeBreakpoint??N_)?"expanded":"normal"}function Fn(e,t,n,r=null){let i=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),l=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&r?r:aa(e.mode,e.size,t);return{panelOpen:i,panelSize:l}}function mn(){return typeof window>"u"?0:window.innerWidth}var $_="x-public-key",F_="x-ai-agent-deployment-id";function Os(e){return{headers(){let t={};return e.aiAgentDeploymentId&&(t[F_]=e.aiAgentDeploymentId),e.publicKey&&(t[e.publicKeyHeader??$_]=e.publicKey),t}}}function Bn(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=setTimeout(i,e),o=()=>i();t?.addEventListener("abort",o,{once:!0});function i(){clearTimeout(r),t?.removeEventListener("abort",o),n()}})}var Ar="1.1.3";var We=class extends Error{constructor(n,r,o,i){super(n);te(this,"code",r);te(this,"status",o);te(this,"cause",i);this.name="StreamError"}};var Ns=ee.scope("parser");async function*Ds(e,t){if(!e.ok){let n=await e.text().catch(()=>"");throw new We(`server responded ${e.status}: ${n.slice(0,200)}`,"server",e.status)}for await(let n of B_(e,t)){let r=H_(n);if(r==="done")return;r&&(yield r)}}async function*B_(e,t){if(!e.body)throw new We("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),r="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:o,value:i}=await n.read();if(o){let l=r.trim();l&&(yield l);return}r+=i;let s;for(;(s=r.indexOf(`
7
+ `).replace(/__P__/g,f_).replaceAll("__BRAND_ACCENT_TEXT__",g_).replaceAll("__BRAND_ACCENT__",m_).replaceAll("__BRAND_RADIUS__",v_).replaceAll("__BRAND_FONT__",h_);var b_=ee.scope("mount"),as=new WeakMap,is={floating:"all: initial; position: fixed; z-index: 2147483600;",flow:"all: initial; display: block; position: relative; width: 100%; height: 100%; z-index: 1; contain: size;",viewport:"all: initial; display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;"};function ss(e,t){e.style.cssText=is[t]}function br(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function ls(e={}){let t=e.position??"flow";b_.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${C.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let r;e.existingHost?r=e.existingHost:(r=document.createElement(n),(e.target??document.body).appendChild(r)),r.setAttribute("data-brand",C.id),r.style.cssText=is[t];let o=r.shadowRoot??r.attachShadow({mode:"open"}),i=r.ownerDocument;if(!y_(o,i)){let l=i.createElement("style");l.textContent=Zo,o.appendChild(l)}let s=document.createElement("div");return s.className=`${C.cssPrefix}-app`,o.appendChild(s),{appRoot:s,destroy:()=>r.remove(),hostElement:r,shadowRoot:o}}function y_(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let r=as.get(t);if(!r)try{r=new n.CSSStyleSheet,r.replaceSync(Zo),as.set(t,r)}catch{return!1}try{return e.adoptedStyleSheets=[r],!0}catch{return!1}}function P_(e,t){let n=C.cssPrefix;t.accent&&e.style.setProperty(`--${n}-accent-user`,t.accent),t.accentText&&e.style.setProperty(`--${n}-accent-text-user`,t.accentText),t.radius&&e.style.setProperty(`--${n}-radius`,t.radius),t.fontFamily&&e.style.setProperty(`--${n}-font`,t.fontFamily),t.contentMaxWidth&&e.style.setProperty(`--${n}-conversation-max`,t.contentMaxWidth)}function x_(e,t){e.dataset.theme=t}function S_(e,t){let n=C.cssPrefix;t.width!==void 0&&e.style.setProperty(`--${n}-panel-w`,t.width),t.height!==void 0&&e.style.setProperty(`--${n}-panel-h`,t.height),t.expanded?.width!==void 0&&e.style.setProperty(`--${n}-expanded-w`,t.expanded.width),t.expanded?.height!==void 0&&e.style.setProperty(`--${n}-expanded-h`,t.expanded.height),t.inset!==void 0&&e.style.setProperty(`--${n}-panel-inset`,t.inset)}function k_(e,t){e.dataset.position=t}function yr(e,t){e.dataset.mode=t}function cs(e,t){x_(e,t.themeMode),P_(e,t.themeOverrides),k_(e,t.position),S_(e,t.size)}var _n,Oe,ea,ds,On=0,hs=[],Fe=Y,us=Fe.__b,_s=Fe.__r,ps=Fe.diffed,fs=Fe.__c,ms=Fe.unmount,gs=Fe.__;function xr(e,t){Fe.__h&&Fe.__h(Oe,e,On||t),On=0;var n=Oe.__H||(Oe.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function D(e){return On=1,bs(ys,e)}function bs(e,t,n){var r=xr(_n++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ys(void 0,t),function(l){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,l);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=Oe,!Oe.__f)){var o=function(l,c,u){if(!r.__c.__H)return!0;var _=!1,p=r.__c.props!==l;if(r.__c.__H.__.some(function(f){if(f.__N){_=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(p=!0)}}),i){var d=i.call(this,l,c,u);return _?d||p:d}return!_||p};Oe.__f=!0;var i=Oe.shouldComponentUpdate,s=Oe.componentWillUpdate;Oe.componentWillUpdate=function(l,c,u){if(this.__e){var _=i;i=void 0,o(l,c,u),i=_}s&&s.call(this,l,c,u)},Oe.shouldComponentUpdate=o}return r.__N||r.__}function E(e,t){var n=xr(_n++,3);!Fe.__s&&na(n.__H,t)&&(n.__=e,n.u=t,Oe.__H.__h.push(n))}function pt(e,t){var n=xr(_n++,4);!Fe.__s&&na(n.__H,t)&&(n.__=e,n.u=t,Oe.__h.push(n))}function M(e){return On=5,Z(function(){return{current:e}},[])}function Z(e,t){var n=xr(_n++,7);return na(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function O(e,t){return On=8,Z(function(){return e},t)}function w_(){for(var e;e=hs.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Pr),t.__h.some(ta),t.__h=[]}catch(n){t.__h=[],Fe.__e(n,e.__v)}}}Fe.__b=function(e){Oe=null,us&&us(e)},Fe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),gs&&gs(e,t)},Fe.__r=function(e){_s&&_s(e),_n=0;var t=(Oe=e.__c).__H;t&&(ea===Oe?(t.__h=[],Oe.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Pr),t.__h.some(ta),t.__h=[],_n=0)),ea=Oe},Fe.diffed=function(e){ps&&ps(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(hs.push(t)!==1&&ds===Fe.requestAnimationFrame||((ds=Fe.requestAnimationFrame)||C_)(w_)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),ea=Oe=null},Fe.__c=function(e,t){t.some(function(n){try{n.__h.some(Pr),n.__h=n.__h.filter(function(r){return!r.__||ta(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],Fe.__e(r,n.__v)}}),fs&&fs(e,t)},Fe.unmount=function(e){ms&&ms(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{Pr(r)}catch(o){t=o}}),n.__H=void 0,t&&Fe.__e(t,n.__v))};var vs=typeof requestAnimationFrame=="function";function C_(e){var t,n=function(){clearTimeout(r),vs&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);vs&&(t=requestAnimationFrame(n))}function Pr(e){var t=Oe,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Oe=t}function ta(e){var t=Oe;e.__c=e.__(),Oe=t}function na(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function ys(e,t){return typeof t=="function"?t(e):t}var R_=Symbol.for("preact-signals");function Cr(){if(kt>1)kt--;else{var e,t=!1;for((function(){var o=kr;for(kr=void 0;o!==void 0;){var i=o.S;if(i.v===o.v)for(var s=i.t;s!==void 0;s=s.x)s.i===o.i&&(s.i=i.i);o=o.o}})();Dn!==void 0;){var n=Dn;for(Dn=void 0,Sr++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&xs(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(Sr=0,kt--,t)throw e}}function it(e){if(kt>0)return e();ra=++T_,kt++;try{return e()}finally{Cr()}}var Nn,Re=void 0;function $n(e){var t=Re,n=Nn;Re=void 0,Nn=void 0;try{return e()}finally{Re=t,Nn=n}}var Dn=void 0,kt=0,Sr=0,T_=0,ra=0,kr=void 0,wr=0;function Ps(e){if(Re!==void 0){var t=e.n;if(t===void 0||t.t!==Re)return t={i:0,S:e,p:Re.s,n:void 0,t:Re,e:void 0,x:void 0,r:t},Re.s!==void 0&&(Re.s.n=t),Re.s=t,e.n=t,32&Re.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Re.s,t.n=void 0,Re.s.n=t,Re.s=t),t}}function Ve(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Ve.prototype.brand=R_;Ve.prototype.h=function(){return!0};Ve.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:$n(function(){var r;(r=t.W)==null||r.call(t)}))};Ve.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&$n(function(){var o;(o=t.Z)==null||o.call(t)}))}};Ve.prototype.subscribe=function(e){var t=this;return wt(function(){var n=t.value;$n(function(){return e(n)})},{name:"sub"})};Ve.prototype.valueOf=function(){return this.value};Ve.prototype.toString=function(){return this.value+""};Ve.prototype.toJSON=function(){return this.value};Ve.prototype.peek=function(){var e=this;return $n(function(){return e.value})};Object.defineProperty(Ve.prototype,"value",{get:function(){var e=Ps(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Sr>100)throw new Error("Cycle detected");(function(n){kt!==0&&Sr===0&&n.l!==ra&&(n.l=ra,kr={S:n,v:n.v,i:n.i,o:kr})})(this),this.v=e,this.i++,wr++,kt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Cr()}}}});function J(e,t){return new Ve(e,t)}function xs(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Ss(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function ks(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Vt(e,t){Ve.call(this,void 0,t),this.x=e,this.s=void 0,this.g=wr-1,this.f=4}Vt.prototype=new Ve;Vt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===wr))return!0;if(this.g=wr,this.f|=1,this.i>0&&!xs(this))return this.f&=-2,!0;var e=Re;try{Ss(this),Re=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return Re=e,ks(this),this.f&=-2,!0};Vt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Ve.prototype.S.call(this,e)};Vt.prototype.U=function(e){if(this.t!==void 0&&(Ve.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Vt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Vt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Ps(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function pe(e,t){return new Vt(e,t)}function ws(e){var t=e.m;if(e.m=void 0,typeof t=="function"){kt++;var n=Re;Re=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,oa(e),r}finally{Re=n,Cr()}}}function oa(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ws(e)}function I_(e){if(Re!==this)throw new Error("Out-of-order effect");ks(this),Re=e,this.f&=-2,8&this.f&&oa(this),Cr()}function pn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Nn&&Nn.push(this)}pn.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};pn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ws(this),Ss(this),kt++;var e=Re;return Re=this,I_.bind(this,e)};pn.prototype.N=function(){2&this.f||(this.f|=2,this.u=Dn,Dn=this)};pn.prototype.d=function(){this.f|=8,1&this.f||oa(this)};pn.prototype.dispose=function(){this.d()};function wt(e,t){var n=new pn(e,t);try{n.c()}catch(o){throw n.d(),o}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Cs,Ir,Rr,E_=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Rs=[];wt(function(){Cs=this.N})();function fn(e,t){Y[e]=t.bind(null,Y[e]||function(){})}function Tr(e){if(Rr){var t=Rr;Rr=void 0,t()}Rr=e&&e.S()}function Ts(e){var t=this,n=e.data,r=dt(n);r.value=n;var o=Z(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var u=pe(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),_=pe(function(){return!Array.isArray(u.value)&&!$o(u.value)}),p=wt(function(){if(this.N=Is,_.value){var f=u.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=f)}}),d=t.__$u.d;return t.__$u.d=function(){p(),d.call(this)},[_,u]},[]),i=o[0],s=o[1];return i.value?s.peek():s.value}Ts.displayName="ReactiveTextNode";Object.defineProperties(Ve.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Ts},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});fn("__b",function(e,t){if(typeof t.type=="string"){var n,r=t.props;for(var o in r)if(o!=="children"){var i=r[o];i instanceof Ve&&(n||(t.__np=n={}),n[o]=i,r[o]=i.peek())}}e(t)});fn("__r",function(e,t){if(e(t),t.type!==ce){Tr();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(o,i){var s;return wt(function(){s=this},{name:i}),s.c=o,s})(function(){var o;E_&&((o=n.y)==null||o.call(n)),r.__$f|=1,r.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),Ir=r,Tr(n)}});fn("__e",function(e,t,n,r){Tr(),Ir=void 0,e(t,n,r)});fn("diffed",function(e,t){Tr(),Ir=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var r=t.__np,o=t.props,i=n.U;if(i)for(var s in i){var l=i[s];l===void 0||r&&s in r||(l.d(),i[s]=void 0)}if(r){i||(i={},n.U=i);for(var c in r){var u=i[c],_=r[c];u===void 0?(u=A_(n,c,_,o),i[c]=u):u.o(_,o)}}}e(t)});function A_(e,t,n,r){var o=t in e&&e.ownerSVGElement===void 0,i=J(n);return{o:function(s,l){i.value=s,r=l},d:wt(function(){this.N=Is;var s=i.value.value;r[t]!==s&&(r[t]=s,o?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}fn("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var o in r){var i=r[o];i&&i.d()}}}var s=t.__np;if(s){var l=t.props;for(var c in s)l[c]=s[c]}t.__np=void 0}else{var u=t.__c;if(u){var _=u.__$u;_&&(u.__$u=void 0,_.d())}}e(t)});fn("__h",function(e,t,n,r){(r<3||r===9)&&(t.__$f|=2),e(t,n,r)});et.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var o in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var i=2&this.__$f;if(!(r||i||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var l in this.props)if(!(l in e))return!0;return!1};function dt(e,t){return Z(function(){return J(e,t)},[])}function ut(e,t){var n=M(e);return n.current=e,Ir.__$f|=4,Z(function(){return pe(function(){return n.current()},t)},[])}var M_=function(e){queueMicrotask(function(){queueMicrotask(e)})};function L_(){it(function(){for(var e;e=Rs.shift();)Cs.call(e)})}function Is(){Rs.push(this)===1&&(Y.requestAnimationFrame||M_)(L_)}function Es(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function As(e){return Es(e)}function Ms(e){return!(!Es(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function O_(e){return`${C.cssPrefix}:${e}`}function Ls(e,t){let r=Object.entries(t).map(([o,i])=>{let s=O_(o),l=c=>i(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[o,i]of r)e.removeEventListener(o,i)}}function Er(e,t,n){return e==="page"?"page":e==="standalone"?"standalone":e==="inline"?t==="fullscreen"?"fullscreen":"inline":e==="modal"||e==="drawer"?n?t==="fullscreen"?"fullscreen":e:"closed":n?t==="fullscreen"?"fullscreen":t==="expanded"?"expanded":"open":"closed"}var N_=900,D_=640;function aa(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let r=t.initialSize;return r==="expanded"||r==="fullscreen"||r==="normal"?r:n>0&&n<D_?"fullscreen":n>=(t.autoSizeBreakpoint??N_)?"expanded":"normal"}function Fn(e,t,n,r=null){let i=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),l=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&r?r:aa(e.mode,e.size,t);return{panelOpen:i,panelSize:l}}function mn(){return typeof window>"u"?0:window.innerWidth}var $_="x-public-key",F_="x-ai-agent-deployment-id";function Os(e){return{headers(){let t={};return e.aiAgentDeploymentId&&(t[F_]=e.aiAgentDeploymentId),e.publicKey&&(t[e.publicKeyHeader??$_]=e.publicKey),t}}}function Bn(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=setTimeout(i,e),o=()=>i();t?.addEventListener("abort",o,{once:!0});function i(){clearTimeout(r),t?.removeEventListener("abort",o),n()}})}var Ar="1.1.4";var We=class extends Error{constructor(n,r,o,i){super(n);te(this,"code",r);te(this,"status",o);te(this,"cause",i);this.name="StreamError"}};var Ns=ee.scope("parser");async function*Ds(e,t){if(!e.ok){let n=await e.text().catch(()=>"");throw new We(`server responded ${e.status}: ${n.slice(0,200)}`,"server",e.status)}for await(let n of B_(e,t)){let r=H_(n);if(r==="done")return;r&&(yield r)}}async function*B_(e,t){if(!e.body)throw new We("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),r="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:o,value:i}=await n.read();if(o){let l=r.trim();l&&(yield l);return}r+=i;let s;for(;(s=r.indexOf(`
8
8
 
9
9
  `))!==-1;){let l=r.slice(0,s);r=r.slice(s+2),yield l}}}finally{n.releaseLock()}}function H_(e){let t="",n;for(let r of e.split(`
10
10
  `))if(!(r===""||r.startsWith(":"))){if(r.startsWith("data:")){let o=r.slice(5).replace(/^ /,"");t=t?`${t}