1import ae from"./BUEL76OG.js";import te from"./8m5vIOb4.js";import{aV as le,aW as oe,cw as ne,bn as ue,a$ as o,b1 as k,bE as re,aX as ie,aY as se,b9 as I,cH as ce,bC as ve,br as $,by as pe,bs as q}from"./EBpBARSw.js";import"./eB0VGVVH.js";import"./C0Qb2_nu.js";import"./Dy2xinyL.js";import"./Df6GUClV.js";import"./Lmb05Apy.js";import"./D9wVAE0n.js";import"./CYaZkx--.js";import"./D6ZZ2SIr.js";import"./D8qwC3FG.js";import"./DvT_WZF3.js";import"./CtiuOz0V.js";import"./DL71b4LM.js";import"./CGB6CXIl.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new e.Error().stack;u&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[u]="ef4ce390-9935-4681-a485-0f6c152398ec",e._sentryDebugIdIdentifier="sentry-dbid-ef4ce390-9935-4681-a485-0f6c152398ec")}catch{}})();const de={HOST_URL:"https://www.forbes.ru"},he=le({name:"SpeechPlayer",props:{eventDetail:{type:Object,required:!0},volume:{type:Object,required:!0},audioVolume:{default:1,type:Number},playbackRate:{default:1,type:Number},isMobileFolder:{default:!1,type:Boolean}},emits:["close","toggleVolume","volumeInput","changeSpeed","folded","focusPlayer"],setup(e,{emit:u}){const A=oe(),B=de,r=A.$yandexMetrika,f=ne(),m=ue(),l=o(e.eventDetail),i=o(),c=o([]),P=o(""),E=o(""),t=I(()=>ce(l.value.url_alias||"")),z=I(()=>{const a=l.value.url_alias||l.value.path;return`${B.HOST_URL}/${a}`}),h=o(t.value.isPlaying),H=o(e.volume),T=I(()=>e.playbackRate),v=o(t.value.bufferLength),S=t.value.audioSpeechTask,L=o(),y=o(!1),b=o(!1),D=o(!1),R=o(!0),G=o(),p=o(null),U=o(0);k(()=>e.eventDetail,a=>{h.value&&(t.value.playPause(),h.value=t.value.isPlaying),b.value=!0,i.value=a,w("next")}),k(()=>t.value,()=>{N(),v.value=t.value.bufferLength,R.value=!0,t.value.on("update",a=>{h.value=!a.paused}),t.value.volume=H.value.current,t.value.playbackRate=T.value,t.value.onStatus("updateStatus",(a,n)=>{y.value=n}),t.value.onTrackIsOver("track-is-over",()=>{r.reachGoal("100%"),w("next",1500)})}),k(()=>e.playbackRate,a=>{t.value.playbackRate=a}),k(()=>e.audioVolume,a=>{t.value.volume=a});function g(a=null){a&&r.reachGoal("click_start"),t.value.playPause()}function _(){t.value.isPlaying&&t.value.playPause(),r.reachGoal("click_close"),u("close")}function M(){r.reachGoal("click_repear"),t.value.restart()}function X(){u("toggleVolume")}function Y(){const a=T.value===1?1.5:1;r.reachGoal("click_speed"),u("changeSpeed",a)}function J(){r.reachGoal("click_logo")}function Q(){f.currentRoute.path===`/${l.value.url_alias}`?window.scrollTo(0,0):f.push(`/${l.value.url_alias}`)}const Z=re(function*(){return m.pub.getPubMarusiaV1Blocks({document_id:l.value.id}).then(a=>a).then(({data:a})=>a.meta.document.block_total||0).catch(a=>console.error(a))});async function x(){const a=t.value.blocksCount||await Z.perform();t.value.blocksCount=L.value=a}async function N(){i.value=await F(l.value.next_url),E.value=i.value.title}async function F(a){const{data:n}=await m.pub.getPubArticleByAlias({url_alias:a});return n}async function w(a,n=1e3){if(a==="back"&&!c.value.length)return;let s="/";if(h.value&&t.value.playPause(),W(),D.value=!1,b.value=!0,r.reachGoal(`click_${a}`),a==="next")P.value=l.value.title||"",c.value.push({title:l.value.title,url:l.value.url_alias}),s+=i.value.url_alias,l.value=i.value;else{const{url:d}=c.value.pop();s+=d,P.value=c.value[c.value.length-1]?.title||"ÐÑÑÑÑÑÑвÑеÑ",l.value=await F(d)}await f.push(s),G.value=setTimeout(()=>{O(),b.value=!1,U.value+=1},n)}async function ee(){try{const a=t.value.audioInit;t.value.initAudioListeners(),y.value=!0;const n=await S.perform(l.value.id,v.value);t.value.addAudioChunk(n),await t.value.initAudioChunk(),a||g(),v.value+=1,y.value=!1}catch(a){console.error(a)}}async function O(){p.value&&p.value.abort(),p.value=new AbortController;const a=p.value.signal,n=2;if(await x(),t.value.bufferLength===L.value){await t.value.runAudioFromBuffer();return}for(t.value.bufferLength?h.value||g():await ee();v.value<L.value&&R.value;){if(a.aborted)return;try{if(t.value.tempBufferLength>=n){await new Promise(C=>setTimeout(C,1e3));continue}const s=v.value,d=await S.perform(l.value.id,s);t.value.addAudioChunk(d),v.value+=1,await new Promise(C=>setTimeout(C,500))}catch(s){if(s==="cancel")return;console.error("ÐÑибка загÑÑзки Ñанка:",s),await new Promise(d=>setTimeout(d,1e3))}}}function W(){clearTimeout(G.value),p.value&&p.value.abort(),t.value.resetInterval(),R.value=!1,S.cancelAll()}function V(a){u("volumeInput",a)}const K=new Map([["playerEnter",g],["playerEsc",_],["playerLeft",j],["playerRight",j],["playerBackspace",M],["playerUp",V],["playerDown",V]]);function j(a){const n=a.type==="playerLeft"?"back":"next";w(n)}return ie(()=>
1{O(),N(),r.reachGoal("start"),K.forEach((a,n)=>{window.addEventListener(n,a)})}),se(()=>{W(),K.forEach((a,n)=>{window.removeEventListener(n,a)})}),{handleSwitchArticle:w,close:_,restart:M,handleLogo:J,toggleVolume:X,playPause:g,handlePlaybackRate:Y,handleVolumeInput:V,goToCurrentArticle:Q,currentArticle:l,isChunkLoading:y,hasShowPopup:D,isWaitLoadSwitchArticle:b,prevArticleList:c,nextTitle:E,prevTitle:P,shareUrl:z,currentVolume:H,currentPlaybackRate:T,audio:t,componentKey:U}}}),fe={tabindex:"-1"};function me(e,u,A,B,r,f){const m=ae,l=te;return $(),pe("div",fe,[e.$viewport.isLessThan("tablet")?($(),q(m,{key:`mobile_${e.componentKey}`,audio:e.audio,"current-volume":e.currentVolume,"event-detail":e.currentArticle,"has-show-popup":e.hasShowPopup,"is-chunk-loading":e.isChunkLoading,"is-mobile-folder":e.isMobileFolder,"is-prev-list":e.prevArticleList.length,"is-wait-load-switch-article":e.isWaitLoadSwitchArticle,"next-title":e.nextTitle,"playback-rate":e.currentPlaybackRate,"prev-title":e.prevTitle,"share-url":e.shareUrl,onFolded:u[0]||(u[0]=i=>e.$emit("folded",i)),onHandleLogo:e.handleLogo,onHandlePlaybackRate:e.handlePlaybackRate,onPlayPause:e.playPause,onRestart:e.restart,onScrollTo:e.goToCurrentArticle,onSwitchArticle:e.handleSwitchArticle,onToggleVolume:e.toggleVolume,onVolumeInput:e.handleVolumeInput},null,8,["audio","current-volume","event-detail","has-show-popup","is-chunk-loading","is-mobile-folder","is-prev-list","is-wait-load-switch-article","next-title","playback-rate","prev-title","share-url","onHandleLogo","onHandlePlaybackRate","onPlayPause","onRestart","onScrollTo","onSwitchArticle","onToggleVolume","onVolumeInput"])):($(),q(l,{key:e.componentKey,audio:e.audio,"current-volume":e.currentVolume,"event-detail":e.currentArticle,"has-show-popup":e.hasShowPopup,"is-chunk-loading":e.isChunkLoading,"is-prev-list":e.prevArticleList.length,"is-wait-load-switch-article":e.isWaitLoadSwitchArticle,"next-title":e.nextTitle,"playback-rate":e.currentPlaybackRate,"prev-title":e.prevTitle,"share-url":e.shareUrl,onClose:e.close,onFocusPlayer:u[1]||(u[1]=i=>e.$emit("focusPlayer")),onHandleLogo:e.handleLogo,onHandlePlaybackRate:e.handlePlaybackRate,onPlayPause:e.playPause,onRestart:e.restart,onScrollTo:e.goToCurrentArticle,onSwitchArticle:e.handleSwitchArticle,onToggleVolume:e.toggleVolume,onVolumeInput:e.handleVolumeInput},null,8,["audio","current-volume","event-detail","has-show-popup","is-chunk-loading","is-prev-list","is-wait-load-switch-article","next-title","playback-rate","prev-title","share-url","onClose","onHandleLogo","onHandlePlaybackRate","onPlayPause","onRestart","onScrollTo","onSwitchArticle","onToggleVolume","onVolumeInput"]))])}const Ee=ve(he,[["render",me]]);export{Ee as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.