@chat-leo/chatleo 0.0.0-stage → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/chatleo/chatleo.esm.js +1 -0
- package/dist/chatleo/index.esm.js +1 -0
- package/dist/chatleo/p-43ada232.entry.js +1 -0
- package/dist/chatleo/p-4485e141.entry.js +1 -0
- package/dist/chatleo/p-BnCPdbII.js +1 -0
- package/dist/chatleo/p-C-l90Wre.js +1 -0
- package/dist/chatleo/p-DQuL1Twl.js +1 -0
- package/dist/chatleo/p-DmL518NK.js +3 -0
- package/dist/chatleo/p-aed60255.entry.js +1 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/chatleo-avatar_13.cjs.entry.js +2986 -0
- package/dist/cjs/chatleo-call-adapter-B2OfC0VZ.js +35 -0
- package/dist/cjs/chatleo-chat-input.cjs.entry.js +67 -0
- package/dist/cjs/chatleo.cjs.js +25 -0
- package/dist/cjs/index-DkSDLR0y.js +56 -0
- package/dist/cjs/index-Dxw4YCA_.js +1741 -0
- package/dist/cjs/index.cjs.js +7 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/my-component.cjs.entry.js +33 -0
- package/dist/collection/__mocks__/stencil-core.js +26 -0
- package/dist/collection/collection-manifest.json +27 -0
- package/dist/collection/components/chatleo-avatar/chatleo-avatar.css +40 -0
- package/dist/collection/components/chatleo-avatar/chatleo-avatar.js +116 -0
- package/dist/collection/components/chatleo-chat/chatleo-chat.css +108 -0
- package/dist/collection/components/chatleo-chat/chatleo-chat.js +459 -0
- package/dist/collection/components/chatleo-chat-header/chatleo-chat-header.css +22 -0
- package/dist/collection/components/chatleo-chat-header/chatleo-chat-header.js +105 -0
- package/dist/collection/components/chatleo-chat-input/chatleo-chat-input.css +84 -0
- package/dist/collection/components/chatleo-chat-input/chatleo-chat-input.js +141 -0
- package/dist/collection/components/chatleo-chat-message/chatleo-chat-message.css +149 -0
- package/dist/collection/components/chatleo-chat-message/chatleo-chat-message.js +259 -0
- package/dist/collection/components/chatleo-component/chatleo-component.css +271 -0
- package/dist/collection/components/chatleo-component/chatleo-component.js +1366 -0
- package/dist/collection/components/chatleo-new-message-selector/chatleo-new-message-selector.css +96 -0
- package/dist/collection/components/chatleo-new-message-selector/chatleo-new-message-selector.js +231 -0
- package/dist/collection/components/chatleo-rich-input/chatleo-rich-input.css +352 -0
- package/dist/collection/components/chatleo-rich-input/chatleo-rich-input.js +976 -0
- package/dist/collection/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.css +169 -0
- package/dist/collection/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.js +400 -0
- package/dist/collection/components/chatleo-room-list/chatleo-room-list.css +111 -0
- package/dist/collection/components/chatleo-room-list/chatleo-room-list.js +180 -0
- package/dist/collection/components/chatleo-room-tile-component/chatleo-room-tile-component.css +110 -0
- package/dist/collection/components/chatleo-room-tile-component/chatleo-room-tile-component.js +241 -0
- package/dist/collection/components/chatleo-room-view/chatleo-room-view.css +93 -0
- package/dist/collection/components/chatleo-room-view/chatleo-room-view.js +593 -0
- package/dist/collection/components/chatleo-tray-component/chatleo-tray-component.css +284 -0
- package/dist/collection/components/chatleo-tray-component/chatleo-tray-component.js +391 -0
- package/dist/collection/components/chatleo-user-tile/chatleo-user-tile.css +56 -0
- package/dist/collection/components/chatleo-user-tile/chatleo-user-tile.js +149 -0
- package/dist/collection/components/my-component/my-component.css +4 -0
- package/dist/collection/components/my-component/my-component.js +95 -0
- package/dist/collection/index.js +10 -0
- package/dist/collection/utils/call-entry.js +34 -0
- package/dist/collection/utils/delivery.js +7 -0
- package/dist/collection/utils/utils.js +51 -0
- package/dist/components/chatleo-avatar.d.ts +11 -0
- package/dist/components/chatleo-avatar.js +1 -0
- package/dist/components/chatleo-chat-header.d.ts +11 -0
- package/dist/components/chatleo-chat-header.js +1 -0
- package/dist/components/chatleo-chat-input.d.ts +11 -0
- package/dist/components/chatleo-chat-input.js +1 -0
- package/dist/components/chatleo-chat-message.d.ts +11 -0
- package/dist/components/chatleo-chat-message.js +1 -0
- package/dist/components/chatleo-chat.d.ts +11 -0
- package/dist/components/chatleo-chat.js +1 -0
- package/dist/components/chatleo-component.d.ts +11 -0
- package/dist/components/chatleo-component.js +1 -0
- package/dist/components/chatleo-new-message-selector.d.ts +11 -0
- package/dist/components/chatleo-new-message-selector.js +1 -0
- package/dist/components/chatleo-rich-input.d.ts +11 -0
- package/dist/components/chatleo-rich-input.js +1 -0
- package/dist/components/chatleo-rich-message-renderer.d.ts +11 -0
- package/dist/components/chatleo-rich-message-renderer.js +1 -0
- package/dist/components/chatleo-room-list.d.ts +11 -0
- package/dist/components/chatleo-room-list.js +1 -0
- package/dist/components/chatleo-room-tile-component.d.ts +11 -0
- package/dist/components/chatleo-room-tile-component.js +1 -0
- package/dist/components/chatleo-room-view.d.ts +11 -0
- package/dist/components/chatleo-room-view.js +1 -0
- package/dist/components/chatleo-tray-component.d.ts +11 -0
- package/dist/components/chatleo-tray-component.js +1 -0
- package/dist/components/chatleo-user-tile.d.ts +11 -0
- package/dist/components/chatleo-user-tile.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/my-component.d.ts +11 -0
- package/dist/components/my-component.js +1 -0
- package/dist/components/p-8kvQ-Uh-.js +1 -0
- package/dist/components/p-B7cdqAgv.js +1 -0
- package/dist/components/p-BdiOcOYZ.js +1 -0
- package/dist/components/p-BlbDSb7D.js +1 -0
- package/dist/components/p-BnCPdbII.js +1 -0
- package/dist/components/p-C-v19aUJ.js +1 -0
- package/dist/components/p-C1mF0s8g.js +1 -0
- package/dist/components/p-CRtBdzP3.js +1 -0
- package/dist/components/p-CfayCm9O.js +1 -0
- package/dist/components/p-DGjAxoQy.js +1 -0
- package/dist/components/p-Exj_2-yI.js +1 -0
- package/dist/components/p-XlwGxsqT.js +1 -0
- package/dist/components/p-fjMaTJam.js +1 -0
- package/dist/components/p-xt4kzz3B.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/chatleo-avatar_13.entry.js +2972 -0
- package/dist/esm/chatleo-call-adapter-BnCPdbII.js +33 -0
- package/dist/esm/chatleo-chat-input.entry.js +65 -0
- package/dist/esm/chatleo.js +21 -0
- package/dist/esm/index-C-l90Wre.js +53 -0
- package/dist/esm/index-DmL518NK.js +1733 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/my-component.entry.js +31 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/__mocks__/stencil-core.d.ts +24 -0
- package/dist/types/components/chatleo-avatar/chatleo-avatar.d.ts +27 -0
- package/dist/types/components/chatleo-chat/chatleo-chat.d.ts +75 -0
- package/dist/types/components/chatleo-chat-header/chatleo-chat-header.d.ts +27 -0
- package/dist/types/components/chatleo-chat-input/chatleo-chat-input.d.ts +31 -0
- package/dist/types/components/chatleo-chat-message/chatleo-chat-message.d.ts +22 -0
- package/dist/types/components/chatleo-component/chatleo-component.d.ts +278 -0
- package/dist/types/components/chatleo-new-message-selector/chatleo-new-message-selector.d.ts +68 -0
- package/dist/types/components/chatleo-rich-input/chatleo-rich-input.d.ts +216 -0
- package/dist/types/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.d.ts +77 -0
- package/dist/types/components/chatleo-room-list/chatleo-room-list.d.ts +52 -0
- package/dist/types/components/chatleo-room-tile-component/chatleo-room-tile-component.d.ts +59 -0
- package/dist/types/components/chatleo-room-view/chatleo-room-view.d.ts +91 -0
- package/dist/types/components/chatleo-tray-component/chatleo-tray-component.d.ts +112 -0
- package/dist/types/components/chatleo-user-tile/chatleo-user-tile.d.ts +36 -0
- package/dist/types/components/my-component/my-component.d.ts +16 -0
- package/dist/types/components.d.ts +1593 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/stencil-public-runtime.d.ts +1879 -0
- package/dist/types/utils/call-entry.d.ts +9 -0
- package/dist/types/utils/delivery.d.ts +7 -0
- package/dist/types/utils/utils.d.ts +24 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +70 -3
- package/readme.md +111 -0
- package/README.md +0 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function t$2(t,e,n){const l="undefined"!=typeof HTMLElement?HTMLElement.prototype:null;for(;t&&t!==l;){const l=Object.getOwnPropertyDescriptor(t,e);if(l&&(!n||l.get))return l;t=Object.getPrototypeOf(t);}}var e$3,n$6=(e,n)=>{var l;Object.entries(null!=(l=n.l.t)?l:{}).map((([l,[o]])=>{if(31&o||32&o){const o=e[l],s=t$2(Object.getPrototypeOf(e),l,true)||Object.getOwnPropertyDescriptor(e,l);s&&Object.defineProperty(e,l,{get(){return s.get.call(this)},set(t){s.set.call(this,t);},configurable:true,enumerable:true}),n.o.has(l)?e[l]=n.o.get(l):void 0!==o&&(e[l]=o);}}));},l$5=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},o$4=(t,e)=>e in t,s$1=(t,e)=>(0, console.error)(t,e),i$1=new Map,r$3="undefined"!=typeof window?window:{},c$2=r$3.HTMLElement||class{},f$2={i:0,u:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,l)=>t.addEventListener(e,n,l),rel:(t,e,n,l)=>t.removeEventListener(e,n,l),ce:(t,e)=>new CustomEvent(t,e)},u$1=(()=>{try{return !!r$3.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return false})(),a$2=!!u$1&&(()=>!!r$3.document&&Object.getOwnPropertyDescriptor(r$3.document.adoptedStyleSheets,"length").writable)(),d$4=false,p$3=[],h$4=[],m$1=()=>{var t;return (null==(t=r$3.document)?void 0:t.hidden)?setTimeout(v$2,16):f$2.raf(v$2)},b$2=(t,e)=>n=>{t.push(n),d$4||(d$4=true,4&f$2.i?$$1(v$2):m$1());},y$2=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now());}catch(t){s$1(t);}t.length=0;},v$2=()=>{y$2(p$3),y$2(h$4),(d$4=p$3.length>0)&&m$1();},$$1=t=>Promise.resolve(void 0).then(t),g$1=b$2(h$4);function O$1(){const t=this.attachShadow({mode:"open"});void 0===e$3&&(e$3=null),e$3&&(a$2?t.adoptedStyleSheets.push(e$3):t.adoptedStyleSheets=[...t.adoptedStyleSheets,e$3]);}var S$1,k$2=new WeakMap,M$1=t=>"sc-"+t.p,E$1=t=>"object"==(t=typeof t)||"function"===t,A$1=(t,e,...n)=>{let l=null,o=null,i=false,r=false;const c=[],f=e=>{for(let n=0;n<e.length;n++)if(l=e[n],Array.isArray(l))f(l);else if(null!=l&&"boolean"!=typeof l){if(i="function"!=typeof t&&!E$1(l))l+="";else if("function"!=typeof t&&void 0===l.i){s$1("Invalid vNode child");continue}i&&r?c[c.length-1].h+=l:c.push(i?C$1(null,l):l),r=i;}};if(f(n),e){e.key&&(o=e.key);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "));}}const u=C$1(t,null);return u.m=e,c.length>0&&(u.v=c),u.$=o,u},C$1=(t,e)=>({i:0,j:t,h:null!=e?e:null,O:null,v:null,m:null,$:null}),N$1={},x$1=t=>{if(!t)return;const e=Object.keys(t);if(0===e.length)return;let n=false;for(const l of e){if(n)break;for(const e of t[l])if("string"==typeof e){n=true;break}}if(!n)return t;const l={};for(const n of e)l[n]=t[n].map((t=>"string"==typeof t?{[t]:0}:t));return l},L$1=(t,e)=>null==t||E$1(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?"string"==typeof t?parseFloat(t):"number"==typeof t?t:NaN:1&e?t+"":t,_$1=(t,e)=>{const n=t;return {emit:t=>D$1(n,e,{bubbles:true,composed:true,cancelable:true,detail:t})}},D$1=(t,e,n)=>{const l=f$2.ce(e,n);return t.dispatchEvent(l),l},H$1=(t,e,n,s,i,c)=>{if(n===s)return;let u=o$4(t,e),a=e.toLowerCase();if("class"===e){const e=t.classList,l=W$1(n);let o=W$1(s);{let t=l.filter((t=>t&&!o.includes(t)));e.remove(...t),e.add(...o.filter((t=>t&&!l.includes(t))));}}else if("style"===e){for(const e in n)s&&null!=s[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in s)n&&s[e]===n[e]||(e.includes("-")?t.style.setProperty(e,s[e]):t.style[e]=s[e]);}else if("key"===e);else if("ref"===e)s&&tt$1(s,t);else if(t.__lookupSetter__(e)||"o"!==e[0]||"n"!==e[1]){if("a"===e[0]&&e.startsWith("attr:")){const n=e.slice(5);let o;{const e=l$5(t);if(e&&e.l&&e.l.t){const t=e.l.t[n];t&&t[1]&&(o=t[1]);}}return o||(o=n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),void(null==s||false===s?false===s&&""!==t.getAttribute(o)||t.removeAttribute(o):t.setAttribute(o,true===s?"":s))}if("p"===e[0]&&e.startsWith("prop:")){const n=e.slice(5);try{t[n]=s;}catch(t){}return}{const l=E$1(s);if((u||l&&null!==s)&&!i)try{if(t.tagName.includes("-"))t[e]!==s&&(t[e]=s);else {const l=null==s?"":s;"list"===e?u=false:null!=n&&t[e]===l||("function"==typeof t.__lookupSetter__(e)?t[e]=l:t.setAttribute(e,l));}}catch(t){}null==s||false===s?(false!==s||""===t.getAttribute(e)||4&c&&!R$1(e))&&t.removeAttribute(e):(!u||4&c||i)&&!l&&1===t.nodeType&&t.setAttribute(e,s=true===s?"":s);}}else if(e="-"===e[2]?e.slice(3):o$4(r$3,a)?a.slice(2):a[2]+e.slice(3),n||s){const l=e.endsWith(T$1);e=e.replace(F$1,""),n&&f$2.rel(t,e,n,l),s&&f$2.ael(t,e,s,l);}},P$1=new Set(["draggable","contenteditable","spellcheck"]),R$1=t=>P$1.has(t)||t.startsWith("aria-"),U$1=/\s/,W$1=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(U$1):[]),T$1="Capture",F$1=RegExp(T$1+"$"),V$1=(t,e,n)=>{const l=11===e.O.nodeType&&e.O.host?e.O.host:e.O,o=t&&t.m||{},s=e.m||{};for(const t of q$1(Object.keys(o)))t in s||H$1(l,t,o[t],void 0,n,e.i);for(const t of q$1(Object.keys(s)))H$1(l,t,o[t],s[t],n,e.i);};function q$1(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var z$1=false,I$1=false,Y$1=[],Z$1=[],B$1=(t,e,n)=>{const l=e.v[n];let o,s,i=0;if(null!=l.h)o=l.O=r$3.document.createTextNode(l.h);else {if(!r$3.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(o=l.O=r$3.document.createElement(l.j),V$1(null,l,I$1),l.v){const e="template"===l.j?o.content:o;for(i=0;i<l.v.length;++i)s=B$1(t,l,i),s&&e.appendChild(s);}}return o["s-hn"]=S$1,o},G$1=(t,e,n,l,o,s)=>{let i,r=t;for(r.shadowRoot&&r.tagName===S$1&&(r=r.shadowRoot),"template"===n.j&&(r=r.content);o<=s;++o)l[o]&&(i=B$1(null,n,o),i&&(l[o].O=i,et$1(r,i,e)));},J$1=(t,e,n)=>{for(let l=e;l<=n;++l){const e=t[l];if(e){const t=e.O;X$1(e),t&&t.remove();}}},K$1=(t,e,n=false)=>t.j===e.j&&(n?(n&&!t.$&&e.$&&(t.$=e.$),true):t.$===e.$),Q$1=(t,e,n=false)=>{const l=e.O=t.O,o=t.v,s=e.v,i=e.h;null==i?("slot"!==e.j||z$1||t.S!==e.S&&(e.O["s-sn"]=e.S||"",(t=>{f$2.i|=1;const e=t.closest(S$1.toLowerCase());if(null!=e){const n=Array.from(e.__childNodes||e.childNodes).find((t=>t["s-cr"])),l=Array.from(t.__childNodes||t.childNodes);for(const t of n?l.reverse():l)null!=t["s-sh"]&&(et$1(e,t,null!=n?n:null),t["s-sh"]=void 0);}f$2.i&=-2;})(e.O.parentElement)),V$1(t,e,I$1),null!==o&&null!==s?((t,e,n,l,o=false)=>{let s,i,r=0,c=0,f=0,u=0,a=e.length-1,d=e[0],p=e[a],h=l.length-1,m=l[0],b=l[h];const y="template"===n.j?t.content:t;for(;r<=a&&c<=h;)if(null==d)d=e[++r];else if(null==p)p=e[--a];else if(null==m)m=l[++c];else if(null==b)b=l[--h];else if(K$1(d,m,o))Q$1(d,m,o),d=e[++r],m=l[++c];else if(K$1(p,b,o))Q$1(p,b,o),p=e[--a],b=l[--h];else if(K$1(d,b,o))Q$1(d,b,o),et$1(y,d.O,p.O.nextSibling),d=e[++r],b=l[--h];else if(K$1(p,m,o))Q$1(p,m,o),et$1(y,p.O,d.O),p=e[--a],m=l[++c];else {for(f=-1,u=r;u<=a;++u)if(e[u]&&null!==e[u].$&&e[u].$===m.$){f=u;break}f>=0?(i=e[f],i.j!==m.j?s=B$1(e&&e[c],n,c):(Q$1(i,m,o),e[f]=void 0,s=i.O),m=l[++c]):(s=B$1(e&&e[c],n,c),m=l[++c]),s&&et$1(d.O.parentNode,s,d.O);}r>a?G$1(t,null==l[h+1]?null:l[h+1].O,n,l,c,h):c>h&&J$1(e,r,a);})(l,o,e,s,n):null!==s?(null!==t.h&&(l.textContent=""),G$1(l,null,e,s,0,s.length-1)):!n&&null!==o&&J$1(o,0,o.length-1)):t.h!==i&&(l.data=i);},X$1=t=>{t.m&&t.m.ref&&Y$1.push((()=>t.m.ref(null))),t.v&&t.v.map(X$1);},tt$1=(t,e)=>{Z$1.push((()=>t(e)));},et$1=(t,e,n)=>null==t?void 0:t.insertBefore(e,n),nt$1=(t,e,n=false)=>{const l=t.$hostElement$,o=t.l,s=t.k||C$1(null,null),i=(t=>t&&t.j===N$1)(e)?e:A$1(null,null,e);if(S$1=l.tagName,n&&i.m)for(const t of Object.keys(i.m))l.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(i.m[t]=l[t]);i.j=null,i.i|=4,t.k=i,i.O=s.O=l.shadowRoot||l,z$1=!(!(1&o.i)||128&o.i),Q$1(s,i,n),Y$1.forEach((t=>t())),Y$1.length=0,Z$1.forEach((t=>t())),Z$1.length=0;},lt$1=(t,e)=>{if(e&&!t.M&&e["s-p"]){const n=e["s-p"].push(new Promise((l=>t.M=()=>{e["s-p"].splice(n-1,1),l();})));}},ot$1=(t,e)=>{if(t.i|=16,4&t.i)return void(t.i|=512);lt$1(t,t.A);const n=()=>st$1(t,e);if(!e)return g$1(n);queueMicrotask((()=>{n();}));},st$1=(t,e)=>{const n=t.$hostElement$,l=n;if(!l)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let o;return o=dt$1(l,e?"componentWillLoad":"componentWillUpdate",void 0,n),o=it$1(o,(()=>dt$1(l,"componentWillRender",void 0,n))),it$1(o,(()=>ct$1(t,l,e)))},it$1=(t,e)=>rt$1(t)?t.then(e).catch((t=>{console.error(t),e();})):e(),rt$1=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,ct$1=async(t,e,n)=>{var l;const o=t.$hostElement$,s=o["s-rc"];n&&(t=>{const e=t.l,n=t.$hostElement$,l=e.i,o=((t,e)=>{var n,l,o;const s=M$1(e),c=i$1.get(s);if(!r$3.document)return s;if(t=11===t.nodeType?t:r$3.document,c)if("string"==typeof c){let o,i=k$2.get(t=t.head||t);if(i||k$2.set(t,i=new Set),!i.has(s)){o=r$3.document.createElement("style"),o.textContent=c;const d=null!=(n=f$2.C)?n:function(){var t,e,n;return null!=(n=null==(e=null==(t=r$3.document.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:e.getAttribute("content"))?n:void 0}();if(null!=d&&o.setAttribute("nonce",d),!(1&e.i))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),n=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(o,(null==n?void 0:n.parentNode)===t?n:null);}else if("host"in t)if(u$1){const e=new(null!=(l=t.defaultView)?l:t.ownerDocument.defaultView).CSSStyleSheet;e.replaceSync(c),a$2?t.adoptedStyleSheets.unshift(e):t.adoptedStyleSheets=[e,...t.adoptedStyleSheets];}else {const e=t.querySelector("style");e?e.textContent=c+e.textContent:t.prepend(o);}else t.append(o);1&e.i&&t.insertBefore(o,null),4&e.i&&(o.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),i&&i.add(s);}}else {let e=k$2.get(t);if(e||k$2.set(t,e=new Set),!e.has(s)){const n=null!=(o=t.defaultView)?o:t.ownerDocument.defaultView;let l;if(c.constructor===n.CSSStyleSheet)l=c;else {l=new n.CSSStyleSheet;for(let t=0;t<c.cssRules.length;t++)l.insertRule(c.cssRules[t].cssText,t);}a$2?t.adoptedStyleSheets.push(l):t.adoptedStyleSheets=[...t.adoptedStyleSheets,l],e.add(s);}}return s})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"));})(t);ft$1(t,e,o,n),s&&(s.map((t=>t())),o["s-rc"]=void 0);{const e=null!=(l=o["s-p"])?l:[],n=()=>ut$1(t);0===e.length?n():(Promise.all(e).then(n).catch(n),t.i|=4,e.length=0);}},ft$1=(t,e,n,l)=>{try{e=e.render(),t.i&=-17,t.i|=2,nt$1(t,e,l);}catch(e){s$1(e,t.$hostElement$);}return null},ut$1=t=>{const e=t.$hostElement$,n=e,l=t.A;dt$1(n,"componentDidRender",void 0,e),64&t.i?dt$1(n,"componentDidUpdate",void 0,e):(t.i|=64,pt$1(e),dt$1(n,"componentDidLoad",void 0,e),t.N(e),l||at$1()),t.M&&(t.M(),t.M=void 0),512&t.i&&$$1((()=>ot$1(t,false))),t.i&=-517;},at$1=()=>{$$1((()=>D$1(r$3,"appload",{detail:{namespace:"callcomponents"}})));},dt$1=(t,e,n,l)=>{if(t&&t[e])try{return t[e](n)}catch(t){s$1(t,l);}},pt$1=t=>t.classList.add("hydrated"),ht$1=(t,e,n,o)=>{const i=l$5(t);if(!i)return;const r=t,c=i.o.get(e),f=i.i,u=r;if(!((n=L$1(n,o.t[e][0]))===c||Number.isNaN(c)&&Number.isNaN(n))){if(i.o.set(e,n),o.L){const t=o.L[e];t&&t.map((t=>{try{const[[l,o]]=Object.entries(t);(128&f||1&o)&&(u?u[l](n,c,e):i._.push((()=>{i.D[l](n,c,e);})));}catch(t){s$1(t,r);}}));}if(2&f){if(u.componentShouldUpdate&&false===u.componentShouldUpdate(n,c,e)&&!(16&f))return;16&f||ot$1(i,false);}}},mt$1=(e,n)=>{var o,s;const i=e.prototype;{e.watchers&&!n.L&&(n.L=x$1(e.watchers)),e.deserializers&&!n.H&&(n.H=e.deserializers),e.serializers&&!n.P&&(n.P=e.serializers);const r=Object.entries(null!=(o=n.t)?o:{});r.map((([e,[o]])=>{if(31&o||32&o){const{get:s,set:r}=t$2(i,e)||{};s&&(n.t[e][0]|=2048),r&&(n.t[e][0]|=4096),Object.defineProperty(i,e,{get(){return s?s.apply(this):((t,e)=>l$5(this).o.get(e))(0,e)},configurable:true,enumerable:true}),Object.defineProperty(i,e,{set(t){const s=l$5(this);if(s){if(r)return void 0===(32&o?this[e]:s.$hostElement$[e])&&s.o.get(e)&&(t=s.o.get(e)),r.call(this,L$1(t,o)),void ht$1(this,e,t=32&o?this[e]:s.$hostElement$[e],n);ht$1(this,e,t,n);}}});}}));{const t=new Map;i.attributeChangedCallback=function(e,o,s){f$2.jmp((()=>{var c;const f=t.get(e),u=l$5(this);if(this.hasOwnProperty(f),i.hasOwnProperty(f)&&"number"==typeof this[f]&&this[f]==s)return;if(null==f){const t=null==u?void 0:u.i;if(u&&t&&!(8&t)&&s!==o){const l=this,i=null==(c=n.L)?void 0:c[e];null==i||i.forEach((n=>{const[[i,r]]=Object.entries(n);null!=l[i]&&(128&t||1&r)&&l[i].call(l,s,o,e);}));}return}const a=r.find((([t])=>t===f)),d=4&(a?a[1][0]:0),p=d&&null===s&&void 0===this[f];d&&(s=null!==s&&"false"!==s);const h=Object.getOwnPropertyDescriptor(i,f);p||s==this[f]||h.get&&!h.set||(this[f]=s);}));},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(s=n.L)?s:{}),...r.filter((([t,e])=>31&e[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))]));}}return e},bt$1=async(t,e,n)=>{let l;try{if(!(32&e.i)&&(e.i|=32,e.i&=-1025,l=t.constructor,customElements.whenDefined(t.localName).then((()=>e.i|=128)),l&&l.style)){let t;"string"==typeof l.style&&(t=l.style);const e=M$1(n);if(!i$1.has(e)){((t,e,n)=>{let l=i$1.get(t);u$1&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=e:l.replaceSync(e)):l=e,i$1.set(t,l);})(e,t,!!(1&n.i));}}const o=e.A,s=()=>ot$1(e,true);o&&o["s-rc"]?o["s-rc"].push(s):s();}catch(n){s$1(n,t),e.M&&(e.M(),e.M=void 0),!e.N||1024&e.i||e.N(t);}},yt$1=(t,e)=>{const o={i:e[0],p:e[1]};try{o.t=e[2],o.R=e[3],o.L=x$1(t.L),o.H=t.H,o.P=t.P;const s=t.prototype.connectedCallback,i=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:false,__registerHost(){((t,e)=>{const l={i:0,$hostElement$:t,l:e,o:new Map,U:new Map};l.W=new Promise((t=>l.N=t)),t["s-p"]=[],t["s-rc"]=[];const o=l;t.__stencil__getHostRef=()=>o,512&e.i&&n$6(t,l);})(this,o);},connectedCallback(){if(!this.__hasHostListenerAttached){const t=l$5(this);if(!t)return;vt$1(this,t,o.R),this.__hasHostListenerAttached=true;}(t=>{if(!(1&f$2.i)){const e=l$5(t);if(!e)return;const n=e.l;if(1&e.i)vt$1(t,e,n.R),(null==e?void 0:e.D)||(1024&e.i?setTimeout((()=>bt$1(t,e,n)),1e3):(null==e?void 0:e.W)&&e.W.then((()=>{})));else {e.i|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){lt$1(e,e.A=n);break}}n.t&&Object.entries(n.t).map((([e,[n]])=>{if(31&n&&Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];delete t[e],t[e]=n;}})),bt$1(t,e,n);}}})(this),s&&s.call(this);},disconnectedCallback(){(async t=>{if(!(1&f$2.i)){const e=l$5(t);(null==e?void 0:e.T)&&(e.T.map((t=>t())),e.T=void 0);}k$2.has(t)&&k$2.delete(t),t.shadowRoot&&k$2.has(t.shadowRoot)&&k$2.delete(t.shadowRoot);})(this),i&&i.call(this);},__attachShadow(){if(this.shadowRoot){if("open"!==this.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${o.p}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else O$1.call(this,o);}}),Object.defineProperty(t,"is",{value:o.p,configurable:true}),mt$1(t,o)}catch(e){return s$1(e),t}},vt$1=(t,e,n)=>{n&&r$3.document&&n.map((([n,l,o])=>{const s=t,i=$t$1(e,o),r=gt$1(n);f$2.ael(s,l,i,r),(e.T=e.T||[]).push((()=>f$2.rel(s,l,i,r)));}));},$t$1=(t,e)=>n=>{try{t.$hostElement$[e](n);}catch(e){s$1(e,t.$hostElement$);}},gt$1=t=>({passive:!!(1&t),capture:!!(2&t)});function kt$1(t){return t}
|
|
4
|
+
|
|
5
|
+
const t$1={publishAudio:false,publishVideo:false,publishScreen:false,moderate:false},i={join:"Join call",leave:"Leave call",connecting:"Connecting…",reconnecting:"Reconnecting…",migrating:"Moving to another server…",ended:"Call ended",failed:"Call failed",mute:"Mute microphone",unmute:"Unmute microphone",cameraOn:"Turn camera on",cameraOff:"Turn camera off",shareScreen:"Share screen",stopSharing:"Stop sharing",raiseHand:"Raise hand",lowerHand:"Lower hand",chat:"Chat",transcript:"Transcript",captions:"Captions",layout:"Switch layout",lobbyTitle:"Ready to join?",speaker:"Speaker",microphone:"Microphone",camera:"Camera",noDevices:"No devices found",permissionDenied:"Microphone or camera access was denied. Allow access in your browser settings and try again.",permissionBlocked:"Your system is blocking access to the microphone or camera.",joinAsListener:"Join as listener",incomingCall:"Incoming call",accept:"Accept",decline:"Decline",promote:"Promote to speaker",demote:"Move to audience",muteParticipant:"Mute participant",removeParticipant:"Remove participant",audience:"audience",noAudienceYet:"No audience yet",waitingForOthers:"Waiting for others to join…",calling:"Calling…",resumeAudio:"Resume audio",audioBlocked:"Your browser blocked audio playback.",transcriptionRunning:"Transcription is running",recordingRunning:"Recording is running",rejoin:"Rejoin",shareUnsupported:"Screen sharing is not supported in this browser.",shareAlreadyActive:"Someone is already sharing their screen.",deviceFallback:"Your selected device was disconnected. The default device is now in use.",emptyTranscript:"No transcript yet.",pin:"Pin participant",unpin:"Unpin participant",quality:"Video quality",layerAuto:"Auto",layerLow:"Low",layerMedium:"Medium",layerHigh:"High",layerReasonBandwidth:"Bandwidth",layerReasonPinned:"Pinned",layerReasonPublisher:"Publisher",agentIdle:"Idle",agentListening:"Listening",agentThinking:"Thinking",agentSpeaking:"Speaking"};function e$2(t){return {...i,...t??{}}}const s={speakerActivationDelayMs:300,speakerHoldMs:2e3,speakerThreshold:.02,reconnectTimeoutMs:3e4},n$5={permissionDenied:{code:"permission_denied",category:"permission",recoverable:true,message:"Microphone or camera access was denied."},permissionBlocked:{code:"permission_blocked",category:"permission",recoverable:true,message:"The operating system is blocking access to the device."},deviceNotFound:{code:"device_not_found",category:"device",recoverable:true,message:"The selected device is not available."},deviceUnplugged:{code:"device_unplugged",category:"device",recoverable:true,message:"A device was disconnected; the default device is now in use."},authExpired:{code:"auth_expired",category:"auth",recoverable:true,message:"The call token expired."},authRejected:{code:"auth_rejected",category:"auth",recoverable:false,message:"The call token was rejected."},sessionUnknown:{code:"session_unknown",category:"network",recoverable:true,message:"The call session is no longer available; rejoining."},negotiationInProgress:{code:"negotiation_in_progress",category:"protocol",recoverable:true,message:"The call server is negotiating; trying again."},sessionReplaced:{code:"session_replaced",category:"auth",recoverable:false,message:"You joined this call on another device."},rateLimited:{code:"rate_limited",category:"network",recoverable:true,message:"The call server is busy; retrying."},capabilityDenied:{code:"capability_denied",category:"auth",recoverable:false,message:"This action is not allowed for your role."},networkLost:{code:"network_lost",category:"network",recoverable:true,message:"The connection to the call server was lost."},networkFailed:{code:"network_failed",category:"network",recoverable:true,message:"Could not reconnect to the call. You can rejoin."},iceFailed:{code:"ice_failed",category:"network",recoverable:true,message:"The media connection failed and is being renegotiated."},roomEnded:{code:"room_ended",category:"room",recoverable:false,message:"The call ended."},roomFull:{code:"room_full",category:"room",recoverable:false,message:"The room is full."},removed:{code:"removed",category:"room",recoverable:false,message:"You were removed from the call."},protocolMismatch:{code:"protocol_mismatch",category:"protocol",recoverable:false,message:"This client is not compatible with the call server."},invalidAction:{code:"invalid_action",category:"room",recoverable:true,message:"That action is not available right now."},shareUnsupported:{code:"share_unsupported",category:"device",recoverable:true,message:"Screen sharing is not supported in this browser."},shareAlreadyActive:{code:"share_already_active",category:"room",recoverable:true,message:"Someone is already sharing their screen."}};let a$1 = class a extends Error{constructor(t,i,e){super(i??t.message),this.name="CallError",this.code=t.code,this.category=t.category,this.recoverable=t.recoverable,this.cause=e;}static from(t,i,e){return new a(n$5[t],i,e)}toInfo(){return {code:this.code,category:this.category,recoverable:this.recoverable,message:this.message}}};function r$2(t,i,e,s){if("a"===e&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof i?t!==i||!s:!i.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return "m"===e?s:"a"===e?s.call(t):s?s.value:i.get(t)}function o$3(t,i,e){if("function"==typeof i||!i.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i.set(t,e),e}var h$3,c$1,f$1,d$3,u,l$4,m,p$2,w,g,v$1,k$1,y$1,b$1,M,S,T,W,R,I,L,j,A,P,E,_,C,U,x,N,D,F,O,B,H,q,V,J,Y,$,z,G,K,Q,X,Z,tt,it,et,st,nt,at,rt,ot,ht,ct,ft,dt,ut,lt,mt,pt,wt,gt,vt,kt,yt,bt,Mt,St,Tt,Wt,Rt,It,Lt,jt,At,Pt,Et,_t,Ct,Ut,xt,Nt,Dt,Ft,Ot;"function"==typeof SuppressedError&&SuppressedError;class Bt{constructor(t){h$3.set(this,void 0),c$1.set(this,new Set),o$3(this,h$3,t);}getState(){return r$2(this,h$3,"f")}setState(t){const i=t(r$2(this,h$3,"f"));if(!Object.is(i,r$2(this,h$3,"f"))){o$3(this,h$3,i);for(const t of Array.from(r$2(this,c$1,"f"))){const e=t.selector(i);if(!t.equals(t.last,e)){const i=t.last;t.last=e,t.listener(e,i);}}}}subscribe(t,i,e=Object.is){const s={selector:t,listener:i,equals:e,last:t(r$2(this,h$3,"f"))};r$2(this,c$1,"f").add(s);const n=()=>{r$2(this,c$1,"f").delete(s);};return Object.assign(n,{unsubscribe:n})}get subscriberCount(){return r$2(this,c$1,"f").size}}function Ht(t,i){if(Object.is(t,i))return true;if(Array.isArray(t)&&Array.isArray(i))return t.length===i.length&&t.every(((t,e)=>Object.is(t,i[e])));if(t&&i&&"object"==typeof t&&"object"==typeof i){const e=Object.keys(t),s=Object.keys(i);return e.length===s.length&&e.every((e=>Object.prototype.hasOwnProperty.call(i,e)&&Object.is(t[e],i[e])))}return false}h$3=new WeakMap,c$1=new WeakMap;class qt{constructor(t={}){f$1.add(this),d$3.set(this,void 0),u.set(this,new Map),l$4.set(this,null),m.set(this,0),p$2.set(this,0),o$3(this,d$3,{...s,...t});}get activeSpeakerId(){return r$2(this,l$4,"f")}get config(){return r$2(this,d$3,"f")}update(t,i=Date.now()){o$3(this,p$2,i);const e=[],s=new Set;for(const[n,a]of Object.entries(t)){s.add(n);const t=r$2(this,u,"f").get(n)??{aboveSince:null,lastAbove:0},o=Number.isFinite(a)&&a>=r$2(this,d$3,"f").speakerThreshold;o?(t.lastAbove=i,null===t.aboveSince&&(t.aboveSince=i)):t.aboveSince=null,r$2(this,u,"f").set(n,t),o&&e.push(n);}for(const[t,e]of r$2(this,u,"f"))!s.has(t)&&i-e.lastAbove>r$2(this,d$3,"f").speakerHoldMs&&(r$2(this,u,"f").delete(t),r$2(this,l$4,"f")===t&&o$3(this,l$4,null));const n=r$2(this,f$1,"m",w).call(this);if(n){const t=r$2(this,u,"f").get(n),e=null!==t.aboveSince&&i-t.aboveSince>=r$2(this,d$3,"f").speakerActivationDelayMs,s=r$2(this,l$4,"f")?r$2(this,u,"f").get(r$2(this,l$4,"f")):void 0,a=!!s&&i-s.lastAbove<r$2(this,d$3,"f").speakerHoldMs;!e||r$2(this,l$4,"f")&&n===r$2(this,l$4,"f")||a&&null!==r$2(this,l$4,"f")||(o$3(this,l$4,n),o$3(this,m,i));}else if(r$2(this,l$4,"f")){const t=r$2(this,u,"f").get(r$2(this,l$4,"f"));(!t||i-t.lastAbove>=r$2(this,d$3,"f").speakerHoldMs)&&o$3(this,l$4,null);}return {speaking:e,activeSpeakerId:r$2(this,l$4,"f")}}remove(t){r$2(this,u,"f").delete(t),r$2(this,l$4,"f")===t&&o$3(this,l$4,null);}reset(){r$2(this,u,"f").clear(),o$3(this,l$4,null),o$3(this,m,0);}get lastUpdate(){return r$2(this,p$2,"f")}get activeSince(){return r$2(this,m,"f")}}d$3=new WeakMap,u=new WeakMap,l$4=new WeakMap,m=new WeakMap,p$2=new WeakMap,f$1=new WeakSet,w=function(){let t=null,i=Number.POSITIVE_INFINITY;for(const[e,s]of r$2(this,u,"f"))null!==s.aboveSince&&s.aboveSince<i&&(t=e,i=s.aboveSince);return t};class Vt{constructor(t={}){g.set(this,void 0),v$1.set(this,void 0),k$1.set(this,[]),y$1.set(this,{}),b$1.set(this,"unknown"),M.set(this,new Set),S.set(this,(()=>{this.refresh();})),T.set(this,false),o$3(this,g,t.logger),o$3(this,v$1,t.mediaDevices??("undefined"!=typeof navigator?navigator.mediaDevices:void 0));}get devices(){return r$2(this,k$1,"f")}get selected(){return {...r$2(this,y$1,"f")}}get permission(){return r$2(this,b$1,"f")}get supported(){return !!r$2(this,v$1,"f")}async start(){r$2(this,T,"f")||"undefined"==typeof navigator||(o$3(this,T,true),navigator.mediaDevices?.addEventListener?.("devicechange",r$2(this,S,"f")),await this.refresh());}stop(){r$2(this,T,"f")&&"undefined"!=typeof navigator&&(navigator.mediaDevices?.removeEventListener?.("devicechange",r$2(this,S,"f")),o$3(this,T,false));}onChange(t){return r$2(this,M,"f").add(t),()=>r$2(this,M,"f").delete(t)}async refresh(){if(!r$2(this,v$1,"f")?.enumerateDevices)return r$2(this,k$1,"f");try{const t=await r$2(this,v$1,"f").enumerateDevices();o$3(this,k$1,t.filter((t=>"audioinput"===t.kind||"videoinput"===t.kind||"audiooutput"===t.kind)).map((t=>({deviceId:t.deviceId,kind:t.kind,label:t.label,groupId:t.groupId})))),r$2(this,y$1,"f").audioinput||(r$2(this,y$1,"f").audioinput=r$2(this,k$1,"f").find((t=>"audioinput"===t.kind))?.deviceId),r$2(this,y$1,"f").videoinput||(r$2(this,y$1,"f").videoinput=r$2(this,k$1,"f").find((t=>"videoinput"===t.kind))?.deviceId),r$2(this,y$1,"f").audiooutput||(r$2(this,y$1,"f").audiooutput=r$2(this,k$1,"f").find((t=>"audiooutput"===t.kind))?.deviceId),r$2(this,M,"f").forEach((t=>t(r$2(this,k$1,"f"))));}catch(t){r$2(this,g,"f")?.warn?.("call-core: could not enumerate devices",t);}return r$2(this,k$1,"f")}async requestPermission(){if(!r$2(this,v$1,"f")?.getUserMedia)return "unknown";try{(await r$2(this,v$1,"f").getUserMedia({audio:true})).getTracks().forEach((t=>t.stop())),o$3(this,b$1,"granted");}catch(t){const i=t?.name;o$3(this,b$1,"NotAllowedError"===i?"denied":"blocked");}return r$2(this,b$1,"f")}select(t,i){r$2(this,y$1,"f")[t]=i;}async acquire(t){if(!r$2(this,v$1,"f")?.getUserMedia)throw a$1.from("deviceNotFound","This browser does not expose media devices.");const i={};t.audio&&(i.audio=!r$2(this,y$1,"f").audioinput||{deviceId:{exact:r$2(this,y$1,"f").audioinput}}),t.video&&(i.video=!r$2(this,y$1,"f").videoinput||{deviceId:{exact:r$2(this,y$1,"f").videoinput}});try{const e=await r$2(this,v$1,"f").getUserMedia(i);return o$3(this,b$1,"granted"),{audio:t.audio?e.getAudioTracks()[0]:void 0,video:t.video?e.getVideoTracks()[0]:void 0}}catch(t){const i=t?.name;throw "NotAllowedError"===i&&o$3(this,b$1,"denied"),"NotReadableError"!==i&&"SecurityError"!==i||o$3(this,b$1,"blocked"),function(t){const i=t?.name;return "NotAllowedError"===i||"SecurityError"===i?a$1.from("permissionDenied",void 0,t):a$1.from("deviceNotFound","NotFoundError"===i||"OverconstrainedError"===i?void 0:t?.message,t)}(t)}}async replace(t,i){const e="mic"===t,s="camera"===t;try{const t=await this.acquire({audio:e,video:s});return i?.stop(),e?t.audio:t.video}catch(t){if(!i||"ended"===i.readyState)return;return r$2(this,g,"f")?.warn?.("call-core: keeping current track after device switch failed",t),i}}static release(t){if(t)try{t.stop();}catch{}}}g=new WeakMap,v$1=new WeakMap,k$1=new WeakMap,y$1=new WeakMap,b$1=new WeakMap,M=new WeakMap,S=new WeakMap,T=new WeakMap;class Jt{constructor(){W.set(this,void 0),R.set(this,void 0);}connect(t,i){if(this.disconnect(),o$3(this,R,t),"undefined"==typeof EventSource)return;const e=new EventSource(t);o$3(this,W,e),e.onmessage=t=>{try{const e=JSON.parse(t.data);i("segment"in e?e.segment:e);}catch{}};}disconnect(){r$2(this,W,"f")?.close(),o$3(this,W,void 0);}get url(){return r$2(this,R,"f")}}W=new WeakMap,R=new WeakMap;class Yt{static isSupported(){return "undefined"!=typeof navigator&&!!navigator.mediaDevices?.getDisplayMedia}static async acquire(t={}){if(!Yt.isSupported())throw new Error("Screen sharing is not supported in this browser.");const i=await navigator.mediaDevices.getDisplayMedia({video:true,audio:t.audio??true}),e=i.getVideoTracks()[0];if(e)try{e.contentHint="detail";}catch{}return i}static release(t){if(t)for(const i of t.getTracks())try{i.stop();}catch{}}static onEnded(t,i){const e=t.getVideoTracks()[0];return e?(e.addEventListener("ended",i,{once:true}),()=>e.removeEventListener("ended",i)):()=>{}}}class $t{constructor(t,i={}){I.add(this),L.set(this,void 0),j.set(this,void 0),A.set(this,void 0),P.set(this,1),E.set(this,new Map),_.set(this,false),C.set(this,false),o$3(this,L,t),o$3(this,j,i);}get url(){return r$2(this,L,"f").url}get connected(){return r$2(this,C,"f")}connect(){const t=r$2(this,L,"f").WebSocketImpl??("undefined"!=typeof WebSocket?WebSocket:void 0);return t?new Promise(((i,e)=>{let s=false;const n=setTimeout((()=>{s||(s=true,this.close(),e(a$1.from("networkLost")));}),r$2(this,L,"f").requestTimeoutMs??15e3),h=new t(r$2(this,L,"f").url);o$3(this,A,h),h.onopen=()=>{o$3(this,C,true),s||(s=true,clearTimeout(n),i());},h.onmessage=t=>{r$2(this,I,"m",x).call(this,t.data);},h.onerror=()=>{s||(s=true,clearTimeout(n),e(a$1.from("networkLost")));},h.onclose=t=>{if(o$3(this,C,false),r$2(this,I,"m",D).call(this,a$1.from("networkLost")),!s)return s=true,clearTimeout(n),void e(a$1.from("networkLost"));r$2(this,_,"f")||r$2(this,j,"f").onClose?.(t.code,t.reason);};})):Promise.reject(new Error("call-core: WebSocket is not available in this environment."))}request(t,i={}){var e,s;if(1!==r$2(this,A,"f")?.readyState)return Promise.reject(a$1.from("networkLost"));const n=(o$3(this,P,(s=r$2(this,P,"f"),e=s++,s)),e),h=r$2(this,L,"f").requestTimeoutMs??15e3;return new Promise(((e,s)=>{const o=setTimeout((()=>{r$2(this,E,"f").delete(n),s(a$1.from("networkLost",`call-core: ${t} timed out`));}),h);r$2(this,E,"f").set(n,{resolve:t=>e(t),reject:s,timer:o}),r$2(this,I,"m",U).call(this,{jsonrpc:"2.0",id:n,method:t,params:i});}))}notify(t,i={}){r$2(this,I,"m",U).call(this,{jsonrpc:"2.0",method:t,params:i});}close(t=1e3){o$3(this,_,true),o$3(this,C,false),r$2(this,I,"m",D).call(this,a$1.from("networkLost"));const i=r$2(this,A,"f");if(o$3(this,A,void 0),i){i.onopen=i.onmessage=i.onerror=i.onclose=null;try{i.close(t);}catch{}}}}L=new WeakMap,j=new WeakMap,A=new WeakMap,P=new WeakMap,E=new WeakMap,_=new WeakMap,C=new WeakMap,I=new WeakSet,U=function(t){if(1===r$2(this,A,"f")?.readyState)try{r$2(this,A,"f").send(JSON.stringify(t));}catch(t){r$2(this,L,"f").logger?.warn?.("call-core: could not send signalling frame",t);}},x=function(t){let i;try{i=JSON.parse(t);}catch(t){return void r$2(this,L,"f").logger?.warn?.("call-core: ignoring malformed signalling frame",t)}if(void 0!==i.id){const t=r$2(this,E,"f").get(i.id);if(!t)return;return r$2(this,E,"f").delete(i.id),clearTimeout(t.timer),void(i.error?t.reject(r$2(this,I,"m",N).call(this,i.error)):t.resolve(i.result??{}))}i.method&&r$2(this,j,"f").onNotification?.(i.method,i.params??{});},N=function(t){return function(t){const i=(t.data?.reason??"").toLowerCase(),e=t.message;if("negotiation_in_progress"===i)return a$1.from("negotiationInProgress",e);switch(t.code){case 4401:return /expired/.test(i)?a$1.from("authExpired",e):a$1.from("authRejected",e);case 4403:return a$1.from("authRejected",e);case 4404:return a$1.from("sessionUnknown",e);case 4409:return a$1.from("sessionReplaced",e);case 4429:return a$1.from("rateLimited",e);case 4503:return /full/.test(i)?a$1.from("roomFull",e):a$1.from("roomEnded",e);case 4400:return a$1.from("invalidAction",e);case 4408:case 4500:return a$1.from("networkLost",e)}return "expired"===i?a$1.from("authExpired",e):"unknown_session"===i?a$1.from("sessionUnknown",e):"replaced"===i?a$1.from("sessionReplaced",e):"room_full"===i?a$1.from("roomFull",e):"room_closing"===i||"wrong_room"===i?a$1.from("roomEnded",e):"rate_limited"===i?a$1.from("rateLimited",e):"bad_signature"===i||"not_permitted"===i?a$1.from("authRejected",e):/expired/i.test(i)||-32001===t.code?a$1.from("authExpired",e):/token|auth|forbidden/i.test(i)||401===t.code||403===t.code?a$1.from("authRejected",e):/resume|not found|no such|unknown_session/i.test(i)||404===t.code||409===t.code?a$1.from("sessionUnknown",e):a$1.from("networkLost",e)}(t)},D=function(t){for(const i of r$2(this,E,"f").values())clearTimeout(i.timer),i.reject(t);r$2(this,E,"f").clear();};const zt=[{rid:"l",maxBitrate:15e4,scaleResolutionDownBy:4},{rid:"m",maxBitrate:5e5,scaleResolutionDownBy:2},{rid:"h",maxBitrate:15e5,scaleResolutionDownBy:1}],Gt=["l","m","h"];function Kt(t,i){return "screen"===t?"audio"===i?"screen-audio":"screen":"camera"===t?"camera":"microphone"===t?"mic":void 0}let Qt=0;function Xt(i){switch(i){case "admin":case "moderator":return {publishAudio:true,publishVideo:true,publishScreen:true,moderate:true};case "publisher":return {publishAudio:true,publishVideo:true,publishScreen:true,moderate:false};default:return {...t$1}}}class Zt{constructor(t={}){F.add(this),O.set(this,void 0),B.set(this,void 0),H.set(this,{}),q.set(this,"idle"),V.set(this,void 0),J.set(this,void 0),Y.set(this,void 0),$.set(this,void 0),z.set(this,void 0),G.set(this,false),K.set(this,new Map),Q.set(this,""),X.set(this,""),Z.set(this,"viewer"),tt.set(this,new Map),it.set(this,new Map),et.set(this,new Map),st.set(this,[]),nt.set(this,[]),at.set(this,[]),rt.set(this,Promise.resolve()),ot.set(this,new Set),ht.set(this,Promise.resolve()),ct.set(this,void 0),ft.set(this,false),dt.set(this,false),ut.set(this,void 0),lt.set(this,0),mt.set(this,0),pt.set(this,void 0),o$3(this,O,t),o$3(this,B,t.logger);}get status(){return r$2(this,q,"f")}get participantId(){return r$2(this,Q,"f")}get role(){return r$2(this,Z,"f")}get peerConnection(){return r$2(this,Y,"f")}async connect(t,i){o$3(this,V,t),o$3(this,H,i),o$3(this,ft,false),r$2(this,F,"m",Ft).call(this,"connecting");const e=r$2(this,F,"m",Wt).call(this,t.iceServers);if(!e)throw a$1.from("networkLost","call-core: RTCPeerConnection is not available.");o$3(this,Y,e);for(const[t,i]of r$2(this,K,"f"))"camera"!==t?(e.addTrack(i,new MediaStream([i])),"mic"===t&&o$3(this,$,e.getTransceivers().find((t=>t.sender.track===i)))):await r$2(this,F,"m",yt).call(this,i);r$2(this,$,"f")||o$3(this,$,e.addTransceiver("audio",{direction:"sendrecv"})),await e.setLocalDescription(await e.createOffer()),o$3(this,ht,new Promise((t=>{o$3(this,ct,t);})));const s=new $t({url:t.sfuUrl,logger:r$2(this,B,"f"),WebSocketImpl:r$2(this,O,"f").WebSocketImpl},{onNotification:(t,i)=>r$2(this,F,"m",At).call(this,t,i),onClose:(t,i)=>r$2(this,F,"m",Ut).call(this,t,i)});o$3(this,J,s),await s.connect();const n={token:t.token,offer:e.localDescription?.sdp??""};let h;try{h=await s.request("join",n);}catch(t){throw r$2(this,ct,"f")?.call(this),e.close(),o$3(this,Y,void 0),t}if(!h.answer)throw r$2(this,ct,"f")?.call(this),e.close(),o$3(this,Y,void 0),a$1.from("protocolMismatch","call-core: the SFU did not return an SDP answer.");if(o$3(this,dt,true),r$2(this,F,"m",wt).call(this,h),h.iceServers?.length&&"function"==typeof e.setConfiguration)try{e.setConfiguration({iceServers:h.iceServers});}catch(t){r$2(this,B,"f")?.warn?.("call-core: could not apply join-result ICE servers",t);}return await e.setRemoteDescription({type:"answer",sdp:h.answer}),r$2(this,ct,"f")?.call(this),r$2(this,F,"m",Ft).call(this,"connected"),r$2(this,F,"m",gt).call(this,h)}setInitialTracks(t){o$3(this,K,new Map(t.map((({source:t,track:i})=>[t,i]))));}async disconnect(){o$3(this,ft,true),r$2(this,ut,"f")&&clearTimeout(r$2(this,ut,"f")),r$2(this,pt,"f")&&clearTimeout(r$2(this,pt,"f")),o$3(this,ut,void 0),o$3(this,pt,void 0),r$2(this,J,"f")?.connected&&await r$2(this,J,"f").request("leave",{}).catch((()=>{})),r$2(this,J,"f")?.close(),o$3(this,J,void 0),r$2(this,Y,"f")?.close(),o$3(this,Y,void 0),o$3(this,$,void 0),o$3(this,z,void 0),o$3(this,G,false),r$2(this,K,"f").clear(),r$2(this,tt,"f").clear(),r$2(this,it,"f").clear(),r$2(this,et,"f").clear(),o$3(this,st,[]),r$2(this,nt,"f").splice(0).forEach((t=>clearTimeout(t.timer))),o$3(this,at,[]),o$3(this,dt,false),r$2(this,F,"m",Ft).call(this,"idle");}async publish(t){const i="local-track-"+ ++Qt,e={id:i,participantId:r$2(this,Q,"f"),source:t.source,kind:t.track.kind,muted:false,mediaStreamTrack:t.track,availableLayers:[],currentLayer:null,pinnedLayer:null,subscribed:true};r$2(this,tt,"f").set(i,e);const s=r$2(this,F,"m",_t).call(this,e.kind);if(r$2(this,K,"f").delete(t.source)){"camera"===t.source&&r$2(this,G,"f")&&(e.availableLayers=[...Gt]);try{e.id=await s,e.id!==i&&(r$2(this,tt,"f").delete(i),r$2(this,tt,"f").set(e.id,e)),await r$2(this,F,"m",bt).call(this,e.id,t.source);}catch(t){r$2(this,B,"f")?.warn?.("call-core: initial track was not announced",t);}return e}if("mic"===t.source&&r$2(this,$,"f"))await r$2(this,$,"f").sender.replaceTrack(t.track);else if("camera"===t.source&&r$2(this,Y,"f")){const{simulcast:i}=await r$2(this,F,"m",yt).call(this,t.track);i&&(e.availableLayers=[...Gt]);}else if("screen"===t.source&&r$2(this,Y,"f"))await r$2(this,F,"m",St).call(this,t.track);else if(r$2(this,Y,"f")){const i=r$2(this,Y,"f").addTrack(t.track,new MediaStream([t.track]));"mic"===t.source&&o$3(this,$,r$2(this,Y,"f").getTransceivers().find((t=>t.sender===i)));}try{await r$2(this,F,"m",It).call(this),e.id=await s,e.id!==i&&(r$2(this,tt,"f").delete(i),r$2(this,tt,"f").set(e.id,e)),await r$2(this,F,"m",bt).call(this,e.id,t.source);}catch(t){r$2(this,B,"f")?.warn?.("call-core: publish renegotiation failed",t);}return e}async unpublish(t){const i=r$2(this,tt,"f").get(t);if(i){if(r$2(this,Y,"f")){const t=r$2(this,Y,"f").getSenders().find((t=>t.track===i.mediaStreamTrack));t&&(t===r$2(this,$,"f")?.sender||t===r$2(this,z,"f")?.sender?await t.replaceTrack(null):r$2(this,Y,"f").removeTrack(t));try{await r$2(this,F,"m",It).call(this);}catch(t){r$2(this,B,"f")?.warn?.("call-core: unpublish renegotiation failed",t);}}i.mediaStreamTrack=void 0,r$2(this,tt,"f").delete(t),r$2(this,H,"f").onTrackUnpublished?.(t);}}async subscribe(t,i){const e=r$2(this,it,"f").get(t.id)??t;if(e.subscribed=true,i&&(e.pinnedLayer=i),r$2(this,J,"f")?.connected)try{await r$2(this,J,"f").request("subscribe",{trackId:t.id,...i?{layer:i}:{}});}catch(t){r$2(this,B,"f")?.warn?.("call-core: subscribe failed",t);}e.mediaStreamTrack&&r$2(this,H,"f").onTrackSubscribed?.({...e});}async unsubscribe(t){const i=r$2(this,it,"f").get(t);if(i&&(i.subscribed=false),r$2(this,J,"f")?.connected)try{await r$2(this,J,"f").request("unsubscribe",{trackId:t});}catch(t){r$2(this,B,"f")?.warn?.("call-core: unsubscribe failed",t);}}async setLayer(t,i){const e=r$2(this,it,"f").get(t);if(e&&(e.pinnedLayer=i),r$2(this,J,"f")?.connected)try{await r$2(this,J,"f").request("subscribe",{trackId:t,layer:i});}catch(t){r$2(this,B,"f")?.warn?.("call-core: layer selection failed",t);}}async setMuted(t,i){const e=r$2(this,tt,"f").get(t);if(e&&(e.muted=i),r$2(this,J,"f")?.connected)try{await r$2(this,J,"f").request(i?"mute":"unmute",{trackId:t});}catch(t){r$2(this,B,"f")?.warn?.("call-core: mute command failed",t);}}async setHandRaised(t){r$2(this,J,"f")?.connected&&await r$2(this,J,"f").request("raiseHand",{raised:t});}async setVisibleParticipants(t){}async promote(t,i){r$2(this,B,"f")?.debug?.("call-core: promotion is decided by the token issuer; refresh the token instead");}async demote(t){r$2(this,B,"f")?.debug?.("call-core: demotion is decided by the token issuer; refresh the token instead");}async muteRemote(t,i){r$2(this,J,"f")?.connected&&await r$2(this,J,"f").request("muteParticipant",{participantId:t});}async remove(t){r$2(this,J,"f")?.connected&&await r$2(this,J,"f").request("removeParticipant",{participantId:t});}async startTranscription(){await r$2(this,F,"m",Dt).call(this,"startTranscription");}async stopTranscription(){await r$2(this,F,"m",Dt).call(this,"stopTranscription");}async startRecording(){await r$2(this,F,"m",Dt).call(this,"startRecording");}async stopRecording(){await r$2(this,F,"m",Dt).call(this,"stopRecording");}async requestICERestart(){if(r$2(this,Y,"f"))try{r$2(this,Y,"f").restartIce?.(),await r$2(this,F,"m",It).call(this);}catch(t){r$2(this,B,"f")?.warn?.("call-core: ICE restart failed",t),r$2(this,H,"f").onError?.(a$1.from("iceFailed"),false);}}async updateToken(t){if(!r$2(this,V,"f"))return;const i=r$2(this,V,"f");if(o$3(this,V,{...r$2(this,V,"f"),token:t}),r$2(this,J,"f")?.connected)try{return void await r$2(this,J,"f").request("refreshToken",{token:t})}catch(t){r$2(this,B,"f")?.warn?.("call-core: refreshToken failed; resuming with the new token",t);}r$2(this,J,"f")?.close(),o$3(this,J,void 0);try{await r$2(this,F,"m",Nt).call(this);}catch(t){o$3(this,V,i),r$2(this,H,"f").onError?.(t instanceof a$1?t:a$1.from("authRejected"),true),r$2(this,F,"m",Ft).call(this,"failed");}}}var ti,ii,ei,si,ni,ai,ri,oi,hi,ci,fi,di,ui,li,mi,pi,wi,gi,vi,ki,yi,bi,Mi,Si,Ti,Wi,Ri,Ii,Li,ji,Ai,Pi,Ei,_i,Ci,Ui,xi,Ni,Di,Fi,Oi,Bi,Hi,qi,Vi,Ji,Yi,$i,zi,Gi;O=new WeakMap,B=new WeakMap,H=new WeakMap,q=new WeakMap,V=new WeakMap,J=new WeakMap,Y=new WeakMap,$=new WeakMap,z=new WeakMap,G=new WeakMap,K=new WeakMap,Q=new WeakMap,X=new WeakMap,Z=new WeakMap,tt=new WeakMap,it=new WeakMap,et=new WeakMap,st=new WeakMap,nt=new WeakMap,at=new WeakMap,rt=new WeakMap,ot=new WeakMap,ht=new WeakMap,ct=new WeakMap,ft=new WeakMap,dt=new WeakMap,ut=new WeakMap,lt=new WeakMap,mt=new WeakMap,pt=new WeakMap,F=new WeakSet,wt=function(t){o$3(this,Q,t.participantId),o$3(this,X,t.resumeSecret),o$3(this,Z,t.role),r$2(this,et,"f").clear(),r$2(this,it,"f").clear(),o$3(this,st,[]);for(const i of t.participants){const t=r$2(this,F,"m",vt).call(this,i);t.isLocal=i.participantId===r$2(this,Q,"f"),r$2(this,et,"f").set(t.id,t);}if(!r$2(this,et,"f").has(r$2(this,Q,"f"))){const i=r$2(this,F,"m",vt).call(this,{participantId:r$2(this,Q,"f"),displayName:"",role:t.role});i.isLocal=true,r$2(this,et,"f").set(i.id,i);}for(const i of t.tracks)r$2(this,F,"m",kt).call(this,i);t.roomState?.transcription&&r$2(this,H,"f").onTranscriptionState?.(true),r$2(this,H,"f").onRecordingState?.(!!t.roomState?.recording);},gt=function(t){const i=Array.from(r$2(this,et,"f").values()).map((t=>({...t,tracks:t.tracks.map((t=>({...t})))}))),e=i.find((t=>t.id===r$2(this,Q,"f")));return {participantId:r$2(this,Q,"f"),capabilities:e?.capabilities??Xt(r$2(this,Z,"f")),participants:i,tracks:i.flatMap((t=>t.tracks)),iceServers:t.iceServers}},vt=function(t){return {id:t.participantId,userId:t.userId??t.participantId,kind:"agent"===t.kind?"agent":"human",isLocal:t.participantId===r$2(this,Q,"f"),capabilities:Xt(t.role),tracks:[],audioLevel:0,speaking:false,handRaised:false,connection:"connected",displayName:t.displayName}},kt=function(i){const e=r$2(this,it,"f").get(i.trackId);if(e){e.muted=i.muted,i.layers&&(e.availableLayers=[...i.layers]);const t=Kt(i.source,i.kind);return t&&(e.source=t),e}const s=i.kind,n=Kt(i.source,s)??("audio"===s?"mic":"camera"),a={id:i.trackId,participantId:i.ownerId,source:n,kind:s,muted:i.muted,availableLayers:i.layers?[...i.layers]:[],currentLayer:null,pinnedLayer:null,subscribed:true};r$2(this,it,"f").set(a.id,a);let o=r$2(this,et,"f").get(i.ownerId);return o||i.ownerId===r$2(this,Q,"f")||(o={id:i.ownerId,kind:"human",isLocal:false,capabilities:{...t$1},tracks:[],audioLevel:0,speaking:false,handRaised:false,connection:"connected"},r$2(this,et,"f").set(o.id,o),r$2(this,H,"f").onParticipantJoined?.({...o,tracks:[]})),o&&!o.isLocal&&(o.tracks=[...o.tracks,a],r$2(this,st,"f").push(a),r$2(this,H,"f").onTrackPublished?.({...a})),a},yt=async function(t){const i=r$2(this,Y,"f");if(!i)return {simulcast:false};if(r$2(this,z,"f"))return await r$2(this,z,"f").sender.replaceTrack(t),{simulcast:r$2(this,G,"f")};try{const e=i.addTransceiver(t,{direction:"sendonly",sendEncodings:zt});return o$3(this,z,e),o$3(this,G,true),r$2(this,F,"m",Tt).call(this,e),{simulcast:true}}catch(e){r$2(this,B,"f")?.warn?.("call-core: simulcast encodings rejected; publishing one camera layer",e);const s=i.addTrack(t,new MediaStream([t]));return o$3(this,z,i.getTransceivers().find((t=>t.sender===s))),o$3(this,G,false),{simulcast:false}}},bt=async function(t,i){if("screen"===i&&r$2(this,J,"f")?.connected)try{await r$2(this,J,"f").request("setTrackSource",{trackId:t,source:"screen"});}catch(t){r$2(this,B,"f")?.warn?.("call-core: setTrackSource failed; the SFU will treat the track as camera",t);}},Mt=function(t,i){const e=r$2(this,it,"f").get(t)??r$2(this,tt,"f").get(t);if(!e)return;const s=Kt(i,e.kind);if(!s||s===e.source)return;e.source=s;const n=e.participantId?r$2(this,et,"f").get(e.participantId):void 0;n&&(n.tracks=n.tracks.map((i=>i.id===t?e:i))),r$2(this,H,"f").onTrackSourceChanged?.(t,s);},St=async function(t){const i=r$2(this,Y,"f");if(!i)return {temporal:false};try{t.contentHint="detail";}catch(t){r$2(this,B,"f")?.debug?.("call-core: could not set screen contentHint",t);}try{const e=i.addTransceiver(t,{direction:"sendonly",streams:[new MediaStream([t])],sendEncodings:[{scalabilityMode:"L1T3",maxBitrate:15e5}]});return r$2(this,F,"m",Tt).call(this,e),{temporal:true}}catch(e){r$2(this,B,"f")?.warn?.("call-core: temporal screen encoding rejected; publishing a plain screen sender",e);try{i.addTrack(t,new MediaStream([t]));}catch(t){r$2(this,B,"f")?.warn?.("call-core: could not publish the screen track",t);}return {temporal:false}}},Tt=function(t){try{const i="undefined"!=typeof RTCRtpSender?RTCRtpSender.getCapabilities?.("video"):void 0,e=i?.codecs.filter((t=>"video/vp8"===t.mimeType.toLowerCase()))??[];e.length>0&&t.setCodecPreferences?.(e);}catch(t){r$2(this,B,"f")?.debug?.("call-core: could not set VP8 codec preference",t);}},Wt=function(t=[]){const i=r$2(this,O,"f").createPeerConnection??("undefined"!=typeof RTCPeerConnection?t=>new RTCPeerConnection(t):void 0);if(!i)return;const e=i({iceServers:t});return e.onicecandidate=t=>{r$2(this,dt,"f")&&r$2(this,J,"f")?.notify("candidate",{candidate:t.candidate?.candidate??null,sdpMid:t.candidate?.sdpMid??null,sdpMLineIndex:t.candidate?.sdpMLineIndex??null});},e.ontrack=t=>r$2(this,F,"m",Rt).call(this,t),e.onconnectionstatechange=()=>{const t=e.connectionState;"failed"===t?(r$2(this,H,"f").onError?.(a$1.from("iceFailed"),false),r$2(this,F,"m",Ft).call(this,"reconnecting"),this.requestICERestart()):"disconnected"===t?(r$2(this,F,"m",Ft).call(this,"reconnecting"),r$2(this,pt,"f")||o$3(this,pt,setTimeout((()=>{o$3(this,pt,void 0),"connected"!==r$2(this,Y,"f")?.connectionState&&this.requestICERestart();}),5e3))):"connected"===t&&(r$2(this,pt,"f")&&clearTimeout(r$2(this,pt,"f")),o$3(this,pt,void 0),"reconnecting"===r$2(this,q,"f")&&r$2(this,J,"f")?.connected&&r$2(this,F,"m",Ft).call(this,"connected"));},e},Rt=function(t){const i=r$2(this,st,"f").findIndex((i=>i.kind===t.track.kind&&!i.mediaStreamTrack));if(i<0)return void r$2(this,B,"f")?.debug?.("call-core: ignoring unannounced remote track",t.track.kind);const[e]=r$2(this,st,"f").splice(i,1);e.mediaStreamTrack=t.track,e.subscribed=true,t.track.onended=()=>{r$2(this,H,"f").onTrackUnpublished?.(e.id),r$2(this,it,"f").delete(e.id);const t=r$2(this,et,"f").get(e.participantId);t&&(t.tracks=t.tracks.filter((t=>t.id!==e.id)));},r$2(this,H,"f").onTrackSubscribed?.({...e});},It=async function t(i=4){const e=r$2(this,Y,"f");if(!e||!r$2(this,J,"f"))return;let s=false;o$3(this,rt,r$2(this,rt,"f").then((async()=>{if("closed"===e.signalingState||!r$2(this,J,"f"))return;if("stable"!==e.signalingState)return;const t=await e.createOffer();let i;await e.setLocalDescription(t);try{i=await r$2(this,J,"f").request("offer",{sdp:t.sdp??""});}catch(t){if(t instanceof a$1&&"negotiation_in_progress"===t.code)return s=true,void await e.setLocalDescription({type:"rollback"}).catch((()=>{}));throw t}i?.sdp&&await e.setRemoteDescription({type:"answer",sdp:i.sdp});})).catch((t=>{r$2(this,B,"f")?.warn?.("call-core: renegotiation failed",t);}))),await r$2(this,rt,"f"),s&&i>0&&(await r$2(this,F,"m",Lt).call(this,1500),await r$2(this,F,"m",t).call(this,i-1));},Lt=function(t){return new Promise((i=>{const e=()=>{clearTimeout(s),r$2(this,ot,"f").delete(e),i();},s=setTimeout(e,t);r$2(this,ot,"f").add(e);}))},jt=async function(t){await r$2(this,ht,"f");const i=r$2(this,Y,"f");if(!i)return;const e=String(t.negotiationId??""),s=String(t.sdp??"");o$3(this,rt,r$2(this,rt,"f").then((async()=>{if("stable"!==i.signalingState)try{await i.setLocalDescription({type:"rollback"});}catch{}await i.setRemoteDescription({type:"offer",sdp:s}),await i.setLocalDescription(await i.createAnswer()),await r$2(this,J,"f").request("answer",{negotiationId:e,sdp:i.localDescription?.sdp??""});})).catch((t=>{r$2(this,B,"f")?.warn?.("call-core: could not answer server offer",t);}))),await r$2(this,rt,"f");for(const t of Array.from(r$2(this,ot,"f")))t();},At=function(t,i){switch(t){case "offer":r$2(this,F,"m",jt).call(this,i);break;case "candidate":r$2(this,Y,"f")&&null!=i.candidate&&r$2(this,Y,"f").addIceCandidate({candidate:String(i.candidate),sdpMid:i.sdpMid??null,sdpMLineIndex:i.sdpMLineIndex??null}).catch((t=>r$2(this,B,"f")?.warn?.("call-core: could not add server candidate",t)));break;case "trackPublished":r$2(this,F,"m",Pt).call(this,i.track);break;case "trackUnpublished":r$2(this,F,"m",Et).call(this,String(i.trackId??""));break;case "trackMuted":{const t=String(i.trackId??""),e=!!i.muted,s=r$2(this,it,"f").get(t)??r$2(this,tt,"f").get(t);s&&(s.muted=e),r$2(this,H,"f").onTrackMuted?.(t,e);break}case "layerChanged":{const t=i,e=r$2(this,it,"f").get(t.trackId);if(!e)break;e.currentLayer=t.layer,e.layerReason=t.reason,r$2(this,H,"f").onLayerChanged?.(t.trackId,t.layer,t.reason);break}case "trackSourceChanged":{const t=i;r$2(this,F,"m",Mt).call(this,t.trackId,t.source);break}case "handRaised":{const t=String(i.participantId??""),e=!!i.raised,s=r$2(this,et,"f").get(t);if(!s)break;s.handRaised=e,r$2(this,H,"f").onParticipantUpdated?.({...s,tracks:s.tracks.map((t=>({...t})))});break}case "participantUpdated":{const t=i.participant,e=t?.participantId??String(i.participantId??""),s=r$2(this,et,"f").get(e);if(!s)break;t?(s.userId=t.userId??s.userId,s.kind="agent"===t.kind?"agent":"human",s.displayName=t.displayName||s.displayName,s.capabilities=Xt(t.role),e===r$2(this,Q,"f")&&o$3(this,Z,t.role)):"string"==typeof i.role&&(s.capabilities=Xt(i.role),e===r$2(this,Q,"f")&&o$3(this,Z,i.role)),r$2(this,H,"f").onParticipantUpdated?.({...s,tracks:s.tracks.map((t=>({...t})))});break}case "participantJoined":{const t=i.participant,e=r$2(this,F,"m",vt).call(this,t),s=r$2(this,et,"f").get(e.id);s?(e.tracks=s.tracks,r$2(this,et,"f").set(e.id,e),r$2(this,H,"f").onParticipantUpdated?.({...e})):(r$2(this,et,"f").set(e.id,e),r$2(this,H,"f").onParticipantJoined?.({...e,tracks:[]}));break}case "participantLeft":{const t=String(i.participantId??"");for(const i of r$2(this,it,"f").values())i.participantId===t&&r$2(this,it,"f").delete(i.id);r$2(this,et,"f").delete(t),r$2(this,H,"f").onParticipantLeft?.(t);break}case "activeSpeaker":{const t=i.participantId?String(i.participantId):null,e={};for(const i of r$2(this,et,"f").keys())e[i]=i===t?1:0;r$2(this,H,"f").onAudioLevels?.(e);break}case "roomState":r$2(this,H,"f").onTranscriptionState?.(!!i.transcription),r$2(this,H,"f").onRecordingState?.(!!i.recording);break;case "transcript":{const t=i;r$2(this,H,"f").onTranscript?.({id:t.segmentId,participantId:t.participantId,text:t.text,final:t.final,startMs:Date.parse(t.start)||0,endMs:Date.parse(t.end)||0,language:t.language||"en"});break}case "tokenExpiring":r$2(this,H,"f").onError?.(a$1.from("authExpired"),false);break;case "roomClosing":r$2(this,H,"f").onError?.(a$1.from("roomEnded","The room is closing."),true),r$2(this,F,"m",Ft).call(this,"failed");break;case "error":{const t=String(i.reason??i.message??"Signalling error");r$2(this,H,"f").onError?.(a$1.from("networkLost",t),false);break}default:r$2(this,B,"f")?.debug?.("call-core: ignoring unknown signalling notification",t);}},Pt=function(t){t&&(t.ownerId!==r$2(this,Q,"f")?r$2(this,F,"m",kt).call(this,t):r$2(this,F,"m",Ct).call(this,t.trackId,t.kind));},Et=function(t){r$2(this,it,"f").delete(t);for(const i of r$2(this,et,"f").values())i.tracks.some((i=>i.id===t))&&(i.tracks=i.tracks.filter((i=>i.id!==t)));o$3(this,st,r$2(this,st,"f").filter((i=>i.id!==t))),r$2(this,H,"f").onTrackUnpublished?.(t);},_t=function(t){const i=r$2(this,at,"f").findIndex((i=>i.kind===t));if(i>=0){const[t]=r$2(this,at,"f").splice(i,1);return Promise.resolve(t.trackId)}return new Promise((i=>{const e=setTimeout((()=>{o$3(this,nt,r$2(this,nt,"f").filter((t=>t.timer!==e))),r$2(this,B,"f")?.warn?.("call-core: SFU did not announce a local track in time"),i(`pending-${t}-${Date.now()}`);}),6e3);r$2(this,nt,"f").push({kind:t,resolve:i,timer:e});}))},Ct=function(t,i){const e=r$2(this,nt,"f").findIndex((t=>t.kind===i));if(e<0)return void r$2(this,at,"f").push({kind:i,trackId:t});const[s]=r$2(this,nt,"f").splice(e,1);clearTimeout(s.timer),s.resolve(t);},Ut=function(t,i){if(r$2(this,ft,"f"))return;r$2(this,B,"f")?.warn?.("call-core: signalling socket closed",t,i);const e=(()=>{const e=i.toLowerCase();switch(t){case 1e3:return a$1.from("roomEnded",i||void 0);case 4401:return /expired/.test(e)?a$1.from("authExpired",i||void 0):a$1.from("authRejected",i||void 0);case 4403:return a$1.from("authRejected",i||void 0);case 4404:return a$1.from("sessionUnknown",i||void 0);case 4409:return a$1.from("sessionReplaced",i||void 0);case 4429:return a$1.from("rateLimited",i||void 0);case 4503:return /full/.test(e)?a$1.from("roomFull",i||void 0):a$1.from("roomEnded",i||void 0);default:return null}})();if(e){const t=!e.recoverable;if(r$2(this,H,"f").onError?.(e,t),t)return void r$2(this,F,"m",Ft).call(this,"failed");if("session_unknown"===e.code||"auth_expired"===e.code)return void r$2(this,F,"m",Ft).call(this,"reconnecting")}r$2(this,F,"m",Ft).call(this,"reconnecting"),o$3(this,mt,0),o$3(this,lt,Date.now()),r$2(this,F,"m",xt).call(this);},xt=function t(){if(r$2(this,ft,"f"))return;if(Date.now()-r$2(this,lt,"f")>=r$2(this,F,"m",Ot).call(this))return r$2(this,F,"m",Ft).call(this,"failed"),void r$2(this,H,"f").onError?.(a$1.from("networkFailed"),false);const i=Math.min(8e3,500*2**r$2(this,mt,"f"))*(.5+.5*Math.random());o$3(this,mt,r$2(this,mt,"f")+1),o$3(this,ut,setTimeout((()=>{o$3(this,ut,void 0),r$2(this,F,"m",Nt).call(this).catch((i=>(r$2(this,B,"f")?.warn?.("call-core: resume failed",i),i instanceof a$1&&("authRejected"===i.code||"roomEnded"===i.code||"sessionReplaced"===i.code)?(r$2(this,F,"m",Ft).call(this,"failed"),void r$2(this,H,"f").onError?.(i,true)):i instanceof a$1&&"session_unknown"===i.code?(r$2(this,F,"m",Ft).call(this,"reconnecting"),void r$2(this,H,"f").onError?.(i,false)):void r$2(this,F,"m",t).call(this))));}),i));},Nt=async function(){if(r$2(this,ft,"f")||!r$2(this,V,"f")||!r$2(this,Q,"f")||!r$2(this,X,"f"))throw a$1.from("networkLost");r$2(this,J,"f")?.close();const t=new $t({url:r$2(this,V,"f").sfuUrl,logger:r$2(this,B,"f"),WebSocketImpl:r$2(this,O,"f").WebSocketImpl},{onNotification:(t,i)=>r$2(this,F,"m",At).call(this,t,i),onClose:(t,i)=>r$2(this,F,"m",Ut).call(this,t,i)});o$3(this,J,t),await t.connect();const i=await t.request("join",{token:r$2(this,V,"f").token,resume:{participantId:r$2(this,Q,"f"),resumeSecret:r$2(this,X,"f")}});for(const t of i.participants){const i=r$2(this,F,"m",vt).call(this,t);r$2(this,et,"f").set(i.id,i),r$2(this,H,"f").onParticipantUpdated?.({...i,tracks:[]});}for(const t of i.tracks)r$2(this,F,"m",kt).call(this,t);r$2(this,F,"m",Ft).call(this,"connected");},Dt=async function(t){if(!r$2(this,J,"f")?.connected)throw a$1.from("invalidAction","Not connected to the call server.");await r$2(this,J,"f").request(t,{});},Ft=function(t){r$2(this,q,"f")!==t&&(o$3(this,q,t),r$2(this,H,"f").onStatus?.(t));},Ot=function(){return r$2(this,O,"f").reconnectTimeoutMs??3e4};const Ki={status:"idle",mode:null,roomId:null,sfuUrl:null,localParticipantId:null,participants:[],activeSpeakerId:null,pinnedId:null,visibleParticipantIds:[],transcriptionRunning:false,recordingRunning:false,transcript:[],audioBlocked:false,handRaised:false,sharingId:null,notice:null,error:null,migratingTo:null};class Qi{constructor(t={}){ti.add(this),ii.set(this,void 0),ei.set(this,void 0),si.set(this,void 0),ni.set(this,void 0),ai.set(this,void 0),ri.set(this,void 0),oi.set(this,void 0),hi.set(this,void 0),ci.set(this,void 0),fi.set(this,void 0),di.set(this,new Map),ui.set(this,new Map),li.set(this,new Map),mi.set(this,false),this.store=new Bt({...Ki}),this.strings=e$2(t.strings),this.config={...s,...t.config??{}},o$3(this,ii,t.identity),o$3(this,si,t.logger),o$3(this,ri,t.getToken),o$3(this,oi,t.promote),o$3(this,hi,t.demote),o$3(this,ei,t.transport??new Zt({logger:t.logger})),o$3(this,ni,new Vt({logger:t.logger})),o$3(this,ai,new qt(this.config)),o$3(this,ci,t.transcript??new Jt);}get transport(){return r$2(this,ei,"f")}get devices(){return r$2(this,ni,"f")}async prepare(){if("idle"!==this.store.getState().status)throw a$1.from("invalidAction","The room is already prepared.");r$2(this,ti,"m",$i).call(this,"lobby"),await r$2(this,ni,"f").start();}async startPreview(t={}){if("lobby"!==this.store.getState().status)throw a$1.from("invalidAction","Preview is only available in the lobby.");await r$2(this,ti,"m",ki).call(this,"mic",!!t.audio),await r$2(this,ti,"m",ki).call(this,"camera",!!t.video);}async join(t){const i=this.store.getState().status;if("idle"!==i&&"lobby"!==i&&"failed"!==i)throw a$1.from("invalidAction","The room is already joined.");o$3(this,fi,t),r$2(this,ti,"m",$i).call(this,"connecting"),r$2(this,ti,"m",zi).call(this,{mode:t.mode,roomId:t.roomId,sfuUrl:t.sfuUrl,error:null,notice:null}),await r$2(this,ti,"m",pi).call(this,t);}async leave(){const t=this.store.getState().status;if("idle"!==t&&"ended"!==t){r$2(this,ti,"m",$i).call(this,"ended");for(const t of r$2(this,di,"f").values())t.track.stop();r$2(this,di,"f").clear(),await(r$2(this,ci,"f").disconnect?.()),r$2(this,ni,"f").stop();try{await r$2(this,ei,"f").disconnect();}catch(t){r$2(this,si,"f")?.warn?.("call-core: transport disconnect failed",t);}r$2(this,ai,"f").reset(),r$2(this,ui,"f").clear(),r$2(this,ti,"m",zi).call(this,{participants:[],activeSpeakerId:null,sharingId:null,visibleParticipantIds:[],handRaised:false,transcriptionRunning:false,recordingRunning:false,transcript:[],localParticipantId:null});}}async rejoin(){if(!r$2(this,fi,"f"))throw a$1.from("invalidAction","There is no call to rejoin.");await this.join(r$2(this,fi,"f"));}async refreshToken(){if(!r$2(this,ri,"f")||!r$2(this,fi,"f"))throw a$1.from("invalidAction","No token source for this call.");const t=await r$2(this,ri,"f").call(this,r$2(this,fi,"f"));o$3(this,fi,{...r$2(this,fi,"f"),token:t.token,sfuUrl:t.sfuUrl??r$2(this,fi,"f").sfuUrl,iceServers:t.iceServers??r$2(this,fi,"f").iceServers});try{r$2(this,ei,"f").updateToken&&await r$2(this,ei,"f").updateToken(t.token);}catch(t){const i=a$1.from("authRejected",void 0,t);throw r$2(this,ti,"m",zi).call(this,{error:i.toInfo()}),r$2(this,ti,"m",$i).call(this,"failed"),r$2(this,ti,"m",Gi).call(this,"error",i.toInfo()),i}}async setMicEnabled(t){r$2(this,ti,"m",Yi).call(this,"publishAudio");const i=r$2(this,di,"f").get("mic");if(t){if(!i){const t=r$2(this,ti,"m",Di).call(this,"mic");if(t)return await r$2(this,ei,"f").setMuted(t.id,false),void r$2(this,ti,"m",qi).call(this,t.id,{muted:false});const i=await r$2(this,ti,"m",yi).call(this,"mic");if(!i)return;return void await r$2(this,ti,"m",gi).call(this,"mic",i)}return i.track.enabled=true,i.trackId&&await r$2(this,ei,"f").setMuted(i.trackId,false),void r$2(this,ti,"m",Ji).call(this,"mic",{muted:false})}if(i)i.track.enabled=false,i.trackId&&await r$2(this,ei,"f").setMuted(i.trackId,true),r$2(this,ti,"m",Ji).call(this,"mic",{muted:true});else {const t=r$2(this,ti,"m",Di).call(this,"mic");t&&(await r$2(this,ei,"f").setMuted(t.id,true),r$2(this,ti,"m",qi).call(this,t.id,{muted:true}));}}async setCameraEnabled(t){r$2(this,ti,"m",Yi).call(this,"publishVideo");const i=r$2(this,di,"f").get("camera");if(t){if(i)return;const t=r$2(this,ti,"m",Di).call(this,"camera");if(t?.mediaStreamTrack)return;const e=await r$2(this,ti,"m",yi).call(this,"camera");e&&await r$2(this,ti,"m",gi).call(this,"camera",e);}else if(i)await r$2(this,ti,"m",vi).call(this,"camera"),i.track.stop();else {const t=r$2(this,ti,"m",Di).call(this,"camera");t&&(await r$2(this,ei,"f").unpublish(t.id),r$2(this,ti,"m",Vi).call(this,t.id));}}async startScreenShare(){if(r$2(this,ti,"m",Yi).call(this,"publishScreen"),this.store.getState().sharingId)throw a$1.from("shareAlreadyActive");if(!Yt.isSupported())throw a$1.from("shareUnsupported");let t;try{t=await Yt.acquire({audio:true});}catch(t){throw a$1.from("permissionDenied",void 0,t)}const i=t.getVideoTracks()[0];if(!i)throw a$1.from("shareUnsupported");await r$2(this,ti,"m",gi).call(this,"screen",i,"video");const e=t.getAudioTracks()[0];e&&await r$2(this,ti,"m",gi).call(this,"screen-audio",e,"audio"),Yt.onEnded(t,(()=>{this.stopScreenShare();}));const s=this.store.getState().localParticipantId;r$2(this,ti,"m",zi).call(this,{sharingId:s});}async stopScreenShare(){const t=r$2(this,di,"f").get("screen"),i=r$2(this,di,"f").get("screen-audio");(t||i)&&(t&&(await r$2(this,ti,"m",vi).call(this,"screen"),t.track.stop()),i&&(await r$2(this,ti,"m",vi).call(this,"screen-audio"),i.track.stop()),r$2(this,ti,"m",zi).call(this,{sharingId:null}));}async selectDevice(t,i){r$2(this,ni,"f").select(t,i);const e="audioinput"===t?"mic":"videoinput"===t?"camera":null;if(!e)return;const s=r$2(this,di,"f").get(e);if(s)try{const t=await r$2(this,ni,"f").replace(e,s.track);if(!t)return;s.trackId&&await r$2(this,ei,"f").unpublish(s.trackId),s.trackId=void 0,s.track=t,await r$2(this,ti,"m",gi).call(this,e,t,"mic"===e?"audio":"video");}catch(t){r$2(this,ti,"m",zi).call(this,{notice:this.strings.deviceFallback}),r$2(this,si,"f")?.warn?.("call-core: device switch failed",t);}}async setHandRaised(t){await r$2(this,ei,"f").setHandRaised(t),r$2(this,ti,"m",zi).call(this,{handRaised:t}),r$2(this,ti,"m",Bi).call(this,this.store.getState().localParticipantId,{handRaised:t});}pin(t){r$2(this,ti,"m",zi).call(this,{pinnedId:t});}async setLayer(t,i){const e=r$2(this,ti,"m",Oi).call(this,t);e&&e.pinnedLayer!==i&&(r$2(this,ti,"m",qi).call(this,t,{pinnedLayer:i}),e.subscribed&&await r$2(this,ei,"f").setLayer(t,i));}async setVisibleParticipants(t){if(r$2(this,ti,"m",zi).call(this,{visibleParticipantIds:[...t]}),await r$2(this,ei,"f").setVisibleParticipants(t),"connected"!==this.store.getState().status)return;const i=new Set(t);for(const t of this.store.getState().participants)if(!t.isLocal)for(const e of t.tracks)"video"===e.kind&&(i.has(t.id)?e.subscribed||await r$2(this,ti,"m",Ni).call(this,e):e.subscribed&&(await r$2(this,ei,"f").unsubscribe(e.id),r$2(this,ti,"m",qi).call(this,e.id,{subscribed:false,mediaStreamTrack:void 0})));}async promote(t,i){r$2(this,ti,"m",Yi).call(this,"moderate"),r$2(this,oi,"f")?await r$2(this,oi,"f").call(this,t,i,r$2(this,ti,"m",Fi).call(this,t)):await r$2(this,ei,"f").promote(t,i),r$2(this,ti,"m",Bi).call(this,t,{capabilities:i});}async demote(i){r$2(this,ti,"m",Yi).call(this,"moderate"),r$2(this,hi,"f")?await r$2(this,hi,"f").call(this,i,r$2(this,ti,"m",Fi).call(this,i)):await r$2(this,ei,"f").demote(i),r$2(this,ti,"m",Bi).call(this,i,{capabilities:{...t$1}});}async muteRemote(t,i="mic"){r$2(this,ti,"m",Yi).call(this,"moderate"),await r$2(this,ei,"f").muteRemote(t,i);const e=r$2(this,ti,"m",Fi).call(this,t),s=e?.tracks.find((t=>t.source===i));s&&r$2(this,ti,"m",qi).call(this,s.id,{muted:true});}async remove(t){r$2(this,ti,"m",Yi).call(this,"moderate"),await r$2(this,ei,"f").remove(t),r$2(this,ti,"m",Ti).call(this,t);}async startTranscription(){r$2(this,ti,"m",Yi).call(this,"moderate"),await r$2(this,ei,"f").startTranscription(),r$2(this,ti,"m",zi).call(this,{transcriptionRunning:true});}async stopTranscription(){r$2(this,ti,"m",Yi).call(this,"moderate"),await r$2(this,ei,"f").stopTranscription(),r$2(this,ti,"m",zi).call(this,{transcriptionRunning:false});}async startRecording(){r$2(this,ti,"m",Yi).call(this,"moderate"),await r$2(this,ei,"f").startRecording(),r$2(this,ti,"m",zi).call(this,{recordingRunning:true});}async stopRecording(){r$2(this,ti,"m",Yi).call(this,"moderate"),await r$2(this,ei,"f").stopRecording(),r$2(this,ti,"m",zi).call(this,{recordingRunning:false});}setRecordingRunning(t){r$2(this,ti,"m",zi).call(this,{recordingRunning:t});}notifyAudioBlocked(){this.store.getState().audioBlocked||(r$2(this,ti,"m",zi).call(this,{audioBlocked:true}),r$2(this,ti,"m",Gi).call(this,"audioBlocked",true));}resumeAudio(){r$2(this,ti,"m",zi).call(this,{audioBlocked:false}),r$2(this,ti,"m",Gi).call(this,"resumeAudio");}getState(){return this.store.getState()}localParticipant(){return r$2(this,ti,"m",Fi).call(this,this.store.getState().localParticipantId)}audioLevel(t){return r$2(this,ui,"f").get(t)??0}remoteAudioTracks(){const t=[];for(const i of this.store.getState().participants)if(!i.isLocal)for(const e of i.tracks)"audio"===e.kind&&e.mediaStreamTrack&&!e.muted&&t.push(e.mediaStreamTrack);return t}localPreviewStream(){if("undefined"==typeof MediaStream)return null;const t=Array.from(r$2(this,di,"f").values()).map((t=>t.track)).filter((t=>"ended"!==t.readyState));return t.length?new MediaStream(t):null}on(t,i){let e=r$2(this,li,"f").get(t);return e||(e=new Set,r$2(this,li,"f").set(t,e)),e.add(i),()=>e?.delete(i)}setIdentityResolver(t){o$3(this,ii,t);}setTranscriptSource(t){o$3(this,ci,t);}connectTranscript(t){r$2(this,ci,"f").connect(t,(t=>r$2(this,ti,"m",Ei).call(this,t)));}get transcriptSegments(){return this.store.getState().transcript}}function Xi(t={}){return new Qi(t)}ii=new WeakMap,ei=new WeakMap,si=new WeakMap,ni=new WeakMap,ai=new WeakMap,ri=new WeakMap,oi=new WeakMap,hi=new WeakMap,ci=new WeakMap,fi=new WeakMap,di=new WeakMap,ui=new WeakMap,li=new WeakMap,mi=new WeakMap,ti=new WeakSet,pi=async function t(i){const e={onParticipantJoined:t=>r$2(this,ti,"m",bi).call(this,t),onParticipantLeft:t=>r$2(this,ti,"m",Ti).call(this,t),onParticipantUpdated:t=>r$2(this,ti,"m",Mi).call(this,t),onTrackPublished:t=>r$2(this,ti,"m",Wi).call(this,t),onTrackUnpublished:t=>r$2(this,ti,"m",Ri).call(this,t),onTrackMuted:(t,i)=>r$2(this,ti,"m",qi).call(this,t,{muted:i}),onLayerChanged:(t,i,e)=>r$2(this,ti,"m",Li).call(this,t,i,e),onTrackSourceChanged:(t,i)=>r$2(this,ti,"m",ji).call(this,t,i),onTrackSubscribed:t=>r$2(this,ti,"m",Ii).call(this,t),onAudioLevels:t=>r$2(this,ti,"m",Ai).call(this,t),onTranscriptionState:t=>r$2(this,ti,"m",zi).call(this,{transcriptionRunning:t}),onAgentState:(t,i)=>r$2(this,ti,"m",Pi).call(this,t,i),onTranscript:t=>r$2(this,ti,"m",Ei).call(this,t),onMigrate:t=>{r$2(this,ti,"m",_i).call(this,t);},onStatus:t=>r$2(this,ti,"m",Ui).call(this,t),onError:(t,i)=>{r$2(this,ti,"m",Ci).call(this,t,i);},onAudioBlocked:()=>this.notifyAudioBlocked()};try{const t=Array.from(r$2(this,di,"f").entries()).filter((([,t])=>!t.trackId)).map((([t,i])=>({source:t,track:i.track})));r$2(this,ei,"f").setInitialTracks?.(t);const s=await r$2(this,ei,"f").connect(i,e),n=s.participants.map((t=>({...t}))),a=n.find((t=>t.id===s.participantId));a?(a.isLocal=true,a.capabilities=s.capabilities):n.push({id:s.participantId,kind:"human",isLocal:true,capabilities:s.capabilities,tracks:[],audioLevel:0,speaking:false,handRaised:false,connection:"connected"});for(const t of s.tracks)for(const i of n)i.id!==t.participantId||i.tracks.some((i=>i.id===t.id))||(i.tracks=[...i.tracks,t]);r$2(this,ti,"m",zi).call(this,{mode:i.mode,roomId:i.roomId,sfuUrl:i.sfuUrl,localParticipantId:s.participantId,participants:n,error:null,migratingTo:null}),r$2(this,ti,"m",$i).call(this,"connected");for(const t of n)if(!t.isLocal)for(const i of t.tracks)"audio"===i.kind&&await r$2(this,ti,"m",Ni).call(this,i);r$2(this,ti,"m",xi).call(this,n.map((t=>t.userId??t.id))),await r$2(this,ti,"m",wi).call(this);}catch(e){const s=e instanceof a$1?e:a$1.from("networkFailed",e?.message,e);if("auth_expired"===s.code&&r$2(this,ri,"f"))try{const e=await r$2(this,ri,"f").call(this,i),s={...i,token:e.token,sfuUrl:e.sfuUrl??i.sfuUrl,iceServers:e.iceServers??i.iceServers};return o$3(this,fi,s),r$2(this,ti,"m",zi).call(this,{sfuUrl:s.sfuUrl}),void await r$2(this,ti,"m",t).call(this,s)}catch(t){const i=a$1.from("authRejected",void 0,t);throw r$2(this,ti,"m",zi).call(this,{error:i.toInfo()}),r$2(this,ti,"m",$i).call(this,"failed"),r$2(this,ti,"m",Gi).call(this,"error",i.toInfo()),i}throw r$2(this,ti,"m",zi).call(this,{error:s.toInfo()}),r$2(this,ti,"m",$i).call(this,"failed"),r$2(this,ti,"m",Gi).call(this,"error",s.toInfo()),s}},wi=async function(){const t=this.localParticipant();for(const[i,e]of r$2(this,di,"f"))e.trackId||("mic"!==i||t?.capabilities.publishAudio)&&("camera"!==i||t?.capabilities.publishVideo)&&("screen"!==i||t?.capabilities.publishScreen)&&await r$2(this,ti,"m",gi).call(this,i,e.track,e.track.kind);},gi=async function(t,i,e){const s=await r$2(this,ei,"f").publish({track:i,source:t,simulcast:"camera"===t}),n=r$2(this,di,"f").get(t)??{track:i};n.track=i,n.trackId=s.id,r$2(this,di,"f").set(t,n);const a=this.store.getState().localParticipantId,o={id:s.id,participantId:a??s.participantId,source:t,kind:e??i.kind,muted:"mic"===t&&!i.enabled,mediaStreamTrack:i,availableLayers:s.availableLayers??[],currentLayer:s.currentLayer??null,pinnedLayer:s.pinnedLayer??null,layerReason:s.layerReason,subscribed:true};a&&r$2(this,ti,"m",Hi).call(this,a,o),r$2(this,ti,"m",Gi).call(this,"participant",a);},vi=async function(t){const i=r$2(this,di,"f").get(t);i&&(i.trackId&&(await r$2(this,ei,"f").unpublish(i.trackId),r$2(this,ti,"m",Vi).call(this,i.trackId)),i.trackId=void 0,r$2(this,di,"f").delete(t));},ki=async function(t,i){if(!i)return;if(r$2(this,di,"f").get(t))return;const e=await r$2(this,ti,"m",yi).call(this,t);e&&r$2(this,di,"f").set(t,{track:e});},yi=async function(t){try{const i=await r$2(this,ni,"f").acquire({audio:"mic"===t,video:"camera"===t}),e="mic"===t?i.audio:i.video;if(!e)return;return e}catch(t){const i=t instanceof a$1?t:a$1.from("permissionDenied",void 0,t);return r$2(this,ti,"m",zi).call(this,{error:i.toInfo()}),void r$2(this,ti,"m",Gi).call(this,"error",i.toInfo())}},bi=function(t){const i=this.store.getState().participants;i.some((i=>i.id===t.id))?r$2(this,ti,"m",Bi).call(this,t.id,t):r$2(this,ti,"m",zi).call(this,{participants:[...i,t]});for(const i of t.tracks)"audio"===i.kind&&r$2(this,ti,"m",Ni).call(this,i);r$2(this,ti,"m",xi).call(this,[t.userId??t.id]),r$2(this,ti,"m",Gi).call(this,"participant",t.id);},Mi=function(t){const i=r$2(this,ti,"m",Fi).call(this,t.id);if(!i)return void r$2(this,ti,"m",bi).call(this,t);const e={...i,...t,isLocal:i.isLocal,tracks:i.tracks,displayName:t.displayName??i.displayName,avatarUrl:t.avatarUrl??i.avatarUrl};r$2(this,ti,"m",Bi).call(this,t.id,e),r$2(this,ti,"m",xi).call(this,[t.userId??t.id]),i.isLocal&&t.capabilities&&r$2(this,ti,"m",Si).call(this,t.capabilities);},Si=async function(t){const i={mic:t.publishAudio,camera:t.publishVideo,screen:t.publishScreen,"screen-audio":t.publishScreen};for(const t of Array.from(r$2(this,di,"f").keys())){if(i[t])continue;const e=r$2(this,di,"f").get(t);try{await r$2(this,ti,"m",vi).call(this,t);}catch(i){r$2(this,si,"f")?.warn?.("call-core: could not unpublish after a demotion",i),r$2(this,di,"f").delete(t);}e?.track.stop(),"screen"===t&&r$2(this,ti,"m",zi).call(this,{sharingId:null});}},Ti=function(t){r$2(this,ai,"f").remove(t),r$2(this,ui,"f").delete(t),r$2(this,ti,"m",zi).call(this,(i=>({participants:i.participants.filter((i=>i.id!==t)),pinnedId:i.pinnedId===t?null:i.pinnedId,activeSpeakerId:i.activeSpeakerId===t?null:i.activeSpeakerId,sharingId:i.sharingId===t?null:i.sharingId})));},Wi=function(t){t.participantId!==this.store.getState().localParticipantId&&(r$2(this,ti,"m",Hi).call(this,t.participantId,t),"audio"===t.kind?r$2(this,ti,"m",Ni).call(this,t):"screen"===t.source?(r$2(this,ti,"m",zi).call(this,{sharingId:t.participantId}),r$2(this,ti,"m",Ni).call(this,t)):this.store.getState().visibleParticipantIds.includes(t.participantId)&&r$2(this,ti,"m",Ni).call(this,t));},Ri=function(t){const i=this.store.getState().participants.find((i=>i.tracks.some((i=>i.id===t)))),e=i?.tracks.find((i=>i.id===t));r$2(this,ti,"m",Vi).call(this,t),"screen"===e?.source&&(this.store.getState().participants.some((t=>t.id===e.participantId&&t.tracks.some((t=>"screen"===t.source))))||r$2(this,ti,"m",zi).call(this,{sharingId:null}));},Ii=function(t){r$2(this,ti,"m",qi).call(this,t.id,{mediaStreamTrack:t.mediaStreamTrack,subscribed:true,muted:t.muted,availableLayers:t.availableLayers,currentLayer:t.currentLayer,pinnedLayer:t.pinnedLayer,layerReason:t.layerReason});},Li=function(t,i,e){const s=r$2(this,ti,"m",Oi).call(this,t);s&&(s.currentLayer===i&&s.layerReason===e||r$2(this,ti,"m",qi).call(this,t,{currentLayer:i,layerReason:e}));},ji=function(t,i){const e=r$2(this,ti,"m",Oi).call(this,t);if(!e||e.source===i)return;const s=e.source;if(r$2(this,ti,"m",qi).call(this,t,{source:i}),"screen"===i)return r$2(this,ti,"m",zi).call(this,{sharingId:e.participantId}),void(e.subscribed||r$2(this,ti,"m",Ni).call(this,{...e,source:i}));"screen"===s&&(this.store.getState().participants.some((i=>i.id===e.participantId&&i.tracks.some((i=>i.id!==t&&"screen"===i.source))))||this.store.getState().sharingId!==e.participantId||r$2(this,ti,"m",zi).call(this,{sharingId:null}));},Ai=function(t){for(const[i,e]of Object.entries(t))r$2(this,ui,"f").set(i,e);const{speaking:i,activeSpeakerId:e}=r$2(this,ai,"f").update(t);r$2(this,ti,"m",Gi).call(this,"audioLevel",t);const s=this.store.getState();(e!==s.activeSpeakerId||s.participants.some((t=>t.speaking!==i.includes(t.id))))&&r$2(this,ti,"m",zi).call(this,{activeSpeakerId:e,participants:s.participants.map((e=>{const s=i.includes(e.id);return e.speaking===s?e:{...e,speaking:s,audioLevel:t[e.id]??e.audioLevel}}))});},Pi=function(t,i){r$2(this,ti,"m",Bi).call(this,t,{agentState:i});},Ei=function(t){const i=this.store.getState().transcript,e=i.findIndex((i=>i.id===t.id)),s=e>=0?i.map(((i,s)=>s===e?t:i)):[...i,t];r$2(this,ti,"m",zi).call(this,{transcript:s}),r$2(this,ti,"m",Gi).call(this,"transcript",t);},_i=async function(t){if(r$2(this,mi,"f"))return;o$3(this,mi,true),r$2(this,ti,"m",zi).call(this,{migratingTo:t.sfuUrl}),r$2(this,ti,"m",$i).call(this,"migrating"),r$2(this,ti,"m",Gi).call(this,"migrate",t);const i=Array.from(r$2(this,di,"f").keys());try{await r$2(this,ei,"f").disconnect();const e={sfuUrl:t.sfuUrl,token:t.token,roomId:t.roomId,mode:this.store.getState().mode??"group"};o$3(this,fi,e);for(const t of i){const i=r$2(this,di,"f").get(t);i&&(i.trackId=void 0);}await r$2(this,ti,"m",pi).call(this,e);}catch(t){r$2(this,si,"f")?.warn?.("call-core: migration failed",t);}finally{o$3(this,mi,false);}},Ci=async function(t,i){const e=t instanceof a$1?t:a$1.from("networkLost",void 0,t);if("session_unknown"===e.code&&r$2(this,ri,"f")&&r$2(this,fi,"f"))try{const t=await r$2(this,ri,"f").call(this,r$2(this,fi,"f")),i={...r$2(this,fi,"f"),token:t.token,sfuUrl:t.sfuUrl??r$2(this,fi,"f").sfuUrl,iceServers:t.iceServers??r$2(this,fi,"f").iceServers};return o$3(this,fi,i),r$2(this,ti,"m",$i).call(this,"connecting"),await r$2(this,ei,"f").disconnect().catch((()=>{})),void await r$2(this,ti,"m",pi).call(this,i)}catch(t){const i=a$1.from("authRejected",void 0,t);return r$2(this,ti,"m",zi).call(this,{error:i.toInfo()}),r$2(this,ti,"m",$i).call(this,"failed"),void r$2(this,ti,"m",Gi).call(this,"error",i.toInfo())}if("auth_expired"===e.code&&r$2(this,ri,"f"))try{const t=await r$2(this,ri,"f").call(this,r$2(this,fi,"f"));return void(r$2(this,ei,"f").updateToken?await r$2(this,ei,"f").updateToken(t.token):r$2(this,fi,"f")&&(o$3(this,fi,{...r$2(this,fi,"f"),token:t.token,sfuUrl:t.sfuUrl??r$2(this,fi,"f").sfuUrl,iceServers:t.iceServers??r$2(this,fi,"f").iceServers}),await this.join(r$2(this,fi,"f"))))}catch(t){const i=a$1.from("authRejected",void 0,t);return r$2(this,ti,"m",zi).call(this,{error:i.toInfo()}),r$2(this,ti,"m",$i).call(this,"failed"),void r$2(this,ti,"m",Gi).call(this,"error",i.toInfo())}r$2(this,ti,"m",zi).call(this,{error:e.toInfo()}),r$2(this,ti,"m",Gi).call(this,"error",e.toInfo()),i&&"room"===e.category&&r$2(this,ti,"m",$i).call(this,"failed");},Ui=function(t){"reconnecting"===t&&"connected"===this.store.getState().status?r$2(this,ti,"m",$i).call(this,"reconnecting"):"connected"===t&&"reconnecting"===this.store.getState().status?r$2(this,ti,"m",$i).call(this,"connected"):"failed"===t&&"ended"!==this.store.getState().status&&r$2(this,ti,"m",$i).call(this,"failed");},xi=async function(t){if(!r$2(this,ii,"f")||0===t.length)return;const i=await async function(t,i){if(!t||0===i.length)return {};try{return await t.resolve(i)}catch{return {}}}(r$2(this,ii,"f"),t);if(0===Object.entries(i).length)return;const e=this.store.getState().participants.map((t=>{const e=i[t.userId??t.id];return e?{...t,displayName:e.displayName??t.displayName,avatarUrl:e.avatarUrl??t.avatarUrl,kind:e.kind??t.kind}:t}));r$2(this,ti,"m",zi).call(this,{participants:e});},Ni=async function(t){if(!t.subscribed)try{await r$2(this,ei,"f").subscribe(t,t.pinnedLayer??void 0),r$2(this,ti,"m",qi).call(this,t.id,{subscribed:true});}catch(t){r$2(this,si,"f")?.warn?.("call-core: could not subscribe to track",t);}},Di=function(t){return this.localParticipant()?.tracks.find((i=>i.source===t))},Fi=function(t){if(t)return this.store.getState().participants.find((i=>i.id===t))},Oi=function(t){for(const i of this.store.getState().participants){const e=i.tracks.find((i=>i.id===t));if(e)return e}},Bi=function(t,i){t&&r$2(this,ti,"m",zi).call(this,{participants:this.store.getState().participants.map((e=>e.id===t?{...e,...i}:e))});},Hi=function(t,i){r$2(this,ti,"m",zi).call(this,{participants:this.store.getState().participants.map((e=>e.id!==t?e:e.tracks.some((t=>t.id===i.id))?{...e,tracks:e.tracks.map((t=>t.id===i.id?{...t,...i}:t))}:{...e,tracks:[...e.tracks,i]}))});},qi=function(t,i){r$2(this,ti,"m",zi).call(this,{participants:this.store.getState().participants.map((e=>e.tracks.some((i=>i.id===t))?{...e,tracks:e.tracks.map((e=>e.id===t?{...e,...i}:e))}:e))});},Vi=function(t){r$2(this,ti,"m",zi).call(this,{participants:this.store.getState().participants.map((i=>i.tracks.some((i=>i.id===t))?{...i,tracks:i.tracks.filter((i=>i.id!==t))}:i))});},Ji=function(t,i){const e=r$2(this,di,"f").get(t);e?.trackId&&r$2(this,ti,"m",qi).call(this,e.trackId,i);},Yi=function(t){const i=this.localParticipant();if(!i?.capabilities[t])throw a$1.from("capabilityDenied")},$i=function(t){const i=this.store.getState().status;i!==t&&(r$2(this,ti,"m",zi).call(this,{status:t}),r$2(this,ti,"m",Gi).call(this,"statusChange",{status:t,previous:i}));},zi=function(t){this.store.setState((i=>({...i,..."function"==typeof t?t(i):t})));},Gi=function(t,i){for(const e of r$2(this,li,"f").get(t)??[])try{e(i);}catch(t){r$2(this,si,"f")?.warn?.("call-core: session listener failed",t);}};
|
|
6
|
+
|
|
7
|
+
const o$2=yt$1(class extends c$2{constructor(a){super(),false!==a&&this.__registerHost(),this.__attachShadow();}state="idle";strings;get labels(){return {...i,...this.strings??{}}}render(){const a=this.labels,t="listening"===this.state?a.agentListening:"thinking"===this.state?a.agentThinking:"speaking"===this.state?a.agentSpeaking:a.agentIdle;return A$1(N$1,{key:"8b749b8d6db8352727a285808632a6e13566e46a"},A$1("span",{key:"7af887f2860c4523616ad4d0b8f6ecae718741bb",class:{indicator:true,[this.state]:true},part:"indicator",role:"status","aria-live":"polite"},A$1("span",{key:"b7640b1e56af294dfec16a8f0c8c6a98625e1e7d",class:"dot","aria-hidden":"true"}),A$1("span",{key:"41905116ca40f1d14fb45b46118527d135a4d2ec",class:"label"},t)))}static get style(){return ":host{display:inline-block;--agent-color:var(--accent-color, #4a86e8)}.indicator{display:inline-flex;align-items:center;gap:6px;font-family:var(--font-primary, sans-serif);font-size:12px;color:var(--text-primary, #171a1f)}.dot{width:8px;height:8px;border-radius:50%;background:var(--agent-color);box-shadow:0 0 0 0 color-mix(in srgb, var(--agent-color) 45%, transparent)}.idle .dot{background:var(--text-secondary, #9095a1)}.thinking .dot{animation:pulse 1s ease-in-out infinite}.speaking .dot{animation:pulse 0.6s ease-in-out infinite}@keyframes pulse{0%,100%{box-shadow:0 0 0 0 color-mix(in srgb, var(--agent-color) 45%, transparent)}50%{box-shadow:0 0 0 5px color-mix(in srgb, var(--agent-color) 0%, transparent)}}@media (prefers-reduced-motion: reduce){.dot{animation:none !important}}"}},[513,"chatleo-call-agent-indicator",{state:[1],strings:[16]}]);function r$1(){"undefined"!=typeof customElements&&["chatleo-call-agent-indicator"].forEach((t=>{"chatleo-call-agent-indicator"===t&&(customElements.get(kt$1(t))||customElements.define(kt$1(t),o$2));}));}r$1();
|
|
8
|
+
|
|
9
|
+
const o$1=yt$1(class extends c$2{constructor(s){super(),false!==s&&this.__registerHost(),this.__attachShadow(),this.audioBlocked=_$1(this,"audioBlocked");}get host(){return this}session;sinkId;audioBlocked;audio;unsubscribe;connectedCallback(){this.attach();}disconnectedCallback(){this.unsubscribe?.();}onSessionChange(){this.attach();}onSinkChange(){this.applySink();}async resumeAudio(){await this.play();}attach(){this.unsubscribe?.(),this.session&&(this.unsubscribe=this.session.store.subscribe((s=>s.participants),(()=>this.sync()),((s,i)=>s===i)),this.sync());}sync(){if(!this.audio||!this.session)return;const s=this.session.remoteAudioTracks();if(!s.length)return void(this.audio.srcObject=null);if("undefined"==typeof MediaStream)return;const i=new MediaStream(s);this.audio.srcObject=i,this.applySink(),this.play();}async play(){if(this.audio)try{await this.audio.play();}catch{this.audioBlocked.emit(),this.session?.notifyAudioBlocked();}}applySink(){const s=this.audio;s?.setSinkId&&this.sinkId&&s.setSinkId(this.sinkId).catch((()=>{}));}render(){return A$1(N$1,{key:"fef3bac1dc7359ca03a359462c0e089db434e42e",hidden:true},A$1("audio",{key:"73bb7c0f5f4e840bb79a64caef91a6f496817983",autoplay:true,ref:s=>{this.audio=s,this.sync();}}))}static get watchers(){return {session:[{onSessionChange:0}],sinkId:[{onSinkChange:0}]}}},[513,"chatleo-call-audio",{session:[16],sinkId:[1,"sink-id"],resumeAudio:[64]},void 0,{session:[{onSessionChange:0}],sinkId:[{onSinkChange:0}]}]);function h$2(){"undefined"!=typeof customElements&&["chatleo-call-audio"].forEach((i=>{"chatleo-call-audio"===i&&(customElements.get(kt$1(i))||customElements.define(kt$1(i),o$1));}));}h$2();
|
|
10
|
+
|
|
11
|
+
const l$3=yt$1(class extends c$2{constructor(e){super(),false!==e&&this.__registerHost(),this.__attachShadow(),this.toggleMic=_$1(this,"toggleMic"),this.toggleCamera=_$1(this,"toggleCamera"),this.toggleScreenShare=_$1(this,"toggleScreenShare"),this.toggleHand=_$1(this,"toggleHand"),this.toggleChat=_$1(this,"toggleChat"),this.toggleTranscript=_$1(this,"toggleTranscript"),this.toggleLayout=_$1(this,"toggleLayout"),this.leave=_$1(this,"leave");}session;mode="group";compact=false;layout="auto";chatOpen=false;transcriptOpen=false;strings;toggleMic;toggleCamera;toggleScreenShare;toggleHand;toggleChat;toggleTranscript;toggleLayout;leave;controlState={micOn:false,cameraOn:false,sharing:false,handRaised:false,canPublishAudio:false,canPublishVideo:false,canPublishScreen:false,canModerate:false,localId:null,sharingId:null};unsubscribe;get labels(){return {...i,...this.strings??{}}}connectedCallback(){this.attach();}disconnectedCallback(){this.unsubscribe?.();}attach(){this.unsubscribe?.(),this.session&&(this.unsubscribe=this.session.store.subscribe((e=>{const t=e.participants.find((e=>e.isLocal));return {micOn:!!t?.tracks.find((e=>"mic"===e.source&&!e.muted)),cameraOn:!!t?.tracks.find((e=>"camera"===e.source)),sharing:!!t&&e.sharingId===t.id,handRaised:e.handRaised,canPublishAudio:!!t?.capabilities.publishAudio,canPublishVideo:!!t?.capabilities.publishVideo,canPublishScreen:!!t?.capabilities.publishScreen,canModerate:!!t?.capabilities.moderate,localId:e.localParticipantId,sharingId:e.sharingId}}),(e=>{this.controlState=e;}),((e,t)=>JSON.stringify(e)===JSON.stringify(t))),this.controlState=this.readState());}readState(){if(!this.session)return this.controlState;const e=this.session.getState(),t=e.participants.find((e=>e.isLocal));return {micOn:!!t?.tracks.find((e=>"mic"===e.source&&!e.muted)),cameraOn:!!t?.tracks.find((e=>"camera"===e.source)),sharing:!!t&&e.sharingId===t.id,handRaised:e.handRaised,canPublishAudio:!!t?.capabilities.publishAudio,canPublishVideo:!!t?.capabilities.publishVideo,canPublishScreen:!!t?.capabilities.publishScreen,canModerate:!!t?.capabilities.moderate,localId:e.localParticipantId,sharingId:e.sharingId}}screenSupported(){return "undefined"!=typeof navigator&&!!navigator.mediaDevices?.getDisplayMedia}render(){const e=this.labels,t=this.controlState,a=this.screenSupported(),s="stage"===this.mode,r="group"===this.mode,l=[t.canPublishAudio?A$1("button",{type:"button",class:{active:t.micOn},"aria-pressed":t.micOn?"true":"false","aria-label":t.micOn?e.mute:e.unmute,title:t.micOn?e.mute:e.unmute,onClick:()=>this.toggleMic.emit({enabled:!t.micOn})},t.micOn?"🎙":"🔇"):null,t.canPublishVideo?A$1("button",{type:"button",class:{active:t.cameraOn},"aria-pressed":t.cameraOn?"true":"false","aria-label":t.cameraOn?e.cameraOff:e.cameraOn,title:t.cameraOn?e.cameraOff:e.cameraOn,onClick:()=>this.toggleCamera.emit({enabled:!t.cameraOn})},t.cameraOn?"📹":"📷"):null,A$1("button",{key:"778ea621eeadd90c8ef79cad39988a5b507f88b2",type:"button",class:{active:this.chatOpen},"aria-pressed":this.chatOpen?"true":"false","aria-label":e.chat,title:e.chat,onClick:()=>this.toggleChat.emit()},"💬"),A$1("button",{key:"b8113c612b6dac2b6ca90f9fe2082890899c1b23",type:"button",class:{active:this.transcriptOpen},"aria-pressed":this.transcriptOpen?"true":"false","aria-label":e.transcript,title:e.transcript,onClick:()=>this.toggleTranscript.emit()},"CC"),A$1("button",{key:"e176addec95b1c865805b5e83a96e8b00198346d",type:"button",class:"leave","aria-label":e.leave,title:e.leave,onClick:()=>this.leave.emit()},"⏻")],n=[t.canPublishScreen&&a?A$1("button",{type:"button",class:{active:t.sharing},"aria-pressed":t.sharing?"true":"false","aria-label":t.sharing?e.stopSharing:e.shareScreen,title:t.sharing?e.stopSharing:e.shareScreen,onClick:()=>this.toggleScreenShare.emit({enabled:!t.sharing})},"🖥"):null,s?A$1("button",{type:"button",class:{active:t.handRaised},"aria-pressed":t.handRaised?"true":"false","aria-label":t.handRaised?e.lowerHand:e.raiseHand,title:t.handRaised?e.lowerHand:e.raiseHand,onClick:()=>this.toggleHand.emit({raised:!t.handRaised})},"✋"):null,r?A$1("button",{type:"button","aria-label":e.layout,title:e.layout,onClick:()=>this.toggleLayout.emit()},"speaker"===this.layout?"▦":"▣"):null];return A$1(N$1,{key:"3f708646ac696e79172da46bba0f7d367e574867"},A$1("div",{key:"2f5eb284750d77d266cf91461a5b829fa5cf78f8",class:{controls:true,compact:this.compact},part:"controls",role:"toolbar","aria-label":"Call controls"},A$1("div",{key:"438cf1c4213642641e16cdeb281a80c49817db81",class:"group start"},A$1("slot",{key:"dcfc413e6a90e6897765ed36b5a9012341afe13b",name:"start"})),this.compact?l:[...l,...n],this.compact?A$1("details",{class:"overflow"},A$1("summary",{"aria-label":"More controls"},"⋯"),A$1("div",{class:"overflow-menu"},n)):null,A$1("div",{key:"b0497290c5aa46046a2d05f93b6111a3513f007e",class:"group end"},A$1("slot",{key:"a1abb281f805c141e7440d444f7446dbb78ed534",name:"end"}))))}static get style(){return ":host{display:block;font-family:var(--font-primary, sans-serif)}.controls{display:flex;align-items:center;gap:8px;padding:8px;background:var(--bg-primary, #fff);border-top:1px solid var(--border-light, #eeeeee)}.group{display:flex;gap:6px}.start{margin-right:auto}.end{margin-left:auto}button,summary{min-width:40px;height:40px;border:1px solid var(--border-color, #bdc1ca);border-radius:999px;background:var(--bg-secondary, #f3f4f6);color:var(--text-primary, #171a1f);font-size:16px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0 10px}button.active{background:var(--accent-color, #4a86e8);border-color:var(--accent-color, #4a86e8);color:#fff}button.leave{background:#ef4444;border-color:#ef4444;color:#fff}button:focus-visible,summary:focus-visible{outline:2px solid var(--accent-color, #4a86e8);outline-offset:2px}.overflow{position:relative}.overflow summary{list-style:none}.overflow-menu{position:absolute;bottom:48px;right:0;display:flex;gap:6px;padding:6px;background:var(--bg-primary, #fff);border:1px solid var(--border-light, #eeeeee);border-radius:var(--border-radius, 8px);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);z-index:10}@media (prefers-reduced-motion: reduce){button{transition:none}}"}},[769,"chatleo-call-controls",{session:[16],mode:[1],compact:[4],layout:[1],chatOpen:[4,"chat-open"],transcriptOpen:[4,"transcript-open"],strings:[16],controlState:[32]}]);function n$4(){"undefined"!=typeof customElements&&["chatleo-call-controls"].forEach((t=>{"chatleo-call-controls"===t&&(customElements.get(kt$1(t))||customElements.define(kt$1(t),l$3));}));}n$4();
|
|
12
|
+
|
|
13
|
+
const l$2=yt$1(class extends c$2{constructor(e){super(),false!==e&&this.__registerHost(),this.__attachShadow(),this.deviceChange=_$1(this,"deviceChange");}session;kind="audioinput";label;strings;deviceChange;devices=[];selected;unsubscribe;get labels(){return {...i,...this.strings??{}}}connectedCallback(){this.attach();}disconnectedCallback(){this.unsubscribe?.();}onSessionChange(){this.attach();}attach(){this.unsubscribe?.(),this.session&&(this.unsubscribe=this.session.devices.onChange((()=>this.sync())),this.session.devices.start().then((()=>this.sync())),this.sync());}sync(){this.session&&(this.devices=this.session.devices.devices.filter((e=>e.kind===this.kind)).map((e=>({deviceId:e.deviceId,label:e.label||this.labels.noDevices}))),this.selected=this.session.devices.selected[this.kind]);}get fallbackLabel(){return this.label?this.label:"audioinput"===this.kind?this.labels.microphone:"videoinput"===this.kind?this.labels.camera:this.labels.speaker}render(){return A$1(N$1,{key:"bd092a8a9513cfb293badfcd7be30d6e86684d35"},A$1("label",{key:"07087145735a24aff4c700ffae7464d0b49d4aa0",class:"field",part:"field"},A$1("span",{key:"bbf72354c07ddf2b643dbf8b46e4c22e176b53b8",class:"label"},this.fallbackLabel),A$1("select",{key:"43694a96dffd693b5ee6ad287e355fa57dca47db",onChange:e=>{const s=e.target.value;this.selected=s,this.deviceChange.emit({kind:this.kind,deviceId:s});}},0===this.devices.length?A$1("option",{value:""},this.labels.noDevices):null,this.devices.map((e=>A$1("option",{value:e.deviceId,selected:e.deviceId===this.selected},e.label))))))}static get watchers(){return {session:[{onSessionChange:0}]}}static get style(){return ":host{display:block;font-family:var(--font-primary, sans-serif)}.field{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--text-secondary, #9095a1)}select{min-height:34px;border:1px solid var(--border-color, #bdc1ca);border-radius:var(--border-radius, 8px);background:var(--bg-primary, #fff);color:var(--text-primary, #171a1f);font:inherit;padding:4px 8px}select:focus-visible{outline:2px solid var(--accent-color, #4a86e8);outline-offset:1px}"}},[513,"chatleo-call-device-select",{session:[16],kind:[1],label:[1],strings:[16],devices:[32],selected:[32]},void 0,{session:[{onSessionChange:0}]}]);function o(){"undefined"!=typeof customElements&&["chatleo-call-device-select"].forEach((s=>{"chatleo-call-device-select"===s&&(customElements.get(kt$1(s))||customElements.define(kt$1(s),l$2));}));}o();
|
|
14
|
+
|
|
15
|
+
function n$3(n,r="?"){if(!n)return r;const t=n.trim().split(/\s+/).filter(Boolean);return 0===t.length?r:1===t.length?t[0].slice(0,2).toUpperCase():`${t[0][0]}${t[t.length-1][0]}`.toUpperCase()}function r(n,r="camera"){if(n)return function(n,r){if(n)return n.tracks.find((n=>n.source===r))}(n,"screen"===r?"screen":"camera")}function t(n,r="Participant"){return n?.displayName||n?.id||r}function e$1(n,t="camera"){const e=r(n,t);return !!e&&!e.muted&&!!e.mediaStreamTrack}
|
|
16
|
+
|
|
17
|
+
const d$2=yt$1(class extends c$2{constructor(e){super(),false!==e&&this.__registerHost(),this.__attachShadow(),this.accept=_$1(this,"accept"),this.decline=_$1(this,"decline");}caller;video=false;strings;accept;decline;get labels(){return {...i,...this.strings??{}}}render(){const e=this.labels,a=this.caller?.displayName||this.caller?.id||e.incomingCall;return A$1(N$1,{key:"a9dc9f24ebdf69dee36f74c1a4f6578e28013043"},A$1("div",{key:"8fba33929de794afbcfe81d13584216819a2e7cb",class:"incoming",part:"incoming",role:"dialog","aria-label":e.incomingCall},A$1("div",{key:"0a938ee7b707e6bd5eb034bdd885c97c0876cf2c",class:"avatar","aria-hidden":"true"},this.caller?.avatarUrl?A$1("img",{src:this.caller.avatarUrl,alt:""}):n$3(a)),A$1("div",{key:"549545ce93d6fe5232d0d871b9a4bf1eef90bbd4",class:"who"},A$1("span",{key:"0e6ea7c9e26557c24ff07cdd66dcf0fd28004976",class:"title"},e.incomingCall),A$1("span",{key:"bc6439309e40198c6e50c8186f1261c5b0d0a585",class:"name"},a),A$1("span",{key:"31add48f93045b247882fe9be8c3a8a40e9c63f6",class:"kind"},this.video?"Video call":"Audio call")),A$1("div",{key:"55f674789c7302a451249ed32cbdd0eb3d9d811c",class:"actions"},A$1("button",{key:"44fc4ab2a0e628118176c03fd8940dfedf1be78d",type:"button",class:"decline",onClick:()=>this.decline.emit()},e.decline),A$1("button",{key:"4667a6cdc0e0dbfab582827262ef6431c1d43a2f",type:"button",class:"accept",onClick:()=>this.accept.emit()},e.accept))))}static get style(){return ":host{display:block;font-family:var(--font-primary, sans-serif)}.incoming{display:flex;align-items:center;gap:12px;padding:12px 16px;border-radius:var(--border-radius, 8px);background:var(--bg-primary, #fff);border:1px solid var(--border-light, #eeeeee);box-shadow:0 8px 32px rgba(0, 0, 0, 0.16);color:var(--text-primary, #171a1f)}.avatar{width:44px;height:44px;border-radius:50%;overflow:hidden;background:var(--bg-secondary, #f3f4f6);display:flex;align-items:center;justify-content:center;font-weight:700;color:var(--text-secondary, #9095a1);flex-shrink:0}.avatar img{width:100%;height:100%;object-fit:cover}.who{display:flex;flex-direction:column;flex:1;min-width:0}.title{font-size:11px;text-transform:uppercase;letter-spacing:0.05em;color:var(--text-secondary, #9095a1)}.name{font-size:15px;font-weight:700}.kind{font-size:12px;color:var(--text-secondary, #9095a1)}.actions{display:flex;gap:8px}button{min-height:34px;padding:0 12px;border-radius:999px;border:1px solid var(--border-color, #bdc1ca);background:var(--bg-secondary, #f3f4f6);color:var(--text-primary, #171a1f);font:inherit;cursor:pointer}button.accept{background:#16a34a;border-color:#16a34a;color:#fff}button.decline{background:#ef4444;border-color:#ef4444;color:#fff}button:focus-visible{outline:2px solid var(--accent-color, #4a86e8);outline-offset:2px}"}},[513,"chatleo-call-incoming",{caller:[16],video:[4],strings:[16]}]);function n$2(){"undefined"!=typeof customElements&&["chatleo-call-incoming"].forEach((a=>{"chatleo-call-incoming"===a&&(customElements.get(kt$1(a))||customElements.define(kt$1(a),d$2));}));}n$2();
|
|
18
|
+
|
|
19
|
+
const l$1=yt$1(class extends c$2{constructor(e){super(),false!==e&&this.__registerHost(),this.__attachShadow(),this.joinRequest=_$1(this,"joinRequest");}get host(){return this}session;audioOnly=false;strings;joinRequest;micEnabled=true;cameraEnabled=false;level=0;permissionError=null;ready=false;activeSession;preview;audioContext;animation;unsubscribe;deviceUnsubscribe;get labels(){return {...i,...this.strings??{}}}connectedCallback(){this.activeSession=this.session??function(e){let t;const i=new CustomEvent("chatleoCallSessionRequest",{bubbles:true,composed:true,cancelable:true,detail:{callback:e=>{t=e;}}});return e.dispatchEvent(i),t}(this.host),this.cameraEnabled=!this.audioOnly,this.prepare();}disconnectedCallback(){this.unsubscribe?.(),this.deviceUnsubscribe?.(),this.animation&&cancelAnimationFrame(this.animation),this.audioContext?.close().catch((()=>{}));}async prepare(){if(this.activeSession)try{"idle"===this.activeSession.getState().status&&await this.activeSession.prepare(),await this.activeSession.startPreview({audio:true,video:!this.audioOnly});const e=this.activeSession.getState().error;"permission"===e?.category&&(this.permissionError="permission_blocked"===e.code?this.labels.permissionBlocked:this.labels.permissionDenied),this.deviceUnsubscribe=this.activeSession.devices.onChange((()=>this.ready=true)),this.bindPreview(),this.startMeter(),this.ready=true;}catch{const e=this.activeSession.getState().error;this.permissionError="permission"===e?.category?"permission_blocked"===e.code?this.labels.permissionBlocked:this.labels.permissionDenied:null;}}bindPreview(){if(!this.preview||!this.activeSession)return;const e=this.activeSession.localPreviewStream();this.preview.srcObject=e,e&&this.preview.play().catch((()=>{}));}startMeter(){const e=this.activeSession?.localPreviewStream(),t=e?.getAudioTracks()[0],i="undefined"!=typeof AudioContext?AudioContext:void 0;if(t&&i)try{this.audioContext=new i;const t=this.audioContext.createMediaStreamSource(e),s=this.audioContext.createAnalyser();s.fftSize=256,t.connect(s);const a=new Uint8Array(s.frequencyBinCount),o=()=>{s.getByteFrequencyData(a);const e=a.reduce(((e,t)=>e+t),0)/a.length/255;this.level=e,this.animation=requestAnimationFrame(o);};o();}catch{}}async toggleMic(){this.activeSession&&(this.micEnabled=!this.micEnabled,await this.activeSession.setMicEnabled(this.micEnabled),this.bindPreview());}async toggleCamera(){this.activeSession&&(this.cameraEnabled=!this.cameraEnabled,await this.activeSession.setCameraEnabled(this.cameraEnabled),this.bindPreview());}async selectDevice(e,t){await(this.activeSession?.selectDevice(e,t)),this.bindPreview();}render(){const e=this.labels,t=!this.audioOnly,i=this.activeSession?.localParticipant()?.displayName;return A$1(N$1,{key:"c5b46525a69f412df0fe99b2794267f120e24f64"},A$1("div",{key:"0fe3c8af38e2740be6ec04b9892bdd214acd58ca",class:"lobby",part:"lobby"},A$1("h2",{key:"7fa89e307da483ffe2231e82a72fb4e42debca5a"},e.lobbyTitle),t?A$1("div",{class:"preview",part:"preview"},A$1("video",{autoplay:true,playsinline:true,muted:true,ref:e=>{this.preview=e,this.bindPreview();}}),this.cameraEnabled?null:A$1("div",{class:"placeholder"},n$3(i,"👤"))):null,this.permissionError?A$1("p",{class:"error",role:"alert"},this.permissionError):null,A$1("div",{key:"a7616fca77a2fbda06d975e490184ec534a703b8",class:"devices"},A$1("chatleo-call-device-select",{key:"640948ae2a148a4eed1a3434fe9eb1b8d8082acf",session:this.activeSession,kind:"audioinput",strings:this.strings,onDeviceChange:e=>this.selectDevice("audioinput",e.detail.deviceId)}),t?A$1("chatleo-call-device-select",{session:this.activeSession,kind:"videoinput",strings:this.strings,onDeviceChange:e=>this.selectDevice("videoinput",e.detail.deviceId)}):null,A$1("chatleo-call-device-select",{key:"db1a810579f8eacdfe692489bbe7f6129176757b",session:this.activeSession,kind:"audiooutput",strings:this.strings,onDeviceChange:e=>this.selectDevice("audiooutput",e.detail.deviceId)})),A$1("div",{key:"3d11a4d5979e84892fd174c17b23ffe36f63bc81",class:"meter","aria-label":"Microphone level"},A$1("span",{key:"8a07087e338c603ee210e020e8968d5922ccab86",style:{width:`${Math.round(100*this.level)}%`}})),A$1("div",{key:"c9ec39a57cd7476a3c880cb2ecada77c44ff0606",class:"actions"},A$1("button",{key:"6338e90c14ed83b5d8f8b527b71f617454812340",type:"button","aria-pressed":this.micEnabled?"true":"false",onClick:()=>{this.toggleMic();}},this.micEnabled?e.mute:e.unmute),t?A$1("button",{type:"button","aria-pressed":this.cameraEnabled?"true":"false",onClick:()=>{this.toggleCamera();}},this.cameraEnabled?e.cameraOff:e.cameraOn):null),A$1("div",{key:"79d3497f27f8b99915f50240f4b0c27b2f530164",class:"join-actions"},A$1("button",{key:"c6dcee7fbfe120897514ed0c56774cfe5aee0565",type:"button",class:"primary",disabled:!this.ready,onClick:()=>this.joinRequest.emit({audio:this.micEnabled,video:t&&this.cameraEnabled})},e.join),A$1("button",{key:"bce078ad6d179d47dbad1a982245224bfd5e4b45",type:"button",onClick:()=>this.joinRequest.emit({audio:false,video:false})},e.joinAsListener)),A$1("slot",{key:"c073a2fbde36f5039a435a05fbd688efed41be18",name:"lobby"})))}static get style(){return ":host{display:block;font-family:var(--font-primary, sans-serif);background:var(--bg-primary, #fff);color:var(--text-primary, #171a1f)}.lobby{display:flex;flex-direction:column;gap:12px;padding:16px;max-width:640px;margin:0 auto}h2{margin:0;font-size:18px}.preview{position:relative;aspect-ratio:16 / 9;background:var(--bg-secondary, #f3f4f6);border-radius:var(--border-radius, 8px);overflow:hidden;display:flex;align-items:center;justify-content:center}.preview video{width:100%;height:100%;object-fit:cover;transform:scaleX(-1)}.placeholder{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:40px;background:var(--bg-secondary, #f3f4f6);color:var(--text-secondary, #9095a1)}.devices{display:grid;gap:8px}.meter{height:6px;background:var(--bg-secondary, #f3f4f6);border-radius:999px;overflow:hidden}.meter span{display:block;height:100%;background:var(--accent-color, #4a86e8);transition:width 80ms linear}.actions,.join-actions{display:flex;gap:8px;flex-wrap:wrap}button{min-height:38px;padding:0 14px;border-radius:var(--border-radius, 8px);border:1px solid var(--border-color, #bdc1ca);background:var(--bg-secondary, #f3f4f6);color:var(--text-primary, #171a1f);font:inherit;cursor:pointer}button.primary{background:var(--accent-color, #4a86e8);border-color:var(--accent-color, #4a86e8);color:#fff}button:disabled{opacity:0.5;cursor:not-allowed}button:focus-visible{outline:2px solid var(--accent-color, #4a86e8);outline-offset:2px}.error{color:#b91c1c;font-size:13px}@media (prefers-reduced-motion: reduce){.meter span{transition:none}}"}},[769,"chatleo-call-lobby",{session:[16],audioOnly:[4,"audio-only"],strings:[16],micEnabled:[32],cameraEnabled:[32],level:[32],permissionError:[32],ready:[32]}]);function d$1(){"undefined"!=typeof customElements&&["chatleo-call-lobby","chatleo-call-device-select"].forEach((t=>{switch(t){case "chatleo-call-lobby":customElements.get(kt$1(t))||customElements.define(kt$1(t),l$1);break;case "chatleo-call-device-select":customElements.get(kt$1(t))||o();}}));}d$1();
|
|
20
|
+
|
|
21
|
+
function e(e){const n=e.capabilities;return n.publishAudio||n.publishVideo||n.publishScreen}function n$1(n){const t="stage"===n.mode?n.participants.filter(e):n.participants,s=(r=n.containerWidth,i=n.containerHeight,(o=n.maxTiles)&&o>0?o:r>0&&r<600||i>0&&i<360?4:9);var r,i,o;const c="camera";if(n.sharingId){const e=t.find((e=>e.id===n.sharingId));if(e)return {kind:"share",stageId:e.id,stageSource:"screen",filmstrip:t.filter((n=>n.id!==e.id)),grid:[],inset:null,page:0,pageCount:1,visible:t.map((e=>e.id)),columns:1,rows:1,cap:s}}if(n.pinnedId){const e=t.find((e=>e.id===n.pinnedId));if(e)return {kind:"pin",stageId:e.id,stageSource:e.tracks.some((e=>"screen"===e.source))?"screen":c,filmstrip:t.filter((n=>n.id!==e.id)),grid:[],inset:null,page:0,pageCount:1,visible:t.map((e=>e.id)),columns:1,rows:1,cap:s}}if("speaker"===n.layout){const e=t.find((e=>e.isLocal))?.id??null;let r=n.activeSpeakerId?t.find((e=>e.id===n.activeSpeakerId)):void 0;if(!r||r.id===e){const n=t.filter((n=>n.id!==e));r=n.sort(((e,n)=>n.audioLevel-e.audioLevel))[0];}if(r)return {kind:"speaker",stageId:r.id,stageSource:"camera",filmstrip:t.filter((e=>e.id!==r.id)),grid:[],inset:null,page:0,pageCount:1,visible:t.map((e=>e.id)),columns:1,rows:1,cap:s}}if("direct"===n.mode&&2===t.length){const e=t.find((e=>e.isLocal))??null,n=t.find((e=>!e.isLocal))??null;if(n)return {kind:"direct",stageId:n.id,stageSource:"camera",filmstrip:[],grid:[],inset:e,page:0,pageCount:1,visible:t.map((e=>e.id)),columns:1,rows:1,cap:s}}const a=function(e,n,t){return e.map(((e,n)=>({participant:e,index:n}))).sort(((e,s)=>{const r=e.participant.tracks.some((e=>"screen"===e.source))?1:0,i=s.participant.tracks.some((e=>"screen"===e.source))?1:0;return r!==i?i-r:e.participant.id===n?-1:s.participant.id===n?1:e.participant.speaking!==s.participant.speaking?e.participant.speaking?-1:1:e.participant.id===t?-1:s.participant.id===t?1:e.index-s.index})).map((e=>e.participant))}(t,n.pinnedId,n.activeSpeakerId),{pages:u}=function(e,n,t){if(0===e.length)return {pages:[[]],page:0};const s=[];for(let t=0;t<e.length;t+=n)s.push(e.slice(t,t+n));if(t){const r=e.findIndex((e=>e.id===t));if(r>=n){const t=[...e],[i]=t.splice(r,1);t.unshift(i),s.length=0;for(let e=0;e<t.length;e+=n)s.push(t.slice(e,e+n));}}return {pages:s,page:0}}(a,s,n.participants.find((e=>e.isLocal))?.id??null),l=u[0]??[],g=function(e,n,t){if(e<=1)return {columns:1,rows:1};let s={columns:e,rows:1},r=Number.POSITIVE_INFINITY;const i=16/9;for(let o=1;o<=e;o+=1){const c=Math.ceil(e/o),a=o*c-e,u=Math.abs(Math.log((n>0?n/o:o)/(t>0?t/c:c)/i))+.25*a;u<r&&(r=u,s={columns:o,rows:c});}return s}(l.length,n.containerWidth,n.containerHeight);return {kind:"grid",stageId:null,stageSource:c,filmstrip:[],grid:l,inset:null,page:0,pageCount:u.length,visible:l.map((e=>e.id)),columns:g.columns,rows:g.rows,cap:s}}
|
|
22
|
+
|
|
23
|
+
const d=yt$1(class extends c$2{constructor(t){super(),false!==t&&this.__registerHost(),this.__attachShadow(),this.promote=_$1(this,"promote"),this.demote=_$1(this,"demote"),this.muteRemote=_$1(this,"muteRemote"),this.remove=_$1(this,"remove");}session;showAudience=true;strings;promote;demote;muteRemote;remove;participants=[];canModerate=false;localId=null;stageMode=false;unsubscribe;get labels(){return {...i,...this.strings??{}}}connectedCallback(){this.attach();}disconnectedCallback(){this.unsubscribe?.();}attach(){if(this.unsubscribe?.(),!this.session)return;this.unsubscribe=this.session.store.subscribe((t=>t.participants),(t=>{this.participants=t,this.canModerate=!!t.find((t=>t.isLocal))?.capabilities.moderate;}));const t=this.session.getState();this.participants=t.participants,this.localId=t.localParticipantId,this.stageMode="stage"===t.mode,this.canModerate=!!t.participants.find((t=>t.isLocal))?.capabilities.moderate;}sorted(){return [...this.participants].sort(((t$1,e)=>t$1.handRaised!==e.handRaised?t$1.handRaised?-1:1:t$1.isLocal!==e.isLocal?t$1.isLocal?-1:1:t$1.speaking!==e.speaking?t$1.speaking?-1:1:t(t$1).localeCompare(t(e))))}speakers(){return this.participants.filter((t=>e(t)||t.isLocal))}audience(){return this.participants.filter((t=>!e(t)&&!t.isLocal))}render(){const t$1=this.labels,e$1=this.sorted();return A$1(N$1,{key:"5a0574e8194c7d3a22b2de9933ddcf6e37322181"},A$1("div",{key:"19b4da10be08cfb6d0744dc5c7e26709079c9e10",class:"roster",part:"roster"},this.stageMode&&this.showAudience?A$1("div",{class:"counts",part:"counts"},A$1("span",null,this.speakers().length," ",t$1.speaker),A$1("span",null,this.audience().length," ",t$1.audience)):null,A$1("ul",{key:"b6a77857209010c05dfbea6c2dd99cda32581800",role:"list"},e$1.map((e$1=>{const s=this.canModerate&&e$1.id!==this.localId,a=!e(e$1)&&!e$1.isLocal;return A$1("li",{class:{row:true,speaking:e$1.speaking,hand:e$1.handRaised}},A$1("span",{class:"avatar","aria-hidden":"true"},e$1.avatarUrl?A$1("img",{src:e$1.avatarUrl,alt:""}):n$3(t(e$1))),A$1("span",{class:"who"},A$1("span",{class:"name"},t(e$1)),A$1("span",{class:"meta"},e$1.isLocal?"you":"agent"===e$1.kind?"agent":a?t$1.audience:t$1.speaker,e$1.handRaised?" • hand raised":"",e$1.speaking?" • speaking":"")),s?A$1("span",{class:"actions"},a?A$1("button",{type:"button","aria-label":`${t$1.promote}: ${t(e$1)}`,title:t$1.promote,onClick:()=>this.promote.emit({participantId:e$1.id})},"↑"):A$1("button",{type:"button","aria-label":`${t$1.demote}: ${t(e$1)}`,title:t$1.demote,onClick:()=>this.demote.emit({participantId:e$1.id})},"↓"),A$1("button",{type:"button","aria-label":`${t$1.muteParticipant}: ${t(e$1)}`,title:t$1.muteParticipant,onClick:()=>this.muteRemote.emit({participantId:e$1.id,source:"mic"})},"🔇"),A$1("button",{type:"button",class:"remove","aria-label":`${t$1.removeParticipant}: ${t(e$1)}`,title:t$1.removeParticipant,onClick:()=>this.remove.emit({participantId:e$1.id})},"×")):null)}))),0===e$1.length?A$1("p",{class:"empty"},t$1.waitingForOthers):null))}static get style(){return ":host{display:block;font-family:var(--font-primary, sans-serif)}.roster{padding:8px}.counts{display:flex;justify-content:space-between;font-size:12px;color:var(--text-secondary, #9095a1);padding:4px 6px 8px}ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}.row{display:flex;align-items:center;gap:8px;padding:6px;border-radius:var(--border-radius, 8px)}.row.hand{background:color-mix(in srgb, var(--accent-color, #4a86e8) 10%, transparent)}.avatar{width:28px;height:28px;border-radius:50%;background:var(--bg-secondary, #f3f4f6);color:var(--text-secondary, #9095a1);display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;overflow:hidden;flex-shrink:0}.avatar img{width:100%;height:100%;object-fit:cover}.who{display:flex;flex-direction:column;min-width:0;flex:1}.name{font-size:13px;font-weight:600;color:var(--text-primary, #171a1f);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.meta{font-size:11px;color:var(--text-secondary, #9095a1)}.row.speaking .name::after{content:' •';color:var(--accent-color, #4a86e8)}.actions{display:flex;gap:2px}.actions button{width:26px;height:26px;border-radius:50%;border:1px solid var(--border-color, #bdc1ca);background:var(--bg-primary, #fff);cursor:pointer;font-size:12px;line-height:1}.actions button.remove{color:#ef4444}.empty{font-size:12px;color:var(--text-secondary, #9095a1);padding:8px}"}},[513,"chatleo-call-roster",{session:[16],showAudience:[4,"show-audience"],strings:[16],participants:[32],canModerate:[32],localId:[32],stageMode:[32]}]);function p$1(){"undefined"!=typeof customElements&&["chatleo-call-roster"].forEach((e=>{"chatleo-call-roster"===e&&(customElements.get(kt$1(e))||customElements.define(kt$1(e),d));}));}p$1();
|
|
24
|
+
|
|
25
|
+
const h$1=yt$1(class extends c$2{constructor(e){super(),false!==e&&this.__registerHost(),this.__attachShadow(),this.pin=_$1(this,"pin"),this.layerChange=_$1(this,"layerChange");}get host(){return this}session;participant;source="camera";fit="cover";mirrored;strings;pin;layerChange;video;unsubscribeLevel;get labels(){return {...i,...this.strings??{}}}connectedCallback(){this.session&&(this.unsubscribeLevel=this.session.on("audioLevel",(e=>{this.host.style.setProperty("--speaking-level",String(Math.min(1,Math.max(0,this.participant?e[this.participant.id]??0:0))));})));}disconnectedCallback(){this.unsubscribeLevel?.();}onSessionChange(){this.unsubscribeLevel?.(),this.connectedCallback();}componentDidRender(){const e=this.participant?r(this.participant,this.source):void 0;if(!this.video)return;const t=e?.mediaStreamTrack;if(!t)return void(this.video.srcObject=null);const a=this.video.srcObject;a?.getTracks()[0]!==t&&(this.video.srcObject="undefined"!=typeof MediaStream?new MediaStream([t]):null);}get isPinned(){return !!this.participant&&this.session?.getState().pinnedId===this.participant.id}get isMirrored(){return "screen"!==this.source&&(void 0!==this.mirrored?this.mirrored:!!this.participant?.isLocal)}togglePin=e=>{e.stopPropagation(),this.participant&&this.pin.emit({participantId:this.participant.id,pinned:!this.isPinned});};layerName(e){const t=this.labels;switch(e){case "l":return t.layerLow;case "m":return t.layerMedium;case "h":return t.layerHigh;default:return t.layerAuto}}reasonName(e){const t=this.labels;switch(e){case "bandwidth":return t.layerReasonBandwidth;case "pinned":return t.layerReasonPinned;case "publisher":return t.layerReasonPublisher;default:return}}changeLayer=e=>{if(e.stopPropagation(),!this.participant)return;const t=r(this.participant,this.source);if(!t)return;const a=e.target.value;this.layerChange.emit({participantId:this.participant.id,trackId:t.id,layer:""===a?null:a});};render(){const e=this.participant,t$1=this.labels,a=e$1(e,this.source),i=t(e),r$1=e?r(e,this.source):void 0,p="agent"===e?.kind,h=r$1?.availableLayers??[],f=!e?.isLocal&&h.length>1,u=this.reasonName(r$1?.layerReason);return A$1(N$1,{key:"98b48fd19b439dd66d48ff09cf0671f1211eb4fd"},A$1("div",{key:"4f2c72cca2dce7701d32becabbafea7b7ff44fe1",class:{tile:true,speaking:!!e?.speaking,mirrored:this.isMirrored,"fit-contain":"contain"===this.fit,agent:p,"self-view":!!e?.isLocal},part:"tile","data-source":this.source,"data-participant-id":e?.id??"","data-track-id":r$1?.id??""},p?A$1("div",{class:"agent-body",part:"agent"},A$1("chatleo-call-agent-indicator",{state:e?.agentState??"idle"})):null,!p&&a?A$1("video",{class:"video",part:"video",autoplay:true,playsinline:true,muted:true,ref:e=>{this.video=e;}}):null,p||a?null:A$1("div",{class:"avatar",part:"avatar","aria-hidden":"true"},e?.avatarUrl?A$1("img",{src:e.avatarUrl,alt:""}):A$1("span",{class:"initials"},n$3(i))),A$1("div",{key:"34c35cb20ece877202bcf0425742c6ef8656c2b4",class:"speaking-ring","aria-hidden":"true"}),A$1("span",{key:"6c0fe599f8d1a7119348191bcd4ce68fd013a654",class:"sr-only"},e?.speaking?"Speaking":""),A$1("div",{key:"1dce385fc8e8bccbc10ac6ddc0dd9dc97235da15",class:"top-badges"},f?A$1("span",{class:"badge quality",part:"quality",title:`${t$1.quality}: ${this.layerName(r$1?.currentLayer)}${u?` · ${u}`:""}`,"aria-label":`${t$1.quality}: ${this.layerName(r$1?.currentLayer)}${u?`, ${u}`:""}`},this.layerName(r$1?.currentLayer),u?A$1("span",{class:"quality-reason"}," · ",u):null):null,e?.handRaised?A$1("span",{class:"badge hand",title:t$1.raiseHand,"aria-label":t$1.raiseHand},"✋"):null,r$1?.muted?A$1("span",{class:"badge muted","aria-label":t$1.mute},"🔇"):null,"reconnecting"===e?.connection?A$1("span",{class:"badge reconnecting"},"…"):null),A$1("div",{key:"1bced9db2da6199526f087fc0c1786d21704ef93",class:"bottom-bar"},A$1("span",{key:"cb4a39c5b8ed184a7c97612d2173fbe35feee4a2",class:"name"},i),e?.isLocal?A$1("span",{class:"you"},"(you)"):null),f&&r$1?A$1("div",{class:"layer-control",part:"layer-control"},A$1("select",{class:"layer-select","aria-label":t$1.quality,onChange:this.changeLayer},A$1("option",{value:"",selected:!r$1.pinnedLayer},t$1.layerAuto),h.map((e=>A$1("option",{value:e,selected:r$1.pinnedLayer===e},this.layerName(e)))))):null,A$1("button",{key:"679dcbbdd938875848b58abfa96f9899efdf84f9",type:"button",class:"pin-button",part:"pin","aria-label":this.isPinned?t$1.unpin:t$1.pin,"aria-pressed":this.isPinned?"true":"false",title:this.isPinned?t$1.unpin:t$1.pin,onClick:this.togglePin},this.isPinned?"★":"☆"),A$1("slot",{key:"b273db2d22e11307c0680827b3773462879642d2",name:"overlay"})))}static get watchers(){return {session:[{onSessionChange:0}]}}static get style(){return ":host{display:block;min-width:0;min-height:0;--speaking-level:0;--tile-radius:var(--border-radius, 8px);--tile-bg:var(--bg-secondary, #f3f4f6);--tile-text:var(--text-primary, #171a1f);--accent:var(--accent-color, #4a86e8)}.tile{position:relative;width:100%;height:100%;overflow:hidden;border-radius:var(--tile-radius);background:var(--tile-bg);color:var(--tile-text);display:flex;align-items:center;justify-content:center;aspect-ratio:16 / 9;isolation:isolate}.video{width:100%;height:100%;object-fit:cover;display:block}.fit-contain .video{object-fit:contain;background:#000}.mirrored .video{transform:scaleX(-1)}.avatar{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:linear-gradient(160deg, var(--bg-light, #e7effc), var(--bg-secondary, #f3f4f6))}.avatar img{width:100%;height:100%;object-fit:cover}.initials{font-family:var(--font-primary, sans-serif);font-size:clamp(20px, 12cqmin, 56px);font-weight:700;color:var(--text-secondary, #9095a1)}.speaking-ring{position:absolute;inset:0;border-radius:inherit;pointer-events:none;box-shadow:inset 0 0 0 calc(2px + var(--speaking-level) * 4px) var(--accent);opacity:calc(0.35 + var(--speaking-level) * 0.65);transition:opacity 120ms linear}.tile.speaking .name::after{content:' • speaking';color:var(--accent);font-weight:600}.top-badges{position:absolute;top:6px;left:6px;display:flex;gap:4px}.badge{background:rgba(0, 0, 0, 0.55);color:#fff;border-radius:999px;padding:2px 6px;font-size:12px}.badge.quality{font-variant-numeric:tabular-nums;text-transform:uppercase;letter-spacing:0.02em}.quality-reason{font-weight:400;opacity:0.8;text-transform:none}.layer-control{position:absolute;top:6px;right:40px;display:flex;align-items:center}.layer-select{appearance:auto;max-width:110px;padding:3px 4px;border-radius:6px;border:1px solid rgba(255, 255, 255, 0.4);background:rgba(0, 0, 0, 0.55);color:#fff;font-family:var(--font-primary, sans-serif);font-size:11px;cursor:pointer}.layer-select:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.bottom-bar{position:absolute;left:0;right:0;bottom:0;padding:18px 8px 6px;display:flex;gap:4px;align-items:baseline;background:linear-gradient(transparent, rgba(0, 0, 0, 0.6))}.name{font-family:var(--font-primary, sans-serif);font-size:12px;font-weight:600;color:#fff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.you{font-size:11px;color:rgba(255, 255, 255, 0.75)}.pin-button{position:absolute;top:6px;right:6px;width:28px;height:28px;border-radius:50%;border:1px solid rgba(255, 255, 255, 0.4);background:rgba(0, 0, 0, 0.45);color:#fff;cursor:pointer;font-size:14px;line-height:1;opacity:0;transition:opacity 120ms ease}.tile:hover .pin-button,.pin-button:focus-visible{opacity:1}.agent-body{padding:12px;text-align:center}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}@media (prefers-reduced-motion: reduce){.speaking-ring,.pin-button{transition:none}}@container (max-width: 420px){.pin-button{opacity:1}.layer-select{max-width:86px}}"}},[769,"chatleo-call-tile",{session:[16],participant:[16],source:[1],fit:[1],mirrored:[4],strings:[16]},void 0,{session:[{onSessionChange:0}]}]);function f(){"undefined"!=typeof customElements&&["chatleo-call-tile","chatleo-call-agent-indicator"].forEach((t=>{switch(t){case "chatleo-call-tile":customElements.get(kt$1(t))||customElements.define(kt$1(t),h$1);break;case "chatleo-call-agent-indicator":customElements.get(kt$1(t))||r$1();}}));}f();
|
|
26
|
+
|
|
27
|
+
const h=yt$1(class extends c$2{constructor(t){super(),false!==t&&this.__registerHost(),this.__attachShadow(),this.layoutChange=_$1(this,"layoutChange");}get host(){return this}session;layout="auto";maxTiles;strings;layoutChange;result;unsubscribe;resizeObserver;lastVisibleKey="";connectedCallback(){this.attach(),this.observeSize();}disconnectedCallback(){this.unsubscribe?.(),this.resizeObserver?.disconnect();}attach(){this.unsubscribe?.(),this.session&&(this.unsubscribe=this.session.store.subscribe((t=>({participants:t.participants,activeSpeakerId:t.activeSpeakerId,pinnedId:t.pinnedId,sharingId:t.sharingId,mode:t.mode})),(()=>this.recompute()),((t,i)=>t.activeSpeakerId===i.activeSpeakerId&&t.pinnedId===i.pinnedId&&t.sharingId===i.sharingId&&t.mode===i.mode&&Ht(t.participants,i.participants))),this.recompute());}observeSize(){"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver((()=>this.recompute())),this.resizeObserver.observe(this.host));}recompute(){if(!this.session)return;const t=this.session.getState();if(!t.mode)return;const i=n$1({mode:t.mode,layout:this.layout,participants:t.participants,activeSpeakerId:t.activeSpeakerId,pinnedId:t.pinnedId,sharingId:t.sharingId,maxTiles:this.maxTiles,containerWidth:this.host.clientWidth||0,containerHeight:this.host.clientHeight||0});this.result=i;const s=i.visible.join(",");s!==this.lastVisibleKey&&(this.lastVisibleKey=s,this.session.setVisibleParticipants(i.visible),this.layoutChange.emit({kind:i.kind,page:i.page,pageCount:i.pageCount,visible:i.visible}));}tile(t,i,s){return A$1("chatleo-call-tile",{class:s,session:this.session,participant:t,source:i,fit:"screen"===i?"contain":"cover",strings:this.strings})}render(){const t=this.result;if(!t)return A$1(N$1,null);const i=t=>this.session?.getState().participants.find((i=>i.id===t));if("grid"===t.kind)return A$1(N$1,null,A$1("div",{class:"grid",part:"grid",style:{"--columns":String(t.columns)}},t.grid.map((t=>this.tile(t,"camera")))));if("direct"===t.kind){const s=i(t.stageId),e=t.inset;return A$1(N$1,null,A$1("div",{class:"stage",part:"stage"},A$1("div",{class:"main"},s?this.tile(s,"camera"):null),e?A$1("div",{class:"inset"},this.tile(e,"camera","inset-tile")):null))}const s=i(t.stageId);return A$1(N$1,null,A$1("div",{class:{stage:true,[t.kind]:true},part:"stage"},A$1("div",{class:"main"},s?this.tile(s,t.stageSource):null),t.filmstrip.length>0?A$1("div",{class:"filmstrip",part:"filmstrip"},t.filmstrip.map((t=>this.tile(t,"camera","strip-tile")))):null))}static get style(){return ":host{display:block;min-width:0;min-height:0;width:100%;height:100%;container-type:size}.grid{display:grid;grid-template-columns:repeat(var(--columns, 3), minmax(0, 1fr));gap:8px;padding:8px;width:100%;height:100%;box-sizing:border-box;align-content:center}.stage{position:relative;display:flex;flex-direction:column;width:100%;height:100%;padding:8px;box-sizing:border-box;gap:8px}.main{flex:1;min-height:0}.filmstrip{display:flex;gap:8px;overflow-x:auto;flex:0 0 96px}.filmstrip .strip-tile{width:160px;flex:0 0 auto}.inset{position:absolute;right:20px;bottom:20px;width:min(28%, 220px);aspect-ratio:16 / 9;box-shadow:0 6px 24px rgba(0, 0, 0, 0.3);border-radius:var(--border-radius, 8px);overflow:hidden;cursor:grab}@container (max-width: 600px){.grid{gap:4px;padding:4px}.filmstrip{flex-basis:72px}.filmstrip .strip-tile{width:120px}.inset{width:32%;right:12px;bottom:12px}}@media (prefers-reduced-motion: reduce){.inset{transition:none}}"}},[513,"chatleo-call-stage",{session:[16],layout:[1],maxTiles:[2,"max-tiles"],strings:[16],result:[32]}]);function p(){"undefined"!=typeof customElements&&["chatleo-call-stage","chatleo-call-agent-indicator","chatleo-call-tile"].forEach((i=>{switch(i){case "chatleo-call-stage":customElements.get(kt$1(i))||customElements.define(kt$1(i),h);break;case "chatleo-call-agent-indicator":customElements.get(kt$1(i))||r$1();break;case "chatleo-call-tile":customElements.get(kt$1(i))||f();}}));}p();
|
|
28
|
+
|
|
29
|
+
const a=yt$1(class extends c$2{constructor(t){super(),false!==t&&this.__registerHost(),this.__attachShadow(),this.resumeAudio=_$1(this,"resumeAudio"),this.rejoin=_$1(this,"rejoin");}session;strings;resumeAudio;rejoin;state;unsubscribe;get labels(){return {...i,...this.strings??{}}}connectedCallback(){this.attach();}disconnectedCallback(){this.unsubscribe?.();}attach(){this.unsubscribe?.(),this.session&&(this.unsubscribe=this.session.store.subscribe((t=>t),(t=>{this.state=t;})),this.state=this.session.getState());}render(){const t=this.labels,e=this.state;if(!e)return A$1(N$1,{hidden:true});const n=[];return "reconnecting"===e.status&&n.push({tone:"warn",text:t.reconnecting}),"migrating"===e.status&&n.push({tone:"warn",text:t.migrating}),"failed"===e.status&&n.push({tone:"error",text:e.error?.message??t.failed,action:"rejoin"}),"ended"===e.status&&n.push({tone:"muted",text:t.ended}),e.audioBlocked&&n.push({tone:"warn",text:t.audioBlocked,action:"resume"}),e.notice&&n.push({tone:"info",text:e.notice}),e.error&&"failed"!==e.status&&n.push({tone:"error",text:e.error.message}),e.transcriptionRunning&&n.push({tone:"live",text:t.transcriptionRunning}),e.recordingRunning&&n.push({tone:"live",text:t.recordingRunning}),A$1(N$1,null,A$1("div",{class:"live-region","aria-live":"polite","aria-atomic":"true"},n.length>0?n.map((t=>t.text)).join(". "):""),n.map((e=>A$1("div",{class:{banner:true,[e.tone]:true},part:"banner",role:"error"===e.tone?"alert":"status"},A$1("span",{class:"text"},e.text),"resume"===e.action?A$1("button",{type:"button",onClick:()=>this.resumeAudio.emit()},t.resumeAudio):null,"rejoin"===e.action?A$1("button",{type:"button",onClick:()=>this.rejoin.emit()},t.rejoin):null))))}static get style(){return ":host{display:block;font-family:var(--font-primary, sans-serif)}.banner{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 12px;font-size:12px;font-weight:600;color:#fff;background:#6b7280}.banner.warn{background:#f59e0b}.banner.error{background:#ef4444}.banner.info{background:#4a86e8}.banner.live{background:#b91c1c}.banner.muted{background:#6b7280}.banner button{border:1px solid rgba(255, 255, 255, 0.7);background:transparent;color:inherit;border-radius:var(--border-radius, 8px);padding:2px 8px;font:inherit;cursor:pointer}.live-region{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}"}},[513,"chatleo-call-status",{session:[16],strings:[16],state:[32]}]);function c(){"undefined"!=typeof customElements&&["chatleo-call-status"].forEach((e=>{"chatleo-call-status"===e&&(customElements.get(kt$1(e))||customElements.define(kt$1(e),a));}));}c();
|
|
30
|
+
|
|
31
|
+
const n=yt$1(class extends c$2{constructor(t){super(),false!==t&&this.__registerHost(),this.__attachShadow();}get host(){return this}session;maxLines=200;captions=false;strings;segments=[];autoScroll=true;unsubscribe;scrollEl;get labels(){return {...i,...this.strings??{}}}connectedCallback(){this.attach();}disconnectedCallback(){this.unsubscribe?.();}attach(){this.unsubscribe?.(),this.session&&(this.unsubscribe=this.session.store.subscribe((t=>t.transcript),(t=>{this.segments=t,requestAnimationFrame((()=>this.scrollToBottom()));})),this.segments=this.session.getState().transcript);}scrollToBottom(){this.autoScroll&&this.scrollEl&&(this.scrollEl.scrollTop=this.scrollEl.scrollHeight);}onScroll=()=>{this.scrollEl&&(this.autoScroll=this.scrollEl.scrollHeight-this.scrollEl.scrollTop-this.scrollEl.clientHeight<48);};groups(t$1){const s=[];for(const i of t$1){const t$1=s[s.length-1],e=this.session?.getState().participants.find((t=>t.id===i.participantId)),o=t(e,i.participantId);t$1&&t$1.participantId===i.participantId?t$1.segments.push(i):s.push({participantId:i.participantId,name:o,segments:[i]});}return s}render(){const t$1=this.labels,s=this.segments.slice(-this.maxLines);if(this.captions){const i=s.slice(-2);return A$1(N$1,null,A$1("div",{class:"captions",part:"captions","aria-live":"polite","aria-atomic":"false"},0===i.length?A$1("span",{class:"empty"},t$1.emptyTranscript):null,i.map((t$1=>A$1("p",{class:{line:true,interim:!t$1.final}},A$1("span",{class:"speaker"},t(this.session?.getState().participants.find((s=>s.id===t$1.participantId)),t$1.participantId),":")," ",t$1.text)))))}const i=this.groups(s);return A$1(N$1,null,A$1("div",{class:"panel",part:"panel"},A$1("div",{class:"scroll",ref:t=>{this.scrollEl=t;},onScroll:this.onScroll},0===i.length?A$1("p",{class:"empty"},t$1.emptyTranscript):null,i.map((t=>A$1("div",{class:"group"},A$1("span",{class:"speaker"},t.name),t.segments.map((t=>A$1("span",{class:{text:true,interim:!t.final}},t.text," "))))))),this.autoScroll?null:A$1("button",{type:"button",class:"jump",onClick:()=>{this.autoScroll=true,this.scrollToBottom();}},"↓")))}static get style(){return ":host{display:block;font-family:var(--font-primary, sans-serif);min-height:0}.panel{position:relative;height:100%;min-height:120px;background:var(--bg-primary, #fff);color:var(--text-primary, #171a1f)}.scroll{height:100%;overflow-y:auto;padding:8px;display:flex;flex-direction:column;gap:8px}.group{display:flex;flex-direction:column;gap:2px}.speaker{font-size:11px;font-weight:700;color:var(--accent-color, #4a86e8)}.text{font-size:13px;line-height:1.4}.text.interim{color:var(--text-secondary, #9095a1);font-style:italic}.empty{font-size:12px;color:var(--text-secondary, #9095a1)}.jump{position:absolute;right:12px;bottom:12px;width:30px;height:30px;border-radius:50%;border:1px solid var(--border-color, #bdc1ca);background:var(--bg-primary, #fff);cursor:pointer}.captions{position:absolute;left:50%;bottom:12px;transform:translateX(-50%);max-width:min(90%, 720px);padding:6px 12px;border-radius:var(--border-radius, 8px);background:rgba(0, 0, 0, 0.7);color:#fff;text-align:center;pointer-events:none}.line{margin:0;font-size:14px;line-height:1.35}.line.interim{opacity:0.7}"}},[513,"chatleo-call-transcript",{session:[16],maxLines:[2,"max-lines"],captions:[4],strings:[16],segments:[32],autoScroll:[32]}]);function l(){"undefined"!=typeof customElements&&["chatleo-call-transcript"].forEach((s=>{"chatleo-call-transcript"===s&&(customElements.get(kt$1(s))||customElements.define(kt$1(s),n));}));}l();
|
|
32
|
+
|
|
33
|
+
const y=yt$1(class extends c$2{constructor(t){super(),false!==t&&this.__registerHost(),this.__attachShadow(),this.callJoined=_$1(this,"callJoined"),this.callLeft=_$1(this,"callLeft"),this.callError=_$1(this,"callError"),this.callStatusChange=_$1(this,"callStatusChange");}get host(){return this}mode="group";connection;identity;autoJoin=false;audience=false;layout="auto";strings;transport;getToken;promoteHandler;demoteHandler;transcriptUrl;session;callJoined;callLeft;callError;callStatusChange;activeSession;status="idle";activeLayout="auto";chatOpen=true;transcriptOpen=false;ownsSession=false;unsubscribers=[];audioEl;returnFocus;get labels(){return e$2(this.strings)}componentWillLoad(){this.returnFocus="undefined"!=typeof document?document.activeElement:void 0,this.activeLayout=this.layout,this.session?(this.activeSession=this.session,this.activeSession.setIdentityResolver(this.identity)):(this.ownsSession=true,this.activeSession=Xi({identity:this.identity,transport:this.transport,strings:this.strings,logger:console,getToken:this.getToken,promote:this.promoteHandler,demote:this.demoteHandler})),this.attach();}componentDidLoad(){this.init();}disconnectedCallback(){this.unsubscribers.forEach((t=>t())),this.unsubscribers=[],this.ownsSession&&this.activeSession?.leave();}onSessionPropChange(){this.session&&(this.ownsSession=false,this.activeSession=this.session,this.attach());}onLayoutPropChange(){this.activeLayout=this.layout;}onSessionRequest(t){t.stopPropagation(),t.detail.callback(this.activeSession);}async join(t){const e=t??this.connection;if(!e)throw new Error("chatleo-call-room: no connection credentials supplied.");await(this.activeSession?.join(e));}async refreshToken(){await(this.activeSession?.refreshToken());}async leave(){await this.leaveCall();}attach(){this.unsubscribers.forEach((t=>t())),this.unsubscribers=[];const t=this.activeSession;t&&(this.unsubscribers.push(t.store.subscribe((t=>t.status),(t=>this.onStatus(t)))),this.unsubscribers.push(t.on("error",(t=>{this.callError.emit(t);}))),this.unsubscribers.push(t.on("statusChange",(t=>{const{status:e,previous:s}=t;this.callStatusChange.emit({status:e,previous:s});}))),this.onStatus(t.getState().status),this.transcriptUrl&&t.connectTranscript(this.transcriptUrl));}async init(){const t=this.activeSession;t&&(this.connection&&(this.autoJoin||this.audience||"stage"===this.mode)&&(this.audience||this.autoJoin)?await this.joinWithMedia(this.connection,{audio:!this.audience,video:!this.audience}):"idle"===t.getState().status&&await t.prepare());}onStatus(t){const e=this.status;this.status=t,"connected"===t&&"connected"!==e&&(this.callJoined.emit({roomId:this.activeSession?.getState().roomId??"",participantId:this.activeSession?.getState().localParticipantId??""}),this.host.focus?.()),"lobby"!==t&&"connected"!==t||setTimeout((()=>this.host.focus?.()),0);}async joinWithMedia(t,e){const s=this.activeSession;if(!s)return;await s.join(t);const o=s.localParticipant();e.audio&&o?.capabilities.publishAudio&&await s.setMicEnabled(true),e.video&&o?.capabilities.publishVideo&&await s.setCameraEnabled(true);}async leaveCall(){await(this.activeSession?.leave()),this.callLeft.emit(),this.returnFocus?.focus?.();}async report(t){try{await t();}catch(t){const e=t.toInfo?.()??{code:"unexpected_error",category:"room",recoverable:true,message:t?.message??"Something went wrong."};this.callError.emit(e);}}onJoinRequest(t){t.stopPropagation(),this.connection&&this.report((()=>this.joinWithMedia(this.connection,t.detail)));}onToggleMic(t){t.stopPropagation(),this.report((()=>this.activeSession.setMicEnabled(t.detail.enabled)));}onToggleCamera(t){t.stopPropagation(),this.report((()=>this.activeSession.setCameraEnabled(t.detail.enabled)));}onToggleScreenShare(t){t.stopPropagation(),this.report((()=>t.detail.enabled?this.activeSession.startScreenShare():this.activeSession.stopScreenShare()));}onToggleHand(t){t.stopPropagation(),this.report((()=>this.activeSession.setHandRaised(t.detail.raised)));}onToggleChat(t){t.stopPropagation(),this.chatOpen=!this.chatOpen,this.chatOpen&&(this.transcriptOpen=false);}onToggleTranscript(t){t.stopPropagation(),this.transcriptOpen=!this.transcriptOpen,this.transcriptOpen&&(this.chatOpen=false);}onToggleLayout(t){t.stopPropagation();const e=["auto","grid","speaker"];this.activeLayout=e[(e.indexOf(this.activeLayout)+1)%e.length];}onPin(t){t.stopPropagation(),this.activeSession?.pin(t.detail.pinned?t.detail.participantId:null);}onLayerChange(t){t.stopPropagation(),this.report((()=>this.activeSession.setLayer(t.detail.trackId,t.detail.layer)));}onDeviceChange(t){t.stopPropagation(),this.report((()=>this.activeSession.selectDevice(t.detail.kind,t.detail.deviceId)));}onPromote(t){t.stopPropagation();const e=this.participant(t.detail.participantId);this.report((()=>this.activeSession.promote(t.detail.participantId,{publishAudio:true,publishVideo:true,publishScreen:true,moderate:!!e?.capabilities.moderate})));}onDemote(t){t.stopPropagation(),this.report((()=>this.activeSession.demote(t.detail.participantId)));}onMuteRemote(t){t.stopPropagation(),this.report((()=>this.activeSession.muteRemote(t.detail.participantId,t.detail.source)));}onRemove(t){t.stopPropagation(),this.report((()=>this.activeSession.remove(t.detail.participantId)));}onResumeAudio(t){t.stopPropagation(),this.audioEl?.resumeAudio(),this.activeSession?.resumeAudio();}onRejoin(t){t.stopPropagation(),this.report((()=>this.activeSession.rejoin()));}onLeave(t){t.stopPropagation(),this.leaveCall();}participant(t){return this.activeSession?.getState().participants.find((e=>e.id===t))}render(){const t=this.activeSession,e=this.labels,s="lobby"===this.status&&!this.audience,o="connected"===this.status||"reconnecting"===this.status||"migrating"===this.status,n=o,r="stage"===this.activeSession?.getState().mode;return A$1(N$1,{key:"0665700a4378102caab6a088ae4be3c51036dd56",tabIndex:-1},A$1("div",{key:"d79cf04ddb0d0aac5b9c23711b9dd1ee07731587",class:{room:true,[`status-${this.status}`]:true},part:"room"},A$1("div",{key:"2bc1af847d197e154f75e00bc473eae7933d8c62",class:"body"},A$1("main",{key:"f265d55fad07df031fec8903437887d67534664b",class:"stage-area",part:"stage-area"},s?A$1("slot",{name:"lobby"},A$1("chatleo-call-lobby",{session:t,strings:this.strings})):null,o?A$1("chatleo-call-stage",{session:t,layout:this.activeLayout,strings:this.strings}):null,"idle"===this.status||"ended"===this.status?A$1("slot",{name:"empty"}):null,"connected"!==this.status&&"reconnecting"!==this.status||!this.transcriptOpen?null:A$1("div",{class:"captions-layer"},A$1("chatleo-call-transcript",{session:t,captions:true,strings:this.strings})),A$1("chatleo-call-status",{key:"66843a8b669c81b39afd4e15e0a0e141177a15b8",session:t,strings:this.strings})),A$1("aside",{key:"864eb956df9ef5d3c71168f8c209784cbbe55850",class:{side:true,open:this.chatOpen||this.transcriptOpen},part:"side"},A$1("div",{key:"2848351ae713e82b6232615df455952f94fb9812",class:"tabs"},A$1("button",{key:"e284ca8682a63e824c6097f36a47dd8016752451",type:"button",class:{active:this.chatOpen},"aria-pressed":this.chatOpen?"true":"false",onClick:t=>this.onToggleChat(t)},e.chat),A$1("button",{key:"65cb3bbce8ab18decfbf9849f881a68b9e4c1127",type:"button",class:{active:this.transcriptOpen},"aria-pressed":this.transcriptOpen?"true":"false",onClick:t=>this.onToggleTranscript(t)},e.transcript)),A$1("div",{key:"065b72d3e57f3b898cffb92a5645a30cdfc9e4a8",class:"panel"},this.chatOpen?A$1("div",{class:"chat-slot",hidden:!this.chatOpen},A$1("slot",{name:"chat"})):null,this.transcriptOpen?A$1("chatleo-call-transcript",{session:t,strings:this.strings}):null,this.chatOpen||this.transcriptOpen||r?null:A$1("chatleo-call-roster",{session:t,strings:this.strings})),A$1("div",{key:"73e8d86a8dc1c7050400e7f3a92d5e7368543b21",class:"roster-slot"},r?A$1("chatleo-call-roster",{session:t,strings:this.strings}):null))),n?A$1("chatleo-call-controls",{session:t,mode:this.activeSession?.getState().mode??this.mode,layout:this.activeLayout,chatOpen:this.chatOpen,transcriptOpen:this.transcriptOpen,strings:this.strings},A$1("slot",{name:"controls-start",slot:"start"}),A$1("slot",{name:"controls-end",slot:"end"})):null,A$1("chatleo-call-audio",{key:"e7928a204a5bbd02cdb71cf7c776538ad46c74b7",session:t,ref:t=>{this.audioEl=t;}})))}static get watchers(){return {session:[{onSessionPropChange:0}],layout:[{onLayoutPropChange:0}]}}static get style(){return ":host{display:block;position:relative;width:100%;height:100%;min-height:320px;font-family:var(--font-primary, 'Manrope', sans-serif);color:var(--text-primary, #171a1f);background:var(--bg-primary, #ffffff);--bg-primary:var(--bg-primary, #ffffff);--bg-secondary:var(--bg-secondary, #f3f4f6);--bg-light:var(--bg-light, #e7effc);--text-primary:var(--text-primary, #171a1f);--text-secondary:var(--text-secondary, #9095a1);--border-color:var(--border-color, #bdc1ca);--border-light:var(--border-light, #eeeeee);--accent-color:var(--accent-color, #4a86e8);--accent-hover:var(--accent-hover, #3a7bd8);--border-radius:var(--border-radius, 8px)}:host(:focus-visible){outline:2px solid var(--accent-color);outline-offset:-2px}.room{display:flex;flex-direction:column;width:100%;height:100%;min-height:0;container-type:inline-size}.body{display:flex;flex:1;min-height:0}.stage-area{position:relative;flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;background:var(--bg-secondary, #f3f4f6)}.stage-area>chatleo-call-stage{flex:1;min-height:0}.captions-layer{position:absolute;left:0;right:0;bottom:0;pointer-events:none}.side{width:clamp(240px, 28%, 360px);min-width:0;border-left:1px solid var(--border-light, #eeeeee);background:var(--bg-primary, #ffffff);display:flex;flex-direction:column;min-height:0}.side:not(.open){width:0;border-left:0;overflow:hidden}.tabs{display:flex;gap:4px;padding:6px;border-bottom:1px solid var(--border-light, #eeeeee)}.tabs button{flex:1;min-height:32px;border:0;border-radius:var(--border-radius, 8px);background:transparent;color:var(--text-secondary, #9095a1);font:inherit;font-size:12px;font-weight:600;cursor:pointer}.tabs button.active{background:var(--bg-secondary, #f3f4f6);color:var(--text-primary, #171a1f)}.tabs button:focus-visible{outline:2px solid var(--accent-color);outline-offset:1px}.panel,.chat-slot,.roster-slot{min-height:0}.panel{flex:1;overflow:auto}.chat-slot{height:100%}.roster-slot{border-top:1px solid var(--border-light, #eeeeee)}chatleo-call-status{flex-shrink:0}@container (max-width: 640px){.body{flex-direction:column}.side{width:100%;height:42%;border-left:0;border-top:1px solid var(--border-light, #eeeeee)}.side:not(.open){height:0}.tabs{position:sticky;top:0;background:var(--bg-primary, #ffffff);z-index:2}}@media (prefers-reduced-motion: reduce){*{transition:none !important;animation:none !important}}"}},[769,"chatleo-call-room",{mode:[1],connection:[16],identity:[16],autoJoin:[4,"auto-join"],audience:[4],layout:[1],strings:[16],transport:[16],getToken:[16],promoteHandler:[16],demoteHandler:[16],transcriptUrl:[1,"transcript-url"],session:[16],activeSession:[32],status:[32],activeLayout:[32],chatOpen:[32],transcriptOpen:[32],join:[64],refreshToken:[64],leave:[64]},[[0,"chatleoCallSessionRequest","onSessionRequest"],[0,"joinRequest","onJoinRequest"],[0,"toggleMic","onToggleMic"],[0,"toggleCamera","onToggleCamera"],[0,"toggleScreenShare","onToggleScreenShare"],[0,"toggleHand","onToggleHand"],[0,"toggleChat","onToggleChat"],[0,"toggleTranscript","onToggleTranscript"],[0,"toggleLayout","onToggleLayout"],[0,"pin","onPin"],[0,"layerChange","onLayerChange"],[0,"deviceChange","onDeviceChange"],[0,"promote","onPromote"],[0,"demote","onDemote"],[0,"muteRemote","onMuteRemote"],[0,"remove","onRemove"],[0,"resumeAudio","onResumeAudio"],[0,"rejoin","onRejoin"],[0,"leave","onLeave"]],{session:[{onSessionPropChange:0}],layout:[{onLayoutPropChange:0}]}]);function v(){"undefined"!=typeof customElements&&["chatleo-call-room","chatleo-call-agent-indicator","chatleo-call-audio","chatleo-call-controls","chatleo-call-device-select","chatleo-call-lobby","chatleo-call-roster","chatleo-call-stage","chatleo-call-status","chatleo-call-tile","chatleo-call-transcript"].forEach((e=>{switch(e){case "chatleo-call-room":customElements.get(kt$1(e))||customElements.define(kt$1(e),y);break;case "chatleo-call-agent-indicator":customElements.get(kt$1(e))||r$1();break;case "chatleo-call-audio":customElements.get(kt$1(e))||h$2();break;case "chatleo-call-controls":customElements.get(kt$1(e))||n$4();break;case "chatleo-call-device-select":customElements.get(kt$1(e))||o();break;case "chatleo-call-lobby":customElements.get(kt$1(e))||d$1();break;case "chatleo-call-roster":customElements.get(kt$1(e))||p$1();break;case "chatleo-call-stage":customElements.get(kt$1(e))||p();break;case "chatleo-call-status":customElements.get(kt$1(e))||c();break;case "chatleo-call-tile":customElements.get(kt$1(e))||f();break;case "chatleo-call-transcript":customElements.get(kt$1(e))||l();}}));}v();
|
|
34
|
+
|
|
35
|
+
const k=yt$1(class extends c$2{constructor(t){super(),false!==t&&this.__registerHost(),this.__attachShadow(),this.callAccept=_$1(this,"callAccept"),this.callDecline=_$1(this,"callDecline");}get host(){return this}callId;conversationId;mode="group";autoJoin=false;video=true;connection;credentialsProvider;identity;getToken;promoteHandler;demoteHandler;callEvents;strings;callAccept;callDecline;incoming;roomCredentials;roomMode="group";listeners=[];attachedTarget;connectedCallback(){this.attachEvents(this.callEvents);}disconnectedCallback(){this.detachEvents();}onCallEventsChange(t){this.attachEvents(t);}detachEvents(){if(this.attachedTarget){for(const{type:t,handler:e}of this.listeners)this.attachedTarget.removeEventListener(t,e);this.listeners=[],this.attachedTarget=void 0;}}attachEvents(t){if(this.detachEvents(),!t)return;this.attachedTarget=t;const e=(e,s)=>{const o=t=>s(t.detail??{});t.addEventListener(e,o),this.listeners.push({type:e,handler:o});};e("call.ringing",(t=>{this.incoming=t,this.roomMode=t.mode??"direct";})),e("call.accepted",(()=>{this.incoming&&!this.roomCredentials&&this.accept();})),e("call.declined",(()=>{this.incoming=void 0;})),e("call.ended",(()=>{this.incoming=void 0,this.roomCredentials=void 0;}));}async fetchCredentials(){return this.connection?this.connection:this.credentialsProvider&&this.callId?this.credentialsProvider(this.callId):void 0}async accept(){const t=await this.fetchCredentials();t&&(this.roomCredentials=t,this.roomMode=t.mode,this.callAccept.emit({callId:this.callId??t.roomId}),this.incoming=void 0);}decline(){this.callDecline.emit({callId:this.callId??""}),this.incoming=void 0;}async refreshToken(){const t=this.host.shadowRoot?.querySelector("chatleo-call-room");await(t?.refreshToken?.());}render(){if(this.incoming)return A$1(N$1,null,A$1("chatleo-call-incoming",{caller:this.incoming.caller,video:this.incoming.video??this.video,strings:this.strings,onAccept:()=>{this.accept();},onDecline:()=>this.decline()}));const t=this.roomCredentials??this.connection;return t?A$1(N$1,null,A$1("chatleo-call-room",{mode:this.roomCredentials?this.roomMode:this.connection?.mode??this.mode,connection:t,identity:this.identity,autoJoin:this.autoJoin,strings:this.strings,getToken:this.getToken,promoteHandler:this.promoteHandler,demoteHandler:this.demoteHandler},A$1("slot",{name:"chat",slot:"chat"}),A$1("slot",{name:"controls-start",slot:"controls-start"}),A$1("slot",{name:"controls-end",slot:"controls-end"}),A$1("slot",{name:"empty",slot:"empty"}))):A$1(N$1,null,A$1("slot",{name:"empty"}),A$1("span",{class:"hint"},this.strings?.incomingCall??i.incomingCall))}static get watchers(){return {callEvents:[{onCallEventsChange:0}]}}},[769,"chatleo-call-adapter",{callId:[1,"call-id"],conversationId:[1,"conversation-id"],mode:[1],autoJoin:[4,"auto-join"],video:[4],connection:[16],credentialsProvider:[16],identity:[16],getToken:[16],promoteHandler:[16],demoteHandler:[16],callEvents:[16],strings:[16],incoming:[32],roomCredentials:[32],roomMode:[32],refreshToken:[64]},void 0,{callEvents:[{onCallEventsChange:0}]}]);function b(){"undefined"!=typeof customElements&&["chatleo-call-adapter","chatleo-call-agent-indicator","chatleo-call-audio","chatleo-call-controls","chatleo-call-device-select","chatleo-call-incoming","chatleo-call-lobby","chatleo-call-room","chatleo-call-roster","chatleo-call-stage","chatleo-call-status","chatleo-call-tile","chatleo-call-transcript"].forEach((e=>{switch(e){case "chatleo-call-adapter":customElements.get(kt$1(e))||customElements.define(kt$1(e),k);break;case "chatleo-call-agent-indicator":customElements.get(kt$1(e))||r$1();break;case "chatleo-call-audio":customElements.get(kt$1(e))||h$2();break;case "chatleo-call-controls":customElements.get(kt$1(e))||n$4();break;case "chatleo-call-device-select":customElements.get(kt$1(e))||o();break;case "chatleo-call-incoming":customElements.get(kt$1(e))||n$2();break;case "chatleo-call-lobby":customElements.get(kt$1(e))||d$1();break;case "chatleo-call-room":customElements.get(kt$1(e))||v();break;case "chatleo-call-roster":customElements.get(kt$1(e))||p$1();break;case "chatleo-call-stage":customElements.get(kt$1(e))||p();break;case "chatleo-call-status":customElements.get(kt$1(e))||c();break;case "chatleo-call-tile":customElements.get(kt$1(e))||f();break;case "chatleo-call-transcript":customElements.get(kt$1(e))||l();}}));}b();
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-Dxw4YCA_.js');
|
|
4
|
+
|
|
5
|
+
const chatleoChatInputCss = () => `:host{--input-radius:100px;--button-radius:4px}.chat-input-container{display:flex;align-items:center;gap:16px;padding:16px;border-top:1px solid var(--border-color);background:var(--bg-primary)}.input-wrapper{flex:1;display:flex;align-items:center;gap:8px;background:var(--bg-secondary);border-radius:var(--input-radius);padding:8px 16px}.chat-input{flex:1;border:none;outline:none;background:transparent;font-family:var(--font-primary);font-weight:400;font-size:14px;line-height:1.6;color:var(--text-primary)}.chat-input::placeholder{color:var(--text-secondary)}.emoji-button{border:none;background:transparent;cursor:pointer;font-size:16px;padding:0;display:flex;align-items:center;justify-content:center}.action-buttons{display:flex;gap:0}.action-button{width:32px;height:32px;border:none;background:transparent;border-radius:var(--button-radius);cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:14px;transition:background-color var(--transition-duration) ease}.action-button:hover{background:var(--bg-secondary)}`;
|
|
6
|
+
|
|
7
|
+
const ChatleoChatInput = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.messageInputSent = index.createEvent(this, "messageInputSent");
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* When `true`, the input field and all buttons are disabled, preventing user interaction.
|
|
14
|
+
*/
|
|
15
|
+
disabled = false;
|
|
16
|
+
/**
|
|
17
|
+
* If `true`, the message will be sent when the user presses `Cmd+Enter` (on Mac) or `Ctrl+Enter` (on other systems). If `false`, the message is sent on `Enter` alone.
|
|
18
|
+
*/
|
|
19
|
+
sendOnModifierEnter = false;
|
|
20
|
+
inputValue = '';
|
|
21
|
+
messageInputSent;
|
|
22
|
+
inputRef;
|
|
23
|
+
isMac = () => {
|
|
24
|
+
return typeof navigator !== 'undefined' && navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
|
25
|
+
};
|
|
26
|
+
handleSubmit = (e) => {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
if (this.disabled)
|
|
29
|
+
return;
|
|
30
|
+
const value = this.inputValue.trim();
|
|
31
|
+
if (value) {
|
|
32
|
+
this.messageInputSent.emit(value);
|
|
33
|
+
this.inputValue = '';
|
|
34
|
+
this.inputRef.value = ''; // TODO: why both?
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
handleKeyPress = (e) => {
|
|
38
|
+
if (e.key === 'Enter') {
|
|
39
|
+
if (this.sendOnModifierEnter) {
|
|
40
|
+
// Check for Cmd on Mac or Ctrl on Windows/Linux
|
|
41
|
+
const modifierPressed = this.isMac() ? e.metaKey : e.ctrlKey;
|
|
42
|
+
if (modifierPressed) {
|
|
43
|
+
this.handleSubmit(e);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// Default behavior: send on Enter
|
|
48
|
+
this.handleSubmit(e);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
handleInput = (e) => {
|
|
53
|
+
const target = e.target;
|
|
54
|
+
this.inputValue = target.value;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* @function render
|
|
58
|
+
* @description The render method for the `ChatleoChatInput` component. It creates the layout for the input area, including the text input, emoji button, and action buttons. The `disabled` state of the input and buttons is controlled by the `disabled` prop.
|
|
59
|
+
* @returns {any} A VNode representing the component's UI.
|
|
60
|
+
*/
|
|
61
|
+
render() {
|
|
62
|
+
return (index.h("div", { key: 'd4696c7c5c3a24901303a7ad4ccb5caa46e5a76c', class: "chat-input-container" }, index.h("div", { key: 'bda9a1218853fa285da618b59da61b7e42c872fa', class: "input-wrapper" }, index.h("input", { key: '96d1683a63cdfd3129a895a3dbe583a2d7e19618', ref: el => this.inputRef = el, type: "text", placeholder: "Write a comment...", class: "chat-input", onKeyPress: this.handleKeyPress, onInput: this.handleInput, disabled: this.disabled }), index.h("button", { key: '7de82bd11d42e77cf43d49691c1ce1a5cafa31ab', class: "emoji-button" }, "\uD83D\uDE0A")), index.h("div", { key: '63d136df55745b6f5c99a17e670fcff32c28a02f', class: "action-buttons" }, index.h("button", { key: '884b6bb075e46fe72d334720ea18b579c9fd37c0', class: "action-button" }, index.h("svg", { key: 'ffbcc860666136d91ae0e7833a22f5ecafb9a83e', xmlns: "http://www.w3.org/2000/svg", width: "17", height: "16", viewBox: "0 0 17 16", fill: "none" }, index.h("path", { key: '8e1f60338db9d48dff0293c120b17b44ea97eba4', d: "M11.9286 3.42858L11.9286 10.5714C11.9286 12.6286 10.2714 14.2857 8.21429 14.2857C6.15714 14.2857 4.5 12.6286 4.5 10.5714L4.5 4.28572C4.5 2.85715 5.64286 1.71429 7.07143 1.71429C8.5 1.71429 9.64286 2.85715 9.64286 4.28572L9.64286 10C9.64286 10.8 9.01429 11.4286 8.21429 11.4286C7.41429 11.4286 6.78571 10.8 6.78571 10L6.78571 5.14287", stroke: "#4A86E8", "stroke-width": "1.5", "stroke-miterlimit": "10", "stroke-linecap": "square" }))), index.h("button", { key: '1abac7331daae09f49faacaab62eb620dcc138b7', class: "action-button" }, index.h("svg", { key: '51ad70231d80fb7ca5543904b530697c528e8490', xmlns: "http://www.w3.org/2000/svg", width: "33", height: "32", viewBox: "0 0 33 32", fill: "none" }, index.h("path", { key: 'd606dad20a4ce3b88d6924a3ca9bd035a40fe894', d: "M10.5 18.5312L14.3226 14.7683C14.6047 14.4907 15.062 14.4907 15.344 14.7683L18.4444 17.8203M18.4444 17.8203L17.3611 18.8867M18.4444 17.8203L19.7393 16.5457C20.0214 16.268 20.4786 16.268 20.7607 16.5457L23.5 19.2422M11.9444 21.375H22.0556C22.8533 21.375 23.5 20.7384 23.5 19.9531V11.4219C23.5 10.6366 22.8533 10 22.0556 10H11.9444C11.1467 10 10.5 10.6366 10.5 11.4219V19.9531C10.5 20.7384 11.1467 21.375 11.9444 21.375ZM21.6944 13.1992C21.6944 13.9845 21.0477 14.6211 20.25 14.6211C19.4523 14.6211 18.8056 13.9845 18.8056 13.1992C18.8056 12.4139 19.4523 11.7773 20.25 11.7773C21.0477 11.7773 21.6944 12.4139 21.6944 13.1992Z", stroke: "#4A86E8", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }))), index.h("button", { key: '7e90543be4744853a917661f7ee9ad7d7792ea1c', class: "action-button", onClick: this.handleSubmit }, index.h("svg", { key: '9ca013889d4fec8d45543c54695a6335685b6802', xmlns: "http://www.w3.org/2000/svg", width: "17", height: "16", viewBox: "0 0 17 16", fill: "none" }, index.h("path", { key: '078800be3b4eef96e6801cd3b9b4036f5ac6c4e0', d: "M14.214 2.28564L5.64258 9.14279L5.64258 13.1428L7.69972 10.6856", stroke: "#4A86E8", "stroke-width": "1.5", "stroke-miterlimit": "10" }), index.h("path", { key: '10da5167e57bf2f5784a8e0b42c12aedcbb4f2e4', d: "M2.78613 6.85707L14.2147 2.28564L11.929 13.7142L2.78613 6.85707Z", stroke: "#4A86E8", "stroke-width": "1.5", "stroke-miterlimit": "10", "stroke-linecap": "square" }))))));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
ChatleoChatInput.style = chatleoChatInputCss();
|
|
66
|
+
|
|
67
|
+
exports.chatleo_chat_input = ChatleoChatInput;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-Dxw4YCA_.js');
|
|
4
|
+
var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
5
|
+
|
|
6
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
7
|
+
/*
|
|
8
|
+
Stencil Client Patch Browser v4.45.2 | MIT Licensed | https://stenciljs.com
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var patchBrowser = () => {
|
|
12
|
+
const importMeta = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chatleo.cjs.js', document.baseURI).href));
|
|
13
|
+
const opts = {};
|
|
14
|
+
if (importMeta !== "") {
|
|
15
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
16
|
+
}
|
|
17
|
+
return index.promiseResolve(opts);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
patchBrowser().then(async (options) => {
|
|
21
|
+
await appGlobals.globalScripts();
|
|
22
|
+
return index.bootstrapLazy([["chatleo-chat-input.cjs",[[513,"chatleo-chat-input",{"disabled":[4],"sendOnModifierEnter":[4,"send-on-modifier-enter"],"inputValue":[32]}]]],["my-component.cjs",[[513,"my-component",{"first":[1],"middle":[1],"last":[1]}]]],["chatleo-avatar_13.cjs",[[513,"chatleo-component",{"username":[1],"ticket":[1],"useTray":[4,"use-tray"],"useMain":[4,"use-main"],"useRoomView":[4,"use-room-view"],"roomId":[1,"room-id"],"chatLeoLib":[16],"chatStore":[16],"serverUrl":[1,"server-url"],"transport":[1],"calls":[1],"push":[1],"pushSwPath":[1,"push-sw-path"],"isLoggedIn":[32],"loading":[32],"isSessionExpired":[32],"connectionStatus":[32],"callsAvailable":[32],"incomingCall":[32],"callView":[32],"showCall":[32],"pushState":[32],"pushPromptDismissed":[32],"getConnectionStatus":[64],"openRoom":[64],"closeRoom":[64],"getActiveRoomId":[64],"getDraft":[64],"setDraft":[64],"addFiles":[64],"focusComposer":[64],"openDirectMessageWithUser":[64],"openNewChatDraft":[64]},[[0,"callError","onCallError"],[0,"callLeft","onCallLeft"],[0,"callRequested","onCallRequested"],[0,"newChatClicked","onNewChatClicked"],[0,"messageChatSent","onChatMessage"],[0,"userSelected","onUserSelectedForChat"]],{"chatLeoLib":[{"onChatLeoLibChange":0}],"chatStore":[{"onChatStoreChange":0}],"ticket":[{"onTicketChange":0}],"calls":[{"onCallsChange":0}],"incomingCall":[{"onIncomingCallChange":0}]}],[513,"chatleo-chat",{"chatStore":[16],"isOnline":[4,"is-online"],"pending":[4],"callsAvailable":[4,"calls-available"],"inCall":[4,"in-call"],"selectedRoomId":[32],"_version":[32],"_showRoomDetail":[32],"openRoom":[64],"closeRoom":[64],"getDraft":[64],"setDraft":[64],"addFiles":[64],"focusComposer":[64]},[[0,"messageInputSent","handleSendMessage"],[0,"messageSend","messageSendHandler"],[0,"roomClicked","handleRoomClicked"]],{"chatStore":[{"onChatStoreChange":0}]}],[513,"chatleo-tray-component",{"chatStore":[16],"isChatOpen":[32],"isNewChatSelectorOpen":[32],"isMessagesOpen":[32],"selectedRoomId":[32],"isPending":[32],"_version":[32],"isSessionExpired":[32],"connectionStatus":[32],"openChatPanel":[64]},[[0,"roomClicked","roomClickedHandler"],[0,"messageSend","messageSendHandler"]],{"chatStore":[{"onChatStoreChange":0}],"selectedRoomId":[{"onSelectedRoomIdChanged":0}]}],[513,"chatleo-room-view",{"chatStore":[16],"roomId":[1,"room-id"],"isOnline":[4,"is-online"],"pending":[4],"callsAvailable":[4,"calls-available"],"inCall":[4,"in-call"],"_version":[32],"getDraft":[64],"setDraft":[64],"addFiles":[64],"focusComposer":[64]},[[0,"messageRetry","messageRetryHandler"],[0,"messageDiscard","messageDiscardHandler"],[0,"messageSend","messageSendHandler"]],{"chatStore":[{"onChatStoreChange":0}],"roomId":[{"onRoomIdChanged":0}]}],[513,"chatleo-room-list",{"rooms":[16],"chatStore":[16],"selectedRoomId":[1,"selected-room-id"],"_version":[32],"isNewChatOpen":[32]},[[0,"userSelected","onUserSelected"]],{"chatStore":[{"onChatStoreChange":0}]}],[513,"chatleo-chat-message",{"message":[16],"sender":[16],"senderIsOnline":[4,"sender-is-online"],"isOwnMessage":[4,"is-own-message"],"locale":[1],"translations":[16]}],[513,"chatleo-new-message-selector",{"chatStore":[16],"placeholder":[1],"filterText":[32],"filteredUsers":[32],"_version":[32]},null,{"chatStore":[{"onChatStoreChange":0}]}],[513,"chatleo-chat-header",{"name":[1],"avatar":[1],"isOnline":[4,"is-online"]}],[513,"chatleo-room-tile-component",{"room":[16],"chatStore":[16],"onlineUserIds":[16],"lastMessage":[1,"last-message"],"timestamp":[1],"unreadCount":[2,"unread-count"],"isActive":[4,"is-active"]}],[513,"chatleo-rich-input",{"disabled":[4],"placeholder":[1],"maxHeight":[1,"max-height"],"acceptFiles":[1,"accept-files"],"isDragOver":[32],"hasContent":[32],"getText":[64],"setText":[64],"addFiles":[64],"focusEditor":[64]}],[513,"chatleo-user-tile",{"profile":[16],"isOnline":[4,"is-online"],"lastSeen":[1,"last-seen"]}],[513,"chatleo-rich-message-renderer",{"content":[16],"downloadUrls":[16],"alignment":[1],"translations":[16],"attachmentStates":[32]}],[513,"chatleo-avatar",{"name":[1],"url":[1],"isOnline":[4,"is-online"]}]]]], options);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.setNonce = index.setNonce;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @function format
|
|
5
|
+
* @description This utility function concatenates the first, middle, and last names into a single string, with spaces in between. It gracefully handles cases where some or all of the name parts are not provided.
|
|
6
|
+
* @param {string} first - The first name.
|
|
7
|
+
* @param {string} middle - The middle name.
|
|
8
|
+
* @param {string} last - The last name.
|
|
9
|
+
* @returns {string} The full name as a single string.
|
|
10
|
+
*/
|
|
11
|
+
function format(first, middle, last) {
|
|
12
|
+
return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @function groupMessagesByDate
|
|
16
|
+
* @description This function takes an array of `ChatLeoMessage` objects and groups them into a record where the keys are formatted dates and the values are arrays of messages from that date.
|
|
17
|
+
* @param {ChatLeoMessage[]} messages - An array of `ChatLeoMessage` objects to be grouped.
|
|
18
|
+
* @returns {Record<string, ChatLeoMessage[]>} An object where keys are date strings and values are arrays of messages.
|
|
19
|
+
*/
|
|
20
|
+
function groupMessagesByDate(messages) {
|
|
21
|
+
return [...messages]
|
|
22
|
+
.sort((a, b) => {
|
|
23
|
+
// Sequence numbers are authoritative when both messages have one; legacy servers (and
|
|
24
|
+
// optimistic local messages) fall back to timestamps.
|
|
25
|
+
if (typeof a.seq === 'number' && typeof b.seq === 'number')
|
|
26
|
+
return a.seq - b.seq;
|
|
27
|
+
if (typeof a.seq === 'number' || typeof b.seq === 'number')
|
|
28
|
+
return typeof a.seq === 'number' ? -1 : 1;
|
|
29
|
+
return new Date(a.created_at).getTime() - new Date(b.created_at).getTime();
|
|
30
|
+
})
|
|
31
|
+
.reduce((groups, message) => {
|
|
32
|
+
const date = formatDate(message.created_at);
|
|
33
|
+
if (!groups[date]) {
|
|
34
|
+
groups[date] = [];
|
|
35
|
+
}
|
|
36
|
+
groups[date].push(message);
|
|
37
|
+
return groups;
|
|
38
|
+
}, {});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @function formatDate
|
|
42
|
+
* @description This function takes a timestamp string, converts it to a Date object, and then formats it into a "Month Day, Year" format in uppercase.
|
|
43
|
+
* @param {string} timestamp - An ISO 8601 timestamp string.
|
|
44
|
+
* @returns {string} The formatted date string (e.g., "JAN 1, 2023").
|
|
45
|
+
*/
|
|
46
|
+
function formatDate(timestamp) {
|
|
47
|
+
const date = new Date(timestamp);
|
|
48
|
+
return date.toLocaleDateString('en-US', {
|
|
49
|
+
day: 'numeric',
|
|
50
|
+
month: 'short',
|
|
51
|
+
year: 'numeric'
|
|
52
|
+
}).toUpperCase();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
exports.format = format;
|
|
56
|
+
exports.groupMessagesByDate = groupMessagesByDate;
|