import { Observable , merge } from "rxjs" ; import { configuration } from "~/_" ; import { requestJSON } from "~/browser" ; import { Component , getComponentElement } from "../../_" ; import { IconSearchQuery , mountIconSearchQuery } from "../query" ; import { IconSearchResult , mountIconSearchResult } from "../result" ; /**
 * Icon category
 */ export interface IconCategory { base : string ; data : Record < string , string > ; } /**
 * Icon search index
 */ export interface IconSearchIndex { icons : IconCategory ; emojis : IconCategory ; } /**
 * Icon search
 */ export type IconSearch = IconSearchQuery | IconSearchResult ; param el returns export function mountIconSearch ( el ) { const config = configuration ( ) ; const index$ = requestJSON < IconSearchIndex > ( new URL ( "overrides/assets/javascripts/iconsearch_index.json" , config . base ) ) ; const query = getComponentElement ( "iconsearch-query" , el ) ; const result = getComponentElement ( "iconsearch-result" , el ) ; const query$ = mountIconSearchQuery ( query ) ; const result$ = mountIconSearchResult ( result , { index$ , query$ } ) ; return merge ( query$ , result$ ) ; }