1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2497],{88361:(e,t,r)=>{r.r(t),r.d(t,{LinearContentEmbargoAddon:()=>g});var a=r(68986),n=r(59649),i=r(99745),o=r(72885);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var u="embargo",l=function(){var e;function t(e){var r=this;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");s(this,"session",void 0),s(this,"logger",void 0),this.session=e,this.logger=a.DA.withContext("Embargo cue listener"),this.session.onEventCueEntered(u,function(e){return r.enterEmbargo(e)})}return e=[{key:"destroy",value:function(){}},{key:"enterEmbargo",value:function(e){this.logger.warn("Embargo entered : ",e),this.session.requestSessionStop(i.O.from({reason:o.BQ.Embargo,code:"EMBARGO.BLOCKED_PROGRAM",message:"Session playback has been stopped due to EMBARGO business error.",severity:o.MU.Fatal,parameters:{uri:"".concat(e.data)}}))}}],function(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(t.prototype,e),t}(),c=r(94741),d=r(86749);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=Array(t);r<t;r++)a[r]=e[r];return a}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var m=function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");h(this,"cache",new Map),h(this,"logger",void 0),this.logger=a.DA.withContext("Scte35ProgramDataParser")}return e=[{key:"parseProgramDataFromBinary",value:function(e,t){try{if(!e||/[^\u0000-\u00ff]/.test(e))return;var r,a,n=this.cache.get(e);if(n)return null==(a=n[t])?void 0:a.upid;var i=new d.SCTE35,o=e.startsWith("0x")?i.parseFromHex(e):i.parseFromB64(e);return null==(r=this.cacheData(e,o)[t])?void 0:r.upid}catch(e){this.logger.error("Parsing binary64 is failed with error ".concat(e))}}},{key:"cacheData",value:function(e,t){var r=this.extractProgramSegDescriptors(t);if(!r)return this.cache.set(e,{}),{};var a=r.reduce(function(e,t){var r;return e[t.segmentationTypeId]={upid:String.fromCharCode.apply(null,function(e){if(Array.isArray(e))return f(e)}(r=t.segmentationUpid)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||function(e){if(e){if("string"==typeof e)return f(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return f(e,void 0)}}(r)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())},e},{});return this.cache.set(e,a),a}},{key:"extractProgramSegDescriptors",value:function(e){var t,r=this,a=null==(t=e.descriptors)?void 0:t.filter(this.isSegDescriptor);return null==a||a.forEach(function(e){r.logger.verbose("Found descriptor type: ".concat(e.segmentationTypeId))}),a}},{key:"isSegDescriptor",value:function(e){return e.spliceDescriptorTag===c.Mx.SEGMENTATION_DESCRIPTOR}}],function(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(t.prototype,e),t}();function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var g=function(){var e;function t(e){var r=this;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");v(this,"session",void 0),v(this,"name",void 0),v(this,"logger",void 0),v(this,"scte35Parser",void 0),v(this,"createdEmbargoCues",void 0),v(this,"embargoedIds",void 0),v(this,"linearContentEmbargoCueListener",void 0),v(this,"buildCues",void 0),v(this,"handleMetadata",void 0),this.session=e,this.name="LinearContentEmbargo",this.createdEmbargoCues=new Map,this.embargoedIds=new Set,this.buildCues=function(e){var t={},a={},n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done);
1n=!0){var l=s.value;if(r.isScte35TimedMetadata(l)){var c=r.fetchEmbargoInfo(l);if(c){var d=r.createdEmbargoCues.get(c.contentId);if(d)c.end&&(a[c.contentId]={id:d.cueId,endTime:c.end});else{var f,h=null!=(f=t[c.contentId])?f:{};h.programId=c.contentId,void 0!==c.start&&void 0===h.startTime&&(h.startTime=c.start),void 0!==c.end&&void 0===h.endTime&&(h.endTime=c.end),t[c.contentId]=h}}}}}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return{new:Object.values(t),update:Object.values(a)}},this.handleMetadata=function(e){var t=r.buildCues(e),a=!0,n=!1,i=void 0;try{for(var o,s=t.new[Symbol.iterator]();!(a=(o=s.next()).done);a=!0){var l,c,d,f=o.value;r.logger.info("Embargo Program Info: program=".concat(f.programId," start=").concat(f.startTime," end=").concat(null!=(l=f.endTime)?l:"Infinity"));var h=r.session.registerCue({type:u,startTime:null!=(c=f.startTime)?c:1,endTime:null!=(d=f.endTime)?d:Number.MAX_SAFE_INTEGER,isPersistent:!0,data:f.programId});r.createdEmbargoCues.set(f.programId,{cueId:h})}}catch(e){n=!0,i=e}finally{try{a||null==s.return||s.return()}finally{if(n)throw i}}var m=!0,v=!1,g=void 0;try{for(var y,b=t.update[Symbol.iterator]();!(m=(y=b.next()).done);m=!0){var p=y.value;r.session.updateCueEndTime(p.id,p.endTime)}}catch(e){v=!0,g=e}finally{try{m||null==b.return||b.return()}finally{if(v)throw g}}},this.scte35Parser=new m,this.logger=a.DA.withContext("Linear Content Embargo"),this.linearContentEmbargoCueListener=new l(e),e.onPlayoutDataReceived(this.handlePlayoutData.bind(this,e)),this.logger.info("Addon initialized.")}return e=[{key:"handlePlayoutData",value:function(e,t){if(t.programSchedule){var r=!0,a=!1,n=void 0;try{for(var i,o=t.programSchedule[Symbol.iterator]();!(r=(i=o.next()).done);r=!0){var s=i.value,u=s.restrictions;((null==u?void 0:u.some(function(e){return"embargo"===e.type}))||!u)&&(this.embargoedIds.add(s.id),this.logger.warn("Embargo added for program ID ".concat(s.id)))}}catch(e){a=!0,n=e}finally{try{r||null==o.return||o.return()}finally{if(a)throw n}}}this.embargoedIds.size>0&&e.onBulkTimedMetadataReceived(this.handleMetadata)}},{key:"fetchEmbargoInfo",value:function(e){var t=this.fetchScte35DataFromMetadata(e);if(t){var r=this.fetchStartTime(e),a=this.fetchEndTime(e);try{var n=this.scte35Parser.parseProgramDataFromBinary(t,c.CN.PROGRAM_START);if(n){if(this.logger.warn("Found program start for ".concat(n)),this.embargoedIds.has(n))return{start:r,contentId:n};return}var i=this.scte35Parser.parseProgramDataFromBinary(t,c.CN.PROGRAM_END);if(i&&(this.logger.verbose("Found program end for ".concat(i)),this.embargoedIds.has(i)))return{end:null!=a?a:r,contentId:i};return}catch(e){this.logger.error("Error when fetching embargo information: ".concat(e))}}}},{key:"isScte35TimedMetadata",value:function(e){var t=e.type;return t===n.RQ.EventStream?"urn:scte:scte35:2014:xml+bin"===e.schemeIdUri:t===n.RQ.HlsDaterange&&!!e.clientAttributes.scte35Data}},{key:"fetchStartTime",value:function(e){var t=e.type;return t===n.RQ.EventStream?e.startTime:t===n.RQ.HlsDaterange?e.playerTime:0}},{key:"fetchEndTime",value:function(e){var t=e.type;return t===n.RQ.EventStream?e.endTime:t===n.RQ.HlsDaterange?e.playerTime:0}},{key:"fetchScte35DataFromMetadata",value:function(e){var t,r;switch(e.type){case n.RQ.EventStream:t=null==e?void 0:e.scte35Data;break;case n.RQ.HlsDaterange:t=null==e||null==(r=e.clientAttributes)?void 0:r.scte35Data;break;default:t=null}return t}},{key:"destroy",value:function(){this.logger.warn("Destroy called"),this.linearContentEmbargoCueListener.destroy()}}],function(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(t.prototype,e),t}()}}]);
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.