@ariaflowagents/widget 0.6.9 → 0.6.11

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.
package/dist/widget.js CHANGED
@@ -785,7 +785,7 @@ function $t({
785
785
  console.log("[AriaFlow Widget] Processing state:", A), et(A);
786
786
  });
787
787
  const O = await k.initWidget();
788
- console.log("[AriaFlow Widget] Agent config received:", O), O ? (x(O), console.log("[AriaFlow Widget] Widget initialized successfully")) : console.error("[AriaFlow Widget] Agent config fetch failed");
788
+ console.log("[AriaFlow Widget] Agent config received:", O), O ? (x(O), console.log("[AriaFlow Widget] Widget initialized successfully (v0.6.11)")) : console.error("[AriaFlow Widget] Agent config fetch failed");
789
789
  } catch (O) {
790
790
  console.error("[AriaFlow Widget] Initialization error:", O);
791
791
  }
@@ -1,4 +1,4 @@
1
1
  (function(H,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(H=typeof globalThis<"u"?globalThis:H||self,E(H.AriaFlowWidget={}))})(this,function(H){"use strict";var E,m,pe,I,me,ye,we,ve,ie,se,re,q={},be=[],tt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,V=Array.isArray;function M(t,e){for(var n in e)t[n]=e[n];return t}function ae(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function L(t,e,n){var o,s,i,a={};for(i in e)i=="key"?o=e[i]:i=="ref"?s=e[i]:a[i]=e[i];if(arguments.length>2&&(a.children=arguments.length>3?E.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)a[i]===void 0&&(a[i]=t.defaultProps[i]);return j(t,a,o,s,null)}function j(t,e,n,o,s){var i={type:t,props:e,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++pe,__i:-1,__u:0};return s==null&&m.vnode!=null&&m.vnode(i),i}function U(t){return t.children}function J(t,e){this.props=t,this.context=e}function Q(t,e){if(e==null)return t.__?Q(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?Q(t):null}function Ce(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return Ce(t)}}function ke(t){(!t.__d&&(t.__d=!0)&&I.push(t)&&!K.__r++||me!=m.debounceRendering)&&((me=m.debounceRendering)||ye)(K)}function K(){for(var t,e,n,o,s,i,a,_=1;I.length;)I.length>_&&I.sort(we),t=I.shift(),_=I.length,t.__d&&(n=void 0,o=void 0,s=(o=(e=t).__v).__e,i=[],a=[],e.__P&&((n=M({},o)).__v=o.__v+1,m.vnode&&m.vnode(n),le(e.__P,n,o,e.__n,e.__P.namespaceURI,32&o.__u?[s]:null,i,s??Q(o),!!(32&o.__u),a),n.__v=o.__v,n.__.__k[n.__i]=n,Ne(i,n,a),o.__e=o.__=null,n.__e!=s&&Ce(n)));K.__r=0}function Ae(t,e,n,o,s,i,a,_,c,l,u){var r,h,g,C,$,w,p,f=o&&o.__k||be,P=e.length;for(c=nt(n,e,f,c,P),r=0;r<P;r++)(g=n.__k[r])!=null&&(h=g.__i==-1?q:f[g.__i]||q,g.__i=r,w=le(t,g,h,s,i,a,_,c,l,u),C=g.__e,g.ref&&h.ref!=g.ref&&(h.ref&&ce(h.ref,null,g),u.push(g.ref,g.__c||C,g)),$==null&&C!=null&&($=C),(p=!!(4&g.__u))||h.__k===g.__k?c=Se(g,c,t,p):typeof g.type=="function"&&w!==void 0?c=w:C&&(c=C.nextSibling),g.__u&=-7);return n.__e=$,c}function nt(t,e,n,o,s){var i,a,_,c,l,u=n.length,r=u,h=0;for(t.__k=new Array(s),i=0;i<s;i++)(a=e[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=t.__k[i]=j(null,a,null,null,null):V(a)?a=t.__k[i]=j(U,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=t.__k[i]=j(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):t.__k[i]=a,c=i+h,a.__=t,a.__b=t.__b+1,_=null,(l=a.__i=ot(a,n,c,r))!=-1&&(r--,(_=n[l])&&(_.__u|=2)),_==null||_.__v==null?(l==-1&&(s>u?h--:s<u&&h++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?h--:l==c+1?h++:(l>c?h--:h++,a.__u|=4))):t.__k[i]=null;if(r)for(i=0;i<u;i++)(_=n[i])!=null&&!(2&_.__u)&&(_.__e==o&&(o=Q(_)),Fe(_,_));return o}function Se(t,e,n,o){var s,i;if(typeof t.type=="function"){for(s=t.__k,i=0;s&&i<s.length;i++)s[i]&&(s[i].__=t,e=Se(s[i],e,n,o));return e}t.__e!=e&&(o&&(e&&t.type&&!e.parentNode&&(e=Q(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function ot(t,e,n,o){var s,i,a,_=t.key,c=t.type,l=e[n],u=l!=null&&(2&l.__u)==0;if(l===null&&_==null||u&&_==l.key&&c==l.type)return n;if(o>(u?1:0)){for(s=n-1,i=n+1;s>=0||i<e.length;)if((l=e[a=s>=0?s--:i++])!=null&&!(2&l.__u)&&_==l.key&&c==l.type)return a}return-1}function $e(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||tt.test(e)?n:n+"px"}function G(t,e,n,o,s){var i,a;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof o=="string"&&(t.style.cssText=o=""),o)for(e in o)n&&e in n||$e(t.style,e,"");if(n)for(e in n)o&&n[e]==o[e]||$e(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(ve,"$1")),a=e.toLowerCase(),e=a in t||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+i]=n,n?o?n.u=o.u:(n.u=ie,t.addEventListener(e,i?re:se,i)):t.removeEventListener(e,i?re:se,i);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function We(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=ie++;else if(e.t<n.u)return;return n(m.event?m.event(e):e)}}}function le(t,e,n,o,s,i,a,_,c,l){var u,r,h,g,C,$,w,p,f,P,N,D,W,ne,S,R,O,x=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),i=[_=e.__e=n.__e]),(u=m.__b)&&u(e);e:if(typeof x=="function")try{if(p=e.props,f="prototype"in x&&x.prototype.render,P=(u=x.contextType)&&o[u.__c],N=u?P?P.props.value:u.__:o,n.__c?w=(r=e.__c=n.__c).__=r.__E:(f?e.__c=r=new x(p,N):(e.__c=r=new J(p,N),r.constructor=x,r.render=st),P&&P.sub(r),r.state||(r.state={}),r.__n=o,h=r.__d=!0,r.__h=[],r._sb=[]),f&&r.__s==null&&(r.__s=r.state),f&&x.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=M({},r.__s)),M(r.__s,x.getDerivedStateFromProps(p,r.__s))),g=r.props,C=r.state,r.__v=e,h)f&&x.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),f&&r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(f&&x.getDerivedStateFromProps==null&&p!==g&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(p,N),e.__v==n.__v||!r.__e&&r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(p,r.__s,N)===!1){for(e.__v!=n.__v&&(r.props=p,r.state=r.__s,r.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(F){F&&(F.__=e)}),D=0;D<r._sb.length;D++)r.__h.push(r._sb[D]);r._sb=[],r.__h.length&&a.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(p,r.__s,N),f&&r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(g,C,$)})}if(r.context=N,r.props=p,r.__P=t,r.__e=!1,W=m.__r,ne=0,f){for(r.state=r.__s,r.__d=!1,W&&W(e),u=r.render(r.props,r.state,r.context),S=0;S<r._sb.length;S++)r.__h.push(r._sb[S]);r._sb=[]}else do r.__d=!1,W&&W(e),u=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++ne<25);r.state=r.__s,r.getChildContext!=null&&(o=M(M({},o),r.getChildContext())),f&&!h&&r.getSnapshotBeforeUpdate!=null&&($=r.getSnapshotBeforeUpdate(g,C)),R=u,u!=null&&u.type===U&&u.key==null&&(R=xe(u.props.children)),_=Ae(t,V(R)?R:[R],e,n,o,s,i,a,_,c,l),r.base=e.__e,e.__u&=-161,r.__h.length&&a.push(r),w&&(r.__E=r.__=null)}catch(F){if(e.__v=null,c||i!=null)if(F.then){for(e.__u|=c?160:128;_&&_.nodeType==8&&_.nextSibling;)_=_.nextSibling;i[i.indexOf(_)]=null,e.__e=_}else{for(O=i.length;O--;)ae(i[O]);_e(e)}else e.__e=n.__e,e.__k=n.__k,F.then||_e(e);m.__e(F,e,n)}else i==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):_=e.__e=it(n.__e,e,n,o,s,i,a,c,l);return(u=m.diffed)&&u(e),128&e.__u?void 0:_}function _e(t){t&&t.__c&&(t.__c.__e=!0),t&&t.__k&&t.__k.forEach(_e)}function Ne(t,e,n){for(var o=0;o<n.length;o++)ce(n[o],n[++o],n[++o]);m.__c&&m.__c(e,t),t.some(function(s){try{t=s.__h,s.__h=[],t.some(function(i){i.call(s)})}catch(i){m.__e(i,s.__v)}})}function xe(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:V(t)?t.map(xe):M({},t)}function it(t,e,n,o,s,i,a,_,c){var l,u,r,h,g,C,$,w=n.props||q,p=e.props,f=e.type;if(f=="svg"?s="http://www.w3.org/2000/svg":f=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),i!=null){for(l=0;l<i.length;l++)if((g=i[l])&&"setAttribute"in g==!!f&&(f?g.localName==f:g.nodeType==3)){t=g,i[l]=null;break}}if(t==null){if(f==null)return document.createTextNode(p);t=document.createElementNS(s,f,p.is&&p),_&&(m.__m&&m.__m(e,i),_=!1),i=null}if(f==null)w===p||_&&t.data==p||(t.data=p);else{if(i=i&&E.call(t.childNodes),!_&&i!=null)for(w={},l=0;l<t.attributes.length;l++)w[(g=t.attributes[l]).name]=g.value;for(l in w)if(g=w[l],l!="children"){if(l=="dangerouslySetInnerHTML")r=g;else if(!(l in p)){if(l=="value"&&"defaultValue"in p||l=="checked"&&"defaultChecked"in p)continue;G(t,l,null,g,s)}}for(l in p)g=p[l],l=="children"?h=g:l=="dangerouslySetInnerHTML"?u=g:l=="value"?C=g:l=="checked"?$=g:_&&typeof g!="function"||w[l]===g||G(t,l,g,w[l],s);if(u)_||r&&(u.__html==r.__html||u.__html==t.innerHTML)||(t.innerHTML=u.__html),e.__k=[];else if(r&&(t.innerHTML=""),Ae(e.type=="template"?t.content:t,V(h)?h:[h],e,n,o,f=="foreignObject"?"http://www.w3.org/1999/xhtml":s,i,a,i?i[0]:n.__k&&Q(n,0),_,c),i!=null)for(l=i.length;l--;)ae(i[l]);_||(l="value",f=="progress"&&C==null?t.removeAttribute("value"):C!=null&&(C!==t[l]||f=="progress"&&!C||f=="option"&&C!=w[l])&&G(t,l,C,w[l],s),l="checked",$!=null&&$!=t[l]&&G(t,l,$,w[l],s))}return t}function ce(t,e,n){try{if(typeof t=="function"){var o=typeof t.__u=="function";o&&t.__u(),o&&e==null||(t.__u=t(e))}else t.current=e}catch(s){m.__e(s,n)}}function Fe(t,e,n){var o,s;if(m.unmount&&m.unmount(t),(o=t.ref)&&(o.current&&o.current!=t.__e||ce(o,null,e)),(o=t.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){m.__e(i,e)}o.base=o.__P=null}if(o=t.__k)for(s=0;s<o.length;s++)o[s]&&Fe(o[s],e,n||typeof t.type!="function");n||ae(t.__e),t.__c=t.__=t.__e=void 0}function st(t,e,n){return this.constructor(t,n)}function X(t,e,n){var o,s,i,a;e==document&&(e=document.documentElement),m.__&&m.__(t,e),s=(o=typeof n=="function")?null:n&&n.__k||e.__k,i=[],a=[],le(e,t=(!o&&n||e).__k=L(U,null,[t]),s||q,q,e.namespaceURI,!o&&n?[n]:s?null:e.firstChild?E.call(e.childNodes):null,i,!o&&n?n:s?s.__e:e.firstChild,o,a),Ne(i,t,a)}function Me(t,e){X(t,e,Me)}function Pe(t,e,n){var o,s,i,a,_=M({},t.props);for(i in t.type&&t.type.defaultProps&&(a=t.type.defaultProps),e)i=="key"?o=e[i]:i=="ref"?s=e[i]:_[i]=e[i]===void 0&&a!=null?a[i]:e[i];return arguments.length>2&&(_.children=arguments.length>3?E.call(arguments,2):n),j(t.type,_,o||t.key,s||t.ref,null)}E=be.slice,m={__e:function(t,e,n,o){for(var s,i,a;e=e.__;)if((s=e.__c)&&!s.__)try{if((i=s.constructor)&&i.getDerivedStateFromError!=null&&(s.setState(i.getDerivedStateFromError(t)),a=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(t,o||{}),a=s.__d),a)return s.__E=s}catch(_){t=_}throw t}},pe=0,J.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=M({},this.state),typeof t=="function"&&(t=t(M({},n),this.props)),t&&M(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),ke(this))},J.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ke(this))},J.prototype.render=U,I=[],ye=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,we=function(t,e){return t.__v.__b-e.__v.__b},K.__r=0,ve=/(PointerCapture)$|Capture$/i,ie=0,se=We(!1),re=We(!0);function Y(){return Y=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Y.apply(this,arguments)}function Ee(t,e){if(t==null)return{};var n,o,s={},i=Object.keys(t);for(o=0;o<i.length;o++)e.indexOf(n=i[o])>=0||(s[n]=t[n]);return s}var rt=["context","children"],at=["useFragment"];function lt(t,e,n,o){function s(){var i=Reflect.construct(HTMLElement,[],s);return i._vdomComponent=t,i._root=i,i}return(s.prototype=Object.create(HTMLElement.prototype)).constructor=s,s.prototype.connectedCallback=function(){ct.call(this,o)},s.prototype.attributeChangedCallback=ut,s.prototype.disconnectedCallback=gt,n=n||t.observedAttributes||Object.keys(t.propTypes||{}),s.observedAttributes=n,t.formAssociated&&(s.formAssociated=!0),n.forEach(function(i){Object.defineProperty(s.prototype,i,{get:function(){return this._vdom?this._vdom.props[i]:this._props[i]},set:function(a){this._vdom?this.attributeChangedCallback(i,null,a):(this._props||(this._props={}),this._props[i]=a);var _=typeof a;a!=null&&_!=="string"&&_!=="boolean"&&_!=="number"||this.setAttribute(i,a)}})}),customElements.define(e,s),s}function _t(t){this.getChildContext=function(){return t.context};var e=t.children,n=Ee(t,rt);return Pe(e,n)}function ct(t){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=L(_t,Y({},this._props,{context:e.detail.context}),Ie(this,this._vdomComponent,t)),(this.hasAttribute("hydrate")?Me:X)(this._vdom,this._root)}function Te(t){return t.replace(/-(\w)/g,function(e,n){return n?n.toUpperCase():""})}function ut(t,e,n){if(this._vdom){var o={};o[t]=n=n??void 0,o[Te(t)]=n,this._vdom=Pe(this._vdom,o),X(this._vdom,this._root)}}function gt(){X(this._vdom=null,this._root)}function He(t,e){var n=this,o=t.useFragment,s=Ee(t,at);return L(o?U:"slot",Y({},s,{ref:function(i){i?(n.ref=i,n._listener||(n._listener=function(a){a.stopPropagation(),a.detail.context=e},i.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener)}}))}function Ie(t,e,n){if(t.nodeType===3)return t.data;if(t.nodeType!==1)return null;var o=[],s={},i=0,a=t.attributes,_=t.childNodes;for(i=a.length;i--;)a[i].name!=="slot"&&(s[a[i].name]=a[i].value,s[Te(a[i].name)]=a[i].value);for(i=_.length;i--;){var c=Ie(_[i],null,n),l=_[i].slot;l?s[l]=L(He,{name:l},c):o[i]=c}var u=!(!n||!n.shadow),r=e?L(He,{useFragment:!u},o):o;return!u&&e&&(t.innerHTML=""),L(e||t.nodeName.toLowerCase(),s,r)}var dt=0;function d(t,e,n,o,s,i){e||(e={});var a,_,c=e;if("ref"in c)for(_ in c={},e)_=="ref"?a=e[_]:c[_]=e[_];var l={type:t,props:c,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--dt,__i:-1,__u:0,__source:s,__self:i};if(typeof t=="function"&&(a=t.defaultProps))for(_ in a)c[_]===void 0&&(c[_]=a[_]);return m.vnode&&m.vnode(l),l}var B,y,ue,Ue,Z=0,De=[],b=m,Re=b.__b,Oe=b.__r,Le=b.diffed,Qe=b.__c,qe=b.unmount,je=b.__;function ge(t,e){b.__h&&b.__h(y,t,Z||e),Z=0;var n=y.__H||(y.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function T(t){return Z=1,ht(Ke,t)}function ht(t,e,n){var o=ge(B++,2);if(o.t=t,!o.__c&&(o.__=[Ke(void 0,e),function(_){var c=o.__N?o.__N[0]:o.__[0],l=o.t(c,_);c!==l&&(o.__N=[l,o.__[1]],o.__c.setState({}))}],o.__c=y,!y.__f)){var s=function(_,c,l){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(h){return!!h.__c});if(u.every(function(h){return!h.__N}))return!i||i.call(this,_,c,l);var r=o.__c.props!==_;return u.forEach(function(h){if(h.__N){var g=h.__[0];h.__=h.__N,h.__N=void 0,g!==h.__[0]&&(r=!0)}}),i&&i.call(this,_,c,l)||r};y.__f=!0;var i=y.shouldComponentUpdate,a=y.componentWillUpdate;y.componentWillUpdate=function(_,c,l){if(this.__e){var u=i;i=void 0,s(_,c,l),i=u}a&&a.call(this,_,c,l)},y.shouldComponentUpdate=s}return o.__N||o.__}function Be(t,e){var n=ge(B++,3);!b.__s&&Je(n.__H,e)&&(n.__=t,n.u=e,y.__H.__h.push(n))}function ze(t){return Z=5,ft(function(){return{current:t}},[])}function ft(t,e){var n=ge(B++,7);return Je(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function pt(){for(var t;t=De.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ee),t.__H.__h.forEach(de),t.__H.__h=[]}catch(e){t.__H.__h=[],b.__e(e,t.__v)}}b.__b=function(t){y=null,Re&&Re(t)},b.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),je&&je(t,e)},b.__r=function(t){Oe&&Oe(t),B=0;var e=(y=t.__c).__H;e&&(ue===y?(e.__h=[],y.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.forEach(ee),e.__h.forEach(de),e.__h=[],B=0)),ue=y},b.diffed=function(t){Le&&Le(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(De.push(e)!==1&&Ue===b.requestAnimationFrame||((Ue=b.requestAnimationFrame)||mt)(pt)),e.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),ue=y=null},b.__c=function(t,e){e.some(function(n){try{n.__h.forEach(ee),n.__h=n.__h.filter(function(o){return!o.__||de(o)})}catch(o){e.some(function(s){s.__h&&(s.__h=[])}),e=[],b.__e(o,n.__v)}}),Qe&&Qe(t,e)},b.unmount=function(t){qe&&qe(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{ee(o)}catch(s){e=s}}),n.__H=void 0,e&&b.__e(e,n.__v))};var Ve=typeof requestAnimationFrame=="function";function mt(t){var e,n=function(){clearTimeout(o),Ve&&cancelAnimationFrame(e),setTimeout(t)},o=setTimeout(n,35);Ve&&(e=requestAnimationFrame(n))}function ee(t){var e=y,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),y=e}function de(t){var e=y;t.__c=t.__(),y=e}function Je(t,e){return!t||t.length!==e.length||e.some(function(n,o){return n!==t[o]})}function Ke(t,e){return typeof e=="function"?e(t):e}const yt="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let te=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=yt[n[t]&63];return e};class Ge{constructor(e,n){this.agentUrl=e,this.agentId=n,this.agentConfig=null,this.ws=null,this.messageCallbacks=new Set,this.connectionCallbacks=new Set,this.streamingCallbacks=new Set,this.processingCallbacks=new Set,this.queueCallbacks=new Set,this.messages=[],this.reconnectAttempts=0,this.maxReconnectAttempts=5,this.reconnectDelay=1e3,this.isAgentStreaming=!1,this.isAgentProcessing=!1,this.messageQueue=[]}async initWidget(){try{console.log("[AriaFlow Widget] Fetching agent config...",{agentUrl:this.agentUrl,agentId:this.agentId});try{const n=await fetch(`${this.agentUrl}/api/agent/${this.agentId}`);if(n.ok){const o=await n.json();return console.log("[AriaFlow Widget] Agent config received:",o),!o||o.status!=="active"?(console.error("Agent not found or inactive"),null):(this.agentConfig=o,this.maxReconnectAttempts=o.config.maxRetries||5,this.reconnectDelay=o.config.reconnectDelay||1e3,await this.connectToAgent(),o)}}catch{console.warn("[AriaFlow Widget] Agent config endpoint not available, trying fallback")}console.log("[AriaFlow Widget] Using fallback config for Railway deployment");const e={id:this.agentId,name:this.agentId==="hospital"?"Hospital Support":"Support Agent",wsUrl:`${this.agentUrl.replace(/^https/,"wss")}/ws`,status:"active",capabilities:["chat","streaming"],config:{primaryColor:"#14B8A6",position:"bottom-right",theme:"light",title:this.agentId==="hospital"?"Hospital Support":"Chat Support",subtitle:"We're here to help!",maxRetries:3,reconnectDelay:1e3}};return this.agentConfig=e,await this.connectToAgent(),e}catch(e){return console.error("Failed to initialize widget:",e),null}}async connectToAgent(){if(!this.agentConfig?.wsUrl)throw new Error("No agent WebSocket URL configured");const e=this.getSessionId(),n=`${this.agentConfig.wsUrl}/${e}`;return console.log("[AriaFlow Widget] Connecting to WebSocket:",n),new Promise((o,s)=>{try{this.ws=new WebSocket(n),this.ws.onopen=()=>{console.log("[Widget] Connected to agent"),this.reconnectAttempts=0,this.notifyConnectionChange(!0),o()},this.ws.onmessage=i=>{this.handleMessage(i)},this.ws.onclose=()=>{if(console.log("[Widget] Disconnected from agent"),this.notifyConnectionChange(!1),this.reconnectAttempts<this.maxReconnectAttempts){this.reconnectAttempts++;const i=this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);console.log(`[Widget] Reconnecting in ${i}ms... (attempt ${this.reconnectAttempts})`),setTimeout(()=>this.connectToAgent(),i)}},this.ws.onerror=i=>{console.error("[Widget] WebSocket error:",i),s(i)}}catch(i){s(i)}})}onProcessingChange(e){return this.processingCallbacks.add(e),()=>{this.processingCallbacks.delete(e)}}notifyProcessingChange(e){this.isAgentProcessing=e,this.processingCallbacks.forEach(n=>n(e))}handleMessage(e){try{const n=JSON.parse(e.data);if(n.type==="text-delta")this.isAgentProcessing&&this.notifyProcessingChange(!1),this.setMessages(o=>{const s=o[o.length-1];return s&&s.role==="assistant"&&s.isStreaming?[...o.slice(0,-1),{...s,content:s.content+n.text}]:[...o,{id:te(),role:"assistant",content:n.text,timestamp:Date.now(),isStreaming:!0}]});else if(n.type==="done")console.log("[Widget] Response complete"),this.notifyProcessingChange(!1),this.setMessages(o=>{const s=o[o.length-1];return s&&s.role==="assistant"&&s.isStreaming?[...o.slice(0,-1),{...s,isStreaming:!1}]:o}),this.isAgentStreaming=!1,this.notifyStreamingChange(!1),this.processMessageQueue();else if(n.type==="step-start"||n.type==="agent-start")console.log(`[Widget] ${n.type} received:`,n.agentId||""),this.isAgentStreaming=!0,this.notifyStreamingChange(!0),this.notifyProcessingChange(!0);else if(n.type==="step-end"||n.type==="agent-end")console.log(`[Widget] ${n.type} received`),n.type==="agent-end"&&this.notifyProcessingChange(!1);else if(n.type==="tool-call"){console.log("[Widget] Tool call:",n.tool),this.notifyProcessingChange(!0);const o={id:te(),role:"tool",content:`Calling tool: ${n.tool.name}`,timestamp:Date.now(),toolCall:{name:n.tool.name,arguments:n.tool.arguments}};this.setMessages(s=>[...s,o]),n.tool.name==="suggest_options"&&n.tool.arguments?.options&&this.setMessages(s=>{const i=[...s].reverse().find(a=>a.role==="assistant");return i?s.map(a=>a.id===i.id?{...a,suggestions:n.tool.arguments.options}:a):s})}else n.type==="tool-result"?(console.log("[Widget] Tool result:",n.result),this.setMessages(o=>{const s=o[o.length-1];return s&&s.role==="tool"&&!s.toolResult?[...o.slice(0,-1),{...s,content:s.content+`
