1import{j as h,R as p,r as S,L as Se}from"./chunk-EPOLDU6W-BkvdEuFy.js";import{M as E,I as A}from"./types-Dj5YsmaM.js";import{R as Le}from"./index-BJYk6V8a.js";import{c as F}from"./constants-Dqktsbwg.js";import{c as Z}from"./middleware-KymLCibh.js";import{i as se}from"./routes-D7-60PEt.js";import{E as ze}from"./eye-off-6oF2uyET.js";const Ae=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]],Ne=F("image-off",Ae);const Me=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Ce=F("pause",Me);const De=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Ue=F("play",De);function Te({media:t,title:e,trusted:s=!1,viewer:n=""}){const o=(()=>{try{const i=typeof window<"u"?window.location.origin:void 0,l=new URL(t.url,i);return l.hostname==="ipfs.io"&&(l.hostname="ipfs.rscdn.art"),s&&n!==""&&l.searchParams.set("viewer",n),l.toString()}catch{return t.url}})();return h.jsx("iframe",{allow:"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture;",allowFullScreen:!0,sandbox:"allow-scripts allow-same-origin allow-downloads",src:o,onLoad:i=>{i.currentTarget.contentWindow?.focus()},className:"aspect-square size-full",title:e})}function Oe(){return p.createElement("svg",{"aria-hidden":"true","data-rmiz-btn-unzoom-icon":!0,fill:"currentColor",focusable:"false",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M 14.144531 1.148438 L 9 6.292969 L 9 3 L 8 3 L 8 8 L 13 8 L 13 7 L 9.707031 7 L 14.855469 1.851563 Z M 8 8 L 3 8 L 3 9 L 6.292969 9 L 1.148438 14.144531 L 1.851563 14.855469 L 7 9.707031 L 7 13 L 8 13 Z"}))}function ke(){return p.createElement("svg",{"aria-hidden":"true","data-rmiz-btn-zoom-icon":!0,fill:"currentColor",focusable:"false",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M 9 1 L 9 2 L 12.292969 2 L 2 12.292969 L 2 9 L 1 9 L 1 14 L 6 14 L 6 13 L 2.707031 13 L 13 2.707031 L 13 6 L 14 6 L 14 1 Z"}))}const R=(t,e)=>t===e?.tagName?.toUpperCase?.(),P=t=>R("DIV",t)||R("SPAN",t),j=t=>R("IMG",t),W=t=>t.complete&&t.naturalHeight!==0,k=t=>R("SVG",t),ne=({height:t,offset:e,width:s})=>Math.min((window.innerWidth-e*2)/s,(window.innerHeight-e*2)/t),Re=({containerHeight:t,containerWidth:e,offset:s,targetHeight:n,targetWidth:o})=>{const i=ne({height:n,offset:s,width:o}),l=o>n?o/e:n/t;return i>1?l:i*l},C=({containerHeight:t,containerWidth:e,hasScalableSrc:s,offset:n,targetHeight:o,targetWidth:i})=>!t||!e?1:!s&&o&&i?Re({containerHeight:t,containerWidth:e,offset:n,targetHeight:o,targetWidth:i}):ne({height:t,offset:n,width:e}),je=/url(?:\(['"]?)(.*?)(?:['"]?\))/,H=t=>{if(t){if(j(t))return t.currentSrc;if(P(t)){const e=window.getComputedStyle(t).backgroundImage;if(e)return je.exec(e)?.[1]}}},$e=t=>{if(t)return j(t)?t.alt??void 0:t.getAttribute("aria-label")??void 0},_e=({containerHeight:t,containerLeft:e,containerTop:s,containerWidth:n,hasScalableSrc:o,offset:i,targetHeight:l,targetWidth:c})=>{const a=C({containerHeight:t,containerWidth:n,hasScalableSrc:o,offset:i,targetHeight:l,targetWidth:c});return{top:s,left:e,width:n*a,height:t*a,transform:`translate(0,0) scale(${1/a})`}},I=({position:t,relativeNum:e})=>{const s=parseFloat(t);return t.endsWith("%")?e*s/100:s},Ze=({containerHeight:t,containerLeft:e,containerTop:s,containerWidth:n,hasScalableSrc:o,objectFit:i,objectPosition:l,offset:c,targetHeight:a,targetWidth:r})=>{if(i==="scale-down"&&(r<=n&&a<=t?i="none":i="contain"),i==="cover"||i==="contain"){const u=n/r,m=t/a,d=i==="cover"?Math.max(u,m):Math.min(u,m),[v="50%",g="50%"]=l.split(" "),y=I({position:v,relativeNum:n-r*d}),f=I({position:g,relativeNum:t-a*d}),w=C({containerHeight:a*d,containerWidth:r*d,hasScalableSrc:o,offset:c,targetHeight:a,targetWidth:r});return{top:s+f,left:e+y,width:r*d*w,height:a*d*w,transform:`translate(0,0) scale(${1/w})`}}else if(i==="none"){const[u="50%",m="50%"]=l.split(" "),d=I({position:u,relativeNum:n-r}),v=I({position:m,relativeNum:t-a}),g=C({containerHeight:a,containerWidth:r,hasScalableSrc:o,offset:c,targetHeight:a,targetWidth:r});return{top:s+v,left:e+d,width:r*g,height:a*g,transform:`translate(0,0) scale(${1/g})`}}else if(i==="fill"){const u=n/r,m=t/a,d=Math.max(u,m),v=C({containerHeight:a*d,containerWidth:r*d,hasScalableSrc:o,offset:c,targetHeight:a,targetWidth:r});return{width:n*v,height:t*v,transform:`translate(0,0) scale(${1/v})`}}else return{}},Ge=({backgroundPosition:t,backgroundSize:e,containerHeight:s,containerLeft:n,containerTop:o,containerWidth:i,hasScalableSrc:l,offset:c,targetHeight:a,targetWidth:r})=>{if(e==="cover"||e==="contain"){const u=i/r,m=s/a,d=e==="cover"?Math.max(u,m):Math.min(u,m),[v="50%",g="50%"]=t.split(" "),y=I({position:v,relativeNum:i-r*d}),f=I({position:g,relativeNum:s-a*d}),w=C({containerHeight:a*d,containerWidth:r*d,hasScalableSrc:l,offset:c,targetHeight:a,targetWidth:r});return{top:o+f,left:n+y,width:r*d*w,height:a*d*w,transform:`translate(0,0) scale(${1/w})`}}else if(e==="auto"){const[u="50%",m="50%"]=t.split(" "),d=I({position:u,relativeNum:i-r}),v=I({position:m,relativeNum:s-a}),g=C({containerHeight:a,containerWidth:r,hasScalableSrc:l,offset:c,targetHeight:a,targetWidth:r});return{top:o+v,left:n+d,width:r*g,height:a*g,transform:`translate(0,0) scale(${1/g})`}}else{const[u="50%",m="50%"]=e.split(" "),d=I({position:u,relativeNum:i}),v=I({position:m,relativeNum:s}),g=d/r,y=v/a,f=Math.min(g,y),[w="50%",z="50%"]=t.split(" "),x=I({position:w,relativeNum:i-r*f}),b=I({position:z,relativeNum:s-a*f}),L=C({containerHeight:a*f,containerWidth:r*f,hasScalableSrc:l,offset:c,targetHeight:a,targetWidth:r});return{top:o+b,left:n+x,width:r*f*L,height:a*f*L,transform:`translate(0,0) scale(${1/L})`}}},Fe=/\.svg$/i,Pe=({hasZoomImg:t,imgSrc:e,isSvg:s,isZoomed:n,loadedImgEl:o,offset:i,shouldRefresh:l,targetEl:c})=>{const a=s||e?.slice?.(0,18)==="data:image/svg+xml"||t||!!(e&&Fe.test(e)),r=c.getBoundingClientRect(),u=window.getComputedStyle(c),m=o!=null&&P(c),d=o!=null&&!m,v=_e({containerHeight:r.height,containerLeft:r.left,containerTop:r.top,containerWidth:r.width,hasScalableSrc:a,offset:i,targetHeight:o?.naturalHeight||r.height,targetWidth:o?.naturalWi
1dth||r.width}),g=d?Ze({containerHeight:r.height,containerLeft:r.left,containerTop:r.top,containerWidth:r.width,hasScalableSrc:a,objectFit:u.objectFit,objectPosition:u.objectPosition,offset:i,targetHeight:o?.naturalHeight||r.height,targetWidth:o?.naturalWidth||r.width}):void 0,y=m?Ge({backgroundPosition:u.backgroundPosition,backgroundSize:u.backgroundSize,containerHeight:r.height,containerLeft:r.left,containerTop:r.top,containerWidth:r.width,hasScalableSrc:a,offset:i,targetHeight:o?.naturalHeight||r.height,targetWidth:o?.naturalWidth||r.width}):void 0,f=Object.assign({},v,g,y);if(n){const w=window.innerWidth/2,z=window.innerHeight/2,x=parseFloat(String(f.left||0))+parseFloat(String(f.width||0))/2,b=parseFloat(String(f.top||0))+parseFloat(String(f.height||0))/2,L=w-x,T=z-b;l&&(f.transitionDuration="0.01ms"),f.transform=`translate(${L}px,${T}px) scale(1)`}return f},_=t=>{if(!t)return{};if(k(t)){const e=t.parentElement,s=t.getBoundingClientRect();if(e){const n=e.getBoundingClientRect();return{height:s.height,left:n.left-s.left,top:n.top-s.top,width:s.width}}else return{height:s.height,left:s.left,width:s.width,top:s.top}}else return{height:t.offsetHeight,left:t.offsetLeft,width:t.offsetWidth,top:t.offsetTop}},Ye=t=>{const e="-zoom",s=["clip-path","fill","mask","marker-start","marker-mid","marker-end"],n=new Map;if(t.hasAttribute("id")){const o=t.id,i=o+e;n.set(o,i),t.id=i}t.querySelectorAll("[id]").forEach(o=>{const i=o.id,l=i+e;n.set(i,l),o.id=l}),n.forEach((o,i)=>{const l=`url(#${i})`,c=`url(#${o})`,a=s.map(r=>`[${r}="${l}"]`).join(", ");t.querySelectorAll(a).forEach(r=>{s.forEach(u=>{r.getAttribute(u)===l&&r.setAttribute(u,c)})})}),t.querySelectorAll("style").forEach(o=>{n.forEach((i,l)=>{o.textContent&&(o.textContent=o.textContent.replaceAll(`#${l}`,`#${i}`))})})},Be=["img","svg",'[role="img"]',"[data-zoom]"].map(t=>`${t}:not([aria-hidden="true"])`).join(","),ee={overflow:"",width:""};function Ve(t){return p.createElement(oe,{...t})}class oe extends p.Component{constructor(){super(...arguments),this.state={id:"",isZoomImgLoaded:!1,loadedImgEl:void 0,modalState:"UNLOADED",shouldRefresh:!1,styleGhost:{}},this.refContent=p.createRef(),this.refDialog=p.createRef(),this.refModalContent=p.createRef(),this.refModalImg=p.createRef(),this.refWrap=p.createRef(),this.imgEl=null,this.isScaling=!1,this.prevBodyAttrs=ee,this.styleModalImg={},this.handleModalStateChange=e=>{const{modalState:s}=this.state;e!=="LOADING"&&s==="LOADING"?(this.loadZoomImg(),window.addEventListener("resize",this.handleResize,{passive:!0}),window.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),window.addEventListener("touchmove",this.handleTouchMove,{passive:!0}),window.addEventListener("touchend",this.handleTouchEnd,{passive:!0}),window.addEventListener("touchcancel",this.handleTouchCancel,{passive:!0}),document.addEventListener("keydown",this.handleKeyDown,!0)):e!=="LOADED"&&s==="LOADED"?window.addEventListener("wheel",this.handleWheel,{passive:!0}):e!=="UNLOADING"&&s==="UNLOADING"?(this.ensureImgTransitionEnd(),window.removeEventListener("wheel",this.handleWheel),window.removeEventListener("touchstart",this.handleTouchStart),window.removeEventListener("touchmove",this.handleTouchMove),window.removeEventListener("touchend",this.handleTouchEnd),window.removeEventListener("touchcancel",this.handleTouchCancel),document.removeEventListener("keydown",this.handleKeyDown,!0)):e!=="UNLOADED"&&s==="UNLOADED"&&(this.bodyScrollEnable(),window.removeEventListener("resize",this.handleResize),this.refModalImg.current?.removeEventListener?.("transitionend",this.handleImgTransitionEnd),this.refDialog.current?.close?.())},this.getDialogContainer=()=>{let e=document.querySelector("[data-rmiz-portal]");return e==null&&(e=document.createElement("div"),e.setAttribute("data-rmiz-portal",""),document.body.appendChild(e)),e},this.setId=()=>{const e=()=>Math.random().toString(16).slice(-4);this.setState({id:e()+e()+e()})},this.setAndTrackImg=()=>{const e=this.refContent.current;e&&(this.imgEl=e.querySelector(Be),this.imgEl?(this.contentNotFoundChangeObserver?.disconnect?.(),this.img
1El.addEventListener("load",this.handleImgLoad),this.imgEl.addEventListener("click",this.handleZoom),this.state.loadedImgEl||this.handleImgLoad(),this.imgElResizeObserver=new ResizeObserver(s=>{const n=s[0];n?.target&&(this.imgEl=n.target,this.setState({styleGhost:_(this.imgEl)}))}),this.imgElResizeObserver.observe(this.imgEl),this.contentChangeObserver||(this.contentChangeObserver=new MutationObserver(()=>{this.setState({styleGhost:_(this.imgEl)})}),this.contentChangeObserver.observe(e,{attributes:!0,childList:!0,subtree:!0}))):this.contentNotFoundChangeObserver||(this.contentNotFoundChangeObserver=new MutationObserver(this.setAndTrackImg),this.contentNotFoundChangeObserver.observe(e,{childList:!0,subtree:!0})))},this.handleIfZoomChanged=e=>{const{isZoomed:s}=this.props;!e&&s?this.zoom():e&&!s&&this.unzoom()},this.handleImgLoad=()=>{const e=H(this.imgEl);if(!e)return;const s=new Image;j(this.imgEl)&&(s.sizes=this.imgEl.sizes,s.srcset=this.imgEl.srcset,s.crossOrigin=this.imgEl.crossOrigin),s.src=e;const n=()=>{this.setState({loadedImgEl:s,styleGhost:_(this.imgEl)})};s.decode().then(n).catch(()=>{if(W(s)){n();return}s.onload=n})},this.handleZoom=()=>{this.hasImage()&&this.props.onZoomChange?.(!0)},this.handleUnzoom=()=>{this.props.onZoomChange?.(!1)},this.handleBtnUnzoomClick=e=>{e.preventDefault(),e.stopPropagation(),this.handleUnzoom()},this.handleDialogCancel=e=>{e.preventDefault()},this.handleDialogClick=e=>{(e.target===this.refModalContent.current||e.target===this.refModalImg.current)&&(e.stopPropagation(),this.handleUnzoom())},this.handleDialogClose=e=>{e.stopPropagation(),this.handleUnzoom()},this.handleKeyDown=e=>{(e.key==="Escape"||e.keyCode===27)&&(e.preventDefault(),e.stopPropagation(),this.handleUnzoom())},this.handleWheel=e=>{e.ctrlKey||(e.stopPropagation(),queueMicrotask(()=>{this.handleUnzoom()}))},this.handleTouchStart=e=>{if(e.touches.length>1){this.isScaling=!0;return}e.changedTouches.length===1&&e.changedTouches[0]&&(this.touchYStart=e.changedTouches[0].screenY)},this.handleTouchMove=e=>{const s=window.visualViewport?.scale??1;if(this.props.canSwipeToUnzoom&&!this.isScaling&&s<=1&&this.touchYStart!=null&&e.changedTouches[0]){this.touchYEnd=e.changedTouches[0].screenY;const n=Math.max(this.touchYStart,this.touchYEnd),o=Math.min(this.touchYStart,this.touchYEnd);Math.abs(n-o)>this.props.swipeToUnzoomThreshold&&(this.touchYStart=void 0,this.touchYEnd=void 0,this.handleUnzoom())}},this.handleTouchEnd=()=>{this.isScaling=!1,this.touchYStart=void 0,this.touchYEnd=void 0},this.handleTouchCancel=()=>{this.isScaling=!1,this.touchYStart=void 0,this.touchYEnd=void 0},this.handleResize=()=>{this.setState({shouldRefresh:!0})},this.hasImage=()=>this.imgEl&&(this.state.loadedImgEl||k(this.imgEl))&&window.getComputedStyle(this.imgEl).display!=="none",this.zoom=()=>{this.bodyScrollDisable(),this.refDialog.current?.showModal?.(),this.refModalImg.current?.addEventListener?.("transitionend",this.handleImgTransitionEnd),this.setState({modalState:"LOADING"})},this.unzoom=()=>{this.setState({modalState:"UNLOADING"})},this.handleImgTransitionEnd=()=>{clearTimeout(this.timeoutTransitionEnd),this.state.modalState==="LOADING"?this.setState({modalState:"LOADED"}):this.state.modalState==="UNLOADING"&&this.setState({shouldRefresh:!1,modalState:"UNLOADED"})},this.ensureImgTransitionEnd=()=>
1{if(this.refModalImg.current){const e=window.getComputedStyle(this.refModalImg.current).transitionDuration,s=parseFloat(e);if(s){const n=s*(e.endsWith("ms")?1:1e3)+50;this.timeoutTransitionEnd=setTimeout(this.handleImgTransitionEnd,n)}}},this.bodyScrollDisable=()=>{this.prevBodyAttrs={overflow:document.body.style.overflow,width:document.body.style.width};const e=document.body.clientWidth;document.body.style.overflow="hidden",document.body.style.width=`${e}px`},this.bodyScrollEnable=()=>{document.body.style.width=this.prevBodyAttrs.width,document.body.style.overflow=this.prevBodyAttrs.overflow,this.prevBodyAttrs=ee},this.loadZoomImg=()=>{const{props:{zoomImg:e}}=this,s=e?.src;if(s){const n=new Image;n.sizes=e?.sizes??"",n.srcset=e?.srcSet??"",n.crossOrigin=e?.crossOrigin??void 0,n.src=s;const o=()=>{this.setState({isZoomImgLoaded:!0})};n.decode().then(o).catch(()=>{if(W(n)){o();return}n.onload=o})}},this.UNSAFE_handleSvg=()=>{const{imgEl:e,refModalImg:s,styleModalImg:n}=this;if(k(e)){const o=e.cloneNode(!0);Ye(o),o.style.width=`${n.width||0}px`,o.style.height=`${n.height||0}px`,o.addEventListener("click",this.handleUnzoom),s.current?.firstChild?.remove?.(),s.current?.appendChild?.(o)}}}render(){const{handleBtnUnzoomClick:e,handleDialogCancel:s,handleDialogClick:n,handleDialogClose:o,handleUnzoom:i,handleZoom:l,imgEl:c,props:{a11yNameButtonUnzoom:a,a11yNameButtonZoom:r,children:u,classDialog:m,IconUnzoom:d,IconZoom:v,isZoomed:g,wrapElement:y,ZoomContent:f,zoomImg:w,zoomMargin:z},refContent:x,refDialog:b,refModalContent:L,refModalImg:T,refWrap:ce,state:{id:Y,isZoomImgLoaded:de,loadedImgEl:he,modalState:N,shouldRefresh:ue,styleGhost:me}}=this,B=`rmiz-modal-${Y}`,V=`rmiz-modal-img-${Y}`,fe=P(c),O=j(c),X=k(c),$=$e(c),q=H(c),pe=O?c.sizes:void 0,ge=O?c.srcset:void 0,ve=O?c.crossOrigin:void 0,we=!!w?.src,U=this.hasImage(),ye=$?`${r}: ${$}`:r,Ee=N==="LOADING"||N==="LOADED",xe=U?"found":"not-found",Ie=N==="UNLOADED"||N==="UNLOADING"?"hidden":"visible",be={visibility:N==="UNLOADED"?"visible":"hidden"};this.styleModalImg=U?Pe({hasZoomImg:we,imgSrc:q,isSvg:X,isZoomed:g&&Ee,loadedImgEl:he,offset:z,shouldRefresh:ue,targetEl:c}):{};let K=null;if(U){const Q=O||fe?p.createElement("img",{alt:$,crossOrigin:ve,sizes:pe,src:q,srcSet:ge,...de&&N==="LOADED"?w:{},"data-rmiz-modal-img":"",height:this.styleModalImg.height||void 0,id:V,ref:T,style:this.styleModalImg,width:this.styleModalImg.width||void 0}):X?p.createElement("div",{"data-rmiz-modal-img":!0,ref:T,style:this.styleModalImg}):null,J=p.createElement("button",{"aria-label":a,"data-rmiz-btn-unzoom":"",onClick:e,type:"button"},p.createElement(d,null));K=f?p.createElement(f,{buttonUnzoom:J,modalState:N,img:Q,onUnzoom:i}):p.createElement(p.Fragment,null,Q,J)}return p.createElement(y,{"aria-owns":B,"data-rmiz":"",ref:ce},p.createElement(y,{"data-rmiz-content":xe,ref:x,style:be},u),U&&p.createElement(y,{"data-rmiz-ghost":"",style:me},p.createElement("button",{"aria-label":ye,"data-rmiz-btn-zoom":"",onClick:l,type:"button"},p.createElement(v,null))),U&&Le.createPortal(p.createElement("dialog",{"aria-labelledby":V,"aria-modal":"true",className:m,"data-rmiz-modal":"",id:B,onClick:n,onClose:o,onCancel:s,ref:b,role:"dialog"},p.createElement("div",{"data-rmiz-modal-overlay":Ie}),p.createElement("div",{"data-rmiz-modal-content":"",ref:L},K)),this.getDialogContainer()))}componentDidMount(){this.setId(),this.setAndTrackImg(),this.handleImgLoad(),this.UNSAFE_handleSvg()}componentWillUnmount(){this.state.modalState!=="UNLOADED"&&this.bodyScrollEnable(),this.contentChangeObserver?.disconnect?.(),this.contentNotFoundChangeObserver?.disconnect?.(),this.imgElResizeObserver?.disconnect?.(),this.imgEl?.removeEventListener?.("load",this.handleImgLoad),this.imgEl?.removeEventListener?.("click",this.handleZoom),this.refModalImg.current?.removeEventListener?.("transitionend",this.handleImgTransitionEnd),window.removeEventListener("wheel",this.handleWheel),window.removeEventListener("touchstart",this.handleTouchStart),window.removeEventListener("touchmove",this.handleTouchMove),window.removeEventListener("touchend",this.handleTouchEnd),window.removeEventListener("touchcancel",this.handleTouchCancel),window.removeEventListener("resize",this.handleResize),document.removeEventListener("keydown",this.handleKeyDown,!0)}componentDidUpdate(e,s){this.handleModalStateChange(s.modalState),this.UNSAFE_handleSvg(),this.handleIfZoomChanged(e.isZoomed)}}oe.defaultProps={a11yNameButtonUnzoom:"Minimize image",a11yNameButtonZoom:"Expand image",canSwipeToUnzoom:!0,IconUnzoom:Oe,IconZoom:ke,swipeToUnzoomThreshold:10,wrapElement:"div",zoomMargin:0};function Xe(t){const[e,s]=p.useState(!1);return p.createElement(Ve,{...t,isZoomed:e,onZoomChange:s})}function M({src:t,alt:e,fallbackSrc:s,onError:n,enableZoom:o=!1}){const[i,l]=S.useState(!1),[c,a]=S.useState(!1),[r,u]=S.useState(t);if(t!==r&&(u(t),l(!1),a(!1)),i)return h.jsx(ie,{});const m=h.jsx("img",{loading:"lazy",src:c&&s?s:t,alt:e??"",onError:()=>{if(!c&&s){a(!0);return}l(!0),n?.()},className:"size-full max-h-full max-w-full object-contain"});return o?h.jsx(Xe,{classDialog:"backdrop-blur-sm",children:m}):m}function ie(){return h.jsxs("div",{className:"flex size-full flex-col items-center justify-center gap-1.5",children:[h.jsx(Ne,{size:24,className:"text-foreground opacity-75"}),h.jsx("span",{className:"text-muted-foreground text-xs",children:"Image not available"})]})}function qe({playing:t,onPlay:e,onPause:s,className:n="absolute bottom-2 right-2 z-20"}){return h.jsx("button",{onClick:o=>{o.preventDefault(),o.stopPropagation(),t?s?.():e?.()},className:Z(n,"p-4"),children:h.jsx("div",{className:"grid size-10 place-items-center rounded-none bg-black/25 text-white backdrop-blur-lg hover:bg-black/50",children:t?h.jsx(Ce,{className:"h-4"}):h.jsx(Ue,{className:"h-4"})})})}function Ke({src:t,extension:e,onError:s,showControls:n=!1,onLoad:o,poster:i,showAsThumbnail:l=!1,height:c,width:a}){const r=!l,[u,m]=S.useState(!1),[d,v]=S.useState(r),g=S.useRef(null);function y(){g.current?.pause(),m(!1)}const f=S.useCallback(()=>
1{if(!d)v(!0);else{const x=g.current;if(d&&x){const b=x.play();b!==void 0&&b.then(L=>{m(!0)}).catch(L=>{m(!1)})}}},[d]);S.useEffect(()=>{(d||r)&&f()},[f,d,r]);const w={m4v:"video/x-m4v",mp4:"video/mp4"},z=()=>{s?.()};return S.useEffect(()=>{if(g?.current){const x=g.current.poster;if(x){const b=new Image;b.onload=()=>{o?.()},b.src=x}}},[o]),h.jsxs("div",{className:"size-full",children:[l&&n&&h.jsx(qe,{playing:u,onPlay:f,onPause:y,className:"absolute right-1 bottom-1 z-20 group-[.is-gallery-tile]/card:bottom-10"}),d?h.jsxs("video",{height:c,width:a,poster:i||void 0,autoPlay:!0,playsInline:!0,loop:!0,controls:!l&&n,ref:g,preload:r?"auto":"metadata",muted:r,onPlaying:()=>{o?.()},onAbortCapture:z,onErrorCapture:z,crossOrigin:"anonymous",className:"size-full max-h-full max-w-full object-contain",children:[h.jsx("source",{type:w[e],src:t}),"Your browser does not support this video player."]},"video"):i?h.jsx(M,{src:i,alt:""}):null]})}const Qe={1:["#f2c260","#8a5a14"],2:["#b07cff","#4b1e9e"],3:["#6f7bf7","#23264d"],4:["#59617e","#16182e"]},Je={1:'<polygon points="12,2 15,9 22,9 16.5,14 18.5,21 12,17 5.5,21 7.5,14 2,9 9,9"/>',2:'<polygon points="12,2 22,12 12,22 2,12"/>',3:'<polygon points="12,2 21,7 21,17 12,22 3,17 3,7"/>',4:'<circle cx="12" cy="12" r="9" fill="none" stroke="#fff" stroke-width="1.5"/><circle cx="12" cy="12" r="3"/>'};function We(t){return t.length<=3?1:t.length===4?2:t.length<=6?3:4}const D=1200,G=255,te=50,He=9,et=8,tt=.56,st={a:.56,b:.61,c:.56,d:.61,e:.56,f:.33,g:.61,h:.61,i:.28,j:.28,k:.56,l:.28,m:.89,n:.61,o:.61,p:.61,q:.61,r:.39,s:.56,t:.33,u:.61,v:.56,w:.78,x:.56,y:.56,z:.5,"-":.33};function ae(t){let e=0;for(const s of t)e+=st[s]??tt;return e}function nt(t){if(t.length<=He)return te;const e=G/ae(t);return Math.round(Math.min(te,Math.max(et,e)))}function ot(t){let e=2166136261;for(let s=0;s<t.length;s++)e=Math.imul(e^t.charCodeAt(s),16777619)>>>0;return e}function it(t){let e=ot(t);const s=()=>(e=Math.imul(e,1664525)+1013904223>>>0,e/4294967296);let n="";for(let o=0;o<26;o++){const i=(6+s()*288).toFixed(1),l=(6+s()*288).toFixed(1),c=(.6+s()*1.3).toFixed(1),a=(.25+s()*.6).toFixed(2);n+=`<circle cx="${i}" cy="${l}" r="${c}" fill="#fff" opacity="${a}"/>`}return n}function at(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function rt(t){const e=We(t),[s,n]=Qe[e],o=nt(t),i=ae(t)*o>G?` textLength="${G}" lengthAdjust="spacingAndGlyphs"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300" width="${D}" height="${D}"><defs><linearGradient id="bg" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="${s}"/><stop offset="100%" stop-color="${n}"/></linearGradient><linearGradient id="ov" x1="0" y1="1" x2="1" y2="0"><stop offset="0%" stop-color="#ffffff" stop-opacity="0.16"/><stop offset="55%" stop-color="#ffffff" stop-opacity="0"/></linearGradient></defs><rect width="300" height="300" fill="url(#bg)"/><rect width="300" height="300" fill="url(#ov)"/>`+it(t)+`<g transform="translate(22 22) scale(1.5)" fill="#fff" opacity="0.92">${Je[e]}</g><text x="50%" y="50%" text-anchor="middle" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="700" font-size="${o}" fill="#fff"${i}>${at(t)}</text></svg>`}function lt(t){return`data:image/svg+xml,${encodeURIComponent(rt(t))}`}function re(t){const e=lt(t),s={type:E.image,height:D,width:D,url:e,staticUrl:e};return{type:E.image,url:e,height:D,width:D,fallbackUrl:e,visualAssets:{xs:s,sm:s,md:s,lg:s,xl:s}}}function Et(t,e,s){return se(t)?re(e):s??null}function xt(t){return t?.visualAssets?.[A.xl]?.staticUrl??t?.visualAssets?.[A.lg]?.staticUrl??t?.fallbackUrl}function le(t){if(t.type===E.html)return!0;if(t.type!==E.unknown)return!1;try{return new URL(t.url).pathname.endsWith("/")}catch{return t.url.endsWith("/")}}function ct(t){if(!t)return null;try{const e=new URL(t);if(e.hostname!=="arweave.net")return null;const s=/^\/([a-zA-Z0-9_-]{43})\/.+$/.exec(e.pathname);return s?`https://arweave.net/${s[1]}`:null}catch{return null}}function It({token:t,isOwner:e,context:s}){const{collection:n,animationMedia:o,media:i}=t,l=n.trusted??!1,c=!n.onlyOwner||e;if(se(n.contractAddress))return{media:re(t.tokenId),trusted:l};if(s==="card"&&!n.preferAnimation){const a=c&&o?.type===E.video?o:void 0;return{media:i,trusted:l,playableVideo:a}}return o?c?le(o)&&!l?{media:i,trusted:l}:s==="detail"&&o.type===E.image?{media:i,trusted:l}:{media:o,trusted:l}:{media:i,trusted:l}:{media:i,trusted:l}}const dt={[A.xs]:"xs",[A.sm]:"sm",[A.md]:"md",[A.lg]:"lg",[A.xl]:"xl"};function ht(t){const{media:e,title:s,size:n,playableVideo:o,showAsThumbnail:i={dynamic:!1}
1,showControls:l=!1}=t,c=n?dt[n]:"md",a=e?.visualAssets?.[c]??e?.visualAssets?.lg??e?.visualAssets?.md??e?.visualAssets?.sm??e?.visualAssets?.xs??e?.visualAssets?.xl;if((a?.type??null)===E.vector_graphic&&a?.url&&typeof i=="object"&&i.dynamic)return h.jsx(M,{src:a?.url,alt:s??""});if(e?.type&&new Set([E.image,E.html,E.pdf,E.animated_image,E.video]).has(e.type)&&typeof i=="object"&&!i.dynamic&&a?.staticUrl)return h.jsx(M,{src:a?.staticUrl,alt:s??""});if(e&&le(e)&&!i){if(t.trusted)return h.jsx(Te,{media:e,title:s,trusted:t.trusted,viewer:t.viewer});if(a?.staticUrl)return h.jsx(M,{src:a.staticUrl,alt:s??""});if(e.fallbackUrl)return h.jsx(M,{src:e.fallbackUrl,alt:s??""})}if(e?.type===E.animated_image&&a?.url)return h.jsxs("video",{height:e?.height??500,width:e?.width??500,autoPlay:!0,loop:!0,playsInline:!0,muted:!0,poster:a?.staticUrl||void 0,className:"size-full max-h-full max-w-full object-contain",children:[h.jsx("source",{src:a?.url,type:"video/mp4"}),"Your browser does not support the video tag."]});const u=e?.type===E.video&&e.url?e.url:o&&i&&a?.staticUrl?o.url:void 0;return u?h.jsx(Ke,{src:u,extension:"mp4",showControls:l,poster:a?.staticUrl,height:e?.height??1e3,width:e?.width??1e3,showAsThumbnail:!!i}):e?.visualAssets&&a?.url?h.jsx(M,{src:a.url,alt:s??"",enableZoom:n===A.xl}):e?.fallbackUrl&&e?.fallbackUrl!==""?h.jsx(M,{src:e.fallbackUrl,alt:s??"",fallbackSrc:ct(e.url)}):h.jsx(ie,{})}function ut({height:t,width:e,link:s,backgroundImage:n,children:o,showExplicitOverlay:i=!1,showBackground:l=!0,conformSize:c=!1,rounded:a=!1,scaleOnHover:r=!0,className:u}){const[m,d]=S.useState(i),v=c||!t||!e,g=S.useCallback(f=>{f.stopPropagation(),f.preventDefault(),d(!1)},[]),y=h.jsx("div",{className:Z("absolute inset-0 flex cursor-pointer items-center justify-center backdrop-blur-3xl",a?"rounded-none":null),onClick:g,children:h.jsx(ze,{className:"size-[12%]"})});return h.jsxs("div",{className:Z("relative max-h-full transform-gpu overflow-hidden leading-0 transition-transform group-active/card:scale-100 group-active/largecard:scale-100",v?"md:aspect-1":"",r?"group-hover/card:scale-[1.04] group-hover/largecard:scale-[1.03]":"",l?"bg-black":"",a?"rounded-none":"","flex items-center justify-center w-full",u),style:{aspectRatio:v?1:e&&t?`${e/t}`:void 0},children:[!m&&s&&h.jsx(Se,{to:s,viewTransition:!0,className:"absolute z-10 size-full"}),m&&y,h.jsx("div",{className:"flex size-full items-center justify-center",children:o}),n&&l&&h.jsx("div",{className:"absolute inset-0 z-[-1] size-full bg-cover bg-center blur-xl",style:{backgroundImage:`url("${n}")`}})]})}function bt(t){const e=t.media?.visualAssets?.xs?.staticUrl??t.media?.visualAssets?.sm?.staticUrl??t.media?.visualAssets?.md?.staticUrl;return h.jsx(ut,{rounded:t.rounded,height:t.media?.height,width:t.media?.width,link:t.link,showExplicitOverlay:t.showExplicitOverlay,conformSize:t.conformSize,showBackground:t.showBackground,backgroundImage:e,scaleOnHover:t.scaleOnHover,className:t.className,children:h.jsx(ht,{...t})})}export{bt as M,re as a,lt as b,ut as c,xt as g,Et as n,It as r};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.