@desivocal/agents-cdn 1.0.20-alpha.44 → 1.0.20-alpha.46

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.
@@ -60603,7 +60603,7 @@ const qse = ({ room: t, config: e }) => {
60603
60603
  id: jt.id,
60604
60604
  datetime: jt.datetime
60605
60605
  })),
60606
- timezone: Me.timezone || "UTC",
60606
+ timezone: Me.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
60607
60607
  title: Me.title || "Select a time slot"
60608
60608
  },
60609
60609
  actions: {
@@ -60881,7 +60881,7 @@ const qse = ({ room: t, config: e }) => {
60881
60881
  /* @__PURE__ */ W.jsx(iG, {}),
60882
60882
  !1
60883
60883
  ] });
60884
- }, Wse = "1.0.20-alpha.44", Gse = ({ config: t }) => {
60884
+ }, Wse = "1.0.20-alpha.46", Gse = ({ config: t }) => {
60885
60885
  const [e] = G.useState(() => new Zm({ dynacast: !0, adaptiveStream: !0 }));
60886
60886
  return G.useEffect(() => {
60887
60887
  console.log(`%c[Ringg CDN] v${Wse} initialized`, "background: #7c3aed; color: white; padding: 2px 8px; border-radius: 4px;"), console.log("[Ringg CDN] Config:", t);
@@ -422,5 +422,5 @@ a=extmap-allow-mixed`)!==-1){const s=a.sdp.split(`
422
422
  `))+1))}const l="#".repeat(a),c=n.enter("headingAtx"),h=n.enter("phrasing");s.move(l+" ");let p=n.containerPhrasing(t,{before:"# ",after:`
423
423
  `,...s.current()});return/^[\t ]/.test(p)&&(p=Dv(p.charCodeAt(0))+p.slice(1)),p=p?l+" "+p:l,n.options.closeAtx&&(p+=" "+l),h(),c(),p}V5.peek=yee;function V5(t){return t.value||""}function yee(){return"<"}z5.peek=bee;function z5(t,e,n,r){const a=T_(n),s=a==='"'?"Quote":"Apostrophe",l=n.enter("image");let c=n.enter("label");const h=n.createTracker(r);let p=h.move("![");return p+=h.move(n.safe(t.alt,{before:p,after:"]",...h.current()})),p+=h.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),p+=h.move("<"),p+=h.move(n.safe(t.url,{before:p,after:">",...h.current()})),p+=h.move(">")):(c=n.enter("destinationRaw"),p+=h.move(n.safe(t.url,{before:p,after:t.title?" ":")",...h.current()}))),c(),t.title&&(c=n.enter(`title${s}`),p+=h.move(" "+a),p+=h.move(n.safe(t.title,{before:p,after:a,...h.current()})),p+=h.move(a),c()),p+=h.move(")"),l(),p}function bee(){return"!"}B5.peek=See;function B5(t,e,n,r){const a=t.referenceType,s=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("![");const p=n.safe(t.alt,{before:h,after:"]",...c.current()});h+=c.move(p+"]["),l();const v=n.stack;n.stack=[],l=n.enter("reference");const b=n.safe(n.associationId(t),{before:h,after:"]",...c.current()});return l(),n.stack=v,s(),a==="full"||!p||p!==b?h+=c.move(b+"]"):a==="shortcut"?h=h.slice(0,-1):h+=c.move("]"),h}function See(){return"!"}H5.peek=Cee;function H5(t,e,n){let r=t.value||"",a="`",s=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const l=n.unsafe[s],c=n.compilePattern(l);let h;if(l.atBreak)for(;h=c.exec(r);){let p=h.index;r.charCodeAt(p)===10&&r.charCodeAt(p-1)===13&&p--,r=r.slice(0,p)+" "+r.slice(h.index+1)}}return a+r+a}function Cee(){return"`"}function $5(t,e){const n=Zw(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}q5.peek=kee;function q5(t,e,n,r){const a=T_(n),s=a==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let c,h;if($5(t,n)){const v=n.stack;n.stack=[],c=n.enter("autolink");let b=l.move("<");return b+=l.move(n.containerPhrasing(t,{before:b,after:">",...l.current()})),b+=l.move(">"),c(),n.stack=v,b}c=n.enter("link"),h=n.enter("label");let p=l.move("[");return p+=l.move(n.containerPhrasing(t,{before:p,after:"](",...l.current()})),p+=l.move("]("),h(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(h=n.enter("destinationLiteral"),p+=l.move("<"),p+=l.move(n.safe(t.url,{before:p,after:">",...l.current()})),p+=l.move(">")):(h=n.enter("destinationRaw"),p+=l.move(n.safe(t.url,{before:p,after:t.title?" ":")",...l.current()}))),h(),t.title&&(h=n.enter(`title${s}`),p+=l.move(" "+a),p+=l.move(n.safe(t.title,{before:p,after:a,...l.current()})),p+=l.move(a),h()),p+=l.move(")"),c(),p}function kee(t,e,n){return $5(t,n)?"<":"["}W5.peek=Tee;function W5(t,e,n,r){const a=t.referenceType,s=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("[");const p=n.containerPhrasing(t,{before:h,after:"]",...c.current()});h+=c.move(p+"]["),l();const v=n.stack;n.stack=[],l=n.enter("reference");const b=n.safe(n.associationId(t),{before:h,after:"]",...c.current()});return l(),n.stack=v,s(),a==="full"||!p||p!==b?h+=c.move(b+"]"):a==="shortcut"?h=h.slice(0,-1):h+=c.move("]"),h}function Tee(){return"["}function x_(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function xee(t){const e=x_(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function wee(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function G5(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function _ee(t,e,n,r){const a=n.enter("list"),s=n.bulletCurrent;let l=t.ordered?wee(n):x_(n);const c=t.ordered?l==="."?")":".":xee(n);let h=e&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!t.ordered){const v=t.children?t.children[0]:void 0;if((l==="*"||l==="-")&&v&&(!v.children||!v.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(h=!0),G5(n)===l&&v){let b=-1;for(;++b<t.children.length;){const k=t.children[b];if(k&&k.type==="listItem"&&k.children&&k.children[0]&&k.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(l=c),n.bulletCurrent=l;const p=n.containerFlow(t,r);return n.bulletLastUsed=l,n.bulletCurrent=s,a(),p}function Eee(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function Ree(t,e,n,r){const a=Eee(n);let s=n.bulletCurrent||x_(n);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let l=s.length+1;(a==="tab"||a==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(r);c.move(s+" ".repeat(l-s.length)),c.shift(l);const h=n.enter("listItem"),p=n.indentLines(n.containerFlow(t,c.current()),v);return h(),p;function v(b,k,T){return k?(T?"":" ".repeat(l))+b:(T?s:s+" ".repeat(l-s.length))+b}}function Pee(t,e,n,r){const a=n.enter("paragraph"),s=n.enter("phrasing"),l=n.containerPhrasing(t,r);return s(),a(),l}const Dee=kS(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Aee(t,e,n,r){return(t.children.some(function(l){return Dee(l)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function Oee(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Y5.peek=Mee;function Y5(t,e,n,r){const a=Oee(n),s=n.enter("strong"),l=n.createTracker(r),c=l.move(a+a);let h=l.move(n.containerPhrasing(t,{after:a,before:c,...l.current()}));const p=h.charCodeAt(0),v=_S(r.before.charCodeAt(r.before.length-1),p,a);v.inside&&(h=Dv(p)+h.slice(1));const b=h.charCodeAt(h.length-1),k=_S(r.after.charCodeAt(0),b,a);k.inside&&(h=h.slice(0,-1)+Dv(b));const T=l.move(a+a);return s(),n.attentionEncodeSurroundingInfo={after:k.outside,before:v.outside},c+h+T}function Mee(t,e,n){return n.options.strong||"*"}function Lee(t,e,n,r){return n.safe(t.value,r)}function Nee(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function Iee(t,e,n){const r=(G5(n)+(n.options.ruleSpaces?" ":"")).repeat(Nee(n));return n.options.ruleSpaces?r.slice(0,-1):r}const K5={blockquote:aee,break:F5,code:dee,definition:hee,emphasis:j5,hardBreak:F5,heading:vee,html:V5,image:z5,imageReference:B5,inlineCode:H5,link:q5,linkReference:W5,list:_ee,listItem:Ree,paragraph:Pee,root:Aee,strong:Y5,text:Lee,thematicBreak:Iee};function Uee(){return{enter:{table:Fee,tableData:Z5,tableHeader:Z5,tableRow:Vee},exit:{codeText:zee,table:jee,tableData:w_,tableHeader:w_,tableRow:w_}}}function Fee(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function jee(t){this.exit(t),this.data.inTable=void 0}function Vee(t){this.enter({type:"tableRow",children:[]},t)}function w_(t){this.exit(t)}function Z5(t){this.enter({type:"tableCell",children:[]},t)}function zee(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Bee));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Bee(t,e){return e==="|"?e:t}function Hee(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,a=e.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
424
424
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:k,table:l,tableCell:h,tableRow:c}};function l(T,E,R,M){return p(v(T,R,M),T.align)}function c(T,E,R,M){const A=b(T,R,M),U=p([A]);return U.slice(0,U.indexOf(`
425
- `))}function h(T,E,R,M){const A=R.enter("tableCell"),U=R.enter("phrasing"),V=R.containerPhrasing(T,{...M,before:s,after:s});return U(),A(),V}function p(T,E){return ree(T,{align:E,alignDelimiters:r,padding:n,stringLength:a})}function v(T,E,R){const M=T.children;let A=-1;const U=[],V=E.enter("table");for(;++A<M.length;)U[A]=b(M[A],E,R);return V(),U}function b(T,E,R){const M=T.children;let A=-1;const U=[],V=E.enter("tableRow");for(;++A<M.length;)U[A]=h(M[A],T,E,R);return V(),U}function k(T,E,R){let M=K5.inlineCode(T,E,R);return R.stack.includes("tableCell")&&(M=M.replace(/\|/g,"\\$&")),M}}function $ee(){return{exit:{taskListCheckValueChecked:Q5,taskListCheckValueUnchecked:Q5,paragraph:Wee}}}function qee(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Gee}}}function Q5(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function Wee(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=e.children;let s=-1,l;for(;++s<a.length;){const c=a[s];if(c.type==="paragraph"){l=c;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function Gee(t,e,n,r){const a=t.children[0],s=typeof t.checked=="boolean"&&a&&a.type==="paragraph",l="["+(t.checked?"x":" ")+"] ",c=n.createTracker(r);s&&c.move(l);let h=K5.listItem(t,e,n,{...r,...c.current()});return s&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),h;function p(v){return v+l}}function Yee(){return[wJ(),UJ(),QJ(),Uee(),$ee()]}function Kee(t){return{extensions:[_J(),FJ(),XJ(),Hee(t),qee()]}}const Zee={tokenize:nte,partial:!0},X5={tokenize:rte,partial:!0},J5={tokenize:ite,partial:!0},eU={tokenize:ate,partial:!0},Qee={tokenize:ote,partial:!0},tU={name:"wwwAutolink",tokenize:ete,previous:rU},nU={name:"protocolAutolink",tokenize:tte,previous:iU},Cu={name:"emailAutolink",tokenize:Jee,previous:aU},kl={};function Xee(){return{text:kl}}let mf=48;for(;mf<123;)kl[mf]=Cu,mf++,mf===58?mf=65:mf===91&&(mf=97);kl[43]=Cu,kl[45]=Cu,kl[46]=Cu,kl[95]=Cu,kl[72]=[Cu,nU],kl[104]=[Cu,nU],kl[87]=[Cu,tU],kl[119]=[Cu,tU];function Jee(t,e,n){const r=this;let a,s;return l;function l(b){return!__(b)||!aU.call(r,r.previous)||E_(r.events)?n(b):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),c(b))}function c(b){return __(b)?(t.consume(b),c):b===64?(t.consume(b),h):n(b)}function h(b){return b===46?t.check(Qee,v,p)(b):b===45||b===95||Sa(b)?(s=!0,t.consume(b),h):v(b)}function p(b){return t.consume(b),a=!0,h}function v(b){return s&&a&&za(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(b)):n(b)}}function ete(t,e,n){const r=this;return a;function a(l){return l!==87&&l!==119||!rU.call(r,r.previous)||E_(r.events)?n(l):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Zee,t.attempt(X5,t.attempt(J5,s),n),n)(l))}function s(l){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(l)}}function tte(t,e,n){const r=this;let a="",s=!1;return l;function l(b){return(b===72||b===104)&&iU.call(r,r.previous)&&!E_(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),a+=String.fromCodePoint(b),t.consume(b),c):n(b)}function c(b){if(za(b)&&a.length<5)return a+=String.fromCodePoint(b),t.consume(b),c;if(b===58){const k=a.toLowerCase();if(k==="http"||k==="https")return t.consume(b),h}return n(b)}function h(b){return b===47?(t.consume(b),s?p:(s=!0,h)):n(b)}function p(b){return b===null||fS(b)||Sr(b)||pf(b)||hS(b)?n(b):t.attempt(X5,t.attempt(J5,v),n)(b)}function v(b){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(b)}}function nte(t,e,n){let r=0;return a;function a(l){return(l===87||l===119)&&r<3?(r++,t.consume(l),a):l===46&&r===3?(t.consume(l),s):n(l)}function s(l){return l===null?n(l):e(l)}}function rte(t,e,n){let r,a,s;return l;function l(p){return p===46||p===95?t.check(eU,h,c)(p):p===null||Sr(p)||pf(p)||p!==45&&hS(p)?h(p):(s=!0,t.consume(p),l)}function c(p){return p===95?r=!0:(a=r,r=void 0),t.consume(p),l}function h(p){return a||r||!s?n(p):e(p)}}function ite(t,e){let n=0,r=0;return a;function a(l){return l===40?(n++,t.consume(l),a):l===41&&r<n?s(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?t.check(eU,e,s)(l):l===null||Sr(l)||pf(l)?e(l):(t.consume(l),a)}function s(l){return l===41&&r++,t.consume(l),a}}function ate(t,e,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(t.consume(c),r):c===38?(t.consume(c),s):c===93?(t.consume(c),a):c===60||c===null||Sr(c)||pf(c)?e(c):n(c)}function a(c){return c===null||c===40||c===91||Sr(c)||pf(c)?e(c):r(c)}function s(c){return za(c)?l(c):n(c)}function l(c){return c===59?(t.consume(c),r):za(c)?(t.consume(c),l):n(c)}}function ote(t,e,n){return r;function r(s){return t.consume(s),a}function a(s){return Sa(s)?n(s):e(s)}}function rU(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Sr(t)}function iU(t){return!za(t)}function aU(t){return!(t===47||__(t))}function __(t){return t===43||t===45||t===46||t===95||Sa(t)}function E_(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ste={tokenize:mte,partial:!0};function lte(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:fte,continuation:{tokenize:hte},exit:pte}},text:{91:{name:"gfmFootnoteCall",tokenize:dte},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ute,resolveTo:cte}}}}function ute(t,e,n){const r=this;let a=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;a--;){const h=r.events[a][1];if(h.type==="labelImage"){l=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return c;function c(h){if(!l||!l._balanced)return n(h);const p=Ns(r.sliceSerialize({start:l.end,end:r.now()}));return p.codePointAt(0)!==94||!s.includes(p.slice(1))?n(h):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),e(h))}}function cte(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},t[t.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},c=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",a,e],["exit",a,e],["enter",s,e],["enter",l,e],["exit",l,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...c),t}function dte(t,e,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,l;return c;function c(b){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(b),t.exit("gfmFootnoteCallLabelMarker"),h}function h(b){return b!==94?n(b):(t.enter("gfmFootnoteCallMarker"),t.consume(b),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",p)}function p(b){if(s>999||b===93&&!l||b===null||b===91||Sr(b))return n(b);if(b===93){t.exit("chunkString");const k=t.exit("gfmFootnoteCallString");return a.includes(Ns(r.sliceSerialize(k)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(b),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(b)}return Sr(b)||(l=!0),s++,t.consume(b),b===92?v:p}function v(b){return b===91||b===92||b===93?(t.consume(b),s++,p):p(b)}}function fte(t,e,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,l=0,c;return h;function h(E){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(E){return E===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",v):n(E)}function v(E){if(l>999||E===93&&!c||E===null||E===91||Sr(E))return n(E);if(E===93){t.exit("chunkString");const R=t.exit("gfmFootnoteDefinitionLabelString");return s=Ns(r.sliceSerialize(R)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),k}return Sr(E)||(c=!0),l++,t.consume(E),E===92?b:v}function b(E){return E===91||E===92||E===93?(t.consume(E),l++,v):v(E)}function k(E){return E===58?(t.enter("definitionMarker"),t.consume(E),t.exit("definitionMarker"),a.includes(s)||a.push(s),Vn(t,T,"gfmFootnoteDefinitionWhitespace")):n(E)}function T(E){return e(E)}}function hte(t,e,n){return t.check(wv,e,t.attempt(ste,e,n))}function pte(t){t.exit("gfmFootnoteDefinition")}function mte(t,e,n){const r=this;return Vn(t,a,"gfmFootnoteDefinitionIndent",5);function a(s){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(s):n(s)}}function gte(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(l,c){let h=-1;for(;++h<l.length;)if(l[h][0]==="enter"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._close){let p=h;for(;p--;)if(l[p][0]==="exit"&&l[p][1].type==="strikethroughSequenceTemporary"&&l[p][1]._open&&l[h][1].end.offset-l[h][1].start.offset===l[p][1].end.offset-l[p][1].start.offset){l[h][1].type="strikethroughSequence",l[p][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},l[p][1].start),end:Object.assign({},l[h][1].end)},b={type:"strikethroughText",start:Object.assign({},l[p][1].end),end:Object.assign({},l[h][1].start)},k=[["enter",v,c],["enter",l[p][1],c],["exit",l[p][1],c],["enter",b,c]],T=c.parser.constructs.insideSpan.null;T&&Mo(k,k.length,0,pS(T,l.slice(p+1,h),c)),Mo(k,k.length,0,[["exit",b,c],["enter",l[h][1],c],["exit",l[h][1],c],["exit",v,c]]),Mo(l,p-1,h-p+3,k),h=p+k.length-2;break}}for(h=-1;++h<l.length;)l[h][1].type==="strikethroughSequenceTemporary"&&(l[h][1].type="data");return l}function s(l,c,h){const p=this.previous,v=this.events;let b=0;return k;function k(E){return p===126&&v[v.length-1][1].type!=="characterEscape"?h(E):(l.enter("strikethroughSequenceTemporary"),T(E))}function T(E){const R=Cp(p);if(E===126)return b>1?h(E):(l.consume(E),b++,T);if(b<2&&!n)return h(E);const M=l.exit("strikethroughSequenceTemporary"),A=Cp(E);return M._open=!A||A===2&&!!R,M._close=!R||R===2&&!!A,c(E)}}}class vte{constructor(){this.map=[]}add(e,n,r){yte(this,e,n,r)}consume(e){if(this.map.sort(function(s,l){return s[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push([...e]),e.length=0;let a=r.pop();for(;a;)e.push(...a),a=r.pop();this.map.length=0}}function yte(t,e,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<t.map.length;){if(t.map[a][0]===e){t.map[a][1]+=n,t.map[a][2].push(...r);return}a+=1}t.map.push([e,n,r])}}function bte(t,e){let n=!1;const r=[];for(;e<t.length;){const a=t[e];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function Ste(){return{flow:{null:{name:"table",tokenize:Cte,resolveAll:kte}}}}function Cte(t,e,n){const r=this;let a=0,s=0,l;return c;function c($){let oe=r.events.length-1;for(;oe>-1;){const ke=r.events[oe][1].type;if(ke==="lineEnding"||ke==="linePrefix")oe--;else break}const J=oe>-1?r.events[oe][1].type:null,xe=J==="tableHead"||J==="tableRow"?N:h;return xe===N&&r.parser.lazy[r.now().line]?n($):xe($)}function h($){return t.enter("tableHead"),t.enter("tableRow"),p($)}function p($){return $===124||(l=!0,s+=1),v($)}function v($){return $===null?n($):Bt($)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume($),t.exit("lineEnding"),T):n($):Pn($)?Vn(t,v,"whitespace")($):(s+=1,l&&(l=!1,a+=1),$===124?(t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),l=!0,v):(t.enter("data"),b($)))}function b($){return $===null||$===124||Sr($)?(t.exit("data"),v($)):(t.consume($),$===92?k:b)}function k($){return $===92||$===124?(t.consume($),b):b($)}function T($){return r.interrupt=!1,r.parser.lazy[r.now().line]?n($):(t.enter("tableDelimiterRow"),l=!1,Pn($)?Vn(t,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):E($))}function E($){return $===45||$===58?M($):$===124?(l=!0,t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),R):I($)}function R($){return Pn($)?Vn(t,M,"whitespace")($):M($)}function M($){return $===58?(s+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume($),t.exit("tableDelimiterMarker"),A):$===45?(s+=1,A($)):$===null||Bt($)?j($):I($)}function A($){return $===45?(t.enter("tableDelimiterFiller"),U($)):I($)}function U($){return $===45?(t.consume($),U):$===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume($),t.exit("tableDelimiterMarker"),V):(t.exit("tableDelimiterFiller"),V($))}function V($){return Pn($)?Vn(t,j,"whitespace")($):j($)}function j($){return $===124?E($):$===null||Bt($)?!l||a!==s?I($):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e($)):I($)}function I($){return n($)}function N($){return t.enter("tableRow"),ne($)}function ne($){return $===124?(t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),ne):$===null||Bt($)?(t.exit("tableRow"),e($)):Pn($)?Vn(t,ne,"whitespace")($):(t.enter("data"),X($))}function X($){return $===null||$===124||Sr($)?(t.exit("data"),ne($)):(t.consume($),$===92?se:X)}function se($){return $===92||$===124?(t.consume($),X):X($)}}function kte(t,e){let n=-1,r=!0,a=0,s=[0,0,0,0],l=[0,0,0,0],c=!1,h=0,p,v,b;const k=new vte;for(;++n<t.length;){const T=t[n],E=T[1];T[0]==="enter"?E.type==="tableHead"?(c=!1,h!==0&&(oU(k,e,h,p,v),v=void 0,h=0),p={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},k.add(n,0,[["enter",p,e]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(r=!0,b=void 0,s=[0,0,0,0],l=[0,n+1,0,0],c&&(c=!1,v={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},k.add(n,0,[["enter",v,e]])),a=E.type==="tableDelimiterRow"?2:v?3:1):a&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(s[1]!==0&&(l[0]=l[1],b=ES(k,e,s,a,void 0,b),s=[0,0,0,0]),l[2]=n)):E.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(l[0]=l[1],b=ES(k,e,s,a,void 0,b)),s=l,l=[s[1],n,0,0])):E.type==="tableHead"?(c=!0,h=n):E.type==="tableRow"||E.type==="tableDelimiterRow"?(h=n,s[1]!==0?(l[0]=l[1],b=ES(k,e,s,a,n,b)):l[1]!==0&&(b=ES(k,e,l,a,n,b)),a=0):a&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(l[3]=n)}for(h!==0&&oU(k,e,h,p,v),k.consume(e.events),n=-1;++n<e.events.length;){const T=e.events[n];T[0]==="enter"&&T[1].type==="table"&&(T[1]._align=bte(e.events,n))}return t}function ES(t,e,n,r,a,s){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(s.end=Object.assign({},Tp(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const h=Tp(e.events,n[1]);if(s={type:l,start:Object.assign({},h),end:Object.assign({},h)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const p=Tp(e.events,n[2]),v=Tp(e.events,n[3]),b={type:c,start:Object.assign({},p),end:Object.assign({},v)};if(t.add(n[2],0,[["enter",b,e]]),r!==2){const k=e.events[n[2]],T=e.events[n[3]];if(k[1].end=Object.assign({},T[1].end),k[1].type="chunkText",k[1].contentType="text",n[3]>n[2]+1){const E=n[2]+1,R=n[3]-n[2]-1;t.add(E,R,[])}}t.add(n[3]+1,0,[["exit",b,e]])}return a!==void 0&&(s.end=Object.assign({},Tp(e.events,a)),t.add(a,0,[["exit",s,e]]),s=void 0),s}function oU(t,e,n,r,a){const s=[],l=Tp(e.events,n);a&&(a.end=Object.assign({},l),s.push(["exit",a,e])),r.end=Object.assign({},l),s.push(["exit",r,e]),t.add(n+1,0,s)}function Tp(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const Tte={name:"tasklistCheck",tokenize:wte};function xte(){return{text:{91:Tte}}}function wte(t,e,n){const r=this;return a;function a(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),s)}function s(h){return Sr(h)?(t.enter("taskListCheckValueUnchecked"),t.consume(h),t.exit("taskListCheckValueUnchecked"),l):h===88||h===120?(t.enter("taskListCheckValueChecked"),t.consume(h),t.exit("taskListCheckValueChecked"),l):n(h)}function l(h){return h===93?(t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(h)}function c(h){return Bt(h)?e(h):Pn(h)?t.check({tokenize:_te},e,n)(h):n(h)}}function _te(t,e,n){return Vn(t,r,"whitespace");function r(a){return a===null?n(a):e(a)}}function Ete(t){return I4([Xee(),lte(),gte(t),Ste(),xte()])}const Rte={};function Pte(t){const e=this,n=t||Rte,r=e.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(Ete(n)),s.push(Yee()),l.push(Kee(n))}const Dte=({itemIndex:t,message:e})=>{const n=Zo(),r=WW(e.name),a=r?n.textColor:n.primaryTextColor;return W.jsx("div",{className:xr("ringg_ai-flex ringg_ai-flex-col ringg_ai-items-start ringg_ai-gap-1 ringg_ai-justify-start",r?"ringg_ai-flex-row":"ringg_ai-flex-row-reverse"),children:W.jsx("div",{className:xr("ringg_ai-flex ringg_ai-items-center ringg_ai-justify-start ringg_ai-gap-2 ringg_ai-px-4 ringg_ai-py-2 ringg_ai-rounded-xl ringg_ai-max-w-[90%]",r?"ringg_ai-mr-auto ringg_ai-text-left ringg_ai-rounded-bl-none":"ringg_ai-ml-auto ringg_ai-text-right ringg_ai-rounded-br-none"),style:{backgroundColor:r?n.surfaceColor:n.primaryColor,color:a},children:W.jsxs("div",{className:"ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-2.5 ringg_ai-w-full ringg_ai-overflow-x-auto",children:[W.jsx("div",{className:"ringg_ai-prose ringg_ai-prose-sm ringg_ai-max-w-none [&_p]:ringg_ai-text-sm [&_li]:ringg_ai-text-sm [&_table]:ringg_ai-w-max",style:{"--tw-prose-body":a,"--tw-prose-headings":a,"--tw-prose-bold":a,"--tw-prose-counters":a,"--tw-prose-bullets":a,"--tw-prose-quotes":a,"--tw-prose-code":a,"--tw-prose-th-borders":n.borderColor,"--tw-prose-td-borders":n.borderColor,color:a},children:W.jsx(mJ,{remarkPlugins:[Pte],children:e.message})}),(e==null?void 0:e.sourceUrl)&&W.jsxs("a",{href:e.sourceUrl,target:"_blank",rel:"noopener noreferrer",className:"ringg_ai-text-sm ringg_ai-break-all ringg_ai-w-fit ringg_ai-hover:underline",style:{color:r?n.primaryColor:n.primaryTextColor},children:["Source: ",e.sourceUrl]})]})},`${e.name}__${t}`)},`${e.timestamp}__${t}`)};function Ate({tabs:t=[],activeTab:e="voice-call",onTabChange:n}){const r=Zo(),[a,s]=G.useState(e),l=c=>{s(c),n==null||n(c)};return W.jsx("div",{className:"ringg_ai-w-full ringg_ai-border-t",style:{backgroundColor:r.backgroundColor,borderColor:r.borderColor},children:W.jsx("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-px-0",children:t.map(c=>{const h=c.icon,p=a===c.id,v=p?r.primaryColor:r.mutedTextColor;return W.jsxs("button",{onClick:()=>l(c.id),className:xr("ringg_ai-flex ringg_ai-flex-col ringg_ai-items-center ringg_ai-gap-1 ringg_ai-border-t-2 ringg_ai-py-3 ringg_ai-transition-all ringg_ai-duration-200 ringg_ai-flex-1"),style:{borderTopColor:p?r.primaryColor:"transparent"},children:[W.jsx(h,{className:"ringg_ai-w-5 ringg_ai-h-5 ringg_ai-transition-colors",fill:v,style:{color:v}}),W.jsx("span",{className:"ringg_ai-text-xs ringg_ai-font-medium ringg_ai-transition-colors",style:{color:v},children:c.label})]},c.id)})})})}const Ote=Y3("ringg_ai-inline-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-gap-2 ringg_ai-whitespace-nowrap ringg_ai-rounded-md ringg_ai-text-sm ringg_ai-font-medium ringg_ai-ring-offset-background ringg_ai-transition-colors focus-visible:ringg_ai-outline-none focus-visible:ringg_ai-ring-2 focus-visible:ringg_ai-ring-ring focus-visible:ringg_ai-ring-offset-2 disabled:ringg_ai-pointer-events-none disabled:ringg_ai-opacity-50 [&_svg]:ringg_ai-pointer-events-none [&_svg]:ringg_ai-size-4 [&_svg]:ringg_ai-shrink-0",{variants:{variant:{default:"ringg_ai-bg-primary ringg_ai-text-primary-foreground ringg_ai-shadow hover:ringg_ai-bg-primary/90",destructive:"ringg_ai-bg-destructive ringg_ai-text-destructive-foreground ringg_ai-shadow-sm hover:ringg_ai-bg-destructive/90",outline:"ringg_ai-border ringg_ai-border-input ringg_ai-bg-background ringg_ai-shadow-sm hover:ringg_ai-bg-accent hover:ringg_ai-text-accent-foreground",secondary:"ringg_ai-bg-secondary ringg_ai-text-secondary-foreground ringg_ai-shadow-sm hover:ringg_ai-bg-secondary/80",ghost:"hover:ringg_ai-bg-accent hover:ringg_ai-text-accent-foreground",link:"ringg_ai-text-primary ringg_ai-underline-offset-4 hover:ringg_ai-underline"},size:{default:"ringg_ai-h-9 ringg_ai-px-4 ringg_ai-py-2",sm:"ringg_ai-h-8 ringg_ai-rounded-md ringg_ai-px-3 ringg_ai-text-xs",lg:"ringg_ai-h-10 ringg_ai-rounded-md ringg_ai-px-8",icon:"ringg_ai-h-9 ringg_ai-w-9"}},defaultVariants:{variant:"default",size:"default"}}),Av=G.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...a},s)=>{const l=r?uS:"button";return W.jsx(l,{className:xr(Ote({variant:e,size:n,className:t})),ref:s,...a})});Av.displayName="Button";function Bc(t,e){typeof window<"u"&&window.dispatchEvent(new CustomEvent(t,{detail:e}))}function Mte({callMode:t}){const[e,n]=G.useState(!1),[r,a]=G.useState(!1),[s,l]=G.useState(null),c=G.useRef(!1),h=G.useRef(t);h.current=t;const p=G.useCallback(()=>{c.current||(c.current=!0,n(!0),Bc("ringg:widget_status",{status:"maximised",mode:h.current}))},[]),v=G.useCallback(()=>{c.current=!1,n(!1),Bc("ringg:widget_status",{status:"minimised",mode:h.current})},[]),b=G.useCallback(()=>{a(!1),l(null),v()},[v]),k=G.useCallback(()=>{c.current?v():p()},[p,v]);return G.useMemo(()=>({isOpen:e,showFeedback:r,currentCallId:s,setShowFeedback:a,setCurrentCallId:l,open:p,minimize:v,close:b,toggle:k}),[e,r,s,p,v,b,k])}function Lte({room:t,onError:e}){const[n,r]=G.useState("unknown"),a=G.useRef(e);a.current=e;const s=G.useCallback(async()=>{var h;try{if((h=navigator.permissions)!=null&&h.query){const p=await navigator.permissions.query({name:"microphone"});r(p.state),p.onchange=()=>{r(p.state)}}else try{await navigator.mediaDevices.getUserMedia({audio:!0}),r("granted")}catch{r("denied")}}catch(p){console.error("Error checking microphone permission:",p),r("unknown")}},[]),l=G.useCallback(async()=>{var h;try{const p=await navigator.mediaDevices.getUserMedia({audio:!0});return r("granted"),p.getTracks().forEach(v=>v.stop()),!0}catch(p){return console.error("Error requesting microphone permission:",p),r("denied"),(h=a.current)==null||h.call(a,"Microphone access was denied. Please enable it in your browser settings."),!1}},[]);G.useEffect(()=>{s();const h=()=>{var p;(p=a.current)==null||p.call(a,"Error acquiring microphone permission. Please make sure you grant the necessary permissions in your browser and reload the tab"),r("denied")};return t.on(Ee.MediaDevicesError,h),()=>{t.off(Ee.MediaDevicesError,h)}},[t,s]);const c=n==="granted";return G.useMemo(()=>({state:n,isGranted:c,check:s,request:l}),[n,c,s,l])}function Nte({containerRef:t,enabled:e}){G.useEffect(()=>{const n=t.current;if(!n||!e)return;const r=c=>{const h=n.querySelector('[data-scrollable="true"]');if(!h){c.preventDefault();return}const{scrollTop:p,scrollHeight:v,clientHeight:b}=h,k=p===0&&c.deltaY<0,T=p+b>=v-1&&c.deltaY>0;(k||T)&&c.preventDefault()};let a=0;const s=c=>{a=c.touches[0].clientY},l=c=>{const h=n.querySelector('[data-scrollable="true"]'),p=c.touches[0].clientY,v=a-p;if(!h){c.preventDefault();return}const{scrollTop:b,scrollHeight:k,clientHeight:T}=h,E=b===0&&v<0,R=b+T>=k-1&&v>0;(E||R)&&c.preventDefault()};return n.addEventListener("wheel",r,{passive:!1}),n.addEventListener("touchstart",s,{passive:!0}),n.addEventListener("touchmove",l,{passive:!1}),()=>{n.removeEventListener("wheel",r),n.removeEventListener("touchstart",s),n.removeEventListener("touchmove",l)}},[e])}const xp={mode:"prod",title:"Ringg AI Support",description:"Ringg AI offers 24/7 voice support to handle your business calls efficiently and professionally",defaultTab:"audio",hideTabSelector:!1,notificationTuneUrl:"https://assets.ringg.ai/audios/misc/widget_notification.mp3"};function R_(t){switch(t){case"dev":return"https://calling-dev.ringg.ai/ca/api/v0";case"stage":return"https://stage-api2.desivocal.com/ca/api/v0";default:return"https://prod-api.ringg.ai/ca/api/v0"}}function Ite(t){switch(t){case"dev":return"wss://ringg-ai-dev-92tubwpz.livekit.cloud";case"stage":return"wss://ringg-ai-ujrjmhgy.livekit.cloud";default:return"wss://ringg-ai-prod-r0vhjzhs.livekit.cloud"}}function Jse(t){return t}const sU={center:{top:0,left:0,right:0,bottom:0,margin:"auto"},"top-left":{top:"2%",left:"2%"},"top-right":{top:"2%",right:"2%"},"bottom-left":{bottom:"2%",left:"2%"},"bottom-right":{bottom:"2%",right:"2%"},"bottom-center":{bottom:"2%",left:"50%"}};function Ute(t){return sU[t]??sU["bottom-right"]}function Fte(t){return t==="bottom-center"?{left:"50%"}:t==="bottom-left"?{left:"2%"}:{right:"2%"}}function RS(t){if(t!==void 0)return typeof t=="number"?`${t}px`:t}function jte(t){return t?{width:RS(t.width),height:RS(t.height),borderRadius:RS(t.borderRadius)}:{}}function Vte(t,e){if(!e)return t;let n=[t];return Object.entries(e).forEach(([r,a])=>{n=n.flatMap((s,l)=>{if(typeof s!="string")return s;const c=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=new RegExp(`\\b(${c})\\b`,"g");return s.split(h).map((p,v)=>p===r?W.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"ringg_ai-text-blue-500 hover:ringg_ai-underline",href:a,children:r},`${l}-${v}`):p)})}),n}const zte=({room:t,config:e})=>{var Hi,Ji,ea,co,es,ts,fo;const[n,r]=G.useState({}),a=e,{mode:s=xp.mode,title:l=xp.title,description:c=xp.description,agentId:h,variables:p,buttons:v,xApiKey:b="",defaultTab:k=xp.defaultTab,hideTabSelector:T=xp.hideTabSelector,innerWindowProps:E,logoUrl:R,logoStyles:M,legalDisclaimer:A,feedbackScreen:U,notificationTuneUrl:V=xp.notificationTuneUrl,widgetPosition:j,theme:I}=a,N=WI(I),ne=mw(N.buttonStyle),X=(j==null?void 0:j.triggerPlacement)??"fixed",se=(j==null?void 0:j.triggerAlignment)??"bottom-right",$=(j==null?void 0:j.hideTriggerOnExpand)??!0,oe=(j==null?void 0:j.widgetAlignment)??"bottom-right",J=Ute(se),xe=jte(E),[ke,Ge]=G.useState(k),[Je,je]=G.useState(!1),[ve,He]=G.useState(!1),[z,ee]=G.useState({hasError:!1,message:""}),[Ce,H]=G.useState([]),[Ct,Rt]=G.useState(new Map),ht=G.useRef(null),bt=G.useRef(null),it=G.useRef(null),xt=G.useRef(""),tn=G.useRef(),qn=G.useRef(new Set),_r=G.useRef(null),vr=G.useRef(!1),Xn=G.useRef(new Map),Nr=ex(t),bn=Nr==="connected",Lt=Mte({callMode:ke}),Z=Lte({room:t,onError:et=>ee({hasError:!0,message:et})});Nte({containerRef:bt,enabled:Lt.isOpen});const{chatMessages:le}=$M(),me=hB(),Ve=aB(),ze=HM(),Oe=tx(me.audioTrack||void 0),ut=tx({publication:Ve.microphoneTrack,source:De.Source.Microphone,participant:Ve.localParticipant}),Nt=G.useMemo(()=>ze.find(et=>{var Me;return(Me=et.identity)==null?void 0:Me.includes("agent")}),[ze]),fe=G.useCallback((et,Me)=>{vr.current=!1,console.log("%c[Conversation Started]","background: #22c55e; color: white; padding: 2px 6px; border-radius: 3px;",{mode:et,callId:Me}),Bc("ringg:conversation_status",{status:"started",mode:et,callId:Me})},[]),Re=G.useCallback((et,Me)=>{vr.current||(vr.current=!0,console.log("%c[Conversation Ended]","background: #ef4444; color: white; padding: 2px 6px; border-radius: 3px;",{mode:et,callId:Me}),Bc("ringg:conversation_status",{status:"ended",mode:et,callId:Me}))},[]),vt=G.useCallback(async et=>{if(!(et==="audio"&&!Z.isGranted&&!await Z.request())){je(!0),Ge(et);try{const Me=await fetch(`${R_(s)}/calling/webcall`,{method:"POST",body:JSON.stringify({agent_id:h,custom_args_values:p,media_type:et}),headers:{"Content-Type":"application/json","X-API-KEY":b}}),It=await Me.json();if(!Me.ok)throw new Error((It==null?void 0:It.message)||"Failed to make call");It!=null&&It.call_id&&Lt.setCurrentCallId(It.call_id),await t.connect(Ite(s),It==null?void 0:It.user_token),et==="audio"&&await t.localParticipant.setMicrophoneEnabled(!0),fe(et,It.call_id),ee({hasError:!1,message:""})}catch(Me){ee({hasError:!0,message:Me.message})}finally{je(!1)}}},[t,s,h,p,b,Z,Lt,fe]),Ft=G.useCallback(async()=>{je(!0);try{Lt.currentCallId&&Re(ke,Lt.currentCallId),H([]),Rt(new Map),qn.current=new Set,xt.current="",tn.current=void 0,t.disconnect(),He(!1),Lt.setShowFeedback(!0),Lt.open()}catch(et){ee({hasError:!0,message:"Error ending call: "+et.message})}finally{je(!1)}},[t,ke,Lt,Re]),Kt=G.useCallback(async(et,Me)=>{if(!Lt.currentCallId){Lt.close();return}je(!0);try{await fetch(`${R_(s)}/calling/${Lt.currentCallId}/feedback`,{method:"POST",body:JSON.stringify({rating:et,comment:Me}),headers:{"Content-Type":"application/json","X-API-KEY":b}}),Bc("ringg:feedback_status",{status:"submitted",callId:Lt.currentCallId,rating:et})}catch(It){console.error("Error submitting feedback:",It)}finally{je(!1),Lt.close()}},[s,b,Lt]),Be=G.useCallback(()=>{Lt.currentCallId&&Bc("ringg:feedback_status",{status:"skipped",callId:Lt.currentCallId}),Lt.close()},[Lt]),ct=G.useCallback(et=>{var It;const Me={name:"Agent",message:"",isSelf:!1,timestamp:Date.now()+Math.random(),componentType:et.component_type,componentData:et};H(Ht=>[...Ht,Me]),Bc("ringg:calendar_booking",{status:"shown",componentId:et.component_id}),(It=it.current)==null||It.play().catch(()=>{}),Lt.open()},[Lt]),At=G.useCallback(et=>{qn.current.add(et),Bc("ringg:calendar_booking",{status:"confirmed",componentId:et,message:"Flow completed"})},[]),ln=G.useCallback(async(et,Me)=>{const It=Xn.current.get(et);if(!It){console.warn(`[RPC] No pending response found for component: ${et}`);return}if(!Nt){console.warn("[RPC] No agent participant found to send response to");return}const{name:Ht,originalConfig:Sn}=It,jt="receive_dynamic_data";let Cn;if(Ht==="calendar"){const Er=Me.step_data&&Me.step_data.slot_id;Cn=(Array.isArray(Sn)?Sn:[]).find(Xe=>Xe.id===Er)||{id:Er,datetime:Me.step_data&&Me.step_data.slot_datetime}}else if(Ht==="form")Cn=Me.step_data||Me.all_data;else if(Ht==="buttons"){const Er=Me.step_data&&Me.step_data.selected_button;Cn=(Array.isArray(Sn)?Sn:[]).find(Xe=>Xe.id===Er)||{id:Er}}else Cn=Me;const er=JSON.stringify({componant_type:`receive_component_${Ht}`,component_id:et,componant_data:Cn});try{console.log(`[RPC] Sending ${jt}:`,er);const Er=await Ve.localParticipant.performRpc({destinationIdentity:Nt.identity,method:jt,payload:er});console.log(`[RPC] Response from ${jt}:`,Er),Xn.current.delete(et)}catch(Er){console.error(`[RPC] Error sending ${jt}:`,Er)}},[Nt,Ve.localParticipant]),En=G.useMemo(()=>null,[]),un=G.useCallback(async(et,Me,It)=>(await fetch(Me.startsWith("http")?Me:`${R_(s)}${Me}`,{method:et,body:JSON.stringify(It),headers:{"Content-Type":"application/json","X-API-KEY":b}})).json(),[s,b,bn,En]),Dn=G.useCallback(async et=>{try{const Me=JSON.parse(et.payload);return Array.isArray(Me.source_urls)?xt.current=Me.source_urls.join(", "):Me.source_url&&(xt.current=Me.source_url),JSON.stringify({status:"received"})}catch(Me){throw console.error("Failed to parse RPC payload:",Me),new Error("Invalid payload for send_source_urls")}},[]),Wn=G.useCallback(async et=>{try{console.log("Received dynamic data:",et.payload);const Me=JSON.parse(et.payload);return Me.component_type&&Me.component_id&&ct(Me),JSON.stringify({status:"received"})}catch(Me){throw console.error("Failed to parse component payload:",Me),new Error("Invalid component payload")}},[ct]),Jn=G.useCallback((et,Me)=>{const It=`${et}_${Date.now()}`,Ht=Me.componant_config||Me.component_config;if(et==="calendar"){const Sn=Array.isArray(Ht)?Ht:[];return{component_type:"calendar_booking",component_id:It,data:{available_slots:Sn.map(jt=>({id:jt.id,datetime:jt.datetime})),timezone:Me.timezone||"UTC",title:Me.title||"Select a time slot"},actions:{on_select:{method:"POST",endpoint:"/mock/calendar",payload:{selected_slot_id:"{slot_id}"}}}}}return et==="form"?{component_type:"form",component_id:It,data:{title:Me.title||"Form",description:Me.description,fields:Array.isArray(Ht)?Ht:[],submit_label:Me.submit_label},actions:{on_submit:{method:"POST",endpoint:"/mock/form",payload:{form_data:"{form_data}"}}}}:et==="buttons"?{component_type:"buttons",component_id:It,data:{title:Me.title,buttons:Array.isArray(Ht)?Ht:[]}}:et==="confirmation"?{component_type:"confirmation",component_id:It,data:{title:Me.title||"Confirmed",message:Me.message||"",icon:Me.icon||"success",details:Me.details}}:Me.component_type&&Me.component_id?Me:null},[]),Gn=G.useCallback(async et=>{try{const Me=JSON.parse(et.payload);console.log("[RPC] Received send_dynamic_data:",Me);const It=Me.componant_type||Me.component_type;if(!It)return console.warn("[RPC] No componant_type in payload"),JSON.stringify({status:"error",message:"No componant_type provided"});const Ht=It.replace("render_component_","");console.log(`[RPC] Routing to component: ${Ht}`);const Sn=Jn(Ht,Me);return Sn?(Xn.current.set(Sn.component_id,{name:Ht,originalConfig:Me.componant_config||Me.component_config}),ct(Sn),JSON.stringify({status:"received",component_id:Sn.component_id})):(console.warn(`[RPC] Unknown component type: ${Ht}`),JSON.stringify({status:"error",message:`Unknown component type: ${Ht}`}))}catch(Me){throw console.error("[RPC] Failed to parse send_dynamic_data payload:",Me),new Error("Invalid send_dynamic_data payload")}},[ct,Jn]);G.useEffect(()=>{_r.current=ct},[ct]);const In=G.useRef(Lt.open);return In.current=Lt.open,G.useEffect(()=>{},[]),G.useEffect(()=>{var Ht,Sn;if(!t||ke!=="audio")return;const et=new Map(Ct);me.audioTrack&&Oe.segments.forEach(jt=>{const Cn=et.get(jt.id),er=bw(jt,Cn,me.audioTrack.participant);et.set(jt.id,er),jt.text&&jt.text!==(Cn==null?void 0:Cn.message)&&(jt.final?console.log("%c[Agent Message Complete]","background: #22c55e; color: white; padding: 2px 6px; border-radius: 3px;",jt.text):console.log("%c[Agent Speaking...]","color: #22c55e;",jt.text))}),ut.segments.forEach(jt=>{const Cn=et.get(jt.id),er=bw(jt,Cn,Ve.localParticipant);et.set(jt.id,er),jt.text&&jt.text!==(Cn==null?void 0:Cn.message)&&(jt.final?console.log("%c[User Message Sent]","background: #3b82f6; color: white; padding: 2px 6px; border-radius: 3px;",jt.text):console.log("%c[User Speaking...]","color: #3b82f6;",jt.text))});const Me=Array.from(et.values()).sort((jt,Cn)=>jt.timestamp-Cn.timestamp),It=xt.current&&((Ht=Me[Me.length-1])==null?void 0:Ht.name.includes("Agent"))&&!((Sn=Me[Me.length-1])!=null&&Sn.sourceUrl)&&tn.current!==Me.length-1;if(It){tn.current=Me.length,Me[Me.length-1]={...Me[Me.length-1],sourceUrl:xt.current};const jt=Me.filter(er=>!er.isSelf).length-1,Cn=et.get(Oe.segments[jt].id);et.set(Oe.segments[jt].id,bw(Oe.segments[jt],{...Cn,sourceUrl:xt.current},me.audioTrack.participant))}H(Me),Rt(et),It||(xt.current="")},[ke,le,Oe.segments,ut.segments,me.audioTrack,Ve.localParticipant]),G.useEffect(()=>{if(!t||ke!=="text")return;const et=async(It,Ht)=>{var Sn,jt;try{const Cn=await It.readAll(),er=(Sn=Ht.identity)==null?void 0:Sn.includes("agent");console.log(`%c[Transcript - Text] ${er?"Agent":"User"}:`,`color: ${er?"#22c55e":"#3b82f6"}; font-weight: bold;`,Cn),er&&((jt=it.current)==null||jt.play().catch(()=>{}),Lt.open());const Er={message:Cn,isSelf:!er,name:er?"Agent":"You",timestamp:Date.now()+performance.now()%1,...er&&xt.current&&{sourceUrl:xt.current}};xt.current&&(xt.current=""),H(K=>{const Le=new Set;return[...K,Er].filter(Xe=>!Le.has(Xe.timestamp)&&Le.add(Xe.timestamp)).sort((Xe,ot)=>Xe.timestamp-ot.timestamp)})}catch(Cn){console.error("Error reading text stream",Cn)}},Me=le.map(It=>{var jt,Cn,er,Er;const Ht=((jt=It.from)==null?void 0:jt.identity)===Ve.localParticipant.identity,Sn=me.audioTrack?((Cn=It.from)==null?void 0:Cn.identity)===((er=me.audioTrack.participant)==null?void 0:er.identity):!Ht;return{name:((Er=It.from)==null?void 0:Er.name)||(Sn?"Agent":Ht?"You":"Unknown"),isSelf:Ht,message:It.message,timestamp:It.timestamp}});return H(It=>{const Ht=new Set;return[...It,...Me].filter(Sn=>!Ht.has(Sn.timestamp)&&Ht.add(Sn.timestamp)).sort((Sn,jt)=>Sn.timestamp-jt.timestamp)}),t.registerTextStreamHandler("lk.transcription",et),()=>{t.unregisterTextStreamHandler("lk.transcription")}},[t,ke,le,Lt,Ve.localParticipant,me.audioTrack]),G.useEffect(()=>{if(t)return console.log("[RPC] Registering handlers on room connect"),t.registerRpcMethod("send_source_urls",Dn),t.registerRpcMethod("render_component",Wn),t.registerRpcMethod("send_dynamic_data",Gn),console.log("[RPC] Registered: send_source_urls, render_component, send_dynamic_data"),()=>{t.unregisterRpcMethod("send_source_urls"),t.unregisterRpcMethod("render_component"),t.unregisterRpcMethod("send_dynamic_data")}},[t,Dn,Wn,Gn]),G.useEffect(()=>{if(t)return t.on(Ee.ParticipantDisconnected,Ft),t.on(Ee.Disconnected,Ft),()=>{t.off(Ee.ParticipantDisconnected,Ft),t.off(Ee.Disconnected,Ft)}},[Ft,t]),G.useEffect(()=>{if(ht.current&&(ht.current.scrollTop=ht.current.scrollHeight),Ce.length>0){const et=Ce.filter(Me=>Me.message&&!Me.componentType).map(Me=>`${Me.isSelf?"User":"Agent"}: ${Me.message}`).join(`
426
- `);console.groupCollapsed(`%c[Transcript Summary] ${Ce.filter(Me=>Me.message).length} messages`,"color: #8b5cf6; font-weight: bold;"),console.log(et),console.groupEnd()}},[Ce]),G.useEffect(()=>(it.current=new Audio(V),it.current.preload="auto",()=>{it.current&&(it.current.pause(),it.current.src="",it.current=null)}),[V]),W.jsxs(pW,{theme:I,children:[W.jsxs(sx,{children:[(!$||!Lt.isOpen)&&W.jsx(mu.button,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{type:"spring",stiffness:400,damping:25},"aria-label":"Open call widget",onClick:Lt.toggle,style:{position:X,...J,backgroundColor:N.primaryColor,color:N.primaryTextColor,...(Hi=v==null?void 0:v.modalTrigger)==null?void 0:Hi.styles},className:"ringg_ai-h-14 ringg_ai-w-14 !ringg_ai-rounded-full ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-shadow ringg_ai-trigger-btn !ringg_ai-z-[9999] hover:ringg_ai-opacity-90 ringg_ai-transition-opacity",children:W.jsx("img",{src:((ea=(Ji=v==null?void 0:v.modalTrigger)==null?void 0:Ji.icon)==null?void 0:ea.url)??"https://assets.ringg.ai/images/icons/widget-phone.svg",alt:"Widget trigger",style:{width:((es=(co=v==null?void 0:v.modalTrigger)==null?void 0:co.icon)==null?void 0:es.size)??25,height:((fo=(ts=v==null?void 0:v.modalTrigger)==null?void 0:ts.icon)==null?void 0:fo.size)??25}})},"trigger-button"),Lt.isOpen&&W.jsxs(mu.div,{ref:bt,initial:{y:"100%",opacity:0,x:oe==="bottom-center"?"-50%":0},animate:{y:0,opacity:1,x:oe==="bottom-center"?"-50%":0},exit:{y:"100%",opacity:0,x:oe==="bottom-center"?"-50%":0},transition:{type:"spring",stiffness:300,damping:28},className:xr("ringg_ai-relative ringg_ai-border ringg_ai-overflow-hidden ringg_ai-shadow-xl !ringg_ai-z-[9999] ringg_ai-w-[95vw] md:ringg_ai-w-[360px]",bn&&"ringg_ai-h-[24.5rem]"),style:{position:"fixed",bottom:"2%",...Fte(oe),...bn?xe:{},maxWidth:"96dvw",maxHeight:"96dvh",backgroundColor:N.backgroundColor,borderColor:N.borderColor,borderRadius:RS(E==null?void 0:E.borderRadius)??N.borderRadius,fontFamily:N.fontFamily,"--widget-primary":N.primaryColor,"--widget-primary-text":N.primaryTextColor,"--widget-bg":N.backgroundColor,"--widget-surface":N.surfaceColor,"--widget-text":N.textColor,"--widget-muted":N.mutedTextColor,"--widget-border":N.borderColor,"--widget-button-radius":ne},children:[bn&&W.jsx(Av,{size:"icon",variant:"ghost","aria-label":"Minimize widget",onClick:Lt.minimize,className:"ringg_ai-absolute !ringg_ai-z-[9999] ringg_ai-top-2.5 ringg_ai-right-12 !ringg_ai-rounded-full ringg_ai-text-gray-500 hover:ringg_ai-text-gray-700",children:W.jsx(iW,{size:20})}),W.jsx(Av,{size:"icon",variant:"ghost","aria-label":bn?"End call":"Close widget",onClick:()=>bn?He(!0):Lt.showFeedback?Be():Lt.minimize(),className:"ringg_ai-absolute !ringg_ai-z-[9999] ringg_ai-top-2.5 ringg_ai-right-2.5 !ringg_ai-rounded-full ringg_ai-text-gray-500 hover:ringg_ai-text-gray-700",children:W.jsx(lW,{size:20})}),W.jsx(UY,{open:ve,onOpenChange:He,containerRef:bt,children:W.jsxs(FY,{children:[W.jsxs(jY,{children:[W.jsxs(VY,{children:["Are you sure you want to end ",ke==="text"?"chat":"call","?"]}),W.jsx(zY,{children:"Your current conversation will be closed and cannot be accessed later."})]}),W.jsxs(BY,{children:[W.jsx(Av,{variant:"outline",onClick:()=>He(!1),style:{borderRadius:ne,borderColor:N.borderColor,backgroundColor:N.surfaceColor,color:N.textColor},children:"Cancel"}),W.jsxs(Av,{onClick:Ft,style:{borderRadius:ne,backgroundColor:N.primaryColor,color:N.primaryTextColor},children:["End ",ke==="text"?"Chat":"Call"]})]})]})}),Lt.showFeedback?W.jsx($Y,{callMode:ke,isSubmitting:Je,feedbackScreenConfig:U,onSubmit:Kt,onSkip:Be}):W.jsxs("div",{className:"ringg_ai-flex ringg_ai-h-full ringg_ai-flex-col",children:[W.jsxs("div",{className:xr("ringg_ai-relative ringg_ai-p-5 ringg_ai-h-full ringg_ai-mb-2 ringg_ai-flex ringg_ai-gap-5 ringg_ai-flex-col",!bn&&"ringg_ai-mt-2"),children:[W.jsx(qY,{isCalling:bn,isLoading:Je,title:l,description:c,logoUrl:R,logoStyles:M}),Ce.length===0&&bn&&W.jsx("div",{className:"ringg_ai-mt-20 ringg_ai-h-full"}),Ce.length>0&&bn&&W.jsx("div",{"data-scrollable":"true",ref:ht,className:"ringg_ai-mt-20 ringg_ai-h-full ringg_ai-overflow-y-auto ringg_ai-flex ringg_ai-flex-col",children:W.jsx("div",{className:"ringg_ai-mt-auto md:ringg_ai-mt-0 ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-2.5",children:Ce.sort((et,Me)=>et.timestamp-Me.timestamp).map((et,Me)=>et.componentType&&et.componentData?W.jsx(nK,{initialComponent:et.componentData,onApiCall:un,onComplete:()=>At(et.componentData.component_id),onSendResponse:ln},`flow_${et.componentData.component_id}_${Me}`):W.jsx(Dte,{itemIndex:Me,message:et},`${et.timestamp}__${Me}`))})}),W.jsx(IY,{buttonConfig:v,callMode:ke,isCalling:bn,onCallEnd:Ft}),z.hasError&&W.jsx("div",{className:"ringg_ai-text-center ringg_ai-text-sm ringg_ai-text-red-500 -ringg_ai-mt-3 -ringg_ai-mb-2",children:z.message}),Nr==="disconnected"&&W.jsx(GW,{callMode:ke,buttonConfig:v,isCalling:bn,isLoading:Je,onCallTrigger:vt}),!bn&&W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-text-center",style:{color:N.mutedTextColor},children:A?Vte(A.text,A.links):W.jsxs(W.Fragment,{children:["By starting call you agree to ",W.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"hover:ringg_ai-underline",style:{color:N.primaryColor},href:"https://www.ringg.ai/privacy",children:"Privacy policy"})," & ",W.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"hover:ringg_ai-underline",style:{color:N.primaryColor},href:"https://www.ringg.ai/terms",children:"T&C"})]})})]}),!bn&&!T&&W.jsx(Ate,{tabs:XG,activeTab:ke,onTabChange:et=>Ge(et)})]})]},"chat-widget")]}),W.jsx(vB,{}),!1]})},Bte="1.0.20-alpha.44",Hte=({config:t})=>{const[e]=G.useState(()=>new Gh({dynacast:!0,adaptiveStream:!0}));return G.useEffect(()=>{console.log(`%c[Ringg CDN] v${Bte} initialized`,"background: #7c3aed; color: white; padding: 2px 8px; border-radius: 4px;"),console.log("[Ringg CDN] Config:",t)},[t]),W.jsx(XT.Provider,{value:e,children:W.jsx(zte,{config:t,room:e})})};{const t="ringg_ai_container";(function(e,n){function r(a){console.log("%c[Ringg CDN] loadAgent called","background: #22c55e; color: white; padding: 2px 8px; border-radius: 4px;",a);let s=n.getElementById(t);s||(s=n.createElement("div"),s.id=t,n.body.appendChild(s)),yg.createRoot(s).render(W.jsx(ir.StrictMode,{children:W.jsx(Hte,{config:a})}))}e.loadAgent=r})(window,document)}});
425
+ `))}function h(T,E,R,M){const A=R.enter("tableCell"),U=R.enter("phrasing"),V=R.containerPhrasing(T,{...M,before:s,after:s});return U(),A(),V}function p(T,E){return ree(T,{align:E,alignDelimiters:r,padding:n,stringLength:a})}function v(T,E,R){const M=T.children;let A=-1;const U=[],V=E.enter("table");for(;++A<M.length;)U[A]=b(M[A],E,R);return V(),U}function b(T,E,R){const M=T.children;let A=-1;const U=[],V=E.enter("tableRow");for(;++A<M.length;)U[A]=h(M[A],T,E,R);return V(),U}function k(T,E,R){let M=K5.inlineCode(T,E,R);return R.stack.includes("tableCell")&&(M=M.replace(/\|/g,"\\$&")),M}}function $ee(){return{exit:{taskListCheckValueChecked:Q5,taskListCheckValueUnchecked:Q5,paragraph:Wee}}}function qee(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Gee}}}function Q5(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function Wee(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=e.children;let s=-1,l;for(;++s<a.length;){const c=a[s];if(c.type==="paragraph"){l=c;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function Gee(t,e,n,r){const a=t.children[0],s=typeof t.checked=="boolean"&&a&&a.type==="paragraph",l="["+(t.checked?"x":" ")+"] ",c=n.createTracker(r);s&&c.move(l);let h=K5.listItem(t,e,n,{...r,...c.current()});return s&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),h;function p(v){return v+l}}function Yee(){return[wJ(),UJ(),QJ(),Uee(),$ee()]}function Kee(t){return{extensions:[_J(),FJ(),XJ(),Hee(t),qee()]}}const Zee={tokenize:nte,partial:!0},X5={tokenize:rte,partial:!0},J5={tokenize:ite,partial:!0},eU={tokenize:ate,partial:!0},Qee={tokenize:ote,partial:!0},tU={name:"wwwAutolink",tokenize:ete,previous:rU},nU={name:"protocolAutolink",tokenize:tte,previous:iU},Cu={name:"emailAutolink",tokenize:Jee,previous:aU},kl={};function Xee(){return{text:kl}}let mf=48;for(;mf<123;)kl[mf]=Cu,mf++,mf===58?mf=65:mf===91&&(mf=97);kl[43]=Cu,kl[45]=Cu,kl[46]=Cu,kl[95]=Cu,kl[72]=[Cu,nU],kl[104]=[Cu,nU],kl[87]=[Cu,tU],kl[119]=[Cu,tU];function Jee(t,e,n){const r=this;let a,s;return l;function l(b){return!__(b)||!aU.call(r,r.previous)||E_(r.events)?n(b):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),c(b))}function c(b){return __(b)?(t.consume(b),c):b===64?(t.consume(b),h):n(b)}function h(b){return b===46?t.check(Qee,v,p)(b):b===45||b===95||Sa(b)?(s=!0,t.consume(b),h):v(b)}function p(b){return t.consume(b),a=!0,h}function v(b){return s&&a&&za(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(b)):n(b)}}function ete(t,e,n){const r=this;return a;function a(l){return l!==87&&l!==119||!rU.call(r,r.previous)||E_(r.events)?n(l):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Zee,t.attempt(X5,t.attempt(J5,s),n),n)(l))}function s(l){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(l)}}function tte(t,e,n){const r=this;let a="",s=!1;return l;function l(b){return(b===72||b===104)&&iU.call(r,r.previous)&&!E_(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),a+=String.fromCodePoint(b),t.consume(b),c):n(b)}function c(b){if(za(b)&&a.length<5)return a+=String.fromCodePoint(b),t.consume(b),c;if(b===58){const k=a.toLowerCase();if(k==="http"||k==="https")return t.consume(b),h}return n(b)}function h(b){return b===47?(t.consume(b),s?p:(s=!0,h)):n(b)}function p(b){return b===null||fS(b)||Sr(b)||pf(b)||hS(b)?n(b):t.attempt(X5,t.attempt(J5,v),n)(b)}function v(b){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(b)}}function nte(t,e,n){let r=0;return a;function a(l){return(l===87||l===119)&&r<3?(r++,t.consume(l),a):l===46&&r===3?(t.consume(l),s):n(l)}function s(l){return l===null?n(l):e(l)}}function rte(t,e,n){let r,a,s;return l;function l(p){return p===46||p===95?t.check(eU,h,c)(p):p===null||Sr(p)||pf(p)||p!==45&&hS(p)?h(p):(s=!0,t.consume(p),l)}function c(p){return p===95?r=!0:(a=r,r=void 0),t.consume(p),l}function h(p){return a||r||!s?n(p):e(p)}}function ite(t,e){let n=0,r=0;return a;function a(l){return l===40?(n++,t.consume(l),a):l===41&&r<n?s(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?t.check(eU,e,s)(l):l===null||Sr(l)||pf(l)?e(l):(t.consume(l),a)}function s(l){return l===41&&r++,t.consume(l),a}}function ate(t,e,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(t.consume(c),r):c===38?(t.consume(c),s):c===93?(t.consume(c),a):c===60||c===null||Sr(c)||pf(c)?e(c):n(c)}function a(c){return c===null||c===40||c===91||Sr(c)||pf(c)?e(c):r(c)}function s(c){return za(c)?l(c):n(c)}function l(c){return c===59?(t.consume(c),r):za(c)?(t.consume(c),l):n(c)}}function ote(t,e,n){return r;function r(s){return t.consume(s),a}function a(s){return Sa(s)?n(s):e(s)}}function rU(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Sr(t)}function iU(t){return!za(t)}function aU(t){return!(t===47||__(t))}function __(t){return t===43||t===45||t===46||t===95||Sa(t)}function E_(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ste={tokenize:mte,partial:!0};function lte(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:fte,continuation:{tokenize:hte},exit:pte}},text:{91:{name:"gfmFootnoteCall",tokenize:dte},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ute,resolveTo:cte}}}}function ute(t,e,n){const r=this;let a=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;a--;){const h=r.events[a][1];if(h.type==="labelImage"){l=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return c;function c(h){if(!l||!l._balanced)return n(h);const p=Ns(r.sliceSerialize({start:l.end,end:r.now()}));return p.codePointAt(0)!==94||!s.includes(p.slice(1))?n(h):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),e(h))}}function cte(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},t[t.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},c=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",a,e],["exit",a,e],["enter",s,e],["enter",l,e],["exit",l,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...c),t}function dte(t,e,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,l;return c;function c(b){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(b),t.exit("gfmFootnoteCallLabelMarker"),h}function h(b){return b!==94?n(b):(t.enter("gfmFootnoteCallMarker"),t.consume(b),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",p)}function p(b){if(s>999||b===93&&!l||b===null||b===91||Sr(b))return n(b);if(b===93){t.exit("chunkString");const k=t.exit("gfmFootnoteCallString");return a.includes(Ns(r.sliceSerialize(k)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(b),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(b)}return Sr(b)||(l=!0),s++,t.consume(b),b===92?v:p}function v(b){return b===91||b===92||b===93?(t.consume(b),s++,p):p(b)}}function fte(t,e,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,l=0,c;return h;function h(E){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(E){return E===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",v):n(E)}function v(E){if(l>999||E===93&&!c||E===null||E===91||Sr(E))return n(E);if(E===93){t.exit("chunkString");const R=t.exit("gfmFootnoteDefinitionLabelString");return s=Ns(r.sliceSerialize(R)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(E),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),k}return Sr(E)||(c=!0),l++,t.consume(E),E===92?b:v}function b(E){return E===91||E===92||E===93?(t.consume(E),l++,v):v(E)}function k(E){return E===58?(t.enter("definitionMarker"),t.consume(E),t.exit("definitionMarker"),a.includes(s)||a.push(s),Vn(t,T,"gfmFootnoteDefinitionWhitespace")):n(E)}function T(E){return e(E)}}function hte(t,e,n){return t.check(wv,e,t.attempt(ste,e,n))}function pte(t){t.exit("gfmFootnoteDefinition")}function mte(t,e,n){const r=this;return Vn(t,a,"gfmFootnoteDefinitionIndent",5);function a(s){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(s):n(s)}}function gte(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(l,c){let h=-1;for(;++h<l.length;)if(l[h][0]==="enter"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._close){let p=h;for(;p--;)if(l[p][0]==="exit"&&l[p][1].type==="strikethroughSequenceTemporary"&&l[p][1]._open&&l[h][1].end.offset-l[h][1].start.offset===l[p][1].end.offset-l[p][1].start.offset){l[h][1].type="strikethroughSequence",l[p][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},l[p][1].start),end:Object.assign({},l[h][1].end)},b={type:"strikethroughText",start:Object.assign({},l[p][1].end),end:Object.assign({},l[h][1].start)},k=[["enter",v,c],["enter",l[p][1],c],["exit",l[p][1],c],["enter",b,c]],T=c.parser.constructs.insideSpan.null;T&&Mo(k,k.length,0,pS(T,l.slice(p+1,h),c)),Mo(k,k.length,0,[["exit",b,c],["enter",l[h][1],c],["exit",l[h][1],c],["exit",v,c]]),Mo(l,p-1,h-p+3,k),h=p+k.length-2;break}}for(h=-1;++h<l.length;)l[h][1].type==="strikethroughSequenceTemporary"&&(l[h][1].type="data");return l}function s(l,c,h){const p=this.previous,v=this.events;let b=0;return k;function k(E){return p===126&&v[v.length-1][1].type!=="characterEscape"?h(E):(l.enter("strikethroughSequenceTemporary"),T(E))}function T(E){const R=Cp(p);if(E===126)return b>1?h(E):(l.consume(E),b++,T);if(b<2&&!n)return h(E);const M=l.exit("strikethroughSequenceTemporary"),A=Cp(E);return M._open=!A||A===2&&!!R,M._close=!R||R===2&&!!A,c(E)}}}class vte{constructor(){this.map=[]}add(e,n,r){yte(this,e,n,r)}consume(e){if(this.map.sort(function(s,l){return s[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push([...e]),e.length=0;let a=r.pop();for(;a;)e.push(...a),a=r.pop();this.map.length=0}}function yte(t,e,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<t.map.length;){if(t.map[a][0]===e){t.map[a][1]+=n,t.map[a][2].push(...r);return}a+=1}t.map.push([e,n,r])}}function bte(t,e){let n=!1;const r=[];for(;e<t.length;){const a=t[e];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function Ste(){return{flow:{null:{name:"table",tokenize:Cte,resolveAll:kte}}}}function Cte(t,e,n){const r=this;let a=0,s=0,l;return c;function c($){let oe=r.events.length-1;for(;oe>-1;){const ke=r.events[oe][1].type;if(ke==="lineEnding"||ke==="linePrefix")oe--;else break}const J=oe>-1?r.events[oe][1].type:null,xe=J==="tableHead"||J==="tableRow"?N:h;return xe===N&&r.parser.lazy[r.now().line]?n($):xe($)}function h($){return t.enter("tableHead"),t.enter("tableRow"),p($)}function p($){return $===124||(l=!0,s+=1),v($)}function v($){return $===null?n($):Bt($)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume($),t.exit("lineEnding"),T):n($):Pn($)?Vn(t,v,"whitespace")($):(s+=1,l&&(l=!1,a+=1),$===124?(t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),l=!0,v):(t.enter("data"),b($)))}function b($){return $===null||$===124||Sr($)?(t.exit("data"),v($)):(t.consume($),$===92?k:b)}function k($){return $===92||$===124?(t.consume($),b):b($)}function T($){return r.interrupt=!1,r.parser.lazy[r.now().line]?n($):(t.enter("tableDelimiterRow"),l=!1,Pn($)?Vn(t,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):E($))}function E($){return $===45||$===58?M($):$===124?(l=!0,t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),R):I($)}function R($){return Pn($)?Vn(t,M,"whitespace")($):M($)}function M($){return $===58?(s+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume($),t.exit("tableDelimiterMarker"),A):$===45?(s+=1,A($)):$===null||Bt($)?j($):I($)}function A($){return $===45?(t.enter("tableDelimiterFiller"),U($)):I($)}function U($){return $===45?(t.consume($),U):$===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume($),t.exit("tableDelimiterMarker"),V):(t.exit("tableDelimiterFiller"),V($))}function V($){return Pn($)?Vn(t,j,"whitespace")($):j($)}function j($){return $===124?E($):$===null||Bt($)?!l||a!==s?I($):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e($)):I($)}function I($){return n($)}function N($){return t.enter("tableRow"),ne($)}function ne($){return $===124?(t.enter("tableCellDivider"),t.consume($),t.exit("tableCellDivider"),ne):$===null||Bt($)?(t.exit("tableRow"),e($)):Pn($)?Vn(t,ne,"whitespace")($):(t.enter("data"),X($))}function X($){return $===null||$===124||Sr($)?(t.exit("data"),ne($)):(t.consume($),$===92?se:X)}function se($){return $===92||$===124?(t.consume($),X):X($)}}function kte(t,e){let n=-1,r=!0,a=0,s=[0,0,0,0],l=[0,0,0,0],c=!1,h=0,p,v,b;const k=new vte;for(;++n<t.length;){const T=t[n],E=T[1];T[0]==="enter"?E.type==="tableHead"?(c=!1,h!==0&&(oU(k,e,h,p,v),v=void 0,h=0),p={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},k.add(n,0,[["enter",p,e]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(r=!0,b=void 0,s=[0,0,0,0],l=[0,n+1,0,0],c&&(c=!1,v={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},k.add(n,0,[["enter",v,e]])),a=E.type==="tableDelimiterRow"?2:v?3:1):a&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(s[1]!==0&&(l[0]=l[1],b=ES(k,e,s,a,void 0,b),s=[0,0,0,0]),l[2]=n)):E.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(l[0]=l[1],b=ES(k,e,s,a,void 0,b)),s=l,l=[s[1],n,0,0])):E.type==="tableHead"?(c=!0,h=n):E.type==="tableRow"||E.type==="tableDelimiterRow"?(h=n,s[1]!==0?(l[0]=l[1],b=ES(k,e,s,a,n,b)):l[1]!==0&&(b=ES(k,e,l,a,n,b)),a=0):a&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(l[3]=n)}for(h!==0&&oU(k,e,h,p,v),k.consume(e.events),n=-1;++n<e.events.length;){const T=e.events[n];T[0]==="enter"&&T[1].type==="table"&&(T[1]._align=bte(e.events,n))}return t}function ES(t,e,n,r,a,s){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(s.end=Object.assign({},Tp(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const h=Tp(e.events,n[1]);if(s={type:l,start:Object.assign({},h),end:Object.assign({},h)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const p=Tp(e.events,n[2]),v=Tp(e.events,n[3]),b={type:c,start:Object.assign({},p),end:Object.assign({},v)};if(t.add(n[2],0,[["enter",b,e]]),r!==2){const k=e.events[n[2]],T=e.events[n[3]];if(k[1].end=Object.assign({},T[1].end),k[1].type="chunkText",k[1].contentType="text",n[3]>n[2]+1){const E=n[2]+1,R=n[3]-n[2]-1;t.add(E,R,[])}}t.add(n[3]+1,0,[["exit",b,e]])}return a!==void 0&&(s.end=Object.assign({},Tp(e.events,a)),t.add(a,0,[["exit",s,e]]),s=void 0),s}function oU(t,e,n,r,a){const s=[],l=Tp(e.events,n);a&&(a.end=Object.assign({},l),s.push(["exit",a,e])),r.end=Object.assign({},l),s.push(["exit",r,e]),t.add(n+1,0,s)}function Tp(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const Tte={name:"tasklistCheck",tokenize:wte};function xte(){return{text:{91:Tte}}}function wte(t,e,n){const r=this;return a;function a(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),s)}function s(h){return Sr(h)?(t.enter("taskListCheckValueUnchecked"),t.consume(h),t.exit("taskListCheckValueUnchecked"),l):h===88||h===120?(t.enter("taskListCheckValueChecked"),t.consume(h),t.exit("taskListCheckValueChecked"),l):n(h)}function l(h){return h===93?(t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(h)}function c(h){return Bt(h)?e(h):Pn(h)?t.check({tokenize:_te},e,n)(h):n(h)}}function _te(t,e,n){return Vn(t,r,"whitespace");function r(a){return a===null?n(a):e(a)}}function Ete(t){return I4([Xee(),lte(),gte(t),Ste(),xte()])}const Rte={};function Pte(t){const e=this,n=t||Rte,r=e.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(Ete(n)),s.push(Yee()),l.push(Kee(n))}const Dte=({itemIndex:t,message:e})=>{const n=Zo(),r=WW(e.name),a=r?n.textColor:n.primaryTextColor;return W.jsx("div",{className:xr("ringg_ai-flex ringg_ai-flex-col ringg_ai-items-start ringg_ai-gap-1 ringg_ai-justify-start",r?"ringg_ai-flex-row":"ringg_ai-flex-row-reverse"),children:W.jsx("div",{className:xr("ringg_ai-flex ringg_ai-items-center ringg_ai-justify-start ringg_ai-gap-2 ringg_ai-px-4 ringg_ai-py-2 ringg_ai-rounded-xl ringg_ai-max-w-[90%]",r?"ringg_ai-mr-auto ringg_ai-text-left ringg_ai-rounded-bl-none":"ringg_ai-ml-auto ringg_ai-text-right ringg_ai-rounded-br-none"),style:{backgroundColor:r?n.surfaceColor:n.primaryColor,color:a},children:W.jsxs("div",{className:"ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-2.5 ringg_ai-w-full ringg_ai-overflow-x-auto",children:[W.jsx("div",{className:"ringg_ai-prose ringg_ai-prose-sm ringg_ai-max-w-none [&_p]:ringg_ai-text-sm [&_li]:ringg_ai-text-sm [&_table]:ringg_ai-w-max",style:{"--tw-prose-body":a,"--tw-prose-headings":a,"--tw-prose-bold":a,"--tw-prose-counters":a,"--tw-prose-bullets":a,"--tw-prose-quotes":a,"--tw-prose-code":a,"--tw-prose-th-borders":n.borderColor,"--tw-prose-td-borders":n.borderColor,color:a},children:W.jsx(mJ,{remarkPlugins:[Pte],children:e.message})}),(e==null?void 0:e.sourceUrl)&&W.jsxs("a",{href:e.sourceUrl,target:"_blank",rel:"noopener noreferrer",className:"ringg_ai-text-sm ringg_ai-break-all ringg_ai-w-fit ringg_ai-hover:underline",style:{color:r?n.primaryColor:n.primaryTextColor},children:["Source: ",e.sourceUrl]})]})},`${e.name}__${t}`)},`${e.timestamp}__${t}`)};function Ate({tabs:t=[],activeTab:e="voice-call",onTabChange:n}){const r=Zo(),[a,s]=G.useState(e),l=c=>{s(c),n==null||n(c)};return W.jsx("div",{className:"ringg_ai-w-full ringg_ai-border-t",style:{backgroundColor:r.backgroundColor,borderColor:r.borderColor},children:W.jsx("div",{className:"ringg_ai-flex ringg_ai-items-center ringg_ai-px-0",children:t.map(c=>{const h=c.icon,p=a===c.id,v=p?r.primaryColor:r.mutedTextColor;return W.jsxs("button",{onClick:()=>l(c.id),className:xr("ringg_ai-flex ringg_ai-flex-col ringg_ai-items-center ringg_ai-gap-1 ringg_ai-border-t-2 ringg_ai-py-3 ringg_ai-transition-all ringg_ai-duration-200 ringg_ai-flex-1"),style:{borderTopColor:p?r.primaryColor:"transparent"},children:[W.jsx(h,{className:"ringg_ai-w-5 ringg_ai-h-5 ringg_ai-transition-colors",fill:v,style:{color:v}}),W.jsx("span",{className:"ringg_ai-text-xs ringg_ai-font-medium ringg_ai-transition-colors",style:{color:v},children:c.label})]},c.id)})})})}const Ote=Y3("ringg_ai-inline-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-gap-2 ringg_ai-whitespace-nowrap ringg_ai-rounded-md ringg_ai-text-sm ringg_ai-font-medium ringg_ai-ring-offset-background ringg_ai-transition-colors focus-visible:ringg_ai-outline-none focus-visible:ringg_ai-ring-2 focus-visible:ringg_ai-ring-ring focus-visible:ringg_ai-ring-offset-2 disabled:ringg_ai-pointer-events-none disabled:ringg_ai-opacity-50 [&_svg]:ringg_ai-pointer-events-none [&_svg]:ringg_ai-size-4 [&_svg]:ringg_ai-shrink-0",{variants:{variant:{default:"ringg_ai-bg-primary ringg_ai-text-primary-foreground ringg_ai-shadow hover:ringg_ai-bg-primary/90",destructive:"ringg_ai-bg-destructive ringg_ai-text-destructive-foreground ringg_ai-shadow-sm hover:ringg_ai-bg-destructive/90",outline:"ringg_ai-border ringg_ai-border-input ringg_ai-bg-background ringg_ai-shadow-sm hover:ringg_ai-bg-accent hover:ringg_ai-text-accent-foreground",secondary:"ringg_ai-bg-secondary ringg_ai-text-secondary-foreground ringg_ai-shadow-sm hover:ringg_ai-bg-secondary/80",ghost:"hover:ringg_ai-bg-accent hover:ringg_ai-text-accent-foreground",link:"ringg_ai-text-primary ringg_ai-underline-offset-4 hover:ringg_ai-underline"},size:{default:"ringg_ai-h-9 ringg_ai-px-4 ringg_ai-py-2",sm:"ringg_ai-h-8 ringg_ai-rounded-md ringg_ai-px-3 ringg_ai-text-xs",lg:"ringg_ai-h-10 ringg_ai-rounded-md ringg_ai-px-8",icon:"ringg_ai-h-9 ringg_ai-w-9"}},defaultVariants:{variant:"default",size:"default"}}),Av=G.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...a},s)=>{const l=r?uS:"button";return W.jsx(l,{className:xr(Ote({variant:e,size:n,className:t})),ref:s,...a})});Av.displayName="Button";function Bc(t,e){typeof window<"u"&&window.dispatchEvent(new CustomEvent(t,{detail:e}))}function Mte({callMode:t}){const[e,n]=G.useState(!1),[r,a]=G.useState(!1),[s,l]=G.useState(null),c=G.useRef(!1),h=G.useRef(t);h.current=t;const p=G.useCallback(()=>{c.current||(c.current=!0,n(!0),Bc("ringg:widget_status",{status:"maximised",mode:h.current}))},[]),v=G.useCallback(()=>{c.current=!1,n(!1),Bc("ringg:widget_status",{status:"minimised",mode:h.current})},[]),b=G.useCallback(()=>{a(!1),l(null),v()},[v]),k=G.useCallback(()=>{c.current?v():p()},[p,v]);return G.useMemo(()=>({isOpen:e,showFeedback:r,currentCallId:s,setShowFeedback:a,setCurrentCallId:l,open:p,minimize:v,close:b,toggle:k}),[e,r,s,p,v,b,k])}function Lte({room:t,onError:e}){const[n,r]=G.useState("unknown"),a=G.useRef(e);a.current=e;const s=G.useCallback(async()=>{var h;try{if((h=navigator.permissions)!=null&&h.query){const p=await navigator.permissions.query({name:"microphone"});r(p.state),p.onchange=()=>{r(p.state)}}else try{await navigator.mediaDevices.getUserMedia({audio:!0}),r("granted")}catch{r("denied")}}catch(p){console.error("Error checking microphone permission:",p),r("unknown")}},[]),l=G.useCallback(async()=>{var h;try{const p=await navigator.mediaDevices.getUserMedia({audio:!0});return r("granted"),p.getTracks().forEach(v=>v.stop()),!0}catch(p){return console.error("Error requesting microphone permission:",p),r("denied"),(h=a.current)==null||h.call(a,"Microphone access was denied. Please enable it in your browser settings."),!1}},[]);G.useEffect(()=>{s();const h=()=>{var p;(p=a.current)==null||p.call(a,"Error acquiring microphone permission. Please make sure you grant the necessary permissions in your browser and reload the tab"),r("denied")};return t.on(Ee.MediaDevicesError,h),()=>{t.off(Ee.MediaDevicesError,h)}},[t,s]);const c=n==="granted";return G.useMemo(()=>({state:n,isGranted:c,check:s,request:l}),[n,c,s,l])}function Nte({containerRef:t,enabled:e}){G.useEffect(()=>{const n=t.current;if(!n||!e)return;const r=c=>{const h=n.querySelector('[data-scrollable="true"]');if(!h){c.preventDefault();return}const{scrollTop:p,scrollHeight:v,clientHeight:b}=h,k=p===0&&c.deltaY<0,T=p+b>=v-1&&c.deltaY>0;(k||T)&&c.preventDefault()};let a=0;const s=c=>{a=c.touches[0].clientY},l=c=>{const h=n.querySelector('[data-scrollable="true"]'),p=c.touches[0].clientY,v=a-p;if(!h){c.preventDefault();return}const{scrollTop:b,scrollHeight:k,clientHeight:T}=h,E=b===0&&v<0,R=b+T>=k-1&&v>0;(E||R)&&c.preventDefault()};return n.addEventListener("wheel",r,{passive:!1}),n.addEventListener("touchstart",s,{passive:!0}),n.addEventListener("touchmove",l,{passive:!1}),()=>{n.removeEventListener("wheel",r),n.removeEventListener("touchstart",s),n.removeEventListener("touchmove",l)}},[e])}const xp={mode:"prod",title:"Ringg AI Support",description:"Ringg AI offers 24/7 voice support to handle your business calls efficiently and professionally",defaultTab:"audio",hideTabSelector:!1,notificationTuneUrl:"https://assets.ringg.ai/audios/misc/widget_notification.mp3"};function R_(t){switch(t){case"dev":return"https://calling-dev.ringg.ai/ca/api/v0";case"stage":return"https://stage-api2.desivocal.com/ca/api/v0";default:return"https://prod-api.ringg.ai/ca/api/v0"}}function Ite(t){switch(t){case"dev":return"wss://ringg-ai-dev-92tubwpz.livekit.cloud";case"stage":return"wss://ringg-ai-ujrjmhgy.livekit.cloud";default:return"wss://ringg-ai-prod-r0vhjzhs.livekit.cloud"}}function Jse(t){return t}const sU={center:{top:0,left:0,right:0,bottom:0,margin:"auto"},"top-left":{top:"2%",left:"2%"},"top-right":{top:"2%",right:"2%"},"bottom-left":{bottom:"2%",left:"2%"},"bottom-right":{bottom:"2%",right:"2%"},"bottom-center":{bottom:"2%",left:"50%"}};function Ute(t){return sU[t]??sU["bottom-right"]}function Fte(t){return t==="bottom-center"?{left:"50%"}:t==="bottom-left"?{left:"2%"}:{right:"2%"}}function RS(t){if(t!==void 0)return typeof t=="number"?`${t}px`:t}function jte(t){return t?{width:RS(t.width),height:RS(t.height),borderRadius:RS(t.borderRadius)}:{}}function Vte(t,e){if(!e)return t;let n=[t];return Object.entries(e).forEach(([r,a])=>{n=n.flatMap((s,l)=>{if(typeof s!="string")return s;const c=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=new RegExp(`\\b(${c})\\b`,"g");return s.split(h).map((p,v)=>p===r?W.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"ringg_ai-text-blue-500 hover:ringg_ai-underline",href:a,children:r},`${l}-${v}`):p)})}),n}const zte=({room:t,config:e})=>{var Hi,Ji,ea,co,es,ts,fo;const[n,r]=G.useState({}),a=e,{mode:s=xp.mode,title:l=xp.title,description:c=xp.description,agentId:h,variables:p,buttons:v,xApiKey:b="",defaultTab:k=xp.defaultTab,hideTabSelector:T=xp.hideTabSelector,innerWindowProps:E,logoUrl:R,logoStyles:M,legalDisclaimer:A,feedbackScreen:U,notificationTuneUrl:V=xp.notificationTuneUrl,widgetPosition:j,theme:I}=a,N=WI(I),ne=mw(N.buttonStyle),X=(j==null?void 0:j.triggerPlacement)??"fixed",se=(j==null?void 0:j.triggerAlignment)??"bottom-right",$=(j==null?void 0:j.hideTriggerOnExpand)??!0,oe=(j==null?void 0:j.widgetAlignment)??"bottom-right",J=Ute(se),xe=jte(E),[ke,Ge]=G.useState(k),[Je,je]=G.useState(!1),[ve,He]=G.useState(!1),[z,ee]=G.useState({hasError:!1,message:""}),[Ce,H]=G.useState([]),[Ct,Rt]=G.useState(new Map),ht=G.useRef(null),bt=G.useRef(null),it=G.useRef(null),xt=G.useRef(""),tn=G.useRef(),qn=G.useRef(new Set),_r=G.useRef(null),vr=G.useRef(!1),Xn=G.useRef(new Map),Nr=ex(t),bn=Nr==="connected",Lt=Mte({callMode:ke}),Z=Lte({room:t,onError:et=>ee({hasError:!0,message:et})});Nte({containerRef:bt,enabled:Lt.isOpen});const{chatMessages:le}=$M(),me=hB(),Ve=aB(),ze=HM(),Oe=tx(me.audioTrack||void 0),ut=tx({publication:Ve.microphoneTrack,source:De.Source.Microphone,participant:Ve.localParticipant}),Nt=G.useMemo(()=>ze.find(et=>{var Me;return(Me=et.identity)==null?void 0:Me.includes("agent")}),[ze]),fe=G.useCallback((et,Me)=>{vr.current=!1,console.log("%c[Conversation Started]","background: #22c55e; color: white; padding: 2px 6px; border-radius: 3px;",{mode:et,callId:Me}),Bc("ringg:conversation_status",{status:"started",mode:et,callId:Me})},[]),Re=G.useCallback((et,Me)=>{vr.current||(vr.current=!0,console.log("%c[Conversation Ended]","background: #ef4444; color: white; padding: 2px 6px; border-radius: 3px;",{mode:et,callId:Me}),Bc("ringg:conversation_status",{status:"ended",mode:et,callId:Me}))},[]),vt=G.useCallback(async et=>{if(!(et==="audio"&&!Z.isGranted&&!await Z.request())){je(!0),Ge(et);try{const Me=await fetch(`${R_(s)}/calling/webcall`,{method:"POST",body:JSON.stringify({agent_id:h,custom_args_values:p,media_type:et}),headers:{"Content-Type":"application/json","X-API-KEY":b}}),It=await Me.json();if(!Me.ok)throw new Error((It==null?void 0:It.message)||"Failed to make call");It!=null&&It.call_id&&Lt.setCurrentCallId(It.call_id),await t.connect(Ite(s),It==null?void 0:It.user_token),et==="audio"&&await t.localParticipant.setMicrophoneEnabled(!0),fe(et,It.call_id),ee({hasError:!1,message:""})}catch(Me){ee({hasError:!0,message:Me.message})}finally{je(!1)}}},[t,s,h,p,b,Z,Lt,fe]),Ft=G.useCallback(async()=>{je(!0);try{Lt.currentCallId&&Re(ke,Lt.currentCallId),H([]),Rt(new Map),qn.current=new Set,xt.current="",tn.current=void 0,t.disconnect(),He(!1),Lt.setShowFeedback(!0),Lt.open()}catch(et){ee({hasError:!0,message:"Error ending call: "+et.message})}finally{je(!1)}},[t,ke,Lt,Re]),Kt=G.useCallback(async(et,Me)=>{if(!Lt.currentCallId){Lt.close();return}je(!0);try{await fetch(`${R_(s)}/calling/${Lt.currentCallId}/feedback`,{method:"POST",body:JSON.stringify({rating:et,comment:Me}),headers:{"Content-Type":"application/json","X-API-KEY":b}}),Bc("ringg:feedback_status",{status:"submitted",callId:Lt.currentCallId,rating:et})}catch(It){console.error("Error submitting feedback:",It)}finally{je(!1),Lt.close()}},[s,b,Lt]),Be=G.useCallback(()=>{Lt.currentCallId&&Bc("ringg:feedback_status",{status:"skipped",callId:Lt.currentCallId}),Lt.close()},[Lt]),ct=G.useCallback(et=>{var It;const Me={name:"Agent",message:"",isSelf:!1,timestamp:Date.now()+Math.random(),componentType:et.component_type,componentData:et};H(Ht=>[...Ht,Me]),Bc("ringg:calendar_booking",{status:"shown",componentId:et.component_id}),(It=it.current)==null||It.play().catch(()=>{}),Lt.open()},[Lt]),At=G.useCallback(et=>{qn.current.add(et),Bc("ringg:calendar_booking",{status:"confirmed",componentId:et,message:"Flow completed"})},[]),ln=G.useCallback(async(et,Me)=>{const It=Xn.current.get(et);if(!It){console.warn(`[RPC] No pending response found for component: ${et}`);return}if(!Nt){console.warn("[RPC] No agent participant found to send response to");return}const{name:Ht,originalConfig:Sn}=It,jt="receive_dynamic_data";let Cn;if(Ht==="calendar"){const Er=Me.step_data&&Me.step_data.slot_id;Cn=(Array.isArray(Sn)?Sn:[]).find(Xe=>Xe.id===Er)||{id:Er,datetime:Me.step_data&&Me.step_data.slot_datetime}}else if(Ht==="form")Cn=Me.step_data||Me.all_data;else if(Ht==="buttons"){const Er=Me.step_data&&Me.step_data.selected_button;Cn=(Array.isArray(Sn)?Sn:[]).find(Xe=>Xe.id===Er)||{id:Er}}else Cn=Me;const er=JSON.stringify({componant_type:`receive_component_${Ht}`,component_id:et,componant_data:Cn});try{console.log(`[RPC] Sending ${jt}:`,er);const Er=await Ve.localParticipant.performRpc({destinationIdentity:Nt.identity,method:jt,payload:er});console.log(`[RPC] Response from ${jt}:`,Er),Xn.current.delete(et)}catch(Er){console.error(`[RPC] Error sending ${jt}:`,Er)}},[Nt,Ve.localParticipant]),En=G.useMemo(()=>null,[]),un=G.useCallback(async(et,Me,It)=>(await fetch(Me.startsWith("http")?Me:`${R_(s)}${Me}`,{method:et,body:JSON.stringify(It),headers:{"Content-Type":"application/json","X-API-KEY":b}})).json(),[s,b,bn,En]),Dn=G.useCallback(async et=>{try{const Me=JSON.parse(et.payload);return Array.isArray(Me.source_urls)?xt.current=Me.source_urls.join(", "):Me.source_url&&(xt.current=Me.source_url),JSON.stringify({status:"received"})}catch(Me){throw console.error("Failed to parse RPC payload:",Me),new Error("Invalid payload for send_source_urls")}},[]),Wn=G.useCallback(async et=>{try{console.log("Received dynamic data:",et.payload);const Me=JSON.parse(et.payload);return Me.component_type&&Me.component_id&&ct(Me),JSON.stringify({status:"received"})}catch(Me){throw console.error("Failed to parse component payload:",Me),new Error("Invalid component payload")}},[ct]),Jn=G.useCallback((et,Me)=>{const It=`${et}_${Date.now()}`,Ht=Me.componant_config||Me.component_config;if(et==="calendar"){const Sn=Array.isArray(Ht)?Ht:[];return{component_type:"calendar_booking",component_id:It,data:{available_slots:Sn.map(jt=>({id:jt.id,datetime:jt.datetime})),timezone:Me.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone,title:Me.title||"Select a time slot"},actions:{on_select:{method:"POST",endpoint:"/mock/calendar",payload:{selected_slot_id:"{slot_id}"}}}}}return et==="form"?{component_type:"form",component_id:It,data:{title:Me.title||"Form",description:Me.description,fields:Array.isArray(Ht)?Ht:[],submit_label:Me.submit_label},actions:{on_submit:{method:"POST",endpoint:"/mock/form",payload:{form_data:"{form_data}"}}}}:et==="buttons"?{component_type:"buttons",component_id:It,data:{title:Me.title,buttons:Array.isArray(Ht)?Ht:[]}}:et==="confirmation"?{component_type:"confirmation",component_id:It,data:{title:Me.title||"Confirmed",message:Me.message||"",icon:Me.icon||"success",details:Me.details}}:Me.component_type&&Me.component_id?Me:null},[]),Gn=G.useCallback(async et=>{try{const Me=JSON.parse(et.payload);console.log("[RPC] Received send_dynamic_data:",Me);const It=Me.componant_type||Me.component_type;if(!It)return console.warn("[RPC] No componant_type in payload"),JSON.stringify({status:"error",message:"No componant_type provided"});const Ht=It.replace("render_component_","");console.log(`[RPC] Routing to component: ${Ht}`);const Sn=Jn(Ht,Me);return Sn?(Xn.current.set(Sn.component_id,{name:Ht,originalConfig:Me.componant_config||Me.component_config}),ct(Sn),JSON.stringify({status:"received",component_id:Sn.component_id})):(console.warn(`[RPC] Unknown component type: ${Ht}`),JSON.stringify({status:"error",message:`Unknown component type: ${Ht}`}))}catch(Me){throw console.error("[RPC] Failed to parse send_dynamic_data payload:",Me),new Error("Invalid send_dynamic_data payload")}},[ct,Jn]);G.useEffect(()=>{_r.current=ct},[ct]);const In=G.useRef(Lt.open);return In.current=Lt.open,G.useEffect(()=>{},[]),G.useEffect(()=>{var Ht,Sn;if(!t||ke!=="audio")return;const et=new Map(Ct);me.audioTrack&&Oe.segments.forEach(jt=>{const Cn=et.get(jt.id),er=bw(jt,Cn,me.audioTrack.participant);et.set(jt.id,er),jt.text&&jt.text!==(Cn==null?void 0:Cn.message)&&(jt.final?console.log("%c[Agent Message Complete]","background: #22c55e; color: white; padding: 2px 6px; border-radius: 3px;",jt.text):console.log("%c[Agent Speaking...]","color: #22c55e;",jt.text))}),ut.segments.forEach(jt=>{const Cn=et.get(jt.id),er=bw(jt,Cn,Ve.localParticipant);et.set(jt.id,er),jt.text&&jt.text!==(Cn==null?void 0:Cn.message)&&(jt.final?console.log("%c[User Message Sent]","background: #3b82f6; color: white; padding: 2px 6px; border-radius: 3px;",jt.text):console.log("%c[User Speaking...]","color: #3b82f6;",jt.text))});const Me=Array.from(et.values()).sort((jt,Cn)=>jt.timestamp-Cn.timestamp),It=xt.current&&((Ht=Me[Me.length-1])==null?void 0:Ht.name.includes("Agent"))&&!((Sn=Me[Me.length-1])!=null&&Sn.sourceUrl)&&tn.current!==Me.length-1;if(It){tn.current=Me.length,Me[Me.length-1]={...Me[Me.length-1],sourceUrl:xt.current};const jt=Me.filter(er=>!er.isSelf).length-1,Cn=et.get(Oe.segments[jt].id);et.set(Oe.segments[jt].id,bw(Oe.segments[jt],{...Cn,sourceUrl:xt.current},me.audioTrack.participant))}H(Me),Rt(et),It||(xt.current="")},[ke,le,Oe.segments,ut.segments,me.audioTrack,Ve.localParticipant]),G.useEffect(()=>{if(!t||ke!=="text")return;const et=async(It,Ht)=>{var Sn,jt;try{const Cn=await It.readAll(),er=(Sn=Ht.identity)==null?void 0:Sn.includes("agent");console.log(`%c[Transcript - Text] ${er?"Agent":"User"}:`,`color: ${er?"#22c55e":"#3b82f6"}; font-weight: bold;`,Cn),er&&((jt=it.current)==null||jt.play().catch(()=>{}),Lt.open());const Er={message:Cn,isSelf:!er,name:er?"Agent":"You",timestamp:Date.now()+performance.now()%1,...er&&xt.current&&{sourceUrl:xt.current}};xt.current&&(xt.current=""),H(K=>{const Le=new Set;return[...K,Er].filter(Xe=>!Le.has(Xe.timestamp)&&Le.add(Xe.timestamp)).sort((Xe,ot)=>Xe.timestamp-ot.timestamp)})}catch(Cn){console.error("Error reading text stream",Cn)}},Me=le.map(It=>{var jt,Cn,er,Er;const Ht=((jt=It.from)==null?void 0:jt.identity)===Ve.localParticipant.identity,Sn=me.audioTrack?((Cn=It.from)==null?void 0:Cn.identity)===((er=me.audioTrack.participant)==null?void 0:er.identity):!Ht;return{name:((Er=It.from)==null?void 0:Er.name)||(Sn?"Agent":Ht?"You":"Unknown"),isSelf:Ht,message:It.message,timestamp:It.timestamp}});return H(It=>{const Ht=new Set;return[...It,...Me].filter(Sn=>!Ht.has(Sn.timestamp)&&Ht.add(Sn.timestamp)).sort((Sn,jt)=>Sn.timestamp-jt.timestamp)}),t.registerTextStreamHandler("lk.transcription",et),()=>{t.unregisterTextStreamHandler("lk.transcription")}},[t,ke,le,Lt,Ve.localParticipant,me.audioTrack]),G.useEffect(()=>{if(t)return console.log("[RPC] Registering handlers on room connect"),t.registerRpcMethod("send_source_urls",Dn),t.registerRpcMethod("render_component",Wn),t.registerRpcMethod("send_dynamic_data",Gn),console.log("[RPC] Registered: send_source_urls, render_component, send_dynamic_data"),()=>{t.unregisterRpcMethod("send_source_urls"),t.unregisterRpcMethod("render_component"),t.unregisterRpcMethod("send_dynamic_data")}},[t,Dn,Wn,Gn]),G.useEffect(()=>{if(t)return t.on(Ee.ParticipantDisconnected,Ft),t.on(Ee.Disconnected,Ft),()=>{t.off(Ee.ParticipantDisconnected,Ft),t.off(Ee.Disconnected,Ft)}},[Ft,t]),G.useEffect(()=>{if(ht.current&&(ht.current.scrollTop=ht.current.scrollHeight),Ce.length>0){const et=Ce.filter(Me=>Me.message&&!Me.componentType).map(Me=>`${Me.isSelf?"User":"Agent"}: ${Me.message}`).join(`
426
+ `);console.groupCollapsed(`%c[Transcript Summary] ${Ce.filter(Me=>Me.message).length} messages`,"color: #8b5cf6; font-weight: bold;"),console.log(et),console.groupEnd()}},[Ce]),G.useEffect(()=>(it.current=new Audio(V),it.current.preload="auto",()=>{it.current&&(it.current.pause(),it.current.src="",it.current=null)}),[V]),W.jsxs(pW,{theme:I,children:[W.jsxs(sx,{children:[(!$||!Lt.isOpen)&&W.jsx(mu.button,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{type:"spring",stiffness:400,damping:25},"aria-label":"Open call widget",onClick:Lt.toggle,style:{position:X,...J,backgroundColor:N.primaryColor,color:N.primaryTextColor,...(Hi=v==null?void 0:v.modalTrigger)==null?void 0:Hi.styles},className:"ringg_ai-h-14 ringg_ai-w-14 !ringg_ai-rounded-full ringg_ai-flex ringg_ai-items-center ringg_ai-justify-center ringg_ai-shadow ringg_ai-trigger-btn !ringg_ai-z-[9999] hover:ringg_ai-opacity-90 ringg_ai-transition-opacity",children:W.jsx("img",{src:((ea=(Ji=v==null?void 0:v.modalTrigger)==null?void 0:Ji.icon)==null?void 0:ea.url)??"https://assets.ringg.ai/images/icons/widget-phone.svg",alt:"Widget trigger",style:{width:((es=(co=v==null?void 0:v.modalTrigger)==null?void 0:co.icon)==null?void 0:es.size)??25,height:((fo=(ts=v==null?void 0:v.modalTrigger)==null?void 0:ts.icon)==null?void 0:fo.size)??25}})},"trigger-button"),Lt.isOpen&&W.jsxs(mu.div,{ref:bt,initial:{y:"100%",opacity:0,x:oe==="bottom-center"?"-50%":0},animate:{y:0,opacity:1,x:oe==="bottom-center"?"-50%":0},exit:{y:"100%",opacity:0,x:oe==="bottom-center"?"-50%":0},transition:{type:"spring",stiffness:300,damping:28},className:xr("ringg_ai-relative ringg_ai-border ringg_ai-overflow-hidden ringg_ai-shadow-xl !ringg_ai-z-[9999] ringg_ai-w-[95vw] md:ringg_ai-w-[360px]",bn&&"ringg_ai-h-[24.5rem]"),style:{position:"fixed",bottom:"2%",...Fte(oe),...bn?xe:{},maxWidth:"96dvw",maxHeight:"96dvh",backgroundColor:N.backgroundColor,borderColor:N.borderColor,borderRadius:RS(E==null?void 0:E.borderRadius)??N.borderRadius,fontFamily:N.fontFamily,"--widget-primary":N.primaryColor,"--widget-primary-text":N.primaryTextColor,"--widget-bg":N.backgroundColor,"--widget-surface":N.surfaceColor,"--widget-text":N.textColor,"--widget-muted":N.mutedTextColor,"--widget-border":N.borderColor,"--widget-button-radius":ne},children:[bn&&W.jsx(Av,{size:"icon",variant:"ghost","aria-label":"Minimize widget",onClick:Lt.minimize,className:"ringg_ai-absolute !ringg_ai-z-[9999] ringg_ai-top-2.5 ringg_ai-right-12 !ringg_ai-rounded-full ringg_ai-text-gray-500 hover:ringg_ai-text-gray-700",children:W.jsx(iW,{size:20})}),W.jsx(Av,{size:"icon",variant:"ghost","aria-label":bn?"End call":"Close widget",onClick:()=>bn?He(!0):Lt.showFeedback?Be():Lt.minimize(),className:"ringg_ai-absolute !ringg_ai-z-[9999] ringg_ai-top-2.5 ringg_ai-right-2.5 !ringg_ai-rounded-full ringg_ai-text-gray-500 hover:ringg_ai-text-gray-700",children:W.jsx(lW,{size:20})}),W.jsx(UY,{open:ve,onOpenChange:He,containerRef:bt,children:W.jsxs(FY,{children:[W.jsxs(jY,{children:[W.jsxs(VY,{children:["Are you sure you want to end ",ke==="text"?"chat":"call","?"]}),W.jsx(zY,{children:"Your current conversation will be closed and cannot be accessed later."})]}),W.jsxs(BY,{children:[W.jsx(Av,{variant:"outline",onClick:()=>He(!1),style:{borderRadius:ne,borderColor:N.borderColor,backgroundColor:N.surfaceColor,color:N.textColor},children:"Cancel"}),W.jsxs(Av,{onClick:Ft,style:{borderRadius:ne,backgroundColor:N.primaryColor,color:N.primaryTextColor},children:["End ",ke==="text"?"Chat":"Call"]})]})]})}),Lt.showFeedback?W.jsx($Y,{callMode:ke,isSubmitting:Je,feedbackScreenConfig:U,onSubmit:Kt,onSkip:Be}):W.jsxs("div",{className:"ringg_ai-flex ringg_ai-h-full ringg_ai-flex-col",children:[W.jsxs("div",{className:xr("ringg_ai-relative ringg_ai-p-5 ringg_ai-h-full ringg_ai-mb-2 ringg_ai-flex ringg_ai-gap-5 ringg_ai-flex-col",!bn&&"ringg_ai-mt-2"),children:[W.jsx(qY,{isCalling:bn,isLoading:Je,title:l,description:c,logoUrl:R,logoStyles:M}),Ce.length===0&&bn&&W.jsx("div",{className:"ringg_ai-mt-20 ringg_ai-h-full"}),Ce.length>0&&bn&&W.jsx("div",{"data-scrollable":"true",ref:ht,className:"ringg_ai-mt-20 ringg_ai-h-full ringg_ai-overflow-y-auto ringg_ai-flex ringg_ai-flex-col",children:W.jsx("div",{className:"ringg_ai-mt-auto md:ringg_ai-mt-0 ringg_ai-flex ringg_ai-flex-col ringg_ai-gap-2.5",children:Ce.sort((et,Me)=>et.timestamp-Me.timestamp).map((et,Me)=>et.componentType&&et.componentData?W.jsx(nK,{initialComponent:et.componentData,onApiCall:un,onComplete:()=>At(et.componentData.component_id),onSendResponse:ln},`flow_${et.componentData.component_id}_${Me}`):W.jsx(Dte,{itemIndex:Me,message:et},`${et.timestamp}__${Me}`))})}),W.jsx(IY,{buttonConfig:v,callMode:ke,isCalling:bn,onCallEnd:Ft}),z.hasError&&W.jsx("div",{className:"ringg_ai-text-center ringg_ai-text-sm ringg_ai-text-red-500 -ringg_ai-mt-3 -ringg_ai-mb-2",children:z.message}),Nr==="disconnected"&&W.jsx(GW,{callMode:ke,buttonConfig:v,isCalling:bn,isLoading:Je,onCallTrigger:vt}),!bn&&W.jsx("p",{className:"ringg_ai-text-xs ringg_ai-text-center",style:{color:N.mutedTextColor},children:A?Vte(A.text,A.links):W.jsxs(W.Fragment,{children:["By starting call you agree to ",W.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"hover:ringg_ai-underline",style:{color:N.primaryColor},href:"https://www.ringg.ai/privacy",children:"Privacy policy"})," & ",W.jsx("a",{target:"_blank",rel:"noopener noreferrer",className:"hover:ringg_ai-underline",style:{color:N.primaryColor},href:"https://www.ringg.ai/terms",children:"T&C"})]})})]}),!bn&&!T&&W.jsx(Ate,{tabs:XG,activeTab:ke,onTabChange:et=>Ge(et)})]})]},"chat-widget")]}),W.jsx(vB,{}),!1]})},Bte="1.0.20-alpha.46",Hte=({config:t})=>{const[e]=G.useState(()=>new Gh({dynacast:!0,adaptiveStream:!0}));return G.useEffect(()=>{console.log(`%c[Ringg CDN] v${Bte} initialized`,"background: #7c3aed; color: white; padding: 2px 8px; border-radius: 4px;"),console.log("[Ringg CDN] Config:",t)},[t]),W.jsx(XT.Provider,{value:e,children:W.jsx(zte,{config:t,room:e})})};{const t="ringg_ai_container";(function(e,n){function r(a){console.log("%c[Ringg CDN] loadAgent called","background: #22c55e; color: white; padding: 2px 8px; border-radius: 4px;",a);let s=n.getElementById(t);s||(s=n.createElement("div"),s.id=t,n.body.appendChild(s)),yg.createRoot(s).render(W.jsx(ir.StrictMode,{children:W.jsx(Hte,{config:a})}))}e.loadAgent=r})(window,document)}});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@desivocal/agents-cdn",
3
3
  "private": false,
4
- "version": "1.0.20-alpha.44",
4
+ "version": "1.0.20-alpha.46",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "lint": "eslint .",