pleroma/priv/static/packs/containers/media_container.js
2018-08-12 18:02:43 +02:00

2 lines
30 KiB
JavaScript

webpackJsonp([34,33],{7:function(e,t,n){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];(Array.isArray(e)?e:[e]).forEach(function(e){e&&e.locale&&(F.a.__addLocaleData(e),E.a.__addLocaleData(e))})}function a(e){for(var t=(e||"").split("-");t.length>0;){if(o(t.join("-")))return!0;t.pop()}return!1}function o(e){var t=e&&e.toLowerCase();return!(!F.a.__localeData__[t]||!E.a.__localeData__[t])}function i(e){return(""+e).replace(_e,function(e){return be[e]})}function s(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.reduce(function(t,r){return e.hasOwnProperty(r)?t[r]=e[r]:n.hasOwnProperty(r)&&(t[r]=n[r]),t},{})}function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.intl;U()(t,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}function u(e,t){if(e===t)return!0;if("object"!==(void 0===e?"undefined":q(e))||null===e||"object"!==(void 0===t?"undefined":q(t))||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),o=0;o<n.length;o++)if(!a(n[o])||e[n[o]]!==t[n[o]])return!1;return!0}function c(e,t,n){var r=e.props,a=e.state,o=e.context,i=void 0===o?{}:o,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},c=i.intl,d=void 0===c?{}:c,f=l.intl,p=void 0===f?{}:f;return!u(t,r)||!u(n,a)||!(p===d||u(s(p,ye),s(d,ye)))}function d(e){return e.displayName||e.name||"Component"}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.intlPropName,r=void 0===n?"intl":n,a=t.withRef,o=void 0!==a&&a,i=function(t){function n(e,t){H(this,n);var r=Q(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return l(t),r}return Z(n,t),J(n,[{key:"getWrappedInstance",value:function(){return U()(o,"[React Intl] To access the wrapped instance, the `{withRef: true}` option must be set when calling: `injectIntl()`"),this.refs.wrappedInstance}},{key:"render",value:function(){return R.a.createElement(e,B({},this.props,G({},r,this.context.intl),{ref:o?"wrappedInstance":null}))}}]),n}(A.Component);return i.displayName="InjectIntl("+d(e)+")",i.contextTypes={intl:pe},i.WrappedComponent=e,i}function p(e){return e}function h(e){return F.a.prototype._resolveLocale(e)}function m(e){return F.a.prototype._findPluralRuleFunction(e)}function v(e){var t=E.a.thresholds;t.second=e.second,t.minute=e.minute,t.hour=e.hour,t.day=e.day,t.month=e.month}function g(e,t,n){var r=e&&e[t]&&e[t][n];if(r)return r}function y(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=e.locale,o=e.formats,i=r.format,l=new Date(n),u=i&&g(o,"date",i),c=s(r,Oe,u);try{return t.getDateTimeFormat(a,c).format(l)}catch(e){}return String(l)}function b(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=e.locale,o=e.formats,i=r.format,l=new Date(n),u=i&&g(o,"time",i),c=s(r,Oe,u);c.hour||c.minute||c.second||(c=B({},c,{hour:"numeric",minute:"numeric"}));try{return t.getDateTimeFormat(a,c).format(l)}catch(e){}return String(l)}function _(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=e.locale,o=e.formats,i=r.format,l=new Date(n),u=new Date(r.now),c=i&&g(o,"relative",i),d=s(r,ke,c),f=B({},E.a.thresholds);v(Ne);try{return t.getRelativeFormat(a,d).format(l,{now:isFinite(u)?u:t.now()})}catch(e){}finally{v(f)}return String(l)}function w(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=e.locale,o=e.formats,i=r.format,l=i&&g(o,"number",i),u=s(r,xe,l);try{return t.getNumberFormat(a,u).format(n)}catch(e){}return String(n)}function O(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=e.locale,o=s(r,Ce);try{return t.getPluralFormat(a,o).format(n)}catch(e){}return"other"}function x(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=e.locale,o=e.formats,i=e.messages,s=e.defaultLocale,l=e.defaultFormats,u=n.id,c=n.defaultMessage;U()(u,"[React Intl] An `id` must be provided to format a message.");var d=i&&i[u];if(!(Object.keys(r).length>0))return d||c||u;var f=void 0;if(d)try{f=t.getMessageFormat(d,a,o).format(r)}catch(e){}if(!f&&c)try{f=t.getMessageFormat(c,s,l).format(r)}catch(e){}return f||d||c||u}function k(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return x(e,t,n,Object.keys(r).reduce(function(e,t){var n=r[t];return e[t]="string"==typeof n?i(n):n,e},{}))}function C(e){var t=Math.abs(e);return t<Ie?"second":t<Ae?"minute":t<Re?"hour":"day"}function N(e){switch(e){case"second":return De;case"minute":return Ie;case"hour":return Ae;case"day":return Re;default:return Le}}function j(e,t){if(e===t)return!0;var n=new Date(e).getTime(),r=new Date(t).getTime();return isFinite(n)&&isFinite(r)&&n===r}n.d(t,"e",function(){return r}),n.d(t,"g",function(){return f}),n.d(t,"f",function(){return p}),n.d(t,"d",function(){return Fe}),n.d(t,"a",function(){return Se}),n.d(t,"c",function(){return We}),n.d(t,"b",function(){return Ve});var M=n(107),P=n.n(M),T=n(59),F=n.n(T),S=n(76),E=n.n(S),D=n(5),I=n.n(D),A=n(0),R=n.n(A),L=n(18),U=n.n(L),W=n(108),z=n.n(W),V={locale:"en",pluralRuleFunction:function(e,t){var n=String(e).split("."),r=!n[1],a=Number(n[0])==e,o=a&&n[0].slice(-1),i=a&&n[0].slice(-2);return t?1==o&&11!=i?"one":2==o&&12!=i?"two":3==o&&13!=i?"few":"other":1==e&&r?"one":"other"},fields:{year:{displayName:"year",relative:{0:"this year",1:"next year","-1":"last year"},relativeTime:{future:{one:"in {0} year",other:"in {0} years"},past:{one:"{0} year ago",other:"{0} years ago"}}},month:{displayName:"month",relative:{0:"this month",1:"next month","-1":"last month"},relativeTime:{future:{one:"in {0} month",other:"in {0} months"},past:{one:"{0} month ago",other:"{0} months ago"}}},day:{displayName:"day",relative:{0:"today",1:"tomorrow","-1":"yesterday"},relativeTime:{future:{one:"in {0} day",other:"in {0} days"},past:{one:"{0} day ago",other:"{0} days ago"}}},hour:{displayName:"hour",relative:{0:"this hour"},relativeTime:{future:{one:"in {0} hour",other:"in {0} hours"},past:{one:"{0} hour ago",other:"{0} hours ago"}}},minute:{displayName:"minute",relative:{0:"this minute"},relativeTime:{future:{one:"in {0} minute",other:"in {0} minutes"},past:{one:"{0} minute ago",other:"{0} minutes ago"}}},second:{displayName:"second",relative:{0:"now"},relativeTime:{future:{one:"in {0} second",other:"in {0} seconds"},past:{one:"{0} second ago",other:"{0} seconds ago"}}}}},q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},J=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}}(),G=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},B=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Z=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},K=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},Q=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},X=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},Y=I.a.bool,$=I.a.number,ee=I.a.string,te=I.a.func,ne=I.a.object,re=I.a.oneOf,ae=I.a.shape,oe=I.a.any,ie=I.a.oneOfType,se=re(["best fit","lookup"]),le=re(["narrow","short","long"]),ue=re(["numeric","2-digit"]),ce=te.isRequired,de={locale:ee,formats:ne,messages:ne,textComponent:oe,defaultLocale:ee,defaultFormats:ne},fe={formatDate:ce,formatTime:ce,formatRelative:ce,formatNumber:ce,formatPlural:ce,formatMessage:ce,formatHTMLMessage:ce},pe=ae(B({},de,fe,{formatters:ne,now:ce})),he=(ee.isRequired,ie([ee,ne]),{localeMatcher:se,formatMatcher:re(["basic","best fit"]),timeZone:ee,hour12:Y,weekday:le,era:le,year:ue,month:re(["numeric","2-digit","narrow","short","long"]),day:ue,hour:ue,minute:ue,second:ue,timeZoneName:re(["short","long"])}),me={localeMatcher:se,style:re(["decimal","currency","percent"]),currency:ee,currencyDisplay:re(["symbol","code","name"]),useGrouping:Y,minimumIntegerDigits:$,minimumFractionDigits:$,maximumFractionDigits:$,minimumSignificantDigits:$,maximumSignificantDigits:$},ve={style:re(["best fit","numeric"]),units:re(["second","minute","hour","day","month","year"])},ge={style:re(["cardinal","ordinal"])},ye=Object.keys(de),be={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},_e=/[&><"']/g,we=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};H(this,e);var r="ordinal"===n.style,a=m(h(t));this.format=function(e){return a(e,r)}},Oe=Object.keys(he),xe=Object.keys(me),ke=Object.keys(ve),Ce=Object.keys(ge),Ne={second:60,minute:60,hour:24,day:30,month:12},je=Object.freeze({formatDate:y,formatTime:b,formatRelative:_,formatNumber:w,formatPlural:O,formatMessage:x,formatHTMLMessage:k}),Me=Object.keys(de),Pe=Object.keys(fe),Te={formats:{},messages:{},textComponent:"span",defaultLocale:"en",defaultFormats:{}},Fe=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};H(this,t);var r=Q(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));U()("undefined"!=typeof Intl,"[React Intl] The `Intl` APIs must be available in the runtime, and do not appear to be built-in. An `Intl` polyfill should be loaded.\nSee: http://formatjs.io/guides/runtime-environments/");var a=n.intl,o=void 0;o=isFinite(e.initialNow)?Number(e.initialNow):a?a.now():Date.now();var i=a||{},s=i.formatters,l=void 0===s?{getDateTimeFormat:z()(Intl.DateTimeFormat),getNumberFormat:z()(Intl.NumberFormat),getMessageFormat:z()(F.a),getRelativeFormat:z()(E.a),getPluralFormat:z()(we)}:s;return r.state=B({},l,{now:function(){return r._didDisplay?Date.now():o}}),r}return Z(t,e),J(t,[{key:"getConfig",value:function(){var e=this.context.intl,t=s(this.props,Me,e);for(var n in Te)void 0===t[n]&&(t[n]=Te[n]);if(!a(t.locale)){var r=t,o=(r.locale,r.defaultLocale),i=r.defaultFormats;t=B({},t,{locale:o,formats:i,messages:Te.messages})}return t}},{key:"getBoundFormatFns",value:function(e,t){return Pe.reduce(function(n,r){return n[r]=je[r].bind(null,e,t),n},{})}},{key:"getChildContext",value:function(){var e=this.getConfig(),t=this.getBoundFormatFns(e,this.state),n=this.state,r=n.now,a=K(n,["now"]);return{intl:B({},e,t,{formatters:a,now:r})}}},{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.apply(void 0,[this].concat(t))}},{key:"componentDidMount",value:function(){this._didDisplay=!0}},{key:"render",value:function(){return A.Children.only(this.props.children)}}]),t}(A.Component);Fe.displayName="IntlProvider",Fe.contextTypes={intl:pe},Fe.childContextTypes={intl:pe.isRequired};var Se=function(e){function t(e,n){H(this,t);var r=Q(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return l(n),r}return Z(t,e),J(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl,t=e.formatDate,n=e.textComponent,r=this.props,a=r.value,o=r.children,i=t(a,this.props);return"function"==typeof o?o(i):R.a.createElement(n,null,i)}}]),t}(A.Component);Se.displayName="FormattedDate",Se.contextTypes={intl:pe};var Ee=function(e){function t(e,n){H(this,t);var r=Q(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return l(n),r}return Z(t,e),J(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl,t=e.formatTime,n=e.textComponent,r=this.props,a=r.value,o=r.children,i=t(a,this.props);return"function"==typeof o?o(i):R.a.createElement(n,null,i)}}]),t}(A.Component);Ee.displayName="FormattedTime",Ee.contextTypes={intl:pe};var De=1e3,Ie=6e4,Ae=36e5,Re=864e5,Le=2147483647,Ue=function(e){function t(e,n){H(this,t);var r=Q(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));l(n);var a=isFinite(e.initialNow)?Number(e.initialNow):n.intl.now();return r.state={now:a},r}return Z(t,e),J(t,[{key:"scheduleNextUpdate",value:function(e,t){var n=this;clearTimeout(this._timer);var r=e.value,a=e.units,o=e.updateInterval,i=new Date(r).getTime();if(o&&isFinite(i)){var s=i-t.now,l=N(a||C(s)),u=Math.abs(s%l),c=s<0?Math.max(o,l-u):Math.max(o,u);this._timer=setTimeout(function(){n.setState({now:n.context.intl.now()})},c)}}},{key:"componentDidMount",value:function(){this.scheduleNextUpdate(this.props,this.state)}},{key:"componentWillReceiveProps",value:function(e){j(e.value,this.props.value)||this.setState({now:this.context.intl.now()})}},{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.apply(void 0,[this].concat(t))}},{key:"componentWillUpdate",value:function(e,t){this.scheduleNextUpdate(e,t)}},{key:"componentWillUnmount",value:function(){clearTimeout(this._timer)}},{key:"render",value:function(){var e=this.context.intl,t=e.formatRelative,n=e.textComponent,r=this.props,a=r.value,o=r.children,i=t(a,B({},this.props,this.state));return"function"==typeof o?o(i):R.a.createElement(n,null,i)}}]),t}(A.Component);Ue.displayName="FormattedRelative",Ue.contextTypes={intl:pe},Ue.defaultProps={updateInterval:1e4};var We=function(e){function t(e,n){H(this,t);var r=Q(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return l(n),r}return Z(t,e),J(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl,t=e.formatNumber,n=e.textComponent,r=this.props,a=r.value,o=r.children,i=t(a,this.props);return"function"==typeof o?o(i):R.a.createElement(n,null,i)}}]),t}(A.Component);We.displayName="FormattedNumber",We.contextTypes={intl:pe};var ze=function(e){function t(e,n){H(this,t);var r=Q(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return l(n),r}return Z(t,e),J(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl,t=e.formatPlural,n=e.textComponent,r=this.props,a=r.value,o=r.other,i=r.children,s=t(a,this.props),l=this.props[s]||o;return"function"==typeof i?i(l):R.a.createElement(n,null,l)}}]),t}(A.Component);ze.displayName="FormattedPlural",ze.contextTypes={intl:pe},ze.defaultProps={style:"cardinal"};var Ve=function(e){function t(e,n){H(this,t);var r=Q(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return l(n),r}return Z(t,e),J(t,[{key:"shouldComponentUpdate",value:function(e){var t=this.props.values;if(!u(e.values,t))return!0;for(var n=B({},e,{values:t}),r=arguments.length,a=Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return c.apply(void 0,[this,n].concat(a))}},{key:"render",value:function(){var e=this.context.intl,t=e.formatMessage,n=e.textComponent,r=this.props,a=r.id,o=r.description,i=r.defaultMessage,s=r.values,l=r.tagName,u=void 0===l?n:l,c=r.children,d=void 0,f=void 0,p=void 0;if(s&&Object.keys(s).length>0){var h=Math.floor(1099511627776*Math.random()).toString(16),m=function(){var e=0;return function(){return"ELEMENT-"+h+"-"+(e+=1)}}();d="@__"+h+"__@",f={},p={},Object.keys(s).forEach(function(e){var t=s[e];if(Object(A.isValidElement)(t)){var n=m();f[e]=d+n+d,p[n]=t}else f[e]=t})}var v={id:a,description:o,defaultMessage:i},g=t(v,f||s),y=void 0;return y=p&&Object.keys(p).length>0?g.split(d).filter(function(e){return!!e}).map(function(e){return p[e]||e}):[g],"function"==typeof c?c.apply(void 0,X(y)):A.createElement.apply(void 0,[u,null].concat(X(y)))}}]),t}(A.Component);Ve.displayName="FormattedMessage",Ve.contextTypes={intl:pe},Ve.defaultProps={values:{}};var qe=function(e){function t(e,n){H(this,t);var r=Q(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return l(n),r}return Z(t,e),J(t,[{key:"shouldComponentUpdate",value:function(e){var t=this.props.values;if(!u(e.values,t))return!0;for(var n=B({},e,{values:t}),r=arguments.length,a=Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return c.apply(void 0,[this,n].concat(a))}},{key:"render",value:function(){var e=this.context.intl,t=e.formatHTMLMessage,n=e.textComponent,r=this.props,a=r.id,o=r.description,i=r.defaultMessage,s=r.values,l=r.tagName,u=void 0===l?n:l,c=r.children,d={id:a,description:o,defaultMessage:i},f=t(d,s);if("function"==typeof c)return c(f);var p={__html:f};return R.a.createElement(u,{dangerouslySetInnerHTML:p})}}]),t}(A.Component);qe.displayName="FormattedHTMLMessage",qe.contextTypes={intl:pe},qe.defaultProps={values:{}},r(V),r(P.a)},805:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"default",function(){return j});var r,a,o,i,s,l=n(2),u=n.n(l),c=n(1),d=n.n(c),f=n(3),p=n.n(f),h=n(4),m=n.n(h),v=n(0),g=n.n(v),y=n(8),b=(n.n(y),n(23)),_=n(7),w=n(43),O=n(10),x=n.n(O),k=n(13),C=Object(_.f)({toggle_visible:{id:"media_gallery.toggle_visible",defaultMessage:"Toggle visibility"}}),N=(a=r=function(e){function t(){var n,r,a;d()(this,t);for(var o=arguments.length,i=Array(o),s=0;s<o;s++)i[s]=arguments[s];return n=r=p()(this,e.call.apply(e,[this].concat(i))),r.handleMouseEnter=function(e){r.hoverToPlay()&&e.target.play()},r.handleMouseLeave=function(e){r.hoverToPlay()&&(e.target.pause(),e.target.currentTime=0)},r.handleClick=function(e){var t=r.props,n=t.index,a=t.onClick;0===e.button&&(e.preventDefault(),a(n)),e.stopPropagation()},a=n,p()(r,a)}return m()(t,e),t.prototype.hoverToPlay=function(){var e=this.props.attachment;return!k.a&&"gifv"===e.get("type")},t.prototype.render=function(){var e=this.props,t=e.attachment,n=e.index,r=e.size,a=e.standalone,o=e.displayWidth,i=50,s=100,l="auto",c="auto",d="auto",f="auto";1===r&&(i=100),(4===r||3===r&&n>0)&&(s=50),2===r?0===n?f="2px":c="2px":3===r?(0===n?f="2px":n>0&&(c="2px"),1===n?d="2px":n>1&&(l="2px")):4===r&&(0!==n&&2!==n||(f="2px"),1!==n&&3!==n||(c="2px"),n<2?d="2px":l="2px");var p="";if("image"===t.get("type")){var h=t.get("preview_url"),m=t.getIn(["meta","small","width"]),v=t.get("url"),g=t.getIn(["meta","original","width"]),y="number"==typeof g&&"number"==typeof m,b=y?v+" "+g+"w, "+h+" "+m+"w":null,_=y?o*(i/100)+"px":null,O=t.getIn(["meta","focus","x"])||0,C=t.getIn(["meta","focus","y"])||0,N=100*(O/2+.5),j=100*(C/-2+.5);p=u()("a",{className:"media-gallery__item-thumbnail",href:t.get("remote_url")||v,onClick:this.handleClick,target:"_blank"},void 0,u()("img",{src:h,srcSet:b,sizes:_,alt:t.get("description"),title:t.get("description"),style:{objectPosition:N+"% "+j+"%"}}))}else if("audio"===t.get("type"))p=u()("div",{className:"media-gallery__audio"},void 0,u()("audio",{className:"media-gallery__item-audio-thumbnail","aria-label":t.get("description"),role:"application",src:t.get("url"),loop:!0,controls:!0}));else if("gifv"===t.get("type")){var M=!Object(w.a)()&&k.a;p=u()("div",{className:x()("media-gallery__gifv",{autoplay:M})},void 0,u()("video",{className:"media-gallery__item-gifv-thumbnail","aria-label":t.get("description"),role:"application",src:t.get("url"),onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,autoPlay:M,loop:!0,muted:!0}),u()("span",{className:"media-gallery__gifv__label"},void 0,"GIF"))}return u()("div",{className:x()("media-gallery__item",{standalone:a}),style:{left:c,top:l,right:f,bottom:d,width:i+"%",height:s+"%"}},t.get("id"),p)},t}(g.a.PureComponent),r.defaultProps={standalone:!1,index:0,size:1},a),j=Object(_.g)((s=i=function(e){function t(){var n,r,a;d()(this,t);for(var o=arguments.length,i=Array(o),s=0;s<o;s++)i[s]=arguments[s];return n=r=p()(this,e.call.apply(e,[this].concat(i))),r.state={visible:!r.props.sensitive||k.f},r.handleOpen=function(){r.setState({visible:!r.state.visible})},r.handleClick=function(e){r.props.onOpenMedia(r.props.media,e)},r.handleRef=function(e){e&&r.setState({width:e.offsetWidth})},a=n,p()(r,a)}return m()(t,e),t.prototype.componentWillReceiveProps=function(e){Object(y.is)(e.media,this.props.media)||this.setState({visible:!e.sensitive})},t.prototype.isStandaloneEligible=function(){var e=this.props,t=e.media;return e.standalone&&1===t.size&&t.getIn([0,"meta","small","aspect"])},t.prototype.render=function(){var e=this,t=this.props,n=t.media,r=t.intl,a=t.sensitive,o=t.height,i=this.state,s=i.width,l=i.visible,c=void 0,d={};if(this.isStandaloneEligible()?s&&(d.height=s/this.props.media.getIn([0,"meta","small","aspect"])):d.height=s?s/(16/9):o,l){var f=n.take(4).size;c=this.isStandaloneEligible()?u()(N,{standalone:!0,onClick:this.handleClick,attachment:n.get(0),displayWidth:s}):n.take(4).map(function(t,n){return u()(N,{onClick:e.handleClick,attachment:t,index:n,size:f,displayWidth:s},t.get("id"))})}else{var p=void 0;p=a?u()(_.b,{id:"status.sensitive_warning",defaultMessage:"Sensitive content"}):u()(_.b,{id:"status.media_hidden",defaultMessage:"Media hidden"}),c=g.a.createElement("button",{type:"button",className:"media-spoiler",onClick:this.handleOpen,style:d,ref:this.handleRef},u()("span",{className:"media-spoiler__warning"},void 0,p),u()("span",{className:"media-spoiler__trigger"},void 0,u()(_.b,{id:"status.sensitive_toggle",defaultMessage:"Click to view"})))}return g.a.createElement("div",{className:"media-gallery",style:d,ref:this.handleRef},u()("div",{className:x()("spoiler-button",{"spoiler-button--visible":l})},void 0,u()(b.a,{title:r.formatMessage(C.toggle_visible),icon:l?"eye":"eye-slash",overlay:!0,onClick:this.handleOpen})),c)},t}(g.a.PureComponent),i.defaultProps={standalone:!1},o=s))||o},839:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"default",function(){return F});var r=n(34),a=n.n(r),o=n(55),i=n.n(o),s=n(2),l=n.n(s),u=n(1),c=n.n(u),d=n(3),f=n.n(d),p=n(4),h=n.n(p),m=n(0),v=n.n(m),g=n(20),y=n.n(g),b=n(7),_=n(6),w=n(805),O=n(74),x=n(899),k=n(328),C=n(329),N=n(8),j=(n.n(N),Object(_.getLocale)()),M=j.localeData,P=j.messages;Object(b.e)(M);var T={MediaGallery:w.default,Video:O.default,Card:x.a},F=function(e){function t(){var n,r,a;c()(this,t);for(var o=arguments.length,i=Array(o),s=0;s<o;s++)i[s]=arguments[s];return n=r=f()(this,e.call.apply(e,[this].concat(i))),r.state={media:null,index:null,time:null},r.handleOpenMedia=function(e,t){document.body.classList.add("media-standalone__body"),r.setState({media:e,index:t})},r.handleOpenVideo=function(e,t){var n=Object(N.List)([e]);document.body.classList.add("media-standalone__body"),r.setState({media:n,time:t})},r.handleCloseMedia=function(){document.body.classList.remove("media-standalone__body"),r.setState({media:null,index:null,time:null})},a=n,f()(r,a)}return h()(t,e),t.prototype.render=function(){var e=this,t=this.props,n=t.locale,r=t.components;return l()(b.d,{locale:n,messages:P},void 0,l()(m.Fragment,{},void 0,[].map.call(r,function(t,n){var r=t.getAttribute("data-component"),o=T[r],s=JSON.parse(t.getAttribute("data-props")),l=s.media,u=s.card,c=i()(s,["media","card"]);return Object.assign(c,Object.assign({},l?{media:Object(N.fromJS)(l)}:{},u?{card:Object(N.fromJS)(u)}:{},"Video"===r?{onOpenVideo:e.handleOpenVideo}:{onOpenMedia:e.handleOpenMedia})),y.a.createPortal(v.a.createElement(o,a()({},c,{key:"media-"+n})),t)}),l()(k.a,{onClose:this.handleCloseMedia},void 0,this.state.media&&l()(C.a,{media:this.state.media,index:this.state.index||0,time:this.state.time,onClose:this.handleCloseMedia}))))},t}(m.PureComponent)},899:function(e,t,n){"use strict";n.d(t,"a",function(){return N});var r,a,o=n(2),i=n.n(o),s=n(1),l=n.n(s),u=n(3),c=n.n(u),d=n(4),f=n.n(d),p=n(0),h=n.n(p),m=n(8),v=n.n(m),g=n(900),y=n.n(g),b=n(10),_=n.n(b),w=function(e){return e.split(".").map(function(e){return 0===e.indexOf("xn--")?y.a.decode(e.slice("xn--".length)):e}).join(".")},O=function(e){var t=document.createElement("a");return t.href=e,t.hostname},x=function(e,t){var n=e.indexOf(" ",t);return-1===n?e:e.substring(0,n)+(e.length>t?"…":"")},k=new DOMParser,C=function(e){var t=k.parseFromString(e,"text/html").documentElement,n=t.querySelector("iframe");return n?(-1!==n.src.indexOf("?")?n.src+="&":n.src+="?",n.src+="autoplay=1&auto_play=1",t.querySelector("body").innerHTML):e},N=(a=r=function(e){function t(){var n,r,a;l()(this,t);for(var o=arguments.length,i=Array(o),s=0;s<o;s++)i[s]=arguments[s];return n=r=c()(this,e.call.apply(e,[this].concat(i))),r.state={width:280,embedded:!1},r.handlePhotoClick=function(){var e=r.props,t=e.card;(0,e.onOpenMedia)(v.a.fromJS([{type:"image",url:t.get("embed_url"),description:t.get("title"),meta:{original:{width:t.get("width"),height:t.get("height")}}}]),0)},r.handleEmbedClick=function(){"photo"===r.props.card.get("type")?r.handlePhotoClick():r.setState({embedded:!0})},r.setRef=function(e){e&&r.setState({width:e.offsetWidth})},a=n,c()(r,a)}return f()(t,e),t.prototype.componentWillReceiveProps=function(e){this.props.card!==e.card&&this.setState({embedded:!1})},t.prototype.renderVideo=function(){var e=this.props.card,t={__html:C(e.get("html"))},n=this.state.width,r=e.get("width")/e.get("height"),a=e.get("width")>e.get("height")?n/r:n*r;return h.a.createElement("div",{ref:this.setRef,className:"status-card__image status-card-video",dangerouslySetInnerHTML:t,style:{height:a}})},t.prototype.render=function(){var e=this.props,t=e.card,n=e.maxDescription,r=this.state,a=r.width,o=r.embedded;if(null===t)return null;var s=0===t.get("provider_name").length?w(O(t.get("url"))):t.get("provider_name"),l=t.get("width")>t.get("height")&&t.get("width")+100>=a||"link"!==t.get("type"),u=_()("status-card",{horizontal:l}),c="link"!==t.get("type"),d=c?i()("a",{className:"status-card__title",href:t.get("url"),title:t.get("title"),rel:"noopener",target:"_blank"},void 0,i()("strong",{},void 0,t.get("title"))):i()("strong",{className:"status-card__title",title:t.get("title")},void 0,t.get("title")),f=t.get("width")/t.get("height"),p=t.get("width")>t.get("height")?a/f:a*f,m=i()("div",{className:"status-card__content"},void 0,d,!l&&i()("p",{className:"status-card__description"},void 0,x(t.get("description")||"",n)),i()("span",{className:"status-card__host"},void 0,s)),v="",g=i()("div",{style:{backgroundImage:"url("+t.get("image")+")",width:l?a:null,height:l?p:null},className:"status-card__image-image"});if(c){if(o)v=this.renderVideo();else{var y="play";"photo"===t.get("type")&&(y="search-plus"),v=i()("div",{className:"status-card__image"},void 0,g,i()("div",{className:"status-card__actions"},void 0,i()("div",{},void 0,i()("button",{onClick:this.handleEmbedClick},void 0,i()("i",{className:"fa fa-"+y})),i()("a",{href:t.get("url"),target:"_blank",rel:"noopener"},void 0,i()("i",{className:"fa fa-external-link"})))))}return h.a.createElement("div",{className:u,ref:this.setRef},v,m)}return t.get("image")&&(v=i()("div",{className:"status-card__image"},void 0,g)),h.a.createElement("a",{href:t.get("url"),className:u,target:"_blank",rel:"noopener",ref:this.setRef},v,m)},t}(h.a.PureComponent),r.defaultProps={maxDescription:50},a)},900:function(e,t,n){(function(e,r){var a;!function(o){function i(e){throw new RangeError(S[e])}function s(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function l(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(F,"."),r+s(e.split("."),t).join(".")}function u(e){for(var t,n,r=[],a=0,o=e.length;a<o;)t=e.charCodeAt(a++),t>=55296&&t<=56319&&a<o?(n=e.charCodeAt(a++),56320==(64512&n)?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),a--)):r.push(t);return r}function c(e){return s(e,function(e){var t="";return e>65535&&(e-=65536,t+=I(e>>>10&1023|55296),e=56320|1023&e),t+=I(e)}).join("")}function d(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:w}function f(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function p(e,t,n){var r=0;for(e=n?D(e/C):e>>1,e+=D(e/t);e>E*x>>1;r+=w)e=D(e/E);return D(r+(E+1)*e/(e+k))}function h(e){var t,n,r,a,o,s,l,u,f,h,m=[],v=e.length,g=0,y=j,b=N;for(n=e.lastIndexOf(M),n<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&i("not-basic"),m.push(e.charCodeAt(r));for(a=n>0?n+1:0;a<v;){for(o=g,s=1,l=w;a>=v&&i("invalid-input"),u=d(e.charCodeAt(a++)),(u>=w||u>D((_-g)/s))&&i("overflow"),g+=u*s,f=l<=b?O:l>=b+x?x:l-b,!(u<f);l+=w)h=w-f,s>D(_/h)&&i("overflow"),s*=h;t=m.length+1,b=p(g-o,t,0==o),D(g/t)>_-y&&i("overflow"),y+=D(g/t),g%=t,m.splice(g++,0,y)}return c(m)}function m(e){var t,n,r,a,o,s,l,c,d,h,m,v,g,y,b,k=[];for(e=u(e),v=e.length,t=j,n=0,o=N,s=0;s<v;++s)(m=e[s])<128&&k.push(I(m));for(r=a=k.length,a&&k.push(M);r<v;){for(l=_,s=0;s<v;++s)(m=e[s])>=t&&m<l&&(l=m);for(g=r+1,l-t>D((_-n)/g)&&i("overflow"),n+=(l-t)*g,t=l,s=0;s<v;++s)if(m=e[s],m<t&&++n>_&&i("overflow"),m==t){for(c=n,d=w;h=d<=o?O:d>=o+x?x:d-o,!(c<h);d+=w)b=c-h,y=w-h,k.push(I(f(h+b%y,0))),c=D(b/y);k.push(I(f(c,0))),o=p(n,g,r==a),n=0,++r}++n,++t}return k.join("")}function v(e){return l(e,function(e){return P.test(e)?h(e.slice(4).toLowerCase()):e})}function g(e){return l(e,function(e){return T.test(e)?"xn--"+m(e):e})}var y=("object"==typeof t&&t&&t.nodeType,"object"==typeof e&&e&&e.nodeType,"object"==typeof r&&r);var b,_=2147483647,w=36,O=1,x=26,k=38,C=700,N=72,j=128,M="-",P=/^xn--/,T=/[^\x20-\x7E]/,F=/[\x2E\u3002\uFF0E\uFF61]/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=w-O,D=Math.floor,I=String.fromCharCode;b={version:"1.4.1",ucs2:{decode:u,encode:c},decode:h,encode:m,toASCII:g,toUnicode:v},void 0!==(a=function(){return b}.call(t,n,t,e))&&(e.exports=a)}()}).call(t,n(101)(e),n(57))}});
//# sourceMappingURL=media_container.js.map