PageSourceSearch

https://post.lurk.org/packs/media_modal-D532Fz6g.js

js lurk.org collected 2026-10-02 04:10:48 UTC 24,455 bytes, 14 lines download raw bytes

1import{o as e}from"./chunk-CMxvf4Kt.js";import{n as t,t as n}from"./jsx-runtime-SsSjplwM.js";import{c as r,s as i}from"./react-intl-Cop388b4.js";import{$ as a,C as o,S as s,T as c,Y as l,ct as u,et as d,f,i as p,it as m,lt as h,ot as g,rt as _,st as v,w as y}from"./poll-KnnyIIa4.js";import{Ai as b,Bt as x,V as S,Yr as C}from"./render-Bjo3CXfy.js";import{m as w,s as T}from"./react-router-XnIB1woh.js";import{t as E}from"./defineProperty-ZVu8KZGq.js";import{o as D,s as O}from"./typed_functions-DeEJvs8W.js";import{t as k}from"./classnames-CYxIelk8.js";import{t as A}from"./video-C_tXsHL7.js";import{a as j,d as M,f as N,o as P}from"./card-CxOU3N_g.js";import{i as F,n as ee,r as te,t as ne}from"./use-gesture-react.esm-CkIoXYZ6.js";import{t as re}from"./chevron_left-CiGtVExw.js";var I=e(k()),L=e(t()),R=n(),z=i({reply:{id:`status.reply`,defaultMessage:`Reply`},replyAll:{id:`status.replyAll`,defaultMessage:`Reply to thread`},reblog:{id:`status.reblog`,defaultMessage:`Boost`},reblog_private:{id:`status.reblog_private`,defaultMessage:`Share again with your followers`},cancel_reblog_private:{id:`status.cancel_reblog_private`,defaultMessage:`Unboost`},cannot_reblog:{id:`status.cannot_reblog`,defaultMessage:`This post cannot be boosted`},favourite:{id:`status.favourite`,defaultMessage:`Favorite`},removeFavourite:{id:`status.remove_favourite`,defaultMessage:`Remove from favorites`},open:{id:`status.open`,defaultMessage:`Expand this status`}}),B=({statusId:e,withOpenButton:t,onClose:n})=>{let{signedIn:i}=l(),c=r(),u=T(),d=D(),p=(0,L.useMemo)(()=>f(),[]),m=O(t=>p(t,{id:e})),h=m?.get(`account`),g=O(e=>e.compose.get(`text`).trim().length!==0),_=(0,L.useCallback)(()=>{m&&(i?(n(!0),d(g?b({modalType:`CONFIRM_REPLY`,modalProps:{status:m}}):C(m))):d(b({modalType:`INTERACTION`,modalProps:{intent:`reply`,accountId:m.getIn([`account`,`id`]),url:m.get(`uri`)}})))},[d,m,i,g,n]),v=(0,L.useCallback)(()=>{m&&d(i?S(m.get(`id`)):b({modalType:`INTERACTION`,modalProps:{intent:`favourite`,accountId:m.getIn([`account`,`id`]),url:m.get(`uri`)}}))},[d,m,i]),x=(0,L.useCallback)(e=>{e.button!==0||!m||(n(),u.push(`/@${h?.acct}/${m.get(`id`)}`))},[u,m,h,n]);if(!m)return null;let w,E,k;m.get(`in_reply_to_id`,null)===null?(w=`reply`,E=y,k=c.formatMessage(z.reply)):(w=`reply-all`,E=M,k=c.formatMessage(z.replyAll));let A=c.formatMessage(m.get(`favourited`)?z.removeFavourite:z.favourite);return(0,R.jsxs)(`div`,{className:`picture-in-picture__footer`,children:[(0,R.jsx)(a,{className:`status__action-bar-button`,title:k,icon:m.get(`in_reply_to_account_id`)===m.getIn([`account`,`id`])?`reply`:w,iconComponent:m.get(`in_reply_to_account_id`)===m.getIn([`account`,`id`])?y:E,onClick:_,counter:m.get(`replies_count`)}),(0,R.jsx)(P,{counters:!0,status:m}),(0,R.jsx)(a,{className:`status__action-bar-button star-icon`,animate:!0,active:m.get(`favourited`),title:A,icon:`star`,iconComponent:m.get(`favourited`)?o:s,onClick:v,counter:m.get(`favourites_count`)}),t&&(0,R.jsx)(a,{className:`status__action-bar-button`,title:c.formatMessage(z.open),icon:`external-link`,iconComponent:N,onClick:x,href:`/@${h?.acct}/${m.get(`id`)}`})]})},V=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function H(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}(function(){if(typeof window>`u`||typeof Element>`u`)return;var e=Array.prototype.slice,t=Element.prototype.matches||Element.prototype.msMatchesSelector,n=[`a[href]`,`area[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`button:not([disabled])`,`details`,`summary`,`iframe`,`object`,`embed`,`video`,`[contenteditable]`].join(`,`),r=function(){function r(e,t){H(this,r),this._inertManager=t,this._rootElement=e,this._managedNodes=new Set,this._rootElement.hasAttribute(`aria-hidden`)?this._savedAriaHidden=this._rootElement.getAttribute(`aria-hidden`):this._savedAriaHidden=null,this._rootElement.setAttribute(`aria-hidden`,`true`),this._makeSubtreeUnfocusable(this._rootElement),this._observer=new MutationObserver(this._onMutation.bind(this)),this._observer.observe(this._rootElement,{attributes:!0,childList:!0,subtree:!0})}return V(r,[{key:`destructor`,value:function(){this._observer.disconnect(),this._rootElement&&(this._savedAriaHidden===null?this._rootElement.removeAttribute(`aria-hidden`):this._rootElement.setAttribute(`aria-hidden`,this._savedAriaHidden)),this._managedNodes.forEac
1h(function(e){this._unmanageNode(e.node)},this),this._observer=null,this._rootElement=null,this._managedNodes=null,this._inertManager=null}},{key:`_makeSubtreeUnfocusable`,value:function(e){var t=this;o(e,function(e){return t._visitNode(e)});var n=document.activeElement;if(!document.body.contains(e)){for(var r=e,i=void 0;r;){if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){i=r;break}r=r.parentNode}i&&(n=i.activeElement)}e.contains(n)&&(n.blur(),n===document.activeElement&&document.body.focus())}},{key:`_visitNode`,value:function(e){if(e.nodeType===Node.ELEMENT_NODE){var r=e;r!==this._rootElement&&r.hasAttribute(`inert`)&&this._adoptInertRoot(r),(t.call(r,n)||r.hasAttribute(`tabindex`))&&this._manageNode(r)}}},{key:`_manageNode`,value:function(e){var t=this._inertManager.register(e,this);this._managedNodes.add(t)}},{key:`_unmanageNode`,value:function(e){var t=this._inertManager.deregister(e,this);t&&this._managedNodes.delete(t)}},{key:`_unmanageSubtree`,value:function(e){var t=this;o(e,function(e){return t._unmanageNode(e)})}},{key:`_adoptInertRoot`,value:function(e){var t=this._inertManager.getInertRoot(e);t||=(this._inertManager.setInert(e,!0),this._inertManager.getInertRoot(e)),t.managedNodes.forEach(function(e){this._manageNode(e.node)},this)}},{key:`_onMutation`,value:function(t,n){t.forEach(function(t){var n=t.target;if(t.type===`childList`)e.call(t.addedNodes).forEach(function(e){this._makeSubtreeUnfocusable(e)},this),e.call(t.removedNodes).forEach(function(e){this._unmanageSubtree(e)},this);else if(t.type===`attributes`){if(t.attributeName===`tabindex`)this._manageNode(n);else if(n!==this._rootElement&&t.attributeName===`inert`&&n.hasAttribute(`inert`)){this._adoptInertRoot(n);var r=this._inertManager.getInertRoot(n);this._managedNodes.forEach(function(e){n.contains(e.node)&&r._manageNode(e.node)})}}},this)}},{key:`managedNodes`,get:function(){return new Set(this._managedNodes)}},{key:`hasSavedAriaHidden`,get:function(){return this._savedAriaHidden!==null}},{key:`savedAriaHidden`,set:function(e){this._savedAriaHidden=e},get:function(){return this._savedAriaHidden}}]),r}(),i=function(){function e(t,n){H(this,e),this._node=t,this._overrodeFocusMethod=!1,this._inertRoots=new Set([n]),this._savedTabIndex=null,this._destroyed=!1,this.ensureUntabbable()}return V(e,[{key:`destructor`,value:function(){if(this._throwIfDestroyed(),this._node&&this._node.nodeType===Node.ELEMENT_NODE){var e=this._node;this._savedTabIndex===null?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,this._savedTabIndex),this._overrodeFocusMethod&&delete e.focus}this._node=null,this._inertRoots=null,this._destroyed=!0}},{key:`_throwIfDestroyed`,value:function(){if(this.destroyed)throw Error(`Trying to access destroyed InertNode`)}},{key:`ensureUntabbable`,value:function(){if(this.node.nodeType===Node.ELEMENT_NODE){var e=this.node;if(t.call(e,n)){if(e.tabIndex===-1&&this.hasSavedTabIndex)return;e.hasAttribute(`tabindex`)&&(this._savedTabIndex=e.tabIndex),e.setAttribute(`tabindex`,`-1`),e.nodeType===Node.ELEMENT_NODE&&(e.focus=function(){},this._overrodeFocusMethod=!0)}else e.hasAttribute(`tabindex`)&&(this._savedTabIndex=e.tabIndex,e.removeAttribute(`tabindex`))}}},{key:`addInertRoot`,value:function(e){this._throwIfDestroyed(),this._inertRoots.add(e)}},{key:`removeInertRoot`,value:function(e){this._throwIfDestroyed(),this._inertRoots.delete(e),this._inertRoots.size===0&&this.destructor()}},{key:`destroyed`,get:function(){return this._destroyed}},{key:`hasSavedTabIndex`,get:function(){return this._savedTabIndex!==null}},{key:`node`,get:function(){return this._throwIfDestroyed(),this._node}},{key:`savedTabIndex`,set:function(e){this._throwIfDestroyed(),this._savedTabIndex=e},get:function(){return this._throwIfDestroyed(),this._savedTabIndex}}]),e}(),a=function(){function n(e){if(H(this,n),!e)throw Error(`Missing required argument; InertManager needs to wrap a document.`);this._document=e,this._managedNodes=new Map,this._inertRoots=new Map,this._observer=new MutationObserver(this._watchForInert.bind(this)),s(e.head||e.body||e.documentElement),e.readyState===`loading`?e.addEventListener(`DOMContentLoaded`,this._onDocumentLoaded.bind(this)):this._onDocumentLoaded()}return V(n,[{key:`setInert`,value:function(e,t){if(t){if(this._inertRoots.has(e))return;var n=new r(e,this);if(e.setAttribute(`inert`,``),this._inertRoots.set(e,n),!this._document.body.contains(e))for(var i=e.parentNode;i;)i.nodeType===11&&s(i),i=i.parentNode}else{if(!this._inertRoots.has(e))return;this._inertRoots.get(e).destructor(),this._inertRoots.delete(e),e.removeAttribute(`inert`)}}},{key:`getInertRoot`,value:function(e){return this._inertRoots.get(e)}},{key:`register`,value:function(e,t){var n=this._managedNodes.get(e);return n===void 0?n=new i(e,t):n.addInertRoot(t),this._managedNodes.set(e,n),n}},{key:`deregister`,value:function(e,t){var n=this._managedNodes.get(e);return n?(n.removeInertRoot(t),n.destroyed&&this._managedNodes.delete(e),n):null}},{key:`_onDocumentLoaded`,value:function(){e.call(this._document.querySelectorAll(`[inert]`)).forEac
1h(function(e){this.setInert(e,!0)},this),this._observer.observe(this._document.body||this._document.documentElement,{attributes:!0,subtree:!0,childList:!0})}},{key:`_watchForInert`,value:function(n,r){var i=this;n.forEach(function(n){switch(n.type){case`childList`:e.call(n.addedNodes).forEach(function(n){if(n.nodeType===Node.ELEMENT_NODE){var r=e.call(n.querySelectorAll(`[inert]`));t.call(n,`[inert]`)&&r.unshift(n),r.forEach(function(e){this.setInert(e,!0)},i)}},i);break;case`attributes`:if(n.attributeName!==`inert`)return;var r=n.target,a=r.hasAttribute(`inert`);i.setInert(r,a);break}},this)}}]),n}();function o(e,t,n){if(e.nodeType==Node.ELEMENT_NODE){var r=e;t&&t(r);var i=r.shadowRoot;if(i){o(i,t,i);return}if(r.localName==`content`){for(var a=r,s=a.getDistributedNodes?a.getDistributedNodes():[],c=0;c<s.length;c++)o(s[c],t,n);return}if(r.localName==`slot`){for(var l=r,u=l.assignedNodes?l.assignedNodes({flatten:!0}):[],d=0;d<u.length;d++)o(u[d],t,n);return}}for(var f=e.firstChild;f!=null;)o(f,t,n),f=f.nextSibling}function s(e){if(!e.querySelector(`style#inert-style, link#inert-style`)){var t=document.createElement(`style`);t.setAttribute(`id`,`inert-style`),t.textContent=`
2[inert] {
3  pointer-events: none;
4  cursor: default;
5}
6
7[inert], [inert] * {
8  -webkit-user-select: none;
9  -moz-user-select: none;
10  -ms-user-select: none;
11  user-select: none;
12}
13`,e.appendChild(t)}}if(!HTMLElement.prototype.hasOwnProperty(`inert`)){var c=new a(document);Object.defineProperty(HTMLElement.prototype,"inert",{enumerable:!0,get:function(){return this.hasAttribute(`inert`)},set:function(e){c.setInert(this,e)}})}})();function U(e,t,n){return{r:255*n(e.r/255,t.r/255),g:255*n(e.g/255,t.g/255),b:255*n(e.b/255,t.b/255)}}function W(e,t){return e*t}function G(e,t,n){return Math.min(Math.max(e||0,t),n)}function K(e){return{r:G(e.r,0,255),g:G(e.g,0,255),b:G(e.b,0,255),a:G(e.a,0,1)}}function q(e){return{r:255*e.r,g:255*e.g,b:255*e.b,a:e.a}}function ie(e){return{r:e.r/255,g:e.g/255,b:e.b/255,a:e.a}}function J(e,t){t===void 0&&(t=0);var n=10**t;return{r:Math.round(e.r*n)/n,g:Math.round(e.g*n)/n,b:Math.round(e.b*n)/n,a:e.a}}function Y(e,t,n,r,i,a){return(1-t/n)*r+t/n*Math.round((1-e)*i+e*a)}function ae(e,t,n,r,i){i===void 0&&(i={unitInput:!1,unitOutput:!1,roundOutput:!0}),i.unitInput&&(e=q(e),t=q(t)),e=K(e);var a=(t=K(t)).a+e.a-t.a*e.a,o=n(e,t,r),s=K({r:Y(e.a,t.a,a,e.r,t.r,o.r),g:Y(e.a,t.a,a,e.g,t.g,o.g),b:Y(e.a,t.a,a,e.b,t.b,o.b),a});return s=i.unitOutput?ie(s):i.roundOutput?J(s):function(e){return J(e,9)}(s),s}function oe(e,t){return ae(e,t,U,W)}var se=j(class extends L.PureComponent{constructor(...e){super(...e),E(this,`activeElement`,this.props.children?document.activeElement:null),E(this,`handleKeyUp`,e=>{(e.key===`Escape`||e.key===`Esc`||e.keyCode===27)&&this.props.children&&this.props.onClose()}),E(this,`handleKeyDown`,e=>{if(e.key===`Tab`){let t=Array.from(this.node.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>window.getComputedStyle(e).display!==`none`),n=t.indexOf(e.target),r;r=e.shiftKey?t[n-1]||t[t.length-1]:t[n+1]||t[0],r&&(r.focus(),e.stopPropagation(),e.preventDefault())}}),E(this,`getSiblings`,()=>Array(...this.node.parentElement.childNodes).filter(e=>e!==this.node)),E(this,`setRef`,e=>{this.node=e})}componentDidMount(){window.addEventListener(`keyup`,this.handleKeyUp,!1),window.addEventListener(`keydown`,this.handleKeyDown,!1),this.history=this.props.history||w()}componentDidUpdate(e){!this.props.children&&e.children&&(this.getSiblings().forEac
13h(e=>e.removeAttribute(`inert`)),Promise.resolve().then(()=>{this.props.ignoreFocus||this.activeElement.focus({preventScroll:!0}),this.activeElement=null}).catch(console.error),this._handleModalClose()),this.props.children&&!e.children&&(this.activeElement=document.activeElement,this.getSiblings().forEach(e=>e.setAttribute(`inert`,!0)),this._handleModalOpen()),this.props.children&&this._ensureHistoryBuffer()}componentWillUnmount(){window.removeEventListener(`keyup`,this.handleKeyUp),window.removeEventListener(`keydown`,this.handleKeyDown)}_handleModalOpen(){this._modalHistoryKey=Date.now(),this.unlistenHistory=this.history.listen((e,t)=>{t===`POP`&&this.props.onClose()})}_handleModalClose(){this.unlistenHistory&&this.unlistenHistory();let{state:e}=this.history.location;e&&e.mastodonModalKey===this._modalHistoryKey&&this.history.goBack()}_ensureHistoryBuffer(){let{pathname:e,search:t,hash:n,state:r}=this.history.location;(!r||r.mastodonModalKey!==this._modalHistoryKey)&&this.history.push({pathname:e,search:t,hash:n},{...r,focusTarget:this.props.ignoreFocus!==x,mastodonModalKey:this._modalHistoryKey})}render(){let{children:e,onClose:t}=this.props,n=!!e;if(!n)return(0,R.jsx)(`div`,{className:`modal-root`,ref:this.setRef,style:{opacity:0}});let r=null;if(this.props.backgroundColor&&typeof this.props.backgroundColor==`string`)r=this.props.backgroundColor;else if(this.props.backgroundColor){let e=oe({...this.props.backgroundColor,a:1},{r:0,g:0,b:0,a:.7});r=`rgb(${e.r}, ${e.g}, ${e.b})`}return(0,R.jsx)(`div`,{className:`modal-root`,ref:this.setRef,children:(0,R.jsxs)(`div`,{style:{pointerEvents:n?`auto`:`none`},children:[(0,R.jsx)(`div`,{role:`presentation`,className:`modal-root__overlay`,onClick:t,style:{backgroundColor:r}}),(0,R.jsx)(`div`,{role:`dialog`,className:`modal-root__container`,children:e})]})})}}),X=(0,L.forwardRef)(({src:e,alt:t,lang:n,width:r,height:i,onClick:a,onMouseDown:o,onTouchStart:s},c)=>{let[l,u]=(0,L.useState)(!0),d=(0,L.useCallback)(()=>{u(!1)},[u]),f=(0,L.useCallback)(e=>{e.stopPropagation(),a?.(e)},[a]);return(0,R.jsxs)(`div`,{className:`gifv`,children:[l&&(0,R.jsx)(`canvas`,{role:`button`,tabIndex:0,"aria-label":t,lang:n,onClick:f}),(0,R.jsx)(`video`,{ref:c,src:e,role:`button`,tabIndex:0,"aria-label":t,lang:n,width:r,height:i,muted:!0,loop:!0,autoPlay:!0,playsInline:!0,onClick:f,onLoadedData:d,onMouseDown:o,onTouchStart:s})]})});X.displayName=`GIFV`;var ce=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~`.split(``),le=e=>{let t=0,n;for(let r of e)n=ce.indexOf(r),t=t*83+n;return t},ue=e=>({r:Math.max(0,e>>16),g:Math.max(0,e>>8&255),b:Math.max(0,e&255)}),de=e=>e?ue(le(e.slice(2,6))):null,Z=1,fe=4,pe=250,me=(e,t,n,r)=>{let{clientWidth:i,clientHeight:a}=e,{offsetWidth:o,offsetHeight:s}=t;return{containerWidth:i,containerHeight:a,imageWidth:o,imageHeight:s,initialScale:(n/r<i/a?`width`:`height`)==`width`?Math.min(i,n)/o:Math.min(a,r)/s}},he=ne([te,F]),ge=(e,t)=>{if(!e||t===Z)return{left:-1/0,right:1/0,top:-1/0,bottom:1/0};let{containerWidth:n,containerHeight:r,imageWidth:i,imageHeight:a}=e;return{left:-Math.max(i*t-n,0)/2,right:Math.max(i*t-n,0)/2,top:-Math.max(a*t-r,0)/2,bottom:Math.max(a*t-r,0)/2}},_e=({alt:e=``,lang:t=``,src:n,width:r,height:i,onClick:a,onDoubleClick:o,onClose:s,onZoomChange:l,zoomedIn:d,blurhash:f})=>{(0,L.useEffect)(()=>{let e=e=>{e.preventDefault()};return document.addEventListener(`gesturestart`,e),document.addEventListener(`gesturechange`,e),document.addEventListener(`gestureend`,e),()=>{document.removeEventListener(`gesturestart`,e),document.removeEventListener(`gesturechange`,e),document.removeEventListener(`gestureend`,e)}},[]);let[p,m]=(0,L.useState)(!1),[y,b]=(0,L.useState)(!1),[x,S]=(0,L.useState)(!1),C=(0,L.useRef)(null),w=(0,L.useRef)(null),T=(0,L.useRef)(),E=(0,L.useRef)(null),[D,O]=h(()=>({x:0,y:0,scale:1,onRest:{scale({value:e}){l&&l(e!==Z)}}}));he({onDrag({pinching:e,cancel:t,active:n,last:r,offset:[i,c],velocity:[,l],direction:[,u],tap:f}){if(f){T.current?(clearTimeout(T.current),T.current=null,o?.()):T.current=setTimeout(()=>{a?.(),T.current=null},pe);return}if(!d){if(r){(l>.5&&u!==0||Math.abs(c)>
13150)&&s?.(),O.start({y:0,config:v.wobbly});return}else if(u!==0){O.start({y:c,immediate:!0});return}t();return}if(e){t();return}m(!!n),O.start({x:i,y:c})},onPinch({origin:[e,t],first:n,movement:[r],offset:[i],memo:a}){if(!w.current)return;if(n){let{width:n,height:r,x:i,y:o}=w.current.getBoundingClientRect(),s=e-(i+n/2),c=t-(o+r/2);a=[D.x.get(),D.y.get(),s,c]}let o=a[0]-(r-1)*a[2],s=a[1]-(r-1)*a[3];return O.start({scale:i,x:o,y:s}),a}},{target:w,drag:{from:()=>[D.x.get(),D.y.get()],filterTaps:!0,bounds:()=>ge(E.current,D.scale.get()),rubberband:!0},pinch:{scaleBounds:{min:Z,max:fe},rubberband:!0}}),(0,L.useEffect)(()=>{!y||!C.current||!w.current||(E.current=me(C.current,w.current,r,i),d?D.scale.get()===Z&&O.start({scale:E.current.initialScale,x:0,y:0}):O.start({scale:Z,x:0,y:0}))},[O,D.scale,d,r,i,y]);let k=(0,L.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),A=(0,L.useCallback)(()=>{b(!0)},[b]),j=(0,L.useCallback)(()=>{S(!0)},[S]),M=u([D.scale,D.x,D.y],(e,t,n)=>`matrix(${e}, 0, 0, ${e}, ${t}, ${n})`);return(0,R.jsxs)(`div`,{className:(0,I.default)(`zoomable-image`,{"zoomable-image--zoomed-in":d,"zoomable-image--error":x,"zoomable-image--dragging":p}),ref:C,children:[!y&&f&&(0,R.jsx)(`div`,{className:`zoomable-image__preview`,style:{aspectRatio:`${r}/${i}`,height:`min(${i}px, 100%)`},children:(0,R.jsx)(c,{hash:f})}),(0,R.jsx)(g.img,{style:{transform:M},ref:w,alt:e,lang:t,src:n,width:r,height:i,draggable:!1,onLoad:A,onError:j,onClickCapture:k}),!y&&!x&&(0,R.jsx)(_,{})]})},ve=e=>(0,R.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:24,viewBox:`0 -960 960 960`,width:24,...e,children:(0,R.jsx)(`path`,{d:`M800-600v-120H680v-80h120q33 0 56.5 23.5T880-720v120h-80Zm-720 0v-120q0-33 23.5-56.5T160-800h120v80H160v120H80Zm600 440v-80h120v-120h80v120q0 33-23.5 56.5T800-160H680Zm-520 0q-33 0-56.5-23.5T80-240v-120h80v120h120v80H160Zm80-160v-320h480v320H240Zm80-80h320v-160H320v160Zm0 0v-160 160Z`})}),ye=e=>(0,R.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,R.jsx)(`path`,{d:`M3.1002 20.2C2.46686 20.2 1.9252 19.9833 1.4752 19.55C1.04186 19.1 0.825195 18.5583 0.825195 17.925V6.07499C0.825195 5.44165 1.04186 4.90832 1.4752 4.47499C1.9252 4.02499 2.46686 3.79999 3.1002 3.79999H20.9002C21.5335 3.79999 22.0669 4.02499 22.5002 4.47499C22.9502 4.90832 23.1752 5.44165 23.1752 6.07499V17.925C23.1752 18.5583 22.9502 19.1 22.5002 19.55C22.0669 19.9833 21.5335 20.2 20.9002 20.2H3.1002ZM3.1002 17.925H20.9002V6.07499H3.1002V17.925Z`,fill:`black`}),(0,R.jsx)(`path`,{d:`M8.12522 16V9.85782H6.25043V8H10V16H8.12522ZM11.1461 16V14.1422H13.0209V16H11.1461ZM15.1252 16V9.85782H13.2313V8H17V16H15.1252ZM11.1461 12.8578V11H13.0209V12.8578H11.1461Z`,fill:`black`})]}),Q=i({close:{id:`lightbox.close`,defaultMessage:`Close`},previous:{id:`lightbox.previous`,defaultMessage:`Previous`},next:{id:`lightbox.next`,defaultMessage:`Next`},zoomIn:{id:`lightbox.zoom_in`,defaultMessage:`Zoom to actual size`},zoomOut:{id:`lightbox.zoom_out`,defaultMessage:`Zoom to fit`}}),be=400,$=getComputedStyle(document.body).direction!==`rtl`,xe=(0,L.forwardRef)(({media:e,onClose:t,index:n,lang:i,currentTime:o,autoPlay:s,volume:c,statusId:l,onChangeBackgroundColor:u},f)=>{let[_,v]=(0,L.useState)(n),[y,b]=(0,L.useState)(!1),x=e.get(_),S=$?`-`:``,[C,w]=h(()=>({x:`${S}${_*100}%`})),T=(0,L.useCallback)((t,n=!1)=>{t<0?t=e.size+t:t>=e.size&&(t%=e.size),v(t),b(!1),n&&w.start({x:`calc(${S}${t*100}% + 0px)`})},[w,e.size,S]),E=(0,L.useCallback)(()=>{T(_-1,!0)},[T,_]),D=(0,L.useCallback)(()=>{T(_+1,!0)},[T,_]),O=(0,L.useCallback)(e=>{let t=$?`ArrowLeft`:`ArrowRight`,n=$?`ArrowRight`:`ArrowLeft`;e.key===t?(E(),e.preventDefault(),e.stopPropagation()):e.key===n&&(D(),e.preventDefault(),e.stopPropagation())},[D,E]),k=ee(({active:e,movement:[t],direction:[n],cancel:r})=>{if(y)return;e&&Math.abs(t)>Math.min(window.innerWidth/4,be)&&(T($?_-n:_+n),r());let i=e?t:0,a=$?`+`:`-`;w.start({x:`calc(${S}${_*100}% ${a} ${i}px)`})},{pointer:{capture:!1}});(0,L.useEffect)(()=>(window.addEventListener(`keydown`,O,!1),()=>
13{window.removeEventListener(`keydown`,O)}),[O]),(0,L.useEffect)(()=>{let e=x?.get(`blurhash`);if(e){let t=de(e);t&&u(t)}return()=>{u(null)}},[x,u]);let[j,M]=(0,L.useState)({width:0,height:0}),N=(0,L.useCallback)(e=>{typeof f==`function`?f(e):f&&(f.current=e),e?.clientWidth&&e.clientHeight&&M({width:e.clientWidth,height:e.clientHeight})},[f]),P=x?.get(`type`)===`image`&&(x.getIn([`meta`,`original`,`width`])>j.width||x.getIn([`meta`,`original`,`height`])>j.height),F=(0,L.useCallback)(()=>{b(e=>!e)},[]),[te,ne]=(0,L.useState)(!1),z=(0,L.useCallback)(()=>{ne(e=>!e)},[]),V=(0,L.useMemo)(()=>e.map((e,n)=>{let r=e.get(`url`),a=e.get(`blurhash`),l=e.getIn([`meta`,`original`,`width`],0),u=e.getIn([`meta`,`original`,`height`],0),d=e.getIn([`translation`,`description`],e.get(`description`));return e.get(`type`)===`image`?(0,R.jsx)(_e,{src:r,blurhash:a,width:l,height:u,alt:d,lang:i,onClick:z,onDoubleClick:F,onClose:t,onZoomChange:b,zoomedIn:y&&n===_},r):e.get(`type`)===`video`?(0,R.jsx)(A,{preview:e.get(`preview_url`),blurhash:a,src:r,frameRate:e.getIn([`meta`,`original`,`frame_rate`]),aspectRatio:`${l} / ${u}`,startTime:o??0,startPlaying:s??!1,startVolume:c??1,onCloseVideo:t,detailed:!0,alt:d,lang:i},r):e.get(`type`)===`gifv`?(0,R.jsx)(X,{src:r,alt:d,lang:i,onClick:z},r):null}),[s,o,z,F,_,i,e,t,c,y]),H=r(),U=e.size>1&&(0,R.jsx)(`button`,{className:`media-modal__nav media-modal__nav--prev`,onClick:E,"aria-label":H.formatMessage(Q.previous),type:`button`,children:(0,R.jsx)(d,{id:`chevron-left`,icon:re})}),W=e.size>1&&(0,R.jsx)(`button`,{className:`media-modal__nav  media-modal__nav--next`,onClick:D,"aria-label":H.formatMessage(Q.next),type:`button`,children:(0,R.jsx)(d,{id:`chevron-right`,icon:p})});return(0,R.jsxs)(`div`,{...k(),className:`modal-root__modal media-modal`,ref:N,children:[(0,R.jsx)(g.div,{style:C,className:`media-modal__closer`,role:`presentation`,onClick:t,children:V}),(0,R.jsxs)(`div`,{className:(0,I.default)(`media-modal__navigation`,{"media-modal__navigation--hidden":te}),children:[(0,R.jsxs)(`div`,{className:`media-modal__buttons`,children:[P&&(0,R.jsx)(a,{title:H.formatMessage(y?Q.zoomOut:Q.zoomIn),icon:``,iconComponent:y?ve:ye,onClick:F}),(0,R.jsx)(a,{title:H.formatMessage(Q.close),icon:`times`,iconComponent:m,onClick:t})]}),U,W,(0,R.jsxs)(`div`,{className:`media-modal__overlay`,children:[(0,R.jsx)(Se,{itemsCount:e.size,index:_,onChangeIndex:T}),l&&(0,R.jsx)(B,{statusId:l,withOpenButton:!0,onClose:t})]})]})]})});xe.displayName=`MediaModal`;var Se=({itemsCount:e,index:t,onChangeIndex:n})=>{let r=(0,L.useCallback)(e=>()=>{n(e)},[n]);return e<=1?null:(0,R.jsx)(`ul`,{className:`media-modal__pagination`,children:Array.from({length:e}).map((e,n)=>(0,R.jsx)(`button`,{className:(0,I.default)(`media-modal__page-dot`,{active:n===t}),onClick:r(n),type:`button`,children:n+1},n))})};export{se as a,X as i,_e as n,B as o,de as r,xe as t};
14//# sourceMappingURL=media_modal-D532Fz6g.js.map

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.