(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[9176],{24530:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>E});var n=i(62688),a=i.n(n),l=i(97023),r=i.n(l),c=(i(43813),i(3188),i(30973),i(84402)),o=i(23453),s=i(60853),u=i(92243),f=i(53442),d=i(8361),m=i(26614);const g=(0,d.Mz)("getGiphyFetchInstance",(e=>(0,m.zj)(e).GiphySdkKey),(e=>e?new f.uK(e):null));function p(e){const t=(0,o.useSelector)(g),i=(0,l.useCallback)((async i=>t?e.filter.length>0?await t.search(e.filter,{offset:i,limit:10}):await t.trending({offset:i,limit:10}):{}),[e.filter,t]);return r().createElement("div",{className:"emoji-picker__items gif-picker__items"},r().createElement(c.xA,{key:0===e.filter.length?"trending":e.filter,columns:2,gutter:8,hideAttribution:!0,width:e.width,noResultsMessage:r().createElement(s.A,{variant:u.L.Search,titleValues:{channelName:"".concat(e.filter)}}),fetchGifs:i,onGifClick:e.onClick}))}p.propTypes={width:a().number.isRequired,filter:a().string.isRequired};const h=(0,l.memo)(p);i(59297);var k=i(14778),v=i(11038),C=i(77440);const _=i.p+"files/91a3a29ed2f93ba44792.png",b=i.p+"files/c01e2180eeaf3ec6fc96.png";function w(e){const t=(0,o.useSelector)(C.O4),{formatMessage:i}=(0,k.useIntl)(),n=(0,l.useCallback)((t=>{var i,n,a;t.preventDefault();const l=null!==(i=null===(n=t.target)||void 0===n||null===(a=n.value)||void 0===a?void 0:a.replace(/^:|:$/g,""))&&void 0!==i?i:"";e.onChange(l)}),[e.onChange]),a=(0,l.useMemo)((()=>!!v.A.mostReadable(t.centerChannelBg,["#FFFFFF","#000000"],{includeFallbackColors:!1}).isLight()),[t.centerChannelBg]);return r().createElement("div",{className:"emoji-picker__search-container"},r().createElement("div",{className:"emoji-picker__text-container gif-picker__text-container"},r().createElement("span",{className:"icon-magnify icon emoji-picker__search-icon"}),r().createElement("input",{id:"emojiPickerSearch",className:"emoji-picker__search","aria-label":i({id:"gif_picker.input.label",defaultMessage:"Search for GIFs"}),placeholder:i({id:"gif_picker.input.placeholder",defaultMessage:"Search GIPHY"}),type:"text",autoFocus:!0,autoComplete:"off",onChange:n,value:e.value})),r().createElement("div",{className:"gif-attribution"},r().createElement("img",{src:a?b:_,alt:i({id:"gif_picker.attribution.alt",defaultMessage:"Powered by GIPHY"})})))}w.propTypes={value:a().string.isRequired,onChange:a().func.isRequired};const F=(0,l.memo)(w),R=e=>{const t=(0,l.useCallback)(((t,i)=>{if(e.onGifClick){i.preventDefault();const n="![".concat(t.title,"](").concat(t.images.fixed_height.url,")");e.onGifClick(n)}}),[e.onGifClick]),i=(0,l.useMemo)((()=>{var t,i,n,a;return(null!==(t=null===(i=e.getRootPickerNode)||void 0===i||null===(n=i.call(e))||void 0===n||null===(a=n.getBoundingClientRect())||void 0===a?void 0:a.width)&&void 0!==t?t:350)-24}),[e.getRootPickerNode]);return r().createElement(r().Fragment,null,r().createElement(F,{value:e.filter,onChange:e.handleFilterChange}),r().createElement(h,{width:i,filter:e.filter,onClick:t}))};R.propTypes={filter:a().string.isRequired,onGifClick:a().func,handleFilterChange:a().func.isRequired,getRootPickerNode:a().func.isRequired};const E=R},43966:()=>{}}]);
//# sourceMappingURL=9176.8b2e61676b1253e7b285.js.map