1import{_ as B}from"./Vzh7R4nb.js";import{f as U,an as x,ao as E,a as N,i as A,v as h,k as L,U as z,N as O,o as c,b as P,z as $,c as k,a1 as q,a2 as j,J as F,ad as H,W as J}from"./Ci0sP1HV.js";import{_ as K}from"./BKc8u1VI.js";const V={key:0,class:"sport-widget"},w="bt-renderer",D={__name:"SportWidget",setup(G){const b=H(),a=U(),S=x(),{locale:v}=E(),y=N(),o=A([]),i=new Map,d=[];let l=0;const u=h(()=>v.value||"ru"),I=h(()=>S.token||""),R=h(()=>{var t;return`${(((t=b.public.betby)==null?void 0:t.rendererUrl)||"https://demoapi.betby.com").replace(/\/$/,"")}/bt-renderer.min.js`}),p=(e,t)=>[t,e.brandId||e.brand_id,e.widgetName,e.placeholder].filter(Boolean).join(":"),C=(e,t)=>{e?i.set(t,e):i.delete(t)},M=()=>new Promise((e,t)=>{if(window.BTRenderer){e();return}const r=document.getElementById(w);if(r){r.addEventListener("load",e,{once:!0}),r.addEventListener("error",t,{once:!0});return}const n=document.createElement("script");n.id=w,n.src=R.value,n.async=!0,n.onload=e,n.onerror=t,document.head.appendChild(n)}),f=()=>{for(;d.length;){const e=d.pop();e&&typeof e.kill=="function"&&e.kill()}},g=(e={})=>{if(e.url){if(/^[a-z][a-z0-9+.-]*:/i.test(e.url)){window.location.href=e.url;return}y.push(`/sport?bt-path=${encodeURIComponent(e.url)}`)}},T=e=>({placeholder:e.placeholder,onOutcomeClick:g,goToClick:g,onSportClick:g,onLogin:()=>{a.authModalMode="signIn",a.isOpenAuthModal=!0},onRegister:()=>{a.authModalMode="signUp",a.isOpenAuthModal=!0},onSessionRefresh:m}),W=async()=>{f(),o.value.length&&(await M(),await J(),o.value.forEach((e,t)=>{const r=p(e,t),n=i.get(r),s=e.brandId||e.brand_id;if(!n||!s||!e.widgetName)return;n.innerHTML="";const _=new window.BTRenderer().initialize({brand_id:s,token:e.token||void 0,lang:u.value,target:n,widgetName:e.widgetName,widgetParams:T(e)});d.push(_)}))};async function m(){const e=++l;try{const t=await a.fetchSportWidgets({language:u.value});if(e!==l)return;o.value=Array.isArray(t==null?void 0:t.widgets)?t.widgets:[],await W()}catch(t){if(e!==l)return;o.value=[],f(),console.error("Sport widgets loading failed",t)}}return L(m),z(()=>{f()}),O([u,I],m),(e,t)=>{const r=B;return c(),P(r,null,{default:$(()=>[o.value.length?(c(),k("section",V,[(c(!0),k(q,null,j(o.value,(n,s)=>(c(),k("div",{key:p(n,s),ref_for:!0,ref:_=>C(_,p(n,s)),class:"sport-widget__target"}))),128))])):F("",!0)]),_:1})}}},Z=K(D,[["__scopeId","data-v-010400ea"]]);export{Z 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.