@wisemen/vue-core-actions 0.2.2 → 0.2.3
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 +1 -1
- package/dist/index.js +187 -189
- package/package.json +1 -1
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=(0,t.shallowRef)(!1);function ce(e){se.value=e}function le(e){return e}function A(e){return typeof e?.then==`function`}var ue=/[\s\-_./]+/;async function de(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();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=he(i.slice(0,e),n);s.push(...t)}else if(fe(i)){let t=he(i.actions.slice(0,e),n);s.push(...t)}else{let t=n;a.push(async()=>he(await pe(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:ge(e,t.searchInput,t)})).filter(({score:e})=>e>=ie);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&&I(e.action,t)?0:1,l=s?.showSelectedSubActionsFirst!==!1&&I(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=N(e.action,t),f=N(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&&I(e,t)?0:1,i=s&&I(n,t)?0:1;return r===i?N(e,t)-N(n,t):r-i})}function fe(e){return typeof e==`object`&&!!e&&`actions`in e&&`pagination`in e&&Array.isArray(e.actions)}async function pe(e,t){if(A(e)){let n=await e;return fe(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 me(e){let t=[];for(let n of e)typeof n==`function`?t.push(...n()):t.push(n);return t}function he(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!(!se.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 ge(e,t,n){if(t.trim().length===0||e.skipFilterScoring)return 1;let r=F(e,n),i=_e(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=ve(r,t),o=ve(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 _e(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 ve(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(ue);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 ye(e,t){return typeof e.avatar==`function`?e.avatar(t):e.avatar??null}function be(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 xe(e,t){return typeof e.preview==`function`?e.preview(t):null}function Se({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:xe(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 Ce(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 we(e,t,n){e.execute!==void 0&&(await e.execute(t),n?.onComplete?.())}function Te(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=Ce(`[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=Te([...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:we,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 Ee(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 De({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}=Se({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 Ee(a.value,n,m.value));let i=await de(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 Oe=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 ke(){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 Ae=Symbol(`HotkeysContext`);function je(){return(0,t.inject)(Ae,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 Me(e,t=V()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var Ne=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),Pe=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),Fe=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),Ie=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),Le=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),Re=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),ze={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Semicolon:`;`,Slash:`/`};[...Ne,...Pe,...Fe,...Ie,...Le,...Re];var Be={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 Ve(e){return/^\p{Letter}$/u.test(e)}function W(e){if(!e)return``;if(e in Be)return Be[e];if(Ve(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=Me(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 He(e,t=V()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(Me(`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 Ue(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 We(e,t=V()){return Ue(G(e,t),t)}function Ge(e,t=V()){return Ue(e,t)}function Ke(e,t=V()){return typeof e==`string`?We(e,t):Ge(He(e,t),t)}function qe(e){return e in U||e.toLowerCase()in U}function Je(e){return e.join(` `)}function Ye(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(Ve(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 ze?ze[e.code]===a:!1}return i===a}var Xe={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function Ze(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function Qe(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 $e(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 et(e,t,n){let r=$e(t);return r&&Qe(r)&&r!==n||e.composedPath().some(e=>Qe(e)&&e!==n)?!0:Qe(e.target)&&e.target!==n}function tt(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 nt(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 rt({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 it(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 at=[],J=0,{link:ot,unlink:st,propagate:ct,checkDirty:lt,shallowPropagate:ut}=rt({update(e){return e._update()},notify(e){at[dt++]=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,dt=0,X,ft=0;function Z(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=st(n,e)}function pt(){if(!(ft>0)){for(;Y<dt;){let e=at[Y];at[Y++]=void 0,e.notify()}Y=0,dt=0}}function mt(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&&ot(i,X,J),i._snapshot},subscribe(e){let t=it(e),n={current:!1},r=ht(()=>{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&<(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&ut(e)}}else e&q.Pending&&(i.flags=e&~q.Pending);return X!==void 0&&ot(i,X,J),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(ct(e),ut(e),pt())}},i}function ht(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&<(this.deps,this)?t():this.flags=q.Watching},stop(){this.flags=q.None,this.depsTail=void 0,Z(this)}};return t(),n}var gt=class{constructor(e,t){this.atom=mt(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(it(e))}},_t=0;function vt(){return`hotkey_${++_t}`}var yt=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new gt(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:vt(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=vt(),i=n.platform??this.#t,a=typeof e==`string`?G(e,i):He(e,i),o=typeof e==`string`?e:Ye(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&nt(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??Ze(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...Xe,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&&tt(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&et(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 bt(){return yt.getInstance()}var xt=1e3,St=0;function Ct(){return`sequence_${++St}`}function wt(e){return e.join(`|`)}function Tt(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 Et=class e{static#e=null;#t=new Map;#n=new Map;#r=new Map;#i;constructor(){this.registrations=new gt(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,Tt(e)))}register(e,t,n={}){if(e.length===0)throw Error(`Sequence must contain at least one hotkey`);let r=Ct(),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&&nt(c.id,Je(e),s,e=>this.#o(e));let l=a[0],u=n.ignoreInputs??Ze(l),d={id:r,sequence:e,parsedSequence:a,callback:t,options:{...Xe,timeout:xt,...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,Tt(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,Tt(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(qe(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||!tt(e,t)||!r.options.enabled)continue;if(r.options.ignoreInputs!==!1&&et(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=wt(e);for(let e of this.#t.values())if(wt(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 Dt(){return Et.getInstance()}function Ot(e,n={}){let r=je(),i=bt(),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=Ke(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 kt(e,n={}){let r=je(),i=Dt(),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=Je(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 At=(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*jt(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*jt(e,t):typeof e==`object`&&e&&`actions`in e&&Array.isArray(e.actions)&&(yield*jt(e.actions,t))}}function Mt(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 Nt(e){let t=At(),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}}}Ot(()=>{let i=new Map,a=e?e():n.actionContext({});for(let e of jt(t.allActions(),a)){if(e.keyboardShortcut===void 0||`sequence`in e.keyboardShortcut)continue;let t=e.keyboardShortcut,n=Mt(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`}),kt(()=>{let i=new Map,a=e?e():n.actionContext({});for(let e of jt(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 Pt({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 Ee(e.parentAction,n,d.value)}else r=e;let i=await de(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 Ft(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 It({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}=Se({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 Lt(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 Rt(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 zt(e,n,r=!1){let i=At(),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 Bt(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 Vt(e){Bt(e,`view`)}var Ht=0,Ut=new WeakMap;function Wt(e,t){return e===void 0?`no-group`:e.name?P(e.name,t):(Ut.has(e)||Ut.set(e,`unnamed-${Ht++}`),Ut.get(e))}function Gt(e,t){let n=new Map;for(let r of e){let e=r.group,i=Wt(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=Oe,exports.actionsLocales=e.t,exports.applicableActions=de,exports.buildCommandMenuGroups=Gt,exports.createAction=le,exports.isAuthenticated=se,exports.isSubActionsWithMeta=z,exports.resolveActionAvatar=ye,exports.resolveActionBreadcrumbs=Lt,exports.resolveActionHint=be,exports.resolveActionName=F,exports.resolveActionPreview=xe,exports.resolveActionSelected=I,exports.resolveActionValue=P,exports.resolveApplicable=M,exports.resolveSearchSubActionsConfig=L,exports.resolveSubActions=Ee,exports.setIsAuthenticated=ce,exports.storeSubActionsPagination=B,exports.useActionDropdownMenuContent=De,exports.useActionGroup=ke,exports.useActionManagerStore=R,exports.useActionPreview=Se,exports.useActionRegistryStore=At,exports.useActionShortcuts=Nt,exports.useCommandMenuActions=Pt,exports.useCommandMenuAnimation=Ft,exports.useCommandMenuNavigation=It,exports.useFocusedModels=Rt,exports.useTemporaryActions=zt,exports.useViewModels=Vt;
|
|
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;
|
package/dist/index.js
CHANGED
|
@@ -311,11 +311,11 @@ function ye(e, n, r = {}) {
|
|
|
311
311
|
}
|
|
312
312
|
//#endregion
|
|
313
313
|
//#region src/const/index.ts
|
|
314
|
-
var be = .24, xe = .85, Se = -.15, Ce = m(!1);
|
|
315
|
-
function we(e) {
|
|
316
|
-
Ce.value = e;
|
|
317
|
-
}
|
|
314
|
+
var be = .24, xe = .85, Se = -.15, Ce = .05, we = m(!1);
|
|
318
315
|
function Te(e) {
|
|
316
|
+
we.value = e;
|
|
317
|
+
}
|
|
318
|
+
function Ee(e) {
|
|
319
319
|
return e;
|
|
320
320
|
}
|
|
321
321
|
//#endregion
|
|
@@ -325,9 +325,9 @@ function j(e) {
|
|
|
325
325
|
}
|
|
326
326
|
//#endregion
|
|
327
327
|
//#region src/utils/resolveActions.util.ts
|
|
328
|
-
var
|
|
329
|
-
async function
|
|
330
|
-
let i = t.searchInput.length, a = i >= 0, o =
|
|
328
|
+
var De = /[\s\-_./]+/;
|
|
329
|
+
async function Oe(e, t, n, r) {
|
|
330
|
+
let i = t.searchInput.length, a = i >= 0, o = je(e);
|
|
331
331
|
if (a) {
|
|
332
332
|
let e = [], a = [], s = [...o];
|
|
333
333
|
for (; s.length > 0;) {
|
|
@@ -337,14 +337,14 @@ async function De(e, t, n, r) {
|
|
|
337
337
|
if (n.subActions !== void 0 && o) {
|
|
338
338
|
let e = r?.maxResults ?? 99, i = n.subActions(t);
|
|
339
339
|
if (Array.isArray(i)) {
|
|
340
|
-
let t =
|
|
340
|
+
let t = Me(i.slice(0, e), n);
|
|
341
341
|
s.push(...t);
|
|
342
|
-
} else if (
|
|
343
|
-
let t =
|
|
342
|
+
} else if (ke(i)) {
|
|
343
|
+
let t = Me(i.actions.slice(0, e), n);
|
|
344
344
|
s.push(...t);
|
|
345
345
|
} else {
|
|
346
346
|
let t = n;
|
|
347
|
-
a.push(async () =>
|
|
347
|
+
a.push(async () => Me(await Ae(i, e), t));
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
}
|
|
@@ -377,17 +377,15 @@ function M(e, t, n) {
|
|
|
377
377
|
if (r) {
|
|
378
378
|
let e = o.map((e) => ({
|
|
379
379
|
action: e,
|
|
380
|
-
score:
|
|
380
|
+
score: Ne(e, t.searchInput, t)
|
|
381
381
|
})).filter(({ score: e }) => e >= be);
|
|
382
382
|
return e = e.toSorted((e, r) => {
|
|
383
|
-
let i = e.action.parentAction
|
|
384
|
-
if (
|
|
385
|
-
let
|
|
386
|
-
if (c !== l) return
|
|
387
|
-
let u =
|
|
388
|
-
|
|
389
|
-
let d = P(e.action, t), f = P(r.action, t);
|
|
390
|
-
return d === f ? u : d - f;
|
|
383
|
+
let i = e.action.parentAction ?? n, a = r.action.parentAction ?? n, o = i?.showSelectedSubActionsFirst !== !1 && L(e.action, t) ? 0 : 1, s = a?.showSelectedSubActionsFirst !== !1 && L(r.action, t) ? 0 : 1;
|
|
384
|
+
if (o !== s) return o - s;
|
|
385
|
+
let c = Math.floor(e.score / Ce + 1e-9), l = Math.floor(r.score / Ce + 1e-9);
|
|
386
|
+
if (c !== l) return l - c;
|
|
387
|
+
let u = P(e.action, t), d = P(r.action, t);
|
|
388
|
+
return u === d ? r.score - e.score : u - d;
|
|
391
389
|
}), e.map((e) => e.action);
|
|
392
390
|
}
|
|
393
391
|
let s = n?.showSelectedSubActionsFirst !== !1;
|
|
@@ -396,25 +394,25 @@ function M(e, t, n) {
|
|
|
396
394
|
return r === i ? P(e, t) - P(n, t) : r - i;
|
|
397
395
|
});
|
|
398
396
|
}
|
|
399
|
-
function
|
|
397
|
+
function ke(e) {
|
|
400
398
|
return typeof e == "object" && !!e && "actions" in e && "pagination" in e && Array.isArray(e.actions);
|
|
401
399
|
}
|
|
402
|
-
async function
|
|
400
|
+
async function Ae(e, t) {
|
|
403
401
|
if (j(e)) {
|
|
404
402
|
let n = await e;
|
|
405
|
-
return
|
|
403
|
+
return ke(n) ? n.actions.slice(0, t) : n.slice(0, t);
|
|
406
404
|
}
|
|
407
405
|
if (e == null || !(Symbol.asyncIterator in e)) return [];
|
|
408
406
|
let n = [];
|
|
409
407
|
for await (let r of e) if (n.push(r), n.length >= t) break;
|
|
410
408
|
return n;
|
|
411
409
|
}
|
|
412
|
-
function
|
|
410
|
+
function je(e) {
|
|
413
411
|
let t = [];
|
|
414
412
|
for (let n of e) typeof n == "function" ? t.push(...n()) : t.push(n);
|
|
415
413
|
return t;
|
|
416
414
|
}
|
|
417
|
-
function
|
|
415
|
+
function Me(e, t) {
|
|
418
416
|
let n = t.rootAction ?? t;
|
|
419
417
|
return e.map((e) => ({
|
|
420
418
|
...e,
|
|
@@ -425,23 +423,23 @@ function je(e, t) {
|
|
|
425
423
|
}));
|
|
426
424
|
}
|
|
427
425
|
function N(e, t) {
|
|
428
|
-
return !(!
|
|
426
|
+
return !(!we.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);
|
|
429
427
|
}
|
|
430
428
|
function P(e, t) {
|
|
431
429
|
let n = e.group?.priority ?? null;
|
|
432
430
|
return n === null ? 9999 : typeof n == "function" ? n(t) : n;
|
|
433
431
|
}
|
|
434
|
-
function
|
|
432
|
+
function Ne(e, t, n) {
|
|
435
433
|
if (t.trim().length === 0 || e.skipFilterScoring) return 1;
|
|
436
|
-
let r = I(e, n), i =
|
|
434
|
+
let r = I(e, n), i = Pe(e, n);
|
|
437
435
|
if (e.keywordsExactMatch) {
|
|
438
436
|
let t = Array.isArray(e.keywordsExactMatch) ? e.keywordsExactMatch : [e.keywordsExactMatch];
|
|
439
437
|
if (t.some((e) => r.toLowerCase().includes(e.toLowerCase())) || t.some((e) => i.toLowerCase().includes(e.toLowerCase()))) return 1;
|
|
440
438
|
}
|
|
441
|
-
let a =
|
|
439
|
+
let a = Fe(r, t), o = Fe(i, t) * xe, s = Math.max(a, o);
|
|
442
440
|
return s < .24 && (r.toLowerCase().includes(t.toLowerCase()) ? s = .29 : i.toLowerCase().includes(t.toLowerCase()) && (s = .245)), e.parentAction && (s += Se), e.scoreOverride !== void 0 && (s = e.scoreOverride), e.sortPriority !== void 0 && (s -= e.sortPriority * 1e-4), s;
|
|
443
441
|
}
|
|
444
|
-
function
|
|
442
|
+
function Pe(e, t) {
|
|
445
443
|
let n = [], r = e.parentScoreInfluence ?? "all";
|
|
446
444
|
if (r !== "none") {
|
|
447
445
|
let i = e.parentAction;
|
|
@@ -460,14 +458,14 @@ function Ne(e, t) {
|
|
|
460
458
|
}
|
|
461
459
|
return n.join(" ");
|
|
462
460
|
}
|
|
463
|
-
function
|
|
461
|
+
function Fe(e, t) {
|
|
464
462
|
if (!e || !t) return 0;
|
|
465
463
|
let n = e.toLowerCase().trim(), r = t.toLowerCase().trim();
|
|
466
464
|
if (!r || n === r) return 1;
|
|
467
465
|
if (n.startsWith(r)) return .92 - Math.min(.12, (n.length - r.length) * .002);
|
|
468
466
|
let i = n.indexOf(r);
|
|
469
467
|
if (i !== -1) return .82 - Math.min(.12, i * .004);
|
|
470
|
-
let a = n.split(
|
|
468
|
+
let a = n.split(De);
|
|
471
469
|
if (a.some((e) => e.startsWith(r))) return .68;
|
|
472
470
|
let o = a.map((e) => e[0] ?? "").join("");
|
|
473
471
|
if (o === r || o.startsWith(r)) return .6;
|
|
@@ -485,10 +483,10 @@ function F(e, t) {
|
|
|
485
483
|
function I(e, t) {
|
|
486
484
|
return typeof e.name == "function" ? e.name(t) : e.name;
|
|
487
485
|
}
|
|
488
|
-
function
|
|
486
|
+
function Ie(e, t) {
|
|
489
487
|
return typeof e.avatar == "function" ? e.avatar(t) : e.avatar ?? null;
|
|
490
488
|
}
|
|
491
|
-
function
|
|
489
|
+
function Le(e, t) {
|
|
492
490
|
return typeof e.hint == "function" ? e.hint(t) : e.hint ?? null;
|
|
493
491
|
}
|
|
494
492
|
function L(e, t) {
|
|
@@ -497,16 +495,16 @@ function L(e, t) {
|
|
|
497
495
|
function R(e, t) {
|
|
498
496
|
return typeof e.searchSubActionsConfig == "function" ? e.searchSubActionsConfig(t) : e.searchSubActionsConfig ?? null;
|
|
499
497
|
}
|
|
500
|
-
function
|
|
498
|
+
function Re(e, t) {
|
|
501
499
|
return typeof e.preview == "function" ? e.preview(t) : null;
|
|
502
500
|
}
|
|
503
501
|
//#endregion
|
|
504
502
|
//#region src/composables/actionPreview.composable.ts
|
|
505
|
-
function
|
|
503
|
+
function ze({ highlightedActionId: e, getContext: n, resolvedActions: r }) {
|
|
506
504
|
let i = p(!1), a = t(() => {
|
|
507
505
|
if (e.value === null || !i.value) return null;
|
|
508
506
|
let t = r.value.find((t) => t.id === e.value) ?? null;
|
|
509
|
-
return t === null ? null :
|
|
507
|
+
return t === null ? null : Re(t, n());
|
|
510
508
|
});
|
|
511
509
|
function o() {
|
|
512
510
|
i.value = !0;
|
|
@@ -528,7 +526,7 @@ function Re({ highlightedActionId: e, getContext: n, resolvedActions: r }) {
|
|
|
528
526
|
}
|
|
529
527
|
//#endregion
|
|
530
528
|
//#region src/composables/isSelectorVisible.composable.ts
|
|
531
|
-
function
|
|
529
|
+
function Be(e) {
|
|
532
530
|
let t = p(!1), n = null;
|
|
533
531
|
function r() {
|
|
534
532
|
t.value = document.querySelector(e) !== null;
|
|
@@ -544,15 +542,15 @@ function ze(e) {
|
|
|
544
542
|
}
|
|
545
543
|
//#endregion
|
|
546
544
|
//#region src/stores/actionManager.store.ts
|
|
547
|
-
async function
|
|
545
|
+
async function Ve(e, t, n) {
|
|
548
546
|
e.execute !== void 0 && (await e.execute(t), n?.onComplete?.());
|
|
549
547
|
}
|
|
550
|
-
function
|
|
548
|
+
function He(e) {
|
|
551
549
|
let t = /* @__PURE__ */ new Set();
|
|
552
550
|
return e.filter((e) => t.has(e) ? !1 : (t.add(e), !0));
|
|
553
551
|
}
|
|
554
552
|
var z = y("actionManager", () => {
|
|
555
|
-
let e = p([]), t = p([]), n = p({}), r = x(), i = b(), a =
|
|
553
|
+
let e = p([]), t = p([]), n = p({}), r = x(), i = b(), a = Be("[data-dialog]:not([data-command-menu])");
|
|
556
554
|
function o(e) {
|
|
557
555
|
n.value = {
|
|
558
556
|
...n.value,
|
|
@@ -570,7 +568,7 @@ var z = y("actionManager", () => {
|
|
|
570
568
|
t.value = e;
|
|
571
569
|
}
|
|
572
570
|
function u(o) {
|
|
573
|
-
let s =
|
|
571
|
+
let s = He([
|
|
574
572
|
...o.models ?? [],
|
|
575
573
|
...t.value,
|
|
576
574
|
...e.value
|
|
@@ -603,7 +601,7 @@ var z = y("actionManager", () => {
|
|
|
603
601
|
}
|
|
604
602
|
return {
|
|
605
603
|
actionContext: u,
|
|
606
|
-
executeAction:
|
|
604
|
+
executeAction: Ve,
|
|
607
605
|
focusedModels: e,
|
|
608
606
|
metadata: n,
|
|
609
607
|
registerMetadata: o,
|
|
@@ -621,7 +619,7 @@ function B(e) {
|
|
|
621
619
|
function V(e, t, n) {
|
|
622
620
|
return B(t) ? (e.id && (n[e.id] = t.pagination.nextOffset), t.actions) : (e.id && delete n[e.id], t);
|
|
623
621
|
}
|
|
624
|
-
async function
|
|
622
|
+
async function Ue(e, t, n, r = 297) {
|
|
625
623
|
if (e.subActions === void 0) return [];
|
|
626
624
|
let i = e.subActions(t);
|
|
627
625
|
if (Array.isArray(i) || B(i)) return V(e, i, n);
|
|
@@ -632,13 +630,13 @@ async function He(e, t, n, r = 297) {
|
|
|
632
630
|
}
|
|
633
631
|
//#endregion
|
|
634
632
|
//#region src/composables/actionDropdownMenuContent.composable.ts
|
|
635
|
-
function
|
|
633
|
+
function We({ actions: e, metadata: n, models: r, parentAction: i, scrollContainerRef: a }) {
|
|
636
634
|
let o = v(), s = z(), c = p(null), l = p(""), u = p(""), d = p(!1), f = p([]), m = p({}), h = p(!0), g = 0, y = t(() => s.actionContext({
|
|
637
635
|
menuType: "contextualMenu",
|
|
638
636
|
metadata: n.value,
|
|
639
637
|
models: r.value,
|
|
640
638
|
searchInput: u.value
|
|
641
|
-
})), { preview: b, onHidePreview: x, onKeyDown: S, onShowPreview: C } =
|
|
639
|
+
})), { preview: b, onHidePreview: x, onKeyDown: S, onShowPreview: C } = ze({
|
|
642
640
|
highlightedActionId: c,
|
|
643
641
|
getContext: () => y.value,
|
|
644
642
|
resolvedActions: f
|
|
@@ -651,8 +649,8 @@ function Ue({ actions: e, metadata: n, models: r, parentAction: i, scrollContain
|
|
|
651
649
|
let t = ++g, n = y.value;
|
|
652
650
|
try {
|
|
653
651
|
let r = e.value;
|
|
654
|
-
i.value?.subActions !== void 0 && (r = await
|
|
655
|
-
let a = await
|
|
652
|
+
i.value?.subActions !== void 0 && (r = await Ue(i.value, n, m.value));
|
|
653
|
+
let a = await Oe(r, n, (e) => {
|
|
656
654
|
t !== g || e.length === 0 || (f.value = e);
|
|
657
655
|
}, i.value ?? void 0);
|
|
658
656
|
if (t !== g) return;
|
|
@@ -720,10 +718,10 @@ function Ue({ actions: e, metadata: n, models: r, parentAction: i, scrollContain
|
|
|
720
718
|
}
|
|
721
719
|
//#endregion
|
|
722
720
|
//#region src/composables/actionGroup.composable.ts
|
|
723
|
-
var
|
|
721
|
+
var Ge = /* @__PURE__ */ function(e) {
|
|
724
722
|
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;
|
|
725
723
|
}({});
|
|
726
|
-
function
|
|
724
|
+
function Ke() {
|
|
727
725
|
let e = v();
|
|
728
726
|
return {
|
|
729
727
|
account: {
|
|
@@ -758,9 +756,9 @@ function Ge() {
|
|
|
758
756
|
}
|
|
759
757
|
//#endregion
|
|
760
758
|
//#region ../../../node_modules/.pnpm/@tanstack+vue-hotkeys@0.10.0_vue@3.5.27_typescript@5.9.3_/node_modules/@tanstack/vue-hotkeys/dist/HotkeysProviderContext.js
|
|
761
|
-
var
|
|
762
|
-
function
|
|
763
|
-
return i(
|
|
759
|
+
var qe = Symbol("HotkeysContext");
|
|
760
|
+
function Je() {
|
|
761
|
+
return i(qe, null)?.defaultOptions ?? {};
|
|
764
762
|
}
|
|
765
763
|
//#endregion
|
|
766
764
|
//#region ../../../node_modules/.pnpm/@tanstack+hotkeys@0.8.0/node_modules/@tanstack/hotkeys/dist/constants.js
|
|
@@ -802,10 +800,10 @@ var W = {
|
|
|
802
800
|
commandorcontrol: "Mod",
|
|
803
801
|
mod: "Mod"
|
|
804
802
|
};
|
|
805
|
-
function
|
|
803
|
+
function Ye(e, t = H()) {
|
|
806
804
|
return e === "Mod" ? t === "mac" ? "Meta" : "Control" : e;
|
|
807
805
|
}
|
|
808
|
-
var
|
|
806
|
+
var Xe = /* @__PURE__ */ new Set(/* @__PURE__ */ "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")), Ze = /* @__PURE__ */ new Set([
|
|
809
807
|
"0",
|
|
810
808
|
"1",
|
|
811
809
|
"2",
|
|
@@ -816,7 +814,7 @@ var Ye = /* @__PURE__ */ new Set(/* @__PURE__ */ "ABCDEFGHIJKLMNOPQRSTUVWXYZ".sp
|
|
|
816
814
|
"7",
|
|
817
815
|
"8",
|
|
818
816
|
"9"
|
|
819
|
-
]),
|
|
817
|
+
]), Qe = /* @__PURE__ */ new Set([
|
|
820
818
|
"F1",
|
|
821
819
|
"F2",
|
|
822
820
|
"F3",
|
|
@@ -829,7 +827,7 @@ var Ye = /* @__PURE__ */ new Set(/* @__PURE__ */ "ABCDEFGHIJKLMNOPQRSTUVWXYZ".sp
|
|
|
829
827
|
"F10",
|
|
830
828
|
"F11",
|
|
831
829
|
"F12"
|
|
832
|
-
]),
|
|
830
|
+
]), $e = /* @__PURE__ */ new Set([
|
|
833
831
|
"ArrowUp",
|
|
834
832
|
"ArrowDown",
|
|
835
833
|
"ArrowLeft",
|
|
@@ -838,14 +836,14 @@ var Ye = /* @__PURE__ */ new Set(/* @__PURE__ */ "ABCDEFGHIJKLMNOPQRSTUVWXYZ".sp
|
|
|
838
836
|
"End",
|
|
839
837
|
"PageUp",
|
|
840
838
|
"PageDown"
|
|
841
|
-
]),
|
|
839
|
+
]), et = /* @__PURE__ */ new Set([
|
|
842
840
|
"Enter",
|
|
843
841
|
"Escape",
|
|
844
842
|
"Space",
|
|
845
843
|
"Tab",
|
|
846
844
|
"Backspace",
|
|
847
845
|
"Delete"
|
|
848
|
-
]),
|
|
846
|
+
]), tt = /* @__PURE__ */ new Set([
|
|
849
847
|
"/",
|
|
850
848
|
"[",
|
|
851
849
|
"]",
|
|
@@ -856,7 +854,7 @@ var Ye = /* @__PURE__ */ new Set(/* @__PURE__ */ "ABCDEFGHIJKLMNOPQRSTUVWXYZ".sp
|
|
|
856
854
|
".",
|
|
857
855
|
";",
|
|
858
856
|
"`"
|
|
859
|
-
]),
|
|
857
|
+
]), nt = {
|
|
860
858
|
Backquote: "`",
|
|
861
859
|
Backslash: "\\",
|
|
862
860
|
BracketLeft: "[",
|
|
@@ -869,14 +867,14 @@ var Ye = /* @__PURE__ */ new Set(/* @__PURE__ */ "ABCDEFGHIJKLMNOPQRSTUVWXYZ".sp
|
|
|
869
867
|
Slash: "/"
|
|
870
868
|
};
|
|
871
869
|
[
|
|
872
|
-
...Ye,
|
|
873
870
|
...Xe,
|
|
874
871
|
...Ze,
|
|
875
872
|
...Qe,
|
|
876
873
|
...$e,
|
|
877
|
-
...et
|
|
874
|
+
...et,
|
|
875
|
+
...tt
|
|
878
876
|
];
|
|
879
|
-
var
|
|
877
|
+
var rt = {
|
|
880
878
|
Esc: "Escape",
|
|
881
879
|
esc: "Escape",
|
|
882
880
|
escape: "Escape",
|
|
@@ -913,13 +911,13 @@ var nt = {
|
|
|
913
911
|
pgup: "PageUp",
|
|
914
912
|
pgdn: "PageDown"
|
|
915
913
|
};
|
|
916
|
-
function
|
|
914
|
+
function it(e) {
|
|
917
915
|
return /^\p{Letter}$/u.test(e);
|
|
918
916
|
}
|
|
919
917
|
function G(e) {
|
|
920
918
|
if (!e) return "";
|
|
921
|
-
if (e in
|
|
922
|
-
if (
|
|
919
|
+
if (e in rt) return rt[e];
|
|
920
|
+
if (it(e)) {
|
|
923
921
|
let t = e.toUpperCase();
|
|
924
922
|
return t.length === 1 ? t : e;
|
|
925
923
|
}
|
|
@@ -936,7 +934,7 @@ function K(e, t = H()) {
|
|
|
936
934
|
else {
|
|
937
935
|
let e = W[a] ?? W[a.toLowerCase()];
|
|
938
936
|
if (e) {
|
|
939
|
-
let n =
|
|
937
|
+
let n = Ye(e, t);
|
|
940
938
|
r.add(n);
|
|
941
939
|
} else n.length === 1 && (i = G(a));
|
|
942
940
|
}
|
|
@@ -950,9 +948,9 @@ function K(e, t = H()) {
|
|
|
950
948
|
modifiers: U.filter((e) => r.has(e))
|
|
951
949
|
};
|
|
952
950
|
}
|
|
953
|
-
function
|
|
951
|
+
function at(e, t = H()) {
|
|
954
952
|
let n = e.ctrl ?? !1, r = e.shift ?? !1, i = e.alt ?? !1, a = e.meta ?? !1;
|
|
955
|
-
e.mod && (
|
|
953
|
+
e.mod && (Ye("Mod", t) === "Control" ? n = !0 : a = !0);
|
|
956
954
|
let o = U.filter((e) => {
|
|
957
955
|
switch (e) {
|
|
958
956
|
case "Control": return n;
|
|
@@ -971,30 +969,30 @@ function it(e, t = H()) {
|
|
|
971
969
|
modifiers: o
|
|
972
970
|
};
|
|
973
971
|
}
|
|
974
|
-
function
|
|
972
|
+
function ot(e, t) {
|
|
975
973
|
let n = t === "mac" ? e.meta && !e.ctrl : e.ctrl && !e.meta, r = [];
|
|
976
974
|
if (n) r.push("Mod"), e.alt && r.push("Alt"), e.shift && r.push("Shift");
|
|
977
975
|
else for (let t of U) e.modifiers.includes(t) && r.push(t);
|
|
978
976
|
return r.push(G(e.key)), r.join("+");
|
|
979
977
|
}
|
|
980
|
-
function ot(e, t = H()) {
|
|
981
|
-
return at(K(e, t), t);
|
|
982
|
-
}
|
|
983
978
|
function st(e, t = H()) {
|
|
984
|
-
return
|
|
979
|
+
return ot(K(e, t), t);
|
|
985
980
|
}
|
|
986
981
|
function ct(e, t = H()) {
|
|
987
|
-
return
|
|
982
|
+
return ot(e, t);
|
|
988
983
|
}
|
|
989
|
-
function lt(e) {
|
|
984
|
+
function lt(e, t = H()) {
|
|
985
|
+
return typeof e == "string" ? st(e, t) : ct(at(e, t), t);
|
|
986
|
+
}
|
|
987
|
+
function ut(e) {
|
|
990
988
|
return e in W || e.toLowerCase() in W;
|
|
991
989
|
}
|
|
992
990
|
//#endregion
|
|
993
991
|
//#region ../../../node_modules/.pnpm/@tanstack+hotkeys@0.8.0/node_modules/@tanstack/hotkeys/dist/format.js
|
|
994
|
-
function
|
|
992
|
+
function dt(e) {
|
|
995
993
|
return e.join(" ");
|
|
996
994
|
}
|
|
997
|
-
function
|
|
995
|
+
function ft(e) {
|
|
998
996
|
let t = [];
|
|
999
997
|
for (let n of U) e.modifiers.includes(n) && t.push(n);
|
|
1000
998
|
return t.push(e.key), t.join("+");
|
|
@@ -1007,7 +1005,7 @@ function q(e, t, n = H()) {
|
|
|
1007
1005
|
let i = G(e.key), a = r.key;
|
|
1008
1006
|
if (i !== "Dead" && i.length === 1 && a.length === 1) {
|
|
1009
1007
|
if (i.toUpperCase() === a.toUpperCase()) return !0;
|
|
1010
|
-
if (
|
|
1008
|
+
if (it(i) && (/^[A-Za-z]$/.test(i) || !e.altKey)) return !1;
|
|
1011
1009
|
}
|
|
1012
1010
|
if (e.code && (i === "Dead" || i.length === 1 && a.length === 1)) {
|
|
1013
1011
|
if (e.code.startsWith("Key")) {
|
|
@@ -1018,13 +1016,13 @@ function q(e, t, n = H()) {
|
|
|
1018
1016
|
let t = e.code.slice(5);
|
|
1019
1017
|
if (t.length === 1 && /^[0-9]$/.test(t)) return t === a;
|
|
1020
1018
|
}
|
|
1021
|
-
return e.code in
|
|
1019
|
+
return e.code in nt ? nt[e.code] === a : !1;
|
|
1022
1020
|
}
|
|
1023
1021
|
return i === a;
|
|
1024
1022
|
}
|
|
1025
1023
|
//#endregion
|
|
1026
1024
|
//#region ../../../node_modules/.pnpm/@tanstack+hotkeys@0.8.0/node_modules/@tanstack/hotkeys/dist/manager.utils.js
|
|
1027
|
-
var
|
|
1025
|
+
var pt = {
|
|
1028
1026
|
preventDefault: !0,
|
|
1029
1027
|
stopPropagation: !0,
|
|
1030
1028
|
eventType: "keydown",
|
|
@@ -1032,10 +1030,10 @@ var ft = {
|
|
|
1032
1030
|
ignoreInputs: !0,
|
|
1033
1031
|
conflictBehavior: "warn"
|
|
1034
1032
|
};
|
|
1035
|
-
function
|
|
1033
|
+
function mt(e) {
|
|
1036
1034
|
return !(e.ctrl || e.meta || e.key === "Escape");
|
|
1037
1035
|
}
|
|
1038
|
-
function
|
|
1036
|
+
function ht(e) {
|
|
1039
1037
|
if (!e) return !1;
|
|
1040
1038
|
if (e instanceof HTMLInputElement) {
|
|
1041
1039
|
let t = e.type.toLowerCase();
|
|
@@ -1043,17 +1041,17 @@ function mt(e) {
|
|
|
1043
1041
|
}
|
|
1044
1042
|
return !!(e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement || e instanceof HTMLElement && e.isContentEditable);
|
|
1045
1043
|
}
|
|
1046
|
-
function
|
|
1044
|
+
function gt(e) {
|
|
1047
1045
|
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;
|
|
1048
1046
|
}
|
|
1049
|
-
function
|
|
1050
|
-
let r =
|
|
1051
|
-
return r &&
|
|
1047
|
+
function _t(e, t, n) {
|
|
1048
|
+
let r = gt(t);
|
|
1049
|
+
return r && ht(r) && r !== n || e.composedPath().some((e) => ht(e) && e !== n) ? !0 : ht(e.target) && e.target !== n;
|
|
1052
1050
|
}
|
|
1053
|
-
function
|
|
1051
|
+
function vt(e, t) {
|
|
1054
1052
|
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)));
|
|
1055
1053
|
}
|
|
1056
|
-
function
|
|
1054
|
+
function yt(e, t, n, r) {
|
|
1057
1055
|
if (n !== "allow") {
|
|
1058
1056
|
if (n === "warn") {
|
|
1059
1057
|
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.`);
|
|
@@ -1069,7 +1067,7 @@ var J = /* @__PURE__ */ function(e) {
|
|
|
1069
1067
|
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;
|
|
1070
1068
|
}({});
|
|
1071
1069
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1072
|
-
function
|
|
1070
|
+
function bt({ update: e, notify: t, unwatched: n }) {
|
|
1073
1071
|
return {
|
|
1074
1072
|
link: r,
|
|
1075
1073
|
unlink: i,
|
|
@@ -1188,7 +1186,7 @@ function yt({ update: e, notify: t, unwatched: n }) {
|
|
|
1188
1186
|
}
|
|
1189
1187
|
//#endregion
|
|
1190
1188
|
//#region ../../../node_modules/.pnpm/@tanstack+store@0.11.0/node_modules/@tanstack/store/dist/atom.js
|
|
1191
|
-
function
|
|
1189
|
+
function xt(e, t, n) {
|
|
1192
1190
|
let r = typeof e == "object", i = r ? e : void 0;
|
|
1193
1191
|
return {
|
|
1194
1192
|
next: (r ? e.next : e)?.bind(i),
|
|
@@ -1196,31 +1194,31 @@ function bt(e, t, n) {
|
|
|
1196
1194
|
complete: (r ? e.complete : n)?.bind(i)
|
|
1197
1195
|
};
|
|
1198
1196
|
}
|
|
1199
|
-
var
|
|
1197
|
+
var St = [], Y = 0, { link: Ct, unlink: wt, propagate: Tt, checkDirty: Et, shallowPropagate: Dt } = /* @__PURE__ */ bt({
|
|
1200
1198
|
update(e) {
|
|
1201
1199
|
return e._update();
|
|
1202
1200
|
},
|
|
1203
1201
|
notify(e) {
|
|
1204
|
-
|
|
1202
|
+
St[Ot++] = e, e.flags &= ~J.Watching;
|
|
1205
1203
|
},
|
|
1206
1204
|
unwatched(e) {
|
|
1207
|
-
e.depsTail !== void 0 && (e.depsTail = void 0, e.flags = J.Mutable | J.Dirty,
|
|
1205
|
+
e.depsTail !== void 0 && (e.depsTail = void 0, e.flags = J.Mutable | J.Dirty, At(e));
|
|
1208
1206
|
}
|
|
1209
|
-
}), X = 0,
|
|
1210
|
-
function
|
|
1207
|
+
}), X = 0, Ot = 0, Z, kt = 0;
|
|
1208
|
+
function At(e) {
|
|
1211
1209
|
let t = e.depsTail, n = t === void 0 ? e.deps : t.nextDep;
|
|
1212
|
-
for (; n !== void 0;) n =
|
|
1210
|
+
for (; n !== void 0;) n = wt(n, e);
|
|
1213
1211
|
}
|
|
1214
|
-
function
|
|
1215
|
-
if (!(
|
|
1216
|
-
for (; X <
|
|
1217
|
-
let e =
|
|
1218
|
-
|
|
1212
|
+
function jt() {
|
|
1213
|
+
if (!(kt > 0)) {
|
|
1214
|
+
for (; X < Ot;) {
|
|
1215
|
+
let e = St[X];
|
|
1216
|
+
St[X++] = void 0, e.notify();
|
|
1219
1217
|
}
|
|
1220
|
-
X = 0,
|
|
1218
|
+
X = 0, Ot = 0;
|
|
1221
1219
|
}
|
|
1222
1220
|
}
|
|
1223
|
-
function
|
|
1221
|
+
function Mt(e, t) {
|
|
1224
1222
|
let n = typeof e == "function", r = e, i = {
|
|
1225
1223
|
_snapshot: n ? void 0 : e,
|
|
1226
1224
|
subs: void 0,
|
|
@@ -1229,10 +1227,10 @@ function jt(e, t) {
|
|
|
1229
1227
|
depsTail: void 0,
|
|
1230
1228
|
flags: n ? J.None : J.Mutable,
|
|
1231
1229
|
get() {
|
|
1232
|
-
return Z !== void 0 &&
|
|
1230
|
+
return Z !== void 0 && Ct(i, Z, Y), i._snapshot;
|
|
1233
1231
|
},
|
|
1234
1232
|
subscribe(e) {
|
|
1235
|
-
let t =
|
|
1233
|
+
let t = xt(e), n = { current: !1 }, r = Nt(() => {
|
|
1236
1234
|
i.get(), n.current ? t.next?.(i._snapshot) : n.current = !0;
|
|
1237
1235
|
});
|
|
1238
1236
|
return { unsubscribe: () => {
|
|
@@ -1248,34 +1246,34 @@ function jt(e, t) {
|
|
|
1248
1246
|
let t = i._snapshot, a = typeof e == "function" ? e(t) : e === void 0 && n ? r(t) : e;
|
|
1249
1247
|
return t === void 0 || !o(t, a) ? (i._snapshot = a, !0) : !1;
|
|
1250
1248
|
} finally {
|
|
1251
|
-
Z = a, n && (i.flags &= ~J.RecursedCheck),
|
|
1249
|
+
Z = a, n && (i.flags &= ~J.RecursedCheck), At(i);
|
|
1252
1250
|
}
|
|
1253
1251
|
}
|
|
1254
1252
|
};
|
|
1255
1253
|
return n ? (i.flags = J.Mutable | J.Dirty, i.get = function() {
|
|
1256
1254
|
let e = i.flags;
|
|
1257
|
-
if (e & J.Dirty || e & J.Pending &&
|
|
1255
|
+
if (e & J.Dirty || e & J.Pending && Et(i.deps, i)) {
|
|
1258
1256
|
if (i._update()) {
|
|
1259
1257
|
let e = i.subs;
|
|
1260
|
-
e !== void 0 &&
|
|
1258
|
+
e !== void 0 && Dt(e);
|
|
1261
1259
|
}
|
|
1262
1260
|
} else e & J.Pending && (i.flags = e & ~J.Pending);
|
|
1263
|
-
return Z !== void 0 &&
|
|
1261
|
+
return Z !== void 0 && Ct(i, Z, Y), i._snapshot;
|
|
1264
1262
|
}) : i.set = function(e) {
|
|
1265
1263
|
if (i._update(e)) {
|
|
1266
1264
|
let e = i.subs;
|
|
1267
|
-
e !== void 0 && (
|
|
1265
|
+
e !== void 0 && (Tt(e), Dt(e), jt());
|
|
1268
1266
|
}
|
|
1269
1267
|
}, i;
|
|
1270
1268
|
}
|
|
1271
|
-
function
|
|
1269
|
+
function Nt(e) {
|
|
1272
1270
|
let t = () => {
|
|
1273
1271
|
let t = Z;
|
|
1274
1272
|
Z = n, ++Y, n.depsTail = void 0, n.flags = J.Watching | J.RecursedCheck;
|
|
1275
1273
|
try {
|
|
1276
1274
|
return e();
|
|
1277
1275
|
} finally {
|
|
1278
|
-
Z = t, n.flags &= ~J.RecursedCheck,
|
|
1276
|
+
Z = t, n.flags &= ~J.RecursedCheck, At(n);
|
|
1279
1277
|
}
|
|
1280
1278
|
}, n = {
|
|
1281
1279
|
deps: void 0,
|
|
@@ -1285,19 +1283,19 @@ function Mt(e) {
|
|
|
1285
1283
|
flags: J.Watching | J.RecursedCheck,
|
|
1286
1284
|
notify() {
|
|
1287
1285
|
let e = this.flags;
|
|
1288
|
-
e & J.Dirty || e & J.Pending &&
|
|
1286
|
+
e & J.Dirty || e & J.Pending && Et(this.deps, this) ? t() : this.flags = J.Watching;
|
|
1289
1287
|
},
|
|
1290
1288
|
stop() {
|
|
1291
|
-
this.flags = J.None, this.depsTail = void 0,
|
|
1289
|
+
this.flags = J.None, this.depsTail = void 0, At(this);
|
|
1292
1290
|
}
|
|
1293
1291
|
};
|
|
1294
1292
|
return t(), n;
|
|
1295
1293
|
}
|
|
1296
1294
|
//#endregion
|
|
1297
1295
|
//#region ../../../node_modules/.pnpm/@tanstack+store@0.11.0/node_modules/@tanstack/store/dist/store.js
|
|
1298
|
-
var
|
|
1296
|
+
var Pt = class {
|
|
1299
1297
|
constructor(e, t) {
|
|
1300
|
-
this.atom =
|
|
1298
|
+
this.atom = Mt(e), this.get = this.get.bind(this), this.setState = this.setState.bind(this), this.subscribe = this.subscribe.bind(this), t && (this.actions = t(this));
|
|
1301
1299
|
}
|
|
1302
1300
|
setState(e) {
|
|
1303
1301
|
this.atom.set(e);
|
|
@@ -1309,19 +1307,19 @@ var Nt = class {
|
|
|
1309
1307
|
return this.state;
|
|
1310
1308
|
}
|
|
1311
1309
|
subscribe(e) {
|
|
1312
|
-
return this.atom.subscribe(
|
|
1310
|
+
return this.atom.subscribe(xt(e));
|
|
1313
1311
|
}
|
|
1314
|
-
},
|
|
1315
|
-
function
|
|
1316
|
-
return `hotkey_${++
|
|
1312
|
+
}, Ft = 0;
|
|
1313
|
+
function It() {
|
|
1314
|
+
return `hotkey_${++Ft}`;
|
|
1317
1315
|
}
|
|
1318
|
-
var
|
|
1316
|
+
var Lt = class e {
|
|
1319
1317
|
static #e = null;
|
|
1320
1318
|
#t;
|
|
1321
1319
|
#n = /* @__PURE__ */ new Map();
|
|
1322
1320
|
#r = /* @__PURE__ */ new Map();
|
|
1323
1321
|
constructor() {
|
|
1324
|
-
this.registrations = new
|
|
1322
|
+
this.registrations = new Pt(/* @__PURE__ */ new Map()), this.#t = H();
|
|
1325
1323
|
}
|
|
1326
1324
|
static getInstance() {
|
|
1327
1325
|
return e.#e ||= new e(), e.#e;
|
|
@@ -1333,7 +1331,7 @@ var It = class e {
|
|
|
1333
1331
|
if (typeof document > "u" && !n.target) {
|
|
1334
1332
|
let e = t;
|
|
1335
1333
|
return {
|
|
1336
|
-
id:
|
|
1334
|
+
id: It(),
|
|
1337
1335
|
unregister: () => {},
|
|
1338
1336
|
get callback() {
|
|
1339
1337
|
return e;
|
|
@@ -1347,15 +1345,15 @@ var It = class e {
|
|
|
1347
1345
|
}
|
|
1348
1346
|
};
|
|
1349
1347
|
}
|
|
1350
|
-
let r =
|
|
1351
|
-
l &&
|
|
1352
|
-
let u = n.ignoreInputs ??
|
|
1348
|
+
let r = It(), i = n.platform ?? this.#t, a = typeof e == "string" ? K(e, i) : at(e, i), o = typeof e == "string" ? e : ft(a), s = n.target ?? document, c = n.conflictBehavior ?? "warn", l = this.#d(o, s);
|
|
1349
|
+
l && yt(l.id, o, c, (e) => this.#i(e));
|
|
1350
|
+
let u = n.ignoreInputs ?? mt(a), d = {
|
|
1353
1351
|
id: r,
|
|
1354
1352
|
hotkey: o,
|
|
1355
1353
|
parsedHotkey: a,
|
|
1356
1354
|
callback: t,
|
|
1357
1355
|
options: {
|
|
1358
|
-
...
|
|
1356
|
+
...pt,
|
|
1359
1357
|
requireReset: !1,
|
|
1360
1358
|
...n,
|
|
1361
1359
|
platform: i,
|
|
@@ -1430,7 +1428,7 @@ var It = class e {
|
|
|
1430
1428
|
let r = this.#r.get(t);
|
|
1431
1429
|
if (r) for (let i of r) {
|
|
1432
1430
|
let r = this.registrations.state.get(i);
|
|
1433
|
-
if (r &&
|
|
1431
|
+
if (r && vt(e, t) && r.options.enabled && !(r.options.ignoreInputs !== !1 && _t(e, t, r.target))) if (n === "keydown") {
|
|
1434
1432
|
if (r.options.eventType !== "keydown") continue;
|
|
1435
1433
|
q(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)));
|
|
1436
1434
|
} else r.options.eventType === "keyup" && q(e, r.parsedHotkey, r.options.platform) && this.#c(r, e), r.options.requireReset && r.hasFired && this.#f(r, e) && (r.hasFired = !1);
|
|
@@ -1491,19 +1489,19 @@ var It = class e {
|
|
|
1491
1489
|
this.registrations.setState(() => /* @__PURE__ */ new Map()), this.#n.clear(), this.#r.clear();
|
|
1492
1490
|
}
|
|
1493
1491
|
};
|
|
1494
|
-
function
|
|
1495
|
-
return
|
|
1492
|
+
function Rt() {
|
|
1493
|
+
return Lt.getInstance();
|
|
1496
1494
|
}
|
|
1497
1495
|
//#endregion
|
|
1498
1496
|
//#region ../../../node_modules/.pnpm/@tanstack+hotkeys@0.8.0/node_modules/@tanstack/hotkeys/dist/sequence-manager.js
|
|
1499
|
-
var
|
|
1500
|
-
function
|
|
1501
|
-
return `sequence_${++
|
|
1497
|
+
var zt = 1e3, Bt = 0;
|
|
1498
|
+
function Vt() {
|
|
1499
|
+
return `sequence_${++Bt}`;
|
|
1502
1500
|
}
|
|
1503
|
-
function
|
|
1501
|
+
function Ht(e) {
|
|
1504
1502
|
return e.join("|");
|
|
1505
1503
|
}
|
|
1506
|
-
function
|
|
1504
|
+
function Ut(e) {
|
|
1507
1505
|
let t = e.parsedSequence.length, n = e.currentIndex > 0 && e.currentIndex < t;
|
|
1508
1506
|
return {
|
|
1509
1507
|
id: e.id,
|
|
@@ -1516,14 +1514,14 @@ function Ht(e) {
|
|
|
1516
1514
|
partialMatchLastKeyTime: n ? e.lastKeyTime : 0
|
|
1517
1515
|
};
|
|
1518
1516
|
}
|
|
1519
|
-
var
|
|
1517
|
+
var Wt = class e {
|
|
1520
1518
|
static #e = null;
|
|
1521
1519
|
#t = /* @__PURE__ */ new Map();
|
|
1522
1520
|
#n = /* @__PURE__ */ new Map();
|
|
1523
1521
|
#r = /* @__PURE__ */ new Map();
|
|
1524
1522
|
#i;
|
|
1525
1523
|
constructor() {
|
|
1526
|
-
this.registrations = new
|
|
1524
|
+
this.registrations = new Pt(/* @__PURE__ */ new Map()), this.#i = H();
|
|
1527
1525
|
}
|
|
1528
1526
|
static getInstance() {
|
|
1529
1527
|
return e.#e ||= new e(), e.#e;
|
|
@@ -1532,20 +1530,20 @@ var Ut = class e {
|
|
|
1532
1530
|
e.#e &&= (e.#e.destroy(), null);
|
|
1533
1531
|
}
|
|
1534
1532
|
#a(e) {
|
|
1535
|
-
this.registrations.setState((t) => new Map(t).set(e.id,
|
|
1533
|
+
this.registrations.setState((t) => new Map(t).set(e.id, Ut(e)));
|
|
1536
1534
|
}
|
|
1537
1535
|
register(e, t, n = {}) {
|
|
1538
1536
|
if (e.length === 0) throw Error("Sequence must contain at least one hotkey");
|
|
1539
|
-
let r =
|
|
1540
|
-
c &&
|
|
1541
|
-
let l = a[0], u = n.ignoreInputs ??
|
|
1537
|
+
let r = Vt(), i = n.platform ?? this.#i, a = e.map((e) => K(e, i)), o = n.target ?? (typeof document < "u" ? document : {}), s = n.conflictBehavior ?? "warn", c = this.#f(e, o);
|
|
1538
|
+
c && yt(c.id, dt(e), s, (e) => this.#o(e));
|
|
1539
|
+
let l = a[0], u = n.ignoreInputs ?? mt(l), d = {
|
|
1542
1540
|
id: r,
|
|
1543
1541
|
sequence: e,
|
|
1544
1542
|
parsedSequence: a,
|
|
1545
1543
|
callback: t,
|
|
1546
1544
|
options: {
|
|
1547
|
-
...
|
|
1548
|
-
timeout:
|
|
1545
|
+
...pt,
|
|
1546
|
+
timeout: zt,
|
|
1549
1547
|
...n,
|
|
1550
1548
|
platform: i,
|
|
1551
1549
|
ignoreInputs: u
|
|
@@ -1556,7 +1554,7 @@ var Ut = class e {
|
|
|
1556
1554
|
triggerCount: 0,
|
|
1557
1555
|
hasFired: !1
|
|
1558
1556
|
};
|
|
1559
|
-
this.#t.set(r, d), this.registrations.setState((e) => new Map(e).set(r,
|
|
1557
|
+
this.#t.set(r, d), this.registrations.setState((e) => new Map(e).set(r, Ut(d))), this.#r.has(o) || this.#r.set(o, /* @__PURE__ */ new Set()), this.#r.get(o).add(r), this.#s(o);
|
|
1560
1558
|
let f = this;
|
|
1561
1559
|
return {
|
|
1562
1560
|
get id() {
|
|
@@ -1577,7 +1575,7 @@ var Ut = class e {
|
|
|
1577
1575
|
t && (t.options = {
|
|
1578
1576
|
...t.options,
|
|
1579
1577
|
...e
|
|
1580
|
-
}, f.registrations.setState((e) => new Map(e).set(r,
|
|
1578
|
+
}, f.registrations.setState((e) => new Map(e).set(r, Ut(t))));
|
|
1581
1579
|
},
|
|
1582
1580
|
unregister: () => {
|
|
1583
1581
|
f.#o(r);
|
|
@@ -1619,14 +1617,14 @@ var Ut = class e {
|
|
|
1619
1617
|
};
|
|
1620
1618
|
}
|
|
1621
1619
|
#d(e, t, n) {
|
|
1622
|
-
if (
|
|
1620
|
+
if (ut(G(e.key))) return;
|
|
1623
1621
|
let r = this.#r.get(t);
|
|
1624
1622
|
if (!r) return;
|
|
1625
1623
|
let i = Date.now();
|
|
1626
1624
|
registrationIds: for (let a of r) {
|
|
1627
1625
|
let r = this.#t.get(a);
|
|
1628
|
-
if (!r || !
|
|
1629
|
-
if (r.options.ignoreInputs !== !1 &&
|
|
1626
|
+
if (!r || !vt(e, t) || !r.options.enabled) continue;
|
|
1627
|
+
if (r.options.ignoreInputs !== !1 && _t(e, t, r.target)) continue registrationIds;
|
|
1630
1628
|
if (r.options.eventType !== n) continue;
|
|
1631
1629
|
let o = r.options.timeout ?? 1e3;
|
|
1632
1630
|
r.currentIndex > 0 && i - r.lastKeyTime > o && (r.currentIndex = 0, this.#a(r));
|
|
@@ -1648,8 +1646,8 @@ var Ut = class e {
|
|
|
1648
1646
|
}
|
|
1649
1647
|
}
|
|
1650
1648
|
#f(e, t) {
|
|
1651
|
-
let n =
|
|
1652
|
-
for (let e of this.#t.values()) if (
|
|
1649
|
+
let n = Ht(e);
|
|
1650
|
+
for (let e of this.#t.values()) if (Ht(e.sequence) === n && e.target === t) return e;
|
|
1653
1651
|
return null;
|
|
1654
1652
|
}
|
|
1655
1653
|
resetAll() {
|
|
@@ -1684,20 +1682,20 @@ var Ut = class e {
|
|
|
1684
1682
|
this.#t.clear(), this.registrations.setState(() => /* @__PURE__ */ new Map());
|
|
1685
1683
|
}
|
|
1686
1684
|
};
|
|
1687
|
-
function
|
|
1688
|
-
return
|
|
1685
|
+
function Gt() {
|
|
1686
|
+
return Wt.getInstance();
|
|
1689
1687
|
}
|
|
1690
1688
|
//#endregion
|
|
1691
1689
|
//#region ../../../node_modules/.pnpm/@tanstack+vue-hotkeys@0.10.0_vue@3.5.27_typescript@5.9.3_/node_modules/@tanstack/vue-hotkeys/dist/useHotkeys.js
|
|
1692
|
-
function
|
|
1693
|
-
let n =
|
|
1690
|
+
function Kt(e, t = {}) {
|
|
1691
|
+
let n = Je(), r = Rt(), i = /* @__PURE__ */ new Map(), a = _(() => {
|
|
1694
1692
|
let r = Q(e), i = Q(t);
|
|
1695
1693
|
return r.map((e, t) => {
|
|
1696
1694
|
let r = Q(e.hotkey), a = e.options ? Q(e.options) : {}, o = {
|
|
1697
1695
|
...n.hotkey,
|
|
1698
1696
|
...i,
|
|
1699
1697
|
...a
|
|
1700
|
-
}, s =
|
|
1698
|
+
}, s = lt(r, o.platform ?? H()), c = o.enabled === void 0 ? void 0 : Q(o.enabled), l = o.target === void 0 ? void 0 : Q(o.target);
|
|
1701
1699
|
return {
|
|
1702
1700
|
index: t,
|
|
1703
1701
|
hotkeyString: s,
|
|
@@ -1756,15 +1754,15 @@ function Q(e) {
|
|
|
1756
1754
|
}
|
|
1757
1755
|
//#endregion
|
|
1758
1756
|
//#region ../../../node_modules/.pnpm/@tanstack+vue-hotkeys@0.10.0_vue@3.5.27_typescript@5.9.3_/node_modules/@tanstack/vue-hotkeys/dist/useHotkeySequences.js
|
|
1759
|
-
function
|
|
1760
|
-
let n =
|
|
1757
|
+
function qt(e, t = {}) {
|
|
1758
|
+
let n = Je(), r = Gt(), i = /* @__PURE__ */ new Map(), a = _(() => {
|
|
1761
1759
|
let r = $(e), i = $(t);
|
|
1762
1760
|
return r.map((e, t) => {
|
|
1763
1761
|
let r = $(e.sequence), a = e.options ? $(e.options) : {}, o = {
|
|
1764
1762
|
...n.hotkeySequence,
|
|
1765
1763
|
...i,
|
|
1766
1764
|
...a
|
|
1767
|
-
}, s =
|
|
1765
|
+
}, s = dt(r), c = o.enabled === void 0 ? void 0 : $(o.enabled), l = o.target === void 0 ? void 0 : $(o.target);
|
|
1768
1766
|
return {
|
|
1769
1767
|
index: t,
|
|
1770
1768
|
resolvedSequence: r,
|
|
@@ -1825,7 +1823,7 @@ function $(e) {
|
|
|
1825
1823
|
}
|
|
1826
1824
|
//#endregion
|
|
1827
1825
|
//#region src/stores/actionRegistry.store.ts
|
|
1828
|
-
var
|
|
1826
|
+
var Jt = y("actionRegistry", () => {
|
|
1829
1827
|
let e = p([]), t = p(/* @__PURE__ */ new Map()), n = 1;
|
|
1830
1828
|
function r() {
|
|
1831
1829
|
return [...e.value, ...t.value.values().map((e) => e)];
|
|
@@ -1849,14 +1847,14 @@ var qt = y("actionRegistry", () => {
|
|
|
1849
1847
|
});
|
|
1850
1848
|
//#endregion
|
|
1851
1849
|
//#region src/composables/actionShortcuts.composable.ts
|
|
1852
|
-
function*
|
|
1850
|
+
function* Yt(e, t) {
|
|
1853
1851
|
for (let n of e) {
|
|
1854
1852
|
if (yield n, n.subActionsHaveKeyboardShortcuts !== !0 || n.subActions === void 0) continue;
|
|
1855
1853
|
let e = n.subActions(t);
|
|
1856
|
-
Array.isArray(e) ? yield*
|
|
1854
|
+
Array.isArray(e) ? yield* Yt(e, t) : typeof e == "object" && e && "actions" in e && Array.isArray(e.actions) && (yield* Yt(e.actions, t));
|
|
1857
1855
|
}
|
|
1858
1856
|
}
|
|
1859
|
-
function
|
|
1857
|
+
function Xt(e) {
|
|
1860
1858
|
return [
|
|
1861
1859
|
e.key,
|
|
1862
1860
|
e.alt === !0 ? "alt" : "",
|
|
@@ -1866,8 +1864,8 @@ function Yt(e) {
|
|
|
1866
1864
|
e.shift === !0 ? "shift" : ""
|
|
1867
1865
|
].filter(Boolean).join("+");
|
|
1868
1866
|
}
|
|
1869
|
-
function
|
|
1870
|
-
let t =
|
|
1867
|
+
function Zt(e) {
|
|
1868
|
+
let t = Jt(), n = z();
|
|
1871
1869
|
function r(t) {
|
|
1872
1870
|
return () => {
|
|
1873
1871
|
let r = e ? e() : n.actionContext({});
|
|
@@ -1882,11 +1880,11 @@ function Xt(e) {
|
|
|
1882
1880
|
}
|
|
1883
1881
|
};
|
|
1884
1882
|
}
|
|
1885
|
-
|
|
1883
|
+
Kt(() => {
|
|
1886
1884
|
let i = /* @__PURE__ */ new Map(), a = e ? e() : n.actionContext({});
|
|
1887
|
-
for (let e of
|
|
1885
|
+
for (let e of Yt(t.allActions(), a)) {
|
|
1888
1886
|
if (e.keyboardShortcut === void 0 || "sequence" in e.keyboardShortcut) continue;
|
|
1889
|
-
let t = e.keyboardShortcut, n =
|
|
1887
|
+
let t = e.keyboardShortcut, n = Xt(t);
|
|
1890
1888
|
i.has(n) || i.set(n, []), i.get(n).push(e);
|
|
1891
1889
|
}
|
|
1892
1890
|
return Array.from(i.values()).map((e) => {
|
|
@@ -1908,9 +1906,9 @@ function Xt(e) {
|
|
|
1908
1906
|
}
|
|
1909
1907
|
};
|
|
1910
1908
|
});
|
|
1911
|
-
}, { conflictBehavior: "allow" }),
|
|
1909
|
+
}, { conflictBehavior: "allow" }), qt(() => {
|
|
1912
1910
|
let i = /* @__PURE__ */ new Map(), a = e ? e() : n.actionContext({});
|
|
1913
|
-
for (let e of
|
|
1911
|
+
for (let e of Yt(t.allActions(), a)) {
|
|
1914
1912
|
if (e.keyboardShortcut === void 0 || !("sequence" in e.keyboardShortcut)) continue;
|
|
1915
1913
|
let t = e.keyboardShortcut.sequence.join(",");
|
|
1916
1914
|
i.has(t) || i.set(t, []), i.get(t).push(e);
|
|
@@ -1931,7 +1929,7 @@ function Xt(e) {
|
|
|
1931
1929
|
}
|
|
1932
1930
|
//#endregion
|
|
1933
1931
|
//#region src/composables/commandMenuActions.composable.ts
|
|
1934
|
-
function
|
|
1932
|
+
function Qt({ actionsSnapshot: e, focusedModelsSnapshot: n, listboxContentRef: r, listboxRootRef: i, manager: a, navStack: o, searchInput: s }) {
|
|
1935
1933
|
let c = p(!1), l = p(!1), u = m([]), d = p({}), f = 0, h = t(() => r.value?.$el);
|
|
1936
1934
|
function g(e) {
|
|
1937
1935
|
return a.actionContext({
|
|
@@ -1948,9 +1946,9 @@ function Zt({ actionsSnapshot: e, focusedModelsSnapshot: n, listboxContentRef: r
|
|
|
1948
1946
|
let n = g(), r;
|
|
1949
1947
|
if (o.value.length > 0) {
|
|
1950
1948
|
let e = o.value.at(-1);
|
|
1951
|
-
r = e.parentAction.subActions === void 0 ? e.actions : await
|
|
1949
|
+
r = e.parentAction.subActions === void 0 ? e.actions : await Ue(e.parentAction, n, d.value);
|
|
1952
1950
|
} else r = e;
|
|
1953
|
-
let i = await
|
|
1951
|
+
let i = await Oe(r, n, (e) => {
|
|
1954
1952
|
t === f && e.length > 0 && (u.value = e);
|
|
1955
1953
|
}, o.value.at(-1)?.parentAction);
|
|
1956
1954
|
t === f && (u.value = i);
|
|
@@ -2009,7 +2007,7 @@ function Zt({ actionsSnapshot: e, focusedModelsSnapshot: n, listboxContentRef: r
|
|
|
2009
2007
|
}
|
|
2010
2008
|
//#endregion
|
|
2011
2009
|
//#region src/composables/commandMenuAnimation.composable.ts
|
|
2012
|
-
function
|
|
2010
|
+
function $t(e, t) {
|
|
2013
2011
|
let n = p(!1), r = p(!1), i = null;
|
|
2014
2012
|
return _(e, (e) => {
|
|
2015
2013
|
e || (r.value = !1);
|
|
@@ -2026,7 +2024,7 @@ function Qt(e, t) {
|
|
|
2026
2024
|
}
|
|
2027
2025
|
//#endregion
|
|
2028
2026
|
//#region src/composables/commandMenuNavigation.composable.ts
|
|
2029
|
-
function
|
|
2027
|
+
function en({ isShiftKeyHeld: e, buildContext: n, emit: r, listboxRootRef: i, manager: a, navStack: o, refreshActions: s, resolvedActions: c, scrollToTopOfGroup: l, searchInput: u, subActionsMetaMap: d }) {
|
|
2030
2028
|
let f = v(), m = p(null), h = t(() => o.value.at(-1)?.parentAction ?? null), g = t(() => {
|
|
2031
2029
|
let e = n();
|
|
2032
2030
|
return o.value.filter((e) => e.parentAction.forceAsRootMenu !== !0).map((t) => {
|
|
@@ -2037,7 +2035,7 @@ function $t({ isShiftKeyHeld: e, buildContext: n, emit: r, listboxRootRef: i, ma
|
|
|
2037
2035
|
if (h.value === null) return f.t("type_a_command_or_search");
|
|
2038
2036
|
let e = R(h.value, n())?.placeholder;
|
|
2039
2037
|
return e === void 0 ? f.t("search") : typeof e == "function" ? e() : e;
|
|
2040
|
-
}), { preview: y, onKeyDown: b } =
|
|
2038
|
+
}), { preview: y, onKeyDown: b } = ze({
|
|
2041
2039
|
highlightedActionId: m,
|
|
2042
2040
|
getContext: n,
|
|
2043
2041
|
resolvedActions: c
|
|
@@ -2076,7 +2074,7 @@ function $t({ isShiftKeyHeld: e, buildContext: n, emit: r, listboxRootRef: i, ma
|
|
|
2076
2074
|
onKeyDown: C
|
|
2077
2075
|
};
|
|
2078
2076
|
}
|
|
2079
|
-
function
|
|
2077
|
+
function tn(e, t) {
|
|
2080
2078
|
let n = [], r = e.parentAction ?? null;
|
|
2081
2079
|
for (; r !== null;) {
|
|
2082
2080
|
if (r.forceAsRootMenu === !0) return n;
|
|
@@ -2090,7 +2088,7 @@ function en(e, t) {
|
|
|
2090
2088
|
}
|
|
2091
2089
|
//#endregion
|
|
2092
2090
|
//#region src/composables/focusedModels.composable.ts
|
|
2093
|
-
function
|
|
2091
|
+
function nn(e) {
|
|
2094
2092
|
let t = z(), n = p(!1);
|
|
2095
2093
|
function r() {
|
|
2096
2094
|
n.value = !0, t.setFocusedModels([...t.focusedModels, ...e.value]);
|
|
@@ -2109,8 +2107,8 @@ function tn(e) {
|
|
|
2109
2107
|
}
|
|
2110
2108
|
//#endregion
|
|
2111
2109
|
//#region src/composables/temporaryActions.composable.ts
|
|
2112
|
-
function
|
|
2113
|
-
let r =
|
|
2110
|
+
function rn(e, t, n = !1) {
|
|
2111
|
+
let r = Jt(), i = [];
|
|
2114
2112
|
function a() {
|
|
2115
2113
|
i.length > 0 || (i = (Array.isArray(e) ? e : [e]).map((e) => r.registerTemporaryAction(s(e))));
|
|
2116
2114
|
}
|
|
@@ -2136,7 +2134,7 @@ function nn(e, t, n = !1) {
|
|
|
2136
2134
|
}
|
|
2137
2135
|
//#endregion
|
|
2138
2136
|
//#region src/composables/activeModels.composable.ts
|
|
2139
|
-
function
|
|
2137
|
+
function an(e, t) {
|
|
2140
2138
|
let n = z();
|
|
2141
2139
|
function r() {
|
|
2142
2140
|
t === "focused" ? n.setFocusedModels([...n.focusedModels, ...e.value]) : n.setViewModels([...n.viewModels, ...e.value]);
|
|
@@ -2152,19 +2150,19 @@ function rn(e, t) {
|
|
|
2152
2150
|
}
|
|
2153
2151
|
//#endregion
|
|
2154
2152
|
//#region src/composables/viewModels.composable.ts
|
|
2155
|
-
function
|
|
2156
|
-
|
|
2153
|
+
function on(e) {
|
|
2154
|
+
an(e, "view");
|
|
2157
2155
|
}
|
|
2158
2156
|
//#endregion
|
|
2159
2157
|
//#region src/utils/commandMenuGroups.util.ts
|
|
2160
|
-
var
|
|
2161
|
-
function cn(e, t) {
|
|
2162
|
-
return e === void 0 ? "no-group" : e.name ? F(e.name, t) : (sn.has(e) || sn.set(e, `unnamed-${on++}`), sn.get(e));
|
|
2163
|
-
}
|
|
2158
|
+
var sn = 0, cn = /* @__PURE__ */ new WeakMap();
|
|
2164
2159
|
function ln(e, t) {
|
|
2160
|
+
return e === void 0 ? "no-group" : e.name ? F(e.name, t) : (cn.has(e) || cn.set(e, `unnamed-${sn++}`), cn.get(e));
|
|
2161
|
+
}
|
|
2162
|
+
function un(e, t) {
|
|
2165
2163
|
let n = /* @__PURE__ */ new Map();
|
|
2166
2164
|
for (let r of e) {
|
|
2167
|
-
let e = r.group, i =
|
|
2165
|
+
let e = r.group, i = ln(e, t), a = n.get(i);
|
|
2168
2166
|
if (a === void 0) {
|
|
2169
2167
|
let r = e?.name ? F(e.name, t) : null;
|
|
2170
2168
|
a = {
|
|
@@ -2181,4 +2179,4 @@ function ln(e, t) {
|
|
|
2181
2179
|
return [...n.values()];
|
|
2182
2180
|
}
|
|
2183
2181
|
//#endregion
|
|
2184
|
-
export {
|
|
2182
|
+
export { Ge as GroupPriority, e as actionsLocales, Oe as applicableActions, un as buildCommandMenuGroups, Ee as createAction, we as isAuthenticated, B as isSubActionsWithMeta, Ie as resolveActionAvatar, tn as resolveActionBreadcrumbs, Le as resolveActionHint, I as resolveActionName, Re as resolveActionPreview, L as resolveActionSelected, F as resolveActionValue, N as resolveApplicable, R as resolveSearchSubActionsConfig, Ue as resolveSubActions, Te as setIsAuthenticated, V as storeSubActionsPagination, We as useActionDropdownMenuContent, Ke as useActionGroup, z as useActionManagerStore, ze as useActionPreview, Jt as useActionRegistryStore, Zt as useActionShortcuts, Qt as useCommandMenuActions, $t as useCommandMenuAnimation, en as useCommandMenuNavigation, nn as useFocusedModels, rn as useTemporaryActions, on as useViewModels };
|