{"version":3,"file":"BDropdown-DAHnN54Z.mjs","names":[],"sources":["../src/components/BDropdown/BDropdown.vue","../src/components/BDropdown/BDropdown.vue"],"sourcesContent":["<template>\n  <ConditionalWrapper\n    :skip=\"inInputGroup || props.noWrapper\"\n    :class=\"computedClasses\"\n    :role=\"inButtonGroupAttributes?.role\"\n  >\n    <BButton\n      :id=\"computedId\"\n      ref=\"_splitButton\"\n      :variant=\"props.splitVariant || props.variant\"\n      :size=\"props.size\"\n      :class=\"buttonClasses\"\n      :disabled=\"props.splitDisabled || props.disabled\"\n      :type=\"props.splitButtonType\"\n      :aria-label=\"props.ariaLabel\"\n      :aria-expanded=\"props.split ? undefined : showRef\"\n      :aria-haspopup=\"props.split ? undefined : 'menu'\"\n      :href=\"props.split ? props.splitHref : undefined\"\n      :icon=\"props.icon\"\n      :to=\"props.split && props.splitTo ? props.splitTo : undefined\"\n      @click=\"onSplitClick\"\n    >\n      <slot name=\"button-content\"> {{ props.text }} </slot>\n    </BButton>\n    <BButton\n      v-if=\"props.split\"\n      :id=\"computedId + '-split'\"\n      ref=\"_button\"\n      :variant=\"props.variant\"\n      :size=\"props.size\"\n      :disabled=\"props.disabled\"\n      :class=\"[props.toggleClass, {show: showRef}]\"\n      class=\"dropdown-toggle-split dropdown-toggle\"\n      :aria-expanded=\"showRef\"\n      aria-haspopup=\"menu\"\n      @click=\"onButtonClick\"\n    >\n      <span class=\"visually-hidden\">\n        <slot name=\"toggle-text\">\n          {{ props.toggleText }}\n        </slot>\n      </span>\n    </BButton>\n    <ConditionalTeleport\n      :to=\"props.teleportTo\"\n      :disabled=\"!props.teleportTo || props.teleportDisabled\"\n    >\n      <Transition\n        v-if=\"renderRef || contentShowing\"\n        v-bind=\"transitionProps\"\n        :appear=\"modelValue || props.visible\"\n      >\n        <ul\n          v-show=\"showRef\"\n          :id=\"computedId + '-menu'\"\n          ref=\"_floating\"\n          :style=\"[floatingStyles, sizeStyles, {display: showRef || isActive ? 'block' : 'none'}]\"\n          class=\"dropdown-menu overflow-auto b-floating-size\"\n          :class=\"[props.menuClass, computedMenuClasses]\"\n          :aria-labelledby=\"computedId\"\n          :role=\"props.role\"\n          @click=\"onClickInside\"\n        >\n          <slot\n            v-if=\"contentShowing\"\n            :id=\"computedId\"\n            :hide=\"hide\"\n            :show=\"show\"\n            :visible=\"showRef\"\n            :click=\"onClickInside\"\n            :toggle=\"onButtonClick\"\n            :active=\"showRef\"\n          />\n        </ul>\n      </Transition>\n    </ConditionalTeleport>\n  </ConditionalWrapper>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n  autoUpdate,\n  type Boundary,\n  flip,\n  type Middleware,\n  offset as offsetMiddleware,\n  type ReferenceElement,\n  type RootBoundary,\n  shift,\n  size as sizeMiddleware,\n  useFloating,\n} from '@floating-ui/vue'\nimport {onClickOutside, onKeyStroke, useToNumber} from '@vueuse/core'\nimport {\n  computed,\n  type ComputedRef,\n  type CSSProperties,\n  type EmitFn,\n  inject,\n  nextTick,\n  provide,\n  readonly,\n  ref,\n  toRef,\n  useTemplateRef,\n  watch,\n} from 'vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport BButton from '../BButton/BButton.vue'\nimport ConditionalWrapper from '../ConditionalWrapper.vue'\nimport ConditionalTeleport from '../ConditionalTeleport.vue'\nimport {isBoundary, isRootBoundary, resolveBootstrapCaret} from '../../utils/floatingUi'\nimport {getElement} from '../../utils/getElement'\nimport {buttonGroupKey, dropdownInjectionKey, inputGroupKey} from '../../utils/keys'\nimport {useShowHide} from '../../composables/useShowHide'\nimport type {BDropdownEmits, BDropdownProps, BDropdownSlots} from '../../types'\nimport {getSafeDocument} from '../../utils/dom'\n\nconst _props = withDefaults(defineProps<Omit<BDropdownProps, 'modelValue'>>(), {\n  ariaLabel: undefined,\n  autoClose: true,\n  boundary: 'clippingAncestors',\n  boundaryPadding: undefined,\n  teleportTo: undefined,\n  teleportDisabled: false,\n  disabled: false,\n  floatingMiddleware: undefined,\n  icon: false,\n  id: undefined,\n  initialAnimation: false,\n  isNav: false,\n  lazy: false,\n  menuClass: undefined,\n  noCaret: false,\n  noFade: false,\n  noFlip: false,\n  noShift: false,\n  noSize: false,\n  offset: 0,\n  unmountLazy: false,\n  role: 'menu',\n  size: 'md',\n  noWrapper: false,\n  split: false,\n  splitButtonType: 'button',\n  splitClass: undefined,\n  splitDisabled: undefined,\n  splitHref: undefined,\n  splitTo: undefined,\n  placement: 'bottom-start',\n  splitVariant: undefined,\n  strategy: 'absolute',\n  text: undefined,\n  show: false,\n  toggleClass: undefined,\n  toggleText: 'Toggle dropdown',\n  transProps: undefined,\n  variant: 'secondary',\n  visible: false,\n  wrapperClass: undefined,\n})\nconst props = useDefaults(_props, 'BDropdown')\nconst emit = defineEmits<BDropdownEmits>()\ndefineSlots<BDropdownSlots>()\n\nconst computedId = useId(() => props.id, 'dropdown')\n\nconst modelValue = defineModel<Exclude<BDropdownProps['modelValue'], undefined>>({default: false})\n\nconst inInputGroup = inject(inputGroupKey, false)\nconst inButtonGroup = inject(buttonGroupKey, false)\n\nconst computedOffset = computed(() =>\n  typeof props.offset === 'string' || typeof props.offset === 'number' ? props.offset : Number.NaN\n)\nconst offsetToNumber = useToNumber(computedOffset)\n\nconst floatingElement = useTemplateRef<HTMLUListElement | null>('_floating')\nconst button = useTemplateRef<HTMLElement | null>('_button')\nconst splitButton = useTemplateRef<HTMLElement | null>('_splitButton')\n\nconst boundary = computed<Boundary | undefined>(() =>\n  isBoundary(props.boundary) ? props.boundary : undefined\n)\nconst rootBoundary = computed<RootBoundary | undefined>(() =>\n  isRootBoundary(props.boundary) ? props.boundary : undefined\n)\n\nconst referenceElement = computed(() => (!props.split ? splitButton.value : button.value))\nlet cleanup: ReturnType<typeof autoUpdate> | undefined\n\nconst {\n  showRef,\n  renderRef,\n  hide,\n  show,\n  toggle,\n  computedNoAnimation,\n  transitionProps,\n  contentShowing,\n  isVisible,\n  isActive,\n} = useShowHide(modelValue, props, emit as EmitFn, referenceElement, computedId, {\n  showFn: () => {\n    update()\n    nextTick(() => {\n      cleanup = autoUpdate(\n        referenceElement.value as ReferenceElement,\n        floatingElement.value as HTMLElement,\n        update,\n        {\n          animationFrame: false,\n        }\n      )\n    })\n  },\n  hideFn: () => {\n    if (cleanup) {\n      cleanup()\n      cleanup = undefined\n    }\n  },\n})\n\nconst computedMenuClasses = computed(() => [\n  {\n    show: isVisible.value,\n    fade: !computedNoAnimation.value,\n  },\n])\n\nonKeyStroke(\n  'Escape',\n  () => {\n    hide()\n    getElement(referenceElement.value)?.focus()\n  },\n  {target: referenceElement}\n)\nonKeyStroke(\n  'Escape',\n  () => {\n    hide()\n    getElement(referenceElement.value)?.focus()\n  },\n  {target: floatingElement, passive: true}\n)\n\nconst keynav = (e: Readonly<Event>, v: number) => {\n  if (floatingElement.value?.contains((e.target as HTMLElement)?.closest('form'))) return\n  if (/input|select|option|textarea|form/i.test((e.target as HTMLElement)?.tagName)) return\n  e.preventDefault()\n  if (!showRef.value) {\n    show()\n    const loop = setInterval(() => {\n      if (isVisible.value) {\n        clearInterval(loop)\n        nextTick(() => keynav(e, v))\n      }\n    }, 16)\n    return\n  }\n  const list = floatingElement.value?.querySelectorAll(\n    '.dropdown-item:not(.disabled):not(:disabled)'\n  )\n  const doc = getSafeDocument()\n  if (!list || !doc) return\n  if (floatingElement.value?.contains(doc.activeElement)) {\n    const active = floatingElement.value.querySelector('.dropdown-item:focus')\n    const index = Array.prototype.indexOf.call(list, active) + v\n    if (index >= 0 && index < list?.length) (list[index] as HTMLElement)?.focus()\n  } else {\n    ;(list[v === -1 ? list.length - 1 : 0] as HTMLElement)?.focus()\n  }\n}\n\nonKeyStroke('ArrowUp', (e) => keynav(e, -1), {target: referenceElement})\nonKeyStroke('ArrowDown', (e) => keynav(e, 1), {target: referenceElement})\nonKeyStroke('ArrowUp', (e) => keynav(e, -1), {target: floatingElement})\nonKeyStroke('ArrowDown', (e) => keynav(e, 1), {target: floatingElement})\n\nconst sizeStyles = ref<CSSProperties>({})\nconst floatingMiddleware = computed<readonly Middleware[]>(() => {\n  if (props.floatingMiddleware !== undefined) {\n    return props.floatingMiddleware\n  }\n  const localOffset =\n    typeof props.offset === 'string' || typeof props.offset === 'number'\n      ? offsetToNumber.value\n      : props.offset\n  const arr: Middleware[] = [offsetMiddleware(localOffset)]\n  if (props.noFlip === false) {\n    arr.push(\n      flip({\n        boundary: boundary.value,\n        rootBoundary: rootBoundary.value,\n        padding: props.boundaryPadding,\n      })\n    )\n  }\n  if (props.noShift === false) {\n    arr.push(\n      shift({\n        boundary: boundary.value,\n        rootBoundary: rootBoundary.value,\n        padding: props.boundaryPadding,\n      })\n    )\n  }\n  if (props.noSize === false) {\n    arr.push(\n      sizeMiddleware({\n        boundary: boundary.value,\n        rootBoundary: rootBoundary.value,\n        padding: props.boundaryPadding,\n        apply({availableWidth, availableHeight}) {\n          sizeStyles.value = {\n            '--bv-floating-max-height':\n              availableHeight >= (floatingElement.value?.scrollHeight ?? 0)\n                ? undefined\n                : availableHeight\n                  ? `${Math.max(0, availableHeight)}px`\n                  : undefined,\n            '--bv-floating-max-width':\n              availableWidth >= (floatingElement.value?.scrollWidth ?? 0)\n                ? undefined\n                : availableWidth\n                  ? `${Math.max(0, availableWidth)}px`\n                  : undefined,\n          }\n        },\n      })\n    )\n  }\n  return arr\n})\nconst {update, floatingStyles} = useFloating(referenceElement, floatingElement, {\n  placement: () => props.placement,\n  middleware: floatingMiddleware as ComputedRef<Middleware[]>,\n  strategy: toRef(() => props.strategy),\n})\n\nconst inButtonGroupAttributes = inButtonGroup\n  ? {\n      class: 'btn-group',\n      role: 'group',\n    }\n  : undefined\n\nconst computedClasses = computed(() => [\n  inButtonGroupAttributes?.class,\n  props.wrapperClass,\n  {\n    'btn-group': !props.wrapperClass && props.split,\n    [`drop${resolveBootstrapCaret(props.placement)}`]: !props.wrapperClass,\n    'position-static': props.boundary !== 'clippingAncestors' && !props.isNav,\n  },\n])\n\nconst buttonClasses = computed(() => [\n  props.split ? props.splitClass : props.toggleClass,\n  {\n    'nav-link': props.isNav,\n    'dropdown-toggle': !props.split,\n    'dropdown-toggle-no-caret': props.noCaret && !props.split,\n    'show': props.split ? undefined : showRef.value,\n  },\n])\n\nconst onButtonClick = () => {\n  toggle()\n}\n\nconst onSplitClick = (event: Readonly<MouseEvent>) => {\n  if (props.split) {\n    emit('split-click', event)\n    return\n  }\n  onButtonClick()\n}\n\nonClickOutside(\n  floatingElement,\n  () => {\n    if (showRef.value && (props.autoClose === true || props.autoClose === 'outside')) {\n      hide()\n    }\n  },\n  {ignore: [button, splitButton]}\n)\nconst onClickInside = () => {\n  if (showRef.value && (props.autoClose === true || props.autoClose === 'inside')) {\n    hide()\n  }\n}\n\nwatch(isVisible, () => {\n  update()\n})\n\ndefineExpose({\n  hide,\n  show,\n  toggle,\n})\n\nprovide(dropdownInjectionKey, {\n  id: computedId,\n  show,\n  hide,\n  toggle,\n  visible: readonly(showRef),\n  isNav: toRef(() => props.isNav),\n})\n</script>\n","<template>\n  <ConditionalWrapper\n    :skip=\"inInputGroup || props.noWrapper\"\n    :class=\"computedClasses\"\n    :role=\"inButtonGroupAttributes?.role\"\n  >\n    <BButton\n      :id=\"computedId\"\n      ref=\"_splitButton\"\n      :variant=\"props.splitVariant || props.variant\"\n      :size=\"props.size\"\n      :class=\"buttonClasses\"\n      :disabled=\"props.splitDisabled || props.disabled\"\n      :type=\"props.splitButtonType\"\n      :aria-label=\"props.ariaLabel\"\n      :aria-expanded=\"props.split ? undefined : showRef\"\n      :aria-haspopup=\"props.split ? undefined : 'menu'\"\n      :href=\"props.split ? props.splitHref : undefined\"\n      :icon=\"props.icon\"\n      :to=\"props.split && props.splitTo ? props.splitTo : undefined\"\n      @click=\"onSplitClick\"\n    >\n      <slot name=\"button-content\"> {{ props.text }} </slot>\n    </BButton>\n    <BButton\n      v-if=\"props.split\"\n      :id=\"computedId + '-split'\"\n      ref=\"_button\"\n      :variant=\"props.variant\"\n      :size=\"props.size\"\n      :disabled=\"props.disabled\"\n      :class=\"[props.toggleClass, {show: showRef}]\"\n      class=\"dropdown-toggle-split dropdown-toggle\"\n      :aria-expanded=\"showRef\"\n      aria-haspopup=\"menu\"\n      @click=\"onButtonClick\"\n    >\n      <span class=\"visually-hidden\">\n        <slot name=\"toggle-text\">\n          {{ props.toggleText }}\n        </slot>\n      </span>\n    </BButton>\n    <ConditionalTeleport\n      :to=\"props.teleportTo\"\n      :disabled=\"!props.teleportTo || props.teleportDisabled\"\n    >\n      <Transition\n        v-if=\"renderRef || contentShowing\"\n        v-bind=\"transitionProps\"\n        :appear=\"modelValue || props.visible\"\n      >\n        <ul\n          v-show=\"showRef\"\n          :id=\"computedId + '-menu'\"\n          ref=\"_floating\"\n          :style=\"[floatingStyles, sizeStyles, {display: showRef || isActive ? 'block' : 'none'}]\"\n          class=\"dropdown-menu overflow-auto b-floating-size\"\n          :class=\"[props.menuClass, computedMenuClasses]\"\n          :aria-labelledby=\"computedId\"\n          :role=\"props.role\"\n          @click=\"onClickInside\"\n        >\n          <slot\n            v-if=\"contentShowing\"\n            :id=\"computedId\"\n            :hide=\"hide\"\n            :show=\"show\"\n            :visible=\"showRef\"\n            :click=\"onClickInside\"\n            :toggle=\"onButtonClick\"\n            :active=\"showRef\"\n          />\n        </ul>\n      </Transition>\n    </ConditionalTeleport>\n  </ConditionalWrapper>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n  autoUpdate,\n  type Boundary,\n  flip,\n  type Middleware,\n  offset as offsetMiddleware,\n  type ReferenceElement,\n  type RootBoundary,\n  shift,\n  size as sizeMiddleware,\n  useFloating,\n} from '@floating-ui/vue'\nimport {onClickOutside, onKeyStroke, useToNumber} from '@vueuse/core'\nimport {\n  computed,\n  type ComputedRef,\n  type CSSProperties,\n  type EmitFn,\n  inject,\n  nextTick,\n  provide,\n  readonly,\n  ref,\n  toRef,\n  useTemplateRef,\n  watch,\n} from 'vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport BButton from '../BButton/BButton.vue'\nimport ConditionalWrapper from '../ConditionalWrapper.vue'\nimport ConditionalTeleport from '../ConditionalTeleport.vue'\nimport {isBoundary, isRootBoundary, resolveBootstrapCaret} from '../../utils/floatingUi'\nimport {getElement} from '../../utils/getElement'\nimport {buttonGroupKey, dropdownInjectionKey, inputGroupKey} from '../../utils/keys'\nimport {useShowHide} from '../../composables/useShowHide'\nimport type {BDropdownEmits, BDropdownProps, BDropdownSlots} from '../../types'\nimport {getSafeDocument} from '../../utils/dom'\n\nconst _props = withDefaults(defineProps<Omit<BDropdownProps, 'modelValue'>>(), {\n  ariaLabel: undefined,\n  autoClose: true,\n  boundary: 'clippingAncestors',\n  boundaryPadding: undefined,\n  teleportTo: undefined,\n  teleportDisabled: false,\n  disabled: false,\n  floatingMiddleware: undefined,\n  icon: false,\n  id: undefined,\n  initialAnimation: false,\n  isNav: false,\n  lazy: false,\n  menuClass: undefined,\n  noCaret: false,\n  noFade: false,\n  noFlip: false,\n  noShift: false,\n  noSize: false,\n  offset: 0,\n  unmountLazy: false,\n  role: 'menu',\n  size: 'md',\n  noWrapper: false,\n  split: false,\n  splitButtonType: 'button',\n  splitClass: undefined,\n  splitDisabled: undefined,\n  splitHref: undefined,\n  splitTo: undefined,\n  placement: 'bottom-start',\n  splitVariant: undefined,\n  strategy: 'absolute',\n  text: undefined,\n  show: false,\n  toggleClass: undefined,\n  toggleText: 'Toggle dropdown',\n  transProps: undefined,\n  variant: 'secondary',\n  visible: false,\n  wrapperClass: undefined,\n})\nconst props = useDefaults(_props, 'BDropdown')\nconst emit = defineEmits<BDropdownEmits>()\ndefineSlots<BDropdownSlots>()\n\nconst computedId = useId(() => props.id, 'dropdown')\n\nconst modelValue = defineModel<Exclude<BDropdownProps['modelValue'], undefined>>({default: false})\n\nconst inInputGroup = inject(inputGroupKey, false)\nconst inButtonGroup = inject(buttonGroupKey, false)\n\nconst computedOffset = computed(() =>\n  typeof props.offset === 'string' || typeof props.offset === 'number' ? props.offset : Number.NaN\n)\nconst offsetToNumber = useToNumber(computedOffset)\n\nconst floatingElement = useTemplateRef<HTMLUListElement | null>('_floating')\nconst button = useTemplateRef<HTMLElement | null>('_button')\nconst splitButton = useTemplateRef<HTMLElement | null>('_splitButton')\n\nconst boundary = computed<Boundary | undefined>(() =>\n  isBoundary(props.boundary) ? props.boundary : undefined\n)\nconst rootBoundary = computed<RootBoundary | undefined>(() =>\n  isRootBoundary(props.boundary) ? props.boundary : undefined\n)\n\nconst referenceElement = computed(() => (!props.split ? splitButton.value : button.value))\nlet cleanup: ReturnType<typeof autoUpdate> | undefined\n\nconst {\n  showRef,\n  renderRef,\n  hide,\n  show,\n  toggle,\n  computedNoAnimation,\n  transitionProps,\n  contentShowing,\n  isVisible,\n  isActive,\n} = useShowHide(modelValue, props, emit as EmitFn, referenceElement, computedId, {\n  showFn: () => {\n    update()\n    nextTick(() => {\n      cleanup = autoUpdate(\n        referenceElement.value as ReferenceElement,\n        floatingElement.value as HTMLElement,\n        update,\n        {\n          animationFrame: false,\n        }\n      )\n    })\n  },\n  hideFn: () => {\n    if (cleanup) {\n      cleanup()\n      cleanup = undefined\n    }\n  },\n})\n\nconst computedMenuClasses = computed(() => [\n  {\n    show: isVisible.value,\n    fade: !computedNoAnimation.value,\n  },\n])\n\nonKeyStroke(\n  'Escape',\n  () => {\n    hide()\n    getElement(referenceElement.value)?.focus()\n  },\n  {target: referenceElement}\n)\nonKeyStroke(\n  'Escape',\n  () => {\n    hide()\n    getElement(referenceElement.value)?.focus()\n  },\n  {target: floatingElement, passive: true}\n)\n\nconst keynav = (e: Readonly<Event>, v: number) => {\n  if (floatingElement.value?.contains((e.target as HTMLElement)?.closest('form'))) return\n  if (/input|select|option|textarea|form/i.test((e.target as HTMLElement)?.tagName)) return\n  e.preventDefault()\n  if (!showRef.value) {\n    show()\n    const loop = setInterval(() => {\n      if (isVisible.value) {\n        clearInterval(loop)\n        nextTick(() => keynav(e, v))\n      }\n    }, 16)\n    return\n  }\n  const list = floatingElement.value?.querySelectorAll(\n    '.dropdown-item:not(.disabled):not(:disabled)'\n  )\n  const doc = getSafeDocument()\n  if (!list || !doc) return\n  if (floatingElement.value?.contains(doc.activeElement)) {\n    const active = floatingElement.value.querySelector('.dropdown-item:focus')\n    const index = Array.prototype.indexOf.call(list, active) + v\n    if (index >= 0 && index < list?.length) (list[index] as HTMLElement)?.focus()\n  } else {\n    ;(list[v === -1 ? list.length - 1 : 0] as HTMLElement)?.focus()\n  }\n}\n\nonKeyStroke('ArrowUp', (e) => keynav(e, -1), {target: referenceElement})\nonKeyStroke('ArrowDown', (e) => keynav(e, 1), {target: referenceElement})\nonKeyStroke('ArrowUp', (e) => keynav(e, -1), {target: floatingElement})\nonKeyStroke('ArrowDown', (e) => keynav(e, 1), {target: floatingElement})\n\nconst sizeStyles = ref<CSSProperties>({})\nconst floatingMiddleware = computed<readonly Middleware[]>(() => {\n  if (props.floatingMiddleware !== undefined) {\n    return props.floatingMiddleware\n  }\n  const localOffset =\n    typeof props.offset === 'string' || typeof props.offset === 'number'\n      ? offsetToNumber.value\n      : props.offset\n  const arr: Middleware[] = [offsetMiddleware(localOffset)]\n  if (props.noFlip === false) {\n    arr.push(\n      flip({\n        boundary: boundary.value,\n        rootBoundary: rootBoundary.value,\n        padding: props.boundaryPadding,\n      })\n    )\n  }\n  if (props.noShift === false) {\n    arr.push(\n      shift({\n        boundary: boundary.value,\n        rootBoundary: rootBoundary.value,\n        padding: props.boundaryPadding,\n      })\n    )\n  }\n  if (props.noSize === false) {\n    arr.push(\n      sizeMiddleware({\n        boundary: boundary.value,\n        rootBoundary: rootBoundary.value,\n        padding: props.boundaryPadding,\n        apply({availableWidth, availableHeight}) {\n          sizeStyles.value = {\n            '--bv-floating-max-height':\n              availableHeight >= (floatingElement.value?.scrollHeight ?? 0)\n                ? undefined\n                : availableHeight\n                  ? `${Math.max(0, availableHeight)}px`\n                  : undefined,\n            '--bv-floating-max-width':\n              availableWidth >= (floatingElement.value?.scrollWidth ?? 0)\n                ? undefined\n                : availableWidth\n                  ? `${Math.max(0, availableWidth)}px`\n                  : undefined,\n          }\n        },\n      })\n    )\n  }\n  return arr\n})\nconst {update, floatingStyles} = useFloating(referenceElement, floatingElement, {\n  placement: () => props.placement,\n  middleware: floatingMiddleware as ComputedRef<Middleware[]>,\n  strategy: toRef(() => props.strategy),\n})\n\nconst inButtonGroupAttributes = inButtonGroup\n  ? {\n      class: 'btn-group',\n      role: 'group',\n    }\n  : undefined\n\nconst computedClasses = computed(() => [\n  inButtonGroupAttributes?.class,\n  props.wrapperClass,\n  {\n    'btn-group': !props.wrapperClass && props.split,\n    [`drop${resolveBootstrapCaret(props.placement)}`]: !props.wrapperClass,\n    'position-static': props.boundary !== 'clippingAncestors' && !props.isNav,\n  },\n])\n\nconst buttonClasses = computed(() => [\n  props.split ? props.splitClass : props.toggleClass,\n  {\n    'nav-link': props.isNav,\n    'dropdown-toggle': !props.split,\n    'dropdown-toggle-no-caret': props.noCaret && !props.split,\n    'show': props.split ? undefined : showRef.value,\n  },\n])\n\nconst onButtonClick = () => {\n  toggle()\n}\n\nconst onSplitClick = (event: Readonly<MouseEvent>) => {\n  if (props.split) {\n    emit('split-click', event)\n    return\n  }\n  onButtonClick()\n}\n\nonClickOutside(\n  floatingElement,\n  () => {\n    if (showRef.value && (props.autoClose === true || props.autoClose === 'outside')) {\n      hide()\n    }\n  },\n  {ignore: [button, splitButton]}\n)\nconst onClickInside = () => {\n  if (showRef.value && (props.autoClose === true || props.autoClose === 'inside')) {\n    hide()\n  }\n}\n\nwatch(isVisible, () => {\n  update()\n})\n\ndefineExpose({\n  hide,\n  show,\n  toggle,\n})\n\nprovide(dropdownInjectionKey, {\n  id: computedId,\n  show,\n  hide,\n  toggle,\n  visible: readonly(showRef),\n  isNav: toRef(() => props.isNav),\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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