{"version":3,"sources":["webpack:///./milestones/utils.js","webpack:///./vue_shared/components/filtered_search_bar/tokens/base_token.vue","webpack:///./vue_shared/components/filtered_search_bar/tokens/base_token.vue?9c7d","webpack:///vue_shared/components/filtered_search_bar/tokens/base_token.vue","webpack:///./vue_shared/components/filtered_search_bar/tokens/base_token.vue?71c7","webpack:///./issues/list/queries/milestone.fragment.graphql","webpack:////build/source/node_modules/@gitlab/ui/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-header.js","webpack:////build/source/node_modules/@gitlab/ui/dist/components/base/dropdown/dropdown_section_header.js","webpack:///./issues/list/queries/search_milestones.query.graphql","webpack:///./vue_shared/components/filtered_search_bar/tokens/milestone_token.vue","webpack:///./vue_shared/components/filtered_search_bar/tokens/milestone_token.vue?2369","webpack:///vue_shared/components/filtered_search_bar/tokens/milestone_token.vue","webpack:///./vue_shared/components/filtered_search_bar/tokens/milestone_token.vue?3392"],"names":["sortMilestonesByDueDate","milestoneA","milestoneB","rawDueDateA","due_date","dueDate","rawDueDateB","dueDateA","newDate","dueDateB","expiredA","expired","Date","now","getTime","expiredB","components","GlFilteredSearchToken","GlFilteredSearchSuggestion","GlDropdownDivider","GlDropdownSectionHeader","GlDropdownText","GlLoadingIcon","props","config","type","Object","required","value","active","Boolean","suggestionsLoading","default","suggestions","Array","getActiveTokenValue","Function","data","find","defaultSuggestions","preloadedSuggestions","valueIdentifier","token","id","searchBy","String","undefined","appliedTokens","_getRecentlyUsedSugge","hasFetched","searchKey","selectedTokens","recentSuggestions","recentSuggestionsStorageKey","getRecentlyUsedSuggestions","computed","isRecentSuggestionsEnabled","suggestionsEnabled","suggestionsDisabled","recentTokenIds","map","preloadedTokenIds","activeTokenValue","multiSelectEnabled","isArray","_last","availableDefaultSuggestions","OPERATOR_NOT","OPERATOR_OR","includes","operator","filter","suggestion","FILTERS_NONE_ANY","availableSuggestions","_this","tokenValue","applyMaxSuggestions","showDefaultSuggestions","length","showNoMatchesText","showRecentSuggestions","showPreloadedSuggestions","showAvailableSuggestions","searchTerm","multiSelect","OPERATORS_TO_GROUP","validatedConfig","watch","immediate","handler","_this2","flat","forEach","item","search","$emit","loading","deep","newValue","concat","methods","handleInput","_debounce","startsWith","endsWith","stripQuotes","slice","DEBOUNCE_DELAY","handleTokenValueSelected","selectedValue","index","indexOf","splice","push","setTokenValueToRecentlyUsed","maxSuggestions","component","_vm","this","_c","_self","_g","_b","attrs","on","scopedSlots","_u","key","fn","viewTokenProps","_t","_l","_v","_s","text","_e","__","proxy","$attrs","$listeners","doc","loc","source","definitionRefs","findOperation","name","i","definitions","element","def","refs","Set","collectFragmentReferences","node","kind","add","selectionSet","selections","selection","variableDefinitions","module","exports","operationName","newDoc","hasOwnProperty","opRefs","allRefs","newRefs","refName","size","prevRefs","has","childRef","op","oneQuery","tag","variant","BDropdownHeader","functional","h","_ref","children","role","staticClass","class","ref","__vue_script__","inheritAttrs","__vue_component__","render","_h","$createElement","staticRenderFns","names","BaseToken","milestones","initialMilestones","defaultMilestones","DEFAULT_MILESTONES","namespace","isProject","WORKSPACE_PROJECT","WORKSPACE_GROUP","fetchMilestonesQuery","fetchMilestones","fetchMilestonesBySearchTerm","getActiveMilestone","milestone","getMilestoneTitle","toLowerCase","title","$apollo","query","searchMilestonesQuery","variables","fullPath","then","_data$_this2$namespac","nodes","_this3","response","uniqueData","reduce","acc","current","shouldSkipSort","sort","catch","createAlert","message","finally","inputValue"],"mappings":"mGAAA,kDAaO,SAASA,EAAwBC,EAAYC,GAClD,MAAMC,EAAcF,EAAWG,UAAYH,EAAWI,QAChDC,EAAcJ,EAAWE,UAAYF,EAAWG,QAChDE,EAAWJ,EAAcK,aAAQL,GAAe,KAChDM,EAAWH,EAAcE,aAAQF,GAAe,KAChDI,EAAWT,EAAWU,SAAWC,KAAKC,OAAQN,aAAQ,EAARA,EAAUO,WACxDC,EAAWb,EAAWS,SAAWC,KAAKC,OAAQJ,aAAQ,EAARA,EAAUK,WAG9D,OAAIJ,EAAiB,EACjBK,GAAk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AAM,CAAC,MAAQN,EAAI2F,kBAAkBD,KAAa,CAAC1F,EAAIe,GAAG,WAAWf,EAAIgB,GAAGhB,EAAI2F,kBAAkBD,IAAY,oBAAmB,aAAa1F,EAAIqB,QAAO,GAAOrB,EAAIsB,eAE15B,IGSpB,EACA,KACA,KACA,MAIa,UAAAvB,E","file":"334.89a7446e.chunk.js","sourcesContent":["import { newDate } from '~/lib/utils/datetime_utility';\n\n/**\n * This method is to be used with `Array.prototype.sort` function\n * where array contains milestones with `due_date`/`dueDate` and/or\n * `expired` properties.\n * This method sorts given milestone params based on their expiration\n * status by putting expired milestones at the bottom and upcoming\n * milestones at the top of the list.\n *\n * @param {object} milestoneA\n * @param {object} milestoneB\n */\nexport function sortMilestonesByDueDate(milestoneA, milestoneB) {\n  const rawDueDateA = milestoneA.due_date || milestoneA.dueDate;\n  const rawDueDateB = milestoneB.due_date || milestoneB.dueDate;\n  const dueDateA = rawDueDateA ? newDate(rawDueDateA) : null;\n  const dueDateB = rawDueDateB ? newDate(rawDueDateB) : null;\n  const expiredA = milestoneA.expired || Date.now() > dueDateA?.getTime();\n  const expiredB = milestoneB.expired || Date.now() > dueDateB?.getTime();\n\n  // Move all expired milestones to the bottom.\n  if (expiredA) return 1;\n  if (expiredB) return -1;\n\n  // Move milestones without due dates just above expired milestones.\n  if (!dueDateA) return 1;\n  if (!dueDateB) return -1;\n\n  // Sort by due date in ascending order.\n  return dueDateA - dueDateB;\n}\n","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('gl-filtered-search-token',_vm._g(_vm._b({attrs:{\"config\":_vm.validatedConfig,\"value\":_vm.value,\"active\":_vm.active,\"multi-select-values\":_vm.selectedTokens},on:{\"input\":_vm.handleInput,\"select\":_vm.handleTokenValueSelected},scopedSlots:_vm._u([{key:\"view-token\",fn:function(viewTokenProps){return [_vm._t(\"view-token\",null,{\"viewTokenProps\":/* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ {\n        ...viewTokenProps,\n        activeTokenValue: _vm.activeTokenValue,\n        selectedTokens: _vm.selectedTokens,\n      } /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */})]}},{key:\"view\",fn:function(viewTokenProps){return [_vm._t(\"view\",null,{\"viewTokenProps\":/* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ {\n        ...viewTokenProps,\n        activeTokenValue: _vm.activeTokenValue,\n        selectedTokens: _vm.selectedTokens,\n      } /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */})]}},(_vm.suggestionsEnabled)?{key:\"suggestions\",fn:function(){return [(_vm.showDefaultSuggestions)?[_vm._l((_vm.availableDefaultSuggestions),function(token){return _c('gl-filtered-search-suggestion',{key:token.value,attrs:{\"value\":token.value}},[_vm._v(\"\\n        \"+_vm._s(token.text)+\"\\n      \")])}),_vm._v(\" \"),_c('gl-dropdown-divider')]:_vm._e(),_vm._v(\" \"),(_vm.showRecentSuggestions)?[_c('gl-dropdown-section-header',[_vm._v(_vm._s(_vm.__('Recently used')))]),_vm._v(\" \"),_vm._t(\"suggestions-list\",null,{\"suggestions\":_vm.recentSuggestions,\"selections\":_vm.selectedTokens}),_vm._v(\" \"),_c('gl-dropdown-divider')]:_vm._e(),_vm._v(\" \"),(_vm.showPreloadedSuggestions)?_vm._t(\"suggestions-list\",null,{\"suggestions\":_vm.preloadedSuggestions,\"selections\":_vm.selectedTokens}):_vm._e(),_vm._v(\" \"),(_vm.suggestionsLoading)?_c('gl-loading-icon',{attrs:{\"size\":\"sm\"}}):(_vm.showAvailableSuggestions)?[_vm._t(\"suggestions-list\",null,{\"suggestions\":_vm.availableSuggestions,\"selections\":_vm.selectedTokens})]:(_vm.showNoMatchesText)?_c('gl-dropdown-text',[_vm._v(\"\\n      \"+_vm._s(_vm.__('No matches found'))+\"\\n    \")]):(_vm.hasFetched)?_c('gl-dropdown-text',[_vm._v(_vm._s(_vm.__('No suggestions found')))]):_vm._e(),_vm._v(\" \"),_vm._t(\"footer\")]},proxy:true}:null],null,true)},'gl-filtered-search-token',_vm.$attrs,false),_vm.$listeners))\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import mod from \"-!../../../../../../../node_modules/thread-loader/dist/cjs.js??ref--13-0!../../../../../../../node_modules/babel-loader/lib/index.js??ref--13-1!../../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./base_token.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../../../../../node_modules/thread-loader/dist/cjs.js??ref--13-0!../../../../../../../node_modules/babel-loader/lib/index.js??ref--13-1!../../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./base_token.vue?vue&type=script&lang=js\"","<script>\nimport {\n  GlFilteredSearchToken,\n  GlFilteredSearchSuggestion,\n  GlDropdownDivider,\n  GlDropdownSectionHeader,\n  GlDropdownText,\n  GlLoadingIcon,\n} from '@gitlab/ui';\nimport { debounce, last } from 'lodash';\n\nimport { stripQuotes } from '~/lib/utils/text_utility';\nimport {\n  DEBOUNCE_DELAY,\n  FILTERS_NONE_ANY,\n  OPERATOR_NOT,\n  OPERATOR_OR,\n  OPERATORS_TO_GROUP,\n} from '../constants';\nimport { getRecentlyUsedSuggestions, setTokenValueToRecentlyUsed } from '../filtered_search_utils';\n\nexport default {\n  components: {\n    GlFilteredSearchToken,\n    GlFilteredSearchSuggestion,\n    GlDropdownDivider,\n    GlDropdownSectionHeader,\n    GlDropdownText,\n    GlLoadingIcon,\n  },\n  props: {\n    config: {\n      type: Object,\n      required: true,\n    },\n    value: {\n      type: Object,\n      required: true,\n    },\n    active: {\n      type: Boolean,\n      required: true,\n    },\n    suggestionsLoading: {\n      type: Boolean,\n      required: false,\n      default: false,\n    },\n    suggestions: {\n      type: Array,\n      required: false,\n      default: () => [],\n    },\n    getActiveTokenValue: {\n      type: Function,\n      required: false,\n      default: (suggestions, data) => suggestions.find(({ value }) => value === data),\n    },\n    defaultSuggestions: {\n      type: Array,\n      required: false,\n      default: () => [],\n    },\n    preloadedSuggestions: {\n      type: Array,\n      required: false,\n      default: () => [],\n    },\n    valueIdentifier: {\n      type: Function,\n      required: false,\n      default: (token) => token.id,\n    },\n    searchBy: {\n      type: String,\n      required: false,\n      default: undefined,\n    },\n    appliedTokens: {\n      type: Array,\n      required: false,\n      default: () => [],\n    },\n  },\n  data() {\n    return {\n      hasFetched: false, // use this to avoid flash of `No suggestions found` before fetching\n      searchKey: '',\n      selectedTokens: [],\n      recentSuggestions: this.config.recentSuggestionsStorageKey\n        ? getRecentlyUsedSuggestions(\n            this.config.recentSuggestionsStorageKey,\n            this.appliedTokens,\n            this.valueIdentifier,\n          ) ?? []\n        : [],\n    };\n  },\n  computed: {\n    isRecentSuggestionsEnabled() {\n      return Boolean(this.config.recentSuggestionsStorageKey);\n    },\n    suggestionsEnabled() {\n      return !this.config.suggestionsDisabled;\n    },\n    recentTokenIds() {\n      return this.recentSuggestions.map(this.valueIdentifier);\n    },\n    preloadedTokenIds() {\n      return this.preloadedSuggestions.map(this.valueIdentifier);\n    },\n    activeTokenValue() {\n      const data =\n        this.multiSelectEnabled && Array.isArray(this.value.data)\n          ? last(this.value.data)\n          : this.value.data;\n      return this.getActiveTokenValue(this.suggestions, data);\n    },\n    availableDefaultSuggestions() {\n      if ([OPERATOR_NOT, OPERATOR_OR].includes(this.value.operator)) {\n        return this.defaultSuggestions.filter(\n          (suggestion) => !FILTERS_NONE_ANY.includes(suggestion.value),\n        );\n      }\n      return this.defaultSuggestions;\n    },\n    /**\n     * Return all the suggestions when searchKey is present\n     * otherwise return only the suggestions which aren't\n     * present in \"Recently used\"\n     */\n    availableSuggestions() {\n      const suggestions = this.searchKey\n        ? this.suggestions\n        : this.suggestions.filter(\n            (tokenValue) =>\n              !this.recentTokenIds.includes(this.valueIdentifier(tokenValue)) &&\n              !this.preloadedTokenIds.includes(this.valueIdentifier(tokenValue)),\n          );\n\n      return this.applyMaxSuggestions(suggestions);\n    },\n    showDefaultSuggestions() {\n      return this.availableDefaultSuggestions.length > 0;\n    },\n    showNoMatchesText() {\n      return this.searchKey && !this.availableSuggestions.length;\n    },\n    showRecentSuggestions() {\n      return (\n        this.isRecentSuggestionsEnabled && this.recentSuggestions.length > 0 && !this.searchKey\n      );\n    },\n    showPreloadedSuggestions() {\n      return this.preloadedSuggestions.length > 0 && !this.searchKey;\n    },\n    showAvailableSuggestions() {\n      return this.availableSuggestions.length > 0;\n    },\n    searchTerm() {\n      return this.searchBy && this.activeTokenValue\n        ? this.activeTokenValue[this.searchBy]\n        : undefined;\n    },\n    multiSelectEnabled() {\n      return this.config.multiSelect && OPERATORS_TO_GROUP.includes(this.value.operator);\n    },\n    validatedConfig() {\n      if (this.config.multiSelect && !this.multiSelectEnabled) {\n        return {\n          ...this.config,\n          multiSelect: false,\n        };\n      }\n      return this.config;\n    },\n  },\n  watch: {\n    active: {\n      immediate: true,\n      handler(active) {\n        if (!active && !this.suggestions.length) {\n          // data could be a string or an array of strings\n          const selectedItems = [this.value.data].flat();\n          selectedItems.forEach((item) => {\n            const search = this.searchTerm ? this.searchTerm : item;\n            this.$emit('fetch-suggestions', search);\n          });\n        }\n      },\n    },\n    suggestionsLoading: {\n      handler(loading) {\n        if (loading) {\n          this.hasFetched = true;\n        }\n      },\n    },\n    value: {\n      deep: true,\n      immediate: true,\n      handler(newValue) {\n        const { data } = newValue;\n\n        if (!this.multiSelectEnabled) {\n          return;\n        }\n\n        // don't add empty values to selectedUsernames\n        if (!data) {\n          return;\n        }\n\n        if (Array.isArray(data)) {\n          this.selectedTokens = data;\n          // !active so we don't add strings while searching, e.g. r, ro, roo\n          // !includes so we don't add the same usernames (if @input is emitted twice)\n        } else if (!this.active && !this.selectedTokens.includes(data)) {\n          this.selectedTokens = this.selectedTokens.concat(data);\n        }\n      },\n    },\n  },\n  methods: {\n    handleInput: debounce(function debouncedSearch({ data, operator }) {\n      // in multiSelect mode, data could be an array\n      if (Array.isArray(data)) return;\n\n      // Prevent fetching suggestions when data or operator is not present\n      if (data || operator) {\n        this.searchKey = data;\n\n        if (!this.activeTokenValue) {\n          let search = this.searchTerm ? this.searchTerm : data;\n\n          if (search.startsWith('\"') && search.endsWith('\"')) {\n            search = stripQuotes(search);\n          } else if (search.startsWith('\"')) {\n            search = search.slice(1, search.length);\n          }\n\n          this.$emit('fetch-suggestions', search);\n        }\n      }\n    }, DEBOUNCE_DELAY),\n    handleTokenValueSelected(selectedValue) {\n      if (this.multiSelectEnabled) {\n        const index = this.selectedTokens.indexOf(selectedValue);\n        if (index > -1) {\n          this.selectedTokens.splice(index, 1);\n        } else {\n          this.selectedTokens.push(selectedValue);\n        }\n\n        // need to clear search\n        this.$emit('input', { ...this.value, data: '' });\n      }\n\n      const activeTokenValue = this.getActiveTokenValue(this.suggestions, selectedValue);\n      // Make sure that;\n      // 1. Recently used values feature is enabled\n      // 2. User has actually selected a value\n      // 3. Selected value is not part of preloaded list.\n      if (\n        this.isRecentSuggestionsEnabled &&\n        activeTokenValue &&\n        !this.preloadedTokenIds.includes(this.valueIdentifier(activeTokenValue))\n      ) {\n        setTokenValueToRecentlyUsed(this.config.recentSuggestionsStorageKey, activeTokenValue);\n      }\n    },\n    applyMaxSuggestions(suggestions) {\n      const { maxSuggestions } = this.config;\n      if (!maxSuggestions || maxSuggestions <= 0) return suggestions;\n\n      return suggestions.slice(0, maxSuggestions);\n    },\n  },\n};\n</script>\n\n<template>\n  <gl-filtered-search-token\n    :config=\"validatedConfig\"\n    :value=\"value\"\n    :active=\"active\"\n    :multi-select-values=\"selectedTokens\"\n    v-bind=\"$attrs\"\n    v-on=\"$listeners\"\n    @input=\"handleInput\"\n    @select=\"handleTokenValueSelected\"\n  >\n    <template #view-token=\"viewTokenProps\">\n      <slot\n        name=\"view-token\"\n        :view-token-props=\"/* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ {\n          ...viewTokenProps,\n          activeTokenValue,\n          selectedTokens,\n        } /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */\"\n      ></slot>\n    </template>\n    <template #view=\"viewTokenProps\">\n      <slot\n        name=\"view\"\n        :view-token-props=\"/* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ {\n          ...viewTokenProps,\n          activeTokenValue,\n          selectedTokens,\n        } /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */\"\n      ></slot>\n    </template>\n    <template v-if=\"suggestionsEnabled\" #suggestions>\n      <template v-if=\"showDefaultSuggestions\">\n        <gl-filtered-search-suggestion\n          v-for=\"token in availableDefaultSuggestions\"\n          :key=\"token.value\"\n          :value=\"token.value\"\n        >\n          {{ token.text }}\n        </gl-filtered-search-suggestion>\n        <gl-dropdown-divider />\n      </template>\n      <template v-if=\"showRecentSuggestions\">\n        <gl-dropdown-section-header>{{ __('Recently used') }}</gl-dropdown-section-header>\n        <slot\n          name=\"suggestions-list\"\n          :suggestions=\"recentSuggestions\"\n          :selections=\"selectedTokens\"\n        ></slot>\n        <gl-dropdown-divider />\n      </template>\n      <slot\n        v-if=\"showPreloadedSuggestions\"\n        name=\"suggestions-list\"\n        :suggestions=\"preloadedSuggestions\"\n        :selections=\"selectedTokens\"\n      ></slot>\n      <gl-loading-icon v-if=\"suggestionsLoading\" size=\"sm\" />\n      <template v-else-if=\"showAvailableSuggestions\">\n        <slot\n          name=\"suggestions-list\"\n          :suggestions=\"availableSuggestions\"\n          :selections=\"selectedTokens\"\n        ></slot>\n      </template>\n      <gl-dropdown-text v-else-if=\"showNoMatchesText\">\n        {{ __('No matches found') }}\n      </gl-dropdown-text>\n      <gl-dropdown-text v-else-if=\"hasFetched\">{{ __('No suggestions found') }}</gl-dropdown-text>\n      <slot name=\"footer\"></slot>\n    </template>\n  </gl-filtered-search-token>\n</template>\n","import { render, staticRenderFns } from \"./base_token.vue?vue&type=template&id=bd574ef6\"\nimport script from \"./base_token.vue?vue&type=script&lang=js\"\nexport * from \"./base_token.vue?vue&type=script&lang=js\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\nexport default component.exports","\n    var doc = {\"kind\":\"Document\",\"definitions\":[{\"kind\":\"FragmentDefinition\",\"name\":{\"kind\":\"Name\",\"value\":\"Milestone\"},\"typeCondition\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"Milestone\"}},\"directives\":[],\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"id\"},\"arguments\":[],\"directives\":[]},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"title\"},\"arguments\":[],\"directives\":[]}]}}],\"loc\":{\"start\":0,\"end\":49}};\n    doc.loc.source = {\"body\":\"fragment Milestone on Milestone {\\n  id\\n  title\\n}\\n\",\"name\":\"GraphQL request\",\"locationOffset\":{\"line\":1,\"column\":1}};\n  \n\n    var names = {};\n    function unique(defs) {\n      return defs.filter(\n        function(def) {\n          if (def.kind !== 'FragmentDefinition') return true;\n          var name = def.name.value\n          if (names[name]) {\n            return false;\n          } else {\n            names[name] = true;\n            return true;\n          }\n        }\n      )\n    }\n  \n\n    // Collect any fragment/type references from a node, adding them to the refs Set\n    function collectFragmentReferences(node, refs) {\n      if (node.kind === \"FragmentSpread\") {\n        refs.add(node.name.value);\n      } else if (node.kind === \"VariableDefinition\") {\n        var type = node.type;\n        if (type.kind === \"NamedType\") {\n          refs.add(type.name.value);\n        }\n      }\n\n      if (node.selectionSet) {\n        node.selectionSet.selections.forEach(function(selection) {\n          collectFragmentReferences(selection, refs);\n        });\n      }\n\n      if (node.variableDefinitions) {\n        node.variableDefinitions.forEach(function(def) {\n          collectFragmentReferences(def, refs);\n        });\n      }\n\n      if (node.definitions) {\n        node.definitions.forEach(function(def) {\n          collectFragmentReferences(def, refs);\n        });\n      }\n    }\n\n    var definitionRefs = {};\n    (function extractReferences() {\n      doc.definitions.forEach(function(def) {\n        if (def.name) {\n          var refs = new Set();\n          collectFragmentReferences(def, refs);\n          definitionRefs[def.name.value] = refs;\n        }\n      });\n    })();\n\n    function findOperation(doc, name) {\n      for (var i = 0; i < doc.definitions.length; i++) {\n        var element = doc.definitions[i];\n        if (element.name && element.name.value == name) {\n          return element;\n        }\n      }\n    }\n\n    function oneQuery(doc, operationName) {\n      // Copy the DocumentNode, but clear out the definitions\n      var newDoc = {\n        kind: doc.kind,\n        definitions: [findOperation(doc, operationName)]\n      };\n      if (doc.hasOwnProperty(\"loc\")) {\n        newDoc.loc = doc.loc;\n      }\n\n      // Now, for the operation we're running, find any fragments referenced by\n      // it or the fragments it references\n      var opRefs = definitionRefs[operationName] || new Set();\n      var allRefs = new Set();\n      var newRefs = new Set();\n\n      // IE 11 doesn't support \"new Set(iterable)\", so we add the members of opRefs to newRefs one by one\n      opRefs.forEach(function(refName) {\n        newRefs.add(refName);\n      });\n\n      while (newRefs.size > 0) {\n        var prevRefs = newRefs;\n        newRefs = new Set();\n\n        prevRefs.forEach(function(refName) {\n          if (!allRefs.has(refName)) {\n            allRefs.add(refName);\n            var childRefs = definitionRefs[refName] || new Set();\n            childRefs.forEach(function(childRef) {\n              newRefs.add(childRef);\n            });\n          }\n        });\n      }\n\n      allRefs.forEach(function(refName) {\n        var op = findOperation(doc, refName);\n        if (op) {\n          newDoc.definitions.push(op);\n        }\n      });\n\n      return newDoc;\n    }\n    \n    module.exports = doc;\n    \n        module.exports[\"Milestone\"] = oneQuery(doc, \"Milestone\");\n        \n","import { extend, mergeData } from '../../vue';\nimport { NAME_DROPDOWN_HEADER } from '../../constants/components';\nimport { PROP_TYPE_STRING } from '../../constants/props';\nimport { isTag } from '../../utils/dom';\nimport { omit } from '../../utils/object';\nimport { makePropsConfigurable, makeProp } from '../../utils/props';\n\n// --- Props ---\n\nconst props = makePropsConfigurable({\n  id: makeProp(PROP_TYPE_STRING),\n  tag: makeProp(PROP_TYPE_STRING, 'header'),\n  variant: makeProp(PROP_TYPE_STRING)\n}, NAME_DROPDOWN_HEADER);\n\n// --- Main component ---\n\n// @vue/component\nconst BDropdownHeader = /*#__PURE__*/extend({\n  name: NAME_DROPDOWN_HEADER,\n  functional: true,\n  props,\n  render(h, _ref) {\n    let {\n      props,\n      data,\n      children\n    } = _ref;\n    const {\n      tag,\n      variant\n    } = props;\n    return h('li', mergeData(omit(data, ['attrs']), {\n      attrs: {\n        role: 'presentation'\n      }\n    }), [h(tag, {\n      staticClass: 'dropdown-header',\n      class: {\n        [`text-${variant}`]: variant\n      },\n      attrs: {\n        ...(data.attrs || {}),\n        id: props.id || null,\n        role: isTag(tag, 'header') ? null : 'heading'\n      },\n      ref: 'header'\n    }, children)]);\n  }\n});\n\nexport { BDropdownHeader, props };\n","import { BDropdownHeader } from '../../../vendor/bootstrap-vue/src/components/dropdown/dropdown-header';\nimport __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';\n\nvar script = {\n  name: 'GlDropdownHeader',\n  components: {\n    BDropdownHeader\n  },\n  inheritAttrs: false\n};\n\n/* script */\nconst __vue_script__ = script;\n\n/* template */\nvar __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-dropdown-header',_vm._g(_vm._b({staticClass:\"gl-dropdown-section-header\"},'b-dropdown-header',_vm.$attrs,false),_vm.$listeners),[_vm._t(\"default\")],2)};\nvar __vue_staticRenderFns__ = [];\n\n  /* style */\n  const __vue_inject_styles__ = undefined;\n  /* scoped */\n  const __vue_scope_id__ = undefined;\n  /* module identifier */\n  const __vue_module_identifier__ = undefined;\n  /* functional template */\n  const __vue_is_functional_template__ = false;\n  /* style inject */\n  \n  /* style inject SSR */\n  \n  /* style inject shadow dom */\n  \n\n  \n  const __vue_component__ = __vue_normalize__(\n    { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },\n    __vue_inject_styles__,\n    __vue_script__,\n    __vue_scope_id__,\n    __vue_is_functional_template__,\n    __vue_module_identifier__,\n    false,\n    undefined,\n    undefined,\n    undefined\n  );\n\nexport default __vue_component__;\n","\n    var doc = {\"kind\":\"Document\",\"definitions\":[{\"kind\":\"OperationDefinition\",\"operation\":\"query\",\"name\":{\"kind\":\"Name\",\"value\":\"searchMilestones\"},\"variableDefinitions\":[{\"kind\":\"VariableDefinition\",\"variable\":{\"kind\":\"Variable\",\"name\":{\"kind\":\"Name\",\"value\":\"fullPath\"}},\"type\":{\"kind\":\"NonNullType\",\"type\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"ID\"}}},\"directives\":[]},{\"kind\":\"VariableDefinition\",\"variable\":{\"kind\":\"Variable\",\"name\":{\"kind\":\"Name\",\"value\":\"search\"}},\"type\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"String\"}},\"directives\":[]},{\"kind\":\"VariableDefinition\",\"variable\":{\"kind\":\"Variable\",\"name\":{\"kind\":\"Name\",\"value\":\"isProject\"}},\"type\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"Boolean\"}},\"defaultValue\":{\"kind\":\"BooleanValue\",\"value\":false},\"directives\":[]},{\"kind\":\"VariableDefinition\",\"variable\":{\"kind\":\"Variable\",\"name\":{\"kind\":\"Name\",\"value\":\"state\"}},\"type\":{\"kind\":\"NamedType\",\"name\":{\"kind\":\"Name\",\"value\":\"MilestoneStateEnum\"}},\"directives\":[]}],\"directives\":[],\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"group\"},\"arguments\":[{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"fullPath\"},\"value\":{\"kind\":\"Variable\",\"name\":{\"kind\":\"Name\",\"value\":\"fullPath\"}}}],\"directives\":[{\"kind\":\"Directive\",\"name\":{\"kind\":\"Name\",\"value\":\"skip\"},\"arguments\":[{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"if\"},\"value\":{\"kind\":\"Variable\",\"name\":{\"kind\":\"Name\",\"value\":\"isProject\"}}}]}],\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"id\"},\"arguments\":[],\"directives\":[]},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"milestones\"},\"arguments\":[{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"searchTitle\"},\"value\":{\"kind\":\"Variable\",\"name\":{\"kind\":\"Name\",\"value\":\"search\"}}},{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"includeAncestors\"},\"value\":{\"kind\":\"BooleanValue\",\"value\":true}},{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"includeDescendants\"},\"value\":{\"kind\":\"BooleanValue\",\"value\":true}},{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"sort\"},\"value\":{\"kind\":\"EnumValue\",\"value\":\"EXPIRED_LAST_DUE_DATE_ASC\"}},{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"state\"},\"value\":{\"kind\":\"Variable\",\"name\":{\"kind\":\"Name\",\"value\":\"state\"}}}],\"directives\":[],\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"nodes\"},\"arguments\":[],\"directives\":[],\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"FragmentSpread\",\"name\":{\"kind\":\"Name\",\"value\":\"Milestone\"},\"directives\":[]}]}}]}}]}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"project\"},\"arguments\":[{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"fullPath\"},\"value\":{\"kind\":\"Variable\",\"name\":{\"kind\":\"Name\",\"value\":\"fullPath\"}}}],\"directives\":[{\"kind\":\"Directive\",\"name\":{\"kind\":\"Name\",\"value\":\"include\"},\"arguments\":[{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"if\"},\"value\":{\"kind\":\"Variable\",\"name\":{\"kind\":\"Name\",\"value\":\"isProject\"}}}]}],\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"id\"},\"arguments\":[],\"directives\":[]},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"milestones\"},\"arguments\":[{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"searchTitle\"},\"value\":{\"kind\":\"Variable\",\"name\":{\"kind\":\"Name\",\"value\":\"search\"}}},{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"includeAncestors\"},\"value\":{\"kind\":\"BooleanValue\",\"value\":true}},{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"sort\"},\"value\":{\"kind\":\"EnumValue\",\"value\":\"EXPIRED_LAST_DUE_DATE_ASC\"}},{\"kind\":\"Argument\",\"name\":{\"kind\":\"Name\",\"value\":\"state\"},\"value\":{\"kind\":\"Variable\",\"name\":{\"kind\":\"Name\",\"value\":\"state\"}}}],\"directives\":[],\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"nodes\"},\"arguments\":[],\"directives\":[],\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"FragmentSpread\",\"name\":{\"kind\":\"Name\",\"value\":\"Milestone\"},\"directives\":[]}]}}]}}]}}]}}],\"loc\":{\"start\":0,\"end\":702}};\n    doc.loc.source = {\"body\":\"#import \\\"./milestone.fragment.graphql\\\"\\n\\nquery searchMilestones(\\n  $fullPath: ID!\\n  $search: String\\n  $isProject: Boolean = false\\n  $state: MilestoneStateEnum\\n) {\\n  group(fullPath: $fullPath) @skip(if: $isProject) {\\n    id\\n    milestones(\\n      searchTitle: $search\\n      includeAncestors: true\\n      includeDescendants: true\\n      sort: EXPIRED_LAST_DUE_DATE_ASC\\n      state: $state\\n    ) {\\n      nodes {\\n        ...Milestone\\n      }\\n    }\\n  }\\n  project(fullPath: $fullPath) @include(if: $isProject) {\\n    id\\n    milestones(\\n      searchTitle: $search\\n      includeAncestors: true\\n      sort: EXPIRED_LAST_DUE_DATE_ASC\\n      state: $state\\n    ) {\\n      nodes {\\n        ...Milestone\\n      }\\n    }\\n  }\\n}\\n\",\"name\":\"GraphQL request\",\"locationOffset\":{\"line\":1,\"column\":1}};\n  \n\n    var names = {};\n    function unique(defs) {\n      return defs.filter(\n        function(def) {\n          if (def.kind !== 'FragmentDefinition') return true;\n          var name = def.name.value\n          if (names[name]) {\n            return false;\n          } else {\n            names[name] = true;\n            return true;\n          }\n        }\n      )\n    }\n  doc.definitions = doc.definitions.concat(unique(require(\"./milestone.fragment.graphql\").definitions));\n\n\n    // Collect any fragment/type references from a node, adding them to the refs Set\n    function collectFragmentReferences(node, refs) {\n      if (node.kind === \"FragmentSpread\") {\n        refs.add(node.name.value);\n      } else if (node.kind === \"VariableDefinition\") {\n        var type = node.type;\n        if (type.kind === \"NamedType\") {\n          refs.add(type.name.value);\n        }\n      }\n\n      if (node.selectionSet) {\n        node.selectionSet.selections.forEach(function(selection) {\n          collectFragmentReferences(selection, refs);\n        });\n      }\n\n      if (node.variableDefinitions) {\n        node.variableDefinitions.forEach(function(def) {\n          collectFragmentReferences(def, refs);\n        });\n      }\n\n      if (node.definitions) {\n        node.definitions.forEach(function(def) {\n          collectFragmentReferences(def, refs);\n        });\n      }\n    }\n\n    var definitionRefs = {};\n    (function extractReferences() {\n      doc.definitions.forEach(function(def) {\n        if (def.name) {\n          var refs = new Set();\n          collectFragmentReferences(def, refs);\n          definitionRefs[def.name.value] = refs;\n        }\n      });\n    })();\n\n    function findOperation(doc, name) {\n      for (var i = 0; i < doc.definitions.length; i++) {\n        var element = doc.definitions[i];\n        if (element.name && element.name.value == name) {\n          return element;\n        }\n      }\n    }\n\n    function oneQuery(doc, operationName) {\n      // Copy the DocumentNode, but clear out the definitions\n      var newDoc = {\n        kind: doc.kind,\n        definitions: [findOperation(doc, operationName)]\n      };\n      if (doc.hasOwnProperty(\"loc\")) {\n        newDoc.loc = doc.loc;\n      }\n\n      // Now, for the operation we're running, find any fragments referenced by\n      // it or the fragments it references\n      var opRefs = definitionRefs[operationName] || new Set();\n      var allRefs = new Set();\n      var newRefs = new Set();\n\n      // IE 11 doesn't support \"new Set(iterable)\", so we add the members of opRefs to newRefs one by one\n      opRefs.forEach(function(refName) {\n        newRefs.add(refName);\n      });\n\n      while (newRefs.size > 0) {\n        var prevRefs = newRefs;\n        newRefs = new Set();\n\n        prevRefs.forEach(function(refName) {\n          if (!allRefs.has(refName)) {\n            allRefs.add(refName);\n            var childRefs = definitionRefs[refName] || new Set();\n            childRefs.forEach(function(childRef) {\n              newRefs.add(childRef);\n            });\n          }\n        });\n      }\n\n      allRefs.forEach(function(refName) {\n        var op = findOperation(doc, refName);\n        if (op) {\n          newDoc.definitions.push(op);\n        }\n      });\n\n      return newDoc;\n    }\n    \n    module.exports = doc;\n    \n        module.exports[\"searchMilestones\"] = oneQuery(doc, \"searchMilestones\");\n        \n","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('base-token',_vm._g(_vm._b({attrs:{\"active\":_vm.active,\"config\":_vm.config,\"value\":_vm.value,\"default-suggestions\":_vm.defaultMilestones,\"suggestions\":_vm.milestones,\"suggestions-loading\":_vm.loading,\"get-active-token-value\":_vm.getActiveMilestone,\"value-identifier\":_vm.getMilestoneTitle},on:{\"fetch-suggestions\":_vm.fetchMilestones},scopedSlots:_vm._u([{key:\"view\",fn:function({ viewTokenProps: { inputValue, activeTokenValue } }){return [_vm._v(\"\\n    %\"+_vm._s(activeTokenValue ? _vm.getMilestoneTitle(activeTokenValue) : inputValue)+\"\\n  \")]}},{key:\"suggestions-list\",fn:function({ suggestions }){return _vm._l((suggestions),function(milestone){return _c('gl-filtered-search-suggestion',{key:milestone.id,attrs:{\"value\":_vm.getMilestoneTitle(milestone)}},[_vm._v(\"\\n      \"+_vm._s(_vm.getMilestoneTitle(milestone))+\"\\n    \")])})}}])},'base-token',_vm.$attrs,false),_vm.$listeners))\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import mod from \"-!../../../../../../../node_modules/thread-loader/dist/cjs.js??ref--13-0!../../../../../../../node_modules/babel-loader/lib/index.js??ref--13-1!../../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./milestone_token.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../../../../../node_modules/thread-loader/dist/cjs.js??ref--13-0!../../../../../../../node_modules/babel-loader/lib/index.js??ref--13-1!../../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./milestone_token.vue?vue&type=script&lang=js\"","<script>\nimport { GlFilteredSearchSuggestion } from '@gitlab/ui';\nimport { createAlert } from '~/alert';\nimport { __ } from '~/locale';\nimport { WORKSPACE_GROUP, WORKSPACE_PROJECT } from '~/issues/constants';\nimport searchMilestonesQuery from '~/issues/list/queries/search_milestones.query.graphql';\nimport { sortMilestonesByDueDate } from '~/milestones/utils';\nimport BaseToken from '~/vue_shared/components/filtered_search_bar/tokens/base_token.vue';\nimport { stripQuotes } from '~/lib/utils/text_utility';\nimport { DEFAULT_MILESTONES } from '../constants';\n\nexport default {\n  components: {\n    BaseToken,\n    GlFilteredSearchSuggestion,\n  },\n  props: {\n    active: {\n      type: Boolean,\n      required: true,\n    },\n    config: {\n      type: Object,\n      required: true,\n    },\n    value: {\n      type: Object,\n      required: true,\n    },\n  },\n  data() {\n    return {\n      milestones: this.config.initialMilestones || [],\n      loading: false,\n    };\n  },\n  computed: {\n    defaultMilestones() {\n      return this.config.defaultMilestones || DEFAULT_MILESTONES;\n    },\n    namespace() {\n      return this.config.isProject ? WORKSPACE_PROJECT : WORKSPACE_GROUP;\n    },\n    fetchMilestonesQuery() {\n      return this.config.fetchMilestones\n        ? this.config.fetchMilestones\n        : this.fetchMilestonesBySearchTerm;\n    },\n  },\n  methods: {\n    getActiveMilestone(milestones, data) {\n      /* We need to check default milestones against the value not the\n       * title because there is a discrepancy between the value graphql\n       * accepts and the title.\n       * https://gitlab.com/gitlab-org/gitlab/-/issues/337687#note_648058797\n       */\n\n      return (\n        milestones.find(\n          (milestone) =>\n            this.getMilestoneTitle(milestone).toLowerCase() === stripQuotes(data).toLowerCase(),\n        ) || this.defaultMilestones.find(({ value }) => value === data)\n      );\n    },\n    getMilestoneTitle(milestone) {\n      return milestone.title;\n    },\n    fetchMilestonesBySearchTerm(search) {\n      return this.$apollo\n        .query({\n          query: searchMilestonesQuery,\n          variables: { fullPath: this.config.fullPath, search, isProject: this.config.isProject },\n        })\n        .then(({ data }) => data[this.namespace]?.milestones.nodes);\n    },\n    fetchMilestones(searchTerm) {\n      this.loading = true;\n      this.fetchMilestonesQuery(searchTerm)\n        .then((response) => {\n          const data = Array.isArray(response) ? response : response.data;\n\n          const uniqueData = data.reduce((acc, current) => {\n            const existingItem = acc.find((item) => item.title === current.title);\n\n            if (!existingItem) {\n              acc.push(current);\n            }\n\n            return acc;\n          }, []);\n\n          if (this.config.shouldSkipSort) {\n            this.milestones = uniqueData;\n          } else {\n            this.milestones = uniqueData.slice().sort(sortMilestonesByDueDate);\n          }\n        })\n        .catch(() => {\n          createAlert({ message: __('There was a problem fetching milestones.') });\n        })\n        .finally(() => {\n          this.loading = false;\n        });\n    },\n  },\n};\n</script>\n\n<template>\n  <base-token\n    :active=\"active\"\n    :config=\"config\"\n    :value=\"value\"\n    :default-suggestions=\"defaultMilestones\"\n    :suggestions=\"milestones\"\n    :suggestions-loading=\"loading\"\n    :get-active-token-value=\"getActiveMilestone\"\n    :value-identifier=\"getMilestoneTitle\"\n    v-bind=\"$attrs\"\n    @fetch-suggestions=\"fetchMilestones\"\n    v-on=\"$listeners\"\n  >\n    <template #view=\"{ viewTokenProps: { inputValue, activeTokenValue } }\">\n      %{{ activeTokenValue ? getMilestoneTitle(activeTokenValue) : inputValue }}\n    </template>\n    <template #suggestions-list=\"{ suggestions }\">\n      <gl-filtered-search-suggestion\n        v-for=\"milestone in suggestions\"\n        :key=\"milestone.id\"\n        :value=\"getMilestoneTitle(milestone)\"\n      >\n        {{ getMilestoneTitle(milestone) }}\n      </gl-filtered-search-suggestion>\n    </template>\n  </base-token>\n</template>\n","import { render, staticRenderFns } from \"./milestone_token.vue?vue&type=template&id=7f709866\"\nimport script from \"./milestone_token.vue?vue&type=script&lang=js\"\nexport * from \"./milestone_token.vue?vue&type=script&lang=js\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\nexport default component.exports"],"sourceRoot":""}