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9E,CAAC;IAvFM,mBAAE,GAAG,kBAAkB,CAAC;IAExB,yBAAQ,GAAG;QAChB,8BAAc,CAAC;YACb,gBAAgB,EAAE,gBAAgB;SACnC,CAAC,CAAC;IACL,CAAC,CAAC;IAEK,wBAAO,GAA6B,EAAE,CAAC;IAgFhD,uBAAC;CAAA,CAzFqC,qBAAS,GAyF9C;AAzFY,4CAAgB;AA2F7B,+BAAc,CAAC,2BAA2B,CAAC,gBAAgB,CAAC,CAAC;;;;;;;;ACvH7D,yC","file":"PreferencesPanel__a32fd127c77e29c02637.js","sourcesContent":["import { Component } from '../Base/Component';\nimport { IComponentBindings } from '../Base/ComponentBindings';\nimport { ComponentOptions } from '../Base/ComponentOptions';\nimport { SettingsEvents } from '../../events/SettingsEvents';\nimport { ISettingsPopulateMenuArgs } from '../Settings/Settings';\nimport { PreferencesPanelEvents } from '../../events/PreferencesPanelEvents';\nimport { Initialization } from '../Base/Initialization';\nimport { l } from '../../strings/Strings';\nimport { $$ } from '../../utils/Dom';\nimport { exportGlobally } from '../../GlobalExports';\nimport { ModalBox as ModalBoxModule } from '../../ExternalModulesShim';\nimport * as _ from 'underscore';\n\nimport 'styling/_PreferencesPanel';\nimport { InitializationEvents } from '../../events/InitializationEvents';\nimport { SVGIcons } from '../../utils/SVGIcons';\n\nexport interface IPreferencesPanelOptions {}\n\n/**\n * The PreferencesPanel component renders a **Preferences** item inside the {@link Settings} component which the end\n * user can click to access a panel from which it is possible to specify certain customization options for the search\n * interface. These customization options are then saved in the browser local storage.\n *\n * This component should be used inside the {@link Settings} component.\n *\n * See also the {@link ResultsFiltersPreferences} and {@link ResultsPreferences} components.\n */\nexport class PreferencesPanel extends Component {\n  static ID = 'PreferencesPanel';\n\n  static doExport = () => {\n    exportGlobally({\n      PreferencesPanel: PreferencesPanel\n    });\n  };\n\n  static options: IPreferencesPanelOptions = {};\n  private modalbox: Coveo.ModalBox.ModalBox;\n  private content: HTMLElement[] = [];\n\n  /**\n   * Creates a new PreferencesPanel.\n   * @param element The HTMLElement on which to instantiate the component.\n   * @param options The options for the PreferencesPanel component.\n   * @param bindings The bindings that the component requires to function normally. If not set, these will be\n   * automatically resolved (with a slower execution time).\n   */\n  constructor(\n    public element: HTMLElement,\n    public options: IPreferencesPanelOptions,\n    bindings?: IComponentBindings,\n    private ModalBox = ModalBoxModule\n  ) {\n    super(element, PreferencesPanel.ID, bindings);\n    this.options = ComponentOptions.initComponentOptions(element, PreferencesPanel, options);\n    this.bind.onRootElement(SettingsEvents.settingsPopulateMenu, (args: ISettingsPopulateMenuArgs) => {\n      args.menuData.push({\n        className: 'coveo-preferences-panel',\n        text: l('Preferences'),\n        onOpen: () => this.open(),\n        onClose: () => this.close(),\n        svgIcon: SVGIcons.icons.dropdownPreferences,\n        svgIconClassName: 'coveo-preferences-panel-svg'\n      });\n    });\n    this.bind.onRootElement(InitializationEvents.afterComponentsInitialization, () => {\n      this.content = $$(this.element).children();\n    });\n  }\n\n  /**\n   * Opens the PreferencesPanel.\n   */\n  public open(): void {\n    if (this.modalbox == null) {\n      let root = $$('div');\n      _.each(this.content, oneChild => {\n        root.append(oneChild);\n      });\n\n      this.modalbox = this.ModalBox.open(root.el, {\n        title: l('Preferences'),\n        validation: () => {\n          this.cleanupOnExit();\n          return true;\n        }\n      });\n    }\n  }\n\n  /**\n   * Closes the PreferencesPanel without saving changes.\n   *\n   * Also triggers the `exitPreferencesWithoutSave` event.\n   */\n  public close(): void {\n    if (this.modalbox) {\n      this.cleanupOnExit();\n      this.modalbox.close();\n      this.modalbox = null;\n    }\n  }\n\n  /**\n   * Saves the changes and executes a new query.\n   *\n   * Also triggers the `savePreferences` event.\n   */\n  public save(): void {\n    $$(this.element).trigger(PreferencesPanelEvents.savePreferences);\n    this.queryController.executeQuery();\n  }\n\n  private cleanupOnExit() {\n    $$(this.element).trigger(PreferencesPanelEvents.exitPreferencesWithoutSave);\n  }\n}\n\nInitialization.registerAutoCreateComponent(PreferencesPanel);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/PreferencesPanel/PreferencesPanel.ts","// removed by extract-text-webpack-plugin\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./sass/_PreferencesPanel.scss\n// module id = 464\n// module chunks = 66 77"],"sourceRoot":""}