{"version":3,"file":"jioAds.js","sources":["webpack://JioAds/jioAds.js"],"sourcesContent":["var JioAds=function(e){var t={};function i(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,a){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},i.r=function(e){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&\"object\"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(i.r(a),Object.defineProperty(a,\"default\",{enumerable:!0,value:e}),2&t&&\"string\"!=typeof e)for(var n in e)i.d(a,n,function(t){return e[t]}.bind(null,n));return a},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,\"a\",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p=\"\",i(i.s=31)}([function(e,t,i){var a,n,r,s;function o(e){return(o=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e})(e)}s=function(e){\"use strict\";function t(e){return(t=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}function a(e,t){for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adId:e.adId||null,sequence:e.sequence||null,apiFramework:e.apiFramework||null,universalAdId:{value:null,idRegistry:\"unknown\"},creativeExtensions:[]}}var m=[\"ADCATEGORIES\",\"ADCOUNT\",\"ADPLAYHEAD\",\"ADSERVINGID\",\"ADTYPE\",\"APIFRAMEWORKS\",\"APPBUNDLE\",\"ASSETURI\",\"BLOCKEDADCATEGORIES\",\"BREAKMAXADLENGTH\",\"BREAKMAXADS\",\"BREAKMAXDURATION\",\"BREAKMINADLENGTH\",\"BREAKMINDURATION\",\"BREAKPOSITION\",\"CLICKPOS\",\"CLICKTYPE\",\"CLIENTUA\",\"CONTENTID\",\"CONTENTPLAYHEAD\",\"CONTENTURI\",\"DEVICEIP\",\"DEVICEUA\",\"DOMAIN\",\"EXTENSIONS\",\"GDPRCONSENT\",\"IFA\",\"IFATYPE\",\"INVENTORYSTATE\",\"LATLONG\",\"LIMITADTRACKING\",\"MEDIAMIME\",\"MEDIAPLAYHEAD\",\"OMIDPARTNER\",\"PAGEURL\",\"PLACEMENTTYPE\",\"PLAYERCAPABILITIES\",\"PLAYERSIZE\",\"PLAYERSTATE\",\"PODSEQUENCE\",\"REGULATIONS\",\"SERVERSIDE\",\"SERVERUA\",\"TRANSACTIONID\",\"UNIVERSALADID\",\"VASTVERSIONS\",\"VERIFICATIONVENDORS\",\"bz\",\"ccb\",\"seq\",\"cmd\",\"cn\",\"st\",\"ct\",\"pn\"];function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=[],n=y(e);!t.ERRORCODE||i.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=E(Math.round(1e8*Math.random()).toString()),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING;var r=t.cmd;for(var s in t)t[s]=C(t[s]);for(var o in t.cmd=r,n){var c=n[o];\"string\"==typeof c&&a.push(f(c,t))}return a}function f(e,t){var i=(e=v(e,t)).match(/[^[\\]]+(?=])/g);if(!i)return e;var a=i.filter((function(e){return m.indexOf(e)>-1}));return 0===a.length?e:v(e,a=a.reduce((function(e,t){return e[t]=\"\",e}),{}))}function v(e,t){var i=e;for(var a in t){var n=t[a];i=i.replace(/%5B/g,\"[\").replace(/%5D/g,\"]\").replace(new RegExp(\"(?:\\\\[|%%)(\".concat(a,\")(?:\\\\]|%%)\"),\"g\"),n).replace(/\\[trq\\]|\\{trq\\}/gi,encodeURI((new Date).getTime()))}return i}function y(e){return Array.isArray(e)?e.map((function(e){return e&&e.hasOwnProperty(\"url\")?e.url:e.hasOwnProperty(\"viewable\")?e.viewable[0]:e})):e}function b(e,t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:8,i=String(e);return i.lengthr;n?s++:s--)a.push(s);return a}var w={track:function(e,t,i){g(e,t,i).forEach((function(e){\"undefined\"!=typeof window&&null!==window&&((new Image).src=e)}))},resolveURLTemplates:g,extractURLsFromTemplates:y,containsTemplateObject:b,isTemplateObjectEqual:k,encodeURIComponentRFC3986:C,replaceUrlMacros:f,leftpad:E,range:I,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce((function(t,i){return t.concat(Array.isArray(i)?e(i):i)}),[])},joinArrayOfUniqueTemplateObjs:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=Array.isArray(e)?e:[],a=Array.isArray(t)?t:[],n=i.concat(a);return n.reduce((function(e,t){return b(t,e)||e.push(t),e}),[])}};function T(e){return-1!==[\"true\",\"TRUE\",\"True\",\"1\"].indexOf(e)}var j={childByName:function(e,t){var i=e.childNodes;for(var a in i){var n=i[a];if(n.nodeName===t)return n}},childrenByName:function(e,t){var i=[],a=e.childNodes;for(var n in a){var r=a[n];r.nodeName===t&&i.push(r)}return i},resolveVastAdTagURI:function(e,t){if(!t)return e;if(0===e.indexOf(\"//\")){var i=location.protocol;return\"\".concat(i).concat(e)}if(-1===e.indexOf(\"://\")){var a=t.slice(0,t.lastIndexOf(\"/\"));return\"\".concat(a,\"/\").concat(e)}return e},parseBoolean:T,parseNodeText:function(e){return e&&(e.textContent||e.text||\"\").trim()},copyNodeAttribute:function(e,t,i){var a=t.getAttribute(e);a&&i.setAttribute(e,a)},parseAttributes:function(e){for(var t=e.attributes,i={},a=0;a3600||a>60?-1:r+n+a},splitVAST:function(e){var t=[],i=null;return e.forEach((function(a,n){if(a.sequence&&(a.sequence=parseInt(a.sequence,10)),a.sequence>1){var r=e[n-1];if(r&&r.sequence===a.sequence-1)return void(i&&i.push(a));delete a.sequence}i=[a],t.push(i)})),t},assignAttributes:function(e,t){if(e)for(var i in e){var a=e[i];if(a.nodeName&&a.nodeValue&&t.hasOwnProperty(a.nodeName)){var n=a.nodeValue;\"boolean\"==typeof t[a.nodeName]&&(n=T(n)),t[a.nodeName]=n}}},mergeWrapperAdData:function(e,t){e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.viewableImpression=t.viewableImpression.concat(e.viewableImpression),e.extensions=t.extensions.concat(e.extensions),e.followAdditionalWrappers=t.followAdditionalWrappers,e.allowMultipleAds=t.allowMultipleAds,e.fallbackOnNoAd=t.fallbackOnNoAd;var i=(t.creatives||[]).filter((function(e){return e&&\"companion\"===e.type})),a=i.reduce((function(e,t){return(t.variations||[]).forEach((function(t){(t.companionClickTrackingURLTemplates||[]).forEach((function(t){w.containsTemplateObject(t,e)||e.push(t)}))})),e}),[]);e.creatives=i.concat(e.creatives);var n=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,r=t.videoCustomClickURLTemplates&&t.videoCustomClickURLTemplates.length;e.creatives.forEach((function(e){if(t.trackingEvents&&t.trackingEvents[e.type])for(var i in t.trackingEvents[e.type]){var s=t.trackingEvents[e.type][i];Array.isArray(e.trackingEvents[i])||(e.trackingEvents[i]=[]),e.trackingEvents[i]=e.trackingEvents[i].concat(s)}t.adParameters&&(Array.isArray(e.adParameters)||(e.adParameters=[]),t.adParameters.forEach((function(t){e.adParameters.push(t)}))),\"linear\"===e.type&&(n&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),r&&(e.videoCustomClickURLTemplates=e.videoCustomClickURLTemplates.concat(t.videoCustomClickURLTemplates)),!t.videoClickThroughURLTemplate||null!==e.videoClickThroughURLTemplate&&void 0!==e.videoClickThroughURLTemplate||(e.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate)),\"companion\"===e.type&&a.length&&(e.variations||[]).forEach((function(e){e.companionClickTrackingURLTemplates=w.joinArrayOfUniqueTemplateObjs(e.companionClickTrackingURLTemplates,a)}))})),t.adVerifications&&(e.adVerifications=e.adVerifications.concat(t.adVerifications)),t.blockedAdCategories&&(e.blockedAdCategories=e.blockedAdCategories.concat(t.blockedAdCategories))}};function S(e,t){var i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=A(e),i=t.id,a=t.adId,n=t.sequence,r=t.apiFramework;return{id:i,adId:a,sequence:n,apiFramework:r,type:\"companion\",required:null,variations:[]}}(t);return i.required=e.getAttribute(\"required\")||null,i.variations=j.childrenByName(e,\"Companion\").map((function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adType:\"companionAd\",width:e.width||0,height:e.height||0,assetWidth:e.assetWidth||null,assetHeight:e.assetHeight||null,expandedWidth:e.expandedWidth||null,expandedHeight:e.expandedHeight||null,apiFramework:e.apiFramework||null,adSlotID:e.adSlotID||e.adSlotId||null,pxratio:e.pxratio||\"1\",renderingMode:e.renderingMode||\"default\",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,xmlEncoded:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(j.parseAttributes(e));t.htmlResources=j.childrenByName(e,\"HTMLResource\").reduce((function(e,t){var i=j.parseNodeText(t);return i?e.concat(i):e}),[]),t.iframeResources=j.childrenByName(e,\"IFrameResource\").reduce((function(e,t){var i=j.parseNodeText(t);return i?e.concat(i):e}),[]),t.staticResources=j.childrenByName(e,\"StaticResource\").reduce((function(e,t){var i=j.parseNodeText(t);return i?e.concat({url:i,creativeType:t.getAttribute(\"creativeType\")||null}):e}),[]),t.altText=j.parseNodeText(j.childByName(e,\"AltText\"))||null;var i=j.childByName(e,\"TrackingEvents\");i&&j.childrenByName(i,\"Tracking\").forEach((function(e){var i=e.getAttribute(\"event\"),a=j.parseNodeText(e);i&&a&&(Array.isArray(t.trackingEvents[i])||(t.trackingEvents[i]=[]),t.trackingEvents[i].push(a))})),t.companionClickTrackingURLTemplates=j.childrenByName(e,\"CompanionClickTracking\").map((function(e){return{id:e.getAttribute(\"id\")||null,url:j.parseNodeText(e)}})),t.companionClickThroughURLTemplate=j.parseNodeText(j.childByName(e,\"CompanionClickThrough\"))||null;var a=j.childByName(e,\"AdParameters\");if(a){t.adParameters=[];for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=A(e),i=t.id,a=t.adId,n=t.sequence,r=t.apiFramework;return{id:i,adId:a,sequence:n,apiFramework:r,type:\"linear\",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(t);a.duration=j.parseDuration(j.parseNodeText(j.childByName(e,\"Duration\")));var n=e.getAttribute(\"skipoffset\");if(null==n)a.skipDelay=null;else if(\"%\"===n.charAt(n.length-1)&&-1!==a.duration){var r=parseInt(n,10);a.skipDelay=a.duration*(r/100)}else a.skipDelay=j.parseDuration(n);var s=j.childByName(e,\"VideoClicks\");if(s){var o=j.childByName(s,\"ClickThrough\");a.videoClickThroughURLTemplate=o?{id:o.getAttribute(\"id\")||null,url:j.parseNodeText(o)}:null,j.childrenByName(s,\"ClickTracking\").forEach((function(e){a.videoClickTrackingURLTemplates.push({id:e.getAttribute(\"id\")||null,url:j.parseNodeText(e)})})),j.childrenByName(s,\"CustomClick\").forEach((function(e){a.videoCustomClickURLTemplates.push({id:e.getAttribute(\"id\")||null,url:j.parseNodeText(e)})}))}var c=j.childByName(e,\"AdParameters\");if(c){a.adParameters=[];for(var d=0;d0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,apiFramework:e.apiFramework||null,variableDuration:j.parseBoolean(e.variableDuration),fileURL:null}}(j.parseAttributes(e));return t.fileURL=j.parseNodeText(e),t}(t));var i=j.childByName(e,\"ClosedCaptionFiles\");i&&j.childrenByName(i,\"ClosedCaptionFile\").forEach((function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,language:e.language||null,fileURL:null}}(j.parseAttributes(e));t.fileURL=j.parseNodeText(e),a.closedCaptionFiles.push(t)}));var n,r,s,o=j.childByName(e,\"Mezzanine\"),c=(n=o,r={},s=!1,[\"delivery\",\"type\",\"width\",\"height\"].forEach((function(e){n&&n.getAttribute(e)?r[e]=n.getAttribute(e):s=!0})),s?null:r);if(c){var d={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:\"2D\"};d.id=o.getAttribute(\"id\"),d.fileURL=j.parseNodeText(o),d.delivery=c.delivery,d.codec=o.getAttribute(\"codec\"),d.type=c.type,d.width=parseInt(c.width,10),d.height=parseInt(c.height,10),d.fileSize=parseInt(o.getAttribute(\"fileSize\"),10),d.mediaType=o.getAttribute(\"mediaType\")||\"2D\",a.mezzanine=d}}));var u=j.childByName(e,\"Icons\");return u&&j.childrenByName(u,\"Icon\").forEach((function(e){a.icons.push(function(e){var t,i,a={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:\"1\",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null};a.program=e.getAttribute(\"program\"),a.height=parseInt(e.getAttribute(\"height\")||0),a.width=parseInt(e.getAttribute(\"width\")||0),a.xPosition=(i=e.getAttribute(\"xPosition\"),-1!==[\"left\",\"right\"].indexOf(i)?i:parseInt(i||0)),a.yPosition=(t=e.getAttribute(\"yPosition\"),-1!==[\"top\",\"bottom\"].indexOf(t)?t:parseInt(t||0)),a.apiFramework=e.getAttribute(\"apiFramework\"),a.pxratio=e.getAttribute(\"pxratio\")||\"1\",a.offset=j.parseDuration(e.getAttribute(\"offset\")),a.duration=j.parseDuration(e.getAttribute(\"duration\")),j.childrenByName(e,\"HTMLResource\").forEach((function(e){a.type=e.getAttribute(\"creativeType\")||\"text/html\",a.htmlResource=j.parseNodeText(e)})),j.childrenByName(e,\"IFrameResource\").forEach((function(e){a.type=e.getAttribute(\"creativeType\")||0,a.iframeResource=j.parseNodeText(e)})),j.childrenByName(e,\"StaticResource\").forEach((function(e){a.type=e.getAttribute(\"creativeType\")||0,a.staticResource=j.parseNodeText(e)}));var n=j.childByName(e,\"IconClicks\");return n&&(a.iconClickThroughURLTemplate=j.parseNodeText(j.childByName(n,\"IconClickThrough\")),j.childrenByName(n,\"IconClickTracking\").forEach((function(e){a.iconClickTrackingURLTemplates.push({id:e.getAttribute(\"id\")||null,url:j.parseNodeText(e)})}))),a.iconViewTrackingURLTemplate=j.parseNodeText(j.childByName(e,\"IconViewTracking\")),a}(e))})),a}function x(e,t){var i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=A(e),i=t.id,a=t.adId,n=t.sequence,r=t.apiFramework;return{id:i,adId:a,sequence:n,apiFramework:r,type:\"nonlinear\",variations:[],trackingEvents:{}}}(t);return j.childrenByName(e,\"TrackingEvents\").forEach((function(e){var t,a;j.childrenByName(e,\"Tracking\").forEach((function(e){t=e.getAttribute(\"event\"),a=j.parseNodeText(e),t&&a&&(Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(a))}))})),j.childrenByName(e,\"NonLinear\").forEach((function(e){var t={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:\"static\",adType:\"nonLinearAd\",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};t.id=e.getAttribute(\"id\")||null,t.width=e.getAttribute(\"width\"),t.height=e.getAttribute(\"height\"),t.expandedWidth=e.getAttribute(\"expandedWidth\"),t.expandedHeight=e.getAttribute(\"expandedHeight\"),t.scalable=j.parseBoolean(e.getAttribute(\"scalable\")),t.maintainAspectRatio=j.parseBoolean(e.getAttribute(\"maintainAspectRatio\")),t.minSuggestedDuration=j.parseDuration(e.getAttribute(\"minSuggestedDuration\")),t.apiFramework=e.getAttribute(\"apiFramework\"),j.childrenByName(e,\"HTMLResource\").forEach((function(e){t.type=e.getAttribute(\"creativeType\")||\"text/html\",t.htmlResource=j.parseNodeText(e)})),j.childrenByName(e,\"IFrameResource\").forEach((function(e){t.type=e.getAttribute(\"creativeType\")||0,t.iframeResource=j.parseNodeText(e)})),j.childrenByName(e,\"StaticResource\").forEach((function(e){t.type=e.getAttribute(\"creativeType\")||0,t.staticResource=j.parseNodeText(e)}));var a=j.childByName(e,\"AdParameters\");if(a){t.adParameters=[];for(var n=0;n=0){var l=j.parseNodeText(t);\"\"!==l&&(a.value=l),a.children=[]}return null===(i=a).value&&0===Object.keys(i.attributes).length&&0===i.children.length?null:a}(e);i&&t.push(i)})),t}function P(e){var t=[];return e.forEach((function(e){var i,a,n={id:e.getAttribute(\"id\")||null,adId:D(e),sequence:e.getAttribute(\"sequence\")||null,apiFramework:e.getAttribute(\"apiFramework\")||null},r=j.childByName(e,\"UniversalAdId\");r&&(i={idRegistry:r.getAttribute(\"idRegistry\")||\"unknown\",value:j.parseNodeText(r)});var s=j.childByName(e,\"CreativeExtensions\");for(var o in s&&(a=O(j.childrenByName(s,\"CreativeExtension\"))),e.childNodes){var c=e.childNodes[o],d=void 0;switch(c.nodeName){case\"Linear\":d=M(c,n);break;case\"NonLinearAds\":d=x(c,n);break;case\"CompanionAds\":d=S(c,n)}d&&(i&&(d.universalAdId=i),a&&(d.creativeExtensions=a),t.push(d))}})),t}function D(e){return e.getAttribute(\"AdID\")||e.getAttribute(\"adID\")||e.getAttribute(\"adId\")||null}var N={Wrapper:{subElements:[\"VASTAdTagURI\",\"Impression\"]},BlockedAdCategories:{attributes:[\"authority\"]},InLine:{subElements:[\"AdSystem\",\"AdTitle\",\"Impression\",\"AdServingId\",\"Creatives\"]},Category:{attributes:[\"authority\"]},Pricing:{attributes:[\"model\",\"currency\"]},Verification:{oneOfinLineResources:[\"JavaScriptResource\",\"ExecutableResource\"],attributes:[\"vendor\"]},UniversalAdId:{attributes:[\"idRegistry\"]},JavaScriptResource:{attributes:[\"apiFramework\",\"browserOptional\"]},ExecutableResource:{attributes:[\"apiFramework\",\"type\"]},Tracking:{attributes:[\"event\"]},Creatives:{subElements:[\"Creative\"]},Creative:{subElements:[\"UniversalAdId\"]},Linear:{subElements:[\"MediaFiles\",\"Duration\"]},MediaFiles:{subElements:[\"MediaFile\"]},MediaFile:{attributes:[\"delivery\",\"type\",\"width\",\"height\"]},Mezzanine:{attributes:[\"delivery\",\"type\",\"width\",\"height\"]},NonLinear:{oneOfinLineResources:[\"StaticResource\",\"IFrameResource\",\"HTMLResource\"],attributes:[\"width\",\"height\"]},Companion:{oneOfinLineResources:[\"StaticResource\",\"IFrameResource\",\"HTMLResource\"],attributes:[\"width\",\"height\"]},StaticResource:{attributes:[\"creativeType\"]},Icons:{subElements:[\"Icon\"]},Icon:{oneOfinLineResources:[\"StaticResource\",\"IFrameResource\",\"HTMLResource\"]}};function R(e,t){if(N[e.nodeName]&&N[e.nodeName].attributes){var i=N[e.nodeName].attributes.filter((function(t){return!e.getAttribute(t)}));i.length>0&&V({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:i},t)}}function B(e,t,i){var a=N[e.nodeName],n=!i&&\"Wrapper\"!==e.nodeName;if(a&&!n){if(a.subElements){var r=a.subElements.filter((function(t){return!j.childByName(e,t)}));r.length>0&&V({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:r},t)}i&&a.oneOfinLineResources&&(a.oneOfinLineResources.some((function(t){return j.childByName(e,t)}))||V({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:a.oneOfinLineResources},t))}}function U(e){return e.children&&0!==e.children.length}function V(e,t){var i=e.name,a=e.parentName,n=e.attributes,r=e.subElements,s=e.oneOfResources,o=\"Element '\".concat(i,\"'\");t(\"VAST-warning\",{message:o+=n?\" missing required attribute(s) '\".concat(n.join(\", \"),\"' \"):r?\" missing required sub element(s) '\".concat(r.join(\", \"),\"' \"):s?\" must provide one of the following '\".concat(s.join(\", \"),\"' \"):\" is empty\",parentElement:a,specVersion:4.1})}var F={verifyRequiredValues:function e(t,i,a){if(t&&t.nodeName)if(\"InLine\"===t.nodeName&&(a=!0),R(t,i),U(t)){B(t,i,a);for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{},a=i.allowMultipleAds,n=i.followAdditionalWrappers,r=e.childNodes;for(var s in r){var o=r[s];if(-1!==[\"Wrapper\",\"InLine\"].indexOf(o.nodeName)&&(\"Wrapper\"!==o.nodeName||!1!==n)){if(j.copyNodeAttribute(\"id\",e,o),j.copyNodeAttribute(\"sequence\",e,o),j.copyNodeAttribute(\"adType\",e,o),\"Wrapper\"===o.nodeName)return{ad:Q(o,t),type:\"WRAPPER\"};if(\"InLine\"===o.nodeName)return{ad:z(o,t,{allowMultipleAds:a}),type:\"INLINE\"}}}}function z(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.allowMultipleAds,G(e,t)}function G(e,t){t&&F.verifyRequiredValues(e,t);var i=e.childNodes,a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,sequence:e.sequence||null,adType:e.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(j.parseAttributes(e));for(var n in i){var r=i[n];switch(r.nodeName){case\"Error\":a.errorURLTemplates.push(j.parseNodeText(r));break;case\"Impression\":a.impressionURLTemplates.push({id:r.getAttribute(\"id\")||null,url:j.parseNodeText(r)});break;case\"Creatives\":a.creatives=P(j.childrenByName(r,\"Creative\"));break;case\"Extensions\":var s=j.childrenByName(r,\"Extension\");a.extensions=O(s),a.adVerifications.length||(a.adVerifications=q(s));break;case\"AdVerifications\":a.adVerifications=Y(j.childrenByName(r,\"Verification\"));break;case\"AdSystem\":a.system={value:j.parseNodeText(r),version:r.getAttribute(\"version\")||null};break;case\"AdTitle\":a.title=j.parseNodeText(r);break;case\"AdServingId\":a.adServingId=j.parseNodeText(r);break;case\"Category\":a.categories.push({authority:r.getAttribute(\"authority\")||null,value:j.parseNodeText(r)});break;case\"Expires\":a.expires=parseInt(j.parseNodeText(r),10);break;case\"ViewableImpression\":a.viewableImpression.push(K(r));break;case\"Description\":a.description=j.parseNodeText(r);break;case\"Advertiser\":a.advertiser={id:r.getAttribute(\"id\")||null,value:j.parseNodeText(r)};break;case\"Pricing\":a.pricing={value:j.parseNodeText(r),model:r.getAttribute(\"model\")||null,currency:r.getAttribute(\"currency\")||null};break;case\"Survey\":a.survey=j.parseNodeText(r);break;case\"BlockedAdCategories\":a.blockedAdCategories.push({authority:r.getAttribute(\"authority\")||null,value:j.parseNodeText(r)})}}return a}function Q(e,t){var i=G(e,t),a=e.getAttribute(\"followAdditionalWrappers\"),n=e.getAttribute(\"allowMultipleAds\"),r=e.getAttribute(\"fallbackOnNoAd\");i.followAdditionalWrappers=!a||j.parseBoolean(a),i.allowMultipleAds=!!n&&j.parseBoolean(n),i.fallbackOnNoAd=r?j.parseBoolean(r):null;var s=j.childByName(e,\"VASTAdTagURI\");if(s?i.nextWrapperURL=j.parseNodeText(s):(s=j.childByName(e,\"VASTAdTagURL\"))&&(i.nextWrapperURL=j.parseNodeText(j.childByName(s,\"URL\"))),i.creatives.forEach((function(e){if(-1!==[\"linear\",\"nonlinear\"].indexOf(e.type)){if(e.trackingEvents){i.trackingEvents||(i.trackingEvents={}),i.trackingEvents[e.type]||(i.trackingEvents[e.type]={});var t=function(t){var a=e.trackingEvents[t];Array.isArray(i.trackingEvents[e.type][t])||(i.trackingEvents[e.type][t]=[]),a.forEach((function(a){i.trackingEvents[e.type][t].push(a)}))};for(var a in e.trackingEvents)t(a)}e.videoClickTrackingURLTemplates&&(Array.isArray(i.videoClickTrackingURLTemplates)||(i.videoClickTrackingURLTemplates=[]),e.videoClickTrackingURLTemplates.forEach((function(e){i.videoClickTrackingURLTemplates.push(e)}))),e.videoClickThroughURLTemplate&&(i.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate),e.videoCustomClickURLTemplates&&(Array.isArray(i.videoCustomClickURLTemplates)||(i.videoCustomClickURLTemplates=[]),e.videoCustomClickURLTemplates.forEach((function(e){i.videoCustomClickURLTemplates.push(e)}))),e.adParameters&&(Array.isArray(i.adParameters)||(i.adParameters=[]),e.adParameters.forEach((function(e){i.adParameters.push(e)})))}})),i.nextWrapperURL)return i}function Y(e){var t=[];return e.forEach((function(e){var i={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},a=e.childNodes;for(var n in j.assignAttributes(e.attributes,i),a){var r=a[n];switch(r.nodeName){case\"JavaScriptResource\":case\"ExecutableResource\":i.resource=j.parseNodeText(r),j.assignAttributes(r.attributes,i);break;case\"VerificationParameters\":i.parameters=j.parseNodeText(r)}}var s=j.childByName(e,\"TrackingEvents\");s&&j.childrenByName(s,\"Tracking\").forEach((function(e){var t=e.getAttribute(\"event\"),a=j.parseNodeText(e);t&&a&&(Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(a))})),t.push(i)})),t}function q(e){var t=null,i=[];return e.some((function(e){return t=j.childByName(e,\"AdVerifications\")})),t&&(i=Y(j.childrenByName(t,\"Verification\"))),i}function K(e){var t={};t.id=e.getAttribute(\"id\")||null;var i=e.childNodes;for(var a in i){var n=i[a],r=n.nodeName,s=j.parseNodeText(n);if((\"Viewable\"===r||\"NotViewable\"===r||\"ViewUndetermined\"===r)&&s){var o=r.toLowerCase();Array.isArray(t[o])||(t[o]=[]),t[o].push(s)}}return t}var W=function(){function e(){i(this,e),this._handlers=[]}return n(e,[{key:\"on\",value:function(e,i){if(\"function\"!=typeof i)throw new TypeError(\"The handler argument must be of type Function. Received type \".concat(t(i)));if(!e)throw new TypeError(\"The event argument must be of type String. Received type \".concat(t(e)));return this._handlers.push({event:e,handler:i}),this}},{key:\"once\",value:function(e,t){return this.on(e,function(e,t,i){var a={fired:!1,wrapFn:void 0};function n(){a.fired||(e.off(t,a.wrapFn),a.fired=!0,i.bind(e).apply(void 0,arguments))}return a.wrapFn=n,n}(this,e,t))}},{key:\"off\",value:function(e,t){return this._handlers=this._handlers.filter((function(i){return i.event!==e||i.handler!==t})),this}},{key:\"emit\",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),a=1;a2?i-2:0),n=2;n1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new Promise((function(n,r){t.URLTemplateFilters.forEach((function(t){e=t(e)})),t.parentURLs.push(e);var s=Date.now();t.emit(\"VAST-resolving\",{url:e,previousUrl:a,wrapperDepth:i,maxWrapperDepth:t.maxWrapperDepth,timeout:t.fetchingOptions.timeout}),t.urlHandler.get(e,t.fetchingOptions,(function(o,c){var d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},l=Math.round(Date.now()-s),u=Object.assign({url:e,previousUrl:a,wrapperDepth:i,error:o,duration:l},d);t.emit(\"VAST-resolved\",u),o?r(o):n(c)}))}))}},{key:\"initParsingStatus\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.rootURL=\"\",this.remainingAds=[],this.parentURLs=[],this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.maxWrapperDepth=e.wrapperLimit||10,this.fetchingOptions={timeout:e.timeout||12e4,withCredentials:e.withCredentials},this.urlHandler=e.urlHandler||e.urlhandler||$,this.vastVersion=null}},{key:\"getRemainingAds\",value:function(e){var t=this;if(0===this.remainingAds.length)return Promise.reject(new Error(\"No more ads are available for the given VAST\"));var i=e?w.flatten(this.remainingAds):this.remainingAds.shift();return this.errorURLTemplates=[],this.parentURLs=[],this.resolveAds(i,{wrapperDepth:0,url:this.rootURL}).then((function(e){return t.buildVASTResponse(e)}))}},{key:\"getAndParseVAST\",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(i),this.URLTemplateFilters.forEach((function(t){e=t(e)})),this.rootURL=e,this.fetchVAST(e).then((function(a){return i.previousUrl=e,i.isRootVAST=!0,i.url=e,t.parse(a,i).then((function(e){return t.buildVASTResponse(e)}))}))}},{key:\"parseVAST\",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(i),i.isRootVAST=!0,this.parse(e,i).then((function(e){return t.buildVASTResponse(e)}))}},{key:\"buildVASTResponse\",value:function(e){var t,i={ads:(t={ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion}).ads||[],errorURLTemplates:t.errorURLTemplates||[],version:t.version||null};return this.completeWrapperResolving(i),i}},{key:\"parseVastXml\",value:function(e,t){var i=t.isRootVAST,a=void 0!==i&&i,n=t.url,r=void 0===n?null:n,s=t.wrapperDepth,o=void 0===s?0:s,c=t.allowMultipleAds,d=t.followAdditionalWrappers;if(!e||!e.documentElement||\"VAST\"!==e.documentElement.nodeName)throw this.emit(\"VAST-ad-parsed\",{type:\"ERROR\",url:r,wrapperDepth:o}),new Error(\"Invalid VAST XMLDocument\");var l=[],u=e.documentElement.childNodes,h=e.documentElement.getAttribute(\"version\");for(var p in a&&h&&(this.vastVersion=h),u){var A=u[p];if(\"Error\"===A.nodeName){var m=j.parseNodeText(A);a?this.rootErrorURLTemplates.push(m):this.errorURLTemplates.push(m)}else if(\"Ad\"===A.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)c=!0;else if(!1===c&&l.length>1)break;var g=H(A,this.emit.bind(this),{allowMultipleAds:c,followAdditionalWrappers:d});g.ad?(l.push(g.ad),this.emit(\"VAST-ad-parsed\",{type:g.type,url:r,wrapperDepth:o,adIndex:l.length-1,vastVersion:h})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return l}},{key:\"parse\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.url,a=void 0===i?null:i,n=t.resolveAll,r=void 0===n||n,s=t.wrapperSequence,o=void 0===s?null:s,c=t.previousUrl,d=void 0===c?null:c,l=t.wrapperDepth,u=void 0===l?0:l,h=t.isRootVAST,p=void 0!==h&&h,A=t.followAdditionalWrappers,m=t.allowMultipleAds,g=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&p&&(m=!0);try{g=this.parseVastXml(e,{isRootVAST:p,url:a,wrapperDepth:u,allowMultipleAds:m,followAdditionalWrappers:A})}catch(e){return Promise.reject(e)}return 1===g.length&&null!=o&&(g[0].sequence=o),!1===r&&(this.remainingAds=j.splitVAST(g),g=this.remainingAds.shift()),this.resolveAds(g,{wrapperDepth:u,previousUrl:d,url:a})}},{key:\"resolveAds\",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1?arguments[1]:void 0,a=i.wrapperDepth,n=i.previousUrl,r=i.url,s=[];return n=r,t.forEach((function(t){var i=e.resolveWrappers(t,a,n);s.push(i)})),Promise.all(s).then((function(t){var i=w.flatten(t);if(!i&&e.remainingAds.length>0){var s=e.remainingAds.shift();return e.resolveAds(s,{wrapperDepth:a,previousUrl:n,url:r})}return i}))}},{key:\"resolveWrappers\",value:function(e,t,i){var a=this;return new Promise((function(n){if(t++,!e.nextWrapperURL)return delete e.nextWrapperURL,n(e);if(t>=a.maxWrapperDepth||-1!==a.parentURLs.indexOf(e.nextWrapperURL))return e.errorCode=302,delete e.nextWrapperURL,n(e);e.nextWrapperURL=j.resolveVastAdTagURI(e.nextWrapperURL,i),a.URLTemplateFilters.forEach((function(t){e.nextWrapperURL=t(e.nextWrapperURL)}));var r=e.sequence;a.fetchVAST(e.nextWrapperURL,t,i).then((function(s){return a.parse(s,{url:e.nextWrapperURL,previousUrl:i,wrapperSequence:r,wrapperDepth:t,followAdditionalWrappers:e.followAdditionalWrappers,allowMultipleAds:!0}).then((function(t){if(delete e.nextWrapperURL,0===t.length)return e.creatives=[],n(e);t.forEach((function(t){t&&j.mergeWrapperAdData(t,e)})),n(t)}))})).catch((function(t){e.errorCode=301,e.errorMessage=t.message,n(e)}))}))}},{key:\"completeWrapperResolving\",value:function(e){if(0===e.ads.length)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(var t=e.ads.length-1;t>=0;t--){var i=e.ads[t];(i.errorCode||0===i.creatives.length)&&(this.trackVastError(i.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:i.errorCode||303},{ERRORMESSAGE:i.errorMessage||\"\"},{extensions:i.extensions},{system:i.system}),e.ads.splice(t,1))}}}]),a}(W),ie=null,ae={data:{},length:0,getItem:function(e){return this.data[e]},setItem:function(e,t){this.data[e]=t,this.length=Object.keys(this.data).length},removeItem:function(e){delete this.data[e],this.length=Object.keys(this.data).length},clear:function(){this.data={},this.length=0}},ne=function(){function e(){i(this,e),this.storage=this.initStorage()}return n(e,[{key:\"initStorage\",value:function(){if(ie)return ie;try{ie=\"undefined\"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){ie=null}return ie&&!this.isStorageDisabled(ie)||(ie=ae).clear(),ie}},{key:\"isStorageDisabled\",value:function(e){var t=\"__VASTStorage__\";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch(e){return!0}return e.removeItem(t),!1}},{key:\"getItem\",value:function(e){return this.storage.getItem(e)}},{key:\"setItem\",value:function(e,t){return this.storage.setItem(e,t)}},{key:\"removeItem\",value:function(e){return this.storage.removeItem(e)}},{key:\"clear\",value:function(){return this.storage.clear()}}]),e}(),re=function(){function e(t,a,n){i(this,e),this.cappingFreeLunch=t||0,this.cappingMinimumTimeInterval=a||0,this.defaultOptions={withCredentials:!1,timeout:0},this.vastParser=new te,this.storage=n||new ne,void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)}return n(e,[{key:\"getParser\",value:function(){return this.vastParser}},{key:\"lastSuccessfulAd\",get:function(){return this.storage.getItem(\"vast-client-last-successful-ad\")},set:function(e){this.storage.setItem(\"vast-client-last-successful-ad\",e)}},{key:\"totalCalls\",get:function(){return this.storage.getItem(\"vast-client-total-calls\")},set:function(e){this.storage.setItem(\"vast-client-total-calls\",e)}},{key:\"totalCallsTimeout\",get:function(){return this.storage.getItem(\"vast-client-total-calls-timeout\")},set:function(e){this.storage.setItem(\"vast-client-total-calls-timeout\",e)}},{key:\"hasRemainingAds\",value:function(){return this.vastParser.remainingAds.length>0}},{key:\"getNextAds\",value:function(e){return this.vastParser.getRemainingAds(e)}},{key:\"get\",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=Date.now();return(i=Object.assign({},this.defaultOptions,i)).hasOwnProperty(\"resolveAll\")||(i.resolveAll=!1),this.totalCallsTimeout=t.totalCalls)return r(new Error(\"VAST call canceled – FreeLunch capping not reached yet \".concat(t.totalCalls,\"/\").concat(t.cappingFreeLunch)));var s=a-t.lastSuccessfulAd;if(s<0)t.lastSuccessfulAd=0;else if(s3&&void 0!==arguments[3]?arguments[3]:null;for(var c in i(this,a),(s=t.call(this)).ad=n,s.creative=r,s.variation=o,s.muted=!1,s.impressed=!1,s.completed=!1,s.viewability=!1,s.skippable=!1,s.trackingEvents={},s.lastPercentage=0,s._alreadyTriggeredQuartiles={},s.emitAlwaysEvents=[\"creativeView\",\"start\",\"firstQuartile\",\"midpoint\",\"thirdQuartile\",\"complete\",\"resume\",\"pause\",\"rewind\",\"skip\",\"closeLinear\",\"close\"],s.creative.trackingEvents){var d=s.creative.trackingEvents[c];s.trackingEvents[c]=d.slice(0)}return L(s.creative)?s._initLinearTracking():s._initVariationTracking(),e&&s.on(\"start\",(function(){e.lastSuccessfulAd=Date.now()})),s}return n(a,[{key:\"_initLinearTracking\",value:function(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}},{key:\"_initVariationTracking\",value:function(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(var e in this.variation.trackingEvents){var t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}\"nonLinearAd\"===this.variation.adType?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return\"companionAd\"===e.adType}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}},{key:\"setDuration\",value:function(e){this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}}},{key:\"setProgress\",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=this.skipDelay||-1;if(-1===a||this.skippable||(a>e?this.emit(\"skip-countdown\",a-e):(this.skippable=!0,this.emit(\"skip-countdown\",0))),this.assetDuration>0){var n=Math.round(e/this.assetDuration*100),r=[];if(e>0){r.push(\"start\");for(var s=this.lastPercentage;s2&&(this.viewability=!0,this.ad&&this.trackURLs(this.ad.viewableImpression,i)),r.forEach((function(e){t.track(e,{macros:i,once:!0})})),e1&&void 0!==arguments[1]?arguments[1]:{};this.muted!==e&&this.track(e?\"mute\":\"unmute\",{macros:t}),this.muted=e}},{key:\"setPaused\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.paused!==e&&this.track(e?\"pause\":\"resume\",{macros:t}),this.paused=e}},{key:\"setFullscreen\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.fullscreen!==e&&this.track(e?\"fullscreen\":\"exitFullscreen\",{macros:t}),this.fullscreen=e}},{key:\"setExpand\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.expanded!==e&&(this.track(e?\"expand\":\"collapse\",{macros:t}),this.track(e?\"playerExpand\":\"playerCollapse\",{macros:t})),this.expanded=e}},{key:\"setSkipDelay\",value:function(e){\"number\"==typeof e&&(this.skipDelay=e)}},{key:\"trackImpression\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.impressed||(this.impressed=!0,this.ad&&this.trackURLs(this.ad.impressionURLTemplates,e),this.track(\"creativeView\",{macros:e}))}},{key:\"errorWithCode\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.trackURLs(this.ad.errorURLTemplates,{ERRORCODE:e},{isCustomCode:t})}},{key:\"complete\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.completed||(this.completed=!0,this.track(\"complete\",{macros:e}))}},{key:\"notUsed\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track(\"notUsed\",{macros:e}),this.trackingEvents=[]}},{key:\"otherAdInteraction\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track(\"otherAdInteraction\",{macros:e})}},{key:\"acceptInvitation\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track(\"acceptInvitation\",{macros:e})}},{key:\"adExpand\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track(\"adExpand\",{macros:e})}},{key:\"adCollapse\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track(\"adCollapse\",{macros:e})}},{key:\"minimize\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track(\"minimize\",{macros:e})}},{key:\"verificationNotExecuted\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error(\"No adVerifications provided\");if(!e)throw new Error(\"No vendor provided, unable to find associated verificationNotExecuted\");var i=this.ad.adVerifications.find((function(t){return t.vendor===e}));if(!i)throw new Error(\"No associated verification element found for vendor: \".concat(e));var a=i.trackingEvents;if(a&&a.verificationNotExecuted){var n=a.verificationNotExecuted;this.trackURLs(n,t),this.emit(\"verificationNotExecuted\",{trackingURLTemplates:n})}}},{key:\"overlayViewDuration\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.ADPLAYHEAD=e,this.track(\"overlayViewDuration\",{macros:t})}},{key:\"close\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track(this.linear?\"closeLinear\":\"close\",{macros:e})}},{key:\"skip\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track(\"skip\",{macros:e})}},{key:\"load\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.track(\"loaded\",{macros:e})}},{key:\"click\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);var i=this.clickThroughURLTemplate||e,a=c({},t);if(i){this.progress&&(a.ADPLAYHEAD=this.progressFormatted());var n=w.resolveURLTemplates([i],a)[0];this.emit(\"clickthrough\",n)}}},{key:\"track\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.macros,a=void 0===i?{}:i,n=t.once,r=void 0!==n&&n;\"closeLinear\"===e&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e=\"close\");var s=this.trackingEvents[e],o=this.emitAlwaysEvents.indexOf(e)>-1;s?(this.emit(e,{trackingURLTemplates:s}),this.trackURLs(s,a)):o&&this.emit(e,null),r&&(delete this.trackingEvents[e],o&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}},{key:\"trackURLs\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(t.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(t.ADPLAYHEAD=this.progressFormatted())),this.creative&&this.creative.universalAdId&&this.creative.universalAdId.idRegistry&&this.creative.universalAdId.value&&(t.UNIVERSALADID=\"\".concat(this.creative.universalAdId.idRegistry,\" \").concat(this.creative.universalAdId.value)),this.ad&&(this.ad.sequence&&(t.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(t.ADTYPE=this.ad.adType),this.ad.adServingId&&(t.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(t.ADCATEGORIES=this.ad.categories.map((function(e){return e.value})).join(\",\")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(t.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories)),w.track(e,t,i)}},{key:\"convertToTimecode\",value:function(e){var t=1e3*e,i=Math.floor(t/36e5),a=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),r=Math.floor(t%1e3);return\"\".concat(w.leftpad(i,2),\":\").concat(w.leftpad(a,2),\":\").concat(w.leftpad(n,2),\".\").concat(w.leftpad(r,3))}},{key:\"progressFormatted\",value:function(){return this.convertToTimecode(this.progress)}}]),a}(W);e.VASTClient=re,e.VASTParser=te,e.VASTTracker=se,Object.defineProperty(e,\"__esModule\",{value:!0})},\"object\"===o(t)&&void 0!==e?s(t):(n=[t],void 0===(r=\"function\"==typeof(a=s)?a.apply(t,n):a)||(e.exports=r))},function(e,t,i){var a,n,r;!function(i,s){\"use strict\";\"object\"==typeof e.exports?e.exports=s():(n=[],void 0===(r=\"function\"==typeof(a=s)?a.apply(t,n):a)||(e.exports=r))}(0,(function(){\"use strict\";var e=Object.prototype.toString;function t(e,t){return null!=e&&Object.prototype.hasOwnProperty.call(e,t)}function i(e){if(!e)return!0;if(n(e)&&0===e.length)return!0;if(\"string\"!=typeof e){for(var i in e)if(t(e,i))return!1;return!0}return!1}function a(t){return e.call(t)}var n=Array.isArray||function(t){return\"[object Array]\"===e.call(t)};function r(e){var t=parseInt(e);return t.toString()===e?t:e}function s(e){var s,o=function(e){return Object.keys(o).reduce((function(t,i){return\"create\"===i||\"function\"==typeof o[i]&&(t[i]=o[i].bind(o,e)),t}),{})};function c(e,t){if(s(e,t))return e[t]}function d(t,i,a,n){if(\"number\"==typeof i&&(i=[i]),!i||0===i.length)return t;if(\"string\"==typeof i)return d(t,i.split(\".\").map(r),a,n);var s=i[0],o=c(t,s);if(e.includeInheritedProps&&(\"__proto__\"===s||\"constructor\"===s&&\"function\"==typeof o))throw new Error(\"For security reasons, object's magic properties cannot be set\");return 1===i.length?(void 0!==o&&n||(t[s]=a),o):(void 0===o&&(\"number\"==typeof i[1]?t[s]=[]:t[s]={}),d(t[s],i.slice(1),a,n))}return s=(e=e||{}).includeInheritedProps?function(){return!0}:function(e,i){return\"number\"==typeof i&&Array.isArray(e)||t(e,i)},o.has=function(i,a){if(\"number\"==typeof a?a=[a]:\"string\"==typeof a&&(a=a.split(\".\")),!a||0===a.length)return!!i;for(var s=0;s1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0,s=\"\",c=\"\",d=i||{},l=0;l