';$(t).on("adReady",function(){r("SF | Image Widget | Create"),$("div[data-type=image]").each(function(n,i){var s,a,c=$(i).data("format"),u=$(i).attr("loading");if(c){if("string"==typeof c)try{c=c.replace(/"/gm,'"'),c=JSON.parse(c)}catch(o){}"string"==typeof c&&"%"===c.substr(0,1)&&(c=[]),r("SF | Image Widget | Create picture element with formats: "+c);var l=$(t.createElement("picture")),d=$("img",i),f=$(i).attr("data-original"),p=d.attr("src")||d.attr("data-src");if(!e.isTemplate&&p){if(s=p.lastIndexOf("?"),s>-1&&(p=p.substr(0,s)),a=p.lastIndexOf("."),p=a>-1?p.substr(0,a):p,r("SF | Image Widget | Image Name: "+p,2),c.length&&!f){l.append("");for(var m=0;m")}u&&d.attr("loading",u),l.append(d),d.on("error",function(e){$(this).siblings("source").remove()}),$(i).append(l),r("SF | Image Widget | Finished creating "+p)}}})}),$('div[data-type=image] > img[src^="%%"], div[data-type=image] > img[data-src^="%%"]').parent().addClass("temp-placeholder").append($(n)),$('div[data-type=image] > img[src^="%%"], div[data-type=image] > img[data-src^="%%"]').removeAttr("src","").removeAttr("data-src")}(window,document);function assert(e,t){e||error(t)}!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.Decoder=t()}(this,function(){function e(){r=this,r||("undefined"!=typeof window?r=window:"undefined"!=typeof self&&(r=self))}function t(e){console.error(e),console.trace()}var r;e();var a=function(e,t){function a(e){i(!ie);var t=ne;return ne=ne+e+15&-16,t}function n(e,t){t||(t=de);var r=e=Math.ceil(e/t)*t;return r}function i(e,t){e||L("Assertion failed: "+t)}function o(e,t){if(0===t||!e)return"";for(var r,a=0,n=0;;){if(r=J[e+n>>0],a|=r,0==r&&!t)break;if(n++,t&&n==t)break}t||(t=n);var i="";if(a<128){for(var o,s=1024;t>0;)o=String.fromCharCode.apply(String,J.subarray(e,e+Math.min(t,s))),i=i?i+o:o,e+=s,t-=s;return i}return u(e)}function s(e,t){for(var r=t;e[r];)++r;if(r-t>16&&e.subarray&&ve)return ve.decode(e.subarray(t,r));for(var a,n,i,o,s,u,f="";;){if(a=e[t++],!a)return f;if(128&a)if(n=63&e[t++],192!=(224&a))if(i=63&e[t++],224==(240&a)?a=(15&a)<<12|n<<6|i:(o=63&e[t++],240==(248&a)?a=(7&a)<<18|n<<12|i<<6|o:(s=63&e[t++],248==(252&a)?a=(3&a)<<24|n<<18|i<<12|o<<6|s:(u=63&e[t++],a=(1&a)<<30|n<<24|i<<18|o<<12|s<<6|u))),a<65536)f+=String.fromCharCode(a);else{var c=a-65536;f+=String.fromCharCode(55296|c>>10,56320|1023&c)}else f+=String.fromCharCode((31&a)<<6|n);else f+=String.fromCharCode(a)}}function u(e){return s(J,e)}function f(e,t){return e%t>0&&(e+=t-e%t),e}function c(e){G.buffer=q=e}function d(){G.HEAP8=K=new Int8Array(q),G.HEAP16=Z=new Int16Array(q),G.HEAP32=$=new Int32Array(q),G.HEAPU8=J=new Uint8Array(q),G.HEAPU16=Q=new Uint16Array(q),G.HEAPU32=ee=new Uint32Array(q),G.HEAPF32=te=new Float32Array(q),G.HEAPF64=re=new Float64Array(q)}function h(){L("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+we+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function l(){h()}function p(){return we}function m(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?G.dynCall_v(r):G.dynCall_vi(r,t.arg):r(void 0===t.arg?null:t.arg)}else t()}}function v(){if(G.preRun)for("function"==typeof G.preRun&&(G.preRun=[G.preRun]);G.preRun.length;)T(G.preRun.shift());m(Te)}function y(){Re||(Re=!0,m(Ae))}function g(){m(xe)}function b(){m(Se),Ee=!0}function w(){if(G.postRun)for("function"==typeof G.postRun&&(G.postRun=[G.postRun]);G.postRun.length;)A(G.postRun.shift());m(Ue)}function T(e){Te.unshift(e)}function A(e){Ue.unshift(e)}function x(e){Ce++,G.monitorRunDependencies&&G.monitorRunDependencies(Ce)}function S(e){if(Ce--,G.monitorRunDependencies&&G.monitorRunDependencies(Ce),0==Ce&&(null!==Pe&&(clearInterval(Pe),Pe=null),_e)){var t=_e;_e=null,t()}}function U(e){return String.prototype.startsWith?e.startsWith(Me):0===e.indexOf(Me)}function R(){function e(e){var t=G.buffer;e.byteLength>2]=r.position,r.getdents&&0===o&&0===i&&(r.getdents=null),0}catch(s){return"undefined"!=typeof FS&&s instanceof FS.ErrnoError||L(s),-s.errno}}function C(e,t){ke.varargs=t;try{var r=ke.get(),a=ke.get(),n=ke.get(),o=0;C.buffers||(C.buffers=[null,[],[]],C.printChar=function(e,t){var r=C.buffers[e];i(r),0===t||10===t?((1===e?G.print:G.printErr)(s(r,0)),r.length=0):r.push(t)});for(var u=0;u>2],c=$[a+(8*u+4)>>2],d=0;d>2]=e),e}function F(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function O(e){function t(){G.calledRun||(G.calledRun=!0,pe||(y(),g(),G.onRuntimeInitialized&&G.onRuntimeInitialized(),w()))}e=e||G.arguments,Ce>0||(v(),Ce>0||G.calledRun||(G.setStatus?(G.setStatus("Running..."),setTimeout(function(){setTimeout(function(){G.setStatus("")},1),t()},1)):t()))}function I(e,t){t&&G.noExitRuntime&&0===e||(G.noExitRuntime||(pe=!0,me=e,se=Fe,b(),G.onExit&&G.onExit(e)),Y&&process.exit(e),G.quit(e,new F(e)))}function L(e){throw G.onAbort&&G.onAbort(e),void 0!==e?(G.print(e),G.printErr(e),e=JSON.stringify(e)):e="",pe=!0,me=1,"abort("+e+"). Build with -s ASSERTIONS=1 for more info."}var N,G="undefined"!=typeof G?G:{},z={};for(N in G)G.hasOwnProperty(N)&&(z[N]=G[N]);G.arguments=[],G.thisProgram="./this.program",G.quit=function(e,t){throw t},G.preRun=[],G.postRun=[];var W=!1,j=!1,Y=!1,V=!1;if(G.ENVIRONMENT)if("WEB"===G.ENVIRONMENT)W=!0;else if("WORKER"===G.ENVIRONMENT)j=!0;else if("NODE"===G.ENVIRONMENT)Y=!0;else{if("SHELL"!==G.ENVIRONMENT)throw new Error("Module['ENVIRONMENT'] value is not valid. must be one of: WEB|WORKER|NODE|SHELL.");V=!0}else W="object"==typeof window,j="function"==typeof importScripts,Y="object"==typeof process&&!1&&!W&&!j,V=!W&&!Y&&!j;if(Y){var X,H;G.read=function(e,t){var r;return X||(X=null("fs")),H||(H=null("path")),e=H.normalize(e),r=X.readFileSync(e),t?r:r.toString()},G.readBinary=function(e){var t=G.read(e,!0);return t.buffer||(t=new Uint8Array(t)),i(t.buffer),t},process.argv.length>1&&(G.thisProgram=process.argv[1].replace(/\\/g,"/")),G.arguments=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=G),process.on("uncaughtException",function(e){if(!(e instanceof F))throw e}),process.on("unhandledRejection",function(e,t){process.exit(1)}),G.inspect=function(){return"[Emscripten Module object]"}}else if(V)"undefined"!=typeof read&&(G.read=function(e){return read(e)}),G.readBinary=function(e){var t;return"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(t=read(e,"binary"),i("object"==typeof t),t)},"undefined"!=typeof scriptArgs?G.arguments=scriptArgs:"undefined"!=typeof arguments&&(G.arguments=arguments),"function"==typeof quit&&(G.quit=function(e,t){quit(e)});else{if(!W&&!j)throw new Error("not compiled for this environment");G.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},j&&(G.readBinary=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),G.readAsync=function(e,t,r){var a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType="arraybuffer",a.onload=function(){return 200==a.status||0==a.status&&a.response?void t(a.response):void r()},a.onerror=r,a.send(null)},G.setWindowTitle=function(e){document.title=e}}G.print="undefined"!=typeof console?console.log.bind(console):"undefined"!=typeof print?print:null,G.printErr="undefined"!=typeof printErr?printErr:"undefined"!=typeof console&&console.warn.bind(console)||G.print,G.print=G.print,G.printErr=G.printErr;for(N in z)z.hasOwnProperty(N)&&(G[N]=z[N]);z=void 0;var q,K,J,Z,Q,$,ee,te,re,ae,ne,ie,oe,se,ue,fe,ce,de=16,he={"f64-rem":function(e,t){return e%t},"debugger":function(){}},le=(new Array(0),1024),pe=0,me=0,ve="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,ye=("undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,65536),ge=16777216;ae=ne=oe=se=ue=fe=ce=0,ie=!1;var be=G.TOTAL_STACK||5242880,we=G.TOTAL_MEMORY||52428800;if(we>2];return t},getStr:function(){var e=o(ke.get());return e},get64:function(){var e=ke.get(),t=ke.get();return i(e>=0?0===t:t===-1),e},getZero:function(){i(0===ke.get())}};G._broadwayOnHeadersDecoded=M,G._broadwayOnPictureDecoded=B,ce=a(4),oe=se=n(ne),ue=oe+be,fe=n(ue),$[ce>>2]=fe,ie=!0,G.wasmTableSize=10,G.wasmMaxTableSize=10,G.asmGlobalArg={},G.asmLibraryArg={abort:L,enlargeMemory:l,getTotalMemory:p,abortOnCannotGrowMemory:h,___setErrNo:D,___syscall140:E,___syscall146:C,___syscall54:P,___syscall6:_,_broadwayOnHeadersDecoded:M,_broadwayOnPictureDecoded:B,_emscripten_memcpy_big:k,DYNAMICTOP_PTR:ce,STACKTOP:se};var De=G.asm(G.asmGlobalArg,G.asmLibraryArg,q);G.asm=De;G._broadwayCreateStream=function(){return G.asm._broadwayCreateStream.apply(null,arguments)},G._broadwayExit=function(){return G.asm._broadwayExit.apply(null,arguments)},G._broadwayGetMajorVersion=function(){return G.asm._broadwayGetMajorVersion.apply(null,arguments)},G._broadwayGetMinorVersion=function(){return G.asm._broadwayGetMinorVersion.apply(null,arguments)},G._broadwayInit=function(){return G.asm._broadwayInit.apply(null,arguments)},G._broadwayPlayStream=function(){return G.asm._broadwayPlayStream.apply(null,arguments)};G.asm=De,F.prototype=new Error,F.prototype.constructor=F;var Fe;if(_e=function Ge(){G.calledRun||O(),G.calledRun||(_e=Ge)},G.run=O,G.exit=I,G.abort=L,G.preInit)for("function"==typeof G.preInit&&(G.preInit=[G.preInit]);G.preInit.length>0;)G.preInit.pop()();G.noExitRuntime=!0,O();var Oe;"undefined"!=typeof r&&r.Module&&(Oe=r.Module),"undefined"!=typeof G&&(Oe=G),Oe._broadwayOnHeadersDecoded=e,Oe._broadwayOnPictureDecoded=t;var Ie,Le=!1,Ne=function(){Le=!0,Ie&&Ie(Oe)};return Oe.onRuntimeInitialized=function(){Ne(Oe)},function(e){Le?e(Oe):Ie=e}};return function(){"use strict";function e(e,t,r){"use asm";var a=e.Math.imul;var n=e.Math.min;var i=e.Math.max;var o=e.Math.pow;var s=new e.Uint8Array(r);var u=new e.Uint32Array(r);var f=new e.Uint8Array(r);var c=new e.Uint8Array(r);var d=new e.Uint32Array(r);var h=0;var l=0;var p=0;var m=0;var v=0;var y=0;var g=0;var b=0;var w=0;var T=0;function A(e,t){e=e|0;t=t|0;var r=0;var n=0;h=e;w=a(e,4)|0;l=t;p=a(h|0,l|0)|0;m=(p|0)>>2;y=a(a(h,l)|0,4)|0;v=p+m|0+m|0;b=0;g=b+y|0;T=g+v|0;n=~~+o(+2,+24);n=a(n,4)|0;for(r=0|0;(r|0)<(n|0)|0;r=r+4|0){d[(T+r|0)>>2]=0}}function x(){var e=0;var t=0;var r=0;var a=0;var n=0;var i=0;var o=0;var s=0;var u=0;var c=0;var v=0;var y=0;var A=0;var x=0;A=b|0;e=g|0;t=e+p|0|0;r=t+m|0;for(u=0;(u|0)<(l|0);u=u+2|0){v=t;y=r;for(c=0;(c|0)<(h|0);c=c+2|0){a=f[e>>0]|0;n=f[(e+h|0)>>0]|0;i=f[t>>0]|0;o=f[r>>0]|0;x=((a<<16|0)+(i<<8|0)|0)+o|0;s=d[(T+x|0)>>2]|0;if(s){}else{s=S(a,i,o)|0;d[(T+x|0)>>2]=s|0}d[A>>2]=s;x=((n<<16|0)+(i<<8|0)|0)+o|0;s=d[(T+x|0)>>2]|0;if(s){}else{s=S(n,i,o)|0;d[(T+x|0)>>2]=s|0}d[(A+w|0)>>2]=s;A=A+4|0;e=e+1|0;a=f[e>>0]|0;n=f[(e+h|0)>>0]|0;x=((a<<16|0)+(i<<8|0)|0)+o|0;s=d[(T+x|0)>>2]|0;if(s){}else{s=S(a,i,o)|0;d[(T+x|0)>>2]=s|0}d[A>>2]=s;x=((n<<16|0)+(i<<8|0)|0)+o|0;s=d[(T+x|0)>>2]|0;if(s){}else{s=S(n,i,o)|0;d[(T+x|0)>>2]=s|0}d[(A+w|0)>>2]=s;A=A+4|0;e=e+1|0;t=t+1|0;r=r+1|0}A=A+w|0;e=e+h|0}}function S(e,t,r){e=e|0;t=t|0;r=r|0;var o=0;var s=0;var u=0;var f=0;var c=0;var d=0;var h=0;var l=0;var p=0;c=a(1192,e-16|0)|0;d=a(1634,r-128|0)|0;h=a(832,r-128|0)|0;l=a(400,t-128|0)|0;p=a(2066,t-128|0)|0;o=(c+d|0)>>10|0;s=((c-h|0)-l|0)>>10|0;u=(c+p|0)>>10|0;if((o&255|0)!=(o|0)|0){o=n(255,i(0,o|0)|0)|0}if((s&255|0)!=(s|0)|0){s=n(255,i(0,s|0)|0)|0}if((u&255|0)!=(u|0)|0){u=n(255,i(0,u|0)|0)|0}f=255;f=f<<8|0;f=f+u|0;f=f<<8|0;f=f+s|0;f=f<<8|0;f=f+o|0;return f|0}return{init:A,doit:x}}var t=function(){return(new Date).getTime()};"undefined"!=typeof performance&&performance.now&&(t=function(){return performance.now()});var n=function(e){this.options=e||{},this.now=t;var r,n,i,s={},u=function(e,a,i){var s=this.pictureBuffers[e];s||(s=this.pictureBuffers[e]=n(e,a*i*3/2));var u,f=!1;if(this.infoAr.length&&(f=!0,u=this.infoAr),this.infoAr=[],this.options.rgb){r||(r=o(a,i)),r.inp.set(s),r.doit();var c=new Uint8Array(r.outSize);return c.set(r.out),f&&(u[0].finishDecoding=t()),void this.onPictureDecoded(c,a,i,u)}f&&(u[0].finishDecoding=t()),this.onPictureDecoded(s,a,i,u)}.bind(this),f=!1;this.options.sliceMode&&(u=function(e,r,a,o){if(!f){var s=this.pictureBuffers[e];s||(s=this.pictureBuffers[e]=n(e,r*a*3/2));var u=this.pictureBuffers[o];u||(u=this.pictureBuffers[o]=i(o,18));var c,d=!1;this.infoAr.length&&(d=!0,c=this.infoAr),this.infoAr=[],c[0].finishDecoding=t();for(var h=[],l=0;l<20;++l)h.push(u[l]);c[0].sliceInfoAr=h,this.onPictureDecoded(s,r,a,c)}}.bind(this));var c=a.apply(s,[function(){},u]),d=1048576,h=this;this.onPictureDecoded=function(e,t,r,a){},this.onDecoderReady=function(){};var l=[];this.decode=function(e,t,r){l.push([e,t,r])},c(function(e){var r=(e.HEAP8,e.HEAPU8);e.HEAP16,e.HEAP32;e._broadwayInit(),n=function(e,t){return r.subarray(e,e+t)},i=function(e,t){return new Uint32Array(r.buffer,e,t)},h.streamBuffer=n(e._broadwayCreateStream(d),d),h.pictureBuffers={},h.infoAr=[];var a=0;if(h.options.sliceMode?(a=h.options.sliceNum,h.decode=function(r,n,i){h.infoAr.push(n),n.startDecoding=t();var o,s=n.nals;if(!s){s=[],n.nals=s;var u=r.length,f=!1,c=0,d=0;for(o=0;o>2,u=o+s+s,f=t*a*4,c=4*Math.pow(2,24),d=u+f+c,h=Math.pow(2,24),l=h;l0&&(i(u,f),o(r[2],r[3]),o(r[4],r[5])),u=r[6],f=r[7],f>0&&(i(u,f),o(r[8],r[9]),o(r[10],r[11])),u=r[12],f=r[15],f>0&&(s(u,f),s(r[13],r[16]),s(r[14],r[17]))},S=function(e){y=e,g=y-1};self.addEventListener("message",function(e){if(l){if(p&&e.data.reuse&&T.push(e.data.reuse),e.data.buf)return void(m&&0!==b?w.push(e.data):s.decode(new Uint8Array(e.data.buf,e.data.offset||0,e.data.length),e.data.info,function(){m&&v!==g&&postMessage(e.data,[e.data.buf])}));if(e.data.slice){var r=t();if(x(new Uint8Array(e.data.slice),f,e.data.infos[0].sliceInfoAr,e.data.width,e.data.height),e.data.theOne&&(x(f,new Uint8Array(e.data.slice),u,e.data.width,e.data.height),h>e.data.infos[0].timeDecoding&&(e.data.infos[0].timeDecoding=h),e.data.infos[0].timeCopy+=t()-r),postMessage(e.data,[e.data.slice]),b-=1,0===b&&w.length){var a=w.shift();s.decode(new Uint8Array(a.buf,a.offset||0,a.length),a.info,function(){m&&v!==g&&postMessage(a,[a.buf])})}return}if(e.data.setSliceCnt)return void S(e.data.sliceCnt)}else e.data&&"Broadway.js - Worker init"===e.data.type&&(l=!0,s=new n(e.data.options),e.data.options.sliceMode?(p=!0,m=!0,v=e.data.options.sliceNum,S(e.data.options.sliceCnt),s.onPictureDecoded=function(e,t,r,a){var n=new Uint8Array(A(e.length));x(e,n,a[0].sliceInfoAr,t,r),c=a[0].startDecoding,d=a[0].finishDecoding,h=d-c,a[0].timeDecoding=h,a[0].timeCopy=0,postMessage({slice:n.buffer,sliceNum:v,width:t,height:r,infos:a},[n.buffer]),b=y-1,f=e,u=a[0].sliceInfoAr}):e.data.options.reuseMemory?(p=!0,s.onPictureDecoded=function(e,t,r,a){var n=new Uint8Array(A(e.length));n.set(e,0,e.length),postMessage({buf:n.buffer,length:e.length,width:t,height:r,infos:a},[n.buffer])}):s.onPictureDecoded=function(e,t,r,a){e&&(e=new Uint8Array(e));var n=new Uint8Array(e.length);n.set(e,0,e.length),postMessage({buf:n.buffer,length:e.length,width:t,height:r,infos:a},[n.buffer])},postMessage({consoleLog:"broadway worker initialized"}))},!1)}return n.nowValue=t,n}()}),function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.YUVCanvas=t()}(this,function(){function e(e){e=e||{},this.canvasElement=e.canvas||document.createElement("canvas"),this.contextOptions=e.contextOptions,this.type=e.type||"yuv420",this.customYUV444=e.customYUV444,this.conversionType=e.conversionType||"rec601",this.width=e.width||640,this.height=e.height||320,this.animationTime=e.animationTime||0,this.canvasElement.width=this.width,this.canvasElement.height=this.height,this.initContextGL(),this.contextGL&&(this.initProgram(),this.initBuffers(),this.initTextures()),"yuv420"===this.type?this.drawNextOuptutPictureGL=function(e){var t=this.contextGL,r=this.texturePosBuffer,a=this.uTexturePosBuffer,n=this.vTexturePosBuffer,i=this.yTextureRef,o=this.uTextureRef,s=this.vTextureRef,u=e.yData,f=e.uData,c=e.vData,d=this.width,h=this.height,l=e.yDataPerRow||d,p=e.yRowCnt||h,m=e.uDataPerRow||d/2,v=e.uRowCnt||h/2,y=e.vDataPerRow||m,g=e.vRowCnt||v;t.viewport(0,0,d,h);var b=0,w=0,T=h/p,A=d/l,x=new Float32Array([A,b,w,b,A,T,w,T]);t.bindBuffer(t.ARRAY_BUFFER,r),t.bufferData(t.ARRAY_BUFFER,x,t.DYNAMIC_DRAW),this.customYUV444?(T=h/v,A=d/m):(T=h/2/v,A=d/2/m);var S=new Float32Array([A,b,w,b,A,T,w,T]);t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,S,t.DYNAMIC_DRAW),this.customYUV444?(T=h/g,A=d/y):(T=h/2/g,A=d/2/y);var U=new Float32Array([A,b,w,b,A,T,w,T]);t.bindBuffer(t.ARRAY_BUFFER,n),t.bufferData(t.ARRAY_BUFFER,U,t.DYNAMIC_DRAW),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.LUMINANCE,l,p,0,t.LUMINANCE,t.UNSIGNED_BYTE,u),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,o),t.texImage2D(t.TEXTURE_2D,0,t.LUMINANCE,m,v,0,t.LUMINANCE,t.UNSIGNED_BYTE,f),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,t.LUMINANCE,y,g,0,t.LUMINANCE,t.UNSIGNED_BYTE,c),t.drawArrays(t.TRIANGLE_STRIP,0,4)}:"yuv422"===this.type&&(this.drawNextOuptutPictureGL=function(e){var t=this.contextGL,r=this.texturePosBuffer,a=this.textureRef,n=e.data,i=this.width,o=this.height,s=e.dataPerRow||2*i,u=e.rowCnt||o;t.viewport(0,0,i,o);var f=0,c=0,d=o/u,h=i/(s/2),l=new Float32Array([h,f,c,f,h,d,c,d]);t.bindBuffer(t.ARRAY_BUFFER,r),t.bufferData(t.ARRAY_BUFFER,l,t.DYNAMIC_DRAW),t.uniform2f(t.getUniformLocation(this.shaderProgram,"resolution"),s,o),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,a),t.texImage2D(t.TEXTURE_2D,0,t.LUMINANCE,s,u,0,t.LUMINANCE,t.UNSIGNED_BYTE,n),t.drawArrays(t.TRIANGLE_STRIP,0,4)})}return e.prototype.isWebGL=function(){return this.contextGL},e.prototype.initContextGL=function(){for(var e=this.canvasElement,t=null,r=["webgl","experimental-webgl","moz-webgl","webkit-3d"],a=0;!t&&a=n?r=1:setTimeout(s,o);var a=-1*r,u=1*r,f=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,f),e.bufferData(e.ARRAY_BUFFER,new Float32Array([u,u,a,u,u,a,a,a]),e.STATIC_DRAW);var c=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(c),e.vertexAttribPointer(c,2,e.FLOAT,!1,0,0);try{e.drawArrays(e.TRIANGLE_STRIP,0,4)}catch(d){}};s()}var u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var f=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(f),e.vertexAttribPointer(f,2,e.FLOAT,!1,0,0),this.texturePosBuffer=u,"yuv420"===this.type){var c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var d=e.getAttribLocation(t,"uTexturePos");e.enableVertexAttribArray(d),e.vertexAttribPointer(d,2,e.FLOAT,!1,0,0),this.uTexturePosBuffer=c;var h=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,h),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var l=e.getAttribLocation(t,"vTexturePos");e.enableVertexAttribArray(l),e.vertexAttribPointer(l,2,e.FLOAT,!1,0,0),this.vTexturePosBuffer=h}},e.prototype.initTextures=function(){var e=this.contextGL,t=this.shaderProgram;if("yuv420"===this.type){var r=this.initTexture(),a=e.getUniformLocation(t,"ySampler");e.uniform1i(a,0),this.yTextureRef=r;var n=this.initTexture(),i=e.getUniformLocation(t,"uSampler");e.uniform1i(i,1),this.uTextureRef=n;var o=this.initTexture(),s=e.getUniformLocation(t,"vSampler");e.uniform1i(s,2),this.vTextureRef=o}else if("yuv422"===this.type){var u=this.initTexture(),f=e.getUniformLocation(t,"sampler");e.uniform1i(f,0),this.textureRef=u}},e.prototype.initTexture=function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t},e.prototype.drawNextOutputPicture=function(e,t,r,a){var n=this.contextGL;n?this.drawNextOuptutPictureGL(e,t,r,a):this.drawNextOuptutPictureRGBA(e,t,r,a)},e.prototype.drawNextOuptutPictureRGBA=function(e,t,r,a){var n=this.canvasElement,r=null,i=a,o=n.getContext("2d"),s=o.getImageData(0,0,e,t);s.data.set(i),null===r?o.putImageData(s,0,0):o.putImageData(s,-r.left,-r.top,0,0,r.width,r.height)},e}),function(e,t){"function"==typeof define&&define.amd?define(["./Decoder","./YUVCanvas"],t):"object"==typeof exports?module.exports=t(require("./Decoder"),require("./YUVCanvas")):e.Player=t(e.Decoder,e.YUVCanvas)}(this,function(e,t){"use strict";var r=e.nowValue,a=function(t){var a=this;this._config=t||{},this.render=!0,this._config.render===!1&&(this.render=!1),this.nowValue=r,this._config.workerFile=this._config.workerFile||"Decoder.js",this._config.preserveDrawingBuffer&&(this._config.contextOptions=this._config.contextOptions||{},this._config.contextOptions.preserveDrawingBuffer=!0);var n="auto";if(this._config.webgl===!0?n=!0:this._config.webgl===!1&&(n=!1),"auto"==n){n=!0;try{if(window.WebGLRenderingContext){var i=document.createElement("canvas"),o=i.getContext("webgl");o||(n=!1)}else n=!1}catch(s){n=!1}}this.webgl=n,this.webgl?(this.createCanvasObj=this.createCanvasWebGL,this.renderFrame=this.renderFrameWebGL):(this.createCanvasObj=this.createCanvasRGB,this.renderFrame=this.renderFrameRGB);var u,f,c=function(e,t,n,i){a.onPictureDecoded(e,t,n,i);r();e&&a.render&&(a.renderFrame({canvasObj:a.canvasObj,data:e,width:t,height:n}),a.onRenderFrameComplete&&a.onRenderFrameComplete({data:e,width:t,height:n,infos:i,canvasObj:a.canvasObj}))};if(this._config.size||(this._config.size={}),this._config.size.width=this._config.size.width||200,this._config.size.height=this._config.size.height||200,this._config.useWorker){var d=new Worker(this._config.workerFile);this.worker=d,d.addEventListener("message",function(e){var t=e.data;return t.consoleLog?void console.log(t.consoleLog):void c.call(a,new Uint8Array(t.buf,0,t.length),t.width,t.height,t.infos)},!1),d.postMessage({type:"Broadway.js - Worker init",options:{rgb:!n,memsize:this.memsize,reuseMemory:!!this._config.reuseMemory}}),this._config.transferMemory?this.decode=function(e,t){d.postMessage({buf:e.buffer,offset:e.byteOffset,length:e.length,info:t},[e.buffer])}:this.decode=function(e,t){var r=new Uint8Array(e.length);r.set(e,0,e.length),d.postMessage({buf:r.buffer,offset:0,length:e.length,info:t},[r.buffer])},this._config.reuseMemory&&(this.recycleMemory=function(e){d.postMessage({reuse:e.buffer},[e.buffer])})}else this.decoder=new e({rgb:!n}),this.decoder.onPictureDecoded=c,this.decode=function(e,t){a.decoder.decode(e,t)};this.render&&(this.canvasObj=this.createCanvasObj({contextOptions:this._config.contextOptions}),this.canvas=this.canvasObj.canvas),this.domNode=this.canvas,u=this._config.size.width,f=this._config.size.height};return a.prototype={onPictureDecoded:function(e,t,r,a){},recycleMemory:function(e){},createCanvasWebGL:function(e){var t=this._createBasicCanvasObj(e);return t.contextOptions=e.contextOptions,t},createCanvasRGB:function(e){var t=this._createBasicCanvasObj(e);return t},_createBasicCanvasObj:function(e){e=e||{};var t={},r=e.width;r||(r=this._config.size.width);var a=e.height;return a||(a=this._config.size.height),t.canvas=document.createElement("canvas"),t.canvas.width=r,t.canvas.height=a,t.canvas.style.backgroundColor="#0D0E1B",t},
renderFrameWebGL:function(e){var r=e.canvasObj,a=e.width||r.canvas.width,n=e.height||r.canvas.height;r.canvas.width===a&&r.canvas.height===n&&r.webGLCanvas||(r.canvas.width=a,r.canvas.height=n,r.webGLCanvas=new t({canvas:r.canvas,contextOptions:r.contextOptions,width:a,height:n}));var i=a*n,o=a/2*(n/2);r.webGLCanvas.drawNextOutputPicture({yData:e.data.subarray(0,i),uData:e.data.subarray(i,i+o),vData:e.data.subarray(i+o,i+o+o)});var s=this;s.recycleMemory(e.data)},renderFrameRGB:function(e){var t=e.canvasObj,r=e.width||t.canvas.width,a=e.height||t.canvas.height;t.canvas.width===r&&t.canvas.height===a||(t.canvas.width=r,t.canvas.height=a);var n=t.ctx,i=t.imgData;n||(t.ctx=t.canvas.getContext("2d"),n=t.ctx,t.imgData=n.createImageData(r,a),i=t.imgData),i.data.set(e.data),n.putImageData(i,0,0);var o=this;o.recycleMemory(e.data)}},a});var Stream=function(){function e(e){this.url=e}return e.prototype={readAll:function(e,t){var r=new XMLHttpRequest,a=!0;r.open("GET",this.url,a),r.responseType="arraybuffer",e&&(r.onprogress=function(t){e(r.response,t.loaded,t.total)}),r.onreadystatechange=function(e){4===r.readyState&&t(r.response)},r.send(null)}},e}(),Size=function(){function e(e,t){this.w=e,this.h=t}return e.prototype={toString:function(){return"("+this.w+", "+this.h+")"},getHalfSize:function(){return new Size(this.w>>>1,this.h>>>1)},length:function(){return this.w*this.h}},e}(),Bytestream=function(){function e(e,t,r){this.bytes=new Uint8Array(e),this.start=t||0,this.pos=this.start,this.end=t+r||this.bytes.length}return e.prototype={get length(){return this.end-this.start},get position(){return this.pos},get remaining(){return this.end-this.pos},readU8Array:function(e){if(this.pos>this.end-e)return null;var t=this.bytes.subarray(this.pos,this.pos+e);return this.pos+=e,t},readU32Array:function(e,t,r){if(t=t||1,this.pos>this.end-e*t*4)return null;if(1==t){for(var a=new Uint32Array(e),n=0;n>24},readU8:function(){return this.pos>=this.end?null:this.bytes[this.pos++]},peek16:function(e){var t=this.pos,r=this.bytes;if(t>this.end-4)return null;var a=r[t+0]<<8|r[t+1];return e&&(this.pos+=4),a},read16:function(){return this.readU16()<<16>>16},readU16:function(){if(this.pos>=this.end-1)return null;var e=this.bytes[this.pos+0]<<8|this.bytes[this.pos+1];return this.pos+=2,e},read24:function(){return this.readU24()<<8>>8},readU24:function(){var e=this.pos,t=this.bytes;if(e>this.end-3)return null;var r=t[e+0]<<16|t[e+1]<<8|t[e+2];return this.pos+=3,r},peek32:function(e){var t=this.pos,r=this.bytes;if(t>this.end-4)return null;var a=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3];return e&&(this.pos+=4),a},read32:function(){return this.peek32(!0)},readU32:function(){return this.peek32(!0)>>>0},read4CC:function(){var e=this.pos;if(e>this.end-4)return null;for(var t="",r=0;r<4;r++)t+=String.fromCharCode(this.bytes[e+r]);return this.pos+=4,t},readFP16:function(){return this.read32()/65536},readFP8:function(){return this.read16()/256},readISO639:function(){for(var e=this.readU16(),t="",r=0;r<3;r++){var a=e>>>5*(2-r)&31;t+=String.fromCharCode(a+96)}return t},readUTF8:function(e){for(var t="",r=0;rthis.end)&&error("Index out of bounds (bounds: [0, "+this.end+"], index: "+e+")."),this.pos=e},subStream:function(e,t){return new Bytestream(this.bytes.buffer,e,t)}},e}(),PARANOID=!0,MP4Reader=function(){function e(e){this.stream=e,this.tracks={}}return e.prototype={readBoxes:function(e,t){for(;e.peek32();){var r=this.readBox(e);if(r.type in t){var a=t[r.type];a instanceof Array||(t[r.type]=[a]),t[r.type].push(r)}else t[r.type]=r}},readBox:function(e){function t(){i.size=e.readU32(),i.type=e.read4CC()}function r(){i.version=e.readU8(),i.flags=e.readU24()}function a(){return i.size-(e.position-i.offset)}function n(){e.skip(a())}var i={offset:e.position},o=function(){var t=e.subStream(e.position,a());this.readBoxes(t,i),e.skip(t.length)}.bind(this);switch(t(),i.type){case"ftyp":i.name="File Type Box",i.majorBrand=e.read4CC(),i.minorVersion=e.readU32(),i.compatibleBrands=new Array((i.size-16)/4);for(var s=0;s0&&(i.name=e.readUTF8(u));break;case"minf":i.name="Media Information Box",o();break;case"stbl":i.name="Sample Table Box",o();break;case"stsd":i.name="Sample Description Box",r(),i.sd=[];e.readU32();o();break;case"avc1":e.reserved(6,0),i.dataReferenceIndex=e.readU16(),assert(0==e.readU16()),assert(0==e.readU16()),e.readU32(),e.readU32(),e.readU32(),i.width=e.readU16(),i.height=e.readU16(),i.horizontalResolution=e.readFP16(),i.verticalResolution=e.readFP16(),assert(0==e.readU32()),i.frameCount=e.readU16(),i.compressorName=e.readPString(32),i.depth=e.readU16(),assert(65535==e.readU16()),o();break;case"mp4a":e.reserved(6,0),i.dataReferenceIndex=e.readU16(),i.version=e.readU16(),e.skip(2),e.skip(4),i.channelCount=e.readU16(),i.sampleSize=e.readU16(),i.compressionId=e.readU16(),i.packetSize=e.readU16(),i.sampleRate=e.readU32()>>>16,assert(0==i.version),o();break;case"esds":i.name="Elementary Stream Descriptor",r(),n();break;case"avcC":i.name="AVC Configuration Box",i.configurationVersion=e.readU8(),i.avcProfileIndication=e.readU8(),i.profileCompatibility=e.readU8(),i.avcLevelIndication=e.readU8(),i.lengthSizeMinusOne=3&e.readU8(),assert(3==i.lengthSizeMinusOne,"TODO");var f=31&e.readU8();i.sps=[];for(var s=0;s=8,"Cannot parse large media data yet."),i.data=e.readU8Array(a());break;default:n()}return i},read:function(){var e=(new Date).getTime();this.file={},this.readBoxes(this.stream,this.file),console.info("Parsed stream in "+((new Date).getTime()-e)+" ms")},traceSamples:function(){var e=this.tracks[1],t=this.tracks[2];console.info("Video Samples: "+e.getSampleCount()),console.info("Audio Samples: "+t.getSampleCount());for(var r=0,a=0,n=0;n<100;n++){var i=e.sampleToOffset(r),o=t.sampleToOffset(a),s=e.sampleToSize(r,1),u=t.sampleToSize(a,1);i0){var i=t[n-1],o=r.firstChunk-i.firstChunk,s=i.samplesPerChunk*o;if(!(e>=s))return{index:a+Math.floor(e/i.samplesPerChunk),offset:e%i.samplesPerChunk};if(e-=s,n==t.length-1)return{index:a+o+Math.floor(e/r.samplesPerChunk),offset:e%r.samplesPerChunk};a+=o}}assert(!1)},chunkToOffset:function(e){var t=this.trak.mdia.minf.stbl.stco.table;return t[e]},sampleToOffset:function(e){var t=this.sampleToChunk(e),r=this.chunkToOffset(t.index);return r+this.sampleToSize(e-t.offset,t.offset)},timeToSample:function(e){for(var t=this.trak.mdia.minf.stbl.stts.table,r=0,a=0;a=n))return r+Math.floor(e/t[a].delta);e-=n,r+=t[a].count}},getTotalTime:function(){if(PARANOID){for(var e=this.trak.mdia.minf.stbl.stts.table,t=0,r=0;r0;){var i=new Bytestream(t.buffer,r).readU32();n.push(t.subarray(r+4,r+i+4)),r=r+i+4}return n}},e}();!function(){function e(e){r.push(e),window.postMessage(a,"*")}function t(e){if(e.source==window&&e.data==a&&(e.stopPropagation(),r.length>0)){var t=r.shift();t()}}var r=[],a="zero-timeout-message";window.addEventListener("message",t,!0),window.setZeroTimeout=e}();var MP4Player=function(){function e(e,t){function r(){var e=this.statistics;if(e){e.videoPictureCounter+=1,e.windowPictureCounter+=1;var r=Date.now();e.videoStartTime||(e.videoStartTime=r),i.currentTime=(e.videoPictureCounter/30).toFixed(2),i.currentFrame=e.videoPictureCounter,t.onprogress&&t.onprogress();var a=r-e.videoStartTime;if(e.elapsed=a/1e3,!(a<1e3)){if(!e.windowStartTime)return void(e.windowStartTime=r);if(r-e.windowStartTime>1e3){var n=r-e.windowStartTime,o=e.windowPictureCounter/n*1e3;e.windowStartTime=r,e.windowPictureCounter=0,oe.fpsMax&&(e.fpsMax=o),e.fps=o}var o=e.videoPictureCounter/a*1e3;e.fpsSinceStart=o,this.onStatisticsUpdated(this.statistics)}}}t||(t={}),this.stream=new Stream(e),this.useWorkers=t.useWorkers||!1,this.webgl=t.webgl||"auto",this.render=t.render||!1,this.state="ready",this.playerStates={created:"created",ended:"ended",initialized:"initialized",loading:"loading",preloading:"preloading",ready:"ready",buffering:"buffering",playing:"playing",paused:"paused"},this.statistics={videoStartTime:0,videoPictureCounter:0,windowStartTime:0,windowPictureCounter:0,fps:0,fpsMin:1e3,fpsMax:-1e3,webGLTextureUploadTime:0},this.onStatisticsUpdated=function(){},this.pic=0,this.avc=new Player({useWorker:this.useWorkers,reuseMemory:!0,webgl:!0,size:{width:t.width||640,height:t.height||368}}),this.webgl=this.avc.webgl;var a,n,i=this,o=null;this.canvas=this.avc.canvas,this.decodeVideo=function(e){this.reader.tracks[1].trak.mdia.minf.stbl.stsd.avc1?(a=this.reader.tracks[1],n=this.reader.tracks[2]):(a=this.reader.tracks[2],n=this.reader.tracks[1]),o=window.setTimeout(function t(){if(this.state===this.playerStates.playing){var e=this.avc;a.getSampleNALUnits(this.pic).forEach(function(t){e.decode(t),r.call(i)}),this.pic++,this.pic1&&void 0!==arguments[1]?arguments[1]:null;clearTimeout(u),A({result:e,error:t})},void 0!==s?s.then(function(){return c(!0)})["catch"](function(A){return c(!1,A)}):c(!0)})}function t(t){return t=A(t),e(t,function(){return{element:document.createElement("video"),source:URL.createObjectURL(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,28,101,108,115,116,0,0,0,0,0,0,0,1,0,0,0,47,0,0,0,0,0,1,0,0,0,0,1,100,109,100,105,97,0,0,0,32,109,100,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,68,0,0,8,0,85,196,0,0,0,0,0,45,104,100,108,114,0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0,0,0,1,15,109,105,110,102,0,0,0,16,115,109,104,100,0,0,0,0,0,0,0,0,0,0,0,36,100,105,110,102,0,0,0,28,100,114,101,102,0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1,0,0,0,211,115,116,98,108,0,0,0,103,115,116,115,100,0,0,0,0,0,0,0,1,0,0,0,87,109,112,52,97,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,16,0,0,0,0,172,68,0,0,0,0,0,51,101,115,100,115,0,0,0,0,3,128,128,128,34,0,2,0,4,128,128,128,20,64,21,0,0,0,0,1,244,0,0,1,243,249,5,128,128,128,2,18,16,6,128,128,128,1,2,0,0,0,24,115,116,116,115,0,0,0,0,0,0,0,1,0,0,0,2,0,0,4,0,0,0,0,28,115,116,115,99,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,28,115,116,115,122,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,115,0,0,1,116,0,0,0,20,115,116,99,111,0,0,0,0,0,0,0,1,0,0,0,44,0,0,0,98,117,100,116,97,0,0,0,90,109,101,116,97,0,0,0,0,0,0,0,33,104,100,108,114,0,0,0,0,0,0,0,0,109,100,105,114,97,112,112,108,0,0,0,0,0,0,0,0,0,0,0,0,45,105,108,115,116,0,0,0,37,169,116,111,111,0,0,0,29,100,97,116,97,0,0,0,1,0,0,0,0,76,97,118,102,53,54,46,52,48,46,49,48,49])],{type:"video/mp4"}),o={video:t};return o}),function(A,e,t){function n(){var e=A.navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return!0;var n=e.indexOf("Trident/");if(n>0){e.indexOf("rv:");return!0}var o=e.indexOf("Edge/");return o>0}function o(A){for(var e in A){var t=new Image;t.src=A[e]}}function a(A){return O("SF | VP2 | Get Player State",2),{type:i(A,"source"),config:i(A,"config"),onclick:i(A,"onclick"),feeds:i(A,"id"),id:A.id,element:A}}function i(A,e){return t(A).data(e)}function r(A){for(var t in A){var n=e.createElement("video");if(!X&&A.webm&&n.canPlayType("video/webm"))return A.webm;if(n.canPlayType(s(t).mimetype))return A[t]}}function s(A){var e="",t="video";switch(A){case"mp4":e="video/mp4";break;case"ogg":e="video/ogg";break;case"webm":e="video/webm"}return{mimetype:e,container:t}}function u(A){var e=d(A);return e}function c(A,e){if(O("SF | VP2 | Build VAST "+A.feeds.vast),"%"!==A.feeds.vast.slice(0,1)){var n=t.Deferred();return e&&ad.addCustomPreloadItem(),l(A.feeds.vast).then(function(t){A.vastObj=t,A.config.id=A.dataid=u(A.vastObj.feed),M[A.feeds.vast]=A,e&&ad.customPreloadedItemComplete(),N[A.feeds.vast]=t,n.resolve()}),n.promise()}}function l(A){function e(A,e){var n={},o=["mp4","ogg","webm"],a=e.find("MediaFiles:first");for(var i in o){var r=a.find('MediaFile[type="video/'+o[i]+'"]');0!=r.length&&(n[o[i]]=t(r[0]).text())}A.feed=n}function n(A,e){if(i(e,A.impression,"Impression:first"),i(e,A.error,"Error:first"),e=e.find("Creative:first"),e.length&&(e=e.find("Linear:first"),e.length)){if(e.find("Tracking").each(function(){var e=t(this),n=e.attr("event");A.trackingEvents[n]&&A.trackingEvents[n].push(e.text())}),!A.videoClicks.clickThrough.length){var n=e.find("ClickThrough:first");n.length&&A.videoClicks.clickThrough.push(n.text())}i(e,A.videoClicks.clickTracking,"ClickTracking")}A.trackingEvents.start.push.apply(A.trackingEvents.start,A.impression,A.creativeView)}O("SF | VP2 | Load VAST "+A),Y.push(A);var o=t.Deferred(),a=function(){var A;return A={wrappers:0,lastResponse:null,impression:[],error:[],trackingEvents:{creativeView:[],start:[],firstQuartile:[],midpoint:[],thirdQuartile:[],complete:[],pause:[],resume:[],mute:[],unmute:[],rewind:[],fullscreen:[]},videoClicks:{clickThrough:[],clickTracking:[]},feed:null,playerEvents:null},A.playerEvents={vst:A.trackingEvents.start,vco:A.trackingEvents.complete,v25:A.trackingEvents.firstQuartile,v50:A.trackingEvents.midpoint,v75:A.trackingEvents.thirdQuartile,vrs:A.trackingEvents.resume,vmu:A.trackingEvents.mute,vum:A.trackingEvents.unmute,vpa:A.trackingEvents.pause},A},i=function(A,e,n){var o=A.find(n);o.each(function(){var A=t(this);e.push(A.text())})},r=function(A){var i=t(A);if(i.find("Creative:first").length&&!i.find("Creative:first").find("Linear:first").length>0)return void console.log("Error. No linear VAST creative found.");var r=a();r.lastResponse=i;var s=i.find("Wrapper:first"),u=i.find("InLine:first");s.length?(n(r,s),r.wrappers++>0?console.log("Error. Wrapper limit reached"):l(s.find("VASTAdTagURI:first").text()).then(function(){o.resolve(r)})):u.length&&(n(r,u),e(r,u),o.resolve(r))};return t.ajax({type:"GET",url:A,dataType:"xml",success:r}),o.promise()}function d(A){var A=A,t="",n=function(A){t=A.slice(A.lastIndexOf("/")+1).replace(/\.|%/g,"")};if("number"==typeof A)n(String(A));else if("string"==typeof A)n(A);else if("object"==typeof A){var o,a=e.createElement("video");if(A.webm&&a.canPlayType("video/webm"))return A.webm;for(var i in A)o||(o=A[i]);n(o)}return t}function p(){var e=A.addEventListener;A.addEventListener=function(){var A=arguments[0],t=arguments[1],n="deviceorientation"==A,o="devicemotion"==A;return n||o?mraid.addEventListener(A,function(A){t(A.detail)}):e.apply(this,arguments)}}function m(A,t){ad.addCustomPreloadItem();var n=e.createElement("script");n.src=A;var o=e.getElementsByTagName("script")[0];o.parentNode.insertBefore(n,o),n.onload=function(){t&&t(!0),ad.customPreloadedItemComplete()},n.onerror=function(){console.log("error on load script: ",A),ad.customPreloadedItemComplete()}}function f(A){A.feeds&&A.feeds.mp4&&"%"===A.feeds.mp4.slice(0,1)||(ad.addCustomPreloadItem(),A.vastObj?A.config.id=u(A.vastObj.feed):A.config.id=u(A.feeds),g(A).then(function(){A.vastObj?M[A.feeds.vast]=A:M[A.feeds.mp4]=A,ad.customPreloadedItemComplete()}))}function v(A){function n(A){var t=e.createElement("source");if(200==this.status){var n=URL.createObjectURL(this.response);t.src=n}else t.src=this.responseURL;a.resolve(t)}if(A&&"%"===A.slice(0,1))return null;A&&A.indexOf("http")>0&&(A=A.slice(A.indexOf("http")));var o=new XMLHttpRequest,a=t.Deferred();o.addEventListener("loadend",n),o.open("GET",A,!0),o.responseType="blob";try{o.send()}catch(i){}return a.promise()}function g(e){A.traceLog&&A.traceLog("SF | VP2 | Preload Video");var n,o=t.Deferred();return n=r(e.vastObj?e.vastObj.feed:e.feeds),B[n]||P[n]||T[n]?(o.resolve(),o.promise()):(T[n]=n,v(n).then(function(A){P[n]=A,o.resolve()}),o.promise())}function h(){A.traceLog&&A.traceLog("SF | VP2 | Autoplay Test");var n,o,a=e.createElement("video"),i=e.createElement("source"),r="data:video/mp4;base64, AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbm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znN0YmwAAABqc3RzZAAAAAAAAAABAAAAWm1wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAABWIgAAAAAANmVzZHMAAAAAA4CAgCUAAgAEgICAF0AVAAAAAAH0AAABXeoFgICABROQVuUABoCAgAECAAAAGHN0dHMAAAAAAAAAAQAAAAEAAAQAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAABRzdHN6AAAAAAAAAggAAAABAAAAFHN0Y28AAAAAAAAAAQAAAwcAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU3LjcxLjEwMA==";a.muted=!0,a.setAttribute("muted","muted"),a.setAttribute("playsinline","playsinline"),a.setAttribute("webkit-playsinline","webkit-playsinline"),t(a).css({opacity:0}).append(i),Q||F&&W&&W.length&&parseFloat(W[0])>4.4||I&&parseInt(C())>=12||X&&x&&parseInt(x)>71?(i.src=r,a.src=r):(i.src=s,a.src=s),t("body").append(a);try{n=a.play(),void 0!==n?(n.then(function(){b=!1,t(a).remove(),o=!0,A.clearTimeout(z)})["catch"](function(e){b=!0,t(a).remove(),o=!0,A.clearTimeout(z)}),z=setTimeout(function(){o||(b=!0,t(a).remove(),o=!0)},1e3)):(Z?canAutoplay.video({timeout:1e3,muted:!0,inline:!0}).then(function(A,e){b=!A||A.result!==!0}):b=!0,t(a).remove(),o=!0,A.clearTimeout(z))}catch(u){b=!0,t(a).remove(),o=!0,A.clearTimeout(z)}}A.SFVideoPlayers={},A.SFVideoPlayersMap={},A.hasActiveMotionEvents=null;var y,b,C=function(){var e;return S||(S=A.navigator.userAgent),k||(k=S.match(/Android|iPhone|iPad|iPod/i)),/Android/i.test(k)||(/iPhone/i.test(k)||/iPad/i.test(k))&&(e=S.match(/OS\s+([\d\_]+)/i),e=e[0],e=e.replace(/_/g,"."),e=e.replace("OS ","")),e},w={created:"created",ended:"ended",initialized:"initialized",loading:"loading",preloading:"preloading",ready:"ready",buffering:"buffering",playing:"playing",paused:"paused"},E={progressHandleW:10,progressW:0,volumeW:0,zoom:1},k=A.navigator.userAgent.match(/Android|iPhone|iPad|iPod/i),B={},S=A.navigator.userAgent,P={},T={},M={},V=t(e),I=/iPad|iPhone|iPod/.test(S)&&!A.MSStream,Z=(/Edge\/\d+/.test(S),n()),Q=/SAMSUNG|Samsung|SGH-[I|N|T]|GT-[I|N]|SM-[N|P|T|Z]|SHV-E|SCH-[I|J|R|S]|SPH-L/.test(S),X=S.indexOf("Firefox")>-1||S.indexOf("FxiOS")>-1,G=S.match(/Firefox\/(.*)/),x=G&&G.length?G[1]:null,F=A.navigator.userAgent.indexOf("Android")>-1,j=A.navigator.userAgent.match(/Android\s[\d]*.[\d]*/),W=F&&j?j[0].match(/([0-9]*\.[0-9]*)|([0-9]+)/):0,H=function(){var e=A.navigator.userAgent;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))},L=!1,Y=[],N={},D=A["debugger"]||!1,R=1,O=function(e,t,n){A.traceLog?(!A.debuggerWidget||!A.debuggerWidget.length||A.debuggerWidget.indexOf("video2")>-1)&&A.traceLog(e,t,n):console[n](e)},J=function(n,i){function r(e,n){function o(A){D&&O("Video Player | resolve state"),A.vastObj||(A.dataid=d(A.feeds)),A.element=t("#"+A.id),s(A),a.resolve(A),A.config.is360&&(mraid.enableDeviceOrientation(),mraid.enableDeviceMotion())}var a=t.Deferred();switch(O("SF | VP2 | Check Scripts Ready "+JSON.stringify(n),2),n.type){case"youtube":o(n);break;case"vimeo":o(n);break;case"custom":if(n.config.is360)p(),A.addEventListener("devicemotion",function(e){A.hasActiveMotionEvents||null==e.acceleration.x||(A.hasActiveMotionEvents=!0)}),A.addEventListener("deviceorientation",function(e){A.hasActiveMotionEvents||null==e.gamma||(A.hasActiveMotionEvents=!0)}),n.feeds.hasOwnProperty("vast")?n.config.preloadBeforeReady||"%"===n.feeds.vast.slice(0,1)?o(n):c(n).then(function(){o(n)}):o(n);else if(n.feeds.hasOwnProperty("vast"))if(n.config.preloadBeforeReady||"%"===n.feeds.vast.slice(0,1)){var i=jQuery.extend({},n);n=M[n.feeds.vast]||i,o(n)}else O("SF | VP2 | Check Scripts Ready | VAST "+JSON.stringify(n),3),c(n).then(function(){n=M[n.feeds.vast],o(n)});else o(n)}return a.promise()}function s(n){O("SF | VP2 | Video Player | build placement");var a=t(n.element),i=a.data("onclick"),r=t(e.createElement("div")).attr({"class":"vp-container"});if(a.append(r),"custom"===n.type&&!n.config.is360){if(i||n.config.open||n.vastObj&&n.vastObj.videoClicks&&n.vastObj.videoClicks.clickThrough&&n.vastObj.videoClicks.clickThrough.length){!n.config.open&&n.vastObj&&(L=!0,n.config.open=n.vastObj.videoClicks.clickThrough[0]),O("SF | VP2 | Video Player | create click tag "+n.config.open,2);var s=t(e.createElement("div")).attr({id:"click-"+n.id,"class":"vp-clickmask","data-tracking":t(n.element).attr("data-tracking")||t(n.element).attr("id")});t(s).on("click",function(){"pause"===i&&G.toggle(!0),n.config.open&&("pause"===i&&"playing"===G.getState()||!i)&&(mraid.open(n.config.open,n.element),n.vastObj.videoClicks&&n.vastObj.videoClicks.clickTracking&&n.vastObj.videoClicks.clickTracking.length&&o(n.vastObj.videoClicks.clickTracking))}),a.append(s)}if(!n.config.hideControls||n.config.customControls){var u=t(e.createElement("div")).attr({"class":"vp-controls"}),c=t(n.element).width();c<=600&&c>400?t(u).addClass("md"):c<=400&&c>170?t(u).addClass("sm"):c<=170&&t(u).addClass("xs"),Z&&u.addClass("is_ie"),l(u,n),a.append(u)}}n.config.use_as_vpaid&&(A.vpaidSkinId=n.id)}function u(A){A?X.show():(X.hide(),t(".vp-controls").addClass("show"))}function l(A,n){O("SF | VP2 | create widget | create controls");var o=e.createElement("span");o.classList.add("vp-play-pause");var a=e.createElement("span");a.classList.add("vp-volume-onoff"),n.config.muted&&a.classList.add("muted");var i,r,s,u;n.config.customControls?(i=t(e.createElement("span")).attr({"class":"vp-play ecl"}),r=t(e.createElement("span")).attr({"class":"vp-pause ecl"}),s=t(e.createElement("span")).attr({"class":"vp-unmute ecl"}),u=t(e.createElement("span")).attr({"class":"vp-mute ecl"})):(i=h("play",n),r=h("pause",n),s=h("unmute",n),u=h("mute",n));var c=y("timer"),l=y("duration"),d=b(n),p=C();t(o).append(i).append(r),t(a).append(s).append(u),A.append(o).append(c).append(d).append(l).append(a).append(p),H()&&t(p).hide(),t(i).on("click",function(){G.play(!0,!0)}),t(r).on("click",function(){G.pause(!0,!0)}),t(s).on("click",function(){G.unmute(!0)}),t(u).on("click",function(){G.mute(!0)}),t(e).on("adResize",function(){f()})}function m(A){if(!V.config.hideControls||V.config.customControls){if("playing"===A&&(t(".vp-play-pause",F).addClass("playing"),t(".vp-clickmask",F).addClass("playing")),
"paused"!==A&&"ended"!==A||(t(".vp-play-pause",F).removeClass("playing"),t(".vp-clickmask",F).removeClass("playing")),"mute"===A&&(t(".vp-volume-onoff",F).addClass("muted"),t(".vp-current-volume",F).css({width:"0px"}),t(".vp-volume-handle",F).css({left:-(E.progressHandleW/2)+"px"})),"unmute"===A){t(".vp-volume-onoff",F).removeClass("muted");var e=G.getVolume();E.volumeW||(E.volumeW=parseInt(t(".vp-volume-bar",F).width())),t(".vp-current-volume",F).css({width:e*E.volumeW+"px"}),t(".vp-volume-handle",F).css({left:e*E.volumeW-E.progressHandleW/2+"px"})}"full_volume"===A&&(t(".vp-volume-onoff",F).removeClass("muted"),E.volumeW||(E.volumeW=parseInt(t(".vp-volume-bar",F).width())),t(".vp-current-volume",F).css({width:E.volumeW+"px"}),t(".vp-volume-handle",F).css({left:E.volumeW-E.progressHandleW/2+"px"}))}}function f(){var A=t(".vp-controls",F),e=t(F).closest("section"),n=t(e).attr("data-zoom")||1;E.zoom=n;var o=t(F).width()*n;t(A).css({"font-size":16/n+"px"}),o<=600&&o>450?t(A).removeClass("sm").removeClass("xs").addClass("md"):o<=450&&o>320?t(A).removeClass("md").removeClass("xs").addClass("sm"):o<=320?t(A).removeClass("md").removeClass("sm").addClass("xs"):t(A).removeClass("md").removeClass("sm").removeClass("xs")}function v(A){t(".vp-timer-current",F).text(Y(A.time)),E.progressW=parseInt(t(".vp-progress-bar",F).width());var e=E.progressW*A.pcen;t(".vp-progress-bar-c",F).css({width:e+"px"}),t(".vp-progress-handle",F).css({left:e-E.progressHandleW/2+"px"})}function g(A){t(".vp-progress-bar-c",F).css({width:A+"px"}),t(".vp-progress-handle",F).css({left:A-E.progressHandleW/2+"px"}),E.progressW||(E.progressW=parseInt(t(".vp-progress-bar",F).width()));var e=(A+E.progressHandleW/2)/E.progressW*G.getDuration();t(".vp-timer-current",F).text(Y(e)),G.setCurrentTime(e)}function h(A,n){var o=n.element,a=e.createElement("span"),i=t(o).attr("data-tracking")||t(o).attr("id");return a.innerHTML=AA[A],a.classList.add("vp-"+A),a.classList.add("ecl"),a.classList.add("vp-btn"),a.setAttribute("style","pointer-events: auto;"),a.id=t(o).attr("id")+"_"+A,a.setAttribute("data-tracking",i+"_"+A),a}function y(A){var n=e.createElement("span");n.classList.add("vp-"+A);var o=e.createElement("span");return o.classList.add("vp-"+A+"-current"),o.textContent="00:00",t(n).append(o),n}function b(A){var n=e.createElement("span");n.classList.add("vp-progress");var o=e.createElement("div");o.classList.add("vp-progress-bar"),t(o).on("click",function(e){var t=e.offsetX?e.offsetX:e.originalEvent.touches[0].pageX,n=N(t,A.element);g(n)});var a=e.createElement("div");a.classList.add("vp-progress-bar-c");var i=e.createElement("div");return i.classList.add("vp-progress-handle"),k(i,A.element),t(n).append(a).append(o).append(i),n}function C(){var A=e.createElement("span");A.classList.add("vp-volume");var n=e.createElement("div");n.classList.add("vp-volume-bar");var o=e.createElement("div");o.classList.add("vp-current-volume");var a=e.createElement("div");return a.classList.add("vp-volume-handle"),P(a,V.element),t(n).on("click",function(A){var e=A.offsetX?A.offsetX:A.originalEvent.touches[0].pageX,t=B(e,V.element);S(t)}),t(A).append(o).append(n).append(a),A}function k(A,n){function o(){s=!0,G.state===w.playing&&(G.pause(!1,!1),r=!0)}function a(e){s&&(s=!1,u=parseInt(A.style.left)||0,r&&(G.play(!1,!1),r=!1))}function i(A){if(s){var e=A.clientX?A.clientX:A.originalEvent.touches[0].pageX;e/=E.zoom||1;var o=t(".vp-progress-bar",n).offset().left||0,a=N(e-o/(E.zoom||1),n);g(a)}}var r=!1,s=!1,u=0;t(A).on("mousedown touchstart",o),t(A).on("mouseup touchend",a),t(e).on("mousemove touchmove",i),t(e).on("mouseup touchend",a)}function B(A,e){var n,o=(t(".vp-volume-bar",e).offset().left,parseInt(t(".vp-volume-bar",e).width()));return n=A<0?-5:A>o?o-5:A}function S(A){A||(A=0),t(".vp-current-volume",V.element).css({width:A+E.progressHandleW/2+"px"}),t(".vp-volume-handle",V.element).css({left:A+"px"}),E.volumeW||(E.volumeW=parseInt(t(".vp-volume-bar",V.element).width()));var e=parseFloat((A+E.progressHandleW/2)/E.volumeW).toFixed(2);G.setVolume(e),m(0==e?"mute":"unmute")}function P(A,n){function o(){r=!0}function a(){r&&(r=!1,s=parseInt(A.style.left)||0)}function i(A){if(r){var e=A.clientX?A.clientX:A.originalEvent.touches[0].pageX;e/=E.zoom||1;var o=t(".vp-volume-bar",n).offset().left||0,a=B(e-o/(E.zoom||1),n);S(a)}}var r=!1,s=0;t(A).on("mousedown touchstart",o),t(A).on("mouseup touchend",a),t(e).on("mousemove touchmove",i),t(e).on("mouseup touchend",a)}function T(){O("SF | VP2 | create widget | subscribe to content events"),G.dispatcher.on("statechange mute unmute",function(A,e){m(e,G)}),G.dispatcher.on("scenechange",function(A){v({time:G.getCurrentTime(),pcen:G.getCurrentTime()/G.getDuration()})}),G.dispatcher.on("buffering",function(A,e){X&&u(e)}),G.dispatcher.on("ended",function(){var A=V.config.oncomplete;if("loop"===A)G.play(!1);else if("undefined"!==A&&A.length>0){t(".vp-controls",F).addClass("inview");var e=t("#"+A);ad.switchToScene(j.attr("class"),e.data("index"),e.data("canvas"))}else t(".vp-controls",F).addClass("inview")}),G.dispatcher.on("play started",function(A){X&&u(!1),H()||t(".vp-controls",F).removeClass("inview")}),G.dispatcher.on("canplay",function(A){var e=G.getDuration();f(),X&&u(!1),t(".vp-controls",F).addClass("inview"),t(".vp-duration-current",F).text(Y(e)),e>0&&(x=!0)}),G.dispatcher.on("progress",function(A,e){v(e)}),G.dispatcher.on("pause",function(A){t(".vp-controls",F).addClass("inview")}),G.dispatcher.on("loadcomplete, canplaythrough",function(A){if(!x){var e=G.getDuration();t(".vp-duration-current",F).text(Y(e)),e>0&&(x=!0)}})}D=A["debugger"]||!1,O("SF | VP2 | create widget "+t(n).attr("id"));var V,I=t(n).data("id"),Q=t(n).attr("id");V=I.hasOwnProperty("vast")&&M[I.vast]?M[I.vast]:M[I.mp4]?M[I.mp4]:a(n),V.id=Q,V.element=n;var X,G,x,F=n,j=t(F).closest("section"),W=!0;X=new Spinner(n),W&&u(!0),r(n,V).then(function(){G=_.getFromElement(V),G.addPlayerWidget(V),T(),X&&(u(!1),W=!1)});var Y=function(A){var e=parseInt(A/60)%60,t=parseInt(A%60);return(e<10?"0"+e:e)+":"+(t<10?"0"+t:t)},N=function(A,e){var n,o=(t(V.element).closest("section"),parseInt(t(".vp-progress-bar",e).width()));return n=A<0?-5:A>o?o-5:A};this.getContent=function(){return G},this.getContainer=function(){return t(F)},this.getCurrentTime=function(){return G.getCurrentTime()},this.getDuration=function(){return G.getDuration()},this.getState=function(){return G.getState()},this.getVideoElement=function(){return G.getVideoElement()},this.isMuted=function(){return G.isMuted()},this.isPlaying=function(){return G.state===w.playing},this.setCurrentTime=function(A){G.setCurrentTime(A)},this.setVideoSource=function(A){G.setVideoSource(A)},this.pause=function(A,e){G.pause(A,e)},this.play=function(A,e){G.play(A,e)},this.toggle=function(A,e){G.toggle(A,e)},this.toggleSound=function(){D&&R&&R>=10&&O("video element | toggle sound"),G.toggleSound()}},_=function(n){function a(A){function e(A){var e,t=A.type;switch(t){case"custom":e=new U(A);break;case"youtube":e=new K(A);break;case"vimeo":e=new $(A);break;default:console.log("video type not found")}return e}m=e(A),O("SF | VP2 | Content Manager | create player"),r(),fA()}function i(A,e,n){if(!S&&(n||(n=m.getContainer()),!j[A]&&E)){var a;"vmu"!=A&&"vum"!=A&&(a=m.isMuted()?"muted":"unmuted"),ad.event(A,a,void 0,t(n).attr("id"),e),j[A]++,m.hasOwnProperty("getVastObject")&&m.getVastObject()&&o(m.getVastObject().playerEvents[A])}}function r(){m.oncanplay=Y,m.oncanplaythrough=N,m.onload=_,m.onprogress=q,m.onbuffering=L,m.onplay=eA,m.onpause=AA,m.onstatechange=nA,m.onmute=z,m.onstarted=tA,m.onended=J,m.onunmute=aA,m.onvolumechange=iA}function s(){a(n),n.vastObj&&setTimeout(function(){u()},100),V.on("adResize adStateChange adSceneChange",u)}function u(A){D&&O("check first display"),W=!0;var n=ad.getVisibleSection();"hidden"!==mraid.getState()&&F.getVisiblePlayer(n)&&(F.loaded?lA():F.loading||F.load(),F.handleStateChange(),V.off("adResize adStateChange adSceneChange",u),V.on("adResize adStateChange adSceneChange",F.handleStateChange)),S&&t(e).trigger("vpaidSkinIdReady")}O("SF | VP2 | Content Manager | init");var c,l,d,p,m,f,v,g,h,b,C=(t(n.element),null),E=null,k=n.config.autoplay,B={},S=(n.config.is360,n.config.use_as_vpaid),P=null,T=null,M=A.multilayer_main||!1,I=A.multilayer_top||!1,Z=!1,Q=!1,X=A.scroller_format||0,G=1===A.scroller_ratio,x=n.type,F=this;p=mraid.getCustomData&&mraid.getCustomData().placementType?"inline"===mraid.getCustomData().placementType:!mraid.getPlacementType||"inline"===mraid.getPlacementType(),S&&(p=!1),O("SF | VP2 | Content Manager | configs: {\n\tis vpaid source: "+S+", \n\tis inline: "+p+"\n}",2),F.dispatcher=t(""),F.loading=!1,F.loaded=!1;var j={vst:0,vco:0,v25:0,v50:0,v75:0,vrs:0,vre:0,vmu:0,vum:0,vpa:0,"05s":0,"15s":0},W=!1,H=function(){F.dispatcher.trigger("backintoview")},L=function(A){F.dispatcher.trigger("buffering",[A])},Y=function(){O("SF | VP2 | Content Manager | oncanplay"),F.dispatcher.trigger("canplay"),L(!1),p=mraid.getCustomData&&mraid.getCustomData().placementType?"inline"===mraid.getCustomData().placementType:!mraid.getPlacementType||"inline"===mraid.getPlacementType(),B=mraid.getFullCurrentPosition?mraid.getFullCurrentPosition():mraid.getCurrentPosition(),"youtube"!==x&&"vimeo"!==x&&(rA()?k&&F.state===w.ready&&F.play():(O("SF | VP2 | Content Manager | oncanplay | either no player in section or out of view",3),k&&F.state===w.ready&&pA(F.state)))},N=function(A){F.dispatcher.trigger("canplaythrough"),rA()&&k&&F.state===w.ready&&F.play()},J=function(){D&&R>=1&&O("Content Manager | onended"),V.trigger("adVideoStopped"),i("vco"),F.dispatcher.trigger("ended")},_=function(){F.loaded||(F.loaded=!0,F.loading=!1,F.dispatcher.trigger("loadcomplete"),setTimeout(function(){l=sA(y),l&&k&&F.state===w.ready&&F.play()},100))},z=function(A,e){F.muted=!0,void 0==e&&(e=!0),F.dispatcher.trigger("mute",["mute"]),F.dispatcher.trigger("volumechange",[0]),void 0===A&&(A=!1),F.loaded&&e&&i("vmu",A)},q=function(A,e,t){F.dispatcher.trigger("progress",{pcen:A,time:e,frame:t}),!j.vst&&A>0?i("vst"):A>=.25&&!j.v25?i("v25"):A>=.5&&!j.v50?i("v50"):A>=.75&&!j.v75&&i("v75"),e>=5&&!j["05s"]?i("05s"):e>=15&&!j["15s"]&&i("15s")},AA=function(){O("Content Manager | onpause"),"custom"!==x&&"undefined"==typeof g&&(g=!0),V.trigger("adVideoStopped"),F.dispatcher.trigger("pause",f),g&&i("vpa",f)},eA=function(){O("SF | VP2 | Content Manager | onplay"),"custom"!==x&&"undefined"==typeof h&&(h=!0),t(".vp-poster").hide(),V.trigger("adVideoStarted"),F.dispatcher.trigger("play"),h&&j.vpa&&i("vrs",Z)},tA=function(){F.dispatcher.trigger("started"),j.vst||i("vst",Z),j.vco&&!j.vre&&i("vre",Z)},nA=function(A){F.dispatcher.trigger("statechange",[A]),F.state=A},oA=function(){F.dispatcher.trigger("scenechange")},aA=function(A,e){F.muted=!1,void 0==e&&(e=!0),F.dispatcher.trigger("unmute",["unmute"]),F.dispatcher.trigger("volumechange",[F.getVolume()]),void 0===A&&(A=!1),F.loaded&&i("vum",A)},iA=function(A){F.dispatcher.trigger("volumechange",[A])},rA=function(){O("SF | VP2 | Content Manager | Chek if visible",3),c||(c=ad.getVisibleSection());var e=F.getVisiblePlayer(c),t=y||B.scrollTop,n=mraid.getState();return G=1===A.scroller_ratio,l=!!e&&(!(p||X||M)||"expanded"===n||sA(t,B.y)),null!==e&&l},sA=function(e,n){e=e||y||0;var o,a=null,i=mraid.getState();null!==n&&void 0!==n?a=n:B&&null!==B.y&&void 0!==B.y?a=B.y:(o=mraid.getFullCurrentPosition?mraid.getFullCurrentPosition():mraid.getCurrentPosition(),a=o.y),y=e;var r=C?C.getContainer():null;if(!r||!r.is(":visible")||"expanded"!==i&&(p||X||M)){if(r&&r.is(":visible")){var s=t(r).parents("section"),u=s.attr("data-zoom")||1,c=r.offset().top+r.height()*u/2,l=(I?A.scroller_px_height||mraid.getMaxSize().height*A.scroller_ratio:0,a+c);if(y=e,X||M){var d=A.scroller_px_height||mraid.getMaxSize().height*A.scroller_ratio;return a-ec}return l>=e&&l<=e+mraid.getMaxSize().height}return!1}return!0},uA=function(){O("SF | VP2 | Custom Player | on viewable change to "+mraid.isViewable(),3),S||(mraid.isViewable()?(y?(B.scrollTop=y,y=null):B=mraid.getFullCurrentPosition?mraid.getFullCurrentPosition():mraid.getCurrentPosition(),l=sA(B.scrollTop,B.y),l&&H(),dA()):(pA(F.state),F.state===w.playing&&F.pause(!1)))},cA=function(A){A=A.detail||A,b||(b=!0,p=mraid.getCustomData&&mraid.getCustomData().placementType?"inline"===mraid.getCustomData().placementType:!mraid.getPlacementType||"inline"===mraid.getPlacementType()),(p||X||M)&&(l=sA(A.scrollTop),l!==d&&F.state!==w.ended&&(d=l,l?((F.state===w.paused&&!f||k&&F.state===w.ready)&&F.play(!1),dA(),H()):F.state===w.playing?(pA(w.playing),F.pause(!1)):pA(F.state)))},lA=function(){Y(),N(),F.loaded=!1,_()},dA=function(){O("SF | VP2 | Content Manager | restore player state to "+F.savedState+" and autoplay is "+k,4),l=sA(y),l&&("custom"!==x&&F.savedTime&&F.setCurrentTime(F.savedTime),(F.savedState===w.playing||F.savedState===w.ready&&k||F.state===w.ready&&k)&&F.play(!1,!1),F.savedState&&(F.savedState=null))},pA=function(A){F.savedState||(F.savedState=A,"custom"!==x&&(F.savedTime=F.getCurrentTime()))},mA=function(){Q=!0,mraid.enableScroll(),mraid.addEventListener("pageScroll",cA)},fA=function(){mraid.addEventListener("viewableChange",uA),!Q&&(p||X||M)&&mA()};F.state=w.created,F.savedState=null,F.savedTime=null,F.playerWidgets=[],F.videoName=n.dataid,F.addPlayerWidget=function(A){F.playerWidgets.push(A.id)},F.getCurrentTime=function(){return m.getCurrentTime()},F.getDuration=function(){return m.getDuration()},F.getState=function(){return F.state},F.getVisiblePlayer=function(e){var n=null;return e||(e=ad.getVisibleSection()),t("div[data-type=video2]",e).each(function(){F.playerWidgets.indexOf(this.id)>-1&&(n=A.SFVideoPlayers[this.id])}),n},F.getVideoElement=function(){return m.getVideoElement()},F.getVolume=function(){return m.getVolume()},F.handleStateChange=function(){O("SF | VP2 | Content Manager | handle state change"),c=ad.getVisibleSection(),c.length>1&&(c=null);var A=c?c.attr("id"):null,e=c?c.attr("class"):null;if(c){if(O("SF | VP2 | Content Manager | has visible section",3),"hidden"===mraid.getState())O("SF | VP2 | Content Manager | has visible section | current state is hidden",3),C=null,E=null,pA(F.state),F.state===w.playing&&F.pause(!1);else if(P!==A||T!==e){O("SF | VP2 | Content Manager | has visible section | change in state",2);var n=F.getVisiblePlayer(c);if(C&&pA(F.state),n){O("SF | VP2 | Content Manager | has visible section | has active player widget",4),oA(),C=n,E=c;var o=C.getContainer(),a=m.getVideoElement();0===t(o).find(a).length?(O("SF | VP2 | Content Manager | has visible section | has active player widget | move player to visible section",4),F.state===w.playing&&F.pause(!1),setTimeout(function(){var A=t(".vp-container",o);A.append(a),dA(),mraid.getCurrentPosition&&(B.y=mraid.getCurrentPosition().y)},1)):(O("SF | VP2 | Content Manager | has visible section | do not move video element",4),dA())}else O("SF | VP2 | Content Manager | has visible section | no active player widget",4),F.state===w.playing&&F.pause(!1),C=null,E=null;P=A,T=e}}else O("SF | VP2 | Content Manager | handle state change | no visible section",3)},F.isMuted=function(){return m.isMuted()},F.load=function(){F.loaded||F.loading||(F.loading=!0,m.load())},F.mute=function(A,e){D&&R&&R>=10&&O("content manager | mute"),m.isMuted()||(m.mute(A),v=A)},F.pause=function(A,e){"undefined"==typeof e&&(e=!0),F.state===w.paused&&F.state===w.ready||(m.pause(A,e),f=A,Z=!1,g=e)},F.play=function(A,e){"undefined"==typeof A&&(A=!1),"undefined"==typeof e&&(e=!0),h=e,F.state===w.playing||f&&!A||(O("SF | VP2 | Content Manager | play",4),f=!1,Z=A,A&&F.isMuted()&&!v&&F.unmute(),m.play(A))},F.setCurrentTime=function(A){m.setCurrentTime(A)},F.setVideoSource=function(A){m.setVideoSource(A)},F.setVolume=function(A){var e=Math.min(A,1);m.setVolume(e)},F.toggle=function(A,e){F.state===w.playing?F.pause(A,e):(F.state===w.paused||F.state===w.ready||F.state===w.ended&&A)&&F.play(A,e)},F.toggleSound=function(){D&&R&&R>=10&&O("content manager | toggle sound"),m.isMuted()?m.unmute():m.mute()},F.unmute=function(A,e){m.isMuted()&&m.unmute(A)},s()};_.getFromElement=function(e){var t;return t=A.SFVideoPlayersMap[e.dataid]?A.SFVideoPlayersMap[e.dataid]:A.SFVideoPlayersMap[e.dataid]=new _(e)};var z,U=function(n){function o(){return O("SF | VP2 | Custom Player | build video element"),c=e.createElement("video"),z={autoplay:!1,controls:!1,preload:l.preload},l.poster&&(z.poster=l.poster),("undefined"==typeof l.playsinline||l.playsinline)&&(z.playsinline=1,z["webkit-playsinline"]=1),"undefined"==typeof l.loadonplay||l.loadonplay||(z.preload="none"),t(c).attr(z),l.muted&&(z.muted=!0,t(c).attr("muted","true"),c.volume=0,c.muted=!0),l.hideControls||t(".vp-controls").addClass("show"),CA(w.initialized),c}function a(){return O("SF | VP2 | Custom Player | build canvas element"),c=e.createElement("div"),V||(m=e.createElement("canvas"),t(m).css({height:"100%",width:"100%",display:"none"}),t(c).append(m)),t(c).css({height:"100%",width:"100%"}),l.poster&&(y=t(e.createElement("div")).addClass("vp-poster").css({height:"100%",width:"100%","background-image":"url("+l.poster+")",position:"absolute","z-index":"1",top:0,left:0}),t(c).append(y)),M&&(u(),T&&t(c).append(T.getElement())),l.hideControls||t(".vp-controls").addClass("show"),CA(w.initialized),c}function i(){function o(){D&&O("Custom Player | set360"),h=e.createElement("div"),t(h).addClass("pano-view").css({width:"100%",height:"100%"}),t(j).append(h),eA.container=h,eA.viewer=new A.PANOLENS.Viewer({container:eA.container,controlBar:!1,controlButtons:["video"],autoHideInfospot:!0,horizontalView:!1,enableReticle:!1,dwellTime:1500,autoReticleSelect:!0,passiveRendering:!1,output:"console"}),eA.panorama=new A.PANOLENS.VideoPanorama(c.children[0].src,{videoElement:c,muted:l.muted,autoplay:!1,loop:Y}),l.preloadBeforeReady?(eA.viewer.add(eA.panorama),A.hasActiveMotionEvents&&eA.viewer.enableControl(1),rA()):(c.onloadeddata=function(){eA.viewer.add(eA.panorama),A.hasActiveMotionEvents&&eA.viewer.enableControl(1),rA()},c.load()),A.pano=eA}O("SF | VP2 | Custom Player | Define video player"),c.oncanplay=iA,c.oncanplaythrough=cA,c.onvolumechange=bA,c.onended=lA,c.addEventListener("timeupdate",function(){var A=c.duration;if(A>0&&c.buffered&&c.buffered.length){c.buffered.end(Math.max(c.buffered.length-1,0)),c.seekable.end(c.seekable.length-1)}}),E=e.createElement("source"),E.addEventListener("error",function(){F&&(g&&""!==g?(E.src=g,t(c).append(E)):O("SF | VP2 | No default video source was configured.",1,"warn"))}),CA(w.preloading),Z?H=setInterval(EA,10):c.onload=c.onsuspend=dA;var a=U?Q.originalVideo:r(Q);if(a&&""!==a?(g=a,O("SF | VP2 | Video source is "+a,2)):v?a=v:(N=!1,O("SF | VP2 | No video source was configured.",1,"warn")),N&&"%"===a.slice(0,1)){$=!0,t(x).addClass("temp-placeholder");var i=e.createElement("div");i.innerHTML=AA.play,t(i).addClass("temp-poster"),t(x).append(i)}if(N&&"%"!==a.slice(0,1)&&!$&&(E.src=a),$&&N&&a.indexOf("_q%")>-1)if(O("SF | VP2 | Custom Player| is Template",5),n.vastObj&&n.vastObj.feed)E.src=a;else{var s=t(x).attr("data-placeholder-value");if(s){var u=s.split(".").pop().toLowerCase(),d=/mov|mpeg|mpg|mp4|webm|avi/g;d.test(u)||(s+=".mp4"),E.src=s}}N&&!B[a]&&(B[a]=a),N&&!F?t(c).append(E):F&&v&&(E.src=v,t(c).append(E)),n.config.is360&&A.THREE&&o(),C=c}function s(){D&&O("Custom Player | define canvas player"),CA(w.preloading);var A;V?(A=Q.mp4,f=new MP4Player(A,{width:"100%",height:"100%",onfinished:lA,onload:fA,onprogress:yA}),t(c).append(f.canvas),f.init()):(A=Q.mpg,f=new jsmpeg(A,{canvas:m,seekable:!0,onload:fA,onfinished:lA,ondecodeframe:yA}),C=f),T&&T.load()}function u(){D&&O("Custom Player | call to create audio player"),T=new q(n,M,l.muted),T.oncanplay=uA,T.onload=mA,T.onmute=nA,T.onunmute=oA,T.onerror=mA}O("SF | VP2 | Custom Player | init");var c,l=n.config,d=this;if(l){var p,m,f,v,g,h,y,C,E,k,S=!1,P=!1,T=null,M=n.feeds.mp3,V=!1,Q=n.vastObj?n.vastObj.feed:n.feeds,X=!1,G=!1,x=n.element,F=l.is_dynamic||!1,j=t(".vp-container",x),W=!1,H=null,L=-1,Y="loop"===n.config.oncomplete,N=!0,J=null,_=w.created,z={autoplay:!1,muted:!0},U=l.use_original,K=mraid.getCustomData(),$=1==K.is_template;if(A.forceMp4Player&&("object"!=typeof WebAssembly?Q.mpg||(b=!1):(b=!0,V=!0)),l.is360){var eA={};b=!1}void 0==b&&(b=!1),O("SF | VP2 | Custom Player config "+JSON.stringify({loop:Y,useCanvas:b,useOriginal:U}),2);var tA=!1,nA=function(){d.onmute()},oA=function(){d.onunmute()},aA=function(A){CA(A?w.buffering:w.playing),d.onbuffering(A)},iA=function(){n.config.is360&&!G||(tA=!0,z.muted&&(d.mute(),d.onmute(!1,!1)),c.oncanplay=null,c.pause(),setTimeout(function(){c.onplaying=hA,c.onpause=gA,CA(w.ready),d.oncanplay(),k&&(k=!1,d.play(!0))},5))},rA=function(){G=!0,iA()},sA=function(){(T&&S||!T)&&tA&&(X=!0,CA(w.ready),d.oncanplay())},uA=function(){S=!0,sA()},cA=function(A){tA||d.oncanplay(),c.oncanplaythrough=null,d.oncanplaythrough(A)},lA=function(A){clearInterval(J),L=-1,Y?_!==w.paused&&CA(w.paused):CA(w.ended),d.onended()},dA=function(){I&&!b&&!n.config.is360,tA||iA(),tA?(W=!0,d.onload()):H=setInterval(wA,10)},pA=function(){D&&R>=5&&O("Custom Player | onload_canvas"),W&&(T&&P||!T)&&(t(m).show(),tA=!0,vA(),d.onload())},mA=function(){D&&R>=5&&O("Custom Player | onload_audio"),P||(P=!0,pA())},fA=function(){D&&R>=5&&O("Custom Player | onload_video_canvas"),W=!0,pA()},vA=function(){D&&R>=5&&O("Custom Player | oncanplay_video_canvas"),sA()},gA=function(){clearInterval(J),CA(w.paused),d.onpause()},hA=function(){CA(w.playing),d.onplay(),(L===-1||b&&f&&(f.currentFrame===-1||0===f.currentFrame))&&d.onstarted(),b||kA()},yA=function(){d.onprogress(f.currentTime/f.duration,f.currentTime,f.currentFrame)},bA=function(){D&&R>=5&&O("Custom Player | onvolumechange"),c.muted?d.onmute():d.onunmute()};d.oncanplay=function(A){},d.oncanplaythrough=function(A){},d.onload=function(A){},d.onmute=function(A){},d.onpause=function(){},d.onplay=function(){},d.onstatechange=function(A){},d.onprogress=function(A){},d.onbuffering=function(A){},d.onstarted=function(){},d.onended=function(){},d.onunmute=function(A,e){},d.onvolumechange=function(A){};var CA=function(A){D&&R>=5&&O("state: "+A),_!==A&&(_=A,d.onstatechange(A))},wA=function(){tA&&(clearInterval(H),dA())},EA=function(){var A=c&&c.buffered&&c.buffered.length>0?Math.round(100*c.buffered.end(0))/100:0,e=Math.round(100*c.duration)/100;4===c.readyState&&c.buffered.length>0&&A>=e&&(clearInterval(H),setTimeout(function(){d.onload("onload")},10))},kA=function(){clearInterval(J),J=setInterval(BA,150),BA()},BA=function(){c.currentTime!=L?(_==w.buffering&&aA(!1),d.onprogress(c.currentTime/c.duration,c.currentTime,null)):W||_==w.buffering||aA(!0),L=c.currentTime};d.getVideoElement=function(){return n.config.is360?h:c},d.getContainer=function(){return n.config.is360?t(h).closest('div[data-type="video2"]'):t(c).closest('div[data-type="video2"]')},d.getCurrentTime=function(){return f&&!isNaN(f.currentTime)?f.currentTime:!C||C&&isNaN(C.currentTime)?0:C.currentTime},d.getDuration=function(){return f&&!isNaN(f.duration)?f.duration:!C||C&&isNaN(C.duration)?0:C.duration},d.getState=function(){return _},d.getVastObject=function(){return n.vastObj?n.vastObj:null},d.getVolume=function(){return b&&T?T.getVolume():b&&!T?0:c.volume},d.isMuted=function(){return b&&T?T.isMuted():!(!b||T)||c.muted},d.mute=function(A,e){D&&R&&R>=10&&O("custom player | mute"),b&&T?T.mute():c.muted=!0,d.onmute(A,e)},d.load=function(){b?s():i()},d.pause=function(){n.config.is360&&eA.panorama.pauseVideo?eA.panorama.pauseVideo():C?(C.pause(),b&&(gA(),T&&T.pause())):(f?f.pause():c&&c.pause(),gA())},d.play=function(A){O("SF | VP2 | Custom Player | play with state"+_,4),"preloading"===_?k=!0:n.config.is360&&eA.panorama.playVideo?C?C.play():c&&c.play():(C?C.play():f?f.play():c&&c.play(),b&&(hA(),T&&T.play(d.getCurrentTime())))},d.setCurrentTime=function(A){b?(f.seekToTime(A),T&&T.setCurrentTime(A)):C.currentTime=A},d.setVideoSource=function(A){E?(E.src=A,v=A,t(c).append(E)):v=A},d.setVolume=function(A){return c.muted=A<=0,c.volume=A},d.unmute=function(A){b&&T?(T.unmute(),T.isPlaying()||T.play(d.getCurrentTime())):(c.muted=!1,c.volume=1),d.onunmute(A)},b?p=a():(p=o(),c.onplaying=hA,c.onpause=gA)}},q=function(A,n,o){function a(){return D&&O("Audio Player | create element"),i=e.createElement("audio"),t(i).attr({autoplay:!1,muted:!0,"webkit-playsinline":"true"}),i.muted=!0,i}if(O("SF | VP2 | Audio Player | init"),n){var i,r=this,s=!1,u=null,c=function(){r.onerror()},l=function(){s=!0,i.oncanplay=null,r.oncanplay()},d=function(A){s||l(),i.oncanplaythrough=null,r.oncanplaythrough(A)},p=function(){s?r.onload():H()?(l(),r.onload(),i.onload=i.onsuspend=null):u=setInterval(h,10)},m=function(){},f=function(){},v=function(){i.muted?r.onmute():r.onunmute()},g=function(){},h=function(){s&&(clearInterval(u),p("onload"))},y=function(){var A=i.buffered&&i.buffered.end&&i.buffered.length>0?i.buffered.end(0):0,e=i.duration&&!isNaN(i.duration)?i.duration:0,t=Math.round(100*A)/100,n=Math.round(100*e)/100;4===i.readyState&&i.buffered.length>0&&t>=n&&(clearInterval(u),setTimeout(function(){r.onload("onload")},10))};r.oncanplay=function(A){},r.oncanplaythrough=function(A){},r.onload=function(A){},r.onmute=function(A){},r.onvolumechange=function(A){},r.onunmute=function(A){},r.onerror=function(A){},r.getElement=function(){return i},r.getCurrentTime=function(){return i.currentTime},r.getVolume=function(){return i.volume},r.setCurrentTime=function(A){i.currentTime=A},r.isMuted=function(){return i.muted},r.isPlaying=function(){return i.paused===!1},r.load=function(){i.oncanplay=l,i.oncanplaythrough=d,i.onplaying=f,i.onpause=m,i.onvolumechange=v,i.ontimeupdate=g,i.onerror=c,Z?u=setInterval(y,10):i.onload=i.onsuspend=p,i.src=n},r.mute=function(){i.muted=!0},r.play=function(A){i.play(),A&&(i.currentTime=A)},r.pause=function(){i.pause()},r.unmute=function(){i.muted=!1},a()}},K=function(A){function n(e){var n=ad.getVisibleSection(),a=(t(m).attr("data-id"),t('[data-id="'+t(m).attr("data-id")+'"]',n));a&&a.length&&(f=t(".vp-container",a),m=a);var u=t(m).closest("section").data("zoom")||1;if(i.id="youtube-"+A.feeds,i.setAttribute("style","width: "+100*u+"%; height: "+100*u+"%; pointer-events: auto;"),f.append(i),e=o(r),k(w.initialized),YT&&YT.Player)return s=new YT.Player(i.id,{height:t(m).height(),width:t(m).width(),playerVars:p,videoId:A.dataid,events:e}),t(f).find("iframe").css({transform:"scale("+1/u+")","transform-origin":"top left"}),s}function o(A){function e(e){var n=A.getApi().getPlayerState();switch(s||(s=setInterval(function(){t(A.getApi().getPlayerState(),a,i)},500)),n){case YT.PlayerState.BUFFERING:g();break;case YT.PlayerState.CUED:break;case YT.PlayerState.ENDED:y();break;case YT.PlayerState.PAUSED:C();break;case YT.PlayerState.PLAYING:E()}}function t(e){var t=A.getApi().getCurrentTime(),n=A.getApi().getDuration(),o=A.getApi().isMuted();a||(a=t),void 0==i&&(i=o),e==YT.PlayerState.PLAYING&&r.onprogress(t/n,t,null),o!=i&&(o?r.onmute():r.onunmute()),a=t,i=o}function n(A){console.log("error",A)}function o(){h(),b()}var a,i,s;return{onError:n,onReady:o,onStateChange:e}}O("SF | VP2 | YouTube Player | init");var a=A.config,i=e.createElement("div"),r=this;if(a){var s,u,c={},l=a.loop,d=!!a.autoplay||("undefined"==typeof a.muted||a.muted),p={autoplay:a.autoplay?1:0,controls:a.hideControls?0:1,mute:d,playsinline:1,disablekb:1,fs:0,loop:l?1:0,showinfo:0,rel:0,iv_load_policy:3,enablejsapi:1,html5:e.createElement("video").canPlayType?1:0},m=A.element,f=t(".vp-container",m),v=!1,g=function(A){k(A?w.buffering:w.playing),r.onbuffering(A)},h=function(){k(w.ready),setTimeout(function(){r.oncanplay()},1)},y=function(){v=!1,l||k(w.ended),r.onended()},b=function(){r.onload()},C=function(){k(w.paused),r.onpause()},E=function(){k(w.playing),v?r.onplay():(v=!0,r.onstarted())},k=function(A){u!==A&&(u=A,r.onstatechange(A))};r.oncanplay=function(A){},r.oncanplaythrough=function(A){},r.onload=function(A){},r.onmute=function(A){},r.onpause=function(){},r.onplay=function(){},r.onstatechange=function(A){},r.onprogress=function(A){},r.onbuffering=function(A){},r.onstarted=function(){},r.onended=function(){},r.onunmute=function(A){},r.onvolumechange=function(A){},r.getApi=function(){return s},r.getContainer=function(){return m},r.getCurrentTime=function(){return s&&s.getCurrentTime?s.getCurrentTime():0},r.getDuration=function(){return s&&s.getDuration?s.getDuration():0},r.getState=function(){return u},r.getVideoElement=function(){return s?s.getIframe():null},r.getVolume=function(){var A=s.getVolume();return A/100},r.isMuted=function(){return s.isMuted()},r.load=function(){k(w.preloading),H()?setTimeout(function(){s=n(c)},100):s=n(c)},r.mute=function(){s.mute(),r.onmute()},r.pause=function(){s&&s.pauseVideo&&s.pauseVideo()},r.play=function(){s&&s.playVideo&&s.playVideo()},r.setCurrentTime=function(A){s&&s.seekTo(A)},r.setVolume=function(A){s.setVolume(100*A),r.onvolumechange(A)},r.unmute=function(){s.unMute(),r.onunmute()}}},$=function(A){function n(){return D&&O("Vimeo Player | build element"),l=new Vimeo.Player(r,h)}function o(){l&&(l.on("ended",function(A){b()}),l.on("play",function(A){E()}),l.on("pause",function(A){C()}),l.on("timeupdate",function(A){m=A.duration,p=A.seconds,s.onprogress(A.seconds/A.duration,A.seconds,null)}),l.on("volumechange",function(A){var e=!A.volume>0;k(e),A.volume>0&&s.onvolumechange(A.volume)}),l.on("error",function(){console.log("Vimeo Error")}))}O("SF | VP2 | Vimeo Player | init");var a,i=A.config,r=e.createElement("div"),s=this;if(i){var u,c,l,d=A.element,p=0,m=0,f=i.loop,v=!!i.autoplay||("undefined"==typeof i.muted||i.muted),g=A.feeds&&"string"==typeof A.feeds&&"%"===A.feeds.slice(0,1),h={id:g?1:A.dataid,autoplay:i.autoplay,byline:!1,loop:f,muted:v,playsinline:!0,portrait:!1,title:!1};r.id="vimeo-"+A.dataid,r.setAttribute("style","width: 100%; height: 100%; pointer-events: auto;");var y=function(){B(w.ready),setTimeout(function(){s.oncanplay()},1)},b=function(){u=!1,f||B(w.ended),s.onended()},C=function(){B(w.paused),s.onpause()},E=function(){B(w.playing),u?s.onplay():(u=!0,s.onstarted())},k=function(A){A?(s.onmute(),c=!0):(s.onunmute(),c=!1)},B=function(A){a!==A&&(a=A,s.onstatechange(A))},S=function(){u?C():B(w.ready)};s.oncanplay=function(A){},s.oncanplaythrough=function(A){},s.onload=function(A){},s.onmute=function(A){},s.onpause=function(){},s.onplay=function(){},s.onstatechange=function(A){},s.onprogress=function(A){},s.onbuffering=function(A){},s.onstarted=function(){},s.onended=function(){},s.onunmute=function(A){},s.onvolumechange=function(A){},s.getContainer=function(){return d},s.getCurrentTime=function(){return p},s.getDuration=function(){return m},s.getState=function(){return a},s.getVideoElement=function(){return r},s.getVolume=function(){return l.getVolume()},s.isMuted=function(){return c},s.load=function(){B(w.preloading),l=n(),l.getVideoTitle().then(function(A){l.element.id=r.id,t(d).find("iframe").css({width:t(d).width(),height:t(d).height()}),y()})["catch"](function(A){console.log(A)}),setTimeout(function(){o()},1)},s.mute=function(){l.setVolume(0)},s.setCurrentTime=function(A){l&&l.setCurrentTime(A)},s.pause=function(){l?(l.pause(),C()):S()},s.play=function(){l&&l.play()},s.setVolume=function(A){l.setVolume(A)},s.unmute=function(){l.setVolume(1)}}},AA={exitFullScreen:'',fullScreen:'',
pause:'',play:'',unmute:'',mute:''};h(),t("div[data-type=video2][data-id]").each(function(e,t){var n=a(t);switch(n.type){case"youtube":m("https://www.youtube.com/player_api");break;case"vimeo":m("https://player.vimeo.com/api/player.js");break;case"custom":if(ad.preloadJS(["https://creative-p.undertone.com/spk-public/common/canvas-player.js"]),n.config.is360&&(ad.preloadJS(["https://ajax.googleapis.com/ajax/libs/threejs/r83/three.min.js","/sparkflow/formats/latest/panolens.min.js"]),p(),A.addEventListener("devicemotion",function(e){A.hasActiveMotionEvents||null==e.acceleration.x||(A.hasActiveMotionEvents=!0)}),A.addEventListener("deviceorientation",function(e){A.hasActiveMotionEvents||null==e.gamma||(A.hasActiveMotionEvents=!0)})),n.config.preloadBeforeReady)if(n.feeds.vast){if("%"===n.feeds.vast.slice(0,1))return void f(n);c(n,!0).then(function(){f(n)})}else f(n)}}),t(e).on("adReady",function(){z&&A.clearTimeout(z),t("div[data-type=video2][data-id]").each(function(e,t){var n=new J(this,e);A.SFVideoPlayers[t.id]=n})})}(window,document,jQuery);var Spinner=function(a){var t=12,n=.6,e=1/12,i=$(document.createElement("div")).addClass("spinner");this.show=function(){i.show()},this.hide=function(){i.hide()};for(var o=0;o-1)&&e.traceLog(t,o,a):console.info(t)};o(t).on("adReady",function(){if(e.enablePostMessage){a("SF | PostMessage | Start"),e.postToken||console.warn("SF | POST MESSAGE | No token was configured, post message won't be delivered");var t="expand detected",s="redirect detected",n=["expand"],i=["open"],c=e.postPrimaryEvts||n,r=e.postSecondaryEvts||i;c.forEach(function(s){a("SF | PostMessage | Set expand click",2),o("[data-onclick="+s+"]").on("click",function(s){a("SF | PostMessage | Expand Detected"),e.onClickPostMessage(e.primaryMessage||t,e.postTitle||"",o(this).data("tracking"),o(this).data("value"),e.postToken||"")})}),r.forEach(function(t){a("SF | PostMessage | Set redirect click",2),o("[data-onclick="+t+"]").on("click",function(t){a("SF | PostMessage | Redirect Detected"),e.onClickPostMessage(e.secondaryMessage||s,e.postTitle||"",o(this).data("tracking"),o(this).data("value"),e.postToken||"")})})}})}(window,document,jQuery);window.display_size_data=function(){if(window.traceLog("SF | Creative Size Reporting | Start"),void 0!==performance){var e=performance.getEntriesByType("resource");if(void 0!==e){for(var i=0,n=0;n-1)&&e.traceLog(i,n,r):console.info(i)};n(i).on("adReady",function(){var t=mraid.getCustomData();t.run&&"size"===t.run&&(r("SF | Creative Size Reporting | Init"),e.setTimeout(function(){n(i).trigger("startSizeReporting"),e.display_size_data()},12e3))})}(window,document,jQuery);(function(){$(function () {
console.log("ad.preload");
ad.preload([
'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.2.6/gsap.min.js']);
});
// Wait for the adReady or adClick event to initialize
$(document).on('adReady', function () {
console.log("document.on adReady fired");
mraid.setAutoClose(15 * 1000);
setTimeout(function () {
adReadyDelay();
}, 100);
});
function adReadyDelay() {
initializeAd();
initializeEvents();
startAd();
}
function initializeAd () {
console.log("initializeAd() called");
gsap.config({force3D: false});
gsap.set(".frames, .element,.lightning", {autoAlpha:0});
}
function initializeEvents(){
console.log("initializeEvents() called");
//video constants
const videoFullLandscape = SFVideoPlayers["video-clicked"];
const videoFullPortrait = SFVideoPlayers["video-clickedP"];
$("#play-video-clicked").on("click", function(){
videoFullLandscape.play();
videoFullPortrait.play();
gsap.to('#video-cover,#video-coverP, #play-video-clicked, #play-video-clickedP',0.5, {autoAlpha: 0});
});
$("#play-video-clickedP").on("click", function(){
videoFullLandscape.play();
videoFullPortrait.play();
gsap.to('#video-cover,#video-coverP, #play-video-clicked, #play-video-clickedP',0.5, {autoAlpha: 0});
});
function closeVideoLandscapeFunction() {
videoFullLandscape.pause();
videoFullPortrait.pause();
gsap.to('#video-cover,#video-coverP, #play-video-clicked, #play-video-clickedP',0.5, {autoAlpha: 1});
}
videoFullLandscape.getContent().dispatcher.on('ended', closeVideoLandscapeFunction);
let Clouds = gsap.timeline()
.to(".clouds", 7, {autoAlpha:1, x:-400})
let Water = gsap.timeline()
.from("#water1L, #water1P", 1, {y:100, x:-50})
.from("#water2L, #water2P", 1, {y:100, x:-50},"-=.95")
.to(".water", 10, {autoAlpha:1, x:600},"<")
let Lightning = gsap.timeline({repeat:2})
.to(".lightning", 3, {autoAlpha:0, x:50})
.to(".lightning", 3, {autoAlpha:0, x:0},">")
let LightningFlash1 = gsap.timeline({repeat:1,delay:1.6})
.to("#lightening1L, #lightening1P", .01, {autoAlpha:1})
.to("#lightening1L, #lightening1P", .01, {autoAlpha:0},"+=.1")
let LightningFlash2 = gsap.timeline({repeat:1,delay:1.5})
.to("#lightening2L, #lightening2P", .01, {autoAlpha:1})
.to("#lightening2L, #lightening2P", .01, {autoAlpha:0},"+=.1")
let LightningFlash4 = gsap.timeline({repeat:1,delay:1.7})
.to("#lightening4L, #lightening4P", .01, {autoAlpha:1})
.to("#lightening4L, #lightening4P", .01, {autoAlpha:0},"+=.1")
let LightningFlash3 = gsap.timeline({repeat:1, delay:1})
.to("#lightening3L, #lightening3P", .01, {autoAlpha:1})
.to("#lightening3L, #lightening3P", .01, {autoAlpha:0},"+=.1")
setTimeout(function () {
LightningFlash2.restart();
}, 3500);
setTimeout(function () {
LightningFlash3.restart();
}, 4000);
setTimeout(function () {
LightningFlash4.restart();
}, 4100);
setTimeout(function () {
LightningFlash1.restart();
}, 4200);
//third lightning
setTimeout(function () {
LightningFlash3.restart();
}, 6000);
setTimeout(function () {
LightningFlash2.restart();
}, 6500);
setTimeout(function () {
LightningFlash1.restart();
}, 6600);
setTimeout(function () {
LightningFlash4.restart();
}, 6700);
let ClearSky = gsap.timeline({delay:7})
.to(".grey-scale", 1, {autoAlpha:0},"<")
.to(".lightning, .clouds", 1, {autoAlpha:0},"<")
.set(".lightning, .clouds", {y:-600},">")
.to("#title2L, #title2P, #subtitle2L, #subtitle2P, #footer-headlineP", .5, {autoAlpha:1},"-=1")
.to("#title1L, #title1P, #subtitle1L, #subtitle1P", .5, {autoAlpha:0},"<")
.fromTo("#sunL, #sunP", 1, {autoAlpha:0,y:50, x:50}, {autoAlpha:1,y:0, x:0},"-=.5")
.fromTo("#clouds-lightL, #clouds-lightP", 3, {autoAlpha:0, x:200}, {autoAlpha:1, x:-100},"<")
.to("#light-scaleL", 1, {autoAlpha:1},"<")
.to("#water2L, #water2P", 3, {y:100},"<")
.to("#water1L, #water1P", 3, {y:100},"-=2.85")
.to(".water", 0, {autoAlpha:0},">")
//Fires every time the ad receives a user interaction, like a click, swipe or tap in any interactive element.
$(document).on('adInteraction', function (e) {
console.log("document.on adInteraction fired");
mraid.setAutoClose(15 * 1000);
});
//Fires every time a user clicks an exit link and opens a new page.
$(document).on('adClick', function () {
console.log("document.on adClick fired");
mraid.setAutoClose(15 * 1000);
});
$(document).on('adResize', function () {
console.log("document.on adResize fired");
});
//Fires every time we change state. Using mraid.getState() is helpful here.
$(document).on('adStateChange', function () {
console.log("document.on adStateChange fired");
console.log("state is: " + mraid.getState());
});
}
function startAd(){
gsap.to("section", .5, { opacity: 1 });
//Portrait.play();
}
;var _fullyOpened = false;
var adChoicesParams = {
corner: "tr",
showClose: false,
url: "http://www.undertone.com/opt-out-tool?utm_source=AdChoiceIcon&utm_medium=IAAdChoicesIcon&utm_campaign=Privacy"
};
var utParams = {
corner: "tl"
};
var adBars = {
//disable: true,
//style: {},
//topText: '',
//bottomText: ''
};
$(document).on("adReady", function() {
setAdChoice(adChoicesParams); // add adChoices
setUTMark(utParams); // add Undertone mark
setAdBars(adBars); // change ad bars
// setFullyViewable(.5); // change percent of the viewability needed to declare creative fully viewable. from 0 to 1
});
$(document).on("adFullyViewable", function(){
// action to take when ad is fully visible
_switchToScene('Full View');
});
$(document).on("adStateChange adResize", function(e) {
// return to Full View scene if it was already shown before
if (_fullyOpened) {
_switchToScene('Full View');
}
});
/*-----------------------------------*/
function _switchToScene (sceneName) {
var _viewClass = ad.getVisibleSection().attr("class"),
_section = $('section[data-name^="'+sceneName+' - "][class="'+_viewClass+'"]');
if (_section) {
var _container = $(_section).find('#container');
var _children = $(_container).children();
if (_children.length > 1) {
ad.switchToScene(_section.attr("class"), _section.data("index"), _section.data("canvas"));
_fullyOpened = true;
}
}
}
function setAdChoice(acparams) {
acparams.uid = mraid._info.uid;
var _adChoiceCode = '\
if (window.AdChoices) AdChoices.init(' + JSON.stringify(acparams) + ');\
';
mraid.parentBridge('addJavaScript', [_adChoiceCode]);
}
function setUTMark(utparams) {
utparams.uid = mraid._info.uid;
var _utCode = '\
if (window.UndertoneMark) UndertoneMark.init(' + JSON.stringify(utparams) + ');\
';
mraid.parentBridge('addJavaScript', [_utCode]);
}
function setAdBars(config) {
if (config) {
var _adBarsCode = '\
var _c = ' + JSON.stringify(config) + ';\
if (window.SFinlinescroller && window.SFinlinescroller.hideBars) window.SFinlinescroller.hideBars(_c.disable);\
if (_c.style && window.SFinlinescroller && window.SFinlinescroller.updateBarsStyle) window.SFinlinescroller.updateBarsStyle(_c.style);\
if (_c.topText && window.SFinlinescroller && window.SFinlinescroller.updateTopText) window.SFinlinescroller.updateTopText(_c.topText);\
if (_c.bottomText && window.SFinlinescroller && window.SFinlinescroller.updateBottomText) window.SFinlinescroller.updateBottomText(_c.bottomText);\
';
mraid.parentBridge('addJavaScript', [_adBarsCode]);
}
}
//mraid.enableScroll();
var _scrollHandler = function (e) {
e = e.detail || e;
var _toExpand = 0;
var winSize = window.innerHeight;
var currentPosition = mraid.getCurrentPosition();
var isMobile = mraid.detectMobile();
if (mraid.isViewable()) {
_toExpand = ((winSize.height + e.scrollTop - currentPosition.y)/ (winSize.height * .75));
_toExpand = Math.max(0, Math.min(1, _toExpand));
}
};
//mraid.addEventListener('pageScroll', _scrollHandler);
function setFullyViewable(p) {
if (p) {
var _fvCode = '\
var _fv = ' + p + ';\
if (_fv && window.SFinlinescroller && window.SFinlinescroller.updateFullyViewable) window.SFinlinescroller.updateFullyViewable(_fv);\
';
mraid.parentBridge('addJavaScript', [_fvCode]);
}
};
})();