@openplayerjs/ads 3.0.0-beta.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.js +33 -13
- package/dist/index.js.map +1 -1
- package/dist/openplayer-ads.js +1 -1
- package/dist/openplayer-ads.js.map +1 -1
- package/dist/types/ads.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/openplayer-ads.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@openplayerjs/core")):"function"==typeof define&&define.amd?define(["@openplayerjs/core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).OpenPlayerJS)}(this,function(e){"use strict";function t(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adId:e.adId||null,sequence:e.sequence||null,apiFramework:e.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}const i=["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"];function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=[],n=o(e);!t.ERRORCODE||r.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=h(Math.round(1e8*Math.random())),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING;for(const e in t)t[e]=d(t[e]);for(const e in n){const r=n[e];"string"==typeof r&&i.push(a(r,t))}return i}function a(e,t){const r=(e=s(e,t)).match(/[^[\]]+(?=])/g);if(!r)return e;let n=r.filter(e=>i.indexOf(e)>-1);return 0===n.length?e:(n=n.reduce((e,t)=>(e[t]=-1,e),{}),s(e,n))}function s(e,t){let r=e;for(const e in t){const i=t[e];r=r.replace(new RegExp("(?:\\[|%%)(".concat(e,")(?:\\]|%%)"),"g"),i)}return r}function o(e){return Array.isArray(e)?e.map(e=>e&&e.hasOwnProperty("url")?e.url:e):e}function l(e){return/^(https?:\/\/|\/\/)/.test(e)}function c(e,t){for(let r=0;r<t.length;r++)if(u(t[r],e))return!0;return!1}function u(e,t){if(e&&t){const r=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);return r.length===i.length&&e.id===t.id&&e.url===t.url}return!1}function d(e){return encodeURIComponent(e).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.toString().padStart(t,"0")}const p={track:function(e,t,r){n(e,t,r).forEach(e=>{"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:n,extractURLsFromTemplates:o,filterUrlTemplates:function(e){return e.reduce((e,t)=>{const r=t.url||t;return l(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:c,isTemplateObjectEqual:u,encodeURIComponentRFC3986:d,replaceUrlMacros:a,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce((t,r)=>t.concat(Array.isArray(r)?e(r):r),[])},joinArrayOfUniqueTemplateObjs:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[];return r.concat(i).reduce((e,t)=>(c(t,e)||e.push(t),e),[])},isValidTimeValue:function(e){return Number.isFinite(e)&&e>=-2},addLeadingZeros:h,isValidUrl:l,isBrowserEnvironment:function(){return"undefined"!=typeof window},formatMacrosValues:function(e){return"object"!=typeof e?e:JSON.stringify(e)}};function m(e){return["true","TRUE","True","1"].includes(e)}const f={childByName:function(e,t){return Array.from(e.childNodes).find(e=>e.nodeName===t)},childrenByName:function(e,t){return Array.from(e.childNodes).filter(e=>e.nodeName===t)},resolveVastAdTagURI:function(e,t){if(!t)return e;if(e.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(e)}if(!e.includes("://")){const r=t.slice(0,t.lastIndexOf("/"));return"".concat(r,"/").concat(e)}return e},parseBoolean:m,parseNodeText:function(e){return e&&(e.textContent||e.text||"").trim()},copyNodeAttribute:function(e,t,r){const i=t.getAttribute(e);i&&r.setAttribute(e,i)},parseAttributes:function(e){return Array.from(e.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:function(e){if(null==e)return-1;if(p.isNumeric(e))return parseInt(e);const t=e.split(":");if(3!==t.length)return-1;const r=t[2].split(".");let i=parseInt(r[0]);2===r.length&&(i+=parseFloat("0.".concat(r[1])));const n=parseInt(60*t[1]),a=parseInt(60*t[0]*60);return isNaN(a)||isNaN(n)||isNaN(i)||n>3600||i>60?-1:a+n+i},getStandAloneAds:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>!parseInt(e.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>parseInt(e.sequence,10)).sort((e,t)=>e.sequence-t.sequence)},assignAttributes:function(e,t){e&&Array.from(e).forEach(e=>{let{nodeName:r,nodeValue:i}=e;if(r&&i&&t.hasOwnProperty(r)){let e=i;"boolean"==typeof t[r]&&(e=m(e)),t[r]=e}})},mergeWrapperAdData:function(e,t){var r;e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),t.viewableImpression.length>0&&(e.viewableImpression=[...e.viewableImpression,...t.viewableImpression]),e.followAdditionalWrappers=t.followAdditionalWrappers,e.allowMultipleAds=t.allowMultipleAds,e.fallbackOnNoAd=t.fallbackOnNoAd;const i=(t.creatives||[]).filter(e=>e&&"companion"===e.type),n=i.reduce((e,t)=>((t.variations||[]).forEach(t=>{(t.companionClickTrackingURLTemplates||[]).forEach(t=>{p.containsTemplateObject(t,e)||e.push(t)})}),e),[]);e.creatives=i.concat(e.creatives);const a=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,s=t.videoCustomClickURLTemplates&&t.videoCustomClickURLTemplates.length;if(e.creatives.forEach(e=>{if(t.trackingEvents&&t.trackingEvents[e.type])for(const r in t.trackingEvents[e.type]){const i=t.trackingEvents[e.type][r];Array.isArray(e.trackingEvents[r])||(e.trackingEvents[r]=[]),e.trackingEvents[r]=e.trackingEvents[r].concat(i)}"linear"===e.type&&(a&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),s&&(e.videoCustomClickURLTemplates=e.videoCustomClickURLTemplates.concat(t.videoCustomClickURLTemplates)),!t.videoClickThroughURLTemplate||null!==e.videoClickThroughURLTemplate&&void 0!==e.videoClickThroughURLTemplate||(e.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate)),"companion"===e.type&&n.length&&(e.variations||[]).forEach(e=>{e.companionClickTrackingURLTemplates=p.joinArrayOfUniqueTemplateObjs(e.companionClickTrackingURLTemplates,n)})}),t.adVerifications&&(e.adVerifications=e.adVerifications.concat(t.adVerifications)),t.blockedAdCategories&&(e.blockedAdCategories=e.blockedAdCategories.concat(t.blockedAdCategories)),null!==(r=t.creatives)&&void 0!==r&&r.length){const r=t.creatives.filter(e=>{var t;return(null===(t=e.icons)||void 0===t?void 0:t.length)&&!e.mediaFiles.length});r.length&&(e.creatives=e.creatives.concat(r))}}};function g(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:i,sequence:n,apiFramework:a}=r(e);return{id:t,adId:i,sequence:n,apiFramework:a,type:"companion",required:null,variations:[]}}(t);return i.required=e.getAttribute("required")||null,i.variations=f.childrenByName(e,"Companion").map(e=>{const t=function(){let 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||null,pxratio:e.pxratio||"1",renderingMode:e.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(f.parseAttributes(e));t.htmlResources=f.childrenByName(e,"HTMLResource").reduce((e,t)=>{const r=f.parseNodeText(t);return r?e.concat(r):e},[]),t.iframeResources=f.childrenByName(e,"IFrameResource").reduce((e,t)=>{const r=f.parseNodeText(t);return r?e.concat(r):e},[]),t.staticResources=f.childrenByName(e,"StaticResource").reduce((e,t)=>{const r=f.parseNodeText(t);return r?e.concat({url:r,creativeType:t.getAttribute("creativeType")||null}):e},[]),t.altText=f.parseNodeText(f.childByName(e,"AltText"))||null;const r=f.childByName(e,"TrackingEvents");r&&f.childrenByName(r,"Tracking").forEach(e=>{const r=e.getAttribute("event"),i=f.parseNodeText(e);r&&i&&(Array.isArray(t.trackingEvents[r])||(t.trackingEvents[r]=[]),t.trackingEvents[r].push(i))}),t.companionClickTrackingURLTemplates=f.childrenByName(e,"CompanionClickTracking").map(e=>({id:e.getAttribute("id")||null,url:f.parseNodeText(e)})),t.companionClickThroughURLTemplate=f.parseNodeText(f.childByName(e,"CompanionClickThrough"))||null;const i=f.childByName(e,"AdParameters");return i&&(t.adParameters={value:f.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t}),i}function v(e,t){let i;const n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:i,sequence:n,apiFramework:a}=r(e);return{id:t,adId:i,sequence:n,apiFramework:a,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(t);n.duration=f.parseDuration(f.parseNodeText(f.childByName(e,"Duration")));const a=e.getAttribute("skipoffset");if(null==a)n.skipDelay=null;else if("%"===a.charAt(a.length-1)&&-1!==n.duration){const e=parseInt(a,10);n.skipDelay=n.duration*(e/100)}else n.skipDelay=f.parseDuration(a);const s=f.childByName(e,"VideoClicks");if(s){const e=f.childByName(s,"ClickThrough");n.videoClickThroughURLTemplate=e?{id:e.getAttribute("id")||null,url:f.parseNodeText(e)}:null,f.childrenByName(s,"ClickTracking").forEach(e=>{n.videoClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:f.parseNodeText(e)})}),f.childrenByName(s,"CustomClick").forEach(e=>{n.videoCustomClickURLTemplates.push({id:e.getAttribute("id")||null,url:f.parseNodeText(e)})})}const o=f.childByName(e,"AdParameters");o&&(n.adParameters={value:f.parseNodeText(o),xmlEncoded:o.getAttribute("xmlEncoded")||null}),f.childrenByName(e,"TrackingEvents").forEach(e=>{f.childrenByName(e,"Tracking").forEach(e=>{let t=e.getAttribute("event");const r=f.parseNodeText(e);if(t&&r){if("progress"===t){if(i=e.getAttribute("offset"),!i)return;t="%"===i.charAt(i.length-1)?"progress-".concat(i):"progress-".concat(f.parseDuration(i))}Array.isArray(n.trackingEvents[t])||(n.trackingEvents[t]=[]),n.trackingEvents[t].push(r)}})}),f.childrenByName(e,"MediaFiles").forEach(e=>{f.childrenByName(e,"MediaFile").forEach(e=>{n.mediaFiles.push(function(e){const t={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};t.id=e.getAttribute("id"),t.fileURL=f.parseNodeText(e),t.deliveryType=e.getAttribute("delivery"),t.codec=e.getAttribute("codec"),t.mimeType=e.getAttribute("type"),t.mediaType=e.getAttribute("mediaType")||"2D",t.apiFramework=e.getAttribute("apiFramework"),t.fileSize=parseInt(e.getAttribute("fileSize")||0),t.bitrate=parseInt(e.getAttribute("bitrate")||0),t.minBitrate=parseInt(e.getAttribute("minBitrate")||0),t.maxBitrate=parseInt(e.getAttribute("maxBitrate")||0),t.width=parseInt(e.getAttribute("width")||0),t.height=parseInt(e.getAttribute("height")||0);const r=e.getAttribute("scalable");r&&"string"==typeof r&&(t.scalable=f.parseBoolean(r));const i=e.getAttribute("maintainAspectRatio");return i&&"string"==typeof i&&(t.maintainAspectRatio=f.parseBoolean(i)),t}(e))});const t=f.childByName(e,"InteractiveCreativeFile");t&&(n.interactiveCreativeFile=function(e){const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,apiFramework:e.apiFramework||null,variableDuration:f.parseBoolean(e.variableDuration),fileURL:null}}(f.parseAttributes(e));return t.fileURL=f.parseNodeText(e),t}(t));const r=f.childByName(e,"ClosedCaptionFiles");r&&f.childrenByName(r,"ClosedCaptionFile").forEach(e=>{const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,language:e.language||null,fileURL:null}}(f.parseAttributes(e));t.fileURL=f.parseNodeText(e),n.closedCaptionFiles.push(t)});const i=f.childByName(e,"Mezzanine"),a=function(e){const t={};let r=!1;return["delivery","type","width","height"].forEach(i=>{e&&e.getAttribute(i)?t[i]=e.getAttribute(i):r=!0}),r?null:t}(i);if(a){const e={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};e.id=i.getAttribute("id"),e.fileURL=f.parseNodeText(i),e.delivery=a.delivery,e.codec=i.getAttribute("codec"),e.type=a.type,e.width=parseInt(a.width,10),e.height=parseInt(a.height,10),e.fileSize=parseInt(i.getAttribute("fileSize"),10),e.mediaType=i.getAttribute("mediaType")||"2D",n.mezzanine=e}});const l=f.childByName(e,"Icons");return l&&f.childrenByName(l,"Icon").forEach(e=>{n.icons.push(function(e){const t={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,iconClickFallbackImages:[],altText:null,hoverText:null};t.program=e.getAttribute("program"),t.height=parseInt(e.getAttribute("height")||0),t.width=parseInt(e.getAttribute("width")||0),t.xPosition=function(e){return-1!==["left","right"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("xPosition")),t.yPosition=function(e){return-1!==["top","bottom"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("yPosition")),t.apiFramework=e.getAttribute("apiFramework"),t.pxratio=e.getAttribute("pxratio")||"1",t.offset=f.parseDuration(e.getAttribute("offset")),t.duration=f.parseDuration(e.getAttribute("duration")),t.altText=e.getAttribute("altText"),t.hoverText=e.getAttribute("hoverText"),f.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=f.parseNodeText(e)}),f.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=f.parseNodeText(e)}),f.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=f.parseNodeText(e)});const r=f.childByName(e,"IconClicks");if(r){t.iconClickThroughURLTemplate=f.parseNodeText(f.childByName(r,"IconClickThrough")),f.childrenByName(r,"IconClickTracking").forEach(e=>{t.iconClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:f.parseNodeText(e)})});const e=f.childByName(r,"IconClickFallbackImages");e&&f.childrenByName(e,"IconClickFallbackImage").forEach(e=>{t.iconClickFallbackImages.push({url:f.parseNodeText(e)||null,width:e.getAttribute("width")||null,height:e.getAttribute("height")||null})})}return t.iconViewTrackingURLTemplate=f.parseNodeText(f.childByName(e,"IconViewTracking")),t}(e))}),n}function b(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:i,sequence:n,apiFramework:a}=r(e);return{id:t,adId:i,sequence:n,apiFramework:a,type:"nonlinear",variations:[],trackingEvents:{}}}(t);return f.childrenByName(e,"TrackingEvents").forEach(e=>{let t,r;f.childrenByName(e,"Tracking").forEach(e=>{t=e.getAttribute("event"),r=f.parseNodeText(e),t&&r&&(Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(r))})}),f.childrenByName(e,"NonLinear").forEach(e=>{const 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=f.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=f.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=f.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),f.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=f.parseNodeText(e)}),f.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=f.parseNodeText(e)}),f.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=f.parseNodeText(e)});const r=f.childByName(e,"AdParameters");r&&(t.adParameters={value:f.parseNodeText(r),xmlEncoded:r.getAttribute("xmlEncoded")||null}),t.nonlinearClickThroughURLTemplate=f.parseNodeText(f.childByName(e,"NonLinearClickThrough")),f.childrenByName(e,"NonLinearClickTracking").forEach(e=>{t.nonlinearClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:f.parseNodeText(e)})}),i.variations.push(t)}),i}function y(e){const t=[];return e.forEach(e=>{const r=k(e);r&&t.push(r)}),t}function k(e){if("#comment"===e.nodeName)return null;const t={name:null,value:null,attributes:{},children:[]},r=e.attributes,i=e.childNodes;if(t.name=e.nodeName,e.attributes)for(const e in r)if(r.hasOwnProperty(e)){const i=r[e];i.nodeName&&i.nodeValue&&(t.attributes[i.nodeName]=i.nodeValue)}for(const e in i)if(i.hasOwnProperty(e)){const r=k(i[e]);r&&t.children.push(r)}if(0===t.children.length||1===t.children.length&&["#cdata-section","#text"].indexOf(t.children[0].name)>=0){const r=f.parseNodeText(e);""!==r&&(t.value=r),t.children=[]}return null===(n=t).value&&0===Object.keys(n.attributes).length&&0===n.children.length?null:t;var n}function T(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}const w={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 A(e,t){if(!w[e.nodeName]||!w[e.nodeName].attributes)return;const r=w[e.nodeName].attributes.filter(t=>!e.getAttribute(t));r.length>0&&R({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:r},t)}function N(e,t,r){const i=w[e.nodeName],n=!r&&"Wrapper"!==e.nodeName;if(i&&!n){if(i.subElements){const r=i.subElements.filter(t=>!f.childByName(e,t));r.length>0&&R({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:r},t)}r&&i.oneOfinLineResources&&(i.oneOfinLineResources.some(t=>f.childByName(e,t))||R({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},t))}}function E(e){return e.children&&0!==e.children.length}function R(e,t){let{name:r,parentName:i,attributes:n,subElements:a,oneOfResources:s}=e,o="Element '".concat(r,"'");o+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):a?" missing required sub element(s) '".concat(a.join(", "),"' "):s?" must provide one of the following '".concat(s.join(", "),"' "):" is empty",t("VAST-warning",{message:o,parentElement:i,specVersion:4.1})}const L=function e(t,r,i){if(t&&t.nodeName)if("InLine"===t.nodeName&&(i=!0),A(t,r),E(t)){N(t,r,i);for(let n=0;n<t.children.length;n++)e(t.children[n],r,i)}else 0===f.parseNodeText(t).length&&R({name:t.nodeName,parentName:t.parentNode.nodeName},r)};function C(e,t){let{allowMultipleAds:r,followAdditionalWrappers:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=Array.from(e.childNodes).filter(e=>{const t=e.nodeName.toLowerCase();return"inline"===t||!1!==i&&"wrapper"===t});for(const i of n){if(f.copyNodeAttribute("id",e,i),f.copyNodeAttribute("sequence",e,i),f.copyNodeAttribute("adType",e,i),"Wrapper"===i.nodeName)return{ad:D(i,t),type:"WRAPPER"};if("InLine"===i.nodeName)return{ad:x(i,t,{allowMultipleAds:r}),type:"INLINE"};const n=i.nodeName.toLowerCase();t("VAST-warning",{message:"<".concat(i.nodeName,"inline"===n?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:i})}}function x(e,t){let{allowMultipleAds:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return!1===r&&e.getAttribute("sequence")?null:S(e,t)}function S(e,t){let r=[];t&&L(e,t);const i=Array.from(e.childNodes),n=function(){let 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}}(f.parseAttributes(e));return i.forEach(e=>{switch(e.nodeName){case"Error":n.errorURLTemplates.push(f.parseNodeText(e));break;case"Impression":n.impressionURLTemplates.push({id:e.getAttribute("id")||null,url:f.parseNodeText(e)});break;case"Creatives":n.creatives=function(e){const t=[];return e.forEach(e=>{const r={id:e.getAttribute("id")||null,adId:T(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null},i=[];let n;f.childrenByName(e,"UniversalAdId").forEach(e=>{const t={idRegistry:e.getAttribute("idRegistry")||"unknown",value:f.parseNodeText(e)};i.push(t)});const a=f.childByName(e,"CreativeExtensions");a&&(n=y(f.childrenByName(a,"CreativeExtension")));for(const a in e.childNodes){const s=e.childNodes[a];let o;switch(s.nodeName){case"Linear":o=v(s,r);break;case"NonLinearAds":o=b(s,r);break;case"CompanionAds":o=g(s,r)}o&&(i&&(o.universalAdIds=i),n&&(o.creativeExtensions=n),t.push(o))}}),t}(f.childrenByName(e,"Creative"));break;case"Extensions":{const t=f.childrenByName(e,"Extension");n.extensions=y(t),n.adVerifications.length||(r=function(e){let t=null,r=[];return e.some(e=>t=f.childByName(e,"AdVerifications")),t&&(r=I(f.childrenByName(t,"Verification"))),r}(t));break}case"AdVerifications":n.adVerifications=I(f.childrenByName(e,"Verification"));break;case"AdSystem":n.system={value:f.parseNodeText(e),version:e.getAttribute("version")||null};break;case"AdTitle":n.title=f.parseNodeText(e);break;case"AdServingId":n.adServingId=f.parseNodeText(e);break;case"Category":n.categories.push({authority:e.getAttribute("authority")||null,value:f.parseNodeText(e)});break;case"Expires":n.expires=parseInt(f.parseNodeText(e),10);break;case"ViewableImpression":n.viewableImpression.push(function(e){const t=(e,t)=>{const r=f.parseNodeText(t);return r&&e.push(r),e};return{id:e.getAttribute("id")||null,viewable:f.childrenByName(e,"Viewable").reduce(t,[]),notViewable:f.childrenByName(e,"NotViewable").reduce(t,[]),viewUndetermined:f.childrenByName(e,"ViewUndetermined").reduce(t,[])}}(e));break;case"Description":n.description=f.parseNodeText(e);break;case"Advertiser":n.advertiser={id:e.getAttribute("id")||null,value:f.parseNodeText(e)};break;case"Pricing":n.pricing={value:f.parseNodeText(e),model:e.getAttribute("model")||null,currency:e.getAttribute("currency")||null};break;case"Survey":n.survey={value:f.parseNodeText(e),type:e.getAttribute("type")||null};break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:e.getAttribute("authority")||null,value:f.parseNodeText(e)})}}),r.length&&(n.adVerifications=n.adVerifications.concat(r)),n}function D(e,t){const r=S(e,t),i=e.getAttribute("followAdditionalWrappers"),n=e.getAttribute("allowMultipleAds"),a=e.getAttribute("fallbackOnNoAd");r.followAdditionalWrappers=!i||f.parseBoolean(i),r.allowMultipleAds=!!n&&f.parseBoolean(n),r.fallbackOnNoAd=a?f.parseBoolean(a):null;let s=f.childByName(e,"VASTAdTagURI");if(s?r.nextWrapperURL=f.parseNodeText(s):(s=f.childByName(e,"VASTAdTagURL"),s&&(r.nextWrapperURL=f.parseNodeText(f.childByName(s,"URL")))),r.creatives.forEach(e=>{if(["linear","nonlinear"].includes(e.type)){if(e.trackingEvents){r.trackingEvents||(r.trackingEvents={}),r.trackingEvents[e.type]||(r.trackingEvents[e.type]={});for(const t in e.trackingEvents){const i=e.trackingEvents[t];Array.isArray(r.trackingEvents[e.type][t])||(r.trackingEvents[e.type][t]=[]),i.forEach(i=>{r.trackingEvents[e.type][t].push(i)})}}e.videoClickTrackingURLTemplates&&(Array.isArray(r.videoClickTrackingURLTemplates)||(r.videoClickTrackingURLTemplates=[]),e.videoClickTrackingURLTemplates.forEach(e=>{r.videoClickTrackingURLTemplates.push(e)})),e.videoClickThroughURLTemplate&&(r.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate),e.videoCustomClickURLTemplates&&(Array.isArray(r.videoCustomClickURLTemplates)||(r.videoCustomClickURLTemplates=[]),e.videoCustomClickURLTemplates.forEach(e=>{r.videoCustomClickURLTemplates.push(e)}))}}),r.nextWrapperURL)return r}function I(e){const t=[];return e.forEach(e=>{const r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},i=Array.from(e.childNodes);f.assignAttributes(e.attributes,r),i.forEach(e=>{let{nodeName:t,textContent:i,attributes:n}=e;switch(t){case"JavaScriptResource":case"ExecutableResource":r.resource=i.trim(),f.assignAttributes(n,r);break;case"VerificationParameters":r.parameters=i.trim()}});const n=f.childByName(e,"TrackingEvents");n&&f.childrenByName(n,"Tracking").forEach(e=>{const t=e.getAttribute("event"),i=f.parseNodeText(e);t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))}),t.push(r)}),t}class O{constructor(){this._handlers=[]}on(e,t){if("function"!=typeof t)throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(e,t,r){const i={fired:!1,wrapFn:void 0};function n(){i.fired||(e.off(t,i.wrapFn),i.fired=!0,r.bind(e)(...arguments))}return i.wrapFn=n,n}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(r=>r.event!==e||r.handler!==t),this}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];let n=!1;return this._handlers.forEach(t=>{"*"===t.event&&(n=!0,t.handler(e,...r)),t.event===e&&(n=!0,t.handler(...r))}),n}removeAllListeners(e){return e?(this._handlers=this._handlers.filter(t=>t.event!==e),this):(this._handlers=[],this)}listenerCount(e){return this._handlers.filter(t=>t.event===e).length}listeners(e){return this._handlers.reduce((t,r)=>(r.event===e&&t.push(r.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}}let U=0,P=0;const M=(e,t)=>{!e||!t||e<=0||t<=0||(P=(P*U+8*e/t)/++U)},B={ERRORCODE:900,extensions:[]},q="VAST response version not supported";class V extends O{constructor(){let{fetcher:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null,this.keepFailedAdPod=!1}trackVastError(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];this.emit("VAST-error",Object.assign({},B,t,...i)),p.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return P}initParsingStatus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.keepFailedAdPod=e.keepFailedAdPod||!1,this.rootURL="",this.resetParsingStatus(),M(e.byteLength,e.requestDuration)}resetParsingStatus(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}getRemainingAds(e){if(0===this.remainingAds.length)return Promise.reject(new Error("No more ads are available for the given VAST"));const t=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(t,{wrapperDepth:0,url:this.rootURL}).then(e=>this.buildVASTResponse(e))}parseVAST(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(e=>this.buildVASTResponse(e))}buildVASTResponse(e){const t=function(e){let{ads:t,errorURLTemplates:r,version:i}=e;return{ads:t||[],errorURLTemplates:r||[],version:i||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:r=!1,url:i=null,wrapperDepth:n=0,allowMultipleAds:a,followAdditionalWrappers:s}=t;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName){var o;this.emit("VAST-ad-parsed",{type:"ERROR",url:i,wrapperDepth:n});const t="VideoAdServingTemplate"===(null==e||null===(o=e.documentElement)||void 0===o?void 0:o.nodeName);throw new Error(t?q:"Invalid VAST XMLDocument")}const l=[],c=e.documentElement.childNodes,u=e.documentElement.getAttribute("version");r&&u&&(this.vastVersion=u);for(const e in c){const t=c[e];if("Error"===t.nodeName){const e=f.parseNodeText(t);r?this.rootErrorURLTemplates.push(e):this.errorURLTemplates.push(e)}else if("Ad"===t.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(!1===a&&l.length>1)break;const e=C(t,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:s});e.ad?(l.push(e.ad),this.emit("VAST-ad-parsed",{type:e.type,url:i,wrapperDepth:n,adIndex:l.length-1,vastVersion:u})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return l}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:i=null,previousUrl:n=null,wrapperDepth:a=0,isRootVAST:s=!1,followAdditionalWrappers:o,allowMultipleAds:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&s&&(l=!0);try{c=this.parseVastXml(e,{isRootVAST:s,url:t,wrapperDepth:a,allowMultipleAds:l,followAdditionalWrappers:o})}catch(e){return Promise.reject(e)}if(1===c.length&&null!=i&&(c[0].sequence=i),!1===r){const e=f.getSortedAdPods(c),t=f.getStandAloneAds(c);e.length?c=e:t.length&&(c=[t.shift()]),this.remainingAds=t}return this.resolveAds(c,{wrapperDepth:a,previousUrl:n,url:t})}resolveAds(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:i}=arguments.length>1?arguments[1]:void 0;const n=[];return r=i,e.forEach(e=>{const i=this.resolveWrappers(e,t,r);n.push(i)}),Promise.all(n).then(e=>p.flatten(e))}resolveWrappers(e,t,r){const i={...e};return new Promise(e=>{var n;if(t++,!i.nextWrapperURL)return delete i.nextWrapperURL,e(i);if(!this.fetcher)return i.VASTAdTagURI=i.nextWrapperURL,delete i.nextWrapperURL,e(i);if(t>=this.maxWrapperDepth)return i.errorCode=302,delete i.nextWrapperURL,e(i);i.nextWrapperURL=f.resolveVastAdTagURI(i.nextWrapperURL,r);const a=null!==(n=this.parsingOptions.allowMultipleAds)&&void 0!==n?n:i.allowMultipleAds,s=i.sequence;this.fetcher.fetchVAST({url:i.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(n=>this.parse(n,{url:i.nextWrapperURL,previousUrl:r,wrapperSequence:s,wrapperDepth:t,followAdditionalWrappers:i.followAdditionalWrappers,allowMultipleAds:a}).then(t=>{if(delete i.nextWrapperURL,0===t.length)return i.creatives=[],e(i);t.forEach(e=>{e&&f.mergeWrapperAdData(e,i)}),e(t)})).catch(t=>{i.errorCode=t.message===q?102:301,i.errorMessage=t.message,e(i)})})}completeWrapperResolving(e){if(0===e.ads.length)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(let t=e.ads.length-1;t>=0;t--){const r=e.ads[t],i=!r.creatives.some(e=>{var t,r;return(null===(t=e.mediaFiles)||void 0===t?void 0:t.length)>0||(null===(r=e.variations)||void 0===r?void 0:r.length)>0});!r.errorCode&&!i||r.VASTAdTagURI||(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),this.keepFailedAdPod&&r.sequence?r.hasFailed=!0:e.ads.splice(t,1))}}}let F=null;const _={data:{},length:0,getItem(e){return this.data[e]},setItem(e,t){this.data[e]=t,this.length=Object.keys(this.data).length},removeItem(e){delete this.data[e],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class j{constructor(){this.storage=this.initStorage()}initStorage(){if(F)return F;try{F="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){F=null}return F&&!this.isStorageDisabled(F)||(F=_,F.clear()),F}isStorageDisabled(e){const 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}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const W=12e4,H={get:async function(e,t){try{const r=new AbortController,i=setTimeout(()=>{throw r.abort(),new Error("URLHandler: Request timed out after ".concat(t.timeout||W," ms (408)"))},t.timeout||W),n=await fetch(e,{...t,signal:r.signal,credentials:t.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(i)}),a=function(e){return p.isBrowserEnvironment()&&"https:"===window.location.protocol&&e.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":200===e.status&&e.ok?null:"URLHandler: ".concat(e.statusText," (").concat(e.status,")")}(n);return a?{error:new Error(a),statusCode:n.status}:async function(e){const t=await e.text();let r;return r=p.isBrowserEnvironment()?new DOMParser:new((await Promise.resolve().then(function(){return Ne})).DOMParser),{xml:r.parseFromString(t,"text/xml"),details:{byteLength:t.length,statusCode:e.status,rawXml:t}}}(n)}catch(e){return{error:e,statusCode:"AbortError"===e.name?408:null}}}};class G{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||H,this.fetchingOptions={...e.fetchOptions,timeout:e.timeout||W,withCredentials:Boolean(e.withCredentials)}}addURLTemplateFilter(e){"function"==typeof e&&this.URLTemplateFilters.push(e)}removeLastURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}async fetchVAST(e){var t;let{url:r,maxWrapperDepth:i,emitter:n,wrapperDepth:a=0,previousUrl:s=null,wrapperAd:o=null}=e;const l=Date.now();this.URLTemplateFilters.forEach(e=>{r=e(r)}),n("VAST-resolving",{url:r,previousUrl:s,wrapperDepth:a,maxWrapperDepth:i,timeout:this.fetchingOptions.timeout,wrapperAd:o});const c=await this.urlHandler.get(r,this.fetchingOptions),u=Math.round(Date.now()-l);if(n("VAST-resolved",{url:r,previousUrl:s,wrapperDepth:a,error:(null==c?void 0:c.error)||null,duration:u,statusCode:(null==c?void 0:c.statusCode)||null,...null==c?void 0:c.details}),M(null==c||null===(t=c.details)||void 0===t?void 0:t.byteLength,u),c.error)throw new Error(c.error);return c.xml}}class X{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new j;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new G,this.vastParser=new V({fetcher:this.fetcher}),this.storage=r,void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)}addURLTemplateFilter(e){this.fetcher.addURLTemplateFilter(e)}removeLastURLTemplateFilter(){this.fetcher.removeLastURLTemplateFilter()}countURLTemplateFilters(){return this.fetcher.countURLTemplateFilters()}clearURLTemplateFilters(){this.fetcher.clearURLTemplateFilters()}getParser(){return this.vastParser}get lastSuccessfulAd(){return this.storage.getItem("vast-client-last-successful-ad")}set lastSuccessfulAd(e){this.storage.setItem("vast-client-last-successful-ad",e)}get totalCalls(){return this.storage.getItem("vast-client-total-calls")}set totalCalls(e){this.storage.setItem("vast-client-total-calls",e)}get totalCallsTimeout(){return this.storage.getItem("vast-client-total-calls-timeout")}set totalCallsTimeout(e){this.storage.setItem("vast-client-total-calls-timeout",e)}hasRemainingAds(){return this.vastParser.remainingAds.length>0}getNextAds(e){return this.vastParser.getRemainingAds(e)}parseVAST(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<r?(this.totalCalls=1,this.totalCallsTimeout=r+36e5):this.totalCalls++,new Promise((i,n)=>{if(this.cappingFreeLunch>=this.totalCalls)return n(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=r-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return n(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval,")ms minimum interval reached")));this.vastParser.initParsingStatus(t),this.fetcher.setOptions(t),this.vastParser.rootURL=e,this.fetcher.fetchVAST({url:e,emitter:this.vastParser.emit.bind(this.vastParser),maxWrapperDepth:this.vastParser.maxWrapperDepth}).then(r=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(r,t).then(e=>{const t=this.vastParser.buildVASTResponse(e);i(t)}))).catch(e=>n(e))})}}class z extends O{constructor(e,t,r){var i;let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=a,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const e in this.creative.trackingEvents){const t=this.creative.trackingEvents[e];this.trackingEvents[e]=t.slice(0)}this.viewableImpressionTrackers=(null===(i=this.ad.viewableImpression)||void 0===i?void 0:i.reduce((e,t)=>(e.notViewable.push(...t.notViewable),e.viewUndetermined.push(...t.viewUndetermined),e.viewable.push(...t.viewable),e),{notViewable:[],viewUndetermined:[],viewable:[]}))||{},Object.entries(this.viewableImpressionTrackers).forEach(e=>{let[t,r]=e;r.length&&(this.trackingEvents[t]=r)}),function(e){return"linear"===e.type}(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const 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)}}setDuration(e){p.isValidTimeValue(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}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}setProgress(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!p.isValidTimeValue(e)||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))});const i=this.skipDelay||-1;if(-1===i||this.skippable||(i>e?this.emit("skip-countdown",i-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const i=Math.round(e/this.assetDuration*100),n=[];if(e>0){n.push("start");for(let e=this.lastPercentage;e<i;e++)n.push("progress-".concat(e+1,"%"));n.push("progress-".concat(e));for(const t in this.quartiles)this.isQuartileReached(t,this.quartiles[t],e)&&(n.push(t),this._alreadyTriggeredQuartiles[t]=!0);this.lastPercentage=i}n.forEach(e=>{this.track(e,{macros:t,once:r})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,r){let i=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(i=!0),i}setMuted(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))})}setPaused(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))})}setFullscreen(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))})}setExpand(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))})}setSkipDelay(e){p.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("viewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("notViewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("viewUndetermined",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e&&"boolean"==typeof t?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(p.formatMacrosValues(e),", isCustomCode: ").concat(t)})}errorWithCode(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"string"==typeof e&&"boolean"==typeof t?(this.error({ERRORCODE:e},t),console.log("The method errorWithCode is deprecated, please use vast tracker error method instead")):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}complete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}notUsed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}otherAdInteraction(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}acceptInvitation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}adExpand(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}adCollapse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}minimize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}verificationNotExecuted(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))});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");const r=this.ad.adVerifications.find(t=>t.vendor===e);if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));const i=r.trackingEvents;if(i&&i.verificationNotExecuted){const e=i.verificationNotExecuted;this.trackURLs(e,t),this.emit("verificationNotExecuted",{trackingURLTemplates:e})}}overlayViewDuration(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&"object"==typeof t?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))})}close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}skip(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}load(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}click(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!==e&&"string"!=typeof e||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const r=this.clickThroughURLTemplate||e,i={...t};if(r){this.progress&&(i.ADPLAYHEAD=this.progressFormatted());const e=p.resolveURLTemplates([r],i)[0];this.emit("clickthrough",e)}}trackProgressEvents(e,t,r){const i=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(e=>{let[t]=e;return t.startsWith("progress-")}).map(e=>{let[t,r]=e;return{name:t,time:parseFloat(t.split("-")[1]),urls:r}}).filter(e=>{let{time:t}=e;return t<=i&&t>this.progress}).forEach(e=>{let{name:i,urls:n}=e;!r&&this.trackedProgressEvents.includes(i)||(this.emit(i,{trackingURLTemplates:n}),this.trackURLs(n,t),r?delete this.trackingEvents[i]:this.trackedProgressEvents.push(i))})}track(e){let{macros:t={},once:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof t)return void this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(t)});"closeLinear"===e&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,t,r);const i=this.trackingEvents[e],n=this.emitAlwaysEvents.indexOf(e)>-1;i?(this.emit(e,{trackingURLTemplates:i}),this.trackURLs(i,t)):n&&this.emit(e,null),r&&(delete this.trackingEvents[e],n&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{validUrls:n,invalidUrls:a}=p.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const s={...r};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(s.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(s.ADPLAYHEAD=this.progressFormatted())),null!==(t=this.creative)&&void 0!==t&&null!==(t=t.universalAdIds)&&void 0!==t&&t.length&&(s.UNIVERSALADID=this.creative.universalAdIds.map(e=>e.idRegistry.concat(" ",e.value)).join(",")),this.ad&&(this.ad.sequence&&(s.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(s.ADTYPE=this.ad.adType),this.ad.adServingId&&(s.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(s.ADCATEGORIES=this.ad.categories.map(e=>e.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(s.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(e=>e.value).join(","))),p.track(n,s,i)}convertToTimecode(e){if(!p.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),i=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(p.addLeadingZeros(r,2),":").concat(p.addLeadingZeros(i,2),":").concat(p.addLeadingZeros(n,2),".").concat(p.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}}function K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Y=$(function e(t){for(var r in K(this,e),this.id=t.getAttribute("id"),this.allowMultipleAds=t.getAttribute("allowMultipleAds"),this.followRedirects=t.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null,t.childNodes){var i=t.childNodes[r];switch(i.localName){case"AdTagURI":this.adTagURI={templateType:i.getAttribute("templateType"),uri:(i.textContent||i.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=i.firstChild;this.vastAdData&&1!==this.vastAdData.nodeType;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=i}}});function Q(e,t){var r=[];for(var i in e.childNodes){var n=e.childNodes[i];n.nodeName!==t&&t!=="vmap:".concat(n.nodeName)&&n.nodeName!=="vmap:".concat(t)||r.push(n)}return r}function J(e){var t={attributes:{},children:{},value:{}};t.value=function(e){if(!e||!e.childNodes)return{};var t=e.childNodes,r=[];for(var i in t){var n=t[i];"#cdata-section"===n.nodeName&&r.push(n)}if(r&&r.length>0)try{return JSON.parse(r[0].data)}catch(e){}var a="";for(var s in t){var o=t[s];switch(o.nodeName){case"#text":a+=o.textContent.trim();break;case"#cdata-section":a+=o.data}}return a}(e);var r=e.attributes;if(r)for(var i in r){var n=r[i];n.nodeName&&void 0!==n.nodeValue&&null!==n.nodeValue&&(t.attributes[n.nodeName]=n.nodeValue)}var a=e.childNodes;if(a)for(var s in a){var o=a[s];o.nodeName&&"#"!==o.nodeName.substring(0,1)&&(t.children[o.nodeName]=J(o))}return t}var Z,ee=function(){function e(t){for(var r in K(this,e),this.timeOffset=t.getAttribute("timeOffset"),this.breakType=t.getAttribute("breakType"),this.breakId=t.getAttribute("breakId"),this.repeatAfter=t.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[],t.childNodes){var i=t.childNodes[r];switch(i.localName){case"AdSource":this.adSource=new Y(i);break;case"TrackingEvents":for(var n in i.childNodes){var a=i.childNodes[n];"Tracking"===a.localName&&this.trackingEvents.push({event:a.getAttribute("event"),uri:(a.textContent||a.text||"").trim()})}break;case"Extensions":this.extensions=Q(i,"Extension").map(function(e){return J(e)})}}}return $(e,[{key:"track",value:function(e,t){for(var r in this.trackingEvents){var i=this.trackingEvents[r];if(i.event===e){var n=i.uri;"error"===i.event&&(n=n.replace("[ERRORCODE]",t)),this.tracker(n)}}}},{key:"tracker",value:function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)}}]),e}(),te=$(function e(t){if(K(this,e),!t||!t.documentElement||"VMAP"!==t.documentElement.localName)throw new Error("Not a VMAP document");for(var r in this.version=t.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[],t.documentElement.childNodes){var i=t.documentElement.childNodes[r];switch(i.localName){case"AdBreak":this.adBreaks.push(new ee(i));break;case"Extensions":this.extensions=Q(i,"Extension").map(function(e){return J(e)})}}});class re{constructor(e){Object.defineProperty(this,"bus",{enumerable:!0,configurable:!0,writable:!0,value:e})}on(e,t){return this.bus.on(e,t)}emit(e,...t){this.bus.emit(e,...t)}}class ie{constructor(e={}){Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ads"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"1.0.0"}),Object.defineProperty(this,"capabilities",{enumerable:!0,configurable:!0,writable:!0,value:["ads"]}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_lastCreative",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"overlayId",{enumerable:!0,configurable:!0,writable:!0,value:"ads"}),Object.defineProperty(this,"prevActiveCaptionSig",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"adEndPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"adTrackEls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"cfg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"overlay",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"adVideo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipWrap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipBtn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipOffsetRaw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipAtSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"companionWrap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nonLinearWrap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedNonLinearContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedCompanionContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentBreakMeta",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"vastClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"globalUnsubs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sessionUnsubs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"resumeAfter",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"contentMedia",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentHadControls",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startingBreak",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"playedBreaks",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"userPlayIntent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"forcedMuteUntilInteraction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"resolvedBreaks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pendingPercentBreaks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"syncingVolume",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"vmapLoadPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"vmapPending",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"pendingVmapSrc",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=(e=>{const t=[];return(e.sources?Array.isArray(e.sources)?e.sources:[e.sources]:[]).forEach(e=>{if(!e||"string"!=typeof e.src)return;const r=e.src.trim(),i=e.type;r&&("VAST"!==i&&"VMAP"!==i&&"NONLINEAR"!==i||t.push({type:i,src:r}))}),t})(e),r=e.breaks||[],i=r.some(e=>"preroll"===e.at&&e.source?.src),n=t.some(e=>"VAST"===e.type||"VMAP"===e.type||"NONLINEAR"===e.type);this.cfg={allowNativeControls:e.allowNativeControls??!1,resumeContent:e.resumeContent??!0,preferredMediaTypes:e.preferredMediaTypes||["video/mp4","video/webm","application/vnd.apple.mpegurl","application/x-mpegURL"],debug:e.debug??!1,breakTolerance:e.breakTolerance??.25,sources:t,breaks:r,interceptPlayForPreroll:e.interceptPlayForPreroll??(Boolean(i)||n),autoPlayOnReady:e.autoPlayOnReady||!1,mountEl:e.mountEl,mountSelector:e.mountSelector,nonLinearContainer:e.nonLinearContainer,nonLinearSelector:e.nonLinearSelector,companionContainer:e.companionContainer,companionSelector:e.companionSelector,adSourcesMode:e.adSourcesMode??"waterfall"}}setup(t){this.ctx=t,this.bus=new re(t.events),this.vastClient=new X,this.overlay=document.createElement("div"),this.overlay.className="op-ads",this.overlay.style.display="none",this.globalUnsubs.push(t.events.on("source:set",()=>{this.playedBreaks.clear(),this.startingBreak=!1,this.clearSession(),this.active=!1,this.contentMedia=void 0,this.contentHadControls=!1,this.overlay.style.display="none",this.ctx.leases.release("playback",this.name);try{e.getOverlayManager(this.ctx.core).deactivate(this.overlayId)}catch{}this.userPlayIntent=!1,this.pendingPercentBreaks=[],this.vmapLoadPromise=null,this.vmapPending=!1,this.pendingVmapSrc=void 0,this.rebuildSchedule()})),this.rebuildSchedule(),this.bindBreakScheduler(),this.cfg.interceptPlayForPreroll&&this.bindPrerollInterceptors(),this.globalUnsubs.push(t.events.on("player:interacted",()=>{if(this.forcedMuteUntilInteraction=!1,this.active&&this.adVideo)try{this.adVideo.muted=t.core.muted,this.adVideo.volume=t.core.volume}catch{}}))}async playAds(e){const t=this.inferSourceTypeForUrl(e);return this.playBreakFromVast({kind:"url",value:e},{kind:"manual",id:"manual",sourceType:t})}async playAdsFromXml(e){return this.playBreakFromVast({kind:"xml",value:e},{kind:"manual",id:"manual"})}getDueMidrollBreaks(e){const t=this.ctx.core.media;if(Number.isFinite(t.duration)&&t.duration>0&&this.pendingPercentBreaks.length){const e=t.duration,r=[];for(const t of this.pendingPercentBreaks){const i=e*t.percent;r.push({id:t.id,at:i,once:t.once,source:t.source})}this.pendingPercentBreaks=[],this.resolvedBreaks.push(...r)}const r=[];for(const t of this.resolvedBreaks){if("number"!=typeof t.at)continue;if(!this.getVastInputFromBreak(t).input)continue;const i=this.getBreakId(t);!1!==t.once&&this.playedBreaks.has(i)||e+(this.cfg.breakTolerance??.25)>=t.at&&r.push(t)}return r.sort((e,t)=>e.at-t.at),r}getDueMidrollBreak(e){return this.getDueMidrollBreaks(e)[0]}destroy(){this.finish({resume:!1});for(const e of this.globalUnsubs)e();this.globalUnsubs=[],this.overlay?.remove()}inferSourceTypeForUrl(e){const t=this.cfg.sources||[],r=t.find(t=>t.src===e);return"NONLINEAR"===r?.type||t.length>0&&t.every(e=>"NONLINEAR"===e.type)?"NONLINEAR":void 0}resolveContainer(e,t){if(e&&1===e.nodeType)return e;if(t){const e=document.querySelector(t);if(e instanceof HTMLElement)return e}}getNonLinearContainer(){return this.resolvedNonLinearContainer||(this.resolvedNonLinearContainer=this.resolveContainer(this.cfg.nonLinearContainer,this.cfg.nonLinearSelector)),this.resolvedNonLinearContainer}getCompanionContainer(){return this.resolvedCompanionContainer||(this.resolvedCompanionContainer=this.resolveContainer(this.cfg.companionContainer,this.cfg.companionSelector)),this.resolvedCompanionContainer}getSource(e){return(this.cfg.sources||[]).find(t=>t.type===e&&"string"==typeof t.src&&t.src.trim())}getPrimaryVastLikeSource(){return this.getSource("VAST")||this.getSource("NONLINEAR")}isXmlString(e){return e.trim().startsWith("<")}async getVastXmlText(e){if("xml"===e.kind){if("string"==typeof e.value)return e.value;try{return(new XMLSerializer).serializeToString(e.value)}catch{return String(e.value)}}const t=await fetch(e.value);if(!t.ok)throw new Error(`VAST request failed: ${t.status}`);return await t.text()}buildParsedForNonLinearFromXml(e){return this.toXmlDocument(e)}setSafeHTML(e,t){const r=document.createElement("template");r.innerHTML=String(t||"");const i=new Set(["SCRIPT","IFRAME","OBJECT","EMBED","LINK","STYLE","SVG","MATH","FORM","INPUT","TEXTAREA","SELECT","OPTION","META","BASE"]),n=document.createTreeWalker(r.content,NodeFilter.SHOW_ELEMENT),a=[];for(;n.nextNode();){const e=n.currentNode;i.has(e.tagName)?a.push(e):Array.from(e.attributes).forEach(t=>{const r=t.name.toLowerCase(),i=(t.value||"").trim();if(r.startsWith("on")&&e.removeAttribute(t.name),"href"===r||"src"===r||"xlink:href"===r){const r=i.toLowerCase(),n=r.startsWith("javascript:"),a=r.startsWith("data:"),s=r.startsWith("http://")||r.startsWith("https://")||r.startsWith("/")||r.startsWith("./"),o=a&&/^data:image\/(png|gif|jpe?g|webp|svg\+xml);/i.test(i);(n||!s&&!o)&&e.removeAttribute(t.name)}"srcdoc"===r&&e.removeAttribute(t.name)})}a.forEach(e=>e.remove()),e.replaceChildren(r.content.cloneNode(!0))}log(...e){this.cfg?.debug&&console.debug("[player][ads]",...e)}warn(...e){this.cfg?.debug&&console.warn("[player][ads]",...e)}rebuildSchedule(){const e=[...this.cfg.breaks||[]];if(0===e.length){const t=this.cfg.sources.filter(e=>("VAST"===e.type||"NONLINEAR"===e.type)&&e.src?.trim());if(t.length>0)if("playlist"===this.cfg.adSourcesMode)for(const r of t)e.push({at:"preroll",source:{type:r.type,src:r.src},once:!0});else t.length>1?e.push({at:"preroll",source:t[0],sources:t,once:!0}):e.push({at:"preroll",source:t[0],once:!0})}const t=this.getSource("VMAP");if(t?.src){const r=this.ctx?.core?.media;"none"===(r?(r.getAttribute("preload")||r.preload||"").toLowerCase():"")?this.pendingVmapSrc=t.src:(this.vmapPending=!0,this.vmapLoadPromise=this.loadVmapAndMerge(e,t.src))}this.resolvedBreaks=e}normalizeVmapAdSource(e){if(e)return Array.isArray(e)?e.find(e=>e?.adTagURI||e?.vastAdData)||e[0]:e}extractVastTagUri(e){if(e){if("string"==typeof e)return e.trim()||void 0;if("object"==typeof e){const t=e.uri||e.URI||e.value||e.text||e["#text"];if("string"==typeof t&&t.trim())return t.trim()}}}async loadVmapAndMerge(e,t){try{const r=(t||this.getSource("VMAP")?.src||"").trim();if(!r)return;const i=this.isXmlString(r)?r:await fetch(r).then(e=>{if(!e.ok)throw new Error(`VMAP request failed: ${e.status}`);return e.text()}),n=(new DOMParser).parseFromString(i,"text/xml"),a=new te(n),s=[],o=a.adBreaks||[],l=this.pendingPercentBreaks.length,c=(()=>{try{const e=n.getElementsByTagNameNS("*","AdBreak");if(e&&e.length)return e.length}catch{}try{return n.getElementsByTagName("AdBreak").length}catch{return 0}})();for(let e=0;e<o.length;e++){const t=o[e],r=String(t?.breakType||"").toLowerCase();if(r&&"linear"!==r&&"nonlinear"!==r&&"non-linear"!==r)continue;const i=String(t?.timeOffset||"").trim(),n=`${t?.breakId||"vmap"}:${i||"start"}:${e}`,{at:a,pendingPercent:l}=this.parseVmapTimeOffset(i),c=this.normalizeVmapAdSource(t?.adSource),u=c?.vastAdData,d=c?.adTagURI,h=this.extractVastTagUri(d);let p;if(u&&("string"==typeof u?p=u:u?.nodeType&&(p=(new XMLSerializer).serializeToString(u))),!h&&!p)continue;const m={type:"nonlinear"===r||"non-linear"===r?"NONLINEAR":"VAST",src:h||p};null==l?s.push({id:n,at:a,once:!0,timeOffset:i||("postroll"===a?"end":"start"),source:m}):this.pendingPercentBreaks.push({id:n,percent:l,vast:h?{kind:"url",value:h}:{kind:"xml",value:p},once:!0,source:m})}const u=s.length+(this.pendingPercentBreaks.length-l);if(c>0&&u<c&&(s.length=0,this.pendingPercentBreaks.splice(l)),0===s.length&&this.pendingPercentBreaks.length===l){const e=(e,t)=>{try{const r=e.getElementsByTagNameNS?.("*",t);if(r&&r.length)return Array.from(r)}catch{}try{return Array.from(e.getElementsByTagName(t))}catch{return[]}},t=e(n,"AdBreak");for(let r=0;r<t.length;r++){const i=t[r],n=String(i.getAttribute("breakType")||"").toLowerCase();if(n&&"linear"!==n&&"nonlinear"!==n&&"non-linear"!==n)continue;const a=String(i.getAttribute("timeOffset")||"").trim(),o=`${i.getAttribute("breakId")||i.getAttribute("id")||"vmap-fb"}:${a||"start"}:${r}`,{at:l,pendingPercent:c}=this.parseVmapTimeOffset(a),u=e(i,"AdSource")[0];let d,h;if(u){const t=e(u,"AdTagURI");if(t.length&&(d=(t[0].textContent||"").trim()||void 0),!d){const t=e(u,"VASTAdData");t.length&&(h=(t[0].textContent||"").trim()||void 0)}}if(!d&&!h)continue;const p={type:"nonlinear"===n||"non-linear"===n?"NONLINEAR":"VAST",src:d||h};null==c?s.push({id:o,at:l,once:!0,timeOffset:a||("postroll"===l?"end":"start"),source:p}):this.pendingPercentBreaks.push({id:o,percent:c,vast:d?{kind:"url",value:d}:{kind:"xml",value:h},once:!0,source:p})}}this.resolvedBreaks=[...e,...s]}catch(e){this.warn("VMAP load/parse failed",e),this.bus.emit("ads:error",{reason:"vmap_parse_failed",error:e}),this.ctx.events.emit("ads.error",{reason:"vmap_parse_failed",error:e})}finally{this.vmapPending=!1}}resolveMount(){if(this.cfg.mountEl)return this.cfg.mountEl;if(this.cfg.mountSelector){const e=document.querySelector(this.cfg.mountSelector);if(e)return e}const e=this.ctx.core.media;return e.closest(".op-player")||e.parentElement||document.body}parseVmapTimeOffset(e){const t=String(e||"").trim();if(!t||"start"===t)return{at:"preroll"};if("end"===t)return{at:"postroll"};if(t.endsWith("%")){const e=Number(t.slice(0,-1));if(Number.isFinite(e)&&e>=0&&e<=100)return{at:0,pendingPercent:e/100}}const r=/^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(t);if(r){const e=Number(r[1]),t=Number(r[2]),i=Number(r[3]);if([e,t,i].every(e=>Number.isFinite(e)))return{at:3600*e+60*t+i}}const i=Number(t);return Number.isFinite(i)&&i>=0?{at:i}:{at:"preroll"}}getVastInputFromBreak(e){if(e.source&&"string"==typeof e.source.src&&e.source.src.trim()){const t=e.source.src.trim(),r=e.source.type;return this.isXmlString(t)?{input:{kind:"xml",value:t},sourceType:r}:{input:{kind:"url",value:t},sourceType:r}}return{input:void 0,sourceType:void 0}}getPostrollBreak(){for(const e of this.resolvedBreaks){if("postroll"!==e.at)continue;if(!this.getVastInputFromBreak(e).input)continue;const t=this.getBreakId(e);if(!(!1!==e.once)||!this.playedBreaks.has(t))return e}}toXmlDocument(e){return(new DOMParser).parseFromString(String(e||""),"text/xml")}getBreakId(e){if(e.id)return e.id;const{input:t,sourceType:r}=this.getVastInputFromBreak(e),i="url"===t?.kind?t.value:"xml";return`${String(e.at)}:${r||"VAST"}:${i}`}getPrerollBreak(){for(const e of this.resolvedBreaks){if("preroll"!==e.at)continue;if(!this.getVastInputFromBreak(e).input)continue;const t=this.getBreakId(e);if(!(!1!==e.once)||!this.playedBreaks.has(t))return e}for(const e of this.cfg.breaks){if("preroll"!==e.at)continue;if(!this.getVastInputFromBreak(e).input)continue;const t=this.getBreakId(e);if(!(!1!==e.once)||!this.playedBreaks.has(t))return e}const e=this.cfg.breaks.some(e=>"preroll"===e.at);if(!e){const e=this.getPrimaryVastLikeSource();if(e?.src){const t={at:"preroll",source:{type:e.type,src:e.src},once:!0},r=this.getBreakId(t);if(!this.playedBreaks.has(r))return t}}}shouldInterceptPreroll(){const e=this.getPrerollBreak();if(!e)return!1;if(this.active||this.startingBreak)return!1;const t=this.ctx.core.media;if((t?.currentTime??0)>.25)return!1;const r=this.getBreakId(e);if(!1!==e.once&&this.playedBreaks.has(r))return!1;return"ended"!==this.ctx.state.current}bindPrerollInterceptors(){const{events:e,core:t}=this.ctx,r=t.media,i=()=>{if(this.pendingVmapSrc&&!this.vmapLoadPromise){this.vmapPending=!0;const e=this.pendingVmapSrc;this.pendingVmapSrc=void 0,this.vmapLoadPromise=this.loadVmapAndMerge([...this.resolvedBreaks],e)}};this.globalUnsubs.push(e.on("cmd:play",()=>{i();const n=this.vmapPending,a=this.shouldInterceptPreroll();if(a||n&&!this.active&&!this.startingBreak)try{r.pause()}catch{}(async()=>{if(this.vmapLoadPromise&&await this.vmapLoadPromise.catch(()=>{}),!this.shouldInterceptPreroll())return void(!n||a||this.active||this.startingBreak||e.emit("cmd:play"));this.userPlayIntent=!!t.userInteracted;let r=0;for(;r++<10;){const e=this.getPrerollBreak();if(!e)break;await this.startBreak(e,"preroll")}})()}));const n=()=>{i();const n=this.vmapPending,a=this.shouldInterceptPreroll();if(a||n&&!this.active&&!this.startingBreak)try{r.pause()}catch{}(async()=>{if(this.vmapLoadPromise&&await this.vmapLoadPromise.catch(()=>{}),!this.shouldInterceptPreroll())return void(!n||a||this.active||this.startingBreak||e.emit("cmd:play"));this.userPlayIntent=!!t.userInteracted;let r=0;for(;r++<10;){const e=this.getPrerollBreak();if(!e)break;await this.startBreak(e,"preroll")}})()};r.addEventListener("play",n,{capture:!0}),this.globalUnsubs.push(()=>r.removeEventListener("play",n,{capture:!0}))}bindBreakScheduler(){const e=this.ctx.core.media;if(!e)return;const t=()=>{if(this.active||this.startingBreak)return;const t=e.currentTime||0,r=this.getDueMidrollBreaks(t);if(!r.length)return;const i=r[0],n=i.at,a=i.timeOffset,s=this.cfg.breakTolerance??.25,o=a?this.resolvedBreaks.filter(e=>"number"==typeof e.at&&!this.playedBreaks.has(this.getBreakId(e))&&e.timeOffset===a&&Math.abs(e.at-n)<=Math.max(1,s)):r.filter(e=>Math.abs(e.at-n)<=s);o.length&&(1===o.length?this.startBreak(o[0],"midroll"):this.startBreakGroup(o,"midroll"))};e.addEventListener("timeupdate",t),this.globalUnsubs.push(()=>e.removeEventListener("timeupdate",t));const r=()=>{this.active||this.startingBreak||(async()=>{for(this.vmapLoadPromise&&await this.vmapLoadPromise.catch(()=>{});!this.active&&!this.startingBreak;){const e=this.getPostrollBreak();if(!e)break;this.ctx.events.emit("ads.mediaended",{break:{kind:"postroll",id:this.getBreakId(e)},at:e.at}),await this.startBreak(e,"postroll")}})()};e.addEventListener("ended",r),this.globalUnsubs.push(()=>e.removeEventListener("ended",r))}async startBreak(e,t,r){if(this.active||this.startingBreak)return;const i=this.getBreakId(e);if(!1!==e.once&&this.playedBreaks.has(i))return;const n=e.sources;if(n&&n.length>1){this.startingBreak=!0,this.bus.emit("ads:break:start",{id:i,kind:t,at:e.at});try{for(let e=0;e<n.length;e++){const a=n[e],s=e===n.length-1,o=this.isXmlString(a.src)?{kind:"xml",value:a.src}:{kind:"url",value:a.src};if(await this.playBreakFromVast(o,{kind:t,id:i,sourceType:a.type},{suppressResumeOnError:!s,suppressResumeOnSuccess:r?.suppressResume}))break}this.playedBreaks.add(i)}finally{this.startingBreak=!1,this.bus.emit("ads:break:end",{id:i,kind:t,at:e.at})}return}const{input:a,sourceType:s}=this.getVastInputFromBreak(e);if(a){this.startingBreak=!0,this.bus.emit("ads:break:start",{id:i,kind:t,at:e.at});try{await this.playBreakFromVast(a,{kind:t,id:i,sourceType:s},{suppressResumeOnSuccess:r?.suppressResume}),this.playedBreaks.add(i)}finally{this.startingBreak=!1,this.bus.emit("ads:break:end",{id:i,kind:t,at:e.at})}}}async startBreakGroup(e,t){let r=!1;const i=[];for(const n of e){if("midroll"===t){const{input:e}=this.getVastInputFromBreak(n),t="url"===e?.kind?e.value:"",i=/bumper/i.test(t)||/bumper/i.test(n.id||"");if(i&&r){this.playedBreaks.add(this.getBreakId(n));continue}i||(r=!0)}i.push(n)}for(let e=0;e<i.length;e++){const r=e===i.length-1;await this.startBreak(i[e],t,{suppressResume:!r})}}extractAdsFromParsed(e){const t=e?.ads||e?.vastResponse?.ads;if(Array.isArray(t)&&t.length)return t;const r=e?.adPods||e?.vastResponse?.adPods||e?.vastResponse?.adpods;if(Array.isArray(r)&&r.length){const e=[];for(const t of r){const r=t?.ads||t?.Ads;Array.isArray(r)&&e.push(...r)}if(e.length)return e}const i=e?.adPod||e?.vastResponse?.adPod||e?.vastResponse?.adpod,n=i?.ads||i?.Ads;return Array.isArray(n)&&n.length?n:[]}collectPodAds(e){const t=this.extractAdsFromParsed(e),r=[];for(const e of t){const t=e?.creatives||e?.Creatives||[],i=e?.sequence||e?.attributes?.sequence||void 0,n=null!=i?Number(i):void 0;for(let i=0;i<t.length;i++){const a=t[i],s=a?.mediaFiles||a?.MediaFiles||a?.linear?.mediaFiles||a?.Linear?.mediaFiles||a?.linear?.MediaFiles||a?.linear?.mediafiles||[],o=this.pickBestMediaFile(s);if(!o)continue;const l=this.extractSkipOffsetFromCreative(a),c=a?.companionAds?.companions||a?.companions||void 0,u=a?.nonLinearAds?.nonLinears||a?.nonLinears||void 0;r.push({ad:e,creative:a,mediaFile:o,sequence:Number.isFinite(n)?n:void 0,creativeIndex:i,skipOffset:l,companions:Array.isArray(c)?c:void 0,nonLinears:Array.isArray(u)?u:void 0})}}return r.sort((e,t)=>{const r=e.sequence??Number.MAX_SAFE_INTEGER,i=t.sequence??Number.MAX_SAFE_INTEGER;if(r!==i)return r-i;return(e.creativeIndex??0)-(t.creativeIndex??0)})}collectPodAdsFromXml(e){if(!e)return[];const t=Array.from(e.getElementsByTagName("Ad")),r=[];for(const e of t){const t=e.getAttribute("sequence"),i=null!=t?Number(t):void 0,n=Array.from(e.getElementsByTagName("Creative"));for(let t=0;t<n.length;t++){const a=n[t],s=a.getElementsByTagName("Linear")?.[0];if(!s)continue;const o=s.getAttribute("skipoffset")||s.getAttribute("skipOffset")||void 0,l=s.getElementsByTagName("MediaFiles")?.[0];if(!l)continue;const c=Array.from(l.getElementsByTagName("MediaFile")).map(e=>({type:e.getAttribute("type")||"",mimeType:e.getAttribute("type")||"",bitrate:Number(e.getAttribute("bitrate")||0),bitRate:Number(e.getAttribute("bitRate")||0),width:Number(e.getAttribute("width")||0),height:Number(e.getAttribute("height")||0),fileURL:(e.textContent||"").trim(),url:(e.textContent||"").trim(),rawEl:e})),u=this.pickBestMediaFile(c);u&&r.push({ad:{id:e.getAttribute("id")||void 0},creative:{linear:{MediaFiles:c}},mediaFile:u,sequence:Number.isFinite(i)?i:void 0,creativeIndex:t,skipOffset:o||void 0})}}return r.sort((e,t)=>{const r=e.sequence??Number.MAX_SAFE_INTEGER,i=t.sequence??Number.MAX_SAFE_INTEGER;if(r!==i)return r-i;return(e.creativeIndex??0)-(t.creativeIndex??0)})}clearAdTracks(){for(const e of this.adTrackEls)e.remove();this.adTrackEls=[]}buildCaptionsFromVastMediaFileRaw(e){return this.extractClosedCaptions(e).map((e,t)=>{const r=e.language?String(e.language):"",i=e.type?String(e.type):"";return{src:String(e.fileURL),kind:"captions",srclang:r||void 0,label:r?r.toUpperCase():`CC ${t+1}`,type:i||void 0}}).filter(e=>!!e.src)}ensureRawCaptions(e){if(!e)return[];if(Array.isArray(e.captions))return e.captions;const t=this.buildCaptionsFromVastMediaFileRaw(e);return e.captions=t,t}attachAdCaptionTracks(e,t){const r=this.ensureRawCaptions(t).filter(e=>(e.type||"").toLowerCase().includes("vtt")||e.src.toLowerCase().endsWith(".vtt")),i=[];for(const t of r){const r=document.createElement("track");r.kind=t.kind,r.src=t.src,t.srclang&&(r.srclang=t.srclang),t.label&&(r.label=t.label),r.default=!1,e.appendChild(r),i.push(r)}return i}captionsSignature(e){return`${String(e?.kind??"")}|${String((e?.language??e?.srclang??"")||"")}|${String((e?.label??"")||"")}`}listCaptionTracks(e){const t=e?.textTracks;if(!t||"number"!=typeof t.length)return[];const r=[];for(let e=0;e<Number(t.length);e++){const i=t[e]??("function"==typeof t.item?t.item(e):null);if(!i)continue;const n=String(i.kind||"");"captions"!==n&&"subtitles"!==n||r.push(i)}return r}captureActiveCaptionTrack(e){if(this.prevActiveCaptionSig)return;const t=this.listCaptionTracks(e).find(e=>"showing"===String(e.mode));t&&(this.prevActiveCaptionSig=this.captionsSignature(t))}restoreActiveTextTrack(){const e=this.prevActiveCaptionSig;if(this.prevActiveCaptionSig=null,!e)return;const t=this.ctx?.core?.media;if(!t)return;const r=this.listCaptionTracks(t);if(!r.length)return;for(const e of r)e.mode="disabled";const i=r.find(t=>this.captionsSignature(t)===e);i&&(i.mode="showing")}extractClosedCaptions(e){if(!e)return[];const t=e.closedCaptionFiles??e.ClosedCaptionFiles??e.closedCaptionFile??e.ClosedCaptionFile??null;return(Array.isArray(t)?t:Array.isArray(t?.closedCaptionFiles)?t.closedCaptionFiles:Array.isArray(t?.ClosedCaptionFile)?t.ClosedCaptionFile:Array.isArray(t?.closedCaptionFile)?t.closedCaptionFile:[]).map(e=>({type:e?.type??e?.mimeType??e?.mime_type,language:e?.language??e?.lang,fileURL:e?.fileURL??e?.url??e?.src})).filter(e=>"string"==typeof e.fileURL&&e.fileURL.length>0)}removeAdCaptions(){for(const e of this.adTrackEls)try{e.remove()}catch{}this.adTrackEls=[]}pickBestMediaFile(e){if(!Array.isArray(e)||0===e.length)return null;const t=e.map(e=>({type:String(e?.mimeType||e?.type||""),fileURL:String(e?.fileURL||e?.url||e?.src||""),bitrate:Number(e?.bitrate||e?.bitRate||0),width:Number(e?.width||0),height:Number(e?.height||0),raw:e})).filter(e=>Boolean(e.fileURL));if(0===t.length)return null;for(const e of this.cfg.preferredMediaTypes){const r=t.filter(t=>(t.type||"").toLowerCase()===e.toLowerCase());if(r.length)return r.sort((e,t)=>(t.bitrate||0)-(e.bitrate||0))[0]}return t.sort((e,t)=>(t.bitrate||0)-(e.bitrate||0))[0]}extractSkipOffsetFromCreative(e){const t=e?.linear||e?.Linear||e,r=t?.skipDelay??t?.skipdelay;if("number"==typeof r&&Number.isFinite(r)&&r>=0)return String(r);const i=[t?.skipOffset,t?.skipoffset,t?.attributes?.skipOffset,t?.attributes?.skipoffset,t?.attributes?.skipOffset?.value,t?.attributes?.skipoffset?.value,t?.attributes?.skipOffset?.["#text"],t?.attributes?.skipoffset?.["#text"]];if(t&&"object"==typeof t)for(const e of["skipOffset","skipoffset","skipDelay","skipdelay"])i.push(t[e]),i.push(t?.attributes?.[e]);const n=e=>{if("number"==typeof e&&Number.isFinite(e)&&e>=0)return String(e);if("string"==typeof e){const t=e.trim();return t||void 0}if(e&&"object"==typeof e){const t=e,r=t.value??t["#text"]??t.text;if("string"==typeof r){const e=r.trim();return e||void 0}}};for(const e of i){const t=n(e);if(t)return t}}parseTimecodeToSeconds(e){const t=/^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(String(e).trim());if(!t)return null;const r=Number(t[1]),i=Number(t[2]),n=Number(t[3]);return[r,i,n].every(e=>Number.isFinite(e))?3600*r+60*i+n:null}computeSkipAtSeconds(e,t){if(!e)return;const r=e.trim();if(!r)return;if(r.endsWith("%")){const e=Number(r.slice(0,-1));return Number.isFinite(e)&&e>=0&&e<=100&&Number.isFinite(t)&&t>0?e/100*t:void 0}const i=this.parseTimecodeToSeconds(r);if(null!=i)return i;const n=Number(r);return Number.isFinite(n)&&n>=0?n:void 0}ensureSkipDom(){if(this.skipWrap&&this.skipBtn)return;const t=document.createElement("div");t.className="op-ads__skip";const r=document.createElement("button");r.type="button",r.className="op-ads__skip-btn",r.textContent="Skip Ad",t.appendChild(r),this.overlay.appendChild(t);const i=e=>{this.onSkip?.(),e.preventDefault(),e.stopPropagation()};r.addEventListener("click",i,e.EVENT_OPTIONS),this.skipWrap=t,this.skipBtn=r,this.sessionUnsubs.push(()=>r.removeEventListener("click",i)),this.sessionUnsubs.push(()=>t.remove())}hideSkipUi(){this.skipWrap&&(this.skipWrap.style.display="none"),this.skipOffsetRaw=void 0,this.skipAtSeconds=void 0}setupSkipUIForPodItem(e){this.hideSkipUi();const t=this.adVideo;if(!t)return;const r=e.skipOffset??this.extractSkipOffsetFromCreative(e.creative);if(!r)return void this.log("creative not skippable (no skipOffset/skipDelay)",{sequence:e.sequence});this.log("creative skippable",r),this.skipOffsetRaw=r,this.ensureSkipDom();const i=()=>{const e=t.duration,i=this.computeSkipAtSeconds(r,e);if(null==i)return;this.skipAtSeconds=i;const n=t.currentTime||0,a=Math.max(0,i-n);this.skipWrap&&(this.skipWrap.style.display="block"),this.skipBtn&&(this.skipBtn.textContent=a<=.05?"Skip Ad":Math.ceil(a).toString(),this.skipBtn.style.pointerEvents=a<=.05?"auto":"none")};t.addEventListener("timeupdate",i),t.addEventListener("loadedmetadata",i),i(),this.sessionUnsubs.push(()=>t.removeEventListener("timeupdate",i)),this.sessionUnsubs.push(()=>t.removeEventListener("loadedmetadata",i))}onSkip(){this.requestSkip("button")}requestSkip(e="api"){if(this.skipOffsetRaw&&null!=this.skipAtSeconds&&this.adVideo){const t=this.adVideo.currentTime||0;if(t+.01<this.skipAtSeconds)return void this.log("skip requested too early",{cur:t,skipAt:this.skipAtSeconds,reason:e})}try{this.tracker?.trackSkip?.()}catch{}const t=this.currentBreakMeta?{kind:this.currentBreakMeta.kind,id:this.currentBreakMeta.breakId}:null;this.bus.emit("ads:skip",{break:t,reason:e}),this.ctx.events.emit("ads.skipped",{break:t,reason:e}),this.ctx.events.emit("adsskipped",{break:t,reason:e});const r=this.adVideo;if(r)try{Number.isFinite(r.duration)&&r.duration>0&&(r.currentTime=Math.max(0,r.duration-.001)),r.dispatchEvent(new Event("ended"))}catch{}}clearAdOverlays(){this.hideSkipUi(),this.skipWrap?.remove(),this.skipWrap=void 0,this.skipBtn=void 0,this.companionWrap?.remove(),this.nonLinearWrap?.remove(),this.companionWrap=void 0,this.nonLinearWrap=void 0}mountCompanions(e){const t=this.getCompanionContainer();if(!t)return;const r=("companion"===e?.type?e?.variations:void 0)||e?.companionAds?.companions||e?.companions;if(!Array.isArray(r)||0===r.length)return;const i=document.createElement("div");i.className="op-ads__companions",i.style.zIndex="2",i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.maxWidth="40%",i.style.pointerEvents="auto";for(const e of r){const t=this.renderCompanion(e);t&&i.appendChild(t)}i.childElementCount&&(t.appendChild(i),this.companionWrap=i,this.sessionUnsubs.push(()=>i.remove()))}renderCompanion(e){const t=e?.companionClickThroughURLTemplate||e?.clickThroughURLTemplate||e?.companionClickThrough||e?.clickThrough,r=document.createElement("div");r.className="op-ads__companion",r.style.position="relative",r.style.cursor=t?"pointer":"default";const i=e?.staticResource||e?.StaticResource||e?.staticResources?.[0]||e?.StaticResources?.[0],n=e?.iFrameResource||e?.IFrameResource||e?.iFrameResources?.[0]||e?.IFrameResources?.[0],a=e?.htmlResource||e?.HTMLResource||e?.htmlResources?.[0]||e?.HTMLResources?.[0];let s=null;if(i){const e=document.createElement("img");e.src=String(i?.url||i?.uri||i?.value||i),e.style.maxWidth="100%",e.style.height="auto",s=e}else if(n){const e=document.createElement("iframe");e.src=String(n?.url||n?.uri||n?.value||n),e.style.border="0",e.style.width="100%",e.style.height="100%",s=e}else if(a){const e=document.createElement("div");this.setSafeHTML(e,String(a?.value||a)),s=e}if(!s)return null;if(r.appendChild(s),t){const e=e=>{const r="string"==typeof t?t:t.url;this.safeWindowOpen(r);try{this.tracker?.trackClick?.(),this.tracker?.trackClickThrough?.()}catch{}e.preventDefault(),e.stopPropagation()};r.addEventListener("click",e),this.sessionUnsubs.push(()=>r.removeEventListener("click",e))}return r}collectNonLinearCreatives(e){const t=this.extractAdsFromParsed(e),r=[];for(const e of t){const t=e?.creatives||e?.Creatives||[];for(const i of t){const t=i?.variations??i?.nonLinearAds?.nonLinears??i?.nonLinearAds?.nonLinear??i?.NonLinearAds?.NonLinear??i?.nonLinears??i?.NonLinears??void 0;if(t===i?.variations&&"nonlinear"!==i?.type)continue;const n=Array.isArray(t)?t:t?[t]:[];if(0===n.length)continue;const a=e?.sequence||e?.attributes?.sequence||void 0,s=null!=a?Number(a):void 0;for(const t of n)r.push({ad:e,creative:i,nonLinear:t,sequence:Number.isFinite(s)?s:void 0})}}return r.sort((e,t)=>{const r=e.sequence,i=t.sequence;return null==r&&null==i?0:null==r?1:null==i?-1:r-i})}collectNonLinearFromXml(e){const t=[],r=(e,t)=>{try{if(e.getElementsByTagNameNS){const r=e.getElementsByTagNameNS("*",t),i=Array.from(r);if(i.length)return i}}catch{}try{return Array.from(e.getElementsByTagName(t))}catch{return[]}},i=(e,t)=>{const i=r(e,t);return n=i[0]??null,(n?.textContent||"").trim();var n},n=[];try{const t=r(e,"Companion");for(const e of t){const t=Number(e.getAttribute("width")||0),r=Number(e.getAttribute("height")||0),a=i(e,"StaticResource"),s=i(e,"CompanionClickThrough");a&&n.push({width:t||void 0,height:r||void 0,staticResource:{value:a},clickThrough:s||void 0})}}catch{}const a=r(e,"NonLinear");for(const e of a){const r=Number(e.getAttribute("width")||0),a=Number(e.getAttribute("height")||0),s=e.getAttribute("minSuggestedDuration")||void 0,o=i(e,"StaticResource"),l=i(e,"IFrameResource"),c=i(e,"HTMLResource"),u={width:r||void 0,height:a||void 0,minSuggestedDuration:s,staticResource:o?{value:o}:void 0,iFrameResource:l?{value:l}:void 0,htmlResource:c?{value:c}:void 0,nonLinearClickThrough:i(e,"NonLinearClickThrough")||void 0};t.push({nonLinear:u,companions:n.length?n:void 0})}return t}async playNonLinearOnlyBreakFromXml(e,t){this.ensureOverlayMounted(),this.clearAdOverlays(),this.overlay.replaceChildren(),this.overlay.style.display="block",this.active=!0;let r=0;for(let i=0;i<e.length;i++){const n=e[i];n.companions?.length&&this.mountCompanions({companions:n.companions,companionAds:{companions:n.companions}}),this.ensureNonLinearDom();const a=this.renderNonLinear(n.nonLinear);a&&this.nonLinearWrap.appendChild(a),r=Math.max(r,this.nonLinearSuggestedDurationSeconds(n.nonLinear)),this.bus.emit("ads:impression",{break:t,index:i}),this.bus.emit("ads:ad:start",{break:t,index:i})}this.active=!1,this.ctx.events.emit("cmd:play");const i=Date.now();(async()=>{await new Promise(e=>{const t=()=>{const n=(Date.now()-i)/1e3;!this.nonLinearWrap?.querySelector(".op-ads__nonlinear-item")||n>=r?e():setTimeout(t,50)};t()});for(let r=0;r<e.length;r++)this.bus.emit("ads:ad:end",{break:t,index:r});this.clearSession(),this.overlay.style.display="none",this.overlay.replaceChildren(),this.currentBreakMeta=void 0})()}ensureNonLinearDom(){if(this.nonLinearWrap)return;const e=document.createElement("div");e.className="op-ads__nonlinear",e.style.position="absolute",e.style.left="12px",e.style.right="12px",e.style.bottom="12px",e.style.zIndex="2",e.style.display="flex",e.style.justifyContent="center",e.style.pointerEvents="auto";(this.getNonLinearContainer()||this.adVideo?.parentElement||this.overlay).appendChild(e),this.nonLinearWrap=e,this.sessionUnsubs.push(()=>e.remove())}renderNonLinear(e){const t=e?.nonlinearClickThroughURLTemplate||e?.nonLinearClickThroughURLTemplate||e?.clickThroughURLTemplate||e?.nonLinearClickThrough||e?.clickThrough,r=document.createElement("div");r.className="op-ads__nonlinear-item",r.style.position="relative",r.style.maxWidth="100%",r.style.cursor=t?"pointer":"default";const i=e=>Array.isArray(e)?e[0]:e,n=i(e?.staticResource??e?.StaticResource??e?.staticResources??e?.StaticResources),a=i(e?.iFrameResource??e?.IFrameResource??e?.iFrameResources??e?.IFrameResources),s=i(e?.htmlResource??e?.HTMLResource??e?.htmlResources??e?.HTMLResources);let o=null;if(n){const e=document.createElement("img");e.src=String(n?.url||n?.uri||n?.value||n),e.style.maxWidth="100%",e.style.height="auto",o=e}else if(a){const e=document.createElement("iframe");e.src=String(a?.url||a?.uri||a?.value||a),e.style.border="0",e.style.width="100%",e.style.height="100%",o=e}else if(s){const e=document.createElement("div");this.setSafeHTML(e,String(s?.value||s)),o=e}if(!o)return null;if(r.appendChild(o),t){const e=e=>{if("BUTTON"===e.target?.tagName)return;const r="string"==typeof t?t:t.url;this.safeWindowOpen(r);try{this.tracker?.trackClick?.(),this.tracker?.trackClickThrough?.()}catch{}e.preventDefault(),e.stopPropagation()};r.addEventListener("click",e),this.sessionUnsubs.push(()=>r.removeEventListener("click",e))}return r}mountNonLinear(e){const t=("nonlinear"===e?.type?e?.variations:void 0)??e?.nonLinearAds?.nonLinears??e?.nonLinearAds?.nonLinear??e?.NonLinearAds?.NonLinear??e?.nonLinears??e?.NonLinears??void 0,r=Array.isArray(t)?t:t?[t]:[];if(0!==r.length){this.ensureNonLinearDom();for(const e of r){const t=this.renderNonLinear(e);t&&this.nonLinearWrap.appendChild(t)}}}nonLinearSuggestedDurationSeconds(e){const t=e?.minSuggestedDuration??e?.minSuggestedDurationSeconds??e?.attributes?.minSuggestedDuration??void 0;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;if("string"==typeof t){const e=this.parseTimecodeToSeconds(t);if(null!=e&&e>0)return e;const r=Number(t);if(Number.isFinite(r)&&r>0)return r}return 10}async playNonLinearOnlyBreak(e,t){this.ensureOverlayMounted(),this.overlay.replaceChildren(),this.overlay.style.display="block",this.active=!0;const r=this.collectNonLinearCreatives(e);if(!r.length)return;let i=0;for(let e=0;e<r.length;e++){const n=r[e];try{this.tracker=new z(this.vastClient,n.ad,n.creative)}catch{this.tracker=void 0}this._lastCreative=n.creative;const a=n.ad?.creatives?.find(e=>"companion"===e?.type)??n.creative;this.mountCompanions(a),this.ensureNonLinearDom();const s=this.renderNonLinear(n.nonLinear);s&&this.nonLinearWrap.appendChild(s);try{this.tracker?.trackImpression?.(),this.tracker?.trackCreativeView?.()}catch{}this.bus.emit("ads:impression",{break:t,index:e}),this.bus.emit("ads:ad:start",{break:t,index:e,sequence:n.sequence}),i=Math.max(i,this.nonLinearSuggestedDurationSeconds(n.nonLinear))}this.active=!1,this.ctx.events.emit("cmd:play");const n=Date.now();(async()=>{await new Promise(e=>{const t=()=>{const r=(Date.now()-n)/1e3;!this.nonLinearWrap?.querySelector(".op-ads__nonlinear-item")||r>=i?e():setTimeout(t,50)};t()});for(let e=0;e<r.length;e++){const i=r[e];this.bus.emit("ads:ad:end",{break:t,index:e,sequence:i.sequence})}this.clearSession(),this.overlay.style.display="none",this.overlay.replaceChildren(),this.currentBreakMeta=void 0})()}async mountAdVideo(t,r){this.ensureOverlayMounted();const i=this.overlay.parentElement;this.overlay.replaceChildren(),this.overlay.style.display="block",this.contentMedia=t,this.captureActiveCaptionTrack(t);const n=document.createElement("video");n.className="op-ads__media",n.playsInline=!0;const a=(t.getAttribute("preload")||t.preload||"").toLowerCase(),s=(!!t.autoplay||"auto"===a)&&!this.ctx.core.userInteracted;n.preload="none"===a?"metadata":"auto",n.controls=this.cfg.allowNativeControls,n.style.width="100%",n.style.height="100%",n.src=r.fileURL;try{n.load()}catch{}const o=!!s||this.ctx.core.muted,l=s?0:this.ctx.core.volume;n.muted=o,n.defaultMuted=o,Number.isFinite(l)&&(n.volume=Math.max(0,Math.min(1,l))),this.adEndPromise=new Promise(e=>{const t=()=>e(),r=()=>{if(this.adVideo===n){try{n.pause()}catch{}n.remove(),this.adVideo=void 0}else n.remove()},i=()=>{this.ctx.events.emit("ended"),r(),t()},a=()=>{r(),t()};n.addEventListener("ended",i,{once:!0}),n.addEventListener("error",a,{once:!0}),this.sessionUnsubs.push(()=>n.removeEventListener("ended",i)),this.sessionUnsubs.push(()=>n.removeEventListener("error",a))}),this.overlay.appendChild(n),this.adVideo=n;const c=()=>{if("visible"!==document.visibilityState)return;const e=this.adVideo;if(e&&e.paused&&!e.ended)try{const t=e.play?.();t&&"function"==typeof t.catch&&t.catch(()=>{})}catch{}};document.addEventListener("visibilitychange",c),this.sessionUnsubs.push(()=>document.removeEventListener("visibilitychange",c)),this.clearAdTracks(),this.adTrackEls=this.attachAdCaptionTracks(n,r.raw),this.sessionUnsubs.push(()=>this.clearAdTracks());let u=null;try{u=e.getOverlayManager(this.ctx.core),u.activate({id:"ads",priority:100,mode:"countdown",canSeek:!1,duration:0,value:0,label:"Ad",fullscreenEl:i,fullscreenVideoEl:n})}catch{}const d=()=>{if(!u)return;const e=n.duration,t=n.currentTime;!Number.isFinite(e)||e<=0||!Number.isFinite(t)||u.update(this.overlayId,{duration:e,value:Math.max(0,e-t)+1,mode:"countdown",canSeek:!1,fullscreenEl:i,fullscreenVideoEl:n})};n.addEventListener("loadedmetadata",d),n.addEventListener("timeupdate",d),d(),this.sessionUnsubs.push(()=>n.removeEventListener("loadedmetadata",d)),this.sessionUnsubs.push(()=>n.removeEventListener("timeupdate",d))}bindAdSurfaceCommands(){const{events:e}=this.ctx,t=()=>this.adVideo;this.sessionUnsubs.push(e.on("cmd:play",()=>{const e=Boolean(this.contentMedia?.autoplay||"auto"===this.contentMedia?.preload);if(!this.userPlayIntent&&e&&!this.ctx.core.userInteracted){this.forcedMuteUntilInteraction=!0;try{t()&&(t().muted=!0,t().volume=0)}catch{}}else{this.forcedMuteUntilInteraction=!1;try{t()&&(t().muted=this.ctx.core.muted,t().volume=this.ctx.core.volume)}catch{}}t()?.play().catch(()=>{})})),this.sessionUnsubs.push(e.on("cmd:pause",()=>t()?.pause())),this.sessionUnsubs.push(e.on("cmd:setVolume",e=>{const r=Number(e);Number.isFinite(r)&&t()&&(this.syncingVolume||this.forcedMuteUntilInteraction||(t().volume=r))})),this.sessionUnsubs.push(e.on("cmd:setMuted",e=>{if(t()&&!this.syncingVolume)return this.forcedMuteUntilInteraction&&!this.ctx.core.userInteracted?(t().muted=!0,void(t().volume=0)):void(t().muted=Boolean(e))}))}bindTrackerAndTelemetry(e){this.currentBreakMeta=e;const t=this.adVideo;let r=!1,i=t.muted||0===t.volume,n=t.paused;const a=()=>{const r=t.duration;Number.isFinite(r)&&r>0&&(this.bus.emit("ads:duration",{break:e,duration:r}),this.ctx.events.emit("ads.durationChange",{duration:r,break:e}))};let s=!1,o=!1,l=!1,c=!1;const u=t=>{this.bus.emit("ads:quartile",{break:e,quartile:t}),25===t&&this.ctx.events.emit("ads.firstQuartile",{break:e}),50===t&&this.ctx.events.emit("ads.midpoint",{break:e}),75===t&&this.ctx.events.emit("ads.thirdQuartile",{break:e}),100===t&&this.ctx.events.emit("ads.complete",{break:e})},d=()=>{r?n&&(this.tracker?.trackResume?.(),this.bus.emit("ads:resume",{break:e}),this.ctx.events.emit("ads.resume",{break:e})):(r=!0,this.tracker?.trackStart?.(),this.ctx.events.emit("play"),this.ctx.events.emit("ads.start",{break:e}),u(0),a()),this.ctx.events.emit("playing"),n=!1},h=()=>{r&&this.tracker?.trackPause?.(),n=!0,this.bus.emit("ads:pause",{break:e}),this.ctx.events.emit("pause"),this.ctx.events.emit("ads.pause",{break:e})},p=()=>{const r=t.duration,i=t.currentTime;if(!Number.isFinite(r)||r<=0||!Number.isFinite(i))return;a();const n=Math.max(0,r-i);this.bus.emit("ads:timeupdate",{break:e,currentTime:i,remainingTime:n,duration:r}),this.ctx.events.emit("ads.adProgress",{currentTime:i,duration:r,break:e}),this.tracker?.setDuration?.(r),this.tracker?.setProgress?.(i);const d=i/r;!s&&d>=.25&&(s=!0,this.tracker?.trackFirstQuartile?.(),u(25)),!o&&d>=.5&&(o=!0,this.tracker?.trackMidpoint?.(),u(50)),!l&&d>=.75&&(l=!0,this.tracker?.trackThirdQuartile?.(),u(75)),!c&&d>=.999&&(c=!0,this.tracker?.trackComplete?.(),u(100))},m=()=>{const r=t.volume,n=t.muted||0===t.volume;if(this.bus.emit("ads:volumeChange",{break:e,volume:r,muted:n}),this.ctx.events.emit("ads.volumeChange",{volume:r,muted:n,break:e}),n!==i&&(i=n,n?(this.tracker?.trackMute?.(),this.bus.emit("ads:mute",{break:e})):(this.tracker?.trackUnmute?.(),this.bus.emit("ads:unmute",{break:e}))),(!this.forcedMuteUntilInteraction||this.ctx.core.userInteracted)&&!this.syncingVolume)try{this.syncingVolume=!0,this.ctx.core.muted=n,Number.isFinite(r)&&(this.ctx.core.volume=Math.max(0,Math.min(1,r)))}catch{}finally{this.syncingVolume=!1}},f=t=>{if(t.defaultPrevented)return;const r=this.getClickThroughUrl();if(!r)return;const i="string"==typeof r?r:r.url;this.safeWindowOpen(i),this.tracker?.trackClick?.(),this.tracker?.trackClickThrough?.(),this.bus.emit("ads:clickthrough",{break:e,url:r}),this.ctx.events.emit("ads.click",{break:e,url:r})};t.addEventListener("playing",d),t.addEventListener("pause",h),t.addEventListener("timeupdate",p),t.addEventListener("volumechange",m),t.addEventListener("click",f),t.addEventListener("loadedmetadata",a),this.sessionUnsubs.push(()=>t.removeEventListener("playing",d)),this.sessionUnsubs.push(()=>t.removeEventListener("pause",h)),this.sessionUnsubs.push(()=>t.removeEventListener("timeupdate",p)),this.sessionUnsubs.push(()=>t.removeEventListener("volumechange",m)),this.sessionUnsubs.push(()=>t.removeEventListener("click",f)),this.sessionUnsubs.push(()=>t.removeEventListener("loadedmetadata",a))}getClickThroughUrl(){const e=this._lastCreative;return e?.videoClickThroughURLTemplate||e?.videoClicks?.clickThrough||e?.videoClicks?.clickThroughURLTemplate||void 0}safeWindowOpen(e){try{const t=new URL(e,window.location.href);if("http:"!==t.protocol&&"https:"!==t.protocol)return;window.open(t.toString(),"_blank","noopener,noreferrer")}catch{}}ensureOverlayMounted(){const e=this.resolveMount();if(e instanceof HTMLElement){const t=window.getComputedStyle(e);t.position&&"static"!==t.position||(e.style.position="relative")}this.overlay.style.position="absolute",this.overlay.style.inset="0",this.overlay.style.width="100%",this.overlay.style.height="100%",this.overlay.style.zIndex=this.overlay.style.zIndex||"3",this.overlay.style.pointerEvents="auto",this.overlay.parentElement!==e&&e.appendChild(this.overlay)}tryMountSimidLayer(e){const t=e?.simid??e?.SIMID??e?.simidLayer,r=t?.urls??t?.url??t?.resources??t?.iframeResources??e?.simidUrls??null,i=Array.isArray(r)?r.map(e=>String(e)).filter(e=>e.trim()):"string"==typeof r?[r].filter(e=>e.trim()):[];if(!i.length)return;this.ensureOverlayMounted();let n=this.overlay.querySelector(".op-ads__simid");n?n.innerHTML="":(n=document.createElement("div"),n.className="op-ads__simid",n.style.position="absolute",n.style.inset="0",n.style.pointerEvents="auto",this.overlay.appendChild(n));for(const e of i){const t=document.createElement("iframe");t.src=e,t.setAttribute("title","SIMID"),t.setAttribute("loading","lazy"),t.setAttribute("referrerpolicy","no-referrer"),t.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-popups"),t.style.width="100%",t.style.height="100%",t.style.border="0",n.appendChild(t)}}async playBreakFromVast(e,t,r){if(this.active)return!1;this.ensureOverlayMounted();const{events:i,leases:n,core:{media:a}}=this.ctx,s="url"===e.kind?e.value:"[xml]";this.bus.emit("ads:requested",s),this.log("requested",s,t),this.resumeAfter=this.cfg.resumeContent&&"postroll"!==t.kind;const o=()=>{try{a.pause()}catch{}return i.emit("cmd:pause"),!!n.acquire("playback",this.name)||(this.bus.emit("ads:error",{reason:"playback lease already owned",owner:n.owner("playback")}),this.ctx.events.emit("ads.error",{reason:"playback lease already owned",owner:n.owner("playback")}),!1)};let l=null;const c=async()=>{if(!l)try{const t=await this.getVastXmlText(e);l=this.buildParsedForNonLinearFromXml(t)}catch{l=null}};try{let i;if("url"===e.kind)try{i=await this.vastClient.get(e.value)}catch(e){if(await c(),!l)throw e;i=await this.vastClient.parseVAST(l)}else{const t="string"==typeof e.value?this.toXmlDocument(e.value):e.value instanceof XMLDocument?e.value:this.toXmlDocument((new XMLSerializer).serializeToString(e.value));l=t,i=await this.vastClient.parseVAST(t)}this.log("vast parsed",{ads:i?.ads?.length??0,version:i?.version});const n=e=>{this.bus.emit("ads:loaded",{break:t,count:e}),this.ctx.events.emit("ads.loaded",{break:t,count:e})};if("NONLINEAR"===t.sourceType){const e=this.collectNonLinearCreatives(i);if(e.length)return n(e.length),await this.playNonLinearOnlyBreak(i,t),!0;if(await c(),l){const e=this.collectNonLinearFromXml(l);if(e.length)return n(e.length),await this.playNonLinearOnlyBreakFromXml(e,t),!0}}let s=this.collectPodAds(i);if(this.log("linear pod items",s.length),!s.length){const e=this.collectNonLinearCreatives(i);if(e.length)return n(e.length),await this.playNonLinearOnlyBreak(i,t),!0;if(await c(),l&&(s=this.collectPodAdsFromXml(l),this.log("linear pod items (xml fallback)",s.length),!s.length)){const e=this.collectNonLinearFromXml(l);if(e.length)return n(e.length),await this.playNonLinearOnlyBreakFromXml(e,t),!0}}if(!s.length)throw this.warn("no playable ads found in VAST response"),new Error("No playable ads found in VAST response");if(n(s.length),!o())return!1;this.active=!0;for(let e=0;e<s.length;e++){const r=s[e];this.bus.emit("ads:ad:start",{break:t,index:e,sequence:r.sequence}),this.clearSession(),this.tracker=new z(this.vastClient,r.ad,r.creative),this._lastCreative=r.creative,this.log("mount ad video",{url:r.mediaFile?.fileURL,type:r.mediaFile?.type,skipOffset:r.skipOffset}),this.mountAdVideo(a,r.mediaFile);const i=this.waitForAdEnd();this.setupSkipUIForPodItem(r),this.log("skip ui",{raw:this.skipOffsetRaw,at:this.skipAtSeconds}),this.mountCompanions(r.creative),this.mountNonLinear(r.creative),this.cfg.allowNativeControls||this.bindAdSurfaceCommands(),this.tracker?.trackImpression?.(),this.bus.emit("ads:impression",{break:t,index:e}),this.bindTrackerAndTelemetry({kind:t.kind,breakId:t.id}),this.startAdPlayback(),await i,this.bus.emit("ads:ad:end",{break:t,index:e,sequence:r.sequence})}return this.bus.emit("ads:allAdsCompleted",{break:t}),this.ctx.events.emit("ads.allAdsCompleted",{break:t}),this.finish({resume:"postroll"!==t.kind&&(this.userPlayIntent||this.resumeAfter),suppressResume:r?.suppressResumeOnSuccess}),!0}catch(e){return this.bus.emit("ads:error",e),this.ctx.events.emit("ads.error",{err:e}),this.finish({resume:"postroll"!==t.kind&&(this.userPlayIntent||this.resumeAfter),suppressResume:r?.suppressResumeOnError}),!1}}waitForAdEnd(){return this.adEndPromise||Promise.resolve()}startAdPlayback(){const e=this.adVideo;if(this.ctx.events.emit("play"),!e)return;const t=t=>{try{t&&(e.muted=!0,e.volume=0,this.forcedMuteUntilInteraction=!0);const r=e.play?.();return r&&"function"==typeof r.then?r:void 0}catch{return}},r=t(!1);r&&r.catch(()=>{const e=t(!0);e&&e.catch(()=>{})})}clearSession(){for(const e of this.sessionUnsubs)e();if(this.sessionUnsubs=[],this.tracker=void 0,this.clearAdOverlays(),this.removeAdCaptions(),this.adVideo){try{this.adVideo.pause()}catch{}this.adVideo.remove(),this.adVideo=void 0}try{document.querySelectorAll("video.op-ads__media").forEach(e=>e?.parentNode?.removeChild?.(e)??e.remove?.())}catch{}this.adEndPromise=null,this.overlay.replaceChildren()}finish(t){const{events:r,leases:i}=this.ctx;this.clearSession(),this.contentMedia&&this.contentHadControls&&this.contentMedia.setAttribute("controls",""),this.contentMedia=void 0,this.contentHadControls=!1,this.overlay.style.display="none",this.overlay.replaceChildren(),i.release("playback",this.name),this.active=!1;const n=!!(t.resume||this.userPlayIntent||this.resumeAfter);this.userPlayIntent=!1,this.restoreActiveTextTrack();try{e.getOverlayManager(this.ctx.core).deactivate(this.overlayId)}catch{}t.suppressResume||(n?r.emit("cmd:play"):r.emit("cmd:pause"))}}function ne(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(Z=window).OpenPlayerPlugins=Z.OpenPlayerPlugins||{},Z.OpenPlayerPlugins.ads={name:"ads",kind:"plugin",factory:e=>new ie({...e||{},allowNativeControls:!1}),install:e=>function(e){e&&e.prototype&&(Object.getOwnPropertyDescriptor(e.prototype,"ads")||Object.defineProperty(e.prototype,"ads",{configurable:!0,enumerable:!1,get(){return this.getPlugin?.("ads")}}),"function"!=typeof e.prototype.playAds&&Object.defineProperty(e.prototype,"playAds",{configurable:!0,enumerable:!1,value:function(e){const t=this.getPlugin?.("ads")||this.ads;if(!t)throw new Error("Ads plugin not installed; cannot playAds()");const r=String(e??"").trim();if(!r)throw new Error("playAds(input) requires a non-empty URL or VAST XML string");if(r.startsWith("<")){if("function"!=typeof t.playAdsFromXml)throw new Error("Ads plugin does not support XML input (playAdsFromXml missing)");return t.playAdsFromXml(r)}return t.playAds(r)}}))}(e),extend:(e,t)=>function(e,t){e&&("function"==typeof e.extend?e.extend({ads:t}):void 0===e.ads&&(e.ads=t))}(e,t)},function(e){var t;(t=e.OpenPlayerJS)&&!t.prototype.playAds&&(t.prototype.playAds=function(e){return("function"==typeof this.getPlayer?this.getPlayer():this.player).playAds(e)})}(window);var ae,se,oe={},le={},ce={};function ue(){if(ae)return ce;function e(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}ae=1;var t=e({HTML:"text/html",isHTML:function(e){return e===t.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),r=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===r.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return ce.assign=function(e,t){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},ce.find=function(e,t,r){if(void 0===r&&(r=Array.prototype),e&&"function"==typeof r.find)return r.find.call(e,t);for(var i=0;i<e.length;i++)if(Object.prototype.hasOwnProperty.call(e,i)){var n=e[i];if(t.call(void 0,n,i,e))return n}},ce.freeze=e,ce.MIME_TYPE=t,ce.NAMESPACE=r,ce}function de(){if(se)return le;se=1;var e=ue(),t=e.find,r=e.NAMESPACE;function i(e){return""!==e}function n(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function a(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(i):[]}(e);return Object.keys(t.reduce(n,{}))}function s(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function o(e,t){var r=e.prototype;if(!(r instanceof t)){function i(){}i.prototype=t.prototype,s(r,i=new i),e.prototype=r=i}r.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),r.constructor=e)}var l={},c=l.ELEMENT_NODE=1,u=l.ATTRIBUTE_NODE=2,d=l.TEXT_NODE=3,h=l.CDATA_SECTION_NODE=4,p=l.ENTITY_REFERENCE_NODE=5,m=l.ENTITY_NODE=6,f=l.PROCESSING_INSTRUCTION_NODE=7,g=l.COMMENT_NODE=8,v=l.DOCUMENT_NODE=9,b=l.DOCUMENT_TYPE_NODE=10,y=l.DOCUMENT_FRAGMENT_NODE=11,k=l.NOTATION_NODE=12,T={},w={};T.INDEX_SIZE_ERR=(w[1]="Index size error",1),T.DOMSTRING_SIZE_ERR=(w[2]="DOMString size error",2);var A=T.HIERARCHY_REQUEST_ERR=(w[3]="Hierarchy request error",3);T.WRONG_DOCUMENT_ERR=(w[4]="Wrong document",4),T.INVALID_CHARACTER_ERR=(w[5]="Invalid character",5),T.NO_DATA_ALLOWED_ERR=(w[6]="No data allowed",6),T.NO_MODIFICATION_ALLOWED_ERR=(w[7]="No modification allowed",7);var N=T.NOT_FOUND_ERR=(w[8]="Not found",8);T.NOT_SUPPORTED_ERR=(w[9]="Not supported",9);var E=T.INUSE_ATTRIBUTE_ERR=(w[10]="Attribute in use",10);function R(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,w[e]),this.message=w[e],Error.captureStackTrace&&Error.captureStackTrace(this,R);return r.code=e,t&&(this.message=this.message+": "+t),r}function L(){}function C(e,t){this._node=e,this._refresh=t,x(this)}function x(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(ke(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var i=r.length;i in e;i++)Object.prototype.hasOwnProperty.call(e,i)&&delete e[i];s(r,e),e._inc=t}}function S(){}function D(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function I(e,t,i,n){if(n?t[D(t,n)]=i:t[t.length++]=i,e){i.ownerElement=e;var a=e.ownerDocument;a&&(n&&V(a,e,n),function(e,t,i){e&&e._inc++;var n=i.namespaceURI;n===r.XMLNS&&(t._nsMap[i.prefix?i.localName:""]=i.value)}(a,e,i))}}function O(e,t,r){var i=D(t,r);if(!(i>=0))throw new R(N,new Error(e.tagName+"@"+r));for(var n=t.length-1;i<n;)t[i]=t[++i];if(t.length=n,e){var a=e.ownerDocument;a&&(V(a,e,r),r.ownerElement=null)}}function U(){}function P(){}function M(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function B(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(B(e,t))return!0}while(e=e.nextSibling)}function q(){this.ownerDocument=this}function V(e,t,i,n){e&&e._inc++,i.namespaceURI===r.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function F(e,t,r){if(e&&e._inc){e._inc++;var i=t.childNodes;if(r)i[i.length++]=r;else{for(var n=t.firstChild,a=0;n;)i[a++]=n,n=n.nextSibling;i.length=a,delete i[i.length]}}}function _(e,t){var r=t.previousSibling,i=t.nextSibling;return r?r.nextSibling=i:e.firstChild=i,i?i.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,F(e.ownerDocument,e),t}function j(e){return e&&e.nodeType===P.DOCUMENT_TYPE_NODE}function W(e){return e&&e.nodeType===P.ELEMENT_NODE}function H(e){return e&&e.nodeType===P.TEXT_NODE}function G(e,r){var i=e.childNodes||[];if(t(i,W)||j(r))return!1;var n=t(i,j);return!(r&&n&&i.indexOf(n)>i.indexOf(r))}function X(e,r){var i=e.childNodes||[];if(t(i,function(e){return W(e)&&e!==r}))return!1;var n=t(i,j);return!(r&&n&&i.indexOf(n)>i.indexOf(r))}function z(e,t,r){if(!function(e){return e&&(e.nodeType===P.DOCUMENT_NODE||e.nodeType===P.DOCUMENT_FRAGMENT_NODE||e.nodeType===P.ELEMENT_NODE)}(e))throw new R(A,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new R(N,"child not in parent");if(!function(e){return e&&(W(e)||H(e)||j(e)||e.nodeType===P.DOCUMENT_FRAGMENT_NODE||e.nodeType===P.COMMENT_NODE||e.nodeType===P.PROCESSING_INSTRUCTION_NODE)}(t)||j(t)&&e.nodeType!==P.DOCUMENT_NODE)throw new R(A,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function K(e,r,i){var n=e.childNodes||[],a=r.childNodes||[];if(r.nodeType===P.DOCUMENT_FRAGMENT_NODE){var s=a.filter(W);if(s.length>1||t(a,H))throw new R(A,"More than one element or text in fragment");if(1===s.length&&!G(e,i))throw new R(A,"Element in fragment can not be inserted before doctype")}if(W(r)&&!G(e,i))throw new R(A,"Only one element can be added and only after doctype");if(j(r)){if(t(n,j))throw new R(A,"Only one doctype is allowed");var o=t(n,W);if(i&&n.indexOf(o)<n.indexOf(i))throw new R(A,"Doctype can only be inserted before an element");if(!i&&o)throw new R(A,"Doctype can not be appended since element is present")}}function $(e,r,i){var n=e.childNodes||[],a=r.childNodes||[];if(r.nodeType===P.DOCUMENT_FRAGMENT_NODE){var s=a.filter(W);if(s.length>1||t(a,H))throw new R(A,"More than one element or text in fragment");if(1===s.length&&!X(e,i))throw new R(A,"Element in fragment can not be inserted before doctype")}if(W(r)&&!X(e,i))throw new R(A,"Only one element can be added and only after doctype");if(j(r)){function l(e){return j(e)&&e!==i}if(t(n,l))throw new R(A,"Only one doctype is allowed");var o=t(n,W);if(i&&n.indexOf(o)<n.indexOf(i))throw new R(A,"Doctype can only be inserted before an element")}}function Y(e,t,r,i){z(e,t,r),e.nodeType===P.DOCUMENT_NODE&&(i||K)(e,t,r);var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===y){var a=t.firstChild;if(null==a)return t;var s=t.lastChild}else a=s=t;var o=r?r.previousSibling:e.lastChild;a.previousSibling=o,s.nextSibling=r,o?o.nextSibling=a:e.firstChild=a,null==r?e.lastChild=s:r.previousSibling=s;do{a.parentNode=e,Q(a,e.ownerDocument||e)}while(a!==s&&(a=a.nextSibling));return F(e.ownerDocument||e,e),t.nodeType==y&&(t.firstChild=t.lastChild=null),t}function Q(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===c&&e.attributes)for(var r=0;r<e.attributes.length;r++){var i=e.attributes.item(r);i&&(i.ownerDocument=t)}for(var n=e.firstChild;n;)Q(n,t),n=n.nextSibling}}function J(){this._nsMap={}}function Z(){}function ee(){}function te(){}function re(){}function ie(){}function ne(){}function ae(){}function oe(){}function ce(){}function de(){}function he(){}function pe(){}function me(e,t){var r=[],i=9==this.nodeType&&this.documentElement||this,n=i.prefix,a=i.namespaceURI;if(a&&null==n&&null==(n=i.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return ve(this,r,e,t,s),r.join("")}function fe(e,t,i){var n=e.prefix||"",a=e.namespaceURI;if(!a)return!1;if("xml"===n&&a===r.XML||a===r.XMLNS)return!1;for(var s=i.length;s--;){var o=i[s];if(o.prefix===n)return o.namespace!==a}return!0}function ge(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,M),'"')}function ve(e,t,i,n,a){if(a||(a=[]),n){if(!(e=n(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case c:var s=e.attributes,o=s.length,l=e.firstChild,m=e.tagName,k=m;if(!(i=r.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var T,w=0;w<s.length;w++)if("xmlns"===s.item(w).name){T=s.item(w).value;break}if(!T)for(var A=a.length-1;A>=0;A--){if(""===(N=a[A]).prefix&&N.namespace===e.namespaceURI){T=N.namespace;break}}if(T!==e.namespaceURI)for(A=a.length-1;A>=0;A--){var N;if((N=a[A]).namespace===e.namespaceURI){N.prefix&&(k=N.prefix+":"+m);break}}}t.push("<",k);for(var E=0;E<o;E++){"xmlns"==(R=s.item(E)).prefix?a.push({prefix:R.localName,namespace:R.value}):"xmlns"==R.nodeName&&a.push({prefix:"",namespace:R.value})}for(E=0;E<o;E++){var R,L,C;if(fe(R=s.item(E),0,a))ge(t,(L=R.prefix||"")?"xmlns:"+L:"xmlns",C=R.namespaceURI),a.push({prefix:L,namespace:C});ve(R,t,i,n,a)}if(m===k&&fe(e,0,a))ge(t,(L=e.prefix||"")?"xmlns:"+L:"xmlns",C=e.namespaceURI),a.push({prefix:L,namespace:C});if(l||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(m)){if(t.push(">"),i&&/^script$/i.test(m))for(;l;)l.data?t.push(l.data):ve(l,t,i,n,a.slice()),l=l.nextSibling;else for(;l;)ve(l,t,i,n,a.slice()),l=l.nextSibling;t.push("</",k,">")}else t.push("/>");return;case v:case y:for(l=e.firstChild;l;)ve(l,t,i,n,a.slice()),l=l.nextSibling;return;case u:return ge(t,e.name,e.value);case d:return t.push(e.data.replace(/[<&>]/g,M));case h:return t.push("<![CDATA[",e.data,"]]>");case g:return t.push("\x3c!--",e.data,"--\x3e");case b:var x=e.publicId,S=e.systemId;if(t.push("<!DOCTYPE ",e.name),x)t.push(" PUBLIC ",x),S&&"."!=S&&t.push(" ",S),t.push(">");else if(S&&"."!=S)t.push(" SYSTEM ",S,">");else{var D=e.internalSubset;D&&t.push(" [",D,"]"),t.push(">")}return;case f:return t.push("<?",e.target," ",e.data,"?>");case p:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function be(e,t,r){var i;switch(t.nodeType){case c:(i=t.cloneNode(!1)).ownerDocument=e;case y:break;case u:r=!0}if(i||(i=t.cloneNode(!1)),i.ownerDocument=e,i.parentNode=null,r)for(var n=t.firstChild;n;)i.appendChild(be(e,n,r)),n=n.nextSibling;return i}function ye(e,t,r){var i=new t.constructor;for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var a=t[n];"object"!=typeof a&&a!=i[n]&&(i[n]=a)}switch(t.childNodes&&(i.childNodes=new L),i.ownerDocument=e,i.nodeType){case c:var s=t.attributes,o=i.attributes=new S,l=s.length;o._ownerElement=i;for(var d=0;d<l;d++)i.setAttributeNode(ye(e,s.item(d),!0));break;case u:r=!0}if(r)for(var h=t.firstChild;h;)i.appendChild(ye(e,h,r)),h=h.nextSibling;return i}function ke(e,t,r){e[t]=r}T.INVALID_STATE_ERR=(w[11]="Invalid state",11),T.SYNTAX_ERR=(w[12]="Syntax error",12),T.INVALID_MODIFICATION_ERR=(w[13]="Invalid modification",13),T.NAMESPACE_ERR=(w[14]="Invalid namespace",14),T.INVALID_ACCESS_ERR=(w[15]="Invalid access",15),R.prototype=Error.prototype,s(T,R),L.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t){for(var r=[],i=0;i<this.length;i++)ve(this[i],r,e,t);return r.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},C.prototype.item=function(e){return x(this),this[e]||null},o(C,L),S.prototype={length:0,item:L.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new R(E);var r=this.getNamedItem(e.nodeName);return I(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t,r=e.ownerElement;if(r&&r!=this._ownerElement)throw new R(E);return t=this.getNamedItemNS(e.namespaceURI,e.localName),I(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return O(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return O(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var i=this[r];if(i.localName==t&&i.namespaceURI==e)return i}return null}},U.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var i=new q;if(i.implementation=this,i.childNodes=new L,i.doctype=r||null,r&&i.appendChild(r),t){var n=i.createElementNS(e,t);i.appendChild(n)}return i},createDocumentType:function(e,t,r){var i=new ne;return i.name=e,i.nodeName=e,i.publicId=t||"",i.systemId=r||"",i}},P.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return Y(this,e,t)},replaceChild:function(e,t){Y(this,e,t,$),t&&this.removeChild(t)},removeChild:function(e){return _(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return ye(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==d&&e.nodeType==d?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r)for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)&&r[i]===e)return i;t=t.nodeType==u?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,e))return r[e];t=t.nodeType==u?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},s(l,P),s(l,P.prototype),q.prototype={nodeName:"#document",nodeType:v,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==y){for(var r=e.firstChild;r;){var i=r.nextSibling;this.insertBefore(r,t),r=i}return e}return Y(this,e,t),Q(e,this),null===this.documentElement&&e.nodeType===c&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),_(this,e)},replaceChild:function(e,t){Y(this,e,t,$),Q(e,this),t&&this.removeChild(t),W(e)&&(this.documentElement=e)},importNode:function(e,t){return be(this,e,t)},getElementById:function(e){var t=null;return B(this.documentElement,function(r){if(r.nodeType==c&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=a(e);return new C(this,function(r){var i=[];return t.length>0&&B(r.documentElement,function(n){if(n!==r&&n.nodeType===c){var s=n.getAttribute("class");if(s){var o=e===s;if(!o){var l=a(s);o=t.every((u=l,function(e){return u&&-1!==u.indexOf(e)}))}o&&i.push(n)}}var u}),i})},createElement:function(e){var t=new J;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new L,(t.attributes=new S)._ownerElement=t,t},createDocumentFragment:function(){var e=new de;return e.ownerDocument=this,e.childNodes=new L,e},createTextNode:function(e){var t=new te;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new re;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new ie;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new he;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new Z;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new ce;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new J,i=t.split(":"),n=r.attributes=new S;return r.childNodes=new L,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=t,n._ownerElement=r,r},createAttributeNS:function(e,t){var r=new Z,i=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=t,r}},o(q,P),J.prototype={nodeType:c,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===y?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,F(e.ownerDocument,e,t),Q(t,e.ownerDocument||e),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var i=this.ownerDocument.createAttributeNS(e,t);i.value=i.nodeValue=""+r,this.setAttributeNode(i)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new C(this,function(t){var r=[];return B(t,function(i){i===t||i.nodeType!=c||"*"!==e&&i.tagName!=e||r.push(i)}),r})},getElementsByTagNameNS:function(e,t){return new C(this,function(r){var i=[];return B(r,function(n){n===r||n.nodeType!==c||"*"!==e&&n.namespaceURI!==e||"*"!==t&&n.localName!=t||i.push(n)}),i})}},q.prototype.getElementsByTagName=J.prototype.getElementsByTagName,q.prototype.getElementsByTagNameNS=J.prototype.getElementsByTagNameNS,o(J,P),Z.prototype.nodeType=u,o(Z,P),ee.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(w[A])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){r=this.data.substring(0,e)+r+this.data.substring(e+t),this.nodeValue=this.data=r,this.length=r.length}},o(ee,P),te.prototype={nodeName:"#text",nodeType:d,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var i=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},o(te,ee),re.prototype={nodeName:"#comment",nodeType:g},o(re,ee),ie.prototype={nodeName:"#cdata-section",nodeType:h},o(ie,ee),ne.prototype.nodeType=b,o(ne,P),ae.prototype.nodeType=k,o(ae,P),oe.prototype.nodeType=m,o(oe,P),ce.prototype.nodeType=p,o(ce,P),de.prototype.nodeName="#document-fragment",de.prototype.nodeType=y,o(de,P),he.prototype.nodeType=f,o(he,P),pe.prototype.serializeToString=function(e,t,r){return me.call(e,t,r)},P.prototype.toString=me;try{if(Object.defineProperty){function Te(e){switch(e.nodeType){case c:case y:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(Te(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(C.prototype,"length",{get:function(){return x(this),this.$$length}}),Object.defineProperty(P.prototype,"textContent",{get:function(){return Te(this)},set:function(e){switch(this.nodeType){case c:case y:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),ke=function(e,t,r){e["$$"+t]=r}}}catch(we){}return le.DocumentType=ne,le.DOMException=R,le.DOMImplementation=U,le.Element=J,le.Node=P,le.NodeList=L,le.XMLSerializer=pe,le}var he,pe={},me={};function fe(){return he||(he=1,e=me,t=ue().freeze,e.XML_ENTITIES=t({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=t({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),e.entityMap=e.HTML_ENTITIES),me;var e,t}var ge,ve,be,ye={};function ke(){if(ge)return ye;ge=1;var e=ue().NAMESPACE,t=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,r=new RegExp("[\\-\\.0-9"+t.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+t.source+r.source+"*(?::"+t.source+r.source+"*)?$");function n(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,n)}function a(){}function s(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function o(t,r,i,n,a,s){function o(e,t,r){i.attributeNames.hasOwnProperty(e)&&s.fatalError("Attribute "+e+" redefined"),i.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,a),r)}for(var l,c=++r,u=0;;){var d=t.charAt(c);switch(d){case"=":if(1===u)l=t.slice(r,c),u=3;else{if(2!==u)throw new Error("attribute equal must after attrName");u=3}break;case"'":case'"':if(3===u||1===u){if(1===u&&(s.warning('attribute value must after "="'),l=t.slice(r,c)),r=c+1,!((c=t.indexOf(d,r))>0))throw new Error("attribute value no end '"+d+"' match");o(l,h=t.slice(r,c),r-1),u=5}else{if(4!=u)throw new Error('attribute value must after "="');o(l,h=t.slice(r,c),r),s.warning('attribute "'+l+'" missed start quot('+d+")!!"),r=c+1,u=5}break;case"/":switch(u){case 0:i.setTagName(t.slice(r,c));case 5:case 6:case 7:u=7,i.closed=!0;case 4:case 1:break;case 2:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),0==u&&i.setTagName(t.slice(r,c)),c;case">":switch(u){case 0:i.setTagName(t.slice(r,c));case 5:case 6:case 7:break;case 4:case 1:"/"===(h=t.slice(r,c)).slice(-1)&&(i.closed=!0,h=h.slice(0,-1));case 2:2===u&&(h=l),4==u?(s.warning('attribute "'+h+'" missed quot(")!'),o(l,h,r)):(e.isHTML(n[""])&&h.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+h+'" missed value!! "'+h+'" instead!!'),o(h,h,r));break;case 3:throw new Error("attribute value missed!!")}return c;case"":d=" ";default:if(d<=" ")switch(u){case 0:i.setTagName(t.slice(r,c)),u=6;break;case 1:l=t.slice(r,c),u=2;break;case 4:var h=t.slice(r,c);s.warning('attribute "'+h+'" missed quot(")!!'),o(l,h,r);case 5:u=6}else switch(u){case 2:e.isHTML(n[""])&&l.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),o(l,l,r),r=c,u=1;break;case 5:s.warning('attribute space is required"'+l+'"!!');case 6:u=1,r=c;break;case 3:u=4,r=c;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function l(t,r,i){for(var n=t.tagName,a=null,s=t.length;s--;){var o=t[s],l=o.qName,c=o.value;if((m=l.indexOf(":"))>0)var u=o.prefix=l.slice(0,m),h=l.slice(m+1),p="xmlns"===u&&h;else h=l,u=null,p="xmlns"===l&&"";o.localName=h,!1!==p&&(null==a&&(a={},d(i,i={})),i[p]=a[p]=c,o.uri=e.XMLNS,r.startPrefixMapping(p,c))}for(s=t.length;s--;){(u=(o=t[s]).prefix)&&("xml"===u&&(o.uri=e.XML),"xmlns"!==u&&(o.uri=i[u||""]))}var m;(m=n.indexOf(":"))>0?(u=t.prefix=n.slice(0,m),h=t.localName=n.slice(m+1)):(u=null,h=t.localName=n);var f=t.uri=i[u||""];if(r.startElement(f,h,n,t),!t.closed)return t.currentNSMap=i,t.localNSMap=a,!0;if(r.endElement(f,h,n),a)for(u in a)Object.prototype.hasOwnProperty.call(a,u)&&r.endPrefixMapping(u)}function c(e,t,r,i,n){if(/^(?:script|textarea)$/i.test(r)){var a=e.indexOf("</"+r+">",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(r)?(n.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,i),n.characters(s,0,s.length),a)}return t+1}function u(e,t,r,i){var n=i[r];return null==n&&((n=e.lastIndexOf("</"+r+">"))<t&&(n=e.lastIndexOf("</"+r)),i[r]=n),n<t}function d(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function h(e,t,r,i){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(n=e.indexOf("--\x3e",t+4))>t?(r.comment(e,t+4,n-t-4),n+3):(i.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var n=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,n-t-9),r.endCDATA(),n+3}var a=function(e,t){var r,i=[],n=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;n.lastIndex=t,n.exec(e);for(;r=n.exec(e);)if(i.push(r),r[1])return i}(e,t),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var o=a[1][0],l=!1,c=!1;s>3&&(/^public$/i.test(a[2][0])?(l=a[3][0],c=s>4&&a[4][0]):/^system$/i.test(a[2][0])&&(c=a[3][0]));var u=a[s-1];return r.startDTD(o,l,c),r.endDTD(),u.index+u[0].length}return-1}function p(e,t,r){var i=e.indexOf("?>",t);if(i){var n=e.substring(t,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return n?(r.processingInstruction(n[1],n[2]),i+2):-1}return-1}function m(){this.attributeNames={}}return n.prototype=new Error,n.prototype.name=n.name,a.prototype={parse:function(t,r,i){var a=this.domBuilder;a.startDocument(),d(r,r={}),function(t,r,i,a,d){function f(e){if(e>65535){var t=55296+((e-=65536)>>10),r=56320+(1023&e);return String.fromCharCode(t,r)}return String.fromCharCode(e)}function g(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(i,t)?i[t]:"#"===t.charAt(0)?f(parseInt(t.substr(1).replace("x","0x"))):(d.error("entity not found:"+e),e)}function v(e){if(e>E){var r=t.substring(E,e).replace(/&#?\w+;/g,g);w&&b(E),a.characters(r,0,e-E),E=e}}function b(e,r){for(;e>=k&&(r=T.exec(t));)y=r.index,k=y+r[0].length,w.lineNumber++;w.columnNumber=e-y+1}var y=0,k=0,T=/.*(?:\r\n?|\n)|.*$/g,w=a.locator,A=[{currentNSMap:r}],N={},E=0;for(;;){try{var R=t.indexOf("<",E);if(R<0){if(!t.substr(E).match(/^\s*$/)){var L=a.doc,C=L.createTextNode(t.substr(E));L.appendChild(C),a.currentElement=C}return}switch(R>E&&v(R),t.charAt(R+1)){case"/":var x=t.indexOf(">",R+3),S=t.substring(R+2,x).replace(/[ \t\n\r]+$/g,""),D=A.pop();x<0?(S=t.substring(R+2).replace(/[\s<].*/,""),d.error("end tag name: "+S+" is not complete:"+D.tagName),x=R+1+S.length):S.match(/\s</)&&(S=S.replace(/[\s<].*/,""),d.error("end tag name: "+S+" maybe not complete"),x=R+1+S.length);var I=D.localNSMap,O=D.tagName==S;if(O||D.tagName&&D.tagName.toLowerCase()==S.toLowerCase()){if(a.endElement(D.uri,D.localName,S),I)for(var U in I)Object.prototype.hasOwnProperty.call(I,U)&&a.endPrefixMapping(U);O||d.fatalError("end tag name: "+S+" is not match the current start tagName:"+D.tagName)}else A.push(D);x++;break;case"?":w&&b(R),x=p(t,R,a);break;case"!":w&&b(R),x=h(t,R,a,d);break;default:w&&b(R);var P=new m,M=A[A.length-1].currentNSMap,B=(x=o(t,R,P,M,g,d),P.length);if(!P.closed&&u(t,x,P.tagName,N)&&(P.closed=!0,i.nbsp||d.warning("unclosed xml attribute")),w&&B){for(var q=s(w,{}),V=0;V<B;V++){var F=P[V];b(F.offset),F.locator=s(w,{})}a.locator=q,l(P,a,M)&&A.push(P),a.locator=w}else l(P,a,M)&&A.push(P);e.isHTML(P.uri)&&!P.closed?x=c(t,x,P.tagName,g,a):x++}}catch(e){if(e instanceof n)throw e;d.error("element parse error: "+e),x=-1}x>E?E=x:v(Math.max(R,E)+1)}}(t,r,i,a,this.errorHandler),a.endDocument()}},m.prototype={setTagName:function(e){if(!i.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!i.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},ye.XMLReader=a,ye.ParseError=n,ye}function Te(){if(ve)return pe;ve=1;var e=ue(),t=de(),r=fe(),i=ke(),n=t.DOMImplementation,a=e.NAMESPACE,s=i.ParseError,o=i.XMLReader;function l(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function c(e){this.options=e||{locator:{}}}function u(){this.cdata=!1}function d(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function h(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function p(e,t,r){return"string"==typeof e?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}function m(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}return c.prototype.parseFromString=function(e,t){var i=this.options,n=new o,s=i.domBuilder||new u,c=i.errorHandler,d=i.locator,p=i.xmlns||{},m=/\/x?html?$/.test(t),f=m?r.HTML_ENTITIES:r.XML_ENTITIES;d&&s.setDocumentLocator(d),n.errorHandler=function(e,t,r){if(!e){if(t instanceof u)return t;e=t}var i={},n=e instanceof Function;function a(t){var a=e[t];!a&&n&&(a=2==e.length?function(r){e(t,r)}:e),i[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+h(r))}||function(){}}return r=r||{},a("warning"),a("error"),a("fatalError"),i}(c,s,d),n.domBuilder=i.domBuilder||s,m&&(p[""]=a.HTML),p.xml=p.xml||a.XML;var g=i.normalizeLineEndings||l;return e&&"string"==typeof e?n.parse(g(e),p,f):n.errorHandler.error("invalid doc source"),s.doc},u.prototype={startDocument:function(){this.doc=(new n).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,i){var n=this.doc,a=n.createElementNS(e,r||t),s=i.length;m(this,a),this.currentElement=a,this.locator&&d(this.locator,a);for(var o=0;o<s;o++){e=i.getURI(o);var l=i.getValue(o),c=(r=i.getQName(o),n.createAttributeNS(e,r));this.locator&&d(i.getLocator(o),c),c.value=c.nodeValue=l,a.setAttributeNode(c)}},endElement:function(e,t,r){var i=this.currentElement;this.currentElement=i.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&d(this.locator,r),m(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=p.apply(this,arguments)){if(this.cdata)var i=this.doc.createCDATASection(e);else i=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(e)&&this.doc.appendChild(i),this.locator&&d(this.locator,i)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=p.apply(this,arguments);var i=this.doc.createComment(e);this.locator&&d(this.locator,i),m(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var i=this.doc.implementation;if(i&&i.createDocumentType){var n=i.createDocumentType(e,t,r);this.locator&&d(this.locator,n),m(this,n),this.doc.doctype=n}},warning:function(e){console.warn("[xmldom warning]\t"+e,h(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,h(this.locator))},fatalError:function(e){throw new s(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){u.prototype[e]=function(){return null}}),pe.__DOMHandler=u,pe.normalizeLineEndings=l,pe.DOMParser=c,pe}function we(){if(be)return oe;be=1;var e=de();return oe.DOMImplementation=e.DOMImplementation,oe.XMLSerializer=e.XMLSerializer,oe.DOMParser=Te().DOMParser,oe}var Ae=we(),Ne=t({__proto__:null,default:ne(Ae)},[Ae])});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@openplayerjs/core")):"function"==typeof define&&define.amd?define(["@openplayerjs/core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).OpenPlayerJS)}(this,function(e){"use strict";function t(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adId:e.adId||null,sequence:e.sequence||null,apiFramework:e.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}const i=["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"];function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=[],n=o(e);!t.ERRORCODE||r.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=h(Math.round(1e8*Math.random())),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING;for(const e in t)t[e]=d(t[e]);for(const e in n){const r=n[e];"string"==typeof r&&i.push(a(r,t))}return i}function a(e,t){const r=(e=s(e,t)).match(/[^[\]]+(?=])/g);if(!r)return e;let n=r.filter(e=>i.indexOf(e)>-1);return 0===n.length?e:(n=n.reduce((e,t)=>(e[t]=-1,e),{}),s(e,n))}function s(e,t){let r=e;for(const e in t){const i=t[e];r=r.replace(new RegExp("(?:\\[|%%)(".concat(e,")(?:\\]|%%)"),"g"),i)}return r}function o(e){return Array.isArray(e)?e.map(e=>e&&e.hasOwnProperty("url")?e.url:e):e}function l(e){return/^(https?:\/\/|\/\/)/.test(e)}function c(e,t){for(let r=0;r<t.length;r++)if(u(t[r],e))return!0;return!1}function u(e,t){if(e&&t){const r=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);return r.length===i.length&&e.id===t.id&&e.url===t.url}return!1}function d(e){return encodeURIComponent(e).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.toString().padStart(t,"0")}const p={track:function(e,t,r){n(e,t,r).forEach(e=>{"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:n,extractURLsFromTemplates:o,filterUrlTemplates:function(e){return e.reduce((e,t)=>{const r=t.url||t;return l(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:c,isTemplateObjectEqual:u,encodeURIComponentRFC3986:d,replaceUrlMacros:a,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce((t,r)=>t.concat(Array.isArray(r)?e(r):r),[])},joinArrayOfUniqueTemplateObjs:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[];return r.concat(i).reduce((e,t)=>(c(t,e)||e.push(t),e),[])},isValidTimeValue:function(e){return Number.isFinite(e)&&e>=-2},addLeadingZeros:h,isValidUrl:l,isBrowserEnvironment:function(){return"undefined"!=typeof window},formatMacrosValues:function(e){return"object"!=typeof e?e:JSON.stringify(e)}};function m(e){return["true","TRUE","True","1"].includes(e)}const f={childByName:function(e,t){return Array.from(e.childNodes).find(e=>e.nodeName===t)},childrenByName:function(e,t){return Array.from(e.childNodes).filter(e=>e.nodeName===t)},resolveVastAdTagURI:function(e,t){if(!t)return e;if(e.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(e)}if(!e.includes("://")){const r=t.slice(0,t.lastIndexOf("/"));return"".concat(r,"/").concat(e)}return e},parseBoolean:m,parseNodeText:function(e){return e&&(e.textContent||e.text||"").trim()},copyNodeAttribute:function(e,t,r){const i=t.getAttribute(e);i&&r.setAttribute(e,i)},parseAttributes:function(e){return Array.from(e.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:function(e){if(null==e)return-1;if(p.isNumeric(e))return parseInt(e);const t=e.split(":");if(3!==t.length)return-1;const r=t[2].split(".");let i=parseInt(r[0]);2===r.length&&(i+=parseFloat("0.".concat(r[1])));const n=parseInt(60*t[1]),a=parseInt(60*t[0]*60);return isNaN(a)||isNaN(n)||isNaN(i)||n>3600||i>60?-1:a+n+i},getStandAloneAds:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>!parseInt(e.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>parseInt(e.sequence,10)).sort((e,t)=>e.sequence-t.sequence)},assignAttributes:function(e,t){e&&Array.from(e).forEach(e=>{let{nodeName:r,nodeValue:i}=e;if(r&&i&&t.hasOwnProperty(r)){let e=i;"boolean"==typeof t[r]&&(e=m(e)),t[r]=e}})},mergeWrapperAdData:function(e,t){var r;e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),t.viewableImpression.length>0&&(e.viewableImpression=[...e.viewableImpression,...t.viewableImpression]),e.followAdditionalWrappers=t.followAdditionalWrappers,e.allowMultipleAds=t.allowMultipleAds,e.fallbackOnNoAd=t.fallbackOnNoAd;const i=(t.creatives||[]).filter(e=>e&&"companion"===e.type),n=i.reduce((e,t)=>((t.variations||[]).forEach(t=>{(t.companionClickTrackingURLTemplates||[]).forEach(t=>{p.containsTemplateObject(t,e)||e.push(t)})}),e),[]);e.creatives=i.concat(e.creatives);const a=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,s=t.videoCustomClickURLTemplates&&t.videoCustomClickURLTemplates.length;if(e.creatives.forEach(e=>{if(t.trackingEvents&&t.trackingEvents[e.type])for(const r in t.trackingEvents[e.type]){const i=t.trackingEvents[e.type][r];Array.isArray(e.trackingEvents[r])||(e.trackingEvents[r]=[]),e.trackingEvents[r]=e.trackingEvents[r].concat(i)}"linear"===e.type&&(a&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),s&&(e.videoCustomClickURLTemplates=e.videoCustomClickURLTemplates.concat(t.videoCustomClickURLTemplates)),!t.videoClickThroughURLTemplate||null!==e.videoClickThroughURLTemplate&&void 0!==e.videoClickThroughURLTemplate||(e.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate)),"companion"===e.type&&n.length&&(e.variations||[]).forEach(e=>{e.companionClickTrackingURLTemplates=p.joinArrayOfUniqueTemplateObjs(e.companionClickTrackingURLTemplates,n)})}),t.adVerifications&&(e.adVerifications=e.adVerifications.concat(t.adVerifications)),t.blockedAdCategories&&(e.blockedAdCategories=e.blockedAdCategories.concat(t.blockedAdCategories)),null!==(r=t.creatives)&&void 0!==r&&r.length){const r=t.creatives.filter(e=>{var t;return(null===(t=e.icons)||void 0===t?void 0:t.length)&&!e.mediaFiles.length});r.length&&(e.creatives=e.creatives.concat(r))}}};function g(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:i,sequence:n,apiFramework:a}=r(e);return{id:t,adId:i,sequence:n,apiFramework:a,type:"companion",required:null,variations:[]}}(t);return i.required=e.getAttribute("required")||null,i.variations=f.childrenByName(e,"Companion").map(e=>{const t=function(){let 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||null,pxratio:e.pxratio||"1",renderingMode:e.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(f.parseAttributes(e));t.htmlResources=f.childrenByName(e,"HTMLResource").reduce((e,t)=>{const r=f.parseNodeText(t);return r?e.concat(r):e},[]),t.iframeResources=f.childrenByName(e,"IFrameResource").reduce((e,t)=>{const r=f.parseNodeText(t);return r?e.concat(r):e},[]),t.staticResources=f.childrenByName(e,"StaticResource").reduce((e,t)=>{const r=f.parseNodeText(t);return r?e.concat({url:r,creativeType:t.getAttribute("creativeType")||null}):e},[]),t.altText=f.parseNodeText(f.childByName(e,"AltText"))||null;const r=f.childByName(e,"TrackingEvents");r&&f.childrenByName(r,"Tracking").forEach(e=>{const r=e.getAttribute("event"),i=f.parseNodeText(e);r&&i&&(Array.isArray(t.trackingEvents[r])||(t.trackingEvents[r]=[]),t.trackingEvents[r].push(i))}),t.companionClickTrackingURLTemplates=f.childrenByName(e,"CompanionClickTracking").map(e=>({id:e.getAttribute("id")||null,url:f.parseNodeText(e)})),t.companionClickThroughURLTemplate=f.parseNodeText(f.childByName(e,"CompanionClickThrough"))||null;const i=f.childByName(e,"AdParameters");return i&&(t.adParameters={value:f.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t}),i}function v(e,t){let i;const n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:i,sequence:n,apiFramework:a}=r(e);return{id:t,adId:i,sequence:n,apiFramework:a,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(t);n.duration=f.parseDuration(f.parseNodeText(f.childByName(e,"Duration")));const a=e.getAttribute("skipoffset");if(null==a)n.skipDelay=null;else if("%"===a.charAt(a.length-1)&&-1!==n.duration){const e=parseInt(a,10);n.skipDelay=n.duration*(e/100)}else n.skipDelay=f.parseDuration(a);const s=f.childByName(e,"VideoClicks");if(s){const e=f.childByName(s,"ClickThrough");n.videoClickThroughURLTemplate=e?{id:e.getAttribute("id")||null,url:f.parseNodeText(e)}:null,f.childrenByName(s,"ClickTracking").forEach(e=>{n.videoClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:f.parseNodeText(e)})}),f.childrenByName(s,"CustomClick").forEach(e=>{n.videoCustomClickURLTemplates.push({id:e.getAttribute("id")||null,url:f.parseNodeText(e)})})}const o=f.childByName(e,"AdParameters");o&&(n.adParameters={value:f.parseNodeText(o),xmlEncoded:o.getAttribute("xmlEncoded")||null}),f.childrenByName(e,"TrackingEvents").forEach(e=>{f.childrenByName(e,"Tracking").forEach(e=>{let t=e.getAttribute("event");const r=f.parseNodeText(e);if(t&&r){if("progress"===t){if(i=e.getAttribute("offset"),!i)return;t="%"===i.charAt(i.length-1)?"progress-".concat(i):"progress-".concat(f.parseDuration(i))}Array.isArray(n.trackingEvents[t])||(n.trackingEvents[t]=[]),n.trackingEvents[t].push(r)}})}),f.childrenByName(e,"MediaFiles").forEach(e=>{f.childrenByName(e,"MediaFile").forEach(e=>{n.mediaFiles.push(function(e){const t={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};t.id=e.getAttribute("id"),t.fileURL=f.parseNodeText(e),t.deliveryType=e.getAttribute("delivery"),t.codec=e.getAttribute("codec"),t.mimeType=e.getAttribute("type"),t.mediaType=e.getAttribute("mediaType")||"2D",t.apiFramework=e.getAttribute("apiFramework"),t.fileSize=parseInt(e.getAttribute("fileSize")||0),t.bitrate=parseInt(e.getAttribute("bitrate")||0),t.minBitrate=parseInt(e.getAttribute("minBitrate")||0),t.maxBitrate=parseInt(e.getAttribute("maxBitrate")||0),t.width=parseInt(e.getAttribute("width")||0),t.height=parseInt(e.getAttribute("height")||0);const r=e.getAttribute("scalable");r&&"string"==typeof r&&(t.scalable=f.parseBoolean(r));const i=e.getAttribute("maintainAspectRatio");return i&&"string"==typeof i&&(t.maintainAspectRatio=f.parseBoolean(i)),t}(e))});const t=f.childByName(e,"InteractiveCreativeFile");t&&(n.interactiveCreativeFile=function(e){const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,apiFramework:e.apiFramework||null,variableDuration:f.parseBoolean(e.variableDuration),fileURL:null}}(f.parseAttributes(e));return t.fileURL=f.parseNodeText(e),t}(t));const r=f.childByName(e,"ClosedCaptionFiles");r&&f.childrenByName(r,"ClosedCaptionFile").forEach(e=>{const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,language:e.language||null,fileURL:null}}(f.parseAttributes(e));t.fileURL=f.parseNodeText(e),n.closedCaptionFiles.push(t)});const i=f.childByName(e,"Mezzanine"),a=function(e){const t={};let r=!1;return["delivery","type","width","height"].forEach(i=>{e&&e.getAttribute(i)?t[i]=e.getAttribute(i):r=!0}),r?null:t}(i);if(a){const e={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};e.id=i.getAttribute("id"),e.fileURL=f.parseNodeText(i),e.delivery=a.delivery,e.codec=i.getAttribute("codec"),e.type=a.type,e.width=parseInt(a.width,10),e.height=parseInt(a.height,10),e.fileSize=parseInt(i.getAttribute("fileSize"),10),e.mediaType=i.getAttribute("mediaType")||"2D",n.mezzanine=e}});const l=f.childByName(e,"Icons");return l&&f.childrenByName(l,"Icon").forEach(e=>{n.icons.push(function(e){const t={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,iconClickFallbackImages:[],altText:null,hoverText:null};t.program=e.getAttribute("program"),t.height=parseInt(e.getAttribute("height")||0),t.width=parseInt(e.getAttribute("width")||0),t.xPosition=function(e){return-1!==["left","right"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("xPosition")),t.yPosition=function(e){return-1!==["top","bottom"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("yPosition")),t.apiFramework=e.getAttribute("apiFramework"),t.pxratio=e.getAttribute("pxratio")||"1",t.offset=f.parseDuration(e.getAttribute("offset")),t.duration=f.parseDuration(e.getAttribute("duration")),t.altText=e.getAttribute("altText"),t.hoverText=e.getAttribute("hoverText"),f.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=f.parseNodeText(e)}),f.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=f.parseNodeText(e)}),f.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=f.parseNodeText(e)});const r=f.childByName(e,"IconClicks");if(r){t.iconClickThroughURLTemplate=f.parseNodeText(f.childByName(r,"IconClickThrough")),f.childrenByName(r,"IconClickTracking").forEach(e=>{t.iconClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:f.parseNodeText(e)})});const e=f.childByName(r,"IconClickFallbackImages");e&&f.childrenByName(e,"IconClickFallbackImage").forEach(e=>{t.iconClickFallbackImages.push({url:f.parseNodeText(e)||null,width:e.getAttribute("width")||null,height:e.getAttribute("height")||null})})}return t.iconViewTrackingURLTemplate=f.parseNodeText(f.childByName(e,"IconViewTracking")),t}(e))}),n}function b(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:i,sequence:n,apiFramework:a}=r(e);return{id:t,adId:i,sequence:n,apiFramework:a,type:"nonlinear",variations:[],trackingEvents:{}}}(t);return f.childrenByName(e,"TrackingEvents").forEach(e=>{let t,r;f.childrenByName(e,"Tracking").forEach(e=>{t=e.getAttribute("event"),r=f.parseNodeText(e),t&&r&&(Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(r))})}),f.childrenByName(e,"NonLinear").forEach(e=>{const 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=f.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=f.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=f.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),f.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=f.parseNodeText(e)}),f.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=f.parseNodeText(e)}),f.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=f.parseNodeText(e)});const r=f.childByName(e,"AdParameters");r&&(t.adParameters={value:f.parseNodeText(r),xmlEncoded:r.getAttribute("xmlEncoded")||null}),t.nonlinearClickThroughURLTemplate=f.parseNodeText(f.childByName(e,"NonLinearClickThrough")),f.childrenByName(e,"NonLinearClickTracking").forEach(e=>{t.nonlinearClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:f.parseNodeText(e)})}),i.variations.push(t)}),i}function y(e){const t=[];return e.forEach(e=>{const r=k(e);r&&t.push(r)}),t}function k(e){if("#comment"===e.nodeName)return null;const t={name:null,value:null,attributes:{},children:[]},r=e.attributes,i=e.childNodes;if(t.name=e.nodeName,e.attributes)for(const e in r)if(r.hasOwnProperty(e)){const i=r[e];i.nodeName&&i.nodeValue&&(t.attributes[i.nodeName]=i.nodeValue)}for(const e in i)if(i.hasOwnProperty(e)){const r=k(i[e]);r&&t.children.push(r)}if(0===t.children.length||1===t.children.length&&["#cdata-section","#text"].indexOf(t.children[0].name)>=0){const r=f.parseNodeText(e);""!==r&&(t.value=r),t.children=[]}return null===(n=t).value&&0===Object.keys(n.attributes).length&&0===n.children.length?null:t;var n}function T(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}const A={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 w(e,t){if(!A[e.nodeName]||!A[e.nodeName].attributes)return;const r=A[e.nodeName].attributes.filter(t=>!e.getAttribute(t));r.length>0&&R({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:r},t)}function N(e,t,r){const i=A[e.nodeName],n=!r&&"Wrapper"!==e.nodeName;if(i&&!n){if(i.subElements){const r=i.subElements.filter(t=>!f.childByName(e,t));r.length>0&&R({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:r},t)}r&&i.oneOfinLineResources&&(i.oneOfinLineResources.some(t=>f.childByName(e,t))||R({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},t))}}function E(e){return e.children&&0!==e.children.length}function R(e,t){let{name:r,parentName:i,attributes:n,subElements:a,oneOfResources:s}=e,o="Element '".concat(r,"'");o+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):a?" missing required sub element(s) '".concat(a.join(", "),"' "):s?" must provide one of the following '".concat(s.join(", "),"' "):" is empty",t("VAST-warning",{message:o,parentElement:i,specVersion:4.1})}const L=function e(t,r,i){if(t&&t.nodeName)if("InLine"===t.nodeName&&(i=!0),w(t,r),E(t)){N(t,r,i);for(let n=0;n<t.children.length;n++)e(t.children[n],r,i)}else 0===f.parseNodeText(t).length&&R({name:t.nodeName,parentName:t.parentNode.nodeName},r)};function C(e,t){let{allowMultipleAds:r,followAdditionalWrappers:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=Array.from(e.childNodes).filter(e=>{const t=e.nodeName.toLowerCase();return"inline"===t||!1!==i&&"wrapper"===t});for(const i of n){if(f.copyNodeAttribute("id",e,i),f.copyNodeAttribute("sequence",e,i),f.copyNodeAttribute("adType",e,i),"Wrapper"===i.nodeName)return{ad:D(i,t),type:"WRAPPER"};if("InLine"===i.nodeName)return{ad:x(i,t,{allowMultipleAds:r}),type:"INLINE"};const n=i.nodeName.toLowerCase();t("VAST-warning",{message:"<".concat(i.nodeName,"inline"===n?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:i})}}function x(e,t){let{allowMultipleAds:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return!1===r&&e.getAttribute("sequence")?null:S(e,t)}function S(e,t){let r=[];t&&L(e,t);const i=Array.from(e.childNodes),n=function(){let 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}}(f.parseAttributes(e));return i.forEach(e=>{switch(e.nodeName){case"Error":n.errorURLTemplates.push(f.parseNodeText(e));break;case"Impression":n.impressionURLTemplates.push({id:e.getAttribute("id")||null,url:f.parseNodeText(e)});break;case"Creatives":n.creatives=function(e){const t=[];return e.forEach(e=>{const r={id:e.getAttribute("id")||null,adId:T(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null},i=[];let n;f.childrenByName(e,"UniversalAdId").forEach(e=>{const t={idRegistry:e.getAttribute("idRegistry")||"unknown",value:f.parseNodeText(e)};i.push(t)});const a=f.childByName(e,"CreativeExtensions");a&&(n=y(f.childrenByName(a,"CreativeExtension")));for(const a in e.childNodes){const s=e.childNodes[a];let o;switch(s.nodeName){case"Linear":o=v(s,r);break;case"NonLinearAds":o=b(s,r);break;case"CompanionAds":o=g(s,r)}o&&(i&&(o.universalAdIds=i),n&&(o.creativeExtensions=n),t.push(o))}}),t}(f.childrenByName(e,"Creative"));break;case"Extensions":{const t=f.childrenByName(e,"Extension");n.extensions=y(t),n.adVerifications.length||(r=function(e){let t=null,r=[];return e.some(e=>t=f.childByName(e,"AdVerifications")),t&&(r=I(f.childrenByName(t,"Verification"))),r}(t));break}case"AdVerifications":n.adVerifications=I(f.childrenByName(e,"Verification"));break;case"AdSystem":n.system={value:f.parseNodeText(e),version:e.getAttribute("version")||null};break;case"AdTitle":n.title=f.parseNodeText(e);break;case"AdServingId":n.adServingId=f.parseNodeText(e);break;case"Category":n.categories.push({authority:e.getAttribute("authority")||null,value:f.parseNodeText(e)});break;case"Expires":n.expires=parseInt(f.parseNodeText(e),10);break;case"ViewableImpression":n.viewableImpression.push(function(e){const t=(e,t)=>{const r=f.parseNodeText(t);return r&&e.push(r),e};return{id:e.getAttribute("id")||null,viewable:f.childrenByName(e,"Viewable").reduce(t,[]),notViewable:f.childrenByName(e,"NotViewable").reduce(t,[]),viewUndetermined:f.childrenByName(e,"ViewUndetermined").reduce(t,[])}}(e));break;case"Description":n.description=f.parseNodeText(e);break;case"Advertiser":n.advertiser={id:e.getAttribute("id")||null,value:f.parseNodeText(e)};break;case"Pricing":n.pricing={value:f.parseNodeText(e),model:e.getAttribute("model")||null,currency:e.getAttribute("currency")||null};break;case"Survey":n.survey={value:f.parseNodeText(e),type:e.getAttribute("type")||null};break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:e.getAttribute("authority")||null,value:f.parseNodeText(e)})}}),r.length&&(n.adVerifications=n.adVerifications.concat(r)),n}function D(e,t){const r=S(e,t),i=e.getAttribute("followAdditionalWrappers"),n=e.getAttribute("allowMultipleAds"),a=e.getAttribute("fallbackOnNoAd");r.followAdditionalWrappers=!i||f.parseBoolean(i),r.allowMultipleAds=!!n&&f.parseBoolean(n),r.fallbackOnNoAd=a?f.parseBoolean(a):null;let s=f.childByName(e,"VASTAdTagURI");if(s?r.nextWrapperURL=f.parseNodeText(s):(s=f.childByName(e,"VASTAdTagURL"),s&&(r.nextWrapperURL=f.parseNodeText(f.childByName(s,"URL")))),r.creatives.forEach(e=>{if(["linear","nonlinear"].includes(e.type)){if(e.trackingEvents){r.trackingEvents||(r.trackingEvents={}),r.trackingEvents[e.type]||(r.trackingEvents[e.type]={});for(const t in e.trackingEvents){const i=e.trackingEvents[t];Array.isArray(r.trackingEvents[e.type][t])||(r.trackingEvents[e.type][t]=[]),i.forEach(i=>{r.trackingEvents[e.type][t].push(i)})}}e.videoClickTrackingURLTemplates&&(Array.isArray(r.videoClickTrackingURLTemplates)||(r.videoClickTrackingURLTemplates=[]),e.videoClickTrackingURLTemplates.forEach(e=>{r.videoClickTrackingURLTemplates.push(e)})),e.videoClickThroughURLTemplate&&(r.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate),e.videoCustomClickURLTemplates&&(Array.isArray(r.videoCustomClickURLTemplates)||(r.videoCustomClickURLTemplates=[]),e.videoCustomClickURLTemplates.forEach(e=>{r.videoCustomClickURLTemplates.push(e)}))}}),r.nextWrapperURL)return r}function I(e){const t=[];return e.forEach(e=>{const r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},i=Array.from(e.childNodes);f.assignAttributes(e.attributes,r),i.forEach(e=>{let{nodeName:t,textContent:i,attributes:n}=e;switch(t){case"JavaScriptResource":case"ExecutableResource":r.resource=i.trim(),f.assignAttributes(n,r);break;case"VerificationParameters":r.parameters=i.trim()}});const n=f.childByName(e,"TrackingEvents");n&&f.childrenByName(n,"Tracking").forEach(e=>{const t=e.getAttribute("event"),i=f.parseNodeText(e);t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))}),t.push(r)}),t}class O{constructor(){this._handlers=[]}on(e,t){if("function"!=typeof t)throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(e,t,r){const i={fired:!1,wrapFn:void 0};function n(){i.fired||(e.off(t,i.wrapFn),i.fired=!0,r.bind(e)(...arguments))}return i.wrapFn=n,n}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(r=>r.event!==e||r.handler!==t),this}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];let n=!1;return this._handlers.forEach(t=>{"*"===t.event&&(n=!0,t.handler(e,...r)),t.event===e&&(n=!0,t.handler(...r))}),n}removeAllListeners(e){return e?(this._handlers=this._handlers.filter(t=>t.event!==e),this):(this._handlers=[],this)}listenerCount(e){return this._handlers.filter(t=>t.event===e).length}listeners(e){return this._handlers.reduce((t,r)=>(r.event===e&&t.push(r.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}}let U=0,P=0;const M=(e,t)=>{!e||!t||e<=0||t<=0||(P=(P*U+8*e/t)/++U)},q={ERRORCODE:900,extensions:[]},B="VAST response version not supported";class V extends O{constructor(){let{fetcher:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null,this.keepFailedAdPod=!1}trackVastError(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];this.emit("VAST-error",Object.assign({},q,t,...i)),p.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return P}initParsingStatus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.keepFailedAdPod=e.keepFailedAdPod||!1,this.rootURL="",this.resetParsingStatus(),M(e.byteLength,e.requestDuration)}resetParsingStatus(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}getRemainingAds(e){if(0===this.remainingAds.length)return Promise.reject(new Error("No more ads are available for the given VAST"));const t=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(t,{wrapperDepth:0,url:this.rootURL}).then(e=>this.buildVASTResponse(e))}parseVAST(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(e=>this.buildVASTResponse(e))}buildVASTResponse(e){const t=function(e){let{ads:t,errorURLTemplates:r,version:i}=e;return{ads:t||[],errorURLTemplates:r||[],version:i||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:r=!1,url:i=null,wrapperDepth:n=0,allowMultipleAds:a,followAdditionalWrappers:s}=t;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName){var o;this.emit("VAST-ad-parsed",{type:"ERROR",url:i,wrapperDepth:n});const t="VideoAdServingTemplate"===(null==e||null===(o=e.documentElement)||void 0===o?void 0:o.nodeName);throw new Error(t?B:"Invalid VAST XMLDocument")}const l=[],c=e.documentElement.childNodes,u=e.documentElement.getAttribute("version");r&&u&&(this.vastVersion=u);for(const e in c){const t=c[e];if("Error"===t.nodeName){const e=f.parseNodeText(t);r?this.rootErrorURLTemplates.push(e):this.errorURLTemplates.push(e)}else if("Ad"===t.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(!1===a&&l.length>1)break;const e=C(t,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:s});e.ad?(l.push(e.ad),this.emit("VAST-ad-parsed",{type:e.type,url:i,wrapperDepth:n,adIndex:l.length-1,vastVersion:u})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return l}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:i=null,previousUrl:n=null,wrapperDepth:a=0,isRootVAST:s=!1,followAdditionalWrappers:o,allowMultipleAds:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&s&&(l=!0);try{c=this.parseVastXml(e,{isRootVAST:s,url:t,wrapperDepth:a,allowMultipleAds:l,followAdditionalWrappers:o})}catch(e){return Promise.reject(e)}if(1===c.length&&null!=i&&(c[0].sequence=i),!1===r){const e=f.getSortedAdPods(c),t=f.getStandAloneAds(c);e.length?c=e:t.length&&(c=[t.shift()]),this.remainingAds=t}return this.resolveAds(c,{wrapperDepth:a,previousUrl:n,url:t})}resolveAds(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:i}=arguments.length>1?arguments[1]:void 0;const n=[];return r=i,e.forEach(e=>{const i=this.resolveWrappers(e,t,r);n.push(i)}),Promise.all(n).then(e=>p.flatten(e))}resolveWrappers(e,t,r){const i={...e};return new Promise(e=>{var n;if(t++,!i.nextWrapperURL)return delete i.nextWrapperURL,e(i);if(!this.fetcher)return i.VASTAdTagURI=i.nextWrapperURL,delete i.nextWrapperURL,e(i);if(t>=this.maxWrapperDepth)return i.errorCode=302,delete i.nextWrapperURL,e(i);i.nextWrapperURL=f.resolveVastAdTagURI(i.nextWrapperURL,r);const a=null!==(n=this.parsingOptions.allowMultipleAds)&&void 0!==n?n:i.allowMultipleAds,s=i.sequence;this.fetcher.fetchVAST({url:i.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(n=>this.parse(n,{url:i.nextWrapperURL,previousUrl:r,wrapperSequence:s,wrapperDepth:t,followAdditionalWrappers:i.followAdditionalWrappers,allowMultipleAds:a}).then(t=>{if(delete i.nextWrapperURL,0===t.length)return i.creatives=[],e(i);t.forEach(e=>{e&&f.mergeWrapperAdData(e,i)}),e(t)})).catch(t=>{i.errorCode=t.message===B?102:301,i.errorMessage=t.message,e(i)})})}completeWrapperResolving(e){if(0===e.ads.length)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(let t=e.ads.length-1;t>=0;t--){const r=e.ads[t],i=!r.creatives.some(e=>{var t,r;return(null===(t=e.mediaFiles)||void 0===t?void 0:t.length)>0||(null===(r=e.variations)||void 0===r?void 0:r.length)>0});!r.errorCode&&!i||r.VASTAdTagURI||(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),this.keepFailedAdPod&&r.sequence?r.hasFailed=!0:e.ads.splice(t,1))}}}let F=null;const _={data:{},length:0,getItem(e){return this.data[e]},setItem(e,t){this.data[e]=t,this.length=Object.keys(this.data).length},removeItem(e){delete this.data[e],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class j{constructor(){this.storage=this.initStorage()}initStorage(){if(F)return F;try{F="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){F=null}return F&&!this.isStorageDisabled(F)||(F=_,F.clear()),F}isStorageDisabled(e){const 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}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const W=12e4,H={get:async function(e,t){try{const r=new AbortController,i=setTimeout(()=>{throw r.abort(),new Error("URLHandler: Request timed out after ".concat(t.timeout||W," ms (408)"))},t.timeout||W),n=await fetch(e,{...t,signal:r.signal,credentials:t.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(i)}),a=function(e){return p.isBrowserEnvironment()&&"https:"===window.location.protocol&&e.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":200===e.status&&e.ok?null:"URLHandler: ".concat(e.statusText," (").concat(e.status,")")}(n);return a?{error:new Error(a),statusCode:n.status}:async function(e){const t=await e.text();let r;return r=p.isBrowserEnvironment()?new DOMParser:new((await Promise.resolve().then(function(){return Ne})).DOMParser),{xml:r.parseFromString(t,"text/xml"),details:{byteLength:t.length,statusCode:e.status,rawXml:t}}}(n)}catch(e){return{error:e,statusCode:"AbortError"===e.name?408:null}}}};class G{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||H,this.fetchingOptions={...e.fetchOptions,timeout:e.timeout||W,withCredentials:Boolean(e.withCredentials)}}addURLTemplateFilter(e){"function"==typeof e&&this.URLTemplateFilters.push(e)}removeLastURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}async fetchVAST(e){var t;let{url:r,maxWrapperDepth:i,emitter:n,wrapperDepth:a=0,previousUrl:s=null,wrapperAd:o=null}=e;const l=Date.now();this.URLTemplateFilters.forEach(e=>{r=e(r)}),n("VAST-resolving",{url:r,previousUrl:s,wrapperDepth:a,maxWrapperDepth:i,timeout:this.fetchingOptions.timeout,wrapperAd:o});const c=await this.urlHandler.get(r,this.fetchingOptions),u=Math.round(Date.now()-l);if(n("VAST-resolved",{url:r,previousUrl:s,wrapperDepth:a,error:(null==c?void 0:c.error)||null,duration:u,statusCode:(null==c?void 0:c.statusCode)||null,...null==c?void 0:c.details}),M(null==c||null===(t=c.details)||void 0===t?void 0:t.byteLength,u),c.error)throw new Error(c.error);return c.xml}}class X{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new j;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new G,this.vastParser=new V({fetcher:this.fetcher}),this.storage=r,void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)}addURLTemplateFilter(e){this.fetcher.addURLTemplateFilter(e)}removeLastURLTemplateFilter(){this.fetcher.removeLastURLTemplateFilter()}countURLTemplateFilters(){return this.fetcher.countURLTemplateFilters()}clearURLTemplateFilters(){this.fetcher.clearURLTemplateFilters()}getParser(){return this.vastParser}get lastSuccessfulAd(){return this.storage.getItem("vast-client-last-successful-ad")}set lastSuccessfulAd(e){this.storage.setItem("vast-client-last-successful-ad",e)}get totalCalls(){return this.storage.getItem("vast-client-total-calls")}set totalCalls(e){this.storage.setItem("vast-client-total-calls",e)}get totalCallsTimeout(){return this.storage.getItem("vast-client-total-calls-timeout")}set totalCallsTimeout(e){this.storage.setItem("vast-client-total-calls-timeout",e)}hasRemainingAds(){return this.vastParser.remainingAds.length>0}getNextAds(e){return this.vastParser.getRemainingAds(e)}parseVAST(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<r?(this.totalCalls=1,this.totalCallsTimeout=r+36e5):this.totalCalls++,new Promise((i,n)=>{if(this.cappingFreeLunch>=this.totalCalls)return n(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=r-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return n(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval,")ms minimum interval reached")));this.vastParser.initParsingStatus(t),this.fetcher.setOptions(t),this.vastParser.rootURL=e,this.fetcher.fetchVAST({url:e,emitter:this.vastParser.emit.bind(this.vastParser),maxWrapperDepth:this.vastParser.maxWrapperDepth}).then(r=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(r,t).then(e=>{const t=this.vastParser.buildVASTResponse(e);i(t)}))).catch(e=>n(e))})}}class z extends O{constructor(e,t,r){var i;let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=a,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const e in this.creative.trackingEvents){const t=this.creative.trackingEvents[e];this.trackingEvents[e]=t.slice(0)}this.viewableImpressionTrackers=(null===(i=this.ad.viewableImpression)||void 0===i?void 0:i.reduce((e,t)=>(e.notViewable.push(...t.notViewable),e.viewUndetermined.push(...t.viewUndetermined),e.viewable.push(...t.viewable),e),{notViewable:[],viewUndetermined:[],viewable:[]}))||{},Object.entries(this.viewableImpressionTrackers).forEach(e=>{let[t,r]=e;r.length&&(this.trackingEvents[t]=r)}),function(e){return"linear"===e.type}(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const 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)}}setDuration(e){p.isValidTimeValue(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}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}setProgress(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!p.isValidTimeValue(e)||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))});const i=this.skipDelay||-1;if(-1===i||this.skippable||(i>e?this.emit("skip-countdown",i-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const i=Math.round(e/this.assetDuration*100),n=[];if(e>0){n.push("start");for(let e=this.lastPercentage;e<i;e++)n.push("progress-".concat(e+1,"%"));n.push("progress-".concat(e));for(const t in this.quartiles)this.isQuartileReached(t,this.quartiles[t],e)&&(n.push(t),this._alreadyTriggeredQuartiles[t]=!0);this.lastPercentage=i}n.forEach(e=>{this.track(e,{macros:t,once:r})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,r){let i=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(i=!0),i}setMuted(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))})}setPaused(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))})}setFullscreen(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))})}setExpand(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))})}setSkipDelay(e){p.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("viewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("notViewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("viewUndetermined",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e&&"boolean"==typeof t?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(p.formatMacrosValues(e),", isCustomCode: ").concat(t)})}errorWithCode(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"string"==typeof e&&"boolean"==typeof t?(this.error({ERRORCODE:e},t),console.log("The method errorWithCode is deprecated, please use vast tracker error method instead")):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}complete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}notUsed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}otherAdInteraction(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}acceptInvitation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}adExpand(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}adCollapse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}minimize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}verificationNotExecuted(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))});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");const r=this.ad.adVerifications.find(t=>t.vendor===e);if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));const i=r.trackingEvents;if(i&&i.verificationNotExecuted){const e=i.verificationNotExecuted;this.trackURLs(e,t),this.emit("verificationNotExecuted",{trackingURLTemplates:e})}}overlayViewDuration(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&"object"==typeof t?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))})}close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}skip(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}load(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}click(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!==e&&"string"!=typeof e||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(p.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const r=this.clickThroughURLTemplate||e,i={...t};if(r){this.progress&&(i.ADPLAYHEAD=this.progressFormatted());const e=p.resolveURLTemplates([r],i)[0];this.emit("clickthrough",e)}}trackProgressEvents(e,t,r){const i=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(e=>{let[t]=e;return t.startsWith("progress-")}).map(e=>{let[t,r]=e;return{name:t,time:parseFloat(t.split("-")[1]),urls:r}}).filter(e=>{let{time:t}=e;return t<=i&&t>this.progress}).forEach(e=>{let{name:i,urls:n}=e;!r&&this.trackedProgressEvents.includes(i)||(this.emit(i,{trackingURLTemplates:n}),this.trackURLs(n,t),r?delete this.trackingEvents[i]:this.trackedProgressEvents.push(i))})}track(e){let{macros:t={},once:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof t)return void this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(t)});"closeLinear"===e&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,t,r);const i=this.trackingEvents[e],n=this.emitAlwaysEvents.indexOf(e)>-1;i?(this.emit(e,{trackingURLTemplates:i}),this.trackURLs(i,t)):n&&this.emit(e,null),r&&(delete this.trackingEvents[e],n&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{validUrls:n,invalidUrls:a}=p.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const s={...r};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(s.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(s.ADPLAYHEAD=this.progressFormatted())),null!==(t=this.creative)&&void 0!==t&&null!==(t=t.universalAdIds)&&void 0!==t&&t.length&&(s.UNIVERSALADID=this.creative.universalAdIds.map(e=>e.idRegistry.concat(" ",e.value)).join(",")),this.ad&&(this.ad.sequence&&(s.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(s.ADTYPE=this.ad.adType),this.ad.adServingId&&(s.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(s.ADCATEGORIES=this.ad.categories.map(e=>e.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(s.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(e=>e.value).join(","))),p.track(n,s,i)}convertToTimecode(e){if(!p.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),i=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(p.addLeadingZeros(r,2),":").concat(p.addLeadingZeros(i,2),":").concat(p.addLeadingZeros(n,2),".").concat(p.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}}function K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Y=$(function e(t){for(var r in K(this,e),this.id=t.getAttribute("id"),this.allowMultipleAds=t.getAttribute("allowMultipleAds"),this.followRedirects=t.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null,t.childNodes){var i=t.childNodes[r];switch(i.localName){case"AdTagURI":this.adTagURI={templateType:i.getAttribute("templateType"),uri:(i.textContent||i.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=i.firstChild;this.vastAdData&&1!==this.vastAdData.nodeType;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=i}}});function Q(e,t){var r=[];for(var i in e.childNodes){var n=e.childNodes[i];n.nodeName!==t&&t!=="vmap:".concat(n.nodeName)&&n.nodeName!=="vmap:".concat(t)||r.push(n)}return r}function J(e){var t={attributes:{},children:{},value:{}};t.value=function(e){if(!e||!e.childNodes)return{};var t=e.childNodes,r=[];for(var i in t){var n=t[i];"#cdata-section"===n.nodeName&&r.push(n)}if(r&&r.length>0)try{return JSON.parse(r[0].data)}catch(e){}var a="";for(var s in t){var o=t[s];switch(o.nodeName){case"#text":a+=o.textContent.trim();break;case"#cdata-section":a+=o.data}}return a}(e);var r=e.attributes;if(r)for(var i in r){var n=r[i];n.nodeName&&void 0!==n.nodeValue&&null!==n.nodeValue&&(t.attributes[n.nodeName]=n.nodeValue)}var a=e.childNodes;if(a)for(var s in a){var o=a[s];o.nodeName&&"#"!==o.nodeName.substring(0,1)&&(t.children[o.nodeName]=J(o))}return t}var Z,ee=function(){function e(t){for(var r in K(this,e),this.timeOffset=t.getAttribute("timeOffset"),this.breakType=t.getAttribute("breakType"),this.breakId=t.getAttribute("breakId"),this.repeatAfter=t.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[],t.childNodes){var i=t.childNodes[r];switch(i.localName){case"AdSource":this.adSource=new Y(i);break;case"TrackingEvents":for(var n in i.childNodes){var a=i.childNodes[n];"Tracking"===a.localName&&this.trackingEvents.push({event:a.getAttribute("event"),uri:(a.textContent||a.text||"").trim()})}break;case"Extensions":this.extensions=Q(i,"Extension").map(function(e){return J(e)})}}}return $(e,[{key:"track",value:function(e,t){for(var r in this.trackingEvents){var i=this.trackingEvents[r];if(i.event===e){var n=i.uri;"error"===i.event&&(n=n.replace("[ERRORCODE]",t)),this.tracker(n)}}}},{key:"tracker",value:function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)}}]),e}(),te=$(function e(t){if(K(this,e),!t||!t.documentElement||"VMAP"!==t.documentElement.localName)throw new Error("Not a VMAP document");for(var r in this.version=t.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[],t.documentElement.childNodes){var i=t.documentElement.childNodes[r];switch(i.localName){case"AdBreak":this.adBreaks.push(new ee(i));break;case"Extensions":this.extensions=Q(i,"Extension").map(function(e){return J(e)})}}});class re{constructor(e){Object.defineProperty(this,"bus",{enumerable:!0,configurable:!0,writable:!0,value:e})}on(e,t){return this.bus.on(e,t)}emit(e,...t){this.bus.emit(e,...t)}}class ie{constructor(e={}){Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ads"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"1.0.0"}),Object.defineProperty(this,"capabilities",{enumerable:!0,configurable:!0,writable:!0,value:["ads"]}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_lastCreative",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"overlayId",{enumerable:!0,configurable:!0,writable:!0,value:"ads"}),Object.defineProperty(this,"prevActiveCaptionSig",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"adEndPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"adTrackEls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"cfg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"overlay",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"adVideo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipWrap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipBtn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipOffsetRaw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipAtSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"companionWrap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nonLinearWrap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedNonLinearContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedCompanionContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentBreakMeta",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"vastClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"globalUnsubs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sessionUnsubs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"resumeAfter",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"contentMedia",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentHadControls",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startingBreak",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"playedBreaks",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"userPlayIntent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"forcedMuteUntilInteraction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"resolvedBreaks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pendingPercentBreaks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"syncingVolume",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"vmapLoadPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"vmapPending",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"pendingVmapSrc",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=(e=>{const t=[];return(e.sources?Array.isArray(e.sources)?e.sources:[e.sources]:[]).forEach(e=>{if(!e||"string"!=typeof e.src)return;const r=e.src.trim(),i=e.type;r&&("VAST"!==i&&"VMAP"!==i&&"NONLINEAR"!==i||t.push({type:i,src:r}))}),t})(e),r=e.breaks||[],i=r.some(e=>"preroll"===e.at&&(e.source?.src||Array.isArray(e.sources)&&e.sources.some(e=>e?.src))),n=t.some(e=>"VAST"===e.type||"VMAP"===e.type||"NONLINEAR"===e.type);this.cfg={allowNativeControls:e.allowNativeControls??!1,resumeContent:e.resumeContent??!0,preferredMediaTypes:e.preferredMediaTypes||["video/mp4","video/webm","application/vnd.apple.mpegurl","application/x-mpegURL"],debug:e.debug??!1,breakTolerance:e.breakTolerance??.25,sources:t,breaks:r,interceptPlayForPreroll:e.interceptPlayForPreroll??(Boolean(i)||n),autoPlayOnReady:e.autoPlayOnReady||!1,mountEl:e.mountEl,mountSelector:e.mountSelector,nonLinearContainer:e.nonLinearContainer,nonLinearSelector:e.nonLinearSelector,companionContainer:e.companionContainer,companionSelector:e.companionSelector,adSourcesMode:e.adSourcesMode??"waterfall"}}setup(t){this.ctx=t,this.bus=new re(t.events),this.vastClient=new X,this.overlay=document.createElement("div"),this.overlay.className="op-ads",this.overlay.style.display="none",this.globalUnsubs.push(t.events.on("source:set",()=>{this.playedBreaks.clear(),this.startingBreak=!1,this.clearSession(),this.active=!1,this.contentMedia=void 0,this.contentHadControls=!1,this.overlay.style.display="none",this.ctx.leases.release("playback",this.name);try{e.getOverlayManager(this.ctx.core).deactivate(this.overlayId)}catch{}this.userPlayIntent=!1,this.pendingPercentBreaks=[],this.vmapLoadPromise=null,this.vmapPending=!1,this.pendingVmapSrc=void 0,this.rebuildSchedule()})),this.rebuildSchedule(),this.bindBreakScheduler(),this.cfg.interceptPlayForPreroll&&this.bindPrerollInterceptors(),this.globalUnsubs.push(t.events.on("player:interacted",()=>{if(this.forcedMuteUntilInteraction=!1,this.active&&this.adVideo)try{this.adVideo.muted=t.core.muted,this.adVideo.volume=t.core.volume}catch{}}))}async playAds(e){const t=this.inferSourceTypeForUrl(e);return this.playBreakFromVast({kind:"url",value:e},{kind:"manual",id:"manual",sourceType:t})}async playAdsFromXml(e){return this.playBreakFromVast({kind:"xml",value:e},{kind:"manual",id:"manual"})}getDueMidrollBreaks(e){const t=this.ctx.core.media;if(Number.isFinite(t.duration)&&t.duration>0&&this.pendingPercentBreaks.length){const e=t.duration,r=[];for(const t of this.pendingPercentBreaks){const i=e*t.percent;r.push({id:t.id,at:i,once:t.once,source:t.source})}this.pendingPercentBreaks=[],this.resolvedBreaks.push(...r)}const r=[];for(const t of this.resolvedBreaks){if("number"!=typeof t.at)continue;if(!this.getVastInputFromBreak(t).input)continue;const i=this.getBreakId(t);!1!==t.once&&this.playedBreaks.has(i)||e+(this.cfg.breakTolerance??.25)>=t.at&&r.push(t)}return r.sort((e,t)=>e.at-t.at),r}getDueMidrollBreak(e){return this.getDueMidrollBreaks(e)[0]}destroy(){this.finish({resume:!1});for(const e of this.globalUnsubs)e();this.globalUnsubs=[],this.overlay?.remove()}inferSourceTypeForUrl(e){const t=this.cfg.sources||[],r=t.find(t=>t.src===e);return"NONLINEAR"===r?.type||t.length>0&&t.every(e=>"NONLINEAR"===e.type)?"NONLINEAR":void 0}resolveContainer(e,t){if(e&&1===e.nodeType)return e;if(t){const e=document.querySelector(t);if(e instanceof HTMLElement)return e}}getNonLinearContainer(){return this.resolvedNonLinearContainer||(this.resolvedNonLinearContainer=this.resolveContainer(this.cfg.nonLinearContainer,this.cfg.nonLinearSelector)),this.resolvedNonLinearContainer}getCompanionContainer(){return this.resolvedCompanionContainer||(this.resolvedCompanionContainer=this.resolveContainer(this.cfg.companionContainer,this.cfg.companionSelector)),this.resolvedCompanionContainer}getSource(e){return(this.cfg.sources||[]).find(t=>t.type===e&&"string"==typeof t.src&&t.src.trim())}getPrimaryVastLikeSource(){return this.getSource("VAST")||this.getSource("NONLINEAR")}isXmlString(e){return e.trim().startsWith("<")}async getVastXmlText(e){if("xml"===e.kind){if("string"==typeof e.value)return e.value;try{return(new XMLSerializer).serializeToString(e.value)}catch{return String(e.value)}}const t=await fetch(e.value);if(!t.ok)throw new Error(`VAST request failed: ${t.status}`);return await t.text()}buildParsedForNonLinearFromXml(e){return this.toXmlDocument(e)}setSafeHTML(e,t){const r=document.createElement("template");r.innerHTML=String(t||"");const i=new Set(["SCRIPT","IFRAME","OBJECT","EMBED","LINK","STYLE","SVG","MATH","FORM","INPUT","TEXTAREA","SELECT","OPTION","META","BASE"]),n=document.createTreeWalker(r.content,NodeFilter.SHOW_ELEMENT),a=[];for(;n.nextNode();){const e=n.currentNode;i.has(e.tagName)?a.push(e):Array.from(e.attributes).forEach(t=>{const r=t.name.toLowerCase(),i=(t.value||"").trim();if(r.startsWith("on")&&e.removeAttribute(t.name),"href"===r||"src"===r||"xlink:href"===r){const r=i.toLowerCase(),n=r.startsWith("javascript:"),a=r.startsWith("vbscript:"),s=r.startsWith("data:"),o=r.startsWith("http://")||r.startsWith("https://")||r.startsWith("/")||r.startsWith("./"),l=s&&/^data:image\/(png|gif|jpe?g|webp|svg\+xml);/i.test(i);(n||a||!o&&!l)&&e.removeAttribute(t.name)}"srcdoc"===r&&e.removeAttribute(t.name)})}a.forEach(e=>e.remove()),e.replaceChildren(r.content.cloneNode(!0))}log(...e){this.cfg?.debug&&console.debug("[player][ads]",...e)}warn(...e){this.cfg?.debug&&console.warn("[player][ads]",...e)}rebuildSchedule(){const e=[...this.cfg.breaks||[]];if(0===e.length){const t=this.cfg.sources.filter(e=>("VAST"===e.type||"NONLINEAR"===e.type)&&e.src?.trim());if(t.length>0)if("playlist"===this.cfg.adSourcesMode)for(const r of t)e.push({at:"preroll",source:{type:r.type,src:r.src},once:!0});else t.length>1?e.push({at:"preroll",source:t[0],sources:t,once:!0}):e.push({at:"preroll",source:t[0],once:!0})}const t=this.getSource("VMAP");if(t?.src){const r=this.ctx?.core?.media;"none"===(r?(r.getAttribute("preload")||r.preload||"").toLowerCase():"")?this.pendingVmapSrc=t.src:(this.vmapPending=!0,this.vmapLoadPromise=this.loadVmapAndMerge(e,t.src))}this.resolvedBreaks=e}normalizeVmapAdSource(e){if(e)return Array.isArray(e)?e.find(e=>e?.adTagURI||e?.vastAdData)||e[0]:e}extractVastTagUri(e){if(e){if("string"==typeof e)return e.trim()||void 0;if("object"==typeof e){const t=e.uri||e.URI||e.value||e.text||e["#text"];if("string"==typeof t&&t.trim())return t.trim()}}}async loadVmapAndMerge(e,t){try{const r=(t||this.getSource("VMAP")?.src||"").trim();if(!r)return;const i=this.isXmlString(r)?r:await fetch(r).then(e=>{if(!e.ok)throw new Error(`VMAP request failed: ${e.status}`);return e.text()}),n=(new DOMParser).parseFromString(i,"text/xml"),a=new te(n),s=[],o=a.adBreaks||[],l=this.pendingPercentBreaks.length,c=(()=>{try{const e=n.getElementsByTagNameNS("*","AdBreak");if(e&&e.length)return e.length}catch{}try{return n.getElementsByTagName("AdBreak").length}catch{return 0}})();for(let e=0;e<o.length;e++){const t=o[e],r=String(t?.breakType||"").toLowerCase();if(r&&"linear"!==r&&"nonlinear"!==r&&"non-linear"!==r)continue;const i=String(t?.timeOffset||"").trim(),n=`${t?.breakId||"vmap"}:${i||"start"}:${e}`,{at:a,pendingPercent:l}=this.parseVmapTimeOffset(i),c=this.normalizeVmapAdSource(t?.adSource),u=c?.vastAdData,d=c?.adTagURI,h=this.extractVastTagUri(d);let p;if(u&&("string"==typeof u?p=u:u?.nodeType&&(p=(new XMLSerializer).serializeToString(u))),!h&&!p)continue;const m={type:"nonlinear"===r||"non-linear"===r?"NONLINEAR":"VAST",src:h||p};null==l?s.push({id:n,at:a,once:!0,timeOffset:i||("postroll"===a?"end":"start"),source:m}):this.pendingPercentBreaks.push({id:n,percent:l,vast:h?{kind:"url",value:h}:{kind:"xml",value:p},once:!0,source:m})}const u=s.length+(this.pendingPercentBreaks.length-l);if(c>0&&u<c&&(s.length=0,this.pendingPercentBreaks.splice(l)),0===s.length&&this.pendingPercentBreaks.length===l){const e=(e,t)=>{try{const r=e.getElementsByTagNameNS?.("*",t);if(r&&r.length)return Array.from(r)}catch{}try{return Array.from(e.getElementsByTagName(t))}catch{return[]}},t=e(n,"AdBreak");for(let r=0;r<t.length;r++){const i=t[r],n=String(i.getAttribute("breakType")||"").toLowerCase();if(n&&"linear"!==n&&"nonlinear"!==n&&"non-linear"!==n)continue;const a=String(i.getAttribute("timeOffset")||"").trim(),o=`${i.getAttribute("breakId")||i.getAttribute("id")||"vmap-fb"}:${a||"start"}:${r}`,{at:l,pendingPercent:c}=this.parseVmapTimeOffset(a),u=e(i,"AdSource")[0];let d,h;if(u){const t=e(u,"AdTagURI");if(t.length&&(d=(t[0].textContent||"").trim()||void 0),!d){const t=e(u,"VASTAdData");t.length&&(h=(t[0].textContent||"").trim()||void 0)}}if(!d&&!h)continue;const p={type:"nonlinear"===n||"non-linear"===n?"NONLINEAR":"VAST",src:d||h};null==c?s.push({id:o,at:l,once:!0,timeOffset:a||("postroll"===l?"end":"start"),source:p}):this.pendingPercentBreaks.push({id:o,percent:c,vast:d?{kind:"url",value:d}:{kind:"xml",value:h},once:!0,source:p})}}this.resolvedBreaks=[...e,...s]}catch(e){this.warn("VMAP load/parse failed",e),this.bus.emit("ads:error",{reason:"vmap_parse_failed",error:e}),this.ctx.events.emit("ads.error",{reason:"vmap_parse_failed",error:e})}finally{this.vmapPending=!1}}resolveMount(){if(this.cfg.mountEl)return this.cfg.mountEl;if(this.cfg.mountSelector){const e=document.querySelector(this.cfg.mountSelector);if(e)return e}const e=this.ctx.core.media;return e.closest(".op-player")||e.parentElement||document.body}parseVmapTimeOffset(e){const t=String(e||"").trim();if(!t||"start"===t)return{at:"preroll"};if("end"===t)return{at:"postroll"};if(t.endsWith("%")){const e=Number(t.slice(0,-1));if(Number.isFinite(e)&&e>=0&&e<=100)return{at:0,pendingPercent:e/100}}const r=/^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(t);if(r){const e=Number(r[1]),t=Number(r[2]),i=Number(r[3]);if([e,t,i].every(e=>Number.isFinite(e)))return{at:3600*e+60*t+i}}const i=Number(t);return Number.isFinite(i)&&i>=0?{at:i}:{at:"preroll"}}getVastInputFromBreak(e){if(e.source&&"string"==typeof e.source.src&&e.source.src.trim()){const t=e.source.src.trim(),r=e.source.type;return this.isXmlString(t)?{input:{kind:"xml",value:t},sourceType:r}:{input:{kind:"url",value:t},sourceType:r}}const t=Array.isArray(e.sources)?e.sources[0]:void 0;if(t&&"string"==typeof t.src&&t.src.trim()){const e=t.src.trim(),r=t.type;return this.isXmlString(e)?{input:{kind:"xml",value:e},sourceType:r}:{input:{kind:"url",value:e},sourceType:r}}return{input:void 0,sourceType:void 0}}getPostrollBreak(){for(const e of this.resolvedBreaks){if("postroll"!==e.at)continue;if(!this.getVastInputFromBreak(e).input)continue;const t=this.getBreakId(e);if(!(!1!==e.once)||!this.playedBreaks.has(t))return e}}toXmlDocument(e){return(new DOMParser).parseFromString(String(e||""),"text/xml")}getBreakId(e){if(e.id)return e.id;const{input:t,sourceType:r}=this.getVastInputFromBreak(e),i="url"===t?.kind?t.value:"xml";return`${String(e.at)}:${r||"VAST"}:${i}`}getPrerollBreak(){for(const e of this.resolvedBreaks){if("preroll"!==e.at)continue;if(!this.getVastInputFromBreak(e).input)continue;const t=this.getBreakId(e);if(!(!1!==e.once)||!this.playedBreaks.has(t))return e}for(const e of this.cfg.breaks){if("preroll"!==e.at)continue;if(!this.getVastInputFromBreak(e).input)continue;const t=this.getBreakId(e);if(!(!1!==e.once)||!this.playedBreaks.has(t))return e}const e=this.cfg.breaks.some(e=>"preroll"===e.at);if(!e){const e=this.getPrimaryVastLikeSource();if(e?.src){const t={at:"preroll",source:{type:e.type,src:e.src},once:!0},r=this.getBreakId(t);if(!this.playedBreaks.has(r))return t}}}shouldInterceptPreroll(){const e=this.getPrerollBreak();if(!e)return!1;if(this.active||this.startingBreak)return!1;const t=this.ctx.core.media;if((t?.currentTime??0)>.25)return!1;const r=this.getBreakId(e);if(!1!==e.once&&this.playedBreaks.has(r))return!1;return"ended"!==this.ctx.state.current}bindPrerollInterceptors(){const{events:e,core:t}=this.ctx,r=t.media,i=()=>{if(this.pendingVmapSrc&&!this.vmapLoadPromise){this.vmapPending=!0;const e=this.pendingVmapSrc;this.pendingVmapSrc=void 0,this.vmapLoadPromise=this.loadVmapAndMerge([...this.resolvedBreaks],e)}};this.globalUnsubs.push(e.on("cmd:play",()=>{i();const n=this.vmapPending,a=this.shouldInterceptPreroll();if(a||n&&!this.active&&!this.startingBreak)try{r.pause()}catch{}(async()=>{if(this.vmapLoadPromise&&await this.vmapLoadPromise.catch(()=>{}),!this.shouldInterceptPreroll())return void(!n||a||this.active||this.startingBreak||e.emit("cmd:play"));this.userPlayIntent=!!t.userInteracted;let r=0;for(;r++<10;){const e=this.getPrerollBreak();if(!e)break;await this.startBreak(e,"preroll")}})()}));const n=()=>{i();const n=this.vmapPending,a=this.shouldInterceptPreroll();if(a||n&&!this.active&&!this.startingBreak)try{r.pause()}catch{}(async()=>{if(this.vmapLoadPromise&&await this.vmapLoadPromise.catch(()=>{}),!this.shouldInterceptPreroll())return void(!n||a||this.active||this.startingBreak||e.emit("cmd:play"));this.userPlayIntent=!!t.userInteracted;let r=0;for(;r++<10;){const e=this.getPrerollBreak();if(!e)break;await this.startBreak(e,"preroll")}})()};r.addEventListener("play",n,{capture:!0}),this.globalUnsubs.push(()=>r.removeEventListener("play",n,{capture:!0}))}bindBreakScheduler(){const e=this.ctx.core.media;if(!e)return;const t=()=>{if(this.active||this.startingBreak)return;const t=e.currentTime||0,r=this.getDueMidrollBreaks(t);if(!r.length)return;const i=r[0],n=i.at,a=i.timeOffset,s=this.cfg.breakTolerance??.25,o=a?this.resolvedBreaks.filter(e=>"number"==typeof e.at&&!this.playedBreaks.has(this.getBreakId(e))&&e.timeOffset===a&&Math.abs(e.at-n)<=Math.max(1,s)):r.filter(e=>Math.abs(e.at-n)<=s);o.length&&(1===o.length?this.startBreak(o[0],"midroll"):this.startBreakGroup(o,"midroll"))};e.addEventListener("timeupdate",t),this.globalUnsubs.push(()=>e.removeEventListener("timeupdate",t));const r=()=>{this.active||this.startingBreak||(async()=>{for(this.vmapLoadPromise&&await this.vmapLoadPromise.catch(()=>{});!this.active&&!this.startingBreak;){const e=this.getPostrollBreak();if(!e)break;this.ctx.events.emit("ads.mediaended",{break:{kind:"postroll",id:this.getBreakId(e)},at:e.at}),await this.startBreak(e,"postroll")}})()};e.addEventListener("ended",r),this.globalUnsubs.push(()=>e.removeEventListener("ended",r))}async startBreak(e,t,r){if(this.active||this.startingBreak)return;const i=this.getBreakId(e),n=!1!==e.once;if(n&&this.playedBreaks.has(i))return;const a=e.sources;if(a&&a.length>1){n&&this.playedBreaks.add(i),this.startingBreak=!0,this.bus.emit("ads:break:start",{id:i,kind:t,at:e.at});try{for(let e=0;e<a.length;e++){const n=a[e],s=e===a.length-1,o=this.isXmlString(n.src)?{kind:"xml",value:n.src}:{kind:"url",value:n.src};if(await this.playBreakFromVast(o,{kind:t,id:i,sourceType:n.type},{suppressResumeOnError:!s,suppressResumeOnSuccess:r?.suppressResume}))break}}finally{this.startingBreak=!1,this.bus.emit("ads:break:end",{id:i,kind:t,at:e.at})}return}const{input:s,sourceType:o}=this.getVastInputFromBreak(e);if(s){n&&this.playedBreaks.add(i),this.startingBreak=!0,this.bus.emit("ads:break:start",{id:i,kind:t,at:e.at});try{await this.playBreakFromVast(s,{kind:t,id:i,sourceType:o},{suppressResumeOnSuccess:r?.suppressResume})}finally{this.startingBreak=!1,this.bus.emit("ads:break:end",{id:i,kind:t,at:e.at})}}}async startBreakGroup(e,t){let r=!1;const i=[];for(const n of e){if("midroll"===t){const{input:e}=this.getVastInputFromBreak(n),t="url"===e?.kind?e.value:"",i=/bumper/i.test(t)||/bumper/i.test(n.id||"");if(i&&r){this.playedBreaks.add(this.getBreakId(n));continue}i||(r=!0)}i.push(n)}for(let e=0;e<i.length;e++){const r=e===i.length-1;await this.startBreak(i[e],t,{suppressResume:!r})}}extractAdsFromParsed(e){const t=e?.ads||e?.vastResponse?.ads;if(Array.isArray(t)&&t.length)return t;const r=e?.adPods||e?.vastResponse?.adPods||e?.vastResponse?.adpods;if(Array.isArray(r)&&r.length){const e=[];for(const t of r){const r=t?.ads||t?.Ads;Array.isArray(r)&&e.push(...r)}if(e.length)return e}const i=e?.adPod||e?.vastResponse?.adPod||e?.vastResponse?.adpod,n=i?.ads||i?.Ads;return Array.isArray(n)&&n.length?n:[]}collectPodAds(e){const t=this.extractAdsFromParsed(e),r=[];for(const e of t){const t=e?.creatives||e?.Creatives||[],i=e?.sequence||e?.attributes?.sequence||void 0,n=null!=i?Number(i):void 0;for(let i=0;i<t.length;i++){const a=t[i],s=a?.mediaFiles||a?.MediaFiles||a?.linear?.mediaFiles||a?.Linear?.mediaFiles||a?.linear?.MediaFiles||a?.linear?.mediafiles||[],o=this.pickBestMediaFile(s);if(!o)continue;const l=this.extractSkipOffsetFromCreative(a),c=a?.companionAds?.companions||a?.companions||void 0,u=a?.nonLinearAds?.nonLinears||a?.nonLinears||void 0;r.push({ad:e,creative:a,mediaFile:o,sequence:Number.isFinite(n)?n:void 0,creativeIndex:i,skipOffset:l,companions:Array.isArray(c)?c:void 0,nonLinears:Array.isArray(u)?u:void 0})}}return r.sort((e,t)=>{const r=e.sequence??Number.MAX_SAFE_INTEGER,i=t.sequence??Number.MAX_SAFE_INTEGER;if(r!==i)return r-i;return(e.creativeIndex??0)-(t.creativeIndex??0)})}collectPodAdsFromXml(e){if(!e)return[];const t=Array.from(e.getElementsByTagName("Ad")),r=[];for(const e of t){const t=e.getAttribute("sequence"),i=null!=t?Number(t):void 0,n=Array.from(e.getElementsByTagName("Creative"));for(let t=0;t<n.length;t++){const a=n[t],s=a.getElementsByTagName("Linear")?.[0];if(!s)continue;const o=s.getAttribute("skipoffset")||s.getAttribute("skipOffset")||void 0,l=s.getElementsByTagName("MediaFiles")?.[0];if(!l)continue;const c=Array.from(l.getElementsByTagName("MediaFile")).map(e=>({type:e.getAttribute("type")||"",mimeType:e.getAttribute("type")||"",bitrate:Number(e.getAttribute("bitrate")||0),bitRate:Number(e.getAttribute("bitRate")||0),width:Number(e.getAttribute("width")||0),height:Number(e.getAttribute("height")||0),fileURL:(e.textContent||"").trim(),url:(e.textContent||"").trim(),rawEl:e})),u=this.pickBestMediaFile(c);u&&r.push({ad:{id:e.getAttribute("id")||void 0},creative:{linear:{MediaFiles:c}},mediaFile:u,sequence:Number.isFinite(i)?i:void 0,creativeIndex:t,skipOffset:o||void 0})}}return r.sort((e,t)=>{const r=e.sequence??Number.MAX_SAFE_INTEGER,i=t.sequence??Number.MAX_SAFE_INTEGER;if(r!==i)return r-i;return(e.creativeIndex??0)-(t.creativeIndex??0)})}clearAdTracks(){for(const e of this.adTrackEls)e.remove();this.adTrackEls=[]}buildCaptionsFromVastMediaFileRaw(e){return this.extractClosedCaptions(e).map((e,t)=>{const r=e.language?String(e.language):"",i=e.type?String(e.type):"";return{src:String(e.fileURL),kind:"captions",srclang:r||void 0,label:r?r.toUpperCase():`CC ${t+1}`,type:i||void 0}}).filter(e=>!!e.src)}ensureRawCaptions(e){if(!e)return[];if(Array.isArray(e.captions))return e.captions;const t=this.buildCaptionsFromVastMediaFileRaw(e);return e.captions=t,t}attachAdCaptionTracks(e,t){const r=this.ensureRawCaptions(t).filter(e=>(e.type||"").toLowerCase().includes("vtt")||e.src.toLowerCase().endsWith(".vtt")),i=[];for(const t of r){const r=document.createElement("track");r.kind=t.kind,r.src=t.src,t.srclang&&(r.srclang=t.srclang),t.label&&(r.label=t.label),r.default=!1,e.appendChild(r),i.push(r)}return i}captionsSignature(e){return`${String(e?.kind??"")}|${String((e?.language??e?.srclang??"")||"")}|${String((e?.label??"")||"")}`}listCaptionTracks(e){const t=e?.textTracks;if(!t||"number"!=typeof t.length)return[];const r=[];for(let e=0;e<Number(t.length);e++){const i=t[e]??("function"==typeof t.item?t.item(e):null);if(!i)continue;const n=String(i.kind||"");"captions"!==n&&"subtitles"!==n||r.push(i)}return r}captureActiveCaptionTrack(e){if(this.prevActiveCaptionSig)return;const t=this.listCaptionTracks(e).find(e=>"showing"===String(e.mode));t&&(this.prevActiveCaptionSig=this.captionsSignature(t))}restoreActiveTextTrack(){const e=this.prevActiveCaptionSig;if(this.prevActiveCaptionSig=null,!e)return;const t=this.ctx?.core?.media;if(!t)return;const r=this.listCaptionTracks(t);if(!r.length)return;for(const e of r)e.mode="disabled";const i=r.find(t=>this.captionsSignature(t)===e);i&&(i.mode="showing")}extractClosedCaptions(e){if(!e)return[];const t=e.closedCaptionFiles??e.ClosedCaptionFiles??e.closedCaptionFile??e.ClosedCaptionFile??null;return(Array.isArray(t)?t:Array.isArray(t?.closedCaptionFiles)?t.closedCaptionFiles:Array.isArray(t?.ClosedCaptionFile)?t.ClosedCaptionFile:Array.isArray(t?.closedCaptionFile)?t.closedCaptionFile:[]).map(e=>({type:e?.type??e?.mimeType??e?.mime_type,language:e?.language??e?.lang,fileURL:e?.fileURL??e?.url??e?.src})).filter(e=>"string"==typeof e.fileURL&&e.fileURL.length>0)}removeAdCaptions(){for(const e of this.adTrackEls)try{e.remove()}catch{}this.adTrackEls=[]}pickBestMediaFile(e){if(!Array.isArray(e)||0===e.length)return null;const t=e.map(e=>({type:String(e?.mimeType||e?.type||""),fileURL:String(e?.fileURL||e?.url||e?.src||""),bitrate:Number(e?.bitrate||e?.bitRate||0),width:Number(e?.width||0),height:Number(e?.height||0),raw:e})).filter(e=>Boolean(e.fileURL));if(0===t.length)return null;for(const e of this.cfg.preferredMediaTypes){const r=t.filter(t=>(t.type||"").toLowerCase()===e.toLowerCase());if(r.length)return r.sort((e,t)=>(t.bitrate||0)-(e.bitrate||0))[0]}return t.sort((e,t)=>(t.bitrate||0)-(e.bitrate||0))[0]}extractSkipOffsetFromCreative(e){const t=e?.linear||e?.Linear||e,r=t?.skipDelay??t?.skipdelay;if("number"==typeof r&&Number.isFinite(r)&&r>=0)return String(r);const i=[t?.skipOffset,t?.skipoffset,t?.attributes?.skipOffset,t?.attributes?.skipoffset,t?.attributes?.skipOffset?.value,t?.attributes?.skipoffset?.value,t?.attributes?.skipOffset?.["#text"],t?.attributes?.skipoffset?.["#text"]];if(t&&"object"==typeof t)for(const e of["skipOffset","skipoffset","skipDelay","skipdelay"])i.push(t[e]),i.push(t?.attributes?.[e]);const n=e=>{if("number"==typeof e&&Number.isFinite(e)&&e>=0)return String(e);if("string"==typeof e){const t=e.trim();return t||void 0}if(e&&"object"==typeof e){const t=e,r=t.value??t["#text"]??t.text;if("string"==typeof r){const e=r.trim();return e||void 0}}};for(const e of i){const t=n(e);if(t)return t}}parseTimecodeToSeconds(e){const t=/^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(String(e).trim());if(!t)return null;const r=Number(t[1]),i=Number(t[2]),n=Number(t[3]);return[r,i,n].every(e=>Number.isFinite(e))?3600*r+60*i+n:null}computeSkipAtSeconds(e,t){if(!e)return;const r=e.trim();if(!r)return;if(r.endsWith("%")){const e=Number(r.slice(0,-1));return Number.isFinite(e)&&e>=0&&e<=100&&Number.isFinite(t)&&t>0?e/100*t:void 0}const i=this.parseTimecodeToSeconds(r);if(null!=i)return i;const n=Number(r);return Number.isFinite(n)&&n>=0?n:void 0}ensureSkipDom(){if(this.skipWrap&&this.skipBtn)return;const t=document.createElement("div");t.className="op-ads__skip";const r=document.createElement("button");r.type="button",r.className="op-ads__skip-btn",r.textContent="Skip Ad",t.appendChild(r),this.overlay.appendChild(t);const i=e=>{this.onSkip?.(),e.preventDefault(),e.stopPropagation()};r.addEventListener("click",i,e.EVENT_OPTIONS),this.skipWrap=t,this.skipBtn=r,this.sessionUnsubs.push(()=>r.removeEventListener("click",i)),this.sessionUnsubs.push(()=>t.remove())}hideSkipUi(){this.skipWrap&&(this.skipWrap.style.display="none"),this.skipOffsetRaw=void 0,this.skipAtSeconds=void 0}setupSkipUIForPodItem(e){this.hideSkipUi();const t=this.adVideo;if(!t)return;const r=e.skipOffset??this.extractSkipOffsetFromCreative(e.creative);if(!r)return void this.log("creative not skippable (no skipOffset/skipDelay)",{sequence:e.sequence});this.log("creative skippable",r),this.skipOffsetRaw=r,this.ensureSkipDom();const i=()=>{const e=t.duration,i=this.computeSkipAtSeconds(r,e);if(null==i)return;this.skipAtSeconds=i;const n=t.currentTime||0,a=Math.max(0,i-n);this.skipWrap&&(this.skipWrap.style.display="block"),this.skipBtn&&(this.skipBtn.textContent=a<=.05?"Skip Ad":Math.ceil(a).toString(),this.skipBtn.style.pointerEvents=a<=.05?"auto":"none")};t.addEventListener("timeupdate",i),t.addEventListener("loadedmetadata",i),i(),this.sessionUnsubs.push(()=>t.removeEventListener("timeupdate",i)),this.sessionUnsubs.push(()=>t.removeEventListener("loadedmetadata",i))}onSkip(){this.requestSkip("button")}requestSkip(e="api"){if(this.skipOffsetRaw&&null!=this.skipAtSeconds&&this.adVideo){const t=this.adVideo.currentTime||0;if(t+.01<this.skipAtSeconds)return void this.log("skip requested too early",{cur:t,skipAt:this.skipAtSeconds,reason:e})}try{this.tracker?.trackSkip?.()}catch{}const t=this.currentBreakMeta?{kind:this.currentBreakMeta.kind,id:this.currentBreakMeta.breakId}:null;this.bus.emit("ads:skip",{break:t,reason:e}),this.ctx.events.emit("ads.skipped",{break:t,reason:e}),this.ctx.events.emit("adsskipped",{break:t,reason:e});const r=this.adVideo;if(r)try{Number.isFinite(r.duration)&&r.duration>0&&(r.currentTime=Math.max(0,r.duration-.001)),r.dispatchEvent(new Event("ended"))}catch{}}clearAdOverlays(){this.hideSkipUi(),this.skipWrap?.remove(),this.skipWrap=void 0,this.skipBtn=void 0,this.companionWrap?.remove(),this.nonLinearWrap?.remove(),this.companionWrap=void 0,this.nonLinearWrap=void 0}mountCompanions(e){const t=this.getCompanionContainer();if(!t)return;const r=("companion"===e?.type?e?.variations:void 0)||e?.companionAds?.companions||e?.companions;if(!Array.isArray(r)||0===r.length)return;const i=document.createElement("div");i.className="op-ads__companions",i.style.zIndex="2",i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.maxWidth="40%",i.style.pointerEvents="auto";for(const e of r){const t=this.renderCompanion(e);t&&i.appendChild(t)}i.childElementCount&&(t.appendChild(i),this.companionWrap=i,this.sessionUnsubs.push(()=>i.remove()))}renderCompanion(e){const t=e?.companionClickThroughURLTemplate||e?.clickThroughURLTemplate||e?.companionClickThrough||e?.clickThrough,r=document.createElement("div");r.className="op-ads__companion",r.style.position="relative",r.style.cursor=t?"pointer":"default";const i=e?.staticResource||e?.StaticResource||e?.staticResources?.[0]||e?.StaticResources?.[0],n=e?.iFrameResource||e?.IFrameResource||e?.iFrameResources?.[0]||e?.IFrameResources?.[0],a=e?.htmlResource||e?.HTMLResource||e?.htmlResources?.[0]||e?.HTMLResources?.[0];let s=null;if(i){const e=document.createElement("img");e.src=String(i?.url||i?.uri||i?.value||i),e.style.maxWidth="100%",e.style.height="auto",s=e}else if(n){const e=document.createElement("iframe");e.src=String(n?.url||n?.uri||n?.value||n),e.style.border="0",e.style.width="100%",e.style.height="100%",s=e}else if(a){const e=document.createElement("div");this.setSafeHTML(e,String(a?.value||a)),s=e}if(!s)return null;if(r.appendChild(s),t){const e=e=>{const r="string"==typeof t?t:t.url;this.safeWindowOpen(r);try{this.tracker?.trackClick?.(),this.tracker?.trackClickThrough?.()}catch{}e.preventDefault(),e.stopPropagation()};r.addEventListener("click",e),this.sessionUnsubs.push(()=>r.removeEventListener("click",e))}return r}collectNonLinearCreatives(e){const t=this.extractAdsFromParsed(e),r=[];for(const e of t){const t=e?.creatives||e?.Creatives||[];for(const i of t){const t=i?.variations??i?.nonLinearAds?.nonLinears??i?.nonLinearAds?.nonLinear??i?.NonLinearAds?.NonLinear??i?.nonLinears??i?.NonLinears??void 0;if(t===i?.variations&&"nonlinear"!==i?.type)continue;const n=Array.isArray(t)?t:t?[t]:[];if(0===n.length)continue;const a=e?.sequence||e?.attributes?.sequence||void 0,s=null!=a?Number(a):void 0;for(const t of n)r.push({ad:e,creative:i,nonLinear:t,sequence:Number.isFinite(s)?s:void 0})}}return r.sort((e,t)=>{const r=e.sequence,i=t.sequence;return null==r&&null==i?0:null==r?1:null==i?-1:r-i})}collectNonLinearFromXml(e){const t=[],r=(e,t)=>{try{if(e.getElementsByTagNameNS){const r=e.getElementsByTagNameNS("*",t),i=Array.from(r);if(i.length)return i}}catch{}try{return Array.from(e.getElementsByTagName(t))}catch{return[]}},i=(e,t)=>{const i=r(e,t);return n=i[0]??null,(n?.textContent||"").trim();var n},n=[];try{const t=r(e,"Companion");for(const e of t){const t=Number(e.getAttribute("width")||0),r=Number(e.getAttribute("height")||0),a=i(e,"StaticResource"),s=i(e,"CompanionClickThrough");a&&n.push({width:t||void 0,height:r||void 0,staticResource:{value:a},clickThrough:s||void 0})}}catch{}const a=r(e,"NonLinear");for(const e of a){const r=Number(e.getAttribute("width")||0),a=Number(e.getAttribute("height")||0),s=e.getAttribute("minSuggestedDuration")||void 0,o=i(e,"StaticResource"),l=i(e,"IFrameResource"),c=i(e,"HTMLResource"),u={width:r||void 0,height:a||void 0,minSuggestedDuration:s,staticResource:o?{value:o}:void 0,iFrameResource:l?{value:l}:void 0,htmlResource:c?{value:c}:void 0,nonLinearClickThrough:i(e,"NonLinearClickThrough")||void 0};t.push({nonLinear:u,companions:n.length?n:void 0})}return t}async playNonLinearOnlyBreakFromXml(e,t){this.ensureOverlayMounted(),this.clearAdOverlays(),this.overlay.replaceChildren(),this.overlay.style.display="block",this.active=!0;let r=0;for(let i=0;i<e.length;i++){const n=e[i];n.companions?.length&&this.mountCompanions({companions:n.companions,companionAds:{companions:n.companions}}),this.ensureNonLinearDom();const a=this.renderNonLinear(n.nonLinear);a&&this.nonLinearWrap.appendChild(a),r=Math.max(r,this.nonLinearSuggestedDurationSeconds(n.nonLinear)),this.bus.emit("ads:impression",{break:t,index:i}),this.bus.emit("ads:ad:start",{break:t,index:i})}this.active=!1,this.ctx.events.emit("cmd:play");const i=Date.now();(async()=>{await new Promise(e=>{const t=()=>{const n=(Date.now()-i)/1e3;!this.nonLinearWrap?.querySelector(".op-ads__nonlinear-item")||n>=r?e():setTimeout(t,50)};t()});for(let r=0;r<e.length;r++)this.bus.emit("ads:ad:end",{break:t,index:r});this.clearSession(),this.overlay.style.display="none",this.overlay.replaceChildren(),this.currentBreakMeta=void 0})()}ensureNonLinearDom(){if(this.nonLinearWrap)return;const e=document.createElement("div");e.className="op-ads__nonlinear",e.style.position="absolute",e.style.left="12px",e.style.right="12px",e.style.bottom="12px",e.style.zIndex="2",e.style.display="flex",e.style.justifyContent="center",e.style.pointerEvents="auto";(this.getNonLinearContainer()||this.adVideo?.parentElement||this.overlay).appendChild(e),this.nonLinearWrap=e,this.sessionUnsubs.push(()=>e.remove())}renderNonLinear(e){const t=e?.nonlinearClickThroughURLTemplate||e?.nonLinearClickThroughURLTemplate||e?.clickThroughURLTemplate||e?.nonLinearClickThrough||e?.clickThrough,r=document.createElement("div");r.className="op-ads__nonlinear-item",r.style.position="relative",r.style.maxWidth="100%",r.style.cursor=t?"pointer":"default";const i=e=>Array.isArray(e)?e[0]:e,n=i(e?.staticResource??e?.StaticResource??e?.staticResources??e?.StaticResources),a=i(e?.iFrameResource??e?.IFrameResource??e?.iFrameResources??e?.IFrameResources),s=i(e?.htmlResource??e?.HTMLResource??e?.htmlResources??e?.HTMLResources);let o=null;if(n){const e=document.createElement("img");e.src=String(n?.url||n?.uri||n?.value||n),e.style.maxWidth="100%",e.style.height="auto",o=e}else if(a){const e=document.createElement("iframe");e.src=String(a?.url||a?.uri||a?.value||a),e.style.border="0",e.style.width="100%",e.style.height="100%",o=e}else if(s){const e=document.createElement("div");this.setSafeHTML(e,String(s?.value||s)),o=e}if(!o)return null;if(r.appendChild(o),t){const e=e=>{if("BUTTON"===e.target?.tagName)return;const r="string"==typeof t?t:t.url;this.safeWindowOpen(r);try{this.tracker?.trackClick?.(),this.tracker?.trackClickThrough?.()}catch{}e.preventDefault(),e.stopPropagation()};r.addEventListener("click",e),this.sessionUnsubs.push(()=>r.removeEventListener("click",e))}return r}mountNonLinear(e){const t=("nonlinear"===e?.type?e?.variations:void 0)??e?.nonLinearAds?.nonLinears??e?.nonLinearAds?.nonLinear??e?.NonLinearAds?.NonLinear??e?.nonLinears??e?.NonLinears??void 0,r=Array.isArray(t)?t:t?[t]:[];if(0!==r.length){this.ensureNonLinearDom();for(const e of r){const t=this.renderNonLinear(e);t&&this.nonLinearWrap.appendChild(t)}}}nonLinearSuggestedDurationSeconds(e){const t=e?.minSuggestedDuration??e?.minSuggestedDurationSeconds??e?.attributes?.minSuggestedDuration??void 0;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;if("string"==typeof t){const e=this.parseTimecodeToSeconds(t);if(null!=e&&e>0)return e;const r=Number(t);if(Number.isFinite(r)&&r>0)return r}return 10}async playNonLinearOnlyBreak(e,t){this.ensureOverlayMounted(),this.overlay.replaceChildren(),this.overlay.style.display="block",this.active=!0;const r=this.collectNonLinearCreatives(e);if(!r.length)return;let i=0;for(let e=0;e<r.length;e++){const n=r[e];try{this.tracker=new z(this.vastClient,n.ad,n.creative)}catch{this.tracker=void 0}this._lastCreative=n.creative;const a=n.ad?.creatives?.find(e=>"companion"===e?.type)??n.creative;this.mountCompanions(a),this.ensureNonLinearDom();const s=this.renderNonLinear(n.nonLinear);s&&this.nonLinearWrap.appendChild(s);try{this.tracker?.trackImpression?.(),this.tracker?.trackCreativeView?.()}catch{}this.bus.emit("ads:impression",{break:t,index:e}),this.bus.emit("ads:ad:start",{break:t,index:e,sequence:n.sequence}),i=Math.max(i,this.nonLinearSuggestedDurationSeconds(n.nonLinear))}this.active=!1,this.ctx.events.emit("cmd:play");const n=Date.now();(async()=>{await new Promise(e=>{const t=()=>{const r=(Date.now()-n)/1e3;!this.nonLinearWrap?.querySelector(".op-ads__nonlinear-item")||r>=i?e():setTimeout(t,50)};t()});for(let e=0;e<r.length;e++){const i=r[e];this.bus.emit("ads:ad:end",{break:t,index:e,sequence:i.sequence})}this.clearSession(),this.overlay.style.display="none",this.overlay.replaceChildren(),this.currentBreakMeta=void 0})()}async mountAdVideo(t,r){this.ensureOverlayMounted();const i=this.overlay.parentElement;this.overlay.replaceChildren(),this.overlay.style.display="block",this.contentMedia=t,this.captureActiveCaptionTrack(t);const n=document.createElement("video");n.className="op-ads__media",n.playsInline=!0;const a=(t.getAttribute("preload")||t.preload||"").toLowerCase(),s=!!t.autoplay&&!this.ctx.core.userInteracted;n.preload="none"===a?"metadata":"auto",n.controls=this.cfg.allowNativeControls,n.style.width="100%",n.style.height="100%",n.src=r.fileURL;try{n.load()}catch{}const o=!!s||this.ctx.core.muted,l=s?0:this.ctx.core.volume;n.muted=o,n.defaultMuted=o,Number.isFinite(l)&&(n.volume=Math.max(0,Math.min(1,l))),this.adEndPromise=new Promise(e=>{const t=()=>e(),r=()=>{if(this.adVideo===n){try{n.pause()}catch{}n.remove(),this.adVideo=void 0}else n.remove()},i=()=>{this.ctx.events.emit("ended"),r(),t()},a=()=>{r(),t()};n.addEventListener("ended",i,{once:!0}),n.addEventListener("error",a,{once:!0}),this.sessionUnsubs.push(()=>n.removeEventListener("ended",i)),this.sessionUnsubs.push(()=>n.removeEventListener("error",a))}),this.overlay.appendChild(n),this.adVideo=n;const c=()=>{if("visible"!==document.visibilityState)return;const e=this.adVideo;if(e&&e.paused&&!e.ended)try{const t=e.play?.();t&&"function"==typeof t.catch&&t.catch(()=>{})}catch{}};document.addEventListener("visibilitychange",c),this.sessionUnsubs.push(()=>document.removeEventListener("visibilitychange",c)),this.clearAdTracks(),this.adTrackEls=this.attachAdCaptionTracks(n,r.raw),this.sessionUnsubs.push(()=>this.clearAdTracks());let u=null;try{u=e.getOverlayManager(this.ctx.core),u.activate({id:"ads",priority:100,mode:"countdown",canSeek:!1,duration:0,value:0,label:"Ad",fullscreenEl:i,fullscreenVideoEl:n})}catch{}const d=()=>{if(!u)return;const e=n.duration,t=n.currentTime;!Number.isFinite(e)||e<=0||!Number.isFinite(t)||u.update(this.overlayId,{duration:e,value:Math.max(0,e-t),mode:"countdown",canSeek:!1,fullscreenEl:i,fullscreenVideoEl:n})};n.addEventListener("loadedmetadata",d),n.addEventListener("timeupdate",d),d(),this.sessionUnsubs.push(()=>n.removeEventListener("loadedmetadata",d)),this.sessionUnsubs.push(()=>n.removeEventListener("timeupdate",d))}bindAdSurfaceCommands(){const{events:e}=this.ctx,t=()=>this.adVideo;this.sessionUnsubs.push(e.on("cmd:play",()=>{const e=Boolean(this.contentMedia?.autoplay);if(!this.userPlayIntent&&e&&!this.ctx.core.userInteracted){this.forcedMuteUntilInteraction=!0;try{t()&&(t().muted=!0,t().volume=0)}catch{}}else{this.forcedMuteUntilInteraction=!1;try{t()&&(t().muted=this.ctx.core.muted,t().volume=this.ctx.core.volume)}catch{}}t()?.play().catch(()=>{})})),this.sessionUnsubs.push(e.on("cmd:pause",()=>t()?.pause())),this.sessionUnsubs.push(e.on("cmd:setVolume",e=>{const r=Number(e);Number.isFinite(r)&&t()&&(this.syncingVolume||this.forcedMuteUntilInteraction||(t().volume=r))})),this.sessionUnsubs.push(e.on("cmd:setMuted",e=>{if(t()&&!this.syncingVolume)return this.forcedMuteUntilInteraction&&!this.ctx.core.userInteracted?(t().muted=!0,void(t().volume=0)):void(t().muted=Boolean(e))}))}bindTrackerAndTelemetry(e){this.currentBreakMeta=e;const t=this.adVideo;let r=!1,i=t.muted||0===t.volume,n=t.paused;const a=()=>{const r=t.duration;Number.isFinite(r)&&r>0&&(this.bus.emit("ads:duration",{break:e,duration:r}),this.ctx.events.emit("ads.durationChange",{duration:r,break:e}))};let s=!1,o=!1,l=!1,c=!1;const u=t=>{this.bus.emit("ads:quartile",{break:e,quartile:t}),25===t&&this.ctx.events.emit("ads.firstQuartile",{break:e}),50===t&&this.ctx.events.emit("ads.midpoint",{break:e}),75===t&&this.ctx.events.emit("ads.thirdQuartile",{break:e}),100===t&&this.ctx.events.emit("ads.complete",{break:e})},d=()=>{r?n&&(this.tracker?.trackResume?.(),this.bus.emit("ads:resume",{break:e}),this.ctx.events.emit("ads.resume",{break:e})):(r=!0,this.tracker?.trackStart?.(),this.ctx.events.emit("play"),this.ctx.events.emit("ads.start",{break:e}),u(0),a()),this.ctx.events.emit("playing"),n=!1},h=()=>{r&&this.tracker?.trackPause?.(),n=!0,this.bus.emit("ads:pause",{break:e}),this.ctx.events.emit("pause"),this.ctx.events.emit("ads.pause",{break:e})},p=()=>{const r=t.duration,i=t.currentTime;if(!Number.isFinite(r)||r<=0||!Number.isFinite(i))return;a();const n=Math.max(0,r-i);this.bus.emit("ads:timeupdate",{break:e,currentTime:i,remainingTime:n,duration:r}),this.ctx.events.emit("ads.adProgress",{currentTime:i,duration:r,break:e}),this.tracker?.setDuration?.(r),this.tracker?.setProgress?.(i);const d=i/r;!s&&d>=.25&&(s=!0,this.tracker?.trackFirstQuartile?.(),u(25)),!o&&d>=.5&&(o=!0,this.tracker?.trackMidpoint?.(),u(50)),!l&&d>=.75&&(l=!0,this.tracker?.trackThirdQuartile?.(),u(75)),!c&&d>=.999&&(c=!0,this.tracker?.trackComplete?.(),u(100))},m=()=>{const r=t.volume,n=t.muted||0===t.volume;if(this.bus.emit("ads:volumeChange",{break:e,volume:r,muted:n}),this.ctx.events.emit("ads.volumeChange",{volume:r,muted:n,break:e}),n!==i&&(i=n,n?(this.tracker?.trackMute?.(),this.bus.emit("ads:mute",{break:e})):(this.tracker?.trackUnmute?.(),this.bus.emit("ads:unmute",{break:e}))),(!this.forcedMuteUntilInteraction||this.ctx.core.userInteracted)&&!this.syncingVolume)try{this.syncingVolume=!0,this.ctx.core.muted=n,Number.isFinite(r)&&(this.ctx.core.volume=Math.max(0,Math.min(1,r)))}catch{}finally{this.syncingVolume=!1}},f=t=>{if(t.defaultPrevented)return;const r=this.getClickThroughUrl();if(!r)return;const i="string"==typeof r?r:r.url;this.safeWindowOpen(i),this.tracker?.trackClick?.(),this.tracker?.trackClickThrough?.(),this.bus.emit("ads:clickthrough",{break:e,url:r}),this.ctx.events.emit("ads.click",{break:e,url:r})};t.addEventListener("playing",d),t.addEventListener("pause",h),t.addEventListener("timeupdate",p),t.addEventListener("volumechange",m),t.addEventListener("click",f),t.addEventListener("loadedmetadata",a),this.sessionUnsubs.push(()=>t.removeEventListener("playing",d)),this.sessionUnsubs.push(()=>t.removeEventListener("pause",h)),this.sessionUnsubs.push(()=>t.removeEventListener("timeupdate",p)),this.sessionUnsubs.push(()=>t.removeEventListener("volumechange",m)),this.sessionUnsubs.push(()=>t.removeEventListener("click",f)),this.sessionUnsubs.push(()=>t.removeEventListener("loadedmetadata",a))}getClickThroughUrl(){const e=this._lastCreative;return e?.videoClickThroughURLTemplate||e?.videoClicks?.clickThrough||e?.videoClicks?.clickThroughURLTemplate||void 0}safeWindowOpen(e){try{const t=new URL(e,window.location.href);if("http:"!==t.protocol&&"https:"!==t.protocol)return;window.open(t.toString(),"_blank","noopener,noreferrer")}catch{}}ensureOverlayMounted(){const e=this.resolveMount();if(e instanceof HTMLElement){const t=window.getComputedStyle(e);t.position&&"static"!==t.position||(e.style.position="relative")}this.overlay.style.position="absolute",this.overlay.style.inset="0",this.overlay.style.width="100%",this.overlay.style.height="100%",this.overlay.style.zIndex=this.overlay.style.zIndex||"3",this.overlay.style.pointerEvents="auto",this.overlay.parentElement!==e&&e.appendChild(this.overlay)}tryMountSimidLayer(e){const t=e?.simid??e?.SIMID??e?.simidLayer,r=t?.urls??t?.url??t?.resources??t?.iframeResources??e?.simidUrls??null,i=Array.isArray(r)?r.map(e=>String(e)).filter(e=>e.trim()):"string"==typeof r?[r].filter(e=>e.trim()):[];if(!i.length)return;this.ensureOverlayMounted();let n=this.overlay.querySelector(".op-ads__simid");n?n.innerHTML="":(n=document.createElement("div"),n.className="op-ads__simid",n.style.position="absolute",n.style.inset="0",n.style.pointerEvents="auto",this.overlay.appendChild(n));for(const e of i){const t=document.createElement("iframe");t.src=e,t.setAttribute("title","SIMID"),t.setAttribute("loading","lazy"),t.setAttribute("referrerpolicy","no-referrer"),t.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-popups"),t.style.width="100%",t.style.height="100%",t.style.border="0",n.appendChild(t)}}async playBreakFromVast(e,t,r){if(this.active)return!1;this.ensureOverlayMounted();const{events:i,leases:n,core:{media:a}}=this.ctx,s="url"===e.kind?e.value:"[xml]";this.bus.emit("ads:requested",s),this.log("requested",s,t),this.resumeAfter=!1!==this.cfg.resumeContent&&"postroll"!==t.kind;const o=()=>{try{a.pause()}catch{}return i.emit("cmd:pause"),!!n.acquire("playback",this.name)||(this.bus.emit("ads:error",{reason:"playback lease already owned",owner:n.owner("playback")}),this.ctx.events.emit("ads.error",{reason:"playback lease already owned",owner:n.owner("playback")}),!1)};let l=null;const c=async()=>{if(!l)try{const t=await this.getVastXmlText(e);l=this.buildParsedForNonLinearFromXml(t)}catch{l=null}};try{let i;if("url"===e.kind)try{i=await this.vastClient.get(e.value)}catch(e){if(await c(),!l)throw e;i=await this.vastClient.parseVAST(l)}else{const t="string"==typeof e.value?this.toXmlDocument(e.value):e.value instanceof XMLDocument?e.value:this.toXmlDocument((new XMLSerializer).serializeToString(e.value));l=t,i=await this.vastClient.parseVAST(t)}this.log("vast parsed",{ads:i?.ads?.length??0,version:i?.version});const n=e=>{this.bus.emit("ads:loaded",{break:t,count:e}),this.ctx.events.emit("ads.loaded",{break:t,count:e})};if("NONLINEAR"===t.sourceType){const e=this.collectNonLinearCreatives(i);if(e.length)return n(e.length),await this.playNonLinearOnlyBreak(i,t),!0;if(await c(),l){const e=this.collectNonLinearFromXml(l);if(e.length)return n(e.length),await this.playNonLinearOnlyBreakFromXml(e,t),!0}}let s=this.collectPodAds(i);if(this.log("linear pod items",s.length),!s.length){const e=this.collectNonLinearCreatives(i);if(e.length)return n(e.length),await this.playNonLinearOnlyBreak(i,t),!0;if(await c(),l&&(s=this.collectPodAdsFromXml(l),this.log("linear pod items (xml fallback)",s.length),!s.length)){const e=this.collectNonLinearFromXml(l);if(e.length)return n(e.length),await this.playNonLinearOnlyBreakFromXml(e,t),!0}}if(!s.length)throw this.warn("no playable ads found in VAST response"),new Error("No playable ads found in VAST response");if(n(s.length),!o())return!1;this.active=!0;for(let e=0;e<s.length;e++){const r=s[e];this.bus.emit("ads:ad:start",{break:t,index:e,sequence:r.sequence}),this.clearSession(),this.tracker=new z(this.vastClient,r.ad,r.creative),this._lastCreative=r.creative,this.log("mount ad video",{url:r.mediaFile?.fileURL,type:r.mediaFile?.type,skipOffset:r.skipOffset}),this.mountAdVideo(a,r.mediaFile);const i=this.waitForAdEnd();this.setupSkipUIForPodItem(r),this.log("skip ui",{raw:this.skipOffsetRaw,at:this.skipAtSeconds}),this.mountCompanions(r.creative),this.mountNonLinear(r.creative),this.cfg.allowNativeControls||this.bindAdSurfaceCommands(),this.tracker?.trackImpression?.(),this.bus.emit("ads:impression",{break:t,index:e}),this.bindTrackerAndTelemetry({kind:t.kind,breakId:t.id}),this.startAdPlayback(),await i,this.bus.emit("ads:ad:end",{break:t,index:e,sequence:r.sequence})}return this.bus.emit("ads:allAdsCompleted",{break:t}),this.ctx.events.emit("ads.allAdsCompleted",{break:t}),this.finish({resume:"postroll"!==t.kind&&(this.userPlayIntent||this.resumeAfter),suppressResume:r?.suppressResumeOnSuccess}),!0}catch(e){return this.bus.emit("ads:error",e),this.ctx.events.emit("ads.error",{err:e}),this.finish({resume:"postroll"!==t.kind&&(this.userPlayIntent||this.resumeAfter),suppressResume:r?.suppressResumeOnError}),!1}}waitForAdEnd(){return this.adEndPromise||Promise.resolve()}startAdPlayback(){const e=this.adVideo;if(this.ctx.events.emit("play"),!e)return;const t=t=>{try{t&&(e.muted=!0,e.volume=0,this.forcedMuteUntilInteraction=!0);const r=e.play?.();return r&&"function"==typeof r.then?r:void 0}catch{return}},r=t(!1);r&&r.catch(()=>{const e=t(!0);e&&e.catch(()=>{})})}clearSession(){for(const e of this.sessionUnsubs)e();if(this.sessionUnsubs=[],this.tracker=void 0,this.clearAdOverlays(),this.removeAdCaptions(),this.adVideo){try{this.adVideo.pause()}catch{}this.adVideo.remove(),this.adVideo=void 0}try{this.overlay.querySelectorAll("video.op-ads__media").forEach(e=>e?.parentNode?.removeChild?.(e)??e.remove?.())}catch{}this.adEndPromise=null,this.overlay.replaceChildren()}finish(t){const{events:r,leases:i}=this.ctx;this.clearSession(),this.contentMedia&&this.contentHadControls&&this.contentMedia.setAttribute("controls",""),this.contentMedia=void 0,this.contentHadControls=!1,this.overlay.style.display="none",this.overlay.replaceChildren(),i.release("playback",this.name),this.active=!1;const n=!!(t.resume||this.userPlayIntent||this.resumeAfter);this.userPlayIntent=!1,this.restoreActiveTextTrack();try{e.getOverlayManager(this.ctx.core).deactivate(this.overlayId)}catch{}t.suppressResume||(n?r.emit("cmd:play"):r.emit("cmd:pause"))}}function ne(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(Z=window).OpenPlayerPlugins=Z.OpenPlayerPlugins||{},Z.OpenPlayerPlugins.ads={name:"ads",kind:"plugin",factory:e=>new ie({...e||{},allowNativeControls:!1}),install:e=>function(e){e&&e.prototype&&(Object.getOwnPropertyDescriptor(e.prototype,"ads")||Object.defineProperty(e.prototype,"ads",{configurable:!0,enumerable:!1,get(){return this.getPlugin?.("ads")}}),"function"!=typeof e.prototype.playAds&&Object.defineProperty(e.prototype,"playAds",{configurable:!0,enumerable:!1,value:function(e){const t=this.getPlugin?.("ads")||this.ads;if(!t)throw new Error("Ads plugin not installed; cannot playAds()");const r=String(e??"").trim();if(!r)throw new Error("playAds(input) requires a non-empty URL or VAST XML string");if(r.startsWith("<")){if("function"!=typeof t.playAdsFromXml)throw new Error("Ads plugin does not support XML input (playAdsFromXml missing)");return t.playAdsFromXml(r)}return t.playAds(r)}}))}(e),extend:(e,t)=>function(e,t){e&&("function"==typeof e.extend?e.extend({ads:t}):void 0===e.ads&&(e.ads=t))}(e,t)},function(e){var t;(t=e.OpenPlayerJS)&&!t.prototype.playAds&&(t.prototype.playAds=function(e){const t="function"==typeof this.getCore?this.getCore():null;if(!t)throw new Error("Call player.init() before player.playAds()");const r="function"==typeof t.getPlugin?t.getPlugin("ads"):null;if(!r)throw new Error("Ads plugin not installed");const i=String(e??"").trim();if(!i)throw new Error("playAds(input) requires a non-empty URL or VAST XML string");return i.startsWith("<")?r.playAdsFromXml(i):r.playAds(i)})}(window);var ae,se,oe={},le={},ce={};function ue(){if(ae)return ce;function e(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}ae=1;var t=e({HTML:"text/html",isHTML:function(e){return e===t.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),r=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===r.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return ce.assign=function(e,t){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},ce.find=function(e,t,r){if(void 0===r&&(r=Array.prototype),e&&"function"==typeof r.find)return r.find.call(e,t);for(var i=0;i<e.length;i++)if(Object.prototype.hasOwnProperty.call(e,i)){var n=e[i];if(t.call(void 0,n,i,e))return n}},ce.freeze=e,ce.MIME_TYPE=t,ce.NAMESPACE=r,ce}function de(){if(se)return le;se=1;var e=ue(),t=e.find,r=e.NAMESPACE;function i(e){return""!==e}function n(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function a(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(i):[]}(e);return Object.keys(t.reduce(n,{}))}function s(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function o(e,t){var r=e.prototype;if(!(r instanceof t)){function i(){}i.prototype=t.prototype,s(r,i=new i),e.prototype=r=i}r.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),r.constructor=e)}var l={},c=l.ELEMENT_NODE=1,u=l.ATTRIBUTE_NODE=2,d=l.TEXT_NODE=3,h=l.CDATA_SECTION_NODE=4,p=l.ENTITY_REFERENCE_NODE=5,m=l.ENTITY_NODE=6,f=l.PROCESSING_INSTRUCTION_NODE=7,g=l.COMMENT_NODE=8,v=l.DOCUMENT_NODE=9,b=l.DOCUMENT_TYPE_NODE=10,y=l.DOCUMENT_FRAGMENT_NODE=11,k=l.NOTATION_NODE=12,T={},A={};T.INDEX_SIZE_ERR=(A[1]="Index size error",1),T.DOMSTRING_SIZE_ERR=(A[2]="DOMString size error",2);var w=T.HIERARCHY_REQUEST_ERR=(A[3]="Hierarchy request error",3);T.WRONG_DOCUMENT_ERR=(A[4]="Wrong document",4),T.INVALID_CHARACTER_ERR=(A[5]="Invalid character",5),T.NO_DATA_ALLOWED_ERR=(A[6]="No data allowed",6),T.NO_MODIFICATION_ALLOWED_ERR=(A[7]="No modification allowed",7);var N=T.NOT_FOUND_ERR=(A[8]="Not found",8);T.NOT_SUPPORTED_ERR=(A[9]="Not supported",9);var E=T.INUSE_ATTRIBUTE_ERR=(A[10]="Attribute in use",10);function R(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,A[e]),this.message=A[e],Error.captureStackTrace&&Error.captureStackTrace(this,R);return r.code=e,t&&(this.message=this.message+": "+t),r}function L(){}function C(e,t){this._node=e,this._refresh=t,x(this)}function x(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(ke(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var i=r.length;i in e;i++)Object.prototype.hasOwnProperty.call(e,i)&&delete e[i];s(r,e),e._inc=t}}function S(){}function D(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function I(e,t,i,n){if(n?t[D(t,n)]=i:t[t.length++]=i,e){i.ownerElement=e;var a=e.ownerDocument;a&&(n&&V(a,e,n),function(e,t,i){e&&e._inc++;var n=i.namespaceURI;n===r.XMLNS&&(t._nsMap[i.prefix?i.localName:""]=i.value)}(a,e,i))}}function O(e,t,r){var i=D(t,r);if(!(i>=0))throw new R(N,new Error(e.tagName+"@"+r));for(var n=t.length-1;i<n;)t[i]=t[++i];if(t.length=n,e){var a=e.ownerDocument;a&&(V(a,e,r),r.ownerElement=null)}}function U(){}function P(){}function M(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function q(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(q(e,t))return!0}while(e=e.nextSibling)}function B(){this.ownerDocument=this}function V(e,t,i,n){e&&e._inc++,i.namespaceURI===r.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function F(e,t,r){if(e&&e._inc){e._inc++;var i=t.childNodes;if(r)i[i.length++]=r;else{for(var n=t.firstChild,a=0;n;)i[a++]=n,n=n.nextSibling;i.length=a,delete i[i.length]}}}function _(e,t){var r=t.previousSibling,i=t.nextSibling;return r?r.nextSibling=i:e.firstChild=i,i?i.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,F(e.ownerDocument,e),t}function j(e){return e&&e.nodeType===P.DOCUMENT_TYPE_NODE}function W(e){return e&&e.nodeType===P.ELEMENT_NODE}function H(e){return e&&e.nodeType===P.TEXT_NODE}function G(e,r){var i=e.childNodes||[];if(t(i,W)||j(r))return!1;var n=t(i,j);return!(r&&n&&i.indexOf(n)>i.indexOf(r))}function X(e,r){var i=e.childNodes||[];if(t(i,function(e){return W(e)&&e!==r}))return!1;var n=t(i,j);return!(r&&n&&i.indexOf(n)>i.indexOf(r))}function z(e,t,r){if(!function(e){return e&&(e.nodeType===P.DOCUMENT_NODE||e.nodeType===P.DOCUMENT_FRAGMENT_NODE||e.nodeType===P.ELEMENT_NODE)}(e))throw new R(w,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new R(N,"child not in parent");if(!function(e){return e&&(W(e)||H(e)||j(e)||e.nodeType===P.DOCUMENT_FRAGMENT_NODE||e.nodeType===P.COMMENT_NODE||e.nodeType===P.PROCESSING_INSTRUCTION_NODE)}(t)||j(t)&&e.nodeType!==P.DOCUMENT_NODE)throw new R(w,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function K(e,r,i){var n=e.childNodes||[],a=r.childNodes||[];if(r.nodeType===P.DOCUMENT_FRAGMENT_NODE){var s=a.filter(W);if(s.length>1||t(a,H))throw new R(w,"More than one element or text in fragment");if(1===s.length&&!G(e,i))throw new R(w,"Element in fragment can not be inserted before doctype")}if(W(r)&&!G(e,i))throw new R(w,"Only one element can be added and only after doctype");if(j(r)){if(t(n,j))throw new R(w,"Only one doctype is allowed");var o=t(n,W);if(i&&n.indexOf(o)<n.indexOf(i))throw new R(w,"Doctype can only be inserted before an element");if(!i&&o)throw new R(w,"Doctype can not be appended since element is present")}}function $(e,r,i){var n=e.childNodes||[],a=r.childNodes||[];if(r.nodeType===P.DOCUMENT_FRAGMENT_NODE){var s=a.filter(W);if(s.length>1||t(a,H))throw new R(w,"More than one element or text in fragment");if(1===s.length&&!X(e,i))throw new R(w,"Element in fragment can not be inserted before doctype")}if(W(r)&&!X(e,i))throw new R(w,"Only one element can be added and only after doctype");if(j(r)){function l(e){return j(e)&&e!==i}if(t(n,l))throw new R(w,"Only one doctype is allowed");var o=t(n,W);if(i&&n.indexOf(o)<n.indexOf(i))throw new R(w,"Doctype can only be inserted before an element")}}function Y(e,t,r,i){z(e,t,r),e.nodeType===P.DOCUMENT_NODE&&(i||K)(e,t,r);var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===y){var a=t.firstChild;if(null==a)return t;var s=t.lastChild}else a=s=t;var o=r?r.previousSibling:e.lastChild;a.previousSibling=o,s.nextSibling=r,o?o.nextSibling=a:e.firstChild=a,null==r?e.lastChild=s:r.previousSibling=s;do{a.parentNode=e,Q(a,e.ownerDocument||e)}while(a!==s&&(a=a.nextSibling));return F(e.ownerDocument||e,e),t.nodeType==y&&(t.firstChild=t.lastChild=null),t}function Q(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===c&&e.attributes)for(var r=0;r<e.attributes.length;r++){var i=e.attributes.item(r);i&&(i.ownerDocument=t)}for(var n=e.firstChild;n;)Q(n,t),n=n.nextSibling}}function J(){this._nsMap={}}function Z(){}function ee(){}function te(){}function re(){}function ie(){}function ne(){}function ae(){}function oe(){}function ce(){}function de(){}function he(){}function pe(){}function me(e,t){var r=[],i=9==this.nodeType&&this.documentElement||this,n=i.prefix,a=i.namespaceURI;if(a&&null==n&&null==(n=i.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return ve(this,r,e,t,s),r.join("")}function fe(e,t,i){var n=e.prefix||"",a=e.namespaceURI;if(!a)return!1;if("xml"===n&&a===r.XML||a===r.XMLNS)return!1;for(var s=i.length;s--;){var o=i[s];if(o.prefix===n)return o.namespace!==a}return!0}function ge(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,M),'"')}function ve(e,t,i,n,a){if(a||(a=[]),n){if(!(e=n(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case c:var s=e.attributes,o=s.length,l=e.firstChild,m=e.tagName,k=m;if(!(i=r.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var T,A=0;A<s.length;A++)if("xmlns"===s.item(A).name){T=s.item(A).value;break}if(!T)for(var w=a.length-1;w>=0;w--){if(""===(N=a[w]).prefix&&N.namespace===e.namespaceURI){T=N.namespace;break}}if(T!==e.namespaceURI)for(w=a.length-1;w>=0;w--){var N;if((N=a[w]).namespace===e.namespaceURI){N.prefix&&(k=N.prefix+":"+m);break}}}t.push("<",k);for(var E=0;E<o;E++){"xmlns"==(R=s.item(E)).prefix?a.push({prefix:R.localName,namespace:R.value}):"xmlns"==R.nodeName&&a.push({prefix:"",namespace:R.value})}for(E=0;E<o;E++){var R,L,C;if(fe(R=s.item(E),0,a))ge(t,(L=R.prefix||"")?"xmlns:"+L:"xmlns",C=R.namespaceURI),a.push({prefix:L,namespace:C});ve(R,t,i,n,a)}if(m===k&&fe(e,0,a))ge(t,(L=e.prefix||"")?"xmlns:"+L:"xmlns",C=e.namespaceURI),a.push({prefix:L,namespace:C});if(l||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(m)){if(t.push(">"),i&&/^script$/i.test(m))for(;l;)l.data?t.push(l.data):ve(l,t,i,n,a.slice()),l=l.nextSibling;else for(;l;)ve(l,t,i,n,a.slice()),l=l.nextSibling;t.push("</",k,">")}else t.push("/>");return;case v:case y:for(l=e.firstChild;l;)ve(l,t,i,n,a.slice()),l=l.nextSibling;return;case u:return ge(t,e.name,e.value);case d:return t.push(e.data.replace(/[<&>]/g,M));case h:return t.push("<![CDATA[",e.data,"]]>");case g:return t.push("\x3c!--",e.data,"--\x3e");case b:var x=e.publicId,S=e.systemId;if(t.push("<!DOCTYPE ",e.name),x)t.push(" PUBLIC ",x),S&&"."!=S&&t.push(" ",S),t.push(">");else if(S&&"."!=S)t.push(" SYSTEM ",S,">");else{var D=e.internalSubset;D&&t.push(" [",D,"]"),t.push(">")}return;case f:return t.push("<?",e.target," ",e.data,"?>");case p:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function be(e,t,r){var i;switch(t.nodeType){case c:(i=t.cloneNode(!1)).ownerDocument=e;case y:break;case u:r=!0}if(i||(i=t.cloneNode(!1)),i.ownerDocument=e,i.parentNode=null,r)for(var n=t.firstChild;n;)i.appendChild(be(e,n,r)),n=n.nextSibling;return i}function ye(e,t,r){var i=new t.constructor;for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var a=t[n];"object"!=typeof a&&a!=i[n]&&(i[n]=a)}switch(t.childNodes&&(i.childNodes=new L),i.ownerDocument=e,i.nodeType){case c:var s=t.attributes,o=i.attributes=new S,l=s.length;o._ownerElement=i;for(var d=0;d<l;d++)i.setAttributeNode(ye(e,s.item(d),!0));break;case u:r=!0}if(r)for(var h=t.firstChild;h;)i.appendChild(ye(e,h,r)),h=h.nextSibling;return i}function ke(e,t,r){e[t]=r}T.INVALID_STATE_ERR=(A[11]="Invalid state",11),T.SYNTAX_ERR=(A[12]="Syntax error",12),T.INVALID_MODIFICATION_ERR=(A[13]="Invalid modification",13),T.NAMESPACE_ERR=(A[14]="Invalid namespace",14),T.INVALID_ACCESS_ERR=(A[15]="Invalid access",15),R.prototype=Error.prototype,s(T,R),L.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t){for(var r=[],i=0;i<this.length;i++)ve(this[i],r,e,t);return r.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},C.prototype.item=function(e){return x(this),this[e]||null},o(C,L),S.prototype={length:0,item:L.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new R(E);var r=this.getNamedItem(e.nodeName);return I(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t,r=e.ownerElement;if(r&&r!=this._ownerElement)throw new R(E);return t=this.getNamedItemNS(e.namespaceURI,e.localName),I(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return O(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return O(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var i=this[r];if(i.localName==t&&i.namespaceURI==e)return i}return null}},U.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var i=new B;if(i.implementation=this,i.childNodes=new L,i.doctype=r||null,r&&i.appendChild(r),t){var n=i.createElementNS(e,t);i.appendChild(n)}return i},createDocumentType:function(e,t,r){var i=new ne;return i.name=e,i.nodeName=e,i.publicId=t||"",i.systemId=r||"",i}},P.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return Y(this,e,t)},replaceChild:function(e,t){Y(this,e,t,$),t&&this.removeChild(t)},removeChild:function(e){return _(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return ye(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==d&&e.nodeType==d?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r)for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)&&r[i]===e)return i;t=t.nodeType==u?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,e))return r[e];t=t.nodeType==u?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},s(l,P),s(l,P.prototype),B.prototype={nodeName:"#document",nodeType:v,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==y){for(var r=e.firstChild;r;){var i=r.nextSibling;this.insertBefore(r,t),r=i}return e}return Y(this,e,t),Q(e,this),null===this.documentElement&&e.nodeType===c&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),_(this,e)},replaceChild:function(e,t){Y(this,e,t,$),Q(e,this),t&&this.removeChild(t),W(e)&&(this.documentElement=e)},importNode:function(e,t){return be(this,e,t)},getElementById:function(e){var t=null;return q(this.documentElement,function(r){if(r.nodeType==c&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=a(e);return new C(this,function(r){var i=[];return t.length>0&&q(r.documentElement,function(n){if(n!==r&&n.nodeType===c){var s=n.getAttribute("class");if(s){var o=e===s;if(!o){var l=a(s);o=t.every((u=l,function(e){return u&&-1!==u.indexOf(e)}))}o&&i.push(n)}}var u}),i})},createElement:function(e){var t=new J;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new L,(t.attributes=new S)._ownerElement=t,t},createDocumentFragment:function(){var e=new de;return e.ownerDocument=this,e.childNodes=new L,e},createTextNode:function(e){var t=new te;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new re;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new ie;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new he;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new Z;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new ce;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new J,i=t.split(":"),n=r.attributes=new S;return r.childNodes=new L,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=t,n._ownerElement=r,r},createAttributeNS:function(e,t){var r=new Z,i=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=t,r}},o(B,P),J.prototype={nodeType:c,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===y?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,F(e.ownerDocument,e,t),Q(t,e.ownerDocument||e),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var i=this.ownerDocument.createAttributeNS(e,t);i.value=i.nodeValue=""+r,this.setAttributeNode(i)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new C(this,function(t){var r=[];return q(t,function(i){i===t||i.nodeType!=c||"*"!==e&&i.tagName!=e||r.push(i)}),r})},getElementsByTagNameNS:function(e,t){return new C(this,function(r){var i=[];return q(r,function(n){n===r||n.nodeType!==c||"*"!==e&&n.namespaceURI!==e||"*"!==t&&n.localName!=t||i.push(n)}),i})}},B.prototype.getElementsByTagName=J.prototype.getElementsByTagName,B.prototype.getElementsByTagNameNS=J.prototype.getElementsByTagNameNS,o(J,P),Z.prototype.nodeType=u,o(Z,P),ee.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(A[w])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){r=this.data.substring(0,e)+r+this.data.substring(e+t),this.nodeValue=this.data=r,this.length=r.length}},o(ee,P),te.prototype={nodeName:"#text",nodeType:d,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var i=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},o(te,ee),re.prototype={nodeName:"#comment",nodeType:g},o(re,ee),ie.prototype={nodeName:"#cdata-section",nodeType:h},o(ie,ee),ne.prototype.nodeType=b,o(ne,P),ae.prototype.nodeType=k,o(ae,P),oe.prototype.nodeType=m,o(oe,P),ce.prototype.nodeType=p,o(ce,P),de.prototype.nodeName="#document-fragment",de.prototype.nodeType=y,o(de,P),he.prototype.nodeType=f,o(he,P),pe.prototype.serializeToString=function(e,t,r){return me.call(e,t,r)},P.prototype.toString=me;try{if(Object.defineProperty){function Te(e){switch(e.nodeType){case c:case y:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(Te(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(C.prototype,"length",{get:function(){return x(this),this.$$length}}),Object.defineProperty(P.prototype,"textContent",{get:function(){return Te(this)},set:function(e){switch(this.nodeType){case c:case y:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),ke=function(e,t,r){e["$$"+t]=r}}}catch(Ae){}return le.DocumentType=ne,le.DOMException=R,le.DOMImplementation=U,le.Element=J,le.Node=P,le.NodeList=L,le.XMLSerializer=pe,le}var he,pe={},me={};function fe(){return he||(he=1,e=me,t=ue().freeze,e.XML_ENTITIES=t({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=t({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),e.entityMap=e.HTML_ENTITIES),me;var e,t}var ge,ve,be,ye={};function ke(){if(ge)return ye;ge=1;var e=ue().NAMESPACE,t=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,r=new RegExp("[\\-\\.0-9"+t.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+t.source+r.source+"*(?::"+t.source+r.source+"*)?$");function n(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,n)}function a(){}function s(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function o(t,r,i,n,a,s){function o(e,t,r){i.attributeNames.hasOwnProperty(e)&&s.fatalError("Attribute "+e+" redefined"),i.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,a),r)}for(var l,c=++r,u=0;;){var d=t.charAt(c);switch(d){case"=":if(1===u)l=t.slice(r,c),u=3;else{if(2!==u)throw new Error("attribute equal must after attrName");u=3}break;case"'":case'"':if(3===u||1===u){if(1===u&&(s.warning('attribute value must after "="'),l=t.slice(r,c)),r=c+1,!((c=t.indexOf(d,r))>0))throw new Error("attribute value no end '"+d+"' match");o(l,h=t.slice(r,c),r-1),u=5}else{if(4!=u)throw new Error('attribute value must after "="');o(l,h=t.slice(r,c),r),s.warning('attribute "'+l+'" missed start quot('+d+")!!"),r=c+1,u=5}break;case"/":switch(u){case 0:i.setTagName(t.slice(r,c));case 5:case 6:case 7:u=7,i.closed=!0;case 4:case 1:break;case 2:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),0==u&&i.setTagName(t.slice(r,c)),c;case">":switch(u){case 0:i.setTagName(t.slice(r,c));case 5:case 6:case 7:break;case 4:case 1:"/"===(h=t.slice(r,c)).slice(-1)&&(i.closed=!0,h=h.slice(0,-1));case 2:2===u&&(h=l),4==u?(s.warning('attribute "'+h+'" missed quot(")!'),o(l,h,r)):(e.isHTML(n[""])&&h.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+h+'" missed value!! "'+h+'" instead!!'),o(h,h,r));break;case 3:throw new Error("attribute value missed!!")}return c;case"":d=" ";default:if(d<=" ")switch(u){case 0:i.setTagName(t.slice(r,c)),u=6;break;case 1:l=t.slice(r,c),u=2;break;case 4:var h=t.slice(r,c);s.warning('attribute "'+h+'" missed quot(")!!'),o(l,h,r);case 5:u=6}else switch(u){case 2:e.isHTML(n[""])&&l.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),o(l,l,r),r=c,u=1;break;case 5:s.warning('attribute space is required"'+l+'"!!');case 6:u=1,r=c;break;case 3:u=4,r=c;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function l(t,r,i){for(var n=t.tagName,a=null,s=t.length;s--;){var o=t[s],l=o.qName,c=o.value;if((m=l.indexOf(":"))>0)var u=o.prefix=l.slice(0,m),h=l.slice(m+1),p="xmlns"===u&&h;else h=l,u=null,p="xmlns"===l&&"";o.localName=h,!1!==p&&(null==a&&(a={},d(i,i={})),i[p]=a[p]=c,o.uri=e.XMLNS,r.startPrefixMapping(p,c))}for(s=t.length;s--;){(u=(o=t[s]).prefix)&&("xml"===u&&(o.uri=e.XML),"xmlns"!==u&&(o.uri=i[u||""]))}var m;(m=n.indexOf(":"))>0?(u=t.prefix=n.slice(0,m),h=t.localName=n.slice(m+1)):(u=null,h=t.localName=n);var f=t.uri=i[u||""];if(r.startElement(f,h,n,t),!t.closed)return t.currentNSMap=i,t.localNSMap=a,!0;if(r.endElement(f,h,n),a)for(u in a)Object.prototype.hasOwnProperty.call(a,u)&&r.endPrefixMapping(u)}function c(e,t,r,i,n){if(/^(?:script|textarea)$/i.test(r)){var a=e.indexOf("</"+r+">",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(r)?(n.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,i),n.characters(s,0,s.length),a)}return t+1}function u(e,t,r,i){var n=i[r];return null==n&&((n=e.lastIndexOf("</"+r+">"))<t&&(n=e.lastIndexOf("</"+r)),i[r]=n),n<t}function d(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function h(e,t,r,i){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(n=e.indexOf("--\x3e",t+4))>t?(r.comment(e,t+4,n-t-4),n+3):(i.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var n=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,n-t-9),r.endCDATA(),n+3}var a=function(e,t){var r,i=[],n=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;n.lastIndex=t,n.exec(e);for(;r=n.exec(e);)if(i.push(r),r[1])return i}(e,t),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var o=a[1][0],l=!1,c=!1;s>3&&(/^public$/i.test(a[2][0])?(l=a[3][0],c=s>4&&a[4][0]):/^system$/i.test(a[2][0])&&(c=a[3][0]));var u=a[s-1];return r.startDTD(o,l,c),r.endDTD(),u.index+u[0].length}return-1}function p(e,t,r){var i=e.indexOf("?>",t);if(i){var n=e.substring(t,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return n?(r.processingInstruction(n[1],n[2]),i+2):-1}return-1}function m(){this.attributeNames={}}return n.prototype=new Error,n.prototype.name=n.name,a.prototype={parse:function(t,r,i){var a=this.domBuilder;a.startDocument(),d(r,r={}),function(t,r,i,a,d){function f(e){if(e>65535){var t=55296+((e-=65536)>>10),r=56320+(1023&e);return String.fromCharCode(t,r)}return String.fromCharCode(e)}function g(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(i,t)?i[t]:"#"===t.charAt(0)?f(parseInt(t.substr(1).replace("x","0x"))):(d.error("entity not found:"+e),e)}function v(e){if(e>E){var r=t.substring(E,e).replace(/&#?\w+;/g,g);A&&b(E),a.characters(r,0,e-E),E=e}}function b(e,r){for(;e>=k&&(r=T.exec(t));)y=r.index,k=y+r[0].length,A.lineNumber++;A.columnNumber=e-y+1}var y=0,k=0,T=/.*(?:\r\n?|\n)|.*$/g,A=a.locator,w=[{currentNSMap:r}],N={},E=0;for(;;){try{var R=t.indexOf("<",E);if(R<0){if(!t.substr(E).match(/^\s*$/)){var L=a.doc,C=L.createTextNode(t.substr(E));L.appendChild(C),a.currentElement=C}return}switch(R>E&&v(R),t.charAt(R+1)){case"/":var x=t.indexOf(">",R+3),S=t.substring(R+2,x).replace(/[ \t\n\r]+$/g,""),D=w.pop();x<0?(S=t.substring(R+2).replace(/[\s<].*/,""),d.error("end tag name: "+S+" is not complete:"+D.tagName),x=R+1+S.length):S.match(/\s</)&&(S=S.replace(/[\s<].*/,""),d.error("end tag name: "+S+" maybe not complete"),x=R+1+S.length);var I=D.localNSMap,O=D.tagName==S;if(O||D.tagName&&D.tagName.toLowerCase()==S.toLowerCase()){if(a.endElement(D.uri,D.localName,S),I)for(var U in I)Object.prototype.hasOwnProperty.call(I,U)&&a.endPrefixMapping(U);O||d.fatalError("end tag name: "+S+" is not match the current start tagName:"+D.tagName)}else w.push(D);x++;break;case"?":A&&b(R),x=p(t,R,a);break;case"!":A&&b(R),x=h(t,R,a,d);break;default:A&&b(R);var P=new m,M=w[w.length-1].currentNSMap,q=(x=o(t,R,P,M,g,d),P.length);if(!P.closed&&u(t,x,P.tagName,N)&&(P.closed=!0,i.nbsp||d.warning("unclosed xml attribute")),A&&q){for(var B=s(A,{}),V=0;V<q;V++){var F=P[V];b(F.offset),F.locator=s(A,{})}a.locator=B,l(P,a,M)&&w.push(P),a.locator=A}else l(P,a,M)&&w.push(P);e.isHTML(P.uri)&&!P.closed?x=c(t,x,P.tagName,g,a):x++}}catch(e){if(e instanceof n)throw e;d.error("element parse error: "+e),x=-1}x>E?E=x:v(Math.max(R,E)+1)}}(t,r,i,a,this.errorHandler),a.endDocument()}},m.prototype={setTagName:function(e){if(!i.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!i.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},ye.XMLReader=a,ye.ParseError=n,ye}function Te(){if(ve)return pe;ve=1;var e=ue(),t=de(),r=fe(),i=ke(),n=t.DOMImplementation,a=e.NAMESPACE,s=i.ParseError,o=i.XMLReader;function l(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function c(e){this.options=e||{locator:{}}}function u(){this.cdata=!1}function d(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function h(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function p(e,t,r){return"string"==typeof e?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}function m(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}return c.prototype.parseFromString=function(e,t){var i=this.options,n=new o,s=i.domBuilder||new u,c=i.errorHandler,d=i.locator,p=i.xmlns||{},m=/\/x?html?$/.test(t),f=m?r.HTML_ENTITIES:r.XML_ENTITIES;d&&s.setDocumentLocator(d),n.errorHandler=function(e,t,r){if(!e){if(t instanceof u)return t;e=t}var i={},n=e instanceof Function;function a(t){var a=e[t];!a&&n&&(a=2==e.length?function(r){e(t,r)}:e),i[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+h(r))}||function(){}}return r=r||{},a("warning"),a("error"),a("fatalError"),i}(c,s,d),n.domBuilder=i.domBuilder||s,m&&(p[""]=a.HTML),p.xml=p.xml||a.XML;var g=i.normalizeLineEndings||l;return e&&"string"==typeof e?n.parse(g(e),p,f):n.errorHandler.error("invalid doc source"),s.doc},u.prototype={startDocument:function(){this.doc=(new n).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,i){var n=this.doc,a=n.createElementNS(e,r||t),s=i.length;m(this,a),this.currentElement=a,this.locator&&d(this.locator,a);for(var o=0;o<s;o++){e=i.getURI(o);var l=i.getValue(o),c=(r=i.getQName(o),n.createAttributeNS(e,r));this.locator&&d(i.getLocator(o),c),c.value=c.nodeValue=l,a.setAttributeNode(c)}},endElement:function(e,t,r){var i=this.currentElement;this.currentElement=i.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&d(this.locator,r),m(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=p.apply(this,arguments)){if(this.cdata)var i=this.doc.createCDATASection(e);else i=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(e)&&this.doc.appendChild(i),this.locator&&d(this.locator,i)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=p.apply(this,arguments);var i=this.doc.createComment(e);this.locator&&d(this.locator,i),m(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var i=this.doc.implementation;if(i&&i.createDocumentType){var n=i.createDocumentType(e,t,r);this.locator&&d(this.locator,n),m(this,n),this.doc.doctype=n}},warning:function(e){console.warn("[xmldom warning]\t"+e,h(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,h(this.locator))},fatalError:function(e){throw new s(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){u.prototype[e]=function(){return null}}),pe.__DOMHandler=u,pe.normalizeLineEndings=l,pe.DOMParser=c,pe}function Ae(){if(be)return oe;be=1;var e=de();return oe.DOMImplementation=e.DOMImplementation,oe.XMLSerializer=e.XMLSerializer,oe.DOMParser=Te().DOMParser,oe}var we=Ae(),Ne=t({__proto__:null,default:ne(we)},[we])});
|
|
2
2
|
//# sourceMappingURL=openplayer-ads.js.map
|