@vouchfor/embeds 0.0.0-experiment.c43cbe4 → 0.0.0-experiment.c485446
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/es/embeds.js +4 -4
- 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 +4 -4
package/dist/es/embeds.js
CHANGED
@@ -196,7 +196,7 @@ class FetcherController {
|
|
196
196
|
}
|
197
197
|
}
|
198
198
|
const name = "@vouchfor/embeds";
|
199
|
-
const version = "0.0.0-experiment.
|
199
|
+
const version = "0.0.0-experiment.c485446";
|
200
200
|
const license = "MIT";
|
201
201
|
const author = "Aaron Williams";
|
202
202
|
const main = "dist/es/embeds.js";
|
@@ -238,8 +238,8 @@ const scripts = {
|
|
238
238
|
const dependencies = {
|
239
239
|
"@a11y/focus-trap": "^1.0.5",
|
240
240
|
"@lit/task": "^1.0.0",
|
241
|
-
"@vouchfor/canvas-video": "0.0.0-experiment.
|
242
|
-
"@vouchfor/media-player": "0.0.0-experiment.
|
241
|
+
"@vouchfor/canvas-video": "0.0.0-experiment.c485446",
|
242
|
+
"@vouchfor/media-player": "0.0.0-experiment.c485446",
|
243
243
|
uuid: "^9.0.1"
|
244
244
|
};
|
245
245
|
const peerDependencies = {
|
@@ -258,7 +258,7 @@ const devDependencies = {
|
|
258
258
|
"@types/mocha": "^10.0.6",
|
259
259
|
"@vouchfor/eslint-config": "^1.0.1",
|
260
260
|
"@vouchfor/prettier-config": "^1.0.1",
|
261
|
-
"@vouchfor/video-utils": "0.0.0-experiment.
|
261
|
+
"@vouchfor/video-utils": "0.0.0-experiment.c485446",
|
262
262
|
"@web/dev-server-esbuild": "^1.0.2",
|
263
263
|
"@web/test-runner": "^0.18.1",
|
264
264
|
"@web/test-runner-browserstack": "^0.7.1",
|
@@ -2451,7 +2451,7 @@ vec4 transition(vec2 uv) {
|
|
2451
2451
|
return mix(a, b, step(0.0+p.y,progress));
|
2452
2452
|
}
|
2453
2453
|
`,author:"Jake Nelson",license:"MIT",createdAt:"Wed, 1 Nov 2017 15:24:36 -0500",updatedAt:"Thu, 2 Nov 2017 18:37:42 -0500"}];const uc=Co(mp);var hc;function Ep(r){if(typeof r=="string"){const[e,t]=r.split(":");return Math.min(parseFloat(e),parseFloat(t))}return r}function Ip(r){if(typeof r=="string"){const[e,t]=r.split(":"),i=parseFloat(e),n=parseFloat(t);return i/n}return r}function zo({resolution:r,aspectRatio:e}){const t=Ep(r),i=Ip(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}}function vp({source:r,sx:e,sy:t,sw:i,sh:n,dx:s,dy:o,dw:a,dh:l}){const A=(r==null?void 0:r.naturalWidth)??(r==null?void 0:r.videoWidth)??(r==null?void 0:r.width),c=(r==null?void 0:r.naturalHeight)??(r==null?void 0:r.videoHeight)??(r==null?void 0:r.height);e=e??0,t=t??0,i=i??A,n=n??c,i<0&&(e+=i,i=Math.abs(i)),n<0&&(t+=n,n=Math.abs(n)),a<0&&(s+=a,a=Math.abs(a)),l<0&&(o+=l,l=Math.abs(l));const u=Math.max(e,0),h=Math.min(e+i,A),d=Math.max(t,0),f=Math.min(t+n,c),g=a/i,p=l/n;return[r,u,d,h-u,f-d,e<0?s-e*g:s,t<0?o-t*p:o,(h-u)*g,(f-d)*p]}function Cp({context:r,source:e,crop:t,format:i="letterbox",posX:n,posY:s,drawAreaWidth:o,drawAreaHeight:a,sourceWidth:l,sourceHeight:A,cropCanvas:c}){const{x:u,y:h,width:d,height:f}=t??{},g=l*(u??0),p=A*(h??0),v=l*Math.min(1-(u??0),d??1),Q=A*Math.min(1-(h??0),f??1);let b=g,y=p,x=v,R=Q,k=v,H=Q;if(c.width=v,c.height=Q,i==="crop"){const P=o/a,K=v/Q,ie=K>P?v-Q*P:0,ee=K<P?Q-v/P:0;c.width=v+ie,c.height=Q+ee,b+=ie/2,y+=ee/2,x-=ie,R-=ee,k+=ie,H+=ee}const V=c.getContext("2d");if(V){const P=vp({source:e,sx:b,sy:y,sw:x,sh:R,dx:0,dy:0,dw:k,dh:H});V.drawImage(...P)}r.drawImage(c,n,s,o,a)}const ii=/(?<value>\d+\.?\d*)(?=px)/;function dc({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 Zo=vo(({context:r,fontSizes:e,text:t,maxW:i=1/0})=>{try{return r.save(),r.font=r.font.replace(ii,e[0].toString()),t.split(`
|
2454
|
-
`).flatMap(s=>{const o=s.split(" ").filter(Boolean);return o.length?o.slice(1).reduce((a,l,A)=>{const u=`${a[a.length-1].text} ${l}`.trim(),h=r.measureText(u);if(h.width>i)a=[...a,...dc({context:r,word:l,maxW:i})];else{const d=e[A%e.length];r.font=r.font.replace(ii,d.toString()),a[a.length-1]={text:u,metrics:h}}return a},dc({context:r,word:o[0],maxW:i})):{text:"",metrics:r.measureText("")}})}finally{r.restore()}},{cacheKey:([{fontSizes:r,text:e,maxW:t}])=>`${JSON.stringify(r)}_${e}_${t}`}),Qr=1.8;function yp({context:r,x:e,y:t,width:i,height:n,radii:s}){let o,a,l,A;typeof s=="number"?o=a=l=A=s:[o,a,l,A]=s,r.beginPath(),r.moveTo(e+Math.min(n/Qr,o),t),r.lineTo(e+i-Math.min(n/Qr,a),t),r.quadraticCurveTo(e+i,t,e+i,t+Math.min(n/Qr,a)),r.lineTo(e+i,t+n-Math.min(n/Qr,l)),r.quadraticCurveTo(e+i,t+n,e+i-Math.min(n/Qr,l),t+n),r.lineTo(e+Math.min(n/Qr,A),t+n),r.quadraticCurveTo(e,t+n,e,t+n-Math.min(n/Qr,A)),r.lineTo(e,t+Math.min(n/Qr,o)),r.quadraticCurveTo(e,t,e+Math.min(n/Qr,o),t),r.closePath()}function fc({context:r,x:e,y:t,width:i,height:n,radii:s,clip:o=!1,debug:a=!1}){yp({context:r,x:e,y:t,width:i,height:n,radii:s}),a&&(r.strokeStyle="blue",r.stroke()),o&&r.clip()}const gc=[{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 hs({text:r,font:e}){let t=e;return gc.forEach(({family:i,regex:n})=>{n.exec(r)&&(t+=`, ${i}`)}),t}vo(({context:r,fontSizes:e,maxW:t=1/0,words:i})=>{try{return r.save(),r.font=r.font.replace(ii,e[0].toString()),i.length<=0?[]:i.slice(1).reduce((n,s)=>{var o;const a=s.text,A=`${(o=n[n.length-1])==null?void 0:o.text} ${a}`.trim(),c=r.measureText(A);if(c.width>t){const u=e[n.length%e.length];r.font=r.font.replace(ii,u.toString()),n=[...n,{text:a,metrics:r.measureText(a),words:[s]}]}else n[n.length-1]={text:A,metrics:c,words:[...n[n.length-1].words,s]};return n},[{text:i[0].text,metrics:r.measureText(i[0].text),words:[i[0]]}])}finally{r.restore()}},{cacheKey:([{fontSizes:r,words:e,maxW:t}])=>`${JSON.stringify(r)}_${JSON.stringify(e)}_${t}`});let ds;const Bp=new Uint8Array(16);function Tp(){if(!ds&&(ds=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ds))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ds(Bp)}const yt=[];for(let r=0;r<256;++r)yt.push((r+256).toString(16).slice(1));function Qp(r,e=0){return yt[r[e+0]]+yt[r[e+1]]+yt[r[e+2]]+yt[r[e+3]]+"-"+yt[r[e+4]]+yt[r[e+5]]+"-"+yt[r[e+6]]+yt[r[e+7]]+"-"+yt[r[e+8]]+yt[r[e+9]]+"-"+yt[r[e+10]]+yt[r[e+11]]+yt[r[e+12]]+yt[r[e+13]]+yt[r[e+14]]+yt[r[e+15]]}const pc={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function bp(r,e,t){if(pc.randomUUID&&!e&&!r)return pc.randomUUID();r=r||{};const i=r.random||(r.rng||Tp)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let n=0;n<16;++n)e[t+n]=i[n];return e}return Qp(i)}const mc=vo(({font:r,scale:e,context:t,maxW:i,maxH:n,text:s,minSize:o,maxSize:a})=>{var l,A;let c=0;if(a){c=(o??0)*e;let h=0;for(;a*e>c+1;){c+=1;const d=Zo({context:t,fontSizes:[c],text:s,maxW:i});if(h=d.reduce((f,g)=>(g.metrics.width>f&&(f=g.metrics.width),f),0),h>i||d.length*c>n){c-=1;break}}}else c=parseFloat(((A=(l=r.match(ii))==null?void 0:l.groups)==null?void 0:A.value)??"0")*e;return c},{cacheKey:([{font:r,text:e,minSize:t,maxSize:i,scale:n,maxW:s,maxH:o}])=>`${r}_${e}_${t}_${i}_${n}_${s}_${o}`}),xp="text",Ec={100:"Thin",200:"ExtraLight",300:"Light",400:"Regular",500:"Medium",600:"SemiBold",700:"Bold",800:"ExtraBold",900:"Black"},wp={type:xp,options:{value:{type:"text",name:"value",label:"Text"},color:{type:"color",name:"color",label:"Text colour"},"font.size":{type:"number",name:"size",label:"Font size"},"font.weight":{type:"select",name:"weight",label:"Font weight",options:r=>{var e;return((e=r.font.family.data)==null?void 0:e.weights.map(({weight:t})=>({label:Ec[t],value:t,data:t})))??[]}},"font.family":{type:"font",name:"family",label:"Font family"},wrap:{type:"checkbox",name:"wrap",label:"Text wrap"},align:{type:"radio",name:"align",label:"Text align",items:[{label:"Left",value:"left"},{label:"Center",value:"center"},{label:"Right",value:"right"}],visible:r=>r.wrap},fill:{type:"range",name:"fill",label:"Min - Max font size",min:20,max:400,step:1,visible:r=>r.wrap}},transform:{values:r=>{var e,t;return{value:r.value,color:r.color??"#000000",font:{size:r.font.size,weight:{label:Ec[r.font.weight],value:r.font.weight,data:r.font.weight},family:{label:r.font.family.name,value:r.font.family.name,data:r.font.family}},wrap:r.wrap??!1,align:r.align??"left",fill:[((e=r.fill)==null?void 0:e.minSize)??20,((t=r.fill)==null?void 0:t.maxSize)??400]}},options:r=>{var e;return{value:r.value,color:r.color,font:{size:r.font.size,weight:r.font.weight.data,family:{name:r.font.family.value,weights:((e=r.font.family.data)==null?void 0:e.weights)??[]}},wrap:r.wrap,align:r.align,fill:{minSize:r.fill[0],maxSize:r.fill[1]}}}},width:({node:r,options:e,dependencies:t,measureCanvas:i})=>{const{value:n="",align:s="left",wrap:o=!1}=e,{font:a}=t,l=i==null?void 0:i.getContext("2d");if(!l)return r.getComputedWidth();const A=`${a.weight} ${a.size}px ${a.family.name}`,c=hs({font:A,text:n});if(l.font=c,l.textBaseline="top",l.textAlign=s,o){const u=r.getParent(),h=r.getComputedMargin(nr.Edge.Left)+r.getComputedMargin(nr.Edge.Right)+((u==null?void 0:u.getComputedPadding(nr.Edge.Left))??0)+((u==null?void 0:u.getComputedPadding(nr.Edge.Right))??0);return Math.max(((u==null?void 0:u.getComputedWidth())??0)-h,r.getComputedWidth(),...n.split(" ").map(d=>l.measureText(d).width))}return l.measureText(n).width},height:({node:r,options:e,dependencies:t,measureCanvas:i})=>{var n,s;const{value:o="",fill:a,align:l="left",wrap:A=!1}=e,{font:c}=t,u=`${c.weight} ${c.size}px ${c.family.name}`,h=hs({font:u,text:o}),d=i==null?void 0:i.getContext("2d");if(!d)return r.getComputedHeight();if(d.font=h,d.textBaseline="top",d.textAlign=l,A){const f=r.getParent(),g=r.getComputedMargin(nr.Edge.Top)+r.getComputedMargin(nr.Edge.Bottom)+((f==null?void 0:f.getComputedPadding(nr.Edge.Top))??0)+((f==null?void 0:f.getComputedPadding(nr.Edge.Bottom))??0),p=r.getComputedWidth(),v=Math.max(((f==null?void 0:f.getComputedHeight())??0)-g,r.getComputedHeight()),Q=mc({font:h,scale:1,context:d,maxW:p,maxH:v,text:o??"",minSize:a==null?void 0:a.minSize,maxSize:a==null?void 0:a.maxSize});return Zo({context:d,fontSizes:[Q],text:o??"",maxW:p}).length*Q}else return parseFloat(((s=(n=h.match(ii))==null?void 0:n.groups)==null?void 0:s.value)??"0")},render:({dx:r,dy:e,dw:t,dh:i,options:n,dependencies:s,canvases:o})=>{const{value:a="",fill:l,color:A,align:c="left",wrap:u=!1}=n,{font:h}=s,d=`${h.weight} ${h.size}px ${h.family.name}`,f=o.sceneCanvas.getContext("2d");if(!f)return;f.save();const g=hs({font:d,text:a});f.font=g,f.textBaseline="top",f.fillStyle=A,f.textAlign=c;const p={left:r,center:r+t/2,right:r+t};if(u){const v=mc({font:g,scale:1,context:f,maxW:t,maxH:i,text:a??"",minSize:l==null?void 0:l.minSize,maxSize:l==null?void 0:l.maxSize});f.font=g.replace(ii,v.toString()),Zo({context:f,fontSizes:[v],text:a,maxW:t}).forEach((b,y)=>{f.fillText(b.text,p[c],e+v*y)})}else f.fillText(a,p[c],e);f.restore()}},Sp={type:"image",width:({node:r,dependencies:e})=>{var t,i,n,s;const o=r.getComputedHeight();if(!o)return r.getComputedWidth();const a=((t=e.image)==null?void 0:t.naturalWidth)??((i=e.image)==null?void 0:i.width),l=((n=e.image)==null?void 0:n.naturalHeight)??((s=e.image)==null?void 0:s.height),A=a/l;return o*A},height:({node:r,dependencies:e})=>{var t,i,n,s;const o=((t=e.image)==null?void 0:t.naturalWidth)??((i=e.image)==null?void 0:i.width),a=((n=e.image)==null?void 0:n.naturalHeight)??((s=e.image)==null?void 0:s.height),l=o/a;return r.getComputedWidth()/l},render:async({dx:r,dy:e,dw:t,dh:i,radius:n,dependencies:s,canvases:o})=>{const a=o.sceneCanvas.getContext("2d");if(!(!a||!s.image)){if(a.save(),n){const{topLeft:l,topRight:A,bottomLeft:c,bottomRight:u}=n;fc({context:a,x:r,y:e,width:t,height:i,radii:[l,A,u,c]}),a.clip()}a.drawImage(s.image,r,e,t,i),a.restore()}}},Rp={type:"video",options:{crop:{type:"crop",name:"crop",label:"Crop"},speed:{type:"slider",name:"speed",label:"Speed",min:.5,max:4,step:.01},volume:{type:"slider",name:"volume",label:"Volume",min:0,max:1,step:.01}},transform:{values:r=>({format:r.format??"crop",crop:r.crop??{x:0,y:0,width:1,height:1},speed:[r.speed??1],volume:[r.volume??1]}),options:r=>({format:r.format,crop:r.crop,speed:r.speed[0],volume:r.volume[0]})},width:async({node:r,options:e,dependencies:t})=>{const{crop:i,format:n}=e,{aspectRatio:s}=t;if(n==="crop")return r.getComputedWidth();const o=s*(((i==null?void 0:i.width)??1)/((i==null?void 0:i.height)??1)),a=r.getComputedWidth(),l=r.getComputedHeight(),A=a/l;return o>A?a:l*o},height:async({node:r,options:e,dependencies:t})=>{const{crop:i,format:n}=e,{aspectRatio:s}=t;if(n==="crop")return r.getComputedHeight();const o=s*(((i==null?void 0:i.width)??1)/((i==null?void 0:i.height)??1));return r.getComputedWidth()/o},render:async({dx:r,dy:e,dw:t,dh:i,radius:n,sceneTime:s,options:o,dependencies:a,canvases:l})=>{const{crop:A,format:c="letterbox"}=o,u=l.sceneCanvas.getContext("2d");if(!u)return;const h=await a.video(s),d=(h==null?void 0:h.videoWidth)??(h==null?void 0:h.naturalWidth)??(h==null?void 0:h.width),f=(h==null?void 0:h.videoHeight)??(h==null?void 0:h.naturalHeight)??(h==null?void 0:h.height);if(d&&f){if(u.save(),n){const{topLeft:g,topRight:p,bottomLeft:v,bottomRight:Q}=n;fc({context:u,x:r,y:e,width:t,height:i,radii:[g,p,Q,v]}),u.clip()}Cp({context:u,crop:A,format:c,sourceWidth:d,sourceHeight:f,source:h,posX:r,posY:e,drawAreaWidth:t,drawAreaHeight:i,cropCanvas:l.cropCanvas,letterboxCanvas:l.letterboxCanvas}),u.restore()}}},Dp={type:"audio",options:{speed:{type:"slider",name:"speed",label:"Speed",min:.5,max:4,step:.01},volume:{type:"slider",name:"volume",label:"Volume",min:0,max:1,step:.01}},transform:{values:r=>({speed:[r.speed??1],volume:[r.volume??1]}),options:r=>({speed:r.speed[0],volume:r.volume[0]})}};function _p(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 Lp(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 Fp=ti(()=>nr.loadYoga());$f.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${Lp(r)}"`:_p(r)||Array.isArray(r)?JSON.stringify(r):r);const kp="3";function Mp(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 Np(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{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 Ic(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{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 vc(r,e,{layout:t,scale:i=1}){const{position:n="relative",inset:s,width:o,height:a,minWidth:l,minHeight:A,maxWidth:c,maxHeight:u,flex:h,gap:d,margin:f,padding:g,direction:p="column",align:v="start",alignSelf:Q,justify:b="start"}=t??{},y={static:r.POSITION_TYPE_STATIC,relative:r.POSITION_TYPE_RELATIVE,absolute:r.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(y[n]),s){const{top:H,right:V,bottom:P,left:K}=Np(s,i);typeof H<"u"&&e.setPosition(r.EDGE_TOP,H),typeof V<"u"&&e.setPosition(r.EDGE_RIGHT,V),typeof P<"u"&&e.setPosition(r.EDGE_BOTTOM,P),typeof K<"u"&&e.setPosition(r.EDGE_LEFT,K)}const x={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(x[p]);const R={start:r.ALIGN_FLEX_START,end:r.ALIGN_FLEX_END,center:r.ALIGN_CENTER,stretch:r.ALIGN_STRETCH};e.setAlignItems(R[v]),Q&&e.setAlignSelf(R[Q]);const k={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(k[b]),f){const{top:H,right:V,bottom:P,left:K}=Ic(f,i);e.setMargin(r.EDGE_TOP,H),e.setMargin(r.EDGE_RIGHT,V),e.setMargin(r.EDGE_BOTTOM,P),e.setMargin(r.EDGE_LEFT,K)}if(g){const{top:H,right:V,bottom:P,left:K}=Ic(g,i);e.setPadding(r.EDGE_TOP,H),e.setPadding(r.EDGE_RIGHT,V),e.setPadding(r.EDGE_BOTTOM,P),e.setPadding(r.EDGE_LEFT,K)}typeof h<"u"&&e.setFlex(h),e.setGap(r.GUTTER_ALL,(d??0)*i),typeof o<"u"&&e.setWidth(typeof o=="number"?o*i:o),typeof a<"u"&&(typeof a=="function"?e.setHeight("100%"):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 c<"u"&&e.setMaxWidth(typeof c=="number"?c*i:c),typeof u<"u"&&e.setMaxHeight(typeof u=="number"?u*i:u)}async function Cc({yoga:r,index:e,parent:t,element:i,resolvers:n}){var s,o;const{type:a,layout:l={},config:A,options:c,renderer:u}=i,h=r.Node.create();vc(r,h,{layout:l}),t.insertChild(h,e);let d=null;n&&((u==null?void 0:u.type)==="text"||(u==null?void 0:u.type)==="image"||(u==null?void 0:u.type)==="video")&&(d=await((s=n[u.type])==null?void 0:s.call(n,{config:A,options:c}))??null);const f=[];for await(const[g,p]of((o=i.children)==null?void 0:o.entries())??[])f.push(await Cc({yoga:r,index:g,parent:h,element:p,resolvers:n}));return t.calculateLayout(),{type:a,node:h,radius:Mp(l.radius),element:i,renderer:u,config:A,options:c,dependencies:d,childNodes:f}}function yc(r,e,t=0,i=0){const{top:n,left:s}=r.getComputedLayout(),{top:o,left:a,width:l,height:A}=e.node.getComputedLayout(),c=t+a,u=i+o,h=e.childNodes.map(d=>yc(r,d,c,u));return{...e,x:s+c,y:n+u,width:l,height:A,childNodes:h}}async function ea(r,e,t){for await(const{node:i,options:n,dependencies:s,renderer:o,childNodes:a}of e){if(o){const{width:l,height:A}=o;if(l){const c=await l({node:i,options:n,dependencies:s,measureCanvas:t});i.setWidth(c)}if(await ea(r,a,t),A){const c=await A({node:i,options:n,dependencies:s,measureCanvas:t});i.setHeight(c)}}await ea(r,a,t)}r.calculateLayout()}async function Bc({root:r,resolvers:e,measureCanvas:t}){const i=await Fp(),n=i.Node.create();vc(i,n,{layout:r.layout});const s=await Cc({yoga:i,index:0,parent:n,element:r.element,resolvers:e});await ea(n,[s],t);const{top:o,left:a,width:l,height:A}=n.getComputedLayout(),c={root:{x:a,y:o,width:l,height:A},node:yc(n,s)};return n.freeRecursive(),c}function br(r){let e=0;for(const t of r)Array.isArray(t)?e+=br(t):e+=t;return e}function ta(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,c=((o=r[i+1])==null?void 0:o.duration)??1/0,u=((a=r[i+2])==null?void 0:a.type)==="transition"?r[i+2]:null;return Math.min(l?A/2:A,t,u?c/2:c)*-1}return t})}function Tc(r){var e;return{...r,children:((e=r.children)==null?void 0:e.map(t=>{if(t.type!=="recipe")return Tc(t)}).filter(Boolean))??[]}}function Qc(r){const e={box:0,image:0,video:0,text:0,audio:0};r.renderer&&(e[r.renderer.type]+=1);for(const t of r.children??[]){const{box:i,image:n,video:s,text:o,audio:a}=Qc(t);e.box+=i,e.image+=n,e.video+=s,e.text+=o,e.audio+=a}return e}function Pp(r){return r.video>0?Rp.type:r.image>0?Sp.type:r.audio>0?Dp.type:wp.type}function bc({node:r,duration:e}){const t=[];if(r.type==="recipe"){const i=Tc({...r.element,layout:{...r.element.layout,position:"static",width:"100%",height:"100%",margin:0}}),n=Qc(i);t.push({type:Pp(n),id:bp(),x:r.x,y:r.y,width:r.width,height:r.height,duration:e,root:{element:i}})}for(const i of r.childNodes)t.push(...bc({node:i,duration:e}));return t}async function Op({scene:r,start:e=0}){const{root:t,duration:i}=r,n=await Bc({root:t});return{type:r.type,start:e,duration:i,layout:n,id:r.id,config:r}}async function Up({track:r}){const e=ta(r),t=await Promise.all(r.reduce((s,o,a)=>{if(o.type!=="audio")return s;const l=br(e.slice(0,a));return s.push(Op({scene:o,start:l})),s},[])),i=r.reduce((s,o,a)=>{if(o.type!=="gap")return s;const l=br(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 xc(){return document.createElement("canvas")}async function wc({node:r,canvases:e,sceneTime:t}){var i,n;await((n=(i=r.renderer)==null?void 0:i.render)==null?void 0:n.call(i,{canvases:e,sceneTime:t,dx:r.x,dy:r.y,dw:r.width,dh:r.height,radius:r.radius,options:r.options,dependencies:r.dependencies}));const{sceneCanvas:s}=e,o=s.getContext("2d");o&&(o.strokeStyle="red",o.strokeRect(r.x,r.y,r.width,r.height));for await(const a of r.childNodes)await wc({node:a,canvases:e,sceneTime:t})}async function Gp({layout:r,canvases:e,sceneTime:t}){const{node:i}=r;await wc({node:i,canvases:e,sceneTime:t})}async function ra({scene:r,start:e=0,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s=xc}){var o,a;const{x:l,y:A,width:c,height:u,root:h,duration:d}=r,f=await s(),g=await s(),p=await s(),v=await s(),Q=await s(),b=await s(),y=await Bc({root:{...h,layout:{...h.layout,width:i,height:n},element:{...h.element,layout:{...h.element.layout,...typeof l=="number"&&typeof A=="number"?{position:"absolute",inset:{top:A,left:l}}:{},width:c??((o=h.element.layout)==null?void 0:o.width),height:u??((a=h.element.layout)==null?void 0:a.height)}}},resolvers:t,measureCanvas:b}),x=async R=>{const k=Math.max(0,R-e);f.width=f.height=0,f.width=i,f.height=n,await Gp({layout:y,sceneTime:k,canvases:{sceneCanvas:f,cropCanvas:p,letterboxCanvas:v,posterCanvas:Q}})};return{type:r.type,draw:x,start:e,duration:d,layout:y,sceneCanvas:f,transitionCanvas:g,id:r.id,config:r,childScenes:bc({node:y.node,duration:d})}}async function Hp({track:r,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n}){const s=ta(r),o=await Promise.all(r.reduce((c,u,h)=>{const d=br(s.slice(0,h));return u.type==="video"&&c.push(ra({scene:u,start:d,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n})),u.type==="image"&&c.push(ra({scene:u,start:d,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n})),c},[])),a=r.reduce((c,u,h)=>{if(u.type!=="gap")return c;const d=br(s.slice(0,h));return c.push({type:u.type,id:u.id,start:d,config:u,duration:u.duration}),c},[]),l=r.reduce((c,u,h)=>{if(u.type!=="transition")return c;const d=u.duration,f=br(s.slice(0,h))-d;return c.push({type:u.type,id:u.id,name:u.name,start:f,duration:d,config:u,to:o.find(({id:g})=>{var p;return g===((p=r[h+1])==null?void 0:p.id)}),from:o.find(({id:g})=>{var p;return g===((p=r[h-1])==null?void 0:p.id)})}),c},[]),A=r.map(({id:c})=>o.find(({id:u})=>u===c)??a.find(({id:u})=>u===c)??l.find(({id:u})=>u===c)).filter(Boolean);return{type:"picture",scenes:o,gapScenes:a,transitions:l,mergedScenes:A,duration:Math.max(0,...A.map(({start:c,duration:u})=>c+u)),trackCanvas:await n()}}async function $p({track:r,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n}){const s=ta(r),o=await Promise.all(r.reduce((c,u,h)=>{const d=br(s.slice(0,h));return u.type==="text"&&c.push(ra({scene:u,start:d,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n})),c},[])),a=r.reduce((c,u,h)=>{if(u.type!=="gap")return c;const d=br(s.slice(0,h));return c.push({type:u.type,id:u.id,start:d,config:u,duration:u.duration}),c},[]),l=r.reduce((c,u,h)=>{if(u.type!=="transition")return c;const d=u.duration,f=br(s.slice(0,h))-d;return c.push({type:u.type,id:u.id,name:u.name,start:f,duration:d,config:u,to:o.find(({id:g})=>{var p;return g===((p=r[h+1])==null?void 0:p.id)}),from:o.find(({id:g})=>{var p;return g===((p=r[h-1])==null?void 0:p.id)})}),c},[]),A=r.map(({id:c})=>o.find(({id:u})=>u===c)??a.find(({id:u})=>u===c)??l.find(({id:u})=>u===c)).filter(Boolean);return{type:"text",scenes:o,gapScenes:a,transitions:l,mergedScenes:A,duration:Math.max(...A.map(({start:c,duration:u})=>c+u)),trackCanvas:await n()}}function Yp(r){return r.some(({type:e})=>e==="video"||e==="image")}function Vp(r){return r.some(({type:e})=>e==="audio")}function Kp(r){return r.some(({type:e})=>e==="text")}function Wp(r){return r.type==="audio"}const Jp=(((hc=uc)==null?void 0:hc.default)??uc).reduce((r,e)=>(r[e.name]=e,r),{});function qp({name:r,canvas:e,to:t,from:i,progress:n}){var s,o,a;const l=e.getContext("webgl",{alpha:!0});if(l){l.disable(l.DEPTH_TEST),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,!0);const A=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,A),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,-1,4,4,-1]),l.STATIC_DRAW),l.viewport(0,0,e.width,e.height);const c=(((s=ls)==null?void 0:s.default)??ls)(l,i);c.minFilter=l.LINEAR,c.magFilter=l.LINEAR;const u=(((o=ls)==null?void 0:o.default)??ls)(l,t);u.minFilter=l.LINEAR,u.magFilter=l.LINEAR;const h=(((a=cc)==null?void 0:a.default)??cc)(l,Jp[r]);h.draw(n,c,u,e.width,e.height),c.dispose(),u.dispose(),h.dispose(),l.flush()}}async function Sc({config:r,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n=xc}){const s=await Promise.all(r.tracks.map(async l=>{if(Yp(l))return{...await Hp({track:l,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n}),config:l};if(Kp(l))return{...await $p({track:l,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n}),config:l};if(Vp(l))return{...await Up({track:l}),config:l};throw new Error("Unknown track type")}));console.log({tracks:s});const o=await n();return{draw:async({canvas:l,currentTime:A})=>{const c=l.getContext("2d");if(c){c.globalAlpha=1,c.globalCompositeOperation="source-over",c.clearRect(0,0,l.width,l.height),c.save(),c.fillStyle="black",c.fillRect(0,0,l.width,l.height),c.restore();for await(const u of s){if(Wp(u))continue;const{scenes:h,transitions:d,trackCanvas:f}=u;f.width=f.height=0,f.width=l.width,f.height=l.height;const g=h.filter(({start:v,duration:Q})=>A>=v&&A<v+Q);if(g.length<=0)continue;const p=d.find(({start:v,duration:Q})=>A>=v&&A<v+Q);for await(const{id:v,start:Q,duration:b,sceneCanvas:y,transitionCanvas:x,draw:R}of g)if(await(R==null?void 0:R(A)),!p)c.drawImage(y,0,0,y.width,y.height);else{const{name:k,to:H,from:V,duration:P}=p;o.width=o.height=x.width=x.height=0,o.width=x.width=y.width,o.height=x.height=y.height;const K=(H==null?void 0:H.id)===v,ie=(V==null?void 0:V.id)===v,ee=K&&H.sceneCanvas||o,le=ie&&V.sceneCanvas||o,D=K?Math.min(1,Math.max(0,(A-Q)/P)):Math.min(1,Math.max(0,1-(Q+b-A)/P));qp({name:k,progress:D,to:ee,from:le,canvas:x});const O=f.getContext("2d");if(!O)return;O.globalCompositeOperation="lighter",O.drawImage(x,0,0,x.width,x.height)}c.drawImage(f,0,0,f.width,f.height)}}},tracks:s,duration:Math.max(...s.map(({duration:l})=>l))}}const Xp={name:"@vouchfor/embeds",version:"0.0.0-experiment.c43cbe4",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"experiment",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js","test:watch":"yarn test --watch"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.0","@vouchfor/canvas-video":"0.0.0-experiment.c43cbe4","@vouchfor/media-player":"0.0.0-experiment.c43cbe4",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^4.0.0","@storybook/addon-essentials":"^8.0.4","@storybook/addon-links":"^8.0.4","@storybook/blocks":"^8.0.4","@storybook/web-components":"^8.0.4","@storybook/web-components-vite":"^8.0.4","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.6","@vouchfor/eslint-config":"^1.0.1","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"0.0.0-experiment.c43cbe4","@web/dev-server-esbuild":"^1.0.2","@web/test-runner":"^0.18.1","@web/test-runner-browserstack":"^0.7.1","@web/test-runner-mocha":"^0.9.0","@web/test-runner-playwright":"^0.11.0",glob:"^10.3.10","lint-staged":"^15.2.2",lit:"^3.1.2",lodash:"^4.17.21",react:"^18.2.0","react-dom":"^18.2.0","rollup-plugin-tla":"^0.0.2",sinon:"^17.0.1",storybook:"^8.0.4",svgson:"^5.3.1",typescript:"^5.4.3",vite:"^5.2.2","vite-plugin-commonjs":"^0.10.1","vite-plugin-dts":"^3.7.3","web-component-analyzer":"^2.0.0"}};function jp(r){const{publicApiUrl:e}=Vn(r),t=Pr();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function zp(r){var s,o,a,l,A,c,u,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Pr()};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=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const n=Pr();return e||(e=jp(r),(h=(u=window.localStorage)==null?void 0:u.setItem)==null||h.call(u,"vouch-uid-visitor",e)),t||(t=Pr(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),i||(i=Pr(),(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 Zp(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function em(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:Xp.version,templateVersion:kp,...i}}const Rc=1;class tm{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const n=Zp(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}=Vn(this.host.env),{client:i,tab:n,request:s,visitor:o}=zp(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":em(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Rc&&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]+Rc&&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 ia={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Ci<"u"&&Ci,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 a<"u"&&a,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(D){return D&&DataView.prototype.isPrototypeOf(D)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(D){return D&&c.indexOf(Object.prototype.toString.call(D))>-1};function h(D){if(typeof D!="string"&&(D=String(D)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(D)||D==="")throw new TypeError('Invalid character in header field name: "'+D+'"');return D.toLowerCase()}function d(D){return typeof D!="string"&&(D=String(D)),D}function f(D){var O={next:function(){var X=D.shift();return{done:X===void 0,value:X}}};return l.iterable&&(O[Symbol.iterator]=function(){return O}),O}function g(D){this.map={},D instanceof g?D.forEach(function(O,X){this.append(X,O)},this):Array.isArray(D)?D.forEach(function(O){this.append(O[0],O[1])},this):D&&Object.getOwnPropertyNames(D).forEach(function(O){this.append(O,D[O])},this)}g.prototype.append=function(D,O){D=h(D),O=d(O);var X=this.map[D];this.map[D]=X?X+", "+O:O},g.prototype.delete=function(D){delete this.map[h(D)]},g.prototype.get=function(D){return D=h(D),this.has(D)?this.map[D]:null},g.prototype.has=function(D){return this.map.hasOwnProperty(h(D))},g.prototype.set=function(D,O){this.map[h(D)]=d(O)},g.prototype.forEach=function(D,O){for(var X in this.map)this.map.hasOwnProperty(X)&&D.call(O,this.map[X],X,this)},g.prototype.keys=function(){var D=[];return this.forEach(function(O,X){D.push(X)}),f(D)},g.prototype.values=function(){var D=[];return this.forEach(function(O){D.push(O)}),f(D)},g.prototype.entries=function(){var D=[];return this.forEach(function(O,X){D.push([X,O])}),f(D)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(D){if(D.bodyUsed)return Promise.reject(new TypeError("Already read"));D.bodyUsed=!0}function v(D){return new Promise(function(O,X){D.onload=function(){O(D.result)},D.onerror=function(){X(D.error)}})}function Q(D){var O=new FileReader,X=v(O);return O.readAsArrayBuffer(D),X}function b(D){var O=new FileReader,X=v(O);return O.readAsText(D),X}function y(D){for(var O=new Uint8Array(D),X=new Array(O.length),_=0;_<O.length;_++)X[_]=String.fromCharCode(O[_]);return X.join("")}function x(D){if(D.slice)return D.slice(0);var O=new Uint8Array(D.byteLength);return O.set(new Uint8Array(D)),O.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(D){this.bodyUsed=this.bodyUsed,this._bodyInit=D,D?typeof D=="string"?this._bodyText=D:l.blob&&Blob.prototype.isPrototypeOf(D)?this._bodyBlob=D:l.formData&&FormData.prototype.isPrototypeOf(D)?this._bodyFormData=D:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)?this._bodyText=D.toString():l.arrayBuffer&&l.blob&&A(D)?(this._bodyArrayBuffer=x(D.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(D)||u(D))?this._bodyArrayBuffer=x(D):this._bodyText=D=Object.prototype.toString.call(D):this._bodyText="",this.headers.get("content-type")||(typeof D=="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(D)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var D=p(this);if(D)return D;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 D=p(this);return D||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(Q)}),this.text=function(){var D=p(this);if(D)return D;if(this._bodyBlob)return b(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(P)}),this.json=function(){return this.text().then(JSON.parse)},this}var k=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function H(D){var O=D.toUpperCase();return k.indexOf(O)>-1?O:D}function V(D,O){if(!(this instanceof V))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');O=O||{};var X=O.body;if(D instanceof V){if(D.bodyUsed)throw new TypeError("Already read");this.url=D.url,this.credentials=D.credentials,O.headers||(this.headers=new g(D.headers)),this.method=D.method,this.mode=D.mode,this.signal=D.signal,!X&&D._bodyInit!=null&&(X=D._bodyInit,D.bodyUsed=!0)}else this.url=String(D);if(this.credentials=O.credentials||this.credentials||"same-origin",(O.headers||!this.headers)&&(this.headers=new g(O.headers)),this.method=H(O.method||this.method||"GET"),this.mode=O.mode||this.mode||null,this.signal=O.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(X),(this.method==="GET"||this.method==="HEAD")&&(O.cache==="no-store"||O.cache==="no-cache")){var _=/([?&])_=[^&]*/;if(_.test(this.url))this.url=this.url.replace(_,"$1_="+new Date().getTime());else{var S=/\?/;this.url+=(S.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}V.prototype.clone=function(){return new V(this,{body:this._bodyInit})};function P(D){var O=new FormData;return D.trim().split("&").forEach(function(X){if(X){var _=X.split("="),S=_.shift().replace(/\+/g," "),F=_.join("=").replace(/\+/g," ");O.append(decodeURIComponent(S),decodeURIComponent(F))}}),O}function K(D){var O=new g,X=D.replace(/\r?\n[\t ]+/g," ");return X.split("\r").map(function(_){return _.indexOf(`
|
2454
|
+
`).flatMap(s=>{const o=s.split(" ").filter(Boolean);return o.length?o.slice(1).reduce((a,l,A)=>{const u=`${a[a.length-1].text} ${l}`.trim(),h=r.measureText(u);if(h.width>i)a=[...a,...dc({context:r,word:l,maxW:i})];else{const d=e[A%e.length];r.font=r.font.replace(ii,d.toString()),a[a.length-1]={text:u,metrics:h}}return a},dc({context:r,word:o[0],maxW:i})):{text:"",metrics:r.measureText("")}})}finally{r.restore()}},{cacheKey:([{fontSizes:r,text:e,maxW:t}])=>`${JSON.stringify(r)}_${e}_${t}`}),Qr=1.8;function yp({context:r,x:e,y:t,width:i,height:n,radii:s}){let o,a,l,A;typeof s=="number"?o=a=l=A=s:[o,a,l,A]=s,r.beginPath(),r.moveTo(e+Math.min(n/Qr,o),t),r.lineTo(e+i-Math.min(n/Qr,a),t),r.quadraticCurveTo(e+i,t,e+i,t+Math.min(n/Qr,a)),r.lineTo(e+i,t+n-Math.min(n/Qr,l)),r.quadraticCurveTo(e+i,t+n,e+i-Math.min(n/Qr,l),t+n),r.lineTo(e+Math.min(n/Qr,A),t+n),r.quadraticCurveTo(e,t+n,e,t+n-Math.min(n/Qr,A)),r.lineTo(e,t+Math.min(n/Qr,o)),r.quadraticCurveTo(e,t,e+Math.min(n/Qr,o),t),r.closePath()}function fc({context:r,x:e,y:t,width:i,height:n,radii:s,clip:o=!1,debug:a=!1}){yp({context:r,x:e,y:t,width:i,height:n,radii:s}),a&&(r.strokeStyle="blue",r.stroke()),o&&r.clip()}const gc=[{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 hs({text:r,font:e}){let t=e;return gc.forEach(({family:i,regex:n})=>{n.exec(r)&&(t+=`, ${i}`)}),t}vo(({context:r,fontSizes:e,maxW:t=1/0,words:i})=>{try{return r.save(),r.font=r.font.replace(ii,e[0].toString()),i.length<=0?[]:i.slice(1).reduce((n,s)=>{var o;const a=s.text,A=`${(o=n[n.length-1])==null?void 0:o.text} ${a}`.trim(),c=r.measureText(A);if(c.width>t){const u=e[n.length%e.length];r.font=r.font.replace(ii,u.toString()),n=[...n,{text:a,metrics:r.measureText(a),words:[s]}]}else n[n.length-1]={text:A,metrics:c,words:[...n[n.length-1].words,s]};return n},[{text:i[0].text,metrics:r.measureText(i[0].text),words:[i[0]]}])}finally{r.restore()}},{cacheKey:([{fontSizes:r,words:e,maxW:t}])=>`${JSON.stringify(r)}_${JSON.stringify(e)}_${t}`});let ds;const Bp=new Uint8Array(16);function Tp(){if(!ds&&(ds=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ds))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ds(Bp)}const yt=[];for(let r=0;r<256;++r)yt.push((r+256).toString(16).slice(1));function Qp(r,e=0){return yt[r[e+0]]+yt[r[e+1]]+yt[r[e+2]]+yt[r[e+3]]+"-"+yt[r[e+4]]+yt[r[e+5]]+"-"+yt[r[e+6]]+yt[r[e+7]]+"-"+yt[r[e+8]]+yt[r[e+9]]+"-"+yt[r[e+10]]+yt[r[e+11]]+yt[r[e+12]]+yt[r[e+13]]+yt[r[e+14]]+yt[r[e+15]]}const pc={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function bp(r,e,t){if(pc.randomUUID&&!e&&!r)return pc.randomUUID();r=r||{};const i=r.random||(r.rng||Tp)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let n=0;n<16;++n)e[t+n]=i[n];return e}return Qp(i)}const mc=vo(({font:r,scale:e,context:t,maxW:i,maxH:n,text:s,minSize:o,maxSize:a})=>{var l,A;let c=0;if(a){c=(o??0)*e;let h=0;for(;a*e>c+1;){c+=1;const d=Zo({context:t,fontSizes:[c],text:s,maxW:i});if(h=d.reduce((f,g)=>(g.metrics.width>f&&(f=g.metrics.width),f),0),h>i||d.length*c>n){c-=1;break}}}else c=parseFloat(((A=(l=r.match(ii))==null?void 0:l.groups)==null?void 0:A.value)??"0")*e;return c},{cacheKey:([{font:r,text:e,minSize:t,maxSize:i,scale:n,maxW:s,maxH:o}])=>`${r}_${e}_${t}_${i}_${n}_${s}_${o}`}),xp="text",Ec={100:"Thin",200:"ExtraLight",300:"Light",400:"Regular",500:"Medium",600:"SemiBold",700:"Bold",800:"ExtraBold",900:"Black"},wp={type:xp,options:{value:{type:"textarea",name:"value",label:"Text",rows:4},color:{type:"color",name:"color",label:"Text colour"},"font.size":{type:"number",name:"size",label:"Font size",visible:r=>!r.wrap},"font.weight":{type:"select",name:"weight",label:"Font weight",options:r=>{var e;return((e=r.font.family.data)==null?void 0:e.weights.map(({weight:t})=>({label:Ec[t],value:t,data:t})))??[]}},"font.family":{type:"font",name:"family",label:"Font family"},wrap:{type:"checkbox",name:"wrap",label:"Text wrap"},align:{type:"radio",name:"align",label:"Text align",items:[{label:"Left",value:"left"},{label:"Center",value:"center"},{label:"Right",value:"right"}],visible:r=>r.wrap},fill:{type:"range",name:"fill",label:"Max font size",min:20,max:400,step:1,visible:r=>r.wrap}},transform:{values:r=>{var e;return{value:r.value,color:r.color??"#000000",font:{size:r.font.size,weight:{label:Ec[r.font.weight],value:r.font.weight,data:r.font.weight},family:{label:r.font.family.name,value:r.font.family.name,data:r.font.family}},wrap:r.wrap??!0,align:r.align??"left",fill:[((e=r.fill)==null?void 0:e.maxSize)??400]}},options:r=>{var e;return{value:r.value,color:r.color,font:{size:r.font.size,weight:r.font.weight.data,family:{name:r.font.family.value,weights:((e=r.font.family.data)==null?void 0:e.weights)??[]}},wrap:r.wrap,align:r.align,fill:{minSize:20,maxSize:r.fill[0]}}}},width:({node:r,options:e,dependencies:t,measureCanvas:i})=>{const{value:n="",align:s="left",wrap:o=!1}=e,{font:a}=t,l=i==null?void 0:i.getContext("2d");if(!l)return r.getComputedWidth();const A=`${a.weight} ${a.size}px ${a.family.name}`,c=hs({font:A,text:n});if(l.font=c,l.textBaseline="top",l.textAlign=s,o){const u=r.getParent(),h=r.getComputedMargin(nr.Edge.Left)+r.getComputedMargin(nr.Edge.Right)+((u==null?void 0:u.getComputedPadding(nr.Edge.Left))??0)+((u==null?void 0:u.getComputedPadding(nr.Edge.Right))??0);return Math.max(((u==null?void 0:u.getComputedWidth())??0)-h,r.getComputedWidth(),...n.split(" ").map(d=>l.measureText(d).width))}return l.measureText(n).width},height:({node:r,options:e,dependencies:t,measureCanvas:i})=>{var n,s;const{value:o="",fill:a,align:l="left",wrap:A=!1}=e,{font:c}=t,u=`${c.weight} ${c.size}px ${c.family.name}`,h=hs({font:u,text:o}),d=i==null?void 0:i.getContext("2d");if(!d)return r.getComputedHeight();if(d.font=h,d.textBaseline="top",d.textAlign=l,A){const f=r.getParent(),g=r.getComputedMargin(nr.Edge.Top)+r.getComputedMargin(nr.Edge.Bottom)+((f==null?void 0:f.getComputedPadding(nr.Edge.Top))??0)+((f==null?void 0:f.getComputedPadding(nr.Edge.Bottom))??0),p=r.getComputedWidth(),v=Math.max(((f==null?void 0:f.getComputedHeight())??0)-g,r.getComputedHeight()),Q=mc({font:h,scale:1,context:d,maxW:p,maxH:v,text:o??"",minSize:a==null?void 0:a.minSize,maxSize:a==null?void 0:a.maxSize});return Zo({context:d,fontSizes:[Q],text:o??"",maxW:p}).length*Q}else return parseFloat(((s=(n=h.match(ii))==null?void 0:n.groups)==null?void 0:s.value)??"0")},render:({dx:r,dy:e,dw:t,dh:i,options:n,dependencies:s,canvases:o})=>{const{value:a="",fill:l,color:A,align:c="left",wrap:u=!1}=n,{font:h}=s,d=`${h.weight} ${h.size}px ${h.family.name}`,f=o.sceneCanvas.getContext("2d");if(!f)return;f.save();const g=hs({font:d,text:a});f.font=g,f.textBaseline="top",f.fillStyle=A,f.textAlign=c;const p={left:r,center:r+t/2,right:r+t};if(u){const v=mc({font:g,scale:1,context:f,maxW:t,maxH:i,text:a??"",minSize:l==null?void 0:l.minSize,maxSize:l==null?void 0:l.maxSize});f.font=g.replace(ii,v.toString()),Zo({context:f,fontSizes:[v],text:a,maxW:t}).forEach((b,y)=>{f.fillText(b.text,p[c],e+v*y)})}else f.fillText(a,p[c],e);f.restore()}},Sp={type:"image",width:({node:r,dependencies:e})=>{var t,i,n,s;const o=r.getComputedHeight();if(!o)return r.getComputedWidth();const a=((t=e.image)==null?void 0:t.naturalWidth)??((i=e.image)==null?void 0:i.width),l=((n=e.image)==null?void 0:n.naturalHeight)??((s=e.image)==null?void 0:s.height),A=a/l;return o*A},height:({node:r,dependencies:e})=>{var t,i,n,s;const o=((t=e.image)==null?void 0:t.naturalWidth)??((i=e.image)==null?void 0:i.width),a=((n=e.image)==null?void 0:n.naturalHeight)??((s=e.image)==null?void 0:s.height),l=o/a;return r.getComputedWidth()/l},render:async({dx:r,dy:e,dw:t,dh:i,radius:n,dependencies:s,canvases:o})=>{const a=o.sceneCanvas.getContext("2d");if(!(!a||!s.image)){if(a.save(),n){const{topLeft:l,topRight:A,bottomLeft:c,bottomRight:u}=n;fc({context:a,x:r,y:e,width:t,height:i,radii:[l,A,u,c]}),a.clip()}a.drawImage(s.image,r,e,t,i),a.restore()}}},Rp={type:"video",options:{crop:{type:"crop",name:"crop",label:"Crop"},speed:{type:"slider",name:"speed",label:"Speed",min:.5,max:4,step:.01},volume:{type:"slider",name:"volume",label:"Volume",min:0,max:1,step:.01}},transform:{values:r=>({format:r.format??"crop",crop:r.crop??{x:0,y:0,width:1,height:1},speed:[r.speed??1],volume:[r.volume??1]}),options:r=>({format:r.format,crop:r.crop,speed:r.speed[0],volume:r.volume[0]})},width:async({node:r,options:e,dependencies:t})=>{const{crop:i,format:n}=e,{aspectRatio:s}=t;if(n==="crop")return r.getComputedWidth();const o=s*(((i==null?void 0:i.width)??1)/((i==null?void 0:i.height)??1)),a=r.getComputedWidth(),l=r.getComputedHeight(),A=a/l;return o>A?a:l*o},height:async({node:r,options:e,dependencies:t})=>{const{crop:i,format:n}=e,{aspectRatio:s}=t;if(n==="crop")return r.getComputedHeight();const o=s*(((i==null?void 0:i.width)??1)/((i==null?void 0:i.height)??1));return r.getComputedWidth()/o},render:async({dx:r,dy:e,dw:t,dh:i,radius:n,sceneTime:s,options:o,dependencies:a,canvases:l})=>{const{crop:A,format:c="letterbox"}=o,u=l.sceneCanvas.getContext("2d");if(!u)return;const h=await a.video(s),d=(h==null?void 0:h.videoWidth)??(h==null?void 0:h.naturalWidth)??(h==null?void 0:h.width),f=(h==null?void 0:h.videoHeight)??(h==null?void 0:h.naturalHeight)??(h==null?void 0:h.height);if(d&&f){if(u.save(),n){const{topLeft:g,topRight:p,bottomLeft:v,bottomRight:Q}=n;fc({context:u,x:r,y:e,width:t,height:i,radii:[g,p,Q,v]}),u.clip()}Cp({context:u,crop:A,format:c,sourceWidth:d,sourceHeight:f,source:h,posX:r,posY:e,drawAreaWidth:t,drawAreaHeight:i,cropCanvas:l.cropCanvas,letterboxCanvas:l.letterboxCanvas}),u.restore()}}},Dp={type:"audio",options:{speed:{type:"slider",name:"speed",label:"Speed",min:.5,max:4,step:.01},volume:{type:"slider",name:"volume",label:"Volume",min:0,max:1,step:.01}},transform:{values:r=>({speed:[r.speed??1],volume:[r.volume??1]}),options:r=>({speed:r.speed[0],volume:r.volume[0]})}};function _p(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 Lp(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 Fp=ti(()=>nr.loadYoga());$f.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${Lp(r)}"`:_p(r)||Array.isArray(r)?JSON.stringify(r):r);const kp="3";function Mp(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 Np(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{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 Ic(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{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 vc(r,e,{layout:t,scale:i=1}){const{position:n="relative",inset:s,width:o,height:a,minWidth:l,minHeight:A,maxWidth:c,maxHeight:u,flex:h,gap:d,margin:f,padding:g,direction:p="column",align:v="start",alignSelf:Q,justify:b="start"}=t??{},y={static:r.POSITION_TYPE_STATIC,relative:r.POSITION_TYPE_RELATIVE,absolute:r.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(y[n]),s){const{top:H,right:V,bottom:P,left:K}=Np(s,i);typeof H<"u"&&e.setPosition(r.EDGE_TOP,H),typeof V<"u"&&e.setPosition(r.EDGE_RIGHT,V),typeof P<"u"&&e.setPosition(r.EDGE_BOTTOM,P),typeof K<"u"&&e.setPosition(r.EDGE_LEFT,K)}const x={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(x[p]);const R={start:r.ALIGN_FLEX_START,end:r.ALIGN_FLEX_END,center:r.ALIGN_CENTER,stretch:r.ALIGN_STRETCH};e.setAlignItems(R[v]),Q&&e.setAlignSelf(R[Q]);const k={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(k[b]),f){const{top:H,right:V,bottom:P,left:K}=Ic(f,i);e.setMargin(r.EDGE_TOP,H),e.setMargin(r.EDGE_RIGHT,V),e.setMargin(r.EDGE_BOTTOM,P),e.setMargin(r.EDGE_LEFT,K)}if(g){const{top:H,right:V,bottom:P,left:K}=Ic(g,i);e.setPadding(r.EDGE_TOP,H),e.setPadding(r.EDGE_RIGHT,V),e.setPadding(r.EDGE_BOTTOM,P),e.setPadding(r.EDGE_LEFT,K)}typeof h<"u"&&e.setFlex(h),e.setGap(r.GUTTER_ALL,(d??0)*i),typeof o<"u"&&e.setWidth(typeof o=="number"?o*i:o),typeof a<"u"&&(typeof a=="function"?e.setHeight("100%"):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 c<"u"&&e.setMaxWidth(typeof c=="number"?c*i:c),typeof u<"u"&&e.setMaxHeight(typeof u=="number"?u*i:u)}async function Cc({yoga:r,index:e,parent:t,element:i,resolvers:n}){var s,o;const{type:a,layout:l={},config:A,options:c,renderer:u}=i,h=r.Node.create();vc(r,h,{layout:l}),t.insertChild(h,e);let d=null;n&&((u==null?void 0:u.type)==="text"||(u==null?void 0:u.type)==="image"||(u==null?void 0:u.type)==="video")&&(d=await((s=n[u.type])==null?void 0:s.call(n,{config:A,options:c}))??null);const f=[];for await(const[g,p]of((o=i.children)==null?void 0:o.entries())??[])f.push(await Cc({yoga:r,index:g,parent:h,element:p,resolvers:n}));return t.calculateLayout(),{type:a,node:h,radius:Mp(l.radius),element:i,renderer:u,config:A,options:c,dependencies:d,childNodes:f}}function yc(r,e,t=0,i=0){const{top:n,left:s}=r.getComputedLayout(),{top:o,left:a,width:l,height:A}=e.node.getComputedLayout(),c=t+a,u=i+o,h=e.childNodes.map(d=>yc(r,d,c,u));return{...e,x:s+c,y:n+u,width:l,height:A,childNodes:h}}async function ea(r,e,t){for await(const{node:i,options:n,dependencies:s,renderer:o,childNodes:a}of e){if(o){const{width:l,height:A}=o;if(l){const c=await l({node:i,options:n,dependencies:s,measureCanvas:t});i.setWidth(c)}if(await ea(r,a,t),A){const c=await A({node:i,options:n,dependencies:s,measureCanvas:t});i.setHeight(c)}}await ea(r,a,t)}r.calculateLayout()}async function Bc({root:r,resolvers:e,measureCanvas:t}){const i=await Fp(),n=i.Node.create();vc(i,n,{layout:r.layout});const s=await Cc({yoga:i,index:0,parent:n,element:r.element,resolvers:e});await ea(n,[s],t);const{top:o,left:a,width:l,height:A}=n.getComputedLayout(),c={root:{x:a,y:o,width:l,height:A},node:yc(n,s)};return n.freeRecursive(),c}function br(r){let e=0;for(const t of r)Array.isArray(t)?e+=br(t):e+=t;return e}function ta(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,c=((o=r[i+1])==null?void 0:o.duration)??1/0,u=((a=r[i+2])==null?void 0:a.type)==="transition"?r[i+2]:null;return Math.min(l?A/2:A,t,u?c/2:c)*-1}return t})}function Tc(r){var e;return{...r,children:((e=r.children)==null?void 0:e.map(t=>{if(t.type!=="recipe")return Tc(t)}).filter(Boolean))??[]}}function Qc(r){const e={box:0,image:0,video:0,text:0,audio:0};r.renderer&&(e[r.renderer.type]+=1);for(const t of r.children??[]){const{box:i,image:n,video:s,text:o,audio:a}=Qc(t);e.box+=i,e.image+=n,e.video+=s,e.text+=o,e.audio+=a}return e}function Pp(r){return r.video>0?Rp.type:r.image>0?Sp.type:r.audio>0?Dp.type:wp.type}function bc({node:r,duration:e}){const t=[];if(r.type==="recipe"){const i=Tc({...r.element,layout:{...r.element.layout,position:"static",width:"100%",height:"100%",margin:0}}),n=Qc(i);t.push({type:Pp(n),id:bp(),x:r.x,y:r.y,width:r.width,height:r.height,duration:e,root:{element:i}})}for(const i of r.childNodes)t.push(...bc({node:i,duration:e}));return t}async function Op({scene:r,start:e=0}){const{root:t,duration:i}=r,n=await Bc({root:t});return{type:r.type,start:e,duration:i,layout:n,id:r.id,config:r}}async function Up({track:r}){const e=ta(r),t=await Promise.all(r.reduce((s,o,a)=>{if(o.type!=="audio")return s;const l=br(e.slice(0,a));return s.push(Op({scene:o,start:l})),s},[])),i=r.reduce((s,o,a)=>{if(o.type!=="gap")return s;const l=br(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 xc(){return document.createElement("canvas")}async function wc({node:r,canvases:e,sceneTime:t}){var i,n;await((n=(i=r.renderer)==null?void 0:i.render)==null?void 0:n.call(i,{canvases:e,sceneTime:t,dx:r.x,dy:r.y,dw:r.width,dh:r.height,radius:r.radius,options:r.options,dependencies:r.dependencies}));const{sceneCanvas:s}=e,o=s.getContext("2d");o&&(o.strokeStyle="red",o.strokeRect(r.x,r.y,r.width,r.height));for await(const a of r.childNodes)await wc({node:a,canvases:e,sceneTime:t})}async function Gp({layout:r,canvases:e,sceneTime:t}){const{node:i}=r;await wc({node:i,canvases:e,sceneTime:t})}async function ra({scene:r,start:e=0,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s=xc}){var o,a;const{x:l,y:A,width:c,height:u,root:h,duration:d}=r,f=await s(),g=await s(),p=await s(),v=await s(),Q=await s(),b=await s(),y=await Bc({root:{...h,layout:{...h.layout,width:i,height:n},element:{...h.element,layout:{...h.element.layout,...typeof l=="number"&&typeof A=="number"?{position:"absolute",inset:{top:A,left:l}}:{},width:c??((o=h.element.layout)==null?void 0:o.width),height:u??((a=h.element.layout)==null?void 0:a.height)}}},resolvers:t,measureCanvas:b}),x=async R=>{const k=Math.max(0,R-e);f.width=f.height=0,f.width=i,f.height=n,await Gp({layout:y,sceneTime:k,canvases:{sceneCanvas:f,cropCanvas:p,letterboxCanvas:v,posterCanvas:Q}})};return{type:r.type,draw:x,start:e,duration:d,layout:y,sceneCanvas:f,transitionCanvas:g,id:r.id,config:r,childScenes:bc({node:y.node,duration:d})}}async function Hp({track:r,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n}){const s=ta(r),o=await Promise.all(r.reduce((c,u,h)=>{const d=br(s.slice(0,h));return u.type==="video"&&c.push(ra({scene:u,start:d,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n})),u.type==="image"&&c.push(ra({scene:u,start:d,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n})),c},[])),a=r.reduce((c,u,h)=>{if(u.type!=="gap")return c;const d=br(s.slice(0,h));return c.push({type:u.type,id:u.id,start:d,config:u,duration:u.duration}),c},[]),l=r.reduce((c,u,h)=>{if(u.type!=="transition")return c;const d=u.duration,f=br(s.slice(0,h))-d;return c.push({type:u.type,id:u.id,name:u.name,start:f,duration:d,config:u,to:o.find(({id:g})=>{var p;return g===((p=r[h+1])==null?void 0:p.id)}),from:o.find(({id:g})=>{var p;return g===((p=r[h-1])==null?void 0:p.id)})}),c},[]),A=r.map(({id:c})=>o.find(({id:u})=>u===c)??a.find(({id:u})=>u===c)??l.find(({id:u})=>u===c)).filter(Boolean);return{type:"picture",scenes:o,gapScenes:a,transitions:l,mergedScenes:A,duration:Math.max(0,...A.map(({start:c,duration:u})=>c+u)),trackCanvas:await n()}}async function $p({track:r,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n}){const s=ta(r),o=await Promise.all(r.reduce((c,u,h)=>{const d=br(s.slice(0,h));return u.type==="text"&&c.push(ra({scene:u,start:d,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n})),c},[])),a=r.reduce((c,u,h)=>{if(u.type!=="gap")return c;const d=br(s.slice(0,h));return c.push({type:u.type,id:u.id,start:d,config:u,duration:u.duration}),c},[]),l=r.reduce((c,u,h)=>{if(u.type!=="transition")return c;const d=u.duration,f=br(s.slice(0,h))-d;return c.push({type:u.type,id:u.id,name:u.name,start:f,duration:d,config:u,to:o.find(({id:g})=>{var p;return g===((p=r[h+1])==null?void 0:p.id)}),from:o.find(({id:g})=>{var p;return g===((p=r[h-1])==null?void 0:p.id)})}),c},[]),A=r.map(({id:c})=>o.find(({id:u})=>u===c)??a.find(({id:u})=>u===c)??l.find(({id:u})=>u===c)).filter(Boolean);return{type:"text",scenes:o,gapScenes:a,transitions:l,mergedScenes:A,duration:Math.max(...A.map(({start:c,duration:u})=>c+u)),trackCanvas:await n()}}function Yp(r){return r.some(({type:e})=>e==="video"||e==="image")}function Vp(r){return r.some(({type:e})=>e==="audio")}function Kp(r){return r.some(({type:e})=>e==="text")}function Wp(r){return r.type==="audio"}const Jp=(((hc=uc)==null?void 0:hc.default)??uc).reduce((r,e)=>(r[e.name]=e,r),{});function qp({name:r,canvas:e,to:t,from:i,progress:n}){var s,o,a;const l=e.getContext("webgl",{alpha:!0});if(l){l.disable(l.DEPTH_TEST),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,!0);const A=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,A),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,-1,4,4,-1]),l.STATIC_DRAW),l.viewport(0,0,e.width,e.height);const c=(((s=ls)==null?void 0:s.default)??ls)(l,i);c.minFilter=l.LINEAR,c.magFilter=l.LINEAR;const u=(((o=ls)==null?void 0:o.default)??ls)(l,t);u.minFilter=l.LINEAR,u.magFilter=l.LINEAR;const h=(((a=cc)==null?void 0:a.default)??cc)(l,Jp[r]);h.draw(n,c,u,e.width,e.height),c.dispose(),u.dispose(),h.dispose(),l.flush()}}async function Sc({config:r,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n=xc}){const s=await Promise.all(r.tracks.map(async l=>{if(Yp(l))return{...await Hp({track:l,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n}),config:l};if(Kp(l))return{...await $p({track:l,resolvers:e,rootWidth:t,rootHeight:i,canvasFactory:n}),config:l};if(Vp(l))return{...await Up({track:l}),config:l};throw new Error("Unknown track type")}));console.log({tracks:s});const o=await n();return{draw:async({canvas:l,currentTime:A})=>{const c=l.getContext("2d");if(c){c.globalAlpha=1,c.globalCompositeOperation="source-over",c.clearRect(0,0,l.width,l.height),c.save(),c.fillStyle="black",c.fillRect(0,0,l.width,l.height),c.restore();for await(const u of s){if(Wp(u))continue;const{scenes:h,transitions:d,trackCanvas:f}=u;f.width=f.height=0,f.width=l.width,f.height=l.height;const g=h.filter(({start:v,duration:Q})=>A>=v&&A<v+Q);if(g.length<=0)continue;const p=d.find(({start:v,duration:Q})=>A>=v&&A<v+Q);for await(const{id:v,start:Q,duration:b,sceneCanvas:y,transitionCanvas:x,draw:R}of g)if(await(R==null?void 0:R(A)),!p)c.drawImage(y,0,0,y.width,y.height);else{const{name:k,to:H,from:V,duration:P}=p;o.width=o.height=x.width=x.height=0,o.width=x.width=y.width,o.height=x.height=y.height;const K=(H==null?void 0:H.id)===v,ie=(V==null?void 0:V.id)===v,ee=K&&H.sceneCanvas||o,le=ie&&V.sceneCanvas||o,D=K?Math.min(1,Math.max(0,(A-Q)/P)):Math.min(1,Math.max(0,1-(Q+b-A)/P));qp({name:k,progress:D,to:ee,from:le,canvas:x});const O=f.getContext("2d");if(!O)return;O.globalCompositeOperation="lighter",O.drawImage(x,0,0,x.width,x.height)}c.drawImage(f,0,0,f.width,f.height)}}},tracks:s,duration:Math.max(...s.map(({duration:l})=>l))}}const Xp={name:"@vouchfor/embeds",version:"0.0.0-experiment.c485446",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"experiment",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js","test:watch":"yarn test --watch"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.0","@vouchfor/canvas-video":"0.0.0-experiment.c485446","@vouchfor/media-player":"0.0.0-experiment.c485446",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^4.0.0","@storybook/addon-essentials":"^8.0.4","@storybook/addon-links":"^8.0.4","@storybook/blocks":"^8.0.4","@storybook/web-components":"^8.0.4","@storybook/web-components-vite":"^8.0.4","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.6","@vouchfor/eslint-config":"^1.0.1","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"0.0.0-experiment.c485446","@web/dev-server-esbuild":"^1.0.2","@web/test-runner":"^0.18.1","@web/test-runner-browserstack":"^0.7.1","@web/test-runner-mocha":"^0.9.0","@web/test-runner-playwright":"^0.11.0",glob:"^10.3.10","lint-staged":"^15.2.2",lit:"^3.1.2",lodash:"^4.17.21",react:"^18.2.0","react-dom":"^18.2.0","rollup-plugin-tla":"^0.0.2",sinon:"^17.0.1",storybook:"^8.0.4",svgson:"^5.3.1",typescript:"^5.4.3",vite:"^5.2.2","vite-plugin-commonjs":"^0.10.1","vite-plugin-dts":"^3.7.3","web-component-analyzer":"^2.0.0"}};function jp(r){const{publicApiUrl:e}=Vn(r),t=Pr();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function zp(r){var s,o,a,l,A,c,u,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Pr()};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=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const n=Pr();return e||(e=jp(r),(h=(u=window.localStorage)==null?void 0:u.setItem)==null||h.call(u,"vouch-uid-visitor",e)),t||(t=Pr(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),i||(i=Pr(),(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 Zp(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function em(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:Xp.version,templateVersion:kp,...i}}const Rc=1;class tm{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const n=Zp(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}=Vn(this.host.env),{client:i,tab:n,request:s,visitor:o}=zp(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":em(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Rc&&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]+Rc&&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 ia={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Ci<"u"&&Ci,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 a<"u"&&a,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(D){return D&&DataView.prototype.isPrototypeOf(D)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(D){return D&&c.indexOf(Object.prototype.toString.call(D))>-1};function h(D){if(typeof D!="string"&&(D=String(D)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(D)||D==="")throw new TypeError('Invalid character in header field name: "'+D+'"');return D.toLowerCase()}function d(D){return typeof D!="string"&&(D=String(D)),D}function f(D){var O={next:function(){var X=D.shift();return{done:X===void 0,value:X}}};return l.iterable&&(O[Symbol.iterator]=function(){return O}),O}function g(D){this.map={},D instanceof g?D.forEach(function(O,X){this.append(X,O)},this):Array.isArray(D)?D.forEach(function(O){this.append(O[0],O[1])},this):D&&Object.getOwnPropertyNames(D).forEach(function(O){this.append(O,D[O])},this)}g.prototype.append=function(D,O){D=h(D),O=d(O);var X=this.map[D];this.map[D]=X?X+", "+O:O},g.prototype.delete=function(D){delete this.map[h(D)]},g.prototype.get=function(D){return D=h(D),this.has(D)?this.map[D]:null},g.prototype.has=function(D){return this.map.hasOwnProperty(h(D))},g.prototype.set=function(D,O){this.map[h(D)]=d(O)},g.prototype.forEach=function(D,O){for(var X in this.map)this.map.hasOwnProperty(X)&&D.call(O,this.map[X],X,this)},g.prototype.keys=function(){var D=[];return this.forEach(function(O,X){D.push(X)}),f(D)},g.prototype.values=function(){var D=[];return this.forEach(function(O){D.push(O)}),f(D)},g.prototype.entries=function(){var D=[];return this.forEach(function(O,X){D.push([X,O])}),f(D)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(D){if(D.bodyUsed)return Promise.reject(new TypeError("Already read"));D.bodyUsed=!0}function v(D){return new Promise(function(O,X){D.onload=function(){O(D.result)},D.onerror=function(){X(D.error)}})}function Q(D){var O=new FileReader,X=v(O);return O.readAsArrayBuffer(D),X}function b(D){var O=new FileReader,X=v(O);return O.readAsText(D),X}function y(D){for(var O=new Uint8Array(D),X=new Array(O.length),_=0;_<O.length;_++)X[_]=String.fromCharCode(O[_]);return X.join("")}function x(D){if(D.slice)return D.slice(0);var O=new Uint8Array(D.byteLength);return O.set(new Uint8Array(D)),O.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(D){this.bodyUsed=this.bodyUsed,this._bodyInit=D,D?typeof D=="string"?this._bodyText=D:l.blob&&Blob.prototype.isPrototypeOf(D)?this._bodyBlob=D:l.formData&&FormData.prototype.isPrototypeOf(D)?this._bodyFormData=D:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)?this._bodyText=D.toString():l.arrayBuffer&&l.blob&&A(D)?(this._bodyArrayBuffer=x(D.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(D)||u(D))?this._bodyArrayBuffer=x(D):this._bodyText=D=Object.prototype.toString.call(D):this._bodyText="",this.headers.get("content-type")||(typeof D=="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(D)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var D=p(this);if(D)return D;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 D=p(this);return D||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(Q)}),this.text=function(){var D=p(this);if(D)return D;if(this._bodyBlob)return b(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(P)}),this.json=function(){return this.text().then(JSON.parse)},this}var k=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function H(D){var O=D.toUpperCase();return k.indexOf(O)>-1?O:D}function V(D,O){if(!(this instanceof V))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');O=O||{};var X=O.body;if(D instanceof V){if(D.bodyUsed)throw new TypeError("Already read");this.url=D.url,this.credentials=D.credentials,O.headers||(this.headers=new g(D.headers)),this.method=D.method,this.mode=D.mode,this.signal=D.signal,!X&&D._bodyInit!=null&&(X=D._bodyInit,D.bodyUsed=!0)}else this.url=String(D);if(this.credentials=O.credentials||this.credentials||"same-origin",(O.headers||!this.headers)&&(this.headers=new g(O.headers)),this.method=H(O.method||this.method||"GET"),this.mode=O.mode||this.mode||null,this.signal=O.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(X),(this.method==="GET"||this.method==="HEAD")&&(O.cache==="no-store"||O.cache==="no-cache")){var _=/([?&])_=[^&]*/;if(_.test(this.url))this.url=this.url.replace(_,"$1_="+new Date().getTime());else{var S=/\?/;this.url+=(S.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}V.prototype.clone=function(){return new V(this,{body:this._bodyInit})};function P(D){var O=new FormData;return D.trim().split("&").forEach(function(X){if(X){var _=X.split("="),S=_.shift().replace(/\+/g," "),F=_.join("=").replace(/\+/g," ");O.append(decodeURIComponent(S),decodeURIComponent(F))}}),O}function K(D){var O=new g,X=D.replace(/\r?\n[\t ]+/g," ");return X.split("\r").map(function(_){return _.indexOf(`
|
2455
2455
|
`)===0?_.substr(1,_.length):_}).forEach(function(_){var S=_.split(":"),F=S.shift().trim();if(F){var J=S.join(":").trim();O.append(F,J)}}),O}R.call(V.prototype);function ie(D,O){if(!(this instanceof ie))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');O||(O={}),this.type="default",this.status=O.status===void 0?200:O.status,this.ok=this.status>=200&&this.status<300,this.statusText=O.statusText===void 0?"":""+O.statusText,this.headers=new g(O.headers),this.url=O.url||"",this._initBody(D)}R.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},ie.error=function(){var D=new ie(null,{status:0,statusText:""});return D.type="error",D};var ee=[301,302,303,307,308];ie.redirect=function(D,O){if(ee.indexOf(O)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:O,headers:{location:D}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(O,X){this.message=O,this.name=X;var _=Error(O);this.stack=_.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function le(D,O){return new Promise(function(X,_){var S=new V(D,O);if(S.signal&&S.signal.aborted)return _(new o.DOMException("Aborted","AbortError"));var F=new XMLHttpRequest;function J(){F.abort()}F.onload=function(){var ne={status:F.status,statusText:F.statusText,headers:K(F.getAllResponseHeaders()||"")};ne.url="responseURL"in F?F.responseURL:ne.headers.get("X-Request-URL");var ce="response"in F?F.response:F.responseText;setTimeout(function(){X(new ie(ce,ne))},0)},F.onerror=function(){setTimeout(function(){_(new TypeError("Network request failed"))},0)},F.ontimeout=function(){setTimeout(function(){_(new TypeError("Network request failed"))},0)},F.onabort=function(){setTimeout(function(){_(new o.DOMException("Aborted","AbortError"))},0)};function Y(ne){try{return ne===""&&a.location.href?a.location.href:ne}catch{return ne}}F.open(S.method,Y(S.url),!0),S.credentials==="include"?F.withCredentials=!0:S.credentials==="omit"&&(F.withCredentials=!1),"responseType"in F&&(l.blob?F.responseType="blob":l.arrayBuffer&&S.headers.get("Content-Type")&&S.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(F.responseType="arraybuffer")),O&&typeof O.headers=="object"&&!(O.headers instanceof g)?Object.getOwnPropertyNames(O.headers).forEach(function(ne){F.setRequestHeader(ne,d(O.headers[ne]))}):S.headers.forEach(function(ne,ce){F.setRequestHeader(ce,ne)}),S.signal&&(S.signal.addEventListener("abort",J),F.onreadystatechange=function(){F.readyState===4&&S.signal.removeEventListener("abort",J)}),F.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return le.polyfill=!0,a.fetch||(a.fetch=le,a.Headers=g,a.Request=V,a.Response=ie),o.Headers=g,o.Request=V,o.Response=ie,o.fetch=le,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})(ia,ia.exports);var rm=ia.exports;const Dc=Co(rm);async function im(r){var e;try{if((e=await Dc(r,{method:"HEAD"}))!=null&&e.ok)return r}catch{return}}async function na({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=>im(o));e=(await Promise.all(s)).find(Boolean)}return e}async function nm(r){try{return(await Dc(r)).text()}catch{return null}}async function sm(r){return r=r.trim(),r.startsWith("http")||r.startsWith("blob:")?nm(r):r}const om=ti(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?sm(l):null},{cacheKey:([r,{language:e}])=>JSON.stringify({...r,language:e})});function am(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 lm=ti(async r=>{var e,t,i,n,s,o,a,l,A,c,u;const[h,d,f]=await Promise.all([na({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]}),na({sources:[(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),na({sources:[((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:u.xs)]})]);return{src:h,playlist:d,preview:f}},{cacheKey:([r])=>{var e,t,i,n,s,o,a,l,A,c,u;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)??((u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:u.xs)})}});function _c(r){var e,t,i,n,s,o,a,l,A,c,u,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=(u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.contact)==null?void 0:c.client)==null?void 0:u.name)==null?void 0:h.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}const Am=ti(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 c;return((c=A==null?void 0:A.answer)==null?void 0:c.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 sa({data:r,rootData:e,index:t},i){var n,s,o,a,l,A,c,u,h,d,f,g,p,v,Q,b,y,x,R,k,H,V,P,K;const[ie,ee,le]=await Promise.all([Am(r,e,t),lm(e),om({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)??((u=(c=e==null?void 0:e.answer)==null?void 0:c.captions)==null?void 0:u.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)]),D=_c(e);return{...ee,...D,key:ie,captions:le,wordTimings:am((v=e==null?void 0:e.answer)==null?void 0:v.transcription),answerLabel:((Q=e==null?void 0:e.answer)==null?void 0:Q.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((R=(x=(y=(b=r==null?void 0:r.questions)==null?void 0:b.items)==null?void 0:y[t-1])==null?void 0:x.answer)==null?void 0:R.label)??((V=(H=(k=r==null?void 0:r.questions)==null?void 0:k.items)==null?void 0:H[t-1])==null?void 0:V.title)??null:null,isFirstInstanceOfName:t?((K=(P=r==null?void 0:r.questions)==null?void 0:P.items)==null?void 0:K.findIndex(O=>_c(O).name===D.name))===t:!0}}const fs={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 cm({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,c,u;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=(u=(c=(A=(l=n==null?void 0:n.answer)==null?void 0:l.transcription)==null?void 0:A.translation)==null?void 0:c.language)==null?void 0:u.split("-")[0];return h&&fs[h]&&!i.find(f=>f.value===h)&&i.push({value:h,label:fs[h]}),d&&fs[d]&&!i.find(f=>f.value===d)&&i.push({value:d,label:fs[d]}),i},[]))??[]}/**
|
2456
2456
|
* @license
|
2457
2457
|
* Copyright 2018 Google LLC
|
@@ -2489,7 +2489,7 @@ vec4 transition(vec2 uv) {
|
|
2489
2489
|
* @license
|
2490
2490
|
* Copyright 2017 Google LLC
|
2491
2491
|
* SPDX-License-Identifier: BSD-3-Clause
|
2492
|
-
*/const Kh=(r,e,t)=>{const i=new Map;for(let n=e;n<=t;n++)i.set(r[n],n);return i},Wh=vi(class extends nn{constructor(r){if(super(r),r.type!==Ii.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const n=[],s=[];let o=0;for(const a of r)n[o]=i?i(a,o):o,s[o]=t(a,o),o++;return{values:s,keys:n}}render(r,e,t){return this.dt(r,e,t).values}update(r,[e,t,i]){const n=pf(r),{values:s,keys:o}=this.dt(e,t,i);if(!Array.isArray(n))return this.ut=o,s;const a=this.ut??(this.ut=[]),l=[];let A,c,u=0,h=n.length-1,d=0,f=s.length-1;for(;u<=h&&d<=f;)if(n[u]===null)u++;else if(n[h]===null)h--;else if(a[u]===o[d])l[d]=zr(n[u],s[d]),u++,d++;else if(a[h]===o[f])l[f]=zr(n[h],s[f]),h--,f--;else if(a[u]===o[f])l[f]=zr(n[u],s[f]),rn(r,l[f+1],n[u]),u++,f--;else if(a[h]===o[d])l[d]=zr(n[h],s[d]),rn(r,n[u],n[h]),h--,d++;else if(A===void 0&&(A=Kh(o,d,f),c=Kh(a,u,h)),A.has(a[u]))if(A.has(a[h])){const g=c.get(o[d]),p=g!==void 0?n[g]:null;if(p===null){const v=rn(r,n[u]);zr(v,s[d]),l[d]=v}else l[d]=zr(p,s[d]),rn(r,n[u],p),n[g]=null;d++}else Eo(n[h]),h--;else Eo(n[u]),u++;for(;d<=f;){const g=rn(r,l[f+1]);zr(g,s[d]),l[d++]=g}for(;u<=h;){const g=n[u++];g!==null&&Eo(g)}return this.ut=o,gf(r,l),Xt}});var Ft="top",Kt="bottom",Wt="right",kt="left",ol="auto",vn=[Ft,Kt,Wt,kt],Mi="start",Cn="end",OC="clippingParents",Jh="viewport",yn="popper",UC="reference",qh=vn.reduce(function(r,e){return r.concat([e+"-"+Mi,e+"-"+Cn])},[]),Xh=[].concat(vn,[ol]).reduce(function(r,e){return r.concat([e,e+"-"+Mi,e+"-"+Cn])},[]),GC="beforeRead",HC="read",$C="afterRead",YC="beforeMain",VC="main",KC="afterMain",WC="beforeWrite",JC="write",qC="afterWrite",XC=[GC,HC,$C,YC,VC,KC,WC,JC,qC];function fr(r){return r?(r.nodeName||"").toLowerCase():null}function Pt(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function Ai(r){var e=Pt(r).Element;return r instanceof e||r instanceof Element}function Jt(r){var e=Pt(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function al(r){if(typeof ShadowRoot>"u")return!1;var e=Pt(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function jC(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];!Jt(s)||!fr(s)||(Object.assign(s.style,i),Object.keys(n).forEach(function(o){var a=n[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function zC(r){var e=r.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var n=e.elements[i],s=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(l,A){return l[A]="",l},{});!Jt(n)||!fr(n)||(Object.assign(n.style,a),Object.keys(s).forEach(function(l){n.removeAttribute(l)}))})}}const jh={name:"applyStyles",enabled:!0,phase:"write",fn:jC,effect:zC,requires:["computeStyles"]};function gr(r){return r.split("-")[0]}var ci=Math.max,Ws=Math.min,Ni=Math.round;function ll(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function zh(){return!/^((?!chrome|android).)*safari/i.test(ll())}function Pi(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=r.getBoundingClientRect(),n=1,s=1;e&&Jt(r)&&(n=r.offsetWidth>0&&Ni(i.width)/r.offsetWidth||1,s=r.offsetHeight>0&&Ni(i.height)/r.offsetHeight||1);var o=Ai(r)?Pt(r):window,a=o.visualViewport,l=!zh()&&t,A=(i.left+(l&&a?a.offsetLeft:0))/n,c=(i.top+(l&&a?a.offsetTop:0))/s,u=i.width/n,h=i.height/s;return{width:u,height:h,top:c,right:A+u,bottom:c+h,left:A,x:A,y:c}}function Al(r){var e=Pi(r),t=r.offsetWidth,i=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:i}}function Zh(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&al(t)){var i=e;do{if(i&&r.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function _r(r){return Pt(r).getComputedStyle(r)}function ZC(r){return["table","td","th"].indexOf(fr(r))>=0}function $r(r){return((Ai(r)?r.ownerDocument:r.document)||window.document).documentElement}function Js(r){return fr(r)==="html"?r:r.assignedSlot||r.parentNode||(al(r)?r.host:null)||$r(r)}function ed(r){return!Jt(r)||_r(r).position==="fixed"?null:r.offsetParent}function ey(r){var e=/firefox/i.test(ll()),t=/Trident/i.test(ll());if(t&&Jt(r)){var i=_r(r);if(i.position==="fixed")return null}var n=Js(r);for(al(n)&&(n=n.host);Jt(n)&&["html","body"].indexOf(fr(n))<0;){var s=_r(n);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return n;n=n.parentNode}return null}function Bn(r){for(var e=Pt(r),t=ed(r);t&&ZC(t)&&_r(t).position==="static";)t=ed(t);return t&&(fr(t)==="html"||fr(t)==="body"&&_r(t).position==="static")?e:t||ey(r)||e}function cl(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function Tn(r,e,t){return ci(r,Ws(e,t))}function ty(r,e,t){var i=Tn(r,e,t);return i>t?t:i}function td(){return{top:0,right:0,bottom:0,left:0}}function rd(r){return Object.assign({},td(),r)}function id(r,e){return e.reduce(function(t,i){return t[i]=r,t},{})}var ry=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,rd(typeof e!="number"?e:id(e,vn))};function iy(r){var e,t=r.state,i=r.name,n=r.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=gr(t.placement),l=cl(a),A=[kt,Wt].indexOf(a)>=0,c=A?"height":"width";if(!(!s||!o)){var u=ry(n.padding,t),h=Al(s),d=l==="y"?Ft:kt,f=l==="y"?Kt:Wt,g=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],p=o[l]-t.rects.reference[l],v=Bn(s),Q=v?l==="y"?v.clientHeight||0:v.clientWidth||0:0,b=g/2-p/2,y=u[d],x=Q-h[c]-u[f],R=Q/2-h[c]/2+b,k=Tn(y,R,x),H=l;t.modifiersData[i]=(e={},e[H]=k,e.centerOffset=k-R,e)}}function ny(r){var e=r.state,t=r.options,i=t.element,n=i===void 0?"[data-popper-arrow]":i;n!=null&&(typeof n=="string"&&(n=e.elements.popper.querySelector(n),!n)||Zh(e.elements.popper,n)&&(e.elements.arrow=n))}const sy={name:"arrow",enabled:!0,phase:"main",fn:iy,effect:ny,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Oi(r){return r.split("-")[1]}var oy={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ay(r,e){var t=r.x,i=r.y,n=e.devicePixelRatio||1;return{x:Ni(t*n)/n||0,y:Ni(i*n)/n||0}}function nd(r){var e,t=r.popper,i=r.popperRect,n=r.placement,s=r.variation,o=r.offsets,a=r.position,l=r.gpuAcceleration,A=r.adaptive,c=r.roundOffsets,u=r.isFixed,h=o.x,d=h===void 0?0:h,f=o.y,g=f===void 0?0:f,p=typeof c=="function"?c({x:d,y:g}):{x:d,y:g};d=p.x,g=p.y;var v=o.hasOwnProperty("x"),Q=o.hasOwnProperty("y"),b=kt,y=Ft,x=window;if(A){var R=Bn(t),k="clientHeight",H="clientWidth";if(R===Pt(t)&&(R=$r(t),_r(R).position!=="static"&&a==="absolute"&&(k="scrollHeight",H="scrollWidth")),R=R,n===Ft||(n===kt||n===Wt)&&s===Cn){y=Kt;var V=u&&R===x&&x.visualViewport?x.visualViewport.height:R[k];g-=V-i.height,g*=l?1:-1}if(n===kt||(n===Ft||n===Kt)&&s===Cn){b=Wt;var P=u&&R===x&&x.visualViewport?x.visualViewport.width:R[H];d-=P-i.width,d*=l?1:-1}}var K=Object.assign({position:a},A&&oy),ie=c===!0?ay({x:d,y:g},Pt(t)):{x:d,y:g};if(d=ie.x,g=ie.y,l){var ee;return Object.assign({},K,(ee={},ee[y]=Q?"0":"",ee[b]=v?"0":"",ee.transform=(x.devicePixelRatio||1)<=1?"translate("+d+"px, "+g+"px)":"translate3d("+d+"px, "+g+"px, 0)",ee))}return Object.assign({},K,(e={},e[y]=Q?g+"px":"",e[b]=v?d+"px":"",e.transform="",e))}function ly(r){var e=r.state,t=r.options,i=t.gpuAcceleration,n=i===void 0?!0:i,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,A={placement:gr(e.placement),variation:Oi(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:n,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,nd(Object.assign({},A,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,nd(Object.assign({},A,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Ay={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:ly,data:{}};var qs={passive:!0};function cy(r){var e=r.state,t=r.instance,i=r.options,n=i.scroll,s=n===void 0?!0:n,o=i.resize,a=o===void 0?!0:o,l=Pt(e.elements.popper),A=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&A.forEach(function(c){c.addEventListener("scroll",t.update,qs)}),a&&l.addEventListener("resize",t.update,qs),function(){s&&A.forEach(function(c){c.removeEventListener("scroll",t.update,qs)}),a&&l.removeEventListener("resize",t.update,qs)}}const uy={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:cy,data:{}};var hy={left:"right",right:"left",bottom:"top",top:"bottom"};function Xs(r){return r.replace(/left|right|bottom|top/g,function(e){return hy[e]})}var dy={start:"end",end:"start"};function sd(r){return r.replace(/start|end/g,function(e){return dy[e]})}function ul(r){var e=Pt(r),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function hl(r){return Pi($r(r)).left+ul(r).scrollLeft}function fy(r,e){var t=Pt(r),i=$r(r),n=t.visualViewport,s=i.clientWidth,o=i.clientHeight,a=0,l=0;if(n){s=n.width,o=n.height;var A=zh();(A||!A&&e==="fixed")&&(a=n.offsetLeft,l=n.offsetTop)}return{width:s,height:o,x:a+hl(r),y:l}}function gy(r){var e,t=$r(r),i=ul(r),n=(e=r.ownerDocument)==null?void 0:e.body,s=ci(t.scrollWidth,t.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),o=ci(t.scrollHeight,t.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),a=-i.scrollLeft+hl(r),l=-i.scrollTop;return _r(n||t).direction==="rtl"&&(a+=ci(t.clientWidth,n?n.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function dl(r){var e=_r(r),t=e.overflow,i=e.overflowX,n=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+n+i)}function od(r){return["html","body","#document"].indexOf(fr(r))>=0?r.ownerDocument.body:Jt(r)&&dl(r)?r:od(Js(r))}function Qn(r,e){var t;e===void 0&&(e=[]);var i=od(r),n=i===((t=r.ownerDocument)==null?void 0:t.body),s=Pt(i),o=n?[s].concat(s.visualViewport||[],dl(i)?i:[]):i,a=e.concat(o);return n?a:a.concat(Qn(Js(o)))}function fl(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function py(r,e){var t=Pi(r,!1,e==="fixed");return t.top=t.top+r.clientTop,t.left=t.left+r.clientLeft,t.bottom=t.top+r.clientHeight,t.right=t.left+r.clientWidth,t.width=r.clientWidth,t.height=r.clientHeight,t.x=t.left,t.y=t.top,t}function ad(r,e,t){return e===Jh?fl(fy(r,t)):Ai(e)?py(e,t):fl(gy($r(r)))}function my(r){var e=Qn(Js(r)),t=["absolute","fixed"].indexOf(_r(r).position)>=0,i=t&&Jt(r)?Bn(r):r;return Ai(i)?e.filter(function(n){return Ai(n)&&Zh(n,i)&&fr(n)!=="body"}):[]}function Ey(r,e,t,i){var n=e==="clippingParents"?my(r):[].concat(e),s=[].concat(n,[t]),o=s[0],a=s.reduce(function(l,A){var c=ad(r,A,i);return l.top=ci(c.top,l.top),l.right=Ws(c.right,l.right),l.bottom=Ws(c.bottom,l.bottom),l.left=ci(c.left,l.left),l},ad(r,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function ld(r){var e=r.reference,t=r.element,i=r.placement,n=i?gr(i):null,s=i?Oi(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(n){case Ft:l={x:o,y:e.y-t.height};break;case Kt:l={x:o,y:e.y+e.height};break;case Wt:l={x:e.x+e.width,y:a};break;case kt:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var A=n?cl(n):null;if(A!=null){var c=A==="y"?"height":"width";switch(s){case Mi:l[A]=l[A]-(e[c]/2-t[c]/2);break;case Cn:l[A]=l[A]+(e[c]/2-t[c]/2);break}}return l}function bn(r,e){e===void 0&&(e={});var t=e,i=t.placement,n=i===void 0?r.placement:i,s=t.strategy,o=s===void 0?r.strategy:s,a=t.boundary,l=a===void 0?OC:a,A=t.rootBoundary,c=A===void 0?Jh:A,u=t.elementContext,h=u===void 0?yn:u,d=t.altBoundary,f=d===void 0?!1:d,g=t.padding,p=g===void 0?0:g,v=rd(typeof p!="number"?p:id(p,vn)),Q=h===yn?UC:yn,b=r.rects.popper,y=r.elements[f?Q:h],x=Ey(Ai(y)?y:y.contextElement||$r(r.elements.popper),l,c,o),R=Pi(r.elements.reference),k=ld({reference:R,element:b,strategy:"absolute",placement:n}),H=fl(Object.assign({},b,k)),V=h===yn?H:R,P={top:x.top-V.top+v.top,bottom:V.bottom-x.bottom+v.bottom,left:x.left-V.left+v.left,right:V.right-x.right+v.right},K=r.modifiersData.offset;if(h===yn&&K){var ie=K[n];Object.keys(P).forEach(function(ee){var le=[Wt,Kt].indexOf(ee)>=0?1:-1,D=[Ft,Kt].indexOf(ee)>=0?"y":"x";P[ee]+=ie[D]*le})}return P}function Iy(r,e){e===void 0&&(e={});var t=e,i=t.placement,n=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,A=l===void 0?Xh:l,c=Oi(i),u=c?a?qh:qh.filter(function(f){return Oi(f)===c}):vn,h=u.filter(function(f){return A.indexOf(f)>=0});h.length===0&&(h=u);var d=h.reduce(function(f,g){return f[g]=bn(r,{placement:g,boundary:n,rootBoundary:s,padding:o})[gr(g)],f},{});return Object.keys(d).sort(function(f,g){return d[f]-d[g]})}function vy(r){if(gr(r)===ol)return[];var e=Xs(r);return[sd(r),e,sd(e)]}function Cy(r){var e=r.state,t=r.options,i=r.name;if(!e.modifiersData[i]._skip){for(var n=t.mainAxis,s=n===void 0?!0:n,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,A=t.padding,c=t.boundary,u=t.rootBoundary,h=t.altBoundary,d=t.flipVariations,f=d===void 0?!0:d,g=t.allowedAutoPlacements,p=e.options.placement,v=gr(p),Q=v===p,b=l||(Q||!f?[Xs(p)]:vy(p)),y=[p].concat(b).reduce(function(ce,pe){return ce.concat(gr(pe)===ol?Iy(e,{placement:pe,boundary:c,rootBoundary:u,padding:A,flipVariations:f,allowedAutoPlacements:g}):pe)},[]),x=e.rects.reference,R=e.rects.popper,k=new Map,H=!0,V=y[0],P=0;P<y.length;P++){var K=y[P],ie=gr(K),ee=Oi(K)===Mi,le=[Ft,Kt].indexOf(ie)>=0,D=le?"width":"height",O=bn(e,{placement:K,boundary:c,rootBoundary:u,altBoundary:h,padding:A}),X=le?ee?Wt:kt:ee?Kt:Ft;x[D]>R[D]&&(X=Xs(X));var _=Xs(X),S=[];if(s&&S.push(O[ie]<=0),a&&S.push(O[X]<=0,O[_]<=0),S.every(function(ce){return ce})){V=K,H=!1;break}k.set(K,S)}if(H)for(var F=f?3:1,J=function(pe){var ge=y.find(function(Se){var Le=k.get(Se);if(Le)return Le.slice(0,pe).every(function(Ge){return Ge})});if(ge)return V=ge,"break"},Y=F;Y>0;Y--){var ne=J(Y);if(ne==="break")break}e.placement!==V&&(e.modifiersData[i]._skip=!0,e.placement=V,e.reset=!0)}}const yy={name:"flip",enabled:!0,phase:"main",fn:Cy,requiresIfExists:["offset"],data:{_skip:!1}};function Ad(r,e,t){return t===void 0&&(t={x:0,y:0}),{top:r.top-e.height-t.y,right:r.right-e.width+t.x,bottom:r.bottom-e.height+t.y,left:r.left-e.width-t.x}}function cd(r){return[Ft,Wt,Kt,kt].some(function(e){return r[e]>=0})}function By(r){var e=r.state,t=r.name,i=e.rects.reference,n=e.rects.popper,s=e.modifiersData.preventOverflow,o=bn(e,{elementContext:"reference"}),a=bn(e,{altBoundary:!0}),l=Ad(o,i),A=Ad(a,n,s),c=cd(l),u=cd(A);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:A,isReferenceHidden:c,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":u})}const Ty={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:By};function Qy(r,e,t){var i=gr(r),n=[kt,Ft].indexOf(i)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:r})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*n,[kt,Wt].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function by(r){var e=r.state,t=r.options,i=r.name,n=t.offset,s=n===void 0?[0,0]:n,o=Xh.reduce(function(c,u){return c[u]=Qy(u,e.rects,s),c},{}),a=o[e.placement],l=a.x,A=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=A),e.modifiersData[i]=o}const xy={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:by};function wy(r){var e=r.state,t=r.name;e.modifiersData[t]=ld({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Sy={name:"popperOffsets",enabled:!0,phase:"read",fn:wy,data:{}};function Ry(r){return r==="x"?"y":"x"}function Dy(r){var e=r.state,t=r.options,i=r.name,n=t.mainAxis,s=n===void 0?!0:n,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,A=t.rootBoundary,c=t.altBoundary,u=t.padding,h=t.tether,d=h===void 0?!0:h,f=t.tetherOffset,g=f===void 0?0:f,p=bn(e,{boundary:l,rootBoundary:A,padding:u,altBoundary:c}),v=gr(e.placement),Q=Oi(e.placement),b=!Q,y=cl(v),x=Ry(y),R=e.modifiersData.popperOffsets,k=e.rects.reference,H=e.rects.popper,V=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,P=typeof V=="number"?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),K=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ie={x:0,y:0};if(R){if(s){var ee,le=y==="y"?Ft:kt,D=y==="y"?Kt:Wt,O=y==="y"?"height":"width",X=R[y],_=X+p[le],S=X-p[D],F=d?-H[O]/2:0,J=Q===Mi?k[O]:H[O],Y=Q===Mi?-H[O]:-k[O],ne=e.elements.arrow,ce=d&&ne?Al(ne):{width:0,height:0},pe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:td(),ge=pe[le],Se=pe[D],Le=Tn(0,k[O],ce[O]),Ge=b?k[O]/2-F-Le-ge-P.mainAxis:J-Le-ge-P.mainAxis,fe=b?-k[O]/2+F+Le+Se+P.mainAxis:Y+Le+Se+P.mainAxis,Qe=e.elements.arrow&&Bn(e.elements.arrow),Ne=Qe?y==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,we=(ee=K==null?void 0:K[y])!=null?ee:0,qe=X+Ge-we-Ne,Te=X+fe-we,T=Tn(d?Ws(_,qe):_,X,d?ci(S,Te):S);R[y]=T,ie[y]=T-X}if(a){var m,E=y==="x"?Ft:kt,w=y==="x"?Kt:Wt,N=R[x],z=x==="y"?"height":"width",j=N+p[E],Ie=N-p[w],be=[Ft,kt].indexOf(v)!==-1,De=(m=K==null?void 0:K[x])!=null?m:0,ke=be?j:N-k[z]-H[z]-De+P.altAxis,_e=be?N+k[z]+H[z]-De-P.altAxis:Ie,Nt=d&&be?ty(ke,N,_e):Tn(d?ke:j,N,d?_e:Ie);R[x]=Nt,ie[x]=Nt-N}e.modifiersData[i]=ie}}const _y={name:"preventOverflow",enabled:!0,phase:"main",fn:Dy,requiresIfExists:["offset"]};function Ly(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function Fy(r){return r===Pt(r)||!Jt(r)?ul(r):Ly(r)}function ky(r){var e=r.getBoundingClientRect(),t=Ni(e.width)/r.offsetWidth||1,i=Ni(e.height)/r.offsetHeight||1;return t!==1||i!==1}function My(r,e,t){t===void 0&&(t=!1);var i=Jt(e),n=Jt(e)&&ky(e),s=$r(e),o=Pi(r,n,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!t)&&((fr(e)!=="body"||dl(s))&&(a=Fy(e)),Jt(e)?(l=Pi(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=hl(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Ny(r){var e=new Map,t=new Set,i=[];r.forEach(function(s){e.set(s.name,s)});function n(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&n(l)}}),i.push(s)}return r.forEach(function(s){t.has(s.name)||n(s)}),i}function Py(r){var e=Ny(r);return XC.reduce(function(t,i){return t.concat(e.filter(function(n){return n.phase===i}))},[])}function Oy(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}function Uy(r){var e=r.reduce(function(t,i){var n=t[i.name];return t[i.name]=n?Object.assign({},n,i,{options:Object.assign({},n.options,i.options),data:Object.assign({},n.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var ud={placement:"bottom",modifiers:[],strategy:"absolute"};function hd(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function Gy(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,i=t===void 0?[]:t,n=e.defaultOptions,s=n===void 0?ud:n;return function(a,l,A){A===void 0&&(A=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},ud,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},u=[],h=!1,d={state:c,setOptions:function(v){var Q=typeof v=="function"?v(c.options):v;g(),c.options=Object.assign({},s,c.options,Q),c.scrollParents={reference:Ai(a)?Qn(a):a.contextElement?Qn(a.contextElement):[],popper:Qn(l)};var b=Py(Uy([].concat(i,c.options.modifiers)));return c.orderedModifiers=b.filter(function(y){return y.enabled}),f(),d.update()},forceUpdate:function(){if(!h){var v=c.elements,Q=v.reference,b=v.popper;if(hd(Q,b)){c.rects={reference:My(Q,Bn(b),c.options.strategy==="fixed"),popper:Al(b)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(P){return c.modifiersData[P.name]=Object.assign({},P.data)});for(var y=0;y<c.orderedModifiers.length;y++){if(c.reset===!0){c.reset=!1,y=-1;continue}var x=c.orderedModifiers[y],R=x.fn,k=x.options,H=k===void 0?{}:k,V=x.name;typeof R=="function"&&(c=R({state:c,options:H,name:V,instance:d})||c)}}}},update:Oy(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){g(),h=!0}};if(!hd(a,l))return d;d.setOptions(A).then(function(p){!h&&A.onFirstUpdate&&A.onFirstUpdate(p)});function f(){c.orderedModifiers.forEach(function(p){var v=p.name,Q=p.options,b=Q===void 0?{}:Q,y=p.effect;if(typeof y=="function"){var x=y({state:c,name:v,instance:d,options:b}),R=function(){};u.push(x||R)}})}function g(){u.forEach(function(p){return p()}),u=[]}return d}}var Hy=[uy,Sy,Ay,jh,xy,yy,_y,sy,Ty],$y=Gy({defaultModifiers:Hy}),Yy="tippy-box",dd="tippy-content",Vy="tippy-backdrop",fd="tippy-arrow",gd="tippy-svg-arrow",ui={passive:!0,capture:!0},pd=function(){return document.body};function gl(r,e,t){if(Array.isArray(r)){var i=r[e];return i??(Array.isArray(t)?t[e]:t)}return r}function pl(r,e){var t={}.toString.call(r);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function md(r,e){return typeof r=="function"?r.apply(void 0,e):r}function Ed(r,e){if(e===0)return r;var t;return function(i){clearTimeout(t),t=setTimeout(function(){r(i)},e)}}function Ky(r){return r.split(/\s+/).filter(Boolean)}function Ui(r){return[].concat(r)}function Id(r,e){r.indexOf(e)===-1&&r.push(e)}function Wy(r){return r.filter(function(e,t){return r.indexOf(e)===t})}function Jy(r){return r.split("-")[0]}function js(r){return[].slice.call(r)}function vd(r){return Object.keys(r).reduce(function(e,t){return r[t]!==void 0&&(e[t]=r[t]),e},{})}function xn(){return document.createElement("div")}function zs(r){return["Element","Fragment"].some(function(e){return pl(r,e)})}function qy(r){return pl(r,"NodeList")}function Xy(r){return pl(r,"MouseEvent")}function jy(r){return!!(r&&r._tippy&&r._tippy.reference===r)}function zy(r){return zs(r)?[r]:qy(r)?js(r):Array.isArray(r)?r:js(document.querySelectorAll(r))}function ml(r,e){r.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Cd(r,e){r.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Zy(r){var e,t=Ui(r),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function eB(r,e){var t=e.clientX,i=e.clientY;return r.every(function(n){var s=n.popperRect,o=n.popperState,a=n.props,l=a.interactiveBorder,A=Jy(o.placement),c=o.modifiersData.offset;if(!c)return!0;var u=A==="bottom"?c.top.y:0,h=A==="top"?c.bottom.y:0,d=A==="right"?c.left.x:0,f=A==="left"?c.right.x:0,g=s.top-i+u>l,p=i-s.bottom-h>l,v=s.left-t+d>l,Q=t-s.right-f>l;return g||p||v||Q})}function El(r,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(n){r[i](n,t)})}function yd(r,e){for(var t=e;t;){var i;if(r.contains(t))return!0;t=t.getRootNode==null||(i=t.getRootNode())==null?void 0:i.host}return!1}var pr={isTouch:!1},Bd=0;function tB(){pr.isTouch||(pr.isTouch=!0,window.performance&&document.addEventListener("mousemove",Td))}function Td(){var r=performance.now();r-Bd<20&&(pr.isTouch=!1,document.removeEventListener("mousemove",Td)),Bd=r}function rB(){var r=document.activeElement;if(jy(r)){var e=r._tippy;r.blur&&!e.state.isVisible&&r.blur()}}function iB(){document.addEventListener("touchstart",tB,ui),window.addEventListener("blur",rB)}var nB=typeof window<"u"&&typeof document<"u",sB=nB?!!window.msCrypto:!1,oB={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},aB={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},tr=Object.assign({appendTo:pd,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},oB,aB),lB=Object.keys(tr),AB=function(e){var t=Object.keys(e);t.forEach(function(i){tr[i]=e[i]})};function Qd(r){var e=r.plugins||[],t=e.reduce(function(i,n){var s=n.name,o=n.defaultValue;if(s){var a;i[s]=r[s]!==void 0?r[s]:(a=tr[s])!=null?a:o}return i},{});return Object.assign({},r,t)}function cB(r,e){var t=e?Object.keys(Qd(Object.assign({},tr,{plugins:e}))):lB,i=t.reduce(function(n,s){var o=(r.getAttribute("data-tippy-"+s)||"").trim();if(!o)return n;if(s==="content")n[s]=o;else try{n[s]=JSON.parse(o)}catch{n[s]=o}return n},{});return i}function bd(r,e){var t=Object.assign({},e,{content:md(e.content,[r])},e.ignoreAttributes?{}:cB(r,e.plugins));return t.aria=Object.assign({},tr.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var uB=function(){return"innerHTML"};function Il(r,e){r[uB()]=e}function xd(r){var e=xn();return r===!0?e.className=fd:(e.className=gd,zs(r)?e.appendChild(r):Il(e,r)),e}function wd(r,e){zs(e.content)?(Il(r,""),r.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Il(r,e.content):r.textContent=e.content)}function vl(r){var e=r.firstElementChild,t=js(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(dd)}),arrow:t.find(function(i){return i.classList.contains(fd)||i.classList.contains(gd)}),backdrop:t.find(function(i){return i.classList.contains(Vy)})}}function Sd(r){var e=xn(),t=xn();t.className=Yy,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=xn();i.className=dd,i.setAttribute("data-state","hidden"),wd(i,r.props),e.appendChild(t),t.appendChild(i),n(r.props,r.props);function n(s,o){var a=vl(e),l=a.box,A=a.content,c=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&wd(A,r.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild(xd(o.arrow))):l.appendChild(xd(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:n}}Sd.$$tippy=!0;var hB=1,Zs=[],Cl=[];function dB(r,e){var t=bd(r,Object.assign({},tr,Qd(vd(e)))),i,n,s,o=!1,a=!1,l=!1,A=!1,c,u,h,d=[],f=Ed(qe,t.interactiveDebounce),g,p=hB++,v=null,Q=Wy(t.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},y={id:p,reference:r,popper:xn(),popperInstance:v,props:t,state:b,plugins:Q,clearDelayTimeouts:ke,setProps:_e,setContent:Nt,show:ut,hide:Ut,hideWithInteractivity:Ir,enable:be,disable:De,unmount:vr,destroy:Tt};if(!t.render)return y;var x=t.render(y),R=x.popper,k=x.onUpdate;R.setAttribute("data-tippy-root",""),R.id="tippy-"+y.id,y.popper=R,r._tippy=y,R._tippy=y;var H=Q.map(function(q){return q.fn(y)}),V=r.hasAttribute("aria-expanded");return Qe(),F(),X(),_("onCreate",[y]),t.showOnCreate&&j(),R.addEventListener("mouseenter",function(){y.props.interactive&&y.state.isVisible&&y.clearDelayTimeouts()}),R.addEventListener("mouseleave",function(){y.props.interactive&&y.props.trigger.indexOf("mouseenter")>=0&&le().addEventListener("mousemove",f)}),y;function P(){var q=y.props.touch;return Array.isArray(q)?q:[q,0]}function K(){return P()[0]==="hold"}function ie(){var q;return!!((q=y.props.render)!=null&&q.$$tippy)}function ee(){return g||r}function le(){var q=ee().parentNode;return q?Zy(q):document}function D(){return vl(R)}function O(q){return y.state.isMounted&&!y.state.isVisible||pr.isTouch||c&&c.type==="focus"?0:gl(y.props.delay,q?0:1,tr.delay)}function X(q){q===void 0&&(q=!1),R.style.pointerEvents=y.props.interactive&&!q?"":"none",R.style.zIndex=""+y.props.zIndex}function _(q,de,ve){if(ve===void 0&&(ve=!0),H.forEach(function(Fe){Fe[q]&&Fe[q].apply(Fe,de)}),ve){var Pe;(Pe=y.props)[q].apply(Pe,de)}}function S(){var q=y.props.aria;if(q.content){var de="aria-"+q.content,ve=R.id,Pe=Ui(y.props.triggerTarget||r);Pe.forEach(function(Fe){var Xe=Fe.getAttribute(de);if(y.state.isVisible)Fe.setAttribute(de,Xe?Xe+" "+ve:ve);else{var xt=Xe&&Xe.replace(ve,"").trim();xt?Fe.setAttribute(de,xt):Fe.removeAttribute(de)}})}}function F(){if(!(V||!y.props.aria.expanded)){var q=Ui(y.props.triggerTarget||r);q.forEach(function(de){y.props.interactive?de.setAttribute("aria-expanded",y.state.isVisible&&de===ee()?"true":"false"):de.removeAttribute("aria-expanded")})}}function J(){le().removeEventListener("mousemove",f),Zs=Zs.filter(function(q){return q!==f})}function Y(q){if(!(pr.isTouch&&(l||q.type==="mousedown"))){var de=q.composedPath&&q.composedPath()[0]||q.target;if(!(y.props.interactive&&yd(R,de))){if(Ui(y.props.triggerTarget||r).some(function(ve){return yd(ve,de)})){if(pr.isTouch||y.state.isVisible&&y.props.trigger.indexOf("click")>=0)return}else _("onClickOutside",[y,q]);y.props.hideOnClick===!0&&(y.clearDelayTimeouts(),y.hide(),a=!0,setTimeout(function(){a=!1}),y.state.isMounted||ge())}}}function ne(){l=!0}function ce(){l=!1}function pe(){var q=le();q.addEventListener("mousedown",Y,!0),q.addEventListener("touchend",Y,ui),q.addEventListener("touchstart",ce,ui),q.addEventListener("touchmove",ne,ui)}function ge(){var q=le();q.removeEventListener("mousedown",Y,!0),q.removeEventListener("touchend",Y,ui),q.removeEventListener("touchstart",ce,ui),q.removeEventListener("touchmove",ne,ui)}function Se(q,de){Ge(q,function(){!y.state.isVisible&&R.parentNode&&R.parentNode.contains(R)&&de()})}function Le(q,de){Ge(q,de)}function Ge(q,de){var ve=D().box;function Pe(Fe){Fe.target===ve&&(El(ve,"remove",Pe),de())}if(q===0)return de();El(ve,"remove",u),El(ve,"add",Pe),u=Pe}function fe(q,de,ve){ve===void 0&&(ve=!1);var Pe=Ui(y.props.triggerTarget||r);Pe.forEach(function(Fe){Fe.addEventListener(q,de,ve),d.push({node:Fe,eventType:q,handler:de,options:ve})})}function Qe(){K()&&(fe("touchstart",we,{passive:!0}),fe("touchend",Te,{passive:!0})),Ky(y.props.trigger).forEach(function(q){if(q!=="manual")switch(fe(q,we),q){case"mouseenter":fe("mouseleave",Te);break;case"focus":fe(sB?"focusout":"blur",T);break;case"focusin":fe("focusout",T);break}})}function Ne(){d.forEach(function(q){var de=q.node,ve=q.eventType,Pe=q.handler,Fe=q.options;de.removeEventListener(ve,Pe,Fe)}),d=[]}function we(q){var de,ve=!1;if(!(!y.state.isEnabled||m(q)||a)){var Pe=((de=c)==null?void 0:de.type)==="focus";c=q,g=q.currentTarget,F(),!y.state.isVisible&&Xy(q)&&Zs.forEach(function(Fe){return Fe(q)}),q.type==="click"&&(y.props.trigger.indexOf("mouseenter")<0||o)&&y.props.hideOnClick!==!1&&y.state.isVisible?ve=!0:j(q),q.type==="click"&&(o=!ve),ve&&!Pe&&Ie(q)}}function qe(q){var de=q.target,ve=ee().contains(de)||R.contains(de);if(!(q.type==="mousemove"&&ve)){var Pe=z().concat(R).map(function(Fe){var Xe,xt=Fe._tippy,wt=(Xe=xt.popperInstance)==null?void 0:Xe.state;return wt?{popperRect:Fe.getBoundingClientRect(),popperState:wt,props:t}:null}).filter(Boolean);eB(Pe,q)&&(J(),Ie(q))}}function Te(q){var de=m(q)||y.props.trigger.indexOf("click")>=0&&o;if(!de){if(y.props.interactive){y.hideWithInteractivity(q);return}Ie(q)}}function T(q){y.props.trigger.indexOf("focusin")<0&&q.target!==ee()||y.props.interactive&&q.relatedTarget&&R.contains(q.relatedTarget)||Ie(q)}function m(q){return pr.isTouch?K()!==q.type.indexOf("touch")>=0:!1}function E(){w();var q=y.props,de=q.popperOptions,ve=q.placement,Pe=q.offset,Fe=q.getReferenceClientRect,Xe=q.moveTransition,xt=ie()?vl(R).arrow:null,wt=Fe?{getBoundingClientRect:Fe,contextElement:Fe.contextElement||ee()}:r,Vi={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ki){var Wr=Ki.state;if(ie()){var Fn=D(),kn=Fn.box;["placement","reference-hidden","escaped"].forEach(function(Wi){Wi==="placement"?kn.setAttribute("data-placement",Wr.placement):Wr.attributes.popper["data-popper-"+Wi]?kn.setAttribute("data-"+Wi,""):kn.removeAttribute("data-"+Wi)}),Wr.attributes.popper={}}}},St=[{name:"offset",options:{offset:Pe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Xe}},Vi];ie()&&xt&&St.push({name:"arrow",options:{element:xt,padding:3}}),St.push.apply(St,(de==null?void 0:de.modifiers)||[]),y.popperInstance=$y(wt,R,Object.assign({},de,{placement:ve,onFirstUpdate:h,modifiers:St}))}function w(){y.popperInstance&&(y.popperInstance.destroy(),y.popperInstance=null)}function N(){var q=y.props.appendTo,de,ve=ee();y.props.interactive&&q===pd||q==="parent"?de=ve.parentNode:de=md(q,[ve]),de.contains(R)||de.appendChild(R),y.state.isMounted=!0,E()}function z(){return js(R.querySelectorAll("[data-tippy-root]"))}function j(q){y.clearDelayTimeouts(),q&&_("onTrigger",[y,q]),pe();var de=O(!0),ve=P(),Pe=ve[0],Fe=ve[1];pr.isTouch&&Pe==="hold"&&Fe&&(de=Fe),de?i=setTimeout(function(){y.show()},de):y.show()}function Ie(q){if(y.clearDelayTimeouts(),_("onUntrigger",[y,q]),!y.state.isVisible){ge();return}if(!(y.props.trigger.indexOf("mouseenter")>=0&&y.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(q.type)>=0&&o)){var de=O(!1);de?n=setTimeout(function(){y.state.isVisible&&y.hide()},de):s=requestAnimationFrame(function(){y.hide()})}}function be(){y.state.isEnabled=!0}function De(){y.hide(),y.state.isEnabled=!1}function ke(){clearTimeout(i),clearTimeout(n),cancelAnimationFrame(s)}function _e(q){if(!y.state.isDestroyed){_("onBeforeUpdate",[y,q]),Ne();var de=y.props,ve=bd(r,Object.assign({},de,vd(q),{ignoreAttributes:!0}));y.props=ve,Qe(),de.interactiveDebounce!==ve.interactiveDebounce&&(J(),f=Ed(qe,ve.interactiveDebounce)),de.triggerTarget&&!ve.triggerTarget?Ui(de.triggerTarget).forEach(function(Pe){Pe.removeAttribute("aria-expanded")}):ve.triggerTarget&&r.removeAttribute("aria-expanded"),F(),X(),k&&k(de,ve),y.popperInstance&&(E(),z().forEach(function(Pe){requestAnimationFrame(Pe._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[y,q])}}function Nt(q){y.setProps({content:q})}function ut(){var q=y.state.isVisible,de=y.state.isDestroyed,ve=!y.state.isEnabled,Pe=pr.isTouch&&!y.props.touch,Fe=gl(y.props.duration,0,tr.duration);if(!(q||de||ve||Pe)&&!ee().hasAttribute("disabled")&&(_("onShow",[y],!1),y.props.onShow(y)!==!1)){if(y.state.isVisible=!0,ie()&&(R.style.visibility="visible"),X(),pe(),y.state.isMounted||(R.style.transition="none"),ie()){var Xe=D(),xt=Xe.box,wt=Xe.content;ml([xt,wt],0)}h=function(){var St;if(!(!y.state.isVisible||A)){if(A=!0,R.offsetHeight,R.style.transition=y.props.moveTransition,ie()&&y.props.animation){var pi=D(),Ki=pi.box,Wr=pi.content;ml([Ki,Wr],Fe),Cd([Ki,Wr],"visible")}S(),F(),Id(Cl,y),(St=y.popperInstance)==null||St.forceUpdate(),_("onMount",[y]),y.props.animation&&ie()&&Le(Fe,function(){y.state.isShown=!0,_("onShown",[y])})}},N()}}function Ut(){var q=!y.state.isVisible,de=y.state.isDestroyed,ve=!y.state.isEnabled,Pe=gl(y.props.duration,1,tr.duration);if(!(q||de||ve)&&(_("onHide",[y],!1),y.props.onHide(y)!==!1)){if(y.state.isVisible=!1,y.state.isShown=!1,A=!1,o=!1,ie()&&(R.style.visibility="hidden"),J(),ge(),X(!0),ie()){var Fe=D(),Xe=Fe.box,xt=Fe.content;y.props.animation&&(ml([Xe,xt],Pe),Cd([Xe,xt],"hidden"))}S(),F(),y.props.animation?ie()&&Se(Pe,y.unmount):y.unmount()}}function Ir(q){le().addEventListener("mousemove",f),Id(Zs,f),f(q)}function vr(){y.state.isVisible&&y.hide(),y.state.isMounted&&(w(),z().forEach(function(q){q._tippy.unmount()}),R.parentNode&&R.parentNode.removeChild(R),Cl=Cl.filter(function(q){return q!==y}),y.state.isMounted=!1,_("onHidden",[y]))}function Tt(){y.state.isDestroyed||(y.clearDelayTimeouts(),y.unmount(),Ne(),delete r._tippy,y.state.isDestroyed=!0,_("onDestroy",[y]))}}function hi(r,e){e===void 0&&(e={});var t=tr.plugins.concat(e.plugins||[]);iB();var i=Object.assign({},e,{plugins:t}),n=zy(r),s=n.reduce(function(o,a){var l=a&&dB(a,i);return l&&o.push(l),o},[]);return zs(r)?s[0]:s}hi.defaultProps=tr,hi.setDefaultProps=AB,hi.currentInput=pr,Object.assign({},jh,{effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow)}}),hi.setDefaultProps({render:Sd});function Lr(r){var e,t;const i=[];return(((e=r.renderer)==null?void 0:e.type)==="video"||((t=r.renderer)==null?void 0:t.type)==="audio")&&i.push({...r.config,...r.options}),i.push(...r.childNodes.flatMap(Lr).filter(Boolean)),i}class eo extends Error{constructor(e,t=new Error,i=!1){super(),this.fatal=!1,this.fatal=i,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}function Yr(r,e,t){return Math.min(Math.max(e,r),t)}const fB=5;function gB(r,e){return r.length!==e.length||r.some((t,i)=>t!==e[i])}class pB{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=It(),this._controls=It(),this.host=e}set activeScenes(e){gB(e,this._activeScenes)&&(this._activeScenes=e,this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e})),this.host.requestUpdate())}get activeScenes(){return this._activeScenes}set currentTime(e){var t,i,n;const s=Yr(0,e,this.host.duration);this.activeScenes=((t=this.host.composition)==null?void 0:t.tracks.reduce((a,l)=>a.concat(l.scenes.filter(({start:A,duration:c})=>s>=A&&s<A+c)),[]))??[];const o=s!==this.currentTime;this._currentTime=s,this._upcomingScenes=((i=this.host.composition)==null?void 0:i.tracks.reduce((a,l)=>a.concat(l.scenes.filter(({start:A})=>s>=A-fB&&s<A)),[]))??[],this.loadScenes(),this.syncMediaState(),(n=this._controls.value)==null||n.setAttribute("currentTime",s.toString()),o&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:s})),this.draw(s)}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return vt(this._canvas)}controls(){return vt(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{Lr(e.layout.node).forEach(i=>{var n,s,o;const{start:a,duration:l}=e,A=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(this.host.media[i.key]){const c=this.host.media[i.key],{speed:u,volume:h,hls:d,node:f,start:g,duration:p}=c,v=this.host.mediaState[i.key];f&&v&&(f.currentTime>=g+p||f.ended||A&&(d?(n=d.startLoadOnce)==null||n.call(d,g):v.initialised||(s=f.startLoadOnce)==null||s.call(f),f.volume=Yr(0,this.host.volume*(h??1),1),f.playbackRate=Yr(.1,this.host.playbackRate*(u??1),4)))}else if(A){const c=`${a}-${l}`,u=this.host._sceneController.mediaState[c];this.host.duration&&!((o=u==null?void 0:u.buffered)!=null&&o.length)&&(this.host._sceneController.mediaState={...this.host._sceneController.mediaState,[c]:{...u,buffered:[{start:Math.max(0,a/this.host.duration*100),end:Math.min((a+l)/this.host.duration*100,100)}]}})}})})}syncMediaState(){var e;(e=this.host.composition)==null||e.tracks.forEach(t=>{var i;(i=t.scenes)==null||i.forEach(n=>{Lr(n.layout.node).forEach(o=>{if(this.host.media[o.key]){const a=this.host.media[o.key],{node:l}=a,A=this.host.mediaState[o.key],c=this.activeScenes.includes(n);if(A)if(c&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(l.paused&&A.initialised)try{return l.play()}catch(u){throw new eo("Video play error",u,!0)}}else l.paused||l.pause()}})})})}draw(e=this.currentTime){this.host.composition&&this._canvas.value&&this.host.composition.draw({currentTime:e,canvas:this._canvas.value})}clear(){var e;const t=this._canvas.value;(e=t==null?void 0:t.getContext("2d"))==null||e.clearRect(0,0,t.width,t.height)}}async function Rd(r){return r.duration===1/0?new Promise(e=>{r.currentTime=Number.MAX_SAFE_INTEGER,r.ontimeupdate=()=>{r.ontimeupdate=null,e(r.duration),r.currentTime=0}}):r.duration}function mB(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function EB(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function IB(r){return new Promise(async e=>{let t=null;const{type:i,key:n,src:s,duration:o,startOffset:a,endOffset:l}=r;i==="video"?(t=document.createElement("video"),t.playsInline=!0):t=document.createElement("audio"),t.muted=!0,t.loop=!1,t.src=s;let A=!1;if(t.startLoadOnce=()=>{A||(t.preload="auto",t.load(),A=!0)},i==="video"&&o&&r.aspectRatio){t.preload="none";const c=(a??0)*o,u=(1-(l??0))*o;e({key:n,hls:null,node:t,start:c,duration:u-c,aspectRatio:r.aspectRatio})}else{t.preload="metadata";const c=async()=>{const u=await Rd(t),h=(a??0)*u,d=(1-(l??0))*u;e({key:n,hls:null,node:t,start:h,duration:d-h,aspectRatio:t instanceof HTMLVideoElement?t.videoWidth/t.videoHeight:null}),t.removeEventListener("loadedmetadata",c)};t.addEventListener("loadedmetadata",c)}})}function vB({key:r,playlist:e,startOffset:t,endOffset:i}){return new Promise(n=>{const s=document.createElement("video");s instanceof HTMLVideoElement&&(s.playsInline=!0),s.muted=!0,s.loop=!1;let o=!1;const a=new Dr({autoStartLoad:!0,xhrSetup:l=>{const{open:A}=l,c=e.split("?")[1];l.open=function(u,h,d){c&&!h.toString().includes("?")&&(h+="?"+c),!(!o&&h.toString().includes(".ts"))&&A.apply(this,[u,h,d])}}});a.on(Dr.Events.LEVEL_LOADED,async()=>{o||a==null||a.stopLoad();const l=await Rd(s),A=(t??0)*l,c=(1-(i??0))*l;n({key:r,hls:a,node:s,start:A,duration:c-A,aspectRatio:a.levels[0].width/a.levels[0].height})}),a.loadSource(e),a.attachMedia(s),a.startLoadOnce=(l=-1,A)=>{if(a&&!o){const c=a.levels.findIndex(u=>Math.min(u.height,u.width)===A);o=!0,a.startLevel=a.firstLevel,a.startLoad(l),a.currentLevel=c!==-1?c:a.firstLevel}}})}function CB(r){const{playlist:e}=r;return e&&!mB()&&Dr.isSupported()?vB({...r,playlist:e}):IB(r)}const yB=ti(async function(e){const{weight:t,family:i}=e,{client:n,server:s}=i.weights.find(a=>a.weight===t)??{};return!n&&!s?null:new FontFace(e.family.name,`url(${n??s})`,{weight:t,style:"normal"}).load()},{cacheKey:([r])=>JSON.stringify(r)});let BB=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._composition=null,this._media={},this._mediaState={},this._compositionController=new AbortController,this._delayProcessing=(t=100)=>{const i=new AbortController,n=setTimeout(()=>{i.signal.aborted||(this.host._processing=!0)},t);return i.signal.addEventListener("abort",()=>{clearTimeout(n)}),i},this._createImageResolver=ti(async({config:t})=>t.src?new Promise((i,n)=>{const s=new Image;s.onload=()=>{i({image:s})},s.onerror=o=>{n(o)},s.src=t.src}):{image:null},{cacheKey:([{config:t}])=>JSON.stringify(t)}),this._mediaFactory=ti(async t=>{const{key:i}=t,n=await CB(t),s={loadeddata:this._handleLoadedData,waiting:this._handleWaiting,canplay:this._handleCanPlay,progress:this._handleProgress,seeking:this._handleSeeking,seeked:this._handleSeeked,play:this._handlePlay,playing:this._handlePlaying,pause:this._handlePause,stalled:this._handleStalled,timeupdate:this._handleTimeUpdate,ended:this._handleEnded,error:this._handleError},o=Object.keys(s).reduce((a,l)=>{const A=l,c=s[A]({key:i,node:n.node});return a[A]=c,n.node.addEventListener(l,c),a},{});return{media:n,listeners:o,aspectRatio:n.aspectRatio,source:()=>n.node}},{cacheKey:([{key:t,src:i,playlist:n}])=>JSON.stringify({key:t,src:i==null?void 0:i.split("?")[0],playlist:n==null?void 0:n.split("?")[0]})}),this._handleLoadedData=({id:t,key:i,node:n})=>()=>{const s=this.mediaState[i];s!=null&&s.initialised||(this.mediaState={...this.mediaState,[i]:{...s,initialised:!0,waiting:!1,buffered:(s==null?void 0:s.buffered)??[]}},this.setMediaCurrentTime(this.host.currentTime),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:i,node:n}})))},this._handleWaiting=({key:t})=>()=>{const i=this.mediaState[t];i!=null&&i.initialised&&!(i!=null&&i.waiting)&&(this.mediaState={...this.mediaState,[t]:{...i,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const i=this.mediaState[t];i!=null&&i.initialised&&(i!=null&&i.waiting)&&(this.mediaState={...this.mediaState,[t]:{...i,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=()=>()=>{},this._handleSeeking=({id:t,key:i,node:n})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:i,node:n}}))},this._handleSeeked=({id:t,key:i,node:n})=>()=>{const s=this.mediaState[i];s!=null&&s.initialised&&(this.host.draw(),this.host.activeScenes.flatMap(o=>Lr(o.layout.node).map(({id:l})=>l)).includes(t)&&this.host.dispatchEvent(new CustomEvent("seeked",{detail:this.host.currentTime})),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:i,node:n}})))},this._handlePlay=({id:t,key:i,node:n})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:i,node:n}}))},this._handlePlaying=({id:t,key:i,node:n})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:i,node:n}}))},this._handlePause=({id:t,key:i,node:n})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:i,node:n}}))},this._handleStalled=({id:t,key:i,node:n})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:i,node:n}}))},this._handleTimeUpdate=({id:t,key:i,node:n})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:i,node:n}}))},this._handleEnded=({id:t,key:i,node:n})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:i,node:n}}))},this._handleError=({id:t,key:i,node:n})=>()=>{const s=new eo(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:s,message:s.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:i,node:n}}))},this._cleanupMedia=t=>{var i;const n=this.media[t];n&&(n.node.pause(),n.node.src="",(i=n.hls)==null||i.destroy(),Object.keys(n.listeners??{}).forEach(s=>{var o,a;if((o=this.media)!=null&&o[t]){const l=(a=n.listeners)==null?void 0:a[s];l&&n.node.removeEventListener(s,l)}}),delete this._media[t],delete this._mediaState[t])},this.host=e,this.host.addController(this)}set hasPlayed(e){e!==this._hasPlayed&&(this._hasPlayed=e,this.host.requestUpdate())}get hasPlayed(){return this._hasPlayed}set duration(e){!isNaN(e)&&e!==this._duration&&(this._duration=e,this.host.requestUpdate(),this.host.dispatchEvent(new CustomEvent("durationchange",{detail:this._duration})))}get duration(){return this._duration}set composition(e){e!==this._composition&&(this._composition=e,this.host.requestUpdate())}get composition(){return this._composition}set media(e){e!==this._media&&(this._media=e,this.host.requestUpdate())}get media(){return this._media}set mediaState(e){e!==this._mediaState&&(this._mediaState=e,this.host.requestUpdate())}get mediaState(){return this._mediaState}_setupTask(){new Yn(this.host,async([e,t,i])=>{var n;this._compositionController.abort(),this._compositionController=new AbortController;const s=this._compositionController,o=this._delayProcessing();try{if(this.host._errors=[],(!t||!this.host._languages.find(({value:a})=>t===a))&&(this.host._language=(n=this.host._languages[0])==null?void 0:n.value),e){const{width:a,height:l}=zo({aspectRatio:i,resolution:1080});try{const c=await Sc({config:e,resolvers:{text:async({options:u})=>{const h=await yB(u.font);return h&&document.fonts.add(h),{font:u.font}},image:this._createImageResolver,video:async({config:u,options:h})=>{const{media:d,source:f}=await this._mediaFactory({...u,...h});return{video:f,aspectRatio:d.aspectRatio}}},rootWidth:a,rootHeight:l});if(s.signal.aborted)return;this.composition=c}catch(c){throw new eo("Fatal composition error",c,!0)}this.duration=this.composition.duration;const A=[];for await(const c of this.composition.tracks)for await(const u of c.scenes){const h=Lr(u.layout.node);for await(const d of h){const{media:f,listeners:g}=await this._mediaFactory(d);A.push(f.key),this.media={...this.media,[f.key]:{...f,listeners:g,speed:d.speed??1,volume:d.volume??1}},this.mediaState={...this.mediaState,[f.key]:{initialised:!f,waiting:!!f,...this.mediaState[f.key]}}}}Object.keys(this.media).forEach(c=>{A.includes(c)||this.media[c].node.pause()}),this.host.currentTime>this.duration?this.host.reset(this.duration,!1):this.host.paused?this.host.reset(this.host.currentTime,!this.host.paused):this.setMediaCurrentTime(this.host.currentTime)}this.host.dispatchEvent(new CustomEvent("compositionupdate",{detail:this.composition,bubbles:!0,composed:!0}))}catch(a){this.composition=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:a,message:a.message}))}finally{o.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({config:this.host.config,language:this.host.language,aspectRatio:this.host.aspectRatio});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.config,this.host.language,this.host.aspectRatio];return this._memoKey=e,this._lastDeps=t,t})}_setMediaCurrentTime({time:e,scene:t}){const{start:i}=t;Lr(t.layout.node).forEach(s=>{if(this.media[s.key]){const o=this.media[s.key],a=(e-i)*o.speed;o.node.currentTime=Yr(o.start,a+o.start,o.start+o.duration)}})}setMediaCurrentTime(e){var t;(t=this.composition)==null||t.tracks.forEach(i=>{i.scenes.forEach(n=>{this._setMediaCurrentTime({time:e,scene:n})})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.media).forEach(e=>{this._cleanupMedia(e)}),this.media={}}};function TB(r){r.requestFullscreen?r.requestFullscreen():r.mozRequestFullScreen?r.mozRequestFullScreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.msRequestFullscreen&&r.msRequestFullscreen()}function QB(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const yl=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],bB={id:"captions",event:"captions:click",label:"Closed Captions"},xB={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},Dd={title:"Playback Speed",items:[{id:"playback-rate-0.5",event:"playbackRate:click",label:"0.5x",value:.5},{id:"playback-rate-1",event:"playbackRate:click",label:"1.0x",value:1},{id:"playback-rate-1.5",event:"playbackRate:click",label:"1.5x",value:1.5},{id:"playback-rate-2",event:"playbackRate:click",label:"2.0x",value:2}]},wB={id:"playbackRate",label:"Playback playbackRate",subItems:Dd};class SB extends oA{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==Ii.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}disconnected(){var e;(e=this.observer)==null||e.disconnect(),this.observer=void 0}reconnected(){var e;this.element&&((e=this.observer)==null||e.observe(this.element))}update(e,[t]){return this.isConnected&&!this.observer&&(this.observer=new ResizeObserver(t),this.element=e.element,this.observer.observe(this.element)),Xt}}const Bl=vi(SB),RB=PC(()=>{const r=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),e=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-SemiBold.woff2)",{style:"normal",weight:"600"}),t=new FontFace("Roobert","url(https://vouch-clients.s3.ap-southeast-2.amazonaws.com/vouch/fonts/Roobert-Bold.woff2",{style:"normal",weight:"700"}),i=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),n=gc.map(s=>({load:!1,font:new FontFace(s.family,`url(${s.url})`,{style:s.style})}));return[{load:!0,font:r},{load:!0,font:e},{load:!0,font:t},{load:!0,font:i},...n]}),mr={"red-120":"#feeded","red-130":"#fcd5d0","red-400":"#e84a4a","red-500":"#c51c3a","red-700":"#a21c39","red-800":"#850231","red-900":"#580A2D","teal-80":"#f3fafa","teal-100":"#d6f1f1","teal-200":"#ace3e3","teal-300":"#7acace","teal-400":"#4faab2","teal-500":"#358f97","teal-600":"#287179","teal-700":"#22555c","teal-800":"#21484e","teal-900":"#1f3d42","teal-950":"#0d2126","purple-100":"#d7cfff","purple-700":"#5f2fe9","green-200":"#a4d7aa","green-500":"#38b319","green-800":"#2b3c2f","grey-100":"#f0f0f0","light-50":"rgba(255, 255, 255, .05)","light-100":"rgba(255, 255, 255, .1)","light-200":"rgba(255, 255, 255, .2)","light-400":"rgba(255, 255, 255, .4)","light-500":"rgba(255, 255, 255, .5)","light-640":"rgba(255, 255, 255, .64)","light-800":"rgba(255, 255, 255, .8)","light-1000":"#fff","dark-50":"rgba(0, 0, 0, .05)","dark-80":"rgba(0, 0, 0, .08)","dark-100":"rgba(0, 0, 0, .1)","dark-200":"rgba(0, 0, 0, .2)","dark-250":"rgba(0, 0, 0, .25)","dark-400":"rgba(0, 0, 0, .4)","dark-500":"rgba(0, 0, 0, .5)","dark-640":"rgba(0, 0, 0, .64)","dark-800":"rgba(0, 0, 0, .8)","dark-900":"rgba(0, 0, 0, .9)","dark-1000":"#000"},DB={colors:mr,space:{xxs:".25rem",xs:".5rem",small:".75rem",medium:"1rem",large:"1.5rem",xl:"2.5rem"},sizes:{xxs:"1rem",xs:"1.5rem",small:"2rem",medium:"2.5rem",large:"3rem"},fontWeights:{regular:400,semibold:600},lineHeights:{small:1.1,medium:1.25,large:1.4},letterSpacings:{xxs:"-.04rem",xs:"-.03rem",small:"-.02rem",medium:"-.01rem",large:0},fontSizes:{micro:".625rem",small:".75rem",medium:".875rem",large:"1rem",xl:"1.25rem",xxl:"1.5rem",xxxl:"2rem",huge:"2.75rem"},fontFamilies:{sans:'Roobert, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,"Noto Sans", "Noto Color Emoji", sans-serif, "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji"',mono:'"Maison Neue Mono", Menlo, Monaco, Consolas, Liberation Mono, "Courier New", monospace'},borderWidths:{thin:".0625rem"},radii:{small:".25rem",medium:".5rem",large:".75rem",xl:"1rem"},shadows:{small:`.25rem .25rem .25rem ${mr["dark-100"]}`,medium:`0 .125rem .625rem ${mr["dark-100"]}`,large:`0 .25rem 1rem ${mr["dark-50"]}`,xl:`.25rem .25rem 1rem ${mr["dark-250"]}`,xxl:`0 .25rem 2rem ${mr["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${mr["dark-250"]}`,toolbar:`0 -.625rem .625rem ${mr["dark-50"]}`,text:`0 0 .25rem ${mr["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:mr["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},_d=kC(DB,{delimiter:"-"}),_B=Object.keys(_d).map(r=>Ji(`:host { --${r}: ${_d[r]}; }`)),$e=(r=>{const e=class extends r{firstUpdated(){RB().forEach(({load:s,font:o})=>{document.fonts.add(o),s&&o.load()})}};return e.styles=[(r==null?void 0:r.styles)??[],_B,lt`
|
2492
|
+
*/const Kh=(r,e,t)=>{const i=new Map;for(let n=e;n<=t;n++)i.set(r[n],n);return i},Wh=vi(class extends nn{constructor(r){if(super(r),r.type!==Ii.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const n=[],s=[];let o=0;for(const a of r)n[o]=i?i(a,o):o,s[o]=t(a,o),o++;return{values:s,keys:n}}render(r,e,t){return this.dt(r,e,t).values}update(r,[e,t,i]){const n=pf(r),{values:s,keys:o}=this.dt(e,t,i);if(!Array.isArray(n))return this.ut=o,s;const a=this.ut??(this.ut=[]),l=[];let A,c,u=0,h=n.length-1,d=0,f=s.length-1;for(;u<=h&&d<=f;)if(n[u]===null)u++;else if(n[h]===null)h--;else if(a[u]===o[d])l[d]=zr(n[u],s[d]),u++,d++;else if(a[h]===o[f])l[f]=zr(n[h],s[f]),h--,f--;else if(a[u]===o[f])l[f]=zr(n[u],s[f]),rn(r,l[f+1],n[u]),u++,f--;else if(a[h]===o[d])l[d]=zr(n[h],s[d]),rn(r,n[u],n[h]),h--,d++;else if(A===void 0&&(A=Kh(o,d,f),c=Kh(a,u,h)),A.has(a[u]))if(A.has(a[h])){const g=c.get(o[d]),p=g!==void 0?n[g]:null;if(p===null){const v=rn(r,n[u]);zr(v,s[d]),l[d]=v}else l[d]=zr(p,s[d]),rn(r,n[u],p),n[g]=null;d++}else Eo(n[h]),h--;else Eo(n[u]),u++;for(;d<=f;){const g=rn(r,l[f+1]);zr(g,s[d]),l[d++]=g}for(;u<=h;){const g=n[u++];g!==null&&Eo(g)}return this.ut=o,gf(r,l),Xt}});var Ft="top",Kt="bottom",Wt="right",kt="left",ol="auto",vn=[Ft,Kt,Wt,kt],Mi="start",Cn="end",OC="clippingParents",Jh="viewport",yn="popper",UC="reference",qh=vn.reduce(function(r,e){return r.concat([e+"-"+Mi,e+"-"+Cn])},[]),Xh=[].concat(vn,[ol]).reduce(function(r,e){return r.concat([e,e+"-"+Mi,e+"-"+Cn])},[]),GC="beforeRead",HC="read",$C="afterRead",YC="beforeMain",VC="main",KC="afterMain",WC="beforeWrite",JC="write",qC="afterWrite",XC=[GC,HC,$C,YC,VC,KC,WC,JC,qC];function fr(r){return r?(r.nodeName||"").toLowerCase():null}function Pt(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function Ai(r){var e=Pt(r).Element;return r instanceof e||r instanceof Element}function Jt(r){var e=Pt(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function al(r){if(typeof ShadowRoot>"u")return!1;var e=Pt(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function jC(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];!Jt(s)||!fr(s)||(Object.assign(s.style,i),Object.keys(n).forEach(function(o){var a=n[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function zC(r){var e=r.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var n=e.elements[i],s=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(l,A){return l[A]="",l},{});!Jt(n)||!fr(n)||(Object.assign(n.style,a),Object.keys(s).forEach(function(l){n.removeAttribute(l)}))})}}const jh={name:"applyStyles",enabled:!0,phase:"write",fn:jC,effect:zC,requires:["computeStyles"]};function gr(r){return r.split("-")[0]}var ci=Math.max,Ws=Math.min,Ni=Math.round;function ll(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function zh(){return!/^((?!chrome|android).)*safari/i.test(ll())}function Pi(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=r.getBoundingClientRect(),n=1,s=1;e&&Jt(r)&&(n=r.offsetWidth>0&&Ni(i.width)/r.offsetWidth||1,s=r.offsetHeight>0&&Ni(i.height)/r.offsetHeight||1);var o=Ai(r)?Pt(r):window,a=o.visualViewport,l=!zh()&&t,A=(i.left+(l&&a?a.offsetLeft:0))/n,c=(i.top+(l&&a?a.offsetTop:0))/s,u=i.width/n,h=i.height/s;return{width:u,height:h,top:c,right:A+u,bottom:c+h,left:A,x:A,y:c}}function Al(r){var e=Pi(r),t=r.offsetWidth,i=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:i}}function Zh(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&al(t)){var i=e;do{if(i&&r.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function _r(r){return Pt(r).getComputedStyle(r)}function ZC(r){return["table","td","th"].indexOf(fr(r))>=0}function $r(r){return((Ai(r)?r.ownerDocument:r.document)||window.document).documentElement}function Js(r){return fr(r)==="html"?r:r.assignedSlot||r.parentNode||(al(r)?r.host:null)||$r(r)}function ed(r){return!Jt(r)||_r(r).position==="fixed"?null:r.offsetParent}function ey(r){var e=/firefox/i.test(ll()),t=/Trident/i.test(ll());if(t&&Jt(r)){var i=_r(r);if(i.position==="fixed")return null}var n=Js(r);for(al(n)&&(n=n.host);Jt(n)&&["html","body"].indexOf(fr(n))<0;){var s=_r(n);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return n;n=n.parentNode}return null}function Bn(r){for(var e=Pt(r),t=ed(r);t&&ZC(t)&&_r(t).position==="static";)t=ed(t);return t&&(fr(t)==="html"||fr(t)==="body"&&_r(t).position==="static")?e:t||ey(r)||e}function cl(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function Tn(r,e,t){return ci(r,Ws(e,t))}function ty(r,e,t){var i=Tn(r,e,t);return i>t?t:i}function td(){return{top:0,right:0,bottom:0,left:0}}function rd(r){return Object.assign({},td(),r)}function id(r,e){return e.reduce(function(t,i){return t[i]=r,t},{})}var ry=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,rd(typeof e!="number"?e:id(e,vn))};function iy(r){var e,t=r.state,i=r.name,n=r.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=gr(t.placement),l=cl(a),A=[kt,Wt].indexOf(a)>=0,c=A?"height":"width";if(!(!s||!o)){var u=ry(n.padding,t),h=Al(s),d=l==="y"?Ft:kt,f=l==="y"?Kt:Wt,g=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],p=o[l]-t.rects.reference[l],v=Bn(s),Q=v?l==="y"?v.clientHeight||0:v.clientWidth||0:0,b=g/2-p/2,y=u[d],x=Q-h[c]-u[f],R=Q/2-h[c]/2+b,k=Tn(y,R,x),H=l;t.modifiersData[i]=(e={},e[H]=k,e.centerOffset=k-R,e)}}function ny(r){var e=r.state,t=r.options,i=t.element,n=i===void 0?"[data-popper-arrow]":i;n!=null&&(typeof n=="string"&&(n=e.elements.popper.querySelector(n),!n)||Zh(e.elements.popper,n)&&(e.elements.arrow=n))}const sy={name:"arrow",enabled:!0,phase:"main",fn:iy,effect:ny,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Oi(r){return r.split("-")[1]}var oy={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ay(r,e){var t=r.x,i=r.y,n=e.devicePixelRatio||1;return{x:Ni(t*n)/n||0,y:Ni(i*n)/n||0}}function nd(r){var e,t=r.popper,i=r.popperRect,n=r.placement,s=r.variation,o=r.offsets,a=r.position,l=r.gpuAcceleration,A=r.adaptive,c=r.roundOffsets,u=r.isFixed,h=o.x,d=h===void 0?0:h,f=o.y,g=f===void 0?0:f,p=typeof c=="function"?c({x:d,y:g}):{x:d,y:g};d=p.x,g=p.y;var v=o.hasOwnProperty("x"),Q=o.hasOwnProperty("y"),b=kt,y=Ft,x=window;if(A){var R=Bn(t),k="clientHeight",H="clientWidth";if(R===Pt(t)&&(R=$r(t),_r(R).position!=="static"&&a==="absolute"&&(k="scrollHeight",H="scrollWidth")),R=R,n===Ft||(n===kt||n===Wt)&&s===Cn){y=Kt;var V=u&&R===x&&x.visualViewport?x.visualViewport.height:R[k];g-=V-i.height,g*=l?1:-1}if(n===kt||(n===Ft||n===Kt)&&s===Cn){b=Wt;var P=u&&R===x&&x.visualViewport?x.visualViewport.width:R[H];d-=P-i.width,d*=l?1:-1}}var K=Object.assign({position:a},A&&oy),ie=c===!0?ay({x:d,y:g},Pt(t)):{x:d,y:g};if(d=ie.x,g=ie.y,l){var ee;return Object.assign({},K,(ee={},ee[y]=Q?"0":"",ee[b]=v?"0":"",ee.transform=(x.devicePixelRatio||1)<=1?"translate("+d+"px, "+g+"px)":"translate3d("+d+"px, "+g+"px, 0)",ee))}return Object.assign({},K,(e={},e[y]=Q?g+"px":"",e[b]=v?d+"px":"",e.transform="",e))}function ly(r){var e=r.state,t=r.options,i=t.gpuAcceleration,n=i===void 0?!0:i,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,A={placement:gr(e.placement),variation:Oi(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:n,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,nd(Object.assign({},A,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,nd(Object.assign({},A,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Ay={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:ly,data:{}};var qs={passive:!0};function cy(r){var e=r.state,t=r.instance,i=r.options,n=i.scroll,s=n===void 0?!0:n,o=i.resize,a=o===void 0?!0:o,l=Pt(e.elements.popper),A=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&A.forEach(function(c){c.addEventListener("scroll",t.update,qs)}),a&&l.addEventListener("resize",t.update,qs),function(){s&&A.forEach(function(c){c.removeEventListener("scroll",t.update,qs)}),a&&l.removeEventListener("resize",t.update,qs)}}const uy={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:cy,data:{}};var hy={left:"right",right:"left",bottom:"top",top:"bottom"};function Xs(r){return r.replace(/left|right|bottom|top/g,function(e){return hy[e]})}var dy={start:"end",end:"start"};function sd(r){return r.replace(/start|end/g,function(e){return dy[e]})}function ul(r){var e=Pt(r),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function hl(r){return Pi($r(r)).left+ul(r).scrollLeft}function fy(r,e){var t=Pt(r),i=$r(r),n=t.visualViewport,s=i.clientWidth,o=i.clientHeight,a=0,l=0;if(n){s=n.width,o=n.height;var A=zh();(A||!A&&e==="fixed")&&(a=n.offsetLeft,l=n.offsetTop)}return{width:s,height:o,x:a+hl(r),y:l}}function gy(r){var e,t=$r(r),i=ul(r),n=(e=r.ownerDocument)==null?void 0:e.body,s=ci(t.scrollWidth,t.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),o=ci(t.scrollHeight,t.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),a=-i.scrollLeft+hl(r),l=-i.scrollTop;return _r(n||t).direction==="rtl"&&(a+=ci(t.clientWidth,n?n.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function dl(r){var e=_r(r),t=e.overflow,i=e.overflowX,n=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+n+i)}function od(r){return["html","body","#document"].indexOf(fr(r))>=0?r.ownerDocument.body:Jt(r)&&dl(r)?r:od(Js(r))}function Qn(r,e){var t;e===void 0&&(e=[]);var i=od(r),n=i===((t=r.ownerDocument)==null?void 0:t.body),s=Pt(i),o=n?[s].concat(s.visualViewport||[],dl(i)?i:[]):i,a=e.concat(o);return n?a:a.concat(Qn(Js(o)))}function fl(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function py(r,e){var t=Pi(r,!1,e==="fixed");return t.top=t.top+r.clientTop,t.left=t.left+r.clientLeft,t.bottom=t.top+r.clientHeight,t.right=t.left+r.clientWidth,t.width=r.clientWidth,t.height=r.clientHeight,t.x=t.left,t.y=t.top,t}function ad(r,e,t){return e===Jh?fl(fy(r,t)):Ai(e)?py(e,t):fl(gy($r(r)))}function my(r){var e=Qn(Js(r)),t=["absolute","fixed"].indexOf(_r(r).position)>=0,i=t&&Jt(r)?Bn(r):r;return Ai(i)?e.filter(function(n){return Ai(n)&&Zh(n,i)&&fr(n)!=="body"}):[]}function Ey(r,e,t,i){var n=e==="clippingParents"?my(r):[].concat(e),s=[].concat(n,[t]),o=s[0],a=s.reduce(function(l,A){var c=ad(r,A,i);return l.top=ci(c.top,l.top),l.right=Ws(c.right,l.right),l.bottom=Ws(c.bottom,l.bottom),l.left=ci(c.left,l.left),l},ad(r,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function ld(r){var e=r.reference,t=r.element,i=r.placement,n=i?gr(i):null,s=i?Oi(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(n){case Ft:l={x:o,y:e.y-t.height};break;case Kt:l={x:o,y:e.y+e.height};break;case Wt:l={x:e.x+e.width,y:a};break;case kt:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var A=n?cl(n):null;if(A!=null){var c=A==="y"?"height":"width";switch(s){case Mi:l[A]=l[A]-(e[c]/2-t[c]/2);break;case Cn:l[A]=l[A]+(e[c]/2-t[c]/2);break}}return l}function bn(r,e){e===void 0&&(e={});var t=e,i=t.placement,n=i===void 0?r.placement:i,s=t.strategy,o=s===void 0?r.strategy:s,a=t.boundary,l=a===void 0?OC:a,A=t.rootBoundary,c=A===void 0?Jh:A,u=t.elementContext,h=u===void 0?yn:u,d=t.altBoundary,f=d===void 0?!1:d,g=t.padding,p=g===void 0?0:g,v=rd(typeof p!="number"?p:id(p,vn)),Q=h===yn?UC:yn,b=r.rects.popper,y=r.elements[f?Q:h],x=Ey(Ai(y)?y:y.contextElement||$r(r.elements.popper),l,c,o),R=Pi(r.elements.reference),k=ld({reference:R,element:b,strategy:"absolute",placement:n}),H=fl(Object.assign({},b,k)),V=h===yn?H:R,P={top:x.top-V.top+v.top,bottom:V.bottom-x.bottom+v.bottom,left:x.left-V.left+v.left,right:V.right-x.right+v.right},K=r.modifiersData.offset;if(h===yn&&K){var ie=K[n];Object.keys(P).forEach(function(ee){var le=[Wt,Kt].indexOf(ee)>=0?1:-1,D=[Ft,Kt].indexOf(ee)>=0?"y":"x";P[ee]+=ie[D]*le})}return P}function Iy(r,e){e===void 0&&(e={});var t=e,i=t.placement,n=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,A=l===void 0?Xh:l,c=Oi(i),u=c?a?qh:qh.filter(function(f){return Oi(f)===c}):vn,h=u.filter(function(f){return A.indexOf(f)>=0});h.length===0&&(h=u);var d=h.reduce(function(f,g){return f[g]=bn(r,{placement:g,boundary:n,rootBoundary:s,padding:o})[gr(g)],f},{});return Object.keys(d).sort(function(f,g){return d[f]-d[g]})}function vy(r){if(gr(r)===ol)return[];var e=Xs(r);return[sd(r),e,sd(e)]}function Cy(r){var e=r.state,t=r.options,i=r.name;if(!e.modifiersData[i]._skip){for(var n=t.mainAxis,s=n===void 0?!0:n,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,A=t.padding,c=t.boundary,u=t.rootBoundary,h=t.altBoundary,d=t.flipVariations,f=d===void 0?!0:d,g=t.allowedAutoPlacements,p=e.options.placement,v=gr(p),Q=v===p,b=l||(Q||!f?[Xs(p)]:vy(p)),y=[p].concat(b).reduce(function(ce,pe){return ce.concat(gr(pe)===ol?Iy(e,{placement:pe,boundary:c,rootBoundary:u,padding:A,flipVariations:f,allowedAutoPlacements:g}):pe)},[]),x=e.rects.reference,R=e.rects.popper,k=new Map,H=!0,V=y[0],P=0;P<y.length;P++){var K=y[P],ie=gr(K),ee=Oi(K)===Mi,le=[Ft,Kt].indexOf(ie)>=0,D=le?"width":"height",O=bn(e,{placement:K,boundary:c,rootBoundary:u,altBoundary:h,padding:A}),X=le?ee?Wt:kt:ee?Kt:Ft;x[D]>R[D]&&(X=Xs(X));var _=Xs(X),S=[];if(s&&S.push(O[ie]<=0),a&&S.push(O[X]<=0,O[_]<=0),S.every(function(ce){return ce})){V=K,H=!1;break}k.set(K,S)}if(H)for(var F=f?3:1,J=function(pe){var ge=y.find(function(Se){var Le=k.get(Se);if(Le)return Le.slice(0,pe).every(function(Ge){return Ge})});if(ge)return V=ge,"break"},Y=F;Y>0;Y--){var ne=J(Y);if(ne==="break")break}e.placement!==V&&(e.modifiersData[i]._skip=!0,e.placement=V,e.reset=!0)}}const yy={name:"flip",enabled:!0,phase:"main",fn:Cy,requiresIfExists:["offset"],data:{_skip:!1}};function Ad(r,e,t){return t===void 0&&(t={x:0,y:0}),{top:r.top-e.height-t.y,right:r.right-e.width+t.x,bottom:r.bottom-e.height+t.y,left:r.left-e.width-t.x}}function cd(r){return[Ft,Wt,Kt,kt].some(function(e){return r[e]>=0})}function By(r){var e=r.state,t=r.name,i=e.rects.reference,n=e.rects.popper,s=e.modifiersData.preventOverflow,o=bn(e,{elementContext:"reference"}),a=bn(e,{altBoundary:!0}),l=Ad(o,i),A=Ad(a,n,s),c=cd(l),u=cd(A);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:A,isReferenceHidden:c,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":u})}const Ty={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:By};function Qy(r,e,t){var i=gr(r),n=[kt,Ft].indexOf(i)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:r})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*n,[kt,Wt].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function by(r){var e=r.state,t=r.options,i=r.name,n=t.offset,s=n===void 0?[0,0]:n,o=Xh.reduce(function(c,u){return c[u]=Qy(u,e.rects,s),c},{}),a=o[e.placement],l=a.x,A=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=A),e.modifiersData[i]=o}const xy={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:by};function wy(r){var e=r.state,t=r.name;e.modifiersData[t]=ld({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Sy={name:"popperOffsets",enabled:!0,phase:"read",fn:wy,data:{}};function Ry(r){return r==="x"?"y":"x"}function Dy(r){var e=r.state,t=r.options,i=r.name,n=t.mainAxis,s=n===void 0?!0:n,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,A=t.rootBoundary,c=t.altBoundary,u=t.padding,h=t.tether,d=h===void 0?!0:h,f=t.tetherOffset,g=f===void 0?0:f,p=bn(e,{boundary:l,rootBoundary:A,padding:u,altBoundary:c}),v=gr(e.placement),Q=Oi(e.placement),b=!Q,y=cl(v),x=Ry(y),R=e.modifiersData.popperOffsets,k=e.rects.reference,H=e.rects.popper,V=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,P=typeof V=="number"?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),K=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ie={x:0,y:0};if(R){if(s){var ee,le=y==="y"?Ft:kt,D=y==="y"?Kt:Wt,O=y==="y"?"height":"width",X=R[y],_=X+p[le],S=X-p[D],F=d?-H[O]/2:0,J=Q===Mi?k[O]:H[O],Y=Q===Mi?-H[O]:-k[O],ne=e.elements.arrow,ce=d&&ne?Al(ne):{width:0,height:0},pe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:td(),ge=pe[le],Se=pe[D],Le=Tn(0,k[O],ce[O]),Ge=b?k[O]/2-F-Le-ge-P.mainAxis:J-Le-ge-P.mainAxis,fe=b?-k[O]/2+F+Le+Se+P.mainAxis:Y+Le+Se+P.mainAxis,Qe=e.elements.arrow&&Bn(e.elements.arrow),Ne=Qe?y==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,we=(ee=K==null?void 0:K[y])!=null?ee:0,qe=X+Ge-we-Ne,Te=X+fe-we,T=Tn(d?Ws(_,qe):_,X,d?ci(S,Te):S);R[y]=T,ie[y]=T-X}if(a){var m,E=y==="x"?Ft:kt,w=y==="x"?Kt:Wt,N=R[x],z=x==="y"?"height":"width",j=N+p[E],Ie=N-p[w],be=[Ft,kt].indexOf(v)!==-1,De=(m=K==null?void 0:K[x])!=null?m:0,ke=be?j:N-k[z]-H[z]-De+P.altAxis,_e=be?N+k[z]+H[z]-De-P.altAxis:Ie,Nt=d&&be?ty(ke,N,_e):Tn(d?ke:j,N,d?_e:Ie);R[x]=Nt,ie[x]=Nt-N}e.modifiersData[i]=ie}}const _y={name:"preventOverflow",enabled:!0,phase:"main",fn:Dy,requiresIfExists:["offset"]};function Ly(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function Fy(r){return r===Pt(r)||!Jt(r)?ul(r):Ly(r)}function ky(r){var e=r.getBoundingClientRect(),t=Ni(e.width)/r.offsetWidth||1,i=Ni(e.height)/r.offsetHeight||1;return t!==1||i!==1}function My(r,e,t){t===void 0&&(t=!1);var i=Jt(e),n=Jt(e)&&ky(e),s=$r(e),o=Pi(r,n,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!t)&&((fr(e)!=="body"||dl(s))&&(a=Fy(e)),Jt(e)?(l=Pi(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=hl(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Ny(r){var e=new Map,t=new Set,i=[];r.forEach(function(s){e.set(s.name,s)});function n(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&n(l)}}),i.push(s)}return r.forEach(function(s){t.has(s.name)||n(s)}),i}function Py(r){var e=Ny(r);return XC.reduce(function(t,i){return t.concat(e.filter(function(n){return n.phase===i}))},[])}function Oy(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}function Uy(r){var e=r.reduce(function(t,i){var n=t[i.name];return t[i.name]=n?Object.assign({},n,i,{options:Object.assign({},n.options,i.options),data:Object.assign({},n.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var ud={placement:"bottom",modifiers:[],strategy:"absolute"};function hd(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function Gy(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,i=t===void 0?[]:t,n=e.defaultOptions,s=n===void 0?ud:n;return function(a,l,A){A===void 0&&(A=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},ud,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},u=[],h=!1,d={state:c,setOptions:function(v){var Q=typeof v=="function"?v(c.options):v;g(),c.options=Object.assign({},s,c.options,Q),c.scrollParents={reference:Ai(a)?Qn(a):a.contextElement?Qn(a.contextElement):[],popper:Qn(l)};var b=Py(Uy([].concat(i,c.options.modifiers)));return c.orderedModifiers=b.filter(function(y){return y.enabled}),f(),d.update()},forceUpdate:function(){if(!h){var v=c.elements,Q=v.reference,b=v.popper;if(hd(Q,b)){c.rects={reference:My(Q,Bn(b),c.options.strategy==="fixed"),popper:Al(b)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(P){return c.modifiersData[P.name]=Object.assign({},P.data)});for(var y=0;y<c.orderedModifiers.length;y++){if(c.reset===!0){c.reset=!1,y=-1;continue}var x=c.orderedModifiers[y],R=x.fn,k=x.options,H=k===void 0?{}:k,V=x.name;typeof R=="function"&&(c=R({state:c,options:H,name:V,instance:d})||c)}}}},update:Oy(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){g(),h=!0}};if(!hd(a,l))return d;d.setOptions(A).then(function(p){!h&&A.onFirstUpdate&&A.onFirstUpdate(p)});function f(){c.orderedModifiers.forEach(function(p){var v=p.name,Q=p.options,b=Q===void 0?{}:Q,y=p.effect;if(typeof y=="function"){var x=y({state:c,name:v,instance:d,options:b}),R=function(){};u.push(x||R)}})}function g(){u.forEach(function(p){return p()}),u=[]}return d}}var Hy=[uy,Sy,Ay,jh,xy,yy,_y,sy,Ty],$y=Gy({defaultModifiers:Hy}),Yy="tippy-box",dd="tippy-content",Vy="tippy-backdrop",fd="tippy-arrow",gd="tippy-svg-arrow",ui={passive:!0,capture:!0},pd=function(){return document.body};function gl(r,e,t){if(Array.isArray(r)){var i=r[e];return i??(Array.isArray(t)?t[e]:t)}return r}function pl(r,e){var t={}.toString.call(r);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function md(r,e){return typeof r=="function"?r.apply(void 0,e):r}function Ed(r,e){if(e===0)return r;var t;return function(i){clearTimeout(t),t=setTimeout(function(){r(i)},e)}}function Ky(r){return r.split(/\s+/).filter(Boolean)}function Ui(r){return[].concat(r)}function Id(r,e){r.indexOf(e)===-1&&r.push(e)}function Wy(r){return r.filter(function(e,t){return r.indexOf(e)===t})}function Jy(r){return r.split("-")[0]}function js(r){return[].slice.call(r)}function vd(r){return Object.keys(r).reduce(function(e,t){return r[t]!==void 0&&(e[t]=r[t]),e},{})}function xn(){return document.createElement("div")}function zs(r){return["Element","Fragment"].some(function(e){return pl(r,e)})}function qy(r){return pl(r,"NodeList")}function Xy(r){return pl(r,"MouseEvent")}function jy(r){return!!(r&&r._tippy&&r._tippy.reference===r)}function zy(r){return zs(r)?[r]:qy(r)?js(r):Array.isArray(r)?r:js(document.querySelectorAll(r))}function ml(r,e){r.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Cd(r,e){r.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Zy(r){var e,t=Ui(r),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function eB(r,e){var t=e.clientX,i=e.clientY;return r.every(function(n){var s=n.popperRect,o=n.popperState,a=n.props,l=a.interactiveBorder,A=Jy(o.placement),c=o.modifiersData.offset;if(!c)return!0;var u=A==="bottom"?c.top.y:0,h=A==="top"?c.bottom.y:0,d=A==="right"?c.left.x:0,f=A==="left"?c.right.x:0,g=s.top-i+u>l,p=i-s.bottom-h>l,v=s.left-t+d>l,Q=t-s.right-f>l;return g||p||v||Q})}function El(r,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(n){r[i](n,t)})}function yd(r,e){for(var t=e;t;){var i;if(r.contains(t))return!0;t=t.getRootNode==null||(i=t.getRootNode())==null?void 0:i.host}return!1}var pr={isTouch:!1},Bd=0;function tB(){pr.isTouch||(pr.isTouch=!0,window.performance&&document.addEventListener("mousemove",Td))}function Td(){var r=performance.now();r-Bd<20&&(pr.isTouch=!1,document.removeEventListener("mousemove",Td)),Bd=r}function rB(){var r=document.activeElement;if(jy(r)){var e=r._tippy;r.blur&&!e.state.isVisible&&r.blur()}}function iB(){document.addEventListener("touchstart",tB,ui),window.addEventListener("blur",rB)}var nB=typeof window<"u"&&typeof document<"u",sB=nB?!!window.msCrypto:!1,oB={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},aB={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},tr=Object.assign({appendTo:pd,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},oB,aB),lB=Object.keys(tr),AB=function(e){var t=Object.keys(e);t.forEach(function(i){tr[i]=e[i]})};function Qd(r){var e=r.plugins||[],t=e.reduce(function(i,n){var s=n.name,o=n.defaultValue;if(s){var a;i[s]=r[s]!==void 0?r[s]:(a=tr[s])!=null?a:o}return i},{});return Object.assign({},r,t)}function cB(r,e){var t=e?Object.keys(Qd(Object.assign({},tr,{plugins:e}))):lB,i=t.reduce(function(n,s){var o=(r.getAttribute("data-tippy-"+s)||"").trim();if(!o)return n;if(s==="content")n[s]=o;else try{n[s]=JSON.parse(o)}catch{n[s]=o}return n},{});return i}function bd(r,e){var t=Object.assign({},e,{content:md(e.content,[r])},e.ignoreAttributes?{}:cB(r,e.plugins));return t.aria=Object.assign({},tr.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var uB=function(){return"innerHTML"};function Il(r,e){r[uB()]=e}function xd(r){var e=xn();return r===!0?e.className=fd:(e.className=gd,zs(r)?e.appendChild(r):Il(e,r)),e}function wd(r,e){zs(e.content)?(Il(r,""),r.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Il(r,e.content):r.textContent=e.content)}function vl(r){var e=r.firstElementChild,t=js(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(dd)}),arrow:t.find(function(i){return i.classList.contains(fd)||i.classList.contains(gd)}),backdrop:t.find(function(i){return i.classList.contains(Vy)})}}function Sd(r){var e=xn(),t=xn();t.className=Yy,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=xn();i.className=dd,i.setAttribute("data-state","hidden"),wd(i,r.props),e.appendChild(t),t.appendChild(i),n(r.props,r.props);function n(s,o){var a=vl(e),l=a.box,A=a.content,c=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&wd(A,r.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild(xd(o.arrow))):l.appendChild(xd(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:n}}Sd.$$tippy=!0;var hB=1,Zs=[],Cl=[];function dB(r,e){var t=bd(r,Object.assign({},tr,Qd(vd(e)))),i,n,s,o=!1,a=!1,l=!1,A=!1,c,u,h,d=[],f=Ed(qe,t.interactiveDebounce),g,p=hB++,v=null,Q=Wy(t.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},y={id:p,reference:r,popper:xn(),popperInstance:v,props:t,state:b,plugins:Q,clearDelayTimeouts:ke,setProps:_e,setContent:Nt,show:ut,hide:Ut,hideWithInteractivity:Ir,enable:be,disable:De,unmount:vr,destroy:Tt};if(!t.render)return y;var x=t.render(y),R=x.popper,k=x.onUpdate;R.setAttribute("data-tippy-root",""),R.id="tippy-"+y.id,y.popper=R,r._tippy=y,R._tippy=y;var H=Q.map(function(q){return q.fn(y)}),V=r.hasAttribute("aria-expanded");return Qe(),F(),X(),_("onCreate",[y]),t.showOnCreate&&j(),R.addEventListener("mouseenter",function(){y.props.interactive&&y.state.isVisible&&y.clearDelayTimeouts()}),R.addEventListener("mouseleave",function(){y.props.interactive&&y.props.trigger.indexOf("mouseenter")>=0&&le().addEventListener("mousemove",f)}),y;function P(){var q=y.props.touch;return Array.isArray(q)?q:[q,0]}function K(){return P()[0]==="hold"}function ie(){var q;return!!((q=y.props.render)!=null&&q.$$tippy)}function ee(){return g||r}function le(){var q=ee().parentNode;return q?Zy(q):document}function D(){return vl(R)}function O(q){return y.state.isMounted&&!y.state.isVisible||pr.isTouch||c&&c.type==="focus"?0:gl(y.props.delay,q?0:1,tr.delay)}function X(q){q===void 0&&(q=!1),R.style.pointerEvents=y.props.interactive&&!q?"":"none",R.style.zIndex=""+y.props.zIndex}function _(q,de,ve){if(ve===void 0&&(ve=!0),H.forEach(function(Fe){Fe[q]&&Fe[q].apply(Fe,de)}),ve){var Pe;(Pe=y.props)[q].apply(Pe,de)}}function S(){var q=y.props.aria;if(q.content){var de="aria-"+q.content,ve=R.id,Pe=Ui(y.props.triggerTarget||r);Pe.forEach(function(Fe){var Xe=Fe.getAttribute(de);if(y.state.isVisible)Fe.setAttribute(de,Xe?Xe+" "+ve:ve);else{var xt=Xe&&Xe.replace(ve,"").trim();xt?Fe.setAttribute(de,xt):Fe.removeAttribute(de)}})}}function F(){if(!(V||!y.props.aria.expanded)){var q=Ui(y.props.triggerTarget||r);q.forEach(function(de){y.props.interactive?de.setAttribute("aria-expanded",y.state.isVisible&&de===ee()?"true":"false"):de.removeAttribute("aria-expanded")})}}function J(){le().removeEventListener("mousemove",f),Zs=Zs.filter(function(q){return q!==f})}function Y(q){if(!(pr.isTouch&&(l||q.type==="mousedown"))){var de=q.composedPath&&q.composedPath()[0]||q.target;if(!(y.props.interactive&&yd(R,de))){if(Ui(y.props.triggerTarget||r).some(function(ve){return yd(ve,de)})){if(pr.isTouch||y.state.isVisible&&y.props.trigger.indexOf("click")>=0)return}else _("onClickOutside",[y,q]);y.props.hideOnClick===!0&&(y.clearDelayTimeouts(),y.hide(),a=!0,setTimeout(function(){a=!1}),y.state.isMounted||ge())}}}function ne(){l=!0}function ce(){l=!1}function pe(){var q=le();q.addEventListener("mousedown",Y,!0),q.addEventListener("touchend",Y,ui),q.addEventListener("touchstart",ce,ui),q.addEventListener("touchmove",ne,ui)}function ge(){var q=le();q.removeEventListener("mousedown",Y,!0),q.removeEventListener("touchend",Y,ui),q.removeEventListener("touchstart",ce,ui),q.removeEventListener("touchmove",ne,ui)}function Se(q,de){Ge(q,function(){!y.state.isVisible&&R.parentNode&&R.parentNode.contains(R)&&de()})}function Le(q,de){Ge(q,de)}function Ge(q,de){var ve=D().box;function Pe(Fe){Fe.target===ve&&(El(ve,"remove",Pe),de())}if(q===0)return de();El(ve,"remove",u),El(ve,"add",Pe),u=Pe}function fe(q,de,ve){ve===void 0&&(ve=!1);var Pe=Ui(y.props.triggerTarget||r);Pe.forEach(function(Fe){Fe.addEventListener(q,de,ve),d.push({node:Fe,eventType:q,handler:de,options:ve})})}function Qe(){K()&&(fe("touchstart",we,{passive:!0}),fe("touchend",Te,{passive:!0})),Ky(y.props.trigger).forEach(function(q){if(q!=="manual")switch(fe(q,we),q){case"mouseenter":fe("mouseleave",Te);break;case"focus":fe(sB?"focusout":"blur",T);break;case"focusin":fe("focusout",T);break}})}function Ne(){d.forEach(function(q){var de=q.node,ve=q.eventType,Pe=q.handler,Fe=q.options;de.removeEventListener(ve,Pe,Fe)}),d=[]}function we(q){var de,ve=!1;if(!(!y.state.isEnabled||m(q)||a)){var Pe=((de=c)==null?void 0:de.type)==="focus";c=q,g=q.currentTarget,F(),!y.state.isVisible&&Xy(q)&&Zs.forEach(function(Fe){return Fe(q)}),q.type==="click"&&(y.props.trigger.indexOf("mouseenter")<0||o)&&y.props.hideOnClick!==!1&&y.state.isVisible?ve=!0:j(q),q.type==="click"&&(o=!ve),ve&&!Pe&&Ie(q)}}function qe(q){var de=q.target,ve=ee().contains(de)||R.contains(de);if(!(q.type==="mousemove"&&ve)){var Pe=z().concat(R).map(function(Fe){var Xe,xt=Fe._tippy,wt=(Xe=xt.popperInstance)==null?void 0:Xe.state;return wt?{popperRect:Fe.getBoundingClientRect(),popperState:wt,props:t}:null}).filter(Boolean);eB(Pe,q)&&(J(),Ie(q))}}function Te(q){var de=m(q)||y.props.trigger.indexOf("click")>=0&&o;if(!de){if(y.props.interactive){y.hideWithInteractivity(q);return}Ie(q)}}function T(q){y.props.trigger.indexOf("focusin")<0&&q.target!==ee()||y.props.interactive&&q.relatedTarget&&R.contains(q.relatedTarget)||Ie(q)}function m(q){return pr.isTouch?K()!==q.type.indexOf("touch")>=0:!1}function E(){w();var q=y.props,de=q.popperOptions,ve=q.placement,Pe=q.offset,Fe=q.getReferenceClientRect,Xe=q.moveTransition,xt=ie()?vl(R).arrow:null,wt=Fe?{getBoundingClientRect:Fe,contextElement:Fe.contextElement||ee()}:r,Vi={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ki){var Wr=Ki.state;if(ie()){var Fn=D(),kn=Fn.box;["placement","reference-hidden","escaped"].forEach(function(Wi){Wi==="placement"?kn.setAttribute("data-placement",Wr.placement):Wr.attributes.popper["data-popper-"+Wi]?kn.setAttribute("data-"+Wi,""):kn.removeAttribute("data-"+Wi)}),Wr.attributes.popper={}}}},St=[{name:"offset",options:{offset:Pe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Xe}},Vi];ie()&&xt&&St.push({name:"arrow",options:{element:xt,padding:3}}),St.push.apply(St,(de==null?void 0:de.modifiers)||[]),y.popperInstance=$y(wt,R,Object.assign({},de,{placement:ve,onFirstUpdate:h,modifiers:St}))}function w(){y.popperInstance&&(y.popperInstance.destroy(),y.popperInstance=null)}function N(){var q=y.props.appendTo,de,ve=ee();y.props.interactive&&q===pd||q==="parent"?de=ve.parentNode:de=md(q,[ve]),de.contains(R)||de.appendChild(R),y.state.isMounted=!0,E()}function z(){return js(R.querySelectorAll("[data-tippy-root]"))}function j(q){y.clearDelayTimeouts(),q&&_("onTrigger",[y,q]),pe();var de=O(!0),ve=P(),Pe=ve[0],Fe=ve[1];pr.isTouch&&Pe==="hold"&&Fe&&(de=Fe),de?i=setTimeout(function(){y.show()},de):y.show()}function Ie(q){if(y.clearDelayTimeouts(),_("onUntrigger",[y,q]),!y.state.isVisible){ge();return}if(!(y.props.trigger.indexOf("mouseenter")>=0&&y.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(q.type)>=0&&o)){var de=O(!1);de?n=setTimeout(function(){y.state.isVisible&&y.hide()},de):s=requestAnimationFrame(function(){y.hide()})}}function be(){y.state.isEnabled=!0}function De(){y.hide(),y.state.isEnabled=!1}function ke(){clearTimeout(i),clearTimeout(n),cancelAnimationFrame(s)}function _e(q){if(!y.state.isDestroyed){_("onBeforeUpdate",[y,q]),Ne();var de=y.props,ve=bd(r,Object.assign({},de,vd(q),{ignoreAttributes:!0}));y.props=ve,Qe(),de.interactiveDebounce!==ve.interactiveDebounce&&(J(),f=Ed(qe,ve.interactiveDebounce)),de.triggerTarget&&!ve.triggerTarget?Ui(de.triggerTarget).forEach(function(Pe){Pe.removeAttribute("aria-expanded")}):ve.triggerTarget&&r.removeAttribute("aria-expanded"),F(),X(),k&&k(de,ve),y.popperInstance&&(E(),z().forEach(function(Pe){requestAnimationFrame(Pe._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[y,q])}}function Nt(q){y.setProps({content:q})}function ut(){var q=y.state.isVisible,de=y.state.isDestroyed,ve=!y.state.isEnabled,Pe=pr.isTouch&&!y.props.touch,Fe=gl(y.props.duration,0,tr.duration);if(!(q||de||ve||Pe)&&!ee().hasAttribute("disabled")&&(_("onShow",[y],!1),y.props.onShow(y)!==!1)){if(y.state.isVisible=!0,ie()&&(R.style.visibility="visible"),X(),pe(),y.state.isMounted||(R.style.transition="none"),ie()){var Xe=D(),xt=Xe.box,wt=Xe.content;ml([xt,wt],0)}h=function(){var St;if(!(!y.state.isVisible||A)){if(A=!0,R.offsetHeight,R.style.transition=y.props.moveTransition,ie()&&y.props.animation){var pi=D(),Ki=pi.box,Wr=pi.content;ml([Ki,Wr],Fe),Cd([Ki,Wr],"visible")}S(),F(),Id(Cl,y),(St=y.popperInstance)==null||St.forceUpdate(),_("onMount",[y]),y.props.animation&&ie()&&Le(Fe,function(){y.state.isShown=!0,_("onShown",[y])})}},N()}}function Ut(){var q=!y.state.isVisible,de=y.state.isDestroyed,ve=!y.state.isEnabled,Pe=gl(y.props.duration,1,tr.duration);if(!(q||de||ve)&&(_("onHide",[y],!1),y.props.onHide(y)!==!1)){if(y.state.isVisible=!1,y.state.isShown=!1,A=!1,o=!1,ie()&&(R.style.visibility="hidden"),J(),ge(),X(!0),ie()){var Fe=D(),Xe=Fe.box,xt=Fe.content;y.props.animation&&(ml([Xe,xt],Pe),Cd([Xe,xt],"hidden"))}S(),F(),y.props.animation?ie()&&Se(Pe,y.unmount):y.unmount()}}function Ir(q){le().addEventListener("mousemove",f),Id(Zs,f),f(q)}function vr(){y.state.isVisible&&y.hide(),y.state.isMounted&&(w(),z().forEach(function(q){q._tippy.unmount()}),R.parentNode&&R.parentNode.removeChild(R),Cl=Cl.filter(function(q){return q!==y}),y.state.isMounted=!1,_("onHidden",[y]))}function Tt(){y.state.isDestroyed||(y.clearDelayTimeouts(),y.unmount(),Ne(),delete r._tippy,y.state.isDestroyed=!0,_("onDestroy",[y]))}}function hi(r,e){e===void 0&&(e={});var t=tr.plugins.concat(e.plugins||[]);iB();var i=Object.assign({},e,{plugins:t}),n=zy(r),s=n.reduce(function(o,a){var l=a&&dB(a,i);return l&&o.push(l),o},[]);return zs(r)?s[0]:s}hi.defaultProps=tr,hi.setDefaultProps=AB,hi.currentInput=pr,Object.assign({},jh,{effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow)}}),hi.setDefaultProps({render:Sd});function Lr(r){var e,t;const i=[];return(((e=r.renderer)==null?void 0:e.type)==="video"||((t=r.renderer)==null?void 0:t.type)==="audio")&&i.push({...r.config,...r.options}),i.push(...r.childNodes.flatMap(Lr).filter(Boolean)),i}class eo extends Error{constructor(e,t=new Error,i=!1){super(),this.fatal=!1,this.fatal=i,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}function Yr(r,e,t){return Math.min(Math.max(e,r),t)}const fB=5;function gB(r,e){return r.length!==e.length||r.some((t,i)=>t!==e[i])}class pB{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=It(),this._controls=It(),this.host=e}set activeScenes(e){gB(e,this._activeScenes)&&(this._activeScenes=e,this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e})),this.host.requestUpdate())}get activeScenes(){return this._activeScenes}set currentTime(e){var t,i,n;const s=Yr(0,e,this.host.duration);this.activeScenes=((t=this.host.composition)==null?void 0:t.tracks.reduce((a,l)=>a.concat(l.scenes.filter(({start:A,duration:c})=>s>=A&&s<A+c)),[]))??[];const o=s!==this.currentTime;this._currentTime=s,this._upcomingScenes=((i=this.host.composition)==null?void 0:i.tracks.reduce((a,l)=>a.concat(l.scenes.filter(({start:A})=>s>=A-fB&&s<A)),[]))??[],this.loadScenes(),this.syncMediaState(),(n=this._controls.value)==null||n.setAttribute("currentTime",s.toString()),o&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:s})),this.draw(s)}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return vt(this._canvas)}controls(){return vt(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{Lr(e.layout.node).forEach(i=>{var n,s,o;const{start:a,duration:l}=e,A=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(this.host.media[i.key]){const c=this.host.media[i.key],{speed:u,volume:h,hls:d,node:f,start:g,duration:p}=c,v=this.host.mediaState[i.key];f&&v&&(f.currentTime>=g+p||f.ended||A&&(d?(n=d.startLoadOnce)==null||n.call(d,g):v.initialised||(s=f.startLoadOnce)==null||s.call(f),f.volume=Yr(0,this.host.volume*(h??1),1),f.playbackRate=Yr(.1,this.host.playbackRate*(u??1),4)))}else if(A){const c=`${a}-${l}`,u=this.host._sceneController.mediaState[c];this.host.duration&&!((o=u==null?void 0:u.buffered)!=null&&o.length)&&(this.host._sceneController.mediaState={...this.host._sceneController.mediaState,[c]:{...u,buffered:[{start:Math.max(0,a/this.host.duration*100),end:Math.min((a+l)/this.host.duration*100,100)}]}})}})})}syncMediaState(){var e;(e=this.host.composition)==null||e.tracks.forEach(t=>{var i;(i=t.scenes)==null||i.forEach(n=>{Lr(n.layout.node).forEach(o=>{if(this.host.media[o.key]){const a=this.host.media[o.key],{node:l}=a,A=this.host.mediaState[o.key],c=this.activeScenes.includes(n);if(A)if(c&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(l.paused&&A.initialised)try{return l.play()}catch(u){throw new eo("Video play error",u,!0)}}else l.paused||l.pause()}})})})}draw(e=this.currentTime){this.host.composition&&this._canvas.value&&this.host.composition.draw({currentTime:e,canvas:this._canvas.value})}clear(){var e;const t=this._canvas.value;(e=t==null?void 0:t.getContext("2d"))==null||e.clearRect(0,0,t.width,t.height)}}async function Rd(r){return r.duration===1/0?new Promise(e=>{r.currentTime=Number.MAX_SAFE_INTEGER,r.ontimeupdate=()=>{r.ontimeupdate=null,e(r.duration),r.currentTime=0}}):r.duration}function mB(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function EB(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function IB(r){return new Promise(async e=>{let t=null;const{type:i,key:n,src:s,duration:o,startOffset:a,endOffset:l}=r;i==="video"?(t=document.createElement("video"),t.playsInline=!0):t=document.createElement("audio"),t.muted=!0,t.loop=!1,t.crossOrigin="anonymous",t.src=s;let A=!1;if(t.startLoadOnce=()=>{A||(t.preload="auto",t.load(),A=!0)},i==="video"&&o&&r.aspectRatio){t.preload="none";const c=(a??0)*o,u=(1-(l??0))*o;e({key:n,hls:null,node:t,start:c,duration:u-c,aspectRatio:r.aspectRatio})}else{t.preload="metadata";const c=async()=>{const u=await Rd(t),h=(a??0)*u,d=(1-(l??0))*u;e({key:n,hls:null,node:t,start:h,duration:d-h,aspectRatio:t instanceof HTMLVideoElement?t.videoWidth/t.videoHeight:null}),t.removeEventListener("loadedmetadata",c)};t.addEventListener("loadedmetadata",c)}})}function vB({key:r,playlist:e,startOffset:t,endOffset:i}){return new Promise(n=>{const s=document.createElement("video");s instanceof HTMLVideoElement&&(s.playsInline=!0),s.muted=!0,s.loop=!1,s.crossOrigin="anonymous";let o=!1;const a=new Dr({autoStartLoad:!0,xhrSetup:l=>{const{open:A}=l,c=e.split("?")[1];l.open=function(u,h,d){c&&!h.toString().includes("?")&&(h+="?"+c),!(!o&&h.toString().includes(".ts"))&&A.apply(this,[u,h,d])}}});a.on(Dr.Events.LEVEL_LOADED,async()=>{o||a==null||a.stopLoad();const l=await Rd(s),A=(t??0)*l,c=(1-(i??0))*l;n({key:r,hls:a,node:s,start:A,duration:c-A,aspectRatio:a.levels[0].width/a.levels[0].height})}),a.loadSource(e),a.attachMedia(s),a.startLoadOnce=(l=-1,A)=>{if(a&&!o){const c=a.levels.findIndex(u=>Math.min(u.height,u.width)===A);o=!0,a.startLevel=a.firstLevel,a.startLoad(l),a.currentLevel=c!==-1?c:a.firstLevel}}})}function CB(r){const{playlist:e}=r;return e&&!mB()&&Dr.isSupported()?vB({...r,playlist:e}):IB(r)}const yB=ti(async function(e){const{weight:t,family:i}=e,{client:n,server:s}=i.weights.find(a=>a.weight===t)??{};return!n&&!s?null:new FontFace(e.family.name,`url(${n??s})`,{weight:t,style:"normal"}).load()},{cacheKey:([r])=>JSON.stringify(r)});let BB=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._composition=null,this._media={},this._mediaState={},this._compositionController=new AbortController,this._delayProcessing=(t=100)=>{const i=new AbortController,n=setTimeout(()=>{i.signal.aborted||(this.host._processing=!0)},t);return i.signal.addEventListener("abort",()=>{clearTimeout(n)}),i},this._createImageResolver=ti(async({config:t})=>t.src?new Promise((i,n)=>{const s=new Image;s.crossOrigin="anonymous",s.onload=()=>{i({image:s})},s.onerror=o=>{n(o)},s.src=t.src}):{image:null},{cacheKey:([{config:t}])=>JSON.stringify(t)}),this._mediaFactory=ti(async t=>{const{key:i}=t,n=await CB(t),s={loadeddata:this._handleLoadedData,waiting:this._handleWaiting,canplay:this._handleCanPlay,progress:this._handleProgress,seeking:this._handleSeeking,seeked:this._handleSeeked,play:this._handlePlay,playing:this._handlePlaying,pause:this._handlePause,stalled:this._handleStalled,timeupdate:this._handleTimeUpdate,ended:this._handleEnded,error:this._handleError},o=Object.keys(s).reduce((a,l)=>{const A=l,c=s[A]({key:i,node:n.node});return a[A]=c,n.node.addEventListener(l,c),a},{});return{media:n,listeners:o,aspectRatio:n.aspectRatio,source:()=>n.node}},{cacheKey:([{key:t,src:i,playlist:n}])=>JSON.stringify({key:t,src:i==null?void 0:i.split("?")[0],playlist:n==null?void 0:n.split("?")[0]})}),this._handleLoadedData=({id:t,key:i,node:n})=>()=>{const s=this.mediaState[i];s!=null&&s.initialised||(this.mediaState={...this.mediaState,[i]:{...s,initialised:!0,waiting:!1,buffered:(s==null?void 0:s.buffered)??[]}},this.setMediaCurrentTime(this.host.currentTime),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:i,node:n}})))},this._handleWaiting=({key:t})=>()=>{const i=this.mediaState[t];i!=null&&i.initialised&&!(i!=null&&i.waiting)&&(this.mediaState={...this.mediaState,[t]:{...i,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const i=this.mediaState[t];i!=null&&i.initialised&&(i!=null&&i.waiting)&&(this.mediaState={...this.mediaState,[t]:{...i,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=()=>()=>{},this._handleSeeking=({id:t,key:i,node:n})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:i,node:n}}))},this._handleSeeked=({id:t,key:i,node:n})=>()=>{const s=this.mediaState[i];s!=null&&s.initialised&&(this.host.draw(),this.host.activeScenes.flatMap(o=>Lr(o.layout.node).map(({id:l})=>l)).includes(t)&&this.host.dispatchEvent(new CustomEvent("seeked",{detail:this.host.currentTime})),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:i,node:n}})))},this._handlePlay=({id:t,key:i,node:n})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:i,node:n}}))},this._handlePlaying=({id:t,key:i,node:n})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:i,node:n}}))},this._handlePause=({id:t,key:i,node:n})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:i,node:n}}))},this._handleStalled=({id:t,key:i,node:n})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:i,node:n}}))},this._handleTimeUpdate=({id:t,key:i,node:n})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:i,node:n}}))},this._handleEnded=({id:t,key:i,node:n})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:i,node:n}}))},this._handleError=({id:t,key:i,node:n})=>()=>{const s=new eo(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:s,message:s.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:i,node:n}}))},this._cleanupMedia=t=>{var i;const n=this.media[t];n&&(n.node.pause(),n.node.src="",(i=n.hls)==null||i.destroy(),Object.keys(n.listeners??{}).forEach(s=>{var o,a;if((o=this.media)!=null&&o[t]){const l=(a=n.listeners)==null?void 0:a[s];l&&n.node.removeEventListener(s,l)}}),delete this._media[t],delete this._mediaState[t])},this.host=e,this.host.addController(this)}set hasPlayed(e){e!==this._hasPlayed&&(this._hasPlayed=e,this.host.requestUpdate())}get hasPlayed(){return this._hasPlayed}set duration(e){!isNaN(e)&&e!==this._duration&&(this._duration=e,this.host.requestUpdate(),this.host.dispatchEvent(new CustomEvent("durationchange",{detail:this._duration})))}get duration(){return this._duration}set composition(e){e!==this._composition&&(this._composition=e,this.host.requestUpdate())}get composition(){return this._composition}set media(e){e!==this._media&&(this._media=e,this.host.requestUpdate())}get media(){return this._media}set mediaState(e){e!==this._mediaState&&(this._mediaState=e,this.host.requestUpdate())}get mediaState(){return this._mediaState}_setupTask(){new Yn(this.host,async([e,t,i])=>{var n;this._compositionController.abort(),this._compositionController=new AbortController;const s=this._compositionController,o=this._delayProcessing();try{if(this.host._errors=[],(!t||!this.host._languages.find(({value:a})=>t===a))&&(this.host._language=(n=this.host._languages[0])==null?void 0:n.value),e){const{width:a,height:l}=zo({aspectRatio:i,resolution:1080});try{const c=await Sc({config:e,resolvers:{text:async({options:u})=>{const h=await yB(u.font);return h&&document.fonts.add(h),{font:u.font}},image:this._createImageResolver,video:async({config:u,options:h})=>{const{media:d,source:f}=await this._mediaFactory({...u,...h});return{video:f,aspectRatio:d.aspectRatio}}},rootWidth:a,rootHeight:l});if(s.signal.aborted)return;this.composition=c}catch(c){throw new eo("Fatal composition error",c,!0)}this.duration=this.composition.duration;const A=[];for await(const c of this.composition.tracks)for await(const u of c.scenes){const h=Lr(u.layout.node);for await(const d of h){const{media:f,listeners:g}=await this._mediaFactory(d);A.push(f.key),this.media={...this.media,[f.key]:{...f,listeners:g,speed:d.speed??1,volume:d.volume??1}},this.mediaState={...this.mediaState,[f.key]:{initialised:!f,waiting:!!f,...this.mediaState[f.key]}}}}Object.keys(this.media).forEach(c=>{A.includes(c)||this.media[c].node.pause()}),this.host.currentTime>this.duration?this.host.reset(this.duration,!1):this.host.paused?this.host.reset(this.host.currentTime,!this.host.paused):this.setMediaCurrentTime(this.host.currentTime)}this.host.dispatchEvent(new CustomEvent("compositionupdate",{detail:this.composition,bubbles:!0,composed:!0}))}catch(a){this.composition=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:a,message:a.message}))}finally{o.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({config:this.host.config,language:this.host.language,aspectRatio:this.host.aspectRatio});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.config,this.host.language,this.host.aspectRatio];return this._memoKey=e,this._lastDeps=t,t})}_setMediaCurrentTime({time:e,scene:t}){const{start:i}=t;Lr(t.layout.node).forEach(s=>{if(this.media[s.key]){const o=this.media[s.key],a=(e-i)*o.speed;o.node.currentTime=Yr(o.start,a+o.start,o.start+o.duration)}})}setMediaCurrentTime(e){var t;(t=this.composition)==null||t.tracks.forEach(i=>{i.scenes.forEach(n=>{this._setMediaCurrentTime({time:e,scene:n})})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.media).forEach(e=>{this._cleanupMedia(e)}),this.media={}}};function TB(r){r.requestFullscreen?r.requestFullscreen():r.mozRequestFullScreen?r.mozRequestFullScreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.msRequestFullscreen&&r.msRequestFullscreen()}function QB(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const yl=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],bB={id:"captions",event:"captions:click",label:"Closed Captions"},xB={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},Dd={title:"Playback Speed",items:[{id:"playback-rate-0.5",event:"playbackRate:click",label:"0.5x",value:.5},{id:"playback-rate-1",event:"playbackRate:click",label:"1.0x",value:1},{id:"playback-rate-1.5",event:"playbackRate:click",label:"1.5x",value:1.5},{id:"playback-rate-2",event:"playbackRate:click",label:"2.0x",value:2}]},wB={id:"playbackRate",label:"Playback playbackRate",subItems:Dd};class SB extends oA{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==Ii.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}disconnected(){var e;(e=this.observer)==null||e.disconnect(),this.observer=void 0}reconnected(){var e;this.element&&((e=this.observer)==null||e.observe(this.element))}update(e,[t]){return this.isConnected&&!this.observer&&(this.observer=new ResizeObserver(t),this.element=e.element,this.observer.observe(this.element)),Xt}}const Bl=vi(SB),RB=PC(()=>{const r=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),e=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-SemiBold.woff2)",{style:"normal",weight:"600"}),t=new FontFace("Roobert","url(https://vouch-clients.s3.ap-southeast-2.amazonaws.com/vouch/fonts/Roobert-Bold.woff2",{style:"normal",weight:"700"}),i=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),n=gc.map(s=>({load:!1,font:new FontFace(s.family,`url(${s.url})`,{style:s.style})}));return[{load:!0,font:r},{load:!0,font:e},{load:!0,font:t},{load:!0,font:i},...n]}),mr={"red-120":"#feeded","red-130":"#fcd5d0","red-400":"#e84a4a","red-500":"#c51c3a","red-700":"#a21c39","red-800":"#850231","red-900":"#580A2D","teal-80":"#f3fafa","teal-100":"#d6f1f1","teal-200":"#ace3e3","teal-300":"#7acace","teal-400":"#4faab2","teal-500":"#358f97","teal-600":"#287179","teal-700":"#22555c","teal-800":"#21484e","teal-900":"#1f3d42","teal-950":"#0d2126","purple-100":"#d7cfff","purple-700":"#5f2fe9","green-200":"#a4d7aa","green-500":"#38b319","green-800":"#2b3c2f","grey-100":"#f0f0f0","light-50":"rgba(255, 255, 255, .05)","light-100":"rgba(255, 255, 255, .1)","light-200":"rgba(255, 255, 255, .2)","light-400":"rgba(255, 255, 255, .4)","light-500":"rgba(255, 255, 255, .5)","light-640":"rgba(255, 255, 255, .64)","light-800":"rgba(255, 255, 255, .8)","light-1000":"#fff","dark-50":"rgba(0, 0, 0, .05)","dark-80":"rgba(0, 0, 0, .08)","dark-100":"rgba(0, 0, 0, .1)","dark-200":"rgba(0, 0, 0, .2)","dark-250":"rgba(0, 0, 0, .25)","dark-400":"rgba(0, 0, 0, .4)","dark-500":"rgba(0, 0, 0, .5)","dark-640":"rgba(0, 0, 0, .64)","dark-800":"rgba(0, 0, 0, .8)","dark-900":"rgba(0, 0, 0, .9)","dark-1000":"#000"},DB={colors:mr,space:{xxs:".25rem",xs:".5rem",small:".75rem",medium:"1rem",large:"1.5rem",xl:"2.5rem"},sizes:{xxs:"1rem",xs:"1.5rem",small:"2rem",medium:"2.5rem",large:"3rem"},fontWeights:{regular:400,semibold:600},lineHeights:{small:1.1,medium:1.25,large:1.4},letterSpacings:{xxs:"-.04rem",xs:"-.03rem",small:"-.02rem",medium:"-.01rem",large:0},fontSizes:{micro:".625rem",small:".75rem",medium:".875rem",large:"1rem",xl:"1.25rem",xxl:"1.5rem",xxxl:"2rem",huge:"2.75rem"},fontFamilies:{sans:'Roobert, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,"Noto Sans", "Noto Color Emoji", sans-serif, "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji"',mono:'"Maison Neue Mono", Menlo, Monaco, Consolas, Liberation Mono, "Courier New", monospace'},borderWidths:{thin:".0625rem"},radii:{small:".25rem",medium:".5rem",large:".75rem",xl:"1rem"},shadows:{small:`.25rem .25rem .25rem ${mr["dark-100"]}`,medium:`0 .125rem .625rem ${mr["dark-100"]}`,large:`0 .25rem 1rem ${mr["dark-50"]}`,xl:`.25rem .25rem 1rem ${mr["dark-250"]}`,xxl:`0 .25rem 2rem ${mr["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${mr["dark-250"]}`,toolbar:`0 -.625rem .625rem ${mr["dark-50"]}`,text:`0 0 .25rem ${mr["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:mr["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},_d=kC(DB,{delimiter:"-"}),_B=Object.keys(_d).map(r=>Ji(`:host { --${r}: ${_d[r]}; }`)),$e=(r=>{const e=class extends r{firstUpdated(){RB().forEach(({load:s,font:o})=>{document.fonts.add(o),s&&o.load()})}};return e.styles=[(r==null?void 0:r.styles)??[],_B,lt`
|
2493
2493
|
:host {
|
2494
2494
|
font-family: var(--fontFamilies-sans);
|
2495
2495
|
font-size: var(--fontSizes-medium);
|