import{H as t}from"./chunks/human-core-COvRMT3l.js";export{E as EmitEvent,G as GatewayService,b as GatewayState,V as VoiceConversation,d as VoiceConversationE2E,f as buildExpandedWakeWords,e as generateNameVariants}from"./chunks/human-core-COvRMT3l.js";import"./chunks/shared-Bsx1K6Nf.js";import"./chunks/render-kGcOzzbC.js";import"three";import"three/examples/jsm/controls/OrbitControls.js";import"three/examples/jsm/loaders/RGBELoader.js";import"three/examples/jsm/loaders/GLTFLoader.js";import"three/examples/jsm/loaders/KTX2Loader.js";import"three/examples/jsm/libs/meshopt_decoder.module.js";import"three/examples/jsm/loaders/DRACOLoader.js";import"three/addons/controls/OrbitControls.js";var i,n;!function(t){t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSING=2]="CLOSING",t[t.CLOSED=3]="CLOSED"}(i||(i={})),function(t){t.DISCONNECTED="disconnected",t.CONNECTING="connecting",t.CONNECTED="connected",t.RECONNECTING="reconnecting",t.CLOSED="closed"}(n||(n={}));class s{container;conversation;hintElement=null;config;isVisible=!1;handleShow;handleHide;handleInterrupted;constructor(t){if("string"==typeof t.container){const e=document.getElementById(t.container);if(!e)throw new Error(`Container element not found: ${t.container}`);this.container=e}else this.container=t.container;this.conversation=t.conversation,this.config={textPrefix:t.textPrefix??"说",textSuffix:t.textSuffix??"可打断",animationDuration:t.animationDuration??300,customStyles:t.customStyles},this.handleShow=this.show.bind(this),this.handleHide=this.hide.bind(this),this.handleInterrupted=this.onInterrupted.bind(this),this.registerEventListeners()}registerEventListeners(){this.conversation.on("interruptHintShow",this.handleShow),this.conversation.on("interruptHintHide",this.handleHide),this.conversation.on("interrupted",this.handleInterrupted)}unregisterEventListeners(){this.conversation.off("interruptHintShow",this.handleShow),this.conversation.off("interruptHintHide",this.handleHide),this.conversation.off("interrupted",this.handleInterrupted)}createHintElement(t){const e=document.createElement("div");e.id="interrupt-hint",e.className="interrupt-hint",Object.assign(e.style,{position:"fixed",bottom:"120px",left:"50%",transform:"translateX(-50%) translateY(20px)",padding:"12px 24px",backgroundColor:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(10px)",borderRadius:"24px",color:"#ffffff",fontSize:"16px",fontWeight:"500",display:"flex",alignItems:"center",gap:"8px",opacity:"0",transition:`opacity ${this.config.animationDuration}ms ease, transform ${this.config.animationDuration}ms ease`,zIndex:"10000",pointerEvents:"none",whiteSpace:"nowrap",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.3)"}),this.config.customStyles&&Object.assign(e.style,this.config.customStyles);const i=document.createElement("span");i.innerHTML="🎙️",i.style.fontSize="20px",e.appendChild(i);const n=document.createElement("span"),s=t.map((t=>`"${t}"`)).join("、");return n.textContent=`${this.config.textPrefix}${s}${this.config.textSuffix}`,e.appendChild(n),e}show(t){this.isVisible||(this.hintElement&&this.hintElement.remove(),this.hintElement=this.createHintElement(t.words),this.container.appendChild(this.hintElement),requestAnimationFrame((()=>{this.hintElement&&(this.hintElement.style.opacity="1",this.hintElement.style.transform="translateX(-50%) translateY(0)")})),this.isVisible=!0)}hide(){if(!this.isVisible||!this.hintElement)return;this.hintElement.style.opacity="0",this.hintElement.style.transform="translateX(-50%) translateY(20px)";const t=this.hintElement;setTimeout((()=>{t.remove()}),this.config.animationDuration),this.hintElement=null,this.isVisible=!1}onInterrupted(t){this.hide(),this.showFeedback(t.feedback)}showFeedback(t){const e=document.createElement("div");e.className="interrupt-feedback",Object.assign(e.style,{position:"fixed",bottom:"120px",left:"50%",transform:"translateX(-50%)",padding:"12px 24px",backgroundColor:"rgba(76, 175, 80, 0.9)",borderRadius:"24px",color:"#ffffff",fontSize:"16px",fontWeight:"500",opacity:"0",transition:"opacity 200ms ease",zIndex:"10001",pointerEvents:"none"}),e.textContent=t,this.container.appendChild(e),requestAnimationFrame((()=>{e.style.opacity="1"})),setTimeout((()=>{e.style.opacity="0",setTimeout((()=>{e.remove()}),200)}),1e3)}get visible(){return this.isVisible}forceShow(t){this.show({words:t||this.conversation.coreInterruptWords})}forceHide(){this.hide()}destroy(){this.unregisterEventListeners(),this.hintElement&&(this.hintElement.remove(),this.hintElement=null),this.isVisible=!1}}export{s as InterruptHint,i as WebSocketState,t as default};
