@vouchfor/embeds 7.0.2 → 7.0.3
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/dist/es/embeds.js +1 -1
- package/dist/iife/dialog-embed/embed.iife.js +2 -2
- package/dist/iife/dialog-embed/embed.iife.js.map +1 -1
- package/dist/iife/embeds.iife.js +2 -2
- package/dist/iife/embeds.iife.js.map +1 -1
- package/dist/iife/player-embed/embed.iife.js +2 -2
- package/dist/iife/player-embed/embed.iife.js.map +1 -1
- package/package.json +2 -2
package/dist/iife/embeds.iife.js
CHANGED
|
@@ -2473,7 +2473,7 @@ vec4 transition(vec2 uv) {
|
|
|
2473
2473
|
return mix(a, b, step(0.0+p.y,progress));
|
|
2474
2474
|
}
|
|
2475
2475
|
`,author:"Jake Nelson",license:"MIT",createdAt:"Wed, 1 Nov 2017 15:24:36 -0500",updatedAt:"Thu, 2 Nov 2017 18:37:42 -0500"}];const wh=Ha(kv);var _h;function Mv(i){if(typeof i=="string"){const[e,t]=i.split(":");return Math.min(parseFloat(e),parseFloat(t))}return i}function Fv(i){if(typeof i=="string"){const[e,t]=i.split(":"),r=parseFloat(e),n=parseFloat(t);return r/n}return i}function vl({resolution:i,aspectRatio:e}){const t=Mv(i),r=Fv(e),n=r>=1,s=Math.min(n?t*r:t/r,t),o=Math.max(n?t*r:t/r,t);return{resolution:t,aspectRatio:r,height:Math.round(n?s:o),width:Math.round(n?o:s)}}const Rh={linear:qm,easeIn:Ga,easeInOut:jm,easeOut:Jm,circIn:bu,circInOut:Xm,circOut:Su,backIn:$a,backInOut:Zm,backOut:zm,anticipate:eE,bounceIn:nE,bounceInOut:sE,bounceOut:Us},ao=Ms((i,e,{clamp:t=!0,ease:r="easeIn",...n}={})=>$m(i,e,{...n,clamp:t,ease:Rh[r]}),{cacheKey:([i,e,t])=>JSON.stringify({from:i,to:e,options:t})}),Pv={type:"clip",processor:{getTargetState:i=>({clip:{x:i.coordinates.x,y:i.coordinates.y,width:i.dimensions.width,height:i.dimensions.height}}),interpolateState:({value:i,easing:e,progress:t,from:r})=>{const n=r.clip??{x:0,y:0,width:1,height:1},s={x:i.coordinates.x,y:i.coordinates.y,width:i.dimensions.width,height:i.dimensions.height};return{clip:ao([0,1],[n,s],{ease:e})(t)}}}},lo={type:"fade",processor:{getTargetState:i=>({opacity:i}),interpolateState:({value:i,easing:e,progress:t,from:r})=>({opacity:ao([0,1],[r.opacity,i],{ease:e})(t)})}},Nv={type:"scale",processor:{getTargetState:i=>({scale:i}),interpolateState:({value:i,easing:e,progress:t,from:r})=>({scale:ao([0,1],[r.scale,i],{ease:e})(t)})}},Dh={type:"translate",processor:{getTargetState:i=>({translation:i}),interpolateState:({value:i,easing:e,progress:t,from:r})=>({translation:ao([0,1],[r.translation,i],{ease:e})(t)})}},Ov=[{label:"Both",value:"both"},{label:"At start",value:"enter"},{label:"At end",value:"exit"}],Uv=[{value:"left",icon:"arrow-left"},{value:"right",icon:"arrow-right"},{value:"up",icon:"arrow-up"},{value:"down",icon:"arrow-down"}],Gv=[{value:"left",icon:"arrow-left"},{value:"right",icon:"arrow-right"}],$v=[{value:"up",icon:"arrow-up"},{value:"down",icon:"arrow-down"}],Un={timing:{type:"buttonRadio",name:"timing",label:"Animate",options:Ov},speed:{type:"slider",name:"speed",label:"Speed",min:0,max:100,step:1}},yl={type:"switch",name:"reverseExit",label:"Reverse exit animation"},Hv=.2,Yv=1;function Vv(i,e){const t=i==="both"?e/2:e;return Math.min(Yv,t)}function Gn({speed:i,timing:e,elementDuration:t}){const r=Vv(e,t),n=Math.min(Hv,r),s=Math.max(0,Math.min(100,i))/100;return r-s*(r-n)}const Kv="easeOut";function $n(i){return{values:e=>{var t;return{timing:e.timing??"both",speed:[e.speed??50],...((t=i==null?void 0:i.values)==null?void 0:t.call(i,e))??{}}},options:e=>{var t;return{timing:e.timing,speed:e.speed[0],easing:Kv,...((t=i==null?void 0:i.options)==null?void 0:t.call(i,e))??{}}}}}function Xi({timing:i,duration:e,elementDuration:t,easing:r,reverseExit:n=!1,enterFrom:s,exitTo:o,restValue:a}){const c=[],l=i==="both"||i==="enter",u=i==="both"||i==="exit",A=Math.max(0,t-e);if(l?(c.push({time:0,value:s,easing:r}),c.push({time:e,value:a,easing:"linear"})):c.push({time:0,value:a,easing:"linear"}),u){A>e&&c.push({time:A,value:a,easing:r});const h=n?s:o;c.push({time:t,value:h,easing:r})}return c}const Lh="fade",Wv={type:Lh,name:"Fade",options:{...Un},transform:$n(),generate:(i,e)=>{const t=Gn({speed:i.speed,timing:i.timing,elementDuration:e.elementDuration});return{fade:{keyframes:Xi({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,enterFrom:0,exitTo:0,restValue:1}),renderer:lo}}}},kh="pan",Mh=.25,Fh="left";function Ph(i,e,t){switch(i){case"left":return{x:e.width*t,y:0};case"right":return{x:-e.width*t,y:0};default:return Ph(Fh,e,t)}}function qv(i){return{x:-i.x,y:-i.y}}const Jv={type:kh,name:"Pan",options:{...Un,direction:{type:"buttonRadio",name:"direction",label:"Direction",options:Gv},distance:{type:"slider",name:"distance",label:"Distance",min:.1,max:1,step:.05,transform:{format:i=>`${(i*100).toFixed(0)}%`}},reverseExit:yl},transform:$n({values:i=>({direction:i.direction??Fh,distance:[i.distance??Mh],reverseExit:i.reverseExit??!1}),options:i=>({direction:i.direction,distance:i.distance[0],reverseExit:i.reverseExit})}),generate:(i,e)=>{const t=Gn({speed:i.speed,timing:i.timing,elementDuration:e.elementDuration}),r=i.distance??Mh,n=Ph(i.direction,e.elementDimensions,r),s=qv(n);return{fade:{keyframes:Xi({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,reverseExit:i.reverseExit,enterFrom:0,exitTo:0,restValue:1}),renderer:lo},translate:{keyframes:Xi({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,reverseExit:i.reverseExit,enterFrom:n,exitTo:s,restValue:{x:0,y:0}}),renderer:Dh}}}},Nh="pop",Oh=.5,jv={type:Nh,name:"Pop",options:{...Un},transform:$n(),generate:(i,e)=>{const t=Gn({speed:i.speed,timing:i.timing,elementDuration:e.elementDuration});return{fade:{keyframes:Xi({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,enterFrom:0,exitTo:0,restValue:1}),renderer:lo},scale:{keyframes:Xi({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:"backOut",enterFrom:Oh,exitTo:Oh,restValue:1}),renderer:Nv}}}},Uh="rise",Gh=50,Xv="up";function zv(i,e){switch(i){case"down":return{enterY:-e,exitY:e};case"up":default:return{enterY:e,exitY:-e}}}const Zv={type:Uh,name:"Rise",options:{...Un,direction:{type:"buttonRadio",name:"direction",label:"Direction",options:$v},distance:{type:"slider",name:"distance",label:"Distance",min:5,max:100,step:5,transform:{format:i=>`${i}px`}},reverseExit:yl},transform:$n({values:i=>({direction:i.direction??Xv,distance:[i.distance??Gh],reverseExit:i.reverseExit??!1}),options:i=>({direction:i.direction,distance:i.distance[0],reverseExit:i.reverseExit})}),generate:(i,e)=>{const t=Gn({speed:i.speed,timing:i.timing,elementDuration:e.elementDuration}),r=i.distance??Gh,{enterY:n,exitY:s}=zv(i.direction,r);return{fade:{keyframes:Xi({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,reverseExit:i.reverseExit,enterFrom:0,exitTo:0,restValue:1}),renderer:lo},translate:{keyframes:Xi({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,reverseExit:i.reverseExit,enterFrom:{x:0,y:n},exitTo:{x:0,y:s},restValue:{x:0,y:0}}),renderer:Dh}}}},$h="wipe",Cl="left";function Gr(i){switch(i){case"left":return{coordinates:{x:1,y:0},dimensions:{width:0,height:1}};case"right":return{coordinates:{x:0,y:0},dimensions:{width:0,height:1}};case"up":return{coordinates:{x:0,y:1},dimensions:{width:1,height:0}};case"down":return{coordinates:{x:0,y:0},dimensions:{width:1,height:0}};default:return Gr(Cl)}}function Hh(i){switch(i){case"left":return Gr("right");case"right":return Gr("left");case"up":return Gr("down");case"down":return Gr("up");default:return Hh(Cl)}}const ey={coordinates:{x:0,y:0},dimensions:{width:1,height:1}},ty={type:$h,name:"Wipe",options:{...Un,direction:{type:"buttonRadio",name:"direction",label:"Direction",options:Uv},reverseExit:yl},transform:$n({values:i=>({direction:i.direction??Cl,reverseExit:i.reverseExit??!1}),options:i=>({direction:i.direction,reverseExit:i.reverseExit})}),generate:(i,e)=>{const t=Gn({speed:i.speed,timing:i.timing,elementDuration:e.elementDuration}),r=Gr(i.direction),n=Hh(i.direction);return{clip:{keyframes:Xi({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,reverseExit:i.reverseExit,enterFrom:r,exitTo:n,restValue:ey}),renderer:Pv}}}},iy={[Lh]:Wv,[Uh]:Zv,[Nh]:jv,[kh]:Jv,[$h]:ty};function ry(i,e){const{type:t,...r}=i,n=iy[t];if(!n)throw new Error(`Unknown preset type: ${t}`);return n.generate(r,e)}function ny({animation:i,sceneTime:e}){const t=i.keyframes;if(!t||t.length===0)return null;const r=[...t].sort((s,o)=>s.time-o.time);if(e<r[0].time)return null;const n=r[r.length-1];if(e>=n.time)return i.renderer.processor.getTargetState(n.value);for(let s=0;s<r.length-1;s++){const o=r[s],a=r[s+1];if(e>=o.time&&e<=a.time){const c=a.time-o.time,l=c===0?0:(e-o.time)/c,u=o.easing||"linear",A=i.renderer.processor.getTargetState(o.value);return i.renderer.processor.interpolateState({easing:u,progress:l,from:A,value:a.value})}}return null}function sy(i,e,t){const{preset:r,...n}=i;if(!r)return n;const s=ry(r,{elementDuration:e,elementDimensions:t});return{...n,...s}}function oy({layout:i,sceneTime:e,animations:t,elementDuration:r=5,elementDimensions:n={width:100,height:100}}){var s,o,a,c,l,u,A,h,d,f,g;let p={clip:null,opacity:((s=i==null?void 0:i.transform)==null?void 0:s.opacity)??1,translation:{x:((a=(o=i==null?void 0:i.transform)==null?void 0:o.translate)==null?void 0:a.x)??0,y:((l=(c=i==null?void 0:i.transform)==null?void 0:c.translate)==null?void 0:l.y)??0},scale:((u=i==null?void 0:i.transform)==null?void 0:u.scale)??1,rotation:((A=i==null?void 0:i.transform)==null?void 0:A.rotation)??0,dimensions:{widthRatio:((d=(h=i==null?void 0:i.transform)==null?void 0:h.dimension)==null?void 0:d.widthRatio)??1,heightRatio:((g=(f=i==null?void 0:i.transform)==null?void 0:f.dimension)==null?void 0:g.heightRatio)??1}};if(!t)return p;const v=sy(t,r,n);for(const B of Object.values(v)){if(!B)continue;const C=ny({animation:B,sceneTime:e});C&&(p={...p,...C})}return p}let co;const ay=new Uint8Array(16);function ly(){if(!co&&(co=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!co))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return co(ay)}const wt=[];for(let i=0;i<256;++i)wt.push((i+256).toString(16).slice(1));function cy(i,e=0){return wt[i[e+0]]+wt[i[e+1]]+wt[i[e+2]]+wt[i[e+3]]+"-"+wt[i[e+4]]+wt[i[e+5]]+"-"+wt[i[e+6]]+wt[i[e+7]]+"-"+wt[i[e+8]]+wt[i[e+9]]+"-"+wt[i[e+10]]+wt[i[e+11]]+wt[i[e+12]]+wt[i[e+13]]+wt[i[e+14]]+wt[i[e+15]]}const Yh={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ay(i,e,t){if(Yh.randomUUID&&!i)return Yh.randomUUID();i=i||{};const r=i.random||(i.rng||ly)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,cy(r)}function uy(i=.4,e=.4){const t=Math.max(.1,Math.min(.8,i)),r=Math.max(.2,Math.min(.6,e)),s=(1-t)/2,a=1-r;return[{x:0,y:s},{x:a,y:s},{x:a,y:0},{x:1,y:.5},{x:a,y:1},{x:a,y:1-s},{x:0,y:1-s}]}const Ao=64;function hy(){const i=[],e={x:.5,y:.5},t=.5;for(let r=0;r<Ao;r++){const n=r/Ao*2*Math.PI,s=e.x+t*Math.cos(n),o=e.y+t*Math.sin(n);i.push({x:s,y:o})}return i}function dy(i=1){const e=[],t={x:.5,y:.5};let r,n;i>=1?(r=.5,n=.5/i):(r=.5*i,n=.5);for(let s=0;s<Ao;s++){const o=s/Ao*2*Math.PI,a=t.x+r*Math.cos(o),c=t.y+n*Math.sin(o);e.push({x:a,y:c})}return e}function fy(){const i=[];for(let t=0;t<=100;t++){const r=t/100*2*Math.PI,n=16*Math.sin(r)**3,s=-(13*Math.cos(r)-5*Math.cos(2*r)-2*Math.cos(3*r)-Math.cos(4*r)),o=(n+16)/32,a=(s+13)/26;i.push({x:o,y:a})}return i}function Vh(i=0,e=1){if(i===0)return[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1}];const t=i*Math.PI/180,r=Math.tan(t)/e;return[{x:Math.max(0,Math.min(1,0+r)),y:0},{x:Math.max(0,Math.min(1,1+r)),y:0},{x:Math.max(0,Math.min(1,1-r)),y:1},{x:Math.max(0,Math.min(1,0-r)),y:1}]}function uo(i){if(i<3)throw new Error("A polygon must have at least 3 sides");const e=[],t=[];for(let l=0;l<i;l++){const u=l*2*Math.PI/i-Math.PI/2,A=Math.cos(u),h=Math.sin(u);t.push({x:A,y:h})}const r=Math.min(...t.map(l=>l.x)),n=Math.max(...t.map(l=>l.x)),s=Math.min(...t.map(l=>l.y)),o=Math.max(...t.map(l=>l.y)),a=n-r,c=o-s;for(const l of t){const u=(l.x-r)/a,A=(l.y-s)/c;e.push({x:u,y:A})}return e}function Kh(i=90){const e=i*Math.PI/180,r=.5/Math.tan(e),s=1/(1+Math.abs(r)*2),o=r*s;return[{x:.5+o,y:0},{x:1,y:.5},{x:.5-o,y:1},{x:0,y:.5}]}function gy(i=5,e=.4){const t=[];for(let n=0;n<i*2;n++){const s=n*Math.PI/i-Math.PI/2,o=n%2===0?.5:e,a=.5+o*Math.cos(s),c=.5+o*Math.sin(s);t.push({x:a,y:c})}return t}function py(i="isosceles",e={}){switch(i){case"equilateral":return my();case"isosceles":return Wh(e.baseAngle??60);case"right":return Ey(e.rightAnglePosition??"bottom-left");case"scalene":return Iy(e.angles??[60,60,60])}}function my(){return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}]}function Wh(i){const e=i*Math.PI/180,t=.5/Math.tan(e),r=Math.max(.1,Math.min(2,t));return[{x:.5,y:1-Math.min(1,r)},{x:0,y:1},{x:1,y:1}]}function Ey(i){switch(i){case"top":return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}];case"bottom-left":return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}];case"bottom-right":return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}]}}function Iy(i){return Wh(i[0])}function vy(i={},e=1){const{type:t="rectangle",customPolygon:r,parallelogram:n,triangle:s,rhombus:o,arrow:a,star:c,regularPolygon:l}=i;switch(t){case"rectangle":return Vh(0,e);case"parallelogram":return Vh((n==null?void 0:n.angle)??30,e);case"triangle":return py((s==null?void 0:s.type)??"isosceles",{baseAngle:s==null?void 0:s.baseAngle,angles:s==null?void 0:s.angles,rightAnglePosition:s==null?void 0:s.rightAnglePosition});case"rhombus":return Kh((o==null?void 0:o.angle)??90);case"diamond":return Kh(90);case"pentagon":return uo(5);case"hexagon":return uo(6);case"octagon":return uo(8);case"star":return gy((c==null?void 0:c.points)??5,(c==null?void 0:c.innerRadius)??.4);case"arrow":return uy((a==null?void 0:a.shaftRatio)??.4,(a==null?void 0:a.headRatio)??.4);case"heart":return fy();case"circle":return hy();case"ellipse":return dy(e);case"custom-polygon":if(!(r!=null&&r.points)||r.points.length<3)throw new Error("Custom polygon must have at least 3 points");return r.points;default:return uo((l==null?void 0:l.sides)??6)}}function yy(i,e){let t=!1;const r=i.x,n=i.y;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s].x,c=e[s].y,l=e[o].x,u=e[o].y;c>n!=u>n&&r<(l-a)*(n-c)/(u-c)+a&&(t=!t)}return t}function Cy(i,e){let t=1,r=0;const n=200;for(let s=0;s<=n;s++){const o=s/n;yy({x:o,y:i},e)&&(t=Math.min(t,o),r=Math.max(r,o))}return r>=t?{left:t,right:r}:null}function By(i){const e=Math.min(...i.map(c=>c.y)),t=Math.max(...i.map(c=>c.y));let r={x:0,y:0,width:0,height:0},n=0;const s=200,o=(t-e)/s,a=[];for(let c=0;c<=s;c++){const l=e+c*o;a.push({y:l,span:Cy(l,i)})}for(let c=0;c<a.length-1;c++){const l=a[c].y;for(let u=c+1;u<a.length;u++){const h=a[u].y-l;let d=0,f=1,g=!0;const p=Math.min(5,u-c+1);for(let v=0;v<p;v++){const B=c+Math.floor(v/(p-1)*(u-c)),C=a[B].span;if(C){if(d=Math.max(d,C.left),f=Math.min(f,C.right),d>=f){g=!1;break}}else{g=!1;break}}if(g&&f>d){const v=f-d,B=v*h;B>n&&(n=B,r={x:d,y:l,width:v,height:h})}}}return r}function Ty(i,e=1){const t=vy(i,e);if(t.length<3)return{top:0,right:0,bottom:0,left:0};if(i.type==="rectangle")return{top:0,right:0,bottom:0,left:0};const r=By(t),n=r.y,s=r.x,o=1-(r.x+r.width),a=1-(r.y+r.height);return{top:Math.max(0,n),right:Math.max(0,o),bottom:Math.max(0,a),left:Math.max(0,s)}}function by(i){return typeof i=="number"?{topLeft:i,topRight:i,bottomRight:i,bottomLeft:i}:{topLeft:(i==null?void 0:i.topLeft)??0,topRight:(i==null?void 0:i.topRight)??0,bottomRight:(i==null?void 0:i.bottomRight)??0,bottomLeft:(i==null?void 0:i.bottomLeft)??0}}function Sy(i,e){return typeof i=="number"?{top:i*e,right:i*e,bottom:i*e,left:i*e}:typeof i=="string"?{top:i,right:i,bottom:i,left:i}:{top:typeof i.top=="number"?i.top*e:i.top,right:typeof i.right=="number"?i.right*e:i.right,bottom:typeof i.bottom=="number"?i.bottom*e:i.bottom,left:typeof i.left=="number"?i.left*e:i.left}}function xy(i,e){return typeof i=="number"?{top:i*e,right:i*e,bottom:i*e,left:i*e}:typeof i=="string"?{top:i,right:i,bottom:i,left:i}:{top:(typeof i.top=="number"?i.top*e:i.top)??0,right:(typeof i.right=="number"?i.right*e:i.right)??0,bottom:(typeof i.bottom=="number"?i.bottom*e:i.bottom)??0,left:(typeof i.left=="number"?i.left*e:i.left)??0}}function Qy(i,e){return typeof i=="number"?{top:i*e,right:i*e,bottom:i*e,left:i*e}:typeof i=="string"?{top:i,right:i,bottom:i,left:i}:{top:(typeof i.top=="number"?i.top*e:i.top)??0,right:(typeof i.right=="number"?i.right*e:i.right)??0,bottom:(typeof i.bottom=="number"?i.bottom*e:i.bottom)??0,left:(typeof i.left=="number"?i.left*e:i.left)??0}}const wy=Er(()=>xu.loadYoga());function qh(i,e,{layout:t,scale:r=1}){const{position:n="relative",inset:s,width:o,height:a,minWidth:c,minHeight:l,maxWidth:u,maxHeight:A,flex:h,flexGrow:d,flexShrink:f,gap:g,margin:p,padding:v,direction:B="column",align:C="start",alignSelf:y,justify:x="start"}=t??{},_={static:i.POSITION_TYPE_STATIC,relative:i.POSITION_TYPE_RELATIVE,absolute:i.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(_[n]),typeof s<"u"){const{top:M,right:j,bottom:X,left:le}=Sy(s,r);typeof M<"u"&&e.setPosition(i.EDGE_TOP,M),typeof j<"u"&&e.setPosition(i.EDGE_RIGHT,j),typeof X<"u"&&e.setPosition(i.EDGE_BOTTOM,X),typeof le<"u"&&e.setPosition(i.EDGE_LEFT,le)}const D={row:i.FLEX_DIRECTION_ROW,column:i.FLEX_DIRECTION_COLUMN,"row-reverse":i.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":i.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(D[B]);const F={start:i.ALIGN_FLEX_START,end:i.ALIGN_FLEX_END,center:i.ALIGN_CENTER,stretch:i.ALIGN_STRETCH};e.setAlignItems(F[C]),y&&e.setAlignSelf(F[y]);const O={start:i.JUSTIFY_FLEX_START,end:i.JUSTIFY_FLEX_END,center:i.JUSTIFY_CENTER,"space-between":i.JUSTIFY_SPACE_BETWEEN,"space-around":i.JUSTIFY_SPACE_AROUND,"space-evenly":i.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(O[x]),typeof p<"u"){const{top:M,right:j,bottom:X,left:le}=xy(p,r);e.setMargin(i.EDGE_TOP,M),e.setMargin(i.EDGE_RIGHT,j),e.setMargin(i.EDGE_BOTTOM,X),e.setMargin(i.EDGE_LEFT,le)}if(typeof v<"u"){const{top:M,right:j,bottom:X,left:le}=Qy(v,r);e.setPadding(i.EDGE_TOP,M),e.setPadding(i.EDGE_RIGHT,j),e.setPadding(i.EDGE_BOTTOM,X),e.setPadding(i.EDGE_LEFT,le)}typeof d<"u"||typeof f<"u"?(typeof d<"u"&&e.setFlexGrow(d),typeof f<"u"&&e.setFlexShrink(f)):typeof h<"u"&&e.setFlex(h),e.setGap(i.GUTTER_ALL,(g??0)*r),typeof o<"u"&&e.setWidth(typeof o=="number"?o*r:o),typeof a<"u"&&e.setHeight(typeof a=="number"?a*r:a),typeof c<"u"&&e.setMinWidth(typeof c=="number"?c*r:c),typeof l<"u"&&e.setMinHeight(typeof l=="number"?l*r:l),typeof u<"u"&&e.setMaxWidth(typeof u=="number"?u*r:u),typeof A<"u"&&e.setMaxHeight(typeof A=="number"?A*r:A)}async function Jh({id:i,yoga:e,index:t,parent:r,element:n,resolvers:s}){var o,a,c;const{layout:l={},config:u={},options:A={},renderer:h}=n,d=e.Node.create();qh(e,d,{layout:l}),r.insertChild(d,t);let f=null;s&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="caption"||(h==null?void 0:h.type)==="image"||(h==null?void 0:h.type)==="video")&&((h==null?void 0:h.type)==="caption"?f=await((o=s.text)==null?void 0:o.call(s,{id:i,config:u,options:A}))??null:f=await((a=s[h.type])==null?void 0:a.call(s,{id:i,config:u,options:A}))??null);const g=[];for await(const[p,v]of((c=n.children)==null?void 0:c.entries())??[])g.push(await Jh({id:i,yoga:e,index:p,parent:d,element:v,resolvers:s}));return{node:d,radius:by(l.radius),element:n,renderer:h,config:u,options:A,dependencies:f,childNodes:g}}function jh(i,e,t=0,r=0){const{top:n,left:s}=i.getComputedLayout(),{top:o,left:a,width:c,height:l}=e.node.getComputedLayout(),u=t+a,A=r+o,h=e.childNodes.map(d=>jh(i,d,u,A));return{...e,x:s+u,y:n+A,width:c,height:l,childNodes:h}}async function Bl({yoga:i,root:e,tree:t,measureCanvas:r}){for await(const{node:n,options:s,dependencies:o,renderer:a,childNodes:c}of t){if(a){const{width:l,height:u}=a;if(l&&r){e.calculateLayout();const A=await l({node:n,options:s,dependencies:o,measureCanvas:r});A&&n.setWidth(A)}if(u&&r){e.calculateLayout();const A=await u({node:n,options:s,dependencies:o,measureCanvas:r});A&&n.setHeight(A)}if(await Bl({yoga:i,root:e,tree:c,measureCanvas:r}),s!=null&&s.shape){const A=n.getComputedWidth(),h=n.getComputedHeight(),d=Ty(s.shape,A/h);n.setPadding(i.EDGE_TOP,d.top*h),n.setPadding(i.EDGE_RIGHT,d.right*A),n.setPadding(i.EDGE_BOTTOM,d.bottom*h),n.setPadding(i.EDGE_LEFT,d.left*A)}}e.calculateLayout(),await Bl({yoga:i,root:e,tree:c,measureCanvas:r})}}async function Xh({id:i,root:e,resolvers:t,measureCanvas:r}){const n=await wy(),s=n.Node.create();qh(n,s,{layout:e.layout});const o=await Jh({id:i,yoga:n,index:0,parent:s,element:e.element,resolvers:t});await Bl({yoga:n,root:s,tree:[o],measureCanvas:r});const{top:a,left:c,width:l,height:u}=s.getComputedLayout(),A={root:{x:c,y:a,width:l,height:u},node:jh(s,o)};return s.freeRecursive(),A}const _y={type:"audio"},Hn=/(?<value>\d+\.?\d*)(?=px)/;function Tl({words:i,spaceMetrics:e,strokeWidth:t=0}){return i.reduce((r,n,s)=>{const o=n.metrics.width+t,a=s<i.length-1?e.width:0;return r+o+a},0)}Ms(({context:i,font:e,fontSizes:t,words:r,maxW:n=1/0,strokeWidth:s=0,letterSpacing:o=0})=>{try{i.save(),i.letterSpacing=`${o}px`,i.font=e.replace(Hn,t[0].toString());const a=i.measureText("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");if(r.length<=0)return[];const c=i.measureText(r[0].text);return r.slice(1).reduce((l,u)=>{const A=l[l.length-1],h=i.measureText(u.text),d={...u,metrics:h},f=[...A.words,d],g=Tl({strokeWidth:s,words:f,spaceMetrics:A.spaceMetrics});if(g>n){const p=t[l.length%t.length];i.font=e.replace(Hn,p.toString());const v=i.measureText(" "),B=i.measureText(u.text),C=[{...u,metrics:B}],y=i.measureText("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");l=[...l,{allMetrics:y,spaceMetrics:v,lineWidth:Tl({strokeWidth:s,spaceMetrics:v,words:C}),font:i.font,words:C,lineHeight:y.actualBoundingBoxAscent+y.actualBoundingBoxDescent+s}]}else l[l.length-1]={...A,lineWidth:g,words:f};return l},[{allMetrics:a,lineWidth:Tl({strokeWidth:s,words:[{...r[0],metrics:c}],spaceMetrics:i.measureText(" ")}),lineHeight:a.actualBoundingBoxAscent+a.actualBoundingBoxDescent+s,font:i.font,words:[{...r[0],metrics:c}],spaceMetrics:i.measureText(" ")}])}finally{i.restore()}},{cacheKey:([{font:i,fontSizes:e,words:t,maxW:r,strokeWidth:n,letterSpacing:s}])=>`${i}_${JSON.stringify(e)}_${JSON.stringify(t)}_${r}_${n}_${s}`});function Ry(i){return i.slice(0,1).toUpperCase()+i.slice(1)}const zh=[{family:"Noto Arabic",regex:new RegExp("\\p{Script=Arabic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansArabic-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Chinese",regex:new RegExp("\\p{Script=Han}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansSC-VariableFont_wght.woff2",style:"normal"},{family:"Noto Hebrew",regex:new RegExp("\\p{Script=Hebrew}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansHebrew-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Hindi",regex:new RegExp("\\p{Script=Devanagari}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansDevanagari-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Japanese",regex:new RegExp("\\p{Script=Han}|\\p{Script=Katakana}|\\p{Script=Hiragana}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansJP-VariableFont_wght.woff2",style:"normal"},{family:"Noto Korean",regex:new RegExp("\\p{Script=Hangul}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansKR-VariableFont_wght.woff2",style:"normal"},{family:"Noto Color Emoji",regex:new RegExp("\\p{Extended_Pictographic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoColorEmoji-Regular.woff2",style:"normal"}];function Dy({text:i,font:e}){let t=e;return zh.forEach(({family:r,regex:n})=>{n.exec(i)&&(t+=`, ${r}`)}),t}const Ly="caption";Object.keys(Rh).map(i=>({label:Ry(i),value:i,data:i}));const ky={type:Ly},My={type:"image"};function Zh({context:i,word:e,maxW:t=1/0}){const r=[],n=i.measureText(e);if(Math.floor(n.width)<=t)return[{text:e,metrics:n}];for(let s=0;s<e.length;s++){const o=r[r.length-1],a=((o==null?void 0:o.text)??"")+e[s],c=i.measureText(a);c.width<t?r[o?r.length-1:0]={text:a,metrics:c}:r.push({text:e[s],metrics:i.measureText(e[s])})}return r}const Fy=Ms(({font:i,context:e,fontSizes:t,text:r,maxW:n=1/0,letterSpacing:s=0})=>{try{return e.save(),e.letterSpacing=`${s}px`,e.font=i.replace(Hn,t[0].toString()),r.split(`
|
|
2476
|
-
`).flatMap(a=>{const c=a.split(" ").filter(Boolean);return c.length?c.slice(1).reduce((l,u,A)=>{const d=`${l[l.length-1].text} ${u}`.trim(),f=e.measureText(d);if(f.width>n)l=[...l,...Zh({context:e,word:u,maxW:n})];else{const g=t[A%t.length];e.font=i.replace(Hn,g.toString()),l[l.length-1]={text:d,metrics:f}}return l},Zh({context:e,word:c[0],maxW:n})):{text:"",metrics:e.measureText("")}})}finally{e.restore()}},{cacheKey:([{font:i,fontSizes:e,text:t,maxW:r,letterSpacing:n}])=>`${i}_${JSON.stringify(e)}_${t}_${r}_${n}`});Ms(({font:i,text:e,scale:t,context:r,maxW:n,maxH:s,minSize:o,maxSize:a,letterSpacing:c=0})=>{var l,u;let A=0;if(a){A=(o??0)*t;let d=0;for(;a*t>A+1;){A+=1;const f=Fy({font:i,context:r,fontSizes:[A],text:e,maxW:n,letterSpacing:c});if(d=f.reduce((g,p)=>(p.metrics.width>g&&(g=p.metrics.width),g),0),d>n||f.length*A>s){A-=1;break}}}else A=parseFloat(((u=(l=i.match(Hn))==null?void 0:l.groups)==null?void 0:u.value)??"0")*t;return A},{cacheKey:([{font:i,text:e,scale:t,maxW:r,maxH:n,minSize:s,maxSize:o,letterSpacing:a}])=>`${i}_${e}_${s}_${o}_${t}_${r}_${n}_${a}`});const Py={type:"text"},Ny={type:"video"};function ed(){return document.createElement("canvas")}function Oy(i,e){return Object.keys(i).reduce((t,r)=>(e.includes(r)||(t[r]=i[r]),t),{})}function qt(i){let e=0;for(const t of i)Array.isArray(t)?e+=qt(t):e+=t;return e}function ho(i){return i.map(({type:e,duration:t},r)=>{var n,s,o,a;if(e==="transition"){const c=((n=i[r-2])==null?void 0:n.type)==="transition"?i[r-2]:null,l=((s=i[r-1])==null?void 0:s.duration)??1/0,u=((o=i[r+1])==null?void 0:o.duration)??1/0,A=((a=i[r+2])==null?void 0:a.type)==="transition"?i[r+2]:null;return Math.min(c?l/2:l,t,A?u/2:u)*-1}return t})}function td(i){var e;return{...i,children:((e=i.children)==null?void 0:e.map(t=>{if(!t.renderer)return td(t)}).filter(Boolean))??[]}}function id(i){const e={box:0,shape:0,image:0,video:0,text:0,audio:0,gradient:0,caption:0};i.renderer&&(e[i.renderer.type]+=1);for(const t of i.children??[]){const{box:r,shape:n,image:s,video:o,text:a,audio:c,gradient:l,caption:u}=id(t);e.box+=r,e.shape+=n,e.image+=s,e.video+=o,e.text+=a,e.audio+=c,e.gradient+=l,e.caption+=u}return e}function Uy(i){return i.video>0?Ny.type:i.image>0?My.type:i.audio>0?_y.type:i.caption>0?ky.type:Py.type}function rd({node:i,duration:e,parentAnimations:t}){const r=[],n={...t,...i.element.animations};if(i.renderer){const s=td({...i.element,layout:{...i.element.layout?Oy(i.element.layout,["maxWidth","maxHeight"]):{},width:"100%",height:"100%",margin:0}}),o=id(s);r.push({type:Uy(o),id:Ay(),x:i.x,y:i.y,width:i.width,height:i.height,duration:e,root:{element:s}})}for(const s of i.childNodes)r.push(...rd({node:s,duration:e,parentAnimations:n}));return r}function Gy(i){if(i===null||typeof i!="object")return!1;if(Object.getPrototypeOf(i)===null)return!0;let e=i;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(i)===e}function $y(i){return i.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}oE.filters.define("parse",i=>typeof i>"u"?null:typeof i=="string"?`"${$y(i)}"`:Gy(i)||Array.isArray(i)?JSON.stringify(i):i);const Hy="3";async function Yy({scene:i,start:e=0}){const{id:t,root:r,duration:n}=i,s=await Xh({id:t,root:r});return{type:i.type,start:e,duration:n,layout:s,id:i.id,config:i}}async function Vy({track:i}){const e=ho(i),t=await Promise.all(i.reduce((s,o,a)=>{if(o.type!=="audio")return s;const c=qt(e.slice(0,a));return s.push(Yy({scene:o,start:c})),s},[])),r=i.reduce((s,o,a)=>{if(o.type!=="gap")return s;const c=qt(e.slice(0,a));return s.push({type:o.type,id:o.id,start:c,config:o,duration:o.duration}),s},[]),n=i.map(({id:s})=>t.find(({id:o})=>o===s)??r.find(({id:o})=>o===s)).filter(Boolean);return{type:"audio",scenes:t,gapScenes:r,mergedScenes:n,config:i,duration:Math.max(...n.map(({start:s,duration:o})=>s+o))}}async function nd({node:i,canvases:e,sceneTime:t,sceneDuration:r,parentOpacity:n=1,parentTransform:s,debug:o=!1}){var a,c;const l=e.sceneCanvas.getContext("2d");if(l){l.save(),l.setTransform(s);const u=oy({layout:i.element.layout,sceneTime:t,animations:i.element.animations,elementDuration:r,elementDimensions:{width:i.width,height:i.height}}),{opacity:A,translation:h,scale:d,clip:f,dimensions:g,rotation:p}=u,v=i.width*g.widthRatio,B=i.height*g.heightRatio;if(l.globalAlpha=A*n,(h.x||h.y)&&l.translate(h.x,h.y),(d!==1||p!==0)&&(l.translate(i.x+v/2,i.y+B/2),l.scale(d,d),l.rotate(p*Math.PI/180),l.translate(-(i.x+v/2),-(i.y+B/2))),f){l.beginPath();const C={x:i.x+f.x*v,y:i.y+f.y*B,width:f.width*v,height:f.height*B};l.rect(C.x,C.y,C.width,C.height),l.clip()}if(o){const C=l.globalAlpha;l.globalAlpha=1,l.strokeStyle="red",l.strokeRect(i.x,i.y,v,B),l.globalAlpha=C}await((c=(a=i.renderer)==null?void 0:a.render)==null?void 0:c.call(a,{canvases:e,sceneTime:t,dx:i.x,dy:i.y,dw:v,dh:B,radius:i.radius,options:i.options,dependencies:i.dependencies}));for await(const C of i.childNodes)await nd({debug:o,node:C,canvases:e,sceneTime:t,sceneDuration:r,parentOpacity:l.globalAlpha,parentTransform:l.getTransform()});l.restore()}}async function Ky({layout:i,canvases:e,sceneTime:t,sceneDuration:r,debug:n=!1}){const{node:s}=i;await nd({debug:n,node:s,canvases:e,sceneDuration:r,sceneTime:t})}async function fo({debug:i=!1,scene:e,start:t=0,resolvers:r,rootWidth:n,rootHeight:s,canvasFactory:o=ed}){var a,c;const{id:l,x:u,y:A,width:h,height:d,root:f,duration:g}=e,p=o(),v=o(),B=o(),C=o(),y=o(),x=await Xh({id:l,root:{...f,layout:{...f.layout,width:n,height:s},element:{...f.element,layout:{...f.element.layout,...typeof u=="number"&&typeof A=="number"?{position:"absolute",inset:{top:A,left:u}}:{},width:h??((a=f.element.layout)==null?void 0:a.width),height:d??((c=f.element.layout)==null?void 0:c.height)}}},resolvers:r,measureCanvas:y}),_=async D=>{const F=Math.max(0,D-t);p.width=p.height=0,p.width=n,p.height=s,await Ky({debug:i,layout:x,sceneTime:F,sceneDuration:g,canvases:{sceneCanvas:p,cropCanvas:v,letterboxCanvas:B,posterCanvas:C}})};return{id:l,type:e.type,start:t,duration:g,layout:x,sceneCanvas:p,draw:_,config:e,childScenes:x.node.childNodes.flatMap(D=>rd({node:D,duration:g}))}}async function Wy({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=ho(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=qt(o.slice(0,d));return h.type==="caption"&&A.push(fo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=qt(o.slice(0,d));return A.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),A},[]),l=e.reduce((A,h,d)=>{if(h.type!=="transition")return A;const f=h.duration,g=qt(o.slice(0,d))-f;return A.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var v;return p===((v=e[d+1])==null?void 0:v.id)}),from:a.find(({id:p})=>{var v;return p===((v=e[d-1])==null?void 0:v.id)})}),A},[]),u=e.map(({id:A})=>a.find(({id:h})=>h===A)??c.find(({id:h})=>h===A)??l.find(({id:h})=>h===A)).filter(Boolean);return{type:"caption",scenes:a,gapScenes:c,transitions:l,mergedScenes:u,duration:Math.max(...u.map(({start:A,duration:h})=>A+h)),trackCanvas:s()}}async function qy({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=ho(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=qt(o.slice(0,d));return h.type==="video"&&A.push(fo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),h.type==="image"&&A.push(fo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=qt(o.slice(0,d));return A.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),A},[]),l=e.reduce((A,h,d)=>{if(h.type!=="transition")return A;const f=h.duration,g=qt(o.slice(0,d))-f;return A.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var v;return p===((v=e[d+1])==null?void 0:v.id)}),from:a.find(({id:p})=>{var v;return p===((v=e[d-1])==null?void 0:v.id)})}),A},[]),u=e.map(({id:A})=>a.find(({id:h})=>h===A)??c.find(({id:h})=>h===A)??l.find(({id:h})=>h===A)).filter(Boolean);return{type:"picture",scenes:a,gapScenes:c,transitions:l,mergedScenes:u,duration:Math.max(0,...u.map(({start:A,duration:h})=>A+h)),trackCanvas:s()}}async function Jy({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=ho(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=qt(o.slice(0,d));return h.type==="text"&&A.push(fo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=qt(o.slice(0,d));return A.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),A},[]),l=e.reduce((A,h,d)=>{if(h.type!=="transition")return A;const f=h.duration,g=qt(o.slice(0,d))-f;return A.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var v;return p===((v=e[d+1])==null?void 0:v.id)}),from:a.find(({id:p})=>{var v;return p===((v=e[d-1])==null?void 0:v.id)})}),A},[]),u=e.map(({id:A})=>a.find(({id:h})=>h===A)??c.find(({id:h})=>h===A)??l.find(({id:h})=>h===A)).filter(Boolean);return{type:"text",scenes:a,gapScenes:c,transitions:l,mergedScenes:u,duration:Math.max(...u.map(({start:A,duration:h})=>A+h)),trackCanvas:s()}}function jy(i){return i.some(({type:e})=>e==="text")}function Xy(i){return i.some(({type:e})=>e==="caption")}function zy(i){return i.some(({type:e})=>e==="audio")}function Zy(i){return i.some(({type:e})=>e==="video"||e==="image")}function eC(i){return i.type==="audio"}const tC=(((_h=wh)==null?void 0:_h.default)??wh).reduce((i,e)=>(i[e.name]=e,i),{});function iC(i,e){return i.has(e)||i.set(e,{buffer:null,transitions:{},fromTexture:null,toTexture:null}),i.get(e)}function rC({name:i,to:e,from:t,progress:r,width:n,height:s,glContext:o,contextResources:a,returnPixels:c=!0}){var l,u,A;const h=iC(a,o);if(o.disable(o.DEPTH_TEST),h.buffer?o.bindBuffer(o.ARRAY_BUFFER,h.buffer):(h.buffer=o.createBuffer(),o.bindBuffer(o.ARRAY_BUFFER,h.buffer),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,-1,4,4,-1]),o.STATIC_DRAW)),o.viewport(0,0,n,s),h.fromTexture?h.fromTexture.setPixels(t):(h.fromTexture=(((l=ro)==null?void 0:l.default)??ro)(o,t),h.fromTexture.minFilter=o.LINEAR,h.fromTexture.magFilter=o.LINEAR),h.toTexture?h.toTexture.setPixels(e):(h.toTexture=(((u=ro)==null?void 0:u.default)??ro)(o,e),h.toTexture.minFilter=o.LINEAR,h.toTexture.magFilter=o.LINEAR),h.transitions[i]||(h.transitions[i]=(((A=Qh)==null?void 0:A.default)??Qh)(o,tC[i])),h.transitions[i].draw(r,h.fromTexture,h.toTexture,n,s),!c)return o.flush(),new Uint8Array(0);const f=new Uint8Array(n*s*4);return o.readPixels(0,0,n,s,o.RGBA,o.UNSIGNED_BYTE,f),o.flush(),f}function nC(i){for(const[e,t]of i.entries())t.buffer&&e.deleteBuffer(t.buffer),t.fromTexture&&t.fromTexture.dispose(),t.toTexture&&t.toTexture.dispose(),Object.values(t.transitions).forEach(r=>{r.dispose()}),i.delete(e)}function sC({name:i,to:e,from:t,progress:r,canvas:n,contextResources:s}){const o=n.getContext("webgl",{alpha:!0,depth:!1,antialias:!1,preserveDrawingBuffer:!1});o&&(o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!0),rC({name:i,to:e,from:t,progress:r,width:n.width,height:n.height,glContext:o,contextResources:s,returnPixels:!1}))}async function sd({debug:i=!1,config:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s=ed,drawTransition:o=sC}){const a=new Map,c=await Promise.all(e.tracks.map(async A=>{if(Zy(A))return{...await qy({debug:i,track:A,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:A};if(jy(A))return{...await Jy({debug:i,track:A,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:A};if(Xy(A))return{...await Wy({debug:i,track:A,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:A};if(zy(A))return{...await Vy({track:A}),config:A};throw new Error("Unknown track type")}));return{draw:async({canvas:A,currentTime:h})=>{const d=A.getContext("2d");if(d){d.globalAlpha=1,d.globalCompositeOperation="source-over",d.clearRect(0,0,A.width,A.height),d.save(),d.fillStyle="black",d.fillRect(0,0,A.width,A.height),d.restore();for await(const f of c){if(eC(f))continue;const{scenes:g,transitions:p,trackCanvas:v}=f;v.width=v.height=0,v.width=A.width,v.height=A.height;const B=v.getContext("2d"),C=g.filter(({start:x,duration:_})=>h>=x&&h<x+_);if(!B||C.length<=0)continue;const y=p.find(({start:x,duration:_})=>h>=x&&h<x+_);for await(const{sceneCanvas:x,draw:_}of C)await(_==null?void 0:_(h)),(!y||y&&(!y.to||!y.from))&&B.drawImage(x,0,0,x.width,x.height);if(y&&y.to&&y.from&&y.duration>0){const{name:x,to:_,from:D,duration:F,transitionCanvas:O}=y;O.width=O.height=0,O.width=v.width,O.height=v.height;const M=Math.min(1,Math.max(0,(h-_.start)/F));await o({name:x,progress:M,contextResources:a,to:_.sceneCanvas,from:D.sceneCanvas,canvas:O}),B.globalCompositeOperation="lighter",B.drawImage(O,0,0,O.width,O.height)}d.drawImage(v,0,0,v.width,v.height)}}},cleanup:()=>{nC(a)},tracks:c,aspectRatio:e.aspectRatio,transcriptions:e.transcriptions,duration:Math.max(...c.map(({duration:A})=>A))}}const oC={version:"7.0.2"};function aC(i){const{publicApiUrl:e}=ks(i),t=Ki();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function lC(i){var s,o,a,c,l,u,A,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Ki()};let e=(o=(s=window.localStorage)==null?void 0:s.getItem)==null?void 0:o.call(s,"vouch-uid-visitor"),t=(c=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:c.call(a,"vouch-uid-client"),r=(u=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:u.call(l,"vouch-uid-tab");const n=Ki();return e||(e=aC(i),(h=(A=window.localStorage)==null?void 0:A.setItem)==null||h.call(A,"vouch-uid-visitor",e)),t||(t=Ki(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),r||(r=Ki(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",r)),{client:t,tab:r,request:n,visitor:e}}function cC(i,e){return i&&"vouchId"in i?i.vouchId:(e==null?void 0:e.id)??null}function AC(i="embedded_player"){var n,s;const[e,t]=((s=(n=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:n.split)==null?void 0:s.call(n,"/"))??[],r={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const c=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());r[c]=a}}),{source:i,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:oC.version,templateVersion:Hy,...r}}const od=1;class uC{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,r)=>{const n=cC(r,this.host.vouch);!n||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...r,senderId:this.host.senderId,vouchId:n,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=ks(this.host.env),{client:r,tab:n,request:s,visitor:o}=lC(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":r,"x-uid-tab":n,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":AC(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:r}=this._currentlyPlayingVideo;this._streamLatestTime[r]>this._streamStartTime[r]+od&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[r],streamEnd:this._streamLatestTime[r]}),delete this._streamStartTime[r],delete this._streamLatestTime[r]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:r}})=>{this._answersViewed[r]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[r]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:r,node:n}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:r,node:n},this._streamLatestTime[r]=n.currentTime,this._streamStartTime[r]||(this._streamStartTime[r]=n.currentTime,this._streamLatestTime[r]=n.currentTime))},this._handleVideoPause=({detail:{id:t,key:r}})=>{this._streamLatestTime[r]>this._streamStartTime[r]+od&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[r],streamEnd:this._streamLatestTime[r]}),delete this._streamStartTime[r],delete this._streamLatestTime[r]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,r,n;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(r=this.host.mediaPlayer)==null||r.addEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,r,n;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var bl={exports:{}};(function(i,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof qi<"u"&&qi,r=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof qi<"u"&&qi||{},c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(L){return L&&DataView.prototype.isPrototypeOf(L)}if(c.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],A=ArrayBuffer.isView||function(L){return L&&u.indexOf(Object.prototype.toString.call(L))>-1};function h(L){if(typeof L!="string"&&(L=String(L)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(L)||L==="")throw new TypeError('Invalid character in header field name: "'+L+'"');return L.toLowerCase()}function d(L){return typeof L!="string"&&(L=String(L)),L}function f(L){var U={next:function(){var q=L.shift();return{done:q===void 0,value:q}}};return c.iterable&&(U[Symbol.iterator]=function(){return U}),U}function g(L){this.map={},L instanceof g?L.forEach(function(U,q){this.append(q,U)},this):Array.isArray(L)?L.forEach(function(U){if(U.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+U.length);this.append(U[0],U[1])},this):L&&Object.getOwnPropertyNames(L).forEach(function(U){this.append(U,L[U])},this)}g.prototype.append=function(L,U){L=h(L),U=d(U);var q=this.map[L];this.map[L]=q?q+", "+U:U},g.prototype.delete=function(L){delete this.map[h(L)]},g.prototype.get=function(L){return L=h(L),this.has(L)?this.map[L]:null},g.prototype.has=function(L){return this.map.hasOwnProperty(h(L))},g.prototype.set=function(L,U){this.map[h(L)]=d(U)},g.prototype.forEach=function(L,U){for(var q in this.map)this.map.hasOwnProperty(q)&&L.call(U,this.map[q],q,this)},g.prototype.keys=function(){var L=[];return this.forEach(function(U,q){L.push(q)}),f(L)},g.prototype.values=function(){var L=[];return this.forEach(function(U){L.push(U)}),f(L)},g.prototype.entries=function(){var L=[];return this.forEach(function(U,q){L.push([q,U])}),f(L)},c.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(L){if(!L._noBody){if(L.bodyUsed)return Promise.reject(new TypeError("Already read"));L.bodyUsed=!0}}function v(L){return new Promise(function(U,q){L.onload=function(){U(L.result)},L.onerror=function(){q(L.error)}})}function B(L){var U=new FileReader,q=v(U);return U.readAsArrayBuffer(L),q}function C(L){var U=new FileReader,q=v(U),R=/charset=([A-Za-z0-9_-]+)/.exec(L.type),w=R?R[1]:"utf-8";return U.readAsText(L,w),q}function y(L){for(var U=new Uint8Array(L),q=new Array(U.length),R=0;R<U.length;R++)q[R]=String.fromCharCode(U[R]);return q.join("")}function x(L){if(L.slice)return L.slice(0);var U=new Uint8Array(L.byteLength);return U.set(new Uint8Array(L)),U.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(L){this.bodyUsed=this.bodyUsed,this._bodyInit=L,L?typeof L=="string"?this._bodyText=L:c.blob&&Blob.prototype.isPrototypeOf(L)?this._bodyBlob=L:c.formData&&FormData.prototype.isPrototypeOf(L)?this._bodyFormData=L:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(L)?this._bodyText=L.toString():c.arrayBuffer&&c.blob&&l(L)?(this._bodyArrayBuffer=x(L.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(L)||A(L))?this._bodyArrayBuffer=x(L):this._bodyText=L=Object.prototype.toString.call(L):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof L=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(L)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var L=p(this);if(L)return L;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var L=p(this);return L||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(c.blob)return this.blob().then(B);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var L=p(this);if(L)return L;if(this._bodyBlob)return C(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(y(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(M)}),this.json=function(){return this.text().then(JSON.parse)},this}var D=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(L){var U=L.toUpperCase();return D.indexOf(U)>-1?U:L}function O(L,U){if(!(this instanceof O))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');U=U||{};var q=U.body;if(L instanceof O){if(L.bodyUsed)throw new TypeError("Already read");this.url=L.url,this.credentials=L.credentials,U.headers||(this.headers=new g(L.headers)),this.method=L.method,this.mode=L.mode,this.signal=L.signal,!q&&L._bodyInit!=null&&(q=L._bodyInit,L.bodyUsed=!0)}else this.url=String(L);if(this.credentials=U.credentials||this.credentials||"same-origin",(U.headers||!this.headers)&&(this.headers=new g(U.headers)),this.method=F(U.method||this.method||"GET"),this.mode=U.mode||this.mode||null,this.signal=U.signal||this.signal||function(){if("AbortController"in a){var k=new AbortController;return k.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&q)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(q),(this.method==="GET"||this.method==="HEAD")&&(U.cache==="no-store"||U.cache==="no-cache")){var R=/([?&])_=[^&]*/;if(R.test(this.url))this.url=this.url.replace(R,"$1_="+new Date().getTime());else{var w=/\?/;this.url+=(w.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})};function M(L){var U=new FormData;return L.trim().split("&").forEach(function(q){if(q){var R=q.split("="),w=R.shift().replace(/\+/g," "),k=R.join("=").replace(/\+/g," ");U.append(decodeURIComponent(w),decodeURIComponent(k))}}),U}function j(L){var U=new g,q=L.replace(/\r?\n[\t ]+/g," ");return q.split("\r").map(function(R){return R.indexOf(`
|
|
2476
|
+
`).flatMap(a=>{const c=a.split(" ").filter(Boolean);return c.length?c.slice(1).reduce((l,u,A)=>{const d=`${l[l.length-1].text} ${u}`.trim(),f=e.measureText(d);if(f.width>n)l=[...l,...Zh({context:e,word:u,maxW:n})];else{const g=t[A%t.length];e.font=i.replace(Hn,g.toString()),l[l.length-1]={text:d,metrics:f}}return l},Zh({context:e,word:c[0],maxW:n})):{text:"",metrics:e.measureText("")}})}finally{e.restore()}},{cacheKey:([{font:i,fontSizes:e,text:t,maxW:r,letterSpacing:n}])=>`${i}_${JSON.stringify(e)}_${t}_${r}_${n}`});Ms(({font:i,text:e,scale:t,context:r,maxW:n,maxH:s,minSize:o,maxSize:a,letterSpacing:c=0})=>{var l,u;let A=0;if(a){A=(o??0)*t;let d=0;for(;a*t>A+1;){A+=1;const f=Fy({font:i,context:r,fontSizes:[A],text:e,maxW:n,letterSpacing:c});if(d=f.reduce((g,p)=>(p.metrics.width>g&&(g=p.metrics.width),g),0),d>n||f.length*A>s){A-=1;break}}}else A=parseFloat(((u=(l=i.match(Hn))==null?void 0:l.groups)==null?void 0:u.value)??"0")*t;return A},{cacheKey:([{font:i,text:e,scale:t,maxW:r,maxH:n,minSize:s,maxSize:o,letterSpacing:a}])=>`${i}_${e}_${s}_${o}_${t}_${r}_${n}_${a}`});const Py={type:"text"},Ny={type:"video"};function ed(){return document.createElement("canvas")}function Oy(i,e){return Object.keys(i).reduce((t,r)=>(e.includes(r)||(t[r]=i[r]),t),{})}function qt(i){let e=0;for(const t of i)Array.isArray(t)?e+=qt(t):e+=t;return e}function ho(i){return i.map(({type:e,duration:t},r)=>{var n,s,o,a;if(e==="transition"){const c=((n=i[r-2])==null?void 0:n.type)==="transition"?i[r-2]:null,l=((s=i[r-1])==null?void 0:s.duration)??1/0,u=((o=i[r+1])==null?void 0:o.duration)??1/0,A=((a=i[r+2])==null?void 0:a.type)==="transition"?i[r+2]:null;return Math.min(c?l/2:l,t,A?u/2:u)*-1}return t})}function td(i){var e;return{...i,children:((e=i.children)==null?void 0:e.map(t=>{if(!t.renderer)return td(t)}).filter(Boolean))??[]}}function id(i){const e={box:0,shape:0,image:0,video:0,text:0,audio:0,gradient:0,caption:0};i.renderer&&(e[i.renderer.type]+=1);for(const t of i.children??[]){const{box:r,shape:n,image:s,video:o,text:a,audio:c,gradient:l,caption:u}=id(t);e.box+=r,e.shape+=n,e.image+=s,e.video+=o,e.text+=a,e.audio+=c,e.gradient+=l,e.caption+=u}return e}function Uy(i){return i.video>0?Ny.type:i.image>0?My.type:i.audio>0?_y.type:i.caption>0?ky.type:Py.type}function rd({node:i,duration:e,parentAnimations:t}){const r=[],n={...t,...i.element.animations};if(i.renderer){const s=td({...i.element,layout:{...i.element.layout?Oy(i.element.layout,["maxWidth","maxHeight"]):{},width:"100%",height:"100%",margin:0}}),o=id(s);r.push({type:Uy(o),id:Ay(),x:i.x,y:i.y,width:i.width,height:i.height,duration:e,root:{element:s}})}for(const s of i.childNodes)r.push(...rd({node:s,duration:e,parentAnimations:n}));return r}function Gy(i){if(i===null||typeof i!="object")return!1;if(Object.getPrototypeOf(i)===null)return!0;let e=i;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(i)===e}function $y(i){return i.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}oE.filters.define("parse",i=>typeof i>"u"?null:typeof i=="string"?`"${$y(i)}"`:Gy(i)||Array.isArray(i)?JSON.stringify(i):i);const Hy="3";async function Yy({scene:i,start:e=0}){const{id:t,root:r,duration:n}=i,s=await Xh({id:t,root:r});return{type:i.type,start:e,duration:n,layout:s,id:i.id,config:i}}async function Vy({track:i}){const e=ho(i),t=await Promise.all(i.reduce((s,o,a)=>{if(o.type!=="audio")return s;const c=qt(e.slice(0,a));return s.push(Yy({scene:o,start:c})),s},[])),r=i.reduce((s,o,a)=>{if(o.type!=="gap")return s;const c=qt(e.slice(0,a));return s.push({type:o.type,id:o.id,start:c,config:o,duration:o.duration}),s},[]),n=i.map(({id:s})=>t.find(({id:o})=>o===s)??r.find(({id:o})=>o===s)).filter(Boolean);return{type:"audio",scenes:t,gapScenes:r,mergedScenes:n,config:i,duration:Math.max(...n.map(({start:s,duration:o})=>s+o))}}async function nd({node:i,canvases:e,sceneTime:t,sceneDuration:r,parentOpacity:n=1,parentTransform:s,debug:o=!1}){var a,c;const l=e.sceneCanvas.getContext("2d");if(l){l.save(),l.setTransform(s);const u=oy({layout:i.element.layout,sceneTime:t,animations:i.element.animations,elementDuration:r,elementDimensions:{width:i.width,height:i.height}}),{opacity:A,translation:h,scale:d,clip:f,dimensions:g,rotation:p}=u,v=i.width*g.widthRatio,B=i.height*g.heightRatio;if(l.globalAlpha=A*n,(h.x||h.y)&&l.translate(h.x,h.y),(d!==1||p!==0)&&(l.translate(i.x+v/2,i.y+B/2),l.scale(d,d),l.rotate(p*Math.PI/180),l.translate(-(i.x+v/2),-(i.y+B/2))),f){l.beginPath();const C={x:i.x+f.x*v,y:i.y+f.y*B,width:f.width*v,height:f.height*B};l.rect(C.x,C.y,C.width,C.height),l.clip()}if(o){const C=l.globalAlpha;l.globalAlpha=1,l.strokeStyle="red",l.strokeRect(i.x,i.y,v,B),l.globalAlpha=C}await((c=(a=i.renderer)==null?void 0:a.render)==null?void 0:c.call(a,{canvases:e,sceneTime:t,dx:i.x,dy:i.y,dw:v,dh:B,radius:i.radius,options:i.options,dependencies:i.dependencies}));for await(const C of i.childNodes)await nd({debug:o,node:C,canvases:e,sceneTime:t,sceneDuration:r,parentOpacity:l.globalAlpha,parentTransform:l.getTransform()});l.restore()}}async function Ky({layout:i,canvases:e,sceneTime:t,sceneDuration:r,debug:n=!1}){const{node:s}=i;await nd({debug:n,node:s,canvases:e,sceneDuration:r,sceneTime:t})}async function fo({debug:i=!1,scene:e,start:t=0,resolvers:r,rootWidth:n,rootHeight:s,canvasFactory:o=ed}){var a,c;const{id:l,x:u,y:A,width:h,height:d,root:f,duration:g}=e,p=o(),v=o(),B=o(),C=o(),y=o(),x=await Xh({id:l,root:{...f,layout:{...f.layout,width:n,height:s},element:{...f.element,layout:{...f.element.layout,...typeof u=="number"&&typeof A=="number"?{position:"absolute",inset:{top:A,left:u}}:{},width:h??((a=f.element.layout)==null?void 0:a.width),height:d??((c=f.element.layout)==null?void 0:c.height)}}},resolvers:r,measureCanvas:y}),_=async D=>{const F=Math.max(0,D-t);p.width=p.height=0,p.width=n,p.height=s,await Ky({debug:i,layout:x,sceneTime:F,sceneDuration:g,canvases:{sceneCanvas:p,cropCanvas:v,letterboxCanvas:B,posterCanvas:C}})};return{id:l,type:e.type,start:t,duration:g,layout:x,sceneCanvas:p,draw:_,config:e,childScenes:x.node.childNodes.flatMap(D=>rd({node:D,duration:g}))}}async function Wy({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=ho(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=qt(o.slice(0,d));return h.type==="caption"&&A.push(fo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=qt(o.slice(0,d));return A.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),A},[]),l=e.reduce((A,h,d)=>{if(h.type!=="transition")return A;const f=h.duration,g=qt(o.slice(0,d))-f;return A.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var v;return p===((v=e[d+1])==null?void 0:v.id)}),from:a.find(({id:p})=>{var v;return p===((v=e[d-1])==null?void 0:v.id)})}),A},[]),u=e.map(({id:A})=>a.find(({id:h})=>h===A)??c.find(({id:h})=>h===A)??l.find(({id:h})=>h===A)).filter(Boolean);return{type:"caption",scenes:a,gapScenes:c,transitions:l,mergedScenes:u,duration:Math.max(...u.map(({start:A,duration:h})=>A+h)),trackCanvas:s()}}async function qy({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=ho(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=qt(o.slice(0,d));return h.type==="video"&&A.push(fo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),h.type==="image"&&A.push(fo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=qt(o.slice(0,d));return A.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),A},[]),l=e.reduce((A,h,d)=>{if(h.type!=="transition")return A;const f=h.duration,g=qt(o.slice(0,d))-f;return A.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var v;return p===((v=e[d+1])==null?void 0:v.id)}),from:a.find(({id:p})=>{var v;return p===((v=e[d-1])==null?void 0:v.id)})}),A},[]),u=e.map(({id:A})=>a.find(({id:h})=>h===A)??c.find(({id:h})=>h===A)??l.find(({id:h})=>h===A)).filter(Boolean);return{type:"picture",scenes:a,gapScenes:c,transitions:l,mergedScenes:u,duration:Math.max(0,...u.map(({start:A,duration:h})=>A+h)),trackCanvas:s()}}async function Jy({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=ho(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=qt(o.slice(0,d));return h.type==="text"&&A.push(fo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=qt(o.slice(0,d));return A.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),A},[]),l=e.reduce((A,h,d)=>{if(h.type!=="transition")return A;const f=h.duration,g=qt(o.slice(0,d))-f;return A.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var v;return p===((v=e[d+1])==null?void 0:v.id)}),from:a.find(({id:p})=>{var v;return p===((v=e[d-1])==null?void 0:v.id)})}),A},[]),u=e.map(({id:A})=>a.find(({id:h})=>h===A)??c.find(({id:h})=>h===A)??l.find(({id:h})=>h===A)).filter(Boolean);return{type:"text",scenes:a,gapScenes:c,transitions:l,mergedScenes:u,duration:Math.max(...u.map(({start:A,duration:h})=>A+h)),trackCanvas:s()}}function jy(i){return i.some(({type:e})=>e==="text")}function Xy(i){return i.some(({type:e})=>e==="caption")}function zy(i){return i.some(({type:e})=>e==="audio")}function Zy(i){return i.some(({type:e})=>e==="video"||e==="image")}function eC(i){return i.type==="audio"}const tC=(((_h=wh)==null?void 0:_h.default)??wh).reduce((i,e)=>(i[e.name]=e,i),{});function iC(i,e){return i.has(e)||i.set(e,{buffer:null,transitions:{},fromTexture:null,toTexture:null}),i.get(e)}function rC({name:i,to:e,from:t,progress:r,width:n,height:s,glContext:o,contextResources:a,returnPixels:c=!0}){var l,u,A;const h=iC(a,o);if(o.disable(o.DEPTH_TEST),h.buffer?o.bindBuffer(o.ARRAY_BUFFER,h.buffer):(h.buffer=o.createBuffer(),o.bindBuffer(o.ARRAY_BUFFER,h.buffer),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,-1,4,4,-1]),o.STATIC_DRAW)),o.viewport(0,0,n,s),h.fromTexture?h.fromTexture.setPixels(t):(h.fromTexture=(((l=ro)==null?void 0:l.default)??ro)(o,t),h.fromTexture.minFilter=o.LINEAR,h.fromTexture.magFilter=o.LINEAR),h.toTexture?h.toTexture.setPixels(e):(h.toTexture=(((u=ro)==null?void 0:u.default)??ro)(o,e),h.toTexture.minFilter=o.LINEAR,h.toTexture.magFilter=o.LINEAR),h.transitions[i]||(h.transitions[i]=(((A=Qh)==null?void 0:A.default)??Qh)(o,tC[i])),h.transitions[i].draw(r,h.fromTexture,h.toTexture,n,s),!c)return o.flush(),new Uint8Array(0);const f=new Uint8Array(n*s*4);return o.readPixels(0,0,n,s,o.RGBA,o.UNSIGNED_BYTE,f),o.flush(),f}function nC(i){for(const[e,t]of i.entries())t.buffer&&e.deleteBuffer(t.buffer),t.fromTexture&&t.fromTexture.dispose(),t.toTexture&&t.toTexture.dispose(),Object.values(t.transitions).forEach(r=>{r.dispose()}),i.delete(e)}function sC({name:i,to:e,from:t,progress:r,canvas:n,contextResources:s}){const o=n.getContext("webgl",{alpha:!0,depth:!1,antialias:!1,preserveDrawingBuffer:!1});o&&(o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!0),rC({name:i,to:e,from:t,progress:r,width:n.width,height:n.height,glContext:o,contextResources:s,returnPixels:!1}))}async function sd({debug:i=!1,config:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s=ed,drawTransition:o=sC}){const a=new Map,c=await Promise.all(e.tracks.map(async A=>{if(Zy(A))return{...await qy({debug:i,track:A,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:A};if(jy(A))return{...await Jy({debug:i,track:A,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:A};if(Xy(A))return{...await Wy({debug:i,track:A,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:A};if(zy(A))return{...await Vy({track:A}),config:A};throw new Error("Unknown track type")}));return{draw:async({canvas:A,currentTime:h})=>{const d=A.getContext("2d");if(d){d.globalAlpha=1,d.globalCompositeOperation="source-over",d.clearRect(0,0,A.width,A.height),d.save(),d.fillStyle="black",d.fillRect(0,0,A.width,A.height),d.restore();for await(const f of c){if(eC(f))continue;const{scenes:g,transitions:p,trackCanvas:v}=f;v.width=v.height=0,v.width=A.width,v.height=A.height;const B=v.getContext("2d"),C=g.filter(({start:x,duration:_})=>h>=x&&h<x+_);if(!B||C.length<=0)continue;const y=p.find(({start:x,duration:_})=>h>=x&&h<x+_);for await(const{sceneCanvas:x,draw:_}of C)await(_==null?void 0:_(h)),(!y||y&&(!y.to||!y.from))&&B.drawImage(x,0,0,x.width,x.height);if(y&&y.to&&y.from&&y.duration>0){const{name:x,to:_,from:D,duration:F,transitionCanvas:O}=y;O.width=O.height=0,O.width=v.width,O.height=v.height;const M=Math.min(1,Math.max(0,(h-_.start)/F));await o({name:x,progress:M,contextResources:a,to:_.sceneCanvas,from:D.sceneCanvas,canvas:O}),B.globalCompositeOperation="lighter",B.drawImage(O,0,0,O.width,O.height)}d.drawImage(v,0,0,v.width,v.height)}}},cleanup:()=>{nC(a)},tracks:c,aspectRatio:e.aspectRatio,transcriptions:e.transcriptions,duration:Math.max(...c.map(({duration:A})=>A))}}const oC={version:"7.0.3"};function aC(i){const{publicApiUrl:e}=ks(i),t=Ki();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function lC(i){var s,o,a,c,l,u,A,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Ki()};let e=(o=(s=window.localStorage)==null?void 0:s.getItem)==null?void 0:o.call(s,"vouch-uid-visitor"),t=(c=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:c.call(a,"vouch-uid-client"),r=(u=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:u.call(l,"vouch-uid-tab");const n=Ki();return e||(e=aC(i),(h=(A=window.localStorage)==null?void 0:A.setItem)==null||h.call(A,"vouch-uid-visitor",e)),t||(t=Ki(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),r||(r=Ki(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",r)),{client:t,tab:r,request:n,visitor:e}}function cC(i,e){return i&&"vouchId"in i?i.vouchId:(e==null?void 0:e.id)??null}function AC(i="embedded_player"){var n,s;const[e,t]=((s=(n=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:n.split)==null?void 0:s.call(n,"/"))??[],r={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const c=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());r[c]=a}}),{source:i,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:oC.version,templateVersion:Hy,...r}}const od=1;class uC{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,r)=>{const n=cC(r,this.host.vouch);!n||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...r,senderId:this.host.senderId,vouchId:n,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=ks(this.host.env),{client:r,tab:n,request:s,visitor:o}=lC(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":r,"x-uid-tab":n,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":AC(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:r}=this._currentlyPlayingVideo;this._streamLatestTime[r]>this._streamStartTime[r]+od&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[r],streamEnd:this._streamLatestTime[r]}),delete this._streamStartTime[r],delete this._streamLatestTime[r]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:r}})=>{this._answersViewed[r]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[r]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:r,node:n}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:r,node:n},this._streamLatestTime[r]=n.currentTime,this._streamStartTime[r]||(this._streamStartTime[r]=n.currentTime,this._streamLatestTime[r]=n.currentTime))},this._handleVideoPause=({detail:{id:t,key:r}})=>{this._streamLatestTime[r]>this._streamStartTime[r]+od&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[r],streamEnd:this._streamLatestTime[r]}),delete this._streamStartTime[r],delete this._streamLatestTime[r]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,r,n;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(r=this.host.mediaPlayer)==null||r.addEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,r,n;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var bl={exports:{}};(function(i,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof qi<"u"&&qi,r=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof qi<"u"&&qi||{},c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(L){return L&&DataView.prototype.isPrototypeOf(L)}if(c.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],A=ArrayBuffer.isView||function(L){return L&&u.indexOf(Object.prototype.toString.call(L))>-1};function h(L){if(typeof L!="string"&&(L=String(L)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(L)||L==="")throw new TypeError('Invalid character in header field name: "'+L+'"');return L.toLowerCase()}function d(L){return typeof L!="string"&&(L=String(L)),L}function f(L){var U={next:function(){var q=L.shift();return{done:q===void 0,value:q}}};return c.iterable&&(U[Symbol.iterator]=function(){return U}),U}function g(L){this.map={},L instanceof g?L.forEach(function(U,q){this.append(q,U)},this):Array.isArray(L)?L.forEach(function(U){if(U.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+U.length);this.append(U[0],U[1])},this):L&&Object.getOwnPropertyNames(L).forEach(function(U){this.append(U,L[U])},this)}g.prototype.append=function(L,U){L=h(L),U=d(U);var q=this.map[L];this.map[L]=q?q+", "+U:U},g.prototype.delete=function(L){delete this.map[h(L)]},g.prototype.get=function(L){return L=h(L),this.has(L)?this.map[L]:null},g.prototype.has=function(L){return this.map.hasOwnProperty(h(L))},g.prototype.set=function(L,U){this.map[h(L)]=d(U)},g.prototype.forEach=function(L,U){for(var q in this.map)this.map.hasOwnProperty(q)&&L.call(U,this.map[q],q,this)},g.prototype.keys=function(){var L=[];return this.forEach(function(U,q){L.push(q)}),f(L)},g.prototype.values=function(){var L=[];return this.forEach(function(U){L.push(U)}),f(L)},g.prototype.entries=function(){var L=[];return this.forEach(function(U,q){L.push([q,U])}),f(L)},c.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(L){if(!L._noBody){if(L.bodyUsed)return Promise.reject(new TypeError("Already read"));L.bodyUsed=!0}}function v(L){return new Promise(function(U,q){L.onload=function(){U(L.result)},L.onerror=function(){q(L.error)}})}function B(L){var U=new FileReader,q=v(U);return U.readAsArrayBuffer(L),q}function C(L){var U=new FileReader,q=v(U),R=/charset=([A-Za-z0-9_-]+)/.exec(L.type),w=R?R[1]:"utf-8";return U.readAsText(L,w),q}function y(L){for(var U=new Uint8Array(L),q=new Array(U.length),R=0;R<U.length;R++)q[R]=String.fromCharCode(U[R]);return q.join("")}function x(L){if(L.slice)return L.slice(0);var U=new Uint8Array(L.byteLength);return U.set(new Uint8Array(L)),U.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(L){this.bodyUsed=this.bodyUsed,this._bodyInit=L,L?typeof L=="string"?this._bodyText=L:c.blob&&Blob.prototype.isPrototypeOf(L)?this._bodyBlob=L:c.formData&&FormData.prototype.isPrototypeOf(L)?this._bodyFormData=L:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(L)?this._bodyText=L.toString():c.arrayBuffer&&c.blob&&l(L)?(this._bodyArrayBuffer=x(L.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(L)||A(L))?this._bodyArrayBuffer=x(L):this._bodyText=L=Object.prototype.toString.call(L):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof L=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(L)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var L=p(this);if(L)return L;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var L=p(this);return L||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(c.blob)return this.blob().then(B);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var L=p(this);if(L)return L;if(this._bodyBlob)return C(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(y(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(M)}),this.json=function(){return this.text().then(JSON.parse)},this}var D=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(L){var U=L.toUpperCase();return D.indexOf(U)>-1?U:L}function O(L,U){if(!(this instanceof O))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');U=U||{};var q=U.body;if(L instanceof O){if(L.bodyUsed)throw new TypeError("Already read");this.url=L.url,this.credentials=L.credentials,U.headers||(this.headers=new g(L.headers)),this.method=L.method,this.mode=L.mode,this.signal=L.signal,!q&&L._bodyInit!=null&&(q=L._bodyInit,L.bodyUsed=!0)}else this.url=String(L);if(this.credentials=U.credentials||this.credentials||"same-origin",(U.headers||!this.headers)&&(this.headers=new g(U.headers)),this.method=F(U.method||this.method||"GET"),this.mode=U.mode||this.mode||null,this.signal=U.signal||this.signal||function(){if("AbortController"in a){var k=new AbortController;return k.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&q)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(q),(this.method==="GET"||this.method==="HEAD")&&(U.cache==="no-store"||U.cache==="no-cache")){var R=/([?&])_=[^&]*/;if(R.test(this.url))this.url=this.url.replace(R,"$1_="+new Date().getTime());else{var w=/\?/;this.url+=(w.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})};function M(L){var U=new FormData;return L.trim().split("&").forEach(function(q){if(q){var R=q.split("="),w=R.shift().replace(/\+/g," "),k=R.join("=").replace(/\+/g," ");U.append(decodeURIComponent(w),decodeURIComponent(k))}}),U}function j(L){var U=new g,q=L.replace(/\r?\n[\t ]+/g," ");return q.split("\r").map(function(R){return R.indexOf(`
|
|
2477
2477
|
`)===0?R.substr(1,R.length):R}).forEach(function(R){var w=R.split(":"),k=w.shift().trim();if(k){var K=w.join(":").trim();try{U.append(k,K)}catch(Y){console.warn("Response "+Y.message)}}}),U}_.call(O.prototype);function X(L,U){if(!(this instanceof X))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(U||(U={}),this.type="default",this.status=U.status===void 0?200:U.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=U.statusText===void 0?"":""+U.statusText,this.headers=new g(U.headers),this.url=U.url||"",this._initBody(L)}_.call(X.prototype),X.prototype.clone=function(){return new X(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},X.error=function(){var L=new X(null,{status:200,statusText:""});return L.ok=!1,L.status=0,L.type="error",L};var le=[301,302,303,307,308];X.redirect=function(L,U){if(le.indexOf(U)===-1)throw new RangeError("Invalid status code");return new X(null,{status:U,headers:{location:L}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(U,q){this.message=U,this.name=q;var R=Error(U);this.stack=R.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function oe(L,U){return new Promise(function(q,R){var w=new O(L,U);if(w.signal&&w.signal.aborted)return R(new o.DOMException("Aborted","AbortError"));var k=new XMLHttpRequest;function K(){k.abort()}k.onload=function(){var re={statusText:k.statusText,headers:j(k.getAllResponseHeaders()||"")};w.url.indexOf("file://")===0&&(k.status<200||k.status>599)?re.status=200:re.status=k.status,re.url="responseURL"in k?k.responseURL:re.headers.get("X-Request-URL");var he="response"in k?k.response:k.responseText;setTimeout(function(){q(new X(he,re))},0)},k.onerror=function(){setTimeout(function(){R(new TypeError("Network request failed"))},0)},k.ontimeout=function(){setTimeout(function(){R(new TypeError("Network request timed out"))},0)},k.onabort=function(){setTimeout(function(){R(new o.DOMException("Aborted","AbortError"))},0)};function Y(re){try{return re===""&&a.location.href?a.location.href:re}catch{return re}}if(k.open(w.method,Y(w.url),!0),w.credentials==="include"?k.withCredentials=!0:w.credentials==="omit"&&(k.withCredentials=!1),"responseType"in k&&(c.blob?k.responseType="blob":c.arrayBuffer&&(k.responseType="arraybuffer")),U&&typeof U.headers=="object"&&!(U.headers instanceof g||a.Headers&&U.headers instanceof a.Headers)){var ie=[];Object.getOwnPropertyNames(U.headers).forEach(function(re){ie.push(h(re)),k.setRequestHeader(re,d(U.headers[re]))}),w.headers.forEach(function(re,he){ie.indexOf(he)===-1&&k.setRequestHeader(he,re)})}else w.headers.forEach(function(re,he){k.setRequestHeader(he,re)});w.signal&&(w.signal.addEventListener("abort",K),k.onreadystatechange=function(){k.readyState===4&&w.signal.removeEventListener("abort",K)}),k.send(typeof w._bodyInit>"u"?null:w._bodyInit)})}return oe.polyfill=!0,a.fetch||(a.fetch=oe,a.Headers=g,a.Request=O,a.Response=X),o.Headers=g,o.Request=O,o.Response=X,o.fetch=oe,o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var n=t.fetch?t:r;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,i.exports=e})(bl,bl.exports);var hC=bl.exports;const ad=Ha(hC);async function dC(i){var e;try{if((e=await ad(i,{method:"HEAD"}))!=null&&e.ok)return i}catch{return}}async function Sl({sources:i}){const e=i==null?void 0:i.filter(Boolean),t=e==null?void 0:e.find(s=>s.startsWith("blob:")),r=e==null?void 0:e.find(s=>!s.startsWith("http")&&!s.startsWith("blob:"));if(t||r)return t??r;let n=e[0];if(e.length>0){const s=e.map(a=>dC(a)),o=(await Promise.all(s)).find(Boolean);o&&(n=o)}return n}async function fC(i){try{return(await ad(i)).text()}catch{return null}}async function gC(i){return i=i.trim(),i.startsWith("http")||i.startsWith("blob:")?fC(i):i}const pC=Er(async({original:i,translation:e,originalLanguage:t="",translationLanguage:r=""},{language:n})=>{var s,o;const a={[(s=r==null?void 0:r.split("-"))==null?void 0:s[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:i},c=(n&&a[n])??i;return c?gC(c):null},{cacheKey:([i,{language:e}])=>JSON.stringify({...i,language:e})});function mC(i){var e;return((e=i==null?void 0:i.items)==null?void 0:e.map(t=>{var r;return{text:(r=t.alternatives[0])==null?void 0:r.content,start:t.start_time,end:t.end_time}}))??[]}const EC=Er(async i=>{var e,t,r,n,s,o,a,c,l,u,A;const[h,d,f]=await Promise.all([Sl({sources:[(t=(e=i==null?void 0:i.answer)==null?void 0:e.media)==null?void 0:t.video,(n=(r=i==null?void 0:i.answer)==null?void 0:r.media)==null?void 0:n.input]}),Sl({sources:[(o=(s=i==null?void 0:i.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),Sl({sources:[((c=(a=i==null?void 0:i.answer)==null?void 0:a.media)==null?void 0:c.reducedQuality)??((A=(u=(l=i==null?void 0:i.answer)==null?void 0:l.media)==null?void 0:u.videos)==null?void 0:A.xs)]})]);return{src:h,playlist:d,preview:f}},{cacheKey:([i])=>{var e,t,r,n,s,o,a,c,l,u,A;return JSON.stringify({video:(t=(e=i==null?void 0:i.answer)==null?void 0:e.media)==null?void 0:t.video,input:(n=(r=i==null?void 0:i.answer)==null?void 0:r.media)==null?void 0:n.input,playlist:(o=(s=i==null?void 0:i.answer)==null?void 0:s.media)==null?void 0:o.playlist,preview:((c=(a=i==null?void 0:i.answer)==null?void 0:a.media)==null?void 0:c.reducedQuality)??((A=(u=(l=i==null?void 0:i.answer)==null?void 0:l.media)==null?void 0:u.videos)==null?void 0:A.xs)})}});function ld(i){var e,t,r,n,s,o,a,c,l,u,A,h;const d=((t=(e=i==null?void 0:i.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((s=(n=(r=i==null?void 0:i.answer)==null?void 0:r.contact)==null?void 0:n.name)==null?void 0:s.trim())??"",f=((c=(a=(o=i==null?void 0:i.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:c.name)==="Not Supplied"?"":((h=(A=(u=(l=i==null?void 0:i.answer)==null?void 0:l.contact)==null?void 0:u.client)==null?void 0:A.name)==null?void 0:h.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}function IC(i){var e,t;const r=(t=(e=i==null?void 0:i.answer)==null?void 0:e.contact)==null?void 0:t.roleTitle,n=r==null?void 0:r.split(" ");return{roleTitle:r,roleWords:n,firstRoleWord:n==null?void 0:n[0],remainingRoleWords:n==null?void 0:n.slice(1).join(" ")}}async function vC(i,e,t){var r,n,s;const o=(r=e==null?void 0:e.answer)==null?void 0:r.id;return((s=(n=i==null?void 0:i.questions)==null?void 0:n.items)==null?void 0:s.reduce((c,l)=>{var u;return((u=l==null?void 0:l.answer)==null?void 0:u.id)===o?(c??0)+1:c},0))<=1?o:`${o}-${t}`}async function xl({data:i,rootData:e,index:t},r){var n,s,o,a,c,l,u,A,h,d,f,g,p,v,B,C,y,x,_,D,F,O,M,j;const[X,le,oe]=await Promise.all([vC(i,e,t),EC(e),pC({original:((s=(n=e==null?void 0:e.answer)==null?void 0:n.media)==null?void 0:s.captions)??((a=(o=e==null?void 0:e.answer)==null?void 0:o.captions)==null?void 0:a.current),translation:((l=(c=e==null?void 0:e.answer)==null?void 0:c.media)==null?void 0:l.translation)??((A=(u=e==null?void 0:e.answer)==null?void 0:u.captions)==null?void 0:A.translation),originalLanguage:(d=(h=e==null?void 0:e.answer)==null?void 0:h.transcription)==null?void 0:d.language,translationLanguage:(p=(g=(f=e==null?void 0:e.answer)==null?void 0:f.transcription)==null?void 0:g.translation)==null?void 0:p.language},r)]),L=ld(e),U=IC(e);return{...le,...L,...U,key:X,captions:oe,wordTimings:mC((v=e==null?void 0:e.answer)==null?void 0:v.transcription),answerLabel:((B=e==null?void 0:e.answer)==null?void 0:B.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((_=(x=(y=(C=i==null?void 0:i.questions)==null?void 0:C.items)==null?void 0:y[t-1])==null?void 0:x.answer)==null?void 0:_.label)??((O=(F=(D=i==null?void 0:i.questions)==null?void 0:D.items)==null?void 0:F[t-1])==null?void 0:O.title)??null:null,isFirstInstanceOfName:t?((j=(M=i==null?void 0:i.questions)==null?void 0:M.items)==null?void 0:j.findIndex(q=>ld(q).name===L.name))===t:!0}}const go={af:"Afrikaans",sq:"Albanian",am:"Amharic",ar:"Arabic",hy:"Armenian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese (Simplified)",zh_TW:"Chinese (Traditional)",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",fi:"Finnish",fr:"French",fa:"Farsi",tl:"Filipino",ka:"Georgian",de:"German",el:"Greek",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",kn:"Kannada",kk:"Kazakh",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",ml:"Malayalam",mt:"Maltese",mr:"Marathi",mn:"Mongolian",no:"Norwegian",ps:"Pashto",pl:"Polish",pt:"Portuguese",pa:"Punjabi",ro:"Romanian",ru:"Russian",sr:"Serbian",si:"Sinhala",sk:"Slovak",sl:"Slovenian",so:"Somali",es:"Spanish",sw:"Swahili",sv:"Swedish",ta:"Tamil",te:"Telugu",th:"Thai",tr:"Turkish",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",vi:"Vietnamese",cy:"Welsh"};function yC({data:i}){var e,t;return((t=(e=i==null?void 0:i.questions)==null?void 0:e.items)==null?void 0:t.reduce((r,n)=>{var s,o,a,c,l,u,A;const h=(a=(o=(s=n==null?void 0:n.answer)==null?void 0:s.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(A=(u=(l=(c=n==null?void 0:n.answer)==null?void 0:c.transcription)==null?void 0:l.translation)==null?void 0:u.language)==null?void 0:A.split("-")[0];return h&&go[h]&&!r.find(f=>f.value===h)&&r.push({value:h,label:go[h]}),d&&go[d]&&!r.find(f=>f.value===d)&&r.push({value:d,label:go[d]}),r},[]))??[]}/**
|
|
2478
2478
|
* @license
|
|
2479
2479
|
* Copyright 2018 Google LLC
|
|
@@ -3777,7 +3777,7 @@ Schedule: ${c.map(d=>rr(d))}`),u.length&&this.log(`Removed events ${u}`),this.pl
|
|
|
3777
3777
|
vmp-captions.hiddenControls {
|
|
3778
3778
|
transform: translateY(calc(var(--space-small) * -1));
|
|
3779
3779
|
}
|
|
3780
|
-
`],Tt([te({type:Boolean})],gt.prototype,"loading",2),Tt([te({type:Boolean})],gt.prototype,"playing",2),Tt([te({type:Number})],gt.prototype,"volume",2),Tt([te({type:Boolean})],gt.prototype,"muted",2),Tt([te({type:Number})],gt.prototype,"currentTime",2),Tt([te({type:Number})],gt.prototype,"duration",2),Tt([te({type:Array})],gt.prototype,"languages",2),Tt([te({type:String})],gt.prototype,"language",2),Tt([te({type:Array,attribute:!1})],gt.prototype,"levels",2),Tt([te({type:Number})],gt.prototype,"level",2),Tt([te({type:Number})],gt.prototype,"playbackRate",2),Tt([te({type:String})],gt.prototype,"caption",2),Tt([te({type:Array})],gt.prototype,"buffer",2),Tt([te({type:Boolean})],gt.prototype,"captions",2),Tt([te({type:Boolean})],gt.prototype,"fullscreen",2),Tt([te({type:Array})],gt.prototype,"controls",2),Tt([ht()],gt.prototype,"showControls",2),gt=Tt([Mt("vmp-player-overlay")],gt);var GQ=Object.defineProperty,$Q=Object.getOwnPropertyDescriptor,At=(i,e,t,r)=>{for(var n=r>1?void 0:r?$Q(e,t):e,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(e,t,n):o(n))||n);return r&&n&&GQ(e,t,n),n};const HQ=1e3/60,YQ=30;let nt=class extends je{constructor(){super(...arguments),this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.disabled=!1,this.dataResolver=xl,this.languageResolver=yC,this._sceneController=new Zx(this),this._drawController=new Yx(this),this._observer=null,this._wasPlaying=!1,this._manualMute=this.muted,this._seekerRAF=null,this._seekerTimeout=null,this._lastWaiting=!1,this._lastTimestamp=null,this._lastCurrentTime=null,this._pageHidden=document.visibilityState==="hidden",this._aspectRatio=this.propAspectRatio,this._processing=!1,this._waiting=!1,this._errors=[],this._seeking=!1,this._language=this.propLanguage,this._languages=[],this._captions=!1,this._fullscreen=!1,this._playerRef=bt(),this._canvasRef=bt(),this._initialised=null,this._paused=!0,this._playbackRate=1,this._volume=null,this._muted=null,this._videoResolution=-1,this._handleContainerResize=()=>{var i;if((i=this.shadowRoot)!=null&&i.host){const e=this.shadowRoot.host.clientWidth,t=this.shadowRoot.host.clientHeight;if(e<=0||t<=0)return;this.propAspectRatio||(this._aspectRatio=e/t),Object.values(this.media).forEach(({node:r})=>{r instanceof HTMLVideoElement&&(r.width=e,r.height=t)}),this._updateHlsLevelCap(e,t)}},this._handleCanvasResize=()=>{this.draw()},this._loop=()=>{this._endLoop(),this._pageHidden?this._seekerTimeout=setTimeout(this._seeker,HQ):this._seekerRAF=requestAnimationFrame(this._seeker)},this._endLoop=()=>{this._seekerRAF&&cancelAnimationFrame(this._seekerRAF),this._seekerTimeout&&clearTimeout(this._seekerTimeout),this._seekerRAF=null,this._seekerTimeout=null},this._seeker=(i=performance.now())=>{if(this.composition){if(this._waiting=this._drawController.activeScenes.some(({id:e,layout:t})=>Bi(t.node).some(({key:n})=>{const s=ii(e,n);if(this.media[s]&&this.mediaState[s]){const o=this.media[s],a=this.mediaState[s];return!a||!a.initialised||a.waiting||o.node.readyState<3}})),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),i-(this._lastTimestamp??0)>1e3/YQ){let e=this._drawController.currentTime;const t=(i-(this._lastTimestamp??i))/1e3*this.playbackRate;this.activeScenes.every(({id:n,layout:s},o)=>Bi(s.node).every(({key:c},l)=>{var u,A;const h=ii(n,c),d=this.media[h];return((A=(u=this._lastCurrentTime)==null?void 0:u[o])==null?void 0:A[l])!==d.node.currentTime}))&&(e+=t),this._lastCurrentTime=this.activeScenes.map(({id:n,layout:s})=>Bi(s.node).map(({key:a})=>{const c=ii(n,a);return this.media[c].node.currentTime})),this._drawController.currentTime=e,this._lastTimestamp=i}this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))}this.paused||this._loop()},this._handleError=i=>{this._errors=[...this.errors,i.error],i.error.fatal&&this.pause()},this._handleFullscreenChange=()=>{var i;const e=!!(((i=this.shadowRoot)==null?void 0:i.fullscreenElement)??document.fullscreenElement===this),t=this._fullscreen;this._fullscreen=e,e?this._updateHlsLevelCap(window.screen.width,window.screen.height,!0):t&&requestAnimationFrame(()=>{var r;this._handleContainerResize(),(r=this.shadowRoot)!=null&&r.host&&this._updateHlsLevelCap(this.shadowRoot.host.clientWidth,this.shadowRoot.host.clientHeight,!0)})},this._handleVisibilityChange=()=>{this._pageHidden=document.visibilityState==="hidden",this.paused||this._loop()}}get aspectRatio(){return this._aspectRatio}get processing(){return this._processing}get waiting(){return!this.paused&&this._waiting}get errors(){return this._errors}get seeking(){return this._seeking}get language(){return this._language}get languages(){return this._languages}get captions(){return this._captions}get fullscreen(){return this._fullscreen}get playerElement(){return this._playerRef.value??null}get canvasElement(){return this._canvasRef.value??null}get initialised(){return this._initialised=this._initialised??new Promise(i=>{const e=setInterval(()=>{!!this.errors.find(r=>r.fatal)&&i(!1),!this.loading&&!this.processing&&this.composition&&this.duration>0&&i(!0)},500);setTimeout(()=>{clearInterval(e),i(!1)},60*1e3)}),this._initialised}get duration(){return this._sceneController.duration}get media(){return this._sceneController.media??{}}get mediaState(){return this._sceneController.mediaState}get composition(){return this._sceneController.composition}get activeScenes(){return this._drawController.activeScenes}set paused(i){i!==this._paused&&(this._paused=i,this.requestUpdate(),this.dispatchEvent(new CustomEvent(i?"pause":"play")))}get paused(){return this._paused}set playbackRate(i){i!==this._playbackRate&&(this._playbackRate=i,Object.values(this.media).forEach(({node:e,speed:t})=>{e.playbackRate=sr(.1,i*t,4)}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:i})))}get playbackRate(){return this._playbackRate}set volume(i){const e=sr(0,i,1);e!==this._volume&&(Object.values(this.media).forEach(({node:t,volume:r})=>{t.volume=e*r}),localStorage.setItem("vmp-player-volume/v2",e.toString()),this._volume=e,e>0&&(this.muted=!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:i})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume/v2")??"1"))}set muted(i){Object.values(this.media).forEach(({node:e,volume:t})=>{e.muted=t===0||i}),i!==this._muted&&(this._muted=i,localStorage.setItem("vmp-player-muted/v2",i.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:i?0:this.volume})))}get muted(){return this._muted??(this._muted=this.autoplay||localStorage.getItem("vmp-player-muted/v2")==="true")}get _hlsLevels(){for(const i of Object.values(this.media))if(i.hls&&i.hls.levels.length>0)return i.hls.levels;return[]}get _currentLevel(){if(this._videoResolution===-1)return-1;for(const i of Object.values(this.media))if(i.hls&&i.hls.levels.length>0)return i.hls.levels.findIndex(e=>Math.min(e.height,e.width)===this._videoResolution);return-1}set videoResolution(i){var e;i!==this._videoResolution&&(this._videoResolution=i,Object.values(this.media).forEach(({hls:t})=>{if(t)if(i===-1)t.nextLevel=-1;else{const r=t.levels.findIndex(n=>Math.min(n.height,n.width)===i);r!==-1&&(t.nextLevel=r,t.autoLevelCapping=r)}}),i===-1&&((e=this.shadowRoot)!=null&&e.host)&&this._updateHlsLevelCap(this.shadowRoot.host.clientWidth,this.shadowRoot.host.clientHeight),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(i){i!==this._drawController.currentTime&&(this._drawController.currentTime=i,this._sceneController.setMediaCurrentTime(i))}get currentTime(){return this._drawController.currentTime}_updateHlsLevelCap(i,e,t=!1){if(i<=0||e<=0||this._videoResolution!==-1)return;const r=window.devicePixelRatio||1,n=Math.min(i,e)*r;Object.values(this.media).forEach(({hls:s})=>{if(s&&s.levels.length>0){let o=0;for(let a=s.levels.length-1;a>=0;a--)if(Math.min(s.levels[a].width,s.levels[a].height)<=n){o=a;break}s.autoLevelCapping=o,t&&(s.nextLevel=o)}})}reset(i=0,e=!1){this._lastTimestamp=null,this._lastCurrentTime=null,this._drawController.currentTime=i,this._sceneController.setMediaCurrentTime(i),e?this.play():this.pause()}clear(){this._drawController.clear()}play(){this.paused=!1,this._lastTimestamp=null,this._lastCurrentTime=null,this.duration>0&&this._drawController.currentTime>=this.duration&&this.reset(0,!0),this._loop()}pause(){this._endLoop(),this.paused=!0,Object.values(this.media).forEach(({node:i})=>{i.pause()})}draw(i){return this._drawController.draw(i)}toggleFullscreen(i){i??this.fullscreen?tQ():this._playerRef.value&&eQ(this._playerRef.value)}connectedCallback(){var i;super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("webkitfullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),(i=this.shadowRoot)!=null&&i.host&&(this._observer=new ResizeObserver(this._handleContainerResize),this._observer.observe(this.shadowRoot.host))}willUpdate(i){i.has("propAspectRatio")&&(this._aspectRatio=this.propAspectRatio),i.has("propLanguage")&&(this._language=this.propLanguage)}updated(i){var e;i.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize(),this.autoplay&&!this._sceneController.hasPlayed&&!this.processing&&i.get("_processing")&&this.play(),i.has("_processing")&&this.processing&&this.dispatchEvent(new CustomEvent("processing")),i.has("_processing")&&!this.processing&&i.get("_processing")&&(e=this.shadowRoot)!=null&&e.host&&this._updateHlsLevelCap(this.shadowRoot.host.clientWidth,this.shadowRoot.host.clientHeight)}disconnectedCallback(){var i,e;super.disconnectedCallback(),(i=this._observer)==null||i.disconnect(),(e=this.composition)==null||e.cleanup(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?Te`
|
|
3780
|
+
`],Tt([te({type:Boolean})],gt.prototype,"loading",2),Tt([te({type:Boolean})],gt.prototype,"playing",2),Tt([te({type:Number})],gt.prototype,"volume",2),Tt([te({type:Boolean})],gt.prototype,"muted",2),Tt([te({type:Number})],gt.prototype,"currentTime",2),Tt([te({type:Number})],gt.prototype,"duration",2),Tt([te({type:Array})],gt.prototype,"languages",2),Tt([te({type:String})],gt.prototype,"language",2),Tt([te({type:Array,attribute:!1})],gt.prototype,"levels",2),Tt([te({type:Number})],gt.prototype,"level",2),Tt([te({type:Number})],gt.prototype,"playbackRate",2),Tt([te({type:String})],gt.prototype,"caption",2),Tt([te({type:Array})],gt.prototype,"buffer",2),Tt([te({type:Boolean})],gt.prototype,"captions",2),Tt([te({type:Boolean})],gt.prototype,"fullscreen",2),Tt([te({type:Array})],gt.prototype,"controls",2),Tt([ht()],gt.prototype,"showControls",2),gt=Tt([Mt("vmp-player-overlay")],gt);var GQ=Object.defineProperty,$Q=Object.getOwnPropertyDescriptor,At=(i,e,t,r)=>{for(var n=r>1?void 0:r?$Q(e,t):e,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(e,t,n):o(n))||n);return r&&n&&GQ(e,t,n),n};const HQ=1e3/60,YQ=30;let nt=class extends je{constructor(){super(...arguments),this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.disabled=!1,this.dataResolver=xl,this.languageResolver=yC,this._sceneController=new Zx(this),this._drawController=new Yx(this),this._observer=null,this._wasPlaying=!1,this._manualMute=this.muted,this._seekerRAF=null,this._seekerTimeout=null,this._lastWaiting=!1,this._lastTimestamp=null,this._lastCurrentTime=null,this._pageHidden=document.visibilityState==="hidden",this._aspectRatio=this.propAspectRatio,this._processing=!1,this._waiting=!1,this._errors=[],this._seeking=!1,this._language=this.propLanguage,this._languages=[],this._captions=!1,this._fullscreen=!1,this._playerRef=bt(),this._canvasRef=bt(),this._initialised=null,this._paused=!0,this._playbackRate=1,this._volume=null,this._muted=null,this._videoResolution=-1,this._handleContainerResize=()=>{var i;if((i=this.shadowRoot)!=null&&i.host){const e=this.shadowRoot.host.clientWidth,t=this.shadowRoot.host.clientHeight;if(e<=0||t<=0)return;this.propAspectRatio||(this._aspectRatio=e/t),Object.values(this.media).forEach(({node:r})=>{r instanceof HTMLVideoElement&&(r.width=e,r.height=t)}),this._updateHlsLevelCap(e,t)}},this._handleCanvasResize=()=>{this.draw()},this._loop=()=>{this._endLoop(),this._pageHidden?this._seekerTimeout=setTimeout(this._seeker,HQ):this._seekerRAF=requestAnimationFrame(this._seeker)},this._endLoop=()=>{this._seekerRAF&&cancelAnimationFrame(this._seekerRAF),this._seekerTimeout&&clearTimeout(this._seekerTimeout),this._seekerRAF=null,this._seekerTimeout=null},this._seeker=(i=performance.now())=>{if(this.composition){if(this._waiting=this._drawController.activeScenes.some(({id:e,layout:t})=>Bi(t.node).some(({key:n})=>{const s=ii(e,n);if(this.media[s]&&this.mediaState[s]){const o=this.media[s],a=this.mediaState[s];return!a||!a.initialised||a.waiting||o.node.readyState<3}})),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),i-(this._lastTimestamp??0)>1e3/YQ){let e=this._drawController.currentTime;const t=(i-(this._lastTimestamp??i))/1e3*this.playbackRate;this.activeScenes.every(({id:n,layout:s},o)=>Bi(s.node).every(({key:c},l)=>{var u,A;const h=ii(n,c),d=this.media[h];return((A=(u=this._lastCurrentTime)==null?void 0:u[o])==null?void 0:A[l])!==d.node.currentTime}))&&(e+=t),this._lastCurrentTime=this.activeScenes.map(({id:n,layout:s})=>Bi(s.node).map(({key:a})=>{const c=ii(n,a);return this.media[c].node.currentTime})),this._drawController.currentTime=e,this._lastTimestamp=i}this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))}this.paused||this._loop()},this._handleError=i=>{this._errors=[...this.errors,i.error],i.error.fatal&&this.pause()},this._handleFullscreenChange=()=>{var i;const e=!!(((i=this.shadowRoot)==null?void 0:i.fullscreenElement)??document.fullscreenElement===this),t=this._fullscreen;this._fullscreen=e,e?(this._aspectRatio=window.screen.width/window.screen.height,this._updateHlsLevelCap(window.screen.width,window.screen.height,!0)):t&&(this.propAspectRatio&&(this._aspectRatio=this.propAspectRatio),requestAnimationFrame(()=>{var r;this._handleContainerResize(),(r=this.shadowRoot)!=null&&r.host&&this._updateHlsLevelCap(this.shadowRoot.host.clientWidth,this.shadowRoot.host.clientHeight,!0)}))},this._handleVisibilityChange=()=>{this._pageHidden=document.visibilityState==="hidden",this.paused||this._loop()}}get aspectRatio(){return this._aspectRatio}get processing(){return this._processing}get waiting(){return!this.paused&&this._waiting}get errors(){return this._errors}get seeking(){return this._seeking}get language(){return this._language}get languages(){return this._languages}get captions(){return this._captions}get fullscreen(){return this._fullscreen}get playerElement(){return this._playerRef.value??null}get canvasElement(){return this._canvasRef.value??null}get initialised(){return this._initialised=this._initialised??new Promise(i=>{const e=setInterval(()=>{!!this.errors.find(r=>r.fatal)&&i(!1),!this.loading&&!this.processing&&this.composition&&this.duration>0&&i(!0)},500);setTimeout(()=>{clearInterval(e),i(!1)},60*1e3)}),this._initialised}get duration(){return this._sceneController.duration}get media(){return this._sceneController.media??{}}get mediaState(){return this._sceneController.mediaState}get composition(){return this._sceneController.composition}get activeScenes(){return this._drawController.activeScenes}set paused(i){i!==this._paused&&(this._paused=i,this.requestUpdate(),this.dispatchEvent(new CustomEvent(i?"pause":"play")))}get paused(){return this._paused}set playbackRate(i){i!==this._playbackRate&&(this._playbackRate=i,Object.values(this.media).forEach(({node:e,speed:t})=>{e.playbackRate=sr(.1,i*t,4)}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:i})))}get playbackRate(){return this._playbackRate}set volume(i){const e=sr(0,i,1);e!==this._volume&&(Object.values(this.media).forEach(({node:t,volume:r})=>{t.volume=e*r}),localStorage.setItem("vmp-player-volume/v2",e.toString()),this._volume=e,e>0&&(this.muted=!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:i})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume/v2")??"1"))}set muted(i){Object.values(this.media).forEach(({node:e,volume:t})=>{e.muted=t===0||i}),i!==this._muted&&(this._muted=i,localStorage.setItem("vmp-player-muted/v2",i.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:i?0:this.volume})))}get muted(){return this._muted??(this._muted=this.autoplay||localStorage.getItem("vmp-player-muted/v2")==="true")}get _hlsLevels(){for(const i of Object.values(this.media))if(i.hls&&i.hls.levels.length>0){const e=new Map;for(const t of i.hls.levels){const r=Math.min(t.height,t.width),n=e.get(r);(!n||(t.bitrate??0)>(n.bitrate??0))&&e.set(r,t)}return[...e.values()]}return[]}get _currentLevel(){return this._videoResolution===-1?-1:this._hlsLevels.findIndex(i=>Math.min(i.height,i.width)===this._videoResolution)}set videoResolution(i){var e;i!==this._videoResolution&&(this._videoResolution=i,Object.values(this.media).forEach(({hls:t})=>{if(t)if(i===-1)t.nextLevel=-1;else{const r=t.levels.reduce((n,s,o)=>Math.min(s.height,s.width)!==i?n:n===-1||(s.bitrate??0)>(t.levels[n].bitrate??0)?o:n,-1);r!==-1&&(t.nextLevel=r,t.autoLevelCapping=r)}}),i===-1&&((e=this.shadowRoot)!=null&&e.host)&&this._updateHlsLevelCap(this.shadowRoot.host.clientWidth,this.shadowRoot.host.clientHeight),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(i){i!==this._drawController.currentTime&&(this._drawController.currentTime=i,this._sceneController.setMediaCurrentTime(i))}get currentTime(){return this._drawController.currentTime}_updateHlsLevelCap(i,e,t=!1){if(i<=0||e<=0||this._videoResolution!==-1)return;const r=window.devicePixelRatio||1,n=Math.min(i,e)*r;Object.values(this.media).forEach(({hls:s})=>{if(s&&s.levels.length>0){let o=0;for(let a=s.levels.length-1;a>=0;a--)if(Math.min(s.levels[a].width,s.levels[a].height)<=n){o=a;break}s.autoLevelCapping=o,t&&(s.nextLevel=o)}})}reset(i=0,e=!1){this._lastTimestamp=null,this._lastCurrentTime=null,this._drawController.currentTime=i,this._sceneController.setMediaCurrentTime(i),e?this.play():this.pause()}clear(){this._drawController.clear()}play(){this.paused=!1,this._lastTimestamp=null,this._lastCurrentTime=null,this.duration>0&&this._drawController.currentTime>=this.duration&&this.reset(0,!0),this._loop()}pause(){this._endLoop(),this.paused=!0,Object.values(this.media).forEach(({node:i})=>{i.pause()})}draw(i){return this._drawController.draw(i)}toggleFullscreen(i){i??this.fullscreen?tQ():this._playerRef.value&&eQ(this._playerRef.value)}connectedCallback(){var i;super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("webkitfullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),(i=this.shadowRoot)!=null&&i.host&&(this._observer=new ResizeObserver(this._handleContainerResize),this._observer.observe(this.shadowRoot.host))}willUpdate(i){i.has("propAspectRatio")&&(this._aspectRatio=this.propAspectRatio),i.has("propLanguage")&&(this._language=this.propLanguage)}updated(i){var e;i.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize(),this.autoplay&&!this._sceneController.hasPlayed&&!this.processing&&i.get("_processing")&&this.play(),i.has("_processing")&&this.processing&&this.dispatchEvent(new CustomEvent("processing")),i.has("_processing")&&!this.processing&&i.get("_processing")&&(e=this.shadowRoot)!=null&&e.host&&this._updateHlsLevelCap(this.shadowRoot.host.clientWidth,this.shadowRoot.host.clientHeight)}disconnectedCallback(){var i,e;super.disconnectedCallback(),(i=this._observer)==null||i.disconnect(),(e=this.composition)==null||e.cleanup(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?Te`
|
|
3781
3781
|
<style>
|
|
3782
3782
|
:host {
|
|
3783
3783
|
aspect-ratio: ${this.propAspectRatio};
|