{"version":3,"sources":["webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/account_gallery/components/media_item.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/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","icon","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","href","onClick","handleClick","ref","setCanvasRef","ImmutablePureComponent","ImmutablePropTypes","map","isRequired","PropTypes","number","func","LoadMoreMedia","onLoadMore","maxId","disabled","handleLoadMore","shouldUpdateScroll","string","AccountGallery","connect","isAccount","params","accountId","attachments","getAccountGallery","isLoading","hasMore","size","last","undefined","scrollTop","scrollHeight","clientHeight","handleScrollToBottom","dispatch","expandAccountMediaTimeline","includes","openModal","media","index","findIndex","offsetWidth","fetchAccount","componentWillReceiveProps","nextProps","multiColumn","loadOlder","handleLoadOlder","scrollKey","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,gBACPD,EAAEE,OAAOE,QACTJ,EAAEE,OAAOG,YAAc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iBG,UAAU,kBAAkBhC,mBAAoBA,QAAjE,EACE,mBAAKvC,UAAU,8BAA8BwE,SAAUjG,KAAKkG,mBAA5D,EACE,YAAC,IAAD,CAAiB5B,UAAWtE,KAAKpB,MAAMyF,OAAOC,YAE9C,yBAAK9B,KAAK,OAAOf,UAAU,6BAA6ByB,IAAKlD,KAAKmG,WAC/D5B,EAAYjB,IAAI,SAACzE,EAAY0G,GAAb,OAAsC,OAAf1G,EACtC,YAAC,EAAD,CAAkEgF,MAAO0B,EAAQ,EAAIhB,EAAYzF,MAAMyG,EAAQ,EAAG,MAAQ,KAAM3B,WAAY,EAAKG,gBAA7H,QAAUQ,EAAYzF,MAAMyG,EAAQ,EAAG,OAE3D,YAAC,EAAD,CAAsC1G,WAAYA,EAAYoC,aAAcC,EAAOpB,YAAa,EAAKsG,iBAArFvH,EAAWoB,IAAI,SAGhC6F,GAGFrB,GAAkC,IAArBF,EAAYI,MACxB,mBAAKlD,UAAU,2BAAf,EACE,YAAC,IAAD,S,GAnHa2B,K,0BAER,CACjBiB,OAAQb,IAAU6C,OAAO9C,WACzB2B,SAAU1B,IAAUE,KAAKH,WACzBgB,YAAalB,IAAmBiD,KAAK/C,WACrCkB,UAAWjB,IAAU+C,KACrB7B,QAASlB,IAAU+C,KACnBnC,UAAWZ,IAAU+C,KACrBV,YAAarC,IAAU+C,O","file":"features/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 'mastodon/components/icon';\nimport { autoPlayGif, displayMedia } from 'mastodon/initial_state';\nimport classNames from 'classnames';\nimport { decode } from 'blurhash';\nimport { isIOS } from 'mastodon/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 let icon;\n\n if (attachment.get('type') === 'unknown') {\n // Skip\n } else if (attachment.get('type') === 'audio') {\n thumbnail = (\n \n