obi-sdk 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modular/chunks/index-8d3d1cc8.js +6 -0
- package/dist/modular/chunks/index-8d3d1cc8.js.map +1 -0
- package/dist/modular/chunks/{obi-widget-c52bfca4.js → obi-widget-9e8ccac7.js} +3 -5
- package/dist/modular/chunks/{obi-widget-c52bfca4.js.map → obi-widget-9e8ccac7.js.map} +1 -1
- package/dist/modular/index.js +1 -1
- package/dist/modular/ui.js +10 -10
- package/dist/obi-sdk.standalone.iife.js +1 -1
- package/dist/obi-sdk.standalone.iife.js.map +1 -1
- package/dist/react.es.js +1 -7
- package/dist/react.es.js.map +1 -1
- package/dist/react.umd.js +1 -1
- package/dist/react.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/modular/chunks/index-d50e99a5.js +0 -6
- package/dist/modular/chunks/index-d50e99a5.js.map +0 -1
package/dist/react.umd.js
CHANGED
|
@@ -698,7 +698,7 @@ Url: ${no(A)}`),!0}return!1}function $F(A,e){return e?.length?Gp(A).some(t=>Js(t
|
|
|
698
698
|
* @license
|
|
699
699
|
* Copyright 2020 Google LLC
|
|
700
700
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
701
|
-
*/const c_=()=>new u_;class u_{}const Qu=new WeakMap,l_=n_(class extends a_{render(A){return we}update(A,[e]){const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=A.options?.host,this.rt(this.ct=A.element)),we}rt(A){if(this.isConnected||(A=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=Qu.get(e);t===void 0&&(t=new WeakMap,Qu.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,A),A!==void 0&&this.G.call(this.ht,A)}else this.G.value=A}get lt(){return typeof this.G=="function"?Qu.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var d_=Object.defineProperty,h_=Object.getOwnPropertyDescriptor,km=(A,e,t,n)=>{for(var i=n>1?void 0:n?h_(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&d_(e,t,i),i};let qi=class extends L.LitElement{constructor(){super(...arguments),this.volume={speaker:"ASSISTANT",volume:0,spectrum:[]},this.canvasRef=c_(),this.barCount=8,this.animationFrame=null,this.primaryColor=Hr}connectedCallback(){super.connectedCallback(),this.primaryColor=getComputedStyle(this).getPropertyValue("--obi-primary").trim()||Hr,this.startAnimation()}disconnectedCallback(){super.disconnectedCallback(),this.stopAnimation()}startAnimation(){const e=()=>{this.drawEqualizer(),this.animationFrame=requestAnimationFrame(e)};this.animationFrame=requestAnimationFrame(e)}stopAnimation(){this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null)}drawEqualizer(){const e=this.canvasRef.value;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=window.devicePixelRatio||1,i=e.clientWidth,r=e.clientHeight;e.width=Math.round(i*n),e.height=Math.round(r*n),t.scale(n,n),t.imageSmoothingEnabled=!1,t.clearRect(0,0,i,r);const s=3,o=Math.max(1,(i-(this.barCount-1)*s)/this.barCount),a=r/2,c=this.volume.speaker==="USER"?this.volume.volume:this.volume.volume,u=this.volume.speaker==="USER"?this.volume.spectrum:this.volume.spectrum;if(c===0)return;let l=[];if(u&&u.length>0){const d=u.length,h=Math.ceil(d/10);let f=[];for(let v=0;v<10;v++){const C=v*h,w=Math.min((v+1)*h,d);let S=0;for(let F=C;F<w;F++)S+=u[F]||0;f.push({region:v,startIdx:C,endIdx:w,energy:S})}f.sort((v,C)=>C.energy-v.energy);const g=f.slice(0,3),p=Math.min(...g.map(v=>v.startIdx)),B=Math.max(...g.map(v=>v.endIdx));if(B>p)for(let v=0;v<this.barCount;v++){const C=p+v/(this.barCount-1)*(B-p),w=Math.min(d-1,Math.floor(C));l[v]=u[w]||0}else for(let v=0;v<this.barCount;v++){const C=v/(this.barCount-1)*(d/2),w=Math.min(d-1,Math.floor(C));l[v]=u[w]||0}const y=Math.max(...l,1),b=this.volume.speaker==="USER"?.7:.6;l=l.map((v,C)=>{const w=v/y,S=b+C/(this.barCount-1)*.3;return Math.min(1,w*S)})}else if(this.volume.speaker!=="USER")for(let d=0;d<this.barCount;d++){const h=Date.now()*.002,f=.3+.2*Math.sin(h+d*.7);l[d]=f}for(let d=0;d<this.barCount;d++){const h=l.length>0&&l[d]!==void 0?l[d]:c;
|
|
701
|
+
*/const c_=()=>new u_;class u_{}const Qu=new WeakMap,l_=n_(class extends a_{render(A){return we}update(A,[e]){const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=A.options?.host,this.rt(this.ct=A.element)),we}rt(A){if(this.isConnected||(A=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=Qu.get(e);t===void 0&&(t=new WeakMap,Qu.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,A),A!==void 0&&this.G.call(this.ht,A)}else this.G.value=A}get lt(){return typeof this.G=="function"?Qu.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var d_=Object.defineProperty,h_=Object.getOwnPropertyDescriptor,km=(A,e,t,n)=>{for(var i=n>1?void 0:n?h_(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&d_(e,t,i),i};let qi=class extends L.LitElement{constructor(){super(...arguments),this.volume={speaker:"ASSISTANT",volume:0,spectrum:[]},this.canvasRef=c_(),this.barCount=8,this.animationFrame=null,this.primaryColor=Hr}connectedCallback(){super.connectedCallback(),this.primaryColor=getComputedStyle(this).getPropertyValue("--obi-primary").trim()||Hr,this.startAnimation()}disconnectedCallback(){super.disconnectedCallback(),this.stopAnimation()}startAnimation(){const e=()=>{this.drawEqualizer(),this.animationFrame=requestAnimationFrame(e)};this.animationFrame=requestAnimationFrame(e)}stopAnimation(){this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null)}drawEqualizer(){const e=this.canvasRef.value;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=window.devicePixelRatio||1,i=e.clientWidth,r=e.clientHeight;e.width=Math.round(i*n),e.height=Math.round(r*n),t.scale(n,n),t.imageSmoothingEnabled=!1,t.clearRect(0,0,i,r);const s=3,o=Math.max(1,(i-(this.barCount-1)*s)/this.barCount),a=r/2,c=this.volume.speaker==="USER"?this.volume.volume:this.volume.volume,u=this.volume.speaker==="USER"?this.volume.spectrum:this.volume.spectrum;if(c===0)return;let l=[];if(u&&u.length>0){const d=u.length,h=Math.ceil(d/10);let f=[];for(let v=0;v<10;v++){const C=v*h,w=Math.min((v+1)*h,d);let S=0;for(let F=C;F<w;F++)S+=u[F]||0;f.push({region:v,startIdx:C,endIdx:w,energy:S})}f.sort((v,C)=>C.energy-v.energy);const g=f.slice(0,3),p=Math.min(...g.map(v=>v.startIdx)),B=Math.max(...g.map(v=>v.endIdx));if(B>p)for(let v=0;v<this.barCount;v++){const C=p+v/(this.barCount-1)*(B-p),w=Math.min(d-1,Math.floor(C));l[v]=u[w]||0}else for(let v=0;v<this.barCount;v++){const C=v/(this.barCount-1)*(d/2),w=Math.min(d-1,Math.floor(C));l[v]=u[w]||0}const y=Math.max(...l,1),b=this.volume.speaker==="USER"?.7:.6;l=l.map((v,C)=>{const w=v/y,S=b+C/(this.barCount-1)*.3;return Math.min(1,w*S)})}else if(this.volume.speaker!=="USER")for(let d=0;d<this.barCount;d++){const h=Date.now()*.002,f=.3+.2*Math.sin(h+d*.7);l[d]=f}for(let d=0;d<this.barCount;d++){const h=l.length>0&&l[d]!==void 0?l[d]:c;this.volume.speaker==="USER"?t.fillStyle=`${this.primaryColor}`:t.fillStyle="#FFFFFF";const f=Math.max(2,h*.8*a),g=i-(this.barCount-d)*(o+s),p=o/2;t.beginPath(),t.moveTo(g+p,r/2-f),t.lineTo(g+o-p,r/2-f),t.quadraticCurveTo(g+o,r/2-f,g+o,r/2-f+p),t.lineTo(g+o,r/2),t.lineTo(g,r/2),t.lineTo(g,r/2-f+p),t.quadraticCurveTo(g,r/2-f,g+p,r/2-f),t.fill(),t.beginPath(),t.moveTo(g,r/2),t.lineTo(g+o,r/2),t.lineTo(g+o,r/2+f-p),t.quadraticCurveTo(g+o,r/2+f,g+o-p,r/2+f),t.lineTo(g+p,r/2+f),t.quadraticCurveTo(g,r/2+f,g,r/2+f-p),t.lineTo(g,r/2),t.fill()}}render(){return L.html` <canvas ${l_(this.canvasRef)} width="40" height="40"></canvas> `}};qi.styles=L.css`
|
|
702
702
|
:host {
|
|
703
703
|
display: block;
|
|
704
704
|
width: 40px;
|