@yoopta/editor 1.9.9-rc → 1.9.10-rc
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.
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { YooptaBaseElement } from '../../types';
|
|
3
|
-
import {
|
|
3
|
+
import { ParentYooptaPlugin, YooptaPluginType } from '../../utils/plugins';
|
|
4
4
|
import { YooptaMark } from '../../utils/marks';
|
|
5
5
|
import { YooptaTools } from '../../components/YooptaEditor/YooptaEditor';
|
|
6
6
|
export type HoveredElement = YooptaBaseElement<string> | null;
|
|
7
|
+
type YooptaToolsMap = {
|
|
8
|
+
Toolbar: (props: any) => ReactElement;
|
|
9
|
+
ActionMenu: (props: any) => ReactElement;
|
|
10
|
+
ChatGPT: (props: any) => ReactElement;
|
|
11
|
+
[x: string]: (props: any) => ReactElement;
|
|
12
|
+
};
|
|
7
13
|
export type YooptaContextReturnValues = {
|
|
8
14
|
marks: MarksMap;
|
|
9
15
|
elements: ElementsMap;
|
|
10
|
-
tools?:
|
|
16
|
+
tools?: YooptaToolsMap | undefined;
|
|
11
17
|
};
|
|
12
18
|
export type YooptaContextHandlers = {};
|
|
13
19
|
export type YooptaContextType = YooptaContextReturnValues;
|
|
14
|
-
type
|
|
20
|
+
type Props = {
|
|
15
21
|
children: ReactNode;
|
|
16
|
-
plugins:
|
|
22
|
+
plugins: ParentYooptaPlugin[];
|
|
17
23
|
marks?: YooptaMark[];
|
|
18
|
-
tools?: YooptaTools;
|
|
24
|
+
tools?: YooptaTools | undefined;
|
|
19
25
|
};
|
|
20
26
|
export type ToggleOptions = {
|
|
21
27
|
shouldDeleteText: boolean;
|
|
@@ -36,9 +42,9 @@ export type MarksMap = {
|
|
|
36
42
|
isActive: boolean;
|
|
37
43
|
};
|
|
38
44
|
};
|
|
39
|
-
declare const YooptaContextProvider: ({ children, plugins: pluginList, marks: markList, tools }:
|
|
45
|
+
declare const YooptaContextProvider: ({ children, plugins: pluginList, marks: markList, tools }: Props) => JSX.Element;
|
|
40
46
|
declare const useYoopta: () => YooptaContextReturnValues;
|
|
41
47
|
declare const useMarks: () => MarksMap;
|
|
42
48
|
declare const useElements: () => ElementsMap;
|
|
43
|
-
declare const useTools: () =>
|
|
49
|
+
declare const useTools: () => YooptaToolsMap | undefined;
|
|
44
50
|
export { YooptaContextProvider, useYoopta, useMarks, useElements, useTools };
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export { deepClone } from './utils/deepClone';
|
|
|
14
14
|
export { createYooptaMark } from './utils/marks';
|
|
15
15
|
export { isElementActive, getElementByPath } from './utils/nodes';
|
|
16
16
|
export { getElementClassname } from './utils/getElementClassname';
|
|
17
|
-
export type { YooptaPluginType, YooptaPluginEventHandlers, HandlersOptions } from './utils/plugins';
|
|
17
|
+
export type { YooptaPluginType, YooptaPluginEventHandlers, HandlersOptions, YooptaPluginBaseOptions, YooptaRenderHTMLAttributes, } from './utils/plugins';
|
|
18
18
|
export type { YooptaMarksConfig, YooptaMark } from './utils/marks';
|
|
19
19
|
export type { YoEditor, RenderYooptaElementProps, YooptaBaseElement, Modify } from './types';
|
|
20
20
|
declare const UI_HELPERS: {
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import*as n from"react";import r,{useState as o,useEffect as i,useContext as a,useMemo as s,
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import*as n from"react";import r,{useState as o,useEffect as i,useContext as a,useMemo as s,useRef as l,memo as c,useCallback as d}from"react";import{createPortal as u}from"react-dom";import{ReactEditor as f,useSlate as p,useSelected as h,Editable as v,withReact as g,Slate as y}from"slate-react";import{Editor as m,Path as b,Transforms as w,Element as _,Text as x,Operation as O,Range as j,Node as E,createEditor as k}from"slate";import{randomFillSync as N}from"crypto";function S(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 D(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}var P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},A=200,C="__lodash_hash_undefined__",T="[object Function]",L="[object GeneratorFunction]",B=/^\[object .+?Constructor\]$/,M="object"==typeof P&&P&&P.Object===Object&&P,F="object"==typeof self&&self&&self.Object===Object&&self,z=M||F||Function("return this")();function H(e,t){return!!(e?e.length:0)&&function(e,t,n){if(t!=t)return function(e,t,n,r){var o=e.length,i=n+(r?1:-1);for(;r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}(e,R,n);var r=n-1,o=e.length;for(;++r<o;)if(e[r]===t)return r;return-1}(e,t,0)>-1}function I(e,t,n){for(var r=-1,o=e?e.length:0;++r<o;)if(n(t,e[r]))return!0;return!1}function R(e){return e!=e}function W(e,t){return e.has(t)}function V(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var U,$=Array.prototype,Z=Function.prototype,q=Object.prototype,K=z["__core-js_shared__"],G=(U=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"",J=Z.toString,X=q.hasOwnProperty,Q=q.toString,Y=RegExp("^"+J.call(X).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ee=$.splice,te=fe(z,"Map"),ne=fe(z,"Set"),re=fe(Object,"create");function oe(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ie(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ae(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function se(e){var t=-1,n=e?e.length:0;for(this.__data__=new ae;++t<n;)this.add(e[t])}function le(e,t){for(var n,r,o=e.length;o--;)if((n=e[o][0])===(r=t)||n!=n&&r!=r)return o;return-1}function ce(e){if(!pe(e)||(t=e,G&&G in t))return!1;var t,n=function(e){var t=pe(e)?Q.call(e):"";return t==T||t==L}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?Y:B;return n.test(function(e){if(null!=e){try{return J.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}oe.prototype.clear=function(){this.__data__=re?re(null):{}},oe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},oe.prototype.get=function(e){var t=this.__data__;if(re){var n=t[e];return n===C?void 0:n}return X.call(t,e)?t[e]:void 0},oe.prototype.has=function(e){var t=this.__data__;return re?void 0!==t[e]:X.call(t,e)},oe.prototype.set=function(e,t){return this.__data__[e]=re&&void 0===t?C:t,this},ie.prototype.clear=function(){this.__data__=[]},ie.prototype.delete=function(e){var t=this.__data__,n=le(t,e);return!(n<0)&&(n==t.length-1?t.pop():ee.call(t,n,1),!0)},ie.prototype.get=function(e){var t=this.__data__,n=le(t,e);return n<0?void 0:t[n][1]},ie.prototype.has=function(e){return le(this.__data__,e)>-1},ie.prototype.set=function(e,t){var n=this.__data__,r=le(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},ae.prototype.clear=function(){this.__data__={hash:new oe,map:new(te||ie),string:new oe}},ae.prototype.delete=function(e){return ue(this,e).delete(e)},ae.prototype.get=function(e){return ue(this,e).get(e)},ae.prototype.has=function(e){return ue(this,e).has(e)},ae.prototype.set=function(e,t){return ue(this,e).set(e,t),this},se.prototype.add=se.prototype.push=function(e){return this.__data__.set(e,C),this},se.prototype.has=function(e){return this.__data__.has(e)};var de=ne&&1/V(new ne([,-0]))[1]==1/0?function(e){return new ne(e)}:function(){};function ue(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function fe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return ce(n)?n:void 0}function pe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var he,ve=function(e,t){return e&&e.length?function(e,t,n){var r=-1,o=H,i=e.length,a=!0,s=[],l=s;if(n)a=!1,o=I;else if(i>=A){var c=t?null:de(e);if(c)return V(c);a=!1,o=W,l=new se}else l=t?[]:s;e:for(;++r<i;){var d=e[r],u=t?t(d):d;if(d=n||0!==d?d:0,a&&u==u){for(var f=l.length;f--;)if(l[f]===u)continue e;t&&l.push(u),s.push(d)}else o(l,u,n)||(l!==s&&l.push(u),s.push(d))}return s}(e,void 0,t):[]};class ge{constructor(e){he.set(this,void 0),function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?o.call(e,n):o?o.value=n:t.set(e,n)}(this,he,Object.freeze(Object.assign({},e)),"f")}extend(e){const{type:t=D(this,he,"f").type,renderer:n=D(this,he,"f").renderer,placeholder:r=D(this,he,"f").placeholder,shortcut:o=D(this,he,"f").shortcut,exports:i=D(this,he,"f").exports,events:a=D(this,he,"f").events,options:s}=e,l=Object.freeze(Object.assign(Object.assign({},D(this,he,"f")),{type:t,renderer:n,placeholder:r,shortcut:o,exports:i,events:a,options:Object.assign(Object.assign({},D(this,he,"f").options),s)}));return new ge(l)}get getPlugin(){return D(this,he,"f")}}function ye(e){return new ge(e)}function me(e){const t=e.map((e=>{const t=e.getPlugin,{childPlugin:n}=t,r=S(t,["childPlugin"]);return n?[r,Object.assign(Object.assign({},n.getPlugin),{hasParent:!0})]:r})).flat();return ve(t,((e,t)=>e.type===t.type))}he=new WeakMap;var be,we={};
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
|
4
4
|
Licensed under the MIT License (MIT), see
|
|
5
5
|
http://jedwatson.github.io/classnames
|
|
6
6
|
*/
|
|
7
|
-
be={get exports(){return we},set exports(e){we=e}},function(){var e={}.hasOwnProperty;function t(){for(var n=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)n.push(o);else if(Array.isArray(o)){if(o.length){var a=t.apply(null,o);a&&n.push(a)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var s in o)e.call(o,s)&&o[s]&&n.push(s)}}}return n.join(" ")}be.exports?(t.default=t,be.exports=t):window.classNames=t}();var _e=we;function xe(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))}}var Oe="QEROK9NJ",je="ZLDKsGEc",Ee="_0wBAdXIb",ke="P40m4iJS",Ne="_7iHqOybQ";xe(".QEROK9NJ{inset:0;overflow:hidden;pointer-events:none;position:fixed;z-index:999}.ZLDKsGEc,._0wBAdXIb{position:relative;z-index:0}._0wBAdXIb{pointer-events:auto}.P40m4iJS{height:100vh;left:0;position:fixed;top:0;width:100vw}._7iHqOybQ{pointer-events:auto;position:relative;top:100%}");const Se=({children:n,onClose:r})=>{const[a]=o((()=>document.createElement("div")));return i((()=>(a.className="yoopta-overlay",document.body.appendChild(a),()=>{document.body.removeChild(a)})),[a]),u(e("div",Object.assign({className:Oe},{children:[t("div",{className:je}),e("div",Object.assign({className:Ee},{children:[t("div",{className:ke,onClick:r}),t("div",Object.assign({className:Ne,onClick:e=>e.stopPropagation()},{children:n}))]}))]})),a)};var De;function Pe(){return Pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pe.apply(this,arguments)}var Ce,Ae=function(e){return n.createElement("svg",Pe({viewBox:"0 0 16 16",className:"trash_svg__trash",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),De||(De=n.createElement("path",{d:"M4.862 15.429h6.283c1.045 0 1.722-.636 1.77-1.689l.465-9.85h.752c.342 0 .608-.26.608-.602a.594.594 0 0 0-.608-.595H11.09V1.668C11.09.622 10.427 0 9.292 0H6.694C5.566 0 4.896.622 4.896 1.668v1.025H1.861a.598.598 0 1 0 0 1.196h.76l.464 9.858c.048 1.053.718 1.682 1.777 1.682Zm1.292-13.7c0-.355.246-.58.63-.58h2.42c.382 0 .628.225.628.58v.964H6.154V1.73ZM4.992 14.22c-.376 0-.65-.274-.67-.677L3.864 3.89h8.251l-.444 9.652c-.014.403-.287.677-.677.677H4.992Zm.991-1.1c.288 0 .472-.185.465-.452l-.205-7.164c-.007-.274-.198-.451-.472-.451-.287 0-.471.184-.464.45l.205 7.165c.007.273.198.451.471.451Zm2.017 0c.287 0 .479-.185.479-.452V5.503c0-.267-.192-.451-.479-.451s-.479.184-.479.45v7.165c0 .267.192.451.479.451Zm2.017 0c.273 0 .458-.179.464-.452l.212-7.164c.007-.267-.184-.451-.464-.451-.274 0-.465.177-.472.45l-.212 7.165c-.007.267.184.451.472.451Z"})))};function Te(){return Te=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Te.apply(this,arguments)}var Le,Be=function(e){return n.createElement("svg",Te({viewBox:"0 0 16 16",className:"duplicate_svg__duplicate",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),Ce||(Ce=n.createElement("path",{d:"M2.839 12.152H4v1.033c0 1.456.759 2.214 2.242 2.214h6.918c1.477 0 2.242-.758 2.242-2.214V6.212c0-1.456-.765-2.215-2.242-2.215H12V2.965c0-1.456-.766-2.215-2.242-2.215H2.839C1.362.75.597 1.502.597 2.965V9.93c0 1.463.765 2.221 2.242 2.221Zm.082-1.34c-.636 0-.984-.328-.984-.99v-6.74c0-.664.348-.999.984-.999h6.76c.63 0 .985.335.985.998v.916H6.243c-1.483 0-2.242.759-2.242 2.215v4.6h-1.08Zm3.397 3.248c-.635 0-.977-.329-.977-.992v-6.74c0-.663.342-.991.977-.991h6.761c.629 0 .984.328.984.991v6.74c0 .663-.355.992-.984.992H6.32Z"})))};function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Me.apply(this,arguments)}var Fe=function(e){return n.createElement("svg",Me({viewBox:"0 0 16 16",className:"copy_svg__link",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),Le||(Le=n.createElement("path",{d:"m7.7 10.895 1.038-1.046c-.82-.076-1.394-.335-1.818-.76-1.155-1.154-1.155-2.795-.007-3.943l2.27-2.27c1.155-1.155 2.789-1.155 3.944 0 1.162 1.169 1.155 2.796.007 3.944l-1.176 1.176a2.74 2.74 0 0 1 .17 1.634l1.963-1.955c1.682-1.675 1.688-4.054-.007-5.75C12.389.225 10.01.238 8.335 1.913L5.956 4.298c-1.675 1.675-1.688 4.054.007 5.749.403.396.943.697 1.736.848Zm.6-5.763L7.27 6.178c.813.075 1.394.342 1.811.759 1.162 1.162 1.162 2.795.007 3.944l-2.27 2.27c-1.155 1.155-2.782 1.155-3.944 0-1.162-1.163-1.155-2.796 0-3.945L4.042 8.03a2.788 2.788 0 0 1-.17-1.634L1.915 8.352c-1.682 1.674-1.688 4.06.007 5.755 1.695 1.696 4.074 1.682 5.749.007l2.372-2.379c1.682-1.681 1.688-4.06-.007-5.749-.396-.403-.936-.704-1.736-.854Z"})))},He={};!function(e,t){var n=200,r="__lodash_hash_undefined__",o=9007199254740991,i="[object Arguments]",a="[object Boolean]",s="[object Date]",l="[object Function]",c="[object GeneratorFunction]",d="[object Map]",u="[object Number]",f="[object Object]",p="[object Promise]",h="[object RegExp]",v="[object Set]",g="[object String]",y="[object Symbol]",m="[object WeakMap]",b="[object ArrayBuffer]",w="[object DataView]",_="[object Float32Array]",x="[object Float64Array]",O="[object Int8Array]",j="[object Int16Array]",E="[object Int32Array]",k="[object Uint8Array]",N="[object Uint8ClampedArray]",S="[object Uint16Array]",D="[object Uint32Array]",C=/\w*$/,A=/^\[object .+?Constructor\]$/,T=/^(?:0|[1-9]\d*)$/,L={};L[i]=L["[object Array]"]=L[b]=L[w]=L[a]=L[s]=L[_]=L[x]=L[O]=L[j]=L[E]=L[d]=L[u]=L[f]=L[h]=L[v]=L[g]=L[y]=L[k]=L[N]=L[S]=L[D]=!0,L["[object Error]"]=L[l]=L[m]=!1;var B="object"==typeof P&&P&&P.Object===Object&&P,M="object"==typeof self&&self&&self.Object===Object&&self,F=B||M||Function("return this")(),H=t&&!t.nodeType&&t,z=H&&e&&!e.nodeType&&e,I=z&&z.exports===H;function R(e,t){return e.set(t[0],t[1]),e}function W(e,t){return e.add(t),e}function U(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function Z(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function $(e,t){return function(n){return e(t(n))}}function q(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var K=Array.prototype,G=Function.prototype,J=Object.prototype,X=F["__core-js_shared__"],Q=function(){var e=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Y=G.toString,ee=J.hasOwnProperty,te=J.toString,ne=RegExp("^"+Y.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=I?F.Buffer:void 0,oe=F.Symbol,ie=F.Uint8Array,ae=$(Object.getPrototypeOf,Object),se=Object.create,le=J.propertyIsEnumerable,ce=K.splice,de=Object.getOwnPropertySymbols,ue=re?re.isBuffer:void 0,fe=$(Object.keys,Object),pe=He(F,"DataView"),he=He(F,"Map"),ve=He(F,"Promise"),ge=He(F,"Set"),ye=He(F,"WeakMap"),me=He(Object,"create"),be=Ue(pe),we=Ue(he),_e=Ue(ve),xe=Ue(ge),Oe=Ue(ye),je=oe?oe.prototype:void 0,Ee=je?je.valueOf:void 0;function ke(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ne(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Se(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function De(e){this.__data__=new Ne(e)}function Pe(e,t){var n=Ze(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&$e(e)}(e)&&ee.call(e,"callee")&&(!le.call(e,"callee")||te.call(e)==i)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,o=!!r;for(var a in e)!t&&!ee.call(e,a)||o&&("length"==a||Re(a,r))||n.push(a);return n}function Ce(e,t,n){var r=e[t];ee.call(e,t)&&Ve(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Ae(e,t){for(var n=e.length;n--;)if(Ve(e[n][0],t))return n;return-1}function Te(e,t,n,r,o,p,m){var P;if(r&&(P=p?r(e,o,p,m):r(e)),void 0!==P)return P;if(!Ge(e))return e;var A=Ze(e);if(A){if(P=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&ee.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,P)}else{var T=Ie(e),B=T==l||T==c;if(qe(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(T==f||T==i||B&&!p){if(V(e))return p?e:{};if(P=function(e){return"function"!=typeof e.constructor||We(e)?{}:(t=ae(e),Ge(t)?se(t):{});var t}(B?{}:e),!t)return function(e,t){return Me(e,ze(e),t)}(e,function(e,t){return e&&Me(t,Je(t),e)}(P,e))}else{if(!L[T])return p?e:{};P=function(e,t,n,r){var o=e.constructor;switch(t){case b:return Be(e);case a:case s:return new o(+e);case w:return function(e,t){var n=t?Be(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case _:case x:case O:case j:case E:case k:case N:case S:case D:return function(e,t){var n=t?Be(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case d:return function(e,t,n){var r=t?n(Z(e),!0):Z(e);return U(r,R,new e.constructor)}(e,r,n);case u:case g:return new o(e);case h:return function(e){var t=new e.constructor(e.source,C.exec(e));return t.lastIndex=e.lastIndex,t}(e);case v:return function(e,t,n){var r=t?n(q(e),!0):q(e);return U(r,W,new e.constructor)}(e,r,n);case y:return i=e,Ee?Object(Ee.call(i)):{}}var i}(e,T,Te,t)}}m||(m=new De);var M=m.get(e);if(M)return M;if(m.set(e,P),!A)var F=n?function(e){return function(e,t,n){var r=t(e);return Ze(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Je,ze)}(e):Je(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(F||e,(function(o,i){F&&(o=e[i=o]),Ce(P,i,Te(o,t,n,r,i,e,m))})),P}function Le(e){return!(!Ge(e)||(t=e,Q&&Q in t))&&(Ke(e)||V(e)?ne:A).test(Ue(e));var t}function Be(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Me(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var a=t[o],s=r?r(n[a],e[a],a,n,e):void 0;Ce(n,a,void 0===s?e[a]:s)}return n}function Fe(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function He(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(n)?n:void 0}ke.prototype.clear=function(){this.__data__=me?me(null):{}},ke.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},ke.prototype.get=function(e){var t=this.__data__;if(me){var n=t[e];return n===r?void 0:n}return ee.call(t,e)?t[e]:void 0},ke.prototype.has=function(e){var t=this.__data__;return me?void 0!==t[e]:ee.call(t,e)},ke.prototype.set=function(e,t){return this.__data__[e]=me&&void 0===t?r:t,this},Ne.prototype.clear=function(){this.__data__=[]},Ne.prototype.delete=function(e){var t=this.__data__,n=Ae(t,e);return!(n<0)&&(n==t.length-1?t.pop():ce.call(t,n,1),!0)},Ne.prototype.get=function(e){var t=this.__data__,n=Ae(t,e);return n<0?void 0:t[n][1]},Ne.prototype.has=function(e){return Ae(this.__data__,e)>-1},Ne.prototype.set=function(e,t){var n=this.__data__,r=Ae(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Se.prototype.clear=function(){this.__data__={hash:new ke,map:new(he||Ne),string:new ke}},Se.prototype.delete=function(e){return Fe(this,e).delete(e)},Se.prototype.get=function(e){return Fe(this,e).get(e)},Se.prototype.has=function(e){return Fe(this,e).has(e)},Se.prototype.set=function(e,t){return Fe(this,e).set(e,t),this},De.prototype.clear=function(){this.__data__=new Ne},De.prototype.delete=function(e){return this.__data__.delete(e)},De.prototype.get=function(e){return this.__data__.get(e)},De.prototype.has=function(e){return this.__data__.has(e)},De.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ne){var o=r.__data__;if(!he||o.length<n-1)return o.push([e,t]),this;r=this.__data__=new Se(o)}return r.set(e,t),this};var ze=de?$(de,Object):function(){return[]},Ie=function(e){return te.call(e)};function Re(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||T.test(e))&&e>-1&&e%1==0&&e<t}function We(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||J)}function Ue(e){if(null!=e){try{return Y.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ve(e,t){return e===t||e!=e&&t!=t}(pe&&Ie(new pe(new ArrayBuffer(1)))!=w||he&&Ie(new he)!=d||ve&&Ie(ve.resolve())!=p||ge&&Ie(new ge)!=v||ye&&Ie(new ye)!=m)&&(Ie=function(e){var t=te.call(e),n=t==f?e.constructor:void 0,r=n?Ue(n):void 0;if(r)switch(r){case be:return w;case we:return d;case _e:return p;case xe:return v;case Oe:return m}return t});var Ze=Array.isArray;function $e(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}(e.length)&&!Ke(e)}var qe=ue||function(){return!1};function Ke(e){var t=Ge(e)?te.call(e):"";return t==l||t==c}function Ge(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Je(e){return $e(e)?Pe(e):function(e){if(!We(e))return fe(e);var t=[];for(var n in Object(e))ee.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Te(e,!0,!0)}}({get exports(){return He},set exports(e){He=e}},He);var ze=He;function Ie(e){return"function"==typeof window.structuredClone?window.structuredClone(e):ze(e)}const Re={from:{path:null,element:null,parent:null},to:{path:null,element:null,parent:null}};let We,Ue,Ve=(e=21)=>{var t;t=e-=0,!We||We.length<t?(We=Buffer.allocUnsafe(128*t),N(We),Ue=0):Ue+t>We.length&&(N(We),Ue=0),Ue+=t;let n="";for(let t=Ue-e;t<Ue;t++)n+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&We[t]];return n};const Ze=()=>Ve();var $e=!1;if("undefined"!=typeof window){var qe={get passive(){$e=!0}};window.addEventListener("testPassive",null,qe),window.removeEventListener("testPassive",null,qe)}var Ke="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),Ge=[],Je=!1,Xe=-1,Qe=void 0,Ye=void 0,et=void 0,tt=function(e){return Ge.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},nt=function(e){var t=e||window.event;return!!tt(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},rt=function(e,t){if(e){if(!Ge.some((function(t){return t.targetElement===e}))){var n={targetElement:e,options:t||{}};Ge=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(Ge),[n]),Ke?window.requestAnimationFrame((function(){if(void 0===Ye){Ye={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,n=e.scrollX,r=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-t,document.body.style.left=-n,setTimeout((function(){return window.requestAnimationFrame((function(){var e=r-window.innerHeight;e&&t>=r&&(document.body.style.top=-(t+e))}))}),300)}})):function(e){if(void 0===et){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var r=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);et=document.body.style.paddingRight,document.body.style.paddingRight=r+n+"px"}}void 0===Qe&&(Qe=document.body.style.overflow,document.body.style.overflow="hidden")}(t),Ke&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(Xe=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var n=e.targetTouches[0].clientY-Xe;!tt(e.target)&&(t&&0===t.scrollTop&&n>0||function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&n<0?nt(e):e.stopPropagation())}(t,e)},Je||(document.addEventListener("touchmove",nt,$e?{passive:!1}:void 0),Je=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},ot=function(e){e?(Ge=Ge.filter((function(t){return t.targetElement!==e})),Ke&&(e.ontouchstart=null,e.ontouchmove=null,Je&&0===Ge.length&&(document.removeEventListener("touchmove",nt,$e?{passive:!1}:void 0),Je=!1)),Ke?function(){if(void 0!==Ye){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=Ye.position,document.body.style.top=Ye.top,document.body.style.left=Ye.left,window.scrollTo(t,e),Ye=void 0}}():(void 0!==et&&(document.body.style.paddingRight=et,et=void 0),void 0!==Qe&&(document.body.style.overflow=Qe,Qe=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")},it=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},at={"text/plain":"Text","text/html":"Url",default:"Text"},st="Copy to clipboard: #{key}, Enter";var lt=function(e,t){var n,r,o,i,a,s,l=!1;t||(t={}),n=t.debug||!1;try{if(o=it(),i=document.createRange(),a=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=at[t.format]||at.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(s),i.selectNodeContents(s),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");l=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),l=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:st),window.prompt(r,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),s&&document.body.removeChild(s),o()}return l};const ct=e=>({id:e,type:"paragraph",nodeType:"block",children:[{text:""}]});function dt(e,t,n=!1){n&&Object.keys(m.marks(e)||{}).forEach((t=>{m.removeMark(e,t)})),!function(e,t){const n=m.marks(e);return!!(null==n?void 0:n[t])}(e,t)?m.addMark(e,t,!0):m.removeMark(e,t)}const ut={hoveredElement:null,isElementOptionsOpen:!1,nodeSettingsPos:null,dndState:Re,disableWhileDrag:!1,DRAG_MAP:new Map},ft=r.createContext([ut,{openNodeSettings:(e,t)=>{},closeNodeSettings:()=>{},hoverIn:(e,t)=>{},triggerPlusButton:e=>{},deleteNode:()=>{},duplicateNode:()=>{},copyLinkNode:()=>{},onDrop:e=>{},onDragEnd:e=>{},onDragEnter:e=>{},onDragStart:e=>{},changeHoveredNode:e=>{}}]),pt=({children:e})=>{const n=p(),[r,i]=(e=>{const[t,n]=o(!1),[r,i]=o(Re),[a]=o((()=>new Map)),s=t=>{var n;t.preventDefault(),t.stopPropagation();const r=t.target.closest("[data-element-id]");if(r){const{elementId:t,elementType:o}=r.dataset;if(!t||!o)return;const s=a.get(t);if(null===(n=s.data)||void 0===n?void 0:n.skipDrag)return;const l=f.findPath(e,s);i((e=>({from:e.from,to:{path:l,element:{id:t,type:o},parent:null}})))}};return[{dndState:r,disableWhileDrag:t,DRAG_MAP:a},{onDrop:t=>{try{m.withoutNormalizing(e,(()=>{var n,o;if(t.preventDefault(),t.stopPropagation(),(null===(n=r.from.element)||void 0===n?void 0:n.id)===(null===(o=r.to.element)||void 0===o?void 0:o.id))return;const i=r.from.path,s=a.get(r.to.element.id);let l=f.findPath(e,s);if(!i||!l)return;const[c,d]=m.node(e,i),[u,p]=m.parent(e,d);if(console.log("fromPath",i),console.log("fromElementPath",d),console.log("toPath",l),console.log("toPath next",b.next(l)),console.log("fromElementNode",c),console.log("parentElementNode",u),l.length>1){const t=Ie(c);l.length>i.length?(w.insertNodes(e,t,{at:l.length===i.length?l:b.next(l),match:e=>_.isElement(e),mode:"lowest"}),w.removeNodes(e,{at:i,match:e=>_.isElement(e)&&e.id===(null==t?void 0:t.id),mode:"lowest"})):(w.removeNodes(e,{at:i,match:e=>_.isElement(e)&&e.id===(null==t?void 0:t.id),mode:"lowest"}),w.insertNodes(e,t,{at:l.length===i.length?l:b.next(l),match:e=>_.isElement(e),mode:"lowest"})),1===u.children.length&&_.isElement(u.children[0])&&w.removeNodes(e,{at:p,match:e=>_.isElement(e)&&u.id===e.id,mode:"lowest"})}else w.moveNodes(e,{at:i,to:l,match:e=>_.isElement(e)&&_.isElement(c)&&c.type===e.type,mode:"lowest"});t.dataTransfer.clearData(),a.clear()}))}catch(e){console.error(e)}},onDragEnd:e=>{e.stopPropagation(),e.target.removeAttribute("draggable"),e.target.ondragstart=null,e.target.ondragend=null,e.target.ondragenter=null,e.target.ondragover=null,n(!1),i(Re)},onDragEnter:s,onDragStart:(e,t)=>{n(!0),e.dataTransfer.setData("Text",""),e.dataTransfer.effectAllowed="move";const r=document.getElementById("yoopta-contenteditable");r&&(r.ondragenter=e=>s(e),r.ondragover=e=>(e.stopPropagation(),e.preventDefault(),!1),i((e=>({to:e.to,from:t}))))}}]})(n),[a,l]=o(null),[c,d]=o((()=>(({children:e})=>{if(1===e.length)return e[0];return null})(n))),[u,h]=o(!1),v=Object.assign({hoveredElement:c,isElementOptionsOpen:u,nodeSettingsPos:a},r),g=s((()=>Object.assign({hoverIn:(e,t)=>{var n;if(u)return e.preventDefault();(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.skipSettings)||d(t)},changeHoveredNode:e=>d(e),triggerPlusButton:e=>{m.withoutNormalizing(n,(()=>{if(!n.selection||!e)return;const t=f.findPath(n,e),r=b.next([t[0]]),o=ct(Ze());w.insertNodes(n,o,{at:r,select:!0}),d(o)}))},openNodeSettings:(e,t)=>{if(rt(document.body,{reserveScrollBarGap:!0}),h(!0),e.current){const t=e.current.getBoundingClientRect();l({left:t.left+t.width+10,top:t.top})}},closeNodeSettings:()=>{ot(document.body),h(!1),l(null)},deleteNode:()=>{if(c)try{m.withoutNormalizing(n,(()=>{var e;const t=f.findPath(n,c),[r,o]=m.parent(n,t);if(!t)return;let i="highest";if(_.isElement(r)){if(1===r.children.length&&_.isElement(r.children[0]))return w.removeNodes(n,{at:o,match:e=>_.isElement(e)&&e.id===r.id,mode:"highest"}),d(null),void g.closeNodeSettings();(null===(e=r.data)||void 0===e?void 0:e.depth)>0&&(i="lowest")}w.removeNodes(n,{at:t,match:e=>_.isElement(e),mode:i}),d(null),g.closeNodeSettings()}))}catch(e){console.log({error:e})}},duplicateNode:()=>{m.withoutNormalizing(n,(()=>{if(!c)return;const e=f.findPath(n,c),t=b.next(e),r=Ie(c);r.id=Ze(),w.insertNodes(n,r,{at:t,match:e=>_.isElement(e),mode:"highest",select:!0}),f.focus(n),d(null),g.closeNodeSettings()}))},copyLinkNode:()=>{0===window.location.hash.length?lt(`${window.location.href}#${null==c?void 0:c.id}`):lt(`${window.location.href.split("#")[0]}#${null==c?void 0:c.id}`),g.closeNodeSettings()}},i)),[c,u,r,n.children]),y=s((()=>[v,g]),[c,u,r,n.selection,n.children]);return t(ft.Provider,Object.assign({value:y},{children:e}))},ht=()=>a(ft);var vt="IMJgzRnZ",gt="nFfAiJWo",yt="DeARgIyF",mt="kyuzONcU",bt="_95up7F66",wt="_9d0T-cEo";xe(".IMJgzRnZ{align-items:center;background:linear-gradient(90deg,rgba(49,49,47,.99),#262625);border-radius:4px;box-shadow:0 0 0 1px hsla(0,0%,6%,.05),0 3px 6px hsla(0,0%,6%,.1),0 9px 24px hsla(0,0%,6%,.2);display:flex;flex-direction:column;height:auto;max-height:70vh;max-width:calc(100vw - 24px);min-width:200px;opacity:1;overflow:hidden;position:fixed;transform-origin:0 top;width:auto}.nFfAiJWo{flex-grow:1;margin-bottom:0;margin-right:0;min-height:0;overflow:hidden auto;transform:translateZ(0);width:100%;z-index:1}.DeARgIyF{box-shadow:0 -1px 0 rgba(55,53,47,.09);padding-bottom:6px;padding-top:6px}.kyuzONcU{align-items:center;background:inherit;border:none;border-radius:3px;color:#fff;cursor:pointer;display:flex;font-size:14px;line-height:120%;margin-left:4px;margin-right:4px;min-height:28px;transition:background 20ms ease-in 0s;user-select:none;width:calc(100% - 8px)}.kyuzONcU:hover{background-color:#383835;color:#fff}._95up7F66{align-items:center;color:#fff;display:flex;justify-content:center;margin-left:10px;margin-right:4px}._9d0T-cEo{flex:1 1 auto;margin-left:6px;margin-right:6px;overflow:hidden;text-align:left;text-overflow:ellipsis}._5FdNFUNm,._9d0T-cEo{min-width:0;white-space:nowrap}._5FdNFUNm{color:rgba(55,53,47,.5);flex-shrink:0;font-size:12px;margin-left:auto;margin-right:12px}");const _t=n=>{var{onClose:r,style:o,element:i,render:a}=n,s=S(n,["onClose","style","element","render"]);const l=p(),[,c]=ht();m.isVoid(l,i);const d=()=>{var e;c.deleteNode(),null===(e=s.onDelete)||void 0===e||e.call(s)},u=()=>{var e;c.duplicateNode(),null===(e=s.onDuplicate)||void 0===e||e.call(s)},f=()=>{var e;c.copyLinkNode(),null===(e=s.onCopy)||void 0===e||e.call(s)};return t(Se,a?Object.assign({onClose:r},{children:t("div",Object.assign({style:o,className:vt},{children:a({handleDelete:d,handleDuplicate:u,handleCopy:f})}))}):Object.assign({onClose:r},{children:t("div",Object.assign({style:o,className:_e(vt,"yoopta-element-options")},{children:t("div",Object.assign({className:gt},{children:e("div",Object.assign({className:yt},{children:[e("button",Object.assign({type:"button",className:mt,onClick:d},{children:[t("div",Object.assign({className:bt},{children:t(Ae,{})})),t("div",Object.assign({className:wt},{children:"Delete"}))]})),e("button",Object.assign({type:"button",className:mt,onClick:u},{children:[t("div",Object.assign({className:bt},{children:t(Be,{})})),t("div",Object.assign({className:wt},{children:"Duplicate"}))]})),e("button",Object.assign({type:"button",className:mt,onClick:f},{children:[t("div",Object.assign({className:bt},{children:t(Fe,{})})),t("div",Object.assign({className:wt},{children:"Copy link to block"}))]}))]}))}))}))}))};var xt={};Object.defineProperty(xt,"__esModule",{value:!0});for(var Ot="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),jt={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Et={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Ot?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},kt={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},Nt=1;Nt<20;Nt++)kt["f"+Nt]=111+Nt;function St(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map((function(e){return Dt(e,t)})),o=function(e){return r.some((function(t){return Pt(t,e)}))};return null==n?o:o(n)}function Dt(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var a in jt)r[jt[a]]=!1;var s=!0,l=!1,c=void 0;try{for(var d,u=o[Symbol.iterator]();!(s=(d=u.next()).done);s=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=At(f),v=jt[h];if(f.length>1&&!v&&!Et[f]&&!kt[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&v||(n?r.key=h:r.which=Ct(f)),v&&(r[v]=!p||null)}}catch(e){l=!0,c=e}finally{try{!s&&u.return&&u.return()}finally{if(l)throw c}}return r}function Pt(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&((null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r))return!1}return!0}function Ct(e){return e=At(e),kt[e]||e.toUpperCase().charCodeAt(0)}function At(e){return e=e.toLowerCase(),e=Et[e]||e}xt.default=St;var Tt=xt.isHotkey=St,Lt=xt.isCodeHotkey=function(e,t){return St(e,t)},Bt=xt.isKeyHotkey=function(e,t){return St(e,{byKey:!0},t)};xt.parseHotkey=Dt,xt.compareHotkey=Pt,xt.toKeyCode=Ct,xt.toKeyName=At;const Mt=({children:e,fallback:t=null})=>{const[n,r]=o(!1);return i((()=>r(!0)),[]),n?e:t};
|
|
7
|
+
be={get exports(){return we},set exports(e){we=e}},function(){var e={}.hasOwnProperty;function t(){for(var n=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)n.push(o);else if(Array.isArray(o)){if(o.length){var a=t.apply(null,o);a&&n.push(a)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var s in o)e.call(o,s)&&o[s]&&n.push(s)}}}return n.join(" ")}be.exports?(t.default=t,be.exports=t):window.classNames=t}();var _e=we;function xe(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))}}var Oe="QEROK9NJ",je="ZLDKsGEc",Ee="_0wBAdXIb",ke="P40m4iJS",Ne="_7iHqOybQ";xe(".QEROK9NJ{inset:0;overflow:hidden;pointer-events:none;position:fixed;z-index:999}.ZLDKsGEc,._0wBAdXIb{position:relative;z-index:0}._0wBAdXIb{pointer-events:auto}.P40m4iJS{height:100vh;left:0;position:fixed;top:0;width:100vw}._7iHqOybQ{pointer-events:auto;position:relative;top:100%}");const Se=({children:n,onClose:r})=>{const[a]=o((()=>document.createElement("div")));return i((()=>(a.className="yoopta-overlay",document.body.appendChild(a),()=>{document.body.removeChild(a)})),[a]),u(e("div",Object.assign({className:Oe},{children:[t("div",{className:je}),e("div",Object.assign({className:Ee},{children:[t("div",{className:ke,onClick:r}),t("div",Object.assign({className:Ne,onClick:e=>e.stopPropagation()},{children:n}))]}))]})),a)};var De;function Pe(){return Pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pe.apply(this,arguments)}var Ae,Ce=function(e){return n.createElement("svg",Pe({viewBox:"0 0 16 16",className:"trash_svg__trash",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),De||(De=n.createElement("path",{d:"M4.862 15.429h6.283c1.045 0 1.722-.636 1.77-1.689l.465-9.85h.752c.342 0 .608-.26.608-.602a.594.594 0 0 0-.608-.595H11.09V1.668C11.09.622 10.427 0 9.292 0H6.694C5.566 0 4.896.622 4.896 1.668v1.025H1.861a.598.598 0 1 0 0 1.196h.76l.464 9.858c.048 1.053.718 1.682 1.777 1.682Zm1.292-13.7c0-.355.246-.58.63-.58h2.42c.382 0 .628.225.628.58v.964H6.154V1.73ZM4.992 14.22c-.376 0-.65-.274-.67-.677L3.864 3.89h8.251l-.444 9.652c-.014.403-.287.677-.677.677H4.992Zm.991-1.1c.288 0 .472-.185.465-.452l-.205-7.164c-.007-.274-.198-.451-.472-.451-.287 0-.471.184-.464.45l.205 7.165c.007.273.198.451.471.451Zm2.017 0c.287 0 .479-.185.479-.452V5.503c0-.267-.192-.451-.479-.451s-.479.184-.479.45v7.165c0 .267.192.451.479.451Zm2.017 0c.273 0 .458-.179.464-.452l.212-7.164c.007-.267-.184-.451-.464-.451-.274 0-.465.177-.472.45l-.212 7.165c-.007.267.184.451.472.451Z"})))};function Te(){return Te=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Te.apply(this,arguments)}var Le,Be=function(e){return n.createElement("svg",Te({viewBox:"0 0 16 16",className:"duplicate_svg__duplicate",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),Ae||(Ae=n.createElement("path",{d:"M2.839 12.152H4v1.033c0 1.456.759 2.214 2.242 2.214h6.918c1.477 0 2.242-.758 2.242-2.214V6.212c0-1.456-.765-2.215-2.242-2.215H12V2.965c0-1.456-.766-2.215-2.242-2.215H2.839C1.362.75.597 1.502.597 2.965V9.93c0 1.463.765 2.221 2.242 2.221Zm.082-1.34c-.636 0-.984-.328-.984-.99v-6.74c0-.664.348-.999.984-.999h6.76c.63 0 .985.335.985.998v.916H6.243c-1.483 0-2.242.759-2.242 2.215v4.6h-1.08Zm3.397 3.248c-.635 0-.977-.329-.977-.992v-6.74c0-.663.342-.991.977-.991h6.761c.629 0 .984.328.984.991v6.74c0 .663-.355.992-.984.992H6.32Z"})))};function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Me.apply(this,arguments)}var Fe=function(e){return n.createElement("svg",Me({viewBox:"0 0 16 16",className:"copy_svg__link",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),Le||(Le=n.createElement("path",{d:"m7.7 10.895 1.038-1.046c-.82-.076-1.394-.335-1.818-.76-1.155-1.154-1.155-2.795-.007-3.943l2.27-2.27c1.155-1.155 2.789-1.155 3.944 0 1.162 1.169 1.155 2.796.007 3.944l-1.176 1.176a2.74 2.74 0 0 1 .17 1.634l1.963-1.955c1.682-1.675 1.688-4.054-.007-5.75C12.389.225 10.01.238 8.335 1.913L5.956 4.298c-1.675 1.675-1.688 4.054.007 5.749.403.396.943.697 1.736.848Zm.6-5.763L7.27 6.178c.813.075 1.394.342 1.811.759 1.162 1.162 1.162 2.795.007 3.944l-2.27 2.27c-1.155 1.155-2.782 1.155-3.944 0-1.162-1.163-1.155-2.796 0-3.945L4.042 8.03a2.788 2.788 0 0 1-.17-1.634L1.915 8.352c-1.682 1.674-1.688 4.06.007 5.755 1.695 1.696 4.074 1.682 5.749.007l2.372-2.379c1.682-1.681 1.688-4.06-.007-5.749-.396-.403-.936-.704-1.736-.854Z"})))},ze={};!function(e,t){var n=200,r="__lodash_hash_undefined__",o=9007199254740991,i="[object Arguments]",a="[object Boolean]",s="[object Date]",l="[object Function]",c="[object GeneratorFunction]",d="[object Map]",u="[object Number]",f="[object Object]",p="[object Promise]",h="[object RegExp]",v="[object Set]",g="[object String]",y="[object Symbol]",m="[object WeakMap]",b="[object ArrayBuffer]",w="[object DataView]",_="[object Float32Array]",x="[object Float64Array]",O="[object Int8Array]",j="[object Int16Array]",E="[object Int32Array]",k="[object Uint8Array]",N="[object Uint8ClampedArray]",S="[object Uint16Array]",D="[object Uint32Array]",A=/\w*$/,C=/^\[object .+?Constructor\]$/,T=/^(?:0|[1-9]\d*)$/,L={};L[i]=L["[object Array]"]=L[b]=L[w]=L[a]=L[s]=L[_]=L[x]=L[O]=L[j]=L[E]=L[d]=L[u]=L[f]=L[h]=L[v]=L[g]=L[y]=L[k]=L[N]=L[S]=L[D]=!0,L["[object Error]"]=L[l]=L[m]=!1;var B="object"==typeof P&&P&&P.Object===Object&&P,M="object"==typeof self&&self&&self.Object===Object&&self,F=B||M||Function("return this")(),z=t&&!t.nodeType&&t,H=z&&e&&!e.nodeType&&e,I=H&&H.exports===z;function R(e,t){return e.set(t[0],t[1]),e}function W(e,t){return e.add(t),e}function V(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function U(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function $(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Z(e,t){return function(n){return e(t(n))}}function q(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var K=Array.prototype,G=Function.prototype,J=Object.prototype,X=F["__core-js_shared__"],Q=function(){var e=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Y=G.toString,ee=J.hasOwnProperty,te=J.toString,ne=RegExp("^"+Y.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=I?F.Buffer:void 0,oe=F.Symbol,ie=F.Uint8Array,ae=Z(Object.getPrototypeOf,Object),se=Object.create,le=J.propertyIsEnumerable,ce=K.splice,de=Object.getOwnPropertySymbols,ue=re?re.isBuffer:void 0,fe=Z(Object.keys,Object),pe=ze(F,"DataView"),he=ze(F,"Map"),ve=ze(F,"Promise"),ge=ze(F,"Set"),ye=ze(F,"WeakMap"),me=ze(Object,"create"),be=Ve(pe),we=Ve(he),_e=Ve(ve),xe=Ve(ge),Oe=Ve(ye),je=oe?oe.prototype:void 0,Ee=je?je.valueOf:void 0;function ke(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ne(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Se(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function De(e){this.__data__=new Ne(e)}function Pe(e,t){var n=$e(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ze(e)}(e)&&ee.call(e,"callee")&&(!le.call(e,"callee")||te.call(e)==i)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,o=!!r;for(var a in e)!t&&!ee.call(e,a)||o&&("length"==a||Re(a,r))||n.push(a);return n}function Ae(e,t,n){var r=e[t];ee.call(e,t)&&Ue(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Ce(e,t){for(var n=e.length;n--;)if(Ue(e[n][0],t))return n;return-1}function Te(e,t,n,r,o,p,m){var P;if(r&&(P=p?r(e,o,p,m):r(e)),void 0!==P)return P;if(!Ge(e))return e;var C=$e(e);if(C){if(P=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&ee.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,P)}else{var T=Ie(e),B=T==l||T==c;if(qe(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(T==f||T==i||B&&!p){if(U(e))return p?e:{};if(P=function(e){return"function"!=typeof e.constructor||We(e)?{}:(t=ae(e),Ge(t)?se(t):{});var t}(B?{}:e),!t)return function(e,t){return Me(e,He(e),t)}(e,function(e,t){return e&&Me(t,Je(t),e)}(P,e))}else{if(!L[T])return p?e:{};P=function(e,t,n,r){var o=e.constructor;switch(t){case b:return Be(e);case a:case s:return new o(+e);case w:return function(e,t){var n=t?Be(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case _:case x:case O:case j:case E:case k:case N:case S:case D:return function(e,t){var n=t?Be(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case d:return function(e,t,n){var r=t?n($(e),!0):$(e);return V(r,R,new e.constructor)}(e,r,n);case u:case g:return new o(e);case h:return function(e){var t=new e.constructor(e.source,A.exec(e));return t.lastIndex=e.lastIndex,t}(e);case v:return function(e,t,n){var r=t?n(q(e),!0):q(e);return V(r,W,new e.constructor)}(e,r,n);case y:return i=e,Ee?Object(Ee.call(i)):{}}var i}(e,T,Te,t)}}m||(m=new De);var M=m.get(e);if(M)return M;if(m.set(e,P),!C)var F=n?function(e){return function(e,t,n){var r=t(e);return $e(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Je,He)}(e):Je(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(F||e,(function(o,i){F&&(o=e[i=o]),Ae(P,i,Te(o,t,n,r,i,e,m))})),P}function Le(e){return!(!Ge(e)||(t=e,Q&&Q in t))&&(Ke(e)||U(e)?ne:C).test(Ve(e));var t}function Be(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Me(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var a=t[o],s=r?r(n[a],e[a],a,n,e):void 0;Ae(n,a,void 0===s?e[a]:s)}return n}function Fe(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function ze(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(n)?n:void 0}ke.prototype.clear=function(){this.__data__=me?me(null):{}},ke.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},ke.prototype.get=function(e){var t=this.__data__;if(me){var n=t[e];return n===r?void 0:n}return ee.call(t,e)?t[e]:void 0},ke.prototype.has=function(e){var t=this.__data__;return me?void 0!==t[e]:ee.call(t,e)},ke.prototype.set=function(e,t){return this.__data__[e]=me&&void 0===t?r:t,this},Ne.prototype.clear=function(){this.__data__=[]},Ne.prototype.delete=function(e){var t=this.__data__,n=Ce(t,e);return!(n<0)&&(n==t.length-1?t.pop():ce.call(t,n,1),!0)},Ne.prototype.get=function(e){var t=this.__data__,n=Ce(t,e);return n<0?void 0:t[n][1]},Ne.prototype.has=function(e){return Ce(this.__data__,e)>-1},Ne.prototype.set=function(e,t){var n=this.__data__,r=Ce(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Se.prototype.clear=function(){this.__data__={hash:new ke,map:new(he||Ne),string:new ke}},Se.prototype.delete=function(e){return Fe(this,e).delete(e)},Se.prototype.get=function(e){return Fe(this,e).get(e)},Se.prototype.has=function(e){return Fe(this,e).has(e)},Se.prototype.set=function(e,t){return Fe(this,e).set(e,t),this},De.prototype.clear=function(){this.__data__=new Ne},De.prototype.delete=function(e){return this.__data__.delete(e)},De.prototype.get=function(e){return this.__data__.get(e)},De.prototype.has=function(e){return this.__data__.has(e)},De.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ne){var o=r.__data__;if(!he||o.length<n-1)return o.push([e,t]),this;r=this.__data__=new Se(o)}return r.set(e,t),this};var He=de?Z(de,Object):function(){return[]},Ie=function(e){return te.call(e)};function Re(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||T.test(e))&&e>-1&&e%1==0&&e<t}function We(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||J)}function Ve(e){if(null!=e){try{return Y.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ue(e,t){return e===t||e!=e&&t!=t}(pe&&Ie(new pe(new ArrayBuffer(1)))!=w||he&&Ie(new he)!=d||ve&&Ie(ve.resolve())!=p||ge&&Ie(new ge)!=v||ye&&Ie(new ye)!=m)&&(Ie=function(e){var t=te.call(e),n=t==f?e.constructor:void 0,r=n?Ve(n):void 0;if(r)switch(r){case be:return w;case we:return d;case _e:return p;case xe:return v;case Oe:return m}return t});var $e=Array.isArray;function Ze(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}(e.length)&&!Ke(e)}var qe=ue||function(){return!1};function Ke(e){var t=Ge(e)?te.call(e):"";return t==l||t==c}function Ge(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Je(e){return Ze(e)?Pe(e):function(e){if(!We(e))return fe(e);var t=[];for(var n in Object(e))ee.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Te(e,!0,!0)}}({get exports(){return ze},set exports(e){ze=e}},ze);var He=ze;function Ie(e){return"function"==typeof window.structuredClone?window.structuredClone(e):He(e)}const Re={from:{path:null,element:null,parent:null},to:{path:null,element:null,parent:null}};let We,Ve,Ue=(e=21)=>{var t;t=e-=0,!We||We.length<t?(We=Buffer.allocUnsafe(128*t),N(We),Ve=0):Ve+t>We.length&&(N(We),Ve=0),Ve+=t;let n="";for(let t=Ve-e;t<Ve;t++)n+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&We[t]];return n};const $e=()=>Ue();var Ze=!1;if("undefined"!=typeof window){var qe={get passive(){Ze=!0}};window.addEventListener("testPassive",null,qe),window.removeEventListener("testPassive",null,qe)}var Ke="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),Ge=[],Je=!1,Xe=-1,Qe=void 0,Ye=void 0,et=void 0,tt=function(e){return Ge.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},nt=function(e){var t=e||window.event;return!!tt(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},rt=function(e,t){if(e){if(!Ge.some((function(t){return t.targetElement===e}))){var n={targetElement:e,options:t||{}};Ge=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(Ge),[n]),Ke?window.requestAnimationFrame((function(){if(void 0===Ye){Ye={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,n=e.scrollX,r=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-t,document.body.style.left=-n,setTimeout((function(){return window.requestAnimationFrame((function(){var e=r-window.innerHeight;e&&t>=r&&(document.body.style.top=-(t+e))}))}),300)}})):function(e){if(void 0===et){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var r=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);et=document.body.style.paddingRight,document.body.style.paddingRight=r+n+"px"}}void 0===Qe&&(Qe=document.body.style.overflow,document.body.style.overflow="hidden")}(t),Ke&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(Xe=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var n=e.targetTouches[0].clientY-Xe;!tt(e.target)&&(t&&0===t.scrollTop&&n>0||function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&n<0?nt(e):e.stopPropagation())}(t,e)},Je||(document.addEventListener("touchmove",nt,Ze?{passive:!1}:void 0),Je=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},ot=function(e){e?(Ge=Ge.filter((function(t){return t.targetElement!==e})),Ke&&(e.ontouchstart=null,e.ontouchmove=null,Je&&0===Ge.length&&(document.removeEventListener("touchmove",nt,Ze?{passive:!1}:void 0),Je=!1)),Ke?function(){if(void 0!==Ye){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=Ye.position,document.body.style.top=Ye.top,document.body.style.left=Ye.left,window.scrollTo(t,e),Ye=void 0}}():(void 0!==et&&(document.body.style.paddingRight=et,et=void 0),void 0!==Qe&&(document.body.style.overflow=Qe,Qe=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")},it=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},at={"text/plain":"Text","text/html":"Url",default:"Text"},st="Copy to clipboard: #{key}, Enter";var lt=function(e,t){var n,r,o,i,a,s,l=!1;t||(t={}),n=t.debug||!1;try{if(o=it(),i=document.createRange(),a=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=at[t.format]||at.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(s),i.selectNodeContents(s),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");l=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),l=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:st),window.prompt(r,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),s&&document.body.removeChild(s),o()}return l};const ct=e=>({id:e,type:"paragraph",nodeType:"block",children:[{text:""}]});function dt(e,t,n=!1){n&&Object.keys(m.marks(e)||{}).forEach((t=>{m.removeMark(e,t)})),!function(e,t){const n=m.marks(e);return!!(null==n?void 0:n[t])}(e,t)?m.addMark(e,t,!0):m.removeMark(e,t)}const ut={hoveredElement:null,isElementOptionsOpen:!1,nodeSettingsPos:null,dndState:Re,disableWhileDrag:!1,DRAG_MAP:new Map},ft=r.createContext([ut,{openNodeSettings:(e,t)=>{},closeNodeSettings:()=>{},hoverIn:(e,t)=>{},triggerPlusButton:e=>{},deleteNode:()=>{},duplicateNode:()=>{},copyLinkNode:()=>{},onDrop:e=>{},onDragEnd:e=>{},onDragEnter:e=>{},onDragStart:e=>{},changeHoveredNode:e=>{}}]),pt=({children:e})=>{const n=p(),[r,i]=(e=>{const[t,n]=o(!1),[r,i]=o(Re),[a]=o((()=>new Map)),s=t=>{var n;t.preventDefault(),t.stopPropagation();const r=t.target.closest("[data-element-id]");if(r){const{elementId:t,elementType:o}=r.dataset;if(!t||!o)return;const s=a.get(t);if(null===(n=s.data)||void 0===n?void 0:n.skipDrag)return;const l=f.findPath(e,s);i((e=>({from:e.from,to:{path:l,element:{id:t,type:o},parent:null}})))}};return[{dndState:r,disableWhileDrag:t,DRAG_MAP:a},{onDrop:t=>{try{m.withoutNormalizing(e,(()=>{var n,o;if(t.preventDefault(),t.stopPropagation(),(null===(n=r.from.element)||void 0===n?void 0:n.id)===(null===(o=r.to.element)||void 0===o?void 0:o.id))return;const i=r.from.path,s=a.get(r.to.element.id);let l=f.findPath(e,s);if(!i||!l)return;const[c,d]=m.node(e,i),[u,p]=m.parent(e,d);if(console.log("fromPath",i),console.log("fromElementPath",d),console.log("toPath",l),console.log("toPath next",b.next(l)),console.log("fromElementNode",c),console.log("parentElementNode",u),l.length>1){const t=Ie(c);l.length>i.length?(w.insertNodes(e,t,{at:l.length===i.length?l:b.next(l),match:e=>_.isElement(e),mode:"lowest"}),w.removeNodes(e,{at:i,match:e=>_.isElement(e)&&e.id===(null==t?void 0:t.id),mode:"lowest"})):(w.removeNodes(e,{at:i,match:e=>_.isElement(e)&&e.id===(null==t?void 0:t.id),mode:"lowest"}),w.insertNodes(e,t,{at:l.length===i.length?l:b.next(l),match:e=>_.isElement(e),mode:"lowest"})),1===u.children.length&&_.isElement(u.children[0])&&w.removeNodes(e,{at:p,match:e=>_.isElement(e)&&u.id===e.id,mode:"lowest"})}else w.moveNodes(e,{at:i,to:l,match:e=>_.isElement(e)&&_.isElement(c)&&c.type===e.type,mode:"lowest"});t.dataTransfer.clearData(),a.clear()}))}catch(e){console.error(e)}},onDragEnd:e=>{e.stopPropagation(),e.target.removeAttribute("draggable"),e.target.ondragstart=null,e.target.ondragend=null,e.target.ondragenter=null,e.target.ondragover=null,n(!1),i(Re)},onDragEnter:s,onDragStart:(e,t)=>{n(!0),e.dataTransfer.setData("Text",""),e.dataTransfer.effectAllowed="move";const r=document.getElementById("yoopta-contenteditable");r&&(r.ondragenter=e=>s(e),r.ondragover=e=>(e.stopPropagation(),e.preventDefault(),!1),i((e=>({to:e.to,from:t}))))}}]})(n),[a,l]=o(null),[c,d]=o((()=>(({children:e})=>{if(1===e.length)return e[0];return null})(n))),[u,h]=o(!1),v=Object.assign({hoveredElement:c,isElementOptionsOpen:u,nodeSettingsPos:a},r),g=s((()=>Object.assign({hoverIn:(e,t)=>{var n;if(u)return e.preventDefault();(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.skipSettings)||d(t)},changeHoveredNode:e=>d(e),triggerPlusButton:e=>{m.withoutNormalizing(n,(()=>{if(!n.selection||!e)return;const t=f.findPath(n,e),r=b.next([t[0]]),o=ct($e());w.insertNodes(n,o,{at:r,select:!0}),d(o)}))},openNodeSettings:(e,t)=>{rt(document.body,{reserveScrollBarGap:!0}),h(!0);let r=f.findPath(n,t).concat(0);if(_.isElement(null==t?void 0:t.children[0])&&(r=r.concat(0)),w.select(n,{path:r,offset:0}),d(t),e.current){const t=e.current.getBoundingClientRect();l({left:t.left+t.width+10,top:t.top})}},closeNodeSettings:()=>{ot(document.body),h(!1),l(null)},deleteNode:()=>{if(c)try{m.withoutNormalizing(n,(()=>{var e;const t=f.findPath(n,c),[r,o]=m.parent(n,t);if(!t)return;let i="highest";if(_.isElement(r)){if(1===r.children.length&&_.isElement(r.children[0]))return w.removeNodes(n,{at:o,match:e=>_.isElement(e)&&e.id===r.id,mode:"highest"}),d(null),void g.closeNodeSettings();(null===(e=r.data)||void 0===e?void 0:e.depth)>0&&(i="lowest")}w.removeNodes(n,{at:t,match:e=>_.isElement(e),mode:i}),d(null),g.closeNodeSettings()}))}catch(e){console.log({error:e})}},duplicateNode:()=>{m.withoutNormalizing(n,(()=>{if(!c)return;const e=f.findPath(n,c),t=b.next(e),r=Ie(c);r.id=$e(),w.insertNodes(n,r,{at:t,match:e=>_.isElement(e),mode:"highest",select:!0}),f.focus(n),d(null),g.closeNodeSettings()}))},copyLinkNode:()=>{0===window.location.hash.length?lt(`${window.location.href}#${null==c?void 0:c.id}`):lt(`${window.location.href.split("#")[0]}#${null==c?void 0:c.id}`),g.closeNodeSettings()}},i)),[c,u,r,n.children]),y=s((()=>[v,g]),[c,u,r,n.selection,n.children]);return t(ft.Provider,Object.assign({value:y},{children:e}))},ht=()=>a(ft),vt=r.createContext({marks:{},elements:{}}),gt=({children:e,plugins:n,marks:o,tools:i})=>{const a=p(),l=s((()=>{const e={};return n.forEach((t=>{const{createElement:n,defineElement:r,type:o}=t;e[t.type]={create:n,define:r,toggle:e=>((e,t)=>{m.withoutNormalizing(a,(()=>{var n;if(!a.selection)return;const{offset:r,path:o}=a.selection.anchor,{shouldDeleteText:i}=t||{};i&&w.delete(a,{at:{anchor:{path:o,offset:0},focus:{path:o,offset:r}}});const s=m.above(a,{at:a.selection,mode:"highest",match:e=>!m.isEditor(e)&&_.isElement(e)}),[l,c]=m.parent(a,b.parent(a.selection.anchor.path)),[d]=s||[];(null==d?void 0:d.type)!==e.type?(_.isElement(l)&&!m.isEditor(l)&&w.unwrapNodes(a,{at:c,match:e=>!m.isEditor(e)&&!x.isText(e)&&_.isElement(l)&&e.type===l.type}),null===(n=e.createElement)||void 0===n||n.call(e,a)):w.setNodes(a,ct($e()),{mode:"highest",match:e=>!m.isEditor(e)&&_.isElement(e)})}))})(t,e),type:o}})),e}),[n,a.selection,i]),c=e=>{const t=m.marks(a);return!!(null==t?void 0:t[e])},d=s((()=>{const e={};return null==o||o.forEach((t=>{e[t.type]={toggle:e=>((e,t=!1)=>{t&&Object.keys(m.marks(a)||{}).forEach((e=>{m.removeMark(a,e)})),c(e)?m.removeMark(a,e):m.addMark(a,e,!0)})(t.type,null==e?void 0:e.only),isActive:c(t.type)}})),e}),[o,a.selection]),u=s((()=>{const e=Object.keys(i||{});if(0===e.length)return;const t={};return e.forEach((e=>{const o=null==i?void 0:i[e];o&&r.isValidElement(o)&&(t[e]=e=>{var{style:t,className:i}=e,a=S(e,["style","className"]);return r.cloneElement(o,Object.assign(Object.assign({style:t,className:i,plugins:n},a),null==o?void 0:o.props))})})),t}),[i,a.selection]),f=s((()=>({elements:l,marks:d,tools:u})),[a.selection,d,l]);return t(vt.Provider,Object.assign({value:f},{children:e}))},yt=()=>a(vt),mt=()=>a(vt).marks,bt=()=>a(vt).elements,wt=()=>a(vt).tools;var _t="IMJgzRnZ",xt="nFfAiJWo",Ot="DeARgIyF",jt="kyuzONcU",Et="_95up7F66",kt="_9d0T-cEo";xe(".IMJgzRnZ{align-items:center;background:#fff;border-radius:4px;box-shadow:0 0 0 1px hsla(0,0%,6%,.05),0 3px 6px hsla(0,0%,6%,.1),0 9px 24px hsla(0,0%,6%,.2);display:flex;flex-direction:column;height:auto;max-height:70vh;max-width:calc(100vw - 24px);min-width:200px;opacity:1;overflow:hidden;position:fixed;transform-origin:0 top;width:auto}.nFfAiJWo{flex-grow:1;margin-bottom:0;margin-right:0;min-height:0;overflow:hidden auto;position:relative;transform:translateZ(0);width:100%;z-index:1}.DeARgIyF{box-shadow:0 -1px 0 rgba(55,53,47,.09);padding-bottom:6px;padding-top:6px}.kyuzONcU{align-items:center;background:inherit;border:none;border-radius:3px;color:#000;cursor:pointer;display:flex;font-size:14px;line-height:120%;margin-left:4px;margin-right:4px;min-height:28px;transition:background 20ms ease-in 0s;user-select:none;width:calc(100% - 8px)}.kyuzONcU:hover{background-color:rgba(55,53,47,.08);color:#000}._95up7F66{align-items:center;color:#000;display:flex;justify-content:center;margin-left:10px;margin-right:4px}._9d0T-cEo{flex:1 1 auto;margin-left:6px;margin-right:6px;overflow:hidden;text-align:left;text-overflow:ellipsis}._5FdNFUNm,._9d0T-cEo{min-width:0;white-space:nowrap}._5FdNFUNm{color:rgba(55,53,47,.5);flex-shrink:0;font-size:12px;margin-left:auto;margin-right:12px}");const Nt={position:"fixed",opacity:1,bottom:"auto",right:"auto"},St=n=>{var{onClose:r,style:i,element:a,render:s}=n,c=S(n,["onClose","style","element","render"]);o({style:Nt,open:!1});const d=l(null),u=p();wt();const[,f]=ht();m.isVoid(u,a);return t(Se,Object.assign({onClose:r},{children:t("div",Object.assign({style:i,className:_e(_t,"yoopta-element-options"),ref:d},{children:t("div",Object.assign({className:xt},{children:e("div",Object.assign({className:Ot},{children:[e("button",Object.assign({type:"button",className:jt,onClick:()=>{var e;f.deleteNode(),null===(e=c.onDelete)||void 0===e||e.call(c)}},{children:[t("div",Object.assign({className:Et},{children:t(Ce,{})})),t("div",Object.assign({className:kt},{children:"Delete"}))]})),e("button",Object.assign({type:"button",className:jt,onClick:()=>{var e;f.duplicateNode(),null===(e=c.onDuplicate)||void 0===e||e.call(c)}},{children:[t("div",Object.assign({className:Et},{children:t(Be,{})})),t("div",Object.assign({className:kt},{children:"Duplicate"}))]})),e("button",Object.assign({type:"button",className:jt,onClick:()=>{var e;f.copyLinkNode(),null===(e=c.onCopy)||void 0===e||e.call(c)}},{children:[t("div",Object.assign({className:Et},{children:t(Fe,{})})),t("div",Object.assign({className:kt},{children:"Copy link to block"}))]}))]}))}))}))}))};var Dt={};Object.defineProperty(Dt,"__esModule",{value:!0});for(var Pt="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),At={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Ct={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Pt?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Tt={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},Lt=1;Lt<20;Lt++)Tt["f"+Lt]=111+Lt;function Bt(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map((function(e){return Mt(e,t)})),o=function(e){return r.some((function(t){return Ft(t,e)}))};return null==n?o:o(n)}function Mt(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var a in At)r[At[a]]=!1;var s=!0,l=!1,c=void 0;try{for(var d,u=o[Symbol.iterator]();!(s=(d=u.next()).done);s=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Ht(f),v=At[h];if(f.length>1&&!v&&!Ct[f]&&!Tt[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&v||(n?r.key=h:r.which=zt(f)),v&&(r[v]=!p||null)}}catch(e){l=!0,c=e}finally{try{!s&&u.return&&u.return()}finally{if(l)throw c}}return r}function Ft(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&((null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r))return!1}return!0}function zt(e){return e=Ht(e),Tt[e]||e.toUpperCase().charCodeAt(0)}function Ht(e){return e=e.toLowerCase(),e=Ct[e]||e}Dt.default=Bt;var It=Dt.isHotkey=Bt,Rt=Dt.isCodeHotkey=function(e,t){return Bt(e,t)},Wt=Dt.isKeyHotkey=function(e,t){return Bt(e,{byKey:!0},t)};Dt.parseHotkey=Mt,Dt.compareHotkey=Ft,Dt.toKeyCode=zt,Dt.toKeyName=Ht;const Vt=({children:e,fallback:t=null})=>{const[n,r]=o(!1);return i((()=>r(!0)),[]),n?e:t};
|
|
8
8
|
/*!
|
|
9
9
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
12
12
|
* Released under the MIT License.
|
|
13
|
-
*/function Ft(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ht(e){var t,n;return!1!==Ft(e)&&(void 0===(t=e.constructor)||!1!==Ft(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var zt={isHistory:e=>Ht(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||x.isOperationList(e.redos[0]))&&(0===e.undos.length||x.isOperationList(e.undos[0]))},It=new WeakMap,Rt=new WeakMap,Wt={isHistoryEditor:e=>zt.isHistory(e.history)&&m.isEditor(e),isMerging:e=>Rt.get(e),isSaving:e=>It.get(e),redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Wt.isMerging(e);Rt.set(e,!1),t(),Rt.set(e,n)},withoutSaving(e,t){var n=Wt.isSaving(e);It.set(e,!1),t(),It.set(e,n)}},Ut=(e,t)=>"set_selection"===e.type||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!b.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!b.equals(e.path,t.path))),Vt=(e,t)=>"set_selection"!==e.type||null!=e.properties&&null!=e.newProperties,Zt=(e,t)=>!(!t||"set_selection"!==e.type||"set_selection"!==t.type),$t=e=>"set_selection"!==e.type;function qt(e){return!!Array.isArray(e)&&0!==e.length}const Kt="yoopta-content";var Gt="u-OdDyDx";xe(".u-OdDyDx:after{color:#aaa;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);user-select:none}");const Jt={margin:"1px 0",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"inherit",fontSize:"inherit",lineHeight:"inherit",fontWeight:"inherit"},Xt=l((({attributes:e,children:n,placeholder:r,leaf:o})=>{const i=h();return t("span",Object.assign({},e,{"data-placeholder":r,style:Jt,className:_e({[Gt]:o.withPlaceholder&&r&&i})},{children:n}))}));Xt.displayName="TextLeaf";var Qt;function Yt(){return Yt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yt.apply(this,arguments)}var en,tn=function(e){return n.createElement("svg",Yt({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),Qt||(Qt=n.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function nn(){return nn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nn.apply(this,arguments)}var rn=function(e){return n.createElement("svg",nn({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),en||(en=n.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))},on="yCQ-VdE5",an="b--398nS",sn="_6VhqH6wy",ln="k9i48GWd",cn="TNeDy6y5",dn="jVfkavqE",un="_87oFW01f";xe('.yCQ-VdE5{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition:opacity .18s ease-in}.b--398nS{opacity:1}._6VhqH6wy{all:unset;align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;color:rgba(55,53,47,.35);cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition:background-color .18s cubic-bezier(.4,0,.2,1);width:auto;width:18px}._6VhqH6wy:active,._6VhqH6wy:focus,._6VhqH6wy:hover{background-color:rgba(55,54,47,.08)}.k9i48GWd{width:24px}.TNeDy6y5{position:relative;transition:opacity .18s cubic-bezier(.4,0,.2,1)}.jVfkavqE:after{background-color:#007aff;bottom:-7px;content:"";height:3px;left:50%;position:absolute;transform:translateX(-50%);width:100%}._87oFW01f:before{top:-5px}._87oFW01f:after,._87oFW01f:before{background-color:inherit;content:"";height:3px;left:50%;position:absolute;transform:translateX(-50%);width:100%}._87oFW01f:after{bottom:-7px}');const fn=({element:n,editor:r,values:o,handlers:i})=>{const a=c(null),{hoveredElement:s,isElementOptionsOpen:l,nodeSettingsPos:d}=o,{onDragEnd:u,onDragStart:p,openNodeSettings:h,closeNodeSettings:v,triggerPlusButton:g}=i,y=e=>{e.stopPropagation();const t=a.current,o=document.querySelector(`[data-element-id="${null==n?void 0:n.id}"]`),i=f.findPath(r,n),s=m.parent(r,i);_.isElement(n)&&(null==t||t.setAttribute("draggable","false"),o&&(o.setAttribute("draggable","true"),o.ondragstart=e=>{const t={path:i,element:{id:n.id,type:n.type},parent:s};p(e,t)},o.ondragend=u))},b=(null==s?void 0:s.id)===n.id;return e("div",Object.assign({contentEditable:!1,className:_e(on,{[an]:b},"yoopta-element-actions")},{children:[b&&l&&t(_t,{element:n,style:d||void 0,onClose:v}),t("button",Object.assign({type:"button",onMouseDown:y,className:_e(sn,ln,"yoopta-element-actions-plus"),onClick:()=>g(n)},{children:t(rn,{})})),t("button",Object.assign({type:"button",onMouseDown:y,className:_e(sn,"yoopta-element-actions-drag"),onClick:()=>h(a,n),ref:a},{children:t(tn,{})}))]}))},pn=({children:n,element:r,attributes:o,nodeType:i,render:a,HTMLAttributes:l})=>{var c;const d=p(),[u,f]=ht(),h="inline"===i,{hoverIn:v,onDrop:g}=f,{dndState:y,DRAG_MAP:m}=u,b=s((()=>{var e,t;if(null===y.from.element||null===y.to.element)return{isDragging:!1,isDragOver:!1,isDragSelf:!1};const n=(null===(e=u.dndState.from.element)||void 0===e?void 0:e.id)===r.id,o=(null===(t=u.dndState.to.element)||void 0===t?void 0:t.id)===r.id;return{isDragging:n,isDragOver:o,isDragSelf:n&&o}}),[u.dndState.from,u.dndState.to]),w=null===(c=r.data)||void 0===c?void 0:c.skipSettings,{isDragging:_,isDragOver:x,isDragSelf:O}=b,j={opacity:_?.7:1};return m.set(r.id,r),h?a({attributes:o,element:r,children:n,HTMLAttributes:l}):e("div",Object.assign({"data-element-id":r.id,"data-element-type":r.type,onMouseEnter:e=>{w||v(e,r)},onDrop:g,className:_e(cn,{[dn]:x,[un]:O}),style:j},o,{children:[w?null:t(fn,{editor:d,element:r,handlers:f,values:u}),a({attributes:o,element:r,children:n,HTMLAttributes:l})]}))};pn.displayName="ElementWrapper";const hn={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",kekCeburek:"mod+enter"},vn={moveLineBackward:"opt+up",moveLineForward:"opt+down",ctrlLeft:"opt+left",ctrlRight:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},gn={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},yn=e=>{const t=hn[e],n=vn[e],r=gn[e],o=t&&Bt(t),i=n&&Bt(n),a=r&&Bt(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},mn={isBold:yn("bold"),isCompose:yn("compose"),isArrowLeft:yn("arrowLeft"),isArrowRight:yn("arrowRight"),isArrowUp:yn("arrowUp"),isArrowDown:yn("arrowDown"),isDeleteBackward:yn("deleteBackward"),isDeleteForward:yn("deleteForward"),isDeleteLineBackward:yn("deleteLineBackward"),isDeleteLineForward:yn("deleteLineForward"),isDeleteWordBackward:yn("deleteWordBackward"),isDeleteWordForward:yn("deleteWordForward"),isExtendBackward:yn("extendBackward"),isExtendForward:yn("extendForward"),isExtendLineBackward:yn("extendLineBackward"),isExtendLineForward:yn("extendLineForward"),isItalic:yn("italic"),isMoveLineBackward:yn("moveLineBackward"),isMoveLineForward:yn("moveLineForward"),isCtrlLeft:yn("ctrlLeft"),isCtrlRight:yn("ctrlRight"),isRedo:yn("redo"),isShiftEnter:yn("shiftEnter"),isEnter:yn("enter"),isTransposeCharacter:yn("transposeCharacter"),isUndo:yn("undo"),isSpace:yn("space"),isSelect:yn("select"),isTab:yn("tab"),isShiftTab:yn("shiftTab"),isBackspace:yn("backspace"),isCmdEnter:yn("cmdEnter"),isCmd:yn("cmd"),isEscape:yn("escape"),isKekceburek:yn("kekCeburek")},bn=(e,t)=>!!((e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(m.nodes(e,{at:m.unhangRange(e,n),match:e=>!m.isEditor(e)&&_.isElement(e)&&e.type===t}));return r})(e,t),wn=(e,t,n="lowest")=>{var r;const o=Array.from(m.nodes(e,{match:t=>m.isEditor(e)&&_.isElement(t),at:t||(null===(r=e.selection)||void 0===r?void 0:r.anchor.path),mode:n}))[0];return o?o[0]:e.children[0]};function _n(e,t){var n,r;if(O.isText(e))return function(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,(e=>t[e]))}(e.text);const o=e.children.map((e=>_n(e,t))).join(""),i=t[e.type];return"function"==typeof(null===(r=null===(n=i.exports)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize)?i.exports.html.serialize(e,o):o}function xn(e,t){return e.map((e=>_n(e,t))).join("")}const On={hotkeys:mn,defaultNode:ct(Ze())},jn=({editor:n,placeholder:o,marks:a,readOnly:l,plugins:u,className:p,PLUGINS_MAP:h,tools:g})=>{i((()=>{const e=window.location.hash.length>0?window.location.hash.replace("#",""):null;if(e){const t=document.getElementById(e)||document.querySelector(`[data-element-id="${e}"]`);t&&window.scrollTo({top:t.offsetTop,behavior:"smooth"})}}),[]);const y=c(null),[{disableWhileDrag:x},{changeHoveredNode:O}]=ht(),E=x||l,k=s((()=>e=>{var r;const o=h[e.element.type];if(!o)return null;const i=function(e){return"function"==typeof e.renderer?e.renderer:e.renderer.editor}(o)(n,o);return t(pn,Object.assign({element:e.element,attributes:e.attributes,nodeType:e.element.nodeType,render:i,HTMLAttributes:null===(r=o.options)||void 0===r?void 0:r.HTMLAttributes},{children:e.children}))}),[u,n]),N=s((()=>e=>{const t=[],[r,o]=e;return u.forEach((o=>{const i=o.decorator;"function"==typeof i&&_.isElement(r)&&r.type===o.type&&t.push(...i(n)(e))})),n.selection&&!m.isEditor(r)&&""===m.string(n,[o[0]])&&j.includes(n.selection,o)&&j.isCollapsed(n.selection)&&t.push(Object.assign(Object.assign({},n.selection),{withPlaceholder:!0})),t}),[u,n]),S=s((()=>e=>{var r;const i=Object.assign({},e);let s;u.forEach((e=>{if(e.leaf){const t=e.leaf(n)(i);t&&(i.children=t)}})),null==a||a.forEach((e=>{i.leaf[e.type]&&(i.children=e.render(i))}));const l=null===(r=i.children.props)||void 0===r?void 0:r.parent;if(!function(e){var t,n;return 1!==(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.length)||0!==(null===(n=null==e?void 0:e.children[0])||void 0===n?void 0:n.text.length)}(l)){const e=h[null==l?void 0:l.type];s=null===(null==e?void 0:e.placeholder)?null:(null==e?void 0:e.placeholder)||o}return t(Xt,Object.assign({},i,{placeholder:s}))}),[u,n]),D=s((()=>{const e=u.map((e=>Object.keys(e.events||{}))).flat().filter(((e,t,n)=>n.indexOf(e)===t)),t={};return e.forEach((e=>{t[e]=function(t){u.forEach((r=>{var o;if(null===(o=r.events)||void 0===o?void 0:o[e]){r.events[e](n,On)(t)}}))}})),t}),[u,n]),P=d((e=>{m.withoutNormalizing(n,(()=>{var t;if(!n.selection)return;const r=ct(Ze());null==a||a.forEach((t=>{t.hotkey&&Bt(t.hotkey)(e)&&(e.preventDefault(),dt(n,t.type,!1))})),null===(t=D.onKeyDown)||void 0===t||t.call(D,e);const o=m.above(n,{match:e=>!m.isEditor(e),mode:"lowest"});if(mn.isEnter(e)){if(e.isDefaultPrevented())return;e.preventDefault();const t=Object.keys(m.marks(n)||{});t.length>0&&t.forEach((e=>m.removeMark(n,e)));const i=b.parent(n.selection.anchor.path),a=m.string(n,i),s=o&&o[0].type!==r.type;if(s&&0===a.length)return void w.setNodes(n,r,{at:i});if(m.isStart(n,n.selection.anchor,n.selection.anchor.path)&&s){const[e]=o;return w.setNodes(n,r,{at:i}),w.delete(n,{unit:"block"}),w.insertNodes(n,Ie(e),{at:b.next(i)}),void w.select(n,{path:[b.next(n.selection.anchor.path)[0]+1,0],offset:0})}return w.splitNodes(n,{always:!0}),w.setNodes(n,r),void O(r)}if(mn.isShiftEnter(e)){if(e.isDefaultPrevented())return;e.preventDefault(),n.insertText("\n")}if(mn.isSelect(e)){if(e.isDefaultPrevented())return;e.preventDefault();const t=m.above(n,{at:n.selection.anchor.path,match:e=>!m.isEditor(e)&&_.isElement(e)});if(!t)return;const r=m.string(n,t[1]);return j.isExpanded(n.selection)||0===r.length?void w.select(n,[]):void w.select(n,t[1])}}))}),[]),C=s((()=>{if(!g)return null;return Object.keys(g).length>0?Object.keys(g).map((e=>{const t=g[e];return r.isValidElement(g[e])?r.cloneElement(t,Object.assign({key:e,plugins:u},null==t?void 0:t.props)):null})):null}),[g]);return e("div",Object.assign({id:"yoopta-editor",className:p,ref:y,onMouseDown:e=>{l||(e.preventDefault(),e.currentTarget===e.target&&n.selection&&m.withoutNormalizing(n,(()=>{const e=[n.children.length-1,0],t=wn(n,e,"highest"),r=m.string(n,e),o={anchor:{path:e,offset:0},focus:{path:e,offset:0}};if("paragraph"===t.type&&0===r.length)return w.select(n,{path:o.anchor.path,offset:0}),O(t),f.focus(n);const i=ct(Ze());O(i),w.insertNodes(n,i,{at:[n.children.length],select:!0}),f.focus(n)})))}},{children:[C,t(v,Object.assign({id:"yoopta-contenteditable",renderLeaf:S,renderElement:k,readOnly:E,decorate:N,onCopy:e=>{if(e.preventDefault(),!n.selection)return;const t=xn(m.fragment(n,n.selection),n.plugins);return e.clipboardData.setData("text/html",t),e.clipboardData},autoFocus:!0,spellCheck:!0},D,{onKeyDown:P,onMouseDown:e=>{var t;null===(t=D.onMouseDown)||void 0===t||t.call(D,e),(e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()})(e)}}))]}))};function En(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var kn=new WeakMap,Nn=new WeakMap;class Sn{}class Dn extends Sn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}class Pn extends Sn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}var Cn=e=>Nn.get(e);function An(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 Tn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?An(Object(n),!0).forEach((function(t){En(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):An(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ln=new WeakSet,Bn=e=>{var t=[],n=e=>{if(null!=e){var r=t[t.length-1];if("string"==typeof e){var o={text:e};Ln.add(o),e=o}if(O.isText(e)){var i=e;O.isText(r)&&Ln.has(r)&&Ln.has(i)&&O.equals(r,i,{loose:!0})?r.text+=i.text:t.push(i)}else if(_.isElement(e))t.push(e);else{if(!(e instanceof Sn))throw new Error("Unexpected hyperscript child object: ".concat(e));var a=t[t.length-1];O.isText(a)||(n(""),a=t[t.length-1]),e instanceof Dn?((e,t)=>{var n=e.text.length;kn.set(e,[n,t])})(a,e):e instanceof Pn&&((e,t)=>{var n=e.text.length;Nn.set(e,[n,t])})(a,e)}}};for(var r of e.flat(1/0))n(r);return t};function Mn(e,t,n){return Tn(Tn({},t),{},{children:Bn(n)})}function Fn(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 Hn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fn(Object(n),!0).forEach((function(t){En(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var zn,In={anchor:function(e,t,n){return new Dn(t)},cursor:function(e,t,n){return[new Dn(t),new Pn(t)]},editor:(zn=k,(e,t,n)=>{var r,o=[];for(var i of n)j.isRange(i)?r=i:o.push(i);var a,s=Bn(o),l={},c=zn();for(var[d,u]of(Object.assign(c,t),c.children=s,E.texts(c))){var f=(a=d,kn.get(a)),p=Cn(d);if(null!=f){var[h]=f;l.anchor={path:u,offset:h}}if(null!=p){var[v]=p;l.focus={path:u,offset:v}}}if(l.anchor&&!l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!l.anchor&&l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");return null!=r?c.selection=r:j.isRange(l)&&(c.selection=l),c}),element:Mn,focus:function(e,t,n){return new Pn(t)},fragment:function(e,t,n){return Bn(n)},selection:function(e,t,n){var r=n.find((e=>e instanceof Dn)),o=n.find((e=>e instanceof Pn));if(!r||null==r.offset||null==r.path)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!o||null==o.offset||null==o.path)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return Tn({anchor:{offset:r.offset,path:r.path},focus:{offset:o.offset,path:o.path}},t)},text:function(e,t,n){var r=Bn(n);if(r.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var[o]=r;if(null==o&&(o={text:""}),!O.isText(o))throw new Error("\n The <text> hyperscript tag can only contain text content as children.");return Ln.delete(o),Object.assign(o,t),o}},Rn=e=>function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=e[t];if(!a)throw new Error("No hyperscript creator found for tag: <".concat(t,">"));return null==n&&(n={}),Ht(n)||(o=[n].concat(o),n={}),a(t,n,o=o.filter((e=>Boolean(e))).flat())},Wn=e=>{var t={},n=function(n){var r=e[n];if("object"!=typeof r)throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(n,"> tag you passed: ").concat(r));t[n]=(e,t,n)=>Mn(0,Hn(Hn({},r),t),n)};for(var r in e)n(r);return t},Un=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elements:t={}}=e,n=Wn(t),r=Hn(Hn(Hn({},In),n),e.creators);return Rn(r)}();const Vn={DEL:()=>({strikethrough:!0}),EM:()=>({italic:!0}),I:()=>({italic:!0}),S:()=>({strikethrough:!0}),STRONG:()=>({bold:!0}),U:()=>({underline:!0})},Zn=(e,t)=>{var n,r,o,i;if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;if("BR"===e.nodeName)return"\n";const{nodeName:a}=e;let s=e,l=Array.from(s.childNodes).map((e=>Zn(e,t))).flat();if(0===l.length&&(l=[{text:""}]),"BODY"===e.nodeName)return Un("fragment",{},l);if(t[a]){const s=t[a];if(s){let t=s.defineElement();if("function"==typeof(null===(r=null===(n=s.exports)||void 0===n?void 0:n.html.deserialize)||void 0===r?void 0:r.parse)){const n=null===(i=null===(o=s.exports)||void 0===o?void 0:o.html.deserialize)||void 0===i?void 0:i.parse(e);t=Object.assign(Object.assign({},t),{data:n})}return Un("element",t,l)}}if(O.isTextList(l))return Un("element",t.P.defineElement(),l);if(Vn[a]){const t=Vn[a](e);return l.map((e=>O.isText(e)?Un("text",t,e):e))}return l};function $n(e,t){const n=function(e){const t={};return Object.keys(e).forEach((n=>{var r,o,i,a,s,l,c,d;const u=e[n];if(null===(o=null===(r=u.exports)||void 0===r?void 0:r.html.deserialize)||void 0===o?void 0:o.nodeName){if(Array.isArray(null===(a=null===(i=u.exports)||void 0===i?void 0:i.html.deserialize)||void 0===a?void 0:a.nodeName))return void(null===(l=null===(s=u.exports)||void 0===s?void 0:s.html.deserialize)||void 0===l||l.nodeName.forEach((e=>{t[e]=u})));t[null===(d=null===(c=u.exports)||void 0===c?void 0:c.html.deserialize)||void 0===d?void 0:d.nodeName]=u}})),t}(t),r=(new DOMParser).parseFromString(e,"text/html");return Zn(r.body,n)}const qn=r.createContext({marks:{},elements:{},tools:{}}),Kn=({children:e,plugins:n,marks:r,tools:o})=>{const i=p(),a=s((()=>{const e=me(n),t={};return e.forEach((e=>{const{createElement:n,defineElement:r,type:o,hasParent:a}=e;a||(t[e.type]={create:n,define:r,toggle:t=>((e,t)=>{m.withoutNormalizing(i,(()=>{var n;if(!i.selection)return;const{offset:r,path:o}=i.selection.anchor,{shouldDeleteText:a}=t||{};a&&w.delete(i,{at:{anchor:{path:o,offset:0},focus:{path:o,offset:r}}});const s=m.above(i,{at:i.selection,mode:"highest",match:e=>!m.isEditor(e)&&_.isElement(e)}),[l,c]=m.parent(i,b.parent(i.selection.anchor.path)),[d]=s||[];(null==d?void 0:d.type)!==e.type?(_.isElement(l)&&!m.isEditor(l)&&w.unwrapNodes(i,{at:c,match:e=>!m.isEditor(e)&&!O.isText(e)&&_.isElement(l)&&e.type===l.type}),null===(n=e.createElement)||void 0===n||n.call(e,i)):w.setNodes(i,ct(Ze()),{mode:"highest",match:e=>!m.isEditor(e)&&_.isElement(e)})}))})(e,t),type:o})})),t}),[n,i.selection]),l=e=>{const t=m.marks(i);return!!(null==t?void 0:t[e])},c=s((()=>{const e={};return null==r||r.forEach((t=>{e[t.type]={toggle:e=>((e,t=!1)=>{t&&Object.keys(m.marks(i)||{}).forEach((e=>{m.removeMark(i,e)})),l(e)?m.removeMark(i,e):m.addMark(i,e,!0)})(t.type,null==e?void 0:e.only),isActive:l(t.type)}})),e}),[r,i.selection]),d=s((()=>o),[o]),u=s((()=>({elements:a,marks:c,tools:d})),[i.selection,c,a]);return t(qn.Provider,Object.assign({value:u},{children:e}))},Gn=()=>a(qn),Jn=()=>a(qn).marks,Xn=()=>a(qn).elements,Qn=()=>a(qn).tools,Yn=({key:e,value:n,plugins:r,marks:a,readOnly:l,onChange:c,placeholder:u,autoFocus:p=!0,offline:h,className:v,tools:N})=>{const S=function(e){return"string"==typeof e?e:Kt}(h),[D,P]=o((()=>function(e,t,n){const r=[{id:Ze(),type:"paragraph",children:[{text:""}]}],o=qt(n)?n:r;if(!t)return localStorage.removeItem(e),o;try{const t=JSON.parse(localStorage.getItem(e)||"[]");return qt(t)?t:o}catch(t){return localStorage.removeItem(e),r}}(S,h,n))),C=d((e=>{if(c(e),P(e),!h)return;if(B.operations.some((e=>"set_selection"!==e.type)))try{const t=JSON.stringify(e);localStorage.setItem(S,t)}catch(e){}}),[h]),A=s((()=>{const e=me(r),t=function(e){const t={};return e.forEach((e=>t[e.type]=e)),t}(e);return{yooptaPlugins:e,PLUGINS_MAP:t}}),[r]),{yooptaPlugins:T,PLUGINS_MAP:L}=A,B=s((()=>{let e=(e=>{const{insertData:t}=e;return e.insertData=n=>{if(e.selection&&j.isExpanded(e.selection))return;const r=n.getData("text/html");if(r){const t=$n(r,e.plugins);w.insertFragment(e,t)}else t(n)},e})((e=>{const{deleteFragment:t}=e;return e.deleteFragment=()=>{const{selection:n}=e;if(!n)return;const[,r]=m.first(e,[0]),[,o]=m.last(e,[e.children.length-1]),i=m.range(e,r,o),a=j.equals(n,i);if(console.log({isAllNodesSelected:a,fullRange:i}),a)return w.removeNodes(e,{mode:"highest",hanging:!0}),void w.select(e,[0]);t()},e})((e=>{const{normalizeNode:t}=e;return e.normalizeNode=n=>{const[r]=n;if(m.isEditor(r)&&0===e.children.length){const t=ct(Ze());w.insertNodes(e,t,{at:[0]})}else t(n)},e})((e=>{const{insertBreak:t,deleteBackward:n}=e;return e.insertBreak=()=>{if(!e.selection||!j.isCollapsed(e.selection))return t();const n=b.parent(e.selection.anchor.path),r=E.get(e,n);_.isElement(r)&&m.isVoid(e,r)?m.insertNode(e,{id:Ze(),type:"paragraph",children:[{text:""}],nodeType:"block"}):t()},e.deleteBackward=t=>{if(!e.selection||!j.isCollapsed(e.selection)||0!==e.selection.anchor.offset)return n(t);const r=b.parent(e.selection.anchor.path),o=E.get(e,r);if(0===E.string(o).length&&b.hasPrevious(r)){const t=b.previous(r),n=E.get(e,t);if(_.isElement(n)&&m.isVoid(e,n))return w.removeNodes(e),w.select(e,t)}n(t)},e})((e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var r=n[n.length-1];Wt.withoutSaving(t,(()=>{m.withoutNormalizing(t,(()=>{for(var e of r)t.apply(e)}))})),e.redos.pop(),e.undos.push(r)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var r=n[n.length-1];Wt.withoutSaving(t,(()=>{m.withoutNormalizing(t,(()=>{var e=r.map(x.inverse).reverse();for(var n of e)t.apply(n)}))})),e.redos.push(r),e.undos.pop()}},t.apply=e=>{var{operations:r,history:o}=t,{undos:i}=o,a=i[i.length-1],s=a&&a[a.length-1],l=Zt(e,s),c=Wt.isSaving(t),d=Wt.isMerging(t);if(null==c&&(c=Vt(e)),c){if(null==d&&(d=null!=a&&(0!==r.length||Ut(e,s)||l)),a&&d)l&&a.pop(),a.push(e);else{var u=[e];i.push(u)}for(;i.length>100;)i.shift();$t(e)&&(o.redos=[])}n(e)},t})((e=>{const{insertText:t}=e;return e.insertText=n=>{var r,o;const{selection:i}=e;if(" "===n&&i&&j.isCollapsed(i)){const{anchor:a}=i,s=m.above(e,{match:t=>_.isElement(t)&&m.isBlock(e,t),mode:"lowest"});if(!s)return;const[,l]=s,c=m.parent(e,l),[d]=c;if(_.isElement(d)&&!O.isText(d.children[0]))return t(n);const u=s?l:[],f={anchor:a,focus:m.start(e,u)},p=m.string(e,f),h=null===(r=e.shortcuts)||void 0===r?void 0:r[p];if(h)return w.select(e,f),w.delete(e),void(null===(o=h.createElement)||void 0===o||o.call(h,e))}t(n)},e})(g(k())))))));e.plugins=L;const t={};return T.forEach((n=>{var r;n.shortcut&&(Array.isArray(n.shortcut)?n.shortcut.forEach((e=>t[e]=n)):t[n.shortcut]=n),e=(null===(r=n.extendEditor)||void 0===r?void 0:r.call(n,e))||e})),e.shortcuts=t,e}),[T]);return i((()=>{if(p)try{const[,e]=m.first(B,[0]);w.select(B,{anchor:{path:e,offset:0},focus:{path:e,offset:0}}),f.focus(B)}catch(e){}}),[p,B]),t(y,Object.assign({editor:B,value:D,onChange:C},{children:t(Kn,Object.assign({plugins:r,marks:a,tools:N},{children:t(pt,{children:t(jn,{editor:B,readOnly:l,placeholder:u,plugins:T,tools:N,marks:a,PLUGINS_MAP:L,className:v})})}))}),e)},er=e=>t(Mt,{children:t(Yn,Object.assign({},e,{value:e.value,onChange:e.onChange}))});function tr({type:e,hotkey:n,className:r}){return{type:e,hotkey:n,render:e=>t("span",Object.assign({},e.attributes,{className:r},{children:e.children}))}}function nr(e){const{element:t,HTMLAttributes:n,className:r}=e;return`yoopta-${t.type} ${(null==n?void 0:n.className)||""} ${r}`}const rr={ElementOptions:_t,Overlay:Se};export{mn as HOTKEYS,rr as UI_HELPERS,ge as YooptaPlugin,tr as createYooptaMark,ye as createYooptaPlugin,_e as cx,Ie as deepClone,er as default,Ze as generateId,wn as getElementByPath,nr as getElementClassname,Lt as isCodeHotkey,bn as isElementActive,Tt as isHotkey,Bt as isKeyHotkey,qt as isValidYooptaNodes,me as mergePlugins,ht as useElementSettings,Xn as useElements,Jn as useMarks,Qn as useTools,Gn as useYoopta};
|
|
13
|
+
*/function Ut(e){return"[object Object]"===Object.prototype.toString.call(e)}function $t(e){var t,n;return!1!==Ut(e)&&(void 0===(t=e.constructor)||!1!==Ut(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var Zt={isHistory:e=>$t(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||O.isOperationList(e.redos[0]))&&(0===e.undos.length||O.isOperationList(e.undos[0]))},qt=new WeakMap,Kt=new WeakMap,Gt={isHistoryEditor:e=>Zt.isHistory(e.history)&&m.isEditor(e),isMerging:e=>Kt.get(e),isSaving:e=>qt.get(e),redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Gt.isMerging(e);Kt.set(e,!1),t(),Kt.set(e,n)},withoutSaving(e,t){var n=Gt.isSaving(e);qt.set(e,!1),t(),qt.set(e,n)}},Jt=(e,t)=>"set_selection"===e.type||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!b.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!b.equals(e.path,t.path))),Xt=(e,t)=>"set_selection"!==e.type||null!=e.properties&&null!=e.newProperties,Qt=(e,t)=>!(!t||"set_selection"!==e.type||"set_selection"!==t.type),Yt=e=>"set_selection"!==e.type;function en(e){return!!Array.isArray(e)&&0!==e.length}const tn="yoopta-content";var nn="u-OdDyDx";xe(".u-OdDyDx:after{color:#aaa;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);user-select:none}");const rn={margin:"1px 0",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"inherit",fontSize:"inherit",lineHeight:"inherit",fontWeight:"inherit"},on=c((({attributes:e,children:n,placeholder:r,leaf:o})=>{const i=h();return t("span",Object.assign({},e,{"data-placeholder":r,style:rn,className:_e({[nn]:o.withPlaceholder&&r&&i})},{children:n}))}));on.displayName="TextLeaf";var an;function sn(){return sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sn.apply(this,arguments)}var ln,cn=function(e){return n.createElement("svg",sn({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),an||(an=n.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function dn(){return dn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dn.apply(this,arguments)}var un=function(e){return n.createElement("svg",dn({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),ln||(ln=n.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))},fn="yCQ-VdE5",pn="b--398nS",hn="_6VhqH6wy",vn="k9i48GWd",gn="TNeDy6y5",yn="jVfkavqE",mn="_87oFW01f";xe('.yCQ-VdE5{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition:opacity .18s ease-in}.b--398nS{opacity:1}._6VhqH6wy{all:unset;align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;color:rgba(55,53,47,.35);cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition:background-color .18s cubic-bezier(.4,0,.2,1);width:auto;width:18px}._6VhqH6wy:active,._6VhqH6wy:focus,._6VhqH6wy:hover{background-color:rgba(55,54,47,.08)}.k9i48GWd{width:24px}.TNeDy6y5{position:relative;transition:opacity .18s cubic-bezier(.4,0,.2,1)}.jVfkavqE:after{background-color:#007aff;bottom:-7px;content:"";height:3px;left:50%;position:absolute;transform:translateX(-50%);width:100%}._87oFW01f:before{top:-5px}._87oFW01f:after,._87oFW01f:before{background-color:inherit;content:"";height:3px;left:50%;position:absolute;transform:translateX(-50%);width:100%}._87oFW01f:after{bottom:-7px}');const bn=({element:n,editor:r,values:o,handlers:i})=>{const a=l(null),{hoveredElement:s,isElementOptionsOpen:c,nodeSettingsPos:d}=o,{onDragEnd:u,onDragStart:p,openNodeSettings:h,closeNodeSettings:v,triggerPlusButton:g}=i,y=e=>{e.stopPropagation();const t=a.current,o=document.querySelector(`[data-element-id="${null==n?void 0:n.id}"]`),i=f.findPath(r,n),s=m.parent(r,i);_.isElement(n)&&(null==t||t.setAttribute("draggable","false"),o&&(o.setAttribute("draggable","true"),o.ondragstart=e=>{const t={path:i,element:{id:n.id,type:n.type},parent:s};p(e,t)},o.ondragend=u))},b=(null==s?void 0:s.id)===n.id;return e("div",Object.assign({contentEditable:!1,className:_e(fn,{[pn]:b},"yoopta-element-actions")},{children:[b&&c&&t(St,{element:n,style:d||void 0,onClose:v}),t("button",Object.assign({type:"button",onMouseDown:y,className:_e(hn,vn,"yoopta-element-actions-plus"),onClick:()=>g(n)},{children:t(un,{})})),t("button",Object.assign({type:"button",onMouseDown:y,className:_e(hn,"yoopta-element-actions-drag"),onClick:()=>h(a,n),ref:a},{children:t(cn,{})}))]}))},wn=({children:n,element:r,attributes:o,nodeType:i,render:a,HTMLAttributes:l})=>{var c;const d=p(),[u,f]=ht(),h="inline"===i,{hoverIn:v,onDrop:g}=f,{dndState:y,DRAG_MAP:m}=u,b=s((()=>{var e,t;if(null===y.from.element||null===y.to.element)return{isDragging:!1,isDragOver:!1,isDragSelf:!1};const n=(null===(e=u.dndState.from.element)||void 0===e?void 0:e.id)===r.id,o=(null===(t=u.dndState.to.element)||void 0===t?void 0:t.id)===r.id;return{isDragging:n,isDragOver:o,isDragSelf:n&&o}}),[u.dndState.from,u.dndState.to]),w=null===(c=r.data)||void 0===c?void 0:c.skipSettings,{isDragging:_,isDragOver:x,isDragSelf:O}=b,j={opacity:_?.7:1};return m.set(r.id,r),h?a({attributes:o,element:r,children:n,HTMLAttributes:l}):e("div",Object.assign({"data-element-id":r.id,"data-element-type":r.type,onMouseEnter:e=>{w||v(e,r)},onDrop:g,className:_e(gn,{[yn]:x,[mn]:O}),style:j},o,{children:[w?null:t(bn,{editor:d,element:r,handlers:f,values:u}),a({attributes:o,element:r,children:n,HTMLAttributes:l})]}))};wn.displayName="ElementWrapper";const _n={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",kekCeburek:"mod+enter"},xn={moveLineBackward:"opt+up",moveLineForward:"opt+down",ctrlLeft:"opt+left",ctrlRight:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},On={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},jn=e=>{const t=_n[e],n=xn[e],r=On[e],o=t&&Wt(t),i=n&&Wt(n),a=r&&Wt(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},En={isBold:jn("bold"),isCompose:jn("compose"),isArrowLeft:jn("arrowLeft"),isArrowRight:jn("arrowRight"),isArrowUp:jn("arrowUp"),isArrowDown:jn("arrowDown"),isDeleteBackward:jn("deleteBackward"),isDeleteForward:jn("deleteForward"),isDeleteLineBackward:jn("deleteLineBackward"),isDeleteLineForward:jn("deleteLineForward"),isDeleteWordBackward:jn("deleteWordBackward"),isDeleteWordForward:jn("deleteWordForward"),isExtendBackward:jn("extendBackward"),isExtendForward:jn("extendForward"),isExtendLineBackward:jn("extendLineBackward"),isExtendLineForward:jn("extendLineForward"),isItalic:jn("italic"),isMoveLineBackward:jn("moveLineBackward"),isMoveLineForward:jn("moveLineForward"),isCtrlLeft:jn("ctrlLeft"),isCtrlRight:jn("ctrlRight"),isRedo:jn("redo"),isShiftEnter:jn("shiftEnter"),isEnter:jn("enter"),isTransposeCharacter:jn("transposeCharacter"),isUndo:jn("undo"),isSpace:jn("space"),isSelect:jn("select"),isTab:jn("tab"),isShiftTab:jn("shiftTab"),isBackspace:jn("backspace"),isCmdEnter:jn("cmdEnter"),isCmd:jn("cmd"),isEscape:jn("escape"),isKekceburek:jn("kekCeburek")},kn=(e,t)=>!!((e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(m.nodes(e,{at:m.unhangRange(e,n),match:e=>!m.isEditor(e)&&_.isElement(e)&&e.type===t}));return r})(e,t),Nn=(e,t,n="lowest")=>{var r;const o=Array.from(m.nodes(e,{match:t=>m.isEditor(e)&&_.isElement(t),at:t||(null===(r=e.selection)||void 0===r?void 0:r.anchor.path),mode:n}))[0];return o?o[0]:e.children[0]};function Sn(e,t){var n,r;if(x.isText(e))return function(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,(e=>t[e]))}(e.text);const o=e.children.map((e=>Sn(e,t))).join(""),i=t[e.type];return"function"==typeof(null===(r=null===(n=i.exports)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize)?i.exports.html.serialize(e,o):o}function Dn(e,t){return e.map((e=>Sn(e,t))).join("")}const Pn={hotkeys:En,defaultNode:ct($e())},An=({editor:n,placeholder:o,marks:a,readOnly:c,plugins:u,className:p,PLUGINS_MAP:h,tools:g})=>{i((()=>{const e=window.location.hash.length>0?window.location.hash.replace("#",""):null;if(e){const t=document.getElementById(e)||document.querySelector(`[data-element-id="${e}"]`);t&&window.scrollTo({top:t.offsetTop,behavior:"smooth"})}}),[]);const y=l(null),[{disableWhileDrag:x},{changeHoveredNode:O}]=ht(),E=x||c,k=s((()=>e=>{var r;const o=h[e.element.type];if(!o)return null;const i=function(e){return"function"==typeof e.renderer?e.renderer:e.renderer.editor}(o)(n,o);return t(wn,Object.assign({element:e.element,attributes:e.attributes,nodeType:e.element.nodeType,render:i,HTMLAttributes:null===(r=o.options)||void 0===r?void 0:r.HTMLAttributes},{children:e.children}))}),[u,n]),N=s((()=>e=>{const t=[],[r,o]=e;return u.forEach((o=>{const i=o.decorator;"function"==typeof i&&_.isElement(r)&&r.type===o.type&&t.push(...i(n)(e))})),n.selection&&!m.isEditor(r)&&""===m.string(n,[o[0]])&&j.includes(n.selection,o)&&j.isCollapsed(n.selection)&&t.push(Object.assign(Object.assign({},n.selection),{withPlaceholder:!0})),t}),[u,n]),S=s((()=>e=>{var r;const i=Object.assign({},e);let s;u.forEach((e=>{if(e.leaf){const t=e.leaf(n)(i);t&&(i.children=t)}})),null==a||a.forEach((e=>{i.leaf[e.type]&&(i.children=e.render(i))}));const l=null===(r=i.children.props)||void 0===r?void 0:r.parent;if(!function(e){var t,n;return 1!==(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.length)||0!==(null===(n=null==e?void 0:e.children[0])||void 0===n?void 0:n.text.length)}(l)){const e=h[null==l?void 0:l.type];s=null===(null==e?void 0:e.placeholder)?null:(null==e?void 0:e.placeholder)||o}return t(on,Object.assign({},i,{placeholder:s}))}),[u,n]),D=s((()=>{const e=u.map((e=>Object.keys(e.events||{}))).flat().filter(((e,t,n)=>n.indexOf(e)===t)),t={};return e.forEach((e=>{t[e]=function(t){u.forEach((r=>{var o;if(null===(o=r.events)||void 0===o?void 0:o[e]){r.events[e](n,Pn)(t)}}))}})),t}),[u,n]),P=d((e=>{m.withoutNormalizing(n,(()=>{var t;if(!n.selection)return;const r=ct($e());null==a||a.forEach((t=>{t.hotkey&&Wt(t.hotkey)(e)&&(e.preventDefault(),dt(n,t.type,!1))})),null===(t=D.onKeyDown)||void 0===t||t.call(D,e);const o=m.above(n,{match:e=>!m.isEditor(e),mode:"lowest"});if(En.isEnter(e)){if(e.isDefaultPrevented())return;e.preventDefault();const t=Object.keys(m.marks(n)||{});t.length>0&&t.forEach((e=>m.removeMark(n,e)));const i=b.parent(n.selection.anchor.path),a=m.string(n,i),s=o&&o[0].type!==r.type;if(s&&0===a.length)return void w.setNodes(n,r,{at:i});if(m.isStart(n,n.selection.anchor,n.selection.anchor.path)&&s){const[e]=o;return w.setNodes(n,r,{at:i}),w.delete(n,{unit:"block"}),w.insertNodes(n,Ie(e),{at:b.next(i)}),void w.select(n,{path:[b.next(n.selection.anchor.path)[0]+1,0],offset:0})}return w.splitNodes(n,{always:!0}),w.setNodes(n,r),void O(r)}if(En.isShiftEnter(e)){if(e.isDefaultPrevented())return;e.preventDefault(),n.insertText("\n")}if(En.isSelect(e)){if(e.isDefaultPrevented())return;e.preventDefault();const t=m.above(n,{at:n.selection.anchor.path,match:e=>!m.isEditor(e)&&_.isElement(e)});if(!t)return;const r=m.string(n,t[1]);return j.isExpanded(n.selection)||0===r.length?void w.select(n,[]):void w.select(n,t[1])}}))}),[]),A=s((()=>{if(!g)return null;return Object.keys(g).length>0?Object.keys(g).map((e=>{const t=g[e];return r.isValidElement(g[e])?r.cloneElement(t,Object.assign({key:e,plugins:u},null==t?void 0:t.props)):null})):null}),[g]);return e("div",Object.assign({id:"yoopta-editor",className:p,ref:y,onMouseDown:e=>{c||(e.preventDefault(),e.currentTarget===e.target&&n.selection&&m.withoutNormalizing(n,(()=>{const e=[n.children.length-1,0],t=Nn(n,e,"highest"),r=m.string(n,e),o={anchor:{path:e,offset:0},focus:{path:e,offset:0}};if("paragraph"===t.type&&0===r.length)return w.select(n,{path:o.anchor.path,offset:0}),O(t),f.focus(n);const i=ct($e());O(i),w.insertNodes(n,i,{at:[n.children.length],select:!0}),f.focus(n)})))}},{children:[A,t(v,Object.assign({id:"yoopta-contenteditable",renderLeaf:S,renderElement:k,readOnly:E,decorate:N,onCopy:e=>{if(!n.selection)return;const t=Dn(m.fragment(n,n.selection),n.plugins);return e.clipboardData.setData("text/html",t),e.clipboardData},autoFocus:!0,spellCheck:!0},D,{onKeyDown:P,onMouseDown:e=>{var t;null===(t=D.onMouseDown)||void 0===t||t.call(D,e),(e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()})(e)}}))]}))};function Cn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Tn=new WeakMap,Ln=new WeakMap;class Bn{}class Mn extends Bn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}class Fn extends Bn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}var zn=e=>Ln.get(e);function Hn(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 In(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hn(Object(n),!0).forEach((function(t){Cn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Rn=new WeakSet,Wn=e=>{var t=[],n=e=>{if(null!=e){var r=t[t.length-1];if("string"==typeof e){var o={text:e};Rn.add(o),e=o}if(x.isText(e)){var i=e;x.isText(r)&&Rn.has(r)&&Rn.has(i)&&x.equals(r,i,{loose:!0})?r.text+=i.text:t.push(i)}else if(_.isElement(e))t.push(e);else{if(!(e instanceof Bn))throw new Error("Unexpected hyperscript child object: ".concat(e));var a=t[t.length-1];x.isText(a)||(n(""),a=t[t.length-1]),e instanceof Mn?((e,t)=>{var n=e.text.length;Tn.set(e,[n,t])})(a,e):e instanceof Fn&&((e,t)=>{var n=e.text.length;Ln.set(e,[n,t])})(a,e)}}};for(var r of e.flat(1/0))n(r);return t};function Vn(e,t,n){return In(In({},t),{},{children:Wn(n)})}function Un(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Un(Object(n),!0).forEach((function(t){Cn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Un(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Zn,qn={anchor:function(e,t,n){return new Mn(t)},cursor:function(e,t,n){return[new Mn(t),new Fn(t)]},editor:(Zn=k,(e,t,n)=>{var r,o=[];for(var i of n)j.isRange(i)?r=i:o.push(i);var a,s=Wn(o),l={},c=Zn();for(var[d,u]of(Object.assign(c,t),c.children=s,E.texts(c))){var f=(a=d,Tn.get(a)),p=zn(d);if(null!=f){var[h]=f;l.anchor={path:u,offset:h}}if(null!=p){var[v]=p;l.focus={path:u,offset:v}}}if(l.anchor&&!l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!l.anchor&&l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");return null!=r?c.selection=r:j.isRange(l)&&(c.selection=l),c}),element:Vn,focus:function(e,t,n){return new Fn(t)},fragment:function(e,t,n){return Wn(n)},selection:function(e,t,n){var r=n.find((e=>e instanceof Mn)),o=n.find((e=>e instanceof Fn));if(!r||null==r.offset||null==r.path)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!o||null==o.offset||null==o.path)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return In({anchor:{offset:r.offset,path:r.path},focus:{offset:o.offset,path:o.path}},t)},text:function(e,t,n){var r=Wn(n);if(r.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var[o]=r;if(null==o&&(o={text:""}),!x.isText(o))throw new Error("\n The <text> hyperscript tag can only contain text content as children.");return Rn.delete(o),Object.assign(o,t),o}},Kn=e=>function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=e[t];if(!a)throw new Error("No hyperscript creator found for tag: <".concat(t,">"));return null==n&&(n={}),$t(n)||(o=[n].concat(o),n={}),a(t,n,o=o.filter((e=>Boolean(e))).flat())},Gn=e=>{var t={},n=function(n){var r=e[n];if("object"!=typeof r)throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(n,"> tag you passed: ").concat(r));t[n]=(e,t,n)=>Vn(0,$n($n({},r),t),n)};for(var r in e)n(r);return t},Jn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elements:t={}}=e,n=Gn(t),r=$n($n($n({},qn),n),e.creators);return Kn(r)}();const Xn={DEL:()=>({strikethrough:!0}),EM:()=>({italic:!0}),I:()=>({italic:!0}),S:()=>({strikethrough:!0}),STRONG:()=>({bold:!0}),U:()=>({underline:!0})},Qn=(e,t)=>{var n,r,o,i;if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;if("BR"===e.nodeName)return"\n";const{nodeName:a}=e;let s=e,l=Array.from(s.childNodes).map((e=>Qn(e,t))).flat();if(0===l.length&&(l=[{text:""}]),"BODY"===e.nodeName)return Jn("fragment",{},l);if(t[a]){const s=t[a];if(s){let t=s.defineElement();if("function"==typeof(null===(r=null===(n=s.exports)||void 0===n?void 0:n.html.deserialize)||void 0===r?void 0:r.parse)){const n=null===(i=null===(o=s.exports)||void 0===o?void 0:o.html.deserialize)||void 0===i?void 0:i.parse(e);t=Object.assign(Object.assign({},t),{data:n})}return Jn("element",t,l)}}if(x.isTextList(l))return Jn("element",t.P.defineElement(),l);if(Xn[a]){const t=Xn[a](e);return l.map((e=>x.isText(e)?Jn("text",t,e):e))}return l};function Yn(e,t){const n=function(e){const t={};return Object.keys(e).forEach((n=>{var r,o,i,a,s,l,c,d;const u=e[n];if(null===(o=null===(r=u.exports)||void 0===r?void 0:r.html.deserialize)||void 0===o?void 0:o.nodeName){if(Array.isArray(null===(a=null===(i=u.exports)||void 0===i?void 0:i.html.deserialize)||void 0===a?void 0:a.nodeName))return void(null===(l=null===(s=u.exports)||void 0===s?void 0:s.html.deserialize)||void 0===l||l.nodeName.forEach((e=>{t[e]=u})));t[null===(d=null===(c=u.exports)||void 0===c?void 0:c.html.deserialize)||void 0===d?void 0:d.nodeName]=u}})),t}(t),r=(new DOMParser).parseFromString(e,"text/html");return Qn(r.body,n)}const er=({key:e,value:n,plugins:r,marks:a,readOnly:l,onChange:c,placeholder:u,autoFocus:p=!0,offline:h,className:v,tools:N})=>{const S=function(e){return"string"==typeof e?e:tn}(h),[D,P]=o((()=>function(e,t,n){const r=[{id:$e(),type:"paragraph",children:[{text:""}]}],o=en(n)?n:r;if(!t)return localStorage.removeItem(e),o;try{const t=JSON.parse(localStorage.getItem(e)||"[]");return en(t)?t:o}catch(t){return localStorage.removeItem(e),r}}(S,h,n))),A=d((e=>{if(c(e),P(e),!h)return;if(B.operations.some((e=>"set_selection"!==e.type)))try{const t=JSON.stringify(e);localStorage.setItem(S,t)}catch(e){}}),[h]),C=s((()=>{const e=me(r),t=function(e){const t={};return e.forEach((e=>t[e.type]=e)),t}(e);return{yooptaPlugins:e,PLUGINS_MAP:t}}),[r]),{yooptaPlugins:T,PLUGINS_MAP:L}=C,B=s((()=>{let e=(e=>{const{insertData:t}=e;return e.insertData=n=>{if(e.selection&&j.isExpanded(e.selection))return;const r=n.getData("text/html");if(r){const t=Yn(r,e.plugins);w.insertFragment(e,t)}else t(n)},e})((e=>{const{deleteFragment:t}=e;return e.deleteFragment=()=>{const{selection:n}=e;if(!n)return;const[,r]=m.first(e,[0]),[,o]=m.last(e,[e.children.length-1]),i=m.range(e,r,o),a=j.equals(n,i);if(console.log({isAllNodesSelected:a,fullRange:i}),a)return w.removeNodes(e,{mode:"highest",hanging:!0}),void w.select(e,[0]);t()},e})((e=>{const{normalizeNode:t}=e;return e.normalizeNode=n=>{const[r]=n;if(m.isEditor(r)&&0===e.children.length){const t=ct($e());w.insertNodes(e,t,{at:[0]})}else t(n)},e})((e=>{const{insertBreak:t,deleteBackward:n}=e;return e.insertBreak=()=>{if(!e.selection||!j.isCollapsed(e.selection))return t();const n=b.parent(e.selection.anchor.path),r=E.get(e,n);_.isElement(r)&&m.isVoid(e,r)?m.insertNode(e,{id:$e(),type:"paragraph",children:[{text:""}],nodeType:"block"}):t()},e.deleteBackward=t=>{if(!e.selection||!j.isCollapsed(e.selection)||0!==e.selection.anchor.offset)return n(t);const r=b.parent(e.selection.anchor.path),o=E.get(e,r);if(0===E.string(o).length&&b.hasPrevious(r)){const t=b.previous(r),n=E.get(e,t);if(_.isElement(n)&&m.isVoid(e,n))return w.removeNodes(e),w.select(e,t)}n(t)},e})((e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var r=n[n.length-1];Gt.withoutSaving(t,(()=>{m.withoutNormalizing(t,(()=>{for(var e of r)t.apply(e)}))})),e.redos.pop(),e.undos.push(r)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var r=n[n.length-1];Gt.withoutSaving(t,(()=>{m.withoutNormalizing(t,(()=>{var e=r.map(O.inverse).reverse();for(var n of e)t.apply(n)}))})),e.redos.push(r),e.undos.pop()}},t.apply=e=>{var{operations:r,history:o}=t,{undos:i}=o,a=i[i.length-1],s=a&&a[a.length-1],l=Qt(e,s),c=Gt.isSaving(t),d=Gt.isMerging(t);if(null==c&&(c=Xt(e)),c){if(null==d&&(d=null!=a&&(0!==r.length||Jt(e,s)||l)),a&&d)l&&a.pop(),a.push(e);else{var u=[e];i.push(u)}for(;i.length>100;)i.shift();Yt(e)&&(o.redos=[])}n(e)},t})((e=>{const{insertText:t}=e;return e.insertText=n=>{var r,o;const{selection:i}=e;if(" "===n&&i&&j.isCollapsed(i)){const{anchor:a}=i,s=m.above(e,{match:t=>_.isElement(t)&&m.isBlock(e,t),mode:"lowest"});if(!s)return;const[,l]=s,c=m.parent(e,l),[d]=c;if(_.isElement(d)&&!x.isText(d.children[0]))return t(n);const u=s?l:[],f={anchor:a,focus:m.start(e,u)},p=m.string(e,f),h=null===(r=e.shortcuts)||void 0===r?void 0:r[p];if(h)return w.select(e,f),w.delete(e),void(null===(o=h.createElement)||void 0===o||o.call(h,e))}t(n)},e})(g(k())))))));e.plugins=L;const t={};return T.forEach((n=>{var r;n.shortcut&&(Array.isArray(n.shortcut)?n.shortcut.forEach((e=>t[e]=n)):t[n.shortcut]=n),e=(null===(r=n.extendEditor)||void 0===r?void 0:r.call(n,e))||e})),e.shortcuts=t,e}),[T]);return i((()=>{if(p)try{const[,e]=m.first(B,[0]);w.select(B,{anchor:{path:e,offset:0},focus:{path:e,offset:0}}),f.focus(B)}catch(e){}}),[p,B]),t(y,Object.assign({editor:B,value:D,onChange:A},{children:t(gt,Object.assign({plugins:T,marks:a,tools:N},{children:t(pt,{children:t(An,{editor:B,readOnly:l,placeholder:u,plugins:T,tools:N,marks:a,PLUGINS_MAP:L,className:v})})}))}),e)},tr=e=>t(Vt,{children:t(er,Object.assign({},e,{value:e.value,onChange:e.onChange}))});function nr({type:e,hotkey:n,className:r,as:o}){return Object.freeze({type:e,hotkey:n,render:n=>t(o||"span",Object.assign({},n.attributes,{className:_e(r,`yoopta-leaf-${e}`)},{children:n.children}))})}function rr(e){const{element:t,HTMLAttributes:n,className:r}=e;return`yoopta-${t.type} ${(null==n?void 0:n.className)||""} ${r}`}const or={ElementOptions:St,Overlay:Se};export{En as HOTKEYS,or as UI_HELPERS,ge as YooptaPlugin,nr as createYooptaMark,ye as createYooptaPlugin,_e as cx,Ie as deepClone,tr as default,$e as generateId,Nn as getElementByPath,rr as getElementClassname,Rt as isCodeHotkey,kn as isElementActive,It as isHotkey,Wt as isKeyHotkey,en as isValidYooptaNodes,me as mergePlugins,ht as useElementSettings,bt as useElements,mt as useMarks,wt as useTools,yt as useYoopta};
|
package/dist/utils/marks.d.ts
CHANGED
|
@@ -9,5 +9,6 @@ export type YooptaMarksConfig = {
|
|
|
9
9
|
type: string;
|
|
10
10
|
className: string;
|
|
11
11
|
hotkey?: string;
|
|
12
|
+
as?: string;
|
|
12
13
|
};
|
|
13
|
-
export declare function createYooptaMark({ type, hotkey, className }: YooptaMarksConfig): YooptaMark;
|
|
14
|
+
export declare function createYooptaMark({ type, hotkey, className, as }: YooptaMarksConfig): YooptaMark;
|
package/dist/utils/plugins.d.ts
CHANGED
|
@@ -12,7 +12,11 @@ export type DecoratorFn = (nodeEntry: NodeEntry) => Range[];
|
|
|
12
12
|
export type YooptaPluginEventHandlers = {
|
|
13
13
|
[key in keyof EditorEventHandlers]: (editor: YoEditor, options: HandlersOptions) => EditorEventHandlers[key] | void;
|
|
14
14
|
};
|
|
15
|
-
export type YooptaPluginBaseOptions =
|
|
15
|
+
export type YooptaPluginBaseOptions = {
|
|
16
|
+
searchString?: string;
|
|
17
|
+
displayLabel?: string;
|
|
18
|
+
[x: string]: any;
|
|
19
|
+
};
|
|
16
20
|
export type YooptaRenderElementFunc<P extends YooptaBaseElement<string> = YooptaBaseElement<string>> = (editor: YoEditor, plugin: YooptaPluginType) => (props: RenderYooptaElementProps<P> & YooptaRenderHTMLAttributes) => ReactElement;
|
|
17
21
|
export type YooptaRender<P extends YooptaBaseElement<string>> = YooptaRenderElementFunc<P>;
|
|
18
22
|
export type ExtendedYooptaRender<P extends YooptaBaseElement<string>> = {
|
|
@@ -38,7 +42,7 @@ type Exports<T> = {
|
|
|
38
42
|
parse: (mark: any) => any;
|
|
39
43
|
}>;
|
|
40
44
|
};
|
|
41
|
-
export type YooptaPluginType<O = YooptaPluginBaseOptions, P extends YooptaBaseElement<string> = YooptaBaseElement<string>> = {
|
|
45
|
+
export type YooptaPluginType<O extends YooptaPluginBaseOptions = YooptaPluginBaseOptions, P extends YooptaBaseElement<string> = YooptaBaseElement<string>> = {
|
|
42
46
|
type: string;
|
|
43
47
|
renderer: YooptaRenderer<P>;
|
|
44
48
|
placeholder?: string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/editor",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.10-rc",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -71,4 +71,4 @@
|
|
|
71
71
|
"url": "https://github.com/Darginec05/Yoopta-Editor/issues"
|
|
72
72
|
},
|
|
73
73
|
"homepage": "https://github.com/Darginec05/Yoopta-Editor#readme"
|
|
74
|
-
}
|
|
74
|
+
}
|