PageSourceSearch

https://itorah.com/chunk-IHZGCAZ3.js

js itorah.com collected 2026-10-02 05:03:58 UTC 82,460 bytes, 26 lines download raw bytes

1import{b as De}from"./chunk-EWNYEC2V.js";import{f as Ke,k as Xe,m as Ze}from"./chunk-Z2DB4BHG.js";import{d as K,e as Y,g as ze,h as ue,ya as Ye}from"./chunk-V7MTXOXS.js";import{h as Qe}from"./chunk-EJILD4HA.js";import{a as re}from"./chunk-XSTXKUXO.js";import{a as Ge}from"./chunk-7ALBCXC7.js";import{e as Je,r as T,w as H,y as R}from"./chunk-KLT57EFM.js";import{C as Be,Da as We,E as Ie,Ga as Ve,M as Se,R as we,U as He,Xa as N,a as E,b as B,d as Lt,e as Ut,g as x,ia as xe,m as q,n as F,oa as k,sa as b,ta as z,y as le}from"./chunk-P43IKVHK.js";var et=Lt((Ae,Me)=>{"use strict";(function(c,v){typeof Ae=="object"&&typeof Me<"u"?Me.exports=v():typeof define=="function"&&define.amd?define(v):(c=c||self).algoliasearch=v()})(Ae,function(){"use strict";function c(s,a,l){return a in s?Object.defineProperty(s,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):s[a]=l,s}function v(s,a){var l=Object.keys(s);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(s);a&&(h=h.filter(function(p){return Object.getOwnPropertyDescriptor(s,p).enumerable})),l.push.apply(l,h)}return l}function e(s){for(var a=1;a<arguments.length;a++){var l=arguments[a]!=null?arguments[a]:{};a%2?v(Object(l),!0).forEach(function(h){c(s,h,l[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(l)):v(Object(l)).forEac
1h(function(h){Object.defineProperty(s,h,Object.getOwnPropertyDescriptor(l,h))})}return s}function t(s,a){if(s==null)return{};var l,h,p=(function(P,f){if(P==null)return{};var I,C,O={},U=Object.keys(P);for(C=0;C<U.length;C++)I=U[C],f.indexOf(I)>=0||(O[I]=P[I]);return O})(s,a);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(s);for(h=0;h<y.length;h++)l=y[h],a.indexOf(l)>=0||Object.prototype.propertyIsEnumerable.call(s,l)&&(p[l]=s[l])}return p}function i(s,a){return(function(l){if(Array.isArray(l))return l})(s)||(function(l,h){if(Symbol.iterator in Object(l)||Object.prototype.toString.call(l)==="[object Arguments]"){var p=[],y=!0,P=!1,f=void 0;try{for(var I,C=l[Symbol.iterator]();!(y=(I=C.next()).done)&&(p.push(I.value),!h||p.length!==h);y=!0);}catch(O){P=!0,f=O}finally{try{y||C.return==null||C.return()}finally{if(P)throw f}}return p}})(s,a)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")})()}function r(s){return(function(a){if(Array.isArray(a)){for(var l=0,h=new Array(a.length);l<a.length;l++)h[l]=a[l];return h}})(s)||(function(a){if(Symbol.iterator in Object(a)||Object.prototype.toString.call(a)==="[object Arguments]")return Array.from(a)})(s)||(function(){throw new TypeError("Invalid attempt to spread non-iterable instance")})()}function n(){var s=typeof globalThis<"u"?globalThis:void 0;return s&&s.scheduler&&s.scheduler.yield?s.scheduler.yield().catch(function(a){return console.error("Failed to yield to main: ",a),new Promise(function(l){return setTimeout(l,0)})}):new Promise(function(a){return setTimeout(a,0)})}function o(s){var a,l="algoliasearch-client-js-".concat(s.key),h=function(){return a===void 0&&(a=s.localStorage||window.localStorage),a},p=function(){return JSON.parse(h().getItem(l)||"{}")},y=function(f){h().setItem(l,JSON.stringify(f))},P=function(){var f=s.timeToLive?1e3*s.timeToLive:null,I=p(),C=new Date().getTime();return Object.fromEntries(Object.entries(I).filter(function(O){var U=i(O,2)[1];return!(!U||U.timestamp===void 0)&&(!f||U.timestamp+f>=C)}))};return{get:function(f,I){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return n().then(function(){var O=P(),U=O[JSON.stringify(f)];return y(O),U?U.value:I().then(function(_){return C.miss(_).then(function(){return _})})})},set:function(f,I){return n().then(function(){var C=p();return C[JSON.stringify(f)]={timestamp:new Date().getTime(),value:I},h().setItem(l,JSON.stringify(C)),I})},delete:function(f){return n().then(function(){var I=p();delete I[JSON.stringify(f)],h().setItem(l,JSON.stringify(I))})},clear:function(){return Promise.resolve().then(function(){h().removeItem(l)})}}}function u(s){var a=r(s.caches),l=a.shift();return l===void 0?{get:function(h,p){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}},P=p();return P.then(function(f){return Promise.all([f,y.miss(f)])}).then(function(f){return i(f,1)[0]})},set:function(h,p){return Promise.resolve(p)},delete:function(h){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(h,p){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return l.get(h,p,y).catch(function(){return u({caches:a}).get(h,p,y)})},set:function(h,p){return l.set(h,p).catch(function(){return u({caches:a}).set(h,p)})},delete:function(h){return l.delete(h).catch(function(){return u({caches:a}).delete(h)})},clear:function(){return l.clear().catch(function(){return u({caches:a}).clear()})}}}function d(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{serializable:!0},a={};return{get:function(l,h){var p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}},y=JSON.stringify(l);if(y in a)return Promise.resolve(s.serializable?JSON.parse(a[y]):a[y]);var P=h(),f=p&&p.miss||function(){return Promise.resolve()};return P.then(function(I){return f(I)}).then(function(){return P})},set:function(l,h){return a[JSON.stringify(l)]=s.serializable?JSON.stringify(h):h,Promise.resolve(h)},delete:function(l){return delete a[JSON.stringify(l)],Promise.resolve()},clear:function(){return a={},Promise.resolve()}}}function g(s){for(var a=s.length-1;a>0;a--){var l=Math.floor(Math.random()*(a+1)),h=s[a];s[a]=s[l],s[l]=h}return s}
1function m(s,a){return a&&Object.keys(a).forEach(function(l){s[l]=a[l](s)}),s}function S(s){for(var a=arguments.length,l=new Array(a>1?a-1:0),h=1;h<a;h++)l[h-1]=arguments[h];var p=0;return s.replace(/%s/g,function(){return encodeURIComponent(l[p++])})}var $={WithinQueryParameters:0,WithinHeaders:1};function A(s,a){var l=s||{},h=l.data||{};return Object.keys(l).forEach(function(p){["timeout","headers","queryParameters","data","cacheable"].indexOf(p)===-1&&(h[p]=l[p])}),{data:Object.entries(h).length>0?h:void 0,timeout:l.timeout||a,headers:l.headers||{},queryParameters:l.queryParameters||{},cacheable:l.cacheable}}var X={Read:1,Write:2,Any:3},ce=1,Pe=2,de=3;function he(s){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ce;return e(e({},s),{},{status:a,lastUpdate:Date.now()})}function oe(s){return typeof s=="string"?{protocol:"https",url:s,accept:X.Any}:{protocol:s.protocol||"https",url:s.url,accept:s.accept||X.Any}}var te="GET",Z="POST";function pe(s,a){return Promise.all(a.map(function(l){return s.get(l,function(){return Promise.resolve(he(l))})})).then(function(l){var h=l.filter(function(P){return(function(f){return f.status===ce||Date.now()-f.lastUpdate>12e4})(P)}),p=l.filter(function(P){return(function(f){return f.status===de&&Date.now()-f.lastUpdate<=12e4})(P)}),y=[].concat(r(h),r(p));return{getTimeout:function(P,f){return(p.length===0&&P===0?1:p.length+3+P)*f},statelessHosts:y.length>0?y.map(function(P){return oe(P)}):a}})}function _e(s,a,l,h){var p=[],y=(function(_,J){if(!(_.method===te||_.data===void 0&&J.data===void 0)){var M=Array.isArray(_.data)?_.data:e(e({},_.data),J.data);return JSON.stringify(M)}})(l,h),P=(function(_,J){var M=e(e({},_.headers),J.headers),j={};return Object.keys(M).forEach(function(G){var W=M[G];j[G.toLowerCase()]=W}),j})(s,h),f=l.method,I=l.method!==te?{}:e(e({},l.data),h.data),C=e(e(e({"x-algolia-agent":s.userAgent.value},s.queryParameters),I),h.queryParameters),O=0,U=function _(J,M){var j=J.pop();if(j===void 0)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support .",transporterStackTrace:Ue(p)};var G={data:y,headers:P,method:f,url:wt(j,l.path,C),connectTimeout:M(O,s.timeouts.connect),responseTimeout:M(O,h.timeout)},W=function(L){var w={request:G,response:L,host:j,triesLeft:J.length};return p.push(w),w},fe={onSuccess:function(L){return(function(w){try{return JSON.parse(w.content)}catch(Q){throw(function(D,ie){return{name:"DeserializationError",message:D,response:ie}})(Q.message,w)}})(L)},onRetry:function(L){var w=W(L);return L.isTimedOut&&O++,Promise.all([s.logger.info("Retryable failure",je(w)),s.hostsCache.set(j,he(j,L.isTimedOut?de:Pe))]).then(function(){return _(J,M)})},onFail:function(L){throw W(L),(function(w,Q){var D=w.content,ie=w.status,ae=D;try{ae=JSON.parse(D).message}catch(me){}return(function(me,be,_t){return{name:"ApiError",message:me,status:be,transporterStackTrace:_t}})(ae,ie,Q)})(L,Ue(p))}};return s.requester.send(G).then(function(L){return(function(w,Q){return(function(D){var ie=D.status;return D.isTimedOut||(function(ae){var me=ae.isTimedOut,be=ae.status;return!me&&~~be==0})(D)||~~(ie/100)!=2&&~~(ie/100)!=4})(w)?Q.onRetry(w):~~(w.status/100)==2?Q.onSuccess(w):Q.onFail(w)})(L,fe)})};return pe(s.hostsCache,a).then(function(_){return U(r(_.statelessHosts).reverse(),_.getTimeout)})}function St(s){var a={value:"Algolia for JavaScript (".concat(s,")"),add:function(l){var h="; ".concat(l.segment).concat(l.version!==void 0?" (".concat(l.version,")"):"");return a.value.indexOf(h)===-1&&(a.value="".concat(a.value).concat(h)),a}};return a}function wt(s,a,l){var h=Le(l),p="".concat(s.protocol,"://").concat(s.url,"/").concat(a.charAt(0)==="/"?a.substr(1):a);return h.length&&(p+="?".concat(h)),p}function Le(s){return Object.keys(s).map(function(a){return S("%s=%s",a,(l=s[a],Object.prototype.toString.call(l)==="[object Object]"||Object.prototype.toString.call(l)==="[object Array]"?JSON.stringify(s[a]):s[a]));var l}).join("&")}function Ue(s){return s.map(function(a){return je(a)})}function je(s){var a=s.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return e(e({},s),{},{request:e(e({},s.request),{},{headers:e(e({},s.request.headers),a)})})}var xt=function(s){var a=s.appId,l=(function(p,y,P){var f={"x-algolia-api-key":P,"x-algolia-application-id":y};return{headers:function(){return p===$.WithinHeaders?f:{}},queryParameters:function(){return p===$.WithinQueryParameters?f:{}}}})(s.authMode!==void 0?s.authMode:$.WithinHeaders,a,s.apiKey),h=(function(p){var y=p.hostsCache,P=p.logger,f=p.requester,I=p.requestsCache,C=p.responsesCache,O=p.timeouts,U=p.userAgent,_=p.hosts,J=p.queryParameters,M={hostsCache:y,logger:P,requester:f,requestsCache:I,responsesCache:C,timeouts:O,userAgent:U,headers:p.headers,queryParameters:J,hosts:_.map(function(j){return oe(j)}),read:function(j,G){var W=A(G,M.timeouts.read),fe=function(){return _e(M,M.hosts.filter(function(w){return(w.accept&X.Read)!=0}),j,W)};if((W.cacheable!==void 0?W.cacheable:j.cacheable)!==!0)return fe();var L={request:j,mappedRequestOptions:W,transporter:{queryParameters:M.queryParameters,headers:M.headers}};return M.responsesCache.get(L,function(){return M.requestsCache.get(L,function(){return M.requestsCache.set(L,fe()).then(function(w){return Promise.all([M.requestsCache.delete(L),w])},function(w){return Promise.all([M.requestsCache.delete(L),Promise.reject(w)])}).then(function(w){var Q=i(w,2);return Q[0],Q[1]})})},{miss:function(w){return M.responsesCache.set(L,w)}})},write:function(j,G){return _e(M,M.hosts.filter(function(W){return(W.accept&X.Write)!=0}),j,A(G,M.timeouts.write))}};return M})(e(e({hosts:[{url:"".concat(a,"-dsn.algolia.net"),accept:X.Read},{url:"".concat(a,".algolia.net"),accept:X.Write}].concat(g([{url:"".concat(a,"-1.algolianet.com")},{url:"".concat(a,"-2.algolianet.com")},{url:"".concat(a,"-3.algolianet.com")}]))},s),{},{headers:e(e(e({},l.headers()),{"content-type":"application/x-www-form-urlencoded"}),s.headers),queryParameters:e(e({},l.queryParameters()),s.queryParameters)}));return m({transporter:h,appId:a,addAlgoliaAgent:function(p,y){h.userAgent.add({segment:p,version:y})},clearCache:function(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(function(){})}},s.methods)},At=function(s){return function(a,l){return a.method===te?s.transporter.read(a,l):s.transporter.write(a,l)}},Ne=function(s){return function(a){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h={transporter:s.transporter,appId:s.appId,indexName:a};return m(h,l.methods)}},Re=function(s){return function(a,l){var h=a.map(function(p){return e(e({},p),{},{params:Le(p.params||{})})});return s.transporter.read({method:Z,path:"1/indexes/*/queries",data:{requests:h},cacheable:!0},l)}},$e=function(s){return function(a,l){return Promise.all(a.map(function(h){var p=h.params,y=p.facetName,P=p.facetQuery,f=t(p,["facetName","facetQuery"]);return Ne(s)(h.indexName,{methods:{searchForFacetValues:qe}}).searchForFacetValues(y,P,e(e({},l),f))}))}},Mt=function(s){return function(a,l,h){return s.transporter.read({method:Z,path:S("1/answers/%s/prediction",s.indexName),data:{query:a,queryLanguages:l},cacheable:!0},h)}},kt=function(s){return function(a,l){return s.transporter.read({method:Z,path:S("1/indexes/%s/query",s.indexName),data:{query:a},cacheable:!0},l)}},qe=function(s){return function(a,l,h){return s.transporter.read({method:Z,path:S("1/indexes/%s/facets/%s/query",s.indexName,a),data:{facetQuery:l},cacheable:!0},h)}},Tt=1,Ct=2,Et=3,Ot=function(s){return function(a,l){var h=a.map(function(p){return e(e({},p),{},{threshold:p.threshold||0})});return s.transporter.read({method:Z,path:"1/indexes/*/recommendations",data:{requests:h},cacheable:!0},l)}};function Fe(s,a,l){var h,p={appId:s,apiKey:a,timeouts:{connect:1,read:2,write:30},requester:{send:function(y){return new Promise(function(P){var f=new XMLHttpRequest;
1f.open(y.method,y.url,!0),Object.keys(y.headers).forEach(function(U){return f.setRequestHeader(U,y.headers[U])});var I,C=function(U,_){return setTimeout(function(){f.abort(),P({status:0,content:_,isTimedOut:!0})},1e3*U)},O=C(y.connectTimeout,"Connection timeout");f.onreadystatechange=function(){f.readyState>f.OPENED&&I===void 0&&(clearTimeout(O),I=C(y.responseTimeout,"Socket timeout"))},f.onerror=function(){f.status===0&&(clearTimeout(O),clearTimeout(I),P({content:f.responseText||"Network request failed",status:f.status,isTimedOut:!1}))},f.onload=function(){clearTimeout(O),clearTimeout(I),P({content:f.responseText,status:f.status,isTimedOut:!1})},f.send(y.data)})}},logger:(h=Et,{debug:function(y,P){return Tt>=h&&console.debug(y,P),Promise.resolve()},info:function(y,P){return Ct>=h&&console.info(y,P),Promise.resolve()},error:function(y,P){return console.error(y,P),Promise.resolve()}}),responsesCache:d(),requestsCache:d({serializable:!1}),hostsCache:u({caches:[o({key:"".concat("4.26.0","-").concat(s)}),d()]}),userAgent:St("4.26.0").add({segment:"Browser",version:"lite"}),authMode:$.WithinQueryParameters};return xt(e(e(e({},p),l),{},{methods:{search:Re,searchForFacetValues:$e,multipleQueries:Re,multipleSearchForFacetValues:$e,customRequest:At,initIndex:function(y){return function(P){return Ne(y)(P,{methods:{search:kt,searchForFacetValues:qe,findAnswers:Mt}})}},getRecommendations:Ot}}))}return Fe.version="4.26.0",Fe})});var tt=(()=>{class c{constructor(e,t){this.http=e,this.homeSrv=t}getSpeakersByGroup(e,t){return e==="main"&&this.mainSpeakers?.length&&!t?le(this.mainSpeakers):e==="all"&&this.allSpeakers?.length?le(this.allSpeakers):this.homeSrv.homeDataV3.pipe(Ie(i=>i.Speakers),xe(i=>{i&&i.length&&(this.allSpeakers=i,this.favSpeakers=i.filter(r=>r.isMySpeaker),this.mainSpeakers=i.filter(r=>r.isMainSpeaker))}),we(i=>{throw console.error("Failed to load speakers:",i),i}))}getSpeakersByGroupAlert(e,t){return e==="main"&&this.mainSpeakers?.length&&!t?le(this.mainSpeakers):e==="all"&&this.allSpeakers?.length&&!t?le(this.allSpeakers):this.homeSrv.homeDataV3.pipe(He(1),Ie(i=>i.Speakers),xe(i=>{i&&i.length&&(this.allSpeakers=i,this.favSpeakers=i.filter(r=>r.isMySpeaker),this.mainSpeakers=i.filter(r=>r.isMainSpeaker))}),we(i=>{throw console.error("Failed to load speakers:",i),i}))}getSpeakersByParasha(e){return this.http.get(`/Speakers/bycategory?Categories=${e}`)}addSpeakerToFavorites(e){return this.http.post(`/Speakers/myspeakers?SpeakerID=${e}`,{})}removeSpeakerFromFavorites(e){return this.http.delete(`/Speakers/myspeakers?SpeakerID=${e}`)}resetMySpeakers(){this.allSpeakers?.forEach(e=>e.isMySpeaker=!1),this.mainSpeakers?.forEach(e=>e.isMySpeaker=!1),this.favSpeakers=[]}static{this.\u0275fac=function(t){return new(t||c)(b(R),b(De))}}static{this.\u0275prov=k({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var ye=class{};var Nt=[{match:"because of a problem with your internet connection",disposition:"never_report",family:"provider",reason:"JW badConnection \u2014 the client's network, not the media"},{match:"cannot be played in this browser",disposition:"never_report",family:"media_element",reason:"JW cantPlayInBrowser \u2014 a client capability limit, stated by the player itself"},{match:"the video player failed to load",disposition:"never_report",family:"chunk_load",reason:"JW cantLoadPlayer \u2014 player assets failed to download, not the media"},{match:"live stream",disposition:"never_report",family:"provider",reason:"JW liveStreamDown \u2014 live source, not a lecture file"},{match:"protected content",disposition:"never_report",family:"license",reason:"JW protectedContent \u2014 DRM, not a media fault"},{match:"this video file cannot be played",disposition:"probe_then_report",family:"unknown",reason:"JW cantPlayVideo with no numeric code \u2014 ambiguous, requires verification"}],Rt={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};function rt(c,v){let e=c??{},t=it(e.code),i=it(e.sourceError?.code);if(t===void 0)return qt(e.message,v,i);let r=Ft(t);switch(r){case"chunk_load":return{family:r,code:t,disposition:"never_report",reason:"JW failed to download its own JS chunk \u2014 a player asset or CDN problem, not the media"};case"license":return{family:r,code:t,disposition:"never_report",reason:"JW licensing error \u2014 an operations issue, not a per-lecture fault"};case"warning":return{family:r,code:t,disposition:"never_report",reason:"JW warning band \u2014 autoplay blocked or playback aborted, not a media fault"};case"media_element":{let n=i??t%1e3;return $t(t,n,v)}default:return{family:r,code:t,mediaErrorCode:i,disposition:"probe_then_report",reason:`JW ${r} error (${t}) \u2014 verifying the media URL before reporting`}}}function $t(c,v,e){let t=Rt[v]??`MediaError ${v}`,i={family:"media_element",code:c,mediaErrorCode:v};switch(v){case 1:return B(E({},i),{disposition:"never_report",reason:`${t} \u2014 playback was cancelled by the user or by navigation`});case 3:return e?B(E({},i),{disposition:"probe_then_report",reason:`${t} on a client that supports this format \u2014 verifying the media`}):B(E({},i),{disposition:"never_report",reason:`${t} on a client that cannot decode this format \u2014 a capability limit, not a media fault`});case 4:return e?B(E({},i),{disposition:"probe_then_report",reason:`${t} on a client that supports this format \u2014 verifying the media`}):B(E({},i),{disposition:"never_report",reason:`${t} on a client that cannot decode this format \u2014 a capability limit, not a media fault`});default:return B(E({},i),{disposition:"probe_then_report",reason:`${t} \u2014 verifying whether the media URL is reachable`})}}function qt(c,v,e){let t=typeof c=="string"?c.toLowerCase():"";if(!t)return{family:"unknown",disposition:"probe_then_report",mediaErrorCode:e,reason:"Player error carried neither a code nor a message \u2014 verifying the media URL"};for(let i of Nt)if(t.includes(i.match))return i.disposition==="probe_then_report"&&!v?{family:i.family,mediaErrorCode:e,disposition:"never_report",reason:"Player could not play the file on a client that cannot decode this format \u2014 a capability limit"}:{family:i.family,mediaErrorCode:e,disposition:i.disposition,reason:i.reason};return{family:"unknown",mediaErrorCode:e,disposition:"probe_then_report",reason:"Unrecognized player error \u2014 verifying the media URL before reporting"}}function Ft(c){let v=Math.floor(c/1e3)*1e3;return v>=3e5?"warning":v>=23e4&&v<24e4?"hls":v>=22e4&&v<23e4?"media_element":v>=21e4&&v<22e4?"provider":v>=2e5&&v<21e4?"playlist_item":v>=104e3&&v<105e3?"playlist":v>=102e3&&v<103e3?"license":v>=101e3&&v<102e3?"chunk_load":v>=1e5&&v<101e3?"setup":"unknown"}function it(c){let v=typeof c=="number"?c:Number(c);return Number.isFinite(v)?v:void 0}var It=Ut(et());var ke=class{},Te=class extends ke{},ee=class extends Te{};var ne=(()=>{class c{constructor(e,t){this.http=e,this.platformId=t,this.subject=ne
1w q,this.removeFromPlaylistEvent=new q,this.subjectLecures=new q}getUserQueue(){return new Promise((e,t)=>x(this,null,function*(){this.http.get("/Queue").subscribe({next:i=>{this.playlist=i,e(i)},error:i=>{console.error(i),t()}})}))}readPlaylist(e){let t=new H({Authorization:`Bearer ${e}`});return this.http.get("/Queue",{headers:t})}addToPlaylist(e,t){let i=new H({"Content-Type":"application/json"});return this.http.post("/Queue/add",t,{headers:i})}removeFromPlaylist(e,t){let i=new H({"Content-Type":"application/json"});return this.http.post("/Queue",t[0],{headers:i})}setItem(e,t){let i=new ee;i.added=!0,i.id=e.id,i.title=e.title,i.dateRecorded=e.dateRecorded,i.length=e.length,i.language=e.language,i.audio=e.audio,i.video=e.video,i.speaker=t,i.sourceID=e.sourceID,this.subject.next(i)}setItemAlgolia(e,t){let i=new ee;i.added=!0,i.id=+e.internalID,i.title=e.title,i.dateRecorded=e.date,i.length=e.length,i.audio=e.audioUrl,i.video=e.videoUrl,i.speaker=t,i.sourceID=e.sourceID,this.subject.next(i)}removeItem(e){let t=new ee;t.added=!1,t.id=e.id,this.removeFromPlaylistEvent.next(t)}removeItemAlgolia(e){let t=new ee;t.added=!1,t.id=+e.internalID,this.removeFromPlaylistEvent.next(t)}getItem(){return this.subject.asObservable()}setQueue(e){this.subjectLecures.next(e)}getQueue(){return this.subjectLecures.asObservable()}getToken(){if(T(this.platformId)){let e=localStorage.getItem("userItorah");if(e!==null&&e!=="")return JSON.parse(e).token}return""}static{this.\u0275fac=function(t){return new(t||c)(b(R),b(N))}}static{this.\u0275prov=k({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var st=(()=>{class c{constructor(e){this.http=e}read(){return this.http.get("/CompletedClasses")}add(e){let t=new H({"Content-Type":"application/json"});return this.http.post("/CompletedClasses",e,{headers:t})}static{this.\u0275fac=function(t){return new(t||c)(b(R))}}static{this.\u0275prov=k({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var nt=(()=>{class c{constructor(e){this.http=e}read(e){return this.http.get(`/Shiurim?SpeakerID=${e}`)}relatedCategories(e){return this.http.get(`/Shiurim/relatedcategories?ShiurID=${e}`)}relatedBrowse(e,t){return this.http.get(`/Browse/relatedshiurim?ShiurID=${e}&CategoryID=${t}`)}getDownloadStatus(e,t){let i=new H({"Content-Type":"application/json"});return this.http.get(`/download?ShiurID=${e}&SourceID=${t}`,{headers:i})}static{this.\u0275fac=function(t){return new(t||c)(b(R))}}static{this.\u0275prov=k({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var ot=(()=>{class c{constructor(e,t,i,r,n){this.platformId=e,this.qs=t,this.shiurimService=i,this.http=r,this.speakersSrv=n,this.subject=new q,this.subjectDay=new q,this.subjectClasses=new q,this.subjectCompleted=new q,this.subjectQueue=new q,this.subjectPosition=new q;let o=!1;if(T(this.platformId)){let u=localStorage.getItem("userItorah");if(u)try{let d=JSON.parse(u);d&&d.token&&(o=!0)}catch(d){}}o&&this.getQueue()}addLectureToPlaylist(e,t){this.speakersSrv.getSpeakersByGroup("all").subscribe(i=>{e.startsWith("Rabbi")||(e=`Rabbi ${e}`),this.filterCurrentSpeaker(i,e).then(r=>{this.shiurimService.read(r).subscribe(n=>{this.filterCurrentLectureAndSendToPlaylist(n,t,e)})}).catch(r=>console.error(r))})}filterCurrentSpeaker(e,t){return new Promise((i,r)=>{let n=!1;for(let o=0;o<e.length;o++){let u=e[o];if(u.Speaker===t)n=!0,i(u.ID);else if(n===!0)break}})}filterCurrentLectureAndSendToPlaylist(e,t,i){let r=!1;for(let n=0;n<e.length;n++){let o=e[n];if(o.title===t)r=!0,this.qs.setItem(o,i);else if(r===!0)break}}skipIntro(e){e.playlistItem(1)}getClasses(){return this.subjectClasses.asObservable()}getShiurFromPlayer(){return this.subject.asObservable()}setDay(e){this.subjectDay.next(e)}getDayFromPlayer(){return this.subjectDay.asObservable()}setClasses(){this.subjectClasses.next("refresh")}setShiurFromPlayer(e){this.subject.next(e)}getMediaLastPosition(e,t){let i=new H({"Content-Type":"application/json"});return this.http.post("/MediaPosition/get",e,{headers:i})}mediaPlayStats(e,t,i){return new Promise((r,n)=>{let o={ip:"NA",mediaId:e,seriesId:t,mediaType:i?"audio":"video",source:"web"};this.http.post("/MediaPlays",o).subscribe({next:u=>{u==="Success"?r():n()},error:u=>{console.error("Error Saving Media Play Stats!",u),n()}})})}getCompleted(){return this.subjectCompleted.asObservable()}setQueue(e){this.subjectQueue.next(e)}getQueue(){return this.subjectQueue.asObservable()}getPosition(){return this.subjectPosition.asObservable()}static{this.\u0275fac=function(t){return new(t||c)(b(N),b(ne),b(nt),b(R),b(tt))}}static{this.\u0275prov=k({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var at=(()=>{class c{constructor(e,t){this.http=e,this.qs=t,this.savingPosition=!1,this.lastSavedPosition=0}startMPPush(e,t){return x(this,null,function*(){if(!(this.savingPosition||!e.position||e.position<10||e.position===this.lastSavedPosition)){this.savingPosition=!0;try{this.lastSavedPosition=e.position,yield this.saveMediaPosition(e,t),this.fetchPlaylist(t)}
1catch(i){console.error("Error Saving Media Position!",i),(i.status===400||i.error==="Object reference not set to an instance of an object.")&&this.stopMMPPush()}finally{this.savingPosition=!1}}})}stopMMPPush(){this.timerSubscription&&!this.timerSubscription.closed&&this.timerSubscription.unsubscribe()}resetForNewLecture(){this.lastSavedPosition=0,this.savingPosition=!1}saveMediaPosition(e,t){let i=new H({"Content-Type":"application/json"}),r=this.http.post("/MediaPosition/save",e,{headers:i});return Be(r)}fetchPlaylist(e){this.qs.readPlaylist(e).subscribe(t=>{this.qs.setQueue(t)})}static{this.\u0275fac=function(t){return new(t||c)(b(R),b(ne))}}static{this.\u0275prov=k({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var Jt=16/9,Qt=3/2,lt=(()=>{class c{constructor(e){this.helperSrv=e,this.navigateToFullShiurPage=new F(""),this.playerOptionsRequested=new q}_waitForElement(e,t=2e3){return new Promise((i,r)=>{let n=Date.now(),o=setInterval(()=>{let u=document.querySelector(e);u?(clearInterval(o),i(u)):Date.now()-n>t&&(clearInterval(o),r(new Error(`Element with selector "${e}" not found within ${t}ms.`)))},50)})}openInPopup(e,t){this.popupWinObjRef&&this.popupWinObjRef.close();let i=e.split("/")[2],r=e.split("/")[6],n=e.split("/")[5],o=`${t}/popup/${i}/${n}/${r}`;window.open(o,"poppedMediaPlayer","popup,height=301,width=480"),this.popupWinObjRef?.focus()}toggleTheaterMode(e,t,i){return x(this,null,function*(){let r;document.fullscreenElement?(document.exitFullscreen(),r=!0):r=!this.theaterMode,this.setTheaterMode(e,t,r,i)})}setTheaterMode(e,t,i,r){this.theaterMode=i,r?.(i),this.addPlayerButton(e,t,r),this.resizePlayerForMode(e,i),i&&this.helperSrv.performScroll("media-player","PlayerSRV toggleTheaterMode")}syncCurrentPlayerMode(e,t,i){this.addPlayerButton(e,t,i),this.resizePlayerForMode(e,this.theaterMode)}addPlayerButton(e,t,i){let r=e.getPlaylist()[t].file,n=`${re.APP_BASE_URL}/assets/video/annual_sponsor.mp4`;this.theaterMode?(e.addButton("assets/img/icons/resize.svg","Mini Player",()=>this.toggleTheaterMode(e,t,i),"mini-player-btn","mini-player-btn"),this.quickClip&&r!==n&&e.addButton(this.quickClipIcon,"Watch Full Shiur",()=>this.navigateToFullShiurPage.next(this.quickClipData),"full-shiur-btn","full-shiur-btn"),e.removeButton("theater-btn")):(e.addButton("assets/img/icons/resize.svg","Theater Mode",()=>this.toggleTheaterMode(e,t,i),"theater-btn","theater-btn"),this.quickClip&&r!==n&&e.removeButton("full-shiur-btn"),e.removeButton("mini-player-btn"))}resizePlayerForMode(e,t){setTimeout(()=>{if(typeof e?.resize!="function")return;let i=t?"#main-router.inline-video-player > .inline-player, #main-router.theater-player > .theater":"#main-router.mini-player > .media-player-container",r=document.querySelector(i),n=e.getContainer?.(),o=r?.getBoundingClientRect().width||n?.parentElement?.clientWidth||n?.clientWidth||(t?1100:400),u=t?Math.min(o,1100):Math.min(o,400),d=t?Jt:Qt;e.resize("100%",Math.round(u/d))},100)}addRewind15Button(e){return x(this,null,function*(){e.addButton("","",()=>{let t=e.getPosition();if(t>15){e.seek(t-15);return}else{e.seek(0);return}},"rewind-back-15-btn","rewind-back-15-btn")})}moveRewind15Button(){return x(this,null,function*(){try{let e=yield this._waitForElement(".rewind-back-15-btn"),t=document.querySelector(".jw-display-controls");if(e&&t){let i=document.createElement("div");i.className="jw-display-icon-container jw-display-icon-rewind-15 jw-reset",i.style.cursor="pointer",i.appendChild(e);let r=t.firstChild;return t.insertBefore(i,r),!0}return!1}catch(e){return console.error("Failed to move rewind button:",e),!1}})}addSkip15Button(e){return x(this,null,function*(){e.addButton("","",()=>{let t=e.getPosition(),i=e.getDuration();if(t+15<=i){e.seek(t+15);return}},"skip-forward-15-btn","skip-forward-15-btn")})}moveSkip15Button(){return x(this,null,function*(){try{let e=yield this._waitForElement(".skip-forward-15-btn"),t=document.querySelector(".jw-display-controls");if(e&&t){let i=document.createElement("div");return i.className="jw-display-icon-container jw-display-icon-skip jw-reset",i.style.cursor="pointer",i.appendChild(e),t.appendChild(i),!0}return!1}catch(e){return console.error("Failed to move skip button:",e),!1}})}addOpenInPopupButton(e,t,i,r){return x(this,null,function*(){e.addButton("assets/img/icons/popup.svg","Popup",()=>x(this,null,function*(){this.openInPopup(t,i)}),"popup-player-btn","popup-player-btn")})}addPlayerOptionsButton(e){e.removeButton("itorah-player-options-btn"),e.addButton("assets/img/icons/player
1-options.svg","Player Options",()=>this.playerOptionsRequested.next(),"itorah-player-options-btn","itorah-player-options-btn")}addAutoplayButton(e,t,i){e.removeButton("autoplay-next-btn"),e.addButton(t?"assets/img/icons/autoplay-next-on.svg":"assets/img/icons/autoplay-next-off.svg",t?"Autoplay Next: On":"Autoplay Next: Off",()=>i(!t),"autoplay-next-btn","autoplay-next-btn")}removeAutoplayButton(e){e?.removeButton?.("autoplay-next-btn")}static{this.\u0275fac=function(t){return new(t||c)(b(Xe))}}static{this.\u0275prov=k({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var ut=[/googlebot/i,/google-inspectiontool/i,/storebot-google/i,/adsbot-google/i,/mediapartners-google/i,/apis-google/i,/feedfetcher-google/i,/google-read-aloud/i,/google-site-verification/i,/bingbot/i,/bingpreview/i,/adidxbot/i,/msnbot/i,/slurp/i,/duckduckbot/i,/baiduspider/i,/yandex(bot|images|video|media)/i,/sogou/i,/exabot/i,/seznambot/i,/petalbot/i,/applebot/i,/amazonbot/i,/coccocbot/i,/gptbot/i,/oai-searchbot/i,/chatgpt-user/i,/claudebot/i,/claude-web/i,/anthropic-ai/i,/perplexitybot/i,/ccbot/i,/bytespider/i,/google-extended/i,/meta-externalagent/i,/applebot-extended/i,/diffbot/i,/omgili/i,/timpibot/i,/youbot/i,/facebookexternalhit/i,/facebookcatalog/i,/twitterbot/i,/linkedinbot/i,/slackbot/i,/discordbot/i,/telegrambot/i,/whatsapp/i,/pinterest(bot|\/)/i,/redditbot/i,/skypeuripreview/i,/embedly/i,/quora link preview/i,/vkshare/i,/tumblr/i,/flipboard/i,/nuzzel/i,/outbrain/i,/ahrefsbot/i,/semrushbot/i,/mj12bot/i,/dotbot/i,/rogerbot/i,/screaming frog/i,/siteauditbot/i,/barkrowler/i,/dataforseobot/i,/serpstatbot/i,/blexbot/i,/linkdexbot/i,/pingdom/i,/uptimerobot/i,/statuscake/i,/site24x7/i,/newrelicpinger/i,/ia_archiver/i,/archive\.org_bot/i,/wayback/i,/heritrix/i,/\bbot\b/i,/\bcrawler\b/i,/\bspider\b/i,/crawling/i],ct=[/headlesschrome/i,/headless/i,/puppeteer/i,/playwright/i,/selenium/i,/webdriver/i,/phantomjs/i,/electron\//i,/chrome-lighthouse/i,/lighthouse/i,/pagespeed/i,/gtmetrix/i,/webpagetest/i,/cypress/i,/jsdom/i,/python-requests/i,/python-urllib/i,/aiohttp/i,/scrapy/i,/^curl\//i,/\bcurl\/[\d.]+/i,/\bwget\b/i,/libwww-perl/i,/go-http-client/i,/okhttp/i,/apache-httpclient/i,/axios\//i,/node-fetch/i,/got \(/i,/postmanruntime/i,/insomnia/i,/java\/[\d.]+/i,/\bhttpie\b/i];var Gt=8,Ee={hlsNative:!1,mseH264Aac:!1,mp4H264:!1,aac:!1,mp3:!1,webm:!1},dt=Object.freeze({clientClass:"unknown",botSignals:[],codecSupport:Ee,canPlayAnything:!0,viewport:{width:0,height:0,dpr:1}}),ge=(()=>{class c{constructor(){this.platformId=z(N),this.cached=null}getProfile(){if(this.cached)return this.cached;if(!T(this.platformId))return dt;try{this.cached=this.computeProfile()}catch(e){this.cached=B(E({},dt),{botSignals:["profile-error"]})}return this.cached}isNonHumanClient(){let e=this.getProfile().clientClass;return e==="bot"||e==="automation"}canPlayFormat(e){let t=this.getProfile(),i=t.codecSupport;if(typeof e!="string"||!e)return t.canPlayAnything;switch(this.extensionOf(e)){case"m3u8":return i.hlsNative||i.mseH264Aac;case"mpd":return i.mseH264Aac;case"mp4":case"m4v":case"mov":return i.mp4H264&&i.aac;case"m4a":case"aac":return i.aac;case"mp3":return i.mp3;case"webm":case"ogg":case"ogv":return i.webm;default:return t.canPlayAnything}}resetForTesting(){this.cached=null}computeProfile(){let e=[],t="human",i=globalThis.navigator,r=typeof i?.userAgent=="string"?i.userAgent:"";try{i&&i.webdriver===!0&&(t="automation",e.push("webdriver"))}catch(u){}try{let u=this.firstMatch(r,ut);if(u)t="bot",e.push(`ua:${u}`);else if(t!=="automation"){let d=this.firstMatch(r,ct);d&&(t="automation",e.push(`ua-automation:${d}`))}}catch(u){}if(t==="human"){let u=this.weakHeadlessSignals(i,r);u.length>=2&&(t="automation",e.push(...u))}let n=this.probeCodecs(),o=n.mp4H264||n.aac||n.mp3||n.webm||n.hlsNative||n.mseH264Aac;return o||e.push("no-decodable-formats"),{clientClass:t,botSignals:e.slice(0,Gt),codecSupport:n,canPlayAnything:o,connection:this.readConnection(i),viewport:this.readViewport(),hardwareConcurrency:typeof i?.hardwareConcurrency=="number"?i.hardwareConcurrency:void 0,deviceMemory:typeof i?.deviceMemory=="number"?i.deviceMemory:void 0}}weakHeadlessSignals(e,t){let i=[],r=/Chrome\//.test(t);try{r&&e?.plugins&&e.plugins.length===0&&i.push("no-plugins"),e?.languages&&e.languages.length===0&&i.push("no-languages"),r&&!("chrome"in globalThis)&&i.push("no-chrome-object");let n=globalThis.window;n&&(n.outerWidth===0||n.outerHeight===0)&&i.push("zero-outer-size")}catch(n){}return i}probeCodecs(){try{let e=globalThis.document;if(!e)return Ee;let t=e.createElement("video"),i=e.createElement("audio"),r=o=>o==="probably"||o==="maybe",n=!1;try{let o=globalThis.MediaSource;
1n=typeof o<"u"&&typeof o.isTypeSupported=="function"&&o.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}catch(o){}return{mp4H264:r(t.canPlayType('video/mp4; codecs="avc1.42E01E"')),aac:r(i.canPlayType('audio/mp4; codecs="mp4a.40.2"')),mp3:r(i.canPlayType("audio/mpeg")),webm:r(t.canPlayType('video/webm; codecs="vp8, vorbis"')),hlsNative:r(t.canPlayType("application/vnd.apple.mpegurl"))||r(t.canPlayType("application/x-mpegURL")),mseH264Aac:n}}catch(e){return Ee}}readConnection(e){try{let t=e?.connection;return t?{effectiveType:typeof t.effectiveType=="string"?t.effectiveType:void 0,downlink:typeof t.downlink=="number"?t.downlink:void 0,saveData:typeof t.saveData=="boolean"?t.saveData:void 0}:void 0}catch(t){return}}readViewport(){try{let e=globalThis.window;return{width:e?.innerWidth??0,height:e?.innerHeight??0,dpr:e?.devicePixelRatio??1}}catch(e){return{width:0,height:0,dpr:1}}}firstMatch(e,t){if(!e)return null;for(let i of t){let r=e.match(i);if(r)return r[0].toLowerCase().slice(0,40)}return null}extensionOf(e){let t=e.split("#")[0].split("?")[0],i=t.substring(t.lastIndexOf("/")+1),r=i.lastIndexOf(".");return r===-1?"":i.slice(r+1).toLowerCase()}static{this.\u0275fac=function(t){return new(t||c)}}static{this.\u0275prov=k({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var ht="itorah-diag-sid",pt="itorah-diag-sid-ts",Yt=1800*1e3,Xt=5,ft=500,ve=(()=>{class c{constructor(){this.platformId=z(N),this.trail=[],this.navigationCount=0,this.pageEnteredAt=0,this.firstGestureAt=null,this.gestureListenersAttached=!1,this.visibilityListenersAttached=!1,this.pageHiddenFlag=!1,this.cachedSessionId=null,this.referrerCaptured=!1,this.referrerRaw=""}recordNavigation(e){if(!T(this.platformId))return;if(!this.referrerCaptured){this.referrerCaptured=!0;try{this.referrerRaw=globalThis.document?.referrer??""}catch(i){this.referrerRaw=""}}let t=this.sanitizePath(e);this.trail.push(t),this.trail.length>Xt&&this.trail.shift(),this.navigationCount+=1,this.pageEnteredAt=Date.now(),this.attachGestureListeners(),this.attachVisibilityListeners()}getRouteTrail(){return[...this.trail]}getNavigationCount(){return this.navigationCount}getEntryType(){return T(this.platformId)?(this.trail[this.trail.length-1]??"").startsWith("/popup/")?"popup":this.navigationCount>1?"internal_navigation":"direct_landing":"unknown"}getReferrerHost(){if(this.referrerRaw)try{let e=new URL(this.referrerRaw).host;return e?e.slice(0,255):void 0}catch(e){return}}isReferrerInternal(){if(this.referrerRaw)try{let e=new URL(this.referrerRaw).host,t=globalThis.location?.host??"";return!!e&&e===t}catch(e){return}}hasUserGesture(){return this.firstGestureAt!==null}getTimeOnPageMs(){if(this.pageEnteredAt)return Math.max(0,Date.now()-this.pageEnteredAt)}isPageHidden(){return this.pageHiddenFlag}getVisibilityState(){if(T(this.platformId))try{return globalThis.document?.visibilityState}catch(e){return}}getSessionId(){if(T(this.platformId)){if(this.cachedSessionId)return this.cachedSessionId;try{let e=globalThis.sessionStorage;if(!e)return;let t=e.getItem(ht),i=Number(e.getItem(pt)??"0"),n=t&&i>0&&Date.now()-i<Yt?t:this.createUuid();return e.setItem(ht,n),e.setItem(pt,String(Date.now())),this.cachedSessionId=n,n}catch(e){return this.cachedSessionId=this.createUuid(),this.cachedSessionId}}}resetForTesting(){this.trail=[],this.navigationCount=0,this.pageEnteredAt=0,this.firstGestureAt=null,this.pageHiddenFlag=!1,this.cachedSessionId=null,this.referrerCaptured=!1,this.referrerRaw=""}attachGestureListeners(){if(!this.gestureListenersAttached){this.gestureListenersAttached=!0;try{let e=globalThis.document;if(!e)return;let t=()=>{this.firstGestureAt===null&&(this.firstGestureAt=Date.now())},i={once:!0,passive:!0,capture:!0};e.addEventListener("pointerdown",t,i),e.addEventListener("keydown",t,i),e.addEventListener("touchstart",t,i)}catch(e){}}}attachVisibilityListeners(){if(!this.visibilityListenersAttached){this.visibilityListenersAttached=!0;try{let e=globalThis.window,t=globalThis.document;if(!e||!t)return;e.addEventListener("pagehide",()=>{this.pageHiddenFlag=!0},{passive:!0}),t.addEventListener("visibilitychange",()=>{t.visibilityState==="hidden"&&(this.pageHiddenFlag=!0)},{passive:!0})}catch(e){}}}sanitizePath(e){let r=(e||"/").replace(/^https?:\/\/[^/]+/i,"").split("?")[0].split("#")[0];return!r.startsWith("/")||r.startsWith("//")?"/":r.length>ft?r.slice(0,ft):r}createUuid(){let e=globalThis.crypto;return e?.randomUUID?e.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let i=Math.random()*16|0;return(t==="x"?i:i&3|8).toString(16)})}static{this.\u0275fac=function(t){return new(t||c)}}static{this.\u0275prov=k({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var mt="3.1.1";var Dt="/api/media-incidents/report",yt=6e4,ei=200,gt=3,vt=[1e3,4e3],ti=500,Pt=(()=>{class c{constructor(){this.platformId=z(N),this.clientProfile=z(ge),this.navHistory=z(ve),this.recentlyReported=new Map}report(e){if(!T(this.platformId)||!this.isReportable(e)||this.clientProfile.isNonHumanClient())return;let t=this.suppressionKey(e);if(this.isSuppressed(t))return;this.rememberReported(t);let i=this.createEventId(),r=this.buildPayload(e,i);this.send(r,1)}resetSuppression(){this.recentlyReported.clear()}isReportable(e){let t=Number(e.sourceId),i=Number(e.mediaId);return Number.isInteger(t)&&t>0&&Number.isInteger(i)&&i>0}suppressionKey(e){return[e.sourceId,e.mediaId,e.mediaType??"",e.errorKey].join("|")}isSuppressed(e){let t=this.recentlyReported.get(e);return t!==void 0&&Date.now()-t<yt}rememberReported(e){let t=Date.now();for(let[i,r]of this.recentlyReported)t-r>=yt&&this.recentlyReported.delete(i);for(;this.recentlyReported.size>=ei;){let i=this.recentlyReported.keys().next().value;if(i===void 0)break;this.recentlyReported.delete(i)}this.recentlyReported.set(e,t)}createEventId(){let e=globalThis.crypto;return e?.randomUUID?e.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let i=Math.random()*16|0;return(t==="x"?i:i&3|8).toString(16)})}buildPayload(e,t){let i={eventId:t,errorKey:e.errorKey,sourceId:Number(e.sourceId),mediaId:Number(e.mediaId),pagePath:this.sanitizePagePath(e.pagePath),occurredAt:new Date().toISOString()};e.mediaType&&(i.mediaType=e.mediaType),e.mediaUrl&&(i.mediaUrl=this.stripQueryAndFragment(e.mediaUrl)),e.title&&(i.title=this.truncate(e.title)),e.speaker&&(i.speaker=this.truncate(e.speaker)),e.shiurCode&&(i.shiurCode=this.truncate(e.shiurCode,100)),e.playerEvent&&(i.playerEvent=e.playerEvent),e.sourceEndpoint&&(i.sourceEndpoint=e.sourceEndpoint),e.errorCode&&(i.errorCode=this.truncate(String(e.errorCode),100)),e.errorMessage&&(i.errorMessage=this.truncate(e.errorMessage)),e.confidence&&(i.confidence=e.confidence),e.errorFamily&&
1(i.errorFamily=this.truncate(e.errorFamily,40)),typeof e.mediaErrorCode=="number"&&(i.mediaErrorCode=e.mediaErrorCode),e.classificationReason&&(i.classificationReason=this.truncate(e.classificationReason,300)),e.probe&&(i.probe=E({method:e.probe.method,outcome:e.probe.outcome,durationMs:e.probe.durationMs},typeof e.probe.mediaErrorCode=="number"?{mediaErrorCode:e.probe.mediaErrorCode}:{}));let r=this.clientProfile.getProfile().clientClass;i.clientClass=r;let n=this.navHistory.getSessionId();n&&(i.sessionId=n);let o=e.websiteRelease??mt;return o&&(i.websiteRelease=this.truncate(o,100)),e.clientContext&&(i.clientContext=this.buildClientContext(e.clientContext)),i}buildClientContext(e){let t=globalThis.navigator,i=this.clientProfile.getProfile(),r={playbackOrigin:e.playbackOrigin,originPagePath:this.sanitizePagePath(e.originPagePath),lookupAttempts:e.lookupAttempts.slice(0,4).map(g=>E(E(E(E(E({endpoint:g.endpoint,requestPath:this.sanitizeRequestPath(g.requestPath),outcome:g.outcome},g.returnedMediaUrl?{returnedMediaUrl:this.stripQueryAndFragment(g.returnedMediaUrl)}:{}),g.returnedAudioUrl?{returnedAudioUrl:this.stripQueryAndFragment(g.returnedAudioUrl)}:{}),g.returnedVideoUrl?{returnedVideoUrl:this.stripQueryAndFragment(g.returnedVideoUrl)}:{}),g.httpStatus!==void 0?{httpStatus:g.httpStatus}:{}),g.errorMessage?{errorMessage:this.truncate(g.errorMessage)}:{})),browser:E(E({userAgent:this.truncate(t?.userAgent??"unknown",500),platform:this.truncate(t?.platform??"unknown",100),language:this.truncate(t?.language??"unknown",50),online:t?.onLine??!0},typeof i.hardwareConcurrency=="number"?{hardwareConcurrency:i.hardwareConcurrency}:{}),typeof i.deviceMemory=="number"?{deviceMemory:i.deviceMemory}:{}),entryType:this.navHistory.getEntryType(),routeTrail:this.navHistory.getRouteTrail(),userGesture:this.navHistory.hasUserGesture(),codecSupport:i.codecSupport,viewport:i.viewport,botSignals:i.botSignals},n=this.navHistory.getReferrerHost();n&&(r.referrerHost=n);let o=this.navHistory.isReferrerInternal();typeof o=="boolean"&&(r.referrerIsInternal=o);let u=this.navHistory.getTimeOnPageMs();typeof u=="number"&&(r.timeOnPageMs=u);let d=this.navHistory.getVisibilityState();return d&&(r.visibilityState=this.truncate(d,20)),i.connection&&(r.connection=i.connection),e.playTrigger&&(r.playTrigger=e.playTrigger),typeof e.autoplayBlocked=="boolean"&&(r.autoplayBlocked=e.autoplayBlocked),e.playSourceType&&(r.playSourceType=this.truncate(e.playSourceType,100)),e.initialMediaUrl&&(r.initialMediaUrl=this.stripQueryAndFragment(e.initialMediaUrl)),e.selectedMediaUrl&&(r.selectedMediaUrl=this.stripQueryAndFragment(e.selectedMediaUrl)),r}sanitizePagePath(e){let r=(e||"/").replace(/^https?:\/\/[^/]+/i,"").split("?")[0].split("#")[0];return!r.startsWith("/")||r.startsWith("//")?"/":this.truncate(r)}stripQueryAndFragment(e){return this.truncate(e.split("#")[0].split("?")[0],2048)}sanitizeRequestPath(e){return!e.startsWith("/")||e.startsWith("//")||e.includes("://")?"/":this.truncate(e,500)}truncate(e,t=ti){return e.length>t?e.slice(0,t):e}send(e,t){return x(this,null,function*(){try{let i=yield fetch(Dt,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:!0});if(!i.ok&&i.status>=500&&t<gt)return yield this.delay(vt[t-1]??0),this.send(e,t+1)}catch(i){if(t<gt)return yield this.delay(vt[t-1]??0),this.send(e,t+1)}})}delay(e){return new Promise(t=>setTimeout(t,e))}static{this.\u0275fac=function(t){return new(t||c)}}static{this.\u0275prov=k({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var ri=4e3,bt=(()=>{class c{constructor(){this.platformId=z(N)}probe(e,t){return x(this,null,function*(){let i=Date.now();if(!T(this.platformId)||typeof e!="string"||!e)return{method:"none",outcome:"skipped",durationMs:0};try{return yield this.probeWithElement(e,t,i)}catch(r){return{method:"none",outcome:"skipped",durationMs:Date.now()-i}}})}probeWithElement(e,t,i){return new Promise(r=>{let n=globalThis.document;if(!n){r({method:"none",outcome:"skipped",durationMs:Date.now()-i});return}let o=n.createElement(t==="video"?"video":"audio"),u=!1,d=()=>{try{o.removeEventListener("loadedmetadata",m),o.removeEventListener("error",S),o.removeAttribute("src"),o.load()}catch(A){}},g=A=>{u||(u=!0,clearTimeout($),d(),r(A))},m=()=>g({method:"element",outcome:"ok",durationMs:Date.now()-i}),S=()=>{let A=o.error?.code;g({method:"element",outcome:this.outcomeForMediaErrorCode(A),durationMs:Date.now()-i,mediaErrorCode:typeof A=="number"?A:void 0})},$=setTimeout(()=>g({method:"element",outcome:"timeout",durationMs:Date.now()-i}),ri);o.addEventListener("loadedmetadata",m,{once:!0}),o.addEventListener("error",S,{once:!0});try{o.preload="metadata",o.muted=!0,o.src=e,o.load()}catch(A){g({method:"none",outcome:"skipped",durationMs:Date.now()-i})}})}outcomeForMediaErrorCode(e){switch(e){case 2:return"network_error";case 3:return"decode_error";
1case 4:return"not_playable";default:return"skipped"}}static{this.\u0275fac=function(t){return new(t||c)}}static{this.\u0275prov=k({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var Oe=null,ni="itorah-media-cache-v1";function oi(){return x(this,null,function*(){if(Oe)return;let c=ue[0]?.file;if(c&&typeof window<"u"&&"caches"in window)try{let v=yield window.caches.open(ni),e=yield v.match(c);if(e||(e=yield fetch(c),e.ok&&(yield v.put(c,e.clone()))),e&&e.ok&&e.headers.get("content-type")?.includes("video")){let t=yield e.blob();Oe=URL.createObjectURL(t)}}catch(v){console.error("Failed to pre-cache intro",v)}})}var Pr=(()=>{class c{static{this.QUALIFICATION_DEBOUNCE_MS=750}getLogin(){return this.fireStore.getLogin()}setData(e){this.fireStore.setLogin(e)}getToken(){return this.fireStore.getToken()}get introBlobUrl(){return Oe||ue[0]?.file}endIntroOverlay(){this.isIntroOverlayActive$.next(!1),this.pi&&(this._intendedStartPosition!==void 0?(this.pi.seek(this._intendedStartPosition),this._intendedStartPosition=void 0):this.pi.seek(0),this.pi.setMute(!1),this.pi.play())}get introCount(){return 0}constructor(e,t,i,r,n,o,u,d,g,m,S,$,A,X,ce,Pe,de,he){this.document=e,this.http=t,this.qs=i,this.as=r,this.router=n,this.seoSrv=o,this.loc=u,this.cSrv=d,this.notifySrv=g,this.pltSrv=m,this.sPosSrv=S,this.cMPEvSrv=$,this.fireStore=A,this.incidentReporter=X,this.clientProfile=ce,this.navHistory=Pe,this.urlProbe=de,this.platformId=he,this.playerErrorMsg="",this.requesting=!1,this.lastMediaUrlLookupEndpoint=null,this.playlistMDataByIndex=new Map,this.qualificationClaims=new Map,this.pendingPlayTrigger=null,this.isPlayerLoading=!1,this.isPlaying=!1,this.inlineVideoPageActive=!1,this.lectureDocumentPageActive=!1,this.isAutoplayRouteTransition=!1,this.isPlayingMIds=new F([0,0,0]),this.lecturePathEvent=new Ve,this.JWPlayerOptions=ze,this.isIntroOverlayActive$=new F(!1),this.pIdx=0,this.isSeeking=!1,this.seekToPosition=null,this.startAtIndex=null,this.currentPlaylistData=null,this.customBtnsInPlace=!1,this.mediaData=new ye,this.currMDataSubj=new F({}),this.showWatchFullShiurButtonOnPlayer=new F(!1),this.client=(0,It.default)(re.algolia.appId,re.algolia.apiKey),this.index=this.client.initIndex(re.algolia.indexName),this.countdownDuration=5,this.isCountdownActive=new F(!1),this.countdownValue=new F(this.countdownDuration),this.nextLectureInfo=new F(null),this.isAutoplayEnabled=new F(!0),this.hasNextPlayableLecture=new F(!1),this.isNextLecturePromptVisible=new F(!1),this._nextPlayableItemIndex=null,this._nextPlayableLecture=null,this._completionHandledForCurrentItem=!1,this._playlistAdvancePromise=null,this._playlistAdvanceResolver=null,this._nativePlaylistAdvancedDuringCountdown=!1;let oe=this.document.location.protocol,te=this.document.location.hostname,Z=this.document.location.port;if(this.baseUrl=Z?`${oe}//${te}:${Z}`:`${oe}//${te}`,T(this.platformId)){let pe=localStorage.getItem("itorah-autoplay-enabled");pe!==null&&this.isAutoplayEnabled.next(JSON.parse(pe))}this.isAutoplayEnabled.subscribe(()=>this._syncAutoplayPlayerButton()),this.hasNextPlayableLecture.subscribe(()=>this._syncAutoplayPlayerButton()),oi()}setPlayerOptions(e,t,i){if(e.url&&(typeof e.url=="object"&&(e.url=e.url.url||""),typeof e.url=="string"&&e.url.startsWith("//")&&(e.url="https:"+e.url)),e.incidentContext||this.startIncidentContext(e),e.incidentContext&&(e.incidentContext.selectedMediaUrl=typeof e.url=="string"?e.url:void 0),console.log("@@@ *** SET PLAYER OPTIONS (Normalized)",e,"tsp:",t,"relatedLectures:",i),this.isPlaying&&this.pi&&i&&i.length>0){let r=this.mediaId,n=!!e.isOnlyAudio===this.mediaTypeAudio,o=this.currMDataSubj.value.url===e.url;if(String(e.mediaId)===r&&n&&o){this.currentPlaylistData=i,this._updateHasNextPlayableLecture(this.pi.getPlaylistIndex(),this.pi.getPlaylist());return}}+this.mediaId==+e.mediaId&&this.sourceId===e.sourceId&&e.isOnlyAudio===this.mediaTypeAudio&&this.currMDataSubj.value.url===e.url||(e.sponsor||(e.url?e.url.includes("LT-Audio")||e.url.includes("LT-Video")||e.url.includes("PI-Audio")||e.url.includes("PI-Video")?e.sponsor="Sponsor this Shiur":e.sponsor="Sponsor this Media Player":console.error("Lecture URL is undefined!"),this.requesting=!1),this.as.openComponent("app-media-player",!!e.isOnlyAudio||this.inlineVideoPageActive).then(()=>{setTimeout(()=>{this.isPlaying?this.closeStream().then(()=>{this.buildMediaPlayer(e,t,i)}).catch(r=>{console.error("There was an Error while playing Media.",r)}):this.buildMediaPlayer(e,t,i)},500)}).catch(r=>{console.error("There was an Error opening Media Player Component.",r)}))}playDubbing(e){if(!e.mediaId){this.notifySrv.showNotification({Error:"Media ID is missing!"});return}this.startIncidentContext(e,"other"),this.getRequestedMediaType(e)==="video"&&this.scrollToPageTop(),this.lastMediaUrlLookupEndpoint=null,this.setPlayerOptions(e,null,[])}playMedia(e,t,i,r=!1){return x(this,null,function*(){if(console.log("\u25BA *** PLAY MEDIA:"),console.log(`{
2      title: ${e.title},
3      url: ${e.url},
4      sponsor: ${e.sponsor},
5      sourceId: ${e.sourceId},
6      mediaId: ${e.mediaId},
7      speaker: ${e.speaker},
8      isOnlyAudio: ${e.isOnlyAudio},
9      playSourceType: ${e.playSourceType},
10      shiurCode: ${e.shiurCode},
11      voiceOver: ${e.voiceOver},
12      speakerImg: ${e.speakerImg},
13      tsp: ${t}
14    }
14`),!e.mediaId){this.notifySrv.showNotification({Error:"Media ID is missing!"});return}this.startIncidentContext(e),this.lastMediaUrlLookupEndpoint=null;let n=this.getRequestedMediaType(e);n==="video"&&this.scrollToPageTop(),e.voiceOver&&+e.sourceId==6&&(e.speakerImg=`${K}https://itorah.com/assets/img/ai-voiceover-halacha.png${Y}`);let o=i;if(!o||o.length===0)try{let u=yield this.index.search("",{filters:`internalID:${e.mediaId} AND sourceID:${e.sourceId}`});if(u.hits.length===0)throw new Error(`Could not find the primary lecture (ID: ${e.mediaId}) in Algolia.`);let d=u.hits[0];e.date||=d.date||"",e.duration||=d.length||"",e.seriesName||=d.sourceName||"";let g=d.categories?.[0],m=d.speaker;if(!g||!m)console.warn("Primary lecture is missing Speaker or Category in Algolia. Cannot fetch related playlist.");else{let S=yield this.index.search("",{facetFilters:[`speaker:${m}`,`categories:${g}`],filters:`NOT internalID:${e.mediaId}`,hitsPerPage:20});if(S.hits.length>0){let $=S.hits.map(A=>({id:A.internalID,title:A.title,duration:A.length,sourceId:A.sourceID,mediaId:A.internalID,audioUrl:A.audioUrl,videoUrl:A.videoUrl,contentDate:A.date,shiurCode:A.code,hasVoiceOver:A.transcription_status!==null,speakerName:A.speaker}));o=[{id:d.internalID,title:d.title,duration:d.length,sourceId:d.sourceID,mediaId:d.internalID,audioUrl:d.audioUrl,videoUrl:d.videoUrl,contentDate:d.date,shiurCode:d.code,hasVoiceOver:d.transcription_status!==null,speakerName:d.speaker},...$]}}}catch(u){console.error("Failed to fetch related lectures from Algolia. Playing as a single item.",u)}r||(this.cMPEvSrv.theaterMode=n==="video"),this.lastMediaUrlLookupEndpoint="media_data",this.seoSrv.getMediaURL(e.sourceId,e.mediaId,n).subscribe({next:u=>{let d=u;this.recordLookupAttempt(e,{endpoint:"media_data",requestPath:this.mediaDataRequestPath(e,n),outcome:d?.url?"success":"empty",returnedMediaUrl:d?.url||void 0}),(!e.url||e.url.length<=2||e.url.includes("MediaData"))&&(e.url=d.url),e.speakerImg||(d.hasVoiceOver?e.speakerImg=`${K}https://itorah.com/assets/img/ai-voiceover-halacha.png${Y}`:d.primarySpeakerImg&&(e.speakerImg=`${K}${d.primarySpeakerImg}${Y}`)),u.shiurCode?.startsWith("Q")?(this.cMPEvSrv.quickClip=!0,this.cMPEvSrv.quickClipData={sourceID:e.sourceId,mediaID:u.fullShiurID},u.mediaType==="video"?(this.cMPEvSrv.quickClipMediaType="video",this.cMPEvSrv.quickClipIcon=`${K}https://itorah.com/assets/img/icons/watch-full-shiur.svg${Y}`):(this.cMPEvSrv.quickClipMediaType="audio",this.cMPEvSrv.quickClipIcon=`${K}https://itorah.com/assets/img/icons/listen-full-shiur.svg${Y}`)):(this.cMPEvSrv.quickClip=!1,this.cMPEvSrv.quickClipData=null,this.cMPEvSrv.quickClipIcon=""),d.mediaType==="video"?e.isOnlyAudio=!1:e.isOnlyAudio=!0;let g=()=>{this.lastMediaUrlLookupEndpoint="series_content_fallback",this.http.get(`/Series/${e.sourceId}/content/${e.mediaId}`).subscribe({next:m=>{if(m&&(e.isOnlyAudio&&m.audioUrl?e.url=m.audioUrl:!e.isOnlyAudio&&m.videoUrl?e.url=m.videoUrl:m.audioUrl?e.url=m.audioUrl:m.videoUrl&&(e.url=m.videoUrl),e.url&&m.lectures&&Array.isArray(m.lectures))){let S=m.lectures.find($=>$.audioUrl===e.url||$.videoUrl===e.url);S&&S.title&&(e.title=S.title)}this.recordLookupAttempt(e,{endpoint:"series_content_fallback",requestPath:this.seriesContentRequestPath(e),outcome:e.url&&e.url.length>5?"success":"empty",returnedMediaUrl:typeof e.url=="string"?e.url:void 0,returnedAudioUrl:m?.audioUrl||void 0,returnedVideoUrl:m?.videoUrl||void 0}),this.setPlayerOptions(e,t,o)},error:m=>{console.error(m),this.recordLookupAttempt(e,{endpoint:"series_content_fallback",requestPath:this.seriesContentRequestPath(e),outcome:"error",httpStatus:this.httpErrorStatus(m),errorMessage:this.httpErrorMessage(m)}),this.setPlayerOptions(e,t,o)}})};!e.url||e.url.length<=5?g():this.setPlayerOptions(e,t,o)},error:u=>{this.recordLookupAttempt(e,{endpoint:"media_data",requestPath:this.mediaDataRequestPath(e,n),outcome:"error",httpStatus:this.httpErrorStatus(u),errorMessage:this.httpErrorMessage(u)}),(!e.url||e.url.length<=2||e.url.includes("MediaData"))&&(this.playerErrorMsg="Failed to load media information. Please try again later."),console.error(u),!e.url||e.url.length<=5?(this.lastMediaUrlLookupEndpoint="series_content_fallback",this.http.get(`/Series/${e.sourceId}/content/${e.mediaId}`).subscribe({next:d=>{if(d&&(e.isOnlyAudio&&d.audioUrl?e.url=d.audioUrl:!e.isOnlyAudio&&d.videoUrl?e.url=d.videoUrl:d.audioUrl?e.url=d.audioUrl:d.videoUrl&&(e.url=d.videoUrl),e.url&&d.lectures&&Array.isArray(d.lectures))){let g=d.lectures.find(m=>m.audioUrl===e.url||m.videoUrl===e.url);g&&g.title&&(e.title=g.title)}this.recordLookupAttempt(e,{endpoint:"series_content_fallback",requestPath:this.seriesContentRequestPath(e),outcome:e.url&&e.url.length>5?"success":"empty",returnedMediaUrl:typeof e.url=="string"?e.url:void 0,returnedAudioUrl:d?.audioUrl||void 0,returnedVideoUrl:d?.videoUrl||void 0}),e.url&&e.url.length>5&&(this.playerErrorMsg=""),this.setPlayerOptions(e,t,o)},error:d=>{console.error(d),this.recordLookupAttempt(e,{endpoint:"series_content_fallback",requestPath:this.seriesContentRequestPath(e),outcome:"error",httpStatus:this.httpErrorStatus(d),errorMessage:this.httpErrorMessage(d)}),this.setPlayerOptions(e,t,o)}})):this.setPlayerOptions(e,t,o)}})})}getRequestedMediaType(e){if(e.isOnlyAudio===!0)return"audio";if(e.isOnlyAudio===!1)return"video";let t=typeof e.url=="string"?e.url:"";return t.includes("Video")||/\.(?:m3u8|m4v|mov|mp4|webm)(?:[?#]|$)/i.test(t)?"video":"audio"}startIncidentContext(e,t){let i=typeof e.url=="string"?e.url:void 0;e.incidentContext={playbackOrigin:t??this.inferPlaybackOrigin(e),originPagePath:this.router.url,playSourceType:e.playSourceType,playTrigger:this.resolvePlayTrigger(e,t),initialMediaUrl:i,selectedMediaUrl:i,lookupAttempts:[]},this.pendingPlayTrigger=null}resolvePlayTrigger(e,t){try{return this.pendingPlayTrigger?this.pendingPlayTrigger:t==="autoplay_next"||e.playSourceType==="autoplay_next"?"autoplay_next":this.currentPagePath().startsWith("/popup/")?"popup_autostart":this.navHistory.hasUserGesture()?"user_click":"autoplay_initial"}catch(i){return"unknown"}}inferPlaybackOrigin(e){let t=this.router.url.split("?")[0].split("#")[0];return e.playSourceType==="autoplay_next"?"autoplay_next":e.playSourceType==="popup"||t.startsWith("/popup/")?"popup":t==="/"?"homepage_card":t.startsWith("/browse-lectures/")?"browse_card":t.startsWith("/lecture/")?"lecture_page":t.startsWith("/queue")?"queue":"other"}recordLookupAttempt(e,t){e.incidentContext||this.startIncidentContext(e),e.incidentContext?.lookupAttempts.push(B(E({},t),{returnedMediaUrl:this.normalizeMediaUrl(t.returnedMediaUrl),returnedAudioUrl:this.normalizeMediaUrl(t.returnedAudioUrl),returnedVideoUrl:this.normalizeMediaUrl(t.returnedVideoUrl)})),e.incidentContext&&(e.incidentContext.selectedMediaUrl=typeof e.url=="string"?this.normalizeMediaUrl(e.url):void 0)}normalizeMediaUrl(e){if(!(typeof e!="string"||!e))return e.startsWith("//")?`https:${e}`:e}mediaDataRequestPath(e,t){return`/MediaData?SourceID=${e.sourceId}&MediaID=${e.mediaId}&type=${t}`}seriesContentRequestPath(e){return`/Series/${e.sourceId}/content/${e.mediaId}`}httpErrorStatus(e){return typeof e?.status=="number"&&e.status>0?e.status:void 0}httpErrorMessage(e){let t=e?.error?.message||e?.message||e?.statusText;return typeof t=="string"&&t?t:void 0}scrollToPageTop(){T(this.platformId)&&this.document.defaultView?.scrollTo({top:0,left:0,behavior:"smooth"})}handlePlayerError(e,t,i,r){let n=t?.message||i,o=n.includes("This video file cannot be played");this.playerErrorMsg||(this.playerErrorMsg=o?"Media file not found or unsupported format. Please try again later.":n);let u=this.resolveErrorMediaData(r);
14!u?.sourceId||!u?.mediaId||this.qualifyAndReport(u,e,t,n)}resolveErrorMediaData(e){try{let t=this.pi?.getPlaylistIndex?.();if(typeof t=="number"){let i=this.playlistMDataByIndex.get(t);if(i)return i}}catch(t){}return e??this.currMDataSubj.value}qualifyAndReport(e,t,i,r){return x(this,null,function*(){try{if(!T(this.platformId))return;let n=this.getRequestedMediaType(e),o=typeof e.url=="string"?e.url:"",u=this.clientProfile.canPlayFormat(o),d=rt(i,u);if(d.disposition==="never_report"||!this.isReportableClientState(o,u,e)||!this.claimQualificationSlot(e,n))return;let g=d.disposition==="probe_then_report"&&o?yield this.urlProbe.probe(o,n):{method:"none",outcome:"skipped",durationMs:0};if(!this.isReportableClientState(o,u,e))return;let{errorKey:m,confidence:S}=this.classifyProbeOutcome(g,d);this.incidentReporter.report({errorKey:m,confidence:S,sourceId:Number(e.sourceId),mediaId:Number(e.mediaId),mediaType:n,mediaUrl:o||void 0,title:e.title??void 0,speaker:e.speaker??void 0,shiurCode:e.shiurCode??void 0,pagePath:this.router.url,playerEvent:t,errorCode:i?.code!==void 0?String(i.code):void 0,errorMessage:r,errorFamily:d.family,mediaErrorCode:d.mediaErrorCode,classificationReason:d.reason,probe:g,clientContext:e.incidentContext})}catch(n){console.warn("Media incident qualification failed (ignored):",n)}})}isReportableClientState(e,t,i){if(this.clientProfile.isNonHumanClient()||e&&!t)return!1;let r=globalThis.navigator;if(r&&r.onLine===!1)return!1;let n=globalThis.document;if(n&&n.visibilityState!=="visible"||this.navHistory.isPageHidden())return!1;let o=i.incidentContext?.originPagePath;if(o&&this.currentPagePath()!==o)return!1;let u=this.navHistory.getTimeOnPageMs();return!(typeof u=="number"&&u<1e3&&!this.navHistory.hasUserGesture())}currentPagePath(){return this.router.url.split("?")[0].split("#")[0]}claimQualificationSlot(e,t){let i=`${e.sourceId}|${e.mediaId}|${t}`,r=Date.now(),n=this.qualificationClaims.get(i);if(n!==void 0&&r-n<c.QUALIFICATION_DEBOUNCE_MS)return!1;if(this.qualificationClaims.size>100)for(let[o,u]of this.qualificationClaims)r-u>=c.QUALIFICATION_DEBOUNCE_MS&&this.qualificationClaims.delete(o);return this.qualificationClaims.set(i,r),!0}classifyProbeOutcome(e,t){switch(e.outcome){case"ok":return{errorKey:"media_playback_unconfirmed",confidence:"refuted"};case"not_playable":return{errorKey:"media_not_found_or_unsupported",confidence:"suspected"};case"network_error":return{errorKey:"media_url_unreachable",confidence:"suspected"};case"decode_error":return{errorKey:"media_not_found_or_unsupported",confidence:"suspected"};case"timeout":return{errorKey:"media_url_unreachable",confidence:"suspected"};default:return{errorKey:t.family==="hls"?"media_url_unreachable":"media_not_found_or_unsupported",confidence:"suspected"}}}buildMediaPlayer(e,t,i){if(console.log("%c \u25BA *** BUILD MEDIA PLAYER ","color: orange"),console.log(`{
15      title: ${e.title},
16      url: ${e.url},
17      isOnlyAudio: ${e.isOnlyAudio},
18      speaker: ${e.speaker},
19      sponsor: ${e.sponsor},
20      sourceId: ${e.sourceId},
21      mediaId: ${e.mediaId},
22      playerSource: ${e.playSourceType}
23      date: ${e.date},
24      shiurCode: ${e.shiurCode},
25      tsp: ${t}
26    }`),this.sPosSrv.resetForNewLecture(),!e.url||e.url.length<=5){e.isOnlyAudio?this.playerErrorMsg="The Audio URL for this lecture could not be found.":this.playerErrorMsg="The Video URL for this lecture could not be found.",e.sourceId&&e.mediaId&&this.isReportableClientState("",!0,e)&&this.incidentReporter.report({errorKey:"media_url_missing",confidence:"suspected",sourceId:Number(e.sourceId),mediaId:Number(e.mediaId),mediaType:this.getRequestedMediaType(e),title:e.title??void 0,speaker:e.speaker??void 0,shiurCode:e.shiurCode??void 0,pagePath:this.router.url,sourceEndpoint:this.lastMediaUrlLookupEndpoint??void 0,clientContext:e.incidentContext}),this.isIntroOverlayActive$.next(!1),this.generateLectureURL(e.speaker??"",e.speaker??"",e.title??"",e.mediaId,e.sourceId,!!e.isOnlyAudio,e.playSourceType??"direct"),this.isPlaying=!0,this.isPlayerLoading=!1,this.currMDataSubj.next(e);return}if(!e.mediaId){this.notifySrv.showNotification({Error:"Media ID is missing."}),this.isPlaying=!0,this.isPlayingMIds.next([0,0,0]);return}if(+this.mediaId==+e.mediaId&&e.isOnlyAudio===this.mediaTypeAudio&&this.currMDataSubj.value.url===e.url){this.isPlaying=!0,this.notifySrv.showNotification({Warning:"Media is already playing."});return}e.speakerImg||(e.speakerImg=`${K}https://itorah.com/assets/img/social/share.png${Y}`),this.mediaId=String(e.mediaId),this.sourceId=e.sourceId,this.mediaTypeAudio=!!e.isOnlyAudio;let r=e.speaker??"";if(this.JWPlayerOptions.playlist=[],ue&&ue.length>0?(this.isIntroOverlayActive$.next(!0),this.JWPlayerOptions.autostart=!0,this.JWPlayerOptions.mute=!0):(this.isIntroOverlayActive$.next(!1),this.JWPlayerOptions.autostart=!0,this.JWPlayerOptions.mute=!1),i&&i.length>0){this.currentPlaylistData=i;let u=i.find(m=>String(m.id)===String(e.mediaId));u&&(e.isOnlyAudio?u.audioUrl=e.url:u.videoUrl=e.url);let d=i.filter(m=>{let S=this.mediaTypeAudio?!!m.audioUrl:!!m.videoUrl;return S||console.warn(`[Playlist Sync] Excluding lecture "${m.title}" (ID: ${m.id}) due to missing media URL.`),S}).map(m=>{let S=this.mediaTypeAudio?m.audioUrl:m.videoUrl;return typeof S=="string"&&S.startsWith("//")&&(S="https:"+S),{mediaid:String(m.id),file:S,image:e.speakerImg??"",title:m.title}}
26);this.JWPlayerOptions.playlist.push(...d);let g=d.findIndex(m=>m.mediaid===String(e.mediaId));g!==-1?this.startAtIndex=g+this.introCount:this.startAtIndex=null}else this.currentPlaylistData=null,this.startAtIndex=null,this.startAtIndex=null,this.JWPlayerOptions.playlist.push({mediaid:String(e.mediaId),file:e.url,image:e.speakerImg,title:e.title});this._updateHasNextPlayableLecture(this.startAtIndex??0,this.JWPlayerOptions.playlist),this.mediaData.id=null,this.mediaData.sourceId=+e.sourceId,this.mediaData.mediaId=String(e.mediaId);try{this.pi&&typeof this.pi.remove=="function"&&(this._removePlaylistAdvanceGate(),this.pi.remove())}catch(u){console.warn("Error removing old JWPlayer instance (harmless if element missing):",u)}if(this.pi=jwplayer("new-media-modal"),!this.pi){console.error("jwplayer() returned null/undefined. Cannot initialize player.");return}console.log("%c \u25BA *** SETUP JWPLAYER PLAYLIST:","color: magenta; font-weight: bold;",JSON.parse(JSON.stringify(this.JWPlayerOptions.playlist)));let n=this.router.url.startsWith("/popup/video/")&&!e.isOnlyAudio,o=E(B(E({},this.JWPlayerOptions),{mute:!1}),n?{width:"100%",height:"100%",stretching:"uniform"}:this.inlineVideoPageActive&&!e.isOnlyAudio?{responsive:!0,aspectratio:"16:9",stretching:"uniform"}:{});this.playlistMDataByIndex.clear(),this.playlistMDataByIndex.set(this.introCount??0,e),this.pi.setup(o),this.setupPlayerEvents(e,t),this._installPlaylistAdvanceGate(),this.generateLectureURL(r,e.speaker??"",e.title,e.mediaId,e.sourceId,e.isOnlyAudio??!1,e.playSourceType??""),this.playerErrorMsg="",this.isPlaying=!0,this.isPlayerLoading=!0,this.currMDataSubj.next(e)}setupPlayerEvents(e,t){return x(this,null,function*(){let i=!!e.isOnlyAudio;console.log("%c \u25BA *** SETUP PLAYER EVENTS","color: orange","iDX:",this.pIdx,"AUDIO:",i,"TSP:",t);let r=this.qs.getToken(),n=typeof t=="number"&&Number.isFinite(t)&&t>0?Math.floor(t):null;n!==null?(this.seekToPosition=n,this._intendedStartPosition=this.isIntroOverlayActive$.value?n:void 0):this._intendedStartPosition=void 0,this.pi.on("ready",()=>{this.customBtnsInPlace=!1,this.isIntroOverlayActive$.value&&this.pi.setMute(!0),this.pi.play()}),this.pi.on("play",()=>{this.isPlayerLoading=!1,this.isIntroOverlayActive$.value&&(this.seekToPosition!==null&&this.seekToPosition>0?this._intendedStartPosition=this.seekToPosition:this._intendedStartPosition===void 0&&(this._intendedStartPosition=0))}),this.pi.on("beforePlay",()=>x(this,null,function*(){let o=this.pi.getPlaylistIndex();if(this.pIdx=o,!this.isSeeking){if(this.startAtIndex!==null&&o===this.introCount){if(this.startAtIndex!==o){this.pi.playlistItem(this.startAtIndex),this.startAtIndex=null;return}this.startAtIndex=null}if(!(this.pIdx<this.introCount)){if(n!==null){this.seekToPosition=n;return}if(r)try{this.isSeeking=!0,yield this.tryGetMediaLastPosition(r),this.seekToPosition=this.lastPosition,this.lastPosition=0}catch(u){console.error("Error fetching media position.",u)}finally{this.isSeeking=!1}}}})),this.pi.on("setupError",o=>{console.error("JWPlayer Setup Error:",o),this.isIntroOverlayActive$.next(!1),this.handlePlayerError("setupError",o,"Media playback could not be set up. Please try again.",e)}),this.pi.on("error",o=>{console.error("JWPlayer Error:",o),this.isIntroOverlayActive$.next(!1),this.handlePlayerError("error",o,"An error occurred during playback. Please try again.",e)}),this.pi.on("autostartNotAllowed",()=>{let o=e.incidentContext;o&&(o.autoplayBlocked=!0)}),this.pi.on("firstFrame",()=>{this.seekToPosition!==null&&this.seekToPosition>0&&(this.pi.seek(this.seekToPosition),this.seekToPosition=null),!this.customBtnsInPlace&&this.pIdx>=this.introCount&&this.setCustomButtons()}),this.pi.on("play",()=>x(this,null,function*(){if(!this.isIntroOverlayActive$.value&&(this.isPlayingMIds.next([+this.mediaId,+this.sourceId,0]),this.pIdx>=this.introCount&&this._startPositionTimer(),!this.statsSent)){try{yield this.pltSrv.mediaPlayStats(+this.mediaData.mediaId,+this.sourceId,this.mediaData.isAudio)}catch(o){console.error("Error sending media play stats.",o)}this.statsSent=!0}})),this.pi.on("pause",()=>this._handlePause()),this.pi.on("beforeComplete",()=>this._handleCompletedLecture()),this.pi.on("complete",()=>this._handleCompletedLecture()),this.pi.on("playlistItem",()=>{this._handlePlaylistChange(i)}),this.pi.on("nextClick",()=>{})})}_installPlaylistAdvanceGate(){typeof this.pi?.setPlaylistItemCallback=="function"&&this.pi.setPlaylistItemCallback((e,t)=>this._waitForControlledPlaylistAdvance(t))}_removePlaylistAdvanceGate(){typeof this.pi?.removePlaylistItemCallback=="function"?this.pi.removePlaylistItemCallback():typeof this.pi?.setPlaylistItemCallback=="function"&&this.pi.setPlaylistItemCallback(null),this._playlistAdvancePromise=null,this._playlistAdvanceResolver=null,this._nativePlaylistAdvancedDuringCountdown=!1}_waitForControlledPlaylistAdvance(e){if((this.isCountdownActive.getValue()||this.isNextLecturePromptVisible.getValue())&&this._nextPlayableItemIndex===e)return this._playlistAdvancePromise||(this._playlistAdvancePromise=new Promise(i=>{this._playlistAdvanceResolver=i})),this._playlistAdvancePromise}_handlePlaylistChange(e){let t=this.pi.getPlaylistIndex();if((this.isCountdownActive.getValue()||this.isNextLecturePromptVisible.getValue())&&this._nextPlayableItemIndex===t){this._nativePlaylistAdvancedDuringCountdown=!0,this.pi.pause(!0);return}this._completionHandledForCurrentItem=!1,this.seekToPosition=null,this._clearNextLectureState(),this.sPosSrv.stopMMPPush(),this.sPosSrv.resetForNewLecture();let r=this.pi.getPlaylistIndex(),n=this.pi.getPlaylist()[r];if(this._updateHasNextPlayableLecture(r,this.pi.getPlaylist()),r<this.introCount||!this.currentPlaylistData||this.currentPlaylistData.length===0)return;let o=n.mediaid,u=this.currentPlaylistData.find(d=>String(d.id)===o);if(!u){console.error(`--> LOOKUP FAILED. Could not find a match for "${o}".`);return}this.mediaData.sourceId=u.sourceId,this.mediaData.mediaId=String(u.id),this.mediaId=String(u.id),this.sourceId=u.sourceId,this.statsSent=!1,u.speakerName||(u.speakerName=this.currMDataSubj.value.speaker??""),this._updateUrlAndComponent(u,e)}_updateUrlAndComponent(e,t){return x(this,null,function*(){try{let i=this.currMDataSubj.value,r=yield this.as.urlOptimizeText(e.speakerName),n=yield this.as.urlOptimizeText(e.title),u=`/lecture/${t?"audio":"video"}/${r}/${n}/${e.id}/${e.sourceId}`,d={title:e.title,speaker:e.speakerName,mediaId:e.id,sourceId:e.sourceId,url:t?e.audioUrl??"":e.videoUrl??"",isOnlyAudio:t,sponsor:i.sponsor,shiurCode:e.shiurCode,speakerImg:i.speakerImg,date:e.contentDate||i.date,duration:e.duration||i.duration,seriesName:i.seriesName,playSourceType:i.playSourceType,voiceOver:e.hasVoiceOver??!1};this.setPlaylistIncidentContext(d,i),this.currMDataSubj.next(d),this.lecturePathEvent.emit(u.substring(1)),yield this._syncLectureRoute(u),gtag("event","page_view",{page_path:u,timestamp:new Date().getTime()}),this.updateMetaTags(e.title,e.speakerName)}catch(i){console.error("Error while updating URL for lecture:",i)}})}setPlaylistIncidentContext(e,t){if(String(e.mediaId)===String(t.mediaId)&&Number(e.sourceId)===Number(t.sourceId)
26){t.incidentContext?e.incidentContext=t.incidentContext:this.startIncidentContext(e);return}this.startIncidentContext(e,"autoplay_next")}_syncLectureRoute(e){return x(this,null,function*(){let t=this.router.url.split(/[?#]/,1)[0];if(!t.startsWith("/lecture/")){this.loc.go(e);return}if(t!==e&&!t.startsWith(`${e}/`)){this.isAutoplayRouteTransition=!0;try{(yield this.router.navigateByUrl(e,{replaceUrl:!0}))||(this.isAutoplayRouteTransition=!1)}catch(i){throw this.isAutoplayRouteTransition=!1,i}}})}generateLectureURL(e,t,i,r,n,o,u){this.as.urlOptimizeText(e).then(d=>{let g;i.length>0&&i!==""&&i!==void 0&&i!==null?this.as.urlOptimizeText(i).then(m=>{this.lecturePath="/lecture/"+(o?"audio":"video")+"/"+d+"/"+m+"/"+r+"/"+n,this.lecturePathEvent.emit(this.lecturePath),u||this.navigateToRoute(t,i)}).catch(m=>console.error(m)):(g="no-title",this.lecturePath="/lecture/"+(o?"audio":"video")+"/"+d+"/"+g+"/"+r+"/"+n,this.lecturePathEvent.emit(this.lecturePath),u||this.navigateToRoute(t,i))}).catch(d=>console.error(d))}setCustomButtons(){return x(this,null,function*(){this.cMPEvSrv.addRewind15Button(this.pi).then(()=>this.cMPEvSrv.moveRewind15Button()),this.cMPEvSrv.addSkip15Button(this.pi).then(()=>this.cMPEvSrv.moveSkip15Button()),this.router.url?.startsWith("/popup")||(yield this.cMPEvSrv.addOpenInPopupButton(this.pi,this.lecturePath,this.baseUrl,()=>this.closeStream()),this.inlineVideoPageActive&&(this.cMPEvSrv.theaterMode=!0),this.cMPEvSrv.syncCurrentPlayerMode(this.pi,this.pIdx,e=>this.handlePlayerModeChange(e)),this.cMPEvSrv.addPlayerOptionsButton(this.pi)),this._syncAutoplayPlayerButton(),this.customBtnsInPlace=!0})}_syncAutoplayPlayerButton(){if(!(!this.pi||!this.isPlaying)){if(!this.hasNextPlayableLecture.getValue()){this.cMPEvSrv.removeAutoplayButton(this.pi);return}this.cMPEvSrv.addAutoplayButton(this.pi,this.isAutoplayEnabled.getValue(),e=>this.setAutoplay(e))}}showInlineVideoPlayer(){if(!this.isVideoDocumentRoute())return;let e=!this.inlineVideoPageActive||!this.cMPEvSrv.theaterMode;this.inlineVideoPageActive=!0,this.cMPEvSrv.theaterMode=!0,e&&this.isPlaying&&this.pi&&this.mediaTypeAudio===!1&&this.cMPEvSrv.setTheaterMode(this.pi,this.pIdx,!0,t=>this.handlePlayerModeChange(t))}showMiniAudioPlayer(){this.showMiniPlayer()}togglePlayerMode(){!this.isPlaying||!this.pi||this.cMPEvSrv.toggleTheaterMode(this.pi,this.pIdx,e=>this.handlePlayerModeChange(e))}prepareForBackgroundNavigation(){this.showMiniPlayer(),this.as.isMobile&&setTimeout(()=>{this.document.querySelector(".media-player-container")?.classList.remove("active")},150)}beginLectureDocumentNavigation(){let[e,t,i]=this.isPlayingMIds.getValue();if(this.isAutoplayRouteTransition=this.isPlaying&&e>0&&t>0&&i===0,!!this.isPlaying){try{this.pi?.pause?.(!0)}catch(r){console.warn("Unable to pause the current lecture before navigation.",r)}this.isPlaying=!1,this.closeStream().catch(r=>{console.error("Unable to stop the current lecture before navigation.",r)})}}showMiniPlayer(){let e=this.inlineVideoPageActive||this.cMPEvSrv.theaterMode;this.inlineVideoPageActive=!1,this.cMPEvSrv.theaterMode=!1,e&&this.isPlaying&&this.pi&&this.cMPEvSrv.setTheaterMode(this.pi,this.pIdx,!1,t=>this.handlePlayerModeChange(t))}handlePlayerModeChange(e){this.inlineVideoPageActive=e&&this.isVideoDocumentRoute()}isVideoDocumentRoute(){return this.lectureDocumentPageActive||this.router.url.split("?")[0].startsWith("/lecture/video/")}tryGetMediaLastPosition(e){return new Promise(t=>{this.pltSrv.getMediaLastPosition(this.mediaData,e).subscribe({next:i=>{i>0&&(this.lastPositionID=+this.mediaData.mediaId,this.lastPosition=+i),t()},error:i=>{console.error("[PlayerSrv] FAILED to get last media position.",i),t()}})})}navigateToRoute(e,t){this.loc.go(this.lecturePath),console.log(" \u{1F4C8} PLAYER ROUTING :",this.lecturePath),gtag("event","page_view",{page_path:this.lecturePath,timestamp:new Date().getTime()}),t&&e&&this.updateMetaTags(t,e)}updateMetaTags(e,t){let i;t?.startsWith("Rabbi")?i=t.substring(6).replace(" ",""):i=t.replace(" ",""),i==="DuviBensoussan"&&(i="DuviBenSoussan"),this.seoSrv.setSeoMetaTags(e+", lectured by "+t,"Stream "+e+", lectured by "+t+" from desktop or your mobile device.","lecture, torah lectures, itorah"),this.seoSrv.setFacebookMetaTags(e+", lectured by "+t,this.lecturePath.substring(1),"Stream "+e+", lectured by "+t+" from desktop or your mobile device.",i?`${K}https://itorah.com/assets/img/social/${i}.png${Y}`:`${K}https://itorah.com/assets/img/social/share.png${Y}`)}closeStream(e){return new Promise((t,i)=>{try{this.isPlayingMIds.next([0,0,0]),this._clearNextLectureState(),this.hasNextPlayableLecture.next(!1),this.incidentReporter.resetSuppression(),this.qual
26ificationClaims.clear(),this.playlistMDataByIndex.clear(),this.playerErrorMsg="",this.mediaId="",e&&this.as.closeComponent(this,"app-media-player"),T(this.platformId)&&localStorage.getItem("userItorah")!==null&&localStorage.getItem("userItorah")!==""&&this.sPosSrv.stopMMPPush();let n=jwplayer("new-media-modal");n&&typeof n.remove=="function"&&(this._removePlaylistAdvanceGate(),this.isPlaying=!1,this.isSeeking=!1,this.sidePanel=!this.sidePanel,n.remove()),t()}catch(r){console.error("There was an error while closing the stream!",r),i(r)}})}_startPositionTimer(){let e=this.qs.getToken();!e||this.sPosSrv.timerSubscription&&!this.sPosSrv.timerSubscription.closed||T(this.platformId)&&(this.sPosSrv.timerSubscription=Se(1e4).subscribe(()=>{this.pi&&(this.mediaData.position=Math.floor(this.pi.getPosition()),this.sPosSrv.startMPPush(this.mediaData,e))}))}_stopPositionTimer(){this.sPosSrv.stopMMPPush()}_handlePause(){this.isPlayingMIds.next([+this.mediaId,+this.sourceId,1]),this._stopPositionTimer(),!this.isCountdownActive.getValue()&&!this.isNextLecturePromptVisible.getValue()&&this._clearNextLectureState()}_handleCompletedLecture(){if(this._completionHandledForCurrentItem)return;this._completionHandledForCurrentItem=!0,this.isPlayingMIds.next([0,0,0]),this._stopPositionTimer();let e=this.pi.getPlaylistIndex();this.qs.getToken()&&e>=this.introCount&&this.cSrv.add({sourceID:this.mediaData.sourceId,mediaID:+this.mediaData.mediaId}).subscribe(()=>this.pltSrv.setClasses());let i=this._prepareNextLectureInfo();if(!i||e<this.introCount){this.hasNextPlayableLecture.next(!1);return}this.isAutoplayEnabled.getValue()?this._startCountdown(i):this._showNextLecturePrompt(i),this.pi.pause(!0)}skipCountdown(){this._playNextLecture()}_startCountdown(e=this._prepareNextLectureInfo()){if(e){if(this._nextPlayableItemIndex=e.index,this._nextPlayableLecture=e.data,this.nextLectureInfo.next(e.data),this.isCountdownActive.next(!0),this.countdownValue.next(this.countdownDuration),!T(this.platformId))return;this.countdownTimerSubscription=Se(1e3).subscribe(()=>{let t=this.countdownValue.getValue();t>1?this.countdownValue.next(t-1):this._playNextLecture()})}}_clearNextLectureState(){this.countdownTimerSubscription&&!this.countdownTimerSubscription.closed&&this.countdownTimerSubscription.unsubscribe(),this.isCountdownActive.next(!1),this.isNextLecturePromptVisible.next(!1),this.nextLectureInfo.next(null),this._nextPlayableItemIndex=null,this._nextPlayableLecture=null}_playNextLecture(){let e=this._nextPlayableItemIndex,t=this._nextPlayableLecture,i=this._playlistAdvanceResolver,r=this._nativePlaylistAdvancedDuringCountdown,n=this.currentPlaylistData?[...this.currentPlaylistData]:[];this._playlistAdvancePromise=null,this._playlistAdvanceResolver=null,this._nativePlaylistAdvancedDuringCountdown=!1,this._clearNextLectureState(),i?i():r&&this.pi?(this._handlePlaylistChange(this.mediaTypeAudio),this.pi.play(!0)):this.pi&&e!==null?this.pi.playlistItem(e):t&&this.playMedia(t,null,n),this._nextPlayableItemIndex=null,this._nextPlayableLecture=null}setAutoplay(e){this.isAutoplayEnabled.next(e),T(this.platformId)&&localStorage.setItem("itorah-autoplay-enabled",JSON.stringify(e))}_prepareNextLectureInfo(){let e=this.pi.getPlaylistIndex(),t=this.pi.getPlaylist(),i=!!this.currMDataSubj.value.isOnlyAudio;for(let n=e+1;n<t.length;n++){let o=t[n],u=this.currentPlaylistData?.find(d=>String(d.id)===o.mediaid);if(u&&(i?!!u.audioUrl:!!u.videoUrl)){let g={title:u.title,speaker:u.speakerName,mediaId:u.id,sourceId:u.sourceId,url:i?u.audioUrl??"":u.videoUrl??"",isOnlyAudio:i,speakerImg:this.currMDataSubj.value.speakerImg,sponsor:this.currMDataSubj.value.sponsor,shiurCode:u.shiurCode,playSourceType:"autoplay_next"};return this.nextLectureInfo.next(g),this.hasNextPlayableLecture.next(!0),{data:g,index:n}}}let r=this.currentPlaylistData?.findIndex(n=>String(n.id)===String(this.mediaId)||String(n.mediaId)===String(this.mediaId))??-1;if(r>=0&&this.currentPlaylistData)for(let n=r+1;n<this.currentPlaylistData.length;n++){let o=this.currentPlaylistData[n];if(!(i?!!o.audioUrl:!!o.videoUrl))continue;let d={title:o.title,speaker:o.speakerName,mediaId:o.id,sourceId:o.sourceId,url:i?o.audioUrl??"":o.videoUrl??"",isOnlyAudio:i,speakerImg:this.currMDataSubj.value.speakerImg,sponsor:this.currMDataSubj.value.sponsor,shiurCode:o.shiurCode,voiceOver:o.hasVoiceOver,playSourceType:"autoplay_next"};return this.nextLectureInfo.next(d),this.hasNextPlayableLecture.next(!0),{data:d,index:null}}return this.hasNextPlayableLecture.next(!1),null}_updateHasNextPlayableLecture(e,t){let i=this.mediaTypeAudio,r=t.slice(e+1).some(u=>{let d=this.currentPlaylistData?.find(g=>String(g.id)===String(u.mediaid));return!!d&&(i?!!d.audioUrl:!!d.videoUrl)}),n=this.currentPlaylistData?.findIndex(u=>String(u.id)===String(this.mediaId)||String(u.mediaId)===String(this.mediaId))??-1,o=n>=0&&!!this.currentPlaylistData?.slice(n+1).some(u=>i?!!u.audioUrl:!!u.videoUrl);this.hasNextPlayableLecture.next(r||o)}_showNextLecturePrompt(e=this._prepareNextLectureInfo()){e&&(this._nextPlayableItemIndex=e.index,this._nextPlayableLecture=e.data,this.isNextLecturePromptVisible.next(!0))}static{this.\u0275fac=function(t){return new(t||c)(b(We),b(R),b(ne),b(Ze),b(Qe),b(Ye),b(Je),b(st),b(Ge),b(ot),b(at),b(lt),b(Ke),b(Pt),b(ge),b(ve),b(bt),b(N))}}static{this.\u0275prov=k({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();export{Te as a,ne as b,at as c,et as d,st as e,nt as f,tt as g,ot as h,lt as i,ve as j,Pr as k};

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.