2
2
  Result: ${JSON.stringify(n.result)}`,toolResult:n.result}]:o})):n.type==="agent-start"?(console.log(`[Widget] Agent started: ${n.agentId}`),this.isAgentStreaming=!0,this.notifyStreamingChange(!0)):n.type==="handoff"?console.log(`[Widget] Handoff: ${n.from} -> ${n.to}: ${n.reason}`):n.type==="suggested-questions"?(console.log("[Widget] Suggestions received:",n.suggestions),this.setMessages(o=>{const s=[...o].reverse().find(i=>i.role==="assistant");return s?o.map(i=>i.id===s.id?{...i,suggestions:n.suggestions}:i):o})):console.log("[Widget] Unknown message type:",n.type)}catch(n){console.error("[Widget] Error parsing message:",e.data,n)}}async sendMessage(e){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("Not connected to agent");const n={id:te(),role:"user",content:e,timestamp:Date.now()};if(this.setMessages(o=>[...o,n]),this.isAgentStreaming){console.log("[Widget] Agent is streaming, queuing message"),this.messageQueue.push(e),this.notifyQueueChange(this.messageQueue.length);return}this.sendToAgent(e)}async sendToAgent(e){const n=this.getSessionId();this.ws.send(JSON.stringify({message:e,sessionId:n}))}async processMessageQueue(){if(this.messageQueue.length!==0){if(this.messageQueue.length===1){const e=this.messageQueue.shift();console.log("[Widget] Sending queued message:",e),this.sendToAgent(e)}else{const e=this.messageQueue.join(`
