import{l as Ee,p as r,c as q,a as y,m as ie,f as B,n as De,t as Fe}from"./props-b4vEeO_8.js";import{r as He,aj as Ce,e as Re,B as Ie,C as F,G as Pe,as as ze,a4 as g,ae as Ne,h as Se,k as o,a3 as t,ah as ke,I as E,F as pe,N as ye,J as ae}from"./runtime-C3rQLW--.js";import{s as qe}from"./snippet-C5kbqVpq.js";import{i as _}from"./svelte-component-C8Ginrj8.js";import{s as D}from"./attributes-Cg6aLqN3.js";import{s as we}from"./style-DvJ3IcV1.js";import{b as T}from"./size-DMdj3-I9.js";import{b as fe}from"./this-CrUBQEQ_.js";import{c as Le,o as Ge,b as je}from"./index-client-BAw8T8-V.js";import{s as Je}from"./slot-B1isFuVn.js";import{i as Ue}from"./lifecycle-F2p_Qkk3.js";import{G as Ke}from"./GraphicBlock-uLJTqaY1.js";import{F as ne}from"./fa-layers-text.svelte_svelte_type_style_lang-rD9gd1As.js";import{a as Qe,b as xe,c as Xe}from"./index-C3C5q_jF.js";function _e(a,e,n=e){var u,f,v=()=>{cancelAnimationFrame(u),a.paused||(u=requestAnimationFrame(v));var h=a.currentTime;f!==h&&n(f=h)};u=requestAnimationFrame(v),a.addEventListener("timeupdate",v),He(()=>{var h=Number(e());f!==h&&!isNaN(h)&&(a.currentTime=f=h)}),Ce(()=>{cancelAnimationFrame(u),a.removeEventListener("timeupdate",v)})}function Ve(a,e,n=e){var u=e(),f=()=>{u!==a.paused&&n(u=a.paused)};Ee(a,["play","pause","canplay"],f,u==null),Re(()=>{(u=!!e())!==a.paused&&(u?a.pause():a.play().catch(()=>{n(u=!0)}))})}function We(a,e,n,u,f){var v=()=>{u(n[a])};n.addEventListener(e,v),v(),(n===document.body||n===window||n===document)&&Ce(()=>{n.removeEventListener(e,v)})}function Ye(a,e){Ie(e,!1);let n=r(e,"element",8,null),u=r(e,"once",8,!1),f=r(e,"intersecting",12,!1),v=r(e,"root",8,null),h=r(e,"rootMargin",8,"0px"),oe=r(e,"threshold",8,0),V=r(e,"entry",12,null),m=r(e,"observer",12,null);const I=Le();let H=null,k=null;const Z=()=>{m(new IntersectionObserver(z=>{z.forEach(w=>{V(w),f(w.isIntersecting)})},{root:v(),rootMargin:h(),threshold:oe()}))};Ge(()=>(Z(),()=>{m()&&(m().disconnect(),m(null))})),je(async()=>{var z,w,G,N;V()!==null&&(I("observe",V()),V().isIntersecting&&(I("intersect",V()),n()&&u()&&((z=m())==null||z.unobserve(n())))),await ze(),n()!==null&&n()!==k&&((w=m())==null||w.observe(n()),k!==null&&((G=m())==null||G.unobserve(k)),k=n()),H&&h()!==H&&((N=m())==null||N.disconnect(),k=null,Z()),H=h()}),Ue();var R=q(),L=F(R);Je(L,e,"default",{get intersecting(){return f()},get entry(){return V()},get observer(){return m()}}),y(a,R),Pe()}const Ze=(a,e)=>a==="top left"?`top: ${e}px; left: ${e}px;`:a==="top right"?`top: ${e}px; right: ${e}px;`:a==="bottom left"?`bottom: ${e}px; left: ${e}px;`:a==="bottom right"?`bottom: ${e}px; right: ${e}px;`:"top: 50%; left: 50%; transform: translate(-50%, -50%);";var $e=(a,e,n)=>{t(e,!o(e)),t(n,o(e)===!0)},et=B(''),tt=B(''),it=B(''),at=B(''),nt=(a,e)=>{t(e,!o(e))},ot=B(''),rt=(a,e,n)=>{t(e,n())},lt=(a,e,n)=>{t(e,n())},st=B('
',2),dt=B('
',2),ut=B('
',1);function ct(a,e){Ie(e,!0);const n=K=>{var x=at();x.__click=[$e,b,ve];var ge=E(x);{var ee=M=>{var O=et(),Q=E(O);{var X=s=>{ne(s,{get icon(){return Qe},size:"2x",get color(){return w()}})},Y=s=>{ne(s,{get icon(){return xe},size:"2x",get color(){return w()}})};_(Q,s=>{z()?s(X):s(Y,!1)})}y(M,O)},P=M=>{var O=q(),Q=F(O);{var X=s=>{var c=tt(),W=E(c);ne(W,{get icon(){return Xe},size:"2x",get color(){return w()}}),y(s,c)},Y=s=>{var c=q(),W=F(c);{var C=i=>{var d=it(),l=E(d);ne(l,{get icon(){return xe},size:"2x",get color(){return w()}}),y(i,d)},p=i=>{var d=Fe("error");y(i,d)};_(W,i=>{o(b)===!0?i(C):i(p,!1)},!0)}y(s,c)};_(Q,s=>{o(b)===!1?s(X):s(Y,!1)},!0)}y(M,O)};_(ge,M=>{o(Te)?M(ee):M(P,!1)})}ae(()=>we(x,` opacity: ${o(U)??""}; ${o(Be)??""} `)),y(K,x)},u=K=>{var x=ot();x.__click=[nt,b],ae(()=>we(x,`top: 0; left: 0; width: ${o(se)??""}px; height: ${o(le)??""}px;`)),y(K,x)};let f=r(e,"poster",3,""),v=r(e,"class",3,""),h=r(e,"width",3,"normal"),oe=r(e,"textWidth",3,"normal"),V=r(e,"preloadVideo",3,"auto"),m=r(e,"loopVideo",3,!1),I=r(e,"muteVideo",3,!0),H=r(e,"soundAutoplay",3,!1),k=r(e,"playVideoWhenInView",3,!0),Z=r(e,"playVideoThreshold",3,.5),R=r(e,"possibleToPlayPause",3,!0),L=r(e,"showControls",7,!0),z=r(e,"separateReplayIcon",3,!1),w=r(e,"controlsColour",3,"#333"),G=r(e,"controlsOpacityMin",3,0),N=r(e,"controlsOpacityMax",3,.7),Me=r(e,"controlsPosition",3,"top left"),Ae=r(e,"controlsBorderOffset",3,10);R()||L(!1);let b=g(!1),j=g(0),re=g(0),ve=g(!1),Te=ye(()=>o(j)>=o(re)),he=g(0),me=g(0),le=g(0),se=g(0),J=g(!1),de=g(void 0),$=g(void 0),ue=!1;const be=()=>ue=!0;let U=g(Ne(N())),Be=ye(()=>Ze(Me(),Ae()));Se(()=>{k()&&o(J)&&I()&&t(b,!1),k()&&!o(J)&&t(b,!0),H()&&k()&&o(J)&&!I()&&ue&&!o(ve)&&t(b,!1),H()&&!I()&&!ue&&t(b,!0)}),ie("click",ke,be),ie("touchstart",ke,be);{let K=ye(()=>typeof e.notes=="string"?e.notes:void 0);Ke(a,{get textWidth(){return oe()},get title(){return e.title},get description(){return e.description},get notes(){return o(K)},get width(){return h()},get class(){return`video ${v()??""}`},children:(x,ge)=>{var ee=ut(),P=F(ee);P.__mouseover=[rt,U,N],P.__mouseout=[lt,U,G];var M=E(P);{var O=s=>{Ye(s,{get element(){return o(de)},get threshold(){return Z()},once:!1,get intersecting(){return o(J)},set intersecting(c){t(J,c,!0)},children:(c,W)=>{var C=st(),p=E(C);{var i=l=>{var te=q(),ce=F(te);{var A=S=>{n(S)},Oe=S=>{u(S)};_(ce,S=>{L()?S(A):S(Oe,!1)})}y(l,te)};_(p,l=>{R()&&l(i)})}var d=pe(p,2);fe(d,l=>t($,l),()=>o($)),fe(C,l=>t(de,l),()=>o(de)),ae(()=>{D(d,"src",e.src),D(d,"poster",f()),d.muted=I(),D(d,"preload",V()),d.loop=m(),D(d,"aria-label",e.ariaDescription)}),_e(d,()=>o(j),l=>t(j,l)),We("duration","durationchange",d,l=>t(re,l)),Ve(d,()=>o(b),l=>t(b,l)),T(d,"clientWidth",l=>t(me,l)),T(d,"clientHeight",l=>t(he,l)),T(C,"clientWidth",l=>t(se,l)),T(C,"clientHeight",l=>t(le,l)),y(c,C)},$$slots:{default:!0}})},Q=s=>{var c=dt(),W=E(c);{var C=i=>{var d=q(),l=F(d);{var te=A=>{n(A)},ce=A=>{u(A)};_(l,A=>{L()?A(te):A(ce,!1)})}y(i,d)};_(W,i=>{R()&&i(C)})}var p=pe(W,2);fe(p,i=>t($,i),()=>o($)),ae(()=>{D(p,"src",e.src),D(p,"poster",f()),p.muted=I(),D(p,"preload",V()),p.loop=m()}),_e(p,()=>o(j),i=>t(j,i)),We("duration","durationchange",p,i=>t(re,i)),Ve(p,()=>o(b),i=>t(b,i)),T(p,"clientWidth",i=>t(me,i)),T(p,"clientHeight",i=>t(he,i)),T(c,"clientWidth",i=>t(se,i)),T(c,"clientHeight",i=>t(le,i)),y(s,c)};_(M,s=>{k()?s(O):s(Q,!1)})}var X=pe(P,2);{var Y=s=>{var c=q(),W=F(c);qe(W,()=>e.notes),y(s,c)};_(X,s=>{e.notes&&typeof e.notes!="string"&&s(Y)})}ie("focus",P,()=>{t(U,N())}),ie("blur",P,()=>{t(U,G())}),y(x,ee)},$$slots:{default:!0}})}Pe()}De(["click","mouseover","mouseout"]);ct.__docgen={data:[{name:"src",visibility:"public",description:"Video source",keywords:[{name:"required",description:""}],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"poster",visibility:"public",description:"Image to be shown while the video is downloading",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:'""'},{name:"ariaDescription",visibility:"public",description:"ARIA description, passed in as a markdown string.",keywords:[{name:"required",description:""}],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"class",visibility:"public",description:"Add extra classes to the block tag to target it with custom CSS.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"title",visibility:"public",description:"Title of the graphic",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"notes",visibility:"public",description:"Notes to the graphic, passed in as a markdown string OR a custom snippet.",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"type",type:"string",text:"string"},{kind:"function",text:"Snippet<[]>"}],text:"string | Snippet<[]>"},static:!1,readonly:!1},{name:"description",visibility:"public",description:"Description of the graphic, passed in as a markdown string.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"width",visibility:"public",description:"Width of the block within the article well.",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"narrower",text:'"narrower"'},{kind:"const",type:"string",value:"narrow",text:'"narrow"'},{kind:"const",type:"string",value:"normal",text:'"normal"'},{kind:"const",type:"string",value:"wide",text:'"wide"'},{kind:"const",type:"string",value:"wider",text:'"wider"'},{kind:"const",type:"string",value:"widest",text:'"widest"'},{kind:"const",type:"string",value:"fluid",text:'"fluid"'}],text:'"narrower" | "narrow" | "normal" | "wide" | "wider" | "widest" | "fluid"'},static:!1,readonly:!1,defaultValue:'"normal"'},{name:"textWidth",visibility:"public",description:'Set a different width for the text within the text well, for example, "normal" to keep the title, description and notes inline with the rest of the text well. Can\'t ever be wider than `width`.',keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"narrower",text:'"narrower"'},{kind:"const",type:"string",value:"narrow",text:'"narrow"'},{kind:"const",type:"string",value:"normal",text:'"normal"'},{kind:"const",type:"string",value:"wide",text:'"wide"'},{kind:"const",type:"string",value:"wider",text:'"wider"'},{kind:"const",type:"string",value:"widest",text:'"widest"'},{kind:"const",type:"string",value:"fluid",text:'"fluid"'}],text:'"narrower" | "narrow" | "normal" | "wide" | "wider" | "widest" | "fluid"'},static:!1,readonly:!1,defaultValue:'"normal"'},{name:"preloadVideo",visibility:"public",description:"Preload options. `auto` is ignored if `autoplay` is true. Can also be `none` or `metadata`.",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"auto",text:'"auto"'},{kind:"const",type:"string",value:"none",text:'"none"'},{kind:"const",type:"string",value:"metadata",text:'"metadata"'}],text:'"auto" | "none" | "metadata"'},static:!1,readonly:!1,defaultValue:'"auto"'},{name:"loopVideo",visibility:"public",description:"Whether the video should loop.",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"false"},{name:"muteVideo",visibility:"public",description:"Whether video should have sound or not.",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"true"},{name:"soundAutoplay",visibility:"public",description:"If `true`, this allow videos with sound to autoplay if the user has previously interacted with DOM",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"false"},{name:"playVideoWhenInView",visibility:"public",description:"Whether the video should play when it comes into view or just on page load",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"true"},{name:"playVideoThreshold",visibility:"public",description:"Controls how much of the video should be visible when it starts playing. This is a number between 0 and 1, where 0 means the video will start playing as soon as its top enters the viewport, and 1 means it will start when the whole video is in the viewport.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"0.5"},{name:"possibleToPlayPause",visibility:"public",description:"Whether to have the option to pause and play video",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"true"},{name:"showControls",visibility:"public",description:"Whether to show the play / pause buttons",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"true"},{name:"separateReplayIcon",visibility:"public",description:"Whether to use a separate replay icon or use the play icon for replay as well",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"false"},{name:"controlsColour",visibility:"public",description:"Change the colour of the play/pause button",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:'"#333"'},{name:"controlsOpacityMin",visibility:"public",description:"Change the minimum opacity of the play/pause button, which you see on mouseover. Must be between 0 and 1.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"0"},{name:"controlsOpacityMax",visibility:"public",description:"Change the maximum opacity of the play/pause button, which you see on mouseout. Must be between 0 and 1.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"0.7"},{name:"controlsPosition",visibility:"public",description:"Have four options for controls position - top right, top left, bottom right, bottom left",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"middle",text:'"middle"'},{kind:"const",type:"string",value:"top right",text:'"top right"'},{kind:"const",type:"string",value:"top left",text:'"top left"'},{kind:"const",type:"string",value:"bottom right",text:'"bottom right"'},{kind:"const",type:"string",value:"bottom left",text:'"bottom left"'}],text:'"middle" | "top right" | "top left" | "bottom right" | "bottom left"'},static:!1,readonly:!1,defaultValue:'"top left"'},{name:"controlsBorderOffset",visibility:"public",description:"Offset for the controls from the border",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"10"}],name:"Video.svelte"};export{ct as V};