15 lines
3.5 KiB
JavaScript
15 lines
3.5 KiB
JavaScript
import{j as L}from"./jsx-runtime.CyXy1Ci3.js";import{r as t}from"./index.CaZlGE7t.js";/* empty css *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var n=function(){return n=Object.assign||function(r){for(var a,c=1,m=arguments.length;c<m;c++){a=arguments[c];for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(r[l]=a[l])}return r},n.apply(this,arguments)};function O(e,r){var a=t.useState(!1),c=a[0],m=a[1],l=t.useState(e.alwaysLoadIframe||!1),o=l[0],g=l[1],s=encodeURIComponent(e.id),h=typeof e.playlistCoverId=="string"?encodeURIComponent(e.playlistCoverId):null,u=e.title,d=e.poster||"hqdefault",b=e.announce||"Watch",f=new URLSearchParams(n(n(n(n({},e.muted?{mute:"1"}:{}),e.alwaysLoadIframe?{}:{autoplay:"1",state:"1"}),e.enableJsApi?{enablejsapi:"1"}:{}),e.playlist?{list:s}:{})),i=e.noCookie?"https://www.youtube-nocookie.com":"https://www.youtube.com";i=e.cookie?"https://www.youtube.com":"https://www.youtube-nocookie.com";var C=e.playlist?"".concat(i,"/embed/videoseries?").concat(f.toString()):"".concat(i,"/embed/").concat(s,"?").concat(f.toString()),v=e.webp?"webp":"jpg",y=e.webp?"vi_webp":"vi",w=e.thumbnail||(e.playlist?"https://i.ytimg.com/".concat(y,"/").concat(h,"/").concat(d,".").concat(v):"https://i.ytimg.com/".concat(y,"/").concat(s,"/").concat(d,".").concat(v)),I=e.activatedClass||"lyt-activated",E=e.adNetwork||!1,k=e.aspectHeight||9,p=e.aspectWidth||16,j=e.iframeClass||"",S=e.playerClass||"lty-playbtn",_=e.wrapperClass||"yt-lite",x=e.onIframeAdded||function(){},P=e.rel?"prefetch":"preload",F=e.containerElement||"article",N=e.style||{},R=function(){c||m(!0)},U=function(){o||g(!0)};return t.useEffect(function(){o&&x()},[o]),t.createElement(t.Fragment,null,t.createElement("link",{rel:P,href:w,as:"image"}),t.createElement(t.Fragment,null,c&&t.createElement(t.Fragment,null,t.createElement("link",{rel:"preconnect",href:i}),t.createElement("link",{rel:"preconnect",href:"https://www.google.com"}),E&&t.createElement(t.Fragment,null,t.createElement("link",{rel:"preconnect",href:"https://static.doubleclick.net"}),t.createElement("link",{rel:"preconnect",href:"https://googleads.g.doubleclick.net"})))),t.createElement(F,{onPointerOver:R,onClick:U,className:"".concat(_," ").concat(o?I:""),"data-title":u,style:n(n({backgroundImage:"url(".concat(w,")")},{"--aspect-ratio":"".concat(k/p*100,"%")}),N)},t.createElement("button",{type:"button",className:S,"aria-label":"".concat(b," ").concat(u)}),o&&t.createElement("iframe",{ref:r,className:j,title:u,width:"560",height:"315",frameBorder:"0",allow:"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,src:C})))}var W=t.forwardRef(O);const Y=({id:e,title:r,...a})=>L.jsx(W,{wrapperClass:"yt-lite rounded-lg",id:e,title:r,...a});export{Y as default};
|