@yoopta/mention 6.0.0-beta.7 → 6.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/package.json +2 -2
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{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 P(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 R=["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=P(e,R),[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(q.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)?P(e,A):P(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})||q.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},$=e=>e.selection?e.selection:e.children.length>0?q.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 q={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 V(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,V(V({},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 P(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=P(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[R,S]of n.entries()){var C=O,N=C+S.leaf.text.length,A={start:C,end:N};0===R&&(A.isFirst=!0),R===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 P=K.transform(E,t);if(null!=x&&null!=P)x[O]=P;else{var R=void 0,S=void 0;for(var[C,N]of M.texts(e)){if(-1!==w.compare(N,y)){S=[C,N];break}R=[C,N]}var A=!1;R&&S&&(A=!w.isSibling(R[1],y)&&(!!w.equals(S[1],y)||w.common(R[1],y).length<w.common(S[1],y).length)),R&&!A?x[O]={path:R[1],offset:R[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 $=F[W];if(null==$){if("anchor"===W||"focus"===W)throw new Error('Cannot remove the "'.concat(W,'" selection property'));delete B[W]}else B[W]=$}e.selection=B;break;case"split_node":var{path:q,position:z,properties:V}=t,U=q[q.length-1];if(0===q.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(q,"] because the root node cannot be split."));ie(e,w.parent(q),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({},V),{},{text:i})}else{var a=r.children.slice(0,z),c=r.children.slice(z);t=se(se({},r),{},{children:a}),n=se(se({},V),{},{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]:{};q.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:o=$(e)}=n;if(w.isPath(o)&&(o=q.range(e,o)),k.isRange(o))if(k.isCollapsed(o))o=o.anchor;else{var i=k.end(o);if(!r&&q.void(e,{at:i}))return;var a=k.start(o),c=q.pointRef(e,a),s=q.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&&q.void(e,{at:o})||q.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&&q.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(q.nodes(i,{at:[],match:e=>N.isElement(e)&&!q.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]=q.nodes(i,{match:e=>N.isElement(e)&&!q.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,parsers:{html:{deserialize:{nodeNames:["SPAN"],parse:t=>{if("SPAN"===t.nodeName&&t.dataset.mentionId)return{id:e(),type:"mention",children:[{text:""}],props:{id:t.dataset.mentionId||"",name:t.dataset.mentionName||t.textContent||"",avatar:t.dataset.mentionAvatar||"",nodeType:"inlineVoid"}}}},serialize:e=>{const{id:t,name:n,avatar:r}=e.props||{};return`<span data-mention-id="${t}" data-mention-name="${n}" data-mention-avatar="${r||""}" style="color: #2563eb; font-weight: 500;">@${n}</span>`}},markdown:{serialize:e=>{var t;return`@${(null===(t=e.props)||void 0===t?void 0:t.name)||""}`}},email:{serialize:e=>{const{name:t}=e.props||{};return`<span style="color: #2563eb; font-weight: 500;">@${t}</span>`}}},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 Pe(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Re(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 Pe(e).Node)}function ke(e){return!!Ee()&&(e instanceof Element||e instanceof Pe(e).Element)}function Ce(e){return!!Ee()&&(e instanceof HTMLElement||e instanceof Pe(e).HTMLElement)}function Ne(e){return!(!Ee()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Pe(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 $e=new Set(["html","body","#document"]);function qe(e){return $e.has(Oe(e))}function ze(e){return Pe(e).getComputedStyle(e)}function Ve(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||Re(e);return Ne(t)?t.host:t}function Ue(e){const t=Ke(e);return qe(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=Pe(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 Pt(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 Rt(e){return ke(e)?e:e.contextElement}function St(e){const t=Rt(e);if(!Ce(t))return Qe(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Pt(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=Pe(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=Rt(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!==Pe(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=Pe(i),t=r&&ke(r)?Pe(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=Pe(o),o=Ze(n)}}return bt({width:u,height:d,x:s,y:l})}function At(e,t){const n=Ve(e).scrollLeft;return t?t.left+n:Nt(Re(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=Pe(e),r=Re(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=Re(e),n=Ve(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}}(Re(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)||qe(n))&&("fixed"===ze(n).position||Mt(n,t))}function _t(e,t,n){const r=Ce(t),o=Re(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=Ve(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 Re(e)===n&&(n=n.ownerDocument.body),n}function Ft(e,t){const n=Pe(e);if(_e(e))return n;if(!Ce(e)){let t=Ke(e);for(;t&&!qe(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&&qe(r)&&Lt(r)&&!Be(r)?n:r||function(e){let t=Ke(e);for(;Ce(t)&&!qe(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=Re(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=Ve(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:Re,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)&&!qe(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}=Pt(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 $t(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=Rt(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=Re(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 qt=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}}}}}},Vt=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],P=await xt(t,g),R=[];let S=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&R.push(P[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);R.push(P[e[0]],P[e[1]])}if(S=[...S,{placement:o,overflows:R}],!R.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)=>({...qt(e),options:[e,t]}),Qt=(e,t)=>({...zt(e),options:[e,t]}),en=(e,t)=>({...Vt(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!==P.current&&(P.current=e,g(e))},[]),x=d.useCallback(e=>{e!==R.current&&(R.current=e,b(e))},[]),E=i||h,O=a||v,P=d.useRef(null),R=d.useRef(null),S=d.useRef(u),k=null!=s,C=Jt(s),N=Jt(o),A=Jt(l),D=d.useCallback(()=>{if(!P.current||!R.current)return;const e={placement:t,strategy:n,middleware:p};N.current&&(e.platform=N.current),Ut(P.current,R.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&&(P.current=E),O&&(R.current=O),E&&O){if(C.current)return C.current(E,O,D);D()}},[E,O,D,C,k]);const T=d.useMemo(()=>({reference:P,floating:R,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 P=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&&P(),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)}},P=function(){r&&r({})},R=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 R.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({})},R.isPending=function(){return!!s.current},R.flush=function(){return s.current?m(Date.now()):d.current},R},[b,x,t,O,w,y,g,E,r]);return P}(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-]/,Pn=/[\s-]/g;function Rn(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=Rn(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(Pn))&&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=Rn(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(Pn," ")}function kn(e,t,n){return Rn(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(qn);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 $n=Symbol("radix.slottable");function qn(e){return d.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===$n}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 Vn(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=Vn(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),P=function(e,t=globalThis?.document){const n=Vn(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=Vn(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,P.onFocusCapture),onBlurCapture:Cn(e.onBlurCapture,P.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=Vn(o),f=Vn(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(){},Pr=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]),P=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({},P),{ref:O})):d.createElement(b,be({},P,{className:s,ref:O}),c))});Pr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Pr.classNames={fullWidth:hr,zeroRight:mr};function Rr(){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=Rr())&&(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),$r(e,r)){var o=qr(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$r=function(e,t){return"v"===e?function(e){return Br(e,"overflowY")}(t):function(e){return Br(e,"overflowX")}(t)},qr=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]},Vr=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=qr(e,c),m=p[0],h=p[1]-p[2]-i*m;(m||h)&&$r(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?Vr(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,Vr(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(Pr,be({},e,{ref:t,sideCar:Jr}))});Gr.classNames=Pr.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",Po=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(Ro,{...o,ref:t}):l(So,{...o,ref:t})})});Po.displayName=Oo;var Ro=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=Po,$o=Symbol.for("react.lazy"),qo=d[" use ".trim().toString()];function zo(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===$o&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function Vo(e){const t=d.forwardRef((e,t)=>{let{children:n,...r}=e;if(zo(n)&&"function"==typeof qo&&(n=qo(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=Vo(e),n=d.forwardRef((e,n)=>{let{children:r,...o}=e;zo(r)&&"function"==typeof qo&&(r=qo(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,P.emit()}},[u]),bi(()=>{O(6,A)},[]);let P=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,P.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))}}P.emit()}},emit:()=>{a.current.forEach(e=>e())}}),[]),R=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(),P.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(),P.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(),P.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);P.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&&P.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&&P.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?P.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:R.inputId,id:R.labelId,style:Ri},s),Pi(e,e=>d.createElement(ri.Provider,{value:P},d.createElement(ti.Provider,{value:R},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),Pi(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},Pi(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},Pi(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 Pi({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 Ri={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:P}=mn({placement:"bottom-start",open:g,middleware:[tn(),en(),Qt(),Gt(4)],whileElementsMounted:$t}),{isMounted:R,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}}(P,{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:R&&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 +1 @@
|
|
|
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,
|
|
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,EAAgC,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGxE,QAAA,MAAM,OAAO,uDA6GX,CAAC;AAEH,iBAAS,YAAY,CAAC,UAAU,EAAE,SAAS,GAAG,SAAS,CAOtD;AAED,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
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.8",
|
|
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",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"bugs": {
|
|
36
36
|
"url": "https://github.com/Darginec05/Yoopta-Editor/issues"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "dca941dd88adfad95b7c0f2b51c65ada6dd91b49"
|
|
39
39
|
}
|