Loading
function(e,t,n){"use strict";n.d(t,{Ay:()=>R,P8:()=>T,bp:()=>I,p4:()=>S});var r=n(627968),i=n(64700),s=n(735438),a=n(731738),o=n(230109),l=n(673698),u=n(945810),c=n(693875),d=n(776231),_=n(831062),f=n(964404),p=n(544180),h=n(954571),m=n(486020),E=n(515718),g=n(652215),A=n(838541);let I=/\.gif($|\?|#)/i,T=/\.webp($|\?|#)/i,S=/\.avif($|\?|#)/i,y=/\.png($|\?|#)/i,v=400,N=300,C=300;class R extends i.Component{static visibilityObserver=new o.j({threshold:.6});static _lazyLoadTargets=new WeakMap;static _lazyLoadIO="u">typeof IntersectionObserver?new IntersectionObserver(e=>{for(let t of e)if(t.isIntersecting){let e=R._lazyLoadTargets.get(t.target);null!=e&&(R._lazyLoadIO?.unobserve(t.target),R._lazyLoadTargets.delete(t.target),e._triggerLazyLoad())}},{threshold:0,rootMargin:`${C}px`}):null;static defaultProps={shouldLink:!1,autoPlay:!1,animated:!1,minWidth:0,minHeight:0,shouldRenderAccessory:!0,srcIsAnimated:!1};static isAnimated(e){let{src:t,original:n,animated:r,srcIsAnimated:i}=e;return r||I.test(null!=n&&""!==n?n:t)||null!=i&&i&&(T.test(null!=n&&""!==n?n:t)||S.test(null!=n&&""!==n?n:t))}static isSrcPNG(e){let{src:t}=e;return y.test(t)}static isSrcAVIF(e){let{src:t}=e;return S.test(t)}static getFormatQuality(e){let{src:t,original:n,animated:r,srcIsAnimated:i,freeze:s=!1}=e,a=null,o=null;return m.QB&&(s||!R.isAnimated({src:t,original:n,animated:r,srcIsAnimated:i}))?(a="webp",(R.isSrcPNG({src:t})||R.isSrcAVIF({src:t}))&&(o="lossless")):s&&(a="png"),{format:a,quality:o}}static preloadImage(e){let{src:t,dimensions:{maxWidth:n,maxHeight:r,imageWidth:i,imageHeight:s},options:{srcIsAnimated:a,original:o,animated:l,sourceMetadata:u,freeze:c},callback:_}=e;if(1===i&&1===s)return;let{format:f,quality:p}=R.getFormatQuality({src:t,original:o,animated:l,srcIsAnimated:a,freeze:c}),h=(0,d.AE)({src:t,width:i,height:s,maxWidth:n,maxHeight:r,srcIsAnimated:a,format:f,quality:p}),m=Date.now();return(0,d.yt)(h,(e,n)=>{R.trackLoadingCompleted({error:e,imageData:n,trigger:"PRELOAD",startLoadingTime:m,readyState:g.Rv1.READY,format:f,quality:p,imageProps:{src:t,width:i,height:s,sourceMetadata:u,original:o}}),_?.(e,n)})}static async trackLoadingCompleted(e){let{error:t,imageData:n,trigger:r,startLoadingTime:i,readyState:s,format:o,quality:l,imageProps:{src:u,height:c,width:d,original:m,sourceMetadata:E}}=e;if(t&&_.A.increment({name:a.K.IMAGE_LOAD_ERROR}),!O.getConfig({location:"lazy_image"}).enabled)return;let A=await fetch(n.url).catch(()=>void 0),I=A?.headers?.get("content-length"),T=null!=I?Number(I):null,S=Date.now()-i;h.default.track(g.HAw.IMAGE_LOADING_COMPLETED,{duration_ms:S,requested_height:n.height,requested_width:n.width,height:c,width:d,original_url:m,url:u,requested_url:n.url,format:o,quality:l,state:t?g.Rv1.ERROR:s,data_saving_mode:f.Ay.dataSavingMode,low_quality_image_mode:f.Ay.dataSavingMode,trigger:r,size:T,message_id:E?.message?.id,message_sent_timestamp:E?.message?.timestamp.getTime(),connection_type:p.A.getType(),effective_connection_speed:p.A.getEffectiveConnectionSpeed(),service_provider:p.A.getServiceProvider()})}state={readyState:g.Rv1.LOADING,hasMouseOver:!1,hasFocus:!1};startLoadingTime=Date.now();_cancellers=new Set;_unmounted=!1;_imageRef=i.createRef();constructor(e){super(e),(0,d.LE)(this.getSrc(this.getRatio(),R.isAnimated(this.props)))&&(this.state.readyState=g.Rv1.READY)}componentDidMount(){let{readyState:e}=this.state;if(e===g.Rv1.LOADING)if(b.getConfig({location:"LazyImage_componentDidMount"}).enabled){let e=this._imageRef.current;null!=e&&null!=R._lazyLoadIO?(R._lazyLoadTargets.set(e,this),R._lazyLoadIO.observe(e)):this.loadImage(this.getSrc(this.getRatio(),R.isAnimated(this.props)),this.handleImageLoad)}else this.loadImage(this.getSrc(this.getRatio(),R.isAnimated(this.props)),this.handleImageLoad);R.isAnimated(this.props)&&this.observeVisibility()}componentDidUpdate(e){let t=R.isAnimated(this.props);R.isAnimated(e)!==t&&(t?this.observeVisibility():this.unobserveVisibility())}componentWillUnmount(){this._unmounted=!0;let e=this._imageRef.current;null!=e&&(R._lazyLoadIO?.unobserve(e),R._lazyLoadTargets.delete(e)),R.isAnimated(this.props)&&this.unobserveVisibility(),this._cancellers.forEach(e=>e()),this._cancellers.clear()}observeVisibility=()=>{R.visibilityObserver.observe(this,this._imageRef)};unobserveVisibility=()=>{R.visibilityObserver.unobserve(this)};getSrc(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{src:n,width:r,height:i,maxWidth:s,maxHeight:a,mediaLayoutType:o}=this.props,{format:l,quality:u}=R.getFormatQuality({...this.props,freeze:t});return(0,d.AE)({src:n,width:r,height:i,ratio:e,maxWidth:o===A.dG.MOSAIC?s:void 0,maxHeight:o===A.dG.MOSAIC?a:void 0,format:l,quality:u,animated:!t,srcIsAnimated:this.props.srcIsAnimated})}getRatio(){let{width:e,height:t,maxWidth:n=v,maxHeight:r=N,mediaLayoutType:i,useFullWidth:s}=this.props;return i===A.dG.MOSAIC&&s?(0,E.V)({width:e,height:t,maxWidth:n,maxHeight:r}):(0,E.U8)({width:e,height:t,maxWidth:n,maxHeight:r})}getType(){let{mediaLayoutType:e,responsive:t}=this.props;return e??(t?A.dG.RESPONSIVE:A.dG.STATIC)}_triggerLazyLoad(){this._unmounted||this.state.readyState!==g.Rv1.LOADING||this.loadImage(this.getSrc(this.getRatio(),R.isAnimated(this.props)),this.handleImageLoad)}loadImage(e,t){let{width:n,height:r}=this.props;if(this.startLoadingTime=Date.now(),1===n&&1===r)return;let i=(0,d.yt)(e,(e,n)=>{null!=i&&this._cancellers.delete(i),t?.(e,n)});null!=i&&this._cancellers.add(i)}handleImageLoad=(e,t)=>{this._unmounted||this.setState({readyState:e?g.Rv1.ERROR:g.Rv1.READY},()=>{let{format:n,quality:r}=R.getFormatQuality(this.props);R.trackLoadingCompleted({error:e,imageData:t,trigger:this.props.trigger??"LOAD",startLoadingTime:this.startLoadingTime,readyState:this.state.readyState,format:n,quality:r,imageProps:this.props})})};onMouseEnter=e=>{R.isAnimated(this.props)&&this.setState({hasMouseOver:!0});let{onMouseEnter:t}=this.props;t?.(e)};onMouseLeave=e=>{R.isAnimated(this.props)&&this.setState({hasMouseOver:!1});let{onMouseLeave:t}=this.props;t?.(e)};onFocus=e=>{R.isAnimated(this.props)&&this.setState({hasFocus:!0})};onBlur=e=>{let{currentTarget:t,relatedTarget:n}=e;t.contains(n)||this.setState({hasFocus:!1})};onClick=e=>{let{onZoom:t,onClick:n}=this.props;null!=n?n(e):null!=t&&(e.preventDefault(),t(e,{zoomThumbnailPlaceholder:this.getSrc(this.getRatio()),trigger:"CLICK"}))};renderAccessory=()=>{let{hasMouseOver:e,hasFocus:t}=this.state,n=e||t,i=null!=this.props.renderAccessory?this.props.renderAccessory():null;return this.props.shouldRenderAccessory?n?i:(0,r.jsx)(c.A,{}):null};render(){let{alt:e,zoomThumbnailPlaceholder:t,onZoom:n,shouldLink:i,onContextMenu:a,autoPlay:o,original:u,className:c,imageClassName:d,children:_,animated:f,shouldAnimate:p,width:h,height:m,minWidth:E,minHeight:A,maxWidth:I,maxHeight:T,onClick:S,renderAccessory:y,tabIndex:v,limitResponsiveWidth:N,useFullWidth:C,placeholder:O,placeholderVersion:D,dataSafeSrc:L,srcIsAnimated:w}=this.props,{readyState:M,hasMouseOver:P,hasFocus:x}=this.state,k=null!=n,U=this.getRatio(),G=(0,s.clamp)(Math.round(h*U),E??0,I??1/0),F=(0,s.clamp)(Math.round(m*U),A??0,T??1/0),V=b.getConfig({location:"LazyImage_render"}).enabled,B={alt:e,readyState:M,onContextMenu:a??void 0,zoomable:k,className:c,imageClassName:d,minWidth:E,minHeight:A,mediaLayoutType:this.getType(),limitResponsiveWidth:N,useFullWidth:C,tabIndex:v,width:G,height:F,src:"",placeholder:O,placeholderVersion:D,dataSafeSrc:L,srcIsAnimated:w,children:null!=_?e=>{let{src:t,size:n,alt:r,mediaLayoutType:i}=e;return _({src:t,size:n,alt:r,mediaLayoutType:i})}:void 0,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onFocus:this.onFocus,onBlur:this.onBlur};if(1===B.width&&1===B.height)return null;switch((k||null!=S)&&(B.onClick=this.onClick),i&&(B.original=null!=u&&""!==u?u:B.src),M){case g.Rv1.LOADING:null!=t&&(B.src=t);break;case g.Rv1.READY:if(R.isAnimated(this.props)){B.onMouseLeave=this.onMouseLeave;let e=(o||P||x)&&(null==p||p)&&R.visibilityObserver.isVisible(this);e?(B.src=this.getSrc(U),B.renderAccessory=y):(B.src=this.getSrc(U,!f||!o),B.renderAccessory=this.renderAccessory),null!=_&&(B.children=t=>{let{src:n,size:r,alt:i,mediaLayoutType:s}=t;return _({src:n,size:r,animating:e,alt:i,mediaLayoutType:s})})}else B.src=this.getSrc(U)}return(0,r.jsx)(l._,{disableLoadingSpinner:V,ref:this._imageRef,...B})}}let O=(0,u.mj)({name:"2026-03-image-load-metrics",kind:"user",defaultConfig:{enabled:!1},variations:{0:{enabled:!1},1:{enabled:!1},2:{enabled:!0}}}),b=(0,u.mj)({name:"2026-02-lazy-load-all-images",kind:"user",defaultConfig:{enabled:!1},variations:{1:{enabled:!0}}})}