@mlightcad/ribbon 0.1.6 → 0.1.7

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 @@
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){(!e.collections||e.collections.length===0)&&(e.collections=[{id:`${e.id}-collection-1`,items:[]}])}function f(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 p(e,n,r,i,a,o,p,m){let h=(0,t.ref)(r),g=(0,t.ref)(i),_=(0,t.ref)(a),v=(0,t.ref)(o),y=(0,t.ref)(u(n)),b=(0,t.ref)(!1),x=(0,t.ref)(!1),S=(0,t.ref)(!1),C=(0,t.ref)([]),w=(0,t.ref)(``),T=(0,t.ref)(p),E=(0,t.ref)(m),D=(0,t.computed)(()=>y.value.filter(e=>e.visible!==!1)),O={addTab(e){y.value.push(l(e)),v.value||=e.id},removeTab(e){y.value=y.value.filter(t=>t.id!==e),v.value===e&&(v.value=D.value[0]?.id??``)},showTab(e){let t=y.value.find(t=>t.id===e);t&&(t.visible=!0)},hideTab(e){let t=y.value.find(t=>t.id===e);t&&(t.visible=!1)},selectTab(e){v.value=e},addGroup(e,t){let n=y.value.find(t=>t.id===e);n&&(n.groups??=[],d(t),n.groups.push(c(t)))},removeGroup(e,t){let n=y.value.find(t=>t.id===e);n?.groups&&(n.groups=n.groups.filter(e=>e.id!==t))},showGroup(e,t){let n=y.value.find(t=>t.id===e)?.groups?.find(e=>e.id===t);n&&(n.visible=!0)},hideGroup(e,t){let n=y.value.find(t=>t.id===e)?.groups?.find(e=>e.id===t);n&&(n.visible=!1)},addItem(e,t,n,r){f(y.value,e,t,n,e=>e.push(s(r)))},removeItem(e,t,n,r){f(y.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){f(y.value,e,t,n,e=>{let t=e.find(e=>e.id===r);t&&Object.assign(t,i)})},enableItem(e,t,n,r){O.updateItem(e,t,n,r,{disabled:!1})},disableItem(e,t,n,r){O.updateItem(e,t,n,r,{disabled:!0})},refreshLayout(){b.value=!1},minimize(e){_.value=e},toggleSimplified(){g.value=g.value===`classic`?`simplified`:`classic`}};return{context:{id:e,disabled:h,layout:g,minimized:_,activeTab:v,tabs:y,overflowOpen:b,backdropOpen:x,keyTipsOpen:S,keyTips:C,keyTipsSequence:w,tooltipShowAfter:T,tooltipHideAfter:E,registerKeyTip:e=>{C.value.some(t=>t.id===e.id)||C.value.push(e)},unregisterKeyTip:e=>{C.value=C.value.filter(t=>t.id!==e)},api:O},visibleTabs:D}}var m={class:`ml-ribbon-backstage__nav`},h={class:`ml-ribbon-backstage__content`},g={key:0},_={key:1},v=(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`,m,[(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`,h,[i.title?((0,t.openBlock)(),(0,t.createElementBlock)(`h2`,g,(0,t.toDisplayString)(i.title),1)):(0,t.createCommentVNode)(``,!0),i.description?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,_,(0,t.toDisplayString)(i.description),1)):(0,t.createCommentVNode)(``,!0)])],64))],2)]),_:3},8,[`model-value`]))}}),y={class:`ml-ribbon-tabs`,role:`tablist`},b=[`aria-selected`,`disabled`,`onClick`],x=(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`,y,[((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,b))),128))]))}}),S={class:`ml-ribbon-contextual-tabs`},C={class:`ml-ribbon-contextual-tabs__normal`},w={class:`ml-ribbon-contextual-tabs__ctx`},T={key:0},E=(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`,S,[(0,t.createElementVNode)(`div`,C,[(0,t.createVNode)(x,{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`,w,[((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`,T,(0,t.toDisplayString)(n.contextualTitle.trim()),1)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(x,{tabs:[n],"active-tab":e.activeTab,disabled:r.disabled,onSelect:a[1]||=e=>i(`select`,e)},null,8,[`tabs`,`active-tab`,`disabled`])],4))),128))])]))}}),D=[`disabled`],O=(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,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdownItem),{key:e.id,divided:i.showOpenBackstage!==!1&&r===0,command:e.id,disabled:e.disabled},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.label),1)]),_:2},1032,[`divided`,`command`,`disabled`]))),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,D)]),_:1},8,[`disabled`,`popper-class`]))}}),k=(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))}}),A={key:3,class:`ml-ribbon-item-host__label ml-ribbon-button__label`},j=(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`,A,[(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`]))}}),M=[`data-id`],N={key:0,class:`ml-ribbon-button-group__label`},P={class:`ml-ribbon-button-group__text`},ee=(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`,N,(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)(j,{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`,P,(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,M))}}),F={class:`ml-ribbon-item-host__content ml-ribbon-dropdown__content`},I={class:`ml-ribbon-item-host__text-row ml-ribbon-dropdown__text-row`},L={key:0,class:`ml-ribbon-item-host__label ml-ribbon-dropdown__label`},R={class:`ml-ribbon-dropdown-item__content`},z={class:`ml-ribbon-dropdown-item__label`},te=(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}},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),d=(0,t.computed)(()=>Array.isArray(a.options)?a.options:[]),f=(0,t.computed)(()=>d.value.find(e=>E(e)===u.value)??null),p=(0,t.computed)(()=>{if(f.value&&a.syncLabelWithSelection){let e=O(f.value);if(e)return e}return j(a.label)??a.id}),m=(0,t.computed)(()=>!a.hideLabel&&p.value.length>0),h=(0,t.computed)(()=>{if(f.value){let e=w(f.value);if(e)return e}return!a.icon||typeof a.icon==`string`?null:a.icon}),g=(0,t.computed)(()=>{if(f.value){let e=T(f.value);if(e)return e}if(typeof a.icon!=`string`)return null;let e=a.icon.trim();return e.length>0?e:null}),_=(0,t.computed)(()=>!!(h.value||g.value)),v=(0,t.computed)(()=>A(f.value)??j(a.tooltip)??j(p.value)??j(a.label)??M(a.id)),y=(0,t.computed)(()=>[`ml-ribbon-dropdown-menu`,`ml-ribbon-popper`,`ml-ribbon-popper--size-${c.value}`,a.popperClass].filter(Boolean).join(` `));function b(e){if(a.disabled){l.value=!1;return}l.value=e}function x(){a.disabled||(l.value=!l.value)}function S(e){a.disabled||(u.value=e,o(`tooltip-change`,A(f.value)??v.value),o(`command`,e),l.value=!1)}function C(){if(a.disabled)return;let e=f.value;if(!e){o(`click`);return}o(`command`,E(e))}function w(e){if(!e||typeof e!=`object`)return null;let t=e.icon;return!t||typeof t==`string`?null:t}function T(e){if(!e||typeof e!=`object`)return null;let t=e.icon;return typeof t!=`string`||t.trim().length===0?null:t}function E(e){if(!(!e||typeof e!=`object`))return e.value}function D(e){let t=E(e);if(typeof t==`string`||typeof t==`number`||t&&typeof t==`object`)return t}function O(e){if(!e||typeof e!=`object`)return;let t=e.label;return typeof t==`string`?t:void 0}function k(e){if(typeof e==`string`)return M(e);if(typeof e==`number`||typeof e==`boolean`)return String(e)}function A(e){if(!(!e||typeof e!=`object`))return j(e.tooltip)??O(e)??k(E(e))}function j(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function M(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(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":y.value,onVisibleChange:b,onCommand:S},{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,r=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdownItem),{key:String(E(r)),command:D(r),disabled:r.disabled===!0,divided:r.divided===!0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElTooltip),{content:A(r),disabled:!A(r),"show-after":e.tooltipShowAfter,"hide-after":e.tooltipHideAfter,placement:`top`,effect:`dark`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,R,[(0,t.renderSlot)(i.$slots,`option`,{option:r},()=>[w(r)?((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)(w(r))))]),_:2},1024)):T(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-dropdown-item__icon ml-ribbon-dropdown-item__icon--class`,T(r)]),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,z,(0,t.toDisplayString)(O(r)),1)])])]),_:2},1032,[`content`,`disabled`,`show-after`,`hide-after`])]),_:2},1032,[`command`,`disabled`,`divided`]))),128))]),_:3})]),default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElButton),{type:`default`,disabled:e.disabled,"aria-label":v.value,onClick:x},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,F,[i.$slots.icon||_.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":g.value&&!h.value&&!i.$slots.icon}]),onClick:(0,t.withModifiers)(C,[`stop`])},[(0,t.renderSlot)(i.$slots,`icon`,{selectedOption:f.value},()=>[h.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)(h.value)))]),_:1})):g.value?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)(g.value),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0)])],2)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,I,[m.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,L,[(0,t.renderSlot)(i.$slots,`label`,{selectedOption:f.value,label:p.value},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(p.value),1)])])):(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`]))}}),ne=[`disabled`],re=[`src`],ie={key:3,class:`ml-ribbon-gallery__preview-svg`,role:`presentation`,"aria-hidden":`true`},B=[`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`},V=[`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`},H={key:1,class:`ml-ribbon-gallery__title`},U={key:2,class:`ml-ribbon-gallery__categories`},W={key:0,class:`ml-ribbon-gallery__category-title`},fe=[`disabled`,`onClick`],pe=[`src`],me={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`],G=[`disabled`],ye=[`disabled`],be={key:0,class:`ml-ribbon-gallery__panel-category-title`},xe=[`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`},K=6,Ee=64,De=4,Oe=16,ke=4,Ae=22,je=(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(Ee*g.value)),v=(0,t.computed)(()=>Math.round(Ae*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)*De+K*2+(a.collapsed?Oe:ke+v.value)),ee=(0,t.computed)(()=>({modifiers:[{name:`offset`,options:{offset:[p.value,0]}}]}));(0,t.watch)(()=>a.modelValue,e=>{typeof e==`string`&&(s.value=e,te(e))},{immediate:!0}),(0,t.watch)(()=>[x.value.map(e=>e.id).join(`\0`),w.value,s.value],()=>{te()||(l.value=Math.min(l.value,T.value-1))}),(0,t.watch)(c,async e=>{!e||a.collapsed||(je(),await(0,t.nextTick)(),await(0,t.nextTick)(),Me())});function F(e){return e==null||typeof e==`string`?e:typeof e==`object`||typeof e==`function`?(0,t.markRaw)((0,t.toRaw)(e)):e}function I(e){let t=y.value.toLowerCase(),n=e.title.trim().toLowerCase();return b.value>1||!t||n!==t}function L(e){return j.value?e.items.filter(e=>A.value.has(e.id)):e.items}function R(e){if(a.disabled||!j.value)return;let t=E.value+e;l.value=Math.min(Math.max(t,0),T.value-1)}function z(e){let t=x.value.findIndex(t=>t.id===e.id);return t<0?0:Math.floor(t/w.value)}function te(e=s.value){let t=x.value.find(t=>t.id===e);return t?(l.value=z(t),!0):!1}function je(){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-K)}function Me(){let e=f.value;e&&e.querySelector(`[data-gallery-row-index="${E.value}"]`)?.scrollIntoView?.({block:`start`})}function q(e){return e.preview&&typeof e.preview!=`string`?F(e.preview):e.icon&&typeof e.icon!=`string`?F(e.icon):null}function J(e){return e.component?F(e.component):null}function Y(e){return a.disabled||e.disabled===!0}function X(e){if(typeof e.icon!=`string`)return null;let t=e.icon.trim();return t.length>0?t:null}function Z(e){let t=e.previewSvg??e.svg;if(typeof t!=`string`)return null;let n=t.trim();return n.length>0?n:null}function Ne(e){return e.startsWith(`data:image/svg+xml`)||e.endsWith(`.svg`)}function Pe(e){let t=Z(e);return t?Ne(t):!1}function Fe(e){return typeof e.preview==`string`?e.preview:a.previewFallback}function Q(e){Y(e)||(s.value=e.id,l.value=z(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:Y(S.value)},[J(S.value)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(J(S.value)),(0,t.mergeProps)({key:0},S.value.componentProps,{item:S.value,selected:s.value===S.value.id,disabled:Y(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":q(S.value)||X(S.value),"ml-ribbon-gallery__preview--svg":Z(S.value)}])},[q(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)(q(S.value))))]),_:1})):X(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`,X(S.value)]),"aria-hidden":`true`},null,2)):Z(S.value)&&Pe(S.value)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:Z(S.value)??``,alt:``},null,8,re)):Z(S.value)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,ie,[(0,t.createElementVNode)(`use`,{href:Z(S.value)??``},null,8,B)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Fe(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`,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`},[I(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:Y(r),onClick:e=>Q(r)},[(0,t.renderSlot)(i.$slots,`item`,{item:r,category:e,selected:s.value===r.id,disabled:Y(r),select:()=>Q(r)},()=>[J(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(J(r)),(0,t.mergeProps)({key:0,ref_for:!0},r.componentProps,{item:r,category:e,selected:s.value===r.id,disabled:Y(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":q(r)||X(r),"ml-ribbon-gallery__preview--svg":Z(r)}])},[q(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)(q(r))))]),_:2},1024)):X(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`,X(r)]),"aria-hidden":`true`},null,2)):Z(r)&&Pe(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:Z(r)??``,alt:``},null,8,ce)):Z(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,le,[(0,t.createElementVNode)(`use`,{href:Z(r)??``},null,8,ue)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Fe(r)),1)],64))],2),(0,t.createElementVNode)(`div`,de,(0,t.toDisplayString)(r.label),1)],64))])],10,V))),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`,H,(0,t.toDisplayString)(y.value),1)):(0,t.createCommentVNode)(``,!0),e.collapsed?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,U,[((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&&I(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`h4`,W,(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)(L(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:Y(r),onClick:e=>Q(r)},[(0,t.renderSlot)(i.$slots,`item`,{item:r,category:e,selected:s.value===r.id,disabled:Y(r),select:()=>Q(r)},()=>[J(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(J(r)),(0,t.mergeProps)({key:0,ref_for:!0},r.componentProps,{item:r,category:e,selected:s.value===r.id,disabled:Y(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":q(r)||X(r),"ml-ribbon-gallery__preview--svg":Z(r)}])},[q(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)(q(r))))]),_:2},1024)):X(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`,X(r)]),"aria-hidden":`true`},null,2)):Z(r)&&Pe(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:Z(r)??``,alt:``},null,8,pe)):Z(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,me,[(0,t.createElementVNode)(`use`,{href:Z(r)??``},null,8,he)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Fe(r)),1)],64))],2),(0,t.createElementVNode)(`div`,ge,(0,t.toDisplayString)(r.label),1)],64))])],10,fe))),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=>R(-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=>R(1)},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.ArrowDown))]),_:1})],8,G),(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":ee.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:je},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.Bottom))]),_:1})],10,ye)]),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`},[I(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`h4`,be,(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":z(r),disabled:Y(r),onClick:e=>Q(r)},[(0,t.renderSlot)(i.$slots,`item`,{item:r,category:e,selected:s.value===r.id,disabled:Y(r),select:()=>Q(r)},()=>[J(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(J(r)),(0,t.mergeProps)({key:0,ref_for:!0},r.componentProps,{item:r,category:e,selected:s.value===r.id,disabled:Y(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":q(r)||X(r),"ml-ribbon-gallery__preview--svg":Z(r)}])},[q(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)(q(r))))]),_:2},1024)):X(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`,X(r)]),"aria-hidden":`true`},null,2)):Z(r)&&Pe(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:Z(r)??``,alt:``},null,8,Se)):Z(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,Ce,[(0,t.createElementVNode)(`use`,{href:Z(r)??``},null,8,we)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Fe(r)),1)],64))],2),(0,t.createElementVNode)(`div`,Te,(0,t.toDisplayString)(r.label),1)],64))])],10,xe))),128))],4)]))),128))],512)]),_:3},8,[`visible`,`disabled`,`width`,`popper-class`,`popper-options`])])):(0,t.createCommentVNode)(``,!0)]))],2))}}),Me=[`data-id`,`onKeydown`],q={key:0,class:`ml-ribbon-input-number__prefix`},J={key:2,class:`ml-ribbon-input-number__prefix-label`},Y=(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`,q,[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`,J,(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,Me))}}),X=[`data-id`],Z={key:0,class:`ml-ribbon-segmented__label`},Ne=[`data-option-value`],Pe={key:2,class:`ml-ribbon-segmented__option-label`},Fe={key:3,class:`ml-ribbon-segmented__option-sr-label`},Q=(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}},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){let t=c(e);return t.label?.trim()||String(t.value)}function u(e){return c(e).icon??null}function d(e){return c(e).iconClass??null}function f(e){return!u(e)&&!d(e)}function p(e){return String(c(e).value)}function m(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`,Z,(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:m},{default:(0,t.withCtx)(({item:e})=>[(0,t.createElementVNode)(`span`,{class:`ml-ribbon-segmented__option`,"data-option-value":p(e)},[u(e)?((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)(u(e))))]),_:2},1024)):d(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-segmented__option-icon ml-ribbon-item-host__icon--class`,d(e)]),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0),f(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Pe,(0,t.toDisplayString)(l(e)),1)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Fe,(0,t.toDisplayString)(l(e)),1))],8,Ne)]),_:1},8,[`options`,`model-value`,`direction`,`block`,`disabled`,`aria-label`])],8,X))}}),Ie=(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)(j,{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`]))}}),Le=[`data-template-id`,`aria-disabled`],Re=(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,Le))}}),ze=[`data-item-id`],Be={key:0,class:`ml-ribbon-item-host__keytip`},Ve=(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)(()=>ge(s?.tooltipShowAfter.value,1e3)),f=(0,t.computed)(()=>ge(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:he(a.item.tooltip)??he(a.item.label)??be(a.item)??xe(a.item.id)),v=(0,t.computed)(()=>a.item.type!==`buttonGroup`),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`),M=(0,t.computed)(()=>{let e=a.item.props?.component;return!e||typeof e==`string`?null:(0,t.markRaw)((0,t.toRaw)(e))}),N=(0,t.computed)(()=>{let e=a.item.props?.componentProps;return!e||typeof e!=`object`||Array.isArray(e)?{}:e}),P=(0,t.computed)(()=>a.item.props?.wrap!==!1),F=(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)(()=>G(a.item.props?.iconSize)),R=(0,t.computed)(()=>_e(a.item.props?.width??a.item.props?.comboWidth,`92px`)),z=(0,t.computed)(()=>a.item.props?.modelValue),ne=(0,t.computed)(()=>_e(a.item.props?.width??a.item.props?.inputNumberWidth,`96px`)),re=(0,t.computed)(()=>a.item.props?.modelValue),ie=(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}),B=(0,t.computed)(()=>ye(a.item.props?.labelWrapLines)),ae=(0,t.computed)(()=>ve(a.item.props?.labelWrapWidth)),oe=(0,t.computed)(()=>a.item.type===`button`&&a.item.size===`large`&&h.value&&(B.value??0)>1),se=(0,t.computed)(()=>{if(!oe.value)return{};let e={"--ml-rb-item-label-max-lines":String(B.value??2)};return ae.value&&(e[`--ml-rb-item-label-wrap-width`]=ae.value),e});(0,t.watch)(()=>a.item.id,()=>{g.value=void 0});function V(){C.value||o(`item-click`,a.id)}function ce(e){if(!C.value){if(typeof e==`string`||typeof e==`number`){o(`item-click`,String(e));return}V()}}function le(e){g.value=e}function ue(e){if(!C.value){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`){o(`item-click`,String(e));return}V()}}function de(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 H(e){if(!C.value){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`){o(`item-click`,String(e));return}V()}}function U(e){C.value||o(`item-click`,e)}function W(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}V()}}function fe(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}V()}}function pe(e){if(!C.value){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`){o(`item-click`,String(e));return}V()}}function me(e){if(!e||typeof e!=`object`)return;let t=e.label;return typeof t==`string`?t:void 0}function he(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function ge(e,t){return typeof e!=`number`||Number.isNaN(e)||!Number.isFinite(e)?t:Math.max(0,Math.round(e))}function _e(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 ve(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 G(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 ye(e){if(!(typeof e!=`number`||Number.isNaN(e)||!Number.isFinite(e)))return Math.max(1,Math.round(e))}function be(e){let t=c.value.map(e=>me(e)).filter(e=>!!e);if(t.length)return e.type===`buttonGroup`?t.join(` / `):t[0]}function xe(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":oe.value}]]),style:(0,t.normalizeStyle)(se.value),"data-item-id":e.id,role:`group`},[S.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Be,(0,t.toDisplayString)(x.value),1)):(0,t.createCommentVNode)(``,!0),e.item.type===`buttonGroup`?((0,t.openBlock)(),(0,t.createBlock)(ee,{key:1,id:e.item.id,label:e.item.label??``,options:e.item.props?.options??[],"hide-label":e.item.hideLabel===!0,wrap:P.value,"equal-width":F.value,"button-size":I.value,"icon-size":L.value,"tooltip-show-after":d.value,"tooltip-hide-after":f.value,disabled:C.value,onChange:H},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)(Q,{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,onChange:ue},null,8,[`id`,`label`,`options`,`model-value`,`direction`,`block`,`disabled`,`hide-label`])):e.item.type===`toggle`?((0,t.openBlock)(),(0,t.createBlock)(Ie,{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:de},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)(je,{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:U},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)(Re,{key:5,id:e.item.id,item:e.item,disabled:C.value},{default:(0,t.withCtx)(()=>[M.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(M.value),(0,t.mergeProps)({key:0},N.value,{item:e.item,"group-id":e.groupId,disabled:C.value,"emit-item-click":pe}),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)(te,{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??[],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:ce,onTooltipChange:le,onClick:V},null,8,[`id`,`label`,`tooltip`,`icon`,`options`,`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:V},{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:V},null,8,[`disabled`])):e.item.type===`comboBox`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElSelect),{key:9,"model-value":z.value,disabled:C.value,"popper-class":p.value,style:(0,t.normalizeStyle)({width:R.value}),onChange:W},{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)(Y,{key:10,id:e.item.id,"model-value":re.value,width:ne.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":ie.value,disabled:C.value,onChange:fe},null,8,[`id`,`model-value`,`width`,`prefix-label`,`prefix-icon`,`prefix-icon-class`,`control-props`,`disabled`])):((0,t.openBlock)(),(0,t.createBlock)(j,{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:V},null,8,[`id`,`label`,`icon`,`disabled`,`hide-label`,`aria-label`]))],14,ze)]),_: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)(k,{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)(Ve,{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))}}),He=[`data-priority`],Ue={class:`ml-ribbon-group__body`},We={class:`ml-ribbon-group__footer`},Ge={class:`ml-ribbon-group__title`},Ke=[`aria-label`,`aria-expanded`,`disabled`],qe={class:`ml-ribbon-group__overflow-content`},Je=[`aria-label`,`aria-expanded`,`disabled`],Ye={class:`ml-ribbon-group__overflow-content`},Xe=(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)(()=>{z(),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 ee(e){D.value=e}function F(){d.value||(E.value=!E.value)}function I(){d.value||(D.value=!D.value)}let L=null,R=null;function z(){if(!L)return;let e=f.value?.querySelector(`.ml-ribbon-group__content`)??null;R!==e&&(R&&L.unobserve(R),e&&L.observe(e),R=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`&&(L=new ResizeObserver(()=>{M(),N(),A()}),f.value&&L.observe(f.value),z()),j()}),(0,t.onUnmounted)(()=>{L?.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`,Ue,[(0,t.renderSlot)(i.$slots,`default`)]),(0,t.createElementVNode)(`footer`,We,[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`,Ge,(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:F},[(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,Ke)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,qe,[(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=>ee(!0),onHide:a[5]||=e=>ee(!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:I},[(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,Je)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,Ye,[(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,He))}}),Ze=[`inert`,`aria-disabled`],Qe={class:`ml-ribbon__head-left`},$e={class:`ml-ribbon__head-right`},et={key:2,class:`ml-ribbon__tabs-extra`},tt=[`data-active-tab`],nt={key:0,class:`ml-ribbon-group ml-ribbon-group--overflow`},rt={class:`ml-ribbon-group__body ml-ribbon-group__body--overflow`},it=[`aria-label`,`disabled`],at={class:`ml-ribbon-overflow-list`},ot={class:`ml-ribbon-overflow-group__header`},st=[`data-active-tab`],ct=[`disabled`],lt={class:`ml-ribbon-simplified-group__panel`},ut=[`data-active-tab`],dt={key:0,class:`ml-ribbon-group ml-ribbon-group--overflow`},ft={class:`ml-ribbon-group__body ml-ribbon-group__body--overflow`},pt=[`aria-label`,`disabled`],mt={class:`ml-ribbon-overflow-list`},ht={class:`ml-ribbon-overflow-group__header`},gt=[`data-active-tab`],_t=[`disabled`],vt={class:`ml-ribbon-simplified-group__panel`},yt=40,bt=(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 d(e){return e.map(e=>({...e,groups:e.groups?.map(u)}))}function f(e,t){return typeof e!=`number`||Number.isNaN(e)||!Number.isFinite(e)?t:Math.max(0,Math.round(e))}let m={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`},h=e,g=o,{context:_,visibleTabs:y}=p(h.id,h.tabs,h.disabled,h.activeLayout?String(h.activeLayout).toLowerCase()===`simplified`?`simplified`:`classic`:h.layout,h.minimized,h.activeTab||h.tabs[0]?.id||``,f(h.tooltipShowAfter,1e3),f(h.tooltipHideAfter,0));(0,t.provide)(i,_),(0,t.watch)(()=>h.tabs,e=>{_.tabs.value=d(e),_.tabs.value.some(e=>e.id===_.activeTab.value)||(_.activeTab.value=_.tabs.value[0]?.id||``)},{deep:!0}),(0,t.watch)(()=>h.layout,e=>{e!==_.layout.value&&(_.layout.value=e)}),(0,t.watch)(()=>h.activeLayout,e=>{if(!e)return;let t=String(e).toLowerCase()===`simplified`?`simplified`:`classic`;t!==_.layout.value&&(_.layout.value=t)}),(0,t.watch)(()=>h.minimized,e=>{e!==_.minimized.value&&(_.minimized.value=e)}),(0,t.watch)(()=>h.disabled,e=>{e!==_.disabled.value&&(_.disabled.value=e)}),(0,t.watch)(()=>h.activeTab,e=>{e&&e!==_.activeTab.value&&(_.activeTab.value=e)}),(0,t.watch)(()=>h.tooltipShowAfter,e=>{let t=f(e,1e3);t!==_.tooltipShowAfter.value&&(_.tooltipShowAfter.value=t)}),(0,t.watch)(()=>h.tooltipHideAfter,e=>{let t=f(e,0);t!==_.tooltipHideAfter.value&&(_.tooltipHideAfter.value=t)}),(0,t.watch)(_.activeTab,e=>{g(`update:activeTab`,e),g(`tabChange`,e)}),(0,t.watch)(_.layout,e=>{g(`update:layout`,e),g(`layoutChange`,e)}),(0,t.watch)(_.minimized,e=>{g(`update:minimized`,e)}),(0,t.watch)(_.overflowOpen,e=>{g(e?`overflowOpen`:`overflowClose`)}),(0,t.watch)(_.backdropOpen,e=>{g(e?`backstageOpen`:`backstageClose`)});let b=(0,t.computed)(()=>y.value.find(e=>e.id===_.activeTab.value)),x=(0,t.computed)(()=>new Set(y.value.filter(e=>e.contextual&&e.contextualMode===`exclusive`).map(e=>e.id))),S=(0,t.computed)(()=>fe(b.value)),C=(0,t.computed)(()=>b.value?.groups?.filter(e=>e.visible!==!1)??[]),w=(0,t.ref)(null),T=(0,t.ref)(null),D=(0,t.ref)(null),k=(0,t.ref)(null),A=(0,t.ref)(!1),j=(0,t.ref)(0),M=(0,t.ref)({left:`0px`,top:`0px`,width:`1px`,height:`0px`}),N=(0,t.ref)(new Set),P=(0,t.ref)({}),ee=(0,n.useGlobalConfig)(`size`,``),F=(0,t.computed)(()=>h.size||ee.value||`default`),I=(0,t.computed)(()=>`ml-ribbon-group-popover ml-ribbon-group-popover--size-${F.value}`),L=(0,t.computed)(()=>`ml-ribbon-overflow-popover ml-ribbon-overflow-popover--size-${F.value}`),R=(0,t.computed)(()=>`ml-ribbon-tab-panel-popover ml-ribbon-tab-panel-popover--size-${F.value}`),z=(0,t.computed)(()=>({layoutSwitcherTooltip:h.texts.layoutSwitcherTooltip||m.layoutSwitcherTooltip,minimizeTooltip:h.texts.minimizeTooltip||m.minimizeTooltip,keyTipsToggleText:h.texts.keyTipsToggleText||m.keyTipsToggleText,overflowTriggerAriaLabel:h.texts.overflowTriggerAriaLabel||m.overflowTriggerAriaLabel,groupOverflowTriggerAriaLabel:h.texts.groupOverflowTriggerAriaLabel||m.groupOverflowTriggerAriaLabel,fileMenuLabel:h.texts.fileMenuLabel||m.fileMenuLabel,fileMenuOpenBackstageLabel:h.texts.fileMenuOpenBackstageLabel||m.fileMenuOpenBackstageLabel,backstageBackLabel:h.texts.backstageBackLabel||m.backstageBackLabel,backstageTitle:h.texts.backstageTitle||m.backstageTitle,backstageDescription:h.texts.backstageDescription||m.backstageDescription,keyTipsSequencePrefix:h.texts.keyTipsSequencePrefix||m.keyTipsSequencePrefix,keyTipsEmptySequence:h.texts.keyTipsEmptySequence||m.keyTipsEmptySequence,galleryPreviewFallback:h.texts.galleryPreviewFallback||m.galleryPreviewFallback})),te=(0,t.computed)(()=>f(h.tooltipShowAfter,1e3)),ne=(0,t.computed)(()=>f(h.tooltipHideAfter,0)),re=(0,t.computed)(()=>_.minimized.value?r.ArrowUpBold:r.ArrowDownBold),ie=(0,t.computed)(()=>C.value.filter(e=>!N.value.has(e.id))),B=(0,t.computed)(()=>C.value.filter(e=>N.value.has(e.id))),ae=(0,t.computed)(()=>{if(!B.value.length)return 220;let e=B.value.reduce((e,t)=>{let n=P.value[t.id]??V(t);return Math.max(e,n)},0),t=Math.ceil(e+40);return Math.max(220,Math.min(720,t))});function oe(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 se(e){return e.priority??100}function V(e){return typeof e.width==`number`&&Number.isFinite(e.width)&&e.width>0?e.width:140}function ce(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 le(){let e=C.value.reduce((e,t)=>{let n=P.value[t.id]??V(t);return e+Math.max(n,V(t))},0);return Math.max(220,e)}function ue(e){let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--ml-rb-overflow-slot-width`));return Number.isFinite(t)&&t>0?t:yt}function de(){if(_.layout.value!==`classic`){N.value=new Set;return}let e=_.minimized.value?k.value:D.value;if(!e)return;let t=C.value;if(!t.length){N.value=new Set;return}let n=Math.round(e.getBoundingClientRect().width),r=ue(e),i=ce(e);P.value={...P.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=se(t.group)-se(e.group);return n===0?t.index-e.index:n}),l=e=>i[e.id]??V(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}N.value=s}function H(){(0,t.nextTick)(()=>{if(_.layout.value!==`classic`||_.minimized.value){de();return}if(N.value.size===0){de();return}N.value=new Set,(0,t.nextTick)(()=>{de()})})}function U(){let e=w.value,t=T.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);j.value=Math.round(a>0?a:_.layout.value===`classic`?le():Math.max(360,C.value.length*120)),M.value={left:`${Math.round(n.left-r.left+i)}px`,top:`0px`,width:`1px`,height:`${Math.round(r.height)}px`}}function W(){A.value=!1}function fe(e){return _.disabled.value?!0:!e||x.value.size===0?!1:!x.value.has(e.id)}function pe(e){if(_.disabled.value)return;let t=_.activeTab.value===e.id;if(_.activeTab.value=e.id,!_.minimized.value){W();return}U(),A.value=t?!A.value:!0}function me(){_.disabled.value||_.api.toggleSimplified()}function he(){_.disabled.value||(_.minimized.value||W(),_.minimized.value=!_.minimized.value)}function ge(e){_.disabled.value||(W(),g(`fileMenuSelect`,e))}function _e(){_.disabled.value||(W(),_.backdropOpen.value=!0)}function ve(){_.disabled.value||(_.backdropOpen.value=!1)}function G(e,t){S.value||(g(`itemClick`,{tabId:_.activeTab.value,groupId:e,itemId:t}),_.minimized.value&&W())}function ye(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function be(){if(S.value){_.keyTips.value=[];return}let e=b.value;if(!e?.groups?.length){_.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)));_.keyTips.value=t}function xe(e){if(_.disabled.value)return;let t=b.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){G(n.id,r.id),_.keyTipsOpen.value=!1,_.keyTipsSequence.value=``;return}}}}function Se(){_.keyTipsSequence.value=``}function Ce(e){if(!_.disabled.value&&!ye(e.target)){if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key===`Alt`){e.preventDefault(),_.keyTipsOpen.value=!_.keyTipsOpen.value,_.keyTipsOpen.value||Se();return}if(_.keyTipsOpen.value&&!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`){e.preventDefault(),_.keyTipsOpen.value=!1,Se();return}if(e.key===`Backspace`){e.preventDefault(),_.keyTipsSequence.value=_.keyTipsSequence.value.slice(0,-1);return}if(/^[a-z0-9]$/i.test(e.key)){e.preventDefault();let t=`${_.keyTipsSequence.value}${e.key.toUpperCase()}`;_.keyTipsSequence.value=t;let n=t.toLowerCase(),r=_.keyTips.value.find(e=>e.key.toLowerCase()===n);if(r){xe(r);return}_.keyTips.value.some(e=>e.key.toLowerCase().startsWith(n))||Se()}}}}function we(e){return e.icon&&typeof e.icon!=`string`?e.icon:e.groupIconCss?r.Grid:null}function Te(e){A.value=e}(0,t.watch)([C,()=>_.layout.value,()=>_.minimized.value],()=>{H()}),(0,t.watch)([b,()=>_.tabs.value,()=>_.disabled.value],()=>{be(),Se()},{deep:!0,immediate:!0}),(0,t.watch)(()=>_.keyTipsOpen.value,e=>{e||Se()}),(0,t.watch)(()=>_.disabled.value,e=>{e&&(_.overflowOpen.value=!1,_.backdropOpen.value=!1,_.keyTipsOpen.value=!1,W(),Se())}),(0,t.watch)([()=>_.minimized.value,()=>_.layout.value,b],([e,,t])=>{(!e||!t)&&W()}),(0,t.watch)([D,k],([e,t],[n,r])=>{n&&K&&K.unobserve(n),r&&K&&K.unobserve(r),e&&K&&K.observe(e),t&&K&&K.observe(t),(e||t)&&H()},{flush:`post`}),(0,t.watch)(A,e=>{e&&(0,t.nextTick)(()=>{U(),H()})});let K=null;(0,t.onMounted)(()=>{window.addEventListener(`keydown`,Ce),window.addEventListener(`resize`,Ee),typeof ResizeObserver<`u`&&(K=new ResizeObserver(()=>{U(),H()}),D.value&&K.observe(D.value),k.value&&K.observe(k.value)),U(),H()}),(0,t.onUnmounted)(()=>{window.removeEventListener(`keydown`,Ce),window.removeEventListener(`resize`,Ee),K?.disconnect()});function Ee(){A.value&&U()}return a(_.api),(i,a)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElConfigProvider),{size:h.size},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{ref_key:`ribbonRootRef`,ref:w,key:(0,t.unref)(_).disabled.value?`ml-ribbon-disabled`:`ml-ribbon-enabled`,class:(0,t.normalizeClass)([`ml-ribbon`,[`ml-ribbon--${(0,t.unref)(_).layout.value}`,`ml-ribbon--size-${F.value}`,{"ml-ribbon--disabled":(0,t.unref)(_).disabled.value,"ml-ribbon--minimized":(0,t.unref)(_).minimized.value,"ml-ribbon--keytips-open":(0,t.unref)(_).keyTipsOpen.value}]]),inert:(0,t.unref)(_).disabled.value,"aria-disabled":(0,t.unref)(_).disabled.value},[(0,t.createElementVNode)(`header`,{ref_key:`ribbonHeaderRef`,ref:T,class:`ml-ribbon__header`},[(0,t.createElementVNode)(`div`,Qe,[e.showFileMenu?((0,t.openBlock)(),(0,t.createBlock)(O,{key:0,items:e.fileMenuItems,disabled:(0,t.unref)(_).disabled.value,label:z.value.fileMenuLabel,"open-backstage-label":z.value.fileMenuOpenBackstageLabel,"show-open-backstage":e.showOpenBackstage,onSelect:ge,onOpenBackstage:_e},null,8,[`items`,`disabled`,`label`,`open-backstage-label`,`show-open-backstage`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(E,{tabs:(0,t.unref)(y),"active-tab":(0,t.unref)(_).activeTab.value,disabled:(0,t.unref)(_).disabled.value,onSelect:pe},null,8,[`tabs`,`active-tab`,`disabled`]),h.hideMinimizeButton?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElTooltip),{key:1,content:z.value.minimizeTooltip,"show-after":te.value,"hide-after":ne.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)(_).minimized.value?`ml-ribbon__control--minimize-up`:`ml-ribbon__control--minimize-down`]),icon:re.value,disabled:(0,t.unref)(_).disabled.value,onClick:he},null,8,[`class`,`icon`,`disabled`])]),_:1},8,[`content`,`show-after`,`hide-after`]))]),(0,t.createElementVNode)(`div`,$e,[h.hideLayoutSwitcher?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElTooltip),{key:0,content:z.value.layoutSwitcherTooltip,"show-after":te.value,"hide-after":ne.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)(_).disabled.value,onClick:me},null,8,[`icon`,`disabled`])]),_:1},8,[`content`,`show-after`,`hide-after`])),h.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":z.value.keyTipsToggleText,"inactive-text":z.value.keyTipsToggleText,"model-value":(0,t.unref)(_).keyTipsOpen.value,disabled:(0,t.unref)(_).disabled.value,onChange:a[0]||=e=>(0,t.unref)(_).keyTipsOpen.value=!(0,t.unref)(_).keyTipsOpen.value},null,8,[`active-text`,`inactive-text`,`model-value`,`disabled`])),i.$slots[`tabs-extra`]?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,et,[(0,t.renderSlot)(i.$slots,`tabs-extra`,{activeTab:(0,t.unref)(_).activeTab.value,layout:(0,t.unref)(_).layout.value,minimized:(0,t.unref)(_).minimized.value,disabled:(0,t.unref)(_).disabled.value})])):(0,t.createCommentVNode)(``,!0)]),b.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:0,placement:`bottom-start`,visible:A.value,width:j.value||void 0,disabled:(0,t.unref)(_).disabled.value||!(0,t.unref)(_).minimized.value,"show-arrow":!1,offset:0,"popper-class":R.value,"onUpdate:visible":Te},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,{"aria-hidden":`true`,class:`ml-ribbon__minimized-anchor`,style:(0,t.normalizeStyle)(M.value)},null,4)]),default:(0,t.withCtx)(()=>[(0,t.unref)(_).layout.value===`classic`?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:0,ref_key:`minimizedClassicPanelRef`,ref:k,class:`ml-ribbon__panel ml-ribbon__panel--floating`,"data-active-tab":b.value.id},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ie.value,e=>((0,t.openBlock)(),(0,t.createBlock)(Xe,{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":z.value.groupOverflowTriggerAriaLabel,"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[2]||=e=>G(e.groupId,e.itemId)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)($,{group:e,"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[1]||=e=>G(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)),B.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`section`,nt,[(0,t.createElementVNode)(`div`,rt,[(0,t.createVNode)((0,t.unref)(n.ElPopover),{trigger:`click`,placement:`bottom-end`,width:ae.value,disabled:S.value,"show-arrow":!1,"popper-class":L.value,onShow:a[4]||=e=>(0,t.unref)(_).overflowOpen.value=!0,onHide:a[5]||=e=>(0,t.unref)(_).overflowOpen.value=!1},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:`ml-ribbon-overflow-trigger`,"aria-label":z.value.overflowTriggerAriaLabel,disabled:S.value},[...a[13]||=[(0,t.createElementVNode)(`span`,{class:`ml-ribbon-overflow-trigger__dots`},`...`,-1)]],8,it)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,at,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(B.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:e.id,class:`ml-ribbon-overflow-group`},[(0,t.createElementVNode)(`header`,ot,(0,t.toDisplayString)(e.title),1),(0,t.createVNode)($,{group:e,"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[3]||=e=>G(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,tt)):((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:1,class:`ml-ribbon__panel ml-ribbon__panel--simplified ml-ribbon__panel--floating`,"data-active-tab":b.value.id},[((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.ElPopover),{key:e.id,trigger:`click`,placement:`bottom-start`,width:340,disabled:S.value,"show-arrow":!1,"popper-class":I.value},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{class:`ml-ribbon-simplified-group`,type:`button`,disabled:S.value},[we(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)(we(e))))]),_:2},1024)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.title),1)],8,ct)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,lt,[(0,t.createVNode)($,{group:oe(e),"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[6]||=e=>G(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])])]),_:2},1032,[`disabled`,`popper-class`]))),128))],8,st))]),_:1},8,[`visible`,`width`,`disabled`,`popper-class`])):(0,t.createCommentVNode)(``,!0)],512),!(0,t.unref)(_).minimized.value&&b.value&&(0,t.unref)(_).layout.value===`classic`?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:0,class:`ml-ribbon__panel`,"data-active-tab":b.value.id,ref_key:`classicPanelRef`,ref:D},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ie.value,e=>((0,t.openBlock)(),(0,t.createBlock)(Xe,{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":z.value.groupOverflowTriggerAriaLabel,"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[8]||=e=>G(e.groupId,e.itemId)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)($,{group:e,"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[7]||=e=>G(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)),B.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`section`,dt,[(0,t.createElementVNode)(`div`,ft,[(0,t.createVNode)((0,t.unref)(n.ElPopover),{trigger:`click`,placement:`bottom-end`,width:ae.value,disabled:S.value,"popper-class":L.value,onShow:a[10]||=e=>(0,t.unref)(_).overflowOpen.value=!0,onHide:a[11]||=e=>(0,t.unref)(_).overflowOpen.value=!1},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:`ml-ribbon-overflow-trigger`,"aria-label":z.value.overflowTriggerAriaLabel,disabled:S.value},[...a[15]||=[(0,t.createElementVNode)(`span`,{class:`ml-ribbon-overflow-trigger__dots`},`...`,-1)]],8,pt)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,mt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(B.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:e.id,class:`ml-ribbon-overflow-group`},[(0,t.createElementVNode)(`header`,ht,(0,t.toDisplayString)(e.title),1),(0,t.createVNode)($,{group:e,"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[9]||=e=>G(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,ut)):(0,t.createCommentVNode)(``,!0),!(0,t.unref)(_).minimized.value&&b.value&&(0,t.unref)(_).layout.value===`simplified`?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:1,class:`ml-ribbon__panel ml-ribbon__panel--simplified`,"data-active-tab":b.value.id},[((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.ElPopover),{key:e.id,trigger:`click`,placement:`bottom-start`,width:340,disabled:S.value,"popper-class":I.value},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{class:`ml-ribbon-simplified-group`,type:`button`,disabled:S.value},[we(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)(we(e))))]),_:2},1024)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.title),1)],8,_t)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,vt,[(0,t.createVNode)($,{group:oe(e),"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[12]||=e=>G(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])])]),_:2},1032,[`disabled`,`popper-class`]))),128))],8,gt)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(v,{open:(0,t.unref)(_).backdropOpen.value,size:F.value,"back-label":z.value.backstageBackLabel,title:z.value.backstageTitle,description:z.value.backstageDescription,onClose:ve},(0,t.createSlots)({_:2},[i.$slots.backstage?{name:`default`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(i.$slots,`backstage`,{close:ve,open:(0,t.unref)(_).backdropOpen.value,size:F.value,backLabel:z.value.backstageBackLabel,title:z.value.backstageTitle,description:z.value.backstageDescription,disabled:(0,t.unref)(_).disabled.value})]),key:`0`}:void 0]),1032,[`open`,`size`,`back-label`,`title`,`description`])],10,Ze))]),_:3},8,[`size`]))}}),xt={class:`ml-ribbon-tab-definition`,hidden:``},St=(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`,xt,[(0,t.renderSlot)(e.$slots,`default`)]))}}),Ct={key:0,class:`ml-ribbon-keytips`,"aria-live":`polite`},wt={class:`ml-ribbon-keytips__hint`},Tt=(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`,Ct,[(0,t.createElementVNode)(`div`,wt,(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=bt,e.MlRibbonBackstage=v,e.MlRibbonButton=j,e.MlRibbonButtonGroup=ee,e.MlRibbonCollection=k,e.MlRibbonContextualTabs=E,e.MlRibbonDropdown=te,e.MlRibbonFileMenu=O,e.MlRibbonGallery=je,e.MlRibbonGroup=Xe,e.MlRibbonInputNumber=Y,e.MlRibbonItemHost=Ve,e.MlRibbonKeyTips=Tt,e.MlRibbonSegmented=Q,e.MlRibbonTab=St,e.MlRibbonTabs=x,e.MlRibbonTemplateItem=Re,e.MlRibbonToggleButton=Ie});
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){(!e.collections||e.collections.length===0)&&(e.collections=[{id:`${e.id}-collection-1`,items:[]}])}function f(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 p(e,n,r,i,a,o,p,m){let h=(0,t.ref)(r),g=(0,t.ref)(i),_=(0,t.ref)(a),v=(0,t.ref)(o),y=(0,t.ref)(u(n)),b=(0,t.ref)(!1),x=(0,t.ref)(!1),S=(0,t.ref)(!1),C=(0,t.ref)([]),w=(0,t.ref)(``),T=(0,t.ref)(p),E=(0,t.ref)(m),D=(0,t.computed)(()=>y.value.filter(e=>e.visible!==!1)),O={addTab(e){y.value.push(l(e)),v.value||=e.id},removeTab(e){y.value=y.value.filter(t=>t.id!==e),v.value===e&&(v.value=D.value[0]?.id??``)},showTab(e){let t=y.value.find(t=>t.id===e);t&&(t.visible=!0)},hideTab(e){let t=y.value.find(t=>t.id===e);t&&(t.visible=!1)},selectTab(e){v.value=e},addGroup(e,t){let n=y.value.find(t=>t.id===e);n&&(n.groups??=[],d(t),n.groups.push(c(t)))},removeGroup(e,t){let n=y.value.find(t=>t.id===e);n?.groups&&(n.groups=n.groups.filter(e=>e.id!==t))},showGroup(e,t){let n=y.value.find(t=>t.id===e)?.groups?.find(e=>e.id===t);n&&(n.visible=!0)},hideGroup(e,t){let n=y.value.find(t=>t.id===e)?.groups?.find(e=>e.id===t);n&&(n.visible=!1)},addItem(e,t,n,r){f(y.value,e,t,n,e=>e.push(s(r)))},removeItem(e,t,n,r){f(y.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){f(y.value,e,t,n,e=>{let t=e.find(e=>e.id===r);t&&Object.assign(t,i)})},enableItem(e,t,n,r){O.updateItem(e,t,n,r,{disabled:!1})},disableItem(e,t,n,r){O.updateItem(e,t,n,r,{disabled:!0})},refreshLayout(){b.value=!1},minimize(e){_.value=e},toggleSimplified(){g.value=g.value===`classic`?`simplified`:`classic`}};return{context:{id:e,disabled:h,layout:g,minimized:_,activeTab:v,tabs:y,overflowOpen:b,backdropOpen:x,keyTipsOpen:S,keyTips:C,keyTipsSequence:w,tooltipShowAfter:T,tooltipHideAfter:E,registerKeyTip:e=>{C.value.some(t=>t.id===e.id)||C.value.push(e)},unregisterKeyTip:e=>{C.value=C.value.filter(t=>t.id!==e)},api:O},visibleTabs:D}}var m={class:`ml-ribbon-backstage__nav`},h={class:`ml-ribbon-backstage__content`},g={key:0},_={key:1},v=(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`,m,[(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`,h,[i.title?((0,t.openBlock)(),(0,t.createElementBlock)(`h2`,g,(0,t.toDisplayString)(i.title),1)):(0,t.createCommentVNode)(``,!0),i.description?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,_,(0,t.toDisplayString)(i.description),1)):(0,t.createCommentVNode)(``,!0)])],64))],2)]),_:3},8,[`model-value`]))}}),y={class:`ml-ribbon-tabs`,role:`tablist`},b=[`aria-selected`,`disabled`,`onClick`],x=(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`,y,[((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,b))),128))]))}}),S={class:`ml-ribbon-contextual-tabs`},C={class:`ml-ribbon-contextual-tabs__normal`},w={class:`ml-ribbon-contextual-tabs__ctx`},T={key:0},E=(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`,S,[(0,t.createElementVNode)(`div`,C,[(0,t.createVNode)(x,{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`,w,[((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`,T,(0,t.toDisplayString)(n.contextualTitle.trim()),1)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(x,{tabs:[n],"active-tab":e.activeTab,disabled:r.disabled,onSelect:a[1]||=e=>i(`select`,e)},null,8,[`tabs`,`active-tab`,`disabled`])],4))),128))])]))}}),D=[`disabled`],O=(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,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdownItem),{key:e.id,divided:i.showOpenBackstage!==!1&&r===0,command:e.id,disabled:e.disabled},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.label),1)]),_:2},1032,[`divided`,`command`,`disabled`]))),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,D)]),_:1},8,[`disabled`,`popper-class`]))}}),k=(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))}}),A={key:3,class:`ml-ribbon-item-host__label ml-ribbon-button__label`},j=(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`,A,[(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`]))}}),M=[`data-id`],N={key:0,class:`ml-ribbon-button-group__label`},P={class:`ml-ribbon-button-group__text`},ee=(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`,N,(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)(j,{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`,P,(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,M))}}),F={class:`ml-ribbon-item-host__content ml-ribbon-dropdown__content`},I={class:`ml-ribbon-item-host__text-row ml-ribbon-dropdown__text-row`},L={key:0,class:`ml-ribbon-item-host__label ml-ribbon-dropdown__label`},R={class:`ml-ribbon-dropdown-item__content`},z={class:`ml-ribbon-dropdown-item__label`},te=(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}},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),d=(0,t.computed)(()=>Array.isArray(a.options)?a.options:[]),f=(0,t.computed)(()=>d.value.find(e=>E(e)===u.value)??null),p=(0,t.computed)(()=>{if(f.value&&a.syncLabelWithSelection){let e=O(f.value);if(e)return e}return j(a.label)??a.id}),m=(0,t.computed)(()=>!a.hideLabel&&p.value.length>0),h=(0,t.computed)(()=>{if(f.value){let e=w(f.value);if(e)return e}return!a.icon||typeof a.icon==`string`?null:a.icon}),g=(0,t.computed)(()=>{if(f.value){let e=T(f.value);if(e)return e}if(typeof a.icon!=`string`)return null;let e=a.icon.trim();return e.length>0?e:null}),_=(0,t.computed)(()=>!!(h.value||g.value)),v=(0,t.computed)(()=>A(f.value)??j(a.tooltip)??j(p.value)??j(a.label)??M(a.id)),y=(0,t.computed)(()=>[`ml-ribbon-dropdown-menu`,`ml-ribbon-popper`,`ml-ribbon-popper--size-${c.value}`,a.popperClass].filter(Boolean).join(` `));function b(e){if(a.disabled){l.value=!1;return}l.value=e}function x(){a.disabled||(l.value=!l.value)}function S(e){a.disabled||(u.value=e,o(`tooltip-change`,A(f.value)??v.value),o(`command`,e),l.value=!1)}function C(){if(a.disabled)return;let e=f.value;if(!e){o(`click`);return}o(`command`,E(e))}function w(e){if(!e||typeof e!=`object`)return null;let t=e.icon;return!t||typeof t==`string`?null:t}function T(e){if(!e||typeof e!=`object`)return null;let t=e.icon;return typeof t!=`string`||t.trim().length===0?null:t}function E(e){if(!(!e||typeof e!=`object`))return e.value}function D(e){let t=E(e);if(typeof t==`string`||typeof t==`number`||t&&typeof t==`object`)return t}function O(e){if(!e||typeof e!=`object`)return;let t=e.label;return typeof t==`string`?t:void 0}function k(e){if(typeof e==`string`)return M(e);if(typeof e==`number`||typeof e==`boolean`)return String(e)}function A(e){if(!(!e||typeof e!=`object`))return j(e.tooltip)??O(e)??k(E(e))}function j(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function M(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(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":y.value,onVisibleChange:b,onCommand:S},{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,r=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElDropdownItem),{key:String(E(r)),command:D(r),disabled:r.disabled===!0,divided:r.divided===!0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElTooltip),{content:A(r),disabled:!A(r),"show-after":e.tooltipShowAfter,"hide-after":e.tooltipHideAfter,placement:`top`,effect:`dark`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,R,[(0,t.renderSlot)(i.$slots,`option`,{option:r},()=>[w(r)?((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)(w(r))))]),_:2},1024)):T(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)([`ml-ribbon-dropdown-item__icon ml-ribbon-dropdown-item__icon--class`,T(r)]),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,z,(0,t.toDisplayString)(O(r)),1)])])]),_:2},1032,[`content`,`disabled`,`show-after`,`hide-after`])]),_:2},1032,[`command`,`disabled`,`divided`]))),128))]),_:3})]),default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElButton),{type:`default`,disabled:e.disabled,"aria-label":v.value,onClick:x},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,F,[i.$slots.icon||_.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":g.value&&!h.value&&!i.$slots.icon}]),onClick:(0,t.withModifiers)(C,[`stop`])},[(0,t.renderSlot)(i.$slots,`icon`,{selectedOption:f.value},()=>[h.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)(h.value)))]),_:1})):g.value?((0,t.openBlock)(),(0,t.createElementBlock)(`i`,{key:1,class:(0,t.normalizeClass)(g.value),"aria-hidden":`true`},null,2)):(0,t.createCommentVNode)(``,!0)])],2)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,I,[m.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,L,[(0,t.renderSlot)(i.$slots,`label`,{selectedOption:f.value,label:p.value},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(p.value),1)])])):(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`]))}}),ne=[`disabled`],re=[`src`],ie={key:3,class:`ml-ribbon-gallery__preview-svg`,role:`presentation`,"aria-hidden":`true`},B=[`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`},V=[`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`},H={key:1,class:`ml-ribbon-gallery__title`},U={key:2,class:`ml-ribbon-gallery__categories`},W={key:0,class:`ml-ribbon-gallery__category-title`},fe=[`disabled`,`onClick`],pe=[`src`],me={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`],G=[`disabled`],ye=[`disabled`],be={key:0,class:`ml-ribbon-gallery__panel-category-title`},xe=[`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`},K=6,Ee=64,De=4,Oe=16,ke=4,Ae=22,je=(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(Ee*g.value)),v=(0,t.computed)(()=>Math.round(Ae*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)*De+K*2+(a.collapsed?Oe:ke+v.value)),ee=(0,t.computed)(()=>({modifiers:[{name:`offset`,options:{offset:[p.value,0]}}]}));(0,t.watch)(()=>a.modelValue,e=>{typeof e==`string`&&(s.value=e,te(e))},{immediate:!0}),(0,t.watch)(()=>[x.value.map(e=>e.id).join(`\0`),w.value,s.value],()=>{te()||(l.value=Math.min(l.value,T.value-1))}),(0,t.watch)(c,async e=>{!e||a.collapsed||(je(),await(0,t.nextTick)(),await(0,t.nextTick)(),Me())});function F(e){return e==null||typeof e==`string`?e:typeof e==`object`||typeof e==`function`?(0,t.markRaw)((0,t.toRaw)(e)):e}function I(e){let t=y.value.toLowerCase(),n=e.title.trim().toLowerCase();return b.value>1||!t||n!==t}function L(e){return j.value?e.items.filter(e=>A.value.has(e.id)):e.items}function R(e){if(a.disabled||!j.value)return;let t=E.value+e;l.value=Math.min(Math.max(t,0),T.value-1)}function z(e){let t=x.value.findIndex(t=>t.id===e.id);return t<0?0:Math.floor(t/w.value)}function te(e=s.value){let t=x.value.find(t=>t.id===e);return t?(l.value=z(t),!0):!1}function je(){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-K)}function Me(){let e=f.value;e&&e.querySelector(`[data-gallery-row-index="${E.value}"]`)?.scrollIntoView?.({block:`start`})}function q(e){return e.preview&&typeof e.preview!=`string`?F(e.preview):e.icon&&typeof e.icon!=`string`?F(e.icon):null}function J(e){return e.component?F(e.component):null}function Y(e){return a.disabled||e.disabled===!0}function X(e){if(typeof e.icon!=`string`)return null;let t=e.icon.trim();return t.length>0?t:null}function Z(e){let t=e.previewSvg??e.svg;if(typeof t!=`string`)return null;let n=t.trim();return n.length>0?n:null}function Ne(e){return e.startsWith(`data:image/svg+xml`)||e.endsWith(`.svg`)}function Pe(e){let t=Z(e);return t?Ne(t):!1}function Fe(e){return typeof e.preview==`string`?e.preview:a.previewFallback}function Q(e){Y(e)||(s.value=e.id,l.value=z(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:Y(S.value)},[J(S.value)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(J(S.value)),(0,t.mergeProps)({key:0},S.value.componentProps,{item:S.value,selected:s.value===S.value.id,disabled:Y(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":q(S.value)||X(S.value),"ml-ribbon-gallery__preview--svg":Z(S.value)}])},[q(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)(q(S.value))))]),_:1})):X(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`,X(S.value)]),"aria-hidden":`true`},null,2)):Z(S.value)&&Pe(S.value)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:Z(S.value)??``,alt:``},null,8,re)):Z(S.value)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,ie,[(0,t.createElementVNode)(`use`,{href:Z(S.value)??``},null,8,B)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Fe(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`,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`},[I(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:Y(r),onClick:e=>Q(r)},[(0,t.renderSlot)(i.$slots,`item`,{item:r,category:e,selected:s.value===r.id,disabled:Y(r),select:()=>Q(r)},()=>[J(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(J(r)),(0,t.mergeProps)({key:0,ref_for:!0},r.componentProps,{item:r,category:e,selected:s.value===r.id,disabled:Y(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":q(r)||X(r),"ml-ribbon-gallery__preview--svg":Z(r)}])},[q(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)(q(r))))]),_:2},1024)):X(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`,X(r)]),"aria-hidden":`true`},null,2)):Z(r)&&Pe(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:Z(r)??``,alt:``},null,8,ce)):Z(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,le,[(0,t.createElementVNode)(`use`,{href:Z(r)??``},null,8,ue)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Fe(r)),1)],64))],2),(0,t.createElementVNode)(`div`,de,(0,t.toDisplayString)(r.label),1)],64))])],10,V))),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`,H,(0,t.toDisplayString)(y.value),1)):(0,t.createCommentVNode)(``,!0),e.collapsed?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,U,[((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&&I(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`h4`,W,(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)(L(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:Y(r),onClick:e=>Q(r)},[(0,t.renderSlot)(i.$slots,`item`,{item:r,category:e,selected:s.value===r.id,disabled:Y(r),select:()=>Q(r)},()=>[J(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(J(r)),(0,t.mergeProps)({key:0,ref_for:!0},r.componentProps,{item:r,category:e,selected:s.value===r.id,disabled:Y(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":q(r)||X(r),"ml-ribbon-gallery__preview--svg":Z(r)}])},[q(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)(q(r))))]),_:2},1024)):X(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`,X(r)]),"aria-hidden":`true`},null,2)):Z(r)&&Pe(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:Z(r)??``,alt:``},null,8,pe)):Z(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,me,[(0,t.createElementVNode)(`use`,{href:Z(r)??``},null,8,he)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Fe(r)),1)],64))],2),(0,t.createElementVNode)(`div`,ge,(0,t.toDisplayString)(r.label),1)],64))])],10,fe))),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=>R(-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=>R(1)},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.ArrowDown))]),_:1})],8,G),(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":ee.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:je},[(0,t.createVNode)((0,t.unref)(n.ElIcon),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(r.Bottom))]),_:1})],10,ye)]),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`},[I(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`h4`,be,(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":z(r),disabled:Y(r),onClick:e=>Q(r)},[(0,t.renderSlot)(i.$slots,`item`,{item:r,category:e,selected:s.value===r.id,disabled:Y(r),select:()=>Q(r)},()=>[J(r)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(J(r)),(0,t.mergeProps)({key:0,ref_for:!0},r.componentProps,{item:r,category:e,selected:s.value===r.id,disabled:Y(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":q(r)||X(r),"ml-ribbon-gallery__preview--svg":Z(r)}])},[q(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)(q(r))))]),_:2},1024)):X(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`,X(r)]),"aria-hidden":`true`},null,2)):Z(r)&&Pe(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:2,class:`ml-ribbon-gallery__preview-svg`,src:Z(r)??``,alt:``},null,8,Se)):Z(r)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,Ce,[(0,t.createElementVNode)(`use`,{href:Z(r)??``},null,8,we)])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:4},[(0,t.createTextVNode)((0,t.toDisplayString)(Fe(r)),1)],64))],2),(0,t.createElementVNode)(`div`,Te,(0,t.toDisplayString)(r.label),1)],64))])],10,xe))),128))],4)]))),128))],512)]),_:3},8,[`visible`,`disabled`,`width`,`popper-class`,`popper-options`])])):(0,t.createCommentVNode)(``,!0)]))],2))}}),Me=[`data-id`,`onKeydown`],q={key:0,class:`ml-ribbon-input-number__prefix`},J={key:2,class:`ml-ribbon-input-number__prefix-label`},Y=(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`,q,[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`,J,(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,Me))}}),X=[`data-id`],Z={key:0,class:`ml-ribbon-segmented__label`},Ne=[`data-option-value`,`aria-label`],Pe={key:2,class:`ml-ribbon-segmented__option-label`},Fe={key:3,class:`ml-ribbon-segmented__option-sr-label`},Q=(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`,Z,(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`,Pe,(0,t.toDisplayString)(d(r)),1)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Fe,(0,t.toDisplayString)(d(r)),1))],8,Ne)]),_:2},1032,[`content`,`disabled`,`show-after`,`hide-after`])]),_:1},8,[`options`,`model-value`,`direction`,`block`,`disabled`,`aria-label`])],8,X))}}),Ie=(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)(j,{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`]))}}),Le=[`data-template-id`,`aria-disabled`],Re=(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,Le))}}),ze=[`data-item-id`],Be={key:0,class:`ml-ribbon-item-host__keytip`},Ve=(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)(()=>ge(s?.tooltipShowAfter.value,1e3)),f=(0,t.computed)(()=>ge(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:he(a.item.tooltip)??he(a.item.label)??be(a.item)??xe(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`),M=(0,t.computed)(()=>{let e=a.item.props?.component;return!e||typeof e==`string`?null:(0,t.markRaw)((0,t.toRaw)(e))}),N=(0,t.computed)(()=>{let e=a.item.props?.componentProps;return!e||typeof e!=`object`||Array.isArray(e)?{}:e}),P=(0,t.computed)(()=>a.item.props?.wrap!==!1),F=(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)(()=>G(a.item.props?.iconSize)),R=(0,t.computed)(()=>_e(a.item.props?.width??a.item.props?.comboWidth,`92px`)),z=(0,t.computed)(()=>a.item.props?.modelValue),ne=(0,t.computed)(()=>_e(a.item.props?.width??a.item.props?.inputNumberWidth,`96px`)),re=(0,t.computed)(()=>a.item.props?.modelValue),ie=(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}),B=(0,t.computed)(()=>ye(a.item.props?.labelWrapLines)),ae=(0,t.computed)(()=>ve(a.item.props?.labelWrapWidth)),oe=(0,t.computed)(()=>a.item.type===`button`&&a.item.size===`large`&&h.value&&(B.value??0)>1),se=(0,t.computed)(()=>{if(!oe.value)return{};let e={"--ml-rb-item-label-max-lines":String(B.value??2)};return ae.value&&(e[`--ml-rb-item-label-wrap-width`]=ae.value),e});(0,t.watch)(()=>a.item.id,()=>{g.value=void 0});function V(){C.value||o(`item-click`,a.id)}function ce(e){if(!C.value){if(typeof e==`string`||typeof e==`number`){o(`item-click`,String(e));return}V()}}function le(e){g.value=e}function ue(e){if(!C.value){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`){o(`item-click`,String(e));return}V()}}function de(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 H(e){if(!C.value){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`){o(`item-click`,String(e));return}V()}}function U(e){C.value||o(`item-click`,e)}function W(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}V()}}function fe(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}V()}}function pe(e){if(!C.value){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`){o(`item-click`,String(e));return}V()}}function me(e){if(!e||typeof e!=`object`)return;let t=e.label;return typeof t==`string`?t:void 0}function he(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function ge(e,t){return typeof e!=`number`||Number.isNaN(e)||!Number.isFinite(e)?t:Math.max(0,Math.round(e))}function _e(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 ve(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 G(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 ye(e){if(!(typeof e!=`number`||Number.isNaN(e)||!Number.isFinite(e)))return Math.max(1,Math.round(e))}function be(e){let t=c.value.map(e=>me(e)).filter(e=>!!e);if(t.length)return e.type===`buttonGroup`?t.join(` / `):t[0]}function xe(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":oe.value}]]),style:(0,t.normalizeStyle)(se.value),"data-item-id":e.id,role:`group`},[S.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Be,(0,t.toDisplayString)(x.value),1)):(0,t.createCommentVNode)(``,!0),e.item.type===`buttonGroup`?((0,t.openBlock)(),(0,t.createBlock)(ee,{key:1,id:e.item.id,label:e.item.label??``,options:e.item.props?.options??[],"hide-label":e.item.hideLabel===!0,wrap:P.value,"equal-width":F.value,"button-size":I.value,"icon-size":L.value,"tooltip-show-after":d.value,"tooltip-hide-after":f.value,disabled:C.value,onChange:H},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)(Q,{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:ue},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)(Ie,{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:de},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)(je,{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:U},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)(Re,{key:5,id:e.item.id,item:e.item,disabled:C.value},{default:(0,t.withCtx)(()=>[M.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(M.value),(0,t.mergeProps)({key:0},N.value,{item:e.item,"group-id":e.groupId,disabled:C.value,"emit-item-click":pe}),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)(te,{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??[],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:ce,onTooltipChange:le,onClick:V},null,8,[`id`,`label`,`tooltip`,`icon`,`options`,`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:V},{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:V},null,8,[`disabled`])):e.item.type===`comboBox`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElSelect),{key:9,"model-value":z.value,disabled:C.value,"popper-class":p.value,style:(0,t.normalizeStyle)({width:R.value}),onChange:W},{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)(Y,{key:10,id:e.item.id,"model-value":re.value,width:ne.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":ie.value,disabled:C.value,onChange:fe},null,8,[`id`,`model-value`,`width`,`prefix-label`,`prefix-icon`,`prefix-icon-class`,`control-props`,`disabled`])):((0,t.openBlock)(),(0,t.createBlock)(j,{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:V},null,8,[`id`,`label`,`icon`,`disabled`,`hide-label`,`aria-label`]))],14,ze)]),_: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)(k,{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)(Ve,{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))}}),He=[`data-priority`],Ue={class:`ml-ribbon-group__body`},We={class:`ml-ribbon-group__footer`},Ge={class:`ml-ribbon-group__title`},Ke=[`aria-label`,`aria-expanded`,`disabled`],qe={class:`ml-ribbon-group__overflow-content`},Je=[`aria-label`,`aria-expanded`,`disabled`],Ye={class:`ml-ribbon-group__overflow-content`},Xe=(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)(()=>{z(),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 ee(e){D.value=e}function F(){d.value||(E.value=!E.value)}function I(){d.value||(D.value=!D.value)}let L=null,R=null;function z(){if(!L)return;let e=f.value?.querySelector(`.ml-ribbon-group__content`)??null;R!==e&&(R&&L.unobserve(R),e&&L.observe(e),R=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`&&(L=new ResizeObserver(()=>{M(),N(),A()}),f.value&&L.observe(f.value),z()),j()}),(0,t.onUnmounted)(()=>{L?.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`,Ue,[(0,t.renderSlot)(i.$slots,`default`)]),(0,t.createElementVNode)(`footer`,We,[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`,Ge,(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:F},[(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,Ke)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,qe,[(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=>ee(!0),onHide:a[5]||=e=>ee(!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:I},[(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,Je)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,Ye,[(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,He))}}),Ze=[`inert`,`aria-disabled`],Qe={class:`ml-ribbon__head-left`},$e={class:`ml-ribbon__head-right`},et={key:2,class:`ml-ribbon__tabs-extra`},tt=[`data-active-tab`],nt={key:0,class:`ml-ribbon-group ml-ribbon-group--overflow`},rt={class:`ml-ribbon-group__body ml-ribbon-group__body--overflow`},it=[`aria-label`,`disabled`],at={class:`ml-ribbon-overflow-list`},ot={class:`ml-ribbon-overflow-group__header`},st=[`data-active-tab`],ct=[`disabled`],lt={class:`ml-ribbon-simplified-group__panel`},ut=[`data-active-tab`],dt={key:0,class:`ml-ribbon-group ml-ribbon-group--overflow`},ft={class:`ml-ribbon-group__body ml-ribbon-group__body--overflow`},pt=[`aria-label`,`disabled`],mt={class:`ml-ribbon-overflow-list`},ht={class:`ml-ribbon-overflow-group__header`},gt=[`data-active-tab`],_t=[`disabled`],vt={class:`ml-ribbon-simplified-group__panel`},yt=40,bt=(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 d(e){return e.map(e=>({...e,groups:e.groups?.map(u)}))}function f(e,t){return typeof e!=`number`||Number.isNaN(e)||!Number.isFinite(e)?t:Math.max(0,Math.round(e))}let m={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`},h=e,g=o,{context:_,visibleTabs:y}=p(h.id,h.tabs,h.disabled,h.activeLayout?String(h.activeLayout).toLowerCase()===`simplified`?`simplified`:`classic`:h.layout,h.minimized,h.activeTab||h.tabs[0]?.id||``,f(h.tooltipShowAfter,1e3),f(h.tooltipHideAfter,0));(0,t.provide)(i,_),(0,t.watch)(()=>h.tabs,e=>{_.tabs.value=d(e),_.tabs.value.some(e=>e.id===_.activeTab.value)||(_.activeTab.value=_.tabs.value[0]?.id||``)},{deep:!0}),(0,t.watch)(()=>h.layout,e=>{e!==_.layout.value&&(_.layout.value=e)}),(0,t.watch)(()=>h.activeLayout,e=>{if(!e)return;let t=String(e).toLowerCase()===`simplified`?`simplified`:`classic`;t!==_.layout.value&&(_.layout.value=t)}),(0,t.watch)(()=>h.minimized,e=>{e!==_.minimized.value&&(_.minimized.value=e)}),(0,t.watch)(()=>h.disabled,e=>{e!==_.disabled.value&&(_.disabled.value=e)}),(0,t.watch)(()=>h.activeTab,e=>{e&&e!==_.activeTab.value&&(_.activeTab.value=e)}),(0,t.watch)(()=>h.tooltipShowAfter,e=>{let t=f(e,1e3);t!==_.tooltipShowAfter.value&&(_.tooltipShowAfter.value=t)}),(0,t.watch)(()=>h.tooltipHideAfter,e=>{let t=f(e,0);t!==_.tooltipHideAfter.value&&(_.tooltipHideAfter.value=t)}),(0,t.watch)(_.activeTab,e=>{g(`update:activeTab`,e),g(`tabChange`,e)}),(0,t.watch)(_.layout,e=>{g(`update:layout`,e),g(`layoutChange`,e)}),(0,t.watch)(_.minimized,e=>{g(`update:minimized`,e)}),(0,t.watch)(_.overflowOpen,e=>{g(e?`overflowOpen`:`overflowClose`)}),(0,t.watch)(_.backdropOpen,e=>{g(e?`backstageOpen`:`backstageClose`)});let b=(0,t.computed)(()=>y.value.find(e=>e.id===_.activeTab.value)),x=(0,t.computed)(()=>new Set(y.value.filter(e=>e.contextual&&e.contextualMode===`exclusive`).map(e=>e.id))),S=(0,t.computed)(()=>fe(b.value)),C=(0,t.computed)(()=>b.value?.groups?.filter(e=>e.visible!==!1)??[]),w=(0,t.ref)(null),T=(0,t.ref)(null),D=(0,t.ref)(null),k=(0,t.ref)(null),A=(0,t.ref)(!1),j=(0,t.ref)(0),M=(0,t.ref)({left:`0px`,top:`0px`,width:`1px`,height:`0px`}),N=(0,t.ref)(new Set),P=(0,t.ref)({}),ee=(0,n.useGlobalConfig)(`size`,``),F=(0,t.computed)(()=>h.size||ee.value||`default`),I=(0,t.computed)(()=>`ml-ribbon-group-popover ml-ribbon-group-popover--size-${F.value}`),L=(0,t.computed)(()=>`ml-ribbon-overflow-popover ml-ribbon-overflow-popover--size-${F.value}`),R=(0,t.computed)(()=>`ml-ribbon-tab-panel-popover ml-ribbon-tab-panel-popover--size-${F.value}`),z=(0,t.computed)(()=>({layoutSwitcherTooltip:h.texts.layoutSwitcherTooltip||m.layoutSwitcherTooltip,minimizeTooltip:h.texts.minimizeTooltip||m.minimizeTooltip,keyTipsToggleText:h.texts.keyTipsToggleText||m.keyTipsToggleText,overflowTriggerAriaLabel:h.texts.overflowTriggerAriaLabel||m.overflowTriggerAriaLabel,groupOverflowTriggerAriaLabel:h.texts.groupOverflowTriggerAriaLabel||m.groupOverflowTriggerAriaLabel,fileMenuLabel:h.texts.fileMenuLabel||m.fileMenuLabel,fileMenuOpenBackstageLabel:h.texts.fileMenuOpenBackstageLabel||m.fileMenuOpenBackstageLabel,backstageBackLabel:h.texts.backstageBackLabel||m.backstageBackLabel,backstageTitle:h.texts.backstageTitle||m.backstageTitle,backstageDescription:h.texts.backstageDescription||m.backstageDescription,keyTipsSequencePrefix:h.texts.keyTipsSequencePrefix||m.keyTipsSequencePrefix,keyTipsEmptySequence:h.texts.keyTipsEmptySequence||m.keyTipsEmptySequence,galleryPreviewFallback:h.texts.galleryPreviewFallback||m.galleryPreviewFallback})),te=(0,t.computed)(()=>f(h.tooltipShowAfter,1e3)),ne=(0,t.computed)(()=>f(h.tooltipHideAfter,0)),re=(0,t.computed)(()=>_.minimized.value?r.ArrowUpBold:r.ArrowDownBold),ie=(0,t.computed)(()=>C.value.filter(e=>!N.value.has(e.id))),B=(0,t.computed)(()=>C.value.filter(e=>N.value.has(e.id))),ae=(0,t.computed)(()=>{if(!B.value.length)return 220;let e=B.value.reduce((e,t)=>{let n=P.value[t.id]??V(t);return Math.max(e,n)},0),t=Math.ceil(e+40);return Math.max(220,Math.min(720,t))});function oe(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 se(e){return e.priority??100}function V(e){return typeof e.width==`number`&&Number.isFinite(e.width)&&e.width>0?e.width:140}function ce(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 le(){let e=C.value.reduce((e,t)=>{let n=P.value[t.id]??V(t);return e+Math.max(n,V(t))},0);return Math.max(220,e)}function ue(e){let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--ml-rb-overflow-slot-width`));return Number.isFinite(t)&&t>0?t:yt}function de(){if(_.layout.value!==`classic`){N.value=new Set;return}let e=_.minimized.value?k.value:D.value;if(!e)return;let t=C.value;if(!t.length){N.value=new Set;return}let n=Math.round(e.getBoundingClientRect().width),r=ue(e),i=ce(e);P.value={...P.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=se(t.group)-se(e.group);return n===0?t.index-e.index:n}),l=e=>i[e.id]??V(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}N.value=s}function H(){(0,t.nextTick)(()=>{if(_.layout.value!==`classic`||_.minimized.value){de();return}if(N.value.size===0){de();return}N.value=new Set,(0,t.nextTick)(()=>{de()})})}function U(){let e=w.value,t=T.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);j.value=Math.round(a>0?a:_.layout.value===`classic`?le():Math.max(360,C.value.length*120)),M.value={left:`${Math.round(n.left-r.left+i)}px`,top:`0px`,width:`1px`,height:`${Math.round(r.height)}px`}}function W(){A.value=!1}function fe(e){return _.disabled.value?!0:!e||x.value.size===0?!1:!x.value.has(e.id)}function pe(e){if(_.disabled.value)return;let t=_.activeTab.value===e.id;if(_.activeTab.value=e.id,!_.minimized.value){W();return}U(),A.value=t?!A.value:!0}function me(){_.disabled.value||_.api.toggleSimplified()}function he(){_.disabled.value||(_.minimized.value||W(),_.minimized.value=!_.minimized.value)}function ge(e){_.disabled.value||(W(),g(`fileMenuSelect`,e))}function _e(){_.disabled.value||(W(),_.backdropOpen.value=!0)}function ve(){_.disabled.value||(_.backdropOpen.value=!1)}function G(e,t){S.value||(g(`itemClick`,{tabId:_.activeTab.value,groupId:e,itemId:t}),_.minimized.value&&W())}function ye(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function be(){if(S.value){_.keyTips.value=[];return}let e=b.value;if(!e?.groups?.length){_.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)));_.keyTips.value=t}function xe(e){if(_.disabled.value)return;let t=b.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){G(n.id,r.id),_.keyTipsOpen.value=!1,_.keyTipsSequence.value=``;return}}}}function Se(){_.keyTipsSequence.value=``}function Ce(e){if(!_.disabled.value&&!ye(e.target)){if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key===`Alt`){e.preventDefault(),_.keyTipsOpen.value=!_.keyTipsOpen.value,_.keyTipsOpen.value||Se();return}if(_.keyTipsOpen.value&&!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`){e.preventDefault(),_.keyTipsOpen.value=!1,Se();return}if(e.key===`Backspace`){e.preventDefault(),_.keyTipsSequence.value=_.keyTipsSequence.value.slice(0,-1);return}if(/^[a-z0-9]$/i.test(e.key)){e.preventDefault();let t=`${_.keyTipsSequence.value}${e.key.toUpperCase()}`;_.keyTipsSequence.value=t;let n=t.toLowerCase(),r=_.keyTips.value.find(e=>e.key.toLowerCase()===n);if(r){xe(r);return}_.keyTips.value.some(e=>e.key.toLowerCase().startsWith(n))||Se()}}}}function we(e){return e.icon&&typeof e.icon!=`string`?e.icon:e.groupIconCss?r.Grid:null}function Te(e){A.value=e}(0,t.watch)([C,()=>_.layout.value,()=>_.minimized.value],()=>{H()}),(0,t.watch)([b,()=>_.tabs.value,()=>_.disabled.value],()=>{be(),Se()},{deep:!0,immediate:!0}),(0,t.watch)(()=>_.keyTipsOpen.value,e=>{e||Se()}),(0,t.watch)(()=>_.disabled.value,e=>{e&&(_.overflowOpen.value=!1,_.backdropOpen.value=!1,_.keyTipsOpen.value=!1,W(),Se())}),(0,t.watch)([()=>_.minimized.value,()=>_.layout.value,b],([e,,t])=>{(!e||!t)&&W()}),(0,t.watch)([D,k],([e,t],[n,r])=>{n&&K&&K.unobserve(n),r&&K&&K.unobserve(r),e&&K&&K.observe(e),t&&K&&K.observe(t),(e||t)&&H()},{flush:`post`}),(0,t.watch)(A,e=>{e&&(0,t.nextTick)(()=>{U(),H()})});let K=null;(0,t.onMounted)(()=>{window.addEventListener(`keydown`,Ce),window.addEventListener(`resize`,Ee),typeof ResizeObserver<`u`&&(K=new ResizeObserver(()=>{U(),H()}),D.value&&K.observe(D.value),k.value&&K.observe(k.value)),U(),H()}),(0,t.onUnmounted)(()=>{window.removeEventListener(`keydown`,Ce),window.removeEventListener(`resize`,Ee),K?.disconnect()});function Ee(){A.value&&U()}return a(_.api),(i,a)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElConfigProvider),{size:h.size},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{ref_key:`ribbonRootRef`,ref:w,key:(0,t.unref)(_).disabled.value?`ml-ribbon-disabled`:`ml-ribbon-enabled`,class:(0,t.normalizeClass)([`ml-ribbon`,[`ml-ribbon--${(0,t.unref)(_).layout.value}`,`ml-ribbon--size-${F.value}`,{"ml-ribbon--disabled":(0,t.unref)(_).disabled.value,"ml-ribbon--minimized":(0,t.unref)(_).minimized.value,"ml-ribbon--keytips-open":(0,t.unref)(_).keyTipsOpen.value}]]),inert:(0,t.unref)(_).disabled.value,"aria-disabled":(0,t.unref)(_).disabled.value},[(0,t.createElementVNode)(`header`,{ref_key:`ribbonHeaderRef`,ref:T,class:`ml-ribbon__header`},[(0,t.createElementVNode)(`div`,Qe,[e.showFileMenu?((0,t.openBlock)(),(0,t.createBlock)(O,{key:0,items:e.fileMenuItems,disabled:(0,t.unref)(_).disabled.value,label:z.value.fileMenuLabel,"open-backstage-label":z.value.fileMenuOpenBackstageLabel,"show-open-backstage":e.showOpenBackstage,onSelect:ge,onOpenBackstage:_e},null,8,[`items`,`disabled`,`label`,`open-backstage-label`,`show-open-backstage`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(E,{tabs:(0,t.unref)(y),"active-tab":(0,t.unref)(_).activeTab.value,disabled:(0,t.unref)(_).disabled.value,onSelect:pe},null,8,[`tabs`,`active-tab`,`disabled`]),h.hideMinimizeButton?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElTooltip),{key:1,content:z.value.minimizeTooltip,"show-after":te.value,"hide-after":ne.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)(_).minimized.value?`ml-ribbon__control--minimize-up`:`ml-ribbon__control--minimize-down`]),icon:re.value,disabled:(0,t.unref)(_).disabled.value,onClick:he},null,8,[`class`,`icon`,`disabled`])]),_:1},8,[`content`,`show-after`,`hide-after`]))]),(0,t.createElementVNode)(`div`,$e,[h.hideLayoutSwitcher?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElTooltip),{key:0,content:z.value.layoutSwitcherTooltip,"show-after":te.value,"hide-after":ne.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)(_).disabled.value,onClick:me},null,8,[`icon`,`disabled`])]),_:1},8,[`content`,`show-after`,`hide-after`])),h.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":z.value.keyTipsToggleText,"inactive-text":z.value.keyTipsToggleText,"model-value":(0,t.unref)(_).keyTipsOpen.value,disabled:(0,t.unref)(_).disabled.value,onChange:a[0]||=e=>(0,t.unref)(_).keyTipsOpen.value=!(0,t.unref)(_).keyTipsOpen.value},null,8,[`active-text`,`inactive-text`,`model-value`,`disabled`])),i.$slots[`tabs-extra`]?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,et,[(0,t.renderSlot)(i.$slots,`tabs-extra`,{activeTab:(0,t.unref)(_).activeTab.value,layout:(0,t.unref)(_).layout.value,minimized:(0,t.unref)(_).minimized.value,disabled:(0,t.unref)(_).disabled.value})])):(0,t.createCommentVNode)(``,!0)]),b.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElPopover),{key:0,placement:`bottom-start`,visible:A.value,width:j.value||void 0,disabled:(0,t.unref)(_).disabled.value||!(0,t.unref)(_).minimized.value,"show-arrow":!1,offset:0,"popper-class":R.value,"onUpdate:visible":Te},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,{"aria-hidden":`true`,class:`ml-ribbon__minimized-anchor`,style:(0,t.normalizeStyle)(M.value)},null,4)]),default:(0,t.withCtx)(()=>[(0,t.unref)(_).layout.value===`classic`?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:0,ref_key:`minimizedClassicPanelRef`,ref:k,class:`ml-ribbon__panel ml-ribbon__panel--floating`,"data-active-tab":b.value.id},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ie.value,e=>((0,t.openBlock)(),(0,t.createBlock)(Xe,{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":z.value.groupOverflowTriggerAriaLabel,"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[2]||=e=>G(e.groupId,e.itemId)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)($,{group:e,"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[1]||=e=>G(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)),B.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`section`,nt,[(0,t.createElementVNode)(`div`,rt,[(0,t.createVNode)((0,t.unref)(n.ElPopover),{trigger:`click`,placement:`bottom-end`,width:ae.value,disabled:S.value,"show-arrow":!1,"popper-class":L.value,onShow:a[4]||=e=>(0,t.unref)(_).overflowOpen.value=!0,onHide:a[5]||=e=>(0,t.unref)(_).overflowOpen.value=!1},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:`ml-ribbon-overflow-trigger`,"aria-label":z.value.overflowTriggerAriaLabel,disabled:S.value},[...a[13]||=[(0,t.createElementVNode)(`span`,{class:`ml-ribbon-overflow-trigger__dots`},`...`,-1)]],8,it)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,at,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(B.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:e.id,class:`ml-ribbon-overflow-group`},[(0,t.createElementVNode)(`header`,ot,(0,t.toDisplayString)(e.title),1),(0,t.createVNode)($,{group:e,"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[3]||=e=>G(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,tt)):((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:1,class:`ml-ribbon__panel ml-ribbon__panel--simplified ml-ribbon__panel--floating`,"data-active-tab":b.value.id},[((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.ElPopover),{key:e.id,trigger:`click`,placement:`bottom-start`,width:340,disabled:S.value,"show-arrow":!1,"popper-class":I.value},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{class:`ml-ribbon-simplified-group`,type:`button`,disabled:S.value},[we(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)(we(e))))]),_:2},1024)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.title),1)],8,ct)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,lt,[(0,t.createVNode)($,{group:oe(e),"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[6]||=e=>G(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])])]),_:2},1032,[`disabled`,`popper-class`]))),128))],8,st))]),_:1},8,[`visible`,`width`,`disabled`,`popper-class`])):(0,t.createCommentVNode)(``,!0)],512),!(0,t.unref)(_).minimized.value&&b.value&&(0,t.unref)(_).layout.value===`classic`?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:0,class:`ml-ribbon__panel`,"data-active-tab":b.value.id,ref_key:`classicPanelRef`,ref:D},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ie.value,e=>((0,t.openBlock)(),(0,t.createBlock)(Xe,{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":z.value.groupOverflowTriggerAriaLabel,"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[8]||=e=>G(e.groupId,e.itemId)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)($,{group:e,"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[7]||=e=>G(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)),B.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`section`,dt,[(0,t.createElementVNode)(`div`,ft,[(0,t.createVNode)((0,t.unref)(n.ElPopover),{trigger:`click`,placement:`bottom-end`,width:ae.value,disabled:S.value,"popper-class":L.value,onShow:a[10]||=e=>(0,t.unref)(_).overflowOpen.value=!0,onHide:a[11]||=e=>(0,t.unref)(_).overflowOpen.value=!1},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{type:`button`,class:`ml-ribbon-overflow-trigger`,"aria-label":z.value.overflowTriggerAriaLabel,disabled:S.value},[...a[15]||=[(0,t.createElementVNode)(`span`,{class:`ml-ribbon-overflow-trigger__dots`},`...`,-1)]],8,pt)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,mt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(B.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:e.id,class:`ml-ribbon-overflow-group`},[(0,t.createElementVNode)(`header`,ht,(0,t.toDisplayString)(e.title),1),(0,t.createVNode)($,{group:e,"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[9]||=e=>G(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,ut)):(0,t.createCommentVNode)(``,!0),!(0,t.unref)(_).minimized.value&&b.value&&(0,t.unref)(_).layout.value===`simplified`?((0,t.openBlock)(),(0,t.createElementBlock)(`main`,{key:1,class:`ml-ribbon__panel ml-ribbon__panel--simplified`,"data-active-tab":b.value.id},[((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.ElPopover),{key:e.id,trigger:`click`,placement:`bottom-start`,width:340,disabled:S.value,"popper-class":I.value},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`button`,{class:`ml-ribbon-simplified-group`,type:`button`,disabled:S.value},[we(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)(we(e))))]),_:2},1024)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.title),1)],8,_t)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,vt,[(0,t.createVNode)($,{group:oe(e),"gallery-preview-fallback":z.value.galleryPreviewFallback,disabled:S.value,onItemClick:a[12]||=e=>G(e.groupId,e.itemId)},null,8,[`group`,`gallery-preview-fallback`,`disabled`])])]),_:2},1032,[`disabled`,`popper-class`]))),128))],8,gt)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(v,{open:(0,t.unref)(_).backdropOpen.value,size:F.value,"back-label":z.value.backstageBackLabel,title:z.value.backstageTitle,description:z.value.backstageDescription,onClose:ve},(0,t.createSlots)({_:2},[i.$slots.backstage?{name:`default`,fn:(0,t.withCtx)(()=>[(0,t.renderSlot)(i.$slots,`backstage`,{close:ve,open:(0,t.unref)(_).backdropOpen.value,size:F.value,backLabel:z.value.backstageBackLabel,title:z.value.backstageTitle,description:z.value.backstageDescription,disabled:(0,t.unref)(_).disabled.value})]),key:`0`}:void 0]),1032,[`open`,`size`,`back-label`,`title`,`description`])],10,Ze))]),_:3},8,[`size`]))}}),xt={class:`ml-ribbon-tab-definition`,hidden:``},St=(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`,xt,[(0,t.renderSlot)(e.$slots,`default`)]))}}),Ct={key:0,class:`ml-ribbon-keytips`,"aria-live":`polite`},wt={class:`ml-ribbon-keytips__hint`},Tt=(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`,Ct,[(0,t.createElementVNode)(`div`,wt,(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=bt,e.MlRibbonBackstage=v,e.MlRibbonButton=j,e.MlRibbonButtonGroup=ee,e.MlRibbonCollection=k,e.MlRibbonContextualTabs=E,e.MlRibbonDropdown=te,e.MlRibbonFileMenu=O,e.MlRibbonGallery=je,e.MlRibbonGroup=Xe,e.MlRibbonInputNumber=Y,e.MlRibbonItemHost=Ve,e.MlRibbonKeyTips=Tt,e.MlRibbonSegmented=Q,e.MlRibbonTab=St,e.MlRibbonTabs=x,e.MlRibbonTemplateItem=Re,e.MlRibbonToggleButton=Ie});
package/dist/types.d.ts CHANGED
@@ -59,6 +59,16 @@ export interface RibbonDropdownOption {
59
59
  /** When true, renders a divider line above this item (Element Plus `divided`). */
60
60
  divided?: boolean;
61
61
  }
62
+ /** Options for `RibbonItemModel` with `type: 'segmented'` (`props.options`). */
63
+ export interface RibbonSegmentedOption {
64
+ label?: string;
65
+ value: string | number | boolean;
66
+ disabled?: boolean;
67
+ icon?: string | Component;
68
+ iconClass?: string;
69
+ /** Tooltip for this segment; falls back to label then a humanized `value` string. */
70
+ tooltip?: string;
71
+ }
62
72
  export type RibbonGalleryPreview = string | Component;
63
73
  export interface RibbonGalleryItemModel {
64
74
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/ribbon",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "main": "./dist/ml-ribbon.es.js",
6
6
  "module": "./dist/ml-ribbon.es.js",