(function(){try{var g=typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};g["__faroBundleId_Speechify Chrome Extension"]="13.4.1"}catch(l){}})();
import{Dd as _,Fb as l,Gb as W,Za as C,ab as x,d as u,l as v}from"./chunk-XBBZ57XW.js";import{e as q}from"./chunk-G4TQUFZ6.js";import{e as d,f as Q}from"./chunk-EJVP26V3.js";import{m as f,n as I,o as H}from"./chunk-LZ6UXASV.js";import{d as Y,f as a,h as s}from"./chunk-XBE3KAOI.js";a();s();q();a();s();_();var y=Y(H()),X=d("/feature-flags/get");async function E(o){return X.then(n=>n.features[o])}function $(o){let[n,e]=(0,y.useState)({isLoading:!0});return(0,y.useEffect)(()=>{E(o).then(t=>{e({isLoading:!1,variant:t})}).catch(t=>{e({isLoading:!1,error:t})})},[]),n}Q();a();s();_();a();s();a();s();var D=(o,{argsToKey:n=()=>"key",timeout:e}={})=>{let t=new Map,c=async(...i)=>{let r=await Promise.resolve(n(...i));if(r==null)throw new Error("Cache: argsToKey did not return a valid key: "+r);if(!t.has(r)||e&&performance.now()-t.get(r).createdAt>e){let O=o(...i).then(b=>(t.get(r)?.value===O&&t.set(r,{...t.get(r),value:b}),b));t.set(r,{value:O,createdAt:performance.now()})}return t.get(r).value};return c.invalidateCache=(...i)=>{if(i.length===0){t=new Map;return}let r=n(...i);t.delete(r)},c.setCache=({args:i,key:r,value:O})=>{r||(r=n(...i??[])),t.set(r,{value:O,createdAt:performance.now()})},c.getCacheSync=({args:i,key:r}={})=>{if(r||(r=n(...i??[])),!(t.get(r)?.value instanceof Promise))return t.get(r)?.value},c};var S=D(async()=>{let{userAgent:o,brave:n}=navigator,e=o.toLowerCase(),t=/chrome|crios/.test(e)&&!/edge|edg\/|opr\//.test(e);return t&&n?.isBrave&&await n.isBrave()?"brave":t&&globalThis.chrome?"chrome":e.includes("edg/")?"microsoft edge":e.includes("opr/")&&globalThis.opr?"opera":"other"});I();var P=f("SidepanelAnalytics");async function B(o,n={}){try{let e=null;try{let{useSidepanelStore:r}=await import("./store-FYT53TH2.js");e=r.getState().currentUrl}catch(r){P.warn("Could not access sidepanel store for URL, using fallback:",r)}let t=e||window.location.href,c=(()=>{try{return new URL(t).hostname}catch{return t}})(),i={...n,source:"sidepanel",timestamp:Date.now(),hostname:c,webpage:t,browser:await S()};await d("/analytics/log",{eventName:o,properties:i})}catch(e){P.error("Failed to log analytics event:",o,e)}}a();s();var w=(e=>(e.DISABLED="disabled",e.ENABLED="enabled",e))(w||{}),F=(e=>(e.CONTROL="control",e.HYBRID="hybrid",e))(F||{}),A=(e=>(e.CONTROL="control",e.DISPLAY="display",e))(A||{}),L=(e=>(e.CONTROL="control",e.ENABLED="enabled",e))(L||{}),R=(e=>(e.CONTROL="control",e.ENABLED="introduce-autoplay",e))(R||{}),V=(e=>(e.CONTROL="control",e.ENABLED="enabled",e))(V||{}),U=(e=>(e.CONTROL="control",e.ENABLED="enabled",e))(U||{}),T=(e=>(e.CONTROL="control",e.ENABLED="enabled",e))(T||{}),M=(e=>(e.CONTROL="control",e.ENABLED="enabled",e))(M||{}),h=(e=>(e.CONTROL="control",e.ENABLED="enabled",e))(h||{}),N=(e=>(e.CONTROL="control",e.ENABLED="enabled",e))(N||{}),k=(e=>(e.CONTROL="control",e.ENABLED="enabled",e))(k||{}),G=(e=>(e.CONTROL="control",e.ENABLED="enabled",e))(G||{}),z=(e=>(e.CONTROL="control",e.ENABLED="enabled",e))(z||{}),j=(e=>(e.CONTROL="control",e.ENABLED="enabled",e))(j||{}),Oe={oneClickUpsellNotif:Object.values(A),ceParsingMode:Object.values(F),sidePlayer:Object.values(w),grafanaAnonymousTotalVisitLogging:Object.values(L),grafanaAnonymousUniqueVisitLogging:Object.values(L),introduceAiAutoplay:Object.values(R),cevoicetyping:Object.values(V),cevoicetypingFree:Object.values(U),ceVoiceMode:Object.values(T),ceVoiceModeFree:Object.values(M),ceVoiceModeOnByDefault:Object.values(h),ceCursorDictation:Object.values(N),ceQuestionRecommendation:Object.values(k),micButtonRedesign:Object.values(G),ceMeetingNoteTaking:Object.values(z),ceDictationDuringMeetingCapture:Object.values(j),voice_chat_voices_config:[]};I();a();s();v();x();v();W();x();v();var Ne=()=>u(o=>o.setVoiceModePermission);var ke=()=>u(o=>o.setIsActive),Ge=()=>u(o=>o.setStream);var ze=()=>C(o=>o.setIsPermissionModalOpen);var J=f("StartVoiceMode"),K=async()=>{if(!u.getState().isInitializing&&!u.getState().isActive){l.setIsInitializing(!0);try{let o=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});l.setStream(o),l.setVoiceModePermission(!0),l.setIsActive(!0),B("Voice Mode Clicked",{flow:"realtime_voice_chat"})}catch{l.setIsInitializing(!1),l.setIsPermissionModalOpen(!0)}}},nt=async()=>{try{if(await E("ceVoiceModeOnByDefault")==="control")return;let e=(await d("/auth/get-subscription"))?.subscription?.isPremium??!1,t=await E("ceVoiceMode"),c=await E("ceVoiceModeFree");(e?t==="enabled":c==="enabled")&&await K()}catch(o){J.error("Failed to check and start voice mode on boot:",o)}};export{E as a,$ as b,Ne as c,ke as d,Ge as e,ze as f,B as g,K as h,nt as i};
//# sourceMappingURL=chunk-NYKG27VY.js.map
