@wisemen/vue-core-actions 0.2.4 → 0.3.0

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.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./locales-w0AbiD0-.cjs");let t=require("vue"),n=require("vue-i18n"),r=require("pinia"),i=require("vue-router");function a(e,n){return(0,t.getCurrentScope)()?((0,t.onScopeDispose)(e,n),!0):!1}var o=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;var s=e=>e!=null,c=Object.prototype.toString,l=e=>c.call(e)===`[object Object]`,u=()=>{};function d(e,t){function n(...n){return new Promise((r,i)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(r).catch(i)})}return n}function f(e,n={}){let r,i,a=u,o=e=>{clearTimeout(e),a(),a=u},s;return c=>{let l=(0,t.toValue)(e),u=(0,t.toValue)(n.maxWait);return r&&o(r),l<=0||u!==void 0&&u<=0?(i&&=(o(i),void 0),Promise.resolve(c())):new Promise((e,t)=>{a=n.rejectOnCancel?t:e,s=c,u&&!i&&(i=setTimeout(()=>{r&&o(r),i=void 0,e(s())},u)),r=setTimeout(()=>{i&&o(i),i=void 0,e(c())},l)})}}function p(...e){let n=0,r,i=!0,a=u,o,s,c,l,d;!(0,t.isRef)(e[0])&&typeof e[0]==`object`?{delay:s,trailing:c=!0,leading:l=!0,rejectOnCancel:d=!1}=e[0]:[s,c=!0,l=!0,d=!1]=e;let f=()=>{r&&(clearTimeout(r),r=void 0,a(),a=u)};return e=>{let u=(0,t.toValue)(s),p=Date.now()-n,m=()=>o=e();return f(),u<=0?(n=Date.now(),m()):(p>u?(n=Date.now(),(l||!i)&&m()):c&&(o=new Promise((e,t)=>{a=d?t:e,r=setTimeout(()=>{n=Date.now(),i=!0,e(m()),f()},Math.max(0,u-p))})),!l&&!r&&(r=setTimeout(()=>i=!0,u)),i=!1,o)}}function m(e){return Array.isArray(e)?e:[e]}function h(e){return e||(0,t.getCurrentInstance)()}function g(e,t=200,n={}){return d(f(t,n),e)}function _(e,t=200,n=!1,r=!0,i=!1){return d(p(t,n,r,i),e)}function v(e,n=!0,r){h(r)?(0,t.onMounted)(e,r):n?e():(0,t.nextTick)(e)}function y(e,n){h(n)&&(0,t.onUnmounted)(e,n)}function b(e,n,r){return(0,t.watch)(e,n,{...r,immediate:!0})}function x(e,n,r){return(0,t.watch)(e,n,{...r,once:!0})}var S=o?window:void 0;o&&window.document,o&&window.navigator,o&&window.location;function C(e){let n=(0,t.toValue)(e);return n?.$el??n}function w(...e){let n=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),r=(0,t.computed)(()=>{let n=m((0,t.toValue)(e[0])).filter(e=>e!=null);return n.every(e=>typeof e!=`string`)?n:void 0});return b(()=>[r.value?.map(e=>C(e))??[S].filter(e=>e!=null),m((0,t.toValue)(r.value?e[1]:e[0])),m((0,t.unref)(r.value?e[2]:e[1])),(0,t.toValue)(r.value?e[3]:e[2])],([e,t,r,i],a,o)=>{if(!e?.length||!t?.length||!r?.length)return;let s=l(i)?{...i}:i,c=e.flatMap(e=>t.flatMap(t=>r.map(r=>n(e,t,r,s))));o(()=>{c.forEach(e=>e())})},{flush:`post`})}function T(){let e=(0,t.shallowRef)(!1),n=(0,t.getCurrentInstance)();return n&&(0,t.onMounted)(()=>{e.value=!0},n),e}function E(e){let n=T();return(0,t.computed)(()=>(n.value,!!e()))}function ee(e,n,r={}){let{window:i=S,...o}=r,c,l=E(()=>i&&`MutationObserver`in i),u=()=>{c&&=(c.disconnect(),void 0)},d=(0,t.watch)((0,t.computed)(()=>{let n=m((0,t.toValue)(e)).map(C).filter(s);return new Set(n)}),e=>{u(),l.value&&e.size&&(c=new MutationObserver(n),e.forEach(e=>c.observe(e,o)))},{immediate:!0,flush:`post`}),f=()=>c?.takeRecords(),p=()=>{d(),u()};return a(p),{isSupported:l,stop:p,takeRecords:f}}function D(e,n,r={}){let{root:i,rootMargin:o=`0px`,threshold:c=0,window:l=S,immediate:d=!0}=r,f=E(()=>l&&`IntersectionObserver`in l),p=(0,t.computed)(()=>m((0,t.toValue)(e)).map(C).filter(s)),h=u,g=(0,t.shallowRef)(d),_=f.value?(0,t.watch)(()=>[p.value,C(i),g.value],([e,t])=>{if(h(),!g.value||!e.length)return;let r=new IntersectionObserver(n,{root:C(t),rootMargin:o,threshold:c});e.forEach(e=>e&&r.observe(e)),h=()=>{r.disconnect(),h=u}},{immediate:d,flush:`post`}):u,v=()=>{h(),_(),g.value=!1};return a(v),{isSupported:f,isActive:g,pause(){h(),g.value=!1},resume(){g.value=!0},stop:v}}function O(e,n={}){let{window:r=S,scrollTarget:i,threshold:a=0,rootMargin:o,once:s=!1,initialValue:c=!1}=n,l=(0,t.shallowRef)(c),{stop:u}=D(e,e=>{let t=l.value,n=0;for(let r of e)r.time>=n&&(n=r.time,t=r.isIntersecting);l.value=t,s&&x(l,()=>{u()})},{root:i,window:r,threshold:a,rootMargin:(0,t.toValue)(o)});return l}function te(e){return typeof Window<`u`&&e instanceof Window?e.document.documentElement:typeof Document<`u`&&e instanceof Document?e.documentElement:e}var ne=1;function re(e,n={}){let{throttle:r=0,idle:i=200,onStop:a=u,onScroll:o=u,offset:s={left:0,right:0,top:0,bottom:0},observe:c={mutation:!1},eventListenerOptions:l={capture:!1,passive:!0},behavior:d=`auto`,window:f=S,onError:p=e=>{console.error(e)}}=n,m=typeof c==`boolean`?{mutation:c}:c,h=(0,t.shallowRef)(0),y=(0,t.shallowRef)(0),b=(0,t.computed)({get(){return h.value},set(e){T(e,void 0)}}),x=(0,t.computed)({get(){return y.value},set(e){T(void 0,e)}});function T(n,r){var i,a;if(!f)return;let o=(0,t.toValue)(e);if(!o)return;(i=o instanceof Document?f.document.body:o)==null||i.scrollTo({top:(0,t.toValue)(r)??x.value,left:(0,t.toValue)(n)??b.value,behavior:(0,t.toValue)(d)});let s=(o==null||(a=o.document)==null?void 0:a.documentElement)||o?.documentElement||o;b!=null&&(h.value=s.scrollLeft),x!=null&&(y.value=s.scrollTop)}let E=(0,t.shallowRef)(!1),D=(0,t.reactive)({left:!0,right:!1,top:!0,bottom:!1}),O=(0,t.reactive)({left:!1,right:!1,top:!1,bottom:!1}),te=e=>{E.value&&(E.value=!1,O.left=!1,O.right=!1,O.top=!1,O.bottom=!1,a(e))},re=g(te,r+i),k=e=>{var t;if(!f)return;let n=(e==null||(t=e.document)==null?void 0:t.documentElement)||e?.documentElement||C(e),{display:r,flexDirection:i,direction:a}=f.getComputedStyle(n),o=a===`rtl`?-1:1,c=n.scrollLeft;O.left=c<h.value,O.right=c>h.value;let l=Math.abs(c*o)<=(s.left||0),u=Math.abs(c*o)+n.clientWidth>=n.scrollWidth-(s.right||0)-ne;r===`flex`&&i===`row-reverse`?(D.left=u,D.right=l):(D.left=l,D.right=u),h.value=c;let d=n.scrollTop;e===f.document&&!d&&(d=f.document.body.scrollTop),O.top=d<y.value,O.bottom=d>y.value;let p=Math.abs(d)<=(s.top||0),m=Math.abs(d)+n.clientHeight>=n.scrollHeight-(s.bottom||0)-ne;r===`flex`&&i===`column-reverse`?(D.top=m,D.bottom=p):(D.top=p,D.bottom=m),y.value=d},ie=e=>{f&&(k(e.target.documentElement??e.target),E.value=!0,re(e),o(e))};return w(e,`scroll`,r?_(ie,r,!0,!1):ie,l),v(()=>{try{let n=(0,t.toValue)(e);if(!n)return;k(n)}catch(e){p(e)}}),m?.mutation&&e!=null&&e!==f&&e!==document&&ee(e,()=>{let n=(0,t.toValue)(e);n&&k(n)},{attributes:!0,childList:!0,subtree:!0}),w(e,`scrollend`,te,l),{x:b,y:x,isScrolling:E,arrivedState:D,directions:O,measure(){let n=(0,t.toValue)(e);f&&n&&k(n)}}}function k(e,n,r={}){let{direction:i=`bottom`,interval:a=100,canLoadMore:o=()=>!0}=r,s=(0,t.reactive)(re(e,{...r,offset:{[i]:r.distance??0,...r.offset}})),c=(0,t.ref)(),l=(0,t.computed)(()=>!!c.value),u=(0,t.computed)(()=>te((0,t.toValue)(e))),d=O(u),f=(0,t.computed)(()=>u.value?o(u.value):!1);function p(){if(s.measure(),!u.value||!d.value||!f.value)return;let{scrollHeight:e,clientHeight:r,scrollWidth:o,clientWidth:l}=u.value,m=i===`bottom`||i===`top`?e<=r:o<=l;(s.arrivedState[i]||m)&&(c.value||=Promise.all([n(s),new Promise(e=>setTimeout(e,a))]).finally(()=>{c.value=null,(0,t.nextTick)(()=>p())}))}return y((0,t.watch)(()=>[s.arrivedState[i],d.value,f.value],p,{immediate:!0})),{isLoading:l,reset(){(0,t.nextTick)(()=>p())}}}var ie=.24,ae=.85,oe=-.15,se=.05,ce=(0,t.shallowRef)(!1);function le(e){ce.value=e}function ue(e){return e}function A(e){return typeof e?.then==`function`}var de=/[\s\-_./]+/;async function fe(e,t,n,r){let i=t.searchInput.length,a=i>=0,o=he(e);if(a){let e=[],a=[],s=[...o];for(;s.length>0;){let n=s.shift();if(e.push(n),!M(n,t))continue;let r=L(n,t),o=i>=(r?.minLength??2);if(n.subActions!==void 0&&o){let e=r?.maxResults??99,i=n.subActions(t);if(Array.isArray(i)){let t=ge(i.slice(0,e),n);s.push(...t)}else if(pe(i)){let t=ge(i.actions.slice(0,e),n);s.push(...t)}else{let t=n;a.push(async()=>ge(await me(i,e),t))}}}if(a.length>0&&n!==void 0){n(j(e,t,r));let i=[...e];return await Promise.all(a.map(async e=>{let a=await e();i.push(...a),n(j(i,t,r))})),j(i,t,r)}let c=(await Promise.all(a.map(e=>e()))).flat();o=[...e,...c]}return j(o,t,r)}function j(e,t,n){let r=t.searchInput.length>=0,i=new Set,a=new Set,o=[];for(let n of e)if(M(n,t)){if(n.id!==void 0){if(a.has(n.id))continue;a.add(n.id)}if(n.key!==void 0){if(i.has(n.key))continue;i.add(n.key)}o.push(n)}if(r){let e=o.map(e=>({action:e,score:_e(e,t.searchInput,t)})).filter(({score:e})=>e>=ie);return e=e.toSorted((e,r)=>{let i=e.action.parentAction??n,a=r.action.parentAction??n,o=i?.showSelectedSubActionsFirst!==!1&&I(e.action,t)?0:1,s=a?.showSelectedSubActionsFirst!==!1&&I(r.action,t)?0:1;if(o!==s)return o-s;let c=Math.floor(e.score/se+1e-9),l=Math.floor(r.score/se+1e-9);if(c!==l)return l-c;let u=N(e.action,t),d=N(r.action,t);return u===d?r.score-e.score:u-d}),e.map(e=>e.action)}let s=n?.showSelectedSubActionsFirst!==!1;return o.sort((e,n)=>{let r=s&&I(e,t)?0:1,i=s&&I(n,t)?0:1;return r===i?N(e,t)-N(n,t):r-i})}function pe(e){return typeof e==`object`&&!!e&&`actions`in e&&`pagination`in e&&Array.isArray(e.actions)}async function me(e,t){if(A(e)){let n=await e;return pe(n)?n.actions.slice(0,t):n.slice(0,t)}if(e==null||!(Symbol.asyncIterator in e))return[];let n=[];for await(let r of e)if(n.push(r),n.length>=t)break;return n}function he(e){let t=[];for(let n of e)typeof n==`function`?t.push(...n()):t.push(n);return t}function ge(e,t){let n=t.rootAction??t;return e.map(e=>({...e,group:e.group===void 0&&t.group?.groupWhenLifted?t.group.groupWhenLifted:e.group,parentAction:t,rootAction:n,onlyVisibleThroughSearch:!0}))}function M(e,t){return!(!ce.value&&e.availableWhenUnauthenticated!==!0||e.isApplicable!==void 0&&!e.isApplicable(t)||t.menuType===`commandMenu`&&e.disabledReason!==void 0&&typeof e.disabledReason(t)==`string`||e.onlyVisibleThroughSearch&&t.menuType!==void 0&&t.searchInput.length===0)}function N(e,t){let n=e.group?.priority??null;return n===null?9999:typeof n==`function`?n(t):n}function _e(e,t,n){if(t.trim().length===0||e.skipFilterScoring)return 1;let r=F(e,n),i=ve(e,n);if(e.keywordsExactMatch){let t=Array.isArray(e.keywordsExactMatch)?e.keywordsExactMatch:[e.keywordsExactMatch];if(t.some(e=>r.toLowerCase().includes(e.toLowerCase()))||t.some(e=>i.toLowerCase().includes(e.toLowerCase())))return 1}let a=ye(r,t),o=ye(i,t)*ae,s=Math.max(a,o);return s<.24&&(r.toLowerCase().includes(t.toLowerCase())?s=.29:i.toLowerCase().includes(t.toLowerCase())&&(s=.245)),e.parentAction&&(s+=oe),e.scoreOverride!==void 0&&(s=e.scoreOverride),e.sortPriority!==void 0&&(s-=e.sortPriority*1e-4),s}function ve(e,t){let n=[],r=e.parentScoreInfluence??`all`;if(r!==`none`){let i=e.parentAction;if(r===`all`)for(;i;){let e=i.nameAsParent?typeof i.nameAsParent==`function`?i.nameAsParent(t):i.nameAsParent:F(i,t);n.push(e),i=i.parentAction}if(r===`direct`&&e.parentAction!==void 0){let r=e.parentAction,i=r.nameAsParent?typeof r.nameAsParent==`function`?r.nameAsParent(t):r.nameAsParent:F(r,t);n.push(i)}}if(n.push(F(e,t)),e.keywords!==void 0){let t=Array.isArray(e.keywords)?e.keywords:[e.keywords];n.push(...t)}return n.join(` `)}function ye(e,t){if(!e||!t)return 0;let n=e.toLowerCase().trim(),r=t.toLowerCase().trim();if(!r||n===r)return 1;if(n.startsWith(r))return .92-Math.min(.12,(n.length-r.length)*.002);let i=n.indexOf(r);if(i!==-1)return .82-Math.min(.12,i*.004);let a=n.split(de);if(a.some(e=>e.startsWith(r)))return .68;let o=a.map(e=>e[0]??``).join(``);if(o===r||o.startsWith(r))return .6;let s=n.length,c=r.length;if(c>s)return 0;let l=0,u=-1,d=-1,f=-1,p=0,m=0;for(let e=0;e<s&&l<c;e++)n[e]===r[l]&&(u===-1&&(u=e),d=e,l++,f===e-1?(p++,m+=p*.08):p=0,f=e);if(l<c)return 0;let h=d-u+1,g=(1-u/s)*.3+c/h*.35+c/s*.2+Math.min(m,.15);return Math.min(.55,Math.max(0,g))}function P(e,t){return typeof e==`function`?e(t):e}function F(e,t){return typeof e.name==`function`?e.name(t):e.name}function be(e,t){return typeof e.avatar==`function`?e.avatar(t):e.avatar??null}function xe(e,t){return typeof e.hint==`function`?e.hint(t):e.hint??null}function I(e,t){return typeof e.selected==`function`?e.selected(t):e.selected??null}function L(e,t){return typeof e.searchSubActionsConfig==`function`?e.searchSubActionsConfig(t):e.searchSubActionsConfig??null}function Se(e,t){return typeof e.preview==`function`?e.preview(t):null}function Ce({highlightedActionId:e,getContext:n,resolvedActions:r}){let i=(0,t.ref)(!1),a=(0,t.computed)(()=>{if(e.value===null||!i.value)return null;let t=r.value.find(t=>t.id===e.value)??null;return t===null?null:Se(t,n())});function o(){i.value=!0}function s(){i.value=!1}function c(e){if(!(e.target instanceof HTMLInputElement))return;let t=e.target;t.selectionStart===t.value.length&&e.key===`ArrowRight`&&(i.value=!0,e.preventDefault()),e.key===`ArrowLeft`&&i.value&&(i.value=!1,e.preventDefault()),e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`ArrowUp`&&e.key!==`ArrowDown`&&(i.value=!1)}return{preview:a,onHidePreview:s,onKeyDown:c,onShowPreview:o}}function we(e){let n=(0,t.ref)(!1),r=null;function i(){n.value=document.querySelector(e)!==null}return(0,t.onMounted)(()=>{i(),r=new MutationObserver(i),r.observe(document.body,{childList:!0,subtree:!0})}),(0,t.onBeforeUnmount)(()=>{r?.disconnect()}),n}async function Te(e,t,n){e.execute!==void 0&&(await e.execute(t),n?.onComplete?.())}function Ee(e){let t=new Set;return e.filter(e=>t.has(e)?!1:(t.add(e),!0))}var R=(0,r.defineStore)(`actionManager`,()=>{let e=(0,t.ref)([]),n=(0,t.ref)([]),r=(0,t.ref)({}),a=(0,i.useRouter)(),o=(0,i.useRoute)(),s=we(`[data-dialog]:not([data-command-menu])`);function c(e){r.value={...r.value,...e}}function l(e){let t={...r.value};delete t[e],r.value=t}function u(t){e.value=t}function d(e){n.value=e}function f(t){let i=Ee([...t.models??[],...n.value,...e.value]),c={...r.value,...t.metadata};return{getPaginationOffsetForSubActionId:e=>t.subActionsMeta?.[e]??null,hasActiveDialogs:()=>s.value,hasTargetedModelsOfType:e=>i.some(t=>t.modelName===e),isRouteActive:(e,t)=>t===void 0||t===!1?o.matched.some(t=>t.name===e):o.name===e,allModels:i,focusedModels:e.value,keyboardEvent:t.keyboardEvent,menuType:t.menuType,metadata:c,models:t.models??[],router:a,searchInput:t.searchInput??``,subActionsMeta:t.subActionsMeta,targetedModelOfType:e=>i.find(t=>t.modelName===e)??null,targetedModelOfTypeOrThrow:e=>{let t=i.find(t=>t.modelName===e)??null;if(t===null)throw Error(`Model of type: ${e} not found`);return t},targetedModelsOfType:e=>i.filter(t=>t.modelName===e)}}return{actionContext:f,executeAction:Te,focusedModels:e,metadata:r,registerMetadata:c,setFocusedModels:u,setViewModels:d,unregisterMetadata:l,viewModels:n}});function z(e){return typeof e==`object`&&!!e&&`actions`in e&&`pagination`in e&&Array.isArray(e.actions)}function B(e,t,n){return z(t)?(e.id&&(n[e.id]=t.pagination.nextOffset),t.actions):(e.id&&delete n[e.id],t)}async function De(e,t,n,r=297){if(e.subActions===void 0)return[];let i=e.subActions(t);if(Array.isArray(i)||z(i))return B(e,i,n);if(A(i))return B(e,await i,n);let a=[];for await(let e of i)if(a.push(e),a.length>=r)break;return a}function Oe({actions:e,metadata:r,models:i,parentAction:a,scrollContainerRef:o}){let s=(0,n.useI18n)(),c=R(),l=(0,t.ref)(null),u=(0,t.ref)(``),d=(0,t.ref)(``),f=(0,t.ref)(!1),p=(0,t.ref)([]),m=(0,t.ref)({}),h=(0,t.ref)(!0),_=0,v=(0,t.computed)(()=>c.actionContext({menuType:`contextualMenu`,metadata:r.value,models:i.value,searchInput:d.value})),{preview:y,onHidePreview:b,onKeyDown:x,onShowPreview:S}=Ce({highlightedActionId:l,getContext:()=>v.value,resolvedActions:p}),C=(0,t.computed)(()=>{if(a.value==null)return s.t(`search`);let e=L(a.value,v.value)?.placeholder;return e===void 0?s.t(`search`):typeof e==`function`?e():e});async function w(){let t=++_,n=v.value;try{let r=e.value;a.value?.subActions!==void 0&&(r=await De(a.value,n,m.value));let i=await fe(r,n,e=>{t!==_||e.length===0||(p.value=e)},a.value??void 0);if(t!==_)return;p.value=i,f.value=v.value.searchInput.trim().length>0}catch(e){throw console.error(`Error refreshing actions`,e),e}finally{t===_&&(h.value=!1)}}k(o,async()=>{let e=a.value;if(e?.subActions===void 0||e.id===void 0)return;let t=m.value[e.id];if(t==null)return;let n=c.actionContext({menuType:`contextualMenu`,metadata:r.value,models:i.value,searchInput:u.value,subActionsMeta:{[e.id]:t}}),o=e.subActions(n),s;if(Array.isArray(o)||z(o))s=o;else if(A(o))s=await o;else{let e=[];for await(let t of o)e.push(t);p.value=[...p.value,...e];return}p.value=[...p.value,...B(e,s,m.value)]},{canLoadMore:()=>{let e=a.value;return e?.subActions===void 0||e.id===void 0?!1:m.value[e.id]!=null},distance:100});let T=(0,t.computed)(()=>{let e=p.value.filter(e=>{let t=e.isApplicable===void 0||e.isApplicable(v.value),n=e.disabledReason?.(v.value)!=null;return t||n});if(f.value)return e.length>0?[e]:[];let t=[],n=[],r;for(let i of e)n.length>0&&i.separatorGroup!==r&&(t.push(n),n=[]),r=i.separatorGroup,n.push(i);return n.length>0&&t.push(n),t}),E=g(()=>{d.value=u.value,w()},80);return(0,t.watch)(u,()=>{m.value={},E()}),w(),{highlightedActionId:l,isLoading:h,actionGroups:T,context:v,placeholder:C,preview:y,searchInput:u,onHidePreview:b,onKeyDown:x,onShowPreview:S}}var ke=function(e){return e[e.HOVER=1]=`HOVER`,e[e.VIEW=2]=`VIEW`,e[e.MODEL=3]=`MODEL`,e[e.GENERAL=4]=`GENERAL`,e[e.NAVIGATION=5]=`NAVIGATION`,e[e.PREFERENCES=6]=`PREFERENCES`,e[e.SETTINGS=7]=`SETTINGS`,e[e.APPLICATION=8]=`APPLICATION`,e[e.ACCOUNT=9]=`ACCOUNT`,e[e.DEVELOPER=10]=`DEVELOPER`,e}({});function Ae(){let e=(0,n.useI18n)();return{account:{name:e.t(`action.group.account`),priority:9},application:{name:e.t(`action.group.application`),priority:8},developer:{name:e.t(`action.group.developer`),priority:10},general:{name:e.t(`action.group.general`),priority:4},navigation:{name:e.t(`action.group.navigation`),priority:5},preferences:{name:e.t(`action.group.preferences`),priority:6},settings:{name:e.t(`action.group.settings`),priority:7}}}var je=Symbol(`HotkeysContext`);function Me(){return(0,t.inject)(je,null)?.defaultOptions??{}}function V(){if(typeof navigator>`u`)return`linux`;let e=navigator.platform?.toLowerCase()??``,t=navigator.userAgent?.toLowerCase()??``;return e.includes(`mac`)||t.includes(`mac`)?`mac`:e.includes(`win`)||t.includes(`win`)?`windows`:`linux`}var H=[`Control`,`Alt`,`Shift`,`Meta`];new Set(H);var U={Control:`Control`,Ctrl:`Control`,control:`Control`,ctrl:`Control`,Shift:`Shift`,shift:`Shift`,Alt:`Alt`,Option:`Alt`,alt:`Alt`,option:`Alt`,Command:`Meta`,Cmd:`Meta`,Meta:`Meta`,command:`Meta`,cmd:`Meta`,meta:`Meta`,OS:`Meta`,os:`Meta`,Win:`Meta`,win:`Meta`,CommandOrControl:`Mod`,Mod:`Mod`,commandorcontrol:`Mod`,mod:`Mod`};function Ne(e,t=V()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var Pe=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),Fe=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),Ie=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),Le=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),Re=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),ze=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),Be={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Semicolon:`;`,Slash:`/`};[...Pe,...Fe,...Ie,...Le,...Re,...ze];var Ve={Esc:`Escape`,esc:`Escape`,escape:`Escape`,Return:`Enter`,return:`Enter`,enter:`Enter`," ":`Space`,space:`Space`,Spacebar:`Space`,spacebar:`Space`,tab:`Tab`,backspace:`Backspace`,Del:`Delete`,del:`Delete`,delete:`Delete`,Up:`ArrowUp`,up:`ArrowUp`,arrowup:`ArrowUp`,Down:`ArrowDown`,down:`ArrowDown`,arrowdown:`ArrowDown`,Left:`ArrowLeft`,left:`ArrowLeft`,arrowleft:`ArrowLeft`,Right:`ArrowRight`,right:`ArrowRight`,arrowright:`ArrowRight`,home:`Home`,end:`End`,pageup:`PageUp`,pagedown:`PageDown`,PgUp:`PageUp`,PgDn:`PageDown`,pgup:`PageUp`,pgdn:`PageDown`};function He(e){return/^\p{Letter}$/u.test(e)}function W(e){if(!e)return``;if(e in Ve)return Ve[e];if(He(e)){let t=e.toUpperCase();return t.length===1?t:e}let t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}function G(e,t=V()){let n=e.split(`+`),r=new Set,i=``;for(let e=0;e<n.length;e++){let a=n[e].trim();if(e===n.length-1)i=W(a);else{let e=U[a]??U[a.toLowerCase()];if(e){let n=Ne(e,t);r.add(n)}else n.length===1&&(i=W(a))}}return!i&&n.length>0&&(i=W(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:H.filter(e=>r.has(e))}}function Ue(e,t=V()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(Ne(`Mod`,t)===`Control`?n=!0:a=!0);let o=H.filter(e=>{switch(e){case`Control`:return n;case`Shift`:return r;case`Alt`:return i;case`Meta`:return a;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:i,meta:a,modifiers:o}}function We(e,t){let n=t===`mac`?e.meta&&!e.ctrl:e.ctrl&&!e.meta,r=[];if(n)r.push(`Mod`),e.alt&&r.push(`Alt`),e.shift&&r.push(`Shift`);else for(let t of H)e.modifiers.includes(t)&&r.push(t);return r.push(W(e.key)),r.join(`+`)}function Ge(e,t=V()){return We(G(e,t),t)}function Ke(e,t=V()){return We(e,t)}function qe(e,t=V()){return typeof e==`string`?Ge(e,t):Ke(Ue(e,t),t)}function Je(e){return e in U||e.toLowerCase()in U}function Ye(e){return e.join(` `)}function Xe(e){let t=[];for(let n of H)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function K(e,t,n=V()){let r=typeof t==`string`?G(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=W(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(He(i)&&(/^[A-Za-z]$/.test(i)||!e.altKey))return!1}if(e.code&&(i===`Dead`||i.length===1&&a.length===1)){if(e.code.startsWith(`Key`)){let t=e.code.slice(3);if(t.length===1&&/^[A-Za-z]$/.test(t))return t.toUpperCase()===a.toUpperCase()}if(e.code.startsWith(`Digit`)){let t=e.code.slice(5);if(t.length===1&&/^[0-9]$/.test(t))return t===a}return e.code in Be?Be[e.code]===a:!1}return i===a}var Ze={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function Qe(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function $e(e){if(!e)return!1;if(e instanceof HTMLInputElement){let t=e.type.toLowerCase();return!(t===`button`||t===`submit`||t===`reset`)}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function et(e){return typeof document>`u`?null:typeof Document<`u`&&e instanceof Document||typeof Node<`u`&&e.nodeType===Node.DOCUMENT_NODE?e.activeElement:typeof HTMLElement<`u`&&e instanceof HTMLElement?e.ownerDocument.activeElement??null:e.document.activeElement??null}function tt(e,t,n){let r=et(t);return r&&$e(r)&&r!==n||e.composedPath().some(e=>$e(e)&&e!==n)?!0:$e(e.target)&&e.target!==n}function nt(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))}function rt(e,t,n,r){if(n!==`allow`){if(n===`warn`){console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(n===`error`)throw Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}var q=function(e){return e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e}({});function it({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&(q.RecursedCheck|q.Recursed|q.Dirty|q.Pending)?a&(q.RecursedCheck|q.Recursed)?a&q.RecursedCheck?!(a&(q.Dirty|q.Pending))&&c(e,i)?(i.flags=a|(q.Recursed|q.Pending),a&=q.Mutable):a=q.None:i.flags=a&~q.Recursed|q.Pending:a=q.None:i.flags=a|q.Pending,a&q.Watching&&t(i),a&q.Mutable){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&q.Dirty)a=!0;else if((c&(q.Mutable|q.Dirty))===(q.Mutable|q.Dirty)){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&(q.Mutable|q.Pending))===(q.Mutable|q.Pending)){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=~q.Pending;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&(q.Pending|q.Dirty))===q.Pending&&(n.flags=r|q.Dirty,(r&(q.Watching|q.RecursedCheck))===q.Watching&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function at(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var ot=[],J=0,{link:st,unlink:ct,propagate:lt,checkDirty:ut,shallowPropagate:dt}=it({update(e){return e._update()},notify(e){ot[ft++]=e,e.flags&=~q.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=q.Mutable|q.Dirty,Z(e))}}),Y=0,ft=0,X,pt=0;function Z(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=ct(n,e)}function mt(){if(!(pt>0)){for(;Y<ft;){let e=ot[Y];ot[Y++]=void 0,e.notify()}Y=0,ft=0}}function ht(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?q.None:q.Mutable,get(){return X!==void 0&&st(i,X,J),i._snapshot},subscribe(e){let t=at(e),n={current:!1},r=gt(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=X,o=t?.compare??Object.is;if(n)X=i,++J,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=q.Mutable|q.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{X=a,n&&(i.flags&=~q.RecursedCheck),Z(i)}}};return n?(i.flags=q.Mutable|q.Dirty,i.get=function(){let e=i.flags;if(e&q.Dirty||e&q.Pending&&ut(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&dt(e)}}else e&q.Pending&&(i.flags=e&~q.Pending);return X!==void 0&&st(i,X,J),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(lt(e),dt(e),mt())}},i}function gt(e){let t=()=>{let t=X;X=n,++J,n.depsTail=void 0,n.flags=q.Watching|q.RecursedCheck;try{return e()}finally{X=t,n.flags&=~q.RecursedCheck,Z(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:q.Watching|q.RecursedCheck,notify(){let e=this.flags;e&q.Dirty||e&q.Pending&&ut(this.deps,this)?t():this.flags=q.Watching},stop(){this.flags=q.None,this.depsTail=void 0,Z(this)}};return t(),n}var _t=class{constructor(e,t){this.atom=ht(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(at(e))}},vt=0;function yt(){return`hotkey_${++vt}`}var bt=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new _t(new Map),this.#t=V()}static getInstance(){return e.#e||=new e,e.#e}static resetInstance(){e.#e&&=(e.#e.destroy(),null)}register(e,t,n={}){if(typeof document>`u`&&!n.target){let e=t;return{id:yt(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=yt(),i=n.platform??this.#t,a=typeof e==`string`?G(e,i):Ue(e,i),o=typeof e==`string`?e:Xe(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&rt(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??Qe(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...Ze,requireReset:!1,...n,platform:i,ignoreInputs:u},hasFired:!1,triggerCount:0,target:s};this.registrations.setState(e=>new Map(e).set(r,d)),this.#r.has(s)||this.#r.set(s,new Set),this.#r.get(s).add(r),this.#a(s);let f=this;return{get id(){return r},unregister:()=>{f.#i(r)},get callback(){return f.registrations.state.get(r)?.callback??t},set callback(e){let t=f.registrations.state.get(r);t&&(t.callback=e)},setOptions:e=>{f.registrations.setState(t=>{let n=t.get(r);if(n){let i=new Map(t);return i.set(r,{...n,options:{...n.options,...e}}),i}return t})},get isActive(){return f.registrations.state.has(r)}}}#i(e){let t=this.registrations.state.get(e);if(!t)return;let n=t.target;this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),r.size===0&&this.#o(n))}#a(e){if(typeof document>`u`||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener(`keydown`,t),e.addEventListener(`keyup`,n),this.#n.set(e,{keydown:t,keyup:n})}#o(e){if(typeof document>`u`)return;let t=this.#n.get(e);t&&(e.removeEventListener(`keydown`,t.keydown),e.removeEventListener(`keyup`,t.keyup),this.#n.delete(e),this.#r.delete(e))}#s(e,t,n){let r=this.#r.get(t);if(r)for(let i of r){let r=this.registrations.state.get(i);if(r&&nt(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&tt(e,t,r.target)))if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;K(e,r.parsedHotkey,r.options.platform)&&(r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation(),(!r.options.requireReset||!r.hasFired)&&(this.#c(r,e),r.options.requireReset&&(r.hasFired=!0)))}else r.options.eventType===`keyup`&&K(e,r.parsedHotkey,r.options.platform)&&this.#c(r,e),r.options.requireReset&&r.hasFired&&this.#f(r,e)&&(r.hasFired=!1)}}#c(e,t){e.options.preventDefault&&t.preventDefault(),e.options.stopPropagation&&t.stopPropagation(),e.triggerCount++,this.registrations.setState(e=>new Map(e));let n={hotkey:e.hotkey,parsedHotkey:e.parsedHotkey};e.callback(t,n)}#l(e){return t=>{this.#s(t,e,`keydown`)}}#u(e){return t=>{this.#s(t,e,`keyup`)}}#d(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&n.target===t)return n;return null}#f(e,t){let n=e.parsedHotkey,r=W(t.key),i=n.key.length===1?n.key.toUpperCase():n.key;return!!((r.length===1?r.toUpperCase():r)===i||n.ctrl&&r===`Control`||n.shift&&r===`Shift`||n.alt&&r===`Alt`||n.meta&&r===`Meta`)}triggerRegistration(e){let t=this.registrations.state.get(e);if(!t)return!1;let n=t.parsedHotkey,r=new KeyboardEvent(t.options.eventType??`keydown`,{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});return t.triggerCount++,this.registrations.setState(e=>new Map(e)),t.callback(r,{hotkey:t.hotkey,parsedHotkey:t.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&(t===void 0||n.target===t))return!0;return!1}destroy(){for(let e of this.#n.keys())this.#o(e);this.registrations.setState(()=>new Map),this.#n.clear(),this.#r.clear()}};function xt(){return bt.getInstance()}var St=1e3,Ct=0;function wt(){return`sequence_${++Ct}`}function Tt(e){return e.join(`|`)}function Et(e){let t=e.parsedSequence.length,n=e.currentIndex>0&&e.currentIndex<t;return{id:e.id,sequence:e.sequence,options:e.options,target:e.target,triggerCount:e.triggerCount,hasFired:e.hasFired,matchedStepCount:n?e.currentIndex:0,partialMatchLastKeyTime:n?e.lastKeyTime:0}}var Dt=class e{static#e=null;#t=new Map;#n=new Map;#r=new Map;#i;constructor(){this.registrations=new _t(new Map),this.#i=V()}static getInstance(){return e.#e||=new e,e.#e}static resetInstance(){e.#e&&=(e.#e.destroy(),null)}#a(e){this.registrations.setState(t=>new Map(t).set(e.id,Et(e)))}register(e,t,n={}){if(e.length===0)throw Error(`Sequence must contain at least one hotkey`);let r=wt(),i=n.platform??this.#i,a=e.map(e=>G(e,i)),o=n.target??(typeof document<`u`?document:{}),s=n.conflictBehavior??`warn`,c=this.#f(e,o);c&&rt(c.id,Ye(e),s,e=>this.#o(e));let l=a[0],u=n.ignoreInputs??Qe(l),d={id:r,sequence:e,parsedSequence:a,callback:t,options:{...Ze,timeout:St,...n,platform:i,ignoreInputs:u},target:o,currentIndex:0,lastKeyTime:0,triggerCount:0,hasFired:!1};this.#t.set(r,d),this.registrations.setState(e=>new Map(e).set(r,Et(d))),this.#r.has(o)||this.#r.set(o,new Set),this.#r.get(o).add(r),this.#s(o);let f=this;return{get id(){return r},get isActive(){return f.#t.has(r)},get callback(){return f.#t.get(r)?.callback??t},set callback(e){let t=f.#t.get(r);t&&(t.callback=e)},setOptions:e=>{let t=f.#t.get(r);t&&(t.options={...t.options,...e},f.registrations.setState(e=>new Map(e).set(r,Et(t))))},unregister:()=>{f.#o(r)}}}#o(e){let t=this.#t.get(e);if(!t)return;let n=t.target;this.#t.delete(e),this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),r.size===0&&this.#c(n))}#s(e){if(typeof document>`u`||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener(`keydown`,t),e.addEventListener(`keyup`,n),this.#n.set(e,{keydown:t,keyup:n})}#c(e){if(typeof document>`u`)return;let t=this.#n.get(e);t&&(e.removeEventListener(`keydown`,t.keydown),e.removeEventListener(`keyup`,t.keyup),this.#n.delete(e),this.#r.delete(e))}#l(e){return t=>{this.#d(t,e,`keydown`)}}#u(e){return t=>{this.#d(t,e,`keyup`)}}#d(e,t,n){if(Je(W(e.key)))return;let r=this.#r.get(t);if(!r)return;let i=Date.now();registrationIds:for(let a of r){let r=this.#t.get(a);if(!r||!nt(e,t)||!r.options.enabled)continue;if(r.options.ignoreInputs!==!1&&tt(e,t,r.target))continue registrationIds;if(r.options.eventType!==n)continue;let o=r.options.timeout??1e3;r.currentIndex>0&&i-r.lastKeyTime>o&&(r.currentIndex=0,this.#a(r));let s=r.parsedSequence[r.currentIndex];if(s){if(K(e,s,r.options.platform))if(r.lastKeyTime=i,r.currentIndex++,r.currentIndex>=r.parsedSequence.length){r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation();let t={hotkey:r.sequence.join(` `),parsedHotkey:r.parsedSequence[r.parsedSequence.length-1]};r.triggerCount++,r.hasFired=!0,r.currentIndex=0,this.#a(r),r.callback(e,t)}else this.#a(r);else if(r.currentIndex>0){let t=r.parsedSequence[0];K(e,t,r.options.platform)?(r.currentIndex=1,r.lastKeyTime=i):r.currentIndex=0,this.#a(r)}}}}#f(e,t){let n=Tt(e);for(let e of this.#t.values())if(Tt(e.sequence)===n&&e.target===t)return e;return null}resetAll(){for(let e of this.#t.values())e.currentIndex=0,e.lastKeyTime=0,this.#a(e)}triggerSequence(e){let t=this.#t.get(e);if(!t)return!1;let n=t.parsedSequence[t.parsedSequence.length-1];if(!n)return!1;let r=new KeyboardEvent(t.options.eventType??`keydown`,{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});t.triggerCount++,t.hasFired=!0,this.#a(t);let i={hotkey:t.sequence.join(` `),parsedHotkey:n};return t.callback(r,i),!0}getRegistrationCount(){return this.#t.size}destroy(){for(let e of this.#n.keys())this.#c(e);this.#t.clear(),this.registrations.setState(()=>new Map)}};function Ot(){return Dt.getInstance()}function kt(e,n={}){let r=Me(),i=xt(),a=new Map,o=(0,t.watch)(()=>{let t=Q(e),i=Q(n);return t.map((e,t)=>{let n=Q(e.hotkey),a=e.options?Q(e.options):{},o={...r.hotkey,...i,...a},s=qe(n,o.platform??V()),c=o.enabled===void 0?void 0:Q(o.enabled),l=o.target===void 0?void 0:Q(o.target);return{index:t,hotkeyString:s,callback:e.callback,mergedOptions:o,resolvedEnabled:c,resolvedTarget:l}})},e=>{let t=new Set,n=[];for(let r of e){let e=r.resolvedTarget??(typeof document<`u`?document:null);if(!e)continue;let i=`${r.index}:${r.hotkeyString}`;t.add(i),n.push({registrationKey:i,entry:r,finalTarget:e})}for(let[e,n]of[...a.entries()])t.has(e)||(n.handle.isActive&&n.handle.unregister(),a.delete(e));for(let{registrationKey:e,entry:t,finalTarget:r}of n){let n=a.get(e);if(n?.handle.isActive&&n.target===r){n.handle.callback=t.callback;let{target:e,enabled:r,...i}=t.mergedOptions,a={...i,...t.resolvedEnabled===void 0?{}:{enabled:t.resolvedEnabled}};n.handle.setOptions(a);continue}n&&(n.handle.isActive&&n.handle.unregister(),a.delete(e));let{target:o,enabled:s,...c}=t.mergedOptions,l={...c,...t.resolvedEnabled===void 0?{}:{enabled:t.resolvedEnabled}},u=i.register(t.hotkeyString,t.callback,{...l,target:r});a.set(e,{handle:u,target:r})}},{immediate:!0});(0,t.onUnmounted)(()=>{o();for(let{handle:e}of a.values())e.isActive&&e.unregister();a.clear()})}function Q(e){return typeof e==`function`?e():(0,t.unref)(e)}function At(e,n={}){let r=Me(),i=Ot(),a=new Map,o=(0,t.watch)(()=>{let t=$(e),i=$(n);return t.map((e,t)=>{let n=$(e.sequence),a=e.options?$(e.options):{},o={...r.hotkeySequence,...i,...a},s=Ye(n),c=o.enabled===void 0?void 0:$(o.enabled),l=o.target===void 0?void 0:$(o.target);return{index:t,resolvedSequence:n,sequenceString:s,callback:e.callback,mergedOptions:o,resolvedEnabled:c,resolvedTarget:l}})},e=>{let t=new Set,n=[];for(let r of e){if(r.resolvedSequence.length===0)continue;let e=r.resolvedTarget??(typeof document<`u`?document:null);if(!e)continue;let i=`${r.index}:${r.sequenceString}`;t.add(i),n.push({registrationKey:i,entry:r,finalTarget:e})}for(let[e,n]of[...a.entries()])t.has(e)||(n.handle.isActive&&n.handle.unregister(),a.delete(e));for(let{registrationKey:e,entry:t,finalTarget:r}of n){let n=a.get(e);if(n?.handle.isActive&&n.target===r){n.handle.callback=t.callback;let{target:e,enabled:r,...i}=t.mergedOptions,a={...i,...t.resolvedEnabled===void 0?{}:{enabled:t.resolvedEnabled}};n.handle.setOptions(a);continue}n&&(n.handle.isActive&&n.handle.unregister(),a.delete(e));let{target:o,enabled:s,...c}=t.mergedOptions,l={...c,...t.resolvedEnabled===void 0?{}:{enabled:t.resolvedEnabled}},u=i.register(t.resolvedSequence,t.callback,{...l,target:r});a.set(e,{handle:u,target:r})}},{immediate:!0});(0,t.onUnmounted)(()=>{o();for(let{handle:e}of a.values())e.isActive&&e.unregister();a.clear()})}function $(e){return typeof e==`function`?e():(0,t.unref)(e)}var jt=(0,r.defineStore)(`actionRegistry`,()=>{let e=(0,t.ref)([]),n=(0,t.ref)(new Map),r=1;function i(){return[...e.value,...n.value.values().map(e=>e)]}function a(...t){e.value.push(...t)}function o(e){let i=r++;return n.value.set(i,(0,t.markRaw)(e)),i}function s(e){n.value.delete(e)}return{allActions:i,registerActions:a,registerTemporaryAction:o,unregisterAction:s}});function*Mt(e,t){for(let n of e){if(yield n,n.subActionsHaveKeyboardShortcuts!==!0||n.subActions===void 0)continue;let e=n.subActions(t);Array.isArray(e)?yield*Mt(e,t):typeof e==`object`&&e&&`actions`in e&&Array.isArray(e.actions)&&(yield*Mt(e.actions,t))}}function Nt(e){return[e.key,e.alt===!0?`alt`:``,e.ctrl===!0?`ctrl`:``,e.meta===!0?`meta`:``,e.mod===!0?`mod`:``,e.shift===!0?`shift`:``].filter(Boolean).join(`+`)}function Pt(e){let t=jt(),n=R();function r(t){return()=>{let r=e?e():n.actionContext({});for(let e=t.length-1;e>=0;e--){let n=t[e];if(!M(n,r))continue;let i=n.execute?.(r);i instanceof Promise&&i.catch(e=>{console.error(`[useActionShortcuts] action.execute threw:`,e)});return}}}kt(()=>{let i=new Map,a=e?e():n.actionContext({});for(let e of Mt(t.allActions(),a)){if(e.keyboardShortcut===void 0||`sequence`in e.keyboardShortcut)continue;let t=e.keyboardShortcut,n=Nt(t);i.has(n)||i.set(n,[]),i.get(n).push(e)}return Array.from(i.values()).map(e=>{let t=e[0].keyboardShortcut;return{callback:r(e),hotkey:{key:t.key,...t.alt!==void 0&&{alt:t.alt},...t.ctrl!==void 0&&{ctrl:t.ctrl},...t.meta!==void 0&&{meta:t.meta},...t.mod!==void 0&&{mod:t.mod},...t.shift!==void 0&&{shift:t.shift}},options:{ignoreInputs:!t.runWithInputFocus,preventDefault:!0,stopPropagation:!0}}})},{conflictBehavior:`allow`}),At(()=>{let i=new Map,a=e?e():n.actionContext({});for(let e of Mt(t.allActions(),a)){if(e.keyboardShortcut===void 0||!(`sequence`in e.keyboardShortcut))continue;let t=e.keyboardShortcut.sequence.join(`,`);i.has(t)||i.set(t,[]),i.get(t).push(e)}return Array.from(i.values()).map(e=>{let t=e[0].keyboardShortcut;return{callback:r(e),options:{ignoreInputs:!t.runWithInputFocus,preventDefault:!0,stopPropagation:!0},sequence:t.sequence}})},{conflictBehavior:`allow`})}function Ft({actionsSnapshot:e,focusedModelsSnapshot:n,listboxContentRef:r,listboxRootRef:i,manager:a,navStack:o,searchInput:s}){let c=(0,t.ref)(!1),l=(0,t.ref)(!1),u=(0,t.shallowRef)([]),d=(0,t.ref)({}),f=0,p=(0,t.computed)(()=>r.value?.$el);function m(e){return a.actionContext({menuType:`commandMenu`,models:n,searchInput:s.value,subActionsMeta:e})}async function h(){let t=++f;l.value=!1,c.value=!0;try{let n=m(),r;if(o.value.length>0){let e=o.value.at(-1);r=e.parentAction.subActions===void 0?e.actions:await De(e.parentAction,n,d.value)}else r=e;let i=await fe(r,n,e=>{t===f&&e.length>0&&(u.value=e)},o.value.at(-1)?.parentAction);t===f&&(u.value=i)}catch(e){throw console.error(`Error refreshing actions`,e),e}finally{t===f&&(c.value=!1)}}let _=g(h,80);return(0,t.watch)(s,()=>{d.value={},l.value=!0,(r.value?.$el)?.scrollTo({behavior:`instant`,top:0}),_()}),(0,t.watch)(u,(e,t)=>{if(e.length===0)return;let n=i.value?.$el;setTimeout(()=>{(n?.querySelector(`[data-highlighted]`)??null)===null&&i.value?.highlightFirstItem()}),t.length===0&&setTimeout(()=>{(r.value?.$el)?.scrollTo({behavior:`instant`,top:0})})}),k(p,async()=>{let e=o.value.at(-1)?.parentAction;if(e?.subActions===void 0||e.id===void 0)return;let t=d.value[e.id];if(t==null)return;let n=m({[e.id]:t}),r=e.subActions(n),i;if(Array.isArray(r)||z(r))i=r;else if(A(r))i=await r;else{let e=[];for await(let t of r)e.push(t);u.value=[...u.value,...e];return}u.value=[...u.value,...B(e,i,d.value)]},{canLoadMore:()=>{let e=o.value.at(-1)?.parentAction;return e?.subActions===void 0||e.id===void 0?!1:d.value[e.id]!=null},distance:40}),{isDebouncing:l,isLoadingActions:c,buildContext:m,refreshActions:h,resolvedActions:u,subActionsMetaMap:d}}function It(e,n){let r=(0,t.ref)(!1),i=(0,t.ref)(!1),a=null;return(0,t.watch)(e,e=>{e||(i.value=!1)}),(0,t.watch)(n,()=>{i.value=!0,a!==null&&(clearTimeout(a),r.value=!1),(0,t.nextTick)(()=>{r.value=!0,a=setTimeout(()=>{r.value=!1},250)})}),{hasNavigated:i,isBouncing:r}}function Lt({isShiftKeyHeld:e,buildContext:r,emit:i,listboxRootRef:a,manager:o,navStack:s,refreshActions:c,resolvedActions:l,scrollToTopOfGroup:u,searchInput:d,subActionsMetaMap:f}){let p=(0,n.useI18n)(),m=(0,t.ref)(null),h=(0,t.computed)(()=>s.value.at(-1)?.parentAction??null),g=(0,t.computed)(()=>{let e=r();return s.value.filter(e=>e.parentAction.forceAsRootMenu!==!0).map(t=>{let n=t.parentAction;return n.nameAsParent===void 0?P(n.name,e):typeof n.nameAsParent==`function`?n.nameAsParent(e):n.nameAsParent})}),_=(0,t.computed)(()=>{if(h.value===null)return p.t(`type_a_command_or_search`);let e=L(h.value,r())?.placeholder;return e===void 0?p.t(`search`):typeof e==`function`?e():e}),{preview:v,onKeyDown:y}=Ce({highlightedActionId:m,getContext:r,resolvedActions:l});async function b(t){let n=r();if(!t.disabledReason?.(n)){if(t.execute!==void 0){o.executeAction(t,n),(!(h.value?.multiSelectSubActions??!1)||!e.value)&&i(`close`);return}t.subActions!==void 0&&(s.value.push({actions:[],parentAction:t,savedActiveAction:t,savedResolvedActions:l.value,savedSearchInput:d.value}),f.value={},d.value=``,l.value=[],await c())}}async function x(){let e=s.value.pop()??null;e!==null&&(d.value=e.savedSearchInput,l.value=e.savedResolvedActions,await c(),e.savedActiveAction!==null&&a.value?.highlightItem(e.savedActiveAction.id))}function S(e){e.key===`Backspace`&&!e.repeat&&d.value===``&&s.value.length>0&&(e.preventDefault(),x()),(e.key===`ArrowDown`||e.key===`ArrowUp`)&&u(),y(e)}return{highlightedActionId:m,activateAction:b,breadcrumbs:g,currentParent:h,placeholder:_,preview:v,restoreParentFrame:x,onKeyDown:S}}function Rt(e,t){let n=[],r=e.parentAction??null;for(;r!==null;){if(r.forceAsRootMenu===!0)return n;let e=r.nameAsParent===void 0?F(r,t):P(r.nameAsParent,t);n.unshift({icon:r.icon?.(t)??null,label:e}),r=r.parentAction??null}return n.slice(-1)}function zt(e){let n=R(),r=(0,t.ref)(!1);function i(){r.value=!0,n.setFocusedModels([...n.focusedModels,...e.value])}function a(){r.value=!1,n.setFocusedModels(n.focusedModels.filter(t=>!e.value.some(e=>e.key===t.key)))}return(0,t.watch)(e,(t,i)=>{r.value&&n.setFocusedModels([...n.focusedModels.filter(e=>!i.some(t=>t.key===e.key)),...e.value])}),(0,t.onBeforeUnmount)(()=>{a()}),{register:i,unregister:a}}function Bt(e,n,r=!1){let i=jt(),a=[];function o(){a.length>0||(a=(Array.isArray(e)?e:[e]).map(e=>i.registerTemporaryAction(c(e))))}function s(){for(let e of a)i.unregisterAction(e);a=[]}function c(e){return n===void 0?e:{...e,group:{...e.group,priority:n}}}return r||o(),(0,t.onBeforeUnmount)(()=>{s()}),{register:o,unregister:s}}function Vt(e,n){let r=R();function i(){n===`focused`?r.setFocusedModels([...r.focusedModels,...e.value]):r.setViewModels([...r.viewModels,...e.value])}function a(){n===`focused`?r.setFocusedModels(r.focusedModels.filter(t=>!e.value.some(e=>e.key===t.key))):r.setViewModels(r.viewModels.filter(t=>!e.value.some(e=>e.key===t.key)))}(0,t.watch)(e,()=>{a(),i()}),i(),(0,t.onBeforeUnmount)(()=>{a()})}function Ht(e){Vt(e,`view`)}var Ut=0,Wt=new WeakMap;function Gt(e,t){return e===void 0?`no-group`:e.name?P(e.name,t):(Wt.has(e)||Wt.set(e,`unnamed-${Ut++}`),Wt.get(e))}function Kt(e,t){let n=new Map;for(let r of e){let e=r.group,i=Gt(e,t),a=n.get(i);if(a===void 0){let r=e?.name?P(e.name,t):null;a={category:e?.category?P(e.category,t):null,icon:e?.icon?.(t)??null,items:[],key:i,label:r,showIfOnlyGroup:e?.showIfOnlyGroup??!1},n.set(i,a)}a.items.push(r)}return[...n.values()]}exports.GroupPriority=ke,exports.actionsLocales=e.t,exports.applicableActions=fe,exports.buildCommandMenuGroups=Kt,exports.createAction=ue,exports.isAuthenticated=ce,exports.isSubActionsWithMeta=z,exports.resolveActionAvatar=be,exports.resolveActionBreadcrumbs=Rt,exports.resolveActionHint=xe,exports.resolveActionName=F,exports.resolveActionPreview=Se,exports.resolveActionSelected=I,exports.resolveActionValue=P,exports.resolveApplicable=M,exports.resolveSearchSubActionsConfig=L,exports.resolveSubActions=De,exports.setIsAuthenticated=le,exports.storeSubActionsPagination=B,exports.useActionDropdownMenuContent=Oe,exports.useActionGroup=Ae,exports.useActionManagerStore=R,exports.useActionPreview=Ce,exports.useActionRegistryStore=jt,exports.useActionShortcuts=Pt,exports.useCommandMenuActions=Ft,exports.useCommandMenuAnimation=It,exports.useCommandMenuNavigation=Lt,exports.useFocusedModels=zt,exports.useTemporaryActions=Bt,exports.useViewModels=Ht;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./locales-w0AbiD0-.cjs");let t=require("vue"),n=require("vue-i18n"),r=require("pinia"),i=require("vue-router");function a(e,n){return(0,t.getCurrentScope)()?((0,t.onScopeDispose)(e,n),!0):!1}var o=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;var s=e=>e!=null,c=Object.prototype.toString,l=e=>c.call(e)===`[object Object]`,u=()=>{};function d(e,t){function n(...n){return new Promise((r,i)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(r).catch(i)})}return n}function f(e,n={}){let r,i,a=u,o=e=>{clearTimeout(e),a(),a=u},s;return c=>{let l=(0,t.toValue)(e),u=(0,t.toValue)(n.maxWait);return r&&o(r),l<=0||u!==void 0&&u<=0?(i&&=(o(i),void 0),Promise.resolve(c())):new Promise((e,t)=>{a=n.rejectOnCancel?t:e,s=c,u&&!i&&(i=setTimeout(()=>{r&&o(r),i=void 0,e(s())},u)),r=setTimeout(()=>{i&&o(i),i=void 0,e(c())},l)})}}function p(...e){let n=0,r,i=!0,a=u,o,s,c,l,d;!(0,t.isRef)(e[0])&&typeof e[0]==`object`?{delay:s,trailing:c=!0,leading:l=!0,rejectOnCancel:d=!1}=e[0]:[s,c=!0,l=!0,d=!1]=e;let f=()=>{r&&(clearTimeout(r),r=void 0,a(),a=u)};return e=>{let u=(0,t.toValue)(s),p=Date.now()-n,m=()=>o=e();return f(),u<=0?(n=Date.now(),m()):(p>u?(n=Date.now(),(l||!i)&&m()):c&&(o=new Promise((e,t)=>{a=d?t:e,r=setTimeout(()=>{n=Date.now(),i=!0,e(m()),f()},Math.max(0,u-p))})),!l&&!r&&(r=setTimeout(()=>i=!0,u)),i=!1,o)}}function m(e){return Array.isArray(e)?e:[e]}function h(e){return e||(0,t.getCurrentInstance)()}function g(e,t=200,n={}){return d(f(t,n),e)}function _(e,t=200,n=!1,r=!0,i=!1){return d(p(t,n,r,i),e)}function v(e,n=!0,r){h(r)?(0,t.onMounted)(e,r):n?e():(0,t.nextTick)(e)}function y(e,n){h(n)&&(0,t.onUnmounted)(e,n)}function b(e,n,r){return(0,t.watch)(e,n,{...r,immediate:!0})}function x(e,n,r){return(0,t.watch)(e,n,{...r,once:!0})}var S=o?window:void 0;o&&window.document,o&&window.navigator,o&&window.location;function C(e){let n=(0,t.toValue)(e);return n?.$el??n}function w(...e){let n=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),r=(0,t.computed)(()=>{let n=m((0,t.toValue)(e[0])).filter(e=>e!=null);return n.every(e=>typeof e!=`string`)?n:void 0});return b(()=>[r.value?.map(e=>C(e))??[S].filter(e=>e!=null),m((0,t.toValue)(r.value?e[1]:e[0])),m((0,t.unref)(r.value?e[2]:e[1])),(0,t.toValue)(r.value?e[3]:e[2])],([e,t,r,i],a,o)=>{if(!e?.length||!t?.length||!r?.length)return;let s=l(i)?{...i}:i,c=e.flatMap(e=>t.flatMap(t=>r.map(r=>n(e,t,r,s))));o(()=>{c.forEach(e=>e())})},{flush:`post`})}function T(){let e=(0,t.shallowRef)(!1),n=(0,t.getCurrentInstance)();return n&&(0,t.onMounted)(()=>{e.value=!0},n),e}function E(e){let n=T();return(0,t.computed)(()=>(n.value,!!e()))}function ee(e,n,r={}){let{window:i=S,...o}=r,c,l=E(()=>i&&`MutationObserver`in i),u=()=>{c&&=(c.disconnect(),void 0)},d=(0,t.watch)((0,t.computed)(()=>{let n=m((0,t.toValue)(e)).map(C).filter(s);return new Set(n)}),e=>{u(),l.value&&e.size&&(c=new MutationObserver(n),e.forEach(e=>c.observe(e,o)))},{immediate:!0,flush:`post`}),f=()=>c?.takeRecords(),p=()=>{d(),u()};return a(p),{isSupported:l,stop:p,takeRecords:f}}function D(e,n,r={}){let{root:i,rootMargin:o=`0px`,threshold:c=0,window:l=S,immediate:d=!0}=r,f=E(()=>l&&`IntersectionObserver`in l),p=(0,t.computed)(()=>m((0,t.toValue)(e)).map(C).filter(s)),h=u,g=(0,t.shallowRef)(d),_=f.value?(0,t.watch)(()=>[p.value,C(i),g.value],([e,t])=>{if(h(),!g.value||!e.length)return;let r=new IntersectionObserver(n,{root:C(t),rootMargin:o,threshold:c});e.forEach(e=>e&&r.observe(e)),h=()=>{r.disconnect(),h=u}},{immediate:d,flush:`post`}):u,v=()=>{h(),_(),g.value=!1};return a(v),{isSupported:f,isActive:g,pause(){h(),g.value=!1},resume(){g.value=!0},stop:v}}function O(e,n={}){let{window:r=S,scrollTarget:i,threshold:a=0,rootMargin:o,once:s=!1,initialValue:c=!1}=n,l=(0,t.shallowRef)(c),{stop:u}=D(e,e=>{let t=l.value,n=0;for(let r of e)r.time>=n&&(n=r.time,t=r.isIntersecting);l.value=t,s&&x(l,()=>{u()})},{root:i,window:r,threshold:a,rootMargin:(0,t.toValue)(o)});return l}function te(e){return typeof Window<`u`&&e instanceof Window?e.document.documentElement:typeof Document<`u`&&e instanceof Document?e.documentElement:e}var ne=1;function re(e,n={}){let{throttle:r=0,idle:i=200,onStop:a=u,onScroll:o=u,offset:s={left:0,right:0,top:0,bottom:0},observe:c={mutation:!1},eventListenerOptions:l={capture:!1,passive:!0},behavior:d=`auto`,window:f=S,onError:p=e=>{console.error(e)}}=n,m=typeof c==`boolean`?{mutation:c}:c,h=(0,t.shallowRef)(0),y=(0,t.shallowRef)(0),b=(0,t.computed)({get(){return h.value},set(e){T(e,void 0)}}),x=(0,t.computed)({get(){return y.value},set(e){T(void 0,e)}});function T(n,r){var i,a;if(!f)return;let o=(0,t.toValue)(e);if(!o)return;(i=o instanceof Document?f.document.body:o)==null||i.scrollTo({top:(0,t.toValue)(r)??x.value,left:(0,t.toValue)(n)??b.value,behavior:(0,t.toValue)(d)});let s=(o==null||(a=o.document)==null?void 0:a.documentElement)||o?.documentElement||o;b!=null&&(h.value=s.scrollLeft),x!=null&&(y.value=s.scrollTop)}let E=(0,t.shallowRef)(!1),D=(0,t.reactive)({left:!0,right:!1,top:!0,bottom:!1}),O=(0,t.reactive)({left:!1,right:!1,top:!1,bottom:!1}),te=e=>{E.value&&(E.value=!1,O.left=!1,O.right=!1,O.top=!1,O.bottom=!1,a(e))},re=g(te,r+i),k=e=>{var t;if(!f)return;let n=(e==null||(t=e.document)==null?void 0:t.documentElement)||e?.documentElement||C(e),{display:r,flexDirection:i,direction:a}=f.getComputedStyle(n),o=a===`rtl`?-1:1,c=n.scrollLeft;O.left=c<h.value,O.right=c>h.value;let l=Math.abs(c*o)<=(s.left||0),u=Math.abs(c*o)+n.clientWidth>=n.scrollWidth-(s.right||0)-ne;r===`flex`&&i===`row-reverse`?(D.left=u,D.right=l):(D.left=l,D.right=u),h.value=c;let d=n.scrollTop;e===f.document&&!d&&(d=f.document.body.scrollTop),O.top=d<y.value,O.bottom=d>y.value;let p=Math.abs(d)<=(s.top||0),m=Math.abs(d)+n.clientHeight>=n.scrollHeight-(s.bottom||0)-ne;r===`flex`&&i===`column-reverse`?(D.top=m,D.bottom=p):(D.top=p,D.bottom=m),y.value=d},ie=e=>{f&&(k(e.target.documentElement??e.target),E.value=!0,re(e),o(e))};return w(e,`scroll`,r?_(ie,r,!0,!1):ie,l),v(()=>{try{let n=(0,t.toValue)(e);if(!n)return;k(n)}catch(e){p(e)}}),m?.mutation&&e!=null&&e!==f&&e!==document&&ee(e,()=>{let n=(0,t.toValue)(e);n&&k(n)},{attributes:!0,childList:!0,subtree:!0}),w(e,`scrollend`,te,l),{x:b,y:x,isScrolling:E,arrivedState:D,directions:O,measure(){let n=(0,t.toValue)(e);f&&n&&k(n)}}}function k(e,n,r={}){let{direction:i=`bottom`,interval:a=100,canLoadMore:o=()=>!0}=r,s=(0,t.reactive)(re(e,{...r,offset:{[i]:r.distance??0,...r.offset}})),c=(0,t.ref)(),l=(0,t.computed)(()=>!!c.value),u=(0,t.computed)(()=>te((0,t.toValue)(e))),d=O(u),f=(0,t.computed)(()=>u.value?o(u.value):!1);function p(){if(s.measure(),!u.value||!d.value||!f.value)return;let{scrollHeight:e,clientHeight:r,scrollWidth:o,clientWidth:l}=u.value,m=i===`bottom`||i===`top`?e<=r:o<=l;(s.arrivedState[i]||m)&&(c.value||=Promise.all([n(s),new Promise(e=>setTimeout(e,a))]).finally(()=>{c.value=null,(0,t.nextTick)(()=>p())}))}return y((0,t.watch)(()=>[s.arrivedState[i],d.value,f.value],p,{immediate:!0})),{isLoading:l,reset(){(0,t.nextTick)(()=>p())}}}var ie=.24,ae=.85,oe=-.15,se=.05,ce=(0,t.shallowRef)(!1);function le(e){ce.value=e}function ue(e){return e}function A(e){return typeof e?.then==`function`}var de=/[\s\-_./]+/;async function fe(e,t,n,r){let i=t.searchInput.length,a=i>=0,o=he(e);if(a){let e=[],a=[],s=[...o];for(;s.length>0;){let n=s.shift();if(e.push(n),!M(n,t))continue;let r=L(n,t),o=i>=(r?.minLength??2);if(n.subActions!==void 0&&o){let e=r?.maxResults??99,i=n.subActions(t);if(Array.isArray(i)){let t=ge(i.slice(0,e),n);s.push(...t)}else if(pe(i)){let t=ge(i.actions.slice(0,e),n);s.push(...t)}else{let t=n;a.push(async()=>ge(await me(i,e),t))}}}if(a.length>0&&n!==void 0){n(j(e,t,r));let i=[...e];return await Promise.all(a.map(async e=>{let a=await e();i.push(...a),n(j(i,t,r))})),j(i,t,r)}let c=(await Promise.all(a.map(e=>e()))).flat();o=[...e,...c]}return j(o,t,r)}function j(e,t,n){let r=t.searchInput.length>=0,i=new Set,a=new Set,o=[];for(let n of e)if(M(n,t)){if(n.id!==void 0){if(a.has(n.id))continue;a.add(n.id)}if(n.key!==void 0){if(i.has(n.key))continue;i.add(n.key)}o.push(n)}if(r){let e=o.map(e=>({action:e,score:_e(e,t.searchInput,t)})).filter(({score:e})=>e>=ie);return e=e.toSorted((e,r)=>{let i=e.action.parentAction??n,a=r.action.parentAction??n,o=i?.showSelectedSubActionsFirst!==!1&&I(e.action,t)?0:1,s=a?.showSelectedSubActionsFirst!==!1&&I(r.action,t)?0:1;if(o!==s)return o-s;let c=Math.floor(e.score/se+1e-9),l=Math.floor(r.score/se+1e-9);if(c!==l)return l-c;let u=N(e.action,t),d=N(r.action,t);return u===d?r.score-e.score:u-d}),e.map(e=>e.action)}let s=n?.showSelectedSubActionsFirst!==!1;return o.sort((e,n)=>{let r=s&&I(e,t)?0:1,i=s&&I(n,t)?0:1;return r===i?N(e,t)-N(n,t):r-i})}function pe(e){return typeof e==`object`&&!!e&&`actions`in e&&`pagination`in e&&Array.isArray(e.actions)}async function me(e,t){if(A(e)){let n=await e;return pe(n)?n.actions.slice(0,t):n.slice(0,t)}if(e==null||!(Symbol.asyncIterator in e))return[];let n=[];for await(let r of e)if(n.push(r),n.length>=t)break;return n}function he(e){let t=[];for(let n of e)typeof n==`function`?t.push(...n()):t.push(n);return t}function ge(e,t){let n=t.rootAction??t;return e.map(e=>({...e,group:e.group===void 0&&t.group?.groupWhenLifted?t.group.groupWhenLifted:e.group,parentAction:t,rootAction:n,onlyVisibleThroughSearch:!0}))}function M(e,t){return!(!ce.value&&e.availableWhenUnauthenticated!==!0||e.isApplicable!==void 0&&!e.isApplicable(t)||t.menuType===`commandMenu`&&e.disabledReason!==void 0&&typeof e.disabledReason(t)==`string`||e.onlyVisibleThroughSearch&&t.menuType!==void 0&&t.searchInput.length===0)}function N(e,t){let n=e.group?.priority??null;return n===null?9999:typeof n==`function`?n(t):n}function _e(e,t,n){if(t.trim().length===0||e.skipFilterScoring)return 1;let r=F(e,n),i=ve(e,n);if(e.keywordsExactMatch){let t=Array.isArray(e.keywordsExactMatch)?e.keywordsExactMatch:[e.keywordsExactMatch];if(t.some(e=>r.toLowerCase().includes(e.toLowerCase()))||t.some(e=>i.toLowerCase().includes(e.toLowerCase())))return 1}let a=ye(r,t),o=ye(i,t)*ae,s=Math.max(a,o);return s<.24&&(r.toLowerCase().includes(t.toLowerCase())?s=.29:i.toLowerCase().includes(t.toLowerCase())&&(s=.245)),e.parentAction&&(s+=oe),e.scoreOverride!==void 0&&(s=e.scoreOverride),e.sortPriority!==void 0&&(s-=e.sortPriority*1e-4),s}function ve(e,t){let n=[],r=e.parentScoreInfluence??`all`;if(r!==`none`){let i=e.parentAction;if(r===`all`)for(;i;){let e=i.nameAsParent?typeof i.nameAsParent==`function`?i.nameAsParent(t):i.nameAsParent:F(i,t);n.push(e),i=i.parentAction}if(r===`direct`&&e.parentAction!==void 0){let r=e.parentAction,i=r.nameAsParent?typeof r.nameAsParent==`function`?r.nameAsParent(t):r.nameAsParent:F(r,t);n.push(i)}}if(n.push(F(e,t)),e.keywords!==void 0){let t=Array.isArray(e.keywords)?e.keywords:[e.keywords];n.push(...t)}return n.join(` `)}function ye(e,t){if(!e||!t)return 0;let n=e.toLowerCase().trim(),r=t.toLowerCase().trim();if(!r||n===r)return 1;if(n.startsWith(r))return .92-Math.min(.12,(n.length-r.length)*.002);let i=n.indexOf(r);if(i!==-1)return .82-Math.min(.12,i*.004);let a=n.split(de);if(a.some(e=>e.startsWith(r)))return .68;let o=a.map(e=>e[0]??``).join(``);if(o===r||o.startsWith(r))return .6;let s=n.length,c=r.length;if(c>s)return 0;let l=0,u=-1,d=-1,f=-1,p=0,m=0;for(let e=0;e<s&&l<c;e++)n[e]===r[l]&&(u===-1&&(u=e),d=e,l++,f===e-1?(p++,m+=p*.08):p=0,f=e);if(l<c)return 0;let h=d-u+1,g=(1-u/s)*.3+c/h*.35+c/s*.2+Math.min(m,.15);return Math.min(.55,Math.max(0,g))}function P(e,t){return typeof e==`function`?e(t):e}function F(e,t){return typeof e.name==`function`?e.name(t):e.name}function be(e,t){return typeof e.avatar==`function`?e.avatar(t):e.avatar??null}function xe(e,t){return typeof e.hint==`function`?e.hint(t):e.hint??null}function I(e,t){return typeof e.selected==`function`?e.selected(t):e.selected??null}function L(e,t){return typeof e.searchSubActionsConfig==`function`?e.searchSubActionsConfig(t):e.searchSubActionsConfig??null}function Se(e,t){return typeof e.preview==`function`?e.preview(t):null}function Ce({highlightedActionId:e,getContext:n,resolvedActions:r}){let i=(0,t.ref)(!1),a=(0,t.computed)(()=>{if(e.value===null||!i.value)return null;let t=r.value.find(t=>t.id===e.value)??null;return t===null?null:Se(t,n())});function o(){i.value=!0}function s(){i.value=!1}function c(e){if(!(e.target instanceof HTMLInputElement))return;let t=e.target;t.selectionStart===t.value.length&&e.key===`ArrowRight`&&(i.value=!0,e.preventDefault()),e.key===`ArrowLeft`&&i.value&&(i.value=!1,e.preventDefault()),e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`ArrowUp`&&e.key!==`ArrowDown`&&(i.value=!1)}return{preview:a,onHidePreview:s,onKeyDown:c,onShowPreview:o}}function we(e){let n=(0,t.ref)(!1),r=null;function i(){n.value=document.querySelector(e)!==null}return(0,t.onMounted)(()=>{i(),r=new MutationObserver(i),r.observe(document.body,{childList:!0,subtree:!0})}),(0,t.onBeforeUnmount)(()=>{r?.disconnect()}),n}async function Te(e,t,n){e.execute!==void 0&&(await e.execute(t),n?.onComplete?.())}function Ee(e){let t=new Set;return e.filter(e=>t.has(e)?!1:(t.add(e),!0))}var R=(0,r.defineStore)(`actionManager`,()=>{let e=(0,t.ref)([]),n=(0,t.ref)([]),r=(0,t.ref)([]),a=(0,t.ref)(null),o=(0,t.ref)({}),s=(0,i.useRouter)(),c=(0,i.useRoute)(),l=we(`[data-dialog]:not([data-command-menu])`);function u(e){o.value={...o.value,...e}}function d(e){let t={...o.value};delete t[e],o.value=t}function f(t){e.value=t}function p(e){n.value=e}function m(e){r.value=e}function h(e){a.value=e}function g(){a.value={items:[],type:`include`}}function _(t){let i=Ee([...t.models??[],...r.value,...n.value,...e.value]),u={...o.value,...t.metadata};return{getPaginationOffsetForSubActionId:e=>t.subActionsMeta?.[e]??null,hasActiveDialogs:()=>l.value,hasTargetedModelsOfType:e=>i.some(t=>t.modelName===e),isRouteActive:(e,t)=>t===void 0||t===!1?c.matched.some(t=>t.name===e):c.name===e,allModels:i,clearTableSelection:g,focusedModels:e.value,keyboardEvent:t.keyboardEvent,menuType:t.menuType,metadata:u,models:t.models??[],router:s,searchInput:t.searchInput??``,selectedModels:r.value,subActionsMeta:t.subActionsMeta,tableSelection:a.value,targetedModelOfType:e=>i.find(t=>t.modelName===e)??null,targetedModelOfTypeOrThrow:e=>{let t=i.find(t=>t.modelName===e)??null;if(t===null)throw Error(`Model of type: ${e} not found`);return t},targetedModelsOfType:e=>i.filter(t=>t.modelName===e)}}return{actionContext:_,clearTableSelection:g,executeAction:Te,focusedModels:e,metadata:o,registerMetadata:u,selectedModels:r,setFocusedModels:f,setSelectedModels:m,setTableSelection:h,setViewModels:p,tableSelection:a,unregisterMetadata:d,viewModels:n}});function z(e){return typeof e==`object`&&!!e&&`actions`in e&&`pagination`in e&&Array.isArray(e.actions)}function B(e,t,n){return z(t)?(e.id&&(n[e.id]=t.pagination.nextOffset),t.actions):(e.id&&delete n[e.id],t)}async function De(e,t,n,r=297){if(e.subActions===void 0)return[];let i=e.subActions(t);if(Array.isArray(i)||z(i))return B(e,i,n);if(A(i))return B(e,await i,n);let a=[];for await(let e of i)if(a.push(e),a.length>=r)break;return a}function Oe({actions:e,metadata:r,models:i,parentAction:a,scrollContainerRef:o}){let s=(0,n.useI18n)(),c=R(),l=(0,t.ref)(null),u=(0,t.ref)(``),d=(0,t.ref)(``),f=(0,t.ref)(!1),p=(0,t.ref)([]),m=(0,t.ref)({}),h=(0,t.ref)(!0),_=0,v=(0,t.computed)(()=>c.actionContext({menuType:`contextualMenu`,metadata:r.value,models:i.value,searchInput:d.value})),{preview:y,onHidePreview:b,onKeyDown:x,onShowPreview:S}=Ce({highlightedActionId:l,getContext:()=>v.value,resolvedActions:p}),C=(0,t.computed)(()=>{if(a.value==null)return s.t(`search`);let e=L(a.value,v.value)?.placeholder;return e===void 0?s.t(`search`):typeof e==`function`?e():e});async function w(){let t=++_,n=v.value;try{let r=e.value;a.value?.subActions!==void 0&&(r=await De(a.value,n,m.value));let i=await fe(r,n,e=>{t!==_||e.length===0||(p.value=e)},a.value??void 0);if(t!==_)return;p.value=i,f.value=v.value.searchInput.trim().length>0}catch(e){throw console.error(`Error refreshing actions`,e),e}finally{t===_&&(h.value=!1)}}k(o,async()=>{let e=a.value;if(e?.subActions===void 0||e.id===void 0)return;let t=m.value[e.id];if(t==null)return;let n=c.actionContext({menuType:`contextualMenu`,metadata:r.value,models:i.value,searchInput:u.value,subActionsMeta:{[e.id]:t}}),o=e.subActions(n),s;if(Array.isArray(o)||z(o))s=o;else if(A(o))s=await o;else{let e=[];for await(let t of o)e.push(t);p.value=[...p.value,...e];return}p.value=[...p.value,...B(e,s,m.value)]},{canLoadMore:()=>{let e=a.value;return e?.subActions===void 0||e.id===void 0?!1:m.value[e.id]!=null},distance:100});let T=(0,t.computed)(()=>{let e=p.value.filter(e=>{let t=e.isApplicable===void 0||e.isApplicable(v.value),n=e.disabledReason?.(v.value)!=null;return t||n});if(f.value)return e.length>0?[e]:[];let t=[],n=[],r;for(let i of e)n.length>0&&i.separatorGroup!==r&&(t.push(n),n=[]),r=i.separatorGroup,n.push(i);return n.length>0&&t.push(n),t}),E=g(()=>{d.value=u.value,w()},80);return(0,t.watch)(u,()=>{m.value={},E()}),w(),{highlightedActionId:l,isLoading:h,actionGroups:T,context:v,placeholder:C,preview:y,searchInput:u,onHidePreview:b,onKeyDown:x,onShowPreview:S}}var ke=function(e){return e[e.HOVER=1]=`HOVER`,e[e.VIEW=2]=`VIEW`,e[e.MODEL=3]=`MODEL`,e[e.GENERAL=4]=`GENERAL`,e[e.NAVIGATION=5]=`NAVIGATION`,e[e.PREFERENCES=6]=`PREFERENCES`,e[e.SETTINGS=7]=`SETTINGS`,e[e.APPLICATION=8]=`APPLICATION`,e[e.ACCOUNT=9]=`ACCOUNT`,e[e.DEVELOPER=10]=`DEVELOPER`,e}({});function Ae(){let e=(0,n.useI18n)();return{account:{name:e.t(`action.group.account`),priority:9},application:{name:e.t(`action.group.application`),priority:8},developer:{name:e.t(`action.group.developer`),priority:10},general:{name:e.t(`action.group.general`),priority:4},navigation:{name:e.t(`action.group.navigation`),priority:5},preferences:{name:e.t(`action.group.preferences`),priority:6},settings:{name:e.t(`action.group.settings`),priority:7}}}var je=Symbol(`HotkeysContext`);function Me(){return(0,t.inject)(je,null)?.defaultOptions??{}}function V(){if(typeof navigator>`u`)return`linux`;let e=navigator.platform?.toLowerCase()??``,t=navigator.userAgent?.toLowerCase()??``;return e.includes(`mac`)||t.includes(`mac`)?`mac`:e.includes(`win`)||t.includes(`win`)?`windows`:`linux`}var H=[`Control`,`Alt`,`Shift`,`Meta`];new Set(H);var U={Control:`Control`,Ctrl:`Control`,control:`Control`,ctrl:`Control`,Shift:`Shift`,shift:`Shift`,Alt:`Alt`,Option:`Alt`,alt:`Alt`,option:`Alt`,Command:`Meta`,Cmd:`Meta`,Meta:`Meta`,command:`Meta`,cmd:`Meta`,meta:`Meta`,OS:`Meta`,os:`Meta`,Win:`Meta`,win:`Meta`,CommandOrControl:`Mod`,Mod:`Mod`,commandorcontrol:`Mod`,mod:`Mod`};function Ne(e,t=V()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var Pe=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),Fe=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),Ie=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),Le=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),Re=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),ze=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),Be={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Semicolon:`;`,Slash:`/`};[...Pe,...Fe,...Ie,...Le,...Re,...ze];var Ve={Esc:`Escape`,esc:`Escape`,escape:`Escape`,Return:`Enter`,return:`Enter`,enter:`Enter`," ":`Space`,space:`Space`,Spacebar:`Space`,spacebar:`Space`,tab:`Tab`,backspace:`Backspace`,Del:`Delete`,del:`Delete`,delete:`Delete`,Up:`ArrowUp`,up:`ArrowUp`,arrowup:`ArrowUp`,Down:`ArrowDown`,down:`ArrowDown`,arrowdown:`ArrowDown`,Left:`ArrowLeft`,left:`ArrowLeft`,arrowleft:`ArrowLeft`,Right:`ArrowRight`,right:`ArrowRight`,arrowright:`ArrowRight`,home:`Home`,end:`End`,pageup:`PageUp`,pagedown:`PageDown`,PgUp:`PageUp`,PgDn:`PageDown`,pgup:`PageUp`,pgdn:`PageDown`};function He(e){return/^\p{Letter}$/u.test(e)}function W(e){if(!e)return``;if(e in Ve)return Ve[e];if(He(e)){let t=e.toUpperCase();return t.length===1?t:e}let t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}function G(e,t=V()){let n=e.split(`+`),r=new Set,i=``;for(let e=0;e<n.length;e++){let a=n[e].trim();if(e===n.length-1)i=W(a);else{let e=U[a]??U[a.toLowerCase()];if(e){let n=Ne(e,t);r.add(n)}else n.length===1&&(i=W(a))}}return!i&&n.length>0&&(i=W(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:H.filter(e=>r.has(e))}}function Ue(e,t=V()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(Ne(`Mod`,t)===`Control`?n=!0:a=!0);let o=H.filter(e=>{switch(e){case`Control`:return n;case`Shift`:return r;case`Alt`:return i;case`Meta`:return a;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:i,meta:a,modifiers:o}}function We(e,t){let n=t===`mac`?e.meta&&!e.ctrl:e.ctrl&&!e.meta,r=[];if(n)r.push(`Mod`),e.alt&&r.push(`Alt`),e.shift&&r.push(`Shift`);else for(let t of H)e.modifiers.includes(t)&&r.push(t);return r.push(W(e.key)),r.join(`+`)}function Ge(e,t=V()){return We(G(e,t),t)}function Ke(e,t=V()){return We(e,t)}function qe(e,t=V()){return typeof e==`string`?Ge(e,t):Ke(Ue(e,t),t)}function Je(e){return e in U||e.toLowerCase()in U}function Ye(e){return e.join(` `)}function Xe(e){let t=[];for(let n of H)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function K(e,t,n=V()){let r=typeof t==`string`?G(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=W(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(He(i)&&(/^[A-Za-z]$/.test(i)||!e.altKey))return!1}if(e.code&&(i===`Dead`||i.length===1&&a.length===1)){if(e.code.startsWith(`Key`)){let t=e.code.slice(3);if(t.length===1&&/^[A-Za-z]$/.test(t))return t.toUpperCase()===a.toUpperCase()}if(e.code.startsWith(`Digit`)){let t=e.code.slice(5);if(t.length===1&&/^[0-9]$/.test(t))return t===a}return e.code in Be?Be[e.code]===a:!1}return i===a}var Ze={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function Qe(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function $e(e){if(!e)return!1;if(e instanceof HTMLInputElement){let t=e.type.toLowerCase();return!(t===`button`||t===`submit`||t===`reset`)}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function et(e){return typeof document>`u`?null:typeof Document<`u`&&e instanceof Document||typeof Node<`u`&&e.nodeType===Node.DOCUMENT_NODE?e.activeElement:typeof HTMLElement<`u`&&e instanceof HTMLElement?e.ownerDocument.activeElement??null:e.document.activeElement??null}function tt(e,t,n){let r=et(t);return r&&$e(r)&&r!==n||e.composedPath().some(e=>$e(e)&&e!==n)?!0:$e(e.target)&&e.target!==n}function nt(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))}function rt(e,t,n,r){if(n!==`allow`){if(n===`warn`){console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(n===`error`)throw Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}var q=function(e){return e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e}({});function it({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&(q.RecursedCheck|q.Recursed|q.Dirty|q.Pending)?a&(q.RecursedCheck|q.Recursed)?a&q.RecursedCheck?!(a&(q.Dirty|q.Pending))&&c(e,i)?(i.flags=a|(q.Recursed|q.Pending),a&=q.Mutable):a=q.None:i.flags=a&~q.Recursed|q.Pending:a=q.None:i.flags=a|q.Pending,a&q.Watching&&t(i),a&q.Mutable){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&q.Dirty)a=!0;else if((c&(q.Mutable|q.Dirty))===(q.Mutable|q.Dirty)){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&(q.Mutable|q.Pending))===(q.Mutable|q.Pending)){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=~q.Pending;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&(q.Pending|q.Dirty))===q.Pending&&(n.flags=r|q.Dirty,(r&(q.Watching|q.RecursedCheck))===q.Watching&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function at(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var ot=[],J=0,{link:st,unlink:ct,propagate:lt,checkDirty:ut,shallowPropagate:dt}=it({update(e){return e._update()},notify(e){ot[ft++]=e,e.flags&=~q.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=q.Mutable|q.Dirty,Z(e))}}),Y=0,ft=0,X,pt=0;function Z(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=ct(n,e)}function mt(){if(!(pt>0)){for(;Y<ft;){let e=ot[Y];ot[Y++]=void 0,e.notify()}Y=0,ft=0}}function ht(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?q.None:q.Mutable,get(){return X!==void 0&&st(i,X,J),i._snapshot},subscribe(e){let t=at(e),n={current:!1},r=gt(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=X,o=t?.compare??Object.is;if(n)X=i,++J,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=q.Mutable|q.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{X=a,n&&(i.flags&=~q.RecursedCheck),Z(i)}}};return n?(i.flags=q.Mutable|q.Dirty,i.get=function(){let e=i.flags;if(e&q.Dirty||e&q.Pending&&ut(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&dt(e)}}else e&q.Pending&&(i.flags=e&~q.Pending);return X!==void 0&&st(i,X,J),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(lt(e),dt(e),mt())}},i}function gt(e){let t=()=>{let t=X;X=n,++J,n.depsTail=void 0,n.flags=q.Watching|q.RecursedCheck;try{return e()}finally{X=t,n.flags&=~q.RecursedCheck,Z(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:q.Watching|q.RecursedCheck,notify(){let e=this.flags;e&q.Dirty||e&q.Pending&&ut(this.deps,this)?t():this.flags=q.Watching},stop(){this.flags=q.None,this.depsTail=void 0,Z(this)}};return t(),n}var _t=class{constructor(e,t){this.atom=ht(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(at(e))}},vt=0;function yt(){return`hotkey_${++vt}`}var bt=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new _t(new Map),this.#t=V()}static getInstance(){return e.#e||=new e,e.#e}static resetInstance(){e.#e&&=(e.#e.destroy(),null)}register(e,t,n={}){if(typeof document>`u`&&!n.target){let e=t;return{id:yt(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=yt(),i=n.platform??this.#t,a=typeof e==`string`?G(e,i):Ue(e,i),o=typeof e==`string`?e:Xe(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&rt(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??Qe(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...Ze,requireReset:!1,...n,platform:i,ignoreInputs:u},hasFired:!1,triggerCount:0,target:s};this.registrations.setState(e=>new Map(e).set(r,d)),this.#r.has(s)||this.#r.set(s,new Set),this.#r.get(s).add(r),this.#a(s);let f=this;return{get id(){return r},unregister:()=>{f.#i(r)},get callback(){return f.registrations.state.get(r)?.callback??t},set callback(e){let t=f.registrations.state.get(r);t&&(t.callback=e)},setOptions:e=>{f.registrations.setState(t=>{let n=t.get(r);if(n){let i=new Map(t);return i.set(r,{...n,options:{...n.options,...e}}),i}return t})},get isActive(){return f.registrations.state.has(r)}}}#i(e){let t=this.registrations.state.get(e);if(!t)return;let n=t.target;this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),r.size===0&&this.#o(n))}#a(e){if(typeof document>`u`||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener(`keydown`,t),e.addEventListener(`keyup`,n),this.#n.set(e,{keydown:t,keyup:n})}#o(e){if(typeof document>`u`)return;let t=this.#n.get(e);t&&(e.removeEventListener(`keydown`,t.keydown),e.removeEventListener(`keyup`,t.keyup),this.#n.delete(e),this.#r.delete(e))}#s(e,t,n){let r=this.#r.get(t);if(r)for(let i of r){let r=this.registrations.state.get(i);if(r&&nt(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&tt(e,t,r.target)))if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;K(e,r.parsedHotkey,r.options.platform)&&(r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation(),(!r.options.requireReset||!r.hasFired)&&(this.#c(r,e),r.options.requireReset&&(r.hasFired=!0)))}else r.options.eventType===`keyup`&&K(e,r.parsedHotkey,r.options.platform)&&this.#c(r,e),r.options.requireReset&&r.hasFired&&this.#f(r,e)&&(r.hasFired=!1)}}#c(e,t){e.options.preventDefault&&t.preventDefault(),e.options.stopPropagation&&t.stopPropagation(),e.triggerCount++,this.registrations.setState(e=>new Map(e));let n={hotkey:e.hotkey,parsedHotkey:e.parsedHotkey};e.callback(t,n)}#l(e){return t=>{this.#s(t,e,`keydown`)}}#u(e){return t=>{this.#s(t,e,`keyup`)}}#d(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&n.target===t)return n;return null}#f(e,t){let n=e.parsedHotkey,r=W(t.key),i=n.key.length===1?n.key.toUpperCase():n.key;return!!((r.length===1?r.toUpperCase():r)===i||n.ctrl&&r===`Control`||n.shift&&r===`Shift`||n.alt&&r===`Alt`||n.meta&&r===`Meta`)}triggerRegistration(e){let t=this.registrations.state.get(e);if(!t)return!1;let n=t.parsedHotkey,r=new KeyboardEvent(t.options.eventType??`keydown`,{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});return t.triggerCount++,this.registrations.setState(e=>new Map(e)),t.callback(r,{hotkey:t.hotkey,parsedHotkey:t.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&(t===void 0||n.target===t))return!0;return!1}destroy(){for(let e of this.#n.keys())this.#o(e);this.registrations.setState(()=>new Map),this.#n.clear(),this.#r.clear()}};function xt(){return bt.getInstance()}var St=1e3,Ct=0;function wt(){return`sequence_${++Ct}`}function Tt(e){return e.join(`|`)}function Et(e){let t=e.parsedSequence.length,n=e.currentIndex>0&&e.currentIndex<t;return{id:e.id,sequence:e.sequence,options:e.options,target:e.target,triggerCount:e.triggerCount,hasFired:e.hasFired,matchedStepCount:n?e.currentIndex:0,partialMatchLastKeyTime:n?e.lastKeyTime:0}}var Dt=class e{static#e=null;#t=new Map;#n=new Map;#r=new Map;#i;constructor(){this.registrations=new _t(new Map),this.#i=V()}static getInstance(){return e.#e||=new e,e.#e}static resetInstance(){e.#e&&=(e.#e.destroy(),null)}#a(e){this.registrations.setState(t=>new Map(t).set(e.id,Et(e)))}register(e,t,n={}){if(e.length===0)throw Error(`Sequence must contain at least one hotkey`);let r=wt(),i=n.platform??this.#i,a=e.map(e=>G(e,i)),o=n.target??(typeof document<`u`?document:{}),s=n.conflictBehavior??`warn`,c=this.#f(e,o);c&&rt(c.id,Ye(e),s,e=>this.#o(e));let l=a[0],u=n.ignoreInputs??Qe(l),d={id:r,sequence:e,parsedSequence:a,callback:t,options:{...Ze,timeout:St,...n,platform:i,ignoreInputs:u},target:o,currentIndex:0,lastKeyTime:0,triggerCount:0,hasFired:!1};this.#t.set(r,d),this.registrations.setState(e=>new Map(e).set(r,Et(d))),this.#r.has(o)||this.#r.set(o,new Set),this.#r.get(o).add(r),this.#s(o);let f=this;return{get id(){return r},get isActive(){return f.#t.has(r)},get callback(){return f.#t.get(r)?.callback??t},set callback(e){let t=f.#t.get(r);t&&(t.callback=e)},setOptions:e=>{let t=f.#t.get(r);t&&(t.options={...t.options,...e},f.registrations.setState(e=>new Map(e).set(r,Et(t))))},unregister:()=>{f.#o(r)}}}#o(e){let t=this.#t.get(e);if(!t)return;let n=t.target;this.#t.delete(e),this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),r.size===0&&this.#c(n))}#s(e){if(typeof document>`u`||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener(`keydown`,t),e.addEventListener(`keyup`,n),this.#n.set(e,{keydown:t,keyup:n})}#c(e){if(typeof document>`u`)return;let t=this.#n.get(e);t&&(e.removeEventListener(`keydown`,t.keydown),e.removeEventListener(`keyup`,t.keyup),this.#n.delete(e),this.#r.delete(e))}#l(e){return t=>{this.#d(t,e,`keydown`)}}#u(e){return t=>{this.#d(t,e,`keyup`)}}#d(e,t,n){if(Je(W(e.key)))return;let r=this.#r.get(t);if(!r)return;let i=Date.now();registrationIds:for(let a of r){let r=this.#t.get(a);if(!r||!nt(e,t)||!r.options.enabled)continue;if(r.options.ignoreInputs!==!1&&tt(e,t,r.target))continue registrationIds;if(r.options.eventType!==n)continue;let o=r.options.timeout??1e3;r.currentIndex>0&&i-r.lastKeyTime>o&&(r.currentIndex=0,this.#a(r));let s=r.parsedSequence[r.currentIndex];if(s){if(K(e,s,r.options.platform))if(r.lastKeyTime=i,r.currentIndex++,r.currentIndex>=r.parsedSequence.length){r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation();let t={hotkey:r.sequence.join(` `),parsedHotkey:r.parsedSequence[r.parsedSequence.length-1]};r.triggerCount++,r.hasFired=!0,r.currentIndex=0,this.#a(r),r.callback(e,t)}else this.#a(r);else if(r.currentIndex>0){let t=r.parsedSequence[0];K(e,t,r.options.platform)?(r.currentIndex=1,r.lastKeyTime=i):r.currentIndex=0,this.#a(r)}}}}#f(e,t){let n=Tt(e);for(let e of this.#t.values())if(Tt(e.sequence)===n&&e.target===t)return e;return null}resetAll(){for(let e of this.#t.values())e.currentIndex=0,e.lastKeyTime=0,this.#a(e)}triggerSequence(e){let t=this.#t.get(e);if(!t)return!1;let n=t.parsedSequence[t.parsedSequence.length-1];if(!n)return!1;let r=new KeyboardEvent(t.options.eventType??`keydown`,{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});t.triggerCount++,t.hasFired=!0,this.#a(t);let i={hotkey:t.sequence.join(` `),parsedHotkey:n};return t.callback(r,i),!0}getRegistrationCount(){return this.#t.size}destroy(){for(let e of this.#n.keys())this.#c(e);this.#t.clear(),this.registrations.setState(()=>new Map)}};function Ot(){return Dt.getInstance()}function kt(e,n={}){let r=Me(),i=xt(),a=new Map,o=(0,t.watch)(()=>{let t=Q(e),i=Q(n);return t.map((e,t)=>{let n=Q(e.hotkey),a=e.options?Q(e.options):{},o={...r.hotkey,...i,...a},s=qe(n,o.platform??V()),c=o.enabled===void 0?void 0:Q(o.enabled),l=o.target===void 0?void 0:Q(o.target);return{index:t,hotkeyString:s,callback:e.callback,mergedOptions:o,resolvedEnabled:c,resolvedTarget:l}})},e=>{let t=new Set,n=[];for(let r of e){let e=r.resolvedTarget??(typeof document<`u`?document:null);if(!e)continue;let i=`${r.index}:${r.hotkeyString}`;t.add(i),n.push({registrationKey:i,entry:r,finalTarget:e})}for(let[e,n]of[...a.entries()])t.has(e)||(n.handle.isActive&&n.handle.unregister(),a.delete(e));for(let{registrationKey:e,entry:t,finalTarget:r}of n){let n=a.get(e);if(n?.handle.isActive&&n.target===r){n.handle.callback=t.callback;let{target:e,enabled:r,...i}=t.mergedOptions,a={...i,...t.resolvedEnabled===void 0?{}:{enabled:t.resolvedEnabled}};n.handle.setOptions(a);continue}n&&(n.handle.isActive&&n.handle.unregister(),a.delete(e));let{target:o,enabled:s,...c}=t.mergedOptions,l={...c,...t.resolvedEnabled===void 0?{}:{enabled:t.resolvedEnabled}},u=i.register(t.hotkeyString,t.callback,{...l,target:r});a.set(e,{handle:u,target:r})}},{immediate:!0});(0,t.onUnmounted)(()=>{o();for(let{handle:e}of a.values())e.isActive&&e.unregister();a.clear()})}function Q(e){return typeof e==`function`?e():(0,t.unref)(e)}function At(e,n={}){let r=Me(),i=Ot(),a=new Map,o=(0,t.watch)(()=>{let t=$(e),i=$(n);return t.map((e,t)=>{let n=$(e.sequence),a=e.options?$(e.options):{},o={...r.hotkeySequence,...i,...a},s=Ye(n),c=o.enabled===void 0?void 0:$(o.enabled),l=o.target===void 0?void 0:$(o.target);return{index:t,resolvedSequence:n,sequenceString:s,callback:e.callback,mergedOptions:o,resolvedEnabled:c,resolvedTarget:l}})},e=>{let t=new Set,n=[];for(let r of e){if(r.resolvedSequence.length===0)continue;let e=r.resolvedTarget??(typeof document<`u`?document:null);if(!e)continue;let i=`${r.index}:${r.sequenceString}`;t.add(i),n.push({registrationKey:i,entry:r,finalTarget:e})}for(let[e,n]of[...a.entries()])t.has(e)||(n.handle.isActive&&n.handle.unregister(),a.delete(e));for(let{registrationKey:e,entry:t,finalTarget:r}of n){let n=a.get(e);if(n?.handle.isActive&&n.target===r){n.handle.callback=t.callback;let{target:e,enabled:r,...i}=t.mergedOptions,a={...i,...t.resolvedEnabled===void 0?{}:{enabled:t.resolvedEnabled}};n.handle.setOptions(a);continue}n&&(n.handle.isActive&&n.handle.unregister(),a.delete(e));let{target:o,enabled:s,...c}=t.mergedOptions,l={...c,...t.resolvedEnabled===void 0?{}:{enabled:t.resolvedEnabled}},u=i.register(t.resolvedSequence,t.callback,{...l,target:r});a.set(e,{handle:u,target:r})}},{immediate:!0});(0,t.onUnmounted)(()=>{o();for(let{handle:e}of a.values())e.isActive&&e.unregister();a.clear()})}function $(e){return typeof e==`function`?e():(0,t.unref)(e)}var jt=(0,r.defineStore)(`actionRegistry`,()=>{let e=(0,t.ref)([]),n=(0,t.ref)(new Map),r=1;function i(){return[...e.value,...n.value.values().map(e=>e)]}function a(...t){e.value.push(...t)}function o(e){let i=r++;return n.value.set(i,(0,t.markRaw)(e)),i}function s(e){n.value.delete(e)}return{allActions:i,registerActions:a,registerTemporaryAction:o,unregisterAction:s}});function*Mt(e,t){for(let n of e){if(yield n,n.subActionsHaveKeyboardShortcuts!==!0||n.subActions===void 0)continue;let e=n.subActions(t);Array.isArray(e)?yield*Mt(e,t):typeof e==`object`&&e&&`actions`in e&&Array.isArray(e.actions)&&(yield*Mt(e.actions,t))}}function Nt(e){return[e.key,e.alt===!0?`alt`:``,e.ctrl===!0?`ctrl`:``,e.meta===!0?`meta`:``,e.mod===!0?`mod`:``,e.shift===!0?`shift`:``].filter(Boolean).join(`+`)}function Pt(e){let t=jt(),n=R();function r(t){return()=>{let r=e?e():n.actionContext({});for(let e=t.length-1;e>=0;e--){let n=t[e];if(!M(n,r))continue;let i=n.execute?.(r);i instanceof Promise&&i.catch(e=>{console.error(`[useActionShortcuts] action.execute threw:`,e)});return}}}kt(()=>{let i=new Map,a=e?e():n.actionContext({});for(let e of Mt(t.allActions(),a)){if(e.keyboardShortcut===void 0||`sequence`in e.keyboardShortcut)continue;let t=e.keyboardShortcut,n=Nt(t);i.has(n)||i.set(n,[]),i.get(n).push(e)}return Array.from(i.values()).map(e=>{let t=e[0].keyboardShortcut;return{callback:r(e),hotkey:{key:t.key,...t.alt!==void 0&&{alt:t.alt},...t.ctrl!==void 0&&{ctrl:t.ctrl},...t.meta!==void 0&&{meta:t.meta},...t.mod!==void 0&&{mod:t.mod},...t.shift!==void 0&&{shift:t.shift}},options:{ignoreInputs:!t.runWithInputFocus,preventDefault:!0,stopPropagation:!0}}})},{conflictBehavior:`allow`}),At(()=>{let i=new Map,a=e?e():n.actionContext({});for(let e of Mt(t.allActions(),a)){if(e.keyboardShortcut===void 0||!(`sequence`in e.keyboardShortcut))continue;let t=e.keyboardShortcut.sequence.join(`,`);i.has(t)||i.set(t,[]),i.get(t).push(e)}return Array.from(i.values()).map(e=>{let t=e[0].keyboardShortcut;return{callback:r(e),options:{ignoreInputs:!t.runWithInputFocus,preventDefault:!0,stopPropagation:!0},sequence:t.sequence}})},{conflictBehavior:`allow`})}function Ft({actionsSnapshot:e,focusedModelsSnapshot:n,listboxContentRef:r,listboxRootRef:i,manager:a,navStack:o,searchInput:s}){let c=(0,t.ref)(!1),l=(0,t.ref)(!1),u=(0,t.shallowRef)([]),d=(0,t.ref)({}),f=0,p=(0,t.computed)(()=>r.value?.$el);function m(e){return a.actionContext({menuType:`commandMenu`,models:n,searchInput:s.value,subActionsMeta:e})}async function h(){let t=++f;l.value=!1,c.value=!0;try{let n=m(),r;if(o.value.length>0){let e=o.value.at(-1);r=e.parentAction.subActions===void 0?e.actions:await De(e.parentAction,n,d.value)}else r=e;let i=await fe(r,n,e=>{t===f&&e.length>0&&(u.value=e)},o.value.at(-1)?.parentAction);t===f&&(u.value=i)}catch(e){throw console.error(`Error refreshing actions`,e),e}finally{t===f&&(c.value=!1)}}let _=g(h,80);return(0,t.watch)(s,()=>{d.value={},l.value=!0,(r.value?.$el)?.scrollTo({behavior:`instant`,top:0}),_()}),(0,t.watch)(u,(e,t)=>{if(e.length===0)return;let n=i.value?.$el;setTimeout(()=>{(n?.querySelector(`[data-highlighted]`)??null)===null&&i.value?.highlightFirstItem()}),t.length===0&&setTimeout(()=>{(r.value?.$el)?.scrollTo({behavior:`instant`,top:0})})}),k(p,async()=>{let e=o.value.at(-1)?.parentAction;if(e?.subActions===void 0||e.id===void 0)return;let t=d.value[e.id];if(t==null)return;let n=m({[e.id]:t}),r=e.subActions(n),i;if(Array.isArray(r)||z(r))i=r;else if(A(r))i=await r;else{let e=[];for await(let t of r)e.push(t);u.value=[...u.value,...e];return}u.value=[...u.value,...B(e,i,d.value)]},{canLoadMore:()=>{let e=o.value.at(-1)?.parentAction;return e?.subActions===void 0||e.id===void 0?!1:d.value[e.id]!=null},distance:40}),{isDebouncing:l,isLoadingActions:c,buildContext:m,refreshActions:h,resolvedActions:u,subActionsMetaMap:d}}function It(e,n){let r=(0,t.ref)(!1),i=(0,t.ref)(!1),a=null;return(0,t.watch)(e,e=>{e||(i.value=!1)}),(0,t.watch)(n,()=>{i.value=!0,a!==null&&(clearTimeout(a),r.value=!1),(0,t.nextTick)(()=>{r.value=!0,a=setTimeout(()=>{r.value=!1},250)})}),{hasNavigated:i,isBouncing:r}}function Lt({isShiftKeyHeld:e,buildContext:r,emit:i,listboxRootRef:a,manager:o,navStack:s,refreshActions:c,resolvedActions:l,scrollToTopOfGroup:u,searchInput:d,subActionsMetaMap:f}){let p=(0,n.useI18n)(),m=(0,t.ref)(null),h=(0,t.computed)(()=>s.value.at(-1)?.parentAction??null),g=(0,t.computed)(()=>{let e=r();return s.value.filter(e=>e.parentAction.forceAsRootMenu!==!0).map(t=>{let n=t.parentAction;return n.nameAsParent===void 0?P(n.name,e):typeof n.nameAsParent==`function`?n.nameAsParent(e):n.nameAsParent})}),_=(0,t.computed)(()=>{if(h.value===null)return p.t(`type_a_command_or_search`);let e=L(h.value,r())?.placeholder;return e===void 0?p.t(`search`):typeof e==`function`?e():e}),{preview:v,onKeyDown:y}=Ce({highlightedActionId:m,getContext:r,resolvedActions:l});async function b(t){let n=r();if(!t.disabledReason?.(n)){if(t.execute!==void 0){o.executeAction(t,n),(!(h.value?.multiSelectSubActions??!1)||!e.value)&&i(`close`);return}t.subActions!==void 0&&(s.value.push({actions:[],parentAction:t,savedActiveAction:t,savedResolvedActions:l.value,savedSearchInput:d.value}),f.value={},d.value=``,l.value=[],await c())}}async function x(){let e=s.value.pop()??null;e!==null&&(d.value=e.savedSearchInput,l.value=e.savedResolvedActions,await c(),e.savedActiveAction!==null&&a.value?.highlightItem(e.savedActiveAction.id))}function S(e){e.key===`Backspace`&&!e.repeat&&d.value===``&&s.value.length>0&&(e.preventDefault(),x()),(e.key===`ArrowDown`||e.key===`ArrowUp`)&&u(),y(e)}return{highlightedActionId:m,activateAction:b,breadcrumbs:g,currentParent:h,placeholder:_,preview:v,restoreParentFrame:x,onKeyDown:S}}function Rt(e,t){let n=[],r=e.parentAction??null;for(;r!==null;){if(r.forceAsRootMenu===!0)return n;let e=r.nameAsParent===void 0?F(r,t):P(r.nameAsParent,t);n.unshift({icon:r.icon?.(t)??null,label:e}),r=r.parentAction??null}return n.slice(-1)}function zt(e){let n=R(),r=(0,t.ref)(!1);function i(){r.value=!0,n.setFocusedModels([...n.focusedModels,...e.value])}function a(){r.value=!1,n.setFocusedModels(n.focusedModels.filter(t=>!e.value.some(e=>e.key===t.key)))}return(0,t.watch)(e,(t,i)=>{r.value&&n.setFocusedModels([...n.focusedModels.filter(e=>!i.some(t=>t.key===e.key)),...e.value])}),(0,t.onBeforeUnmount)(()=>{a()}),{register:i,unregister:a}}function Bt(e,n,r=!1){let i=jt(),a=[];function o(){a.length>0||(a=(Array.isArray(e)?e:[e]).map(e=>i.registerTemporaryAction(c(e))))}function s(){for(let e of a)i.unregisterAction(e);a=[]}function c(e){return n===void 0?e:{...e,group:{...e.group,priority:n}}}return r||o(),(0,t.onBeforeUnmount)(()=>{s()}),{register:o,unregister:s}}function Vt(e,n){let r=R();function i(){n===`focused`?r.setFocusedModels([...r.focusedModels,...e.value]):r.setViewModels([...r.viewModels,...e.value])}function a(){n===`focused`?r.setFocusedModels(r.focusedModels.filter(t=>!e.value.some(e=>e.key===t.key))):r.setViewModels(r.viewModels.filter(t=>!e.value.some(e=>e.key===t.key)))}(0,t.watch)(e,()=>{a(),i()}),i(),(0,t.onBeforeUnmount)(()=>{a()})}function Ht(e){Vt(e,`view`)}var Ut=0,Wt=new WeakMap;function Gt(e,t){return e===void 0?`no-group`:e.name?P(e.name,t):(Wt.has(e)||Wt.set(e,`unnamed-${Ut++}`),Wt.get(e))}function Kt(e,t){let n=new Map;for(let r of e){let e=r.group,i=Gt(e,t),a=n.get(i);if(a===void 0){let r=e?.name?P(e.name,t):null;a={category:e?.category?P(e.category,t):null,icon:e?.icon?.(t)??null,items:[],key:i,label:r,showIfOnlyGroup:e?.showIfOnlyGroup??!1},n.set(i,a)}a.items.push(r)}return[...n.values()]}exports.GroupPriority=ke,exports.actionsLocales=e.t,exports.applicableActions=fe,exports.buildCommandMenuGroups=Kt,exports.createAction=ue,exports.isAuthenticated=ce,exports.isSubActionsWithMeta=z,exports.resolveActionAvatar=be,exports.resolveActionBreadcrumbs=Rt,exports.resolveActionHint=xe,exports.resolveActionName=F,exports.resolveActionPreview=Se,exports.resolveActionSelected=I,exports.resolveActionValue=P,exports.resolveApplicable=M,exports.resolveSearchSubActionsConfig=L,exports.resolveSubActions=De,exports.setIsAuthenticated=le,exports.storeSubActionsPagination=B,exports.useActionDropdownMenuContent=Oe,exports.useActionGroup=Ae,exports.useActionManagerStore=R,exports.useActionPreview=Ce,exports.useActionRegistryStore=jt,exports.useActionShortcuts=Pt,exports.useCommandMenuActions=Ft,exports.useCommandMenuAnimation=It,exports.useCommandMenuNavigation=Lt,exports.useFocusedModels=zt,exports.useTemporaryActions=Bt,exports.useViewModels=Ht;
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from './types/actionContext.type';
18
18
  export * from './types/actionGroup.type';
19
19
  export * from './types/actionModel.type';
20
20
  export * from './types/commandMenu.type';
21
+ export * from './types/tableSelection.type';
21
22
  export * from './utils/commandMenuGroups.util';
22
23
  export * from './utils/resolveActions.util';
23
24
  export * from './utils/subActions.util';
package/dist/index.js CHANGED
@@ -550,64 +550,85 @@ function He(e) {
550
550
  return e.filter((e) => t.has(e) ? !1 : (t.add(e), !0));
551
551
  }
552
552
  var z = y("actionManager", () => {
553
- let e = p([]), t = p([]), n = p({}), r = x(), i = b(), a = Be("[data-dialog]:not([data-command-menu])");
554
- function o(e) {
555
- n.value = {
556
- ...n.value,
553
+ let e = p([]), t = p([]), n = p([]), r = p(null), i = p({}), a = x(), o = b(), s = Be("[data-dialog]:not([data-command-menu])");
554
+ function c(e) {
555
+ i.value = {
556
+ ...i.value,
557
557
  ...e
558
558
  };
559
559
  }
560
- function s(e) {
561
- let t = { ...n.value };
562
- delete t[e], n.value = t;
560
+ function l(e) {
561
+ let t = { ...i.value };
562
+ delete t[e], i.value = t;
563
563
  }
564
- function c(t) {
564
+ function u(t) {
565
565
  e.value = t;
566
566
  }
567
- function l(e) {
567
+ function d(e) {
568
568
  t.value = e;
569
569
  }
570
- function u(o) {
571
- let s = He([
572
- ...o.models ?? [],
570
+ function f(e) {
571
+ n.value = e;
572
+ }
573
+ function m(e) {
574
+ r.value = e;
575
+ }
576
+ function h() {
577
+ r.value = {
578
+ items: [],
579
+ type: "include"
580
+ };
581
+ }
582
+ function g(c) {
583
+ let l = He([
584
+ ...c.models ?? [],
585
+ ...n.value,
573
586
  ...t.value,
574
587
  ...e.value
575
- ]), c = {
576
- ...n.value,
577
- ...o.metadata
588
+ ]), u = {
589
+ ...i.value,
590
+ ...c.metadata
578
591
  };
579
592
  return {
580
- getPaginationOffsetForSubActionId: (e) => o.subActionsMeta?.[e] ?? null,
581
- hasActiveDialogs: () => a.value,
582
- hasTargetedModelsOfType: (e) => s.some((t) => t.modelName === e),
583
- isRouteActive: (e, t) => t === void 0 || t === !1 ? i.matched.some((t) => t.name === e) : i.name === e,
584
- allModels: s,
593
+ getPaginationOffsetForSubActionId: (e) => c.subActionsMeta?.[e] ?? null,
594
+ hasActiveDialogs: () => s.value,
595
+ hasTargetedModelsOfType: (e) => l.some((t) => t.modelName === e),
596
+ isRouteActive: (e, t) => t === void 0 || t === !1 ? o.matched.some((t) => t.name === e) : o.name === e,
597
+ allModels: l,
598
+ clearTableSelection: h,
585
599
  focusedModels: e.value,
586
- keyboardEvent: o.keyboardEvent,
587
- menuType: o.menuType,
588
- metadata: c,
589
- models: o.models ?? [],
590
- router: r,
591
- searchInput: o.searchInput ?? "",
592
- subActionsMeta: o.subActionsMeta,
593
- targetedModelOfType: (e) => s.find((t) => t.modelName === e) ?? null,
600
+ keyboardEvent: c.keyboardEvent,
601
+ menuType: c.menuType,
602
+ metadata: u,
603
+ models: c.models ?? [],
604
+ router: a,
605
+ searchInput: c.searchInput ?? "",
606
+ selectedModels: n.value,
607
+ subActionsMeta: c.subActionsMeta,
608
+ tableSelection: r.value,
609
+ targetedModelOfType: (e) => l.find((t) => t.modelName === e) ?? null,
594
610
  targetedModelOfTypeOrThrow: (e) => {
595
- let t = s.find((t) => t.modelName === e) ?? null;
611
+ let t = l.find((t) => t.modelName === e) ?? null;
596
612
  if (t === null) throw Error(`Model of type: ${e} not found`);
597
613
  return t;
598
614
  },
599
- targetedModelsOfType: (e) => s.filter((t) => t.modelName === e)
615
+ targetedModelsOfType: (e) => l.filter((t) => t.modelName === e)
600
616
  };
601
617
  }
602
618
  return {
603
- actionContext: u,
619
+ actionContext: g,
620
+ clearTableSelection: h,
604
621
  executeAction: Ve,
605
622
  focusedModels: e,
606
- metadata: n,
607
- registerMetadata: o,
608
- setFocusedModels: c,
609
- setViewModels: l,
610
- unregisterMetadata: s,
623
+ metadata: i,
624
+ registerMetadata: c,
625
+ selectedModels: n,
626
+ setFocusedModels: u,
627
+ setSelectedModels: f,
628
+ setTableSelection: m,
629
+ setViewModels: d,
630
+ tableSelection: r,
631
+ unregisterMetadata: l,
611
632
  viewModels: t
612
633
  };
613
634
  });
@@ -1,5 +1,6 @@
1
1
  import { RegisteredActionContext } from '../register';
2
2
  import { Action } from '../types/action.type.ts';
3
+ import { TableSelectionState } from '../types/tableSelection.type.ts';
3
4
  interface ActionContextOptions {
4
5
  keyboardEvent?: KeyboardEvent;
5
6
  menuType?: 'commandMenu' | 'contextualMenu';
@@ -13,6 +14,7 @@ declare function executeAction(action: Action, ctx: RegisteredActionContext, opt
13
14
  }): Promise<void>;
14
15
  export declare const useActionManagerStore: import('pinia').StoreDefinition<"actionManager", Pick<{
15
16
  actionContext: (options: ActionContextOptions) => RegisteredActionContext;
17
+ clearTableSelection: () => void;
16
18
  executeAction: typeof executeAction;
17
19
  focusedModels: import('vue').Ref<{
18
20
  key: string;
@@ -23,8 +25,30 @@ export declare const useActionManagerStore: import('pinia').StoreDefinition<"act
23
25
  }[]>;
24
26
  metadata: import('vue').Ref<any, any>;
25
27
  registerMetadata: (meta: RegisteredActionContext["metadata"]) => void;
28
+ selectedModels: import('vue').Ref<{
29
+ key: string;
30
+ modelName: string;
31
+ }[], import('..').ActionModel[] | {
32
+ key: string;
33
+ modelName: string;
34
+ }[]>;
26
35
  setFocusedModels: (models: RegisteredActionContext["models"]) => void;
36
+ setSelectedModels: (models: RegisteredActionContext["models"]) => void;
37
+ setTableSelection: (selection: TableSelectionState | null) => void;
27
38
  setViewModels: (models: RegisteredActionContext["models"]) => void;
39
+ tableSelection: import('vue').Ref<{
40
+ items: string[];
41
+ type: "exclude";
42
+ } | {
43
+ items: string[];
44
+ type: "include";
45
+ } | null, TableSelectionState | {
46
+ items: string[];
47
+ type: "exclude";
48
+ } | {
49
+ items: string[];
50
+ type: "include";
51
+ } | null>;
28
52
  unregisterMetadata: (key: string) => void;
29
53
  viewModels: import('vue').Ref<{
30
54
  key: string;
@@ -33,8 +57,9 @@ export declare const useActionManagerStore: import('pinia').StoreDefinition<"act
33
57
  key: string;
34
58
  modelName: string;
35
59
  }[]>;
36
- }, "metadata" | "focusedModels" | "viewModels">, Pick<{
60
+ }, "metadata" | "focusedModels" | "selectedModels" | "tableSelection" | "viewModels">, Pick<{
37
61
  actionContext: (options: ActionContextOptions) => RegisteredActionContext;
62
+ clearTableSelection: () => void;
38
63
  executeAction: typeof executeAction;
39
64
  focusedModels: import('vue').Ref<{
40
65
  key: string;
@@ -45,8 +70,30 @@ export declare const useActionManagerStore: import('pinia').StoreDefinition<"act
45
70
  }[]>;
46
71
  metadata: import('vue').Ref<any, any>;
47
72
  registerMetadata: (meta: RegisteredActionContext["metadata"]) => void;
73
+ selectedModels: import('vue').Ref<{
74
+ key: string;
75
+ modelName: string;
76
+ }[], import('..').ActionModel[] | {
77
+ key: string;
78
+ modelName: string;
79
+ }[]>;
48
80
  setFocusedModels: (models: RegisteredActionContext["models"]) => void;
81
+ setSelectedModels: (models: RegisteredActionContext["models"]) => void;
82
+ setTableSelection: (selection: TableSelectionState | null) => void;
49
83
  setViewModels: (models: RegisteredActionContext["models"]) => void;
84
+ tableSelection: import('vue').Ref<{
85
+ items: string[];
86
+ type: "exclude";
87
+ } | {
88
+ items: string[];
89
+ type: "include";
90
+ } | null, TableSelectionState | {
91
+ items: string[];
92
+ type: "exclude";
93
+ } | {
94
+ items: string[];
95
+ type: "include";
96
+ } | null>;
50
97
  unregisterMetadata: (key: string) => void;
51
98
  viewModels: import('vue').Ref<{
52
99
  key: string;
@@ -57,6 +104,7 @@ export declare const useActionManagerStore: import('pinia').StoreDefinition<"act
57
104
  }[]>;
58
105
  }, never>, Pick<{
59
106
  actionContext: (options: ActionContextOptions) => RegisteredActionContext;
107
+ clearTableSelection: () => void;
60
108
  executeAction: typeof executeAction;
61
109
  focusedModels: import('vue').Ref<{
62
110
  key: string;
@@ -67,8 +115,30 @@ export declare const useActionManagerStore: import('pinia').StoreDefinition<"act
67
115
  }[]>;
68
116
  metadata: import('vue').Ref<any, any>;
69
117
  registerMetadata: (meta: RegisteredActionContext["metadata"]) => void;
118
+ selectedModels: import('vue').Ref<{
119
+ key: string;
120
+ modelName: string;
121
+ }[], import('..').ActionModel[] | {
122
+ key: string;
123
+ modelName: string;
124
+ }[]>;
70
125
  setFocusedModels: (models: RegisteredActionContext["models"]) => void;
126
+ setSelectedModels: (models: RegisteredActionContext["models"]) => void;
127
+ setTableSelection: (selection: TableSelectionState | null) => void;
71
128
  setViewModels: (models: RegisteredActionContext["models"]) => void;
129
+ tableSelection: import('vue').Ref<{
130
+ items: string[];
131
+ type: "exclude";
132
+ } | {
133
+ items: string[];
134
+ type: "include";
135
+ } | null, TableSelectionState | {
136
+ items: string[];
137
+ type: "exclude";
138
+ } | {
139
+ items: string[];
140
+ type: "include";
141
+ } | null>;
72
142
  unregisterMetadata: (key: string) => void;
73
143
  viewModels: import('vue').Ref<{
74
144
  key: string;
@@ -77,5 +147,5 @@ export declare const useActionManagerStore: import('pinia').StoreDefinition<"act
77
147
  key: string;
78
148
  modelName: string;
79
149
  }[]>;
80
- }, "actionContext" | "executeAction" | "registerMetadata" | "setFocusedModels" | "setViewModels" | "unregisterMetadata">>;
150
+ }, "actionContext" | "clearTableSelection" | "executeAction" | "registerMetadata" | "setFocusedModels" | "setSelectedModels" | "setTableSelection" | "setViewModels" | "unregisterMetadata">>;
81
151
  export {};
@@ -1,5 +1,6 @@
1
1
  import { Router } from 'vue-router';
2
2
  import { ActionModel } from './actionModel.type.ts';
3
+ import { TableSelectionState } from './tableSelection.type.ts';
3
4
  /**
4
5
  * Contextual information available to actions during execution or evaluation.
5
6
  * Provides access to models, routing state, user input, and UI context.
@@ -39,6 +40,11 @@ export interface ActionContext<TModelMap = Record<string, ActionModel>, TRoutes
39
40
  * All models currently available in the application, regardless of selection or focus state.
40
41
  */
41
42
  allModels: TModelMap[keyof TModelMap][];
43
+ /**
44
+ * Clears the current data table selection, if any table is registering its
45
+ * selection with the action manager.
46
+ */
47
+ clearTableSelection: () => void;
42
48
  /**
43
49
  * Models that currently have keyboard or UI focus.
44
50
  * A subset of {@link allModels}.
@@ -78,12 +84,22 @@ export interface ActionContext<TModelMap = Record<string, ActionModel>, TRoutes
78
84
  * Empty string when no input has been provided.
79
85
  */
80
86
  searchInput: string;
87
+ /**
88
+ * Models that are currently selected
89
+ * A subset of {@link allModels}.
90
+ */
91
+ selectedModels: TModelMap[keyof TModelMap][];
81
92
  /**
82
93
  * Pagination offsets from previous `subActions` calls, keyed by action id.
83
94
  * Set by the host menu when triggering a "load more" scroll event.
84
95
  * Prefer `getPaginationOffsetForSubActionId` over reading this directly.
85
96
  */
86
97
  subActionsMeta?: Record<string, number | null>;
98
+ /**
99
+ * The current selection state of a data table, if a table is registering its
100
+ * selection with the action manager. `null` when no table selection is active.
101
+ */
102
+ tableSelection: TableSelectionState | null;
87
103
  /**
88
104
  * Returns the targeted model filtered to only those matching the given model type.
89
105
  *
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The selection state of a data table, expressed as either an explicit set of
3
+ * selected item keys (`'include'`) or a set of deselected item keys against an
4
+ * otherwise fully selected table (`'exclude'`).
5
+ */
6
+ export type TableSelectionState = {
7
+ items: string[];
8
+ type: 'exclude';
9
+ } | {
10
+ items: string[];
11
+ type: 'include';
12
+ };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "type": "module",
7
- "version": "0.2.4",
7
+ "version": "0.3.0",
8
8
  "private": false,
9
9
  "license": "SEE LICENSE IN LICENSE.md",
10
10
  "repository": {
@@ -57,11 +57,11 @@
57
57
  "typescript": "5.9.3",
58
58
  "vite": "^8.1.0",
59
59
  "vite-plugin-dts": "4.5.4",
60
- "vitest": "4.1.0",
60
+ "vitest": "4.1.10",
61
61
  "vue": "3.5.27",
62
62
  "vue-tsc": "3.2.2",
63
- "@wisemen/vue-core-icons": "0.0.4",
64
- "@wisemen/eslint-config-vue": "2.1.5"
63
+ "@wisemen/eslint-config-vue": "2.1.5",
64
+ "@wisemen/vue-core-icons": "0.0.4"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "vite build",