-
Notifications
You must be signed in to change notification settings - Fork 0
/
p-5e3a361a.entry.js
13 lines (13 loc) · 35.9 KB
/
p-5e3a361a.entry.js
1
2
3
4
5
6
7
8
9
10
11
12
13
/*!
* Built by BASIS
* Copyright BASIS International Ltd.
*/
import{r as t,c as e,h as i,g as o,H as s}from"./p-00e3df8e.js";import{l as n}from"./p-f5397639.js";import{D as a}from"./p-a2384989.js";import{h as r}from"./p-3e9fe89f.js";import{o as c,p as h,f as d,P as l,h as u}from"./p-5618954f.js";import"./p-21e654a9.js";import"./p-58156e74.js";import"./p-5119ef20.js";import"./p-ece60743.js";
/**!
* hotkeys-js v3.10.1
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
*
* Copyright (c) 2022 kenny wong <wowohoo@qq.com>
* http://jaywcjlove.github.io/hotkeys
* Licensed under the MIT license
*/var m="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function w(t,e,i,o){t.addEventListener?t.addEventListener(e,i,o):t.attachEvent&&t.attachEvent("on".concat(e),(function(){i(window.event)}))}function p(t,e){for(var i=e.slice(0,e.length-1),o=0;o<i.length;o++)i[o]=t[i[o].toLowerCase()];return i}function f(t){"string"!=typeof t&&(t="");for(var e=(t=t.replace(/\s/g,"")).split(","),i=e.lastIndexOf("");i>=0;)e[i-1]+=",",e.splice(i,1),i=e.lastIndexOf("");return e}for(var g={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":m?173:189,"=":m?61:187,";":m?59:186,"'":222,"[":219,"]":221,"\\":220},v={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},b={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},y={16:!1,18:!1,17:!1,91:!1},k={},x=1;x<20;x++)g["f".concat(x)]=111+x;var C=[],j=!1,E="all",O=[],K=function(t){return g[t.toLowerCase()]||v[t.toLowerCase()]||t.toUpperCase().charCodeAt(0)};function P(t){E=t||"all"}function A(){return E||"all"}var M=function(t){var e=t.scope,i=t.method,o=t.splitKey,s=void 0===o?"+":o;f(t.key).forEach((function(t){var o=t.split(s),n=o.length,a=o[n-1],r="*"===a?"*":K(a);if(k[r]){e||(e=A());var c=n>1?p(v,o):[];k[r]=k[r].filter((function(t){return!((!i||t.method===i)&&t.scope===e&&function(t,e){for(var i=t.length>=e.length?t:e,o=t.length>=e.length?e:t,s=!0,n=0;n<i.length;n++)-1===o.indexOf(i[n])&&(s=!1);return s}(t.mods,c))}))}}))};function _(t,e,i,o){var s;if(e.element===o&&(e.scope===i||"all"===e.scope)){for(var n in s=e.mods.length>0,y)Object.prototype.hasOwnProperty.call(y,n)&&(!y[n]&&e.mods.indexOf(+n)>-1||y[n]&&-1===e.mods.indexOf(+n))&&(s=!1);(0!==e.mods.length||y[16]||y[18]||y[17]||y[91])&&!s&&"*"!==e.shortcut||!1===e.method(t,e)&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function z(t,e){var i=k["*"],o=t.keyCode||t.which||t.charCode;if(R.filter.call(this,t)){if(93!==o&&224!==o||(o=91),-1===C.indexOf(o)&&229!==o&&C.push(o),["ctrlKey","altKey","shiftKey","metaKey"].forEach((function(e){var i=b[e];t[e]&&-1===C.indexOf(i)?C.push(i):!t[e]&&C.indexOf(i)>-1?C.splice(C.indexOf(i),1):"metaKey"===e&&t[e]&&3===C.length&&(t.ctrlKey||t.shiftKey||t.altKey||(C=C.slice(C.indexOf(i))))})),o in y){for(var s in y[o]=!0,v)v[s]===o&&(R[s]=!0);if(!i)return}for(var n in y)Object.prototype.hasOwnProperty.call(y,n)&&(y[n]=t[b[n]]);t.getModifierState&&(!t.altKey||t.ctrlKey)&&t.getModifierState("AltGraph")&&(-1===C.indexOf(17)&&C.push(17),-1===C.indexOf(18)&&C.push(18),y[17]=!0,y[18]=!0);var a=A();if(i)for(var r=0;r<i.length;r++)i[r].scope===a&&("keydown"===t.type&&i[r].keydown||"keyup"===t.type&&i[r].keyup)&&_(t,i[r],a,e);if(o in k)for(var c=0;c<k[o].length;c++)if(("keydown"===t.type&&k[o][c].keydown||"keyup"===t.type&&k[o][c].keyup)&&k[o][c].key){for(var h=k[o][c],d=h.key.split(h.splitKey),l=[],u=0;u<d.length;u++)l.push(K(d[u]));l.sort().join("")===C.sort().join("")&&_(t,h,a,e)}}}function R(t,e,i){C=[];var o=f(t),s=[],n="all",a=document,r=0,c=!1,h=!0,d="+",l=!1;for(void 0===i&&"function"==typeof e&&(i=e),"[object Object]"===Object.prototype.toString.call(e)&&(e.scope&&(n=e.scope),e.element&&(a=e.element),e.keyup&&(c=e.keyup),void 0!==e.keydown&&(h=e.keydown),void 0!==e.capture&&(l=e.capture),"string"==typeof e.splitKey&&(d=e.splitKey)),"string"==typeof e&&(n=e);r<o.length;r++)s=[],(t=o[r].split(d)).length>1&&(s=p(v,t)),(t="*"===(t=t[t.length-1])?"*":K(t))in k||(k[t]=[]),k[t].push({keyup:c,keydown:h,scope:n,mods:s,shortcut:o[r],method:i,key:o[r],splitKey:d,element:a});void 0!==a&&!function(t){return O.indexOf(t)>-1}(a)&&window&&(O.push(a),w(a,"keydown",(function(t){z(t,a)}),l),j||(j=!0,w(window,"focus",(function(){C=[]}),l)),w(a,"keyup",(function(t){z(t,a),function(t){var e=t.keyCode||t.which||t.charCode,i=C.indexOf(e);if(i>=0&&C.splice(i,1),t.key&&"meta"===t.key.toLowerCase()&&C.splice(0,C.length),93!==e&&224!==e||(e=91),e in y)for(var o in y[e]=!1,v)v[o]===e&&(R[o]=!1)}(t)}),l))}var T={getPressedKeyString:function(){return C.map((function(t){return e=t,Object.keys(g).find((function(t){return g[t]===e}))||function(t){return Object.keys(v).find((function(e){return v[e]===t}))}(t)||String.fromCharCode(t);var e}))},setScope:P,getScope:A,deleteScope:function(t,e){var i,o;for(var s in t||(t=A()),k)if(Object.prototype.hasOwnProperty.call(k,s))for(i=k[s],o=0;o<i.length;)i[o].scope===t?i.splice(o,1):o++;A()===t&&P(e||"all")},getPressedKeyCodes:function(){return C.slice(0)},isPressed:function(t){return"string"==typeof t&&(t=K(t)),-1!==C.indexOf(t)},filter:function(t){var e=t.target||t.srcElement,i=e.tagName,o=!0;return!e.isContentEditable&&("INPUT"!==i&&"TEXTAREA"!==i&&"SELECT"!==i||e.readOnly)||(o=!1),o},trigger:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";Object.keys(k).forEach((function(i){k[i].filter((function(i){return i.scope===e&&i.shortcut===t})).forEach((function(t){t&&t.method&&t.method()}))}))},unbind:function(t){if(void 0===t)Object.keys(k).forEach((function(t){return delete k[t]}));else if(Array.isArray(t))t.forEach((function(t){t.key&&M(t)}));else if("object"==typeof t)t.key&&M(t);else if("string"==typeof t){for(var e=arguments.length,i=new Array(e>1?e-1:0),o=1;o<e;o++)i[o-1]=arguments[o];var s=i[0],n=i[1];"function"==typeof s&&(n=s,s=""),M({key:t,scope:s,method:n,splitKey:"+"})}},keyMap:g,modifier:v,modifierMap:b};for(var S in T)Object.prototype.hasOwnProperty.call(T,S)&&(R[S]=T[S]);if("undefined"!=typeof window){var B=window.hotkeys;R.noConflict=function(t){return t&&window.hotkeys===R&&(window.hotkeys=B),R},window.hotkeys=R}var D=function(t,e,i,o){var s,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var r=t.length-1;r>=0;r--)(s=t[r])&&(a=(n<3?s(a):n>3?s(e,i,a):s(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};const L=class{constructor(i){t(this,i),this.hotkeyEvent=e(this,"dwc-hotkey",7),this.debug=!1,this.disabled=!1,this.keyName=void 0,this.splitKey="+",this.target="document"}onPropertiesChanged(t,e,i){"keyName"===i&&e&&this.unbind(e),this.bind()}connectedCallback(){this.handleTrigger=this.handleTrigger.bind(this),this.unbind=this.unbind.bind(this),this.bind()}componentDidLoad(){this.bind()}disconnectedCallback(){this.keyName&&this.unbind(this.keyName)}bind(){var t;(null===(t=this.keyName)||void 0===t?void 0:t.trim().length)&&(this.resolvedTarget=this.resolveTarget(this.target),this.resolvedTarget?(this.debugMessage({message:"Target is resolved successfully"}),this.unbind(this.keyName),R(this.keyName,{element:this.resolvedTarget,splitKey:this.splitKey},((t,e)=>(t.preventDefault(),this.handleTrigger(t,e),!1))),this.debugMessage({message:"bind hotkey"})):console.warn("[dwc-hotkeys] Failed to detect the hotkey's target",{keyName:this.keyName,splitKey:this.splitKey,target:this.target,disabled:this.disabled,resolvedTarget:""}))}unbind(t){this.debugMessage({message:"Unbind hotkey"}),R.unbind(t,this.handleTrigger)}handleTrigger(t,e){this.disabled?this.debugMessage({message:"Hotkey handle is disabled"}):(this.hotkeyEvent.emit({keyboardEvent:t,hotkeysEvent:e,el:this.el}),this.debugMessage({message:"Fire hotkey event",keyboardEvent:t,hotkeysEvent:e}))}resolveTarget(t){if(t instanceof HTMLElement)return t;let e=null;if("string"==typeof t)if("document"===t.toLowerCase())e=document.body;else try{e=document.querySelector(t)}catch(t){}return e}debugMessage(t){const e=Object.assign({el:this.el,keyName:this.keyName,splitKey:this.splitKey,target:this.target,disabled:this.disabled,resolvedTarget:this.resolvedTarget||"",message:""},t);this.debug&&console.warn(`[dwc-hotkey] ${e.message}`,e)}render(){return i(s,{key:"47090b39837c2b9fe7861627b468b76c178232e7"})}get el(){return o(this)}static get watchers(){return{keyName:["onPropertiesChanged"],splitKey:["onPropertiesChanged"],target:["onPropertiesChanged"]}}};D([n.debounce(250)],L.prototype,"bind",null),D([n.debounce(50)],L.prototype,"handleTrigger",null);const H=class{constructor(e){t(this,e),this.disabled=void 0,this.hasFocus=!1,this.label="",this.maxRowCount=void 0,this.placement=void 0,this.type=""}onDisabledChanged(t){this.controller&&this.controller.updateItemsProperties({disabled:t})}handleMaxRowCountChange(t){this.updateHeight(t)}onPlacementChanged(t){this.controller&&this.controller.updateItemsProperties({placement:t})}connectedCallback(){this.handleSlotChange=this.handleSlotChange.bind(this),this.handleScroll=this.handleScroll.bind(this)}componentDidLoad(){this.controller=new a(this.el),this.handleSlotChange()}handleItemFocused(){this.hasFocus=!0}handleItemBlurred(){this.hasFocus=!1}handleItemOpened(t){if(this.disabled||t.defaultPrevented)return;const e=t.target;"dwc-menuitem"===e.nodeName.toLowerCase()&&this.controller.closeDropdownsBut(e)}handleItemEnter(t){if(this.disabled||t.defaultPrevented)return;const e=t.target;"dwc-menuitem"===e.nodeName.toLowerCase()&&(this.controller.closeDropdownsBut(e),e.open(),this.controller.focusItem(e))}async handleKeydown(t){if(this.disabled||t.defaultPrevented)return;const e=document.activeElement,i=e.closest("dwc-menu");switch(`${this.placement||"right"}-${t.key}`){case"right-ArrowDown":case"left-ArrowDown":case"top-ArrowDown":case"bottom-ArrowDown":e&&this.el.contains(e)&&(await e.close(),await this.controller.focusNextItem(e)&&t.preventDefault());break;case"left-ArrowUp":case"right-ArrowUp":case"top-ArrowUp":case"bottom-ArrowUp":e&&this.el.contains(e)&&(await e.close(),await this.controller.focusPreviousItem(e)&&t.preventDefault());break;case"right-ArrowRight":case"left-ArrowLeft":case"top-ArrowRight":case"bottom-ArrowRight":if(e.dropdown&&this.el.contains(e)){await e.open(),await e.focusMenu(),t.preventDefault();break}if(i){const e=i.forDwcMenuItem;e&&(t.preventDefault(),await e.close(),await e.setFocus())}break;case"right-Escape":case"left-Escape":case"top-Escape":case"bottom-Escape":case"right-ArrowLeft":case"left-ArrowRight":case"top-ArrowLeft":case"bottom-ArrowLeft":if(!this.el.contains(e))break;if(e.dropdown&&(await e.close(),this.controller.focusItem(e),t.preventDefault()),i){const e=i.forDwcMenuItem;e&&(t.preventDefault(),await e.close(),await e.setFocus())}break;case"left-Enter":case"right-Enter":case"top-Enter":case"bottom-Enter":e.dropdown&&this.el.contains(e)&&(t.preventDefault(),e.opened?await e.focusMenu():this.controller.focusItem(e));break;case"right-Home":case"left-Home":case"top-Home":case"bottom-Home":case"right-End":case"left-End":case"top-End":case"bottom-End":if(e&&this.el.contains(e)){let i="Home"===t.key?this.el.firstElementChild:this.el.lastElementChild;(null==i?void 0:i.hasAttribute("disabled"))&&(i="Home"===t.key?this.controller.getNextItem(i):this.controller.getPreviousItem(i)),i&&(t.preventDefault(),e.close(),this.controller.focusItem(i))}}}async setFocus(){this.controller&&await this.controller.setFocus()}async removeFocus(){this.controller&&await this.controller.removeFocus()}async close(){this.controller&&this.controller.close()}async reposition(){this.controller&&this.controller.getMenuItems().forEach((t=>{t.reposition()}))}async hasItem(t){if(t&&"dwc-menuitem"!==t.nodeName.toLocaleLowerCase())return!1;if(this.el.contains(t))return!0;if(!this.controller)return!1;const e=this.controller.getMenuItems();for(const i of e)if(await i.hasItem(t))return!0;return!1}async length(){return this.controller?this.controller.getMenuItems().length:0}updateHeight(t){if(!this.controller||!t)return;const e=this.controller.getMenuItemsWithSeparators();if(t<0||e.length<t)this.el.style.height=null;else{const i=[];let o=0;for(const s of e){if(o===t)break;const e=s;"dwc-separator"!==e.nodeName.toLowerCase()?(i.push(e),o++):i.push(e)}if(i.length){let t=0;i.forEach((e=>{const i=e.getBoundingClientRect();t+=i.height})),t&&(this.el.style.height=`${t+20}px`)}}}handleSlotChange(){this.controller&&(this.controller.resetTabTraversable(),this.controller.markFirstFocusableItem(),this.controller.updateItemsProperties({disabled:this.disabled,placement:this.placement}),this.updateHeight(this.maxRowCount))}handleScroll(){this.close()}render(){return i(s,{key:"a2ba8c87dd8a2ab48c3b836c0f2cb270037453ab",class:r({BBjControl:!0,BBjMenu:!0,"bbj-disabled":this.disabled})},i("div",{key:"f37e96ba75bdd558ec0d541d61b65efbed6e7d66",part:"control",role:"menu","aria-label":this.label,onScroll:this.handleScroll},i("slot",{key:"947b8221d6fc83509f8768f8ad32a9efa11d3c26",onSlotchange:this.handleSlotChange})))}get el(){return o(this)}static get watchers(){return{disabled:["onDisabledChanged"],maxRowCount:["handleMaxRowCountChange"],placement:["onPlacementChanged"]}}};H.style="@media (prefers-reduced-motion: reduce){*,::before,::after{animation-delay:-1ms !important;animation-duration:1ms !important;animation-iteration-count:1 !important;background-attachment:initial !important;scroll-behavior:auto !important;transition-delay:0s !important;transition-duration:0s !important}}:host{box-sizing:border-box;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:relative;-webkit-tap-highlight-color:transparent;text-size-adjust:100%}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:block}[part=control]{background-color:var(--dwc-menu-background-color, var(--dwc-surface-3));border:var(--dwc-border-width) var(--dwc-border-style) var(--dwc-menu-border-color, var(--dwc-color-default));border-radius:var(--dwc-menu-border-radius, var(--dwc-border-radius-s));box-shadow:var(--dwc-menu-shadow, var(--dwc-shadow-xl));display:flex;flex-direction:column;height:inherit;margin:0;max-height:inherit;max-width:inherit;overflow-x:hidden;overflow-y:auto;padding:var(--dwc-space) 0;width:inherit}";const F=()=>window.matchMedia("(any-pointer: coarse)").matches,I=class{constructor(i){t(this,i),this.changedEvent=e(this,"dwc-changed",7),this.clickedEvent=e(this,"dwc-clicked",7),this.selectedEvent=e(this,"dwc-selected",7),this.enterEvent=e(this,"dwc-entered",7),this.leaveEvent=e(this,"dwc-left",7),this.focusedEvent=e(this,"dwc-focused",7),this.blurredEvent=e(this,"dwc-blurred",7),this.openedEvent=e(this,"dwc-opened",7),this.closedEvent=e(this,"dwc-closed",7),this.isOpened=!1,this.isMouseInside=!1,this.selected=!1,this.positioner=void 0,this.checkable=!1,this.checked=!1,this.distance=0,this.disabled=!1,this.dropdown=!1,this.expanse=void 0,this.hasFocus=!1,this.hideChevronIcon=!1,this.hideHotkeyLabel=!1,this.hotkey="",this.hotkeyLabel="",this.hotkeySplitKey="+",this.hotkeyTarget="document",this.label="",this.opened=!1,this.placement="right",this.skidding=0,this.theme="default",this.tabTraversable=0}onCheckableChanged(t){t?this.$item.setAttribute("aria-checked",this.checked?"true":"false"):this.$item.removeAttribute("aria-checked")}onCheckedChanged(t){this.$item&&this.$item.setAttribute("aria-checked",t?"true":"false")}onOpenedChanged(){this.isOpened?this.close():this.open()}onProperOptionsChanged(){this.popper&&this.popper.setOptions({placement:["top","bottom"].includes(this.placement)?`${this.placement}-start`:this.placement,modifiers:[c(),h(),d("viewport",!0)]})}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleMenuChanged=this.handleMenuChanged.bind(this),this.handleMenuClicked=this.handleMenuClicked.bind(this),this.handleHotKey=this.handleHotKey.bind(this)}componentWillLoad(){this.opened&&this.open()}componentDidLoad(){this.checkable&&this.$item.setAttribute("aria-checked",this.checked?"true":"false")}handleMouseEnter(t){this.disabled||(this.selected=!0,this.isMouseInside=!0,F()||this.enterEvent.emit({originalEvent:t}))}handleMouseLeave(t){this.disabled||(this.isOpened||(this.selected=!1),this.isMouseInside=!1,F()||this.leaveEvent.emit({originalEvent:t}))}async setFocus(){this.hasFocus=!0,this.$item.focus()}async removeFocus(){this.hasFocus=!1,this.$item.blur()}async open(){this.isOpened||this.dropdown&&this.popper&&!this.popper.isVisible&&(await this.popper.open(),this.opened=!0,this.isOpened=!0,this.selected=!0,this.$item.setAttribute("aria-expanded","true"))}async close(){this.isOpened&&this.dropdown&&this.popper&&this.popper.isVisible&&(await this.popper.close(),this.opened=!1,this.isOpened=!1,this.isMouseInside||(this.selected=!1),await this.$menu.close(),this.$item.setAttribute("aria-expanded","false"))}async toggle(){this.dropdown&&this.popper&&(this.popper.isVisible?await this.close():await this.open())}async focusMenu(){this.dropdown&&await this.$menu.setFocus()}async reposition(){this.dropdown&&(this.popper.forceUpdate(),this.$menu.reposition())}async getMenu(){return this.dropdown?this.$menu:null}async hasItem(t){if(t&&"dwc-menuitem"!==t.nodeName.toLocaleLowerCase())return!1;const e=await this.getMenu();return!!e&&await e.hasItem(t)}initPopover(t,e){this.popper&&this.popper.destroy(),this.popper=new l(this.el,e,{strategy:"absolute",placement:["top","bottom"].includes(this.placement)?`${this.placement}-start`:this.placement,moveTo:document.body,restoreTo:this.el,transitionedElement:t,modifiers:[c(this.skidding,this.distance),h(),d("viewport",!0)]})}handleFocus(){this.hasFocus=!0,this.focusedEvent.emit()}handleBlur(){this.hasFocus=!1,this.blurredEvent.emit()}async handleClick(t){if(this.disabled)return;this.checkable&&(this.checked=!this.checked,this.changedEvent.emit({checked:this.checked,item:this.el,isShift:t.shiftKey,isCtrl:t.ctrlKey,originalEvent:t})),this.dropdown&&(this.isOpened?this.closedEvent.emit():this.openedEvent.emit(),await this.toggle()),this.clickedEvent.emit({checked:this.checked,item:this.el,isShift:t.shiftKey,isCtrl:t.ctrlKey,originalEvent:t});let e=!0;const i=this.$menu;this.dropdown&&i&&await i.length()>0&&(e=!1),e&&this.selectedEvent.emit({checked:this.checked,item:this.el,isShift:t.shiftKey,isCtrl:t.ctrlKey,originalEvent:t})}async handleKeydown(t){this.disabled||"Enter"===t.key&&await this.handleClick(t)}handleHotKey(t){const e=t.detail.keyboardEvent;e.preventDefault(),this.handleClick(e)}handleMenuChanged(t){this.changedEvent.emit(t.detail)}handleMenuClicked(t){this.clickedEvent.emit(t.detail)}handleSlotChange(){const t=this.el.shadowRoot.querySelector("[data-menu-slot]").assignedElements({flatten:!0}).filter((t=>"dwc-menu"===t.tagName.toLowerCase()))[0];if(!t)return void this.$item.removeAttribute("aria-haspopup");t.isSameNode(this.$menu)||(t.addEventListener("dwc-changed",this.handleMenuChanged),t.addEventListener("dwc-clicked",this.handleMenuClicked),this.$menu&&(this.$menu.removeEventListener("dwc-changed",this.handleMenuChanged),this.$menu.removeEventListener("dwc-clicked",this.handleMenuClicked))),t.forDwcMenuItem=this.el,t.classList.add("dwc-popper","dwc-popper--menuitem"),this.$menu=t,this.dropdown=!0,this.$item.setAttribute("aria-haspopup","true");let e=t.parentElement;if(!e.classList.contains("dwc-positioner")){const i=document.createElement("div");i.classList.add("dwc-positioner","dwc-positioner--menuitem"),t.parentElement.insertBefore(i,t),i.appendChild(t),e=i,e.setAttribute("hidden","true"),this.positioner=e}this.initPopover(t,e)}render(){const t=this.hotkeyLabel||this.hotkey;return i(s,{key:"d2bedc79a3cf0cd34035826d9023c952c4b1c08c",class:r({BBjControl:!0,BBjMenuItem:!0,"bbj-disabled":this.disabled,"bbj-checked":this.checked,"bbj-selected":this.selected,"bbj-focused":this.hasFocus})},i("dwc-hotkey",{key:"ca96c17be229a98ab1aa07edab1864f9b45459d6","key-name":this.hotkey,"split-key":this.hotkeySplitKey,target:this.hotkeyTarget,disabled:this.disabled,"onDwc-hotkey":this.handleHotKey}),i("div",{key:"200accb309ff480077745b4b612b6e2a49968243",role:this.checkable?"menuitemcheckbox":"menuitem",part:"control",ref:t=>this.$item=t,tabIndex:this.disabled?null:this.tabTraversable,"aria-disabled":this.disabled?"true":"false","aria-label":this.label,onFocus:this.handleFocus,onBlur:this.handleBlur,onClick:this.handleClick,onKeyDown:this.handleKeydown},i("div",{key:"1458958caa0c8ee627d1152bd8191fc881c36926",part:"prefix"},i("slot",{key:"803055f584cc736252f5fd9af7c691c246dcc145",name:"prefix"})),i("div",{key:"570f03322f9b8aea2863ee322134dfe26e5f52d2",part:"label"},i("slot",{key:"223592165efb20c4af075b08a06ecba444c3a9e0",name:"label"}),i("div",{key:"8575efaa49f590e8d5b791da1674e795cf53339d",hidden:!this.label,innerHTML:this.label})),i("div",{key:"08bde0668f1d83a4ea2d4f5fb4f690d8f9f0f6ec",part:"suffix"},i("slot",{key:"8641e7764c69ede47d1cca4293b05f3788a0333a",name:"suffix"})),i("div",{key:"1dc000fa511a7cf366938e16c6472454532cf8ae",part:"hotkey",hidden:!t||this.hideHotkeyLabel},t),this.checkable&&i("div",{key:"d407ccddde7066ee9c5c219b1d3bee54153a06dd",part:"icon-wrapper icon-wrapper-check"},i("dwc-icon",{key:"06c8bb5d4a5fbecf478664374bea74685009670f",part:"icon-check",pool:"dwc",name:"check",label:"check icon"})),this.dropdown&&!this.hideChevronIcon&&i("span",{key:"de40317d5852f1ed8255636d294525e5bd5384f2",part:"icon-wrapper icon-wrapper-chevron"},i("dwc-icon",{key:"238f6464d760490f9b3a626b65bf8a48faac0730",part:"icon-chevron",pool:"dwc",name:"chevron-down",label:"chevron icon"})),i("slot",{key:"ab039fad08a5ec740a55e560e121e1385c7e55ae","data-menu-slot":!0,onSlotchange:this.handleSlotChange})))}get el(){return o(this)}static get watchers(){return{checkable:["onCheckableChanged"],checked:["onCheckedChanged"],opened:["onOpenedChanged"],distance:["onProperOptionsChanged"],placement:["onProperOptionsChanged"],skidding:["onProperOptionsChanged"]}}};(function(t,e,i,o){var s,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var r=t.length-1;r>=0;r--)(s=t[r])&&(a=(n<3?s(a):n>3?s(e,i,a):s(e,i))||a);n>3&&a&&Object.defineProperty(e,i,a)})([n.debounce(50)],I.prototype,"initPopover",null),I.style='@media (prefers-reduced-motion: reduce){*,::before,::after{animation-delay:-1ms !important;animation-duration:1ms !important;animation-iteration-count:1 !important;background-attachment:initial !important;scroll-behavior:auto !important;transition-delay:0s !important;transition-duration:0s !important}}:host{box-sizing:border-box;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:relative;-webkit-tap-highlight-color:transparent;text-size-adjust:100%}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:inline-block}[part=control]{align-items:stretch;cursor:var(--dwc-cursor-click);display:flex;font-family:inherit;font-style:inherit;font-weight:inherit;height:100%;line-height:inherit;min-width:0;outline:none;padding:var(--dwc-space-2xs) var(--dwc-space-s);transition:fill var(--dwc-transition);user-select:none;width:100%}[part=control]:focus{outline:none}:host(:not([disabled])) [part=control]{overflow:hidden;position:relative;transform:translate3d(0, 0, 0)}:host(:not([disabled])) [part=control]::after{background-image:radial-gradient(circle, var(--dwc-ripple-color, currentColor) 10%, transparent 10.01%);background-position:50%;background-repeat:no-repeat;content:"";display:block;filter:blur(3px);height:100%;left:50%;margin-left:-50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%) scale(10, 10);transition:transform var(--dwc-transition-fast), opacity var(--dwc-transition-x-slow), filter var(--dwc-transition-slow);width:100%}:host(:not([disabled])) [part=control]:active::after{filter:blur(0);opacity:0.2;transform:translateY(-50%) scale(0, 0) !important;transition:none}:host([disabled]) [part=control]{cursor:var(--dwc-disabled-cursor);opacity:var(--dwc-disabled-opacity);user-select:none;pointer-events:none}:host([disabled]) [part=control] *{cursor:var(--dwc-disabled-cursor);user-select:none;pointer-events:none}[part=label]{align-items:center;align-self:center;display:flex;flex:1;height:inherit;overflow:hidden;padding:var(--dwc-space-xs) var(--dwc-space-s);text-overflow:ellipsis;white-space:nowrap}[part=label] div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[part=prefix],[part=suffix]{align-items:center;display:inline-flex;flex:0 0 auto}[part=hotkey]{align-self:center;color:var(--dwc-menuitem-hotkey-color, var(--dwc-color-gray-text));margin-left:var(--dwc-space-l);padding:0 var(--dwc-space-s);}[part~=icon-wrapper]{--dwc-icon-size:1.5em;align-self:center;align-self:center;display:flex;opacity:0;transform:scale(0.9);transition:var(--dwc-transition-fast) opacity, var(--dwc-transition-fast) transform}:host([checked]) [part~=icon-wrapper-check]{opacity:1;transform:none}:host([dropdown]) [part~=icon-wrapper-chevron]{opacity:1;transform:none}:host([placement=right]) [part~=icon-wrapper-chevron]{transform:rotate(270deg)}:host([placement=left]){flex-direction:row-reverse;text-align:right}:host([placement=left]) [part=label]{flex-direction:row-reverse}:host([placement=left]) [part=hotkey]{margin-left:auto;margin-right:var(--dwc-space-l)}:host([placement=left]) [part~=icon-wrapper-chevron]{transform:rotate(180deg)}:host([placement=left]) [part~=icon-wrapper-chevron],:host([placement=bottom]) [part~=icon-wrapper-chevron]{transform:rotate(90deg)}:host([selected]:not([disabled])) [part=control]{background-color:var(--dwc-menuitem-selected-background, var(--dwc-color-primary));color:var(--dwc-menuitem-selected-color, var(--dwc-color-on-primary-text))}:host([selected]:not([disabled])) [part=control] [part=hotkey]{color:var(--dwc-menuitem-selected-hotkey-color, var(--dwc-menuitem-selected-color, var(--dwc-color-on-primary-text)))}:host(:not([selected]):not([disabled])) [part=control]:hover,:host(:not([selected]):not([disabled])) [part=control]:focus{background-color:var(--dwc-menuitem-highlighted-background, var(--dwc-color-primary-alt));color:var(--dwc-menuitem-highlighted-color, var(--dwc-color-on-primary-text-alt))}:host(:not([selected]):not([disabled])) [part=control]:hover [part=hotkey],:host(:not([selected]):not([disabled])) [part=control]:focus [part=hotkey]{color:var(--dwc-menuitem-highlighted-hotkey-color, var(--dwc-menuitem-highlighted-color, var(--dwc-color-on-primary-text-alt)))}:host(:not([selected]):not([disabled])) [part=control] [part~=icon-wrapper-check]{color:var(--dwc-menuitem-icon-check-color, var(--dwc-color-primary-text))}:host(:not([disabled])) [part=control]:active{background-color:var(--dwc-menuitem-active-background, var(--dwc-color-primary-dark));color:var(--dwc-menuitem-active-color, var(--dwc-color-on-primary-text-dark))}:host(:not([disabled])) [part=control]:active [part=hotkey]{color:var(--dwc-menuitem-active-hotkey-color, var(--dwc-menuitem-active-color, var(--dwc-color-on-primary-text-dark)))}:host([theme=primary]){--dwc-menuitem-selected-background:var(--dwc-color-primary);--dwc-menuitem-selected-color:var(--dwc-color-on-primary-text);--dwc-menuitem-highlighted-background:var(--dwc-color-primary-alt);--dwc-menuitem-highlighted-color:var(--dwc-color-on-primary-text-alt);--dwc-menuitem-active-background:var(--dwc-color-primary-dark);--dwc-menuitem-active-color:var(--dwc-color-on-primary-text-dark);--dwc-menuitem-icon-check-color:var(--dwc-color-primary-text)}:host([theme=success]){--dwc-menuitem-selected-background:var(--dwc-color-success);--dwc-menuitem-selected-color:var(--dwc-color-on-success-text);--dwc-menuitem-highlighted-background:var(--dwc-color-success-alt);--dwc-menuitem-highlighted-color:var(--dwc-color-on-success-text-alt);--dwc-menuitem-active-background:var(--dwc-color-success-dark);--dwc-menuitem-active-color:var(--dwc-color-on-success-text-dark);--dwc-menuitem-icon-check-color:var(--dwc-color-success-text)}:host([theme=warning]){--dwc-menuitem-selected-background:var(--dwc-color-warning);--dwc-menuitem-selected-color:var(--dwc-color-on-warning-text);--dwc-menuitem-highlighted-background:var(--dwc-color-warning-alt);--dwc-menuitem-highlighted-color:var(--dwc-color-on-warning-text-alt);--dwc-menuitem-active-background:var(--dwc-color-warning-dark);--dwc-menuitem-active-color:var(--dwc-color-on-warning-text-dark);--dwc-menuitem-icon-check-color:var(--dwc-color-warning-text)}:host([theme=danger]){--dwc-menuitem-selected-background:var(--dwc-color-danger);--dwc-menuitem-selected-color:var(--dwc-color-on-danger-text);--dwc-menuitem-highlighted-background:var(--dwc-color-danger-alt);--dwc-menuitem-highlighted-color:var(--dwc-color-on-danger-text-alt);--dwc-menuitem-active-background:var(--dwc-color-danger-dark);--dwc-menuitem-active-color:var(--dwc-color-on-danger-text-dark);--dwc-menuitem-icon-check-color:var(--dwc-color-danger-text)}:host([theme=info]){--dwc-menuitem-selected-background:var(--dwc-color-info);--dwc-menuitem-selected-color:var(--dwc-color-on-info-text);--dwc-menuitem-highlighted-background:var(--dwc-color-info-alt);--dwc-menuitem-highlighted-color:var(--dwc-color-on-info-text-alt);--dwc-menuitem-active-background:var(--dwc-color-info-dark);--dwc-menuitem-active-color:var(--dwc-color-on-info-text-dark);--dwc-menuitem-icon-check-color:var(--dwc-color-info-text)}:host([theme=gray]){--dwc-menuitem-selected-background:var(--dwc-color-gray);--dwc-menuitem-selected-color:var(--dwc-color-on-gray-text);--dwc-menuitem-highlighted-background:var(--dwc-color-gray-alt);--dwc-menuitem-highlighted-color:var(--dwc-color-on-gray-text-alt);--dwc-menuitem-active-background:var(--dwc-color-gray-dark);--dwc-menuitem-active-color:var(--dwc-color-on-gray-text-dark);--dwc-menuitem-icon-check-color:var(--dwc-color-gray-text)}:host([expanse=xl]){font-size:var(--dwc-font-size-xl)}:host([expanse=l]){font-size:var(--dwc-font-size-l)}:host([expanse=m]){font-size:var(--dwc-font-size-m)}:host([expanse=s]){font-size:var(--dwc-font-size-s)}:host([expanse=xs]){font-size:var(--dwc-font-size-xs)}';let U=0;const $=class{constructor(i){t(this,i),this.changedEvent=e(this,"dwc-changed",7),this.clickedEvent=e(this,"dwc-clicked",7),this.openedEvent=e(this,"dwc-opened",7),this.closedEvent=e(this,"dwc-closed",7),this.popupId="popup-"+ ++U,this.isOpened=!1,this.virtualElement={},this.contextElement=void 0,this.disabled=void 0,this.distance=0,this.label="",this.maxRowCount=void 0,this.opened=!1,this.placement=void 0,this.skidding=0,this.type="",this.x=0,this.y=0}onDisabledChanged(t){this.$menu&&(this.$menu.disabled=t)}onLabelChanged(t){this.$menu&&(this.$menu.label=t)}handleMaxRowCountChange(t){this.$menu&&(this.$menu.maxRowCount=t)}onOpenedChanged(){this.isOpened?this.close():this.open()}onPlacementChanged(t){this.$menu&&(this.$menu.placement=t)}onTypeChanged(t){this.$menu&&(this.$menu.type=t)}onCoordinateChange(){var t,e;this.virtualElement.contextElement=this.contextElement,this.virtualElement.getBoundingClientRect=this.generateGetBoundingClientRect(this.x,this.y),null===(t=this.popper)||void 0===t||t.update(),null===(e=this.$menu)||void 0===e||e.reposition()}onProperOptionsChanged(){this.popper&&this.popper.setOptions({modifiers:[c(this.skidding,this.distance),u()]})}connectedCallback(){this.handleSlotChange=this.handleSlotChange.bind(this),this.handleMenuChanged=this.handleMenuChanged.bind(this),this.handleMenuClicked=this.handleMenuClicked.bind(this),this.handleMenuChanged=this.handleMenuChanged.bind(this),this.handleMenuKeydown=this.handleMenuKeydown.bind(this),this.getAvailablePopups()[this.popupId]=this}componentWillLoad(){this.virtualElement.contextElement=this.contextElement,this.virtualElement.getBoundingClientRect=this.generateGetBoundingClientRect(this.x,this.y)}componentDidLoad(){this.opened&&this.open()}disconnectedCallback(){delete this.getAvailablePopups()[this.popupId],this.popper&&this.popper.destroy()}async handleDocumentClick(t){var e;const i=t.target;this.$menu&&((null===(e=this.$menu)||void 0===e?void 0:e.isSameNode(i))||await this.$menu.hasItem(i)||t.defaultPrevented||this.close())}async setFocus(){this.$menu&&await this.$menu.setFocus()}async removeFocus(){this.$menu&&await this.$menu.removeFocus()}async open(){if(this.disabled)return;const t=this.getAvailablePopups();for(const e in t)if(e!==this.popupId&&Object.hasOwn(t,e)){const i=t[e];await i.close()}this.isOpened?this.popper&&this.$menu&&(await this.$menu.close(),this.popper.forceUpdate()):this.$menu&&this.popper&&!this.popper.isVisible&&(await this.popper.open(),this.opened=!0,this.isOpened=!0,this.openedEvent.emit())}async close(){this.isOpened&&this.$menu&&this.popper&&this.popper.isVisible&&(await this.popper.close(),this.opened=!1,this.isOpened=!1,await this.$menu.close(),this.closedEvent.emit())}async toggle(){this.opened?await this.close():await this.open()}async hasItem(t){return(!t||"dwc-menuitem"===t.nodeName.toLocaleLowerCase())&&!!this.$menu&&await this.$menu.hasItem(t)}getAvailablePopups(){return window.Dwc=window.Dwc||{},window.Dwc.Popups=window.Dwc.Popups||{},window.Dwc.Popups}generateGetBoundingClientRect(t=0,e=0){return()=>({width:0,height:0,top:e,right:t,bottom:e,left:t})}initPopover(){if(this.popper&&this.popper.destroy(),!this.$menu)return;const t=this.$menu;let e=t.parentElement;if(!e.classList.contains("dwc-positioner")){const i=document.createElement("div");i.classList.add("dwc-positioner","dwc-positioner--popupmenu"),t.parentElement.insertBefore(i,t),i.appendChild(t),e=i,e.setAttribute("hidden","true"),e.forPopup=this.el}this.popper=new l(this.virtualElement,e,{strategy:"absolute",moveTo:document.body,restoreTo:this.el,transitionedElement:t,modifiers:[c(this.skidding,this.distance),h(),d("viewport",!0),u()]}),this.opened&&this.open()}menuClickedOrChanged(t){if(this.disabled||t.defaultPrevented)return;const e=t.detail.item;t.defaultPrevented||this.el.contains(e)||e.hasAttribute("dropdown")||this.close()}handleMenuChanged(t){this.changedEvent.emit(t.detail),this.menuClickedOrChanged(t)}handleMenuClicked(t){this.clickedEvent.emit(t.detail),this.menuClickedOrChanged(t)}handleMenuKeydown(t){"Escape"===t.key&&this.close()}handleSlotChange(){const t=this.el.shadowRoot.querySelector("[data-menu-slot]").assignedElements({flatten:!0}).filter((t=>"dwc-menu"===t.tagName.toLowerCase()))[0];t&&(t.isSameNode(this.$menu)||(t.addEventListener("dwc-changed",this.handleMenuChanged),t.addEventListener("dwc-clicked",this.handleMenuClicked),t.addEventListener("keydown",this.handleMenuKeydown),this.$menu&&(this.$menu.removeEventListener("dwc-changed",this.handleMenuChanged),this.$menu.removeEventListener("dwc-clicked",this.handleMenuClicked),this.$menu.removeEventListener("keydown",this.handleMenuKeydown))),this.$menu=t,this.$menu.classList.add("dwc-popper","dwc-popper--popupmenu"),void 0!==this.disabled&&(this.$menu.disabled=this.disabled),void 0!==this.placement&&(this.$menu.placement=this.placement),this.$menu.label=this.label,this.$menu.type=this.type,this.$menu.maxRowCount=this.maxRowCount,this.initPopover())}render(){return i(s,{key:"de4aef38d6341ce9f728c5b492d38d0906c7a423",class:r({BBjControl:!0,BBjPopupMenu:!0,"bbj-disabled":this.disabled})},i("div",{key:"443798e3bf664b5039b1171d9366b29c1d5e8b59",part:"control"},i("slot",{key:"912d89cc000f80df773d714fed1065d77dce4656","data-menu-slot":!0,onSlotchange:this.handleSlotChange})))}get el(){return o(this)}static get watchers(){return{disabled:["onDisabledChanged"],label:["onLabelChanged"],maxRowCount:["handleMaxRowCountChange"],opened:["onOpenedChanged"],placement:["onPlacementChanged"],type:["onTypeChanged"],x:["onCoordinateChange"],y:["onCoordinateChange"],contextElement:["onCoordinateChange"],distance:["onProperOptionsChanged"],skidding:["onProperOptionsChanged"]}}};$.style=":host{display:none}";export{L as dwc_hotkey,H as dwc_menu,I as dwc_menuitem,$ as dwc_popupmenu}