@yoopta/mention 6.0.0-beta.1 → 6.0.0-beta.10
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/commands/index.d.ts +41 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/extenstions/withMentions.d.ts +8 -0
- package/dist/extenstions/withMentions.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/use-mention-dropdown.d.ts +7 -0
- package/dist/hooks/use-mention-dropdown.d.ts.map +1 -0
- package/dist/hooks/use-mention-state.d.ts +19 -0
- package/dist/hooks/use-mention-state.d.ts.map +1 -0
- package/dist/index.d.ts +7 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin/mention-plugin.d.ts +5 -0
- package/dist/plugin/mention-plugin.d.ts.map +1 -0
- package/dist/types.d.ts +160 -16
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/commands/MentionCommands.d.ts +0 -32
- package/dist/commands/MentionCommands.d.ts.map +0 -1
- package/dist/components/ui/command.d.ts +0 -68
- package/dist/components/ui/command.d.ts.map +0 -1
- package/dist/plugin/index.d.ts +0 -7
- package/dist/plugin/index.d.ts.map +0 -1
- package/dist/ui/MentionDropdown.d.ts +0 -11
- package/dist/ui/MentionDropdown.d.ts.map +0 -1
- package/dist/ui/MentionRender.d.ts +0 -4
- package/dist/ui/MentionRender.d.ts.map +0 -1
- package/dist/ui/hooks.d.ts +0 -13
- package/dist/ui/hooks.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -2
- package/dist/utils.d.ts.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { BaseYooEditor, YooptaPathIndex } from '@yoopta/editor';
|
|
2
|
+
import type { MentionCloseEvent, MentionElement, MentionElementProps, MentionItem, MentionState, MentionTargetRect, MentionTrigger } from '../types';
|
|
3
|
+
type MentionElementOptions<TMeta = Record<string, unknown>> = {
|
|
4
|
+
props: Omit<MentionElementProps<TMeta>, 'nodeType'>;
|
|
5
|
+
};
|
|
6
|
+
type InsertMentionOptions = {
|
|
7
|
+
/** Focus the editor after inserting */
|
|
8
|
+
focus?: boolean;
|
|
9
|
+
};
|
|
10
|
+
type FindMentionOptions = {
|
|
11
|
+
blockId?: string;
|
|
12
|
+
at?: YooptaPathIndex;
|
|
13
|
+
};
|
|
14
|
+
type UpdateMentionOptions = {
|
|
15
|
+
blockId?: string;
|
|
16
|
+
at?: YooptaPathIndex;
|
|
17
|
+
};
|
|
18
|
+
export type MentionCommandsType<TMeta = Record<string, unknown>> = {
|
|
19
|
+
buildMentionElement: (editor: BaseYooEditor, options: MentionElementOptions<TMeta>) => MentionElement<TMeta>;
|
|
20
|
+
insertMention: (editor: BaseYooEditor, item: MentionItem<TMeta>, options?: InsertMentionOptions) => void;
|
|
21
|
+
findMention: (editor: BaseYooEditor, mentionId: string, options?: FindMentionOptions) => MentionElement<TMeta> | null;
|
|
22
|
+
findMentions: (editor: BaseYooEditor, options?: FindMentionOptions) => MentionElement<TMeta>[];
|
|
23
|
+
findMentionsByType: (editor: BaseYooEditor, type: string, options?: FindMentionOptions) => MentionElement<TMeta>[];
|
|
24
|
+
updateMention: (editor: BaseYooEditor, mentionId: string, props: Partial<Omit<MentionElementProps<TMeta>, 'nodeType'>>, options?: UpdateMentionOptions) => void;
|
|
25
|
+
deleteMention: (editor: BaseYooEditor, mentionId: string, options?: FindMentionOptions) => void;
|
|
26
|
+
openDropdown: (editor: BaseYooEditor, params: {
|
|
27
|
+
trigger: MentionTrigger;
|
|
28
|
+
targetRect: MentionTargetRect;
|
|
29
|
+
triggerRange: MentionState['triggerRange'];
|
|
30
|
+
}) => void;
|
|
31
|
+
closeDropdown: (editor: BaseYooEditor, reason?: MentionCloseEvent['reason']) => void;
|
|
32
|
+
getState: (editor: BaseYooEditor) => MentionState;
|
|
33
|
+
getQuery: (editor: BaseYooEditor) => string;
|
|
34
|
+
setQuery: (editor: BaseYooEditor, query: string) => void;
|
|
35
|
+
getTrigger: (editor: BaseYooEditor) => MentionTrigger | null;
|
|
36
|
+
getTriggers: (editor: BaseYooEditor) => MentionTrigger[];
|
|
37
|
+
getTriggerByChar: (editor: BaseYooEditor, char: string) => MentionTrigger | undefined;
|
|
38
|
+
};
|
|
39
|
+
export declare const MentionCommands: MentionCommandsType;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIrE,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,WAAW,EAEX,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACf,MAAM,UAAU,CAAC;AA2BlB,KAAK,qBAAqB,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC5D,KAAK,EAAE,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;CACrD,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,uCAAuC;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,eAAe,CAAC;CACtB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,eAAe,CAAC;CACtB,CAAC;AAMF,MAAM,MAAM,mBAAmB,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAEjE,mBAAmB,EAAE,CACnB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,qBAAqB,CAAC,KAAK,CAAC,KAClC,cAAc,CAAC,KAAK,CAAC,CAAC;IAG3B,aAAa,EAAE,CACb,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EACxB,OAAO,CAAC,EAAE,oBAAoB,KAC3B,IAAI,CAAC;IAGV,WAAW,EAAE,CACX,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,kBAAkB,KACzB,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,CACZ,MAAM,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,kBAAkB,KACzB,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;IAC7B,kBAAkB,EAAE,CAClB,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,kBAAkB,KACzB,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;IAG7B,aAAa,EAAE,CACb,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,EAC5D,OAAO,CAAC,EAAE,oBAAoB,KAC3B,IAAI,CAAC;IAGV,aAAa,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAGhG,YAAY,EAAE,CACZ,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE;QACN,OAAO,EAAE,cAAc,CAAC;QACxB,UAAU,EAAE,iBAAiB,CAAC;QAC9B,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;KAC5C,KACE,IAAI,CAAC;IACV,aAAa,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IAGrF,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,YAAY,CAAC;IAClD,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,MAAM,CAAC;IAC5C,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,UAAU,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,cAAc,GAAG,IAAI,CAAC;IAG7D,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,cAAc,EAAE,CAAC;IACzD,gBAAgB,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC;CACvF,CAAC;AAMF,eAAO,MAAM,eAAe,EAAE,mBAuM7B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures editor has mention state initialized
|
|
3
|
+
* Called lazily when needed
|
|
4
|
+
*/
|
|
5
|
+
import type { BaseYooEditor } from "@yoopta/editor";
|
|
6
|
+
import type { MentionYooEditor } from "../types";
|
|
7
|
+
export declare function withMentions(editor: BaseYooEditor): MentionYooEditor;
|
|
8
|
+
//# sourceMappingURL=withMentions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withMentions.d.ts","sourceRoot":"","sources":["../../src/extenstions/withMentions.ts"],"names":[],"mappings":"AACA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,KAAK,EAA4F,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAM3I,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,gBAAgB,CA+DpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UseMentionDropdownOptions, UseMentionDropdownReturn } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook for building mention dropdown UI
|
|
4
|
+
* Provides state, actions, and floating-ui refs
|
|
5
|
+
*/
|
|
6
|
+
export declare function useMentionDropdown<TMeta = Record<string, unknown>>(options?: UseMentionDropdownOptions): UseMentionDropdownReturn<TMeta>;
|
|
7
|
+
//# sourceMappingURL=use-mention-dropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mention-dropdown.d.ts","sourceRoot":"","sources":["../../src/hooks/use-mention-dropdown.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAKV,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAGlB;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,OAAO,GAAE,yBAA8B,GACtC,wBAAwB,CAAC,KAAK,CAAC,CA6OjC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to track mention typing state
|
|
3
|
+
* Useful for showing indicators or custom UI while typing a mention
|
|
4
|
+
*/
|
|
5
|
+
export declare function useMentionState(): {
|
|
6
|
+
/** Whether user is currently typing a mention */
|
|
7
|
+
isTypingMention: boolean;
|
|
8
|
+
/** The current trigger (if dropdown is open) */
|
|
9
|
+
currentTrigger: import("../types").MentionTrigger | null;
|
|
10
|
+
/** Current search query */
|
|
11
|
+
query: string;
|
|
12
|
+
/** Position rect for custom positioning */
|
|
13
|
+
targetRect: import("../types").MentionTargetRect | null;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Hook to check if a specific trigger is active
|
|
17
|
+
*/
|
|
18
|
+
export declare function useMentionTriggerActive(triggerChar: string): boolean;
|
|
19
|
+
//# sourceMappingURL=use-mention-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mention-state.d.ts","sourceRoot":"","sources":["../../src/hooks/use-mention-state.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,wBAAgB,eAAe;IA6B3B,iDAAiD;;IAEjD,gDAAgD;;IAEhD,2BAA2B;;IAE3B,2CAA2C;;EAG9C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAGpE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Mention
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export { withMentions };
|
|
1
|
+
import { Mention } from './plugin/mention-plugin';
|
|
2
|
+
export type { MentionType, MentionItem, MentionElementProps, MentionElement, MentionElementMap, MentionPluginElementKeys, MentionTrigger, MentionTargetRect, MentionState, MentionPluginOptions, MentionOpenEvent, MentionCloseEvent, MentionQueryChangeEvent, MentionSelectEvent, UseMentionDropdownOptions, UseMentionDropdownReturn, MentionRenderProps, MentionDropdownRenderProps, MentionItemRenderProps, MentionEditor, } from './types';
|
|
3
|
+
export { INITIAL_MENTION_STATE } from './types';
|
|
4
|
+
export { MentionCommands } from './commands';
|
|
5
|
+
export type { MentionCommandsType } from './commands';
|
|
6
|
+
export { useMentionDropdown, useMentionState, useMentionTriggerActive } from './hooks';
|
|
7
|
+
export { withMentions } from './extenstions/withMentions';
|
|
8
8
|
export default Mention;
|
|
9
|
-
export { MentionDropdown };
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,YAAY,EAEV,WAAW,EACX,WAAW,EAEX,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EAExB,cAAc,EAEd,iBAAiB,EACjB,YAAY,EAEZ,oBAAoB,EAEpB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAElB,yBAAyB,EACzB,wBAAwB,EAExB,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,EAEtB,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,eAAe,OAAO,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateId as e,Blocks as t,useElementSelected as n,YooptaPlugin as r,Elements as o,useYooptaEditor as i,useYooptaPluginOptions as a,UI as c}from"@yoopta/editor";import{jsxs as s,jsx as l,Fragment as u}from"react/jsx-runtime";import*as d from"react";import{useLayoutEffect as f,useEffect as p,useRef as m,useState as h,useCallback as g,useMemo as v}from"react";import*as y from"react-dom";import b from"react-dom";var w={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=w.levels(e,t);return r=n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return w.equals(r,o)&&i>a},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return w.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return w.equals(r,o)&&i<a},equals:(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===w.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===w.compare(e,t),isBefore:(e,t)=>-1===w.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===w.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===w.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===w.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===w.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&w.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!w.isAncestor(t,e)&&!w.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:i}=t;(w.equals(i,r)||w.endsBefore(i,r)||w.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(w.equals(a,r)||w.isAncestor(a,r))return null;w.endsBefore(a,r)&&(r[a.length-1]-=1);break;case"merge_node":var{path:c,position:s}=t;w.equals(c,r)||w.endsBefore(c,r)?r[c.length-1]-=1:w.isAncestor(c,r)&&(r[c.length-1]-=1,r[c.length]+=s);break;case"split_node":var{path:l,position:u}=t;if(w.equals(l,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else w.endsBefore(l,r)?r[l.length-1]+=1:w.isAncestor(l,r)&&e[l.length]>=u&&(r[l.length-1]+=1,r[l.length]-=u);break;case"move_node":var{path:d,newPath:f}=t;if(w.equals(d,f))return r;if(w.isAncestor(d,r)||w.equals(d,r)){var p=f.slice();return w.endsBefore(d,f)&&d.length<f.length&&(p[d.length-1]-=1),p.concat(r.slice(d.length))}w.isSibling(d,f)&&(w.isAncestor(f,r)||w.equals(f,r))?w.endsBefore(d,r)?r[d.length-1]-=1:r[d.length-1]+=1:w.endsBefore(f,r)||w.equals(f,r)||w.isAncestor(f,r)?(w.endsBefore(d,r)&&(r[d.length-1]-=1),r[f.length-1]+=1):w.endsBefore(d,r)&&(w.equals(f,r)&&(r[f.length-1]+=1),r[d.length-1]-=1)}return r}};function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function E(e){var t=function(e,t){if("object"!==x(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==x(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===x(t)?t:String(t)}function O(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var P=["anchor","focus"];function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var k={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return k.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=k.edges(e);return t},equals:(e,t)=>K.equals(e.anchor,t.anchor)&&K.equals(e.focus,t.focus),surrounds(e,t){var n=k.intersection(e,t);return!!n&&k.equals(n,t)},includes(e,t){if(k.isRange(t)){if(k.includes(e,t.anchor)||k.includes(e,t.focus))return!0;var[n,r]=k.edges(e),[o,i]=k.edges(t);return K.isBefore(n,o)&&K.isAfter(r,i)}var[a,c]=k.edges(e),s=!1,l=!1;return K.isPoint(t)?(s=K.compare(t,a)>=0,l=K.compare(t,c)<=0):(s=w.compare(t,a.path)>=0,l=w.compare(t,c.path)<=0),s&&l},intersection(e,t){var n=R(e,P),[r,o]=k.edges(e),[i,a]=k.edges(t),c=K.isBefore(r,i)?i:r,s=K.isBefore(o,a)?o:a;return K.isBefore(s,c)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach(function(t){O(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({anchor:c,focus:s},n)},isBackward(e){var{anchor:t,focus:n}=e;return K.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return K.equals(t,n)},isExpanded:e=>!k.isCollapsed(e),isForward:e=>!k.isBackward(e),isRange:e=>B(e)&&K.isPoint(e.anchor)&&K.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=k.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var a=k.isCollapsed(e);k.isForward(e)?(r="forward",o=a?r:"backward"):(r="backward",o=a?r:"forward")}else"outward"===i?k.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var c=K.transform(e.anchor,t,{affinity:r}),s=K.transform(e.focus,t,{affinity:o});return c&&s?{anchor:c,focus:s}:null}},C=function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!B(e)&&("function"!=typeof e.apply&&(t?M.isNodeList(e.children):Array.isArray(e.children)))},N={isAncestor(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return B(e)&&M.isNodeList(e.children,{deep:t})},isElement:C,isElementList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>N.isElement(e,{deep:t}))},isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return C(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},A=["children"],D=["text"];function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach(function(t){O(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var M={ancestor(e,t){var n=M.get(e,t);if(G.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(H.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of w.ancestors(t,n)){var o=[M.ancestor(e,r),r];yield o}}()},child(e,t){if(G.isText(e))throw new Error("Cannot get the child of a text node: ".concat(H.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(H.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=M.ancestor(e,t),{children:i}=o,a=r?i.length-1:0;r?a>=0:a<i.length;){var c=M.child(o,a),s=t.concat(a);yield[c,s],a=r?a-1:a+1}}()},common(e,t,n){var r=w.common(t,n);return[M.get(e,r),r]},descendant(e,t){var n=M.get(e,t);if(V.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(H.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of M.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of M.nodes(e,t))N.isElement(n)&&(yield[n,r])}()},extractProps:e=>N.isAncestor(e)?R(e,A):R(e,D),first(e,t){for(var n=t.slice(),r=M.get(e,n);r&&!G.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){var n={children:e.children},[r,o]=k.edges(t),i=M.nodes(n,{reverse:!0,pass:e=>{var[,n]=e;return!k.includes(t,n)}}),a=function(){if(!k.includes(t,c)){var e=c[c.length-1];ie(n,w.parent(c),t=>re(t,e,1))}w.equals(c,o.path)&&ae(n,c,e=>{var t=e.text.slice(0,o.offset);return T(T({},e),{},{text:t})}),w.equals(c,r.path)&&ae(n,c,e=>{var t=e.text.slice(r.offset);return T(T({},e),{},{text:t})})};for(var[,c]of i)a();return n.children},get(e,t){var n=M.getIf(e,t);if(void 0===n)throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(H.stringify(e)));return n},getIf(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(G.isText(n)||!n.children[o])return;n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(G.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return G.isText(e)||N.isElement(e,{deep:t})||V.isEditor(e,{deep:t})},isNodeList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>M.isNode(e,{deep:t}))},last(e,t){for(var n=t.slice(),r=M.get(e,n);r&&!G.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=M.get(e,t);if(!G.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(H.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of w.levels(t,n)){var o=M.get(e,r);yield[o,r]}}()},matches:(e,t)=>N.isElement(e)&&N.isElementProps(t)&&N.matches(e,t)||G.isText(e)&&G.isTextProps(t)&&G.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:i}=t,a=new Set,c=[],s=e;!i||!(r?w.isBefore(c,i):w.isAfter(c,i));)if(a.has(s)||(yield[s,c]),a.has(s)||G.isText(s)||0===s.children.length||null!=n&&!1!==n([s,c])){if(0===c.length)break;if(!r){var l=w.next(c);if(M.has(e,l)){c=l,s=M.get(e,c);continue}}if(r&&0!==c[c.length-1])c=w.previous(c),s=M.get(e,c);else c=w.parent(c),s=M.get(e,c),a.add(s)}else{a.add(s);var u=r?s.children.length-1:0;w.isAncestor(c,o)&&(u=o[c.length]),c=c.concat(u),s=M.get(e,c)}}()},parent(e,t){var n=w.parent(t),r=M.get(e,n);if(G.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>G.isText(e)?e.text:e.children.map(M.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of M.nodes(e,t))G.isText(n)&&(yield[n,r])}()}};function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach(function(t){O(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var I,F={isNodeOperation:e=>F.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!B(e))return!1;switch(e.type){case"insert_node":case"remove_node":return w.isPath(e.path)&&M.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&w.isPath(e.path);case"merge_node":return"number"==typeof e.position&&w.isPath(e.path)&&B(e.properties);case"move_node":return w.isPath(e.path)&&w.isPath(e.newPath);case"set_node":return w.isPath(e.path)&&B(e.properties)&&B(e.newProperties);case"set_selection":return null===e.properties&&k.isRange(e.newProperties)||null===e.newProperties&&k.isRange(e.properties)||B(e.properties)&&B(e.newProperties);case"split_node":return w.isPath(e.path)&&"number"==typeof e.position&&B(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every(e=>F.isOperation(e)),isSelectionOperation:e=>F.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>F.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return L(L({},e),{},{type:"remove_node"});case"insert_text":return L(L({},e),{},{type:"remove_text"});case"merge_node":return L(L({},e),{},{type:"split_node",path:w.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(w.equals(t,n))return e;if(w.isSibling(n,t))return L(L({},e),{},{path:t,newPath:n});var r=w.transform(n,e),o=w.transform(w.next(n),e);return L(L({},e),{},{path:r,newPath:o});case"remove_node":return L(L({},e),{},{type:"insert_node"});case"remove_text":return L(L({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return L(L({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:c,newProperties:s}=e;return L(L({},e),{},null==c?{properties:s,newProperties:null}:null==s?{properties:null,newProperties:c}:{properties:s,newProperties:c});case"split_node":return L(L({},e),{},{type:"merge_node",path:w.next(e.path)})}}},B=e=>"object"==typeof e&&null!==e,W=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==o[i])return!1}else if(B(r)&&B(o)){if(!W(r,o))return!1}else if(r!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0},q=e=>e.selection?e.selection:e.children.length>0?V.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(I||(I={})),I.L,I.L,I.V,I.LV,I.LVT,I.LV,I.V,I.V,I.T,I.LVT,I.T,I.T,I.Any,I.Extend,I.ZWJ,I.Any,I.SpacingMark,I.Prepend,I.Any,I.ZWJ,I.ExtPict,I.RI,I.RI;var V={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,n)=>e.isEdge(t,n),isEditor:e=>function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!B(e))return!1;var n="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||B(e.marks))&&(null===e.selection||k.isRange(e.selection))&&(!t||M.isNodeList(e.children))&&F.isOperationList(e.operations);return n}(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)},shouldMergeNodesRemovePrevNode:(e,t,n)=>e.shouldMergeNodesRemovePrevNode(t,n)};function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach(function(t){O(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var K={compare(e,t){var n=w.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===K.compare(e,t),isBefore:(e,t)=>-1===K.compare(e,t),equals:(e,t)=>e.offset===t.offset&&w.equals(e.path,t.path),isPoint:e=>B(e)&&"number"==typeof e.offset&&w.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":o=w.transform(o,t,n);break;case"insert_text":w.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(i+=t.text.length);break;case"merge_node":w.equals(t.path,o)&&(i+=t.position),o=w.transform(o,t,n);break;case"remove_text":w.equals(t.path,o)&&t.offset<=i&&(i-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(w.equals(t.path,o)||w.isAncestor(t.path,o))return null;o=w.transform(o,t,n);break;case"split_node":if(w.equals(t.path,o)){if(t.position===i&&null==r)return null;(t.position<i||t.position===i&&"forward"===r)&&(i-=t.position,o=w.transform(o,t,$($({},n),{},{affinity:"forward"})))}else o=w.transform(o,t,n);break;default:return e}return{path:o,offset:i}}},U=void 0,H={setScrubber(e){U=e},stringify:e=>JSON.stringify(e,U)},Z=["text"],X=["anchor","focus","merge"];function Y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(n),!0).forEach(function(t){O(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var G={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return R(e,Z)}return W(r?o(e):e,r?o(t):t)},isText:e=>B(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every(e=>G.isText(e)),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[{leaf:J({},e)}];for(var r of t){var{anchor:o,focus:i,merge:a}=r,c=R(r,X),[s,l]=k.edges(r),u=[],d=0,f=s.offset,p=l.offset,m=null!=a?a:Object.assign;for(var{leaf:h}of n){var{length:g}=h.text,v=d;if(d+=g,f<=v&&d<=p)m(h,c),u.push({leaf:h});else if(f!==p&&(f===d||p===v)||f>d||p<v||p===v&&0!==v)u.push({leaf:h});else{var y=h,b=void 0,w=void 0;if(p<d){var x=p-v;w={leaf:J(J({},y),{},{text:y.text.slice(x)})},y=J(J({},y),{},{text:y.text.slice(0,x)})}if(f>v){var E=f-v;b={leaf:J(J({},y),{},{text:y.text.slice(0,E)})},y=J(J({},y),{},{text:y.text.slice(E)})}m(y,c),b&&u.push(b),u.push({leaf:y}),w&&u.push(w)}}n=u}if(n.length>1){var O=0;for(var[P,S]of n.entries()){var C=O,N=C+S.leaf.text.length,A={start:C,end:N};0===P&&(A.isFirst=!0),P===n.length-1&&(A.isLast=!0),S.position=A,O=N}}return n}};function Q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ee(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(n),!0).forEach(function(t){O(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var te=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return[...e.slice(0,t),...r,...e.slice(t)]},ne=function(e,t,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];return[...e.slice(0,t),...o,...e.slice(t+n)]},re=ne,oe=(e,t,n)=>{if(0===t.length)throw new Error("Cannot modify the editor");for(var r=M.get(e,t),o=t.slice(),i=n(r);o.length>1;){var a=o.pop(),c=M.get(e,o);i=ee(ee({},c),{},{children:ne(c.children,a,1,i)})}var s=o.pop();e.children=ne(e.children,s,1,i)},ie=(e,t,n)=>{0===t.length?e.children=n(e.children):oe(e,t,e=>{if(G.isText(e))throw new Error("Cannot get the element at path [".concat(t,"] because it refers to a leaf node: ").concat(H.stringify(e)));return ee(ee({},e),{},{children:n(e.children)})})},ae=(e,t,n)=>oe(e,t,e=>{if(!G.isText(e))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(H.stringify(e)));return n(e)});function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function se(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(n),!0).forEach(function(t){O(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var le={transform(e,t){var n=!1;switch(t.type){case"insert_node":var{path:r,node:o}=t;ie(e,w.parent(r),e=>{var t=r[r.length-1];if(t>e.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));return te(e,t,o)}),n=!0;break;case"insert_text":var{path:i,offset:a,text:c}=t;if(0===c.length)break;ae(e,i,e=>{var t=e.text.slice(0,a),n=e.text.slice(a);return se(se({},e),{},{text:t+c+n})}),n=!0;break;case"merge_node":var{path:s}=t,l=s[s.length-1],u=w.previous(s),d=u[u.length-1];ie(e,w.parent(s),e=>{var t,n=e[l],r=e[d];if(G.isText(n)&&G.isText(r))t=se(se({},r),{},{text:r.text+n.text});else{if(G.isText(n)||G.isText(r))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(s,"] to nodes of different interfaces: ").concat(H.stringify(n)," ").concat(H.stringify(r)));t=se(se({},r),{},{children:r.children.concat(n.children)})}return ne(e,d,2,t)}),n=!0;break;case"move_node":var{path:f,newPath:p}=t,m=f[f.length-1];if(w.isAncestor(f,p))throw new Error("Cannot move a path [".concat(f,"] to new path [").concat(p,"] because the destination is inside itself."));var h=M.get(e,f);ie(e,w.parent(f),e=>re(e,m,1));var g=w.transform(f,t),v=g[g.length-1];ie(e,w.parent(g),e=>te(e,v,h)),n=!0;break;case"remove_node":var{path:y}=t,b=y[y.length-1];if(ie(e,w.parent(y),e=>re(e,b,1)),e.selection){var x=se({},e.selection);for(var[E,O]of k.points(x)){var R=K.transform(E,t);if(null!=x&&null!=R)x[O]=R;else{var P=void 0,S=void 0;for(var[C,N]of M.texts(e)){if(-1!==w.compare(N,y)){S=[C,N];break}P=[C,N]}var A=!1;P&&S&&(A=!w.isSibling(P[1],y)&&(!!w.equals(S[1],y)||w.common(P[1],y).length<w.common(S[1],y).length)),P&&!A?x[O]={path:P[1],offset:P[0].text.length}:S?x[O]={path:S[1],offset:0}:x=null}}x&&k.equals(x,e.selection)||(e.selection=x)}break;case"remove_text":var{path:D,offset:j,text:T}=t;if(0===T.length)break;ae(e,D,e=>{var t=e.text.slice(0,j),n=e.text.slice(j+T.length);return se(se({},e),{},{text:t+n})}),n=!0;break;case"set_node":var{path:_,properties:L,newProperties:I}=t;if(0===_.length)throw new Error("Cannot set properties on the root node!");oe(e,_,e=>{var t=se({},e);for(var n in I){if("children"===n||"text"===n)throw new Error('Cannot set the "'.concat(n,'" property of nodes!'));var r=I[n];null==r?delete t[n]:t[n]=r}for(var o in L)I.hasOwnProperty(o)||delete t[o];return t});break;case"set_selection":var{newProperties:F}=t;if(null==F){e.selection=null;break}if(null==e.selection){if(!k.isRange(F))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(H.stringify(F)," when there is no current selection."));e.selection=se({},F);break}var B=se({},e.selection);for(var W in F){var q=F[W];if(null==q){if("anchor"===W||"focus"===W)throw new Error('Cannot remove the "'.concat(W,'" selection property'));delete B[W]}else B[W]=q}e.selection=B;break;case"split_node":var{path:V,position:z,properties:$}=t,U=V[V.length-1];if(0===V.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(V,"] because the root node cannot be split."));ie(e,w.parent(V),e=>{var t,n,r=e[U];if(G.isText(r)){var o=r.text.slice(0,z),i=r.text.slice(z);t=se(se({},r),{},{text:o}),n=se(se({},$),{},{text:i})}else{var a=r.children.slice(0,z),c=r.children.slice(z);t=se(se({},r),{},{children:a}),n=se(se({},$),{},{children:c})}return ne(e,U,1,t,n)}),n=!0}if(n&&e.selection){var Z=se({},e.selection);for(var[X,Y]of k.points(Z))Z[Y]=K.transform(X,t);k.equals(Z,e.selection)||(e.selection=Z)}}},ue={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},de={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},fe={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};V.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:o=q(e)}=n;if(w.isPath(o)&&(o=V.range(e,o)),k.isRange(o))if(k.isCollapsed(o))o=o.anchor;else{var i=k.end(o);if(!r&&V.void(e,{at:i}))return;var a=k.start(o),c=V.pointRef(e,a),s=V.pointRef(e,i);he.delete(e,{at:o,voids:r});var l=c.unref(),u=s.unref();o=l||u,he.setSelection(e,{anchor:o,focus:o})}if(!(!r&&V.void(e,{at:o})||V.elementReadOnly(e,{at:o}))){var{path:d,offset:f}=o;t.length>0&&e.apply({type:"insert_text",path:d,offset:f,text:t})}})}};function pe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pe(Object(n),!0).forEach(function(t){O(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var he=me(me(me(me({},le),ue),de),fe);const ge={buildMentionElements:(t,n)=>{const{props:r}=n||{},o=Object.assign(Object.assign({},r),{nodeType:"inlineVoid"});return{id:e(),type:"mention",children:[{text:""}],props:o}},insertMention:(n,r,o)=>{const{char:i="@"}=n.plugins.Mention.options||{},a=t.getBlockSlate(n,{at:n.path.current}),c=(null==o?void 0:o.selection)||(null==a?void 0:a.selection);if(!a||!k.isRange(c))return;const{anchor:s}=c,l=M.get(a,s.path);if(!G.isText(l))return;const u=l.text.slice(0,s.offset).lastIndexOf(i);if(-1===u)return;he.select(a,{anchor:{path:s.path,offset:u},focus:s}),he.delete(a);const d={id:e(),type:"mention",children:[{text:""}],props:Object.assign(Object.assign({},r),{nodeType:"inlineVoid"})},f=t.getBlock(n,{at:n.path.current});(null==f?void 0:f.id)&&n.focusBlock(null==f?void 0:f.id),he.insertNodes(a,d)},deleteMention:(e,n)=>{const r=t.getBlockSlate(e,{at:e.path.current}),o=(null==n?void 0:n.selection)||(null==r?void 0:r.selection);if(!r||!k.isRange(o))return;const i=M.get(r,o.anchor.path);N.isElement(i)&&i&&V.isInline(r,i)&&he.removeNodes(r,{at:o.anchor.path})},findMentions:(e,n)=>{var r;try{const o=(null==n?void 0:n.blockId)?{id:n.blockId}:{at:null!==(r=null==n?void 0:n.at)&&void 0!==r?r:e.path.current},i=t.getBlockSlate(e,o);if(!i)return[];return Array.from(V.nodes(i,{at:[],match:e=>N.isElement(e)&&!V.isEditor(e)&&"mention"===e.type}))}catch(e){return console.error("Error finding mentions:",e),null}},findMention:(e,n)=>{var r;try{const o=(null==n?void 0:n.blockId)?{id:n.blockId}:{at:null!==(r=null==n?void 0:n.at)&&void 0!==r?r:e.path.current},i=t.getBlockSlate(e,o);if(!i)return null;const[a]=V.nodes(i,{match:e=>N.isElement(e)&&!V.isEditor(e)&&"mention"===e.type,mode:"highest",at:[]});return a||null}catch(e){return console.error("Error finding mention:",e),null}},openDropdown:(e,t,n)=>{e.mentions.target=t,e.mentions.search=n},getSearchQuery:e=>e.mentions.search,closeDropdown:e=>{e.mentions.target=null,e.mentions.search=""}},ve=new r({type:"Mention",elements:{mention:{render:e=>{const{element:t,attributes:r,children:o}=e,{id:i,name:a,avatar:c}=t.props,{isElementSelected:u,isElementFocused:d}=n();return s("span",Object.assign({},r,{contentEditable:!1,"data-mention-id":i,className:"yoopta-mention-tag "+(u&&d?"yoopta-mention-tag-selected":"")},{children:[c&&l("img",{src:c,alt:a,width:16,height:16,loading:"lazy",className:"yoopta-mention-tag-avatar"}),a,o]}))},props:{id:"",avatar:"",name:"",nodeType:"inlineVoid"}}},options:{display:{title:"Mention",description:"Create mention"},char:"@"},commands:ge,extensions:(e,t)=>{const{markableVoid:n,isInline:r}=e;return e.markableVoid=e=>"mention"===e.type||n(e),e.isInline=e=>"mention"===e.type||r(e),e},events:{onKeyDown:(e,n)=>r=>{var i,a;const{key:c}=r,s=e.plugins.Mention.options||{},{char:l}=s;if(c===l&&n.selection&&k.isCollapsed(n.selection)){const r=t.getBlockSlate(e,{at:e.path.current});if(!r||!r.selection)return;const c=o.getElementRect(n,n.selection);if(!c)return;const s=M.get(r,n.selection.anchor.path);if(!G.isText(s))return;const l=s.text,u=n.selection.anchor.offset,d=null!==(i=l[u-1])&&void 0!==i?i:"",f=null!==(a=l[u])&&void 0!==a?a:"",p=""===d||/\s/.test(d),m=""===f||/\s/.test(f);if(!p||!m)return;e.mentions.target=c,e.mentions.search=""}e.mentions.target&&("Escape"===c?ge.closeDropdown(e):"Backspace"===c?e.mentions.search=e.mentions.search.slice(0,-1):1===c.length&&(e.mentions.search+=c))}}});function ye(e){return e.mentions={target:null,search:""},e}var be=function(){return be=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},be.apply(this,arguments)};function we(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function xe(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,c)}s((r=r.apply(e,t||[])).next())})}function Ee(){return"undefined"!=typeof window}function Oe(e){return Se(e)?(e.nodeName||"").toLowerCase():"#document"}function Re(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Pe(e){var t;return null==(t=(Se(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Se(e){return!!Ee()&&(e instanceof Node||e instanceof Re(e).Node)}function ke(e){return!!Ee()&&(e instanceof Element||e instanceof Re(e).Element)}function Ce(e){return!!Ee()&&(e instanceof HTMLElement||e instanceof Re(e).HTMLElement)}function Ne(e){return!(!Ee()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Re(e).ShadowRoot)}"function"==typeof SuppressedError&&SuppressedError;const Ae=new Set(["inline","contents"]);function De(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ze(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Ae.has(o)}const je=new Set(["table","td","th"]);function Te(e){return je.has(Oe(e))}const Me=[":popover-open",":modal"];function _e(e){return Me.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Le=["transform","translate","scale","rotate","perspective"],Ie=["transform","translate","scale","rotate","perspective","filter"],Fe=["paint","layout","strict","content"];function Be(e){const t=We(),n=ke(e)?ze(e):e;return Le.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Ie.some(e=>(n.willChange||"").includes(e))||Fe.some(e=>(n.contain||"").includes(e))}function We(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const qe=new Set(["html","body","#document"]);function Ve(e){return qe.has(Oe(e))}function ze(e){return Re(e).getComputedStyle(e)}function $e(e){return ke(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ke(e){if("html"===Oe(e))return e;const t=e.assignedSlot||e.parentNode||Ne(e)&&e.host||Pe(e);return Ne(t)?t.host:t}function Ue(e){const t=Ke(e);return Ve(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ce(t)&&De(t)?t:Ue(t)}function He(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Ue(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Re(o);if(i){const e=Ze(a);return t.concat(a,a.visualViewport||[],De(o)?o:[],e&&n?He(e):[])}return t.concat(o,He(o,[],n))}function Ze(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Xe=Math.min,Ye=Math.max,Je=Math.round,Ge=Math.floor,Qe=e=>({x:e,y:e}),et={left:"right",right:"left",bottom:"top",top:"bottom"},tt={start:"end",end:"start"};function nt(e,t,n){return Ye(e,Xe(t,n))}function rt(e,t){return"function"==typeof e?e(t):e}function ot(e){return e.split("-")[0]}function it(e){return e.split("-")[1]}function at(e){return"x"===e?"y":"x"}function ct(e){return"y"===e?"height":"width"}const st=new Set(["top","bottom"]);function lt(e){return st.has(ot(e))?"y":"x"}function ut(e){return at(lt(e))}function dt(e){return e.replace(/start|end/g,e=>tt[e])}const ft=["left","right"],pt=["right","left"],mt=["top","bottom"],ht=["bottom","top"];function gt(e,t,n,r){const o=it(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?pt:ft:t?ft:pt;case"left":case"right":return t?mt:ht;default:return[]}}(ot(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(dt)))),i}function vt(e){return e.replace(/left|right|bottom|top/g,e=>et[e])}function yt(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function bt(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function wt(e,t,n){let{reference:r,floating:o}=e;const i=lt(t),a=ut(t),c=ct(a),s=ot(t),l="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[c]/2-o[c]/2;let p;switch(s){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(it(t)){case"start":p[a]-=f*(n&&l?-1:1);break;case"end":p[a]+=f*(n&&l?-1:1)}return p}async function xt(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:c,strategy:s}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=rt(t,e),m=yt(p),h=c[f?"floating"===d?"reference":"floating":d],g=bt(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:l,rootBoundary:u,strategy:s})),v="floating"===d?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},w=bt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:y,strategy:s}):v);return{top:(g.top-w.top+m.top)/b.y,bottom:(w.bottom-g.bottom+m.bottom)/b.y,left:(g.left-w.left+m.left)/b.x,right:(w.right-g.right+m.right)/b.x}}function Et(e){const t=Xe(...e.map(e=>e.left)),n=Xe(...e.map(e=>e.top));return{x:t,y:n,width:Ye(...e.map(e=>e.right))-t,height:Ye(...e.map(e=>e.bottom))-n}}const Ot=new Set(["left","top"]);function Rt(e){const t=ze(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ce(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,c=Je(n)!==i||Je(r)!==a;return c&&(n=i,r=a),{width:n,height:r,$:c}}function Pt(e){return ke(e)?e:e.contextElement}function St(e){const t=Pt(e);if(!Ce(t))return Qe(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Rt(t);let a=(i?Je(n.width):n.width)/r,c=(i?Je(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),c&&Number.isFinite(c)||(c=1),{x:a,y:c}}const kt=Qe(0);function Ct(e){const t=Re(e);return We()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:kt}function Nt(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Pt(e);let a=Qe(1);t&&(r?ke(r)&&(a=St(r)):a=St(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Re(e))&&t}(i,n,r)?Ct(i):Qe(0);let s=(o.left+c.x)/a.x,l=(o.top+c.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=Re(i),t=r&&ke(r)?Re(r):r;let n=e,o=Ze(n);for(;o&&r&&t!==n;){const e=St(o),t=o.getBoundingClientRect(),r=ze(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,l*=e.y,u*=e.x,d*=e.y,s+=i,l+=a,n=Re(o),o=Ze(n)}}return bt({width:u,height:d,x:s,y:l})}function At(e,t){const n=$e(e).scrollLeft;return t?t.left+n:Nt(Pe(e)).left+n}function Dt(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-At(e,n),y:n.top+t.scrollTop}}const jt=new Set(["absolute","fixed"]);function Tt(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Re(e),r=Pe(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,c=0,s=0;if(o){i=o.width,a=o.height;const e=We();(!e||e&&"fixed"===t)&&(c=o.offsetLeft,s=o.offsetTop)}const l=At(r);if(l<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(r.clientWidth-t.clientWidth-o);a<=25&&(i-=a)}else l<=25&&(i+=l);return{width:i,height:a,x:c,y:s}}(e,n);else if("document"===t)r=function(e){const t=Pe(e),n=$e(e),r=e.ownerDocument.body,o=Ye(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Ye(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+At(e);const c=-n.scrollTop;return"rtl"===ze(r).direction&&(a+=Ye(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:c}}(Pe(e));else if(ke(t))r=function(e,t){const n=Nt(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ce(e)?St(e):Qe(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=Ct(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return bt(r)}function Mt(e,t){const n=Ke(e);return!(n===t||!ke(n)||Ve(n))&&("fixed"===ze(n).position||Mt(n,t))}function _t(e,t,n){const r=Ce(t),o=Pe(t),i="fixed"===n,a=Nt(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const s=Qe(0);function l(){s.x=At(o)}if(r||!r&&!i)if(("body"!==Oe(t)||De(o))&&(c=$e(t)),r){const e=Nt(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&l();i&&!r&&o&&l();const u=!o||r||i?Qe(0):Dt(o,c);return{x:a.left+c.scrollLeft-s.x-u.x,y:a.top+c.scrollTop-s.y-u.y,width:a.width,height:a.height}}function Lt(e){return"static"===ze(e).position}function It(e,t){if(!Ce(e)||"fixed"===ze(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Pe(e)===n&&(n=n.ownerDocument.body),n}function Ft(e,t){const n=Re(e);if(_e(e))return n;if(!Ce(e)){let t=Ke(e);for(;t&&!Ve(t);){if(ke(t)&&!Lt(t))return t;t=Ke(t)}return n}let r=It(e,t);for(;r&&Te(r)&&Lt(r);)r=It(r,t);return r&&Ve(r)&&Lt(r)&&!Be(r)?n:r||function(e){let t=Ke(e);for(;Ce(t)&&!Ve(t);){if(Be(t))return t;if(_e(t))return null;t=Ke(t)}return null}(e)||n}const Bt={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Pe(r),c=!!t&&_e(t.floating);if(r===a||c&&i)return n;let s={scrollLeft:0,scrollTop:0},l=Qe(1);const u=Qe(0),d=Ce(r);if((d||!d&&!i)&&(("body"!==Oe(r)||De(a))&&(s=$e(r)),Ce(r))){const e=Nt(r);l=St(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const f=!a||d||i?Qe(0):Dt(a,s);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-s.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-s.scrollTop*l.y+u.y+f.y}},getDocumentElement:Pe,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?_e(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=He(e,[],!1).filter(e=>ke(e)&&"body"!==Oe(e)),o=null;const i="fixed"===ze(e).position;let a=i?Ke(e):e;for(;ke(a)&&!Ve(a);){const t=ze(a),n=Be(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&jt.has(o.position)||De(a)&&!n&&Mt(e,a))?r=r.filter(e=>e!==a):o=t,a=Ke(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((e,n)=>{const r=Tt(t,n,o);return e.top=Ye(r.top,e.top),e.right=Xe(r.right,e.right),e.bottom=Xe(r.bottom,e.bottom),e.left=Ye(r.left,e.left),e},Tt(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:Ft,getElementRects:async function(e){const t=this.getOffsetParent||Ft,n=this.getDimensions,r=await n(e.floating);return{reference:_t(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Rt(e);return{width:t,height:n}},getScale:St,isElement:ke,isRTL:function(e){return"rtl"===ze(e).direction}};function Wt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function qt(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,l=Pt(e),u=o||i?[...l?He(l):[],...He(t)]:[];u.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const d=l&&c?function(e,t){let n,r=null;const o=Pe(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(c,s){void 0===c&&(c=!1),void 0===s&&(s=1),i();const l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(c||t(),!f||!p)return;const m={rootMargin:-Ge(d)+"px "+-Ge(o.clientWidth-(u+f))+"px "+-Ge(o.clientHeight-(d+p))+"px "+-Ge(u)+"px",threshold:Ye(0,Xe(1,s))||1};let h=!0;function g(t){const r=t[0].intersectionRatio;if(r!==s){if(!h)return a();r?a(!1,r):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==r||Wt(l,e.getBoundingClientRect())||a(),h=!1}try{r=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,m)}r.observe(e)}(!0),i}(l,n):null;let f,p=-1,m=null;a&&(m=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),n()}),l&&!s&&m.observe(l),m.observe(t));let h=s?Nt(e):null;return s&&function t(){const r=Nt(e);h&&!Wt(h,r)&&n();h=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=m)||e.disconnect(),m=null,s&&cancelAnimationFrame(f)}}const Vt=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:c}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=ot(n),c=it(n),s="y"===lt(n),l=Ot.has(a)?-1:1,u=i&&s?-1:1,d=rt(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),s?{x:p*u,y:f*l}:{x:f*l,y:p*u}}(t,e);return a===(null==(n=c.offset)?void 0:n.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:a}}}}},zt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=rt(e,t),l={x:n,y:r},u=await xt(t,s),d=lt(ot(o)),f=at(d);let p=l[f],m=l[d];if(i){const e="y"===f?"bottom":"right";p=nt(p+u["y"===f?"top":"left"],p,p-u[e])}if(a){const e="y"===d?"bottom":"right";m=nt(m+u["y"===d?"top":"left"],m,m-u[e])}const h=c.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:i,[d]:a}}}}}},$t=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:c,platform:s,elements:l}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=rt(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=ot(o),y=lt(c),b=ot(c)===c,w=await(null==s.isRTL?void 0:s.isRTL(l.floating)),x=f||(b||!h?[vt(c)]:function(e){const t=vt(e);return[dt(e),t,dt(t)]}(c)),E="none"!==m;!f&&E&&x.push(...gt(c,h,m,w));const O=[c,...x],R=await xt(t,g),P=[];let S=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&P.push(R[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=it(e),o=ut(e),i=ct(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=vt(a)),[a,vt(a)]}(o,a,w);P.push(R[e[0]],R[e[1]])}if(S=[...S,{placement:o,overflows:P}],!P.every(e=>e<=0)){var k,C;const e=((null==(k=i.flip)?void 0:k.index)||0)+1,t=O[e];if(t){if(!("alignment"===d&&y!==lt(t))||S.every(e=>lt(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:S},reset:{placement:t}}}let n=null==(C=S.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:C.placement;if(!n)switch(p){case"bestFit":{var N;const e=null==(N=S.filter(e=>{if(E){const t=lt(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:N[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},Kt=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:c=2,x:s,y:l}=rt(e,t),u=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),d=function(e){const t=e.slice().sort((e,t)=>e.y-t.y),n=[];let r=null;for(let e=0;e<t.length;e++){const o=t[e];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map(e=>bt(Et(e)))}(u),f=bt(Et(u)),p=yt(c);const m=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===d.length&&d[0].left>d[1].right&&null!=s&&null!=l)return d.find(e=>s>e.left-p.left&&s<e.right+p.right&&l>e.top-p.top&&l<e.bottom+p.bottom)||f;if(d.length>=2){if("y"===lt(n)){const e=d[0],t=d[d.length-1],r="top"===ot(n),o=e.top,i=t.bottom,a=r?e.left:t.left,c=r?e.right:t.right;return{top:o,bottom:i,left:a,right:c,width:c-a,height:i-o,x:a,y:o}}const e="left"===ot(n),t=Ye(...d.map(e=>e.right)),r=Xe(...d.map(e=>e.left)),o=d.filter(n=>e?n.left===r:n.right===t),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return f}},floating:r.floating,strategy:a});return o.reference.x!==m.reference.x||o.reference.y!==m.reference.y||o.reference.width!==m.reference.width||o.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},Ut=(e,t,n)=>{const r=new Map,o={platform:Bt,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,c=i.filter(Boolean),s=await(null==a.isRTL?void 0:a.isRTL(t));let l=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=wt(l,r,s),f=r,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:h}=c[n],{x:g,y:v,data:y,reset:b}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:l,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=v?v:d,p={...p,[i]:{...p[i],...y}},b&&m<=50&&(m++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(l=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=wt(l,f,s))),n=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Ht="undefined"!=typeof document?f:function(){};function Zt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!Zt(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Zt(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Xt(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Yt(e,t){const n=Xt(e);return Math.round(t*n)/n}function Jt(e){const t=d.useRef(e);return Ht(()=>{t.current=e}),t}const Gt=(e,t)=>({...Vt(e),options:[e,t]}),Qt=(e,t)=>({...zt(e),options:[e,t]}),en=(e,t)=>({...$t(e),options:[e,t]}),tn=(e,t)=>({...Kt(e),options:[e,t]}),nn={...d},rn=nn.useInsertionEffect||(e=>e());var on="undefined"!=typeof document?f:p;let an=!1,cn=0;const sn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+cn++;const ln=nn.useId||function(){const[e,t]=d.useState(()=>an?sn():void 0);return on(()=>{null==e&&t(sn())},[]),d.useEffect(()=>{an=!0},[]),e};const un=d.createContext(null),dn=d.createContext(null);function fn(e){const t=m(e);return on(()=>{t.current=e}),t}function pn(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=ln(),i=d.useRef({}),[a]=d.useState(()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}}()),c=null!=((null==(s=d.useContext(un))?void 0:s.id)||null);var s;const[l,u]=d.useState(r.reference),f=function(e){const t=d.useRef(()=>{});return rn(()=>{t.current=e}),d.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}((e,t,r)=>{i.current.openEvent=e?t:void 0,a.emit("openchange",{open:e,event:t,reason:r,nested:c}),null==n||n(e,t,r)}),p=d.useMemo(()=>({setPositionReference:u}),[]),m=d.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return d.useMemo(()=>({dataRef:i,open:t,onOpenChange:f,elements:m,events:a,floatingId:o,refs:p}),[t,f,m,a,o,p])}function mn(e){void 0===e&&(e={});const{nodeId:t}=e,n=pn({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,a]=d.useState(null),[c,s]=d.useState(null),l=(null==o?void 0:o.domReference)||i,u=d.useRef(null),f=d.useContext(dn);on(()=>{l&&(u.current=l)},[l]);const p=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:c=!0,whileElementsMounted:s,open:l}=e,[u,f]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=d.useState(r);Zt(p,r)||m(r);const[h,g]=d.useState(null),[v,b]=d.useState(null),w=d.useCallback(e=>{e!==R.current&&(R.current=e,g(e))},[]),x=d.useCallback(e=>{e!==P.current&&(P.current=e,b(e))},[]),E=i||h,O=a||v,R=d.useRef(null),P=d.useRef(null),S=d.useRef(u),k=null!=s,C=Jt(s),N=Jt(o),A=Jt(l),D=d.useCallback(()=>{if(!R.current||!P.current)return;const e={placement:t,strategy:n,middleware:p};N.current&&(e.platform=N.current),Ut(R.current,P.current,e).then(e=>{const t={...e,isPositioned:!1!==A.current};j.current&&!Zt(S.current,t)&&(S.current=t,y.flushSync(()=>{f(t)}))})},[p,t,n,N,A]);Ht(()=>{!1===l&&S.current.isPositioned&&(S.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[l]);const j=d.useRef(!1);Ht(()=>(j.current=!0,()=>{j.current=!1}),[]),Ht(()=>{if(E&&(R.current=E),O&&(P.current=O),E&&O){if(C.current)return C.current(E,O,D);D()}},[E,O,D,C,k]);const T=d.useMemo(()=>({reference:R,floating:P,setReference:w,setFloating:x}),[w,x]),M=d.useMemo(()=>({reference:E,floating:O}),[E,O]),_=d.useMemo(()=>{const e={position:n,left:0,top:0};if(!M.floating)return e;const t=Yt(M.floating,u.x),r=Yt(M.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...Xt(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,c,M.floating,u.x,u.y]);return d.useMemo(()=>({...u,update:D,refs:T,elements:M,floatingStyles:_}),[u,D,T,M,_])}({...e,elements:{...o,...c&&{reference:c}}}),m=d.useCallback(e=>{const t=ke(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s(t),p.refs.setReference(t)},[p.refs]),h=d.useCallback(e=>{(ke(e)||null===e)&&(u.current=e,a(e)),(ke(p.refs.reference.current)||null===p.refs.reference.current||null!==e&&!ke(e))&&p.refs.setReference(e)},[p.refs]),g=d.useMemo(()=>({...p.refs,setReference:h,setPositionReference:m,domReference:u}),[p.refs,h,m]),v=d.useMemo(()=>({...p.elements,domReference:l}),[p.elements,l]),b=d.useMemo(()=>({...p,...r,refs:g,elements:v,nodeId:t}),[p,g,v,t,r]);return on(()=>{r.dataRef.current.floatingContext=b;const e=null==f?void 0:f.nodesRef.current.find(e=>e.id===t);e&&(e.context=b)}),d.useMemo(()=>({...p,context:b,refs:g,elements:v}),[p,g,v,b])}const hn=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function gn(e,t){return"function"==typeof e?e(t):e}function vn(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("number"==typeof o?o:o.close)||0,[a,c]=d.useState("unmounted"),s=function(e,t){const[n,r]=d.useState(e);return e&&!n&&r(!0),d.useEffect(()=>{if(!e&&n){const e=setTimeout(()=>r(!1),t);return()=>clearTimeout(e)}},[e,n,t]),n}(n,i);return s||"close"!==a||c("unmounted"),on(()=>{if(r){if(n){c("initial");const e=requestAnimationFrame(()=>{c("open")});return()=>{cancelAnimationFrame(e)}}c("close")}},[n,r]),{isMounted:s,status:a}}function yn(e,t){return e===t}function bn(e,t,n){var r=n&&n.equalityFn||yn,o=m(e),i=h({})[1],a=function(e,t,n,r){var o=this,i=m(null),a=m(0),c=m(0),s=m(null),l=m([]),u=m(),d=m(),f=m(e),h=m(!0);f.current=e;var g="undefined"!=typeof window,y=!t&&0!==t&&g;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,w=!("trailing"in n)||!!n.trailing,x="maxWait"in n,E="debounceOnServer"in n&&!!n.debounceOnServer,O=x?Math.max(+n.maxWait||0,t):null;p(function(){return h.current=!0,function(){h.current=!1}},[]);var R=v(function(){var e=function(e){var t=l.current,n=u.current;return l.current=u.current=null,a.current=e,c.current=c.current||e,d.current=f.current.apply(n,t)},n=function(e,t){y&&cancelAnimationFrame(s.current),s.current=y?requestAnimationFrame(e):setTimeout(e,t)},p=function(e){if(!h.current)return!1;var n=e-i.current;return!i.current||n>=t||n<0||x&&e-a.current>=O},m=function(t){return s.current=null,w&&l.current?e(t):(l.current=u.current=null,d.current)},v=function e(){var r=Date.now();if(b&&c.current===a.current&&R(),p(r))return m(r);if(h.current){var o=t-(r-i.current),s=x?Math.min(o,O-(r-a.current)):o;n(e,s)}},R=function(){r&&r({})},P=function(){if(g||E){var r=Date.now(),c=p(r);if(l.current=[].slice.call(arguments),u.current=o,i.current=r,c){if(!s.current&&h.current)return a.current=i.current,n(v,t),b?e(i.current):d.current;if(x)return n(v,t),e(i.current)}return s.current||n(v,t),d.current}};return P.cancel=function(){var e=s.current;e&&(y?cancelAnimationFrame(s.current):clearTimeout(s.current)),a.current=0,l.current=i.current=u.current=s.current=null,e&&r&&r({})},P.isPending=function(){return!!s.current},P.flush=function(){return s.current?m(Date.now()):d.current},P},[b,x,t,O,w,y,g,E,r]);return R}(g(function(e){o.current=e,i({})},[i]),t,n,i),c=m(e);return r(c.current,e)||(a(e),c.current=e),[o.current,a]}var wn=.999,xn=/[\\\/_+.#"@\[\(\{&]/,En=/[\\\/_+.#"@\[\(\{&]/g,On=/[\s-]/,Rn=/[\s-]/g;function Pn(e,t,n,r,o,i,a){if(i===t.length)return o===e.length?1:.99;var c=`${o},${i}`;if(void 0!==a[c])return a[c];for(var s,l,u,d,f=r.charAt(i),p=n.indexOf(f,o),m=0;p>=0;)(s=Pn(e,t,n,r,p+1,i+1,a))>m&&(p===o?s*=1:xn.test(e.charAt(p-1))?(s*=.8,(u=e.slice(o,p-1).match(En))&&o>0&&(s*=Math.pow(wn,u.length))):On.test(e.charAt(p-1))?(s*=.9,(d=e.slice(o,p-1).match(Rn))&&o>0&&(s*=Math.pow(wn,d.length))):(s*=.17,o>0&&(s*=Math.pow(wn,p-o))),e.charAt(p)!==t.charAt(i)&&(s*=.9999)),(s<.1&&n.charAt(p-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(p-1)!==r.charAt(i))&&(.1*(l=Pn(e,t,n,r,p+1,i+2,a))>s&&(s=.1*l)),s>m&&(m=s),p=n.indexOf(f,p+1);return a[c]=m,m}function Sn(e){return e.toLowerCase().replace(Rn," ")}function kn(e,t,n){return Pn(e=n&&n.length>0?""+(e+" "+n.join(" ")):e,t,Sn(e),Sn(t),0,0,{})}function Cn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function Nn(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function An(...e){return t=>{let n=!1;const r=e.map(e=>{const r=Nn(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():Nn(e[t],null)}}}}function Dn(...e){return d.useCallback(An(...e),e)}function jn(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const r=n.reduce((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]}),{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Tn=globalThis?.document?d.useLayoutEffect:()=>{},Mn=d[" useId ".trim().toString()]||(()=>{}),_n=0;function Ln(e){const[t,n]=d.useState(Mn());return Tn(()=>{e||n(e=>e??String(_n++))},[e]),e||(t?`radix-${t}`:"")}var In=d[" useInsertionEffect ".trim().toString()]||Tn;function Fn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,a]=function({defaultProp:e,onChange:t}){const[n,r]=d.useState(e),o=d.useRef(n),i=d.useRef(t);return In(()=>{i.current=t},[t]),d.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}({defaultProp:t,onChange:n}),c=void 0!==e,s=c?e:o;{const t=d.useRef(void 0!==e);d.useEffect(()=>{const e=t.current;if(e!==c){const t=e?"controlled":"uncontrolled",n=c?"controlled":"uncontrolled";console.warn(`${r} is changing from ${t} to ${n}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=c},[c,r])}const l=d.useCallback(t=>{if(c){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&a.current?.(n)}else i(t)},[c,e,i,a]);return[s,l]}function Bn(e){const t=Wn(e),n=d.forwardRef((e,n)=>{const{children:r,...o}=e,i=d.Children.toArray(r),a=i.find(Vn);if(a){const e=a.props.children,r=i.map(t=>t===a?d.Children.count(e)>1?d.Children.only(null):d.isValidElement(e)?e.props.children:null:t);return l(t,{...o,ref:n,children:d.isValidElement(e)?d.cloneElement(e,void 0,r):null})}return l(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Wn(e){const t=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{const t=i(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==d.Fragment&&(o.ref=t?An(t,e):e),d.cloneElement(n,o)}return d.Children.count(n)>1?d.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qn=Symbol("radix.slottable");function Vn(e){return d.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===qn}var zn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=Bn(`Primitive.${t}`),r=d.forwardRef((e,r)=>{const{asChild:o,...i}=e,a=o?n:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),l(a,{...i,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function $n(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...e)=>t.current?.(...e),[])}var Kn,Un="dismissableLayer.update",Hn="dismissableLayer.pointerDownOutside",Zn="dismissableLayer.focusOutside",Xn=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Yn=d.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:c,...s}=e,u=d.useContext(Xn),[f,p]=d.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=d.useState({}),g=Dn(t,e=>p(e)),v=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),w=f?v.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,E=w>=b,O=function(e,t=globalThis?.document){const n=$n(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const e=e=>{if(e.target&&!r.current){let r=function(){Gn(Hn,n,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{const t=e.target,n=[...u.branches].some(e=>e.contains(t));E&&!n&&(o?.(e),a?.(e),e.defaultPrevented||c?.())},m),R=function(e,t=globalThis?.document){const n=$n(e),r=d.useRef(!1);return d.useEffect(()=>{const e=e=>{if(e.target&&!r.current){Gn(Zn,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(i?.(e),a?.(e),e.defaultPrevented||c?.())},m);return function(e,t=globalThis?.document){const n=$n(e);d.useEffect(()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{w===u.layers.size-1&&(r?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},m),d.useEffect(()=>{if(f)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Kn=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Jn(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=Kn)}},[f,m,n,u]),d.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Jn())},[f,u]),d.useEffect(()=>{const e=()=>h({});return document.addEventListener(Un,e),()=>document.removeEventListener(Un,e)},[]),l(zn.div,{...s,ref:g,style:{pointerEvents:x?E?"auto":"none":void 0,...e.style},onFocusCapture:Cn(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Cn(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Cn(e.onPointerDownCapture,O.onPointerDownCapture)})});Yn.displayName="DismissableLayer";function Jn(){const e=new CustomEvent(Un);document.dispatchEvent(e)}function Gn(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&y.flushSync(()=>e.dispatchEvent(t))}(o,i):o.dispatchEvent(i)}d.forwardRef((e,t)=>{const n=d.useContext(Xn),r=d.useRef(null),o=Dn(t,r);return d.useEffect(()=>{const e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),l(zn.div,{...e,ref:o})}).displayName="DismissableLayerBranch";var Qn="focusScope.autoFocusOnMount",er="focusScope.autoFocusOnUnmount",tr={bubbles:!1,cancelable:!0},nr=d.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[c,s]=d.useState(null),u=$n(o),f=$n(i),p=d.useRef(null),m=Dn(t,e=>s(e)),h=d.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;d.useEffect(()=>{if(r){let e=function(e){if(h.paused||!c)return;const t=e.target;c.contains(t)?p.current=t:ar(p.current,{select:!0})},t=function(e){if(h.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||ar(p.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&ar(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[r,c,h.paused]),d.useEffect(()=>{if(c){cr.add(h);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(Qn,tr);c.addEventListener(Qn,u),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ar(r,{select:t}),document.activeElement!==n)return}((e=rr(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&ar(c))}return()=>{c.removeEventListener(Qn,u),setTimeout(()=>{const e=new CustomEvent(er,tr);c.addEventListener(er,f),c.dispatchEvent(e),e.defaultPrevented||ar(t??document.body,{select:!0}),c.removeEventListener(er,f),cr.remove(h)},0)}}var e},[c,u,f,h]);const g=d.useCallback(e=>{if(!n&&!r)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(t&&o){const t=e.currentTarget,[r,i]=function(e){const t=rr(e),n=or(t,e),r=or(t.reverse(),e);return[n,r]}(t);r&&i?e.shiftKey||o!==i?e.shiftKey&&o===r&&(e.preventDefault(),n&&ar(i,{select:!0})):(e.preventDefault(),n&&ar(r,{select:!0})):o===t&&e.preventDefault()}},[n,r,h.paused]);return l(zn.div,{tabIndex:-1,...a,ref:m,onKeyDown:g})});function rr(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function or(e,t){for(const n of e)if(!ir(n,{upTo:t}))return n}function ir(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function ar(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}nr.displayName="FocusScope";var cr=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=sr(e,t),e.unshift(t)},remove(t){e=sr(e,t),e[0]?.resume()}}}();function sr(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var lr=d.forwardRef((e,t)=>{const{container:n,...r}=e,[o,i]=d.useState(!1);Tn(()=>i(!0),[]);const a=n||o&&globalThis?.document?.body;return a?b.createPortal(l(zn.div,{...r,ref:t}),a):null});lr.displayName="Portal";var ur=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=d.useState(),r=d.useRef(null),o=d.useRef(e),i=d.useRef("none"),a=e?"mounted":"unmounted",[c,s]=function(e,t){return d.useReducer((e,n)=>t[e][n]??e,e)}(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const e=dr(r.current);i.current="mounted"===c?e:"none"},[c]),Tn(()=>{const t=r.current,n=o.current;if(n!==e){const r=i.current,a=dr(t);if(e)s("MOUNT");else if("none"===a||"none"===t?.display)s("UNMOUNT");else{s(n&&r!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,s]),Tn(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,a=i=>{const a=dr(r.current).includes(CSS.escape(i.animationName));if(i.target===t&&a&&(s("ANIMATION_END"),!o.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(i.current=dr(r.current))};return t.addEventListener("animationstart",c),t.addEventListener("animationcancel",a),t.addEventListener("animationend",a),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",c),t.removeEventListener("animationcancel",a),t.removeEventListener("animationend",a)}}s("ANIMATION_END")},[t,s]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:d.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}(t),o="function"==typeof n?n({present:r.isPresent}):d.Children.only(n),i=Dn(r.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof n||r.isPresent?d.cloneElement(o,{ref:i}):null};function dr(e){return e?.animationName||"none"}ur.displayName="Presence";var fr=0;function pr(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var mr="right-scroll-bar-position",hr="width-before-scroll-bar";function gr(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var vr="undefined"!=typeof window?d.useLayoutEffect:d.useEffect,yr=new WeakMap;function br(e,t){var n,r,o,i=(n=t||null,r=function(t){return e.forEach(function(e){return gr(e,t)})},(o=h(function(){return{value:n,callback:r,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}})[0]).callback=r,o.facade);return vr(function(){var t=yr.get(i);if(t){var n=new Set(t),r=new Set(e),o=i.current;n.forEach(function(e){r.has(e)||gr(e,null)}),r.forEach(function(e){n.has(e)||gr(e,o)})}yr.set(i,e)},[e]),i}function wr(e){return e}var xr=function(e){var t=e.sideCar,n=we(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return d.createElement(r,be({},n))};xr.isSideCarExport=!0;var Er=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=wr);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var o=t(e,r);return n.push(o),function(){n=n.filter(function(e){return e!==o})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var i=function(){var n=t;t=[],n.forEach(e)},a=function(){return Promise.resolve().then(i)};a(),n={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),n}}}}}(null);return t.options=be({async:!0,ssr:!1},e),t}(),Or=function(){},Rr=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:Or,onWheelCapture:Or,onTouchMoveCapture:Or}),o=r[0],i=r[1],a=e.forwardProps,c=e.children,s=e.className,l=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,v=e.allowPinchZoom,y=e.as,b=void 0===y?"div":y,w=e.gapMode,x=we(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=p,O=br([n,t]),R=be(be({},x),o);return d.createElement(d.Fragment,null,u&&d.createElement(E,{sideCar:Er,removeScrollBar:l,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:w}),a?d.cloneElement(d.Children.only(c),be(be({},R),{ref:O})):d.createElement(b,be({},R,{className:s,ref:O}),c))});Rr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Rr.classNames={fullWidth:hr,zeroRight:mr};function Pr(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var Sr=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=Pr())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},kr=function(){var e,t=(e=Sr(),function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},Cr={left:0,top:0,right:0,gap:0},Nr=function(e){return parseInt(e||"",10)||0},Ar=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Cr;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[Nr(n),Nr(r),Nr(o)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Dr=kr(),jr="data-scroll-locked",Tr=function(e,t,n,r){var o=e.left,i=e.top,a=e.right,c=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(c,"px ").concat(r,";\n }\n body[").concat(jr,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(i,"px;\n padding-right: ").concat(a,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(c,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(mr," {\n right: ").concat(c,"px ").concat(r,";\n }\n \n .").concat(hr," {\n margin-right: ").concat(c,"px ").concat(r,";\n }\n \n .").concat(mr," .").concat(mr," {\n right: 0 ").concat(r,";\n }\n \n .").concat(hr," .").concat(hr," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(jr,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(c,"px;\n }\n")},Mr=function(){var e=parseInt(document.body.getAttribute(jr)||"0",10);return isFinite(e)?e:0},_r=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r;d.useEffect(function(){return document.body.setAttribute(jr,(Mr()+1).toString()),function(){var e=Mr()-1;e<=0?document.body.removeAttribute(jr):document.body.setAttribute(jr,e.toString())}},[]);var i=d.useMemo(function(){return Ar(o)},[o]);return d.createElement(Dr,{styles:Tr(i,!t,o,n?"":"!important")})},Lr=!1;if("undefined"!=typeof window)try{var Ir=Object.defineProperty({},"passive",{get:function(){return Lr=!0,!0}});window.addEventListener("test",Ir,Ir),window.removeEventListener("test",Ir,Ir)}catch(e){Lr=!1}var Fr=!!Lr&&{passive:!1},Br=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},Wr=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),qr(e,r)){var o=Vr(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},qr=function(e,t){return"v"===e?function(e){return Br(e,"overflowY")}(t):function(e){return Br(e,"overflowX")}(t)},Vr=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},zr=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},$r=function(e){return[e.deltaX,e.deltaY]},Kr=function(e){return e&&"current"in e?e.current:e},Ur=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Hr=0,Zr=[];function Xr(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Yr,Jr=(Yr=function(e){var t=d.useRef([]),n=d.useRef([0,0]),r=d.useRef(),o=d.useState(Hr++)[0],i=d.useState(kr)[0],a=d.useRef(e);d.useEffect(function(){a.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(Kr),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=d.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!a.current.allowPinchZoom;var o,i=zr(e),c=n.current,s="deltaX"in e?e.deltaX:c[0]-i[0],l="deltaY"in e?e.deltaY:c[1]-i[1],u=e.target,d=Math.abs(s)>Math.abs(l)?"h":"v";if("touches"in e&&"h"===d&&"range"===u.type)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Wr(d,u);if(!m)return!0;if(m?o=d:(o="v"===d?"h":"v",m=Wr(d,u)),!m)return!1;if(!r.current&&"changedTouches"in e&&(s||l)&&(r.current=o),!o)return!0;var h=r.current||o;return function(e,t,n,r,o){var i=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),a=i*r,c=n.target,s=t.contains(c),l=!1,u=a>0,d=0,f=0;do{if(!c)break;var p=Vr(e,c),m=p[0],h=p[1]-p[2]-i*m;(m||h)&&qr(e,c)&&(d+=h,f+=m);var g=c.parentNode;c=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!s&&c!==document.body||s&&(t.contains(c)||t===c));return(u&&(o&&Math.abs(d)<1||!o&&a>d)||!u&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l}(h,t,e,"h"===h?s:l,!0)},[]),s=d.useCallback(function(e){var n=e;if(Zr.length&&Zr[Zr.length-1]===i){var r="deltaY"in n?$r(n):zr(n),o=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&(t=e.delta,o=r,t[0]===o[0]&&t[1]===o[1]);var t,o})[0];if(o&&o.should)n.cancelable&&n.preventDefault();else if(!o){var s=(a.current.shards||[]).map(Kr).filter(Boolean).filter(function(e){return e.contains(n.target)});(s.length>0?c(n,s[0]):!a.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=d.useCallback(function(e,n,r,o){var i={name:e,delta:n,target:r,should:o,shadowParent:Xr(r)};t.current.push(i),setTimeout(function(){t.current=t.current.filter(function(e){return e!==i})},1)},[]),u=d.useCallback(function(e){n.current=zr(e),r.current=void 0},[]),f=d.useCallback(function(t){l(t.type,$r(t),t.target,c(t,e.lockRef.current))},[]),p=d.useCallback(function(t){l(t.type,zr(t),t.target,c(t,e.lockRef.current))},[]);d.useEffect(function(){return Zr.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",s,Fr),document.addEventListener("touchmove",s,Fr),document.addEventListener("touchstart",u,Fr),function(){Zr=Zr.filter(function(e){return e!==i}),document.removeEventListener("wheel",s,Fr),document.removeEventListener("touchmove",s,Fr),document.removeEventListener("touchstart",u,Fr)}},[]);var m=e.removeScrollBar,h=e.inert;return d.createElement(d.Fragment,null,h?d.createElement(i,{styles:Ur(o)}):null,m?d.createElement(_r,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Er.useMedium(Yr),xr),Gr=d.forwardRef(function(e,t){return d.createElement(Rr,be({},e,{ref:t,sideCar:Jr}))});Gr.classNames=Rr.classNames;var Qr=Gr,eo=new WeakMap,to=new WeakMap,no={},ro=0,oo=function(e){return e&&(e.host||oo(e.parentNode))},io=function(e,t,n,r){var o=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=oo(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);no[n]||(no[n]=new WeakMap);var i=no[n],a=[],c=new Set,s=new Set(o),l=function(e){e&&!c.has(e)&&(c.add(e),l(e.parentNode))};o.forEach(l);var u=function(e){e&&!s.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(c.has(e))u(e);else try{var t=e.getAttribute(r),o=null!==t&&"false"!==t,s=(eo.get(e)||0)+1,l=(i.get(e)||0)+1;eo.set(e,s),i.set(e,l),a.push(e),1===s&&o&&to.set(e,!0),1===l&&e.setAttribute(n,"true"),o||e.setAttribute(r,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return u(t),c.clear(),ro++,function(){a.forEach(function(e){var t=eo.get(e)-1,o=i.get(e)-1;eo.set(e,t),i.set(e,o),t||(to.has(e)||e.removeAttribute(r),to.delete(e)),o||e.removeAttribute(n)}),--ro||(eo=new WeakMap,eo=new WeakMap,to=new WeakMap,no={})}},ao=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),io(r,o,n,"aria-hidden")):function(){return null}},co="Dialog",[so,lo]=function(e,t=[]){let n=[];const r=()=>{const t=n.map(e=>d.createContext(e));return function(n){const r=n?.[e]||t;return d.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return r.scopeName=e,[function(t,r){const o=d.createContext(r),i=n.length;n=[...n,r];const a=t=>{const{scope:n,children:r,...a}=t,c=n?.[e]?.[i]||o,s=d.useMemo(()=>a,Object.values(a));return l(c.Provider,{value:s,children:r})};return a.displayName=t+"Provider",[a,function(n,a){const c=a?.[e]?.[i]||o,s=d.useContext(c);if(s)return s;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},jn(r,...t)]}(co),[uo,fo]=so(co),po=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=d.useRef(null),s=d.useRef(null),[u,f]=Fn({prop:r,defaultProp:o??!1,onChange:i,caller:co});return l(uo,{scope:t,triggerRef:c,contentRef:s,contentId:Ln(),titleId:Ln(),descriptionId:Ln(),open:u,onOpenChange:f,onOpenToggle:d.useCallback(()=>f(e=>!e),[f]),modal:a,children:n})};po.displayName=co;var mo="DialogTrigger";d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=fo(mo,n),i=Dn(t,o.triggerRef);return l(zn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Do(o.open),...r,ref:i,onClick:Cn(e.onClick,o.onOpenToggle)})}).displayName=mo;var ho="DialogPortal",[go,vo]=so(ho,{forceMount:void 0}),yo=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=fo(ho,t);return l(go,{scope:t,forceMount:n,children:d.Children.map(r,e=>l(ur,{present:n||i.open,children:l(lr,{asChild:!0,container:o,children:e})}))})};yo.displayName=ho;var bo="DialogOverlay",wo=d.forwardRef((e,t)=>{const n=vo(bo,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=fo(bo,e.__scopeDialog);return i.modal?l(ur,{present:r||i.open,children:l(Eo,{...o,ref:t})}):null});wo.displayName=bo;var xo=Bn("DialogOverlay.RemoveScroll"),Eo=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=fo(bo,n);return l(Qr,{as:xo,allowPinchZoom:!0,shards:[o.contentRef],children:l(zn.div,{"data-state":Do(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Oo="DialogContent",Ro=d.forwardRef((e,t)=>{const n=vo(Oo,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=fo(Oo,e.__scopeDialog);return l(ur,{present:r||i.open,children:i.modal?l(Po,{...o,ref:t}):l(So,{...o,ref:t})})});Ro.displayName=Oo;var Po=d.forwardRef((e,t)=>{const n=fo(Oo,e.__scopeDialog),r=d.useRef(null),o=Dn(t,n.contentRef,r);return d.useEffect(()=>{const e=r.current;if(e)return ao(e)},[]),l(ko,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Cn(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Cn(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:Cn(e.onFocusOutside,e=>e.preventDefault())})}),So=d.forwardRef((e,t)=>{const n=fo(Oo,e.__scopeDialog),r=d.useRef(!1),o=d.useRef(!1);return l(ko,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(o.current=!0));const i=t.target,a=n.triggerRef.current?.contains(i);a&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&o.current&&t.preventDefault()}})}),ko=d.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=e,c=fo(Oo,n),f=d.useRef(null),p=Dn(t,f);return d.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??pr()),document.body.insertAdjacentElement("beforeend",e[1]??pr()),fr++,()=>{1===fr&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),fr--}},[]),s(u,{children:[l(nr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:l(Yn,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Do(c.open),...a,ref:p,onDismiss:()=>c.onOpenChange(!1)})}),s(u,{children:[l(_o,{titleId:c.titleId}),l(Lo,{contentRef:f,descriptionId:c.descriptionId})]})]})}),Co="DialogTitle";d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=fo(Co,n);return l(zn.h2,{id:o.titleId,...r,ref:t})}).displayName=Co;var No="DialogDescription";d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=fo(No,n);return l(zn.p,{id:o.descriptionId,...r,ref:t})}).displayName=No;var Ao="DialogClose";function Do(e){return e?"open":"closed"}d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=fo(Ao,n);return l(zn.button,{type:"button",...r,ref:t,onClick:Cn(e.onClick,()=>o.onOpenChange(!1))})}).displayName=Ao;var jo="DialogTitleWarning",[To,Mo]=function(e,t){const n=d.createContext(t),r=e=>{const{children:t,...r}=e,o=d.useMemo(()=>r,Object.values(r));return l(n.Provider,{value:o,children:t})};return r.displayName=e+"Provider",[r,function(r){const o=d.useContext(n);if(o)return o;if(void 0!==t)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}]}(jo,{contentName:Oo,titleName:Co,docsSlug:"dialog"}),_o=({titleId:e})=>{const t=Mo(jo),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return d.useEffect(()=>{if(e){document.getElementById(e)||console.error(n)}},[n,e]),null},Lo=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Mo("DialogDescriptionWarning").contentName}}.`;return d.useEffect(()=>{const r=e.current?.getAttribute("aria-describedby");if(t&&r){document.getElementById(t)||console.warn(n)}},[n,e,t]),null},Io=po,Fo=yo,Bo=wo,Wo=Ro,qo=Symbol.for("react.lazy"),Vo=d[" use ".trim().toString()];function zo(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===qo&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function $o(e){const t=d.forwardRef((e,t)=>{let{children:n,...r}=e;if(zo(n)&&"function"==typeof Vo&&(n=Vo(n._payload)),d.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{const t=i(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==d.Fragment&&(o.ref=t?An(t,e):e),d.cloneElement(n,o)}return d.Children.count(n)>1?d.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ko=Symbol("radix.slottable");function Uo(e){return d.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Ko}var Ho=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=function(e){const t=$o(e),n=d.forwardRef((e,n)=>{let{children:r,...o}=e;zo(r)&&"function"==typeof Vo&&(r=Vo(r._payload));const i=d.Children.toArray(r),a=i.find(Uo);if(a){const e=a.props.children,r=i.map(t=>t===a?d.Children.count(e)>1?d.Children.only(null):d.isValidElement(e)?e.props.children:null:t);return l(t,{...o,ref:n,children:d.isValidElement(e)?d.cloneElement(e,void 0,r):null})}return l(t,{...o,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}(`Primitive.${t}`),r=d.forwardRef((e,r)=>{const{asChild:o,...i}=e,a=o?n:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),l(a,{...i,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Zo='[cmdk-group=""]',Xo='[cmdk-group-items=""]',Yo='[cmdk-item=""]',Jo=`${Yo}:not([aria-disabled="true"])`,Go="cmdk-item-select",Qo="data-value",ei=(e,t,n)=>kn(e,t,n),ti=d.createContext(void 0),ni=()=>d.useContext(ti),ri=d.createContext(void 0),oi=()=>d.useContext(ri),ii=d.createContext(void 0),ai=d.forwardRef((e,t)=>{let n=wi(()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=wi(()=>new Set),o=wi(()=>new Map),i=wi(()=>new Map),a=wi(()=>new Set),c=yi(e),{label:s,children:l,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=Ln(),w=Ln(),x=Ln(),E=d.useRef(null),O=Oi();bi(()=>{if(void 0!==u){let e=u.trim();n.current.value=e,R.emit()}},[u]),bi(()=>{O(6,A)},[]);let R=d.useMemo(()=>({subscribe:e=>(a.current.add(e),()=>a.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var o,i,a,s;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)N(),k(),O(1,C);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(x);e?e.focus():null==(o=document.getElementById(b))||o.focus()}if(O(7,()=>{var e;n.current.selectedItemId=null==(e=D())?void 0:e.id,R.emit()}),r||O(5,A),void 0!==(null==(i=c.current)?void 0:i.value)){let e=null!=t?t:"";return void(null==(s=(a=c.current).onValueChange)||s.call(a,e))}}R.emit()}},emit:()=>{a.current.forEach(e=>e())}}),[]),P=d.useMemo(()=>({value:(e,t,r)=>{var o;t!==(null==(o=i.current.get(e))?void 0:o.value)&&(i.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,S(t,r)),O(2,()=>{k(),R.emit()}))},item:(e,t)=>(r.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),O(3,()=>{N(),k(),n.current.value||C(),R.emit()}),()=>{i.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=D();O(4,()=>{N(),(null==t?void 0:t.getAttribute("id"))===e&&C(),R.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{i.current.delete(e),o.current.delete(e)}),filter:()=>c.current.shouldFilter,label:s||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:b,inputId:x,labelId:w,listInnerRef:E}),[]);function S(e,t){var r,o;let i=null!=(o=null==(r=c.current)?void 0:r.filter)?o:ei;return e?i(e,n.current.search,t):0}function k(){if(!n.current.search||!1===c.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=o.current.get(n),i=0;r.forEach(t=>{let n=e.get(t);i=Math.max(n,i)}),t.push([n,i])});let r=E.current;j().sort((t,n)=>{var r,o;let i=t.getAttribute("id"),a=n.getAttribute("id");return(null!=(r=e.get(a))?r:0)-(null!=(o=e.get(i))?o:0)}).forEach(e=>{let t=e.closest(Xo);t?t.appendChild(e.parentElement===t?e:e.closest(`${Xo} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Xo} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let n=null==(t=E.current)?void 0:t.querySelector(`${Zo}[${Qo}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)})}function C(){let e=j().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(Qo);R.setState("value",t||void 0)}function N(){var e,t,a,s;if(!n.current.search||!1===c.current.shouldFilter)return void(n.current.filtered.count=r.current.size);n.current.filtered.groups=new Set;let l=0;for(let o of r.current){let r=S(null!=(t=null==(e=i.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(a=i.current.get(o))?void 0:a.keywords)?s:[]);n.current.filtered.items.set(o,r),r>0&&l++}for(let[e,t]of o.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=l}function A(){var e,t,n;let r=D();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(Zo))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function D(){var e;return null==(e=E.current)?void 0:e.querySelector(`${Yo}[aria-selected="true"]`)}function j(){var e;return Array.from((null==(e=E.current)?void 0:e.querySelectorAll(Jo))||[])}function T(e){let t=j()[e];t&&R.setState("value",t.getAttribute(Qo))}function M(e){var t;let n=D(),r=j(),o=r.findIndex(e=>e===n),i=r[o+e];null!=(t=c.current)&&t.loop&&(i=o+e<0?r[r.length-1]:o+e===r.length?r[0]:r[o+e]),i&&R.setState("value",i.getAttribute(Qo))}function _(e){let t,n=D(),r=null==n?void 0:n.closest(Zo);for(;r&&!t;)r=e>0?gi(r,Zo):vi(r,Zo),t=null==r?void 0:r.querySelector(Jo);t?R.setState("value",t.getAttribute(Qo)):M(e)}let L=()=>T(j().length-1),I=e=>{e.preventDefault(),e.metaKey?L():e.altKey?_(1):M(1)},F=e=>{e.preventDefault(),e.metaKey?T(0):e.altKey?_(-1):M(-1)};return d.createElement(Ho.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let n=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!n)switch(e.key){case"n":case"j":v&&e.ctrlKey&&I(e);break;case"ArrowDown":I(e);break;case"p":case"k":v&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),T(0);break;case"End":e.preventDefault(),L();break;case"Enter":{e.preventDefault();let t=D();if(t){let e=new Event(Go);t.dispatchEvent(e)}}}}},d.createElement("label",{"cmdk-label":"",htmlFor:P.inputId,id:P.labelId,style:Pi},s),Ri(e,e=>d.createElement(ri.Provider,{value:R},d.createElement(ti.Provider,{value:P},e))))}),ci=d.forwardRef((e,t)=>{var n,r;let o=Ln(),i=d.useRef(null),a=d.useContext(ii),c=ni(),s=yi(e),l=null!=(r=null==(n=s.current)?void 0:n.forceMount)?r:null==a?void 0:a.forceMount;bi(()=>{if(!l)return c.item(o,null==a?void 0:a.id)},[l]);let u=Ei(o,i,[e.value,e.children,i],e.keywords),f=oi(),p=xi(e=>e.value&&e.value===u.current),m=xi(e=>!(!l&&!1!==c.filter())||(!e.search||e.filtered.items.get(o)>0));function h(){var e,t;g(),null==(t=(e=s.current).onSelect)||t.call(e,u.current)}function g(){f.setState("value",u.current,!0)}if(d.useEffect(()=>{let t=i.current;if(t&&!e.disabled)return t.addEventListener(Go,h),()=>t.removeEventListener(Go,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:v,value:y,onSelect:b,forceMount:w,keywords:x,...E}=e;return d.createElement(Ho.div,{ref:An(i,t),...E,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!p,"data-disabled":!!v,"data-selected":!!p,onPointerMove:v||c.getDisablePointerSelection()?void 0:g,onClick:v?void 0:h},e.children)}),si=d.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,a=Ln(),c=d.useRef(null),s=d.useRef(null),l=Ln(),u=ni(),f=xi(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(a)));bi(()=>u.group(a),[]),Ei(a,c,[e.value,e.heading,s]);let p=d.useMemo(()=>({id:a,forceMount:o}),[o]);return d.createElement(Ho.div,{ref:An(c,t),...i,"cmdk-group":"",role:"presentation",hidden:!f||void 0},n&&d.createElement("div",{ref:s,"cmdk-group-heading":"","aria-hidden":!0,id:l},n),Ri(e,e=>d.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?l:void 0},d.createElement(ii.Provider,{value:p},e))))}),li=d.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=d.useRef(null),i=xi(e=>!e.search);return n||i?d.createElement(Ho.div,{ref:An(o,t),...r,"cmdk-separator":"",role:"separator"}):null}),ui=d.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,i=oi(),a=xi(e=>e.search),c=xi(e=>e.selectedItemId),s=ni();return d.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),d.createElement(Ho.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":s.listId,"aria-labelledby":s.labelId,"aria-activedescendant":c,id:s.inputId,type:"text",value:o?e.value:a,onChange:e=>{o||i.setState("search",e.target.value),null==n||n(e.target.value)}})}),di=d.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=d.useRef(null),a=d.useRef(null),c=xi(e=>e.selectedItemId),s=ni();return d.useEffect(()=>{if(a.current&&i.current){let e,t=a.current,n=i.current,r=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;n.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return r.observe(t),()=>{cancelAnimationFrame(e),r.unobserve(t)}}},[]),d.createElement(Ho.div,{ref:An(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:s.listId},Ri(e,e=>d.createElement("div",{ref:An(a,s.listInnerRef),"cmdk-list-sizer":""},e)))}),fi=d.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:a,...c}=e;return d.createElement(Io,{open:n,onOpenChange:r},d.createElement(Fo,{container:a},d.createElement(Bo,{"cmdk-overlay":"",className:o}),d.createElement(Wo,{"aria-label":e.label,"cmdk-dialog":"",className:i},d.createElement(ai,{ref:t,...c}))))}),pi=d.forwardRef((e,t)=>xi(e=>0===e.filtered.count)?d.createElement(Ho.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),mi=d.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return d.createElement(Ho.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Ri(e,e=>d.createElement("div",{"aria-hidden":!0},e)))}),hi=Object.assign(ai,{List:di,Item:ci,Input:ui,Group:si,Separator:li,Dialog:fi,Empty:pi,Loading:mi});function gi(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function vi(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function yi(e){let t=d.useRef(e);return bi(()=>{t.current=e}),t}var bi="undefined"==typeof window?d.useEffect:d.useLayoutEffect;function wi(e){let t=d.useRef();return void 0===t.current&&(t.current=e()),t}function xi(e){let t=oi(),n=()=>e(t.snapshot());return d.useSyncExternalStore(t.subscribe,n,n)}function Ei(e,t,n,r=[]){let o=d.useRef(),i=ni();return bi(()=>{var a;let c=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():o.current}})(),s=r.map(e=>e.trim());i.value(e,c,s),null==(a=t.current)||a.setAttribute(Qo,c),o.current=c}),o}var Oi=()=>{let[e,t]=d.useState(),n=wi(()=>new Map);return bi(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ri({asChild:e,children:t},n){return e&&d.isValidElement(t)?d.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},n(t.props.children)):n(t)}var Pi={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Si(...e){return e.filter(Boolean).join(" ")}const ki=d.forwardRef((e,t)=>{var{className:n}=e,r=we(e,["className"]);return l(hi,Object.assign({ref:t,className:Si("yoopta-command",n)},r))});ki.displayName=hi.displayName;d.forwardRef((e,t)=>{var{className:n}=e,r=we(e,["className"]);return l("div",Object.assign({className:"yoopta-command-input-wrapper"},{children:l(hi.Input,Object.assign({ref:t,className:Si("yoopta-command-input",n)},r))}))}).displayName=hi.Input.displayName;const Ci=d.forwardRef((e,t)=>{var{className:n}=e,r=we(e,["className"]);return l(hi.List,Object.assign({ref:t,className:Si("yoopta-command-list",n)},r))});Ci.displayName=hi.List.displayName;const Ni=d.forwardRef((e,t)=>l(hi.Empty,Object.assign({ref:t,className:"yoopta-command-empty"},e)));Ni.displayName=hi.Empty.displayName;const Ai=d.forwardRef((e,t)=>{var{className:n}=e,r=we(e,["className"]);return l(hi.Group,Object.assign({ref:t,className:Si("yoopta-command-group",n)},r))});Ai.displayName=hi.Group.displayName;const Di=d.forwardRef((e,t)=>{var{className:n}=e,r=we(e,["className"]);return l(hi.Item,Object.assign({ref:t,disabled:!1,className:Si("yoopta-command-item",n)},r))});Di.displayName=hi.Item.displayName;const{Portal:ji}=c,Ti=()=>l("div",Object.assign({className:"yoopta-mention-dropdown-spinner"},{children:l("div",{className:"yoopta-mention-dropdown-spinner-circle"})})),Mi=({getItems:e,onSelect:n,onClose:r,debounceMs:o,showLoading:c})=>{const u=i(),{char:f="@"}=a("Mention"),g=null!==u.mentions.target,[v,y]=h([]),[b,w]=h(!1),[x]=bn(u.mentions.search,"number"==typeof o?o:1e3),{refs:E,floatingStyles:O,context:R}=mn({placement:"bottom-start",open:g,middleware:[tn(),en(),Qt(),Gt(4)],whileElementsMounted:qt}),{isMounted:P,styles:S}=function(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:a=250}=t,c=e.placement,s=c.split("-")[0],l=d.useMemo(()=>({side:s,placement:c}),[s,c]),u="number"==typeof a,f=(u?a:a.open)||0,p=(u?a:a.close)||0,[m,h]=d.useState(()=>({...gn(i,l),...gn(n,l)})),{isMounted:g,status:v}=vn(e,{duration:a}),y=fn(n),b=fn(r),w=fn(o),x=fn(i);return on(()=>{const e=gn(y.current,l),t=gn(w.current,l),n=gn(x.current,l),r=gn(b.current,l)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===v&&h(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===v&&h({transitionProperty:Object.keys(r).map(hn).join(","),transitionDuration:f+"ms",...n,...r}),"close"===v){const r=t||e;h({transitionProperty:Object.keys(r).map(hn).join(","),transitionDuration:p+"ms",...n,...r})}},[p,w,y,b,x,f,v,l]),{isMounted:g,styles:m}}(R,{duration:100});p(()=>{if(u.mentions.target){const e=u.mentions.target;E.setReference({getBoundingClientRect:()=>e.domRect,getClientRects:()=>e.clientRect})}},[u.mentions.target,E.setReference]);const{listRef:k,itemRefs:C,selectedIndex:N}=(({editor:e,items:n,open:r,onSelect:o,onClose:i})=>{const a=m(null),[c,s]=h(0),l=m([]);return p(()=>{l.current=l.current.slice(0,n.length)},[n]),p(()=>{if(!r)return;const t=t=>{const n=document.getElementById(`mention-portal-${e.id}`);n&&!n.contains(t.target)&&i()};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[e.id,r]),p(()=>{if(!r)return;const a=t.getBlock(e,{at:e.path.current});if(!a)return;const l=document.querySelector(`[data-yoopta-block-id="${a.id}"] [data-slate-editor="true"]`);if(!l)return;const u=e=>{"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),s(e=>(e+1)%n.length)):"ArrowUp"===e.key?(e.preventDefault(),e.stopPropagation(),s(e=>(e-1+n.length)%n.length)):"Enter"===e.key&&n.length>0&&n[c]?(e.preventDefault(),o(n[c]),i()):("ArrowRight"===e.key||"ArrowLeft"===e.key||"Escape"===e.key)&&(e.preventDefault(),i())};return l.addEventListener("keydown",u),()=>l.removeEventListener("keydown",u)},[r,n,c,e.path.current]),p(()=>{const e=l.current[c];e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})},[c]),{listRef:a,selectedIndex:c,itemRefs:l}})({editor:u,items:v,open:g,onSelect:n,onClose:()=>{ge.closeDropdown(u),r&&r()}});if(p(()=>{const t=new RegExp(f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),n=x.replace(t,"");if(!g)return;xe(void 0,void 0,void 0,function*(){try{w(!0);const t=yield e(n);y(t)}catch(e){}finally{w(!1)}})},[x,g]),!g)return null;const A=e=>{e.stopPropagation(),e.preventDefault()},D=e=>{const t=v.find(t=>"string"==typeof t.id?t.id===e:t.id===Number(e));t&&(n(t),ge.closeDropdown(u))},j=Object.assign(Object.assign({},O),S);return l(ji,Object.assign({id:"mention-portal"},{children:P&&l("div",Object.assign({onClick:A,onMouseDown:A,style:j,ref:E.setFloating,className:"yoopta-mention-dropdown"},{children:l(ki,Object.assign({loop:!0},{children:c&&b?l(Ti,{}):0===v.length?l(Ni,{children:"No items found."}):l(Ai,{children:l(Ci,Object.assign({ref:k},{children:v.map((e,t)=>{const n="yoopta-mention-dropdown-item "+(t===N?"yoopta-mention-dropdown-item-selected":"");return l(Di,Object.assign({value:`${e.id}`,onSelect:D,ref:e=>C.current[t]=e,className:n},{children:s("div",Object.assign({className:"yoopta-mention-dropdown-item-content"},{children:[e.avatar&&l("img",{src:e.avatar,alt:e.name,className:"yoopta-mention-dropdown-item-avatar"}),l("span",{children:e.name})]}))}),e.id)})}))})}))}))}))};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(":root{--mention-text-color:#6366f1;--mention-bg-color:rgba(99,102,241,.08);--mention-bg-selected:rgba(34,38,239,.15);--mention-hover-bg:rgba(99,102,241,.12);--mention-hover-text:#4f46e5;--mention-white:#fff;--mention-neutral-50:#fafafa;--mention-neutral-100:#f5f5f5;--mention-neutral-200:#e5e5e5;--mention-neutral-400:#a3a3a3;--mention-neutral-500:#737373;--mention-neutral-800:#262626;--mention-neutral-900:#171717;--mention-blue-500:#3b82f6;--mention-command-radius:0.375rem;--mention-command-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--mention-command-text-size:0.875rem;--mention-command-padding:0.75rem;--mention-command-input-padding:0.75rem;--mention-command-item-padding:0.375rem;--mention-command-group-padding:0.25rem;--mention-dropdown-radius:0.375rem;--mention-dropdown-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--mention-dropdown-padding:0.75rem;--mention-dropdown-item-gap:0.5rem;--mention-dropdown-avatar-size:1.5rem;--mention-transition-duration:200ms;--mention-avatar-size:0.75em}.yoopta-mention-tag{align-items:center;background-color:var(--mention-bg-color);border-radius:4px;color:var(--mention-text-color);cursor:pointer;display:inline-flex;font-size:.8em;gap:.3rem;line-height:120%;margin-left:1px;margin-right:1px;padding:.1rem .3rem;transition-duration:.15s;transition-duration:var(--mention-transition-duration);transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);vertical-align:baseline}.yoopta-mention-tag-avatar{border-radius:9999px;height:var(--mention-avatar-size);width:var(--mention-avatar-size)}.yoopta-mention-tag:hover{background-color:var(--mention-hover-bg);color:var(--mention-hover-text)}.yoopta-mention-tag-selected{background-color:var(--mention-bg-selected)}.yoopta-command{--tw-shadow-color:var(--mention-command-shadow);--tw-shadow:var(--tw-shadow-colored);background-color:var(--mention-white);border-color:var(--mention-neutral-200);border-radius:var(--mention-command-radius);border-width:1px;color:var(--mention-neutral-900);display:flex;flex-direction:column;height:100%;overflow:hidden;width:100%}.yoopta-command-input-wrapper{align-items:center;background-color:var(--mention-neutral-50);border-bottom-width:1px;display:flex;padding-left:var(--mention-command-input-padding);padding-right:var(--mention-command-input-padding)}.yoopta-command-list{max-height:300px;overflow-x:hidden;overflow-y:auto}.yoopta-command-empty{color:var(--mention-neutral-500);font-size:var(--mention-command-text-size);padding-bottom:var(--mention-command-padding);padding-top:var(--mention-command-padding);text-align:center}.yoopta-command-group{color:var(--mention-neutral-800);overflow:hidden;padding:var(--mention-command-group-padding)}.yoopta-command-group [cmdk-group-heading]{color:var(--mention-neutral-400);font-size:var(--mention-command-text-size);font-weight:500;padding:var(--mention-command-group-padding) var(--mention-command-padding)}.yoopta-command-item{align-items:center;border-radius:var(--mention-command-radius);cursor:pointer;display:flex;font-size:var(--mention-command-text-size);outline:2px solid transparent;outline-offset:2px;padding:var(--mention-command-item-padding);position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-command-item:hover{--tw-text-opacity:1;background-color:var(--mention-neutral-200);color:rgb(0 0 0/var(--tw-text-opacity,1))}.yoopta-command-item[aria-selected=true]{--tw-text-opacity:1;background-color:var(--mention-neutral-100);color:rgb(0 0 0/var(--tw-text-opacity,1))}.yoopta-command-item[data-disabled=true]{opacity:.5;pointer-events:none}.yoopta-mention-dropdown{--tw-shadow-color:var(--mention-dropdown-shadow);--tw-shadow:var(--tw-shadow-colored);background-color:var(--mention-white);border-radius:var(--mention-dropdown-radius);border-width:1px;position:fixed;width:300px;z-index:50}.yoopta-mention-dropdown-spinner{align-items:center;display:flex;justify-content:center;padding:var(--mention-dropdown-padding)}.yoopta-mention-dropdown-spinner-circle{height:1.25rem;width:1.25rem}@keyframes yoo-mention-spin{to{transform:rotate(1turn)}}.yoopta-mention-dropdown-spinner-circle{animation:yoo-mention-spin 1s linear infinite;border-color:var(--mention-blue-500);border-radius:var(--mention-dropdown-radius);border-top-color:transparent;border-width:2px}.yoopta-mention-dropdown-item{cursor:pointer;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yoopta-mention-dropdown-item-selected{background-color:var(--mention-neutral-100)}.yoopta-mention-dropdown-item-content{align-items:center;display:flex;gap:var(--mention-dropdown-item-gap)}.yoopta-mention-dropdown-item-avatar{border-radius:var(--mention-dropdown-radius);height:var(--mention-dropdown-avatar-size);width:var(--mention-dropdown-avatar-size)}");export{ge as MentionCommands,Mi as MentionDropdown,ve as default,ye as withMentions};
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{generateId as n,Blocks as r,YooptaPlugin as o,useYooptaEditor as i,useYooptaPluginOptions as a}from"@yoopta/editor";import*as s from"react";import l,{createContext as c,Component as f,useLayoutEffect as u,useEffect as d,useState as h,useRef as p,useCallback as g,useMemo as v}from"react";import*as m from"react-dom";var y={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=y.levels(e,t);return r=n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return y.equals(r,o)&&i>a},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return y.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return y.equals(r,o)&&i<a},equals:(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===y.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===y.compare(e,t),isBefore:(e,t)=>-1===y.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===y.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===y.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===y.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===y.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&y.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!y.isAncestor(t,e)&&!y.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:i}=t;(y.equals(i,r)||y.endsBefore(i,r)||y.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(y.equals(a,r)||y.isAncestor(a,r))return null;y.endsBefore(a,r)&&(r[a.length-1]-=1);break;case"merge_node":var{path:s,position:l}=t;y.equals(s,r)||y.endsBefore(s,r)?r[s.length-1]-=1:y.isAncestor(s,r)&&(r[s.length-1]-=1,r[s.length]+=l);break;case"split_node":var{path:c,position:f}=t;if(y.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else y.endsBefore(c,r)?r[c.length-1]+=1:y.isAncestor(c,r)&&e[c.length]>=f&&(r[c.length-1]+=1,r[c.length]-=f);break;case"move_node":var{path:u,newPath:d}=t;if(y.equals(u,d))return r;if(y.isAncestor(u,r)||y.equals(u,r)){var h=d.slice();return y.endsBefore(u,d)&&u.length<d.length&&(h[u.length-1]-=1),h.concat(r.slice(u.length))}y.isSibling(u,d)&&(y.isAncestor(d,r)||y.equals(d,r))?y.endsBefore(u,r)?r[u.length-1]-=1:r[u.length-1]+=1:y.endsBefore(d,r)||y.equals(d,r)||y.isAncestor(d,r)?(y.endsBefore(u,r)&&(r[u.length-1]-=1),r[d.length-1]+=1):y.endsBefore(u,r)&&(y.equals(d,r)&&(r[d.length-1]+=1),r[u.length-1]-=1)}return r}};function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function b(e){var t=function(e,t){if("object"!==w(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==w(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===w(t)?t:String(t)}function x(e,t,n){return(t=b(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var k=["anchor","focus"];function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var P={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return P.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=P.edges(e);return t},equals:(e,t)=>z.equals(e.anchor,t.anchor)&&z.equals(e.focus,t.focus),surrounds(e,t){var n=P.intersection(e,t);return!!n&&P.equals(n,t)},includes(e,t){if(P.isRange(t)){if(P.includes(e,t.anchor)||P.includes(e,t.focus))return!0;var[n,r]=P.edges(e),[o,i]=P.edges(t);return z.isBefore(n,o)&&z.isAfter(r,i)}var[a,s]=P.edges(e),l=!1,c=!1;return z.isPoint(t)?(l=z.compare(t,a)>=0,c=z.compare(t,s)<=0):(l=y.compare(t,a.path)>=0,c=y.compare(t,s.path)<=0),l&&c},intersection(e,t){var n=O(e,k),[r,o]=P.edges(e),[i,a]=P.edges(t),s=z.isBefore(r,i)?i:r,l=z.isBefore(o,a)?o:a;return z.isBefore(l,s)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({anchor:s,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return z.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return z.equals(t,n)},isExpanded:e=>!P.isCollapsed(e),isForward:e=>!P.isBackward(e),isRange:e=>_(e)&&z.isPoint(e.anchor)&&z.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=P.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var a=P.isCollapsed(e);P.isForward(e)?(r="forward",o=a?r:"backward"):(r="backward",o=a?r:"forward")}else"outward"===i?P.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var s=z.transform(e.anchor,t,{affinity:r}),l=z.transform(e.focus,t,{affinity:o});return s&&l?{anchor:s,focus:l}:null}},E=function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!_(e)&&("function"!=typeof e.apply&&(t?M.isNodeList(e.children):Array.isArray(e.children)))},R={isAncestor(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return _(e)&&M.isNodeList(e.children,{deep:t})},isElement:E,isElementList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>R.isElement(e,{deep:t}))},isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return E(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},C=["children"],T=["text"];function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var M={ancestor(e,t){var n=M.get(e,t);if(J.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(K.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of y.ancestors(t,n)){var o=[M.ancestor(e,r),r];yield o}}()},child(e,t){if(J.isText(e))throw new Error("Cannot get the child of a text node: ".concat(K.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(K.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=M.ancestor(e,t),{children:i}=o,a=r?i.length-1:0;r?a>=0:a<i.length;){var s=M.child(o,a),l=t.concat(a);yield[s,l],a=r?a-1:a+1}}()},common(e,t,n){var r=y.common(t,n);return[M.get(e,r),r]},descendant(e,t){var n=M.get(e,t);if(W.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(K.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of M.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of M.nodes(e,t))R.isElement(n)&&(yield[n,r])}()},extractProps:e=>R.isAncestor(e)?O(e,C):O(e,T),first(e,t){for(var n=t.slice(),r=M.get(e,n);r&&!J.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){var n={children:e.children},[r,o]=P.edges(t),i=M.nodes(n,{reverse:!0,pass:e=>{var[,n]=e;return!P.includes(t,n)}}),a=function(){if(!P.includes(t,s)){var e=s[s.length-1];re(n,y.parent(s),t=>te(t,e,1))}y.equals(s,o.path)&&oe(n,s,e=>{var t=e.text.slice(0,o.offset);return N(N({},e),{},{text:t})}),y.equals(s,r.path)&&oe(n,s,e=>{var t=e.text.slice(r.offset);return N(N({},e),{},{text:t})})};for(var[,s]of i)a();return n.children},get(e,t){var n=M.getIf(e,t);if(void 0===n)throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(K.stringify(e)));return n},getIf(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(J.isText(n)||!n.children[o])return;n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(J.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return J.isText(e)||R.isElement(e,{deep:t})||W.isEditor(e,{deep:t})},isNodeList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>M.isNode(e,{deep:t}))},last(e,t){for(var n=t.slice(),r=M.get(e,n);r&&!J.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=M.get(e,t);if(!J.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(K.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of y.levels(t,n)){var o=M.get(e,r);yield[o,r]}}()},matches:(e,t)=>R.isElement(e)&&R.isElementProps(t)&&R.matches(e,t)||J.isText(e)&&J.isTextProps(t)&&J.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:i}=t,a=new Set,s=[],l=e;!i||!(r?y.isBefore(s,i):y.isAfter(s,i));)if(a.has(l)||(yield[l,s]),a.has(l)||J.isText(l)||0===l.children.length||null!=n&&!1!==n([l,s])){if(0===s.length)break;if(!r){var c=y.next(s);if(M.has(e,c)){s=c,l=M.get(e,s);continue}}if(r&&0!==s[s.length-1])s=y.previous(s),l=M.get(e,s);else s=y.parent(s),l=M.get(e,s),a.add(l)}else{a.add(l);var f=r?l.children.length-1:0;y.isAncestor(s,o)&&(f=o[s.length]),s=s.concat(f),l=M.get(e,s)}}()},parent(e,t){var n=y.parent(t),r=M.get(e,n);if(J.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>J.isText(e)?e.text:e.children.map(M.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of M.nodes(e,t))J.isText(n)&&(yield[n,r])}()}};function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var B,L={isNodeOperation:e=>L.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!_(e))return!1;switch(e.type){case"insert_node":case"remove_node":return y.isPath(e.path)&&M.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&y.isPath(e.path);case"merge_node":return"number"==typeof e.position&&y.isPath(e.path)&&_(e.properties);case"move_node":return y.isPath(e.path)&&y.isPath(e.newPath);case"set_node":return y.isPath(e.path)&&_(e.properties)&&_(e.newProperties);case"set_selection":return null===e.properties&&P.isRange(e.newProperties)||null===e.newProperties&&P.isRange(e.properties)||_(e.properties)&&_(e.newProperties);case"split_node":return y.isPath(e.path)&&"number"==typeof e.position&&_(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every(e=>L.isOperation(e)),isSelectionOperation:e=>L.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>L.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return A(A({},e),{},{type:"remove_node"});case"insert_text":return A(A({},e),{},{type:"remove_text"});case"merge_node":return A(A({},e),{},{type:"split_node",path:y.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(y.equals(t,n))return e;if(y.isSibling(n,t))return A(A({},e),{},{path:t,newPath:n});var r=y.transform(n,e),o=y.transform(y.next(n),e);return A(A({},e),{},{path:r,newPath:o});case"remove_node":return A(A({},e),{},{type:"insert_node"});case"remove_text":return A(A({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return A(A({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:s,newProperties:l}=e;return A(A({},e),{},null==s?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:s}:{properties:l,newProperties:s});case"split_node":return A(A({},e),{},{type:"merge_node",path:y.next(e.path)})}}},_=e=>"object"==typeof e&&null!==e,F=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==o[i])return!1}else if(_(r)&&_(o)){if(!F(r,o))return!1}else if(r!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0},q=e=>e.selection?e.selection:e.children.length>0?W.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(B||(B={})),B.L,B.L,B.V,B.LV,B.LVT,B.LV,B.V,B.V,B.T,B.LVT,B.T,B.T,B.Any,B.Extend,B.ZWJ,B.Any,B.SpacingMark,B.Prepend,B.Any,B.ZWJ,B.ExtPict,B.RI,B.RI;var W={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,n)=>e.isEdge(t,n),isEditor:e=>function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!_(e))return!1;var n="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||_(e.marks))&&(null===e.selection||P.isRange(e.selection))&&(!t||M.isNodeList(e.children))&&L.isOperationList(e.operations);return n}(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)},shouldMergeNodesRemovePrevNode:(e,t,n)=>e.shouldMergeNodesRemovePrevNode(t,n)};function I(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var z={compare(e,t){var n=y.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===z.compare(e,t),isBefore:(e,t)=>-1===z.compare(e,t),equals:(e,t)=>e.offset===t.offset&&y.equals(e.path,t.path),isPoint:e=>_(e)&&"number"==typeof e.offset&&y.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":o=y.transform(o,t,n);break;case"insert_text":y.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(i+=t.text.length);break;case"merge_node":y.equals(t.path,o)&&(i+=t.position),o=y.transform(o,t,n);break;case"remove_text":y.equals(t.path,o)&&t.offset<=i&&(i-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(y.equals(t.path,o)||y.isAncestor(t.path,o))return null;o=y.transform(o,t,n);break;case"split_node":if(y.equals(t.path,o)){if(t.position===i&&null==r)return null;(t.position<i||t.position===i&&"forward"===r)&&(i-=t.position,o=y.transform(o,t,V(V({},n),{},{affinity:"forward"})))}else o=y.transform(o,t,n);break;default:return e}return{path:o,offset:i}}},H=void 0,K={setScrubber(e){H=e},stringify:e=>JSON.stringify(e,H)},$=["text"],U=["anchor","focus","merge"];function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var J={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return O(e,$)}return F(r?o(e):e,r?o(t):t)},isText:e=>_(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every(e=>J.isText(e)),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[{leaf:Q({},e)}];for(var r of t){var{anchor:o,focus:i,merge:a}=r,s=O(r,U),[l,c]=P.edges(r),f=[],u=0,d=l.offset,h=c.offset,p=null!=a?a:Object.assign;for(var{leaf:g}of n){var{length:v}=g.text,m=u;if(u+=v,d<=m&&u<=h)p(g,s),f.push({leaf:g});else if(d!==h&&(d===u||h===m)||d>u||h<m||h===m&&0!==m)f.push({leaf:g});else{var y=g,w=void 0,b=void 0;if(h<u){var x=h-m;b={leaf:Q(Q({},y),{},{text:y.text.slice(x)})},y=Q(Q({},y),{},{text:y.text.slice(0,x)})}if(d>m){var k=d-m;w={leaf:Q(Q({},y),{},{text:y.text.slice(0,k)})},y=Q(Q({},y),{},{text:y.text.slice(k)})}p(y,s),w&&f.push(w),f.push({leaf:y}),b&&f.push(b)}}n=f}if(n.length>1){var S=0;for(var[E,R]of n.entries()){var C=S,T=C+R.leaf.text.length,j={start:C,end:T};0===E&&(j.isFirst=!0),E===n.length-1&&(j.isLast=!0),R.position=j,S=T}}return n}};function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var G=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return[...e.slice(0,t),...r,...e.slice(t)]},ee=function(e,t,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];return[...e.slice(0,t),...o,...e.slice(t+n)]},te=ee,ne=(e,t,n)=>{if(0===t.length)throw new Error("Cannot modify the editor");for(var r=M.get(e,t),o=t.slice(),i=n(r);o.length>1;){var a=o.pop(),s=M.get(e,o);i=Y(Y({},s),{},{children:ee(s.children,a,1,i)})}var l=o.pop();e.children=ee(e.children,l,1,i)},re=(e,t,n)=>{0===t.length?e.children=n(e.children):ne(e,t,e=>{if(J.isText(e))throw new Error("Cannot get the element at path [".concat(t,"] because it refers to a leaf node: ").concat(K.stringify(e)));return Y(Y({},e),{},{children:n(e.children)})})},oe=(e,t,n)=>ne(e,t,e=>{if(!J.isText(e))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(K.stringify(e)));return n(e)});function ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ae(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ie(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ie(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var se={transform(e,t){var n=!1;switch(t.type){case"insert_node":var{path:r,node:o}=t;re(e,y.parent(r),e=>{var t=r[r.length-1];if(t>e.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));return G(e,t,o)}),n=!0;break;case"insert_text":var{path:i,offset:a,text:s}=t;if(0===s.length)break;oe(e,i,e=>{var t=e.text.slice(0,a),n=e.text.slice(a);return ae(ae({},e),{},{text:t+s+n})}),n=!0;break;case"merge_node":var{path:l}=t,c=l[l.length-1],f=y.previous(l),u=f[f.length-1];re(e,y.parent(l),e=>{var t,n=e[c],r=e[u];if(J.isText(n)&&J.isText(r))t=ae(ae({},r),{},{text:r.text+n.text});else{if(J.isText(n)||J.isText(r))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(l,"] to nodes of different interfaces: ").concat(K.stringify(n)," ").concat(K.stringify(r)));t=ae(ae({},r),{},{children:r.children.concat(n.children)})}return ee(e,u,2,t)}),n=!0;break;case"move_node":var{path:d,newPath:h}=t,p=d[d.length-1];if(y.isAncestor(d,h))throw new Error("Cannot move a path [".concat(d,"] to new path [").concat(h,"] because the destination is inside itself."));var g=M.get(e,d);re(e,y.parent(d),e=>te(e,p,1));var v=y.transform(d,t),m=v[v.length-1];re(e,y.parent(v),e=>G(e,m,g)),n=!0;break;case"remove_node":var{path:w}=t,b=w[w.length-1];if(re(e,y.parent(w),e=>te(e,b,1)),e.selection){var x=ae({},e.selection);for(var[O,k]of P.points(x)){var S=z.transform(O,t);if(null!=x&&null!=S)x[k]=S;else{var E=void 0,R=void 0;for(var[C,T]of M.texts(e)){if(-1!==y.compare(T,w)){R=[C,T];break}E=[C,T]}var j=!1;E&&R&&(j=!y.isSibling(E[1],w)&&(!!y.equals(R[1],w)||y.common(E[1],w).length<y.common(R[1],w).length)),E&&!j?x[k]={path:E[1],offset:E[0].text.length}:R?x[k]={path:R[1],offset:0}:x=null}}x&&P.equals(x,e.selection)||(e.selection=x)}break;case"remove_text":var{path:N,offset:D,text:A}=t;if(0===A.length)break;oe(e,N,e=>{var t=e.text.slice(0,D),n=e.text.slice(D+A.length);return ae(ae({},e),{},{text:t+n})}),n=!0;break;case"set_node":var{path:B,properties:L,newProperties:_}=t;if(0===B.length)throw new Error("Cannot set properties on the root node!");ne(e,B,e=>{var t=ae({},e);for(var n in _){if("children"===n||"text"===n)throw new Error('Cannot set the "'.concat(n,'" property of nodes!'));var r=_[n];null==r?delete t[n]:t[n]=r}for(var o in L)_.hasOwnProperty(o)||delete t[o];return t});break;case"set_selection":var{newProperties:F}=t;if(null==F){e.selection=null;break}if(null==e.selection){if(!P.isRange(F))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(K.stringify(F)," when there is no current selection."));e.selection=ae({},F);break}var q=ae({},e.selection);for(var W in F){var I=F[W];if(null==I){if("anchor"===W||"focus"===W)throw new Error('Cannot remove the "'.concat(W,'" selection property'));delete q[W]}else q[W]=I}e.selection=q;break;case"split_node":var{path:V,position:H,properties:$}=t,U=V[V.length-1];if(0===V.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(V,"] because the root node cannot be split."));re(e,y.parent(V),e=>{var t,n,r=e[U];if(J.isText(r)){var o=r.text.slice(0,H),i=r.text.slice(H);t=ae(ae({},r),{},{text:o}),n=ae(ae({},$),{},{text:i})}else{var a=r.children.slice(0,H),s=r.children.slice(H);t=ae(ae({},r),{},{children:a}),n=ae(ae({},$),{},{children:s})}return ee(e,U,1,t,n)}),n=!0}if(n&&e.selection){var X=ae({},e.selection);for(var[Q,Z]of P.points(X))X[Z]=z.transform(Q,t);P.equals(X,e.selection)||(e.selection=X)}}},le={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},ce={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},fe={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};W.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:o=q(e)}=n;if(y.isPath(o)&&(o=W.range(e,o)),P.isRange(o))if(P.isCollapsed(o))o=o.anchor;else{var i=P.end(o);if(!r&&W.void(e,{at:i}))return;var a=P.start(o),s=W.pointRef(e,a),l=W.pointRef(e,i);he.delete(e,{at:o,voids:r});var c=s.unref(),f=l.unref();o=c||f,he.setSelection(e,{anchor:o,focus:o})}if(!(!r&&W.void(e,{at:o})||W.elementReadOnly(e,{at:o}))){var{path:u,offset:d}=o;t.length>0&&e.apply({type:"insert_text",path:u,offset:d,text:t})}})}};function ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var he=de(de(de(de({},se),le),ce),fe);const pe={isOpen:!1,query:"",trigger:null,targetRect:null,triggerRange:null};const ge={buildMentionElement:(e,t)=>{const{props:r}=t;return{id:n(),type:"mention",children:[{text:""}],props:Object.assign(Object.assign({},r),{nodeType:"inlineVoid"})}},insertMention:(e,t,o={})=>{var i,a;const s=e,l=s.mentions.state;if(!l.triggerRange)return;const{blockId:c,path:f,startOffset:u}=l.triggerRange,d=r.getBlockSlate(e,{id:c});if(!d)return;const h=l.trigger,p=l.query,g=u+(null!==(i=null==h?void 0:h.char.length)&&void 0!==i?i:1)+p.length;he.select(d,{anchor:{path:f,offset:u},focus:{path:f,offset:g}}),he.delete(d);const v={id:n(),type:"mention",children:[{text:""}],props:{id:t.id,type:t.type,name:t.name,avatar:t.avatar,meta:t.meta,nodeType:"inlineVoid"}};he.insertNodes(d,v);const m=null===(a=e.plugins.Mention)||void 0===a?void 0:a.options;if(!1!==(null==m?void 0:m.closeOnSelect)&&s.mentions.close("select"),(null==m?void 0:m.onSelect)&&h&&m.onSelect(t,h),o.focus){const t=r.getBlock(e,{id:c});(null==t?void 0:t.id)&&e.focusBlock(t.id)}},findMention:(e,t,n={})=>{var r;return null!==(r=ge.findMentions(e,n).find(e=>{var n;return(null===(n=e.props)||void 0===n?void 0:n.id)===t}))&&void 0!==r?r:null},findMentions:(e,t={})=>{var n;try{const o=t.blockId?{id:t.blockId}:{at:null!==(n=t.at)&&void 0!==n?n:e.path.current},i=r.getBlockSlate(e,o);if(!i)return[];const a=[];for(const[e]of W.nodes(i,{at:[],match:e=>R.isElement(e)&&!W.isEditor(e)&&"mention"===e.type}))a.push(e);return a}catch(e){return[]}},findMentionsByType:(e,t,n={})=>ge.findMentions(e,n).filter(e=>{var n;return(null===(n=e.props)||void 0===n?void 0:n.type)===t}),updateMention:(e,t,n,o={})=>{var i;const a=o.blockId?{id:o.blockId}:{at:null!==(i=o.at)&&void 0!==i?i:e.path.current},s=r.getBlockSlate(e,a);if(!s)return;const l=Array.from(W.nodes(s,{at:[],match:e=>{var n;return R.isElement(e)&&!W.isEditor(e)&&"mention"===e.type&&(null===(n=e.props)||void 0===n?void 0:n.id)===t}})),c=l[0];if(c){const[e,t]=c;he.setNodes(s,{props:Object.assign(Object.assign(Object.assign({},e.props),n),{nodeType:"inlineVoid"})},{at:t})}},deleteMention:(e,t,n={})=>{var o;const i=n.blockId?{id:n.blockId}:{at:null!==(o=n.at)&&void 0!==o?o:e.path.current},a=r.getBlockSlate(e,i);if(!a)return;const s=Array.from(W.nodes(a,{at:[],match:e=>{var n;return R.isElement(e)&&!W.isEditor(e)&&"mention"===e.type&&(null===(n=e.props)||void 0===n?void 0:n.id)===t}})),l=s[0];if(l){const[,e]=l;he.removeNodes(a,{at:e})}},openDropdown:(e,t)=>{e.mentions.open(t)},closeDropdown:(e,t="manual")=>{e.mentions.close(t)},getState:e=>{var t,n;return null!==(n=null===(t=e.mentions)||void 0===t?void 0:t.state)&&void 0!==n?n:pe},getQuery:e=>{var t,n;return null!==(n=null===(t=e.mentions)||void 0===t?void 0:t.state.query)&&void 0!==n?n:""},setQuery:(e,t)=>{e.mentions.setQuery(t)},getTrigger:e=>{var t,n;return null!==(n=null===(t=e.mentions)||void 0===t?void 0:t.state.trigger)&&void 0!==n?n:null},getTriggers:e=>{var t,n;const r=null===(t=e.plugins.Mention)||void 0===t?void 0:t.options;return r?r.triggers&&r.triggers.length>0?r.triggers:[{char:null!==(n=r.char)&&void 0!==n?n:"@"}]:[{char:"@"}]},getTriggerByChar:(e,t)=>ge.getTriggers(e).find(e=>e.char===t)};var ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},me="object"==typeof ve&&ve&&ve.Object===Object&&ve,ye="object"==typeof self&&self&&self.Object===Object&&self,we=(me||ye||Function("return this")()).Symbol;we&&we.toStringTag;we&&we.toStringTag;var be={};Object.defineProperty(be,"__esModule",{value:!0});for(var xe="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Oe={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},ke={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:xe?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Se={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},Pe=1;Pe<20;Pe++)Se["f"+Pe]=111+Pe;function Ee(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(e){return Re(e,t)}),o=function(e){return r.some(function(t){return Ce(t,e)})};return null==n?o:o(n)}function Re(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var a in Oe)r[Oe[a]]=!1;var s=!0,l=!1,c=void 0;try{for(var f,u=o[Symbol.iterator]();!(s=(f=u.next()).done);s=!0){var d=f.value,h=d.endsWith("?")&&d.length>1;h&&(d=d.slice(0,-1));var p=je(d),g=Oe[p];if(d.length>1&&!g&&!ke[d]&&!Se[p])throw new TypeError('Unknown modifier: "'+d+'"');1!==i&&g||(n?r.key=p:r.which=Te(d)),g&&(r[g]=!h||null)}}catch(e){l=!0,c=e}finally{try{!s&&u.return&&u.return()}finally{if(l)throw c}}return r}function Ce(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&((null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r))return!1}return!0}function Te(e){return e=je(e),Se[e]||e.toUpperCase().charCodeAt(0)}function je(e){return e=e.toLowerCase(),e=ke[e]||e}be.default=Ee;var Ne=be.isHotkey=Ee;be.isCodeHotkey=function(e,t){return Ee(e,t)},be.isKeyHotkey=function(e,t){return Ee(e,{byKey:!0},t)},be.parseHotkey=Re,be.compareHotkey=Ce,be.toKeyCode=Te,be.toKeyName=je;var Me,De,Ae=globalThis.Node,Be=globalThis.Text,Le=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,_e=e=>qe(e)&&8===e.nodeType,Fe=e=>qe(e)&&1===e.nodeType,qe=e=>{var t=Le(e);return!!t&&e instanceof t.Node},We=e=>{var t=e&&e.anchorNode&&Le(e.anchorNode);return!!t&&e instanceof t.Selection},Ie=(e,t,n)=>{for(var{childNodes:r}=e,o=r[t],i=t,a=!1,s=!1;(_e(o)||Fe(o)&&0===o.childNodes.length||Fe(o)&&"false"===o.getAttribute("contenteditable"))&&(!a||!s);)i>=r.length?(a=!0,i=t-1,n="backward"):i<0?(s=!0,i=t+1,n="forward"):(o=r[i],t=i,i+="forward"===n?1:-1);return[o,t]},Ve=(e,t,n)=>{var[r]=Ie(e,t,n);return r},ze=e=>null!=e.getSelection?e.getSelection():document.getSelection(),He=(e,t,n)=>{var{target:r}=t;if(Fe(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:o}=gt.getWindow(e);if(Ue(o,r))return gt.hasDOMNode(e,r,{editable:!0});var i=n.find(e=>{var{addedNodes:t,removedNodes:n}=e;for(var o of t)if(o===r||Ue(o,r))return!0;for(var i of n)if(i===r||Ue(i,r))return!0});return!(!i||i===t)&&He(e,i,n)},Ke=(e,t)=>Boolean(e.compareDocumentPosition(t)&Ae.DOCUMENT_POSITION_PRECEDING),$e=(e,t)=>{if(!e)return null;for(var n=e;n;){if(n.matches&&n.matches(t))return n;if(n.parentElement)n=n.parentElement;else{if(!n.parentNode||!("host"in n.parentNode))return null;n=n.parentNode.host}}return null},Ue=(e,t)=>{if(!e||!t)return!1;if(e.contains(t))return!0;for(var n=t;n;){if(n===e)return!0;if(!n.parentNode)return!1;n="host"in n.parentNode?n.parentNode.host:n.parentNode}return!1},Xe="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),Qe="undefined"!=typeof navigator&&/Android/.test(navigator.userAgent),Je="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Ze="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent);function Ye(e){return Ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ye(e)}function Ge(e){var t=function(e,t){if("object"!==Ye(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ye(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ye(t)?t:String(t)}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&/Version\/(\d+)/.test(navigator.userAgent)&&null!==(Me=navigator.userAgent.match(/Version\/(\d+)/))&&void 0!==Me&&Me[1]&&parseInt(null===(De=navigator.userAgent.match(/Version\/(\d+)/))||void 0===De?void 0:De[1],10);var et=0;class tt{constructor(){var e,t,n;e=this,n=void 0,(t=Ge(t="id"))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,this.id="".concat(et++)}}var nt,rt=new WeakMap,ot=new WeakMap,it=new WeakMap,at=new WeakMap,st=new WeakMap,lt=new WeakMap,ct=new WeakMap,ft=new WeakMap,ut=new WeakMap,dt=new WeakMap,ht=new WeakMap,pt=new WeakMap,gt={androidPendingDiffs:e=>pt.get(e),androidScheduleFlush:e=>{var t;null===(t=ht.get(e))||void 0===t||t()},blur:e=>{var t=gt.toDOMNode(e,e),n=gt.findDocumentOrShadowRoot(e);ut.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=gt.findDocumentOrShadowRoot(e),r=ze(n);r&&r.rangeCount>0&&r.removeAllRanges(),t&&he.deselect(e)},findDocumentOrShadowRoot:e=>{var t=gt.toDOMNode(e,e),n=t.getRootNode();return n instanceof Document||n instanceof ShadowRoot?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:o}=t;if(null==n||null==r)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i,a=gt.toSlateNode(e,t.target),s=gt.findPath(e,a);if(R.isElement(a)&&W.isVoid(e,a)){var l=o.getBoundingClientRect(),c=e.isInline(a)?n-l.left<l.left+l.width-n:r-l.top<l.top+l.height-r,f=W.point(e,s,{edge:c?"start":"end"}),u=c?W.before(e,f):W.after(e,f);if(u)return W.range(e,u)}var{document:d}=gt.getWindow(e);if(d.caretRangeFromPoint)i=d.caretRangeFromPoint(n,r);else{var h=d.caretPositionFromPoint(n,r);h&&((i=d.createRange()).setStart(h.offsetNode,h.offset),i.setEnd(h.offsetNode,h.offset))}if(!i)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));return gt.toSlateRange(e,i,{exactMatch:!1,suppressThrow:!1})},findKey:(e,t)=>{var n=lt.get(t);return n||(n=new tt,lt.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var o=ot.get(r);if(null==o){if(W.isEditor(r))return n;break}var i=rt.get(r);if(null==i)break;n.unshift(i),r=o}throw new Error("Unable to find the path for Slate node: ".concat(K.stringify(t)))},focus:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{retries:5};if(!ut.get(e)&&at.get(e)){if(t.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(e.operations.length>0)setTimeout(()=>{gt.focus(e,{retries:t.retries-1})},10);else{var n=gt.toDOMNode(e,e),r=gt.findDocumentOrShadowRoot(e);if(r.activeElement!==n){if(e.selection&&r instanceof Document){var o=ze(r),i=gt.toDOMRange(e,e.selection);null==o||o.removeAllRanges(),null==o||o.addRange(i)}e.selection||he.select(e,W.start(e,[])),ut.set(e,!0),n.focus({preventScroll:!0})}}}},getWindow:e=>{var t=it.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{editable:o=!1}=r,i=gt.toDOMNode(e,e);try{n=Fe(t)?t:t.parentElement}catch(e){if(e instanceof Error&&!e.message.includes('Permission denied to access property "nodeType"'))throw e}return!!n&&!($e(n,"[data-slate-editor]")!==i||o&&!n.isContentEditable&&("boolean"!=typeof n.isContentEditable||$e(n,'[contenteditable="false"]')!==i)&&!n.getAttribute("data-slate-zero-width"))},hasEditableTarget:(e,t)=>qe(t)&>.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return W.hasPath(e,n.path)&&W.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>gt.hasEditableTarget(e,t)||gt.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>qe(t)&>.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!dt.get(e),isFocused:e=>!!ut.get(e),isReadOnly:e=>!!ft.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(ft.get(e))return!1;var n=gt.hasTarget(e,t)&>.toSlateNode(e,t);return R.isElement(n)&&W.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=ct.get(e),r=W.isEditor(t)?at.get(e):null==n?void 0:n.get(gt.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(K.stringify(t)));return r},toDOMPoint:(e,t)=>{var n,[r]=W.node(e,t.path),o=gt.toDOMNode(e,r);W.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i=Array.from(o.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),a=0,s=0;s<i.length;s++){var l=i[s],c=l.childNodes[0];if(null!=c&&null!=c.textContent){var{length:f}=c.textContent,u=l.getAttribute("data-slate-length"),d=a+(null==u?f:parseInt(u,10)),h=i[s+1];if(t.offset===d&&null!=h&&h.hasAttribute("data-slate-mark-placeholder")){var p,g=h.childNodes[0];n=[g instanceof Be?g:h,null!==(p=h.textContent)&&void 0!==p&&p.startsWith("\ufeff")?1:0];break}if(t.offset<=d){n=[c,Math.min(f,Math.max(0,t.offset-a))];break}a=d}}if(!n)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(K.stringify(t)));return n},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,o=P.isBackward(t),i=gt.toDOMPoint(e,n),a=P.isCollapsed(t)?i:gt.toDOMPoint(e,r),s=gt.getWindow(e).document.createRange(),[l,c]=o?a:i,[f,u]=o?i:a,d=!!(Fe(l)?l:l.parentElement).getAttribute("data-slate-zero-width"),h=!!(Fe(f)?f:f.parentElement).getAttribute("data-slate-zero-width");return s.setStart(l,d?1:c),s.setEnd(f,h?1:u),s},toSlateNode:(e,t)=>{var n=Fe(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?st.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:o,searchDirection:i}=n,[a,s]=r?t:(e=>{var[t,n]=e;if(Fe(t)&&t.childNodes.length){var r=n===t.childNodes.length,o=r?n-1:n;for([t,o]=Ie(t,o,r?"backward":"forward"),r=o<n;Fe(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=Ve(t,i,r?"backward":"forward")}n=r&&null!=t.textContent?t.textContent.length:0}return[t,n]})(t),l=a.parentNode,c=null,f=0;if(l){var u,d,h=gt.toDOMNode(e,e),p=l.closest('[data-slate-void="true"]'),g=p&&Ue(h,p)?p:null,v=l.closest('[contenteditable="false"]'),m=v&&Ue(h,v)?v:null,y=l.closest("[data-slate-leaf]"),w=null;if(y){if(c=y.closest('[data-slate-node="text"]')){var b=gt.getWindow(e).document.createRange();b.setStart(c,0),b.setEnd(a,s);var x=b.cloneContents();[...Array.prototype.slice.call(x.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(x.querySelectorAll("[contenteditable=false]"))].forEach(e=>{Qe&&!r&&e.hasAttribute("data-slate-zero-width")&&e.textContent.length>0&&"\ufeff"!==e.textContext?e.textContent.startsWith("\ufeff")&&(e.textContent=e.textContent.slice(1)):e.parentNode.removeChild(e)}),f=x.textContent.length,w=c}}else if(g){for(var O=g.querySelectorAll("[data-slate-leaf]"),k=0;k<O.length;k++){var S=O[k];if(gt.hasDOMNode(e,S)){y=S;break}}y?(c=y.closest('[data-slate-node="text"]'),f=(w=y).textContent.length,w.querySelectorAll("[data-slate-zero-width]").forEach(e=>{f-=e.textContent.length})):f=1}else if(m){var P,E,R=e=>e?e.querySelectorAll("[data-slate-leaf]:not(:scope [data-slate-editor] [data-slate-leaf])"):[],C=m.closest('[data-slate-node="element"]');if("backward"===i||!i)y=null!==(P=[...R(null==C?void 0:C.previousElementSibling),...R(C)].findLast(e=>Ke(m,e)))&&void 0!==P?P:null;if("forward"===i||!i)y=null!==(E=[...R(C),...R(null==C?void 0:C.nextElementSibling)].find(e=>((e,t)=>Boolean(e.compareDocumentPosition(t)&Ae.DOCUMENT_POSITION_FOLLOWING))(m,e)))&&void 0!==E?E:null;y&&(c=y.closest('[data-slate-node="text"]'),w=y,"forward"===i?f=0:(f=w.textContent.length,w.querySelectorAll("[data-slate-zero-width]").forEach(e=>{f-=e.textContent.length})))}w&&f===w.textContent.length&&Qe&&"z"===w.getAttribute("data-slate-zero-width")&&null!==(u=w.textContent)&&void 0!==u&&u.startsWith("\ufeff")&&(l.hasAttribute("data-slate-zero-width")||Je&&null!==(d=w.textContent)&&void 0!==d&&d.endsWith("\n\n"))&&f--}if(Qe&&!c&&!r){var T=l.hasAttribute("data-slate-node")?l:l.closest("[data-slate-node]");if(T&>.hasDOMNode(e,T,{editable:!0})){var j=gt.toSlateNode(e,T),{path:N,offset:M}=W.start(e,gt.findPath(e,j));return T.querySelector("[data-slate-leaf]")||(M=s),{path:N,offset:M}}}if(!c){if(o)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var D=gt.toSlateNode(e,c);return{path:gt.findPath(e,D),offset:f}},toSlateRange:(e,t,n)=>{var r,o,i,a,s,l,{exactMatch:c,suppressThrow:f}=n;if(We(t)?t.anchorNode:t.startContainer)if(We(t)){if(Je&&t.rangeCount>1){a=t.focusNode;var u=t.getRangeAt(0),d=t.getRangeAt(t.rangeCount-1);if(a instanceof HTMLTableRowElement&&u.startContainer instanceof HTMLTableRowElement&&d.startContainer instanceof HTMLTableRowElement){function x(e){return e.childElementCount>0?x(e.children[0]):e}var h=u.startContainer,p=d.startContainer,g=x(h.children[u.startOffset]),v=x(p.children[d.startOffset]);s=0,o=v.childNodes.length>0?v.childNodes[0]:v,a=g.childNodes.length>0?g.childNodes[0]:g,i=v instanceof HTMLElement?v.innerHTML.length:0}else u.startContainer===a?(o=d.endContainer,i=d.endOffset,s=u.startOffset):(o=u.startContainer,i=u.endOffset,s=d.startOffset)}else o=t.anchorNode,i=t.anchorOffset,a=t.focusNode,s=t.focusOffset;l=Ze&&(e=>{for(var t=e&&e.parentNode;t;){if("[object ShadowRoot]"===t.toString())return!0;t=t.parentNode}return!1})(o)||Je?t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:t.isCollapsed}else o=t.startContainer,i=t.startOffset,a=t.endContainer,s=t.endOffset,l=t.collapsed;if(null==o||null==a||null==i||null==s)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));Je&&null!==(r=a.textContent)&&void 0!==r&&r.endsWith("\n\n")&&s===a.textContent.length&&s--;var m=gt.toSlatePoint(e,[o,i],{exactMatch:c,suppressThrow:f});if(!m)return null;var y=Ke(o,a)||o===a&&s<i,w=l?m:gt.toSlatePoint(e,[a,s],{exactMatch:c,suppressThrow:f,searchDirection:y?"forward":"backward"});if(!w)return null;var b={anchor:m,focus:w};return P.isExpanded(b)&&P.isForward(b)&&Fe(a)&&W.void(e,{at:b.focus,mode:"highest"})&&(b=W.unhangRange(e,b,{voids:!0})),b}},vt={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",insertSoftBreak:"shift+enter",splitBlock:"enter",undo:"mod+z"},mt={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},yt={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},wt=e=>{var t=vt[e],n=mt[e],r=yt[e],o=t&&Ne(t),i=n&&Ne(n),a=r&&Ne(r);return e=>!(!o||!o(e))||(!!(Xe&&i&&i(e))||!(Xe||!a||!a(e)))};wt("bold"),wt("compose"),wt("moveBackward"),wt("moveForward"),wt("deleteBackward"),wt("deleteForward"),wt("deleteLineBackward"),wt("deleteLineForward"),wt("deleteWordBackward"),wt("deleteWordForward"),wt("extendBackward"),wt("extendForward"),wt("extendLineBackward"),wt("extendLineForward"),wt("italic"),wt("moveLineBackward"),wt("moveLineForward"),wt("moveWordBackward"),wt("moveWordForward"),wt("redo"),wt("insertSoftBreak"),wt("splitBlock"),wt("transposeCharacter"),wt("undo"),function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(nt||(nt={}));var bt=function(e){return Object.freeze(e)},xt=function(e,t){this.inlineSize=e,this.blockSize=t,bt(this)},Ot=function(){function e(e,t,n,r){return this.x=e,this.y=t,this.width=n,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,bt(this)}return e.prototype.toJSON=function(){var e=this;return{x:e.x,y:e.y,top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),kt="undefined"!=typeof window?window:{};/msie|trident/i.test(kt.navigator&&kt.navigator.userAgent);var St=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=!1),new xt((n?t:e)||0,(n?e:t)||0)};function Pt(e){return Pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pt(e)}function Et(e){var t=function(e,t){if("object"!==Pt(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Pt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Pt(t)?t:String(t)}function Rt(e,t,n){return(t=Et(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}bt({devicePixelContentBoxSize:St(),borderBoxSize:St(),contentBoxSize:St(),contentRect:new Ot(0,0,0,0)});var Ct=c(null),Tt=gt,jt={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};function Nt(e,t,n){var r;const o=(null!==(r=e.allowedAfter)&&void 0!==r?r:/^$|\s/).test(t),i=""===n||/\s/.test(n);return o&&i}function Mt(e){if(!e.selection||!P.isCollapsed(e.selection))return null;try{const t=Tt.toDOMRange(e,e.selection);if(!t)return null;const n=t.getClientRects();return{domRect:t.getBoundingClientRect(),clientRects:n.length>0?n:t.getClientRects()}}catch(e){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const n=t.getRangeAt(0);return{domRect:n.getBoundingClientRect(),clientRects:n.getClientRects()}}}Rt(class extends f{constructor(){super(...arguments),Rt(this,"context",null),Rt(this,"manager",null),Rt(this,"mutationObserver",null)}observe(){var e,{node:t}=this.props;if(!t.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");null===(e=this.mutationObserver)||void 0===e||e.observe(t.current,jt)}componentDidMount(){var{receivedUserInput:e}=this.props,t=this.context;this.manager=((e,t)=>{var n=[],r=()=>{n=[]};return{registerMutations:r=>{if(t.current){var o=r.filter(t=>He(e,t,r));n.push(...o)}},restoreDOM:function(){n.length>0&&(n.reverse().forEach(e=>{"characterData"!==e.type&&(e.removedNodes.forEach(t=>{e.target.insertBefore(t,e.nextSibling)}),e.addedNodes.forEach(t=>{e.target.removeChild(t)}))}),r())},clear:r}})(t,e),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var e,t,n,r,o=null===(e=this.mutationObserver)||void 0===e?void 0:e.takeRecords();null!=o&&o.length&&(null===(r=this.manager)||void 0===r||r.registerMutations(o));return null===(t=this.mutationObserver)||void 0===t||t.disconnect(),null===(n=this.manager)||void 0===n||n.restoreDOM(),null}componentDidUpdate(){var e;null===(e=this.manager)||void 0===e||e.clear(),this.observe()}componentWillUnmount(){var e;null===(e=this.mutationObserver)||void 0===e||e.disconnect()}render(){return this.props.children}},"contextType",Ct),parseInt(l.version.split(".")[0],10);const Dt=new o({type:"Mention",elements:e("mention",{render:e=>{const{element:n,attributes:r,children:o}=e,{name:i}=n.props;return t("span",Object.assign({},r,{contentEditable:!1,"data-mention":!0},{children:["@",i,o]}))},props:{id:"",name:"",avatar:"",type:void 0,meta:void 0},nodeType:"inlineVoid"}),options:{display:{title:"Mention",description:"Mention a user or resource"},char:"@"},commands:ge,parsers:{html:{deserialize:{nodeNames:["SPAN"],parse:e=>{var t,r,o,i,a;if("SPAN"===e.nodeName&&e.dataset.mentionId)return{id:n(),type:"mention",children:[{text:""}],props:{id:null!==(t=e.dataset.mentionId)&&void 0!==t?t:"",name:null!==(o=null!==(r=e.dataset.mentionName)&&void 0!==r?r:e.textContent)&&void 0!==o?o:"",avatar:null!==(i=e.dataset.mentionAvatar)&&void 0!==i?i:"",type:null!==(a=e.dataset.mentionType)&&void 0!==a?a:void 0,nodeType:"inlineVoid"}}}},serialize:e=>{var t;const{id:n,name:r,avatar:o,type:i}=null!==(t=e.props)&&void 0!==t?t:{};return`<span data-mention data-mention-id="${n}" data-mention-name="${r}" data-mention-avatar="${null!=o?o:""}" data-mention-type="${null!=i?i:""}" style="color: #2563eb; font-weight: 500;">@${r}</span>`}},markdown:{serialize:e=>{var t,n;return`@${null!==(n=null===(t=e.props)||void 0===t?void 0:t.name)&&void 0!==n?n:""}`}},email:{serialize:e=>{var t;const{name:n}=null!==(t=e.props)&&void 0!==t?t:{};return`<span style="color: #2563eb; font-weight: 500;">@${n}</span>`}}},extensions:e=>{const{markableVoid:t,isInline:n}=e;return e.markableVoid=e=>"mention"===e.type||t(e),e.isInline=e=>"mention"===e.type||n(e),e},events:{onKeyDown:(e,t,n)=>r=>{var o,i,a;const s=e,l=null===(o=e.plugins.Mention)||void 0===o?void 0:o.options,c=function(e){var t;return e?e.triggers&&e.triggers.length>0?e.triggers:[{char:null!==(t=e.char)&&void 0!==t?t:"@"}]:[{char:"@"}]}(l),f=s.mentions.state,u=n.currentBlock;for(const e of c)if(1===e.char.length&&r.key===e.char&&t.selection&&P.isCollapsed(t.selection)){const n=M.get(t,t.selection.anchor.path);if(!J.isText(n))continue;const r=n.text,o=t.selection.anchor.offset;if(!Nt(e,null!==(i=r[o-1])&&void 0!==i?i:"",null!==(a=r[o])&&void 0!==a?a:""))continue;if(!u)continue;const l=Mt(t);if(!l)continue;return void s.mentions.open({trigger:e,targetRect:l,triggerRange:{blockId:u.id,path:t.selection.anchor.path,startOffset:o}})}if(f.isOpen){const{key:e}=r;if("Escape"===e&&!1!==(null==l?void 0:l.closeOnEscape))return r.preventDefault(),void s.mentions.close("escape");if("Backspace"===e){const e=f.query.slice(0,-1);return 0===f.query.length?void s.mentions.close("backspace"):void s.mentions.setQuery(e)}if(1===e.length&&!r.ctrlKey&&!r.metaKey&&!r.altKey){const t=f.trigger;if(" "===e&&!(null==t?void 0:t.allowSpaces))return void s.mentions.close("manual");if(t&&e===t.char)return;s.mentions.setQuery(f.query+e)}}}}});function At(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})}function Bt(){return"undefined"!=typeof window}function Lt(e){return qt(e)?(e.nodeName||"").toLowerCase():"#document"}function _t(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ft(e){var t;return null==(t=(qt(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function qt(e){return!!Bt()&&(e instanceof Node||e instanceof _t(e).Node)}function Wt(e){return!!Bt()&&(e instanceof Element||e instanceof _t(e).Element)}function It(e){return!!Bt()&&(e instanceof HTMLElement||e instanceof _t(e).HTMLElement)}function Vt(e){return!(!Bt()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof _t(e).ShadowRoot)}"function"==typeof SuppressedError&&SuppressedError;const zt=new Set(["inline","contents"]);function Ht(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=nn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!zt.has(o)}const Kt=new Set(["table","td","th"]);function $t(e){return Kt.has(Lt(e))}const Ut=[":popover-open",":modal"];function Xt(e){return Ut.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Qt=["transform","translate","scale","rotate","perspective"],Jt=["transform","translate","scale","rotate","perspective","filter"],Zt=["paint","layout","strict","content"];function Yt(e){const t=Gt(),n=Wt(e)?nn(e):e;return Qt.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Jt.some(e=>(n.willChange||"").includes(e))||Zt.some(e=>(n.contain||"").includes(e))}function Gt(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const en=new Set(["html","body","#document"]);function tn(e){return en.has(Lt(e))}function nn(e){return _t(e).getComputedStyle(e)}function rn(e){return Wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function on(e){if("html"===Lt(e))return e;const t=e.assignedSlot||e.parentNode||Vt(e)&&e.host||Ft(e);return Vt(t)?t.host:t}function an(e){const t=on(e);return tn(t)?e.ownerDocument?e.ownerDocument.body:e.body:It(t)&&Ht(t)?t:an(t)}function sn(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=an(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=_t(o);if(i){const e=ln(a);return t.concat(a,a.visualViewport||[],Ht(o)?o:[],e&&n?sn(e):[])}return t.concat(o,sn(o,[],n))}function ln(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const cn=Math.min,fn=Math.max,un=Math.round,dn=Math.floor,hn=e=>({x:e,y:e}),pn={left:"right",right:"left",bottom:"top",top:"bottom"},gn={start:"end",end:"start"};function vn(e,t,n){return fn(e,cn(t,n))}function mn(e,t){return"function"==typeof e?e(t):e}function yn(e){return e.split("-")[0]}function wn(e){return e.split("-")[1]}function bn(e){return"x"===e?"y":"x"}function xn(e){return"y"===e?"height":"width"}const On=new Set(["top","bottom"]);function kn(e){return On.has(yn(e))?"y":"x"}function Sn(e){return bn(kn(e))}function Pn(e){return e.replace(/start|end/g,e=>gn[e])}const En=["left","right"],Rn=["right","left"],Cn=["top","bottom"],Tn=["bottom","top"];function jn(e,t,n,r){const o=wn(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Rn:En:t?En:Rn;case"left":case"right":return t?Cn:Tn;default:return[]}}(yn(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(Pn)))),i}function Nn(e){return e.replace(/left|right|bottom|top/g,e=>pn[e])}function Mn(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Dn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function An(e,t,n){let{reference:r,floating:o}=e;const i=kn(t),a=Sn(t),s=xn(a),l=yn(t),c="y"===i,f=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[s]/2-o[s]/2;let h;switch(l){case"top":h={x:f,y:r.y-o.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-o.width,y:u};break;default:h={x:r.x,y:r.y}}switch(wn(t)){case"start":h[a]-=d*(n&&c?-1:1);break;case"end":h[a]+=d*(n&&c?-1:1)}return h}async function Bn(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:d=!1,padding:h=0}=mn(t,e),p=Mn(h),g=s[d?"floating"===u?"reference":"floating":u],v=Dn(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:f,strategy:l})),m="floating"===u?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=Dn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:m,offsetParent:y,strategy:l}):m);return{top:(v.top-b.top+p.top)/w.y,bottom:(b.bottom-v.bottom+p.bottom)/w.y,left:(v.left-b.left+p.left)/w.x,right:(b.right-v.right+p.right)/w.x}}function Ln(e){const t=cn(...e.map(e=>e.left)),n=cn(...e.map(e=>e.top));return{x:t,y:n,width:fn(...e.map(e=>e.right))-t,height:fn(...e.map(e=>e.bottom))-n}}const _n=new Set(["left","top"]);function Fn(e){const t=nn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=It(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=un(n)!==i||un(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function qn(e){return Wt(e)?e:e.contextElement}function Wn(e){const t=qn(e);if(!It(t))return hn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Fn(t);let a=(i?un(n.width):n.width)/r,s=(i?un(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const In=hn(0);function Vn(e){const t=_t(e);return Gt()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:In}function zn(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=qn(e);let a=hn(1);t&&(r?Wt(r)&&(a=Wn(r)):a=Wn(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==_t(e))&&t}(i,n,r)?Vn(i):hn(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,f=o.width/a.x,u=o.height/a.y;if(i){const e=_t(i),t=r&&Wt(r)?_t(r):r;let n=e,o=ln(n);for(;o&&r&&t!==n;){const e=Wn(o),t=o.getBoundingClientRect(),r=nn(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,f*=e.x,u*=e.y,l+=i,c+=a,n=_t(o),o=ln(n)}}return Dn({width:f,height:u,x:l,y:c})}function Hn(e,t){const n=rn(e).scrollLeft;return t?t.left+n:zn(Ft(e)).left+n}function Kn(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Hn(e,n),y:n.top+t.scrollTop}}const $n=new Set(["absolute","fixed"]);function Un(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=_t(e),r=Ft(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=Gt();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}const c=Hn(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(r.clientWidth-t.clientWidth-o);a<=25&&(i-=a)}else c<=25&&(i+=c);return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=Ft(e),n=rn(e),r=e.ownerDocument.body,o=fn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=fn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Hn(e);const s=-n.scrollTop;return"rtl"===nn(r).direction&&(a+=fn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Ft(e));else if(Wt(t))r=function(e,t){const n=zn(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=It(e)?Wn(e):hn(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=Vn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Dn(r)}function Xn(e,t){const n=on(e);return!(n===t||!Wt(n)||tn(n))&&("fixed"===nn(n).position||Xn(n,t))}function Qn(e,t,n){const r=It(t),o=Ft(t),i="fixed"===n,a=zn(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=hn(0);function c(){l.x=Hn(o)}if(r||!r&&!i)if(("body"!==Lt(t)||Ht(o))&&(s=rn(t)),r){const e=zn(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&c();i&&!r&&o&&c();const f=!o||r||i?hn(0):Kn(o,s);return{x:a.left+s.scrollLeft-l.x-f.x,y:a.top+s.scrollTop-l.y-f.y,width:a.width,height:a.height}}function Jn(e){return"static"===nn(e).position}function Zn(e,t){if(!It(e)||"fixed"===nn(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Ft(e)===n&&(n=n.ownerDocument.body),n}function Yn(e,t){const n=_t(e);if(Xt(e))return n;if(!It(e)){let t=on(e);for(;t&&!tn(t);){if(Wt(t)&&!Jn(t))return t;t=on(t)}return n}let r=Zn(e,t);for(;r&&$t(r)&&Jn(r);)r=Zn(r,t);return r&&tn(r)&&Jn(r)&&!Yt(r)?n:r||function(e){let t=on(e);for(;It(t)&&!tn(t);){if(Yt(t))return t;if(Xt(t))return null;t=on(t)}return null}(e)||n}const Gn={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Ft(r),s=!!t&&Xt(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=hn(1);const f=hn(0),u=It(r);if((u||!u&&!i)&&(("body"!==Lt(r)||Ht(a))&&(l=rn(r)),It(r))){const e=zn(r);c=Wn(r),f.x=e.x+r.clientLeft,f.y=e.y+r.clientTop}const d=!a||u||i?hn(0):Kn(a,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+d.x,y:n.y*c.y-l.scrollTop*c.y+f.y+d.y}},getDocumentElement:Ft,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?Xt(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=sn(e,[],!1).filter(e=>Wt(e)&&"body"!==Lt(e)),o=null;const i="fixed"===nn(e).position;let a=i?on(e):e;for(;Wt(a)&&!tn(a);){const t=nn(a),n=Yt(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&$n.has(o.position)||Ht(a)&&!n&&Xn(e,a))?r=r.filter(e=>e!==a):o=t,a=on(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],s=i.reduce((e,n)=>{const r=Un(t,n,o);return e.top=fn(r.top,e.top),e.right=cn(r.right,e.right),e.bottom=cn(r.bottom,e.bottom),e.left=fn(r.left,e.left),e},Un(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Yn,getElementRects:async function(e){const t=this.getOffsetParent||Yn,n=this.getDimensions,r=await n(e.floating);return{reference:Qn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Fn(e);return{width:t,height:n}},getScale:Wn,isElement:Wt,isRTL:function(e){return"rtl"===nn(e).direction}};function er(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tr(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=qn(e),f=o||i?[...c?sn(c):[],...sn(t)]:[];f.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const u=c&&s?function(e,t){let n,r=null;const o=Ft(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const c=e.getBoundingClientRect(),{left:f,top:u,width:d,height:h}=c;if(s||t(),!d||!h)return;const p={rootMargin:-dn(u)+"px "+-dn(o.clientWidth-(f+d))+"px "+-dn(o.clientHeight-(u+h))+"px "+-dn(f)+"px",threshold:fn(0,cn(1,l))||1};let g=!0;function v(t){const r=t[0].intersectionRatio;if(r!==l){if(!g)return a();r?a(!1,r):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==r||er(c,e.getBoundingClientRect())||a(),g=!1}try{r=new IntersectionObserver(v,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(v,p)}r.observe(e)}(!0),i}(c,n):null;let d,h=-1,p=null;a&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let g=l?zn(e):null;return l&&function t(){const r=zn(e);g&&!er(g,r)&&n();g=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==u||u(),null==(e=p)||e.disconnect(),p=null,l&&cancelAnimationFrame(d)}}const nr=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=yn(n),s=wn(n),l="y"===kn(n),c=_n.has(a)?-1:1,f=i&&l?-1:1,u=mn(t,e);let{mainAxis:d,crossAxis:h,alignmentAxis:p}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof p&&(h="end"===s?-1*p:p),l?{x:h*f,y:d*c}:{x:d*c,y:h*f}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}},rr=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=mn(e,t),c={x:n,y:r},f=await Bn(t,l),u=kn(yn(o)),d=bn(u);let h=c[d],p=c[u];if(i){const e="y"===d?"bottom":"right";h=vn(h+f["y"===d?"top":"left"],h,h-f[e])}if(a){const e="y"===u?"bottom":"right";p=vn(p+f["y"===u?"top":"left"],p,p-f[e])}const g=s.fn({...t,[d]:h,[u]:p});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[d]:i,[u]:a}}}}}},or=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...v}=mn(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const m=yn(o),y=kn(s),w=yn(s)===s,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=d||(w||!g?[Nn(s)]:function(e){const t=Nn(e);return[Pn(e),t,Pn(t)]}(s)),O="none"!==p;!d&&O&&x.push(...jn(s,g,p,b));const k=[s,...x],S=await Bn(t,v),P=[];let E=(null==(r=i.flip)?void 0:r.overflows)||[];if(f&&P.push(S[m]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=wn(e),o=Sn(e),i=xn(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Nn(a)),[a,Nn(a)]}(o,a,b);P.push(S[e[0]],S[e[1]])}if(E=[...E,{placement:o,overflows:P}],!P.every(e=>e<=0)){var R,C;const e=((null==(R=i.flip)?void 0:R.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&y!==kn(t))||E.every(e=>kn(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:E},reset:{placement:t}}}let n=null==(C=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:C.placement;if(!n)switch(h){case"bestFit":{var T;const e=null==(T=E.filter(e=>{if(O){const t=kn(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:T[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},ir=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:s=2,x:l,y:c}=mn(e,t),f=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),u=function(e){const t=e.slice().sort((e,t)=>e.y-t.y),n=[];let r=null;for(let e=0;e<t.length;e++){const o=t[e];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map(e=>Dn(Ln(e)))}(f),d=Dn(Ln(f)),h=Mn(s);const p=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=l&&null!=c)return u.find(e=>l>e.left-h.left&&l<e.right+h.right&&c>e.top-h.top&&c<e.bottom+h.bottom)||d;if(u.length>=2){if("y"===kn(n)){const e=u[0],t=u[u.length-1],r="top"===yn(n),o=e.top,i=t.bottom,a=r?e.left:t.left,s=r?e.right:t.right;return{top:o,bottom:i,left:a,right:s,width:s-a,height:i-o,x:a,y:o}}const e="left"===yn(n),t=fn(...u.map(e=>e.right)),r=cn(...u.map(e=>e.left)),o=u.filter(n=>e?n.left===r:n.right===t),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return d}},floating:r.floating,strategy:a});return o.reference.x!==p.reference.x||o.reference.y!==p.reference.y||o.reference.width!==p.reference.width||o.reference.height!==p.reference.height?{reset:{rects:p}}:{}}}},ar=(e,t,n)=>{const r=new Map,o={platform:Gn,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:u}=An(c,r,l),d=r,h={},p=0;for(let n=0;n<s.length;n++){const{name:i,fn:g}=s[n],{x:v,y:m,data:y,reset:w}=await g({x:f,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:h,rects:c,platform:a,elements:{reference:e,floating:t}});f=null!=v?v:f,u=null!=m?m:u,h={...h,[i]:{...h[i],...y}},w&&p<=50&&(p++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(c=!0===w.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:f,y:u}=An(c,d,l))),n=-1)}return{x:f,y:u,placement:d,strategy:o,middlewareData:h}})(e,t,{...o,platform:i})};var sr="undefined"!=typeof document?u:function(){};function lr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!lr(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!lr(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function cr(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fr(e,t){const n=cr(e);return Math.round(t*n)/n}function ur(e){const t=s.useRef(e);return sr(()=>{t.current=e}),t}const dr=(e,t)=>({...nr(e),options:[e,t]}),hr=(e,t)=>({...rr(e),options:[e,t]}),pr=(e,t)=>({...or(e),options:[e,t]}),gr=(e,t)=>({...ir(e),options:[e,t]}),vr={...s},mr=vr.useInsertionEffect||(e=>e());var yr="undefined"!=typeof document?u:d;let wr=!1,br=0;const xr=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+br++;const Or=vr.useId||function(){const[e,t]=s.useState(()=>wr?xr():void 0);return yr(()=>{null==e&&t(xr())},[]),s.useEffect(()=>{wr=!0},[]),e};const kr=s.createContext(null),Sr=s.createContext(null);function Pr(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Or(),i=s.useRef({}),[a]=s.useState(()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}}()),l=null!=((null==(c=s.useContext(kr))?void 0:c.id)||null);var c;const[f,u]=s.useState(r.reference),d=function(e){const t=s.useRef(()=>{});return mr(()=>{t.current=e}),s.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}((e,t,r)=>{i.current.openEvent=e?t:void 0,a.emit("openchange",{open:e,event:t,reason:r,nested:l}),null==n||n(e,t,r)}),h=s.useMemo(()=>({setPositionReference:u}),[]),p=s.useMemo(()=>({reference:f||r.reference||null,floating:r.floating||null,domReference:r.reference}),[f,r.reference,r.floating]);return s.useMemo(()=>({dataRef:i,open:t,onOpenChange:d,elements:p,events:a,floatingId:o,refs:h}),[t,d,p,a,o,h])}function Er(e){void 0===e&&(e={});const{nodeId:t}=e,n=Pr({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,a]=s.useState(null),[l,c]=s.useState(null),f=(null==o?void 0:o.domReference)||i,u=s.useRef(null),d=s.useContext(Sr);yr(()=>{f&&(u.current=f)},[f]);const h=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:f}=e,[u,d]=s.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=s.useState(r);lr(h,r)||p(r);const[g,v]=s.useState(null),[y,w]=s.useState(null),b=s.useCallback(e=>{e!==S.current&&(S.current=e,v(e))},[]),x=s.useCallback(e=>{e!==P.current&&(P.current=e,w(e))},[]),O=i||g,k=a||y,S=s.useRef(null),P=s.useRef(null),E=s.useRef(u),R=null!=c,C=ur(c),T=ur(o),j=ur(f),N=s.useCallback(()=>{if(!S.current||!P.current)return;const e={placement:t,strategy:n,middleware:h};T.current&&(e.platform=T.current),ar(S.current,P.current,e).then(e=>{const t={...e,isPositioned:!1!==j.current};M.current&&!lr(E.current,t)&&(E.current=t,m.flushSync(()=>{d(t)}))})},[h,t,n,T,j]);sr(()=>{!1===f&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[f]);const M=s.useRef(!1);sr(()=>(M.current=!0,()=>{M.current=!1}),[]),sr(()=>{if(O&&(S.current=O),k&&(P.current=k),O&&k){if(C.current)return C.current(O,k,N);N()}},[O,k,N,C,R]);const D=s.useMemo(()=>({reference:S,floating:P,setReference:b,setFloating:x}),[b,x]),A=s.useMemo(()=>({reference:O,floating:k}),[O,k]),B=s.useMemo(()=>{const e={position:n,left:0,top:0};if(!A.floating)return e;const t=fr(A.floating,u.x),r=fr(A.floating,u.y);return l?{...e,transform:"translate("+t+"px, "+r+"px)",...cr(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,l,A.floating,u.x,u.y]);return s.useMemo(()=>({...u,update:N,refs:D,elements:A,floatingStyles:B}),[u,N,D,A,B])}({...e,elements:{...o,...l&&{reference:l}}}),p=s.useCallback(e=>{const t=Wt(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c(t),h.refs.setReference(t)},[h.refs]),g=s.useCallback(e=>{(Wt(e)||null===e)&&(u.current=e,a(e)),(Wt(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!Wt(e))&&h.refs.setReference(e)},[h.refs]),v=s.useMemo(()=>({...h.refs,setReference:g,setPositionReference:p,domReference:u}),[h.refs,g,p]),y=s.useMemo(()=>({...h.elements,domReference:f}),[h.elements,f]),w=s.useMemo(()=>({...h,...r,refs:v,elements:y,nodeId:t}),[h,v,y,t,r]);return yr(()=>{r.dataRef.current.floatingContext=w;const e=null==d?void 0:d.nodesRef.current.find(e=>e.id===t);e&&(e.context=w)}),s.useMemo(()=>({...h,context:w,refs:v,elements:y}),[h,v,y,w])}function Rr(e={}){var t,n,r;const o=i(),s=a("Mention"),[l,c]=h([]),[f,u]=h(!1),[m,y]=h(null),[w,b]=h(0),[x,O]=h(pe),k=p(null),S=p(""),P=null!==(n=null!==(t=e.debounceMs)&&void 0!==t?t:null==s?void 0:s.debounceMs)&&void 0!==n?n:300,E=null!==(r=null==s?void 0:s.minQueryLength)&&void 0!==r?r:0,{refs:R,floatingStyles:C}=Er({placement:"bottom-start",open:x.isOpen,middleware:[gr(),pr(),hr({padding:8}),dr(4)],whileElementsMounted:tr});d(()=>{const e=()=>{O(Object.assign({},o.mentions.state)),b(0),c([]),y(null)},t=()=>{O(Object.assign({},pe)),c([]),b(0),y(null)},n=()=>{O(Object.assign({},o.mentions.state))};return o.on("mention:open",e),o.on("mention:close",t),o.on("mention:query-change",n),()=>{o.off("mention:open",e),o.off("mention:close",t),o.off("mention:query-change",n)}},[o]),d(()=>{x.targetRect&&R.setReference({getBoundingClientRect:()=>x.targetRect.domRect,getClientRects:()=>x.targetRect.clientRects})},[x.targetRect,R]),d(()=>{if(!x.isOpen||!(null==s?void 0:s.onSearch))return;const e=x.query,t=x.trigger;if(!(e===S.current&&l.length>0)){if(S.current=e,!(e.length<E))return k.current&&clearTimeout(k.current),k.current=setTimeout(()=>At(this,void 0,void 0,function*(){var n;if(t){u(!0),y(null);try{const r=yield null===(n=null==s?void 0:s.onSearch)||void 0===n?void 0:n.call(s,e,t);c(r),b(0)}catch(e){y(e instanceof Error?e:new Error("Search failed")),c([])}finally{u(!1)}}}),P),()=>{k.current&&clearTimeout(k.current)};c([])}},[x.isOpen,x.query,x.trigger,s,P,E,l.length]);const T=g(e=>{ge.insertMention(o,e,{focus:!0})},[o]),j=g((e="manual")=>{ge.closeDropdown(o,e)},[o]);return d(()=>{if(!x.isOpen)return;const e=e=>{switch(e.key){case"ArrowDown":e.preventDefault(),b(e=>(e+1)%Math.max(l.length,1));break;case"ArrowUp":e.preventDefault(),b(e=>(e-1+Math.max(l.length,1))%Math.max(l.length,1));break;case"Enter":e.preventDefault(),l[w]&&T(l[w]);break;case"Escape":e.preventDefault(),j("escape");break;case"Tab":j("escape")}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[x.isOpen,l,w,T,j]),d(()=>{if(!x.isOpen)return;if(!1===(null==s?void 0:s.closeOnClickOutside))return;const e=e=>{const t=R.floating.current;t&&!t.contains(e.target)&&j("click-outside")},t=setTimeout(()=>{document.addEventListener("mousedown",e)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[x.isOpen,R.floating,j,null==s?void 0:s.closeOnClickOutside]),v(()=>({isOpen:x.isOpen,query:x.query,trigger:x.trigger,items:l,loading:f,error:m,selectedIndex:w,setSelectedIndex:b,selectItem:T,close:j,refs:{setFloating:R.setFloating,setReference:R.setReference},floatingStyles:C}),[x.isOpen,x.query,x.trigger,l,f,m,w,T,j,R.setFloating,R.setReference,C])}function Cr(){const e=i(),[t,n]=h(pe);return d(()=>{const t=()=>{n(Object.assign({},e.mentions.state))},r=()=>{n(pe)},o=()=>{n(Object.assign({},e.mentions.state))};return e.on("mention:open",t),e.on("mention:close",r),e.on("mention:query-change",o),()=>{e.off("mention:open",t),e.off("mention:close",r),e.off("mention:query-change",o)}},[e]),{isTypingMention:t.isOpen,currentTrigger:t.trigger,query:t.query,targetRect:t.targetRect}}function Tr(e){const{isTypingMention:t,currentTrigger:n}=Cr();return t&&(null==n?void 0:n.char)===e}function jr(e){const t=e;let n=Object.assign({},pe);const r=e.emit,{plugins:o}=e;return t.mentions={get state(){return n},setState:e=>{n=Object.assign(Object.assign({},n),e)},open:e=>{var t;const i=null===(t=o.Mention)||void 0===t?void 0:t.options;n={isOpen:!0,query:"",trigger:e.trigger,targetRect:e.targetRect,triggerRange:e.triggerRange},r("mention:open",{trigger:e.trigger,query:"",targetRect:e.targetRect}),(null==i?void 0:i.onOpen)&&i.onOpen(e.trigger)},close:(e="manual")=>{var t;const i=null===(t=o.Mention)||void 0===t?void 0:t.options;n=Object.assign({},pe),r("mention:close",{reason:e}),(null==i?void 0:i.onClose)&&i.onClose()},setQuery:e=>{n=Object.assign(Object.assign({},n),{query:e}),r("mention:query-change",{query:e,trigger:n.trigger})}},t}export{pe as INITIAL_MENTION_STATE,ge as MentionCommands,Dt as default,Rr as useMentionDropdown,Cr as useMentionState,Tr as useMentionTriggerActive,jr as withMentions};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { YooptaPlugin } from '@yoopta/editor';
|
|
2
|
+
import type { MentionElementMap, MentionPluginOptions } from '../types';
|
|
3
|
+
declare const Mention: YooptaPlugin<MentionElementMap, MentionPluginOptions<Record<string, unknown>>>;
|
|
4
|
+
export { Mention };
|
|
5
|
+
//# sourceMappingURL=mention-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mention-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/mention-plugin.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAc,MAAM,gBAAgB,CAAC;AAI1D,OAAO,KAAK,EACV,iBAAiB,EAEjB,oBAAoB,EAErB,MAAM,UAAU,CAAC;AAuBlB,QAAA,MAAM,OAAO,gFAkKX,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,32 +1,176 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SlateElement } from '@yoopta/editor';
|
|
3
|
-
export type
|
|
4
|
-
export type MentionItem = {
|
|
2
|
+
import type { BaseYooEditor, SlateElement } from '@yoopta/editor';
|
|
3
|
+
export type MentionType = 'user' | 'channel' | 'page' | 'custom' | string;
|
|
4
|
+
export type MentionItem<TMeta = Record<string, unknown>> = {
|
|
5
5
|
id: string;
|
|
6
|
+
type?: MentionType;
|
|
6
7
|
name: string;
|
|
7
8
|
avatar?: string;
|
|
9
|
+
meta?: TMeta;
|
|
8
10
|
};
|
|
9
|
-
export type MentionElementProps = MentionItem & {
|
|
11
|
+
export type MentionElementProps<TMeta = Record<string, unknown>> = MentionItem<TMeta> & {
|
|
10
12
|
nodeType: 'inlineVoid';
|
|
11
13
|
};
|
|
12
|
-
export type
|
|
14
|
+
export type MentionPluginElementKeys = 'mention';
|
|
15
|
+
export type MentionElement<TMeta = Record<string, unknown>> = SlateElement<'mention', MentionElementProps<TMeta>>;
|
|
13
16
|
export type MentionElementMap = {
|
|
14
17
|
mention: MentionElement;
|
|
15
18
|
};
|
|
16
|
-
export type
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
export type MentionTrigger = {
|
|
20
|
+
/** Character(s) that trigger the mention dropdown (e.g., '@', '#', '[[') */
|
|
21
|
+
char: string;
|
|
22
|
+
/** Optional type to categorize this trigger */
|
|
23
|
+
type?: MentionType;
|
|
24
|
+
/** Allow spaces in search query (default: false) */
|
|
25
|
+
allowSpaces?: boolean;
|
|
26
|
+
/** Pattern that must precede the trigger (default: /\s|^/ - whitespace or start) */
|
|
27
|
+
allowedAfter?: RegExp;
|
|
28
|
+
};
|
|
29
|
+
export type MentionTargetRect = {
|
|
30
|
+
domRect: DOMRect;
|
|
31
|
+
clientRects: DOMRectList;
|
|
32
|
+
};
|
|
33
|
+
export type MentionState = {
|
|
34
|
+
/** Whether the dropdown is open */
|
|
35
|
+
isOpen: boolean;
|
|
36
|
+
/** Current search query (without trigger char) */
|
|
37
|
+
query: string;
|
|
38
|
+
/** The trigger that opened the dropdown */
|
|
39
|
+
trigger: MentionTrigger | null;
|
|
40
|
+
/** Position for the dropdown */
|
|
41
|
+
targetRect: MentionTargetRect | null;
|
|
42
|
+
/** The range where trigger was typed (for replacement) */
|
|
43
|
+
triggerRange: {
|
|
44
|
+
blockId: string;
|
|
45
|
+
path: number[];
|
|
46
|
+
startOffset: number;
|
|
47
|
+
} | null;
|
|
48
|
+
};
|
|
49
|
+
export declare const INITIAL_MENTION_STATE: MentionState;
|
|
50
|
+
export type MentionPluginOptions<TMeta = Record<string, unknown>> = {
|
|
51
|
+
/**
|
|
52
|
+
* Multiple triggers configuration
|
|
53
|
+
* Example: [{ char: '@', type: 'user' }, { char: '#', type: 'channel' }]
|
|
54
|
+
*/
|
|
55
|
+
triggers?: MentionTrigger[];
|
|
56
|
+
/**
|
|
57
|
+
* Simple single trigger (shorthand for triggers: [{ char }])
|
|
58
|
+
* @default '@'
|
|
59
|
+
*/
|
|
21
60
|
char?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Search function called when user types after trigger
|
|
63
|
+
* Receives query (without trigger char) and the active trigger
|
|
64
|
+
*/
|
|
65
|
+
onSearch: (query: string, trigger: MentionTrigger) => Promise<MentionItem<TMeta>[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Debounce delay for search in milliseconds
|
|
68
|
+
* @default 300
|
|
69
|
+
*/
|
|
70
|
+
debounceMs?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Minimum query length before triggering search
|
|
73
|
+
* @default 0
|
|
74
|
+
*/
|
|
75
|
+
minQueryLength?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Called when a mention is selected
|
|
78
|
+
*/
|
|
79
|
+
onSelect?: (item: MentionItem<TMeta>, trigger: MentionTrigger) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Called when dropdown opens
|
|
82
|
+
*/
|
|
83
|
+
onOpen?: (trigger: MentionTrigger) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Called when dropdown closes
|
|
86
|
+
*/
|
|
87
|
+
onClose?: () => void;
|
|
88
|
+
/**
|
|
89
|
+
* Close dropdown when item is selected
|
|
90
|
+
* @default true
|
|
91
|
+
*/
|
|
92
|
+
closeOnSelect?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Close dropdown on click outside
|
|
95
|
+
* @default true
|
|
96
|
+
*/
|
|
97
|
+
closeOnClickOutside?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Close dropdown on Escape key
|
|
100
|
+
* @default true
|
|
101
|
+
*/
|
|
102
|
+
closeOnEscape?: boolean;
|
|
103
|
+
};
|
|
104
|
+
export type MentionOpenEvent = {
|
|
105
|
+
trigger: MentionTrigger;
|
|
106
|
+
query: string;
|
|
107
|
+
targetRect: MentionTargetRect;
|
|
108
|
+
};
|
|
109
|
+
export type MentionCloseEvent = {
|
|
110
|
+
reason: 'escape' | 'click-outside' | 'select' | 'manual' | 'backspace';
|
|
111
|
+
};
|
|
112
|
+
export type MentionQueryChangeEvent = {
|
|
113
|
+
query: string;
|
|
114
|
+
trigger: MentionTrigger;
|
|
22
115
|
};
|
|
23
|
-
export
|
|
116
|
+
export type MentionSelectEvent<TMeta = Record<string, unknown>> = {
|
|
117
|
+
item: MentionItem<TMeta>;
|
|
118
|
+
trigger: MentionTrigger;
|
|
119
|
+
};
|
|
120
|
+
export type UseMentionDropdownOptions = {
|
|
121
|
+
/** Custom debounce override */
|
|
122
|
+
debounceMs?: number;
|
|
123
|
+
};
|
|
124
|
+
export type UseMentionDropdownReturn<TMeta = Record<string, unknown>> = {
|
|
125
|
+
isOpen: boolean;
|
|
126
|
+
query: string;
|
|
127
|
+
trigger: MentionTrigger | null;
|
|
128
|
+
items: MentionItem<TMeta>[];
|
|
129
|
+
loading: boolean;
|
|
130
|
+
error: Error | null;
|
|
131
|
+
selectedIndex: number;
|
|
132
|
+
setSelectedIndex: (index: number) => void;
|
|
133
|
+
selectItem: (item: MentionItem<TMeta>) => void;
|
|
134
|
+
close: (reason?: MentionCloseEvent['reason']) => void;
|
|
135
|
+
refs: {
|
|
136
|
+
setFloating: (el: HTMLElement | null) => void;
|
|
137
|
+
setReference: (virtualEl: {
|
|
138
|
+
getBoundingClientRect: () => DOMRect;
|
|
139
|
+
getClientRects?: () => DOMRectList;
|
|
140
|
+
}) => void;
|
|
141
|
+
};
|
|
142
|
+
floatingStyles: React.CSSProperties;
|
|
143
|
+
};
|
|
144
|
+
export type MentionRenderProps<TMeta = Record<string, unknown>> = {
|
|
145
|
+
element: MentionElement<TMeta>;
|
|
146
|
+
attributes: Record<string, unknown>;
|
|
147
|
+
children: React.ReactNode;
|
|
148
|
+
selected: boolean;
|
|
149
|
+
focused: boolean;
|
|
150
|
+
};
|
|
151
|
+
export type MentionDropdownRenderProps<TMeta = Record<string, unknown>> = UseMentionDropdownReturn<TMeta>;
|
|
152
|
+
export type MentionItemRenderProps<TMeta = Record<string, unknown>> = {
|
|
153
|
+
item: MentionItem<TMeta>;
|
|
154
|
+
index: number;
|
|
155
|
+
selected: boolean;
|
|
156
|
+
onSelect: () => void;
|
|
157
|
+
};
|
|
158
|
+
export type MentionEditor = {
|
|
24
159
|
mentions: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
160
|
+
state: MentionState;
|
|
161
|
+
setState: (state: Partial<MentionState>) => void;
|
|
162
|
+
open: (params: {
|
|
163
|
+
trigger: MentionTrigger;
|
|
164
|
+
targetRect: MentionTargetRect;
|
|
165
|
+
triggerRange: MentionState['triggerRange'];
|
|
166
|
+
}) => void;
|
|
167
|
+
close: (reason?: MentionCloseEvent['reason']) => void;
|
|
168
|
+
setQuery: (query: string) => void;
|
|
30
169
|
};
|
|
170
|
+
};
|
|
171
|
+
export type MentionYooEditor = BaseYooEditor & MentionEditor;
|
|
172
|
+
declare module '@yoopta/editor' {
|
|
173
|
+
interface YooEditor extends MentionEditor {
|
|
174
|
+
}
|
|
31
175
|
}
|
|
32
176
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAElE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1E,MAAM,MAAM,WAAW,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACzD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,GAAG;IACtF,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,SAAS,CAAC;AACjD,MAAM,MAAM,cAAc,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,YAAY,CACxE,SAAS,EACT,mBAAmB,CAAC,KAAK,CAAC,CAC3B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,oDAAoD;IACpD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oFAAoF;IACpF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,mCAAmC;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,gCAAgC;IAChC,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACrC,0DAA0D;IAC1D,YAAY,EAAE;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI,CAAC;CACV,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,YAMnC,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAClE;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;IAE5B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAEpF;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAEvE;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAE3C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,iBAAiB,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,QAAQ,GAAG,eAAe,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;CACxE,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAChE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IACzB,OAAO,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAEtE,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAG/B,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAGpB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAG1C,UAAU,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;IAC/C,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IAGtD,IAAI,EAAE;QACJ,WAAW,EAAE,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;QAC9C,YAAY,EAAE,CAAC,SAAS,EAAE;YACxB,qBAAqB,EAAE,MAAM,OAAO,CAAC;YACrC,cAAc,CAAC,EAAE,MAAM,WAAW,CAAC;SACpC,KAAK,IAAI,CAAC;KACZ,CAAC;IACF,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAChE,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACpE,wBAAwB,CAAC,KAAK,CAAC,CAAC;AAElC,MAAM,MAAM,sBAAsB,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACpE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE;QACR,KAAK,EAAE,YAAY,CAAC;QACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;QACjD,IAAI,EAAE,CAAC,MAAM,EAAE;YACb,OAAO,EAAE,cAAc,CAAC;YACxB,UAAU,EAAE,iBAAiB,CAAC;YAC9B,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;SAC5C,KAAK,IAAI,CAAC;QACX,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;QACtD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;KACnC,CAAC;CACH,CAAA;AAGD,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,aAAa,CAAC;AAE7D,OAAO,QAAQ,gBAAgB,CAAC;IAE9B,UAAU,SAAU,SAAQ,aAAa;KAAI;CAC9C"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SlateEditor } from "@yoopta/editor";
|
|
2
|
+
import type { MentionPluginOptions, MentionTargetRect, MentionTrigger } from "../types";
|
|
3
|
+
export declare function getTriggers(options: MentionPluginOptions | undefined): MentionTrigger[];
|
|
4
|
+
export declare function shouldTriggerActivate(trigger: MentionTrigger, charBefore: string, charAfter: string): boolean;
|
|
5
|
+
export declare function getCaretRectFromSlate(slate: SlateEditor): MentionTargetRect | null;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAExF,wBAAgB,WAAW,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS,GAAG,cAAc,EAAE,CAQvF;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAST;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,GAAG,iBAAiB,GAAG,IAAI,CAyBlF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/mention",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.10",
|
|
4
4
|
"description": "Mention plugin for Yoopta Editor",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dist/"
|
|
15
15
|
],
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@yoopta/editor": "
|
|
17
|
+
"@yoopta/editor": "6.0.0-beta.4",
|
|
18
18
|
"react": ">=18.2.0",
|
|
19
19
|
"react-dom": ">=18.2.0"
|
|
20
20
|
},
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"bugs": {
|
|
36
36
|
"url": "https://github.com/Darginec05/Yoopta-Editor/issues"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "cab1b9a3d5f104c46da98df464f1806d968b12fd"
|
|
39
39
|
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { YooEditor, YooptaPathIndex } from '@yoopta/editor';
|
|
2
|
-
import { Location, NodeEntry } from 'slate';
|
|
3
|
-
import { MentionElement, MentionElementProps } from '../types';
|
|
4
|
-
type MentionElementOptions = {
|
|
5
|
-
props: Omit<MentionElementProps, 'nodeType'>;
|
|
6
|
-
};
|
|
7
|
-
type MentionInsertOptions = {
|
|
8
|
-
selection?: Location | undefined;
|
|
9
|
-
};
|
|
10
|
-
type DeleteElementOptions = {
|
|
11
|
-
selection?: Location | undefined;
|
|
12
|
-
};
|
|
13
|
-
type FindMentionOptions = {
|
|
14
|
-
blockId?: string;
|
|
15
|
-
at?: YooptaPathIndex;
|
|
16
|
-
};
|
|
17
|
-
export type MentionCommands = {
|
|
18
|
-
buildMentionElements: (editor: YooEditor, options: MentionElementOptions) => MentionElement;
|
|
19
|
-
getSearchQuery: (editor: YooEditor) => string;
|
|
20
|
-
closeDropdown: (editor: YooEditor) => void;
|
|
21
|
-
insertMention: (editor: YooEditor, props: MentionElementOptions['props'], options?: MentionInsertOptions) => void;
|
|
22
|
-
deleteMention: (editor: YooEditor, options: DeleteElementOptions) => void;
|
|
23
|
-
openDropdown: (editor: YooEditor, target: {
|
|
24
|
-
domRect: DOMRect;
|
|
25
|
-
clientRect: DOMRectList;
|
|
26
|
-
}, search: string) => void;
|
|
27
|
-
findMention: (editor: YooEditor, options?: FindMentionOptions) => NodeEntry<MentionElement> | null;
|
|
28
|
-
findMentions: (editor: YooEditor, options?: FindMentionOptions) => NodeEntry<MentionElement>[] | null;
|
|
29
|
-
};
|
|
30
|
-
export declare const MentionCommands: MentionCommands;
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=MentionCommands.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MentionCommands.d.ts","sourceRoot":"","sources":["../../src/commands/MentionCommands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAmB,QAAQ,EAAQ,SAAS,EAA2B,MAAM,OAAO,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAwB,MAAM,UAAU,CAAC;AAErF,KAAK,qBAAqB,GAAG;IAC3B,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;CAC9C,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,SAAS,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,SAAS,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,eAAe,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,oBAAoB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,qBAAqB,KAAK,cAAc,CAAC;IAC5F,cAAc,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,MAAM,CAAC;IAC9C,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IAC3C,aAAa,EAAE,CACb,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,EACrC,OAAO,CAAC,EAAE,oBAAoB,KAC3B,IAAI,CAAC;IACV,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC1E,YAAY,EAAE,CACZ,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,UAAU,EAAE,WAAW,CAAA;KAAE,EACrD,MAAM,EAAE,MAAM,KACX,IAAI,CAAC;IACV,WAAW,EAAE,CACX,MAAM,EAAE,SAAS,EACjB,OAAO,CAAC,EAAE,kBAAkB,KACzB,SAAS,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IACtC,YAAY,EAAE,CACZ,MAAM,EAAE,SAAS,EACjB,OAAO,CAAC,EAAE,kBAAkB,KACzB,SAAS,CAAC,cAAc,CAAC,EAAE,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,eA8H7B,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
5
|
-
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
6
|
-
} & {
|
|
7
|
-
asChild?: boolean | undefined;
|
|
8
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
9
|
-
label?: string | undefined;
|
|
10
|
-
shouldFilter?: boolean | undefined;
|
|
11
|
-
filter?: ((value: string, search: string, keywords?: string[] | undefined) => number) | undefined;
|
|
12
|
-
defaultValue?: string | undefined;
|
|
13
|
-
value?: string | undefined;
|
|
14
|
-
onValueChange?: ((value: string) => void) | undefined;
|
|
15
|
-
loop?: boolean | undefined;
|
|
16
|
-
disablePointerSelection?: boolean | undefined;
|
|
17
|
-
vimBindings?: boolean | undefined;
|
|
18
|
-
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
-
declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & {
|
|
20
|
-
ref?: React.Ref<HTMLInputElement> | undefined;
|
|
21
|
-
} & {
|
|
22
|
-
asChild?: boolean | undefined;
|
|
23
|
-
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "value" | "type"> & {
|
|
24
|
-
value?: string | undefined;
|
|
25
|
-
onValueChange?: ((search: string) => void) | undefined;
|
|
26
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
27
|
-
declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
28
|
-
children?: React.ReactNode;
|
|
29
|
-
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
30
|
-
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
31
|
-
} & {
|
|
32
|
-
asChild?: boolean | undefined;
|
|
33
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
34
|
-
label?: string | undefined;
|
|
35
|
-
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
-
declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
37
|
-
children?: React.ReactNode;
|
|
38
|
-
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
39
|
-
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
40
|
-
} & {
|
|
41
|
-
asChild?: boolean | undefined;
|
|
42
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
43
|
-
declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
44
|
-
children?: React.ReactNode;
|
|
45
|
-
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
46
|
-
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
47
|
-
} & {
|
|
48
|
-
asChild?: boolean | undefined;
|
|
49
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
|
|
50
|
-
heading?: React.ReactNode;
|
|
51
|
-
value?: string | undefined;
|
|
52
|
-
forceMount?: boolean | undefined;
|
|
53
|
-
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
54
|
-
declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
55
|
-
children?: React.ReactNode;
|
|
56
|
-
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
57
|
-
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
58
|
-
} & {
|
|
59
|
-
asChild?: boolean | undefined;
|
|
60
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "onSelect" | "value" | "disabled"> & {
|
|
61
|
-
disabled?: boolean | undefined;
|
|
62
|
-
onSelect?: ((value: string) => void) | undefined;
|
|
63
|
-
value?: string | undefined;
|
|
64
|
-
keywords?: string[] | undefined;
|
|
65
|
-
forceMount?: boolean | undefined;
|
|
66
|
-
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
-
export { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem };
|
|
68
|
-
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/components/ui/command.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;sFAKX,CAAC;AAGH,QAAA,MAAM,YAAY;;;;;;;0FAWhB,CAAC;AAIH,QAAA,MAAM,WAAW;;;;;;;;sFAKf,CAAC;AAIH,QAAA,MAAM,YAAY;;;;;;uJAGiF,CAAC;AAIpG,QAAA,MAAM,YAAY;;;;;;;;;;sFAKhB,CAAC;AAIH,QAAA,MAAM,WAAW;;;;;;;;;;;;sFAUf,CAAC;AAIH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/plugin/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { YooEditor } from '@yoopta/editor';
|
|
2
|
-
import { YooptaPlugin } from '@yoopta/editor';
|
|
3
|
-
import type { MentionElementMap, MentionPluginOptions } from '../types';
|
|
4
|
-
declare const Mention: YooptaPlugin<MentionElementMap, MentionPluginOptions>;
|
|
5
|
-
declare function withMentions(baseEditor: YooEditor): YooEditor;
|
|
6
|
-
export { Mention, withMentions };
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAoB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAIhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGxE,QAAA,MAAM,OAAO,uDA0EX,CAAC;AAEH,iBAAS,YAAY,CAAC,UAAU,EAAE,SAAS,GAAG,SAAS,CAOtD;AAED,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { MentionItem } from '../types';
|
|
2
|
-
type MentionDropdownProps = {
|
|
3
|
-
onSelect: (mention: MentionItem) => void;
|
|
4
|
-
onClose?: () => void;
|
|
5
|
-
getItems: (query: string) => Promise<MentionItem[]>;
|
|
6
|
-
debounceMs?: number;
|
|
7
|
-
showLoading?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare const MentionDropdown: ({ getItems: getMentionItems, onSelect, onClose, debounceMs, showLoading, }: MentionDropdownProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=MentionDropdown.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MentionDropdown.d.ts","sourceRoot":"","sources":["../../src/ui/MentionDropdown.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,WAAW,EAAwB,MAAM,UAAU,CAAC;AAWlE,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,eAAe,+EAMzB,oBAAoB,mDA4ItB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MentionRender.d.ts","sourceRoot":"","sources":["../../src/ui/MentionRender.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAK/D,QAAA,MAAM,aAAa,UAAW,wBAAwB,4CA4BrD,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/ui/hooks.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const useArrowNavigation: ({ editor, items, open, onSelect, onClose }: {
|
|
3
|
-
editor: any;
|
|
4
|
-
items: any;
|
|
5
|
-
open: any;
|
|
6
|
-
onSelect: any;
|
|
7
|
-
onClose: any;
|
|
8
|
-
}) => {
|
|
9
|
-
listRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
10
|
-
selectedIndex: number;
|
|
11
|
-
itemRefs: import("react").MutableRefObject<(HTMLDivElement | null)[]>;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/ui/hooks.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/ui/hooks.ts"],"names":[],"mappings":";AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;CA0E9B,CAAC"}
|
package/dist/utils.d.ts
DELETED
package/dist/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE,UAErE"}
|