@wisemen/vue-core-actions 0.1.1

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.
Files changed (37) hide show
  1. package/LICENSE.md +59 -0
  2. package/dist/composables/actionDropdownMenuContent.composable.d.ts +24 -0
  3. package/dist/composables/actionGroup.composable.d.ts +32 -0
  4. package/dist/composables/actionPreview.composable.d.ts +15 -0
  5. package/dist/composables/actionShortcuts.composable.d.ts +27 -0
  6. package/dist/composables/activeModels.composable.d.ts +3 -0
  7. package/dist/composables/commandMenuActions.composable.d.ts +28 -0
  8. package/dist/composables/commandMenuAnimation.composable.d.ts +5 -0
  9. package/dist/composables/commandMenuNavigation.composable.d.ts +35 -0
  10. package/dist/composables/focusedModels.composable.d.ts +6 -0
  11. package/dist/composables/isSelectorVisible.composable.d.ts +1 -0
  12. package/dist/composables/temporaryActions.composable.d.ts +6 -0
  13. package/dist/composables/viewModels.composable.d.ts +3 -0
  14. package/dist/const/index.d.ts +6 -0
  15. package/dist/createActions.d.ts +47 -0
  16. package/dist/index.cjs +1 -0
  17. package/dist/index.d.ts +22 -0
  18. package/dist/index.js +2122 -0
  19. package/dist/locales/en-US.json.d.ts +12 -0
  20. package/dist/locales/nl-BE.json.d.ts +12 -0
  21. package/dist/locales-BPtvPqGa.js +22 -0
  22. package/dist/locales-D5e1O21n.cjs +1 -0
  23. package/dist/locales.cjs +1 -0
  24. package/dist/locales.d.ts +20 -0
  25. package/dist/locales.js +2 -0
  26. package/dist/stores/actionManager.store.d.ts +82 -0
  27. package/dist/stores/actionRegistry.store.d.ts +17 -0
  28. package/dist/types/action.type.d.ts +225 -0
  29. package/dist/types/actionContext.type.d.ts +112 -0
  30. package/dist/types/actionGroup.type.d.ts +19 -0
  31. package/dist/types/actionModel.type.d.ts +4 -0
  32. package/dist/types/commandMenu.type.d.ts +11 -0
  33. package/dist/types/keyboardShortcut.type.d.ts +26 -0
  34. package/dist/utils/commandMenuGroups.util.d.ts +12 -0
  35. package/dist/utils/resolveActions.util.d.ts +13 -0
  36. package/dist/utils/subActions.util.d.ts +5 -0
  37. package/package.json +73 -0