3
3
 
4
- `);this.messageQueue.length=0,console.log("[Widget] Sending combined queued messages:",e),this.sendToAgent(e)}this.notifyQueueChange(this.messageQueue.length)}}getSessionId(){let e=sessionStorage.getItem("ariaflow_session_id");return e||(e=te(),sessionStorage.setItem("ariaflow_session_id",e)),e}setMessages(e){this.messages=e(this.messages),this.messageCallbacks.forEach(n=>n(this.messages))}onMessages(e){return this.messageCallbacks.add(e),e(this.messages),()=>{this.messageCallbacks.delete(e)}}onConnectionChange(e){return this.connectionCallbacks.add(e),()=>{this.connectionCallbacks.delete(e)}}onStreamingChange(e){return this.streamingCallbacks.add(e),()=>{this.streamingCallbacks.delete(e)}}onQueueChange(e){return this.queueCallbacks.add(e),()=>{this.queueCallbacks.delete(e)}}notifyConnectionChange(e){this.connectionCallbacks.forEach(n=>n(e))}notifyStreamingChange(e){this.streamingCallbacks.forEach(n=>n(e))}notifyQueueChange(e){this.queueCallbacks.forEach(n=>n(e))}getMessages(){return this.messages}getConfig(){return this.agentConfig}isConnected(){return this.ws?.readyState===WebSocket.OPEN}dispose(){this.ws&&(this.ws.close(),this.ws=null),this.messageCallbacks.clear(),this.connectionCallbacks.clear()}}const he={none:"0",small:"0.375rem",medium:"0.75rem",large:"1rem"};function Xe({agentUrl:t,agentId:e,widgetId:n,apiUrl:o,mode:s="chat",theme:i="light",position:a="bottom-right",size:_="full",radius:c="medium",baseColor:l,accentColor:u="#14B8A6",buttonBaseColor:r="#000000",buttonAccentColor:h="#FFFFFF",title:g,subtitle:C,emptyChatMessage:$}){const[w,p]=T(!1),[f,P]=T([]),[N,D]=T(""),[W,ne]=T(!1),[S,R]=T(!1),[O,x]=T(null),[F,wt]=T(!1),[vt,bt]=T(!1),[fe,Ct]=T(0),oe=ze(null),Ze=ze(null);Be(()=>((async()=>{if(t&&e){console.log("[AriaFlow Widget] Using new agent resolution:",{agentUrl:t,agentId:e});const k=new Ge(t,e);oe.current=k;try{k.onMessages(A=>{console.log("[AriaFlow Widget] Messages updated:",A.length),P(A)}),k.onConnectionChange(A=>{console.log("[AriaFlow Widget] Connection state:",A),ne(A),A&&R(!0)}),k.onStreamingChange(A=>{console.log("[AriaFlow Widget] Streaming state:",A),wt(A)}),k.onQueueChange(A=>{console.log("[AriaFlow Widget] Queue count:",A),Ct(A)}),k.onProcessingChange(A=>{console.log("[AriaFlow Widget] Processing state:",A),bt(A)});const z=await k.initWidget();console.log("[AriaFlow Widget] Agent config received:",z),z?(x(z),console.log("[AriaFlow Widget] Widget initialized successfully")):console.error("[AriaFlow Widget] Agent config fetch failed")}catch(z){console.error("[AriaFlow Widget] Initialization error:",z)}}else t&&!e?(console.warn("[AriaFlow Widget] Direct WebSocket URLs are deprecated. Use agent-url + agent-id instead."),console.error("[AriaFlow Widget] Configuration error: agent-id is required")):o&&n?(console.warn("[AriaFlow Widget] Legacy widget config is deprecated. Use agent-url + agent-id instead."),console.error("[AriaFlow Widget] Configuration error: use agent-url + agent-id instead")):console.error("[AriaFlow Widget] Invalid configuration. Provide agent-url and agent-id.")})(),()=>{oe.current?.dispose()}),[t,e,n,o]),Be(()=>{Ze.current?.scrollIntoView({behavior:"smooth"})},[f]);const et=async()=>{if(!N.trim()||!W)return;const v=N.trim();D("");try{await oe.current?.sendMessage(v)}catch(k){console.error("Failed to send message:",k)}},kt=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),et())},At=v=>{!W||F||oe.current?.sendMessage(v)},St=g||O?.config.title||"Ninewells Hospital",$t=C||O?.config.subtitle||"How can we help you today?",Wt=$||O?.config.emptyChatMessage||"Start a conversation with Ninewells...";return console.log("[AriaFlow Widget] Rendering widget component",{isInitialized:S,isOpen:w,position:a}),d("div",{className:`ariaflow-widget-container ariaflow-widget-${a} ariaflow-widget-${_} ariaflow-widget-radius-${c}`,"data-theme":i,style:{"--ariaflow-accent-color":u,"--ariaflow-base-color":l},children:[!w&&d("button",{className:"ariaflow-widget-launcher",onClick:()=>p(!0),style:{backgroundColor:r,color:h,opacity:S?1:.8,cursor:S?"pointer":"wait",position:"relative"},"aria-label":S?"Open chat":"Connecting to agent...",disabled:!S,title:S?"Click to start chat":"Connecting to agent...",children:[!S&&d("div",{className:"ariaflow-widget-launcher-loading",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"20px",height:"20px",border:`2px solid ${h}`,borderTop:"2px solid transparent",borderRadius:"50%",animation:"spin 1s linear infinite"}}),S&&d("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:d("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})]}),w&&S&&d("div",{className:"ariaflow-widget-window",style:{backgroundColor:i==="dark"&&l?l:void 0,borderRadius:he[c]},children:[d("div",{className:"ariaflow-widget-header",style:{backgroundColor:u,borderRadius:c==="none"?"0":`${he[c]} ${he[c]} 0 0`},children:[d("div",{className:"ariaflow-widget-header-content",children:d("div",{className:"ariaflow-widget-title-group",children:[d("h3",{className:"ariaflow-widget-title",children:St}),d("p",{className:"ariaflow-widget-subtitle",children:$t})]})}),d("button",{className:"ariaflow-widget-close",onClick:()=>p(!1),"aria-label":"Close chat",children:d("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!W&&d("div",{className:"ariaflow-widget-status",children:[d("span",{className:"ariaflow-widget-status-dot"}),"Connecting..."]}),d("div",{className:"ariaflow-widget-messages",children:f.length===0?d("div",{className:"ariaflow-widget-empty",children:d("p",{children:W?Wt:"Connecting to agent..."})}):d(U,{children:[f.map((v,k)=>(f.length-1,v.role==="tool"?null:d("div",{className:`ariaflow-widget-message ariaflow-widget-message-${v.role}`,children:d("div",{className:"ariaflow-widget-message-bubble",children:d(U,{children:[v.content,v.isStreaming&&d("span",{className:"ariaflow-widget-typing-indicator",children:[d("span",{children:"•"}),d("span",{children:"•"}),d("span",{children:"•"})]})]})})},v.id))),d("div",{ref:Ze}),vt&&!F&&d("div",{className:"ariaflow-widget-message ariaflow-widget-message-assistant",children:d("div",{className:"ariaflow-widget-message-bubble",children:d("span",{className:"ariaflow-widget-typing-indicator",children:[d("span",{children:"•"}),d("span",{children:"•"}),d("span",{children:"•"})]})})})]})}),!F&&(()=>{const v=[...f].reverse().find(k=>k.role!=="tool");return v?.role==="assistant"&&v.suggestions&&v.suggestions.length>0?d("div",{className:"ariaflow-widget-suggestions",children:v.suggestions.map(k=>d("button",{className:"ariaflow-widget-chip",onClick:()=>At(k),style:{borderColor:u,color:u,backgroundColor:"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(4px)"},children:k},k))}):null})(),d("div",{className:"ariaflow-widget-input",children:[d("textarea",{value:N,onInput:v=>D(v.target.value),onKeyDown:kt,placeholder:W?F?fe>0?`Agent is responding... (${fe} message${fe>1?"s":""} queued)`:"Agent is responding...":"Type your message...":"Connecting...",rows:1,disabled:!W}),d("button",{className:"ariaflow-widget-send",onClick:et,disabled:!N.trim()||!W,style:{backgroundColor:u},"aria-label":"Send message",children:d("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),d("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]})]})}lt(Xe,"ariaflow-widget",["agent-url","agent-id","widget-id","api-url","mode","theme","position","size","radius","base-color","accent-color","button-base-color","button-accent-color","title","subtitle","empty-chat-message"],!1),typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ye):Ye());function Ye(){const t=document.querySelectorAll("ariaflow-widget");console.log(`[AriaFlow] Initializing ${t.length} widget(s)`)}H.Widget=Xe,H.WidgetClient=Ge,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
4
+ `);this.messageQueue.length=0,console.log("[Widget] Sending combined queued messages:",e),this.sendToAgent(e)}this.notifyQueueChange(this.messageQueue.length)}}getSessionId(){let e=sessionStorage.getItem("ariaflow_session_id");return e||(e=te(),sessionStorage.setItem("ariaflow_session_id",e)),e}setMessages(e){this.messages=e(this.messages),this.messageCallbacks.forEach(n=>n(this.messages))}onMessages(e){return this.messageCallbacks.add(e),e(this.messages),()=>{this.messageCallbacks.delete(e)}}onConnectionChange(e){return this.connectionCallbacks.add(e),()=>{this.connectionCallbacks.delete(e)}}onStreamingChange(e){return this.streamingCallbacks.add(e),()=>{this.streamingCallbacks.delete(e)}}onQueueChange(e){return this.queueCallbacks.add(e),()=>{this.queueCallbacks.delete(e)}}notifyConnectionChange(e){this.connectionCallbacks.forEach(n=>n(e))}notifyStreamingChange(e){this.streamingCallbacks.forEach(n=>n(e))}notifyQueueChange(e){this.queueCallbacks.forEach(n=>n(e))}getMessages(){return this.messages}getConfig(){return this.agentConfig}isConnected(){return this.ws?.readyState===WebSocket.OPEN}dispose(){this.ws&&(this.ws.close(),this.ws=null),this.messageCallbacks.clear(),this.connectionCallbacks.clear()}}const he={none:"0",small:"0.375rem",medium:"0.75rem",large:"1rem"};function Xe({agentUrl:t,agentId:e,widgetId:n,apiUrl:o,mode:s="chat",theme:i="light",position:a="bottom-right",size:_="full",radius:c="medium",baseColor:l,accentColor:u="#14B8A6",buttonBaseColor:r="#000000",buttonAccentColor:h="#FFFFFF",title:g,subtitle:C,emptyChatMessage:$}){const[w,p]=T(!1),[f,P]=T([]),[N,D]=T(""),[W,ne]=T(!1),[S,R]=T(!1),[O,x]=T(null),[F,wt]=T(!1),[vt,bt]=T(!1),[fe,Ct]=T(0),oe=ze(null),Ze=ze(null);Be(()=>((async()=>{if(t&&e){console.log("[AriaFlow Widget] Using new agent resolution:",{agentUrl:t,agentId:e});const k=new Ge(t,e);oe.current=k;try{k.onMessages(A=>{console.log("[AriaFlow Widget] Messages updated:",A.length),P(A)}),k.onConnectionChange(A=>{console.log("[AriaFlow Widget] Connection state:",A),ne(A),A&&R(!0)}),k.onStreamingChange(A=>{console.log("[AriaFlow Widget] Streaming state:",A),wt(A)}),k.onQueueChange(A=>{console.log("[AriaFlow Widget] Queue count:",A),Ct(A)}),k.onProcessingChange(A=>{console.log("[AriaFlow Widget] Processing state:",A),bt(A)});const z=await k.initWidget();console.log("[AriaFlow Widget] Agent config received:",z),z?(x(z),console.log("[AriaFlow Widget] Widget initialized successfully (v0.6.11)")):console.error("[AriaFlow Widget] Agent config fetch failed")}catch(z){console.error("[AriaFlow Widget] Initialization error:",z)}}else t&&!e?(console.warn("[AriaFlow Widget] Direct WebSocket URLs are deprecated. Use agent-url + agent-id instead."),console.error("[AriaFlow Widget] Configuration error: agent-id is required")):o&&n?(console.warn("[AriaFlow Widget] Legacy widget config is deprecated. Use agent-url + agent-id instead."),console.error("[AriaFlow Widget] Configuration error: use agent-url + agent-id instead")):console.error("[AriaFlow Widget] Invalid configuration. Provide agent-url and agent-id.")})(),()=>{oe.current?.dispose()}),[t,e,n,o]),Be(()=>{Ze.current?.scrollIntoView({behavior:"smooth"})},[f]);const et=async()=>{if(!N.trim()||!W)return;const v=N.trim();D("");try{await oe.current?.sendMessage(v)}catch(k){console.error("Failed to send message:",k)}},kt=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),et())},At=v=>{!W||F||oe.current?.sendMessage(v)},St=g||O?.config.title||"Ninewells Hospital",$t=C||O?.config.subtitle||"How can we help you today?",Wt=$||O?.config.emptyChatMessage||"Start a conversation with Ninewells...";return console.log("[AriaFlow Widget] Rendering widget component",{isInitialized:S,isOpen:w,position:a}),d("div",{className:`ariaflow-widget-container ariaflow-widget-${a} ariaflow-widget-${_} ariaflow-widget-radius-${c}`,"data-theme":i,style:{"--ariaflow-accent-color":u,"--ariaflow-base-color":l},children:[!w&&d("button",{className:"ariaflow-widget-launcher",onClick:()=>p(!0),style:{backgroundColor:r,color:h,opacity:S?1:.8,cursor:S?"pointer":"wait",position:"relative"},"aria-label":S?"Open chat":"Connecting to agent...",disabled:!S,title:S?"Click to start chat":"Connecting to agent...",children:[!S&&d("div",{className:"ariaflow-widget-launcher-loading",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"20px",height:"20px",border:`2px solid ${h}`,borderTop:"2px solid transparent",borderRadius:"50%",animation:"spin 1s linear infinite"}}),S&&d("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:d("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})]}),w&&S&&d("div",{className:"ariaflow-widget-window",style:{backgroundColor:i==="dark"&&l?l:void 0,borderRadius:he[c]},children:[d("div",{className:"ariaflow-widget-header",style:{backgroundColor:u,borderRadius:c==="none"?"0":`${he[c]} ${he[c]} 0 0`},children:[d("div",{className:"ariaflow-widget-header-content",children:d("div",{className:"ariaflow-widget-title-group",children:[d("h3",{className:"ariaflow-widget-title",children:St}),d("p",{className:"ariaflow-widget-subtitle",children:$t})]})}),d("button",{className:"ariaflow-widget-close",onClick:()=>p(!1),"aria-label":"Close chat",children:d("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!W&&d("div",{className:"ariaflow-widget-status",children:[d("span",{className:"ariaflow-widget-status-dot"}),"Connecting..."]}),d("div",{className:"ariaflow-widget-messages",children:f.length===0?d("div",{className:"ariaflow-widget-empty",children:d("p",{children:W?Wt:"Connecting to agent..."})}):d(U,{children:[f.map((v,k)=>(f.length-1,v.role==="tool"?null:d("div",{className:`ariaflow-widget-message ariaflow-widget-message-${v.role}`,children:d("div",{className:"ariaflow-widget-message-bubble",children:d(U,{children:[v.content,v.isStreaming&&d("span",{className:"ariaflow-widget-typing-indicator",children:[d("span",{children:"•"}),d("span",{children:"•"}),d("span",{children:"•"})]})]})})},v.id))),d("div",{ref:Ze}),vt&&!F&&d("div",{className:"ariaflow-widget-message ariaflow-widget-message-assistant",children:d("div",{className:"ariaflow-widget-message-bubble",children:d("span",{className:"ariaflow-widget-typing-indicator",children:[d("span",{children:"•"}),d("span",{children:"•"}),d("span",{children:"•"})]})})})]})}),!F&&(()=>{const v=[...f].reverse().find(k=>k.role!=="tool");return v?.role==="assistant"&&v.suggestions&&v.suggestions.length>0?d("div",{className:"ariaflow-widget-suggestions",children:v.suggestions.map(k=>d("button",{className:"ariaflow-widget-chip",onClick:()=>At(k),style:{borderColor:u,color:u,backgroundColor:"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(4px)"},children:k},k))}):null})(),d("div",{className:"ariaflow-widget-input",children:[d("textarea",{value:N,onInput:v=>D(v.target.value),onKeyDown:kt,placeholder:W?F?fe>0?`Agent is responding... (${fe} message${fe>1?"s":""} queued)`:"Agent is responding...":"Type your message...":"Connecting...",rows:1,disabled:!W}),d("button",{className:"ariaflow-widget-send",onClick:et,disabled:!N.trim()||!W,style:{backgroundColor:u},"aria-label":"Send message",children:d("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),d("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]})]})}lt(Xe,"ariaflow-widget",["agent-url","agent-id","widget-id","api-url","mode","theme","position","size","radius","base-color","accent-color","button-base-color","button-accent-color","title","subtitle","empty-chat-message"],!1),typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ye):Ye());function Ye(){const t=document.querySelectorAll("ariaflow-widget");console.log(`[AriaFlow] Initializing ${t.length} widget(s)`)}H.Widget=Xe,H.WidgetClient=Ge,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariaflowagents/widget",
3
- "version": "0.6.9",
3
+ "version": "0.6.11",
4
4
  "type": "module",
5
5
  "description": "Embeddable chat widget for AriaFlow Universal Inbox",
6
6
  "main": "./dist/widget.js",