{"version":3,"sources":["webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/flavours/glitch/features/account_gallery/index.js"],"names":["MediaItem","visible","displayMedia","props","attachment","getIn","loaded","c","canvas","setState","e","hoverToPlay","target","play","pause","currentTime","button","ctrlKey","metaKey","preventDefault","state","onOpenMedia","componentDidMount","this","get","_decode","componentDidUpdate","prevProps","hash","pixels","decode","ctx","getContext","imageData","ImageData","putImageData","autoPlayGif","indexOf","render","displayWidth","width","Math","floor","height","status","title","thumbnail","className","id","x","y","src","alt","style","objectPosition","onLoad","handleImageLoad","autoPlay","isIOS","classNames","autoplay","aria-label","role","onMouseEnter","handleMouseEnter","onMouseLeave","handleMouseLeave","loop","muted","icon","href","onClick","handleClick","ref","setCanvasRef","ImmutablePureComponent","ImmutablePropTypes","map","isRequired","PropTypes","number","func","LoadMoreMedia","onLoadMore","maxId","disabled","handleLoadMore","string","AccountGallery","connect","isAccount","params","accountId","attachments","getAccountGallery","isLoading","hasMore","column","scrollTop","size","last","undefined","scrollHeight","clientHeight","handleScrollToBottom","dispatch","expandAccountMediaTimeline","prevRouterProps","location","mastodonModalOpen","includes","openModal","media","index","findIndex","offsetWidth","fetchAccount","componentWillReceiveProps","nextProps","loadOlder","handleLoadOlder","setColumnRef","handleHeaderClick","scrollKey","shouldUpdateScroll","onScroll","handleScroll","handleRef","handleOpenMedia","object","list","bool"],"mappings":"0SAUqBA,E,sLAQX,CACNC,QAA0B,aAAjBC,MAAgC,EAAKC,MAAMC,WAAWC,MAAM,CAAC,SAAU,eAAkC,aAAjBH,IACjGI,QAAQ,I,0CA2BK,SAAAC,GACb,EAAKC,OAASD,I,6CAGE,WAChB,EAAKE,SAAS,CAAEH,QAAQ,M,8CAGP,SAAAI,GACb,EAAKC,eACPD,EAAEE,OAAOC,S,8CAIM,SAAAH,GACb,EAAKC,gB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MhB,OAJIvB,GAAaD,GAAkC,IAArBF,EAAYM,OACxCoB,EAAY,YAAC,IAAD,CAAUtH,SAAU8F,EAAWxB,QAAShD,KAAKiG,mBAIzD,kBAAC,IAAD,CAAQ/C,IAAKlD,KAAKkG,cAChB,YAAC,IAAD,CAAqBlD,QAAShD,KAAKmG,oBAEnC,YAAC,IAAD,CAAiBC,UAAU,kBAAkBC,mBAAoBrG,KAAKqG,yBAAtE,EACE,mBAAK7E,UAAU,8BAA8B8E,SAAUtG,KAAKuG,mBAA5D,EACE,YAAC,IAAD,CAAiBlC,UAAWrE,KAAKpB,MAAMwF,OAAOC,YAE9C,yBAAK9B,KAAK,OAAOf,UAAU,6BAA6B0B,IAAKlD,KAAKwG,WAC/DlC,EAAYhB,IAAI,SAACzE,EAAY6G,GAAb,OAAsC,OAAf7G,EACtC,YAAC,EAAD,CAAkEgF,MAAO6B,EAAQ,EAAIpB,EAAYxF,MAAM4G,EAAQ,EAAG,MAAQ,KAAM9B,WAAY,EAAKG,gBAA7H,QAAUO,EAAYxF,MAAM4G,EAAQ,EAAG,OAE3D,YAAC,EAAD,CAAsC7G,WAAYA,EAAYmC,aAAcC,EAAOnB,YAAa,EAAK2G,iBAArF5H,EAAWoB,IAAI,SAGhC+F,GAGFxB,GAAkC,IAArBF,EAAYM,MACxB,mBAAKpD,UAAU,2BAAf,EACE,YAAC,IAAD,S,GA/Ha4B,K,0BAER,CACjBgB,OAAQZ,IAAUkD,OAAOnD,WACzB2B,SAAU1B,IAAUE,KAAKH,WACzBe,YAAajB,IAAmBsD,KAAKpD,WACrCiB,UAAWhB,IAAUoD,KACrBnC,QAASjB,IAAUoD,KACnBzC,UAAWX,IAAUoD,O","file":"flavours/glitch/async/account_gallery.js","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport Icon from 'flavours/glitch/components/icon';\nimport { autoPlayGif, displayMedia } from 'flavours/glitch/util/initial_state';\nimport classNames from 'classnames';\nimport { decode } from 'blurhash';\nimport { isIOS } from 'flavours/glitch/util/is_mobile';\n\nexport default class MediaItem extends ImmutablePureComponent {\n\n static propTypes = {\n attachment: ImmutablePropTypes.map.isRequired,\n displayWidth: PropTypes.number.isRequired,\n onOpenMedia: PropTypes.func.isRequired,\n };\n\n state = {\n visible: displayMedia !== 'hide_all' && !this.props.attachment.getIn(['status', 'sensitive']) || displayMedia === 'show_all',\n loaded: false,\n };\n\n componentDidMount () {\n if (this.props.attachment.get('blurhash')) {\n this._decode();\n }\n }\n\n componentDidUpdate (prevProps) {\n if (prevProps.attachment.get('blurhash') !== this.props.attachment.get('blurhash') && this.props.attachment.get('blurhash')) {\n this._decode();\n }\n }\n\n _decode () {\n const hash = this.props.attachment.get('blurhash');\n const pixels = decode(hash, 32, 32);\n\n if (pixels) {\n const ctx = this.canvas.getContext('2d');\n const imageData = new ImageData(pixels, 32, 32);\n\n ctx.putImageData(imageData, 0, 0);\n }\n }\n\n setCanvasRef = c => {\n this.canvas = c;\n }\n\n handleImageLoad = () => {\n this.setState({ loaded: true });\n }\n\n handleMouseEnter = e => {\n if (this.hoverToPlay()) {\n e.target.play();\n }\n }\n\n handleMouseLeave = e => {\n if (this.hoverToPlay()) {\n e.target.pause();\n e.target.currentTime = 0;\n }\n }\n\n hoverToPlay () {\n return !autoPlayGif && ['gifv', 'video'].indexOf(this.props.attachment.get('type')) !== -1;\n }\n\n handleClick = e => {\n if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {\n e.preventDefault();\n\n if (this.state.visible) {\n this.props.onOpenMedia(this.props.attachment);\n } else {\n this.setState({ visible: true });\n }\n }\n }\n\n render () {\n const { attachment, displayWidth } = this.props;\n const { visible, loaded } = this.state;\n\n const width = `${Math.floor((displayWidth - 4) / 3) - 4}px`;\n const height = width;\n const status = attachment.get('status');\n const title = status.get('spoiler_text') || attachment.get('description');\n\n let thumbnail = '';\n\n if (attachment.get('type') === 'unknown') {\n // Skip\n } else if (attachment.get('type') === 'audio') {\n thumbnail = (\n \n