package/LICENSE.md ADDED
@@ -0,0 +1,59 @@
1
+ # PolyForm Strict License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/strict/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose, other than distributing the software or making changes or new works based on the software.
12
+
13
+ ## Patent License
14
+
15
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
16
+
17
+ ## Noncommercial Purposes
18
+
19
+ Any noncommercial purpose is a permitted purpose.
20
+
21
+ ## Personal Uses
22
+
23
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
24
+
25
+ ## Noncommercial Organizations
26
+
27
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
28
+
29
+ ## Fair Use
30
+
31
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
32
+
33
+ ## No Other Rights
34
+
35
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
36
+
37
+ ## Patent Defense
38
+
39
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
40
+
41
+ ## Violations
42
+
43
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
44
+
45
+ ## No Liability
46
+
47
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
48
+
49
+ ## Definitions
50
+
51
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
52
+
53
+ **You** refers to the individual or entity agreeing to these terms.
54
+
55
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
56
+
57
+ **Your licenses** are all the licenses granted to you for the software under these terms.
58
+
59
+ **Use** means anything you do with the software requiring one of your licenses.
@@ -0,0 +1,24 @@
1
+ import { Ref } from 'vue';
2
+ import { Action } from '../types/action.type.ts';
3
+ import { ActionContext } from '../types/actionContext.type.ts';
4
+ import { ActionModel } from '../types/actionModel.type.ts';
5
+ interface UseActionDropdownMenuContentOptions {
6
+ actions: Ref<Action[]>;
7
+ metadata: Ref<Record<string, unknown> | undefined>;
8
+ models: Ref<ActionModel[]>;
9
+ parentAction: Ref<Action | null | undefined>;
10
+ scrollContainerRef: Ref<HTMLElement | null>;
11
+ }
12
+ export declare function useActionDropdownMenuContent({ actions, metadata, models, parentAction, scrollContainerRef, }: UseActionDropdownMenuContentOptions): {
13
+ highlightedActionId: Ref<string | null, string | null>;
14
+ isLoading: Ref<boolean, boolean>;
15
+ actionGroups: import('vue').ComputedRef<Action<any>[][]>;
16
+ context: import('vue').ComputedRef<ActionContext<Record<string, ActionModel>, any[], any>>;
17
+ placeholder: import('vue').ComputedRef<string>;
18
+ preview: import('vue').ComputedRef<import('vue').Component | null>;
19
+ searchInput: Ref<string, string>;
20
+ onHidePreview: () => void;
21
+ onKeyDown: (event: KeyboardEvent) => void;
22
+ onShowPreview: () => void;
23
+ };
24
+ export {};
@@ -0,0 +1,32 @@
1
+ export declare enum GroupPriority {
2
+ HOVER = 1,
3
+ VIEW = 2,
4
+ MODEL = 3,
5
+ GENERAL = 4,
6
+ NAVIGATION = 5,
7
+ PREFERENCES = 6,
8
+ ACCOUNT = 7,
9
+ DEVELOPER = 8
10
+ }
11
+ export declare function useActionGroup(): {
12
+ account: {
13
+ name: string;
14
+ priority: GroupPriority;
15
+ };
16
+ developer: {
17
+ name: string;
18
+ priority: GroupPriority;
19
+ };
20
+ general: {
21
+ name: string;
22
+ priority: GroupPriority;
23
+ };
24
+ navigation: {
25
+ name: string;
26
+ priority: GroupPriority;
27
+ };
28
+ preferences: {
29
+ name: string;
30
+ priority: GroupPriority;
31
+ };
32
+ };
@@ -0,0 +1,15 @@
1
+ import { Component, Ref, ShallowRef } from 'vue';
2
+ import { Action } from '../types/action.type.ts';
3
+ import { ActionContext } from '../types/actionContext.type.ts';
4
+ interface UseActionPreviewOptions {
5
+ highlightedActionId: Ref<string | null>;
6
+ getContext: () => ActionContext;
7
+ resolvedActions: Ref<Action[]> | ShallowRef<Action[]>;
8
+ }
9
+ export declare function useActionPreview({ highlightedActionId, getContext, resolvedActions, }: UseActionPreviewOptions): {
10
+ preview: import('vue').ComputedRef<Component | null>;
11
+ onHidePreview: () => void;
12
+ onKeyDown: (event: KeyboardEvent) => void;
13
+ onShowPreview: () => void;
14
+ };
15
+ export {};
@@ -0,0 +1,27 @@
1
+ import { ActionContext } from '../types/actionContext.type.ts';
2
+ /**
3
+ * Installs global keyboard shortcut listeners for all registered actions using
4
+ * TanStack Hotkeys.
5
+ *
6
+ * Actions with a `{ sequence }` shortcut are registered as multi-step sequences
7
+ * (e.g. ['g', 's']). All other actions with a `keyboardShortcut` are registered
8
+ * as single-key hotkeys (e.g. Mod+S).
9
+ *
10
+ * When a shortcut fires:
11
+ * - `action.isApplicable(ctx)` is checked; if false the callback is a no-op.
12
+ * - `action.execute(ctx)` is called.
13
+ *
14
+ * `ignoreInputs` is derived from `runWithInputFocus` on each shortcut:
15
+ * shortcuts with `runWithInputFocus: true` also fire while a text field is
16
+ * focused; all others are suppressed.
17
+ *
18
+ * Both registration lists are reactive — temporary actions registered at
19
+ * runtime are picked up automatically.
20
+ *
21
+ * Call this composable once, at the app root level (e.g. App.vue).
22
+ *
23
+ * @param buildCtx Optional factory to supply a custom ActionContext for
24
+ * shortcut-triggered actions. Defaults to the action manager's
25
+ * default context.
26
+ */
27
+ export declare function useActionShortcuts(buildCtx?: () => ActionContext): void;
@@ -0,0 +1,3 @@
1
+ import { ComputedRef } from 'vue';
2
+ import { ActionModel } from '../types/actionModel.type.ts';
3
+ export declare function useActiveModels(models: ComputedRef<ActionModel[]>, type: 'focused' | 'view'): void;
@@ -0,0 +1,28 @@
1
+ import { Ref } from 'vue';
2
+ import { useActionManagerStore } from '../stores/actionManager.store.ts';
3
+ import { Action } from '../types/action.type.ts';
4
+ import { ActionContext } from '../types/actionContext.type.ts';
5
+ import { ActionModel } from '../types/actionModel.type.ts';
6
+ import { NavFrame } from '../types/commandMenu.type.ts';
7
+ interface UseCommandMenuActionsOptions {
8
+ actionsSnapshot: Action[];
9
+ focusedModelsSnapshot: ActionModel[];
10
+ listboxContentRef: Ref<{
11
+ $el: HTMLElement;
12
+ } | null>;
13
+ listboxRootRef: Ref<{
14
+ highlightFirstItem: () => void;
15
+ } | null>;
16
+ manager: ReturnType<typeof useActionManagerStore>;
17
+ navStack: Ref<NavFrame[]>;
18
+ searchInput: Ref<string>;
19
+ }
20
+ export declare function useCommandMenuActions({ actionsSnapshot, focusedModelsSnapshot, listboxContentRef, listboxRootRef, manager, navStack, searchInput, }: UseCommandMenuActionsOptions): {
21
+ isDebouncing: Ref<boolean, boolean>;
22
+ isLoadingActions: Ref<boolean, boolean>;
23
+ buildContext: (subActionsMeta?: Record<string, number | null>) => ActionContext;
24
+ refreshActions: () => Promise<void>;
25
+ resolvedActions: import('vue').ShallowRef<Action<any>[], Action<any>[]>;
26
+ subActionsMetaMap: Ref<Record<string, number | null>, Record<string, number | null>>;
27
+ };
28
+ export {};
@@ -0,0 +1,5 @@
1
+ import { Ref } from 'vue';
2
+ export declare function useCommandMenuAnimation(isOpen: Ref<boolean>, getNavStackLength: () => number): {
3
+ hasNavigated: Ref<boolean, boolean>;
4
+ isBouncing: Ref<boolean, boolean>;
5
+ };
@@ -0,0 +1,35 @@
1
+ import { Ref, ShallowRef } from 'vue';
2
+ import { useActionManagerStore } from '../stores/actionManager.store.ts';
3
+ import { Action } from '../types/action.type.ts';
4
+ import { ActionContext } from '../types/actionContext.type.ts';
5
+ import { NavFrame } from '../types/commandMenu.type.ts';
6
+ interface UseCommandMenuNavigationOptions {
7
+ isShiftKeyHeld: Ref<boolean>;
8
+ buildContext: () => ActionContext;
9
+ emit: (event: 'close') => void;
10
+ listboxRootRef: Ref<{
11
+ highlightItem: (id: string | undefined) => void;
12
+ } | null>;
13
+ manager: ReturnType<typeof useActionManagerStore>;
14
+ navStack: Ref<NavFrame[]>;
15
+ refreshActions: () => Promise<void>;
16
+ resolvedActions: ShallowRef<Action[]>;
17
+ scrollToTopOfGroup: () => void;
18
+ searchInput: Ref<string>;
19
+ subActionsMetaMap: Ref<Record<string, number | null>>;
20
+ }
21
+ export declare function useCommandMenuNavigation({ isShiftKeyHeld, buildContext, emit, listboxRootRef, manager, navStack, refreshActions, resolvedActions, scrollToTopOfGroup, searchInput, subActionsMetaMap, }: UseCommandMenuNavigationOptions): {
22
+ highlightedActionId: Ref<string | null, string | null>;
23
+ activateAction: (action: Action) => Promise<void>;
24
+ breadcrumbs: import('vue').ComputedRef<string[]>;
25
+ currentParent: import('vue').ComputedRef<Action<any> | null>;
26
+ placeholder: import('vue').ComputedRef<string>;
27
+ preview: import('vue').ComputedRef<import('vue').Component | null>;
28
+ restoreParentFrame: () => Promise<void>;
29
+ onKeyDown: (event: KeyboardEvent) => void;
30
+ };
31
+ export declare function resolveActionBreadcrumbs(action: Action, ctx: ActionContext): {
32
+ icon: ReturnType<NonNullable<Action['icon']>> | null;
33
+ label: string;
34
+ }[];
35
+ export {};
@@ -0,0 +1,6 @@
1
+ import { ComputedRef } from 'vue';
2
+ import { ActionModel } from '../types/actionModel.type.ts';
3
+ export declare function useFocusedModels(models: ComputedRef<ActionModel[]>): {
4
+ register: () => void;
5
+ unregister: () => void;
6
+ };
@@ -0,0 +1 @@
1
+ export declare function useIsSelectorVisible(selector: string): import('vue').Ref<boolean, boolean>;
@@ -0,0 +1,6 @@
1
+ import { GroupPriority } from './actionGroup.composable';
2
+ import { Action } from '../types/action.type.ts';
3
+ export declare function useTemporaryActions(actions: Action | Action[], priority?: GroupPriority, controlled?: boolean): {
4
+ register: () => void;
5
+ unregister: () => void;
6
+ };
@@ -0,0 +1,3 @@
1
+ import { ComputedRef } from 'vue';
2
+ import { ActionModel } from '../types/actionModel.type.ts';
3
+ export declare function useViewModels(models: ComputedRef<ActionModel[]>): void;
@@ -0,0 +1,6 @@
1
+ export declare const DEFAULT_MIN_SEARCH_INPUT_LENGTH = 2;
2
+ export declare const DEFAULT_MAX_SUB_ACTIONS = 99;
3
+ export declare const DEFAULT_MIN_APPLICABILITY_SCORE = 0.24;
4
+ export declare const SECONDARY_SCORE_WEIGHT = 0.85;
5
+ export declare const PARENT_ACTION_SCORE_PENALTY = -0.15;
6
+ export declare const SCORE_GROUP_PRIORITY_THRESHOLD = 0.05;
@@ -0,0 +1,47 @@
1
+ import { Component, DefineComponent } from 'vue';
2
+ import { Action } from './types/action.type.ts';
3
+ import { ActionContext } from './types/actionContext.type';
4
+ import { KeyboardShortcut } from './types/keyboardShortcut.type.ts';
5
+ export declare const isAuthenticated: import('vue').ShallowRef<boolean, boolean>;
6
+ type TypedActionDropdownMenu<TActionContext extends ActionContext> = DefineComponent<{
7
+ isOpen?: boolean;
8
+ actions?: Action<TActionContext>[];
9
+ currentContextOnly: boolean;
10
+ metadata?: TActionContext['metadata'];
11
+ models?: TActionContext['models'];
12
+ parentAction?: Action<TActionContext>;
13
+ }>;
14
+ type TypedActionTrigger<TActionContext extends ActionContext> = new () => {
15
+ $props: {
16
+ action: Action<TActionContext>;
17
+ currentContextOnly: boolean;
18
+ metadata?: TActionContext['metadata'];
19
+ models?: TActionContext['models'];
20
+ };
21
+ $slots: {
22
+ default: (props: {
23
+ isExecuting: boolean;
24
+ canExecute: boolean;
25
+ icon: Component | null;
26
+ keyboardShortcut: KeyboardShortcut | null;
27
+ label: string;
28
+ }) => any;
29
+ };
30
+ };
31
+ type TypedActionFocus<TActionContext extends ActionContext> = new () => {
32
+ $props: {
33
+ actions: Action<TActionContext>[];
34
+ metadata?: TActionContext['metadata'];
35
+ models?: TActionContext['models'];
36
+ };
37
+ };
38
+ declare function setIsAuthenticated(value: boolean): void;
39
+ export declare function _createUntypedAction<TAction extends Action<ActionContext>>(action: TAction): TAction;
40
+ export declare function typedActionDropdownMenu<TActionContext>(component: Component): TypedActionDropdownMenu<TActionContext extends ActionContext<any, any, any> ? TActionContext : never>;
41
+ export declare function typedActionTrigger<TActionContext>(component: Component): TypedActionTrigger<TActionContext extends ActionContext<any, any, any> ? TActionContext : never>;
42
+ export declare function typedActionFocus<TActionContext>(component: Component): TypedActionFocus<TActionContext extends ActionContext<any, any, any> ? TActionContext : never>;
43
+ export declare function createActions<TActionContext>(): {
44
+ createAction: (action: Action<TActionContext>) => Action<TActionContext>;
45
+ setIsAuthenticated: typeof setIsAuthenticated;
46
+ };
47
+ export {};
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./locales-D5e1O21n.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`,s=typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope,c=e=>e!=null,l=Object.prototype.toString,u=e=>l.call(e)===`[object Object]`,d=()=>{};function f(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 p(e,n={}){let r,i,a=d,o=e=>{clearTimeout(e),a(),a=d},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 m(...e){let n=0,r,i=!0,a=d,o,s,c,l,u;!(0,t.isRef)(e[0])&&typeof e[0]==`object`?{delay:s,trailing:c=!0,leading:l=!0,rejectOnCancel:u=!1}=e[0]:[s,c=!0,l=!0,u=!1]=e;let f=()=>{r&&(clearTimeout(r),r=void 0,a(),a=d)};return e=>{let d=(0,t.toValue)(s),p=Date.now()-n,m=()=>o=e();return f(),d<=0?(n=Date.now(),m()):(p>d?(n=Date.now(),(l||!i)&&m()):c&&(o=new Promise((e,t)=>{a=u?t:e,r=setTimeout(()=>{n=Date.now(),i=!0,e(m()),f()},Math.max(0,d-p))})),!l&&!r&&(r=setTimeout(()=>i=!0,d)),i=!1,o)}}function h(e){return Array.isArray(e)?e:[e]}function g(e){let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))}var _=/\B([A-Z])/g,v=g(e=>e.replace(_,`-$1`).toLowerCase()),y=/-(\w)/g,b=g(e=>e.replace(y,(e,t)=>t?t.toUpperCase():``));function x(e){return e||(0,t.getCurrentInstance)()}function S(e,t=200,n={}){return f(p(t,n),e)}function ee(e,t=200,n=!1,r=!0,i=!1){return f(m(t,n,r,i),e)}function te(e,n=!0,r){x(r)?(0,t.onMounted)(e,r):n?e():(0,t.nextTick)(e)}function C(e,n){x(n)&&(0,t.onUnmounted)(e,n)}function w(e,n,r){return(0,t.watch)(e,n,{...r,immediate:!0})}function ne(e,n,r){return(0,t.watch)(e,n,{...r,once:!0})}var T=o?window:void 0,E=o?window.document:void 0,re=o?window.navigator:void 0,ie=o?window.location:void 0;function D(e){let n=(0,t.toValue)(e);return n?.$el??n}function ae(...e){let n=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),r=(0,t.computed)(()=>{let n=h((0,t.toValue)(e[0])).filter(e=>e!=null);return n.every(e=>typeof e!=`string`)?n:void 0});return w(()=>[r.value?.map(e=>D(e))??[T].filter(e=>e!=null),h((0,t.toValue)(r.value?e[1]:e[0])),h((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=u(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 oe(){let e=(0,t.shallowRef)(!1),n=(0,t.getCurrentInstance)();return n&&(0,t.onMounted)(()=>{e.value=!0},n),e}function se(e){let n=oe();return(0,t.computed)(()=>(n.value,!!e()))}function ce(e,n,r={}){let{window:i=T,...o}=r,s,l=se(()=>i&&`MutationObserver`in i),u=()=>{s&&=(s.disconnect(),void 0)},d=(0,t.watch)((0,t.computed)(()=>{let n=h((0,t.toValue)(e)).map(D).filter(c);return new Set(n)}),e=>{u(),l.value&&e.size&&(s=new MutationObserver(n),e.forEach(e=>s.observe(e,o)))},{immediate:!0,flush:`post`}),f=()=>s?.takeRecords(),p=()=>{d(),u()};return a(p),{isSupported:l,stop:p,takeRecords:f}}function le(e,n,r={}){let{root:i,rootMargin:o=`0px`,threshold:s=0,window:l=T,immediate:u=!0}=r,f=se(()=>l&&`IntersectionObserver`in l),p=(0,t.computed)(()=>h((0,t.toValue)(e)).map(D).filter(c)),m=d,g=(0,t.shallowRef)(u),_=f.value?(0,t.watch)(()=>[p.value,D(i),g.value],([e,t])=>{if(m(),!g.value||!e.length)return;let r=new IntersectionObserver(n,{root:D(t),rootMargin:o,threshold:s});e.forEach(e=>e&&r.observe(e)),m=()=>{r.disconnect(),m=d}},{immediate:u,flush:`post`}):d,v=()=>{m(),_(),g.value=!1};return a(v),{isSupported:f,isActive:g,pause(){m(),g.value=!1},resume(){g.value=!0},stop:v}}function ue(e,n={}){let{window:r=T,scrollTarget:i,threshold:a=0,rootMargin:o,once:s=!1,initialValue:c=!1}=n,l=(0,t.shallowRef)(c),{stop:u}=le(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&&ne(l,()=>{u()})},{root:i,window:r,threshold:a,rootMargin:(0,t.toValue)(o)});return l}function de(e){return typeof Window<`u`&&e instanceof Window?e.document.documentElement:typeof Document<`u`&&e instanceof Document?e.documentElement:e}var fe=1;function pe(e,n={}){let{throttle:r=0,idle:i=200,onStop:a=d,onScroll:o=d,offset:s={left:0,right:0,top:0,bottom:0},observe:c={mutation:!1},eventListenerOptions:l={capture:!1,passive:!0},behavior:u=`auto`,window:f=T,onError:p=e=>{console.error(e)}}=n,m=typeof c==`boolean`?{mutation:c}:c,h=(0,t.shallowRef)(0),g=(0,t.shallowRef)(0),_=(0,t.computed)({get(){return h.value},set(e){y(e,void 0)}}),v=(0,t.computed)({get(){return g.value},set(e){y(void 0,e)}});function y(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)??v.value,left:(0,t.toValue)(n)??_.value,behavior:(0,t.toValue)(u)});let s=(o==null||(a=o.document)==null?void 0:a.documentElement)||o?.documentElement||o;_!=null&&(h.value=s.scrollLeft),v!=null&&(g.value=s.scrollTop)}let b=(0,t.shallowRef)(!1),x=(0,t.reactive)({left:!0,right:!1,top:!0,bottom:!1}),C=(0,t.reactive)({left:!1,right:!1,top:!1,bottom:!1}),w=e=>{b.value&&(b.value=!1,C.left=!1,C.right=!1,C.top=!1,C.bottom=!1,a(e))},ne=S(w,r+i),E=e=>{var t;if(!f)return;let n=(e==null||(t=e.document)==null?void 0:t.documentElement)||e?.documentElement||D(e),{display:r,flexDirection:i,direction:a}=f.getComputedStyle(n),o=a===`rtl`?-1:1,c=n.scrollLeft;C.left=c<h.value,C.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)-fe;r===`flex`&&i===`row-reverse`?(x.left=u,x.right=l):(x.left=l,x.right=u),h.value=c;let d=n.scrollTop;e===f.document&&!d&&(d=f.document.body.scrollTop),C.top=d<g.value,C.bottom=d>g.value;let p=Math.abs(d)<=(s.top||0),m=Math.abs(d)+n.clientHeight>=n.scrollHeight-(s.bottom||0)-fe;r===`flex`&&i===`column-reverse`?(x.top=m,x.bottom=p):(x.top=p,x.bottom=m),g.value=d},re=e=>{f&&(E(e.target.documentElement??e.target),b.value=!0,ne(e),o(e))};return ae(e,`scroll`,r?ee(re,r,!0,!1):re,l),te(()=>{try{let n=(0,t.toValue)(e);if(!n)return;E(n)}catch(e){p(e)}}),m?.mutation&&e!=null&&e!==f&&e!==document&&ce(e,()=>{let n=(0,t.toValue)(e);n&&E(n)},{attributes:!0,childList:!0,subtree:!0}),ae(e,`scrollend`,w,l),{x:_,y:v,isScrolling:b,arrivedState:x,directions:C,measure(){let n=(0,t.toValue)(e);f&&n&&E(n)}}}function me(e,n,r={}){let{direction:i=`bottom`,interval:a=100,canLoadMore:o=()=>!0}=r,s=(0,t.reactive)(pe(e,{...r,offset:{[i]:r.distance??0,...r.offset}})),c=(0,t.ref)(),l=(0,t.computed)(()=>!!c.value),u=(0,t.computed)(()=>de((0,t.toValue)(e))),d=ue(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 C((0,t.watch)(()=>[s.arrivedState[i],d.value,f.value],p,{immediate:!0})),{isLoading:l,reset(){(0,t.nextTick)(()=>p())}}}var he=[{max:6e4,value:1e3,name:`second`},{max:276e4,value:6e4,name:`minute`},{max:72e6,value:36e5,name:`hour`},{max:5184e5,value:864e5,name:`day`},{max:24192e5,value:6048e5,name:`week`},{max:28512e6,value:2592e6,name:`month`},{max:1/0,value:31536e6,name:`year`}];const ge=2,_e=99,ve=.24,ye=.85,be=-.15,xe=.05,O=(0,t.shallowRef)(!1);function Se(e){O.value=e}function Ce(e){return e}function we(e){return e}function Te(e){return e}function Ee(e){return e}function De(){function e(e){return e}return{createAction:e,setIsAuthenticated:Se}}var Oe=/[\s\-_./]+/;async function ke(e,t,n,r){let i=t.searchInput.length,a=i>=0,o=Me(e);if(a){let e=[],a=[],s=[...o];for(;s.length>0;){let n=s.shift();e.push(n);let r=P(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=Ne(i.slice(0,e),n);s.push(...t)}else if(Ae(i)){let t=Ne(i.actions.slice(0,e),n);s.push(...t)}else{let t=n;a.push(async()=>Ne(await je(i,e),t))}}}if(a.length>0&&n!==void 0){n(k(e,t,r));let i=[...e];return await Promise.all(a.map(async e=>{let a=await e();i.push(...a),n(k(i,t,r))})),k(i,t,r)}let c=(await Promise.all(a.map(e=>e()))).flat();o=[...e,...c]}return k(o,t,r)}function k(e,t,n){let r=t.searchInput.length>=0,i=new Set,a=new Set,o=[];for(let n of e)if(Pe(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:Fe(e,t.searchInput,t)})).filter(({score:e})=>e>=.24);return e=e.toSorted((e,r)=>{let i=e.action.parentAction===void 0?0:1,a=r.action.parentAction===void 0?0:1;if(i!==a)return i-a;let o=e.action.parentAction??n,s=r.action.parentAction??n,c=o?.showSelectedSubActionsFirst!==!1&&N(e.action,t)?0:1,l=s?.showSelectedSubActionsFirst!==!1&&N(r.action,t)?0:1;if(c!==l)return c-l;let u=r.score-e.score;if(Math.abs(u)>.05)return u;let d=A(e.action,t),f=A(r.action,t);return d===f?u:d-f}),e.map(e=>e.action)}let s=n?.showSelectedSubActionsFirst!==!1;return o.sort((e,n)=>{let r=s&&N(e,t)?0:1,i=s&&N(n,t)?0:1;return r===i?A(e,t)-A(n,t):r-i})}function Ae(e){return typeof e==`object`&&!!e&&`actions`in e&&`pagination`in e&&Array.isArray(e.actions)}async function je(e,t){if(e instanceof Promise){let n=await e;return Ae(n)?n.actions.slice(0,t):n.slice(0,t)}let n=[];for await(let r of e)if(n.push(r),n.length>=t)break;return n}function Me(e){let t=[];for(let n of e)typeof n==`function`?t.push(...n()):t.push(n);return t}function Ne(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 Pe(e,t){return!(!O.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 A(e,t){let n=e.group?.priority??null;return n===null?9999:typeof n==`function`?n(t):n}function Fe(e,t,n){if(t.trim().length===0||e.skipFilterScoring)return 1;let r=M(e,n),i=Ie(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=Le(r,t),o=Le(i,t)*.85,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+=-.15),e.scoreOverride!==void 0&&(s=e.scoreOverride),e.sortPriority!==void 0&&(s-=e.sortPriority*1e-4),s}function Ie(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:M(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:M(r,t);n.push(i)}}if(n.push(M(e,t)),e.keywords!==void 0){let t=Array.isArray(e.keywords)?e.keywords:[e.keywords];n.push(...t)}return n.join(` `)}function Le(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(Oe);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 j(e,t){return typeof e==`function`?e(t):e}function M(e,t){return typeof e.name==`function`?e.name(t):e.name}function Re(e,t){return typeof e.avatar==`function`?e.avatar(t):e.avatar??null}function ze(e,t){return typeof e.hint==`function`?e.hint(t):e.hint??null}function N(e,t){return typeof e.selected==`function`?e.selected(t):e.selected??null}function P(e,t){return typeof e.searchSubActionsConfig==`function`?e.searchSubActionsConfig(t):e.searchSubActionsConfig??null}function Be(e,t){return typeof e.preview==`function`?e.preview(t):null}function Ve({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:Be(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 He(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 Ue(e,t,n){e.execute!==void 0&&(await e.execute(t),n?.onComplete?.())}function We(e){let t=new Set;return e.filter(e=>t.has(e)?!1:(t.add(e),!0))}const F=(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=He(`[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=We([...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:Ue,focusedModels:e,metadata:r,registerMetadata:c,setFocusedModels:u,setViewModels:d,unregisterMetadata:l,viewModels:n}});function I(e){return typeof e==`object`&&!!e&&`actions`in e&&`pagination`in e&&Array.isArray(e.actions)}function L(e,t,n){return I(t)?(e.id&&(n[e.id]=t.pagination.nextOffset),t.actions):(e.id&&delete n[e.id],t)}async function Ge(e,t,n,r=297){if(e.subActions===void 0)return[];let i=e.subActions(t);if(Array.isArray(i)||I(i))return L(e,i,n);if(i instanceof Promise)return L(e,await i,n);let a=[];for await(let e of i)if(a.push(e),a.length>=r)break;return a}function Ke({actions:e,metadata:r,models:i,parentAction:a,scrollContainerRef:o}){let s=(0,n.useI18n)(),c=F(),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),g=0,_=(0,t.computed)(()=>c.actionContext({menuType:`contextualMenu`,metadata:r.value,models:i.value,searchInput:d.value})),{preview:v,onHidePreview:y,onKeyDown:b,onShowPreview:x}=Ve({highlightedActionId:l,getContext:()=>_.value,resolvedActions:p}),ee=(0,t.computed)(()=>{if(a.value==null)return s.t(`search`);let e=P(a.value,_.value)?.placeholder;return e===void 0?s.t(`search`):typeof e==`function`?e():e});async function te(){let t=++g,n=_.value;try{let r=e.value;a.value?.subActions!==void 0&&(r=await Ge(a.value,n,m.value));let i=await ke(r,n,e=>{t!==g||e.length===0||(p.value=e)},a.value??void 0);if(t!==g)return;p.value=i,f.value=_.value.searchInput.trim().length>0}catch(e){throw console.error(`Error refreshing actions`,e),e}finally{t===g&&(h.value=!1)}}me(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)||I(o))s=o;else if(o instanceof Promise)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,...L(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 C=(0,t.computed)(()=>{let e=p.value.filter(e=>{let t=e.isApplicable===void 0||e.isApplicable(_.value),n=e.disabledReason?.(_.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}),w=S(()=>{d.value=u.value,te()},200);return(0,t.watch)(u,()=>{m.value={},w()}),te(),{highlightedActionId:l,isLoading:h,actionGroups:C,context:_,placeholder:ee,preview:v,searchInput:u,onHidePreview:y,onKeyDown:b,onShowPreview:x}}let R=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.ACCOUNT=7]=`ACCOUNT`,e[e.DEVELOPER=8]=`DEVELOPER`,e}({});function qe(){let e=(0,n.useI18n)();return{account:{name:e.t(`action.group.account`),priority:R.ACCOUNT},developer:{name:e.t(`action.group.developer`),priority:R.DEVELOPER},general:{name:e.t(`action.group.general`),priority:R.GENERAL},navigation:{name:e.t(`action.group.navigation`),priority:R.NAVIGATION},preferences:{name:e.t(`action.group.preferences`),priority:R.PREFERENCES}}}var Je=Symbol(`HotkeysContext`);function Ye(){return(0,t.inject)(Je,null)?.defaultOptions??{}}function z(){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 B=[`Control`,`Alt`,`Shift`,`Meta`],Xe=new Set(B),V={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 Ze(e,t=z()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var Qe=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),$e=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),et=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),tt=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),nt=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),rt=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),it={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Semicolon:`;`,Slash:`/`},at=new Set([...Qe,...$e,...et,...tt,...nt,...rt]),ot={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 st(e){return/^\p{Letter}$/u.test(e)}function H(e){if(!e)return``;if(e in ot)return ot[e];if(st(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}var ct={Control:`Ctrl`,Alt:`Alt`,Shift:`Shift`,Meta:`Win`,Mod:`Ctrl`},lt={...ct,Meta:`Super`};function U(e,t=z()){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=H(a);else{let e=V[a]??V[a.toLowerCase()];if(e){let n=Ze(e,t);r.add(n)}else n.length===1&&(i=H(a))}}return!i&&n.length>0&&(i=H(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:B.filter(e=>r.has(e))}}function ut(e,t=z()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(Ze(`Mod`,t)===`Control`?n=!0:a=!0);let o=B.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 dt(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 B)e.modifiers.includes(t)&&r.push(t);return r.push(H(e.key)),r.join(`+`)}function ft(e,t=z()){return dt(U(e,t),t)}function pt(e,t=z()){return dt(e,t)}function mt(e,t=z()){return typeof e==`string`?ft(e,t):pt(ut(e,t),t)}function ht(e){return e in V||e.toLowerCase()in V}function gt(e){return e.join(` `)}function _t(e){let t=[];for(let n of B)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function W(e,t,n=z()){let r=typeof t==`string`?U(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=H(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(st(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 it?it[e.code]===a:!1}return i===a}var vt={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function yt(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function bt(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 xt(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 St(e,t,n){let r=xt(t);return r&&bt(r)&&r!==n||e.composedPath().some(e=>bt(e)&&e!==n)?!0:bt(e.target)&&e.target!==n}function Ct(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 wt(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 G=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 Tt({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&(G.RecursedCheck|G.Recursed|G.Dirty|G.Pending)?a&(G.RecursedCheck|G.Recursed)?a&G.RecursedCheck?!(a&(G.Dirty|G.Pending))&&c(e,i)?(i.flags=a|(G.Recursed|G.Pending),a&=G.Mutable):a=G.None:i.flags=a&~G.Recursed|G.Pending:a=G.None:i.flags=a|G.Pending,a&G.Watching&&t(i),a&G.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&G.Dirty)a=!0;else if((c&(G.Mutable|G.Dirty))===(G.Mutable|G.Dirty)){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&(G.Mutable|G.Pending))===(G.Mutable|G.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&=~G.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&(G.Pending|G.Dirty))===G.Pending&&(n.flags=r|G.Dirty,(r&(G.Watching|G.RecursedCheck))===G.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 Et(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 Dt=[],K=0,{link:Ot,unlink:kt,propagate:At,checkDirty:jt,shallowPropagate:Mt}=Tt({update(e){return e._update()},notify(e){Dt[Nt++]=e,e.flags&=~G.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=G.Mutable|G.Dirty,Y(e))}}),q=0,Nt=0,J,Pt=0;function Y(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=kt(n,e)}function Ft(){if(!(Pt>0)){for(;q<Nt;){let e=Dt[q];Dt[q++]=void 0,e.notify()}q=0,Nt=0}}function It(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?G.None:G.Mutable,get(){return J!==void 0&&Ot(i,J,K),i._snapshot},subscribe(e){let t=Et(e),n={current:!1},r=Lt(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=J,o=t?.compare??Object.is;if(n)J=i,++K,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=G.Mutable|G.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{J=a,n&&(i.flags&=~G.RecursedCheck),Y(i)}}};return n?(i.flags=G.Mutable|G.Dirty,i.get=function(){let e=i.flags;if(e&G.Dirty||e&G.Pending&&jt(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Mt(e)}}else e&G.Pending&&(i.flags=e&~G.Pending);return J!==void 0&&Ot(i,J,K),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(At(e),Mt(e),Ft())}},i}function Lt(e){let t=()=>{let t=J;J=n,++K,n.depsTail=void 0,n.flags=G.Watching|G.RecursedCheck;try{return e()}finally{J=t,n.flags&=~G.RecursedCheck,Y(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:G.Watching|G.RecursedCheck,notify(){let e=this.flags;e&G.Dirty||e&G.Pending&&jt(this.deps,this)?t():this.flags=G.Watching},stop(){this.flags=G.None,this.depsTail=void 0,Y(this)}};return t(),n}var Rt=class{constructor(e,t){this.atom=It(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(Et(e))}},zt=0;function Bt(){return`hotkey_${++zt}`}var Vt=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new Rt(new Map),this.#t=z()}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:Bt(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=Bt(),i=n.platform??this.#t,a=typeof e==`string`?U(e,i):ut(e,i),o=typeof e==`string`?e:_t(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&wt(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??yt(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...vt,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&&Ct(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&St(e,t,r.target)))if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;W(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`&&W(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=H(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 Ht(){return Vt.getInstance()}var Ut=1e3,Wt=0;function Gt(){return`sequence_${++Wt}`}function Kt(e){return e.join(`|`)}function qt(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 Jt=class e{static#e=null;#t=new Map;#n=new Map;#r=new Map;#i;constructor(){this.registrations=new Rt(new Map),this.#i=z()}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,qt(e)))}register(e,t,n={}){if(e.length===0)throw Error(`Sequence must contain at least one hotkey`);let r=Gt(),i=n.platform??this.#i,a=e.map(e=>U(e,i)),o=n.target??(typeof document<`u`?document:{}),s=n.conflictBehavior??`warn`,c=this.#f(e,o);c&&wt(c.id,gt(e),s,e=>this.#o(e));let l=a[0],u=n.ignoreInputs??yt(l),d={id:r,sequence:e,parsedSequence:a,callback:t,options:{...vt,timeout:Ut,...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,qt(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,qt(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(ht(H(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||!Ct(e,t)||!r.options.enabled)continue;if(r.options.ignoreInputs!==!1&&St(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(W(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];W(e,t,r.options.platform)?(r.currentIndex=1,r.lastKeyTime=i):r.currentIndex=0,this.#a(r)}}}}#f(e,t){let n=Kt(e);for(let e of this.#t.values())if(Kt(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 Yt(){return Jt.getInstance()}function Xt(e,n={}){let r=Ye(),i=Ht(),a=new Map,o=(0,t.watch)(()=>{let t=X(e),i=X(n);return t.map((e,t)=>{let n=X(e.hotkey),a=e.options?X(e.options):{},o={...r.hotkey,...i,...a},s=mt(n,o.platform??z()),c=o.enabled===void 0?void 0:X(o.enabled),l=o.target===void 0?void 0:X(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 X(e){return typeof e==`function`?e():(0,t.unref)(e)}function Zt(e,n={}){let r=Ye(),i=Yt(),a=new Map,o=(0,t.watch)(()=>{let t=Z(e),i=Z(n);return t.map((e,t)=>{let n=Z(e.sequence),a=e.options?Z(e.options):{},o={...r.hotkeySequence,...i,...a},s=gt(n),c=o.enabled===void 0?void 0:Z(o.enabled),l=o.target===void 0?void 0:Z(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 Z(e){return typeof e==`function`?e():(0,t.unref)(e)}const Qt=(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*Q(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*Q(e,t):typeof e==`object`&&e&&`actions`in e&&Array.isArray(e.actions)&&(yield*Q(e.actions,t))}}function $t(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 en(e){let t=Qt(),n=F();function r(t){return()=>{let r=e?e():n.actionContext({});for(let e=t.length-1;e>=0;e--){let n=t[e];if(!Pe(n,r))continue;let i=n.execute?.(r);i instanceof Promise&&i.catch(e=>{console.error(`[useActionShortcuts] action.execute threw:`,e)});return}}}Xt(()=>{let i=new Map,a=e?e():n.actionContext({});for(let e of Q(t.allActions(),a)){if(e.keyboardShortcut===void 0||`sequence`in e.keyboardShortcut)continue;let t=e.keyboardShortcut,n=$t(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`}),Zt(()=>{let i=new Map,a=e?e():n.actionContext({});for(let e of Q(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 tn({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 Ge(e.parentAction,n,d.value)}else r=e;let i=await ke(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=S(h,80);return(0,t.watch)(s,()=>{d.value={},l.value=!0,(r.value?.$el)?.scrollTo({behavior:`instant`,top:0}),g()}),(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})})}),me(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)||I(r))i=r;else if(r instanceof Promise)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,...L(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 nn(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 rn({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?j(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=P(h.value,r())?.placeholder;return e===void 0?p.t(`search`):typeof e==`function`?e():e}),{preview:v,onKeyDown:y}=Ve({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 an(e,t){let n=[],r=e.parentAction??null;for(;r!==null;){if(r.forceAsRootMenu===!0)return n;let e=r.nameAsParent===void 0?M(r,t):j(r.nameAsParent,t);n.unshift({icon:r.icon?.(t)??null,label:e}),r=r.parentAction??null}return n.slice(-1)}function on(e){let n=F(),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 sn(e,n,r=!1){let i=Qt(),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 cn(e,n){let r=F();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 ln(e){cn(e,`view`)}var un=0,$=new WeakMap;function dn(e,t){return e===void 0?`no-group`:e.name?j(e.name,t):($.has(e)||$.set(e,`unnamed-${un++}`),$.get(e))}function fn(e,t){let n=new Map;for(let r of e){let e=r.group,i=dn(e,t),a=n.get(i);if(a===void 0){let r=e?.name?j(e.name,t):null;a={category:e?.category?j(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=R,exports._createUntypedAction=Ce,exports.actionsLocales=e.t,exports.applicableActions=ke,exports.buildCommandMenuGroups=fn,exports.createActions=De,exports.isAuthenticated=O,exports.isSubActionsWithMeta=I,exports.resolveActionAvatar=Re,exports.resolveActionBreadcrumbs=an,exports.resolveActionHint=ze,exports.resolveActionName=M,exports.resolveActionPreview=Be,exports.resolveActionSelected=N,exports.resolveActionValue=j,exports.resolveApplicable=Pe,exports.resolveSearchSubActionsConfig=P,exports.resolveSubActions=Ge,exports.storeSubActionsPagination=L,exports.typedActionDropdownMenu=we,exports.typedActionFocus=Ee,exports.typedActionTrigger=Te,exports.useActionDropdownMenuContent=Ke,exports.useActionGroup=qe,exports.useActionManagerStore=F,exports.useActionPreview=Ve,exports.useActionRegistryStore=Qt,exports.useActionShortcuts=en,exports.useCommandMenuActions=tn,exports.useCommandMenuAnimation=nn,exports.useCommandMenuNavigation=rn,exports.useFocusedModels=on,exports.useTemporaryActions=sn,exports.useViewModels=ln;
@@ -0,0 +1,22 @@
1
+ export * from './composables/actionDropdownMenuContent.composable';
2
+ export * from './composables/actionGroup.composable';
3
+ export * from './composables/actionPreview.composable';
4
+ export * from './composables/actionShortcuts.composable';
5
+ export * from './composables/commandMenuActions.composable';
6
+ export * from './composables/commandMenuAnimation.composable';
7
+ export * from './composables/commandMenuNavigation.composable';
8
+ export * from './composables/focusedModels.composable';
9
+ export * from './composables/temporaryActions.composable';
10
+ export * from './composables/viewModels.composable';
11
+ export * from './createActions';
12
+ export * from './locales';
13
+ export * from './stores/actionManager.store';
14
+ export * from './stores/actionRegistry.store';
15
+ export * from './types/action.type';
16
+ export * from './types/actionContext.type';
17
+ export * from './types/actionGroup.type';
18
+ export * from './types/actionModel.type';
19
+ export * from './types/commandMenu.type';
20
+ export * from './utils/commandMenuGroups.util';
21
+ export * from './utils/resolveActions.util';
22
+ export * from './utils/subActions.util';