{"version":3,"sources":["../src/components/ErrorBoundary.tsx","../src/context/PickerContext.ts","../src/context/TenorContext.ts","#style-inject:#style-inject","../src/components/body/Body.css","../src/context/SettingsContext.ts","../src/components/placeholders/CategoryPlaceholder.css","../src/components/placeholders/Placeholder.tsx","../src/components/placeholders/Placeholder.css","../src/components/placeholders/CategoryPlaceholder.tsx","../src/components/body/CategoryList.css","../src/components/body/Category.css","../src/components/body/Category.tsx","../src/components/body/FeaturedCategory.tsx","../src/components/body/TrendingCategory.tsx","../src/components/body/TrendingCategory.css","../src/components/body/CategoryList.tsx","../src/components/body/SearchResult.tsx","../src/components/body/GifList.css","../src/components/placeholders/ResultPlaceholder.css","../src/components/placeholders/ResultPlaceholder.tsx","../src/components/body/GifListPlaceholder.tsx","../src/components/body/ResultImage.tsx","../src/components/body/ResultImage.css","../src/components/body/GifList.tsx","../src/components/body/TrendingResult.tsx","../src/components/body/Body.tsx","../src/components/header/Header.css","../src/components/header/Search.tsx","../src/components/Button.tsx","../src/components/header/ClearButton.css","../src/components/header/ClearButton.tsx","../src/components/header/Search.css","../src/components/header/Title.tsx","../src/components/header/Title.css","../src/components/header/Header.tsx","../src/types/exposedTypes.ts","../src/components/PickerMain.tsx","../src/GifPickerReact.css","../src/hooks/usePickerContext.ts","../src/hooks/useSettings.ts","../src/managers/TenorManager.ts","../src/GifPickerReact.tsx","../src/index.tsx"],"names":["ErrorBoundary","B","props","error","errorInfo","PickerContext","React","PickerContext_default","TenorContext","H","TenorContext_default","styleInject","css","insertAt","head","style","SettingsContext","D","SettingsContext_default","Placeholder","Placeholder_default","CategoryPlaceholder","settings","useContext","CategoryPlaceholder_default","Category","image","text","onClick","Category_default","FeaturedCategory","name","pickerContext","setPickerContext","contextCopy","FeaturedCategory_default","TrendingCategory","TrendingCategory_default","CategoryList","categories","trending","columnsCount","_a","getCleanedCategories","excessCategoriesCount","cat","i","_","CategoryList_default","ResultPlaceholder","height","showDelay","show","setShow","useState","useEffect","showElement","timeout","ResultPlaceholder_default","PLACEHOLDER_HEIGHTS","GifListPlaceholder","j","GifListPlaceholder_default","ResultImage","searchTerm","tenor","func","ResultImage_default","GifList","isLoading","result","columns","useMemo","generateColumns","isEmpty","col","img","columnsHeight","aspectRatio","shortestColumnIndex","GifList_default","SearchResult","searchResult","setSearchResult","setLoading","search","debounce","SearchResult_default","TrendingResult","trendingResult","TrendingResult_default","MAX_COLUMN_WIDTH","Body","width","setCategories","setTrending","setColumnsCount","ref","useRef","categoryList","trendingList","Body_default","Button","te","Button_default","ClearButton","ClearButton_default","Search","onChange","event","onClear","Search_default","Title","children","Title_default","Header","Header_default","ContentFilter","Theme","PickerMain","PickerMain_default","usePickerContext","initialSearchTerm","DEFAULT_SETTINGS","usePickerContext_default","useSettings","praseDimension","getTheme","dimension","theme","isSystemDarkTheme","useSettings_default","MEDIA_FILTER","BASE_URL","TenorManager","apiKey","clientKey","country","locale","contentFilter","endpoint","params","urlParams","url","res","preview","gif","data","tag","term","limit","images","TenorManager_default","GifPickerReact","tenorManager","GifPickerReact_default","GifPicker","src_default"],"mappings":";;;AAUA,IAAqBA,CAAAA,CAArB,cAAiDC,CAAA,CAAA,SAAkD,CAClG,WAAYC,CAAAA,CAAAA,CAAsC,CACjD,KAAA,CAAMA,CAAK,CACX,CAAA,IAAA,CAAK,KAAQ,CAAA,CAAE,SAAU,CAAM,CAAA,EAChC,CAEA,OAAO,0BAA+C,CACrD,OAAO,CAAE,QAAA,CAAU,EAAK,CACzB,CAEA,iBAAkBC,CAAAA,CAAAA,CAAcC,EAAsB,CAErD,OAAA,CAAQ,KAAM,CAAA,oCAAA,CAAsCD,EAAOC,CAAS,EACrE,CAEA,MAAA,EAA0B,CACzB,OAAI,IAAA,CAAK,KAAM,CAAA,QAAA,CACP,KAGD,IAAK,CAAA,KAAA,CAAM,QACnB,CACD,EC7BA,IAAMC,EAAgBC,CAAAA,UAAAA,CAAM,aAE1B,CAAA,IAAK,EAEAC,CAAQF,CAAAA,EAAAA,CCJf,IAAMG,EAA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 'react';\r\n\r\nexport interface ErrorBoundaryProps {\r\n\tchildren: React.ReactNode;\r\n}\r\n\r\nexport interface ErrorBoundaryState {\r\n\thasError: boolean;\r\n}\r\n\r\nexport default class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\r\n\tconstructor(props: { children: React.ReactNode }) {\r\n\t\tsuper(props);\r\n\t\tthis.state = { hasError: false };\r\n\t}\r\n\r\n\tstatic getDerivedStateFromError(): ErrorBoundaryState {\r\n\t\treturn { hasError: true };\r\n\t}\r\n\r\n\tcomponentDidCatch(error: Error, errorInfo: any): void {\r\n\t\t// eslint-disable-next-line no-console\r\n\t\tconsole.error('GIF Picker React failed to render:', error, errorInfo);\r\n\t}\r\n\r\n\trender(): React.ReactNode {\r\n\t\tif (this.state.hasError) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\treturn this.props.children;\r\n\t}\r\n}\r\n","import React, { Dispatch, SetStateAction } from 'react';\r\nimport { PickerContextType } from '../hooks/usePickerContext';\r\n\r\nconst PickerContext = React.createContext<\r\n\t[PickerContextType, Dispatch<SetStateAction<PickerContextType>>]\r\n>(null!);\r\n\r\nexport default PickerContext;\r\n","import * as React from 'react';\r\nimport TenorManager from '../managers/TenorManager';\r\n\r\nconst TenorContext = React.createContext<TenorManager>(null!);\r\n\r\nexport default TenorContext;\r\n","\n          export default function styleInject(css, { insertAt } = {}) {\n            if (!css || typeof document === 'undefined') return\n          \n            const head = document.head || document.getElementsByTagName('head')[0]\n            const style = document.createElement('style')\n            style.type = 'text/css'\n          \n            if (insertAt === 'top') {\n              if (head.firstChild) {\n                head.insertBefore(style, head.firstChild)\n              } else {\n                head.appendChild(style)\n              }\n            } else {\n              head.appendChild(style)\n            }\n          \n            if (style.styleSheet) {\n              style.styleSheet.cssText = css\n            } else {\n              style.appendChild(document.createTextNode(css))\n            }\n          }\n          ","import styleInject from '#style-inject';styleInject(\".GifPickerReact .gpr-body{display:flex;flex:1;min-height:0}\\n\")","import * as React from 'react';\r\nimport { GifPickerSettings } from '../hooks/useSettings';\r\n\r\nconst SettingsContext = React.createContext<GifPickerSettings>(null!);\r\n\r\nexport default SettingsContext;\r\n","import styleInject from '#style-inject';styleInject(\".GifPickerReact .gpr-category-placeholder{border-radius:var(--gpr-category-border-radius);position:relative}\\n\")","import React from 'react';\r\nimport './Placeholder.css';\r\n\r\nexport interface PlaceholderProps\r\n\textends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {\r\n\twidth?: number | string;\r\n\theight?: number | string;\r\n\tclassName?: string;\r\n}\r\n\r\nfunction Placeholder(props: PlaceholderProps) {\r\n\treturn (\r\n\t\t<div\r\n\t\t\t{...props}\r\n\t\t\tclassName={`gpr-placeholder ${props.className || ''}`}\r\n\t\t\tstyle={{ width: props.width, height: props.height, ...props.style }}\r\n\t\t></div>\r\n\t);\r\n}\r\n\r\nexport default Placeholder;\r\n","import styleInject from '#style-inject';styleInject(\".GifPickerReact .gpr-placeholder{background-color:var(--gpr-placeholder-color);transition:opacity .2s ease-in-out}\\n\")","import React, { useContext } from 'react';\r\nimport SettingsContext from '../../context/SettingsContext';\r\nimport './CategoryPlaceholder.css';\r\nimport Placeholder from './Placeholder';\r\n\r\nfunction CategoryPlaceholder() {\r\n\tconst settings = useContext(SettingsContext);\r\n\r\n\treturn (\r\n\t\t<Placeholder\r\n\t\t\tclassName=\"gpr-category-placeholder\"\r\n\t\t\theight={settings.categoryHeight}\r\n\t\t\twidth=\"100%\"\r\n\t\t/>\r\n\t);\r\n}\r\n\r\nexport default CategoryPlaceholder;\r\n","import styleInject from '#style-inject';styleInject(\".GifPickerReact .gpr-category-list{display:grid;grid-gap:var(--gpr-category-list-padding);flex:1;grid-auto-rows:min-content;overflow-y:scroll;padding:var(--gpr-body-padding)}\\n\")","import styleInject from '#style-inject';styleInject(\".GifPickerReact .gpr-category{border-radius:var(--gpr-category-border-radius);cursor:pointer;position:relative;transition:box-shadow .15s ease-in-out}.GifPickerReact .gpr-category img{background-color:#d3d3d3;border-radius:var(--gpr-category-border-radius);height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.GifPickerReact .gpr-category-overlay{align-items:center;background-color:rgba(0,0,0,var(--gpr-category-background-opacity));border-radius:var(--gpr-category-border-radius);display:flex;height:100%;justify-content:center;left:0;overflow:hidden;position:absolute;top:0;transition:background-color .15s ease-in-out;width:100%}.GifPickerReact .gpr-category-overlay .gpr-category-name{color:var(--gpr-category-font-color);font-size:var(--gpr-category-font-size);font-weight:var(--gpr-category-font-weight);text-shadow:0 1px 1px rgba(0,0,0,var(--gpr-category-shadow-opacity))}.GifPickerReact .gpr-category:hover{box-shadow:0 0 0 2px var(--gpr-category-border-color-hover)}.GifPickerReact .gpr-category:hover .gpr-category-overlay{background-color:rgba(0,0,0,var(--gpr-category-shadow-opacity-hover))}\\n\")","import React, { useContext } from 'react';\r\nimport SettingsContext from '../../context/SettingsContext';\r\nimport './Category.css';\r\n\r\nexport interface CategoryProps {\r\n\timage: string;\r\n\ttext: React.ReactNode | string;\r\n\tonClick?: React.MouseEventHandler<HTMLButtonElement>;\r\n}\r\n\r\nfunction Category({ image, text, onClick }: CategoryProps): JSX.Element {\r\n\tconst settings = useContext(SettingsContext);\r\n\r\n\treturn (\r\n\t\t<button\r\n\t\t\ttype=\"button\"\r\n\t\t\tclassName=\"gpr-btn gpr-category\"\r\n\t\t\tstyle={{ height: settings.categoryHeight }}\r\n\t\t\tdata-testid=\"gpr-category\"\r\n\t\t\tonClick={onClick}\r\n\t\t>\r\n\t\t\t<img\r\n\t\t\t\tsrc={image}\r\n\t\t\t\tloading=\"lazy\"\r\n\t\t\t/>\r\n\t\t\t<div className=\"gpr-category-overlay\">\r\n\t\t\t\t<div className=\"gpr-category-name\">{text}</div>\r\n\t\t\t</div>\r\n\t\t</button>\r\n\t);\r\n}\r\n\r\nexport default Category;\r\n","import React, { useContext } from 'react';\r\nimport PickerContext from '../../context/PickerContext';\r\nimport Category from './Category';\r\n\r\nexport interface FeaturedCategory {\r\n\timage: string;\r\n\tname: string;\r\n}\r\n\r\nfunction FeaturedCategory({ image, name }: FeaturedCategory): JSX.Element {\r\n\tconst [pickerContext, setPickerContext] = useContext(PickerContext);\r\n\r\n\tfunction onClick(): void {\r\n\t\tconst contextCopy = Object.assign({}, pickerContext);\r\n\t\tcontextCopy.searchTerm = name;\r\n\t\tsetPickerContext(contextCopy);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<Category\r\n\t\t\timage={image}\r\n\t\t\ttext={name}\r\n\t\t\tonClick={onClick}\r\n\t\t/>\r\n\t);\r\n}\r\n\r\nexport default FeaturedCategory;\r\n","import React, { useContext } from 'react';\r\nimport PickerContext from '../../context/PickerContext';\r\nimport Category from './Category';\r\nimport './TrendingCategory.css';\r\n\r\nexport interface FeaturedCategory {\r\n\timage: string;\r\n}\r\n\r\nfunction TrendingCategory({ image }: FeaturedCategory): JSX.Element {\r\n\tconst [pickerContext, setPickerContext] = useContext(PickerContext);\r\n\r\n\tfunction onClick(): void {\r\n\t\tconst contextCopy = Object.assign({}, pickerContext);\r\n\t\tcontextCopy.showTrending = true;\r\n\t\tsetPickerContext(contextCopy);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<Category\r\n\t\t\timage={image}\r\n\t\t\tonClick={onClick}\r\n\t\t\ttext={\r\n\t\t\t\t<div className=\"gpr-text-trending-category\">\r\n\t\t\t\t\t<div className=\"gpr-icn-trending\" />\r\n\t\t\t\t\t<span>Trending GIFs</span>\r\n\t\t\t\t</div>\r\n\t\t\t}\r\n\t\t/>\r\n\t);\r\n}\r\n\r\nexport default TrendingCategory;\r\n","import styleInject from '#style-inject';styleInject(\".GifPickerReact .gpr-icn-trending{background-color:transparent;background-image:url(\\\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%23fff' d='M6.3 37 4 34.7l15-15 8 8.05L41.9 11l2.1 2.05-17 19.2-8-7.95Z'/%3E%3C/svg%3E\\\");background-repeat:no-repeat;background-size:20px;height:20px;width:20px}.GifPickerReact .gpr-category .gpr-text-trending-category{align-items:center;display:flex;gap:4px}\\n\")","import React from 'react';\r\nimport { TenorImage } from '../../../dist';\r\nimport { TenorCategory } from '../../managers/TenorManager';\r\nimport CategoryPlaceholder from '../placeholders/CategoryPlaceholder';\r\nimport './CategoryList.css';\r\nimport FeaturedCategory from './FeaturedCategory';\r\nimport TrendingCategory from './TrendingCategory';\r\n\r\nexport interface CategoryListProps {\r\n\tcategories?: TenorCategory[];\r\n\ttrending?: TenorImage;\r\n\tcolumnsCount: number;\r\n}\r\n\r\nfunction CategoryList({ categories, trending, columnsCount }: CategoryListProps): JSX.Element {\r\n\t/**\r\n\t * Make sure that last categories row is always full by removing\r\n\t * excess categories so the total count is devisable by column count\r\n\t */\r\n\tfunction getCleanedCategories() {\r\n\t\tif (!categories) return undefined;\r\n\r\n\t\tconst SPECIAL_CATEGORIES_COUNT = 1; // Trending\r\n\t\tconst totalCategoriesCount = categories.length + SPECIAL_CATEGORIES_COUNT;\r\n\t\tconst excessCategoriesCount = totalCategoriesCount % columnsCount;\r\n\r\n\t\tif (excessCategoriesCount == 0) return categories;\r\n\t\treturn categories?.slice(0, -excessCategoriesCount);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<div\r\n\t\t\tclassName=\"gpr-category-list\"\r\n\t\t\tstyle={{ gridTemplateColumns: `repeat(${columnsCount}, 1fr)` }}\r\n\t\t>\r\n\t\t\t{categories && trending ? (\r\n\t\t\t\t<>\r\n\t\t\t\t\t<TrendingCategory image={trending.url} />\r\n\t\t\t\t\t{getCleanedCategories()?.map((cat, i) => (\r\n\t\t\t\t\t\t<FeaturedCategory\r\n\t\t\t\t\t\t\tkey={i}\r\n\t\t\t\t\t\t\timage={cat.image}\r\n\t\t\t\t\t\t\tname={cat.name}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t))}\r\n\t\t\t\t</>\r\n\t\t\t) : (\r\n\t\t\t\t<>\r\n\t\t\t\t\t{[...Array(10 * columnsCount)].map((_, i) => (\r\n\t\t\t\t\t\t<CategoryPlaceholder key={i} />\r\n\t\t\t\t\t))}\r\n\t\t\t\t</>\r\n\t\t\t)}\r\n\t\t</div>\r\n\t);\r\n}\r\n\r\nexport default CategoryList;\r\n","import React, { useContext, useEffect, useState } from 'react';\r\nimport TenorContext from '../../context/TenorContext';\r\nimport { TenorResult } from '../../managers/TenorManager';\r\nimport GifList from './GifList';\r\n\r\nexport interface SearchResultProps {\r\n\tsearchTerm: string;\r\n\tcolumnsCount: number;\r\n}\r\n\r\nfunction SearchResult({ searchTerm, columnsCount }: SearchResultProps) {\r\n\tconst [searchResult, setSearchResult] = useState<TenorResult>(null!);\r\n\tconst [isLoading, setLoading] = useState(true);\r\n\tconst tenor = useContext(TenorContext);\r\n\r\n\tuseEffect(() => {\r\n\t\tsetLoading(true);\r\n\t\tasync function search(): Promise<any> {\r\n\t\t\tconst result = await tenor.search(searchTerm);\r\n\t\t\tsetSearchResult(result);\r\n\t\t\tsetLoading(false);\r\n\t\t}\r\n\t\tconst debounce = setTimeout(() => search(), 800);\r\n\t\treturn (): void => clearTimeout(debounce);\r\n\t}, [searchTerm]);\r\n\r\n\treturn (\r\n\t\t<GifList\r\n\t\t\tisLoading={isLoading}\r\n\t\t\tcolumnsCount={columnsCount}\r\n\t\t\tresult={searchResult}\r\n\t\t\tsearchTerm={searchTerm}\r\n\t\t/>\r\n\t);\r\n}\r\n\r\nexport default SearchResult;\r\n","import styleInject from '#style-inject';styleInject(\".GifPickerReact .gpr-gif-list{display:flex;flex:1;flex-direction:row;gap:var(--gpr-category-list-padding);overflow-y:scroll;padding:var(--gpr-body-padding)}.GifPickerReact .gpr-gif-list-column{display:grid;flex:1;grid-gap:var(--gpr-category-list-padding);grid-auto-rows:min-content;grid-template-columns:1fr;grid-template-rows:auto 1fr}.GifPickerReact .gpr-gif-list-no-result{align-items:center;display:flex;flex:1;justify-content:center;padding-bottom:30%}\\n\")","import styleInject from '#style-inject';styleInject(\".GifPickerReact .gpr-result-placeholder{border-radius:var(--gpr-category-border-radius)}\\n\")","import React, { useEffect, useState } from 'react';\r\nimport Placeholder from './Placeholder';\r\nimport './ResultPlaceholder.css';\r\n\r\nexport interface ResultPlaceholderProps {\r\n\theight: number | string;\r\n\tshowDelay?: number;\r\n}\r\n\r\nfunction ResultPlaceholder({ height, showDelay }: ResultPlaceholderProps) {\r\n\tconst [show, setShow] = useState(false);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (show) return;\r\n\t\tfunction showElement() {\r\n\t\t\tsetShow(true);\r\n\t\t}\r\n\t\tconst timeout = setTimeout(showElement, showDelay);\r\n\t\treturn () => clearTimeout(timeout);\r\n\t}, []);\r\n\r\n\treturn (\r\n\t\t<Placeholder\r\n\t\t\tclassName=\"gpr-result-placeholder\"\r\n\t\t\theight={height}\r\n\t\t\twidth=\"100%\"\r\n\t\t\tstyle={{ opacity: show ? 1 : 0 }}\r\n\t\t/>\r\n\t);\r\n}\r\n\r\nexport default ResultPlaceholder;\r\n","import React from 'react';\r\nimport ResultPlaceholder from '../placeholders/ResultPlaceholder';\r\n\r\nconst PLACEHOLDER_HEIGHTS = [\r\n\t[120, 100, 130, 175, 154, 110],\r\n\t[150, 115, 135, 154, 145, 170],\r\n\t[140, 125, 120, 150, 100, 125],\r\n\t[130, 145, 175, 120, 135, 100],\r\n];\r\n\r\nexport interface GifListPlaceholderProps {\r\n\tcolumnsCount: number;\r\n\tshowDelay?: number;\r\n}\r\n\r\nfunction GifListPlaceholder({ columnsCount, showDelay = 70 }: GifListPlaceholderProps) {\r\n\treturn (\r\n\t\t<div className=\"gpr-gif-list\">\r\n\t\t\t{[...Array(columnsCount)].map((_, i) => (\r\n\t\t\t\t<div\r\n\t\t\t\t\tclassName=\"gpr-gif-list-column\"\r\n\t\t\t\t\tkey={i}\r\n\t\t\t\t>\r\n\t\t\t\t\t{PLACEHOLDER_HEIGHTS[i % PLACEHOLDER_HEIGHTS.length].map((height, j) => (\r\n\t\t\t\t\t\t<ResultPlaceholder\r\n\t\t\t\t\t\t\tkey={j}\r\n\t\t\t\t\t\t\theight={height}\r\n\t\t\t\t\t\t\tshowDelay={(j + 1) * showDelay * columnsCount + showDelay * i}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t))}\r\n\t\t\t\t</div>\r\n\t\t\t))}\r\n\t\t</div>\r\n\t);\r\n}\r\n\r\nexport default GifListPlaceholder;\r\n","import React, { useContext } from 'react';\r\nimport SettingsContext from '../../context/SettingsContext';\r\nimport TenorContext from '../../context/TenorContext';\r\nimport { TenorImage } from '../../types/exposedTypes';\r\nimport './ResultImage.css';\r\n\r\nexport interface ResultImageProps {\r\n\timage: TenorImage;\r\n\tsearchTerm?: string;\r\n}\r\n\r\nfunction ResultImage({ image, searchTerm }: ResultImageProps): JSX.Element {\r\n\tconst settings = useContext(SettingsContext);\r\n\tconst tenor = useContext(TenorContext);\r\n\r\n\tfunction onClick(): void {\r\n\t\tconst func = settings.onGifClick;\r\n\t\tif (func) func(image);\r\n\t\ttenor.registerShare(image, searchTerm);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<button\r\n\t\t\ttype=\"button\"\r\n\t\t\tclassName=\"gpr-btn gpr-result-image\"\r\n\t\t\tonClick={onClick}\r\n\t\t>\r\n\t\t\t<img\r\n\t\t\t\tsrc={image.preview.url}\r\n\t\t\t\theight={image.preview.height}\r\n\t\t\t\twidth={image.preview.width}\r\n\t\t\t\tloading=\"lazy\"\r\n\t\t\t/>\r\n\t\t</button>\r\n\t);\r\n}\r\n\r\nexport default ResultImage;\r\n","import styleInject from '#style-inject';styleInject(\".GifPickerReact .gpr-result-image{border-radius:var(--gpr-category-border-radius);cursor:pointer;transition:box-shadow .15s ease-in-out}.GifPickerReact .gpr-result-image img{background-color:var(--gpr-placeholder-color);border-radius:var(--gpr-category-border-radius);height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.GifPickerReact .gpr-result-image:hover{box-shadow:0 0 0 2px var(--gpr-category-border-color-hover)}\\n\")","import React, { useMemo } from 'react';\r\nimport { TenorResult } from '../../managers/TenorManager';\r\nimport { TenorImage } from '../../types/exposedTypes';\r\nimport './GifList.css';\r\nimport GifListPlaceholder from './GifListPlaceholder';\r\nimport ResultImage from './ResultImage';\r\n\r\nexport interface GifListProps {\r\n\tisLoading: boolean;\r\n\tresult?: TenorResult;\r\n\tsearchTerm?: string;\r\n\tcolumnsCount: number;\r\n}\r\n\r\nfunction GifList({ isLoading, result, searchTerm, columnsCount }: GifListProps): JSX.Element {\r\n\tconst columns = useMemo(() => generateColumns(result, columnsCount), [result, columnsCount]);\r\n\tconst isEmpty = !result || result.images.length <= 0;\r\n\r\n\tif (isLoading) {\r\n\t\treturn <GifListPlaceholder columnsCount={columnsCount} />;\r\n\t}\r\n\r\n\tif (isEmpty) {\r\n\t\treturn (\r\n\t\t\t<div className=\"gpr-gif-list-no-result\">\r\n\t\t\t\t<span>No GIFs found!</span>\r\n\t\t\t</div>\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<div className=\"gpr-gif-list\">\r\n\t\t\t{columns.map((col, i) => (\r\n\t\t\t\t<div\r\n\t\t\t\t\tclassName=\"gpr-gif-list-column\"\r\n\t\t\t\t\tkey={i}\r\n\t\t\t\t>\r\n\t\t\t\t\t{col.map((img) => (\r\n\t\t\t\t\t\t<ResultImage\r\n\t\t\t\t\t\t\tkey={img.id}\r\n\t\t\t\t\t\t\timage={img}\r\n\t\t\t\t\t\t\tsearchTerm={searchTerm}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t))}\r\n\t\t\t\t</div>\r\n\t\t\t))}\r\n\t\t</div>\r\n\t);\r\n}\r\n\r\n/**\r\n * Splits TenorResult into grid of TenorImage with set amount of columns\r\n * Columns should have more or less similar height but don't necessarily need to\r\n * have fixed amount of elements, GIFs don't have uniform heights\r\n *\r\n * @returns array of columns (which are the arrays of TenorImage)\r\n */\r\nfunction generateColumns(result?: TenorResult, columnsCount = 2): TenorImage[][] {\r\n\tif (!result) return [];\r\n\tconst columns: TenorImage[][] = new Array(columnsCount).fill(null).map(() => []);\r\n\tconst columnsHeight = new Array(columnsCount).fill(0);\r\n\r\n\tfor (const img of result.images) {\r\n\t\tconst aspectRatio = img.preview.height / img.preview.width;\r\n\t\t// We want to put image of this loop in shortest column (smallest width)\r\n\t\tconst shortestColumnIndex = columnsHeight.indexOf(Math.min(...columnsHeight));\r\n\t\tcolumns[shortestColumnIndex].push(img);\r\n\t\t// Here we actually add aspect ratio rather than height since design is responsive\r\n\t\tcolumnsHeight[shortestColumnIndex] += aspectRatio;\r\n\t}\r\n\treturn columns;\r\n}\r\n\r\nexport default GifList;\r\n","import React, { useContext, useEffect, useState } from 'react';\r\nimport TenorContext from '../../context/TenorContext';\r\nimport { TenorResult } from '../../managers/TenorManager';\r\nimport GifList from './GifList';\r\n\r\nexport interface TrendingResultProps {\r\n\tcolumnsCount: number;\r\n}\r\n\r\nfunction TrendingResult({ columnsCount }: TrendingResultProps) {\r\n\tconst [trendingResult, setSearchResult] = useState<TenorResult>(null!);\r\n\tconst [isLoading, setLoading] = useState(true);\r\n\r\n\tconst tenor = useContext(TenorContext);\r\n\r\n\tuseEffect(() => {\r\n\t\tsetLoading(true);\r\n\t\t(async () => {\r\n\t\t\tconst result = await tenor.trending();\r\n\t\t\tsetSearchResult(result);\r\n\t\t\tsetLoading(false);\r\n\t\t})();\r\n\t}, []);\r\n\r\n\treturn (\r\n\t\t<GifList\r\n\t\t\tcolumnsCount={columnsCount}\r\n\t\t\tisLoading={isLoading}\r\n\t\t\tresult={trendingResult}\r\n\t\t/>\r\n\t);\r\n}\r\n\r\nexport default TrendingResult;\r\n","import React, { useContext, useEffect, useRef, useState } from 'react';\r\nimport PickerContext from '../../context/PickerContext';\r\nimport TenorContext from '../../context/TenorContext';\r\nimport { TenorCategory } from '../../managers/TenorManager';\r\nimport { TenorImage } from '../../types/exposedTypes';\r\nimport './Body.css';\r\nimport CategoryList from './CategoryList';\r\nimport SearchResult from './SearchResult';\r\nimport TrendingResult from './TrendingResult';\r\n\r\nconst MAX_COLUMN_WIDTH = 170;\r\n\r\nexport interface BodyProps {\r\n\t/**\r\n\t * Width prop is here is for sole purpose of updating the\r\n\t * columns calculations when width prop change\r\n\t */\r\n\twidth?: number | string;\r\n}\r\n\r\nfunction Body({ width }: BodyProps): JSX.Element {\r\n\tconst [categories, setCategories] = useState<TenorCategory[] | undefined>(undefined);\r\n\tconst [trending, setTrending] = useState<TenorImage | undefined>(undefined);\r\n\tconst [pickerContext] = useContext(PickerContext);\r\n\tconst [columnsCount, setColumnsCount] = useState(1);\r\n\tconst tenor = useContext(TenorContext);\r\n\tconst ref = useRef<HTMLDivElement>(null);\r\n\r\n\t/**\r\n\t * Load categories and first trending image for home page\r\n\t */\r\n\tuseEffect(() => {\r\n\t\t(async (): Promise<any> => {\r\n\t\t\tconst categoryList = await tenor.categories();\r\n\t\t\tsetCategories(categoryList);\r\n\t\t\tconst trendingList = await tenor.trending(1);\r\n\t\t\tsetTrending(trendingList.images[0]);\r\n\t\t})();\r\n\t}, []);\r\n\r\n\t/**\r\n\t * Calculate amount of columns to display\r\n\t */\r\n\tuseEffect(() => {\r\n\t\tconst width = ref.current ? ref.current.offsetWidth : 0;\r\n\t\tlet columns = Math.floor(width / MAX_COLUMN_WIDTH);\r\n\t\tif (columns < 1) columns = 1;\r\n\t\tsetColumnsCount(columns);\r\n\t}, [ref.current, width]);\r\n\r\n\treturn (\r\n\t\t<div\r\n\t\t\tclassName=\"gpr-body\"\r\n\t\t\tref={ref}\r\n\t\t>\r\n\t\t\t{((): JSX.Element => {\r\n\t\t\t\tif (pickerContext.showTrending) {\r\n\t\t\t\t\treturn <TrendingResult columnsCount={columnsCount} />;\r\n\t\t\t\t} else if (pickerContext.searchTerm) {\r\n\t\t\t\t\treturn (\r\n\t\t\t\t\t\t<SearchResult\r\n\t\t\t\t\t\t\tcolumnsCount={columnsCount}\r\n\t\t\t\t\t\t\tsearchTerm={pickerContext.searchTerm}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn (\r\n\t\t\t\t\t\t<CategoryList\r\n\t\t\t\t\t\t\tcolumnsCount={columnsCount}\r\n\t\t\t\t\t\t\tcategories={categories}\r\n\t\t\t\t\t\t\ttrending={trending}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t})()}\r\n\t\t</div>\r\n\t);\r\n}\r\n\r\nexport default Body;\r\n","import styleInject from '#style-inject';styleInject(\".GifPickerReact .gpr-header{border-bottom:1px solid var(--gpr-picker-border-color);min-height:0;padding:var(--gpr-header-padding)}\\n\")","import React, { useContext } from 'react';\r\nimport PickerContext from '../../context/PickerContext';\r\nimport SettingsContext from '../../context/SettingsContext';\r\nimport ClearButton from './ClearButton';\r\nimport './Search.css';\r\n\r\nfunction Search(): JSX.Element {\r\n\tconst [pickerContext, setPickerContext] = useContext(PickerContext);\r\n\tconst settings = useContext(SettingsContext);\r\n\r\n\tfunction onChange(event: React.ChangeEvent<HTMLInputElement>): void {\r\n\t\tconst contextCopy = Object.assign({}, pickerContext);\r\n\t\tcontextCopy.searchTerm = event.target.value;\r\n\t\tsetPickerContext(contextCopy);\r\n\t}\r\n\r\n\tfunction onClear(): void {\r\n\t\tconst contextCopy = Object.assign({}, pickerContext);\r\n\t\tcontextCopy.searchTerm = '';\r\n\t\tsetPickerContext(contextCopy);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<div className=\"gpr-search-container\">\r\n\t\t\t<input\r\n\t\t\t\tautoFocus={settings.autoFocusSearch}\r\n\t\t\t\taria-label={'Search Tenor'}\r\n\t\t\t\tplaceholder={'Search Tenor'}\r\n\t\t\t\tclassName=\"gpr-search\"\r\n\t\t\t\tdata-testid=\"gpr-search-input\"\r\n\t\t\t\ttype=\"text\"\r\n\t\t\t\tdir=\"auto\"\r\n\t\t\t\tmaxLength={500}\r\n\t\t\t\tvalue={pickerContext.searchTerm}\r\n\t\t\t\tonChange={onChange}\r\n\t\t\t/>\r\n\t\t\t<div className=\"gpr-icn-search\" />\r\n\t\t\t{pickerContext.searchTerm.length > 0 && <ClearButton onClick={onClear} />}\r\n\t\t</div>\r\n\t);\r\n}\r\n\r\nexport default Search;\r\n","import * as React from 'react';\r\n\r\ninterface PropsProps\r\n\textends React.DetailedHTMLProps<\r\n\t\tReact.ButtonHTMLAttributes<HTMLButtonElement>,\r\n\t\tHTMLButtonElement\r\n\t> {}\r\n\r\nfunction Button(props: PropsProps): JSX.Element {\r\n\treturn (\r\n\t\t<button\r\n\t\t\ttype=\"button\"\r\n\t\t\t{...props}\r\n\t\t\tclassName={'gpr-btn ' + props.className}\r\n\t\t>\r\n\t\t\t{props.children}\r\n\t\t</button>\r\n\t);\r\n}\r\n\r\nexport default Button;\r\n","import styleInject from '#style-inject';styleInject(\".GifPickerReact button.gpr-btn-clear-search{align-items:center;border-radius:50%;display:flex;height:20px;justify-content:end;padding:0;position:absolute;right:var(--gpr-search-bar-inner-padding);top:50%;transform:translateY(-50%);width:20px}.GifPickerReact .gpr-icn-clear-search{background-color:transparent;background-image:url(\\\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='20' height='80'%3E%3Cpath fill='%23868686' d='M6.98 13.59a.53.53 0 0 0 .74 0l2.42-2.42 2.43 2.43a.53.53 0 0 0 .74 0c.21-.21.21-.54 0-.75l-2.43-2.43L13.32 8c.21-.21.21-.54 0-.75a.525.525 0 0 0-.75 0l-2.42 2.42-2.41-2.4a.525.525 0 0 0-.75 0c-.21.21-.21.54 0 .75l2.41 2.41-2.42 2.42c-.21.2-.21.54 0 .74'/%3E%3Cpath fill='%23868686' d='M10.15 18.43c4.41 0 8-3.59 8-8s-3.59-8-8-8-8 3.59-8 8 3.59 8 8 8m0-14.94c3.83 0 6.94 3.11 6.94 6.94s-3.11 6.94-6.94 6.94-6.94-3.11-6.94-6.94 3.12-6.94 6.94-6.94'/%3E%3Cpath fill='%233371B7' d='M6.98 33.59a.53.53 0 0 0 .74 0l2.42-2.42 2.43 2.43a.53.53 0 0 0 .74 0c.21-.21.21-.54 0-.75l-2.43-2.43L13.32 28c.21-.21.21-.54 0-.75a.525.525 0 0 0-.75 0l-2.42 2.42-2.41-2.41a.525.525 0 0 0-.75 0c-.21.21-.21.54 0 .75l2.41 2.41-2.42 2.42c-.21.21-.21.55 0 .75'/%3E%3Cpath fill='%233371B7' d='M10.15 38.43c4.41 0 8-3.59 8-8s-3.59-8-8-8-8 3.59-8 8 3.59 8 8 8m0-14.94c3.83 0 6.94 3.11 6.94 6.94s-3.11 6.94-6.94 6.94-6.94-3.11-6.94-6.94 3.12-6.94 6.94-6.94'/%3E%3Cpath fill='%23C0C0BF' d='M6.98 53.59a.53.53 0 0 0 .74 0l2.42-2.42 2.43 2.43a.53.53 0 0 0 .74 0c.21-.21.21-.54 0-.75l-2.43-2.43L13.32 48c.21-.21.21-.54 0-.75a.525.525 0 0 0-.75 0l-2.42 2.42-2.41-2.41a.525.525 0 0 0-.75 0c-.21.21-.21.54 0 .75l2.41 2.41-2.42 2.42c-.21.21-.21.55 0 .75'/%3E%3Cpath fill='%23C0C0BF' d='M10.15 58.43c4.41 0 8-3.59 8-8s-3.59-8-8-8-8 3.59-8 8 3.59 8 8 8m0-14.94c3.83 0 6.94 3.11 6.94 6.94s-3.11 6.94-6.94 6.94-6.94-3.11-6.94-6.94 3.12-6.94 6.94-6.94'/%3E%3Cpath fill='%236AA9DD' d='M6.98 73.59a.53.53 0 0 0 .74 0l2.42-2.42 2.43 2.43a.53.53 0 0 0 .74 0c.21-.21.21-.54 0-.75l-2.43-2.43L13.32 68c.21-.21.21-.54 0-.75a.525.525 0 0 0-.75 0l-2.42 2.42-2.41-2.41a.525.525 0 0 0-.75 0c-.21.21-.21.54 0 .75l2.41 2.41-2.42 2.42c-.21.21-.21.55 0 .75'/%3E%3Cpath fill='%236AA9DD' d='M10.15 78.43c4.41 0 8-3.59 8-8s-3.59-8-8-8-8 3.59-8 8 3.59 8 8 8m0-14.94c3.83 0 6.94 3.11 6.94 6.94s-3.11 6.94-6.94 6.94-6.94-3.11-6.94-6.94 3.12-6.94 6.94-6.94'/%3E%3C/svg%3E\\\");background-repeat:no-repeat;background-size:20px;height:20px;width:20px}.GifPickerReact .gpr-search-container button.gpr-btn-clear-search:focus .gpr-icn-clear-search,.GifPickerReact button.gpr-btn-clear-search:hover .gpr-icn-clear-search{background-position-y:-20px}.GifPickerReact button.gpr-btn-clear-search:focus,.GifPickerReact button.gpr-btn-clear-search:hover{background:var(--gpr-hover-bg-color)}.GifPickerReact.gpr-dark-theme button.gpr-btn-clear-search .gpr-icn-clear-search{background-position-y:-40px}.GifPickerReact.gpr-dark-theme button.gpr-btn-clear-search:hover .gpr-icn-clear-search{background-position-y:-60px}\\n\")","import React from 'react';\r\nimport Button from '../Button';\r\nimport './ClearButton.css';\r\n\r\nexport interface ClearButtonProps {\r\n\tonClick: React.MouseEventHandler<HTMLButtonElement>;\r\n}\r\n\r\nfunction ClearButton({ onClick }: ClearButtonProps) {\r\n\treturn (\r\n\t\t<Button\r\n\t\t\tclassName=\"gpr-btn-clear-search\"\r\n\t\t\tonClick={onClick}\r\n\t\t>\r\n\t\t\t<div className=\"gpr-icn-clear-search\" />\r\n\t\t</Button>\r\n\t);\r\n}\r\n\r\nexport default ClearButton;\r\n","import styleInject from '#style-inject';styleInject(\".GifPickerReact .gpr-search-container{display:block;flex:1;min-width:0;position:relative}.GifPickerReact .gpr-search-container input.gpr-search{background-color:var(--gpr-search-input-bg-color);border:1px solid var(--gpr-search-input-bg-color);border-radius:var(--gpr-search-input-border-radius);color:var(--gpr-search-input-text-color);height:var(--gpr-search-input-height);outline:none;padding:var(--gpr-search-input-padding);transition:all .2s ease-in-out;width:100%}.GifPickerReact .gpr-search-container .gpr-icn-search{background-image:url(\\\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='20' height='40'%3E%3Cpath fill='%23868686' fill-rule='evenodd' d='M12 8.81c0 2.08-1.68 3.76-3.76 3.76s-3.76-1.68-3.76-3.76 1.68-3.76 3.76-3.76S12 6.73 12 8.81m-.77 3.91c-.83.64-1.87 1.01-2.99 1.01-2.72 0-4.92-2.2-4.92-4.92s2.2-4.92 4.92-4.92 4.92 2.2 4.92 4.92c0 1.13-.38 2.16-1.01 2.99l3.94 3.93c.25.25.25.66 0 .92-.25.25-.66.25-.92 0z' clip-rule='evenodd'/%3E%3Cpath fill='%23C0C0BF' fill-rule='evenodd' d='M12 28.81c0 2.08-1.68 3.76-3.76 3.76s-3.76-1.68-3.76-3.76 1.68-3.76 3.76-3.76S12 26.73 12 28.81m-.77 3.91c-.83.64-1.87 1.01-2.99 1.01-2.72 0-4.92-2.2-4.92-4.92s2.2-4.92 4.92-4.92 4.92 2.2 4.92 4.92c0 1.13-.38 2.16-1.01 2.99l3.94 3.93c.25.25.25.66 0 .92-.25.25-.66.25-.92 0z' clip-rule='evenodd'/%3E%3C/svg%3E\\\");background-position:0 0;background-repeat:no-repeat;background-size:20px;content:\\\"\\\";height:20px;left:var(--gpr-search-bar-inner-padding);position:absolute;top:50%;transform:translateY(-50%);width:20px}.GifPickerReact.gpr-dark-theme .gpr-search-container .gpr-icn-search{background-position-y:-20px}.GifPickerReact .gpr-search-container input.gpr-search::-moz-placeholder{color:var(--gpr-search-input-placeholder-color)}.GifPickerReact .gpr-search-container input.gpr-search::placeholder{color:var(--gpr-search-input-placeholder-color)}.GifPickerReact .gpr-search-container input.gpr-search:focus{background-color:var(--gpr-search-input-bg-color-active);border:1px solid var(--gpr-search-border-color-active)}\\n\")","import React, { useContext } from 'react';\r\nimport PickerContext from '../../context/PickerContext';\r\nimport Button from '../Button';\r\nimport './Title.css';\r\n\r\nexport interface TitleProps {\r\n\tchildren: React.ReactNode;\r\n}\r\n\r\nfunction Title({ children }: TitleProps): JSX.Element {\r\n\tconst [pickerContext, setPickerContext] = useContext(PickerContext);\r\n\r\n\tfunction onClear(): void {\r\n\t\tconst contextCopy = Object.assign({}, pickerContext);\r\n\t\tcontextCopy.showTrending = false;\r\n\t\tsetPickerContext(contextCopy);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<div className=\"gpr-title-container\">\r\n\t\t\t<div className=\"gpr-title\">{children}</div>\r\n\r\n\t\t\t<Button\r\n\t\t\t\tclassName={'gpr-btn-clear-search'}\r\n\t\t\t\tonClick={onClear}\r\n\t\t\t>\r\n\t\t\t\t<div className=\"gpr-icn-clear-search\" />\r\n\t\t\t</Button>\r\n\t\t</div>\r\n\t);\r\n}\r\n\r\nexport default Title;\r\n","import styleInject from '#style-inject';styleInject(\".GifPickerReact .gpr-title-container{display:block;flex:1;min-width:0;position:relative}.GifPickerReact .gpr-title-container .gpr-title{align-items:center;background-color:var(--gpr-search-input-bg-color);border-radius:var(--gpr-search-input-border-radius);color:var(--gpr-search-input-text-color);display:flex;height:var(--gpr-search-input-height);padding:var(--gpr-horizontal-padding);width:100%}\\n\")","import React, { useContext } from 'react';\r\nimport PickerContext from '../../context/PickerContext';\r\nimport './Header.css';\r\nimport Search from './Search';\r\nimport Title from './Title';\r\n\r\nfunction Header(): JSX.Element {\r\n\tconst [pickerContext] = useContext(PickerContext);\r\n\r\n\treturn (\r\n\t\t<div className=\"gpr-header\">\r\n\t\t\t{pickerContext.showTrending ? <Title>Trending GIFs</Title> : <Search />}\r\n\t\t</div>\r\n\t);\r\n}\r\n\r\nexport default Header;\r\n","export enum ContentFilter {\r\n\tHIGH = 'high',\r\n\tMEDIUM = 'medium',\r\n\tLOW = 'low',\r\n\tOFF = 'off',\r\n}\r\nexport enum Theme {\r\n\tLIGHT = 'light',\r\n\tDARK = 'dark',\r\n\tAUTO = 'auto',\r\n}\r\n\r\nexport interface TenorImage {\r\n\tid: string;\r\n\ttenorUrl: string;\r\n\tshortTenorUrl: string;\r\n\tdescription: string;\r\n\tcreatedAt: Date;\r\n\ttags: string[];\r\n\turl: string;\r\n\theight: number;\r\n\twidth: number;\r\n\tpreview: TenorImagePreview;\r\n}\r\n\r\nexport interface TenorImagePreview {\r\n\turl: string;\r\n\theight: number;\r\n\twidth: number;\r\n}\r\n","import React, { useContext } from 'react';\r\nimport SettingsContext from '../context/SettingsContext';\r\nimport { Theme } from '../types/exposedTypes';\r\n\r\nexport interface PickerMainProps {\r\n\tchildren: React.ReactNode;\r\n}\r\n\r\nfunction PickerMain({ children }: PickerMainProps): JSX.Element {\r\n\tconst settings = useContext(SettingsContext);\r\n\r\n\tconst style: React.CSSProperties = {\r\n\t\theight: settings.height,\r\n\t\twidth: settings.width,\r\n\t};\r\n\r\n\treturn (\r\n\t\t<aside\r\n\t\t\tclassName={`GifPickerReact gpr-main ${settings.theme === Theme.DARK ? ' gpr-dark-theme' : ''}`}\r\n\t\t\tstyle={style}\r\n\t\t>\r\n\t\t\t{children}\r\n\t\t</aside>\r\n\t);\r\n}\r\n\r\nexport default PickerMain;\r\n","import styleInject from '#style-inject';styleInject(\".GifPickerReact{color-scheme:light;--gpr-highlight-color:#007aeb;--gpr-hover-bg-color:#f1f8ff;--gpr-focus-bg-color:#e0f0ff;--gpr-text-color:#858585;--gpr-search-input-bg-color:#f6f6f6;--gpr-picker-border-color:#e7e7e7;--gpr-bg-color:#fff;--gpr-horizontal-padding:10px;--gpr-picker-border-radius:8px;--gpr-header-padding:15px var(--gpr-horizontal-padding);--gpr-search-input-bg-color-active:var(--gpr-search-input-bg-color);--gpr-search-input-padding:0 32px;--gpr-search-input-border-radius:8px;--gpr-search-input-height:40px;--gpr-search-input-text-color:var(--gpr-text-color);--gpr-search-input-placeholder-color:var(--gpr-text-color);--gpr-search-bar-inner-padding:var(--gpr-horizontal-padding);--gpr-search-border-color-active:var(--gpr-highlight-color);--gpr-body-padding:var(--gpr-header-padding) 0px;--gpr-category-list-padding:var(--gpr-horizontal-padding);--gpr-category-border-radius:4px;--gpr-category-background-opacity:40%;--gpr-category-font-color:var(--gpr-picker-border-color);--gpr-category-font-size:16px;--gpr-category-font-weight:600;--gpr-category-shadow-opacity:60%;--gpr-category-shadow-opacity-hover:65%;--gpr-category-border-color-hover:var(--gpr-highlight-color);--gpr-placeholder-color:#d3d3d3}.GifPickerReact.gpr-dark-theme{color-scheme:dark;--gpr-dark:#000;--gpr-hover-bg-color:#363636f6;--gpr-focus-bg-color:#474747;--gpr-text-color:silver;--gpr-search-input-bg-color:#3b3b3b;--gpr-picker-border-color:#2b2b2b;--gpr-bg-color:#222;--gpr-category-font-color:#e7e7e7;--gpr-search-input-bg-color-active:var(--gpr-dark);--gpr-placeholder-color:var(--gpr-search-input-bg-color)}.GifPickerReact *{box-sizing:border-box}.GifPickerReact.gpr-main{background-color:var(--gpr-bg-color);border-color:var(--gpr-picker-border-color);border-radius:var(--gpr-picker-border-radius);border-style:solid;border-width:1px;color:var(--gpr-text-color);display:flex;flex-direction:column;position:relative}.GifPickerReact button.gpr-btn{background:none;border:0;cursor:pointer;outline:none;padding:0}\\n\")","import { Dispatch, SetStateAction, useState } from 'react';\r\n\r\nexport interface PickerContextType {\r\n\tsearchTerm: string;\r\n\tshowTrending: boolean;\r\n}\r\n\r\nfunction usePickerContext(\r\n\tinitialSearchTerm: string,\r\n): [PickerContextType, Dispatch<SetStateAction<PickerContextType>>] {\r\n\tconst DEFAULT_SETTINGS: PickerContextType = {\r\n\t\tsearchTerm: initialSearchTerm,\r\n\t\tshowTrending: false,\r\n\t};\r\n\r\n\tconst [pickerContext, setPickerContext] = useState<PickerContextType>(DEFAULT_SETTINGS);\r\n\r\n\treturn [pickerContext, setPickerContext];\r\n}\r\n\r\nexport default usePickerContext;\r\n","import { GifPickerReactProps } from '../GifPickerReact';\r\nimport { ContentFilter, TenorImage, Theme } from '../types/exposedTypes';\r\n\r\n/**\r\n * This is a parsed version of props with filled defaults\r\n */\r\nexport type GifPickerSettings = {\r\n\ttenorApiKey: string;\r\n\tonGifClick?: (gif: TenorImage) => void;\r\n\tautoFocusSearch: boolean;\r\n\tclientKey: string;\r\n\tcountry: string;\r\n\tlocale: string;\r\n\tcontentFilter: ContentFilter;\r\n\theight: string;\r\n\twidth: string;\r\n\tcategoryHeight: string;\r\n\ttheme: Theme;\r\n\tinitialSearchTerm: string;\r\n};\r\n\r\nfunction useSettings(props: GifPickerReactProps): GifPickerSettings {\r\n\tif (!props.tenorApiKey) {\r\n\t\tthrow new Error('tenorApiKey is a required prop that is missing');\r\n\t}\r\n\treturn {\r\n\t\ttenorApiKey: props.tenorApiKey,\r\n\t\tonGifClick: props.onGifClick ?? undefined,\r\n\t\tautoFocusSearch: props.autoFocusSearch ?? true,\r\n\t\tclientKey: props.clientKey ?? 'gif-picker-react',\r\n\t\tcountry: props.country ?? 'US',\r\n\t\tlocale: props.locale ?? 'en_US',\r\n\t\tcontentFilter: props.contentFilter ?? ContentFilter.OFF,\r\n\t\theight: praseDimension(props.height ?? 450),\r\n\t\twidth: praseDimension(props.width ?? 350),\r\n\t\tcategoryHeight: praseDimension(props.categoryHeight ?? 100),\r\n\t\ttheme: getTheme(props.theme),\r\n\t\tinitialSearchTerm: props.initialSearchTerm ?? '',\r\n\t};\r\n}\r\n\r\n/**\r\n * Processed raw dimension as number or string to css property. You can provide\r\n * a number that will be treated as pixel size, or your any accepted css height as string.\r\n * @param dimension raw dimension\r\n * @returns css size string\r\n */\r\nfunction praseDimension(dimension: string | number): string {\r\n\tif (typeof dimension == 'number') {\r\n\t\treturn `${dimension}px`;\r\n\t} else if (typeof dimension == 'string') {\r\n\t\treturn dimension;\r\n\t} else {\r\n\t\tthrow new TypeError('Invalid dimension provided');\r\n\t}\r\n}\r\n\r\n/**\r\n * Check for a theme passed in. If not passed default to Light.\r\n * Otherwise check for auto or return what was passed in.\r\n * @param theme theme to check\r\n * @returns theme to use\r\n */\r\nfunction getTheme(theme?: Theme): Theme {\r\n\tif (theme === Theme.AUTO) {\r\n\t\treturn isSystemDarkTheme() ? Theme.DARK : Theme.LIGHT;\r\n\t} else {\r\n\t\treturn theme ?? Theme.LIGHT;\r\n\t}\r\n}\r\n\r\n/**\r\n * Check for system settings for darkmode\r\n * @returns true if system is using dark theme\r\n */\r\nfunction isSystemDarkTheme(): boolean {\r\n\tif (typeof window === 'undefined') {\r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn !!window.matchMedia('(prefers-color-scheme: dark)').matches;\r\n}\r\n\r\nexport default useSettings;\r\n","import { ContentFilter, TenorImage } from '../types/exposedTypes';\r\n\r\nconst MEDIA_FILTER = 'gif,tinygif';\r\nconst BASE_URL = 'https://tenor.googleapis.com/v2/';\r\n\r\nexport interface TenorCategory {\r\n\timage: string;\r\n\tname: string;\r\n}\r\n\r\nexport interface TenorResult {\r\n\tnext: string;\r\n\timages: TenorImage[];\r\n}\r\n\r\nclass TenorManager {\r\n\tprivate apiKey: string;\r\n\tprivate clientKey: string;\r\n\tprivate country: string;\r\n\tprivate locale: string;\r\n\tprivate contentFilter: ContentFilter;\r\n\r\n\tconstructor(\r\n\t\tapiKey: string,\r\n\t\tclientKey: string,\r\n\t\tcountry: string,\r\n\t\tlocale: string,\r\n\t\tcontentFilter: ContentFilter,\r\n\t) {\r\n\t\tthis.apiKey = apiKey;\r\n\t\tthis.clientKey = clientKey;\r\n\t\tthis.country = country;\r\n\t\tthis.locale = locale;\r\n\t\tthis.contentFilter = contentFilter;\r\n\t}\r\n\r\n\tprivate async callApi(endpoint: string, params?: { [key: string]: any }): Promise<Response> {\r\n\t\tconst urlParams = new URLSearchParams({\r\n\t\t\tkey: this.apiKey,\r\n\t\t\tclient_key: this.clientKey,\r\n\t\t\tcontentfilter: this.contentFilter,\r\n\t\t\tmedia_filter: MEDIA_FILTER,\r\n\t\t\tlocale: this.locale,\r\n\t\t\tcountry: this.country,\r\n\t\t\t...params,\r\n\t\t});\r\n\t\tconst url = BASE_URL + endpoint + '?' + urlParams;\r\n\t\treturn fetch(url)\r\n\t\t\t.then((res) => {\r\n\t\t\t\tif (!res.ok) {\r\n\t\t\t\t\tconsole.error(res);\r\n\t\t\t\t\tconsole.error('[gif-picker-react] Failed to fetch data from Tenor API');\r\n\t\t\t\t}\r\n\t\t\t\treturn res;\r\n\t\t\t})\r\n\t\t\t.then((res) => res.json())\r\n\t\t\t.catch((error) => {\r\n\t\t\t\tconsole.error(error);\r\n\t\t\t\tconsole.error('[gif-picker-react] Failed to fetch data from Tenor API');\r\n\t\t\t});\r\n\t}\r\n\r\n\tprivate praseResult(img: any): TenorImage {\r\n\t\tconst preview = img['media_formats']['tinygif'];\r\n\t\tconst gif = img['media_formats']['gif'];\r\n\r\n\t\treturn {\r\n\t\t\tid: img.id,\r\n\t\t\ttenorUrl: img['itemurl'],\r\n\t\t\tshortTenorUrl: img.url,\r\n\t\t\tdescription: img['content_description'],\r\n\t\t\tcreatedAt: new Date(img.created * 1000),\r\n\t\t\ttags: img.tags,\r\n\t\t\turl: gif.url,\r\n\t\t\twidth: gif.dims[0],\r\n\t\t\theight: gif.dims[1],\r\n\t\t\tpreview: {\r\n\t\t\t\turl: preview.url,\r\n\t\t\t\twidth: preview.dims[0],\r\n\t\t\t\theight: preview.dims[1],\r\n\t\t\t},\r\n\t\t};\r\n\t}\r\n\r\n\tpublic async categories(): Promise<TenorCategory[]> {\r\n\t\treturn this.callApi('categories', {\r\n\t\t\ttype: 'featured',\r\n\t\t}).then((data: any) => {\r\n\t\t\tconst tags = data.tags;\r\n\t\t\treturn tags.map((tag: any) => ({\r\n\t\t\t\tname: tag['searchterm'],\r\n\t\t\t\timage: tag.image,\r\n\t\t\t}));\r\n\t\t});\r\n\t}\r\n\r\n\tpublic async search(term: string, limit = 50): Promise<TenorResult> {\r\n\t\treturn this.callApi('search', {\r\n\t\t\tq: term,\r\n\t\t\tar_range: 'all',\r\n\t\t\tlimit,\r\n\t\t}).then((data: any) => {\r\n\t\t\tconst results = data.results;\r\n\t\t\tconst images = results.map(this.praseResult);\r\n\t\t\treturn {\r\n\t\t\t\tnext: data.next,\r\n\t\t\t\timages: images,\r\n\t\t\t};\r\n\t\t});\r\n\t}\r\n\r\n\tpublic async trending(limit = 50): Promise<TenorResult> {\r\n\t\treturn this.callApi('featured', {\r\n\t\t\tar_range: 'all',\r\n\t\t\tlimit,\r\n\t\t}).then((data: any) => {\r\n\t\t\tconst results = data.results;\r\n\t\t\tconst images = results.map(this.praseResult);\r\n\t\t\treturn {\r\n\t\t\t\tnext: data.next,\r\n\t\t\t\timages: images,\r\n\t\t\t};\r\n\t\t});\r\n\t}\r\n\r\n\tpublic async registerShare(image: TenorImage, searchTerm?: string): Promise<void> {\r\n\t\tconst params: any = { id: image.id };\r\n\t\tif (searchTerm) params['q'] = searchTerm;\r\n\t\tawait this.callApi('registershare', params);\r\n\t\treturn;\r\n\t}\r\n}\r\n\r\nexport default TenorManager;\r\n","import React, { useMemo } from 'react';\r\nimport Body from './components/body/Body';\r\nimport Header from './components/header/Header';\r\nimport PickerMain from './components/PickerMain';\r\nimport PickerContext from './context/PickerContext';\r\nimport SettingsContext from './context/SettingsContext';\r\nimport TenorContext from './context/TenorContext';\r\nimport './GifPickerReact.css';\r\nimport usePickerContext from './hooks/usePickerContext';\r\nimport useSettings from './hooks/useSettings';\r\nimport TenorManager from './managers/TenorManager';\r\nimport { ContentFilter, TenorImage, Theme } from './types/exposedTypes';\r\n\r\nexport interface GifPickerReactProps {\r\n\ttenorApiKey: string;\r\n\tonGifClick?: (gif: TenorImage) => void;\r\n\tautoFocusSearch?: boolean;\r\n\tcontentFilter?: ContentFilter;\r\n\tinitialSearchTerm?: string;\r\n\tclientKey?: string;\r\n\tcountry?: string;\r\n\tlocale?: string;\r\n\twidth?: number | string;\r\n\theight?: number | string;\r\n\tcategoryHeight?: number | string;\r\n\ttheme?: Theme;\r\n}\r\n\r\nfunction GifPickerReact(props: GifPickerReactProps): JSX.Element {\r\n\tconst settings = useSettings(props);\r\n\tconst pickerContext = usePickerContext(settings.initialSearchTerm);\r\n\tconst tenorManager: TenorManager = useMemo(\r\n\t\t() =>\r\n\t\t\tnew TenorManager(\r\n\t\t\t\tsettings.tenorApiKey,\r\n\t\t\t\tsettings.clientKey,\r\n\t\t\t\tsettings.country,\r\n\t\t\t\tsettings.locale,\r\n\t\t\t\tsettings.contentFilter,\r\n\t\t\t),\r\n\t\t[],\r\n\t);\r\n\r\n\treturn (\r\n\t\t<SettingsContext.Provider value={settings}>\r\n\t\t\t<PickerContext.Provider value={pickerContext}>\r\n\t\t\t\t<TenorContext.Provider value={tenorManager}>\r\n\t\t\t\t\t<PickerMain>\r\n\t\t\t\t\t\t<Header />\r\n\t\t\t\t\t\t<Body width={props.width} />\r\n\t\t\t\t\t</PickerMain>\r\n\t\t\t\t</TenorContext.Provider>\r\n\t\t\t</PickerContext.Provider>\r\n\t\t</SettingsContext.Provider>\r\n\t);\r\n}\r\n\r\nexport default GifPickerReact;\r\n","import React from 'react';\r\nimport ErrorBoundary from './components/ErrorBoundary';\r\nimport GifPickerReact, { GifPickerReactProps } from './GifPickerReact';\r\n\r\nexport { ContentFilter, TenorImage, Theme } from './types/exposedTypes';\r\n\r\nexport interface GifPickerProps extends GifPickerReactProps {}\r\n\r\nfunction GifPicker(props: GifPickerProps): JSX.Element {\r\n\treturn (\r\n\t\t<ErrorBoundary>\r\n\t\t\t<GifPickerReact {...props} />\r\n\t\t</ErrorBoundary>\r\n\t);\r\n}\r\n\r\nexport default GifPicker;\r\n"]}