"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.workplaceSearchTitle = exports.vectorSearchTitle = exports.searchTitle = exports.searchExperiencesTitle = exports.generateTitle = exports.enterpriseSearchContentTitle = exports.elasticsearchTitle = exports.appSearchTitle = exports.analyticsTitle = exports.aiSearchTitle = void 0;
var _constants = require("../../../../common/constants");
/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License
 * 2.0; you may not use this file except in compliance with the Elastic License
 * 2.0.
 */

/**
 * Generate a document title that generally follows our breadcrumb trails
 * https://github.com/elastic/kibana/blob/main/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.md
 */

/**
 * Given an array of page titles, return a final formatted document title
 * @param pages - e.g., ['Curations', 'some Engine', 'App Search']
 * @returns - e.g., 'Curations - some Engine - App Search'
 */
const generateTitle = pages => pages.join(' - ');

/**
 * Product-specific helpers
 */
exports.generateTitle = generateTitle;
const searchTitle = (page = []) => generateTitle([...page, _constants.SEARCH_PRODUCT_NAME]);
exports.searchTitle = searchTitle;
const analyticsTitle = (page = []) => generateTitle([...page, _constants.ANALYTICS_PLUGIN.NAME]);
exports.analyticsTitle = analyticsTitle;
const elasticsearchTitle = (page = []) => generateTitle([...page, 'Getting started with Elasticsearch']);
exports.elasticsearchTitle = elasticsearchTitle;
const appSearchTitle = (page = []) => generateTitle([...page, _constants.APP_SEARCH_PLUGIN.NAME]);
exports.appSearchTitle = appSearchTitle;
const workplaceSearchTitle = (page = []) => generateTitle([...page, _constants.WORKPLACE_SEARCH_PLUGIN.NAME]);
exports.workplaceSearchTitle = workplaceSearchTitle;
const searchExperiencesTitle = (page = []) => generateTitle([...page, _constants.SEARCH_EXPERIENCES_PLUGIN.NAME]);
exports.searchExperiencesTitle = searchExperiencesTitle;
const aiSearchTitle = (page = []) => generateTitle([...page, _constants.AI_SEARCH_PLUGIN.NAME]);
exports.aiSearchTitle = aiSearchTitle;
const vectorSearchTitle = (page = []) => generateTitle([...page, _constants.VECTOR_SEARCH_PLUGIN.NAME]);
exports.vectorSearchTitle = vectorSearchTitle;
const enterpriseSearchContentTitle = (page = []) => generateTitle([...page, _constants.ENTERPRISE_SEARCH_CONTENT_PLUGIN.NAME]);
exports.enterpriseSearchContentTitle = enterpriseSearchContentTitle;