@mlightcad/ribbon 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,4 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`),require(`element-plus`),require(`@element-plus/icons-vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`,`element-plus`,`@element-plus/icons-vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MlRibbon={},e.Vue,e.ElementPlus,e.ElementPlusIconsVue))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=Symbol(`RibbonContext`);function a(e){return e==null||typeof e==`string`?e:typeof e==`object`||typeof e==`function`?(0,t.markRaw)((0,t.toRaw)(e)):e}function o(e){if(!e)return;let t={...e};return`component`in t&&(t.component=a(t.component)),`icon`in t&&(t.icon=a(t.icon)),`activeIcon`in t&&(t.activeIcon=a(t.activeIcon)),`inactiveIcon`in t&&(t.inactiveIcon=a(t.inactiveIcon)),Array.isArray(t.options)&&(t.options=t.options.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return`icon`in t?{...t,icon:a(t.icon)}:t})),Array.isArray(t.categories)&&(t.categories=t.categories.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return{...t,items:Array.isArray(t.items)?t.items.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return{...t,preview:a(t.preview),icon:a(t.icon),component:a(t.component)}}):t.items}})),t}function s(e){return{...e,icon:a(e.icon),props:o(e.props)}}function c(e){return{...e,icon:a(e.icon),footerMenuItems:e.footerMenuItems?.map(s),collections:e.collections?.map(e=>({...e,items:e.items.map(s)}))}}function l(e){return{...e,groups:e.groups?.map(c)}}function u(e){return e.map(l)}function d(e){return e!=null&&e.visible!==!1}function f(e){return e.find(d)?.id??``}function p(e){(!e.collections||e.collections.length===0)&&(e.collections=[{id:`${e.id}-collection-1`,items:[]}])}function m(e,t,n,r,i){let a=e.find(e=>e.id===t);if(!a?.groups)return;let o=a.groups.find(e=>e.id===n);if(!o?.collections)return;let s=o.collections.find(e=>e.id===r);s&&i(s.items)}function h(e,n,r,i,a,o,h,g){let _=(0,t.ref)(r),v=(0,t.ref)(i),y=(0,t.ref)(a),b=(0,t.ref)(d(n.find(e=>e.id===o))?o:f(n)),x=(0,t.ref)(u(n)),S=(0,t.ref)(!1),C=(0,t.ref)(!1),w=(0,t.ref)(!1),T=(0,t.ref)([]),E=(0,t.ref)(``),D=(0,t.ref)(h),O=(0,t.ref)(g),k=(0,t.computed)(()=>x.value.filter(e=>e.visible!==!1)),A={addTab(e){x.value.push(l(e)),b.value||=e.id},removeTab(e){x.value=x.value.filter(t=>t.id!==e),b.value===e&&(b.value=k.value[0]?.id??``)},showTab(e){let t=x.value.find(t=>t.id===e);t&&(t.visible=!0)},hideTab(e){let t=x.value.find(t=>t.id===e);t&&(t.visible=!1),b.value===e&&(b.value=f(x.value))},selectTab(e){b.value=e},addGroup(e,t){let n=x.value.find(t=>t.id===e);n&&(n.groups??=[],p(t),n.groups.push(c(t)))},removeGroup(e,t){let n=x.value.find(t=>t.id===e);n?.groups&&(n.groups=n.groups.filter(e=>e.id!==t))},showGroup(e,t){let n=x.value.find(t=>t.id===e)?.groups?.find(e=>e.id===t);n&&(n.visible=!0)},hideGroup(e,t){let n=x.value.find(t=>t.id===e)?.groups?.find(e=>e.id===t);n&&(n.visible=!1)},addItem(e,t,n,r){m(x.value,e,t,n,e=>e.push(s(r)))},removeItem(e,t,n,r){m(x.value,e,t,n,e=>{let t=e.findIndex(e=>e.id===r);t>=0&&e.splice(t,1)})},updateItem(e,t,n,r,i){m(x.value,e,t,n,e=>{let t=e.find(e=>e.id===r);t&&Object.assign(t,i)})},enableItem(e,t,n,r){A.updateItem(e,t,n,r,{disabled:!1})},disableItem(e,t,n,r){A.updateItem(e,t,n,r,{disabled:!0})},refreshLayout(){S.value=!1},minimize(e){y.value=e},toggleSimplified(){v.value=v.value===`classic`?`simplified`:`classic`}};return{context:{id:e,disabled:_,layout:v,minimized:y,activeTab:b,tabs:x,overflowOpen:S,backdropOpen:C,keyTipsOpen:w,keyTips:T,keyTipsSequence:E,tooltipShowAfter:D,tooltipHideAfter:O,registerKeyTip:e=>{T.value.some(t=>t.id===e.id)||T.value.push(e)},unregisterKeyTip:e=>{T.value=T.value.filter(t=>t.id!==e)},api:A},visibleTabs:k}}var g={class:`ml-ribbon-backstage__nav`},_={class:`ml-ribbon-backstage__content`},v={key:0},y={key:1},b=(0,t.defineComponent)({__name:`RibbonBackstage`,props:{open:{type:Boolean},backLabel:{},title:{},description:{},size:{default:`default`}},emits:[`close`],setup(e,{emit:r}){let i=e,a=r;function o(){a(`close`)}return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDrawer),{"model-value":i.open,size:`100%`,"with-header":!1,direction:`ltr`,onClose:o},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-backstage`,`ml-ribbon-backstage--size-${i.size||`default`}`])},[e.$slots.default?(0,t.renderSlot)(e.$slots,`default`,{key:0,close:o,backLabel:i.backLabel,title:i.title,description:i.description,size:i.size}):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`aside`,g,[(0,t.createVNode)((0,t.unref)(n.ElButton),{type:`primary`,onClick:o},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(i.backLabel),1)]),_:1})]),(0,t.createElementVNode)(`section`,_,[i.title?((0,t.openBlock)(),(0,t.createElementBlock)(`h2`,v,(0,t.toDisplayString)(i.title),1)):(0,t.createCommentVNode)(``,!0),i.description?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,y,(0,t.toDisplayString)(i.description),1)):(0,t.createCommentVNode)(``,!0)])],64))],2)]),_:3},8,[`model-value`]))}}),x={class:`ml-ribbon-tabs`,role:`tablist`},S=[`aria-selected`,`disabled`,`onClick`],C=(0,t.defineComponent)({__name:`RibbonTabs`,props:{tabs:{},activeTab:{},disabled:{type:Boolean}},emits:[`select`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.computed)(()=>r.tabs.filter(e=>e.visible!==!1));function o(e,t){i(`select`,{id:e,triggerEl:t.currentTarget instanceof HTMLElement?t.currentTarget:null})}return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,x,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(a.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:n.id,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-tab`,{"is-active":e.activeTab===n.id}]),role:`tab`,"aria-selected":e.activeTab===n.id,disabled:r.disabled,onClick:e=>o(n.id,e)},(0,t.toDisplayString)(n.title),11,S))),128))]))}}),w={class:`ml-ribbon-contextual-tabs`},T={class:`ml-ribbon-contextual-tabs__normal`},E={class:`ml-ribbon-contextual-tabs__ctx`},D={key:0},O=(0,t.defineComponent)({__name:`RibbonContextualTabs`,props:{tabs:{},activeTab:{},disabled:{type:Boolean}},emits:[`select`],setup(e,{emit:n}){let r=e,i=n;return(n,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,w,[(0,t.createElementVNode)(`div`,T,[(0,t.createVNode)(C,{tabs:r.tabs.filter(e=>!e.contextual),"active-tab":e.activeTab,disabled:r.disabled,onSelect:a[0]||=e=>i(`select`,e)},null,8,[`tabs`,`active-tab`,`disabled`])]),(0,t.createElementVNode)(`div`,E,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.tabs.filter(e=>e.contextual),n=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:n.id,class:`ml-ribbon-contextual-tabs__block`,style:(0,t.normalizeStyle)({"--ctx-color":n.contextualColor||`#67c23a`})},[n.contextualTitle?.trim()?((0,t.openBlock)(),(0,t.createElementBlock)(`small`,D,(0,t.toDisplayString)(n.contextualTitle.trim()),1)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(C,{tabs:[n],"active-tab":e.activeTab,disabled:r.disabled,onSelect:a[1]||=e=>i(`select`,e)},null,8,[`tabs`,`active-tab`,`disabled`])],4))),128))])]))}}),k={class:`ml-ribbon-file-menu-submenu__trigger`},A=(0,t.defineComponent)({__name:`RibbonFileMenuItem`,props:{item:{},divided:{type:Boolean},popperClass:{}},emits:[`select`],setup(e,{emit:i}){let a=e,o=i,s=e=>Array.isArray(e.children)&&e.children.length>0;function c(e){o(`select`,e)}return(e,i)=>{let o=(0,t.resolveComponent)(`RibbonFileMenuItem`,!0);return s(a.item)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdownItem),{key:0,divided:a.divided,disabled:a.item.disabled,class:`ml-ribbon-file-menu-submenu`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElDropdown),{trigger:`hover`,placement:`right-start`,teleported:!0,"show-timeout":0,"hide-timeout":100,"popper-class":a.popperClass,onCommand:c},{dropdown:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElDropdownMenu),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(a.item.children,e=>((0,t.openBlock)(),(0,t.createBlock)(o,{key:e.id,item:e,divided:e.divided===!0,"popper-class":a.popperClass,onSelect:c},null,8,[`item`,`divided`,`popper-class`]))),128))]),_:1})]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,k,[(0,t.createTextVNode)((0,t.toDisplayString)(a.item.label)+` `,1),(0,t.createVNode)((0,t.unref)(n.ElIcon),{class:`ml-ribbon-file-menu-submenu__arrow`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.ArrowRight))]),_:1})])]),_:1},8,[`popper-class`])]),_:1},8,[`divided`,`disabled`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdownItem),{key:1,divided:a.divided,command:a.item.id,disabled:a.item.disabled},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(a.item.label),1)]),_:1},8,[`divided`,`command`,`disabled`]))}}}),j=[`disabled`],M=(0,t.defineComponent)({__name:`RibbonFileMenu`,props:{items:{},label:{},openBackstageLabel:{},showOpenBackstage:{type:Boolean},disabled:{type:Boolean}},emits:[`select`,`open-backstage`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.ref)(!1),s=(0,n.useGlobalConfig)(`size`,``),c=(0,t.computed)(()=>s.value||`default`),l=(0,t.computed)(()=>`ml-ribbon-file-menu-dropdown ml-ribbon-popper ml-ribbon-popper--size-${c.value}`);function u(e){o.value=e}function d(e){if(e===`__backstage`){a(`open-backstage`);return}a(`select`,e)}return(0,t.watch)(()=>i.disabled,e=>{e&&(o.value=!1)}),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdown),{trigger:`click`,disabled:i.disabled,"popper-class":l.value,onCommand:d,onVisibleChange:u},{dropdown:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElDropdownMenu),null,{default:(0,t.withCtx)(()=>[i.showOpenBackstage===!1?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdownItem),{key:0,command:`__backstage`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(i.openBackstageLabel),1)]),_:1})),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(i.items,(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(A,{key:e.id,item:e,divided:e.divided===!0||i.showOpenBackstage!==!1&&n===0,"popper-class":l.value,onSelect:d},null,8,[`item`,`divided`,`popper-class`]))),128))]),_:1})]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-tab ml-ribbon-tab--file`,{"is-active":o.value}]),disabled:i.disabled},(0,t.toDisplayString)(i.label),11,j)]),_:1},8,[`disabled`,`popper-class`]))}}),N=(0,t.defineComponent)({__name:`RibbonCollection`,props:{id:{},layout:{default:`row`},rows:{default:3}},setup(e){let n=e,r=(0,t.computed)(()=>({"--ml-ribbon-collection-rows":String(n.rows)}));return(e,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-collection`,[`ml-ribbon-collection--${n.layout}`]]),style:(0,t.normalizeStyle)(r.value)},[(0,t.renderSlot)(e.$slots,`default`)],6))}}),P={key:3,class:`ml-ribbon-item-host__label ml-ribbon-button__label`},F=(0,t.defineComponent)({name:`MlRibbonButton`,__name:`RibbonButton`,props:{id:{},label:{default:void 0},icon:{default:void 0},disabled:{type:Boolean,default:!1},hideLabel:{type:Boolean,default:!1},ariaLabel:{default:void 0},iconSize:{default:void 0},size:{default:void 0},buttonType:{default:`default`},nativeType:{default:`button`}},emits:[`click`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.computed)(()=>i.label===void 0?i.id:i.label.trim()),s=(0,t.computed)(()=>!i.hideLabel&&o.value.length>0),c=(0,t.computed)(()=>i.ariaLabel?.trim()||o.value||i.id),l=(0,t.computed)(()=>!i.icon||typeof i.icon==`string`?null:i.icon),u=(0,t.computed)(()=>{if(typeof i.icon!=`string`)return null;let e=i.icon.trim();return e.length>0?e:null}),d=(0,t.computed)(()=>s.value?`ml-ribbon-item-host__icon--with-label`:`ml-ribbon-item-host__icon--icon-only`),f=(0,t.computed)(()=>{if(i.iconSize)return{fontSize:i.iconSize}});function p(e){i.disabled||a(`click`,e)}return(r,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElButton),{class:`ml-ribbon-button`,"data-ribbon-button-id":e.id,type:e.buttonType,size:e.size,"native-type":e.nativeType,disabled:e.disabled,"aria-label":c.value,onClick:p},{default:(0,t.withCtx)(()=>[r.$slots.icon?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`ml-ribbon-item-host__icon ml-ribbon-button__icon`,d.value]),style:(0,t.normalizeStyle)(f.value),"aria-hidden":`true`},[(0,t.renderSlot)(r.$slots,`icon`)],6)):l.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:1,class:(0,t.normalizeClass)([`ml-ribbon-item-host__icon ml-ribbon-button__icon`,d.value]),style:(0,t.normalizeStyle)(f.value)},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(l.value)))]),_:1},8,[`class`,`style`])):u.value?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:2,class:(0,t.normalizeClass)([`ml-ribbon-item-host__icon ml-ribbon-item-host__icon--class ml-ribbon-button__icon`,[u.value,d.value]]),style:(0,t.normalizeStyle)(f.value),"aria-hidden":`true`},null,6)):(0,t.createCommentVNode)(``,!0),s.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,P,[(0,t.renderSlot)(r.$slots,`label`,{},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(o.value),1)])])):(0,t.createCommentVNode)(``,!0),(0,t.renderSlot)(r.$slots,`default`)]),_:3},8,[`data-ribbon-button-id`,`type`,`size`,`native-type`,`disabled`,`aria-label`]))}}),I=[`data-id`],L={key:0,class:`ml-ribbon-button-group__label`},R={class:`ml-ribbon-button-group__text`},z=(0,t.defineComponent)({__name:`RibbonButtonGroup`,props:{id:{},label:{},options:{},hideLabel:{type:Boolean,default:!1},wrap:{type:Boolean,default:!0},equalWidth:{type:Boolean,default:!1},buttonSize:{},iconSize:{},tooltipShowAfter:{default:1e3},tooltipHideAfter:{default:0},disabled:{type:Boolean,default:!1}},emits:[`change`],setup(e,{emit:r}){let i=e,a=r;function o(e){i.disabled||a(`change`,e)}function s(e){return typeof e==`string`&&e.trim().length>0}function c(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function l(e){if(typeof e==`string`){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim();return t?t.replace(/\b\w/g,e=>e.toUpperCase()):void 0}if(typeof e==`number`||typeof e==`boolean`)return String(e)}function u(e){return c(e.tooltip)??c(e.label)??l(e.value)}return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-button-group`,{"ml-ribbon-button-group--nowrap":!e.wrap,"ml-ribbon-button-group--equal-width":!e.wrap&&e.equalWidth}]),"data-id":e.id},[!e.hideLabel&&e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,L,(0,t.toDisplayString)(e.label),1)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)((0,t.unref)(n.ElButtonGroup),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.options,r=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElTooltip),{key:String(r.value),content:u(r),disabled:!u(r),"show-after":e.tooltipShowAfter,"hide-after":e.tooltipHideAfter,placement:`top`,effect:`dark`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(F,{id:String(r.value),class:`ml-ribbon-button-group__button`,label:r.label,icon:r.icon,"icon-size":e.iconSize,size:e.buttonSize,disabled:e.disabled,"hide-label":!s(r.label),"aria-label":u(r)??String(r.value),onClick:e=>o(r.value)},(0,t.createSlots)({_:2},[s(r.label)?{name:`label`,fn:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,R,(0,t.toDisplayString)(r.label),1)]),key:`0`}:void 0]),1032,[`id`,`label`,`icon`,`icon-size`,`size`,`disabled`,`hide-label`,`aria-label`,`onClick`])]),_:2},1032,[`content`,`disabled`,`show-after`,`hide-after`]))),128))]),_:1})],10,I))}}),B={class:`ml-ribbon-item-host__content ml-ribbon-dropdown__content`},ee={class:`ml-ribbon-item-host__text-row ml-ribbon-dropdown__text-row`},V={key:0,class:`ml-ribbon-item-host__label ml-ribbon-dropdown__label`},te={class:`ml-ribbon-dropdown-item__content`},H={class:`ml-ribbon-dropdown-item__row`},U={key:0,class:`ml-ribbon-dropdown-item__check`,"aria-hidden":`true`},W={class:`ml-ribbon-dropdown-item__main`},G={class:`ml-ribbon-dropdown-item__label`},K=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,t.defineComponent)({name:`MlRibbonDropdown`,__name:`RibbonDropdown`,props:{id:{},label:{default:void 0},tooltip:{default:void 0},icon:{default:void 0},options:{default:()=>[]},disabled:{type:Boolean,default:!1},hideLabel:{type:Boolean,default:!1},syncLabelWithSelection:{type:Boolean,default:!1},itemSize:{default:`medium`},tooltipShowAfter:{default:1e3},tooltipHideAfter:{default:0},popperClass:{default:void 0},modelValue:{default:void 0}},emits:[`command`,`click`,`tooltip-change`],setup(e,{emit:i}){let a=e,o=i,s=(0,n.useGlobalConfig)(`size`,``),c=(0,t.computed)(()=>s.value||`default`),l=(0,t.ref)(!1),u=(0,t.ref)(void 0);(0,t.watch)(()=>a.modelValue,e=>{e!==void 0&&(u.value=e)},{immediate:!0});let d=(0,t.computed)(()=>Array.isArray(a.options)?a.options:[]),f=(0,t.computed)(()=>d.value.find(e=>D(e)===u.value)??null),p=(0,t.computed)(()=>{if(f.value&&a.syncLabelWithSelection){let e=k(f.value);if(e)return e}return M(a.label)??a.id}),m=(0,t.computed)(()=>!a.hideLabel&&p.value.length>0),h=(0,t.computed)(()=>a.modelValue!==void 0||a.syncLabelWithSelection),g=(0,t.computed)(()=>{if(f.value){let e=T(f.value);if(e)return e}return!a.icon||typeof a.icon==`string`?null:a.icon}),_=(0,t.computed)(()=>{if(f.value){let e=E(f.value);if(e)return e}if(typeof a.icon!=`string`)return null;let e=a.icon.trim();return e.length>0?e:null}),v=(0,t.computed)(()=>!!(g.value||_.value)),y=(0,t.computed)(()=>j(f.value)??M(a.tooltip)??M(p.value)??M(a.label)??N(a.id)),b=(0,t.computed)(()=>[`ml-ribbon-dropdown-menu`,`ml-ribbon-popper`,`ml-ribbon-popper--size-${c.value}`,a.popperClass].filter(Boolean).join(` `));function x(e){if(a.disabled){l.value=!1;return}l.value=e}function S(){a.disabled||(l.value=!l.value)}function C(e){a.disabled||(u.value=e,o(`tooltip-change`,j(f.value)??y.value),o(`command`,e),l.value=!1)}function w(){if(a.disabled)return;let e=f.value;if(!e){o(`click`);return}o(`command`,D(e))}function T(e){if(!e||typeof e!=`object`)return null;let t=e.icon;return!t||typeof t==`string`?null:t}function E(e){if(!e||typeof e!=`object`)return null;let t=e.icon;return typeof t!=`string`||t.trim().length===0?null:t}function D(e){if(!(!e||typeof e!=`object`))return e.value}function O(e){let t=D(e);if(typeof t==`string`||typeof t==`number`||t&&typeof t==`object`)return t}function k(e){if(!e||typeof e!=`object`)return;let t=e.label;return typeof t==`string`?t:void 0}function A(e){if(typeof e==`string`)return N(e);if(typeof e==`number`||typeof e==`boolean`)return String(e)}function j(e){if(!(!e||typeof e!=`object`))return M(e.tooltip)??k(e)??A(D(e))}function M(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function N(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim();return t?t.replace(/\b\w/g,e=>e.toUpperCase()):e}function P(e){return D(e)===u.value}return(i,a)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdown),{class:(0,t.normalizeClass)([`ml-ribbon-dropdown`,[`ml-ribbon-dropdown--item-${e.itemSize}`,{"is-label-hidden":e.hideLabel}]]),trigger:`click`,disabled:e.disabled,"popper-class":b.value,onVisibleChange:x,onCommand:C},{dropdown:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElDropdownMenu),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(d.value,a=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdownItem),{key:String(D(a)),command:O(a),disabled:a.disabled===!0,divided:a.divided===!0,"aria-current":P(a)?`true`:void 0,class:(0,t.normalizeClass)({"ml-ribbon-dropdown-item--selected":P(a)})},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElTooltip),{content:j(a),disabled:!j(a),"show-after":e.tooltipShowAfter,"hide-after":e.tooltipHideAfter,placement:`top`,effect:`dark`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,te,[(0,t.renderSlot)(i.$slots,`option`,{option:a},()=>[(0,t.createElementVNode)(`span`,H,[h.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,U,[P(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-dropdown-item__check-icon`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.Check))]),_:1})):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,W,[T(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-dropdown-item__icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(T(a))))]),_:2},1024)):E(a)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-dropdown-item__icon ml-ribbon-dropdown-item__icon--class`,E(a)]),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,G,(0,t.toDisplayString)(k(a)),1)])])],!0)])]),_:2},1032,[`content`,`disabled`,`show-after`,`hide-after`])]),_:2},1032,[`command`,`disabled`,`divided`,`aria-current`,`class`]))),128))]),_:3})]),default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElButton),{type:`default`,disabled:e.disabled,"aria-label":y.value,onClick:S},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,B,[i.$slots.icon||v.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`ml-ribbon-item-host__icon ml-ribbon-item-host__icon--dropdown-primary ml-ribbon-dropdown__icon`,{"ml-ribbon-item-host__icon--class":_.value&&!g.value&&!i.$slots.icon}]),onClick:(0,t.withModifiers)(w,[`stop`])},[(0,t.renderSlot)(i.$slots,`icon`,{selectedOption:f.value},()=>[g.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(g.value)))]),_:1})):_.value?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)(_.value),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0)],!0)],2)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,ee,[m.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,V,[(0,t.renderSlot)(i.$slots,`label`,{selectedOption:f.value,label:p.value},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(p.value),1)],!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)((0,t.unref)(n.ElIcon),{class:(0,t.normalizeClass)([`ml-ribbon-item-host__dropdown-arrow ml-ribbon-dropdown__arrow`,{"is-open":l.value}])},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(l.value?(0,t.unref)(r.ArrowUp):(0,t.unref)(r.ArrowDown))))]),_:1},8,[`class`])])])]),_:3},8,[`disabled`,`aria-label`])]),_:3},8,[`class`,`disabled`,`popper-class`]))}}),[[`__scopeId`,`data-v-3704c6ba`]]),q=[`disabled`],ne=[`src`],re={key:3,class:`ml-ribbon-gallery__preview-svg`,role:`presentation`,"aria-hidden":`true`},ie=[`href`],ae={class:`ml-ribbon-gallery__label ml-ribbon-gallery__collapsed-label`},oe={class:`ml-ribbon-gallery__panel`},se={key:0,class:`ml-ribbon-gallery__panel-category-title`},J=[`disabled`,`onClick`],Y=[`src`],X={key:3,class:`ml-ribbon-gallery__preview-svg`,role:`presentation`,"aria-hidden":`true`},ce=[`href`],le={class:`ml-ribbon-gallery__label`},ue={key:1,class:`ml-ribbon-gallery__title`},de={key:2,class:`ml-ribbon-gallery__categories`},fe={key:0,class:`ml-ribbon-gallery__category-title`},pe=[`disabled`,`onClick`],me=[`src`],Z={key:3,class:`ml-ribbon-gallery__preview-svg`,role:`presentation`,"aria-hidden":`true`},he=[`href`],ge={class:`ml-ribbon-gallery__label`},_e={key:0,class:`ml-ribbon-gallery__controls`,"aria-label":`Gallery navigation`},ve=[`disabled`],ye=[`disabled`],be=[`disabled`],xe={key:0,class:`ml-ribbon-gallery__panel-category-title`},Q=[`data-gallery-row-index`,`disabled`,`onClick`],Se=[`src`],Ce={key:3,class:`ml-ribbon-gallery__preview-svg`,role:`presentation`,"aria-hidden":`true`},we=[`href`],Te={class:`ml-ribbon-gallery__label`},Ee=6,De=64,Oe=4,ke=16,Ae=4,je=22,Me=(0,t.defineComponent)({name:`MlRibbonGallery`,__name:`RibbonGallery`,props:{id:{},label:{},categories:{},disabled:{type:Boolean,default:!1},modelValue:{},collapsed:{type:Boolean,default:!1},inlineItemLimit:{default:4},inlineItemWidthMode:{default:`fixed`},previewFallback:{}},emits:[`select`],setup(e,{emit:i}){let a=e,o=i,s=(0,t.ref)(``),c=(0,t.ref)(!1),l=(0,t.ref)(0),u=(0,t.ref)(null),d=(0,t.ref)(null),f=(0,t.ref)(null),p=(0,t.ref)(0),m=(0,n.useGlobalConfig)(`size`,``),h=(0,t.computed)(()=>m.value||`default`),g=(0,t.computed)(()=>h.value===`small`?.92:h.value===`large`?1.08:1),_=(0,t.computed)(()=>Math.round(De*g.value)),v=(0,t.computed)(()=>Math.round(je*g.value)),y=(0,t.computed)(()=>a.label?.trim()??``),b=(0,t.computed)(()=>a.categories.filter(e=>e.items.length>0).length),x=(0,t.computed)(()=>a.categories.flatMap(e=>e.items)),S=(0,t.computed)(()=>x.value.find(e=>e.id===s.value)??x.value[0]),C=(0,t.computed)(()=>!Number.isFinite(a.inlineItemLimit)||a.inlineItemLimit<=0?4:Math.floor(a.inlineItemLimit)),w=(0,t.computed)(()=>{let e=C.value,t=x.value.length;return t===0?Math.min(e,1):Math.min(e,t)}),T=(0,t.computed)(()=>Math.max(1,Math.ceil(x.value.length/w.value))),E=(0,t.computed)(()=>Math.min(l.value,T.value-1)),D=(0,t.computed)(()=>j.value&&E.value>0),O=(0,t.computed)(()=>j.value&&E.value<T.value-1),k=(0,t.computed)(()=>{let e=E.value*w.value;return x.value.slice(e,e+w.value)}),A=(0,t.computed)(()=>new Set(k.value.map(e=>e.id))),j=(0,t.computed)(()=>x.value.length>w.value),M=(0,t.computed)(()=>{let e=[`ml-ribbon-gallery-panel`,`ml-ribbon-gallery-panel--${a.collapsed?`collapsed`:`inline`}`,`ml-ribbon-gallery-panel--size-${h.value}`];return a.inlineItemWidthMode===`auto`&&e.push(`ml-ribbon-gallery-panel--item-width-auto`),e.join(` `)}),N=(0,t.computed)(()=>({"--ml-ribbon-gallery-panel-columns":String(w.value),"--ml-ribbon-gallery-panel-item-width":`${_.value}px`})),P=(0,t.computed)(()=>a.inlineItemWidthMode===`auto`?`fit-content`:w.value*_.value+Math.max(0,w.value-1)*Oe+Ee*2+(a.collapsed?ke:Ae+v.value)),F=(0,t.computed)(()=>({modifiers:[{name:`offset`,options:{offset:[p.value,0]}}]}));(0,t.watch)(()=>a.modelValue,e=>{typeof e==`string`&&(s.value=e,ee(e))},{immediate:!0}),(0,t.watch)(()=>[x.value.map(e=>e.id).join(`\0`),w.value,s.value],()=>{ee()||(l.value=Math.min(l.value,T.value-1))}),(0,t.watch)(c,async e=>{!e||a.collapsed||(V(),await(0,t.nextTick)(),await(0,t.nextTick)(),te())});function I(e){return e==null||typeof e==`string`?e:typeof e==`object`||typeof e==`function`?(0,t.markRaw)((0,t.toRaw)(e)):e}function L(e){let t=y.value.toLowerCase(),n=e.title.trim().toLowerCase();return b.value>1||!t||n!==t}function R(e){return j.value?e.items.filter(e=>A.value.has(e.id)):e.items}function z(e){if(a.disabled||!j.value)return;let t=E.value+e;l.value=Math.min(Math.max(t,0),T.value-1)}function B(e){let t=x.value.findIndex(t=>t.id===e.id);return t<0?0:Math.floor(t/w.value)}function ee(e=s.value){let t=x.value.find(t=>t.id===e);return t?(l.value=B(t),!0):!1}function V(){let e=u.value,t=d.value;if(!e||!t){p.value=0;return}let n=e.querySelector(`.ml-ribbon-gallery__grid .ml-ribbon-gallery__item`)?.getBoundingClientRect().left??e.getBoundingClientRect().left;p.value=Math.round(n-t.getBoundingClientRect().left-Ee)}function te(){let e=f.value;e&&e.querySelector(`[data-gallery-row-index="${E.value}"]`)?.scrollIntoView?.({block:`start`})}function H(e){return e.preview&&typeof e.preview!=`string`?I(e.preview):e.icon&&typeof e.icon!=`string`?I(e.icon):null}function U(e){return e.component?I(e.component):null}function W(e){return a.disabled||e.disabled===!0}function G(e){if(typeof e.icon!=`string`)return null;let t=e.icon.trim();return t.length>0?t:null}function K(e){let t=e.previewSvg??e.svg;if(typeof t!=`string`)return null;let n=t.trim();return n.length>0?n:null}function Me(e){return e.startsWith(`data:image/svg+xml`)||e.endsWith(`.svg`)}function Ne(e){let t=K(e);return t?Me(t):!1}function Pe(e){return typeof e.preview==`string`?e.preview:a.previewFallback}function Fe(e){W(e)||(s.value=e.id,l.value=B(e),c.value=!1,o(`select`,e.id))}return(i,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`galleryRef`,ref:u,class:(0,t.normalizeClass)([`ml-ribbon-gallery`,{"is-disabled":e.disabled,"is-collapsed":e.collapsed,"is-unlabeled":!e.collapsed&&!y.value,"is-inline-item-width-auto":!e.collapsed&&e.inlineItemWidthMode===`auto`}])},[e.collapsed&&S.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:0,visible:c.value,"onUpdate:visible":a[0]||=e=>c.value=e,trigger:`click`,placement:`bottom-start`,disabled:e.disabled,width:P.value,"popper-class":M.value},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-gallery__collapsed-button`,{"is-selected":s.value===S.value.id,"is-open":c.value}]),disabled:W(S.value)},[U(S.value)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(U(S.value)),(0,t.mergeProps)({key:0},S.value.componentProps,{item:S.value,selected:s.value===S.value.id,disabled:W(S.value)}),null,16,[`item`,`selected`,`disabled`])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview ml-ribbon-gallery__collapsed-preview`,{"ml-ribbon-gallery__preview--icon":H(S.value)||G(S.value),"ml-ribbon-gallery__preview--svg":K(S.value)}])},[H(S.value)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-gallery__preview-icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(H(S.value))))]),_:1})):G(S.value)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview-icon ml-ribbon-gallery__preview-icon--class`,G(S.value)]),"aria-hidden":`true`},null,2)):K(S.value)&&Ne(S.value)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:K(S.value)??``,alt:``},null,8,ne)):K(S.value)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,re,[(0,t.createElementVNode)(`use`,{href:K(S.value)??``},null,8,ie)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Pe(S.value)),1)],64))],2),(0,t.createElementVNode)(`div`,ae,(0,t.toDisplayString)(S.value.label),1)],64))],10,q)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,oe,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.categories,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:e.id,class:`ml-ribbon-gallery__panel-category`},[L(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`h4`,se,(0,t.toDisplayString)(e.title),1)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:`ml-ribbon-gallery__panel-grid`,style:(0,t.normalizeStyle)(N.value)},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,r=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:r.id,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-gallery__item ml-ribbon-gallery__panel-item`,{"is-selected":s.value===r.id}]),disabled:W(r),onClick:e=>Fe(r)},[(0,t.renderSlot)(i.$slots,`item`,{item:r,category:e,selected:s.value===r.id,disabled:W(r),select:()=>Fe(r)},()=>[U(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(U(r)),(0,t.mergeProps)({key:0,ref_for:!0},r.componentProps,{item:r,category:e,selected:s.value===r.id,disabled:W(r)}),null,16,[`item`,`category`,`selected`,`disabled`])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview`,{"ml-ribbon-gallery__preview--icon":H(r)||G(r),"ml-ribbon-gallery__preview--svg":K(r)}])},[H(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-gallery__preview-icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(H(r))))]),_:2},1024)):G(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview-icon ml-ribbon-gallery__preview-icon--class`,G(r)]),"aria-hidden":`true`},null,2)):K(r)&&Ne(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:K(r)??``,alt:``},null,8,Y)):K(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,X,[(0,t.createElementVNode)(`use`,{href:K(r)??``},null,8,ce)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Pe(r)),1)],64))],2),(0,t.createElementVNode)(`div`,le,(0,t.toDisplayString)(r.label),1)],64))])],10,J))),128))],4)]))),128))])]),_:3},8,[`visible`,`disabled`,`width`,`popper-class`])):(0,t.createCommentVNode)(``,!0),!e.collapsed&&y.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ue,(0,t.toDisplayString)(y.value),1)):(0,t.createCommentVNode)(``,!0),e.collapsed?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,de,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.categories,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:e.id,class:`ml-ribbon-gallery__category`},[y.value&&L(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`h4`,fe,(0,t.toDisplayString)(e.title),1)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:`ml-ribbon-gallery__grid`,style:(0,t.normalizeStyle)({"--ml-ribbon-gallery-inline-columns":String(w.value)})},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(R(e),r=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:r.id,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-gallery__item`,{"is-selected":s.value===r.id}]),disabled:W(r),onClick:e=>Fe(r)},[(0,t.renderSlot)(i.$slots,`item`,{item:r,category:e,selected:s.value===r.id,disabled:W(r),select:()=>Fe(r)},()=>[U(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(U(r)),(0,t.mergeProps)({key:0,ref_for:!0},r.componentProps,{item:r,category:e,selected:s.value===r.id,disabled:W(r)}),null,16,[`item`,`category`,`selected`,`disabled`])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview`,{"ml-ribbon-gallery__preview--icon":H(r)||G(r),"ml-ribbon-gallery__preview--svg":K(r)}])},[H(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-gallery__preview-icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(H(r))))]),_:2},1024)):G(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview-icon ml-ribbon-gallery__preview-icon--class`,G(r)]),"aria-hidden":`true`},null,2)):K(r)&&Ne(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:K(r)??``,alt:``},null,8,me)):K(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,Z,[(0,t.createElementVNode)(`use`,{href:K(r)??``},null,8,he)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Pe(r)),1)],64))],2),(0,t.createElementVNode)(`div`,ge,(0,t.toDisplayString)(r.label),1)],64))])],10,pe))),128))],4)]))),128)),j.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_e,[(0,t.createElementVNode)(`button`,{type:`button`,class:`ml-ribbon-gallery__control-button`,disabled:e.disabled||!D.value,"aria-label":`Show previous gallery row`,onClick:a[1]||=e=>z(-1)},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.ArrowUp))]),_:1})],8,ve),(0,t.createElementVNode)(`button`,{type:`button`,class:`ml-ribbon-gallery__control-button`,disabled:e.disabled||!O.value,"aria-label":`Show next gallery row`,onClick:a[2]||=e=>z(1)},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.ArrowDown))]),_:1})],8,ye),(0,t.createVNode)((0,t.unref)(n.ElPopover),{visible:c.value,"onUpdate:visible":a[3]||=e=>c.value=e,trigger:`click`,placement:`bottom-start`,disabled:e.disabled,width:P.value,"popper-class":M.value,"popper-options":F.value},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{ref_key:`inlineMoreButtonRef`,ref:d,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-gallery__control-button ml-ribbon-gallery__more-button`,{"is-open":c.value}]),disabled:e.disabled,"aria-label":`Show more gallery items`,onClick:V},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.Bottom))]),_:1})],10,be)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{ref_key:`inlinePanelRef`,ref:f,class:`ml-ribbon-gallery__panel`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.categories,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:e.id,class:`ml-ribbon-gallery__panel-category`},[L(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`h4`,xe,(0,t.toDisplayString)(e.title),1)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:`ml-ribbon-gallery__panel-grid`,style:(0,t.normalizeStyle)(N.value)},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,r=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:r.id,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-gallery__item ml-ribbon-gallery__panel-item`,{"is-selected":s.value===r.id}]),"data-gallery-row-index":B(r),disabled:W(r),onClick:e=>Fe(r)},[(0,t.renderSlot)(i.$slots,`item`,{item:r,category:e,selected:s.value===r.id,disabled:W(r),select:()=>Fe(r)},()=>[U(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(U(r)),(0,t.mergeProps)({key:0,ref_for:!0},r.componentProps,{item:r,category:e,selected:s.value===r.id,disabled:W(r)}),null,16,[`item`,`category`,`selected`,`disabled`])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview`,{"ml-ribbon-gallery__preview--icon":H(r)||G(r),"ml-ribbon-gallery__preview--svg":K(r)}])},[H(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-gallery__preview-icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(H(r))))]),_:2},1024)):G(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview-icon ml-ribbon-gallery__preview-icon--class`,G(r)]),"aria-hidden":`true`},null,2)):K(r)&&Ne(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:K(r)??``,alt:``},null,8,Se)):K(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,Ce,[(0,t.createElementVNode)(`use`,{href:K(r)??``},null,8,we)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Pe(r)),1)],64))],2),(0,t.createElementVNode)(`div`,Te,(0,t.toDisplayString)(r.label),1)],64))])],10,Q))),128))],4)]))),128))],512)]),_:3},8,[`visible`,`disabled`,`width`,`popper-class`,`popper-options`])])):(0,t.createCommentVNode)(``,!0)]))],2))}}),Ne=[`data-id`,`onKeydown`],Pe={key:0,class:`ml-ribbon-input-number__prefix`},Fe={key:2,class:`ml-ribbon-input-number__prefix-label`},Ie=(0,t.defineComponent)({name:`MlRibbonInputNumber`,__name:`RibbonInputNumber`,props:{id:{},modelValue:{default:void 0},width:{default:`96px`},prefixLabel:{default:void 0},prefixIcon:{default:void 0},prefixIconClass:{default:void 0},controlProps:{default:()=>({})},disabled:{type:Boolean,default:!1}},emits:[`change`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.computed)(()=>x(i.width,`96px`)),s=(0,t.computed)(()=>o.value===`100%`),c=(0,t.computed)(()=>s.value?{width:`100%`}:{}),l=(0,t.computed)(()=>s.value?{}:{width:o.value}),u=(0,t.computed)(()=>b(i.prefixLabel)),d=(0,t.computed)(()=>!i.prefixIcon||typeof i.prefixIcon==`string`?null:i.prefixIcon),f=(0,t.computed)(()=>b(i.prefixIconClass??(typeof i.prefixIcon==`string`?i.prefixIcon:void 0))??null),p=(0,t.computed)(()=>!!(u.value||d.value||f.value)),m=(0,t.computed)(()=>u.value??i.id),h=(0,t.ref)(void 0);function g(e){v(e)}function _(e){e.preventDefault(),e.stopPropagation();let t=e.target;if(!(t instanceof HTMLInputElement))return;let n=y(t.value);n===void 0&&t.value.trim().length>0||v(n)}function v(e){Object.is(h.value,e)||(h.value=e,a(`change`,e))}function y(e){let t=e.trim();if(!t)return;let n=Number(t);return Number.isFinite(n)?n:void 0}function b(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function x(e,t){if(typeof e==`number`&&Number.isFinite(e)&&e>0)return`${e}px`;if(typeof e==`string`){let n=e.trim();return n?n.toLowerCase()===`full`?`100%`:n:t}return t}return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-input-number`,{"has-prefix":p.value,"is-full":s.value}]),style:(0,t.normalizeStyle)(c.value),"data-id":e.id,onKeydown:(0,t.withKeys)((0,t.withModifiers)(_,[`stop`,`prevent`]),[`enter`])},[p.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Pe,[d.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-input-number__prefix-icon`,"aria-hidden":`true`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(d.value)))]),_:1})):f.value?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-input-number__prefix-icon ml-ribbon-input-number__prefix-icon--class`,f.value]),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0),u.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Fe,(0,t.toDisplayString)(u.value),1)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)((0,t.unref)(n.ElInputNumber),(0,t.mergeProps)(e.controlProps,{"model-value":e.modelValue,disabled:e.disabled,style:l.value,"aria-label":m.value,onChange:g}),null,16,[`model-value`,`disabled`,`style`,`aria-label`])],46,Ne))}}),Le=[`data-id`],Re={key:0,class:`ml-ribbon-segmented__label`},ze=[`data-option-value`,`aria-label`],Be={key:2,class:`ml-ribbon-segmented__option-label`},Ve={key:3,class:`ml-ribbon-segmented__option-sr-label`},He=(0,t.defineComponent)({__name:`RibbonSegmented`,props:{id:{},label:{default:``},options:{},modelValue:{type:[String,Number,Boolean],default:void 0},direction:{default:`horizontal`},block:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},hideLabel:{type:Boolean,default:!1},tooltipShowAfter:{default:1e3},tooltipHideAfter:{default:0}},emits:[`change`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.computed)(()=>i.label?.trim()??``),s=(0,t.computed)(()=>!i.hideLabel&&o.value.length>0);function c(e){return e}function l(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function u(e){if(typeof e==`string`){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim();return t?t.replace(/\b\w/g,e=>e.toUpperCase()):void 0}if(typeof e==`number`||typeof e==`boolean`)return String(e)}function d(e){let t=c(e);return t.label?.trim()||String(t.value)}function f(e){let t=c(e);return l(t.tooltip)??l(t.label)??u(t.value)}function p(e){let t=c(e).icon;return t&&typeof t!=`string`?t:null}function m(e){let t=c(e).iconClass;if(typeof t==`string`&&t.trim())return t;let n=c(e).icon;return typeof n==`string`&&n.trim()?n.trim():null}function h(e){return!p(e)&&!m(e)}function g(e){return String(c(e).value)}function _(e){return f(e)??g(e)}function v(e){a(`change`,e)}return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`ml-ribbon-segmented`,"data-id":e.id},[s.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Re,(0,t.toDisplayString)(o.value),1)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)((0,t.unref)(n.ElSegmented),{class:`ml-ribbon-segmented__control`,options:e.options,"model-value":e.modelValue,direction:e.direction,block:e.block,disabled:e.disabled,"aria-label":o.value||e.id,onChange:v},{default:(0,t.withCtx)(({item:r})=>[(0,t.createVNode)((0,t.unref)(n.ElTooltip),{content:f(r),disabled:!f(r),"show-after":e.tooltipShowAfter,"hide-after":e.tooltipHideAfter,placement:`top`,effect:`dark`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,{class:`ml-ribbon-segmented__option`,"data-option-value":g(r),"aria-label":_(r)},[p(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-segmented__option-icon`,"aria-hidden":`true`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(p(r))))]),_:2},1024)):m(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-segmented__option-icon ml-ribbon-item-host__icon--class`,m(r)]),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0),h(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Be,(0,t.toDisplayString)(d(r)),1)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ve,(0,t.toDisplayString)(d(r)),1))],8,ze)]),_:2},1032,[`content`,`disabled`,`show-after`,`hide-after`])]),_:1},8,[`options`,`model-value`,`direction`,`block`,`disabled`,`aria-label`])],8,Le))}}),Ue=(0,t.defineComponent)({__name:`RibbonToggleButton`,props:{id:{},label:{default:``},modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},hideLabel:{type:Boolean,default:!1},activeIcon:{default:void 0},inactiveIcon:{default:void 0},activeLabel:{default:void 0},inactiveLabel:{default:void 0}},emits:[`change`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.ref)(!!r.modelValue);(0,t.watch)(()=>r.modelValue,e=>{a.value=!!e},{immediate:!0});let o=(0,t.computed)(()=>a.value),s=(0,t.computed)(()=>o.value?r.activeIcon??r.inactiveIcon:r.inactiveIcon??r.activeIcon),c=(0,t.computed)(()=>(o.value?r.activeLabel?.trim():r.inactiveLabel?.trim())||r.label?.trim()||r.id),l=(0,t.computed)(()=>!r.hideLabel&&c.value.length>0);function u(){if(r.disabled)return;let e=!a.value;a.value=e,i(`change`,e)}return(n,r)=>((0,t.openBlock)(),(0,t.createBlock)(F,{id:e.id,class:(0,t.normalizeClass)([`ml-ribbon-toggle`,{"is-active":o.value}]),icon:s.value,label:c.value,disabled:e.disabled,"hide-label":!l.value,"aria-label":c.value,"aria-pressed":String(o.value),onClick:u},null,8,[`id`,`class`,`icon`,`label`,`disabled`,`hide-label`,`aria-label`,`aria-pressed`]))}}),We=[`data-template-id`,`aria-disabled`],Ge=(0,t.defineComponent)({__name:`RibbonTemplateItem`,props:{id:{},item:{},disabled:{type:Boolean}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`ml-ribbon-template-item`,"data-template-id":e.id,"aria-disabled":e.disabled},[(0,t.renderSlot)(n.$slots,`default`,{item:e.item,disabled:e.disabled},()=>[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.item.label??e.item.id),1)])],8,We))}}),Ke=[`data-item-id`],qe={key:0,class:`ml-ribbon-item-host__keytip`},Je=(0,t.defineComponent)({__name:`RibbonItemHost`,props:{id:{},item:{},groupId:{},galleryPreviewFallback:{},disabled:{type:Boolean}},emits:[`item-click`],setup(e,{emit:r}){let a=e,o=r,s=(0,t.inject)(i,null),c=(0,t.computed)(()=>Array.isArray(a.item.props?.options)?a.item.props.options:[]),l=(0,n.useGlobalConfig)(`size`,``),u=(0,t.computed)(()=>l.value||`default`),d=(0,t.computed)(()=>ue(s?.tooltipShowAfter.value,1e3)),f=(0,t.computed)(()=>ue(s?.tooltipHideAfter.value,0)),p=(0,t.computed)(()=>`ml-ribbon-select-dropdown ml-ribbon-popper ml-ribbon-popper--size-${u.value}`),m=(0,t.computed)(()=>a.item.props?.icon||a.item.icon),h=(0,t.computed)(()=>a.item.hideLabel!==!0),g=(0,t.ref)(void 0),_=(0,t.computed)(()=>a.item.type===`dropdown`&&g.value?g.value:le(a.item.tooltip)??le(a.item.label)??Z(a.item)??he(a.item.id)),v=(0,t.computed)(()=>a.item.type!==`buttonGroup`&&a.item.type!==`segmented`),y=(0,t.computed)(()=>!v.value||!_.value),b=(0,t.computed)(()=>_.value??a.item.id),x=(0,t.computed)(()=>a.item.keyTip?.trim().toUpperCase()??``),S=(0,t.computed)(()=>{if(!s?.keyTipsOpen.value||s?.disabled.value||a.disabled===!0||!x.value)return!1;let e=s.keyTipsSequence.value.toLowerCase();return e?x.value.toLowerCase().startsWith(e):!0}),C=(0,t.computed)(()=>a.disabled===!0||a.item.disabled===!0||s?.disabled.value===!0),w=(0,t.computed)(()=>a.item.props?.modelValue),T=(0,t.computed)(()=>a.item.props?.activeLabel),E=(0,t.computed)(()=>a.item.props?.inactiveLabel),D=(0,t.computed)(()=>Array.isArray(a.item.props?.categories)?a.item.props.categories:[]),O=(0,t.computed)(()=>{let e=a.item.props?.modelValue;return typeof e==`string`?e:void 0}),k=(0,t.computed)(()=>{let e=a.item.props?.inlineItemLimit;return typeof e==`number`?e:void 0}),A=(0,t.computed)(()=>a.item.props?.inlineItemWidthMode===`auto`?`auto`:`fixed`),j=(0,t.computed)(()=>{let e=a.item.props?.component;return!e||typeof e==`string`?null:(0,t.markRaw)((0,t.toRaw)(e))}),M=(0,t.computed)(()=>{let e=a.item.props?.componentProps;return!e||typeof e!=`object`||Array.isArray(e)?{}:e}),N=(0,t.computed)(()=>a.item.props?.wrap!==!1),P=(0,t.computed)(()=>a.item.props?.equalWidth===!0),I=(0,t.computed)(()=>{let e=a.item.props?.buttonSize;if(e===`large`||e===`default`||e===`small`)return e}),L=(0,t.computed)(()=>pe(a.item.props?.iconSize)),R=(0,t.computed)(()=>de(a.item.props?.width??a.item.props?.comboWidth,`92px`)),B=(0,t.computed)(()=>a.item.props?.modelValue),ee=(0,t.computed)(()=>de(a.item.props?.width??a.item.props?.inputNumberWidth,`96px`)),V=(0,t.computed)(()=>a.item.props?.modelValue),te=(0,t.computed)(()=>{let e={...a.item.props??{}};return delete e.modelValue,delete e.width,delete e.inputNumberWidth,delete e.prefixLabel,delete e.prefixIcon,delete e.prefixIconClass,delete e.emitValueOnChange,delete e.valuePrefix,delete e.options,delete e.component,delete e.componentProps,e}),H=(0,t.computed)(()=>me(a.item.props?.labelWrapLines)),U=(0,t.computed)(()=>fe(a.item.props?.labelWrapWidth)),W=(0,t.computed)(()=>a.item.type===`button`&&a.item.size===`large`&&h.value&&(H.value??0)>1),G=(0,t.computed)(()=>{if(!W.value)return{};let e={"--ml-rb-item-label-max-lines":String(H.value??2)};return U.value&&(e[`--ml-rb-item-label-wrap-width`]=U.value),e});(0,t.watch)(()=>a.item.id,()=>{g.value=void 0});function q(){C.value||o(`item-click`,a.id)}function ne(e){if(!C.value){if(typeof e==`string`||typeof e==`number`){o(`item-click`,String(e));return}q()}}function re(e){g.value=e}function ie(e){if(!C.value){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`){o(`item-click`,String(e));return}q()}}function ae(e){if(C.value)return;let t=e?a.item.props?.activeValue:a.item.props?.inactiveValue;if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`){o(`item-click`,String(t));return}o(`item-click`,String(e))}function oe(e){if(!C.value){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`){o(`item-click`,String(e));return}q()}}function se(e){C.value||o(`item-click`,e)}function J(e){if(!C.value){if(a.item.props?.emitValueOnChange===!0&&(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)){o(`item-click`,String(e));return}q()}}function Y(e){if(!C.value){if(a.item.props?.emitValueOnChange===!0&&typeof e==`number`&&Number.isFinite(e)){let t=a.item.props?.valuePrefix;o(`item-click`,`${typeof t==`string`?t:``}${e}`);return}q()}}function X(e){if(!C.value){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`){o(`item-click`,String(e));return}q()}}function ce(e){if(!e||typeof e!=`object`)return;let t=e.label;return typeof t==`string`?t:void 0}function le(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function ue(e,t){return typeof e!=`number`||Number.isNaN(e)||!Number.isFinite(e)?t:Math.max(0,Math.round(e))}function de(e,t){if(typeof e==`number`&&Number.isFinite(e)&&e>0)return`${e}px`;if(typeof e==`string`){let n=e.trim();return n?n.toLowerCase()===`full`?`100%`:n:t}return t}function fe(e){if(typeof e==`number`&&Number.isFinite(e)&&e>0)return`${e}px`;if(typeof e==`string`){let t=e.trim();return t?t.toLowerCase()===`full`?`100%`:t:void 0}}function pe(e){if(typeof e==`number`&&Number.isFinite(e)&&e>0)return`${e}px`;if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function me(e){if(!(typeof e!=`number`||Number.isNaN(e)||!Number.isFinite(e)))return Math.max(1,Math.round(e))}function Z(e){let t=c.value.map(e=>ce(e)).filter(e=>!!e);if(t.length)return e.type===`buttonGroup`?t.join(` / `):t[0]}function he(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim();return t?t.replace(/\b\w/g,e=>e.toUpperCase()):e}return(r,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElTooltip),{content:_.value,disabled:y.value,"show-after":d.value,"hide-after":f.value,placement:`top`,effect:`dark`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-item-host`,[`is-${e.item.size??`medium`}`,`type-${e.item.type}`,{"is-label-hidden":e.item.hideLabel===!0,"is-label-wrap":W.value}]]),style:(0,t.normalizeStyle)(G.value),"data-item-id":e.id,role:`group`},[S.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,qe,(0,t.toDisplayString)(x.value),1)):(0,t.createCommentVNode)(``,!0),e.item.type===`buttonGroup`?((0,t.openBlock)(),(0,t.createBlock)(z,{key:1,id:e.item.id,label:e.item.label??``,options:e.item.props?.options??[],"hide-label":e.item.hideLabel===!0,wrap:N.value,"equal-width":P.value,"button-size":I.value,"icon-size":L.value,"tooltip-show-after":d.value,"tooltip-hide-after":f.value,disabled:C.value,onChange:oe},null,8,[`id`,`label`,`options`,`hide-label`,`wrap`,`equal-width`,`button-size`,`icon-size`,`tooltip-show-after`,`tooltip-hide-after`,`disabled`])):e.item.type===`segmented`?((0,t.openBlock)(),(0,t.createBlock)(He,{key:2,id:e.item.id,label:e.item.label??e.item.id,options:e.item.props?.options??[],"model-value":e.item.props?.modelValue,direction:e.item.props?.direction??`horizontal`,block:e.item.props?.block===!0,disabled:C.value,"hide-label":e.item.hideLabel===!0,"tooltip-show-after":d.value,"tooltip-hide-after":f.value,onChange:ie},null,8,[`id`,`label`,`options`,`model-value`,`direction`,`block`,`disabled`,`hide-label`,`tooltip-show-after`,`tooltip-hide-after`])):e.item.type===`toggle`?((0,t.openBlock)(),(0,t.createBlock)(Ue,{key:3,id:e.item.id,label:e.item.label??e.item.id,"model-value":w.value,"active-icon":e.item.props?.activeIcon??e.item.props?.icon??e.item.icon,"inactive-icon":e.item.props?.inactiveIcon??e.item.props?.icon??e.item.icon,"active-label":T.value,"inactive-label":E.value,disabled:C.value,"hide-label":e.item.hideLabel===!0,onChange:ae},null,8,[`id`,`label`,`model-value`,`active-icon`,`inactive-icon`,`active-label`,`inactive-label`,`disabled`,`hide-label`])):e.item.type===`gallery`?((0,t.openBlock)(),(0,t.createBlock)(Me,{key:4,id:e.item.id,label:e.item.label??``,categories:D.value,"model-value":O.value,collapsed:e.item.props?.collapsed===!0,"inline-item-limit":k.value,"inline-item-width-mode":A.value,"preview-fallback":a.galleryPreviewFallback,disabled:C.value,onSelect:se},null,8,[`id`,`label`,`categories`,`model-value`,`collapsed`,`inline-item-limit`,`inline-item-width-mode`,`preview-fallback`,`disabled`])):e.item.type===`custom`||e.item.type===`template`?((0,t.openBlock)(),(0,t.createBlock)(Ge,{key:5,id:e.item.id,item:e.item,disabled:C.value},{default:(0,t.withCtx)(()=>[j.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(j.value),(0,t.mergeProps)({key:0},M.value,{item:e.item,"group-id":e.groupId,disabled:C.value,"emit-item-click":X}),null,16,[`item`,`group-id`,`disabled`])):(0,t.renderSlot)(r.$slots,`template`,{key:1,item:e.item,disabled:C.value})]),_:3},8,[`id`,`item`,`disabled`])):e.item.type===`dropdown`?((0,t.openBlock)(),(0,t.createBlock)(K,{key:6,id:e.item.id,label:e.item.label??e.item.id,tooltip:e.item.tooltip,icon:m.value,options:e.item.props?.options??[],"model-value":e.item.props?.modelValue,disabled:C.value,"hide-label":e.item.hideLabel===!0,"item-size":e.item.size??`medium`,"sync-label-with-selection":e.item.props?.syncLabelWithSelection===!0,"tooltip-show-after":d.value,"tooltip-hide-after":f.value,onCommand:ne,onTooltipChange:re,onClick:q},null,8,[`id`,`label`,`tooltip`,`icon`,`options`,`model-value`,`disabled`,`hide-label`,`item-size`,`sync-label-with-selection`,`tooltip-show-after`,`tooltip-hide-after`])):e.item.type===`checkbox`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElCheckbox),{key:7,disabled:C.value,onChange:q},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.item.label),1)]),_:1},8,[`disabled`])):e.item.type===`colorPicker`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElColorPicker),{key:8,disabled:C.value,onChange:q},null,8,[`disabled`])):e.item.type===`comboBox`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElSelect),{key:9,"model-value":B.value,disabled:C.value,"popper-class":p.value,style:(0,t.normalizeStyle)({width:R.value}),onChange:J},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(c.value,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElOption),{key:String(e.value),label:String(e.label),value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`disabled`,`popper-class`,`style`])):e.item.type===`inputNumber`?((0,t.openBlock)(),(0,t.createBlock)(Ie,{key:10,id:e.item.id,"model-value":V.value,width:ee.value,"prefix-label":e.item.props?.prefixLabel,"prefix-icon":e.item.props?.prefixIcon??e.item.props?.icon??e.item.icon,"prefix-icon-class":e.item.props?.prefixIconClass,"control-props":te.value,disabled:C.value,onChange:Y},null,8,[`id`,`model-value`,`width`,`prefix-label`,`prefix-icon`,`prefix-icon-class`,`control-props`,`disabled`])):((0,t.openBlock)(),(0,t.createBlock)(F,{key:11,id:e.item.id,label:e.item.label??e.item.id,icon:m.value,disabled:C.value,"hide-label":!h.value,"aria-label":b.value,onClick:q},null,8,[`id`,`label`,`icon`,`disabled`,`hide-label`,`aria-label`]))],14,Ke)]),_:3},8,[`content`,`disabled`,`show-after`,`hide-after`]))}}),$=(0,t.defineComponent)({__name:`RibbonGroupContent`,props:{group:{},galleryPreviewFallback:{},disabled:{type:Boolean}},emits:[`item-click`],setup(e,{emit:n}){let r=e,i=n;return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-group__content`,[`ml-ribbon-group__content--${r.group.orientation??`column`}`]])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.group.collections??[],e=>((0,t.openBlock)(),(0,t.createBlock)(N,{id:e.id,key:e.id,layout:e.layout??(r.group.orientation===`row`?`row`:`column`),rows:e.rows},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,e=>((0,t.openBlock)(),(0,t.createBlock)(Je,{id:e.id,key:e.id,item:e,"group-id":r.group.id,"gallery-preview-fallback":r.galleryPreviewFallback,disabled:r.disabled,onItemClick:n[0]||=e=>i(`item-click`,{groupId:r.group.id,itemId:e})},null,8,[`id`,`item`,`group-id`,`gallery-preview-fallback`,`disabled`]))),128))]),_:2},1032,[`id`,`layout`,`rows`]))),128))],2))}}),Ye=[`data-priority`],Xe={class:`ml-ribbon-group__body`},Ze={class:`ml-ribbon-group__footer`},Qe={class:`ml-ribbon-group__title`},$e=[`aria-label`,`aria-expanded`,`disabled`],et={class:`ml-ribbon-group__overflow-content`},tt=[`aria-label`,`aria-expanded`,`disabled`],nt={class:`ml-ribbon-group__overflow-content`},rt=(0,t.defineComponent)({__name:`RibbonGroup`,props:{id:{},title:{},icon:{},groupIconCss:{},orientation:{},width:{},priority:{},launcher:{type:Boolean},showLauncherIcon:{type:Boolean},groupModel:{},overflowTriggerAriaLabel:{},galleryPreviewFallback:{},disabled:{type:Boolean}},emits:[`item-click`],setup(e,{emit:a}){let o=e,s=a,c=(0,t.inject)(i,null),l=(0,t.computed)(()=>o.width==null),u=(0,t.computed)(()=>{if(typeof o.width!=`number`||Number.isNaN(o.width)||o.width<=0)return;let e=`${o.width}px`;return{width:e,minWidth:e,maxWidth:e,flex:`0 0 ${e}`}}),d=(0,t.computed)(()=>o.disabled===!0||c?.disabled.value===!0),f=(0,t.ref)(null),p=(0,t.ref)([]),m=(0,t.ref)(null),h=(0,t.ref)(null),g=(0,t.ref)(0),_=(0,t.ref)(0),v=(0,n.useGlobalConfig)(`size`,``),y=(0,t.computed)(()=>v.value||`default`),b=(0,t.computed)(()=>`ml-ribbon-group__overflow-popover ml-ribbon-group__overflow-popover--size-${y.value}`),x=(0,t.computed)(()=>({modifiers:[{name:`offset`,options:{offset:[g.value,8]}}]})),S=(0,t.computed)(()=>({modifiers:[{name:`offset`,options:{offset:[_.value,8]}}]})),C=(0,t.computed)(()=>!o.icon||typeof o.icon==`string`?null:o.icon),w=(0,t.computed)(()=>p.value.length>0),T=(0,t.computed)(()=>(o.groupModel?.footerMenuItems?.length??0)>0),E=(0,t.ref)(!1),D=(0,t.ref)(!1),O=(0,t.computed)(()=>{if(!o.groupModel||!p.value.length)return null;let e=new Set(p.value),t=o.groupModel.collections?.map(t=>({...t,items:t.items.filter(t=>e.has(t.id))})).filter(e=>e.items.length>0)??[];return t.length?{...o.groupModel,collections:t}:null}),k=(0,t.computed)(()=>o.groupModel?.footerMenuItems?.length?{id:`${o.groupModel.id}-footer-menu`,title:``,orientation:`row`,collections:[{id:`${o.groupModel.id}-footer-menu-collection`,layout:`row`,items:o.groupModel.footerMenuItems}]}:null);function A(){let e=f.value?.querySelector(`.ml-ribbon-group__content`);if(!e){p.value.length>0&&(p.value=[]);return}let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0){p.value.length>0&&(p.value=[]);return}let n=[];e.querySelectorAll(`.ml-ribbon-item-host[data-item-id]`).forEach(e=>{let r=e.dataset.itemId;if(!r)return;let i=e.getBoundingClientRect();(i.right-t.right>.5||i.bottom-t.bottom>.5||t.left-i.left>.5||t.top-i.top>.5)&&n.push(r)}),p.value.length===n.length&&p.value.every((e,t)=>e===n[t])||(p.value=n)}function j(){(0,t.nextTick)(()=>{B(),M(),N(),A()})}function M(){let e=f.value?.getBoundingClientRect(),t=m.value?.getBoundingClientRect();if(!e||!t){g.value!==0&&(g.value=0);return}let n=Math.round(e.left-t.left);g.value!==n&&(g.value=n)}function N(){let e=f.value?.getBoundingClientRect(),t=h.value?.getBoundingClientRect();if(!e||!t){_.value!==0&&(_.value=0);return}let n=Math.round(e.left-t.left);_.value!==n&&(_.value=n)}function P(e){E.value=e}function F(e){D.value=e}function I(){d.value||(E.value=!E.value)}function L(){d.value||(D.value=!D.value)}let R=null,z=null;function B(){if(!R)return;let e=f.value?.querySelector(`.ml-ribbon-group__content`)??null;z!==e&&(z&&R.unobserve(z),e&&R.observe(e),z=e)}return(0,t.watch)(()=>o.groupModel,()=>{j()},{deep:!0}),(0,t.watch)(d,e=>{e&&(E.value=!1,D.value=!1)}),(0,t.onMounted)(()=>{typeof ResizeObserver<`u`&&(R=new ResizeObserver(()=>{M(),N(),A()}),f.value&&R.observe(f.value),B()),j()}),(0,t.onUnmounted)(()=>{R?.disconnect()}),(i,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{ref_key:`groupSectionRef`,ref:f,class:(0,t.normalizeClass)([`ml-ribbon-group`,{"ml-ribbon-group--auto-width":l.value}]),"data-priority":e.priority??100,style:(0,t.normalizeStyle)(u.value)},[(0,t.createElementVNode)(`div`,Xe,[(0,t.renderSlot)(i.$slots,`default`)]),(0,t.createElementVNode)(`footer`,Ze,[C.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-group__icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(C.value)))]),_:1})):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,Qe,(0,t.toDisplayString)(e.title),1),T.value&&k.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:1,trigger:`click`,placement:`bottom-start`,disabled:d.value,"popper-class":b.value,"popper-options":S.value,onShow:a[1]||=e=>P(!0),onHide:a[2]||=e=>P(!1)},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{ref_key:`footerTriggerRef`,ref:h,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-group__footer-trigger`,{"is-open":E.value}]),"aria-label":e.overflowTriggerAriaLabel,"aria-expanded":E.value,disabled:d.value,onClick:I},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(E.value?(0,t.unref)(r.ArrowUp):(0,t.unref)(r.ArrowDown))))]),_:1})],10,$e)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,et,[(0,t.createVNode)($,{group:k.value,"gallery-preview-fallback":e.galleryPreviewFallback,disabled:d.value,onItemClick:a[0]||=e=>s(`item-click`,e)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])])]),_:1},8,[`disabled`,`popper-class`,`popper-options`])):(0,t.createCommentVNode)(``,!0),w.value&&O.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:2,trigger:`click`,placement:`bottom-start`,disabled:d.value,"popper-class":b.value,"popper-options":x.value,onShow:a[4]||=e=>F(!0),onHide:a[5]||=e=>F(!1)},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{ref_key:`overflowTriggerRef`,ref:m,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-group__overflow-trigger`,{"is-open":D.value}]),"aria-label":e.overflowTriggerAriaLabel,"aria-expanded":D.value,disabled:d.value,onClick:L},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(D.value?(0,t.unref)(r.ArrowUp):(0,t.unref)(r.ArrowDown))))]),_:1})],10,tt)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,nt,[(0,t.createVNode)($,{group:O.value,"gallery-preview-fallback":e.galleryPreviewFallback,disabled:d.value,onItemClick:a[3]||=e=>s(`item-click`,e)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])])]),_:1},8,[`disabled`,`popper-class`,`popper-options`])):(0,t.createCommentVNode)(``,!0),e.showLauncherIcon??e.launcher?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElButton),{key:3,link:``,class:`ml-ribbon-group__launcher`,disabled:d.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.Promotion))]),_:1})]),_:1},8,[`disabled`])):(0,t.createCommentVNode)(``,!0)])],14,Ye))}}),it=[`inert`,`aria-disabled`],at={class:`ml-ribbon__head-left`},ot={key:2,class:`ml-ribbon__tabs-after`},st={class:`ml-ribbon__head-right`},ct={key:2,class:`ml-ribbon__tabs-extra`},lt=[`data-active-tab`],ut={key:0,class:`ml-ribbon-group ml-ribbon-group--overflow`},dt={class:`ml-ribbon-group__body ml-ribbon-group__body--overflow`},ft=[`aria-label`,`disabled`],pt={class:`ml-ribbon-overflow-list`},mt={class:`ml-ribbon-overflow-group__header`},ht=[`data-active-tab`],gt=[`disabled`],_t={class:`ml-ribbon-simplified-group__panel`},vt=[`data-active-tab`],yt={key:0,class:`ml-ribbon-group ml-ribbon-group--overflow`},bt={class:`ml-ribbon-group__body ml-ribbon-group__body--overflow`},xt=[`aria-label`,`disabled`],St={class:`ml-ribbon-overflow-list`},Ct={class:`ml-ribbon-overflow-group__header`},wt=[`data-active-tab`],Tt=[`disabled`],Et={class:`ml-ribbon-simplified-group__panel`},Dt=40,Ot=(0,t.defineComponent)({__name:`Ribbon`,props:{id:{default:`ml-ribbon-root`},tabs:{},activeTab:{default:``},activeLayout:{default:void 0},layout:{default:`classic`},size:{default:void 0},minimized:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},hideLayoutSwitcher:{type:Boolean,default:!1},hideMinimizeButton:{type:Boolean,default:!1},hideKeyTipsToggle:{type:Boolean,default:!1},showFileMenu:{type:Boolean,default:!0},showOpenBackstage:{type:Boolean,default:!0},fileMenuItems:{default:()=>[]},texts:{default:()=>({})},tooltipShowAfter:{default:1e3},tooltipHideAfter:{default:0}},emits:[`update:activeTab`,`update:layout`,`update:minimized`,`tabChange`,`layoutChange`,`itemClick`,`overflowOpen`,`overflowClose`,`backstageOpen`,`backstageClose`,`fileMenuSelect`],setup(e,{expose:a,emit:o}){function s(e){return e==null||typeof e==`string`?e:typeof e==`object`||typeof e==`function`?(0,t.markRaw)((0,t.toRaw)(e)):e}function c(e){if(!e)return;let t={...e};return`component`in t&&(t.component=s(t.component)),`icon`in t&&(t.icon=s(t.icon)),`activeIcon`in t&&(t.activeIcon=s(t.activeIcon)),`inactiveIcon`in t&&(t.inactiveIcon=s(t.inactiveIcon)),Array.isArray(t.options)&&(t.options=t.options.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return`icon`in t?{...t,icon:s(t.icon)}:t})),Array.isArray(t.categories)&&(t.categories=t.categories.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return{...t,items:Array.isArray(t.items)?t.items.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return{...t,preview:s(t.preview),icon:s(t.icon),component:s(t.component)}}):t.items}})),t}function l(e){return{...e,icon:s(e.icon),props:c(e.props)}}function u(e){return{...e,icon:s(e.icon),footerMenuItems:e.footerMenuItems?.map(l),collections:e.collections?.map(e=>({...e,items:e.items?.map(l)}))}}function p(e){return e.map(e=>({...e,groups:e.groups?.map(u)}))}function m(e,t){return typeof e!=`number`||Number.isNaN(e)||!Number.isFinite(e)?t:Math.max(0,Math.round(e))}let g={layoutSwitcherTooltip:`Switch ribbon layout`,minimizeTooltip:`Minimize ribbon`,keyTipsToggleText:`Key Tips`,overflowTriggerAriaLabel:`Open overflow groups`,groupOverflowTriggerAriaLabel:`Open group menu`,fileMenuLabel:`File`,fileMenuOpenBackstageLabel:`Open backstage`,backstageBackLabel:`Back`,backstageTitle:`Backstage`,backstageDescription:`Manage your document and settings here.`,keyTipsSequencePrefix:`Sequence:`,keyTipsEmptySequence:`No key sequence`,galleryPreviewFallback:`Preview unavailable`},_=e,v=o,{context:y,visibleTabs:x}=h(_.id,_.tabs,_.disabled,_.activeLayout?String(_.activeLayout).toLowerCase()===`simplified`?`simplified`:`classic`:_.layout,_.minimized,_.activeTab||_.tabs[0]?.id||``,m(_.tooltipShowAfter,1e3),m(_.tooltipHideAfter,0));(0,t.provide)(i,y),(0,t.watch)(()=>_.tabs,e=>{y.tabs.value=p(e),d(y.tabs.value.find(e=>e.id===y.activeTab.value))||(y.activeTab.value=f(y.tabs.value))},{deep:!0}),(0,t.watch)(()=>_.layout,e=>{e!==y.layout.value&&(y.layout.value=e)}),(0,t.watch)(()=>_.activeLayout,e=>{if(!e)return;let t=String(e).toLowerCase()===`simplified`?`simplified`:`classic`;t!==y.layout.value&&(y.layout.value=t)}),(0,t.watch)(()=>_.minimized,e=>{e!==y.minimized.value&&(y.minimized.value=e)}),(0,t.watch)(()=>_.disabled,e=>{e!==y.disabled.value&&(y.disabled.value=e)}),(0,t.watch)(()=>_.activeTab,e=>{e&&e!==y.activeTab.value&&(y.activeTab.value=e)}),(0,t.watch)(()=>_.tooltipShowAfter,e=>{let t=m(e,1e3);t!==y.tooltipShowAfter.value&&(y.tooltipShowAfter.value=t)}),(0,t.watch)(()=>_.tooltipHideAfter,e=>{let t=m(e,0);t!==y.tooltipHideAfter.value&&(y.tooltipHideAfter.value=t)}),(0,t.watch)(y.activeTab,e=>{v(`update:activeTab`,e),v(`tabChange`,e)}),(0,t.watch)(y.layout,e=>{v(`update:layout`,e),v(`layoutChange`,e)}),(0,t.watch)(y.minimized,e=>{v(`update:minimized`,e)}),(0,t.watch)(y.overflowOpen,e=>{v(e?`overflowOpen`:`overflowClose`)}),(0,t.watch)(y.backdropOpen,e=>{v(e?`backstageOpen`:`backstageClose`)});let S=(0,t.computed)(()=>x.value.find(e=>e.id===y.activeTab.value)),C=(0,t.computed)(()=>new Set(x.value.filter(e=>e.contextual&&e.contextualMode===`exclusive`).map(e=>e.id))),w=(0,t.computed)(()=>ce(S.value)),T=(0,t.computed)(()=>S.value?.groups?.filter(e=>e.visible!==!1)??[]),E=(0,t.ref)(null),D=(0,t.ref)(null),k=(0,t.ref)(null),A=(0,t.ref)(null),j=(0,t.ref)(!1),N=(0,t.ref)(0),P=(0,t.ref)({left:`0px`,top:`0px`,width:`1px`,height:`0px`}),F=(0,t.ref)(new Set),I=(0,t.ref)({}),L=(0,n.useGlobalConfig)(`size`,``),R=(0,t.computed)(()=>_.size||L.value||`default`),z=(0,t.computed)(()=>`ml-ribbon-group-popover ml-ribbon-group-popover--size-${R.value}`),B=(0,t.computed)(()=>`ml-ribbon-overflow-popover ml-ribbon-overflow-popover--size-${R.value}`),ee=(0,t.computed)(()=>`ml-ribbon-tab-panel-popover ml-ribbon-tab-panel-popover--size-${R.value}`),V=(0,t.computed)(()=>({layoutSwitcherTooltip:_.texts.layoutSwitcherTooltip||g.layoutSwitcherTooltip,minimizeTooltip:_.texts.minimizeTooltip||g.minimizeTooltip,keyTipsToggleText:_.texts.keyTipsToggleText||g.keyTipsToggleText,overflowTriggerAriaLabel:_.texts.overflowTriggerAriaLabel||g.overflowTriggerAriaLabel,groupOverflowTriggerAriaLabel:_.texts.groupOverflowTriggerAriaLabel||g.groupOverflowTriggerAriaLabel,fileMenuLabel:_.texts.fileMenuLabel||g.fileMenuLabel,fileMenuOpenBackstageLabel:_.texts.fileMenuOpenBackstageLabel||g.fileMenuOpenBackstageLabel,backstageBackLabel:_.texts.backstageBackLabel||g.backstageBackLabel,backstageTitle:_.texts.backstageTitle||g.backstageTitle,backstageDescription:_.texts.backstageDescription||g.backstageDescription,keyTipsSequencePrefix:_.texts.keyTipsSequencePrefix||g.keyTipsSequencePrefix,keyTipsEmptySequence:_.texts.keyTipsEmptySequence||g.keyTipsEmptySequence,galleryPreviewFallback:_.texts.galleryPreviewFallback||g.galleryPreviewFallback})),te=(0,t.computed)(()=>m(_.tooltipShowAfter,1e3)),H=(0,t.computed)(()=>m(_.tooltipHideAfter,0)),U=(0,t.computed)(()=>y.minimized.value?r.ArrowUpBold:r.ArrowDownBold),W=(0,t.computed)(()=>T.value.filter(e=>!F.value.has(e.id))),G=(0,t.computed)(()=>T.value.filter(e=>F.value.has(e.id))),K=(0,t.computed)(()=>{if(!G.value.length)return 220;let e=G.value.reduce((e,t)=>{let n=I.value[t.id]??re(t);return Math.max(e,n)},0),t=Math.ceil(e+40);return Math.max(220,Math.min(720,t))});function q(e){let t=(e.collections??[]).flatMap(e=>(e.items??[]).map(e=>({...l(e),size:`medium`})));return{...e,orientation:`row`,collections:[{id:`${e.id}-simplified`,layout:`row`,items:t}]}}function ne(e){return e.priority??100}function re(e){return typeof e.width==`number`&&Number.isFinite(e.width)&&e.width>0?e.width:140}function ie(e){let t={};return e.querySelectorAll(`.ml-ribbon-group`).forEach(e=>{let n=e.dataset.groupId;if(!n)return;let r=e.getBoundingClientRect().width;r>0&&(t[n]=r)}),t}function ae(){let e=T.value.reduce((e,t)=>{let n=I.value[t.id]??re(t);return e+Math.max(n,re(t))},0);return Math.max(220,e)}function oe(e){let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--ml-rb-overflow-slot-width`));return Number.isFinite(t)&&t>0?t:Dt}function se(){if(y.layout.value!==`classic`){F.value=new Set;return}let e=y.minimized.value?A.value:k.value;if(!e)return;let t=T.value;if(!t.length){F.value=new Set;return}let n=Math.round(e.getBoundingClientRect().width),r=oe(e),i=ie(e);I.value={...I.value,...i};let a=t.filter(e=>e.enableGroupOverflow===!1),o=t.filter(e=>e.enableGroupOverflow!==!1).map((e,t)=>({group:e,index:t})),s=new Set,c=[...o].sort((e,t)=>{let n=ne(t.group)-ne(e.group);return n===0?t.index-e.index:n}),l=e=>i[e.id]??re(e),u=a.reduce((e,t)=>e+l(t),0),d=e=>o.filter(({group:t})=>!e.has(t.id)).reduce((e,{group:t})=>e+l(t),0),f=e=>u+d(e)+(e.size>0?r:0),p=0;for(;f(s)>n&&p<c.length;){let e=c[p].group;s.add(e.id),p+=1}F.value=s}function J(){(0,t.nextTick)(()=>{if(y.layout.value!==`classic`||y.minimized.value){se();return}if(F.value.size===0){se();return}F.value=new Set,(0,t.nextTick)(()=>{se()})})}function Y(){let e=E.value,t=D.value;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=Number.parseFloat(getComputedStyle(e).borderLeftWidth||`0`)||0,a=Math.max(n.width-i*2,e.clientWidth,r.width,t.clientWidth);N.value=Math.round(a>0?a:y.layout.value===`classic`?ae():Math.max(360,T.value.length*120)),P.value={left:`${Math.round(n.left-r.left+i)}px`,top:`0px`,width:`1px`,height:`${Math.round(r.height)}px`}}function X(){j.value=!1}function ce(e){return y.disabled.value?!0:!e||C.value.size===0?!1:!C.value.has(e.id)}function le(e){if(y.disabled.value)return;let t=y.activeTab.value===e.id;if(y.activeTab.value=e.id,!y.minimized.value){X();return}Y(),j.value=t?!j.value:!0}function ue(){y.disabled.value||y.api.toggleSimplified()}function de(){y.disabled.value||(y.minimized.value||X(),y.minimized.value=!y.minimized.value)}function fe(e){y.disabled.value||(X(),v(`fileMenuSelect`,e))}function pe(){y.disabled.value||(X(),y.backdropOpen.value=!0)}function me(){y.disabled.value||(y.backdropOpen.value=!1)}function Z(e,t){w.value||(v(`itemClick`,{tabId:y.activeTab.value,groupId:e,itemId:t}),y.minimized.value&&X())}function he(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function ge(){if(w.value){y.keyTips.value=[];return}let e=S.value;if(!e?.groups?.length){y.keyTips.value=[];return}let t=e.groups.filter(e=>e.visible!==!1).flatMap(t=>(t.collections??[]).flatMap(n=>n.items.filter(e=>e.keyTip&&e.disabled!==!0).map(n=>{let r=n.keyTip?.trim().toUpperCase();return r?{id:`${e.id}:${t.id}:${n.id}`,key:r,targetId:n.id,sequence:r.split(``),scope:`item`}:null}).filter(e=>!!e)));y.keyTips.value=t}function _e(e){if(y.disabled.value)return;let t=S.value;if(t?.groups?.length){for(let n of t.groups)if(n.visible!==!1)for(let t of n.collections??[]){let r=t.items.find(t=>t.id===e.targetId&&t.disabled!==!0);if(r){Z(n.id,r.id),y.keyTipsOpen.value=!1,y.keyTipsSequence.value=``;return}}}}function ve(){y.keyTipsSequence.value=``}function ye(e){if(!y.disabled.value&&!he(e.target)){if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key===`Alt`){e.preventDefault(),y.keyTipsOpen.value=!y.keyTipsOpen.value,y.keyTipsOpen.value||ve();return}if(y.keyTipsOpen.value&&!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`){e.preventDefault(),y.keyTipsOpen.value=!1,ve();return}if(e.key===`Backspace`){e.preventDefault(),y.keyTipsSequence.value=y.keyTipsSequence.value.slice(0,-1);return}if(/^[a-z0-9]$/i.test(e.key)){e.preventDefault();let t=`${y.keyTipsSequence.value}${e.key.toUpperCase()}`;y.keyTipsSequence.value=t;let n=t.toLowerCase(),r=y.keyTips.value.find(e=>e.key.toLowerCase()===n);if(r){_e(r);return}y.keyTips.value.some(e=>e.key.toLowerCase().startsWith(n))||ve()}}}}function be(e){return e.icon&&typeof e.icon!=`string`?e.icon:e.groupIconCss?r.Grid:null}function xe(e){j.value=e}(0,t.watch)([T,()=>y.layout.value,()=>y.minimized.value],()=>{J()}),(0,t.watch)([S,()=>y.tabs.value,()=>y.disabled.value],()=>{ge(),ve()},{deep:!0,immediate:!0}),(0,t.watch)(()=>y.keyTipsOpen.value,e=>{e||ve()}),(0,t.watch)(()=>y.disabled.value,e=>{e&&(y.overflowOpen.value=!1,y.backdropOpen.value=!1,y.keyTipsOpen.value=!1,X(),ve())}),(0,t.watch)([()=>y.minimized.value,()=>y.layout.value,S],([e,,t])=>{(!e||!t)&&X()}),(0,t.watch)([k,A],([e,t],[n,r])=>{n&&Q&&Q.unobserve(n),r&&Q&&Q.unobserve(r),e&&Q&&Q.observe(e),t&&Q&&Q.observe(t),(e||t)&&J()},{flush:`post`}),(0,t.watch)(j,e=>{e&&(0,t.nextTick)(()=>{Y(),J()})});let Q=null;(0,t.onMounted)(()=>{window.addEventListener(`keydown`,ye),window.addEventListener(`resize`,Se),typeof ResizeObserver<`u`&&(Q=new ResizeObserver(()=>{Y(),J()}),k.value&&Q.observe(k.value),A.value&&Q.observe(A.value)),Y(),J()}),(0,t.onUnmounted)(()=>{window.removeEventListener(`keydown`,ye),window.removeEventListener(`resize`,Se),Q?.disconnect()});function Se(){j.value&&Y()}return a(y.api),(i,a)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElConfigProvider),{size:_.size},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{ref_key:`ribbonRootRef`,ref:E,key:(0,t.unref)(y).disabled.value?`ml-ribbon-disabled`:`ml-ribbon-enabled`,class:(0,t.normalizeClass)([`ml-ribbon`,[`ml-ribbon--${(0,t.unref)(y).layout.value}`,`ml-ribbon--size-${R.value}`,{"ml-ribbon--disabled":(0,t.unref)(y).disabled.value,"ml-ribbon--minimized":(0,t.unref)(y).minimized.value,"ml-ribbon--keytips-open":(0,t.unref)(y).keyTipsOpen.value}]]),inert:(0,t.unref)(y).disabled.value,"aria-disabled":(0,t.unref)(y).disabled.value},[(0,t.createElementVNode)(`header`,{ref_key:`ribbonHeaderRef`,ref:D,class:`ml-ribbon__header`},[(0,t.createElementVNode)(`div`,at,[e.showFileMenu?((0,t.openBlock)(),(0,t.createBlock)(M,{key:0,items:e.fileMenuItems,disabled:(0,t.unref)(y).disabled.value,label:V.value.fileMenuLabel,"open-backstage-label":V.value.fileMenuOpenBackstageLabel,"show-open-backstage":e.showOpenBackstage,onSelect:fe,onOpenBackstage:pe},null,8,[`items`,`disabled`,`label`,`open-backstage-label`,`show-open-backstage`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(O,{tabs:(0,t.unref)(x),"active-tab":(0,t.unref)(y).activeTab.value,disabled:(0,t.unref)(y).disabled.value,onSelect:le},null,8,[`tabs`,`active-tab`,`disabled`]),_.hideMinimizeButton?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElTooltip),{key:1,content:V.value.minimizeTooltip,"show-after":te.value,"hide-after":H.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElButton),{class:(0,t.normalizeClass)([`ml-ribbon__control`,`ml-ribbon__control--minimize`,(0,t.unref)(y).minimized.value?`ml-ribbon__control--minimize-up`:`ml-ribbon__control--minimize-down`]),icon:U.value,disabled:(0,t.unref)(y).disabled.value,onClick:de},null,8,[`class`,`icon`,`disabled`])]),_:1},8,[`content`,`show-after`,`hide-after`])),i.$slots[`tabs-after`]?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ot,[(0,t.renderSlot)(i.$slots,`tabs-after`,{activeTab:(0,t.unref)(y).activeTab.value,layout:(0,t.unref)(y).layout.value,minimized:(0,t.unref)(y).minimized.value,disabled:(0,t.unref)(y).disabled.value})])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,st,[_.hideLayoutSwitcher?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElTooltip),{key:0,content:V.value.layoutSwitcherTooltip,"show-after":te.value,"hide-after":H.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElButton),{circle:``,class:`ml-ribbon__control ml-ribbon__control--layout`,icon:(0,t.unref)(r.Menu),disabled:(0,t.unref)(y).disabled.value,onClick:ue},null,8,[`icon`,`disabled`])]),_:1},8,[`content`,`show-after`,`hide-after`])),_.hideKeyTipsToggle?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElSwitch),{key:1,"inline-prompt":``,class:`ml-ribbon__control ml-ribbon__control--keytips`,"active-text":V.value.keyTipsToggleText,"inactive-text":V.value.keyTipsToggleText,"model-value":(0,t.unref)(y).keyTipsOpen.value,disabled:(0,t.unref)(y).disabled.value,onChange:a[0]||=e=>(0,t.unref)(y).keyTipsOpen.value=!(0,t.unref)(y).keyTipsOpen.value},null,8,[`active-text`,`inactive-text`,`model-value`,`disabled`])),i.$slots[`tabs-extra`]?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ct,[(0,t.renderSlot)(i.$slots,`tabs-extra`,{activeTab:(0,t.unref)(y).activeTab.value,layout:(0,t.unref)(y).layout.value,minimized:(0,t.unref)(y).minimized.value,disabled:(0,t.unref)(y).disabled.value})])):(0,t.createCommentVNode)(``,!0)]),S.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:0,placement:`bottom-start`,visible:j.value,width:N.value||void 0,disabled:(0,t.unref)(y).disabled.value||!(0,t.unref)(y).minimized.value,"show-arrow":!1,offset:0,"popper-class":ee.value,"onUpdate:visible":xe},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,{"aria-hidden":`true`,class:`ml-ribbon__minimized-anchor`,style:(0,t.normalizeStyle)(P.value)},null,4)]),default:(0,t.withCtx)(()=>[(0,t.unref)(y).layout.value===`classic`?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:0,ref_key:`minimizedClassicPanelRef`,ref:A,class:`ml-ribbon__panel ml-ribbon__panel--floating`,"data-active-tab":S.value.id},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(W.value,e=>((0,t.openBlock)(),(0,t.createBlock)(rt,{id:e.id,key:e.id,"data-group-id":e.id,title:e.title,icon:e.icon,"group-icon-css":e.groupIconCss,orientation:e.orientation,width:e.width,priority:e.priority??100,launcher:e.launcher,"show-launcher-icon":e.showLauncherIcon,"group-model":e,"overflow-trigger-aria-label":V.value.groupOverflowTriggerAriaLabel,"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[2]||=e=>Z(e.groupId,e.itemId)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)($,{group:e,"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[1]||=e=>Z(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])]),_:2},1032,[`id`,`data-group-id`,`title`,`icon`,`group-icon-css`,`orientation`,`width`,`priority`,`launcher`,`show-launcher-icon`,`group-model`,`overflow-trigger-aria-label`,`gallery-preview-fallback`,`disabled`]))),128)),G.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`section`,ut,[(0,t.createElementVNode)(`div`,dt,[(0,t.createVNode)((0,t.unref)(n.ElPopover),{trigger:`click`,placement:`bottom-end`,width:K.value,disabled:w.value,"show-arrow":!1,"popper-class":B.value,onShow:a[4]||=e=>(0,t.unref)(y).overflowOpen.value=!0,onHide:a[5]||=e=>(0,t.unref)(y).overflowOpen.value=!1},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:`ml-ribbon-overflow-trigger`,"aria-label":V.value.overflowTriggerAriaLabel,disabled:w.value},[...a[13]||=[(0,t.createElementVNode)(`span`,{class:`ml-ribbon-overflow-trigger__dots`},`...`,-1)]],8,ft)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,pt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(G.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:e.id,class:`ml-ribbon-overflow-group`},[(0,t.createElementVNode)(`header`,mt,(0,t.toDisplayString)(e.title),1),(0,t.createVNode)($,{group:e,"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[3]||=e=>Z(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])]))),128))])]),_:1},8,[`width`,`disabled`,`popper-class`])]),a[14]||=(0,t.createElementVNode)(`footer`,{class:`ml-ribbon-group__footer ml-ribbon-group__footer--overflow`},null,-1)])):(0,t.createCommentVNode)(``,!0)],8,lt)):((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:1,class:`ml-ribbon__panel ml-ribbon__panel--simplified ml-ribbon__panel--floating`,"data-active-tab":S.value.id},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(T.value,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:e.id,trigger:`click`,placement:`bottom-start`,width:340,disabled:w.value,"show-arrow":!1,"popper-class":z.value},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{class:`ml-ribbon-simplified-group`,type:`button`,disabled:w.value},[be(e)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-simplified-group__icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(be(e))))]),_:2},1024)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.title),1)],8,gt)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,_t,[(0,t.createVNode)($,{group:q(e),"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[6]||=e=>Z(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])])]),_:2},1032,[`disabled`,`popper-class`]))),128))],8,ht))]),_:1},8,[`visible`,`width`,`disabled`,`popper-class`])):(0,t.createCommentVNode)(``,!0)],512),!(0,t.unref)(y).minimized.value&&S.value&&(0,t.unref)(y).layout.value===`classic`?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:0,class:`ml-ribbon__panel`,"data-active-tab":S.value.id,ref_key:`classicPanelRef`,ref:k},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(W.value,e=>((0,t.openBlock)(),(0,t.createBlock)(rt,{id:e.id,key:e.id,"data-group-id":e.id,title:e.title,icon:e.icon,"group-icon-css":e.groupIconCss,orientation:e.orientation,width:e.width,priority:e.priority??100,launcher:e.launcher,"show-launcher-icon":e.showLauncherIcon,"group-model":e,"overflow-trigger-aria-label":V.value.groupOverflowTriggerAriaLabel,"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[8]||=e=>Z(e.groupId,e.itemId)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)($,{group:e,"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[7]||=e=>Z(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])]),_:2},1032,[`id`,`data-group-id`,`title`,`icon`,`group-icon-css`,`orientation`,`width`,`priority`,`launcher`,`show-launcher-icon`,`group-model`,`overflow-trigger-aria-label`,`gallery-preview-fallback`,`disabled`]))),128)),G.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`section`,yt,[(0,t.createElementVNode)(`div`,bt,[(0,t.createVNode)((0,t.unref)(n.ElPopover),{trigger:`click`,placement:`bottom-end`,width:K.value,disabled:w.value,"popper-class":B.value,onShow:a[10]||=e=>(0,t.unref)(y).overflowOpen.value=!0,onHide:a[11]||=e=>(0,t.unref)(y).overflowOpen.value=!1},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:`ml-ribbon-overflow-trigger`,"aria-label":V.value.overflowTriggerAriaLabel,disabled:w.value},[...a[15]||=[(0,t.createElementVNode)(`span`,{class:`ml-ribbon-overflow-trigger__dots`},`...`,-1)]],8,xt)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,St,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(G.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:e.id,class:`ml-ribbon-overflow-group`},[(0,t.createElementVNode)(`header`,Ct,(0,t.toDisplayString)(e.title),1),(0,t.createVNode)($,{group:e,"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[9]||=e=>Z(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])]))),128))])]),_:1},8,[`width`,`disabled`,`popper-class`])]),a[16]||=(0,t.createElementVNode)(`footer`,{class:`ml-ribbon-group__footer ml-ribbon-group__footer--overflow`},null,-1)])):(0,t.createCommentVNode)(``,!0)],8,vt)):(0,t.createCommentVNode)(``,!0),!(0,t.unref)(y).minimized.value&&S.value&&(0,t.unref)(y).layout.value===`simplified`?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:1,class:`ml-ribbon__panel ml-ribbon__panel--simplified`,"data-active-tab":S.value.id},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(T.value,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:e.id,trigger:`click`,placement:`bottom-start`,width:340,disabled:w.value,"popper-class":z.value},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{class:`ml-ribbon-simplified-group`,type:`button`,disabled:w.value},[be(e)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-simplified-group__icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(be(e))))]),_:2},1024)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.title),1)],8,Tt)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,Et,[(0,t.createVNode)($,{group:q(e),"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[12]||=e=>Z(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])])]),_:2},1032,[`disabled`,`popper-class`]))),128))],8,wt)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(b,{open:(0,t.unref)(y).backdropOpen.value,size:R.value,"back-label":V.value.backstageBackLabel,title:V.value.backstageTitle,description:V.value.backstageDescription,onClose:me},(0,t.createSlots)({_:2},[i.$slots.backstage?{name:`default`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(i.$slots,`backstage`,{close:me,open:(0,t.unref)(y).backdropOpen.value,size:R.value,backLabel:V.value.backstageBackLabel,title:V.value.backstageTitle,description:V.value.backstageDescription,disabled:(0,t.unref)(y).disabled.value})]),key:`0`}:void 0]),1032,[`open`,`size`,`back-label`,`title`,`description`])],10,it))]),_:3},8,[`size`]))}}),kt={class:`ml-ribbon-tab-definition`,hidden:``},At=(0,t.defineComponent)({__name:`RibbonTab`,props:{id:{},title:{},visible:{type:Boolean},contextual:{type:Boolean},contextualColor:{},contextualTitle:{}},setup(e){return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,kt,[(0,t.renderSlot)(e.$slots,`default`)]))}}),jt={key:0,class:`ml-ribbon-keytips`,"aria-live":`polite`},Mt={class:`ml-ribbon-keytips__hint`},Nt=(0,t.defineComponent)({__name:`RibbonKeyTips`,props:{open:{type:Boolean},tips:{default:()=>[]},sequencePrefix:{},emptySequenceText:{}},emits:[`activate`,`close`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.ref)(``),o=(0,t.computed)(()=>a.value?r.tips.filter(e=>e.key.toLowerCase().startsWith(a.value.toLowerCase())):r.tips),s=(0,t.computed)(()=>a.value||r.emptySequenceText||``),c=(0,t.computed)(()=>r.sequencePrefix?`${r.sequencePrefix}${s.value}`:s.value),l=(0,t.computed)(()=>a.value.toLowerCase()),u=(0,t.computed)(()=>r.tips.filter(e=>e.key.toLowerCase()===l.value)),d=(0,t.computed)(()=>r.tips.some(e=>e.key.toLowerCase().startsWith(l.value)));function f(){a.value=``}function p(e){if(r.open&&!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`){e.preventDefault(),f(),i(`close`);return}if(e.key===`Backspace`){e.preventDefault(),a.value=a.value.slice(0,-1);return}if(/^[a-z0-9]$/i.test(e.key)){if(e.preventDefault(),a.value+=e.key.toUpperCase(),u.value.length>0){i(`activate`,u.value[0]),f();return}d.value||f()}}}return(0,t.onMounted)(()=>window.addEventListener(`keydown`,p)),(0,t.onUnmounted)(()=>window.removeEventListener(`keydown`,p)),(0,t.watch)(()=>r.open,e=>{e||f()}),(n,r)=>e.open?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,jt,[(0,t.createElementVNode)(`div`,Mt,(0,t.toDisplayString)(c.value),1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:e.id,class:`ml-ribbon-keytip`},(0,t.toDisplayString)(e.key),1))),128))])):(0,t.createCommentVNode)(``,!0)}});e.MlRibbon=Ot,e.MlRibbonBackstage=b,e.MlRibbonButton=F,e.MlRibbonButtonGroup=z,e.MlRibbonCollection=N,e.MlRibbonContextualTabs=O,e.MlRibbonDropdown=K,e.MlRibbonFileMenu=M,e.MlRibbonGallery=Me,e.MlRibbonGroup=rt,e.MlRibbonInputNumber=Ie,e.MlRibbonItemHost=Je,e.MlRibbonKeyTips=Nt,e.MlRibbonSegmented=He,e.MlRibbonTab=At,e.MlRibbonTabs=C,e.MlRibbonTemplateItem=Ge,e.MlRibbonToggleButton=Ue});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`),require(`element-plus`),require(`@element-plus/icons-vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`,`element-plus`,`@element-plus/icons-vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MlRibbon={},e.Vue,e.ElementPlus,e.ElementPlusIconsVue))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=Symbol(`RibbonContext`);function a(e){return e==null||typeof e==`string`?e:typeof e==`object`||typeof e==`function`?(0,t.markRaw)((0,t.toRaw)(e)):e}function o(e){if(!e)return;let t={...e};return`component`in t&&(t.component=a(t.component)),`icon`in t&&(t.icon=a(t.icon)),`activeIcon`in t&&(t.activeIcon=a(t.activeIcon)),`inactiveIcon`in t&&(t.inactiveIcon=a(t.inactiveIcon)),Array.isArray(t.options)&&(t.options=t.options.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return`icon`in t?{...t,icon:a(t.icon)}:t})),Array.isArray(t.categories)&&(t.categories=t.categories.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return{...t,items:Array.isArray(t.items)?t.items.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return{...t,preview:a(t.preview),icon:a(t.icon),component:a(t.component)}}):t.items}})),t}function s(e){return{...e,icon:a(e.icon),props:o(e.props)}}function c(e){return{...e,icon:a(e.icon),footerMenuItems:e.footerMenuItems?.map(s),collections:e.collections?.map(e=>({...e,items:e.items.map(s)}))}}function l(e){return{...e,groups:e.groups?.map(c)}}function u(e){return e.map(l)}function d(e){return e!=null&&e.visible!==!1}function f(e){return e.find(d)?.id??``}function p(e){(!e.collections||e.collections.length===0)&&(e.collections=[{id:`${e.id}-collection-1`,items:[]}])}function m(e,t,n,r,i){let a=e.find(e=>e.id===t);if(!a?.groups)return;let o=a.groups.find(e=>e.id===n);if(!o?.collections)return;let s=o.collections.find(e=>e.id===r);s&&i(s.items)}function h(e,n,r,i,a,o,h,g){let _=(0,t.ref)(r),v=(0,t.ref)(i),y=(0,t.ref)(a),b=(0,t.ref)(d(n.find(e=>e.id===o))?o:f(n)),x=(0,t.ref)(u(n)),S=(0,t.ref)(!1),C=(0,t.ref)(!1),w=(0,t.ref)(!1),T=(0,t.ref)([]),E=(0,t.ref)(``),D=(0,t.ref)(h),O=(0,t.ref)(g),k=(0,t.computed)(()=>x.value.filter(e=>e.visible!==!1)),A={addTab(e){x.value.push(l(e)),b.value||=e.id},removeTab(e){x.value=x.value.filter(t=>t.id!==e),b.value===e&&(b.value=k.value[0]?.id??``)},showTab(e){let t=x.value.find(t=>t.id===e);t&&(t.visible=!0)},hideTab(e){let t=x.value.find(t=>t.id===e);t&&(t.visible=!1),b.value===e&&(b.value=f(x.value))},selectTab(e){b.value=e},addGroup(e,t){let n=x.value.find(t=>t.id===e);n&&(n.groups??=[],p(t),n.groups.push(c(t)))},removeGroup(e,t){let n=x.value.find(t=>t.id===e);n?.groups&&(n.groups=n.groups.filter(e=>e.id!==t))},showGroup(e,t){let n=x.value.find(t=>t.id===e)?.groups?.find(e=>e.id===t);n&&(n.visible=!0)},hideGroup(e,t){let n=x.value.find(t=>t.id===e)?.groups?.find(e=>e.id===t);n&&(n.visible=!1)},addItem(e,t,n,r){m(x.value,e,t,n,e=>e.push(s(r)))},removeItem(e,t,n,r){m(x.value,e,t,n,e=>{let t=e.findIndex(e=>e.id===r);t>=0&&e.splice(t,1)})},updateItem(e,t,n,r,i){m(x.value,e,t,n,e=>{let t=e.find(e=>e.id===r);t&&Object.assign(t,i)})},enableItem(e,t,n,r){A.updateItem(e,t,n,r,{disabled:!1})},disableItem(e,t,n,r){A.updateItem(e,t,n,r,{disabled:!0})},refreshLayout(){S.value=!1},minimize(e){y.value=e},toggleSimplified(){v.value=v.value===`classic`?`simplified`:`classic`}};return{context:{id:e,disabled:_,layout:v,minimized:y,activeTab:b,tabs:x,overflowOpen:S,backdropOpen:C,keyTipsOpen:w,keyTips:T,keyTipsSequence:E,tooltipShowAfter:D,tooltipHideAfter:O,registerKeyTip:e=>{T.value.some(t=>t.id===e.id)||T.value.push(e)},unregisterKeyTip:e=>{T.value=T.value.filter(t=>t.id!==e)},api:A},visibleTabs:k}}var g={class:`ml-ribbon-backstage__nav`},_={class:`ml-ribbon-backstage__content`},v={key:0},y={key:1},b=(0,t.defineComponent)({__name:`RibbonBackstage`,props:{open:{type:Boolean},backLabel:{},title:{},description:{},size:{default:`default`}},emits:[`close`],setup(e,{emit:r}){let i=e,a=r;function o(){a(`close`)}return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDrawer),{"model-value":i.open,size:`100%`,"with-header":!1,direction:`ltr`,onClose:o},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-backstage`,`ml-ribbon-backstage--size-${i.size||`default`}`])},[e.$slots.default?(0,t.renderSlot)(e.$slots,`default`,{key:0,close:o,backLabel:i.backLabel,title:i.title,description:i.description,size:i.size}):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`aside`,g,[(0,t.createVNode)((0,t.unref)(n.ElButton),{type:`primary`,onClick:o},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(i.backLabel),1)]),_:1})]),(0,t.createElementVNode)(`section`,_,[i.title?((0,t.openBlock)(),(0,t.createElementBlock)(`h2`,v,(0,t.toDisplayString)(i.title),1)):(0,t.createCommentVNode)(``,!0),i.description?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,y,(0,t.toDisplayString)(i.description),1)):(0,t.createCommentVNode)(``,!0)])],64))],2)]),_:3},8,[`model-value`]))}}),x={class:`ml-ribbon-tabs`,role:`tablist`},S=[`aria-selected`,`disabled`,`onClick`],C=(0,t.defineComponent)({__name:`RibbonTabs`,props:{tabs:{},activeTab:{},disabled:{type:Boolean}},emits:[`select`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.computed)(()=>r.tabs.filter(e=>e.visible!==!1));function o(e,t){i(`select`,{id:e,triggerEl:t.currentTarget instanceof HTMLElement?t.currentTarget:null})}return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,x,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(a.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:n.id,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-tab`,{"is-active":e.activeTab===n.id}]),role:`tab`,"aria-selected":e.activeTab===n.id,disabled:r.disabled,onClick:e=>o(n.id,e)},(0,t.toDisplayString)(n.title),11,S))),128))]))}}),w={class:`ml-ribbon-contextual-tabs`},T={class:`ml-ribbon-contextual-tabs__normal`},E={class:`ml-ribbon-contextual-tabs__ctx`},D={key:0},O=(0,t.defineComponent)({__name:`RibbonContextualTabs`,props:{tabs:{},activeTab:{},disabled:{type:Boolean}},emits:[`select`],setup(e,{emit:n}){let r=e,i=n;return(n,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,w,[(0,t.createElementVNode)(`div`,T,[(0,t.createVNode)(C,{tabs:r.tabs.filter(e=>!e.contextual),"active-tab":e.activeTab,disabled:r.disabled,onSelect:a[0]||=e=>i(`select`,e)},null,8,[`tabs`,`active-tab`,`disabled`])]),(0,t.createElementVNode)(`div`,E,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.tabs.filter(e=>e.contextual),n=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:n.id,class:`ml-ribbon-contextual-tabs__block`,style:(0,t.normalizeStyle)({"--ctx-color":n.contextualColor||`#67c23a`})},[n.contextualTitle?.trim()?((0,t.openBlock)(),(0,t.createElementBlock)(`small`,D,(0,t.toDisplayString)(n.contextualTitle.trim()),1)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(C,{tabs:[n],"active-tab":e.activeTab,disabled:r.disabled,onSelect:a[1]||=e=>i(`select`,e)},null,8,[`tabs`,`active-tab`,`disabled`])],4))),128))])]))}}),k={class:`ml-ribbon-file-menu-submenu__trigger`},A=(0,t.defineComponent)({__name:`RibbonFileMenuItem`,props:{item:{},divided:{type:Boolean},popperClass:{}},emits:[`select`],setup(e,{emit:i}){let a=e,o=i,s=e=>Array.isArray(e.children)&&e.children.length>0;function c(e){o(`select`,e)}return(e,i)=>{let o=(0,t.resolveComponent)(`RibbonFileMenuItem`,!0);return s(a.item)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdownItem),{key:0,divided:a.divided,disabled:a.item.disabled,class:`ml-ribbon-file-menu-submenu`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElDropdown),{trigger:`hover`,placement:`right-start`,teleported:!0,"show-timeout":0,"hide-timeout":100,"popper-class":a.popperClass,onCommand:c},{dropdown:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElDropdownMenu),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(a.item.children,e=>((0,t.openBlock)(),(0,t.createBlock)(o,{key:e.id,item:e,divided:e.divided===!0,"popper-class":a.popperClass,onSelect:c},null,8,[`item`,`divided`,`popper-class`]))),128))]),_:1})]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,k,[(0,t.createTextVNode)((0,t.toDisplayString)(a.item.label)+` `,1),(0,t.createVNode)((0,t.unref)(n.ElIcon),{class:`ml-ribbon-file-menu-submenu__arrow`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.ArrowRight))]),_:1})])]),_:1},8,[`popper-class`])]),_:1},8,[`divided`,`disabled`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdownItem),{key:1,divided:a.divided,command:a.item.id,disabled:a.item.disabled},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(a.item.label),1)]),_:1},8,[`divided`,`command`,`disabled`]))}}}),j=[`disabled`],M=(0,t.defineComponent)({__name:`RibbonFileMenu`,props:{items:{},label:{},openBackstageLabel:{},showOpenBackstage:{type:Boolean},disabled:{type:Boolean}},emits:[`select`,`open-backstage`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.ref)(!1),s=(0,n.useGlobalConfig)(`size`,``),c=(0,t.computed)(()=>s.value||`default`),l=(0,t.computed)(()=>`ml-ribbon-file-menu-dropdown ml-ribbon-popper ml-ribbon-popper--size-${c.value}`);function u(e){o.value=e}function d(e){if(e===`__backstage`){a(`open-backstage`);return}a(`select`,e)}return(0,t.watch)(()=>i.disabled,e=>{e&&(o.value=!1)}),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdown),{trigger:`click`,disabled:i.disabled,"popper-class":l.value,onCommand:d,onVisibleChange:u},{dropdown:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElDropdownMenu),null,{default:(0,t.withCtx)(()=>[i.showOpenBackstage===!1?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdownItem),{key:0,command:`__backstage`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(i.openBackstageLabel),1)]),_:1})),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(i.items,(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(A,{key:e.id,item:e,divided:e.divided===!0||i.showOpenBackstage!==!1&&n===0,"popper-class":l.value,onSelect:d},null,8,[`item`,`divided`,`popper-class`]))),128))]),_:1})]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-tab ml-ribbon-tab--file`,{"is-active":o.value}]),disabled:i.disabled},(0,t.toDisplayString)(i.label),11,j)]),_:1},8,[`disabled`,`popper-class`]))}}),N=(0,t.defineComponent)({__name:`RibbonCollection`,props:{id:{},layout:{default:`row`},rows:{default:3}},setup(e){let n=e,r=(0,t.computed)(()=>({"--ml-ribbon-collection-rows":String(n.rows)}));return(e,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-collection`,[`ml-ribbon-collection--${n.layout}`]]),style:(0,t.normalizeStyle)(r.value)},[(0,t.renderSlot)(e.$slots,`default`)],6))}});function P(e){return e.replace(/\r\n?/g,`
2
+ `).split(`
3
+ `)}function F(e){return e.replace(/\r\n?/g,`
4
+ `).replace(/\n+/g,` `)}var I={key:3,class:`ml-ribbon-item-host__label ml-ribbon-button__label`},L={key:0},R=(0,t.defineComponent)({name:`MlRibbonButton`,__name:`RibbonButton`,props:{id:{},label:{default:void 0},icon:{default:void 0},disabled:{type:Boolean,default:!1},hideLabel:{type:Boolean,default:!1},ariaLabel:{default:void 0},iconSize:{default:void 0},size:{default:void 0},buttonType:{default:`default`},nativeType:{default:`button`}},emits:[`click`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.computed)(()=>i.label===void 0?i.id:i.label.trim()),s=(0,t.computed)(()=>!i.hideLabel&&o.value.length>0),c=(0,t.computed)(()=>P(o.value)),l=(0,t.computed)(()=>i.ariaLabel?.trim()||F(o.value)||i.id),u=(0,t.computed)(()=>!i.icon||typeof i.icon==`string`?null:i.icon),d=(0,t.computed)(()=>{if(typeof i.icon!=`string`)return null;let e=i.icon.trim();return e.length>0?e:null}),f=(0,t.computed)(()=>s.value?`ml-ribbon-item-host__icon--with-label`:`ml-ribbon-item-host__icon--icon-only`),p=(0,t.computed)(()=>{if(i.iconSize)return{fontSize:i.iconSize}});function m(e){i.disabled||a(`click`,e)}return(r,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElButton),{class:`ml-ribbon-button`,"data-ribbon-button-id":e.id,type:e.buttonType,size:e.size,"native-type":e.nativeType,disabled:e.disabled,"aria-label":l.value,onClick:m},{default:(0,t.withCtx)(()=>[r.$slots.icon?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`ml-ribbon-item-host__icon ml-ribbon-button__icon`,f.value]),style:(0,t.normalizeStyle)(p.value),"aria-hidden":`true`},[(0,t.renderSlot)(r.$slots,`icon`)],6)):u.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:1,class:(0,t.normalizeClass)([`ml-ribbon-item-host__icon ml-ribbon-button__icon`,f.value]),style:(0,t.normalizeStyle)(p.value)},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(u.value)))]),_:1},8,[`class`,`style`])):d.value?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:2,class:(0,t.normalizeClass)([`ml-ribbon-item-host__icon ml-ribbon-item-host__icon--class ml-ribbon-button__icon`,[d.value,f.value]]),style:(0,t.normalizeStyle)(p.value),"aria-hidden":`true`},null,6)):(0,t.createCommentVNode)(``,!0),s.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,I,[(0,t.renderSlot)(r.$slots,`label`,{label:o.value,lines:c.value},()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(c.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n},[n>0?((0,t.openBlock)(),(0,t.createElementBlock)(`br`,L)):(0,t.createCommentVNode)(``,!0),(0,t.createTextVNode)((0,t.toDisplayString)(e),1)],64))),128))])])):(0,t.createCommentVNode)(``,!0),(0,t.renderSlot)(r.$slots,`default`)]),_:3},8,[`data-ribbon-button-id`,`type`,`size`,`native-type`,`disabled`,`aria-label`]))}}),z=[`data-id`],B={key:0,class:`ml-ribbon-button-group__label`},ee={class:`ml-ribbon-button-group__text`},V=(0,t.defineComponent)({__name:`RibbonButtonGroup`,props:{id:{},label:{},options:{},hideLabel:{type:Boolean,default:!1},wrap:{type:Boolean,default:!0},equalWidth:{type:Boolean,default:!1},buttonSize:{},iconSize:{},tooltipShowAfter:{default:1e3},tooltipHideAfter:{default:0},disabled:{type:Boolean,default:!1}},emits:[`change`],setup(e,{emit:r}){let i=e,a=r;function o(e){i.disabled||a(`change`,e)}function s(e){return typeof e==`string`&&e.trim().length>0}function c(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function l(e){if(typeof e==`string`){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim();return t?t.replace(/\b\w/g,e=>e.toUpperCase()):void 0}if(typeof e==`number`||typeof e==`boolean`)return String(e)}function u(e){return c(e.tooltip)??c(e.label)??l(e.value)}return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-button-group`,{"ml-ribbon-button-group--nowrap":!e.wrap,"ml-ribbon-button-group--equal-width":!e.wrap&&e.equalWidth}]),"data-id":e.id},[!e.hideLabel&&e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,B,(0,t.toDisplayString)(e.label),1)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)((0,t.unref)(n.ElButtonGroup),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.options,r=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElTooltip),{key:String(r.value),content:u(r),disabled:!u(r),"show-after":e.tooltipShowAfter,"hide-after":e.tooltipHideAfter,placement:`top`,effect:`dark`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(R,{id:String(r.value),class:`ml-ribbon-button-group__button`,label:r.label,icon:r.icon,"icon-size":e.iconSize,size:e.buttonSize,disabled:e.disabled,"hide-label":!s(r.label),"aria-label":u(r)??String(r.value),onClick:e=>o(r.value)},(0,t.createSlots)({_:2},[s(r.label)?{name:`label`,fn:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,ee,(0,t.toDisplayString)(r.label),1)]),key:`0`}:void 0]),1032,[`id`,`label`,`icon`,`icon-size`,`size`,`disabled`,`hide-label`,`aria-label`,`onClick`])]),_:2},1032,[`content`,`disabled`,`show-after`,`hide-after`]))),128))]),_:1})],10,z))}}),te={class:`ml-ribbon-item-host__content ml-ribbon-dropdown__content`},H={class:`ml-ribbon-item-host__text-row ml-ribbon-dropdown__text-row`},U={key:0,class:`ml-ribbon-item-host__label ml-ribbon-dropdown__label`},W={key:0},G={class:`ml-ribbon-dropdown-item__content`},K={class:`ml-ribbon-dropdown-item__row`},q={key:0,class:`ml-ribbon-dropdown-item__check`,"aria-hidden":`true`},J={class:`ml-ribbon-dropdown-item__main`},Y={class:`ml-ribbon-dropdown-item__label`},X=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,t.defineComponent)({name:`MlRibbonDropdown`,__name:`RibbonDropdown`,props:{id:{},label:{default:void 0},tooltip:{default:void 0},icon:{default:void 0},options:{default:()=>[]},disabled:{type:Boolean,default:!1},hideLabel:{type:Boolean,default:!1},syncLabelWithSelection:{type:Boolean,default:!1},itemSize:{default:`medium`},tooltipShowAfter:{default:1e3},tooltipHideAfter:{default:0},popperClass:{default:void 0},modelValue:{default:void 0}},emits:[`command`,`click`,`tooltip-change`],setup(e,{emit:i}){let a=e,o=i,s=(0,n.useGlobalConfig)(`size`,``),c=(0,t.computed)(()=>s.value||`default`),l=(0,t.ref)(!1),u=(0,t.ref)(void 0);(0,t.watch)(()=>a.modelValue,e=>{e!==void 0&&(u.value=e)},{immediate:!0});let d=(0,t.computed)(()=>Array.isArray(a.options)?a.options:[]),f=(0,t.computed)(()=>d.value.find(e=>O(e)===u.value)||(a.syncLabelWithSelection&&u.value===void 0?d.value[0]??null:null)),p=(0,t.computed)(()=>{if(f.value&&a.syncLabelWithSelection){let e=A(f.value);if(e)return e}return N(a.label)??a.id}),m=(0,t.computed)(()=>!a.hideLabel&&p.value.length>0),h=(0,t.computed)(()=>P(p.value)),g=(0,t.computed)(()=>a.modelValue!==void 0),_=(0,t.computed)(()=>{if(f.value){let e=E(f.value);if(e)return e}return!a.icon||typeof a.icon==`string`?null:a.icon}),v=(0,t.computed)(()=>{if(f.value){let e=D(f.value);if(e)return e}if(typeof a.icon!=`string`)return null;let e=a.icon.trim();return e.length>0?e:null}),y=(0,t.computed)(()=>!!(_.value||v.value)),b=(0,t.computed)(()=>F(M(f.value)??N(a.tooltip)??N(p.value)??N(a.label)??I(a.id))),x=(0,t.computed)(()=>[`ml-ribbon-dropdown-menu`,`ml-ribbon-popper`,`ml-ribbon-popper--size-${c.value}`,a.popperClass].filter(Boolean).join(` `));function S(e){if(a.disabled){l.value=!1;return}l.value=e}function C(){a.disabled||(l.value=!l.value)}function w(e){a.disabled||(u.value=e,o(`tooltip-change`,M(f.value)??b.value),o(`command`,e),l.value=!1)}function T(){if(a.disabled)return;let e=f.value;if(!e){o(`click`);return}o(`command`,O(e))}function E(e){if(!e||typeof e!=`object`)return null;let t=e.icon;return!t||typeof t==`string`?null:t}function D(e){if(!e||typeof e!=`object`)return null;let t=e.icon;return typeof t!=`string`||t.trim().length===0?null:t}function O(e){if(!(!e||typeof e!=`object`))return e.value}function k(e){let t=O(e);if(typeof t==`string`||typeof t==`number`||t&&typeof t==`object`)return t}function A(e){if(!e||typeof e!=`object`)return;let t=e.label;return typeof t==`string`?t:void 0}function j(e){if(typeof e==`string`)return I(e);if(typeof e==`number`||typeof e==`boolean`)return String(e)}function M(e){if(!(!e||typeof e!=`object`))return N(e.tooltip)??A(e)??j(O(e))}function N(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function I(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim();return t?t.replace(/\b\w/g,e=>e.toUpperCase()):e}function L(e){return O(e)===u.value}return(0,t.watch)([()=>a.syncLabelWithSelection,b],()=>{a.syncLabelWithSelection&&o(`tooltip-change`,b.value)},{immediate:!0,flush:`post`}),(i,a)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdown),{class:(0,t.normalizeClass)([`ml-ribbon-dropdown`,[`ml-ribbon-dropdown--item-${e.itemSize}`,{"is-label-hidden":e.hideLabel}]]),trigger:`click`,disabled:e.disabled,"popper-class":x.value,onVisibleChange:S,onCommand:w},{dropdown:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElDropdownMenu),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(d.value,a=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdownItem),{key:String(O(a)),command:k(a),disabled:a.disabled===!0,divided:a.divided===!0,"aria-current":L(a)?`true`:void 0,class:(0,t.normalizeClass)({"ml-ribbon-dropdown-item--selected":L(a)})},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElTooltip),{content:M(a),disabled:!M(a),"show-after":e.tooltipShowAfter,"hide-after":e.tooltipHideAfter,placement:`top`,effect:`dark`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,G,[(0,t.renderSlot)(i.$slots,`option`,{option:a},()=>[(0,t.createElementVNode)(`span`,K,[g.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,q,[L(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-dropdown-item__check-icon`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.Check))]),_:1})):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,J,[E(a)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-dropdown-item__icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(E(a))))]),_:2},1024)):D(a)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-dropdown-item__icon ml-ribbon-dropdown-item__icon--class`,D(a)]),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,Y,(0,t.toDisplayString)(A(a)),1)])])],!0)])]),_:2},1032,[`content`,`disabled`,`show-after`,`hide-after`])]),_:2},1032,[`command`,`disabled`,`divided`,`aria-current`,`class`]))),128))]),_:3})]),default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElButton),{type:`default`,disabled:e.disabled,"aria-label":b.value,onClick:C},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,te,[i.$slots.icon||y.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`ml-ribbon-item-host__icon ml-ribbon-item-host__icon--dropdown-primary ml-ribbon-dropdown__icon`,{"ml-ribbon-item-host__icon--class":v.value&&!_.value&&!i.$slots.icon}]),onClick:(0,t.withModifiers)(T,[`stop`])},[(0,t.renderSlot)(i.$slots,`icon`,{selectedOption:f.value},()=>[_.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(_.value)))]),_:1})):v.value?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)(v.value),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0)],!0)],2)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,H,[m.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,U,[(0,t.renderSlot)(i.$slots,`label`,{selectedOption:f.value,label:p.value,lines:h.value},()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(h.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n},[n>0?((0,t.openBlock)(),(0,t.createElementBlock)(`br`,W)):(0,t.createCommentVNode)(``,!0),(0,t.createTextVNode)((0,t.toDisplayString)(e),1)],64))),128))],!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)((0,t.unref)(n.ElIcon),{class:(0,t.normalizeClass)([`ml-ribbon-item-host__dropdown-arrow ml-ribbon-dropdown__arrow`,{"is-open":l.value}])},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(l.value?(0,t.unref)(r.ArrowUp):(0,t.unref)(r.ArrowDown))))]),_:1},8,[`class`])])])]),_:3},8,[`disabled`,`aria-label`])]),_:3},8,[`class`,`disabled`,`popper-class`]))}}),[[`__scopeId`,`data-v-453b1e92`]]),ne=[`disabled`],re=[`src`],ie={key:3,class:`ml-ribbon-gallery__preview-svg`,role:`presentation`,"aria-hidden":`true`},Z=[`href`],ae={class:`ml-ribbon-gallery__label ml-ribbon-gallery__collapsed-label`},Q={class:`ml-ribbon-gallery__panel`},oe={key:0,class:`ml-ribbon-gallery__panel-category-title`},se=[`disabled`,`onClick`],ce=[`src`],le={key:3,class:`ml-ribbon-gallery__preview-svg`,role:`presentation`,"aria-hidden":`true`},ue=[`href`],de={class:`ml-ribbon-gallery__label`},fe={key:1,class:`ml-ribbon-gallery__title`},$={key:2,class:`ml-ribbon-gallery__categories`},pe={key:0,class:`ml-ribbon-gallery__category-title`},me=[`disabled`,`onClick`],he=[`src`],ge={key:3,class:`ml-ribbon-gallery__preview-svg`,role:`presentation`,"aria-hidden":`true`},_e=[`href`],ve={class:`ml-ribbon-gallery__label`},ye={key:0,class:`ml-ribbon-gallery__controls`,"aria-label":`Gallery navigation`},be=[`disabled`],xe=[`disabled`],Se=[`disabled`],Ce={key:0,class:`ml-ribbon-gallery__panel-category-title`},we=[`data-gallery-row-index`,`disabled`,`onClick`],Te=[`src`],Ee={key:3,class:`ml-ribbon-gallery__preview-svg`,role:`presentation`,"aria-hidden":`true`},De=[`href`],Oe={class:`ml-ribbon-gallery__label`},ke=6,Ae=64,je=4,Me=16,Ne=4,Pe=22,Fe=(0,t.defineComponent)({name:`MlRibbonGallery`,__name:`RibbonGallery`,props:{id:{},label:{},categories:{},disabled:{type:Boolean,default:!1},modelValue:{},collapsed:{type:Boolean,default:!1},inlineItemLimit:{default:4},inlineItemWidthMode:{default:`fixed`},previewFallback:{}},emits:[`select`],setup(e,{emit:i}){let a=e,o=i,s=(0,t.ref)(``),c=(0,t.ref)(!1),l=(0,t.ref)(0),u=(0,t.ref)(null),d=(0,t.ref)(null),f=(0,t.ref)(null),p=(0,t.ref)(0),m=(0,n.useGlobalConfig)(`size`,``),h=(0,t.computed)(()=>m.value||`default`),g=(0,t.computed)(()=>h.value===`small`?.92:h.value===`large`?1.08:1),_=(0,t.computed)(()=>Math.round(Ae*g.value)),v=(0,t.computed)(()=>Math.round(Pe*g.value)),y=(0,t.computed)(()=>a.label?.trim()??``),b=(0,t.computed)(()=>a.categories.filter(e=>e.items.length>0).length),x=(0,t.computed)(()=>a.categories.flatMap(e=>e.items)),S=(0,t.computed)(()=>x.value.find(e=>e.id===s.value)??x.value[0]),C=(0,t.computed)(()=>!Number.isFinite(a.inlineItemLimit)||a.inlineItemLimit<=0?4:Math.floor(a.inlineItemLimit)),w=(0,t.computed)(()=>{let e=C.value,t=x.value.length;return t===0?Math.min(e,1):Math.min(e,t)}),T=(0,t.computed)(()=>Math.max(1,Math.ceil(x.value.length/w.value))),E=(0,t.computed)(()=>Math.min(l.value,T.value-1)),D=(0,t.computed)(()=>j.value&&E.value>0),O=(0,t.computed)(()=>j.value&&E.value<T.value-1),k=(0,t.computed)(()=>{let e=E.value*w.value;return x.value.slice(e,e+w.value)}),A=(0,t.computed)(()=>new Set(k.value.map(e=>e.id))),j=(0,t.computed)(()=>x.value.length>w.value),M=(0,t.computed)(()=>{let e=[`ml-ribbon-gallery-panel`,`ml-ribbon-gallery-panel--${a.collapsed?`collapsed`:`inline`}`,`ml-ribbon-gallery-panel--size-${h.value}`];return a.inlineItemWidthMode===`auto`&&e.push(`ml-ribbon-gallery-panel--item-width-auto`),e.join(` `)}),N=(0,t.computed)(()=>({"--ml-ribbon-gallery-panel-columns":String(w.value),"--ml-ribbon-gallery-panel-item-width":`${_.value}px`})),P=(0,t.computed)(()=>a.inlineItemWidthMode===`auto`?`fit-content`:w.value*_.value+Math.max(0,w.value-1)*je+ke*2+(a.collapsed?Me:Ne+v.value)),F=(0,t.computed)(()=>({modifiers:[{name:`offset`,options:{offset:[p.value,0]}}]}));(0,t.watch)(()=>a.modelValue,e=>{typeof e==`string`&&(s.value=e,ee(e))},{immediate:!0}),(0,t.watch)(()=>[x.value.map(e=>e.id).join(`\0`),w.value,s.value],()=>{ee()||(l.value=Math.min(l.value,T.value-1))}),(0,t.watch)(c,async e=>{!e||a.collapsed||(V(),await(0,t.nextTick)(),await(0,t.nextTick)(),te())});function I(e){return e==null||typeof e==`string`?e:typeof e==`object`||typeof e==`function`?(0,t.markRaw)((0,t.toRaw)(e)):e}function L(e){let t=y.value.toLowerCase(),n=e.title.trim().toLowerCase();return b.value>1||!t||n!==t}function R(e){return j.value?e.items.filter(e=>A.value.has(e.id)):e.items}function z(e){if(a.disabled||!j.value)return;let t=E.value+e;l.value=Math.min(Math.max(t,0),T.value-1)}function B(e){let t=x.value.findIndex(t=>t.id===e.id);return t<0?0:Math.floor(t/w.value)}function ee(e=s.value){let t=x.value.find(t=>t.id===e);return t?(l.value=B(t),!0):!1}function V(){let e=u.value,t=d.value;if(!e||!t){p.value=0;return}let n=e.querySelector(`.ml-ribbon-gallery__grid .ml-ribbon-gallery__item`)?.getBoundingClientRect().left??e.getBoundingClientRect().left;p.value=Math.round(n-t.getBoundingClientRect().left-ke)}function te(){let e=f.value;e&&e.querySelector(`[data-gallery-row-index="${E.value}"]`)?.scrollIntoView?.({block:`start`})}function H(e){return e.preview&&typeof e.preview!=`string`?I(e.preview):e.icon&&typeof e.icon!=`string`?I(e.icon):null}function U(e){return e.component?I(e.component):null}function W(e){return a.disabled||e.disabled===!0}function G(e){if(typeof e.icon!=`string`)return null;let t=e.icon.trim();return t.length>0?t:null}function K(e){let t=e.previewSvg??e.svg;if(typeof t!=`string`)return null;let n=t.trim();return n.length>0?n:null}function q(e){return e.startsWith(`data:image/svg+xml`)||e.endsWith(`.svg`)}function J(e){let t=K(e);return t?q(t):!1}function Y(e){return typeof e.preview==`string`?e.preview:a.previewFallback}function X(e){W(e)||(s.value=e.id,l.value=B(e),c.value=!1,o(`select`,e.id))}return(i,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`galleryRef`,ref:u,class:(0,t.normalizeClass)([`ml-ribbon-gallery`,{"is-disabled":e.disabled,"is-collapsed":e.collapsed,"is-unlabeled":!e.collapsed&&!y.value,"is-inline-item-width-auto":!e.collapsed&&e.inlineItemWidthMode===`auto`}])},[e.collapsed&&S.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:0,visible:c.value,"onUpdate:visible":a[0]||=e=>c.value=e,trigger:`click`,placement:`bottom-start`,disabled:e.disabled,width:P.value,"popper-class":M.value},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-gallery__collapsed-button`,{"is-selected":s.value===S.value.id,"is-open":c.value}]),disabled:W(S.value)},[U(S.value)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(U(S.value)),(0,t.mergeProps)({key:0},S.value.componentProps,{item:S.value,selected:s.value===S.value.id,disabled:W(S.value)}),null,16,[`item`,`selected`,`disabled`])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview ml-ribbon-gallery__collapsed-preview`,{"ml-ribbon-gallery__preview--icon":H(S.value)||G(S.value),"ml-ribbon-gallery__preview--svg":K(S.value)}])},[H(S.value)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-gallery__preview-icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(H(S.value))))]),_:1})):G(S.value)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview-icon ml-ribbon-gallery__preview-icon--class`,G(S.value)]),"aria-hidden":`true`},null,2)):K(S.value)&&J(S.value)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:K(S.value)??``,alt:``},null,8,re)):K(S.value)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,ie,[(0,t.createElementVNode)(`use`,{href:K(S.value)??``},null,8,Z)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Y(S.value)),1)],64))],2),(0,t.createElementVNode)(`div`,ae,(0,t.toDisplayString)(S.value.label),1)],64))],10,ne)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,Q,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.categories,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:e.id,class:`ml-ribbon-gallery__panel-category`},[L(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`h4`,oe,(0,t.toDisplayString)(e.title),1)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:`ml-ribbon-gallery__panel-grid`,style:(0,t.normalizeStyle)(N.value)},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,r=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:r.id,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-gallery__item ml-ribbon-gallery__panel-item`,{"is-selected":s.value===r.id}]),disabled:W(r),onClick:e=>X(r)},[(0,t.renderSlot)(i.$slots,`item`,{item:r,category:e,selected:s.value===r.id,disabled:W(r),select:()=>X(r)},()=>[U(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(U(r)),(0,t.mergeProps)({key:0,ref_for:!0},r.componentProps,{item:r,category:e,selected:s.value===r.id,disabled:W(r)}),null,16,[`item`,`category`,`selected`,`disabled`])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview`,{"ml-ribbon-gallery__preview--icon":H(r)||G(r),"ml-ribbon-gallery__preview--svg":K(r)}])},[H(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-gallery__preview-icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(H(r))))]),_:2},1024)):G(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview-icon ml-ribbon-gallery__preview-icon--class`,G(r)]),"aria-hidden":`true`},null,2)):K(r)&&J(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:K(r)??``,alt:``},null,8,ce)):K(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,le,[(0,t.createElementVNode)(`use`,{href:K(r)??``},null,8,ue)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Y(r)),1)],64))],2),(0,t.createElementVNode)(`div`,de,(0,t.toDisplayString)(r.label),1)],64))])],10,se))),128))],4)]))),128))])]),_:3},8,[`visible`,`disabled`,`width`,`popper-class`])):(0,t.createCommentVNode)(``,!0),!e.collapsed&&y.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,fe,(0,t.toDisplayString)(y.value),1)):(0,t.createCommentVNode)(``,!0),e.collapsed?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,$,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.categories,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:e.id,class:`ml-ribbon-gallery__category`},[y.value&&L(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`h4`,pe,(0,t.toDisplayString)(e.title),1)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:`ml-ribbon-gallery__grid`,style:(0,t.normalizeStyle)({"--ml-ribbon-gallery-inline-columns":String(w.value)})},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(R(e),r=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:r.id,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-gallery__item`,{"is-selected":s.value===r.id}]),disabled:W(r),onClick:e=>X(r)},[(0,t.renderSlot)(i.$slots,`item`,{item:r,category:e,selected:s.value===r.id,disabled:W(r),select:()=>X(r)},()=>[U(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(U(r)),(0,t.mergeProps)({key:0,ref_for:!0},r.componentProps,{item:r,category:e,selected:s.value===r.id,disabled:W(r)}),null,16,[`item`,`category`,`selected`,`disabled`])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview`,{"ml-ribbon-gallery__preview--icon":H(r)||G(r),"ml-ribbon-gallery__preview--svg":K(r)}])},[H(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-gallery__preview-icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(H(r))))]),_:2},1024)):G(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview-icon ml-ribbon-gallery__preview-icon--class`,G(r)]),"aria-hidden":`true`},null,2)):K(r)&&J(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:K(r)??``,alt:``},null,8,he)):K(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,ge,[(0,t.createElementVNode)(`use`,{href:K(r)??``},null,8,_e)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Y(r)),1)],64))],2),(0,t.createElementVNode)(`div`,ve,(0,t.toDisplayString)(r.label),1)],64))])],10,me))),128))],4)]))),128)),j.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ye,[(0,t.createElementVNode)(`button`,{type:`button`,class:`ml-ribbon-gallery__control-button`,disabled:e.disabled||!D.value,"aria-label":`Show previous gallery row`,onClick:a[1]||=e=>z(-1)},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.ArrowUp))]),_:1})],8,be),(0,t.createElementVNode)(`button`,{type:`button`,class:`ml-ribbon-gallery__control-button`,disabled:e.disabled||!O.value,"aria-label":`Show next gallery row`,onClick:a[2]||=e=>z(1)},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.ArrowDown))]),_:1})],8,xe),(0,t.createVNode)((0,t.unref)(n.ElPopover),{visible:c.value,"onUpdate:visible":a[3]||=e=>c.value=e,trigger:`click`,placement:`bottom-start`,disabled:e.disabled,width:P.value,"popper-class":M.value,"popper-options":F.value},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{ref_key:`inlineMoreButtonRef`,ref:d,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-gallery__control-button ml-ribbon-gallery__more-button`,{"is-open":c.value}]),disabled:e.disabled,"aria-label":`Show more gallery items`,onClick:V},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.Bottom))]),_:1})],10,Se)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{ref_key:`inlinePanelRef`,ref:f,class:`ml-ribbon-gallery__panel`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.categories,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:e.id,class:`ml-ribbon-gallery__panel-category`},[L(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`h4`,Ce,(0,t.toDisplayString)(e.title),1)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,{class:`ml-ribbon-gallery__panel-grid`,style:(0,t.normalizeStyle)(N.value)},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,r=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:r.id,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-gallery__item ml-ribbon-gallery__panel-item`,{"is-selected":s.value===r.id}]),"data-gallery-row-index":B(r),disabled:W(r),onClick:e=>X(r)},[(0,t.renderSlot)(i.$slots,`item`,{item:r,category:e,selected:s.value===r.id,disabled:W(r),select:()=>X(r)},()=>[U(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(U(r)),(0,t.mergeProps)({key:0,ref_for:!0},r.componentProps,{item:r,category:e,selected:s.value===r.id,disabled:W(r)}),null,16,[`item`,`category`,`selected`,`disabled`])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview`,{"ml-ribbon-gallery__preview--icon":H(r)||G(r),"ml-ribbon-gallery__preview--svg":K(r)}])},[H(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-gallery__preview-icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(H(r))))]),_:2},1024)):G(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-gallery__preview-icon ml-ribbon-gallery__preview-icon--class`,G(r)]),"aria-hidden":`true`},null,2)):K(r)&&J(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:K(r)??``,alt:``},null,8,Te)):K(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,Ee,[(0,t.createElementVNode)(`use`,{href:K(r)??``},null,8,De)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Y(r)),1)],64))],2),(0,t.createElementVNode)(`div`,Oe,(0,t.toDisplayString)(r.label),1)],64))])],10,we))),128))],4)]))),128))],512)]),_:3},8,[`visible`,`disabled`,`width`,`popper-class`,`popper-options`])])):(0,t.createCommentVNode)(``,!0)]))],2))}}),Ie=[`data-id`,`onKeydown`],Le={key:0,class:`ml-ribbon-input-number__prefix`},Re={key:2,class:`ml-ribbon-input-number__prefix-label`},ze=(0,t.defineComponent)({name:`MlRibbonInputNumber`,__name:`RibbonInputNumber`,props:{id:{},modelValue:{default:void 0},width:{default:`96px`},prefixLabel:{default:void 0},prefixIcon:{default:void 0},prefixIconClass:{default:void 0},controlProps:{default:()=>({})},disabled:{type:Boolean,default:!1}},emits:[`change`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.computed)(()=>x(i.width,`96px`)),s=(0,t.computed)(()=>o.value===`100%`),c=(0,t.computed)(()=>s.value?{width:`100%`}:{}),l=(0,t.computed)(()=>s.value?{}:{width:o.value}),u=(0,t.computed)(()=>b(i.prefixLabel)),d=(0,t.computed)(()=>!i.prefixIcon||typeof i.prefixIcon==`string`?null:i.prefixIcon),f=(0,t.computed)(()=>b(i.prefixIconClass??(typeof i.prefixIcon==`string`?i.prefixIcon:void 0))??null),p=(0,t.computed)(()=>!!(u.value||d.value||f.value)),m=(0,t.computed)(()=>u.value??i.id),h=(0,t.ref)(void 0);function g(e){v(e)}function _(e){e.preventDefault(),e.stopPropagation();let t=e.target;if(!(t instanceof HTMLInputElement))return;let n=y(t.value);n===void 0&&t.value.trim().length>0||v(n)}function v(e){Object.is(h.value,e)||(h.value=e,a(`change`,e))}function y(e){let t=e.trim();if(!t)return;let n=Number(t);return Number.isFinite(n)?n:void 0}function b(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function x(e,t){if(typeof e==`number`&&Number.isFinite(e)&&e>0)return`${e}px`;if(typeof e==`string`){let n=e.trim();return n?n.toLowerCase()===`full`?`100%`:n:t}return t}return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-input-number`,{"has-prefix":p.value,"is-full":s.value}]),style:(0,t.normalizeStyle)(c.value),"data-id":e.id,onKeydown:(0,t.withKeys)((0,t.withModifiers)(_,[`stop`,`prevent`]),[`enter`])},[p.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Le,[d.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-input-number__prefix-icon`,"aria-hidden":`true`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(d.value)))]),_:1})):f.value?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-input-number__prefix-icon ml-ribbon-input-number__prefix-icon--class`,f.value]),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0),u.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Re,(0,t.toDisplayString)(u.value),1)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)((0,t.unref)(n.ElInputNumber),(0,t.mergeProps)(e.controlProps,{"model-value":e.modelValue,disabled:e.disabled,style:l.value,"aria-label":m.value,onChange:g}),null,16,[`model-value`,`disabled`,`style`,`aria-label`])],46,Ie))}}),Be=[`data-id`],Ve={key:0,class:`ml-ribbon-segmented__label`},He=[`data-option-value`,`aria-label`],Ue={key:2,class:`ml-ribbon-segmented__option-label`},We={key:3,class:`ml-ribbon-segmented__option-sr-label`},Ge=(0,t.defineComponent)({__name:`RibbonSegmented`,props:{id:{},label:{default:``},options:{},modelValue:{type:[String,Number,Boolean],default:void 0},direction:{default:`horizontal`},block:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},hideLabel:{type:Boolean,default:!1},tooltipShowAfter:{default:1e3},tooltipHideAfter:{default:0}},emits:[`change`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.computed)(()=>i.label?.trim()??``),s=(0,t.computed)(()=>!i.hideLabel&&o.value.length>0);function c(e){return e}function l(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function u(e){if(typeof e==`string`){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim();return t?t.replace(/\b\w/g,e=>e.toUpperCase()):void 0}if(typeof e==`number`||typeof e==`boolean`)return String(e)}function d(e){let t=c(e);return t.label?.trim()||String(t.value)}function f(e){let t=c(e);return l(t.tooltip)??l(t.label)??u(t.value)}function p(e){let t=c(e).icon;return t&&typeof t!=`string`?t:null}function m(e){let t=c(e).iconClass;if(typeof t==`string`&&t.trim())return t;let n=c(e).icon;return typeof n==`string`&&n.trim()?n.trim():null}function h(e){return!p(e)&&!m(e)}function g(e){return String(c(e).value)}function _(e){return f(e)??g(e)}function v(e){a(`change`,e)}return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`ml-ribbon-segmented`,"data-id":e.id},[s.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Ve,(0,t.toDisplayString)(o.value),1)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)((0,t.unref)(n.ElSegmented),{class:`ml-ribbon-segmented__control`,options:e.options,"model-value":e.modelValue,direction:e.direction,block:e.block,disabled:e.disabled,"aria-label":o.value||e.id,onChange:v},{default:(0,t.withCtx)(({item:r})=>[(0,t.createVNode)((0,t.unref)(n.ElTooltip),{content:f(r),disabled:!f(r),"show-after":e.tooltipShowAfter,"hide-after":e.tooltipHideAfter,placement:`top`,effect:`dark`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,{class:`ml-ribbon-segmented__option`,"data-option-value":g(r),"aria-label":_(r)},[p(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-segmented__option-icon`,"aria-hidden":`true`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(p(r))))]),_:2},1024)):m(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-segmented__option-icon ml-ribbon-item-host__icon--class`,m(r)]),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0),h(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ue,(0,t.toDisplayString)(d(r)),1)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,We,(0,t.toDisplayString)(d(r)),1))],8,He)]),_:2},1032,[`content`,`disabled`,`show-after`,`hide-after`])]),_:1},8,[`options`,`model-value`,`direction`,`block`,`disabled`,`aria-label`])],8,Be))}}),Ke=(0,t.defineComponent)({__name:`RibbonToggleButton`,props:{id:{},label:{default:``},modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},hideLabel:{type:Boolean,default:!1},activeIcon:{default:void 0},inactiveIcon:{default:void 0},activeLabel:{default:void 0},inactiveLabel:{default:void 0}},emits:[`change`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.ref)(!!r.modelValue);(0,t.watch)(()=>r.modelValue,e=>{a.value=!!e},{immediate:!0});let o=(0,t.computed)(()=>a.value),s=(0,t.computed)(()=>o.value?r.activeIcon??r.inactiveIcon:r.inactiveIcon??r.activeIcon),c=(0,t.computed)(()=>(o.value?r.activeLabel?.trim():r.inactiveLabel?.trim())||r.label?.trim()||r.id),l=(0,t.computed)(()=>!r.hideLabel&&c.value.length>0);function u(){if(r.disabled)return;let e=!a.value;a.value=e,i(`change`,e)}return(n,r)=>((0,t.openBlock)(),(0,t.createBlock)(R,{id:e.id,class:(0,t.normalizeClass)([`ml-ribbon-toggle`,{"is-active":o.value}]),icon:s.value,label:c.value,disabled:e.disabled,"hide-label":!l.value,"aria-label":c.value,"aria-pressed":String(o.value),onClick:u},null,8,[`id`,`class`,`icon`,`label`,`disabled`,`hide-label`,`aria-label`,`aria-pressed`]))}}),qe=[`data-template-id`,`aria-disabled`],Je=(0,t.defineComponent)({__name:`RibbonTemplateItem`,props:{id:{},item:{},disabled:{type:Boolean}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`ml-ribbon-template-item`,"data-template-id":e.id,"aria-disabled":e.disabled},[(0,t.renderSlot)(n.$slots,`default`,{item:e.item,disabled:e.disabled},()=>[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.item.label??e.item.id),1)])],8,qe))}}),Ye=[`data-item-id`],Xe={key:0,class:`ml-ribbon-item-host__keytip`},Ze=(0,t.defineComponent)({__name:`RibbonItemHost`,props:{id:{},item:{},groupId:{},galleryPreviewFallback:{},disabled:{type:Boolean}},emits:[`item-click`],setup(e,{emit:r}){let a=e,o=r,s=(0,t.inject)(i,null),c=(0,t.computed)(()=>Array.isArray(a.item.props?.options)?a.item.props.options:[]),l=(0,n.useGlobalConfig)(`size`,``),u=(0,t.computed)(()=>l.value||`default`),d=(0,t.computed)(()=>le(s?.tooltipShowAfter.value,1e3)),f=(0,t.computed)(()=>le(s?.tooltipHideAfter.value,0)),p=(0,t.computed)(()=>`ml-ribbon-select-dropdown ml-ribbon-popper ml-ribbon-popper--size-${u.value}`),m=(0,t.computed)(()=>a.item.props?.icon||a.item.icon),h=(0,t.computed)(()=>a.item.hideLabel!==!0),g=(0,t.ref)(void 0),_=(0,t.computed)(()=>{if(a.item.type===`dropdown`&&g.value)return F(g.value);let e=ce(a.item.tooltip)??ce(a.item.label)??pe(a.item)??me(a.item.id);return e&&F(e)}),v=(0,t.computed)(()=>a.item.type!==`buttonGroup`&&a.item.type!==`segmented`),y=(0,t.computed)(()=>!v.value||!_.value),b=(0,t.computed)(()=>_.value??a.item.id),x=(0,t.computed)(()=>a.item.keyTip?.trim().toUpperCase()??``),S=(0,t.computed)(()=>{if(!s?.keyTipsOpen.value||s?.disabled.value||a.disabled===!0||!x.value)return!1;let e=s.keyTipsSequence.value.toLowerCase();return e?x.value.toLowerCase().startsWith(e):!0}),C=(0,t.computed)(()=>a.disabled===!0||a.item.disabled===!0||s?.disabled.value===!0),w=(0,t.computed)(()=>a.item.props?.modelValue),T=(0,t.computed)(()=>a.item.props?.activeLabel),E=(0,t.computed)(()=>a.item.props?.inactiveLabel),D=(0,t.computed)(()=>Array.isArray(a.item.props?.categories)?a.item.props.categories:[]),O=(0,t.computed)(()=>{let e=a.item.props?.modelValue;return typeof e==`string`?e:void 0}),k=(0,t.computed)(()=>{let e=a.item.props?.inlineItemLimit;return typeof e==`number`?e:void 0}),A=(0,t.computed)(()=>a.item.props?.inlineItemWidthMode===`auto`?`auto`:`fixed`),j=(0,t.computed)(()=>{let e=a.item.props?.component;return!e||typeof e==`string`?null:(0,t.markRaw)((0,t.toRaw)(e))}),M=(0,t.computed)(()=>{let e=a.item.props?.componentProps;return!e||typeof e!=`object`||Array.isArray(e)?{}:e}),N=(0,t.computed)(()=>a.item.props?.wrap!==!1),P=(0,t.computed)(()=>a.item.props?.equalWidth===!0),I=(0,t.computed)(()=>{let e=a.item.props?.buttonSize;if(e===`large`||e===`default`||e===`small`)return e}),L=(0,t.computed)(()=>fe(a.item.props?.iconSize)),z=(0,t.computed)(()=>ue(a.item.props?.width??a.item.props?.comboWidth,`92px`)),B=(0,t.computed)(()=>a.item.props?.modelValue),ee=(0,t.computed)(()=>ue(a.item.props?.width??a.item.props?.inputNumberWidth,`96px`)),te=(0,t.computed)(()=>a.item.props?.modelValue),H=(0,t.computed)(()=>{let e={...a.item.props??{}};return delete e.modelValue,delete e.width,delete e.inputNumberWidth,delete e.prefixLabel,delete e.prefixIcon,delete e.prefixIconClass,delete e.emitValueOnChange,delete e.valuePrefix,delete e.options,delete e.component,delete e.componentProps,e}),U=(0,t.computed)(()=>$(a.item.props?.labelWrapLines)),W=(0,t.computed)(()=>de(a.item.props?.labelWrapWidth)),G=(0,t.computed)(()=>(a.item.type===`button`||a.item.type===`dropdown`)&&a.item.size===`large`&&h.value&&(U.value??0)>1),K=(0,t.computed)(()=>{if(!G.value)return{};let e={"--ml-rb-item-label-max-lines":String(U.value??2)};return W.value&&(e[`--ml-rb-item-label-wrap-width`]=W.value),e});(0,t.watch)(()=>a.item.id,()=>{g.value=void 0});function q(){C.value||o(`item-click`,a.id)}function J(e){if(!C.value){if(typeof e==`string`||typeof e==`number`){o(`item-click`,String(e));return}q()}}function Y(e){g.value=e}function ne(e){if(!C.value){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`){o(`item-click`,String(e));return}q()}}function re(e){if(C.value)return;let t=e?a.item.props?.activeValue:a.item.props?.inactiveValue;if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`){o(`item-click`,String(t));return}o(`item-click`,String(e))}function ie(e){if(!C.value){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`){o(`item-click`,String(e));return}q()}}function Z(e){C.value||o(`item-click`,e)}function ae(e){if(!C.value){if(a.item.props?.emitValueOnChange===!0&&(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)){o(`item-click`,String(e));return}q()}}function Q(e){if(!C.value){if(a.item.props?.emitValueOnChange===!0&&typeof e==`number`&&Number.isFinite(e)){let t=a.item.props?.valuePrefix;o(`item-click`,`${typeof t==`string`?t:``}${e}`);return}q()}}function oe(e){if(!C.value){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`){o(`item-click`,String(e));return}q()}}function se(e){if(!e||typeof e!=`object`)return;let t=e.label;return typeof t==`string`?t:void 0}function ce(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function le(e,t){return typeof e!=`number`||Number.isNaN(e)||!Number.isFinite(e)?t:Math.max(0,Math.round(e))}function ue(e,t){if(typeof e==`number`&&Number.isFinite(e)&&e>0)return`${e}px`;if(typeof e==`string`){let n=e.trim();return n?n.toLowerCase()===`full`?`100%`:n:t}return t}function de(e){if(typeof e==`number`&&Number.isFinite(e)&&e>0)return`${e}px`;if(typeof e==`string`){let t=e.trim();return t?t.toLowerCase()===`full`?`100%`:t:void 0}}function fe(e){if(typeof e==`number`&&Number.isFinite(e)&&e>0)return`${e}px`;if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function $(e){if(!(typeof e!=`number`||Number.isNaN(e)||!Number.isFinite(e)))return Math.max(1,Math.round(e))}function pe(e){let t=c.value.map(e=>se(e)).filter(e=>!!e);if(t.length)return e.type===`buttonGroup`?t.join(` / `):t[0]}function me(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim();return t?t.replace(/\b\w/g,e=>e.toUpperCase()):e}return(r,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElTooltip),{content:_.value,disabled:y.value,"show-after":d.value,"hide-after":f.value,placement:`top`,effect:`dark`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-item-host`,[`is-${e.item.size??`medium`}`,`type-${e.item.type}`,{"is-label-hidden":e.item.hideLabel===!0,"is-label-wrap":G.value}]]),style:(0,t.normalizeStyle)(K.value),"data-item-id":e.id,role:`group`},[S.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Xe,(0,t.toDisplayString)(x.value),1)):(0,t.createCommentVNode)(``,!0),e.item.type===`buttonGroup`?((0,t.openBlock)(),(0,t.createBlock)(V,{key:1,id:e.item.id,label:e.item.label??``,options:e.item.props?.options??[],"hide-label":e.item.hideLabel===!0,wrap:N.value,"equal-width":P.value,"button-size":I.value,"icon-size":L.value,"tooltip-show-after":d.value,"tooltip-hide-after":f.value,disabled:C.value,onChange:ie},null,8,[`id`,`label`,`options`,`hide-label`,`wrap`,`equal-width`,`button-size`,`icon-size`,`tooltip-show-after`,`tooltip-hide-after`,`disabled`])):e.item.type===`segmented`?((0,t.openBlock)(),(0,t.createBlock)(Ge,{key:2,id:e.item.id,label:e.item.label??e.item.id,options:e.item.props?.options??[],"model-value":e.item.props?.modelValue,direction:e.item.props?.direction??`horizontal`,block:e.item.props?.block===!0,disabled:C.value,"hide-label":e.item.hideLabel===!0,"tooltip-show-after":d.value,"tooltip-hide-after":f.value,onChange:ne},null,8,[`id`,`label`,`options`,`model-value`,`direction`,`block`,`disabled`,`hide-label`,`tooltip-show-after`,`tooltip-hide-after`])):e.item.type===`toggle`?((0,t.openBlock)(),(0,t.createBlock)(Ke,{key:3,id:e.item.id,label:e.item.label??e.item.id,"model-value":w.value,"active-icon":e.item.props?.activeIcon??e.item.props?.icon??e.item.icon,"inactive-icon":e.item.props?.inactiveIcon??e.item.props?.icon??e.item.icon,"active-label":T.value,"inactive-label":E.value,disabled:C.value,"hide-label":e.item.hideLabel===!0,onChange:re},null,8,[`id`,`label`,`model-value`,`active-icon`,`inactive-icon`,`active-label`,`inactive-label`,`disabled`,`hide-label`])):e.item.type===`gallery`?((0,t.openBlock)(),(0,t.createBlock)(Fe,{key:4,id:e.item.id,label:e.item.label??``,categories:D.value,"model-value":O.value,collapsed:e.item.props?.collapsed===!0,"inline-item-limit":k.value,"inline-item-width-mode":A.value,"preview-fallback":a.galleryPreviewFallback,disabled:C.value,onSelect:Z},null,8,[`id`,`label`,`categories`,`model-value`,`collapsed`,`inline-item-limit`,`inline-item-width-mode`,`preview-fallback`,`disabled`])):e.item.type===`custom`||e.item.type===`template`?((0,t.openBlock)(),(0,t.createBlock)(Je,{key:5,id:e.item.id,item:e.item,disabled:C.value},{default:(0,t.withCtx)(()=>[j.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(j.value),(0,t.mergeProps)({key:0},M.value,{item:e.item,"group-id":e.groupId,disabled:C.value,"emit-item-click":oe}),null,16,[`item`,`group-id`,`disabled`])):(0,t.renderSlot)(r.$slots,`template`,{key:1,item:e.item,disabled:C.value})]),_:3},8,[`id`,`item`,`disabled`])):e.item.type===`dropdown`?((0,t.openBlock)(),(0,t.createBlock)(X,{key:6,id:e.item.id,label:e.item.label??e.item.id,tooltip:e.item.tooltip,icon:m.value,options:e.item.props?.options??[],"model-value":e.item.props?.modelValue,disabled:C.value,"hide-label":e.item.hideLabel===!0,"item-size":e.item.size??`medium`,"sync-label-with-selection":e.item.props?.syncLabelWithSelection===!0,"tooltip-show-after":d.value,"tooltip-hide-after":f.value,onCommand:J,onTooltipChange:Y,onClick:q},null,8,[`id`,`label`,`tooltip`,`icon`,`options`,`model-value`,`disabled`,`hide-label`,`item-size`,`sync-label-with-selection`,`tooltip-show-after`,`tooltip-hide-after`])):e.item.type===`checkbox`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElCheckbox),{key:7,disabled:C.value,onChange:q},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.item.label),1)]),_:1},8,[`disabled`])):e.item.type===`colorPicker`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElColorPicker),{key:8,disabled:C.value,onChange:q},null,8,[`disabled`])):e.item.type===`comboBox`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElSelect),{key:9,"model-value":B.value,disabled:C.value,"popper-class":p.value,style:(0,t.normalizeStyle)({width:z.value}),onChange:ae},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(c.value,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElOption),{key:String(e.value),label:String(e.label),value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`disabled`,`popper-class`,`style`])):e.item.type===`inputNumber`?((0,t.openBlock)(),(0,t.createBlock)(ze,{key:10,id:e.item.id,"model-value":te.value,width:ee.value,"prefix-label":e.item.props?.prefixLabel,"prefix-icon":e.item.props?.prefixIcon??e.item.props?.icon??e.item.icon,"prefix-icon-class":e.item.props?.prefixIconClass,"control-props":H.value,disabled:C.value,onChange:Q},null,8,[`id`,`model-value`,`width`,`prefix-label`,`prefix-icon`,`prefix-icon-class`,`control-props`,`disabled`])):((0,t.openBlock)(),(0,t.createBlock)(R,{key:11,id:e.item.id,label:e.item.label??e.item.id,icon:m.value,disabled:C.value,"hide-label":!h.value,"aria-label":b.value,onClick:q},null,8,[`id`,`label`,`icon`,`disabled`,`hide-label`,`aria-label`]))],14,Ye)]),_:3},8,[`content`,`disabled`,`show-after`,`hide-after`]))}}),Qe=(0,t.defineComponent)({__name:`RibbonGroupContent`,props:{group:{},galleryPreviewFallback:{},disabled:{type:Boolean}},emits:[`item-click`],setup(e,{emit:n}){let r=e,i=n;return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ml-ribbon-group__content`,[`ml-ribbon-group__content--${r.group.orientation??`column`}`]])},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.group.collections??[],e=>((0,t.openBlock)(),(0,t.createBlock)(N,{id:e.id,key:e.id,layout:e.layout??(r.group.orientation===`row`?`row`:`column`),rows:e.rows},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,e=>((0,t.openBlock)(),(0,t.createBlock)(Ze,{id:e.id,key:e.id,item:e,"group-id":r.group.id,"gallery-preview-fallback":r.galleryPreviewFallback,disabled:r.disabled,onItemClick:n[0]||=e=>i(`item-click`,{groupId:r.group.id,itemId:e})},null,8,[`id`,`item`,`group-id`,`gallery-preview-fallback`,`disabled`]))),128))]),_:2},1032,[`id`,`layout`,`rows`]))),128))],2))}}),$e=[`aria-label`,`disabled`],et={class:`ml-ribbon-overflow-list`},tt={class:`ml-ribbon-overflow-group-flyout__footer`},nt=(0,t.defineComponent)({__name:`RibbonClassicOverflow`,props:{groups:{},popoverClass:{},popoverWidth:{},triggerAriaLabel:{},galleryPreviewFallback:{},disabled:{type:Boolean}},emits:[`open`,`close`,`itemClick`],setup(e,{emit:r}){let i=r;function a(e){i(`itemClick`,e)}return(r,o)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{trigger:`click`,placement:`bottom-end`,width:e.popoverWidth,disabled:e.disabled,"show-arrow":!1,teleported:!0,"popper-options":{strategy:`fixed`},"popper-class":e.popoverClass,onShow:o[0]||=e=>i(`open`),onHide:o[1]||=e=>i(`close`)},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:`ml-ribbon-overflow-trigger`,"aria-label":e.triggerAriaLabel,disabled:e.disabled},[...o[2]||=[(0,t.createElementVNode)(`span`,{class:`ml-ribbon-overflow-trigger__dots`},`...`,-1)]],8,$e)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,et,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.groups,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:n.id,class:`ml-ribbon-overflow-group-flyout`},[(0,t.createVNode)(Qe,{group:n,"gallery-preview-fallback":e.galleryPreviewFallback,disabled:e.disabled,onItemClick:a},null,8,[`group`,`gallery-preview-fallback`,`disabled`]),(0,t.createElementVNode)(`footer`,tt,(0,t.toDisplayString)(n.title),1)]))),128))])]),_:1},8,[`width`,`disabled`,`popper-class`]))}}),rt=[`data-priority`],it={class:`ml-ribbon-group__body`},at={class:`ml-ribbon-group__footer`},ot={class:`ml-ribbon-group__title`},st=[`aria-label`,`aria-expanded`,`disabled`],ct={class:`ml-ribbon-group__overflow-content`},lt=[`aria-label`,`aria-expanded`,`disabled`],ut={class:`ml-ribbon-group__overflow-content`},dt=(0,t.defineComponent)({__name:`RibbonGroup`,props:{id:{},title:{},icon:{},groupIconCss:{},orientation:{},width:{},priority:{},launcher:{type:Boolean},showLauncherIcon:{type:Boolean},groupModel:{},overflowTriggerAriaLabel:{},galleryPreviewFallback:{},disabled:{type:Boolean}},emits:[`item-click`],setup(e,{emit:a}){let o=e,s=a,c=(0,t.inject)(i,null),l=(0,t.computed)(()=>o.width==null),u=(0,t.computed)(()=>{if(typeof o.width!=`number`||Number.isNaN(o.width)||o.width<=0)return;let e=`${o.width}px`;return{width:e,minWidth:e,maxWidth:e,flex:`0 0 ${e}`}}),d=(0,t.computed)(()=>o.disabled===!0||c?.disabled.value===!0),f=(0,t.ref)(null),p=(0,t.ref)([]),m=(0,t.ref)(null),h=(0,t.ref)(null),g=(0,t.ref)(0),_=(0,t.ref)(0),v=(0,n.useGlobalConfig)(`size`,``),y=(0,t.computed)(()=>v.value||`default`),b=(0,t.computed)(()=>`ml-ribbon-group__overflow-popover ml-ribbon-group__overflow-popover--size-${y.value}`),x=(0,t.computed)(()=>({modifiers:[{name:`offset`,options:{offset:[g.value,8]}}]})),S=(0,t.computed)(()=>({modifiers:[{name:`offset`,options:{offset:[_.value,8]}}]})),C=(0,t.computed)(()=>!o.icon||typeof o.icon==`string`?null:o.icon),w=(0,t.computed)(()=>p.value.length>0),T=(0,t.computed)(()=>(o.groupModel?.footerMenuItems?.length??0)>0),E=(0,t.ref)(!1),D=(0,t.ref)(!1),O=(0,t.computed)(()=>{if(!o.groupModel||!p.value.length)return null;let e=new Set(p.value),t=o.groupModel.collections?.map(t=>({...t,items:t.items.filter(t=>e.has(t.id))})).filter(e=>e.items.length>0)??[];return t.length?{...o.groupModel,collections:t}:null}),k=(0,t.computed)(()=>o.groupModel?.footerMenuItems?.length?{id:`${o.groupModel.id}-footer-menu`,title:``,orientation:`row`,collections:[{id:`${o.groupModel.id}-footer-menu-collection`,layout:`row`,items:o.groupModel.footerMenuItems}]}:null);function A(){let e=f.value?.querySelector(`.ml-ribbon-group__content`);if(!e){p.value.length>0&&(p.value=[]);return}let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0){p.value.length>0&&(p.value=[]);return}let n=[];e.querySelectorAll(`.ml-ribbon-item-host[data-item-id]`).forEach(e=>{let r=e.dataset.itemId;if(!r)return;let i=e.getBoundingClientRect();(i.right-t.right>.5||i.bottom-t.bottom>.5||t.left-i.left>.5||t.top-i.top>.5)&&n.push(r)}),p.value.length===n.length&&p.value.every((e,t)=>e===n[t])||(p.value=n)}function j(){(0,t.nextTick)(()=>{B(),M(),N(),A()})}function M(){let e=f.value?.getBoundingClientRect(),t=m.value?.getBoundingClientRect();if(!e||!t){g.value!==0&&(g.value=0);return}let n=Math.round(e.left-t.left);g.value!==n&&(g.value=n)}function N(){let e=f.value?.getBoundingClientRect(),t=h.value?.getBoundingClientRect();if(!e||!t){_.value!==0&&(_.value=0);return}let n=Math.round(e.left-t.left);_.value!==n&&(_.value=n)}function P(e){E.value=e}function F(e){D.value=e}function I(){d.value||(E.value=!E.value)}function L(){d.value||(D.value=!D.value)}let R=null,z=null;function B(){if(!R)return;let e=f.value?.querySelector(`.ml-ribbon-group__content`)??null;z!==e&&(z&&R.unobserve(z),e&&R.observe(e),z=e)}return(0,t.watch)(()=>o.groupModel,()=>{j()},{deep:!0}),(0,t.watch)(d,e=>{e&&(E.value=!1,D.value=!1)}),(0,t.onMounted)(()=>{typeof ResizeObserver<`u`&&(R=new ResizeObserver(()=>{M(),N(),A()}),f.value&&R.observe(f.value),B()),j()}),(0,t.onUnmounted)(()=>{R?.disconnect()}),(i,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{ref_key:`groupSectionRef`,ref:f,class:(0,t.normalizeClass)([`ml-ribbon-group`,{"ml-ribbon-group--auto-width":l.value}]),"data-priority":e.priority??100,style:(0,t.normalizeStyle)(u.value)},[(0,t.createElementVNode)(`div`,it,[(0,t.renderSlot)(i.$slots,`default`)]),(0,t.createElementVNode)(`footer`,at,[C.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-group__icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(C.value)))]),_:1})):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,ot,(0,t.toDisplayString)(e.title),1),T.value&&k.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:1,trigger:`click`,placement:`bottom-start`,disabled:d.value,"popper-class":b.value,"popper-options":S.value,onShow:a[1]||=e=>P(!0),onHide:a[2]||=e=>P(!1)},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{ref_key:`footerTriggerRef`,ref:h,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-group__footer-trigger`,{"is-open":E.value}]),"aria-label":e.overflowTriggerAriaLabel,"aria-expanded":E.value,disabled:d.value,onClick:I},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(E.value?(0,t.unref)(r.ArrowUp):(0,t.unref)(r.ArrowDown))))]),_:1})],10,st)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,ct,[(0,t.createVNode)(Qe,{group:k.value,"gallery-preview-fallback":e.galleryPreviewFallback,disabled:d.value,onItemClick:a[0]||=e=>s(`item-click`,e)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])])]),_:1},8,[`disabled`,`popper-class`,`popper-options`])):(0,t.createCommentVNode)(``,!0),w.value&&O.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:2,trigger:`click`,placement:`bottom-start`,disabled:d.value,"popper-class":b.value,"popper-options":x.value,onShow:a[4]||=e=>F(!0),onHide:a[5]||=e=>F(!1)},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{ref_key:`overflowTriggerRef`,ref:m,type:`button`,class:(0,t.normalizeClass)([`ml-ribbon-group__overflow-trigger`,{"is-open":D.value}]),"aria-label":e.overflowTriggerAriaLabel,"aria-expanded":D.value,disabled:d.value,onClick:L},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(D.value?(0,t.unref)(r.ArrowUp):(0,t.unref)(r.ArrowDown))))]),_:1})],10,lt)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,ut,[(0,t.createVNode)(Qe,{group:O.value,"gallery-preview-fallback":e.galleryPreviewFallback,disabled:d.value,onItemClick:a[3]||=e=>s(`item-click`,e)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])])]),_:1},8,[`disabled`,`popper-class`,`popper-options`])):(0,t.createCommentVNode)(``,!0),e.showLauncherIcon??e.launcher?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElButton),{key:3,link:``,class:`ml-ribbon-group__launcher`,disabled:d.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.Promotion))]),_:1})]),_:1},8,[`disabled`])):(0,t.createCommentVNode)(``,!0)])],14,rt))}}),ft=[`inert`,`aria-disabled`],pt={class:`ml-ribbon__head-left`},mt={key:2,class:`ml-ribbon__tabs-after`},ht={class:`ml-ribbon__head-right`},gt={key:2,class:`ml-ribbon__tabs-extra`},_t=[`data-active-tab`],vt={key:0,class:`ml-ribbon-group ml-ribbon-group--overflow`},yt={class:`ml-ribbon-group__body ml-ribbon-group__body--overflow`},bt=[`data-active-tab`],xt=[`disabled`],St={class:`ml-ribbon-simplified-group__panel`},Ct=[`data-active-tab`],wt={key:0,class:`ml-ribbon-group ml-ribbon-group--overflow`},Tt={class:`ml-ribbon-group__body ml-ribbon-group__body--overflow`},Et=[`data-active-tab`],Dt=[`disabled`],Ot={class:`ml-ribbon-simplified-group__panel`},kt=40,At=(0,t.defineComponent)({__name:`Ribbon`,props:{id:{default:`ml-ribbon-root`},tabs:{},activeTab:{default:``},activeLayout:{default:void 0},layout:{default:`classic`},size:{default:void 0},minimized:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},hideLayoutSwitcher:{type:Boolean,default:!1},hideMinimizeButton:{type:Boolean,default:!1},hideKeyTipsToggle:{type:Boolean,default:!1},showFileMenu:{type:Boolean,default:!0},showOpenBackstage:{type:Boolean,default:!0},fileMenuItems:{default:()=>[]},texts:{default:()=>({})},tooltipShowAfter:{default:1e3},tooltipHideAfter:{default:0}},emits:[`update:activeTab`,`update:layout`,`update:minimized`,`tabChange`,`layoutChange`,`itemClick`,`overflowOpen`,`overflowClose`,`backstageOpen`,`backstageClose`,`fileMenuSelect`],setup(e,{expose:a,emit:o}){function s(e){return e==null||typeof e==`string`?e:typeof e==`object`||typeof e==`function`?(0,t.markRaw)((0,t.toRaw)(e)):e}function c(e){if(!e)return;let t={...e};return`component`in t&&(t.component=s(t.component)),`icon`in t&&(t.icon=s(t.icon)),`activeIcon`in t&&(t.activeIcon=s(t.activeIcon)),`inactiveIcon`in t&&(t.inactiveIcon=s(t.inactiveIcon)),Array.isArray(t.options)&&(t.options=t.options.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return`icon`in t?{...t,icon:s(t.icon)}:t})),Array.isArray(t.categories)&&(t.categories=t.categories.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return{...t,items:Array.isArray(t.items)?t.items.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return{...t,preview:s(t.preview),icon:s(t.icon),component:s(t.component)}}):t.items}})),t}function l(e){return{...e,icon:s(e.icon),props:c(e.props)}}function u(e){return{...e,icon:s(e.icon),footerMenuItems:e.footerMenuItems?.map(l),collections:e.collections?.map(e=>({...e,items:e.items?.map(l)}))}}function p(e){return e.map(e=>({...e,groups:e.groups?.map(u)}))}function m(e,t){return typeof e!=`number`||Number.isNaN(e)||!Number.isFinite(e)?t:Math.max(0,Math.round(e))}let g={layoutSwitcherTooltip:`Switch ribbon layout`,minimizeTooltip:`Minimize ribbon`,keyTipsToggleText:`Key Tips`,overflowTriggerAriaLabel:`Open overflow groups`,groupOverflowTriggerAriaLabel:`Open group menu`,fileMenuLabel:`File`,fileMenuOpenBackstageLabel:`Open backstage`,backstageBackLabel:`Back`,backstageTitle:`Backstage`,backstageDescription:`Manage your document and settings here.`,keyTipsSequencePrefix:`Sequence:`,keyTipsEmptySequence:`No key sequence`,galleryPreviewFallback:`Preview unavailable`},_=e,v=o,{context:y,visibleTabs:x}=h(_.id,_.tabs,_.disabled,_.activeLayout?String(_.activeLayout).toLowerCase()===`simplified`?`simplified`:`classic`:_.layout,_.minimized,_.activeTab||_.tabs[0]?.id||``,m(_.tooltipShowAfter,1e3),m(_.tooltipHideAfter,0));(0,t.provide)(i,y),(0,t.watch)(()=>_.tabs,e=>{y.tabs.value=p(e),d(y.tabs.value.find(e=>e.id===y.activeTab.value))||(y.activeTab.value=f(y.tabs.value))},{deep:!0}),(0,t.watch)(()=>_.layout,e=>{e!==y.layout.value&&(y.layout.value=e)}),(0,t.watch)(()=>_.activeLayout,e=>{if(!e)return;let t=String(e).toLowerCase()===`simplified`?`simplified`:`classic`;t!==y.layout.value&&(y.layout.value=t)}),(0,t.watch)(()=>_.minimized,e=>{e!==y.minimized.value&&(y.minimized.value=e)}),(0,t.watch)(()=>_.disabled,e=>{e!==y.disabled.value&&(y.disabled.value=e)}),(0,t.watch)(()=>_.activeTab,e=>{e&&e!==y.activeTab.value&&(y.activeTab.value=e)}),(0,t.watch)(()=>_.tooltipShowAfter,e=>{let t=m(e,1e3);t!==y.tooltipShowAfter.value&&(y.tooltipShowAfter.value=t)}),(0,t.watch)(()=>_.tooltipHideAfter,e=>{let t=m(e,0);t!==y.tooltipHideAfter.value&&(y.tooltipHideAfter.value=t)}),(0,t.watch)(y.activeTab,e=>{v(`update:activeTab`,e),v(`tabChange`,e)}),(0,t.watch)(y.layout,e=>{v(`update:layout`,e),v(`layoutChange`,e)}),(0,t.watch)(y.minimized,e=>{v(`update:minimized`,e)}),(0,t.watch)(y.overflowOpen,e=>{v(e?`overflowOpen`:`overflowClose`)}),(0,t.watch)(y.backdropOpen,e=>{v(e?`backstageOpen`:`backstageClose`)});let S=(0,t.computed)(()=>x.value.find(e=>e.id===y.activeTab.value)),C=(0,t.computed)(()=>new Set(x.value.filter(e=>e.contextual&&e.contextualMode===`exclusive`).map(e=>e.id))),w=(0,t.computed)(()=>oe(S.value)),T=(0,t.computed)(()=>S.value?.groups?.filter(e=>e.visible!==!1)??[]),E=(0,t.ref)(null),D=(0,t.ref)(null),k=(0,t.ref)(null),A=(0,t.ref)(null),j=(0,t.ref)(!1),N=(0,t.ref)(0),P=(0,t.ref)({left:`0px`,top:`0px`,width:`1px`,height:`0px`}),F=(0,t.ref)(new Set),I=(0,t.ref)({}),L=(0,n.useGlobalConfig)(`size`,``),R=(0,t.computed)(()=>_.size||L.value||`default`),z=(0,t.computed)(()=>`ml-ribbon-group-popover ml-ribbon-group-popover--size-${R.value}`),B=(0,t.computed)(()=>`ml-ribbon-overflow-popover ml-ribbon-overflow-popover--size-${R.value}`),ee=(0,t.computed)(()=>`ml-ribbon-tab-panel-popover ml-ribbon-tab-panel-popover--size-${R.value}`),V=(0,t.computed)(()=>({layoutSwitcherTooltip:_.texts.layoutSwitcherTooltip||g.layoutSwitcherTooltip,minimizeTooltip:_.texts.minimizeTooltip||g.minimizeTooltip,keyTipsToggleText:_.texts.keyTipsToggleText||g.keyTipsToggleText,overflowTriggerAriaLabel:_.texts.overflowTriggerAriaLabel||g.overflowTriggerAriaLabel,groupOverflowTriggerAriaLabel:_.texts.groupOverflowTriggerAriaLabel||g.groupOverflowTriggerAriaLabel,fileMenuLabel:_.texts.fileMenuLabel||g.fileMenuLabel,fileMenuOpenBackstageLabel:_.texts.fileMenuOpenBackstageLabel||g.fileMenuOpenBackstageLabel,backstageBackLabel:_.texts.backstageBackLabel||g.backstageBackLabel,backstageTitle:_.texts.backstageTitle||g.backstageTitle,backstageDescription:_.texts.backstageDescription||g.backstageDescription,keyTipsSequencePrefix:_.texts.keyTipsSequencePrefix||g.keyTipsSequencePrefix,keyTipsEmptySequence:_.texts.keyTipsEmptySequence||g.keyTipsEmptySequence,galleryPreviewFallback:_.texts.galleryPreviewFallback||g.galleryPreviewFallback})),te=(0,t.computed)(()=>m(_.tooltipShowAfter,1e3)),H=(0,t.computed)(()=>m(_.tooltipHideAfter,0)),U=(0,t.computed)(()=>y.minimized.value?r.ArrowUpBold:r.ArrowDownBold),W=(0,t.computed)(()=>T.value.filter(e=>!F.value.has(e.id))),G=(0,t.computed)(()=>T.value.filter(e=>F.value.has(e.id))),K=(0,t.computed)(()=>{if(!G.value.length)return 220;let e=G.value.reduce((e,t)=>{let n=I.value[t.id]??Y(t);return Math.max(e,n)},0),t=Math.ceil(e+28);return Math.max(220,Math.min(720,t))});function q(e){let t=(e.collections??[]).flatMap(e=>(e.items??[]).map(e=>({...l(e),size:`medium`})));return{...e,orientation:`row`,collections:[{id:`${e.id}-simplified`,layout:`row`,items:t}]}}function J(e){return e.priority??100}function Y(e){return typeof e.width==`number`&&Number.isFinite(e.width)&&e.width>0?e.width:140}function X(e){let t={};return e.querySelectorAll(`.ml-ribbon-group`).forEach(e=>{let n=e.dataset.groupId;if(!n)return;let r=e.getBoundingClientRect().width;r>0&&(t[n]=r)}),t}function ne(){let e=T.value.reduce((e,t)=>{let n=I.value[t.id]??Y(t);return e+Math.max(n,Y(t))},0);return Math.max(220,e)}function re(e){let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--ml-rb-overflow-slot-width`));return Number.isFinite(t)&&t>0?t:kt}function ie(){if(y.layout.value!==`classic`){F.value=new Set;return}let e=y.minimized.value?A.value:k.value;if(!e)return;let t=T.value;if(!t.length){F.value=new Set;return}let n=Math.round(e.getBoundingClientRect().width),r=re(e),i=X(e);I.value={...I.value,...i};let a=t.filter(e=>e.enableGroupOverflow===!1),o=t.filter(e=>e.enableGroupOverflow!==!1).map((e,t)=>({group:e,index:t})),s=new Set,c=[...o].sort((e,t)=>{let n=J(t.group)-J(e.group);return n===0?t.index-e.index:n}),l=e=>i[e.id]??I.value[e.id]??Y(e),u=a.reduce((e,t)=>e+l(t),0),d=e=>o.filter(({group:t})=>!e.has(t.id)).reduce((e,{group:t})=>e+l(t),0),f=e=>u+d(e)+(e.size>0?r:0),p=0;for(;f(s)>n&&p<c.length;){let e=c[p].group;s.add(e.id),p+=1}F.value=s}function Z(){(0,t.nextTick)(()=>{ie()})}function ae(){let e=E.value,t=D.value;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=Number.parseFloat(getComputedStyle(e).borderLeftWidth||`0`)||0,a=Math.max(n.width-i*2,e.clientWidth,r.width,t.clientWidth);N.value=Math.round(a>0?a:y.layout.value===`classic`?ne():Math.max(360,T.value.length*120)),P.value={left:`${Math.round(n.left-r.left+i)}px`,top:`0px`,width:`1px`,height:`${Math.round(r.height)}px`}}function Q(){j.value=!1}function oe(e){return y.disabled.value?!0:!e||C.value.size===0?!1:!C.value.has(e.id)}function se(e){if(y.disabled.value)return;let t=y.activeTab.value===e.id;if(y.activeTab.value=e.id,!y.minimized.value){Q();return}ae(),j.value=t?!j.value:!0}function ce(){y.disabled.value||y.api.toggleSimplified()}function le(){y.disabled.value||(y.minimized.value||Q(),y.minimized.value=!y.minimized.value)}function ue(e){y.disabled.value||(Q(),v(`fileMenuSelect`,e))}function de(){y.disabled.value||(Q(),y.backdropOpen.value=!0)}function fe(){y.disabled.value||(y.backdropOpen.value=!1)}function $(e,t){w.value||(v(`itemClick`,{tabId:y.activeTab.value,groupId:e,itemId:t}),y.minimized.value&&Q())}function pe(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function me(){if(w.value){y.keyTips.value=[];return}let e=S.value;if(!e?.groups?.length){y.keyTips.value=[];return}let t=e.groups.filter(e=>e.visible!==!1).flatMap(t=>(t.collections??[]).flatMap(n=>n.items.filter(e=>e.keyTip&&e.disabled!==!0).map(n=>{let r=n.keyTip?.trim().toUpperCase();return r?{id:`${e.id}:${t.id}:${n.id}`,key:r,targetId:n.id,sequence:r.split(``),scope:`item`}:null}).filter(e=>!!e)));y.keyTips.value=t}function he(e){if(y.disabled.value)return;let t=S.value;if(t?.groups?.length){for(let n of t.groups)if(n.visible!==!1)for(let t of n.collections??[]){let r=t.items.find(t=>t.id===e.targetId&&t.disabled!==!0);if(r){$(n.id,r.id),y.keyTipsOpen.value=!1,y.keyTipsSequence.value=``;return}}}}function ge(){y.keyTipsSequence.value=``}function _e(e){if(!y.disabled.value&&!pe(e.target)){if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key===`Alt`){e.preventDefault(),y.keyTipsOpen.value=!y.keyTipsOpen.value,y.keyTipsOpen.value||ge();return}if(y.keyTipsOpen.value&&!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`){e.preventDefault(),y.keyTipsOpen.value=!1,ge();return}if(e.key===`Backspace`){e.preventDefault(),y.keyTipsSequence.value=y.keyTipsSequence.value.slice(0,-1);return}if(/^[a-z0-9]$/i.test(e.key)){e.preventDefault();let t=`${y.keyTipsSequence.value}${e.key.toUpperCase()}`;y.keyTipsSequence.value=t;let n=t.toLowerCase(),r=y.keyTips.value.find(e=>e.key.toLowerCase()===n);if(r){he(r);return}y.keyTips.value.some(e=>e.key.toLowerCase().startsWith(n))||ge()}}}}function ve(e){return e.icon&&typeof e.icon!=`string`?e.icon:e.groupIconCss?r.Grid:null}function ye(e){j.value=e}(0,t.watch)([T,()=>y.layout.value,()=>y.minimized.value],()=>{Z()}),(0,t.watch)([S,()=>y.tabs.value,()=>y.disabled.value],()=>{me(),ge()},{deep:!0,immediate:!0}),(0,t.watch)(()=>y.keyTipsOpen.value,e=>{e||ge()}),(0,t.watch)(()=>y.disabled.value,e=>{e&&(y.overflowOpen.value=!1,y.backdropOpen.value=!1,y.keyTipsOpen.value=!1,Q(),ge())}),(0,t.watch)([()=>y.minimized.value,()=>y.layout.value,S],([e,,t])=>{(!e||!t)&&Q()});function be(){if(!xe)return;let e=y.minimized.value?A.value:k.value,t=[k.value,A.value];for(let n of t)n&&n!==e&&xe.unobserve(n);e&&xe.observe(e)}(0,t.watch)([k,A,()=>y.minimized.value],()=>{be(),Z()},{flush:`post`}),(0,t.watch)(j,e=>{e&&(0,t.nextTick)(()=>{ae(),Z()})});let xe=null;(0,t.onMounted)(()=>{window.addEventListener(`keydown`,_e),window.addEventListener(`resize`,Se),typeof ResizeObserver<`u`&&(xe=new ResizeObserver(()=>{ae(),Z()}),be()),ae(),Z()}),(0,t.onUnmounted)(()=>{window.removeEventListener(`keydown`,_e),window.removeEventListener(`resize`,Se),xe?.disconnect()});function Se(){j.value&&ae()}return a(y.api),(i,a)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElConfigProvider),{size:_.size},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{ref_key:`ribbonRootRef`,ref:E,key:(0,t.unref)(y).disabled.value?`ml-ribbon-disabled`:`ml-ribbon-enabled`,class:(0,t.normalizeClass)([`ml-ribbon`,[`ml-ribbon--${(0,t.unref)(y).layout.value}`,`ml-ribbon--size-${R.value}`,{"ml-ribbon--disabled":(0,t.unref)(y).disabled.value,"ml-ribbon--minimized":(0,t.unref)(y).minimized.value,"ml-ribbon--keytips-open":(0,t.unref)(y).keyTipsOpen.value}]]),inert:(0,t.unref)(y).disabled.value,"aria-disabled":(0,t.unref)(y).disabled.value},[(0,t.createElementVNode)(`header`,{ref_key:`ribbonHeaderRef`,ref:D,class:`ml-ribbon__header`},[(0,t.createElementVNode)(`div`,pt,[e.showFileMenu?((0,t.openBlock)(),(0,t.createBlock)(M,{key:0,items:e.fileMenuItems,disabled:(0,t.unref)(y).disabled.value,label:V.value.fileMenuLabel,"open-backstage-label":V.value.fileMenuOpenBackstageLabel,"show-open-backstage":e.showOpenBackstage,onSelect:ue,onOpenBackstage:de},null,8,[`items`,`disabled`,`label`,`open-backstage-label`,`show-open-backstage`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(O,{tabs:(0,t.unref)(x),"active-tab":(0,t.unref)(y).activeTab.value,disabled:(0,t.unref)(y).disabled.value,onSelect:se},null,8,[`tabs`,`active-tab`,`disabled`]),_.hideMinimizeButton?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElTooltip),{key:1,content:V.value.minimizeTooltip,"show-after":te.value,"hide-after":H.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElButton),{class:(0,t.normalizeClass)([`ml-ribbon__control`,`ml-ribbon__control--minimize`,(0,t.unref)(y).minimized.value?`ml-ribbon__control--minimize-up`:`ml-ribbon__control--minimize-down`]),icon:U.value,disabled:(0,t.unref)(y).disabled.value,onClick:le},null,8,[`class`,`icon`,`disabled`])]),_:1},8,[`content`,`show-after`,`hide-after`])),i.$slots[`tabs-after`]?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,mt,[(0,t.renderSlot)(i.$slots,`tabs-after`,{activeTab:(0,t.unref)(y).activeTab.value,layout:(0,t.unref)(y).layout.value,minimized:(0,t.unref)(y).minimized.value,disabled:(0,t.unref)(y).disabled.value})])):(0,t.createCommentVNode)(``,!0)]),(0,t.createElementVNode)(`div`,ht,[_.hideLayoutSwitcher?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElTooltip),{key:0,content:V.value.layoutSwitcherTooltip,"show-after":te.value,"hide-after":H.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElButton),{circle:``,class:`ml-ribbon__control ml-ribbon__control--layout`,icon:(0,t.unref)(r.Menu),disabled:(0,t.unref)(y).disabled.value,onClick:ce},null,8,[`icon`,`disabled`])]),_:1},8,[`content`,`show-after`,`hide-after`])),_.hideKeyTipsToggle?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElSwitch),{key:1,"inline-prompt":``,class:`ml-ribbon__control ml-ribbon__control--keytips`,"active-text":V.value.keyTipsToggleText,"inactive-text":V.value.keyTipsToggleText,"model-value":(0,t.unref)(y).keyTipsOpen.value,disabled:(0,t.unref)(y).disabled.value,onChange:a[0]||=e=>(0,t.unref)(y).keyTipsOpen.value=!(0,t.unref)(y).keyTipsOpen.value},null,8,[`active-text`,`inactive-text`,`model-value`,`disabled`])),i.$slots[`tabs-extra`]?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,gt,[(0,t.renderSlot)(i.$slots,`tabs-extra`,{activeTab:(0,t.unref)(y).activeTab.value,layout:(0,t.unref)(y).layout.value,minimized:(0,t.unref)(y).minimized.value,disabled:(0,t.unref)(y).disabled.value})])):(0,t.createCommentVNode)(``,!0)]),S.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:0,placement:`bottom-start`,visible:j.value,width:N.value||void 0,disabled:(0,t.unref)(y).disabled.value||!(0,t.unref)(y).minimized.value,"show-arrow":!1,offset:0,"popper-class":ee.value,"onUpdate:visible":ye},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,{"aria-hidden":`true`,class:`ml-ribbon__minimized-anchor`,style:(0,t.normalizeStyle)(P.value)},null,4)]),default:(0,t.withCtx)(()=>[(0,t.unref)(y).minimized.value&&(0,t.unref)(y).layout.value===`classic`?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:0,ref_key:`minimizedClassicPanelRef`,ref:A,class:`ml-ribbon__panel ml-ribbon__panel--floating`,"data-active-tab":S.value.id},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(W.value,e=>((0,t.openBlock)(),(0,t.createBlock)(dt,{id:e.id,key:e.id,"data-group-id":e.id,title:e.title,icon:e.icon,"group-icon-css":e.groupIconCss,orientation:e.orientation,width:e.width,priority:e.priority??100,launcher:e.launcher,"show-launcher-icon":e.showLauncherIcon,"group-model":e,"overflow-trigger-aria-label":V.value.groupOverflowTriggerAriaLabel,"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[2]||=e=>$(e.groupId,e.itemId)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(Qe,{group:e,"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[1]||=e=>$(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])]),_:2},1032,[`id`,`data-group-id`,`title`,`icon`,`group-icon-css`,`orientation`,`width`,`priority`,`launcher`,`show-launcher-icon`,`group-model`,`overflow-trigger-aria-label`,`gallery-preview-fallback`,`disabled`]))),128)),G.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`section`,vt,[(0,t.createElementVNode)(`div`,yt,[(0,t.createVNode)(nt,{groups:G.value,"popover-class":B.value,"popover-width":K.value,"trigger-aria-label":V.value.overflowTriggerAriaLabel??``,"gallery-preview-fallback":V.value.galleryPreviewFallback??``,disabled:w.value,onOpen:a[3]||=e=>(0,t.unref)(y).overflowOpen.value=!0,onClose:a[4]||=e=>(0,t.unref)(y).overflowOpen.value=!1,onItemClick:a[5]||=e=>$(e.groupId,e.itemId)},null,8,[`groups`,`popover-class`,`popover-width`,`trigger-aria-label`,`gallery-preview-fallback`,`disabled`])]),a[13]||=(0,t.createElementVNode)(`footer`,{class:`ml-ribbon-group__footer ml-ribbon-group__footer--overflow`},null,-1)])):(0,t.createCommentVNode)(``,!0)],8,_t)):(0,t.unref)(y).minimized.value?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:1,class:`ml-ribbon__panel ml-ribbon__panel--simplified ml-ribbon__panel--floating`,"data-active-tab":S.value.id},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(T.value,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:e.id,trigger:`click`,placement:`bottom-start`,width:340,disabled:w.value,"show-arrow":!1,"popper-class":z.value},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{class:`ml-ribbon-simplified-group`,type:`button`,disabled:w.value},[ve(e)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-simplified-group__icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(ve(e))))]),_:2},1024)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.title),1)],8,xt)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,St,[(0,t.createVNode)(Qe,{group:q(e),"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[6]||=e=>$(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])])]),_:2},1032,[`disabled`,`popper-class`]))),128))],8,bt)):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`visible`,`width`,`disabled`,`popper-class`])):(0,t.createCommentVNode)(``,!0)],512),!(0,t.unref)(y).minimized.value&&S.value&&(0,t.unref)(y).layout.value===`classic`?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:0,class:`ml-ribbon__panel`,"data-active-tab":S.value.id,ref_key:`classicPanelRef`,ref:k},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(W.value,e=>((0,t.openBlock)(),(0,t.createBlock)(dt,{id:e.id,key:e.id,"data-group-id":e.id,title:e.title,icon:e.icon,"group-icon-css":e.groupIconCss,orientation:e.orientation,width:e.width,priority:e.priority??100,launcher:e.launcher,"show-launcher-icon":e.showLauncherIcon,"group-model":e,"overflow-trigger-aria-label":V.value.groupOverflowTriggerAriaLabel,"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[8]||=e=>$(e.groupId,e.itemId)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(Qe,{group:e,"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[7]||=e=>$(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])]),_:2},1032,[`id`,`data-group-id`,`title`,`icon`,`group-icon-css`,`orientation`,`width`,`priority`,`launcher`,`show-launcher-icon`,`group-model`,`overflow-trigger-aria-label`,`gallery-preview-fallback`,`disabled`]))),128)),G.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`section`,wt,[(0,t.createElementVNode)(`div`,Tt,[(0,t.createVNode)(nt,{groups:G.value,"popover-class":B.value,"popover-width":K.value,"trigger-aria-label":V.value.overflowTriggerAriaLabel??``,"gallery-preview-fallback":V.value.galleryPreviewFallback??``,disabled:w.value,onOpen:a[9]||=e=>(0,t.unref)(y).overflowOpen.value=!0,onClose:a[10]||=e=>(0,t.unref)(y).overflowOpen.value=!1,onItemClick:a[11]||=e=>$(e.groupId,e.itemId)},null,8,[`groups`,`popover-class`,`popover-width`,`trigger-aria-label`,`gallery-preview-fallback`,`disabled`])]),a[14]||=(0,t.createElementVNode)(`footer`,{class:`ml-ribbon-group__footer ml-ribbon-group__footer--overflow`},null,-1)])):(0,t.createCommentVNode)(``,!0)],8,Ct)):(0,t.createCommentVNode)(``,!0),!(0,t.unref)(y).minimized.value&&S.value&&(0,t.unref)(y).layout.value===`simplified`?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:1,class:`ml-ribbon__panel ml-ribbon__panel--simplified`,"data-active-tab":S.value.id},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(T.value,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:e.id,trigger:`click`,placement:`bottom-start`,width:340,disabled:w.value,"popper-class":z.value},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{class:`ml-ribbon-simplified-group`,type:`button`,disabled:w.value},[ve(e)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElIcon),{key:0,class:`ml-ribbon-simplified-group__icon`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(ve(e))))]),_:2},1024)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.title),1)],8,Dt)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,Ot,[(0,t.createVNode)(Qe,{group:q(e),"gallery-preview-fallback":V.value.galleryPreviewFallback,disabled:w.value,onItemClick:a[12]||=e=>$(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])])]),_:2},1032,[`disabled`,`popper-class`]))),128))],8,Et)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(b,{open:(0,t.unref)(y).backdropOpen.value,size:R.value,"back-label":V.value.backstageBackLabel,title:V.value.backstageTitle,description:V.value.backstageDescription,onClose:fe},(0,t.createSlots)({_:2},[i.$slots.backstage?{name:`default`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(i.$slots,`backstage`,{close:fe,open:(0,t.unref)(y).backdropOpen.value,size:R.value,backLabel:V.value.backstageBackLabel,title:V.value.backstageTitle,description:V.value.backstageDescription,disabled:(0,t.unref)(y).disabled.value})]),key:`0`}:void 0]),1032,[`open`,`size`,`back-label`,`title`,`description`])],10,ft))]),_:3},8,[`size`]))}}),jt={class:`ml-ribbon-tab-definition`,hidden:``},Mt=(0,t.defineComponent)({__name:`RibbonTab`,props:{id:{},title:{},visible:{type:Boolean},contextual:{type:Boolean},contextualColor:{},contextualTitle:{}},setup(e){return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,jt,[(0,t.renderSlot)(e.$slots,`default`)]))}}),Nt={key:0,class:`ml-ribbon-keytips`,"aria-live":`polite`},Pt={class:`ml-ribbon-keytips__hint`},Ft=(0,t.defineComponent)({__name:`RibbonKeyTips`,props:{open:{type:Boolean},tips:{default:()=>[]},sequencePrefix:{},emptySequenceText:{}},emits:[`activate`,`close`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.ref)(``),o=(0,t.computed)(()=>a.value?r.tips.filter(e=>e.key.toLowerCase().startsWith(a.value.toLowerCase())):r.tips),s=(0,t.computed)(()=>a.value||r.emptySequenceText||``),c=(0,t.computed)(()=>r.sequencePrefix?`${r.sequencePrefix}${s.value}`:s.value),l=(0,t.computed)(()=>a.value.toLowerCase()),u=(0,t.computed)(()=>r.tips.filter(e=>e.key.toLowerCase()===l.value)),d=(0,t.computed)(()=>r.tips.some(e=>e.key.toLowerCase().startsWith(l.value)));function f(){a.value=``}function p(e){if(r.open&&!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`){e.preventDefault(),f(),i(`close`);return}if(e.key===`Backspace`){e.preventDefault(),a.value=a.value.slice(0,-1);return}if(/^[a-z0-9]$/i.test(e.key)){if(e.preventDefault(),a.value+=e.key.toUpperCase(),u.value.length>0){i(`activate`,u.value[0]),f();return}d.value||f()}}}return(0,t.onMounted)(()=>window.addEventListener(`keydown`,p)),(0,t.onUnmounted)(()=>window.removeEventListener(`keydown`,p)),(0,t.watch)(()=>r.open,e=>{e||f()}),(n,r)=>e.open?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Nt,[(0,t.createElementVNode)(`div`,Pt,(0,t.toDisplayString)(c.value),1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:e.id,class:`ml-ribbon-keytip`},(0,t.toDisplayString)(e.key),1))),128))])):(0,t.createCommentVNode)(``,!0)}});e.MlRibbon=At,e.MlRibbonBackstage=b,e.MlRibbonButton=R,e.MlRibbonButtonGroup=V,e.MlRibbonCollection=N,e.MlRibbonContextualTabs=O,e.MlRibbonDropdown=X,e.MlRibbonFileMenu=M,e.MlRibbonGallery=Fe,e.MlRibbonGroup=dt,e.MlRibbonInputNumber=ze,e.MlRibbonItemHost=Ze,e.MlRibbonKeyTips=Ft,e.MlRibbonSegmented=Ge,e.MlRibbonTab=Mt,e.MlRibbonTabs=C,e.MlRibbonTemplateItem=Je,e.MlRibbonToggleButton=Ke});
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Splits a ribbon label into display lines.
3
+ *
4
+ * Host apps encode intentional line breaks with `\n` (for example
5
+ * `Recover\nText` / `识别\n文字`). CSS `white-space: normal` collapses those
6
+ * to spaces, so callers should render each entry on its own line.
7
+ */
8
+ export declare function splitRibbonLabelLines(label: string): string[];
9
+ /**
10
+ * Flattens intentional label newlines for tooltip / aria text.
11
+ */
12
+ export declare function flattenRibbonLabel(label: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/ribbon",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",