@vouchfor/embeds 5.0.0 → 5.0.1
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 +1 -1
- package/dist/iife/dialog-embed/embed.iife.js.map +1 -1
- package/dist/iife/embeds.iife.js +1 -1
- package/dist/iife/embeds.iife.js.map +1 -1
- package/dist/iife/player-embed/embed.iife.js +1 -1
- package/dist/iife/player-embed/embed.iife.js.map +1 -1
- package/package.json +4 -4
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 Ih=Fa(dv);var vh;function fv(r){if(typeof r=="string"){const[e,t]=r.split(":");return Math.min(parseFloat(e),parseFloat(t))}return r}function gv(r){if(typeof r=="string"){const[e,t]=r.split(":"),i=parseFloat(e),n=parseFloat(t);return i/n}return r}function dl({resolution:r,aspectRatio:e}){const t=fv(r),i=gv(e),n=i>=1,s=Math.min(n?t*i:t/i,t),o=Math.max(n?t*i:t/i,t);return{resolution:t,aspectRatio:i,height:n?s:o,width:n?o:s}}const yh={linear:xm,easeIn:ka,easeInOut:_m,easeOut:Qm,circIn:gu,circInOut:wm,circOut:pu,backIn:Ma,backInOut:Dm,backOut:Rm,anticipate:Lm,bounceIn:Pm,bounceInOut:Nm,bounceOut:Ms};ws((r,e,{clamp:t=!0,ease:i="easeIn",...n}={})=>ym(r,e,{...n,clamp:t,ease:yh[i]}),{cacheKey:([r,e,t])=>JSON.stringify({from:r,to:e,options:t})});function pv({animation:r,sceneTime:e}){const t=r.keyframes;if(!t||t.length===0)return null;const i=[...t].sort((s,o)=>s.time-o.time);if(e<=i[0].time)return r.renderer.processor.getTargetState(i[0].value);const n=i[i.length-1];if(e>=n.time)return r.renderer.processor.getTargetState(n.value);for(let s=0;s<i.length-1;s++){const o=i[s],a=i[s+1];if(e>=o.time&&e<=a.time){const l=a.time-o.time,A=l===0?0:(e-o.time)/l,u=o.easing||"linear",c=r.renderer.processor.getTargetState(o.value);return r.renderer.processor.interpolateState({easing:u,progress:A,from:c,value:a.value})}}return r.renderer.processor.getTargetState(i[0].value)}function mv({sceneTime:r,animations:e}){let t={};if(!e)return t;for(const i of Object.values(e)){const n=pv({animation:i,sceneTime:r});n&&(t={...t,...n})}return t}let io;const Ev=new Uint8Array(16);function Iv(){if(!io&&(io=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!io))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return io(Ev)}const _t=[];for(let r=0;r<256;++r)_t.push((r+256).toString(16).slice(1));function vv(r,e=0){return _t[r[e+0]]+_t[r[e+1]]+_t[r[e+2]]+_t[r[e+3]]+"-"+_t[r[e+4]]+_t[r[e+5]]+"-"+_t[r[e+6]]+_t[r[e+7]]+"-"+_t[r[e+8]]+_t[r[e+9]]+"-"+_t[r[e+10]]+_t[r[e+11]]+_t[r[e+12]]+_t[r[e+13]]+_t[r[e+14]]+_t[r[e+15]]}const Ch={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function yv(r,e,t){if(Ch.randomUUID&&!r)return Ch.randomUUID();r=r||{};const i=r.random||(r.rng||Iv)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,vv(i)}function Cv(r=.4,e=.4){const t=Math.max(.1,Math.min(.8,r)),i=Math.max(.2,Math.min(.6,e)),s=(1-t)/2,a=1-i;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 ro=64;function Bv(){const r=[],e={x:.5,y:.5},t=.5;for(let i=0;i<ro;i++){const n=i/ro*2*Math.PI,s=e.x+t*Math.cos(n),o=e.y+t*Math.sin(n);r.push({x:s,y:o})}return r}function Tv(r=1){const e=[],t={x:.5,y:.5};let i,n;r>=1?(i=.5,n=.5/r):(i=.5*r,n=.5);for(let s=0;s<ro;s++){const o=s/ro*2*Math.PI,a=t.x+i*Math.cos(o),l=t.y+n*Math.sin(o);e.push({x:a,y:l})}return e}function bv(){const r=[];for(let t=0;t<=100;t++){const i=t/100*2*Math.PI,n=16*Math.sin(i)**3,s=-(13*Math.cos(i)-5*Math.cos(2*i)-2*Math.cos(3*i)-Math.cos(4*i)),o=(n+16)/32,a=(s+13)/26;r.push({x:o,y:a})}return r}function Bh(r=0,e=1){if(r===0)return[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1}];const t=r*Math.PI/180,i=Math.tan(t)/e;return[{x:Math.max(0,Math.min(1,0+i)),y:0},{x:Math.max(0,Math.min(1,1+i)),y:0},{x:Math.max(0,Math.min(1,1-i)),y:1},{x:Math.max(0,Math.min(1,0-i)),y:1}]}function no(r){if(r<3)throw new Error("A polygon must have at least 3 sides");const e=[],t=[];for(let A=0;A<r;A++){const u=A*2*Math.PI/r-Math.PI/2,c=Math.cos(u),h=Math.sin(u);t.push({x:c,y:h})}const i=Math.min(...t.map(A=>A.x)),n=Math.max(...t.map(A=>A.x)),s=Math.min(...t.map(A=>A.y)),o=Math.max(...t.map(A=>A.y)),a=n-i,l=o-s;for(const A of t){const u=(A.x-i)/a,c=(A.y-s)/l;e.push({x:u,y:c})}return e}function Th(r=90){const e=r*Math.PI/180,i=.5/Math.tan(e),s=1/(1+Math.abs(i)*2),o=i*s;return[{x:.5+o,y:0},{x:1,y:.5},{x:.5-o,y:1},{x:0,y:.5}]}function Sv(r=5,e=.4){const t=[];for(let n=0;n<r*2;n++){const s=n*Math.PI/r-Math.PI/2,o=n%2===0?.5:e,a=.5+o*Math.cos(s),l=.5+o*Math.sin(s);t.push({x:a,y:l})}return t}function xv(r="isosceles",e={}){switch(r){case"equilateral":return Qv();case"isosceles":return bh(e.baseAngle??60);case"right":return _v(e.rightAnglePosition??"bottom-left");case"scalene":return wv(e.angles??[60,60,60])}}function Qv(){return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}]}function bh(r){const e=r*Math.PI/180,t=.5/Math.tan(e),i=Math.max(.1,Math.min(2,t));return[{x:.5,y:1-Math.min(1,i)},{x:0,y:1},{x:1,y:1}]}function _v(r){switch(r){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 wv(r){return bh(r[0])}function Rv(r={},e=1){const{type:t="rectangle",customPolygon:i,parallelogram:n,triangle:s,rhombus:o,arrow:a,star:l,regularPolygon:A}=r;switch(t){case"rectangle":return Bh(0,e);case"parallelogram":return Bh((n==null?void 0:n.angle)??30,e);case"triangle":return xv((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 Th((o==null?void 0:o.angle)??90);case"diamond":return Th(90);case"pentagon":return no(5);case"hexagon":return no(6);case"octagon":return no(8);case"star":return Sv((l==null?void 0:l.points)??5,(l==null?void 0:l.innerRadius)??.4);case"arrow":return Cv((a==null?void 0:a.shaftRatio)??.4,(a==null?void 0:a.headRatio)??.4);case"heart":return bv();case"circle":return Bv();case"ellipse":return Tv(e);case"custom-polygon":if(!(i!=null&&i.points)||i.points.length<3)throw new Error("Custom polygon must have at least 3 points");return i.points;default:return no((A==null?void 0:A.sides)??6)}}function Dv(r,e){let t=!1;const i=r.x,n=r.y;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s].x,l=e[s].y,A=e[o].x,u=e[o].y;l>n!=u>n&&i<(A-a)*(n-l)/(u-l)+a&&(t=!t)}return t}function Lv(r,e){let t=1,i=0;const n=200;for(let s=0;s<=n;s++){const o=s/n;Dv({x:o,y:r},e)&&(t=Math.min(t,o),i=Math.max(i,o))}return i>=t?{left:t,right:i}:null}function kv(r){const e=Math.min(...r.map(l=>l.y)),t=Math.max(...r.map(l=>l.y));let i={x:0,y:0,width:0,height:0},n=0;const s=200,o=(t-e)/s,a=[];for(let l=0;l<=s;l++){const A=e+l*o;a.push({y:A,span:Lv(A,r)})}for(let l=0;l<a.length-1;l++){const A=a[l].y;for(let u=l+1;u<a.length;u++){const h=a[u].y-A;let d=0,f=1,g=!0;const p=Math.min(5,u-l+1);for(let v=0;v<p;v++){const B=l+Math.floor(v/(p-1)*(u-l)),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,i={x:d,y:A,width:v,height:h})}}}return i}function Mv(r,e=1){const t=Rv(r,e);if(t.length<3)return{top:0,right:0,bottom:0,left:0};if(r.type==="rectangle")return{top:0,right:0,bottom:0,left:0};const i=kv(t),n=i.y,s=i.x,o=1-(i.x+i.width),a=1-(i.y+i.height);return{top:Math.max(0,n),right:Math.max(0,o),bottom:Math.max(0,a),left:Math.max(0,s)}}function Fv(r){return typeof r=="number"?{topLeft:r,topRight:r,bottomRight:r,bottomLeft:r}:{topLeft:(r==null?void 0:r.topLeft)??0,topRight:(r==null?void 0:r.topRight)??0,bottomRight:(r==null?void 0:r.bottomRight)??0,bottomLeft:(r==null?void 0:r.bottomLeft)??0}}function Pv(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:typeof r=="string"?{top:r,right:r,bottom:r,left:r}:{top:typeof r.top=="number"?r.top*e:r.top,right:typeof r.right=="number"?r.right*e:r.right,bottom:typeof r.bottom=="number"?r.bottom*e:r.bottom,left:typeof r.left=="number"?r.left*e:r.left}}function Nv(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:typeof r=="string"?{top:r,right:r,bottom:r,left:r}:{top:(typeof r.top=="number"?r.top*e:r.top)??0,right:(typeof r.right=="number"?r.right*e:r.right)??0,bottom:(typeof r.bottom=="number"?r.bottom*e:r.bottom)??0,left:(typeof r.left=="number"?r.left*e:r.left)??0}}function Ov(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:typeof r=="string"?{top:r,right:r,bottom:r,left:r}:{top:(typeof r.top=="number"?r.top*e:r.top)??0,right:(typeof r.right=="number"?r.right*e:r.right)??0,bottom:(typeof r.bottom=="number"?r.bottom*e:r.bottom)??0,left:(typeof r.left=="number"?r.left*e:r.left)??0}}function Uv(r){if(r===null||typeof r!="object")return!1;if(Object.getPrototypeOf(r)===null)return!0;let e=r;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e}function Gv(r){return r.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}const $v=Ji(()=>mu.loadYoga());function Sh(r,e,{layout:t,scale:i=1}){const{position:n="relative",inset:s,width:o,height:a,minWidth:l,minHeight:A,maxWidth:u,maxHeight:c,flex:h,flexGrow:d,flexShrink:f,gap:g,margin:p,padding:v,direction:B="column",align:C="start",alignSelf:y,justify:x="start"}=t??{},w={static:r.POSITION_TYPE_STATIC,relative:r.POSITION_TYPE_RELATIVE,absolute:r.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(w[n]),typeof s<"u"){const{top:D,right:X,bottom:j,left:oe}=Pv(s,i);typeof D<"u"&&e.setPosition(r.EDGE_TOP,D),typeof X<"u"&&e.setPosition(r.EDGE_RIGHT,X),typeof j<"u"&&e.setPosition(r.EDGE_BOTTOM,j),typeof oe<"u"&&e.setPosition(r.EDGE_LEFT,oe)}const L={row:r.FLEX_DIRECTION_ROW,column:r.FLEX_DIRECTION_COLUMN,"row-reverse":r.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":r.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(L[B]);const F={start:r.ALIGN_FLEX_START,end:r.ALIGN_FLEX_END,center:r.ALIGN_CENTER,stretch:r.ALIGN_STRETCH};e.setAlignItems(F[C]),y&&e.setAlignSelf(F[y]);const O={start:r.JUSTIFY_FLEX_START,end:r.JUSTIFY_FLEX_END,center:r.JUSTIFY_CENTER,"space-between":r.JUSTIFY_SPACE_BETWEEN,"space-around":r.JUSTIFY_SPACE_AROUND,"space-evenly":r.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(O[x]),typeof p<"u"){const{top:D,right:X,bottom:j,left:oe}=Nv(p,i);e.setMargin(r.EDGE_TOP,D),e.setMargin(r.EDGE_RIGHT,X),e.setMargin(r.EDGE_BOTTOM,j),e.setMargin(r.EDGE_LEFT,oe)}if(typeof v<"u"){const{top:D,right:X,bottom:j,left:oe}=Ov(v,i);e.setPadding(r.EDGE_TOP,D),e.setPadding(r.EDGE_RIGHT,X),e.setPadding(r.EDGE_BOTTOM,j),e.setPadding(r.EDGE_LEFT,oe)}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(r.GUTTER_ALL,(g??0)*i),typeof o<"u"&&e.setWidth(typeof o=="number"?o*i:o),typeof a<"u"&&e.setHeight(typeof a=="number"?a*i:a),typeof l<"u"&&e.setMinWidth(typeof l=="number"?l*i:l),typeof A<"u"&&e.setMinHeight(typeof A=="number"?A*i:A),typeof u<"u"&&e.setMaxWidth(typeof u=="number"?u*i:u),typeof c<"u"&&e.setMaxHeight(typeof c=="number"?c*i:c)}async function xh({id:r,yoga:e,index:t,parent:i,element:n,resolvers:s}){var o,a,l;const{layout:A={},config:u={},options:c={},renderer:h}=n,d=e.Node.create();Sh(e,d,{layout:A}),i.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:r,config:u,options:c}))??null:f=await((a=s[h.type])==null?void 0:a.call(s,{id:r,config:u,options:c}))??null);const g=[];for await(const[p,v]of((l=n.children)==null?void 0:l.entries())??[])g.push(await xh({id:r,yoga:e,index:p,parent:d,element:v,resolvers:s}));return{node:d,radius:Fv(A.radius),element:n,renderer:h,config:u,options:c,dependencies:f,childNodes:g}}function Qh(r,e,t=0,i=0){const{top:n,left:s}=r.getComputedLayout(),{top:o,left:a,width:l,height:A}=e.node.getComputedLayout(),u=t+a,c=i+o,h=e.childNodes.map(d=>Qh(r,d,u,c));return{...e,x:s+u,y:n+c,width:l,height:A,childNodes:h}}async function fl({yoga:r,root:e,tree:t,measureCanvas:i}){for await(const{node:n,options:s,dependencies:o,renderer:a,childNodes:l}of t){if(a){const{width:A,height:u}=a;if(A&&i){e.calculateLayout();const c=await A({node:n,options:s,dependencies:o,measureCanvas:i});c&&n.setWidth(c)}if(u&&i){e.calculateLayout();const c=await u({node:n,options:s,dependencies:o,measureCanvas:i});c&&n.setHeight(c)}if(await fl({yoga:r,root:e,tree:l,measureCanvas:i}),s!=null&&s.shape){const c=n.getComputedWidth(),h=n.getComputedHeight(),d=Mv(s.shape,c/h);n.setPadding(r.EDGE_TOP,d.top*c),n.setPadding(r.EDGE_RIGHT,d.right*c),n.setPadding(r.EDGE_BOTTOM,d.bottom*h),n.setPadding(r.EDGE_LEFT,d.left*c)}}e.calculateLayout(),await fl({yoga:r,root:e,tree:l,measureCanvas:i})}}async function _h({id:r,root:e,resolvers:t,measureCanvas:i}){const n=await $v(),s=n.Node.create();Sh(n,s,{layout:e.layout});const o=await xh({id:r,yoga:n,index:0,parent:s,element:e.element,resolvers:t});await fl({yoga:n,root:s,tree:[o],measureCanvas:i});const{top:a,left:l,width:A,height:u}=s.getComputedLayout(),c={root:{x:l,y:a,width:A,height:u},node:Qh(s,o)};return s.freeRecursive(),c}const Hv={type:"audio"},Nn=/(?<value>\d+\.?\d*)(?=px)/;function gl({words:r,spaceMetrics:e,strokeWidth:t=0}){return r.reduce((i,n,s)=>{const o=n.metrics.width+t,a=s<r.length-1?e.width:0;return i+o+a},0)}ws(({context:r,font:e,fontSizes:t,words:i,maxW:n=1/0,strokeWidth:s=0,letterSpacing:o=0})=>{try{r.save(),r.letterSpacing=`${o}px`,r.font=e.replace(Nn,t[0].toString());const a=r.measureText("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");if(i.length<=0)return[];const l=r.measureText(i[0].text);return i.slice(1).reduce((A,u)=>{const c=A[A.length-1],h=r.measureText(u.text),d={...u,metrics:h},f=[...c.words,d],g=gl({strokeWidth:s,words:f,spaceMetrics:c.spaceMetrics});if(g>n){const p=t[A.length%t.length];r.font=e.replace(Nn,p.toString());const v=r.measureText(" "),B=r.measureText(u.text),C=[{...u,metrics:B}],y=r.measureText("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");A=[...A,{allMetrics:y,spaceMetrics:v,lineWidth:gl({strokeWidth:s,spaceMetrics:v,words:C}),font:r.font,words:C,lineHeight:y.actualBoundingBoxAscent+y.actualBoundingBoxDescent+s}]}else A[A.length-1]={...c,lineWidth:g,words:f};return A},[{allMetrics:a,lineWidth:gl({strokeWidth:s,words:[{...i[0],metrics:l}],spaceMetrics:r.measureText(" ")}),lineHeight:a.actualBoundingBoxAscent+a.actualBoundingBoxDescent+s,font:r.font,words:[{...i[0],metrics:l}],spaceMetrics:r.measureText(" ")}])}finally{r.restore()}},{cacheKey:([{font:r,fontSizes:e,words:t,maxW:i,strokeWidth:n,letterSpacing:s}])=>`${r}_${JSON.stringify(e)}_${JSON.stringify(t)}_${i}_${n}_${s}`});function Yv(r){return r.slice(0,1).toUpperCase()+r.slice(1)}const wh=[{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 Vv({text:r,font:e}){let t=e;return wh.forEach(({family:i,regex:n})=>{n.exec(r)&&(t+=`, ${i}`)}),t}const Kv="caption";Object.keys(yh).map(r=>({label:Yv(r),value:r,data:r}));const Wv={type:Kv},qv={type:"image"};function Rh({context:r,word:e,maxW:t=1/0}){const i=[],n=r.measureText(e);if(Math.floor(n.width)<=t)return[{text:e,metrics:n}];for(let s=0;s<e.length;s++){const o=i[i.length-1],a=((o==null?void 0:o.text)??"")+e[s],l=r.measureText(a);l.width<t?i[o?i.length-1:0]={text:a,metrics:l}:i.push({text:e[s],metrics:r.measureText(e[s])})}return i}const Jv=ws(({font:r,context:e,fontSizes:t,text:i,maxW:n=1/0,letterSpacing:s=0})=>{try{return e.save(),e.letterSpacing=`${s}px`,e.font=r.replace(Nn,t[0].toString()),i.split(`
|
2476
|
-
`).flatMap(a=>{const l=a.split(" ").filter(Boolean);return l.length?l.slice(1).reduce((A,u,c)=>{const d=`${A[A.length-1].text} ${u}`.trim(),f=e.measureText(d);if(f.width>n)A=[...A,...Rh({context:e,word:u,maxW:n})];else{const g=t[c%t.length];e.font=r.replace(Nn,g.toString()),A[A.length-1]={text:d,metrics:f}}return A},Rh({context:e,word:l[0],maxW:n})):{text:"",metrics:e.measureText("")}})}finally{e.restore()}},{cacheKey:([{font:r,fontSizes:e,text:t,maxW:i,letterSpacing:n}])=>`${r}_${JSON.stringify(e)}_${t}_${i}_${n}`});ws(({font:r,text:e,scale:t,context:i,maxW:n,maxH:s,minSize:o,maxSize:a,letterSpacing:l=0})=>{var A,u;let c=0;if(a){c=(o??0)*t;let d=0;for(;a*t>c+1;){c+=1;const f=Jv({font:r,context:i,fontSizes:[c],text:e,maxW:n,letterSpacing:l});if(d=f.reduce((g,p)=>(p.metrics.width>g&&(g=p.metrics.width),g),0),d>n||f.length*c>s){c-=1;break}}}else c=parseFloat(((u=(A=r.match(Nn))==null?void 0:A.groups)==null?void 0:u.value)??"0")*t;return c},{cacheKey:([{font:r,text:e,scale:t,maxW:i,maxH:n,minSize:s,maxSize:o,letterSpacing:a}])=>`${r}_${e}_${s}_${o}_${t}_${i}_${n}_${a}`});const jv={type:"text"},Xv={type:"video"};function Dh(){return document.createElement("canvas")}function zv(r,e){return Object.keys(r).reduce((t,i)=>(e.includes(i)||(t[i]=r[i]),t),{})}function qt(r){let e=0;for(const t of r)Array.isArray(t)?e+=qt(t):e+=t;return e}function so(r){return r.map(({type:e,duration:t},i)=>{var n,s,o,a;if(e==="transition"){const l=((n=r[i-2])==null?void 0:n.type)==="transition"?r[i-2]:null,A=((s=r[i-1])==null?void 0:s.duration)??1/0,u=((o=r[i+1])==null?void 0:o.duration)??1/0,c=((a=r[i+2])==null?void 0:a.type)==="transition"?r[i+2]:null;return Math.min(l?A/2:A,t,c?u/2:u)*-1}return t})}function Lh(r){var e;return{...r,children:((e=r.children)==null?void 0:e.map(t=>{if(!t.renderer)return Lh(t)}).filter(Boolean))??[]}}function kh(r){const e={box:0,shape:0,image:0,video:0,text:0,audio:0,gradient:0,caption:0};r.renderer&&(e[r.renderer.type]+=1);for(const t of r.children??[]){const{box:i,shape:n,image:s,video:o,text:a,audio:l,gradient:A,caption:u}=kh(t);e.box+=i,e.shape+=n,e.image+=s,e.video+=o,e.text+=a,e.audio+=l,e.gradient+=A,e.caption+=u}return e}function Zv(r){return r.video>0?Xv.type:r.image>0?qv.type:r.audio>0?Hv.type:r.caption>0?Wv.type:jv.type}function Mh({node:r,duration:e,parentAnimations:t}){const i=[],n={...t,...r.element.animations};if(r.renderer){const s=Lh({...r.element,layout:{...r.element.layout?zv(r.element.layout,["maxWidth","maxHeight"]):{},width:"100%",height:"100%",margin:0}}),o=kh(s);i.push({type:Zv(o),id:yv(),x:r.x,y:r.y,width:r.width,height:r.height,duration:e,root:{element:s}})}for(const s of r.childNodes)i.push(...Mh({node:s,duration:e,parentAnimations:n}));return i}Om.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${Gv(r)}"`:Uv(r)||Array.isArray(r)?JSON.stringify(r):r);const ey="3";async function ty({scene:r,start:e=0}){const{id:t,root:i,duration:n}=r,s=await _h({id:t,root:i});return{type:r.type,start:e,duration:n,layout:s,id:r.id,config:r}}async function iy({track:r}){const e=so(r),t=await Promise.all(r.reduce((s,o,a)=>{if(o.type!=="audio")return s;const l=qt(e.slice(0,a));return s.push(ty({scene:o,start:l})),s},[])),i=r.reduce((s,o,a)=>{if(o.type!=="gap")return s;const l=qt(e.slice(0,a));return s.push({type:o.type,id:o.id,start:l,config:o,duration:o.duration}),s},[]),n=r.map(({id:s})=>t.find(({id:o})=>o===s)??i.find(({id:o})=>o===s)).filter(Boolean);return{type:"audio",scenes:t,gapScenes:i,mergedScenes:n,config:r,duration:Math.max(...n.map(({start:s,duration:o})=>s+o))}}async function Fh({node:r,canvases:e,sceneTime:t,parentOpacity:i=1,parentTransform:n,debug:s=!1}){var o,a,l,A,u,c,h,d,f,g,p,v,B,C,y,x,w,L,F,O;const D=e.sceneCanvas.getContext("2d");if(D){D.save(),D.setTransform(n);const X=mv({sceneTime:t,animations:r.element.animations});let{opacity:j,translation:oe,scale:ae,clip:k,dimensions:U,rotation:K}=X;typeof j>"u"&&(j=((a=(o=r.element.layout)==null?void 0:o.transform)==null?void 0:a.opacity)??1),typeof oe>"u"&&(oe={x:((u=(A=(l=r.element.layout)==null?void 0:l.transform)==null?void 0:A.translate)==null?void 0:u.x)??0,y:((d=(h=(c=r.element.layout)==null?void 0:c.transform)==null?void 0:h.translate)==null?void 0:d.y)??0}),typeof ae>"u"&&(ae=((g=(f=r.element.layout)==null?void 0:f.transform)==null?void 0:g.scale)??1),typeof k>"u"&&(k=null),typeof U>"u"&&(U={widthRatio:((B=(v=(p=r.element.layout)==null?void 0:p.transform)==null?void 0:v.dimension)==null?void 0:B.widthRatio)??1,heightRatio:((x=(y=(C=r.element.layout)==null?void 0:C.transform)==null?void 0:y.dimension)==null?void 0:x.heightRatio)??1}),typeof K>"u"&&(K=((L=(w=r.element.layout)==null?void 0:w.transform)==null?void 0:L.rotation)??0);const R=r.width*U.widthRatio,_=r.height*U.heightRatio;if(D.globalAlpha=j*i,(oe.x||oe.y)&&D.translate(oe.x,oe.y),(ae!==1||K!==0)&&(D.translate(r.x+R/2,r.y+_/2),D.scale(ae,ae),D.rotate(K*Math.PI/180),D.translate(-(r.x+R/2),-(r.y+_/2))),k){D.beginPath();const M={x:r.x+k.x*R,y:r.y+k.y*_,width:k.width*R,height:k.height*_};D.rect(M.x,M.y,M.width,M.height),D.clip()}if(s){const M=D.globalAlpha;D.globalAlpha=1,D.strokeStyle="red",D.strokeRect(r.x,r.y,R,_),D.globalAlpha=M}await((O=(F=r.renderer)==null?void 0:F.render)==null?void 0:O.call(F,{canvases:e,sceneTime:t,dx:r.x,dy:r.y,dw:R,dh:_,radius:r.radius,options:r.options,dependencies:r.dependencies}));for await(const M of r.childNodes)await Fh({debug:s,node:M,canvases:e,sceneTime:t,parentOpacity:D.globalAlpha,parentTransform:D.getTransform()});D.restore()}}async function ry({layout:r,canvases:e,sceneTime:t,debug:i=!1}){const{node:n}=r;await Fh({debug:i,node:n,canvases:e,sceneTime:t})}async function oo({debug:r=!1,scene:e,start:t=0,resolvers:i,rootWidth:n,rootHeight:s,canvasFactory:o=Dh}){var a,l;const{id:A,x:u,y:c,width:h,height:d,root:f,duration:g}=e,p=o(),v=o(),B=o(),C=o(),y=o(),x=await _h({id:A,root:{...f,layout:{...f.layout,width:n,height:s},element:{...f.element,layout:{...f.element.layout,...typeof u=="number"&&typeof c=="number"?{position:"absolute",inset:{top:c,left:u}}:{},width:h??((a=f.element.layout)==null?void 0:a.width),height:d??((l=f.element.layout)==null?void 0:l.height)}}},resolvers:i,measureCanvas:y}),w=async L=>{const F=Math.max(0,L-t);p.width=p.height=0,p.width=n,p.height=s,await ry({debug:r,layout:x,sceneTime:F,canvases:{sceneCanvas:p,cropCanvas:v,letterboxCanvas:B,posterCanvas:C}})};return{id:A,type:e.type,start:t,duration:g,layout:x,sceneCanvas:p,draw:w,config:e,childScenes:Mh({node:x.node,duration:g})}}async function ny({debug:r=!1,track:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}){const o=so(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=qt(o.slice(0,d));return h.type==="caption"&&c.push(oo({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),c},[])),l=e.reduce((c,h,d)=>{if(h.type!=="gap")return c;const f=qt(o.slice(0,d));return c.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),c},[]),A=e.reduce((c,h,d)=>{if(h.type!=="transition")return c;const f=h.duration,g=qt(o.slice(0,d))-f;return c.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)})}),c},[]),u=e.map(({id:c})=>a.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)??A.find(({id:h})=>h===c)).filter(Boolean);return{type:"caption",scenes:a,gapScenes:l,transitions:A,mergedScenes:u,duration:Math.max(...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}async function sy({debug:r=!1,track:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}){const o=so(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=qt(o.slice(0,d));return h.type==="video"&&c.push(oo({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),h.type==="image"&&c.push(oo({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),c},[])),l=e.reduce((c,h,d)=>{if(h.type!=="gap")return c;const f=qt(o.slice(0,d));return c.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),c},[]),A=e.reduce((c,h,d)=>{if(h.type!=="transition")return c;const f=h.duration,g=qt(o.slice(0,d))-f;return c.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)})}),c},[]),u=e.map(({id:c})=>a.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)??A.find(({id:h})=>h===c)).filter(Boolean);return{type:"picture",scenes:a,gapScenes:l,transitions:A,mergedScenes:u,duration:Math.max(0,...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}async function oy({debug:r=!1,track:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}){const o=so(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=qt(o.slice(0,d));return h.type==="text"&&c.push(oo({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),c},[])),l=e.reduce((c,h,d)=>{if(h.type!=="gap")return c;const f=qt(o.slice(0,d));return c.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),c},[]),A=e.reduce((c,h,d)=>{if(h.type!=="transition")return c;const f=h.duration,g=qt(o.slice(0,d))-f;return c.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)})}),c},[]),u=e.map(({id:c})=>a.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)??A.find(({id:h})=>h===c)).filter(Boolean);return{type:"text",scenes:a,gapScenes:l,transitions:A,mergedScenes:u,duration:Math.max(...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}function ay(r){return r.some(({type:e})=>e==="text")}function ly(r){return r.some(({type:e})=>e==="caption")}function Ay(r){return r.some(({type:e})=>e==="audio")}function cy(r){return r.some(({type:e})=>e==="video"||e==="image")}function uy(r){return r.type==="audio"}const hy=(((vh=Ih)==null?void 0:vh.default)??Ih).reduce((r,e)=>(r[e.name]=e,r),{});function dy(r,e){return r.has(e)||r.set(e,{buffer:null,transitions:{},fromTexture:null,toTexture:null}),r.get(e)}function fy({name:r,to:e,from:t,progress:i,width:n,height:s,glContext:o,contextResources:a,returnPixels:l=!0}){var A,u,c;const h=dy(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=(((A=zs)==null?void 0:A.default)??zs)(o,t),h.fromTexture.minFilter=o.LINEAR,h.fromTexture.magFilter=o.LINEAR),h.toTexture?h.toTexture.setPixels(e):(h.toTexture=(((u=zs)==null?void 0:u.default)??zs)(o,e),h.toTexture.minFilter=o.LINEAR,h.toTexture.magFilter=o.LINEAR),h.transitions[r]||(h.transitions[r]=(((c=Eh)==null?void 0:c.default)??Eh)(o,hy[r])),h.transitions[r].draw(i,h.fromTexture,h.toTexture,n,s),!l)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 gy(r){for(const[e,t]of r.entries())t.buffer&&e.deleteBuffer(t.buffer),t.fromTexture&&t.fromTexture.dispose(),t.toTexture&&t.toTexture.dispose(),Object.values(t.transitions).forEach(i=>{i.dispose()}),r.delete(e)}function py({name:r,to:e,from:t,progress:i,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),fy({name:r,to:e,from:t,progress:i,width:n.width,height:n.height,glContext:o,contextResources:s,returnPixels:!1}))}async function Ph({debug:r=!1,config:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s=Dh,drawTransition:o=py}){const a=new Map,l=await Promise.all(e.tracks.map(async c=>{if(cy(c))return{...await sy({debug:r,track:c,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}),config:c};if(ay(c))return{...await oy({debug:r,track:c,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}),config:c};if(ly(c))return{...await ny({debug:r,track:c,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}),config:c};if(Ay(c))return{...await iy({track:c}),config:c};throw new Error("Unknown track type")}));return{draw:async({canvas:c,currentTime:h})=>{const d=c.getContext("2d");if(d){d.globalAlpha=1,d.globalCompositeOperation="source-over",d.clearRect(0,0,c.width,c.height),d.save(),d.fillStyle="black",d.fillRect(0,0,c.width,c.height),d.restore();for await(const f of l){if(uy(f))continue;const{scenes:g,transitions:p,trackCanvas:v}=f;v.width=v.height=0,v.width=c.width,v.height=c.height;const B=v.getContext("2d"),C=g.filter(({start:x,duration:w})=>h>=x&&h<x+w);if(!B||C.length<=0)continue;const y=p.find(({start:x,duration:w})=>h>=x&&h<x+w);for await(const{sceneCanvas:x,draw:w}of C)await(w==null?void 0:w(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:w,from:L,duration:F,transitionCanvas:O}=y;O.width=O.height=0,O.width=v.width,O.height=v.height;const D=Math.min(1,Math.max(0,(h-w.start)/F));await o({name:x,progress:D,contextResources:a,to:w.sceneCanvas,from:L.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:()=>{gy(a)},tracks:l,aspectRatio:e.aspectRatio,duration:Math.max(...l.map(({duration:c})=>c))}}const my={version:"5.0.0"};function Ey(r){const{publicApiUrl:e}=_s(r),t=Ki();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function Iy(r){var s,o,a,l,A,u,c,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=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),i=(u=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:u.call(A,"vouch-uid-tab");const n=Ki();return e||(e=Ey(r),(h=(c=window.localStorage)==null?void 0:c.setItem)==null||h.call(c,"vouch-uid-visitor",e)),t||(t=Ki(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),i||(i=Ki(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",i)),{client:t,tab:i,request:n,visitor:e}}function vy(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function yy(r="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,"/"))??[],i={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const l=o.toLowerCase().replace(/[-_][a-z0-9]/g,A=>A.slice(-1).toUpperCase());i[l]=a}}),{source:r,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:my.version,templateVersion:ey,...i}}const Nh=1;class Cy{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const n=vy(i,this.host.vouch);!n||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,vouchId:n,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=_s(this.host.env),{client:i,tab:n,request:s,visitor:o}=Iy(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":n,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":yy(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Nh&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},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:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:n}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:i,node:n},this._streamLatestTime[i]=n.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=n.currentTime,this._streamLatestTime[i]=n.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+Nh&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},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,i,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),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,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),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var pl={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof qi<"u"&&qi,i=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||{},l={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 A(k){return k&&DataView.prototype.isPrototypeOf(k)}if(l.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(k){return k&&u.indexOf(Object.prototype.toString.call(k))>-1};function h(k){if(typeof k!="string"&&(k=String(k)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(k)||k==="")throw new TypeError('Invalid character in header field name: "'+k+'"');return k.toLowerCase()}function d(k){return typeof k!="string"&&(k=String(k)),k}function f(k){var U={next:function(){var K=k.shift();return{done:K===void 0,value:K}}};return l.iterable&&(U[Symbol.iterator]=function(){return U}),U}function g(k){this.map={},k instanceof g?k.forEach(function(U,K){this.append(K,U)},this):Array.isArray(k)?k.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):k&&Object.getOwnPropertyNames(k).forEach(function(U){this.append(U,k[U])},this)}g.prototype.append=function(k,U){k=h(k),U=d(U);var K=this.map[k];this.map[k]=K?K+", "+U:U},g.prototype.delete=function(k){delete this.map[h(k)]},g.prototype.get=function(k){return k=h(k),this.has(k)?this.map[k]:null},g.prototype.has=function(k){return this.map.hasOwnProperty(h(k))},g.prototype.set=function(k,U){this.map[h(k)]=d(U)},g.prototype.forEach=function(k,U){for(var K in this.map)this.map.hasOwnProperty(K)&&k.call(U,this.map[K],K,this)},g.prototype.keys=function(){var k=[];return this.forEach(function(U,K){k.push(K)}),f(k)},g.prototype.values=function(){var k=[];return this.forEach(function(U){k.push(U)}),f(k)},g.prototype.entries=function(){var k=[];return this.forEach(function(U,K){k.push([K,U])}),f(k)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(k){if(!k._noBody){if(k.bodyUsed)return Promise.reject(new TypeError("Already read"));k.bodyUsed=!0}}function v(k){return new Promise(function(U,K){k.onload=function(){U(k.result)},k.onerror=function(){K(k.error)}})}function B(k){var U=new FileReader,K=v(U);return U.readAsArrayBuffer(k),K}function C(k){var U=new FileReader,K=v(U),R=/charset=([A-Za-z0-9_-]+)/.exec(k.type),_=R?R[1]:"utf-8";return U.readAsText(k,_),K}function y(k){for(var U=new Uint8Array(k),K=new Array(U.length),R=0;R<U.length;R++)K[R]=String.fromCharCode(U[R]);return K.join("")}function x(k){if(k.slice)return k.slice(0);var U=new Uint8Array(k.byteLength);return U.set(new Uint8Array(k)),U.buffer}function w(){return this.bodyUsed=!1,this._initBody=function(k){this.bodyUsed=this.bodyUsed,this._bodyInit=k,k?typeof k=="string"?this._bodyText=k:l.blob&&Blob.prototype.isPrototypeOf(k)?this._bodyBlob=k:l.formData&&FormData.prototype.isPrototypeOf(k)?this._bodyFormData=k:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)?this._bodyText=k.toString():l.arrayBuffer&&l.blob&&A(k)?(this._bodyArrayBuffer=x(k.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(k)||c(k))?this._bodyArrayBuffer=x(k):this._bodyText=k=Object.prototype.toString.call(k):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof k=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var k=p(this);if(k)return k;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 k=p(this);return k||(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(l.blob)return this.blob().then(B);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var k=p(this);if(k)return k;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)},l.formData&&(this.formData=function(){return this.text().then(D)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(k){var U=k.toUpperCase();return L.indexOf(U)>-1?U:k}function O(k,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 K=U.body;if(k instanceof O){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url,this.credentials=k.credentials,U.headers||(this.headers=new g(k.headers)),this.method=k.method,this.mode=k.mode,this.signal=k.signal,!K&&k._bodyInit!=null&&(K=k._bodyInit,k.bodyUsed=!0)}else this.url=String(k);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 M=new AbortController;return M.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&K)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(K),(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 _=/\?/;this.url+=(_.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})};function D(k){var U=new FormData;return k.trim().split("&").forEach(function(K){if(K){var R=K.split("="),_=R.shift().replace(/\+/g," "),M=R.join("=").replace(/\+/g," ");U.append(decodeURIComponent(_),decodeURIComponent(M))}}),U}function X(k){var U=new g,K=k.replace(/\r?\n[\t ]+/g," ");return K.split("\r").map(function(R){return R.indexOf(`
|
2476
|
+
`).flatMap(a=>{const l=a.split(" ").filter(Boolean);return l.length?l.slice(1).reduce((A,u,c)=>{const d=`${A[A.length-1].text} ${u}`.trim(),f=e.measureText(d);if(f.width>n)A=[...A,...Rh({context:e,word:u,maxW:n})];else{const g=t[c%t.length];e.font=r.replace(Nn,g.toString()),A[A.length-1]={text:d,metrics:f}}return A},Rh({context:e,word:l[0],maxW:n})):{text:"",metrics:e.measureText("")}})}finally{e.restore()}},{cacheKey:([{font:r,fontSizes:e,text:t,maxW:i,letterSpacing:n}])=>`${r}_${JSON.stringify(e)}_${t}_${i}_${n}`});ws(({font:r,text:e,scale:t,context:i,maxW:n,maxH:s,minSize:o,maxSize:a,letterSpacing:l=0})=>{var A,u;let c=0;if(a){c=(o??0)*t;let d=0;for(;a*t>c+1;){c+=1;const f=Jv({font:r,context:i,fontSizes:[c],text:e,maxW:n,letterSpacing:l});if(d=f.reduce((g,p)=>(p.metrics.width>g&&(g=p.metrics.width),g),0),d>n||f.length*c>s){c-=1;break}}}else c=parseFloat(((u=(A=r.match(Nn))==null?void 0:A.groups)==null?void 0:u.value)??"0")*t;return c},{cacheKey:([{font:r,text:e,scale:t,maxW:i,maxH:n,minSize:s,maxSize:o,letterSpacing:a}])=>`${r}_${e}_${s}_${o}_${t}_${i}_${n}_${a}`});const jv={type:"text"},Xv={type:"video"};function Dh(){return document.createElement("canvas")}function zv(r,e){return Object.keys(r).reduce((t,i)=>(e.includes(i)||(t[i]=r[i]),t),{})}function qt(r){let e=0;for(const t of r)Array.isArray(t)?e+=qt(t):e+=t;return e}function so(r){return r.map(({type:e,duration:t},i)=>{var n,s,o,a;if(e==="transition"){const l=((n=r[i-2])==null?void 0:n.type)==="transition"?r[i-2]:null,A=((s=r[i-1])==null?void 0:s.duration)??1/0,u=((o=r[i+1])==null?void 0:o.duration)??1/0,c=((a=r[i+2])==null?void 0:a.type)==="transition"?r[i+2]:null;return Math.min(l?A/2:A,t,c?u/2:u)*-1}return t})}function Lh(r){var e;return{...r,children:((e=r.children)==null?void 0:e.map(t=>{if(!t.renderer)return Lh(t)}).filter(Boolean))??[]}}function kh(r){const e={box:0,shape:0,image:0,video:0,text:0,audio:0,gradient:0,caption:0};r.renderer&&(e[r.renderer.type]+=1);for(const t of r.children??[]){const{box:i,shape:n,image:s,video:o,text:a,audio:l,gradient:A,caption:u}=kh(t);e.box+=i,e.shape+=n,e.image+=s,e.video+=o,e.text+=a,e.audio+=l,e.gradient+=A,e.caption+=u}return e}function Zv(r){return r.video>0?Xv.type:r.image>0?qv.type:r.audio>0?Hv.type:r.caption>0?Wv.type:jv.type}function Mh({node:r,duration:e,parentAnimations:t}){const i=[],n={...t,...r.element.animations};if(r.renderer){const s=Lh({...r.element,layout:{...r.element.layout?zv(r.element.layout,["maxWidth","maxHeight"]):{},width:"100%",height:"100%",margin:0}}),o=kh(s);i.push({type:Zv(o),id:yv(),x:r.x,y:r.y,width:r.width,height:r.height,duration:e,root:{element:s}})}for(const s of r.childNodes)i.push(...Mh({node:s,duration:e,parentAnimations:n}));return i}Om.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${Gv(r)}"`:Uv(r)||Array.isArray(r)?JSON.stringify(r):r);const ey="3";async function ty({scene:r,start:e=0}){const{id:t,root:i,duration:n}=r,s=await _h({id:t,root:i});return{type:r.type,start:e,duration:n,layout:s,id:r.id,config:r}}async function iy({track:r}){const e=so(r),t=await Promise.all(r.reduce((s,o,a)=>{if(o.type!=="audio")return s;const l=qt(e.slice(0,a));return s.push(ty({scene:o,start:l})),s},[])),i=r.reduce((s,o,a)=>{if(o.type!=="gap")return s;const l=qt(e.slice(0,a));return s.push({type:o.type,id:o.id,start:l,config:o,duration:o.duration}),s},[]),n=r.map(({id:s})=>t.find(({id:o})=>o===s)??i.find(({id:o})=>o===s)).filter(Boolean);return{type:"audio",scenes:t,gapScenes:i,mergedScenes:n,config:r,duration:Math.max(...n.map(({start:s,duration:o})=>s+o))}}async function Fh({node:r,canvases:e,sceneTime:t,parentOpacity:i=1,parentTransform:n,debug:s=!1}){var o,a,l,A,u,c,h,d,f,g,p,v,B,C,y,x,w,L,F,O;const D=e.sceneCanvas.getContext("2d");if(D){D.save(),D.setTransform(n);const X=mv({sceneTime:t,animations:r.element.animations});let{opacity:j,translation:oe,scale:ae,clip:k,dimensions:U,rotation:K}=X;typeof j>"u"&&(j=((a=(o=r.element.layout)==null?void 0:o.transform)==null?void 0:a.opacity)??1),typeof oe>"u"&&(oe={x:((u=(A=(l=r.element.layout)==null?void 0:l.transform)==null?void 0:A.translate)==null?void 0:u.x)??0,y:((d=(h=(c=r.element.layout)==null?void 0:c.transform)==null?void 0:h.translate)==null?void 0:d.y)??0}),typeof ae>"u"&&(ae=((g=(f=r.element.layout)==null?void 0:f.transform)==null?void 0:g.scale)??1),typeof k>"u"&&(k=null),typeof U>"u"&&(U={widthRatio:((B=(v=(p=r.element.layout)==null?void 0:p.transform)==null?void 0:v.dimension)==null?void 0:B.widthRatio)??1,heightRatio:((x=(y=(C=r.element.layout)==null?void 0:C.transform)==null?void 0:y.dimension)==null?void 0:x.heightRatio)??1}),typeof K>"u"&&(K=((L=(w=r.element.layout)==null?void 0:w.transform)==null?void 0:L.rotation)??0);const R=r.width*U.widthRatio,_=r.height*U.heightRatio;if(D.globalAlpha=j*i,(oe.x||oe.y)&&D.translate(oe.x,oe.y),(ae!==1||K!==0)&&(D.translate(r.x+R/2,r.y+_/2),D.scale(ae,ae),D.rotate(K*Math.PI/180),D.translate(-(r.x+R/2),-(r.y+_/2))),k){D.beginPath();const M={x:r.x+k.x*R,y:r.y+k.y*_,width:k.width*R,height:k.height*_};D.rect(M.x,M.y,M.width,M.height),D.clip()}if(s){const M=D.globalAlpha;D.globalAlpha=1,D.strokeStyle="red",D.strokeRect(r.x,r.y,R,_),D.globalAlpha=M}await((O=(F=r.renderer)==null?void 0:F.render)==null?void 0:O.call(F,{canvases:e,sceneTime:t,dx:r.x,dy:r.y,dw:R,dh:_,radius:r.radius,options:r.options,dependencies:r.dependencies}));for await(const M of r.childNodes)await Fh({debug:s,node:M,canvases:e,sceneTime:t,parentOpacity:D.globalAlpha,parentTransform:D.getTransform()});D.restore()}}async function ry({layout:r,canvases:e,sceneTime:t,debug:i=!1}){const{node:n}=r;await Fh({debug:i,node:n,canvases:e,sceneTime:t})}async function oo({debug:r=!1,scene:e,start:t=0,resolvers:i,rootWidth:n,rootHeight:s,canvasFactory:o=Dh}){var a,l;const{id:A,x:u,y:c,width:h,height:d,root:f,duration:g}=e,p=o(),v=o(),B=o(),C=o(),y=o(),x=await _h({id:A,root:{...f,layout:{...f.layout,width:n,height:s},element:{...f.element,layout:{...f.element.layout,...typeof u=="number"&&typeof c=="number"?{position:"absolute",inset:{top:c,left:u}}:{},width:h??((a=f.element.layout)==null?void 0:a.width),height:d??((l=f.element.layout)==null?void 0:l.height)}}},resolvers:i,measureCanvas:y}),w=async L=>{const F=Math.max(0,L-t);p.width=p.height=0,p.width=n,p.height=s,await ry({debug:r,layout:x,sceneTime:F,canvases:{sceneCanvas:p,cropCanvas:v,letterboxCanvas:B,posterCanvas:C}})};return{id:A,type:e.type,start:t,duration:g,layout:x,sceneCanvas:p,draw:w,config:e,childScenes:Mh({node:x.node,duration:g})}}async function ny({debug:r=!1,track:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}){const o=so(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=qt(o.slice(0,d));return h.type==="caption"&&c.push(oo({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),c},[])),l=e.reduce((c,h,d)=>{if(h.type!=="gap")return c;const f=qt(o.slice(0,d));return c.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),c},[]),A=e.reduce((c,h,d)=>{if(h.type!=="transition")return c;const f=h.duration,g=qt(o.slice(0,d))-f;return c.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)})}),c},[]),u=e.map(({id:c})=>a.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)??A.find(({id:h})=>h===c)).filter(Boolean);return{type:"caption",scenes:a,gapScenes:l,transitions:A,mergedScenes:u,duration:Math.max(...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}async function sy({debug:r=!1,track:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}){const o=so(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=qt(o.slice(0,d));return h.type==="video"&&c.push(oo({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),h.type==="image"&&c.push(oo({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),c},[])),l=e.reduce((c,h,d)=>{if(h.type!=="gap")return c;const f=qt(o.slice(0,d));return c.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),c},[]),A=e.reduce((c,h,d)=>{if(h.type!=="transition")return c;const f=h.duration,g=qt(o.slice(0,d))-f;return c.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)})}),c},[]),u=e.map(({id:c})=>a.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)??A.find(({id:h})=>h===c)).filter(Boolean);return{type:"picture",scenes:a,gapScenes:l,transitions:A,mergedScenes:u,duration:Math.max(0,...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}async function oy({debug:r=!1,track:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}){const o=so(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=qt(o.slice(0,d));return h.type==="text"&&c.push(oo({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),c},[])),l=e.reduce((c,h,d)=>{if(h.type!=="gap")return c;const f=qt(o.slice(0,d));return c.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),c},[]),A=e.reduce((c,h,d)=>{if(h.type!=="transition")return c;const f=h.duration,g=qt(o.slice(0,d))-f;return c.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)})}),c},[]),u=e.map(({id:c})=>a.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)??A.find(({id:h})=>h===c)).filter(Boolean);return{type:"text",scenes:a,gapScenes:l,transitions:A,mergedScenes:u,duration:Math.max(...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}function ay(r){return r.some(({type:e})=>e==="text")}function ly(r){return r.some(({type:e})=>e==="caption")}function Ay(r){return r.some(({type:e})=>e==="audio")}function cy(r){return r.some(({type:e})=>e==="video"||e==="image")}function uy(r){return r.type==="audio"}const hy=(((vh=Ih)==null?void 0:vh.default)??Ih).reduce((r,e)=>(r[e.name]=e,r),{});function dy(r,e){return r.has(e)||r.set(e,{buffer:null,transitions:{},fromTexture:null,toTexture:null}),r.get(e)}function fy({name:r,to:e,from:t,progress:i,width:n,height:s,glContext:o,contextResources:a,returnPixels:l=!0}){var A,u,c;const h=dy(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=(((A=zs)==null?void 0:A.default)??zs)(o,t),h.fromTexture.minFilter=o.LINEAR,h.fromTexture.magFilter=o.LINEAR),h.toTexture?h.toTexture.setPixels(e):(h.toTexture=(((u=zs)==null?void 0:u.default)??zs)(o,e),h.toTexture.minFilter=o.LINEAR,h.toTexture.magFilter=o.LINEAR),h.transitions[r]||(h.transitions[r]=(((c=Eh)==null?void 0:c.default)??Eh)(o,hy[r])),h.transitions[r].draw(i,h.fromTexture,h.toTexture,n,s),!l)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 gy(r){for(const[e,t]of r.entries())t.buffer&&e.deleteBuffer(t.buffer),t.fromTexture&&t.fromTexture.dispose(),t.toTexture&&t.toTexture.dispose(),Object.values(t.transitions).forEach(i=>{i.dispose()}),r.delete(e)}function py({name:r,to:e,from:t,progress:i,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),fy({name:r,to:e,from:t,progress:i,width:n.width,height:n.height,glContext:o,contextResources:s,returnPixels:!1}))}async function Ph({debug:r=!1,config:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s=Dh,drawTransition:o=py}){const a=new Map,l=await Promise.all(e.tracks.map(async c=>{if(cy(c))return{...await sy({debug:r,track:c,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}),config:c};if(ay(c))return{...await oy({debug:r,track:c,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}),config:c};if(ly(c))return{...await ny({debug:r,track:c,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}),config:c};if(Ay(c))return{...await iy({track:c}),config:c};throw new Error("Unknown track type")}));return{draw:async({canvas:c,currentTime:h})=>{const d=c.getContext("2d");if(d){d.globalAlpha=1,d.globalCompositeOperation="source-over",d.clearRect(0,0,c.width,c.height),d.save(),d.fillStyle="black",d.fillRect(0,0,c.width,c.height),d.restore();for await(const f of l){if(uy(f))continue;const{scenes:g,transitions:p,trackCanvas:v}=f;v.width=v.height=0,v.width=c.width,v.height=c.height;const B=v.getContext("2d"),C=g.filter(({start:x,duration:w})=>h>=x&&h<x+w);if(!B||C.length<=0)continue;const y=p.find(({start:x,duration:w})=>h>=x&&h<x+w);for await(const{sceneCanvas:x,draw:w}of C)await(w==null?void 0:w(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:w,from:L,duration:F,transitionCanvas:O}=y;O.width=O.height=0,O.width=v.width,O.height=v.height;const D=Math.min(1,Math.max(0,(h-w.start)/F));await o({name:x,progress:D,contextResources:a,to:w.sceneCanvas,from:L.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:()=>{gy(a)},tracks:l,aspectRatio:e.aspectRatio,duration:Math.max(...l.map(({duration:c})=>c))}}const my={version:"5.0.1"};function Ey(r){const{publicApiUrl:e}=_s(r),t=Ki();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function Iy(r){var s,o,a,l,A,u,c,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=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),i=(u=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:u.call(A,"vouch-uid-tab");const n=Ki();return e||(e=Ey(r),(h=(c=window.localStorage)==null?void 0:c.setItem)==null||h.call(c,"vouch-uid-visitor",e)),t||(t=Ki(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),i||(i=Ki(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",i)),{client:t,tab:i,request:n,visitor:e}}function vy(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function yy(r="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,"/"))??[],i={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const l=o.toLowerCase().replace(/[-_][a-z0-9]/g,A=>A.slice(-1).toUpperCase());i[l]=a}}),{source:r,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:my.version,templateVersion:ey,...i}}const Nh=1;class Cy{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const n=vy(i,this.host.vouch);!n||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,vouchId:n,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=_s(this.host.env),{client:i,tab:n,request:s,visitor:o}=Iy(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":n,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":yy(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Nh&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},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:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:n}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:i,node:n},this._streamLatestTime[i]=n.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=n.currentTime,this._streamLatestTime[i]=n.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+Nh&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},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,i,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),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,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),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var pl={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof qi<"u"&&qi,i=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||{},l={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 A(k){return k&&DataView.prototype.isPrototypeOf(k)}if(l.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(k){return k&&u.indexOf(Object.prototype.toString.call(k))>-1};function h(k){if(typeof k!="string"&&(k=String(k)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(k)||k==="")throw new TypeError('Invalid character in header field name: "'+k+'"');return k.toLowerCase()}function d(k){return typeof k!="string"&&(k=String(k)),k}function f(k){var U={next:function(){var K=k.shift();return{done:K===void 0,value:K}}};return l.iterable&&(U[Symbol.iterator]=function(){return U}),U}function g(k){this.map={},k instanceof g?k.forEach(function(U,K){this.append(K,U)},this):Array.isArray(k)?k.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):k&&Object.getOwnPropertyNames(k).forEach(function(U){this.append(U,k[U])},this)}g.prototype.append=function(k,U){k=h(k),U=d(U);var K=this.map[k];this.map[k]=K?K+", "+U:U},g.prototype.delete=function(k){delete this.map[h(k)]},g.prototype.get=function(k){return k=h(k),this.has(k)?this.map[k]:null},g.prototype.has=function(k){return this.map.hasOwnProperty(h(k))},g.prototype.set=function(k,U){this.map[h(k)]=d(U)},g.prototype.forEach=function(k,U){for(var K in this.map)this.map.hasOwnProperty(K)&&k.call(U,this.map[K],K,this)},g.prototype.keys=function(){var k=[];return this.forEach(function(U,K){k.push(K)}),f(k)},g.prototype.values=function(){var k=[];return this.forEach(function(U){k.push(U)}),f(k)},g.prototype.entries=function(){var k=[];return this.forEach(function(U,K){k.push([K,U])}),f(k)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(k){if(!k._noBody){if(k.bodyUsed)return Promise.reject(new TypeError("Already read"));k.bodyUsed=!0}}function v(k){return new Promise(function(U,K){k.onload=function(){U(k.result)},k.onerror=function(){K(k.error)}})}function B(k){var U=new FileReader,K=v(U);return U.readAsArrayBuffer(k),K}function C(k){var U=new FileReader,K=v(U),R=/charset=([A-Za-z0-9_-]+)/.exec(k.type),_=R?R[1]:"utf-8";return U.readAsText(k,_),K}function y(k){for(var U=new Uint8Array(k),K=new Array(U.length),R=0;R<U.length;R++)K[R]=String.fromCharCode(U[R]);return K.join("")}function x(k){if(k.slice)return k.slice(0);var U=new Uint8Array(k.byteLength);return U.set(new Uint8Array(k)),U.buffer}function w(){return this.bodyUsed=!1,this._initBody=function(k){this.bodyUsed=this.bodyUsed,this._bodyInit=k,k?typeof k=="string"?this._bodyText=k:l.blob&&Blob.prototype.isPrototypeOf(k)?this._bodyBlob=k:l.formData&&FormData.prototype.isPrototypeOf(k)?this._bodyFormData=k:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)?this._bodyText=k.toString():l.arrayBuffer&&l.blob&&A(k)?(this._bodyArrayBuffer=x(k.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(k)||c(k))?this._bodyArrayBuffer=x(k):this._bodyText=k=Object.prototype.toString.call(k):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof k=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var k=p(this);if(k)return k;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 k=p(this);return k||(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(l.blob)return this.blob().then(B);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var k=p(this);if(k)return k;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)},l.formData&&(this.formData=function(){return this.text().then(D)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(k){var U=k.toUpperCase();return L.indexOf(U)>-1?U:k}function O(k,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 K=U.body;if(k instanceof O){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url,this.credentials=k.credentials,U.headers||(this.headers=new g(k.headers)),this.method=k.method,this.mode=k.mode,this.signal=k.signal,!K&&k._bodyInit!=null&&(K=k._bodyInit,k.bodyUsed=!0)}else this.url=String(k);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 M=new AbortController;return M.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&K)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(K),(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 _=/\?/;this.url+=(_.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})};function D(k){var U=new FormData;return k.trim().split("&").forEach(function(K){if(K){var R=K.split("="),_=R.shift().replace(/\+/g," "),M=R.join("=").replace(/\+/g," ");U.append(decodeURIComponent(_),decodeURIComponent(M))}}),U}function X(k){var U=new g,K=k.replace(/\r?\n[\t ]+/g," ");return K.split("\r").map(function(R){return R.indexOf(`
|
2477
2477
|
`)===0?R.substr(1,R.length):R}).forEach(function(R){var _=R.split(":"),M=_.shift().trim();if(M){var W=_.join(":").trim();try{U.append(M,W)}catch(Y){console.warn("Response "+Y.message)}}}),U}w.call(O.prototype);function j(k,U){if(!(this instanceof j))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(k)}w.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},j.error=function(){var k=new j(null,{status:200,statusText:""});return k.ok=!1,k.status=0,k.type="error",k};var oe=[301,302,303,307,308];j.redirect=function(k,U){if(oe.indexOf(U)===-1)throw new RangeError("Invalid status code");return new j(null,{status:U,headers:{location:k}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(U,K){this.message=U,this.name=K;var R=Error(U);this.stack=R.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function ae(k,U){return new Promise(function(K,R){var _=new O(k,U);if(_.signal&&_.signal.aborted)return R(new o.DOMException("Aborted","AbortError"));var M=new XMLHttpRequest;function W(){M.abort()}M.onload=function(){var re={statusText:M.statusText,headers:X(M.getAllResponseHeaders()||"")};_.url.indexOf("file://")===0&&(M.status<200||M.status>599)?re.status=200:re.status=M.status,re.url="responseURL"in M?M.responseURL:re.headers.get("X-Request-URL");var he="response"in M?M.response:M.responseText;setTimeout(function(){K(new j(he,re))},0)},M.onerror=function(){setTimeout(function(){R(new TypeError("Network request failed"))},0)},M.ontimeout=function(){setTimeout(function(){R(new TypeError("Network request timed out"))},0)},M.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(M.open(_.method,Y(_.url),!0),_.credentials==="include"?M.withCredentials=!0:_.credentials==="omit"&&(M.withCredentials=!1),"responseType"in M&&(l.blob?M.responseType="blob":l.arrayBuffer&&(M.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)),M.setRequestHeader(re,d(U.headers[re]))}),_.headers.forEach(function(re,he){ie.indexOf(he)===-1&&M.setRequestHeader(he,re)})}else _.headers.forEach(function(re,he){M.setRequestHeader(he,re)});_.signal&&(_.signal.addEventListener("abort",W),M.onreadystatechange=function(){M.readyState===4&&_.signal.removeEventListener("abort",W)}),M.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return ae.polyfill=!0,a.fetch||(a.fetch=ae,a.Headers=g,a.Request=O,a.Response=j),o.Headers=g,o.Request=O,o.Response=j,o.fetch=ae,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var n=t.fetch?t:i;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,r.exports=e})(pl,pl.exports);var By=pl.exports;const Oh=Fa(By);async function Ty(r){var e;try{if((e=await Oh(r,{method:"HEAD"}))!=null&&e.ok)return r}catch{return}}async function ml({sources:r}){let e=null;const t=r==null?void 0:r.filter(Boolean),i=t==null?void 0:t.find(s=>s.startsWith("blob:")),n=t==null?void 0:t.find(s=>!s.startsWith("http")&&!s.startsWith("blob:"));if(i||n)return i??n;if(t.length>0){const s=t.map(o=>Ty(o));e=(await Promise.all(s)).find(Boolean)}return e}async function by(r){try{return(await Oh(r)).text()}catch{return null}}async function Sy(r){return r=r.trim(),r.startsWith("http")||r.startsWith("blob:")?by(r):r}const xy=Ji(async({original:r,translation:e,originalLanguage:t="",translationLanguage:i=""},{language:n})=>{var s,o;const a={[(s=i==null?void 0:i.split("-"))==null?void 0:s[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:r},l=(n&&a[n])??r;return l?Sy(l):null},{cacheKey:([r,{language:e}])=>JSON.stringify({...r,language:e})});function Qy(r){var e;return((e=r==null?void 0:r.items)==null?void 0:e.map(t=>{var i;return{text:(i=t.alternatives[0])==null?void 0:i.content,start:t.start_time,end:t.end_time}}))??[]}const _y=Ji(async r=>{var e,t,i,n,s,o,a,l,A,u,c;const[h,d,f]=await Promise.all([ml({sources:[(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,(n=(i=r==null?void 0:r.answer)==null?void 0:i.media)==null?void 0:n.input]}),ml({sources:[(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),ml({sources:[((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((c=(u=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:u.videos)==null?void 0:c.xs)]})]);return{src:h,playlist:d,preview:f}},{cacheKey:([r])=>{var e,t,i,n,s,o,a,l,A,u,c;return JSON.stringify({video:(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,input:(n=(i=r==null?void 0:r.answer)==null?void 0:i.media)==null?void 0:n.input,playlist:(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist,preview:((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((c=(u=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:u.videos)==null?void 0:c.xs)})}});function Uh(r){var e,t,i,n,s,o,a,l,A,u,c,h;const d=((t=(e=r==null?void 0:r.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((s=(n=(i=r==null?void 0:r.answer)==null?void 0:i.contact)==null?void 0:n.name)==null?void 0:s.trim())??"",f=((l=(a=(o=r==null?void 0:r.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:l.name)==="Not Supplied"?"":((h=(c=(u=(A=r==null?void 0:r.answer)==null?void 0:A.contact)==null?void 0:u.client)==null?void 0:c.name)==null?void 0:h.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}function wy(r){var e,t;const i=(t=(e=r==null?void 0:r.answer)==null?void 0:e.contact)==null?void 0:t.roleTitle,n=i==null?void 0:i.split(" ");return{roleTitle:i,roleWords:n,firstRoleWord:n==null?void 0:n[0],remainingRoleWords:n==null?void 0:n.slice(1).join(" ")}}const Ry=Ji(async(r,e,t)=>{var i,n,s;const o=(i=e==null?void 0:e.answer)==null?void 0:i.id;return((s=(n=r==null?void 0:r.questions)==null?void 0:n.items)==null?void 0:s.reduce((l,A)=>{var u;return((u=A==null?void 0:A.answer)==null?void 0:u.id)===o?(l??0)+1:l},0))<=1?o:`${o}-${t}`},{cacheKey:([r,e,t])=>{var i;return JSON.stringify({index:t,rootData:e,allQuestions:(i=r==null?void 0:r.questions)==null?void 0:i.items})}});async function El({data:r,rootData:e,index:t},i){var n,s,o,a,l,A,u,c,h,d,f,g,p,v,B,C,y,x,w,L,F,O,D,X;const[j,oe,ae]=await Promise.all([Ry(r,e,t),_y(e),xy({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:((A=(l=e==null?void 0:e.answer)==null?void 0:l.media)==null?void 0:A.translation)??((c=(u=e==null?void 0:e.answer)==null?void 0:u.captions)==null?void 0:c.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},i)]),k=Uh(e),U=wy(e);return{...oe,...k,...U,key:j,captions:ae,wordTimings:Qy((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?((w=(x=(y=(C=r==null?void 0:r.questions)==null?void 0:C.items)==null?void 0:y[t-1])==null?void 0:x.answer)==null?void 0:w.label)??((O=(F=(L=r==null?void 0:r.questions)==null?void 0:L.items)==null?void 0:F[t-1])==null?void 0:O.title)??null:null,isFirstInstanceOfName:t?((X=(D=r==null?void 0:r.questions)==null?void 0:D.items)==null?void 0:X.findIndex(K=>Uh(K).name===k.name))===t:!0}}const ao={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 Dy({data:r}){var e,t;return((t=(e=r==null?void 0:r.questions)==null?void 0:e.items)==null?void 0:t.reduce((i,n)=>{var s,o,a,l,A,u,c;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=(c=(u=(A=(l=n==null?void 0:n.answer)==null?void 0:l.transcription)==null?void 0:A.translation)==null?void 0:u.language)==null?void 0:c.split("-")[0];return h&&ao[h]&&!i.find(f=>f.value===h)&&i.push({value:h,label:ao[h]}),d&&ao[d]&&!i.find(f=>f.value===d)&&i.push({value:d,label:ao[d]}),i},[]))??[]}/**
|
2478
2478
|
* @license
|
2479
2479
|
* Copyright 2018 Google LLC
|