slate
Version:
A completely customizable framework for building rich text editors.
1 lines • 155 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Slate={})}(this,(function(e){"use strict";var t={transform:function(e,t){var r=e.current,n=e.affinity;if(null!=r){var u=B.transform(r,t,{affinity:n});e.current=u,null==u&&e.unref()}}},r={transform:function(e,t){var r=e.current,n=e.affinity;if(null!=r){var u=it.transform(r,t,{affinity:n});e.current=u,null==u&&e.unref()}}},n={transform:function(e,t){var r=e.current,n=e.affinity;if(null!=r){var u=K.transform(r,t,{affinity:n});e.current=u,null==u&&e.unref()}}},u=new WeakMap,o=new WeakMap,i=new WeakMap,a=new WeakMap,c=new WeakMap,s=new WeakMap,f=new WeakMap;function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function D(e,t){return e(t={exports:{}},t.exports),t.exports}var d=D((function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n},e.exports.__esModule=!0,e.exports.default=e.exports}));l(d);var p=D((function(e){e.exports=function(e){if(Array.isArray(e))return d(e)},e.exports.__esModule=!0,e.exports.default=e.exports}));l(p);var v=D((function(e){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports}));l(v);var h=D((function(e){e.exports=function(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports}));l(h);var C=D((function(e){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports}));l(C);var y=l(D((function(e){e.exports=function(e){return p(e)||v(e)||h(e)||C()},e.exports.__esModule=!0,e.exports.default=e.exports}))),B={ancestors:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.reverse,n=void 0!==r&&r,u=B.levels(e,t);return u=n?u.slice(1):u.slice(0,-1)},common:function(e,t){for(var r=[],n=0;n<e.length&&n<t.length;n++){var u=e[n];if(u!==t[n])break;r.push(u)}return r},compare:function(e,t){for(var r=Math.min(e.length,t.length),n=0;n<r;n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return 0},endsAfter:function(e,t){var r=e.length-1,n=e.slice(0,r),u=t.slice(0,r),o=e[r],i=t[r];return B.equals(n,u)&&o>i},endsAt:function(e,t){var r=e.length,n=e.slice(0,r),u=t.slice(0,r);return B.equals(n,u)},endsBefore:function(e,t){var r=e.length-1,n=e.slice(0,r),u=t.slice(0,r),o=e[r],i=t[r];return B.equals(n,u)&&o<i},equals:function(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))},hasPrevious:function(e){return e[e.length-1]>0},isAfter:function(e,t){return 1===B.compare(e,t)},isAncestor:function(e,t){return e.length<t.length&&0===B.compare(e,t)},isBefore:function(e,t){return-1===B.compare(e,t)},isChild:function(e,t){return e.length===t.length+1&&0===B.compare(e,t)},isCommon:function(e,t){return e.length<=t.length&&0===B.compare(e,t)},isDescendant:function(e,t){return e.length>t.length&&0===B.compare(e,t)},isParent:function(e,t){return e.length+1===t.length&&0===B.compare(e,t)},isPath:function(e){return Array.isArray(e)&&(0===e.length||"number"==typeof e[0])},isSibling:function(e,t){if(e.length!==t.length)return!1;var r=e.slice(0,-1),n=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&B.equals(r,n)},levels:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.reverse,n=void 0!==r&&r,u=[],o=0;o<=e.length;o++)u.push(e.slice(0,o));return n&&u.reverse(),u},next:function(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath:function(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent:function(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous:function(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative:function(e,t){if(!B.isAncestor(t,e)&&!B.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var n=y(e),u=r.affinity,o=void 0===u?"forward":u;if(0===e.length)return n;switch(t.type){case"insert_node":var i=t.path;(B.equals(i,n)||B.endsBefore(i,n)||B.isAncestor(i,n))&&(n[i.length-1]+=1);break;case"remove_node":var a=t.path;if(B.equals(a,n)||B.isAncestor(a,n))return null;B.endsBefore(a,n)&&(n[a.length-1]-=1);break;case"merge_node":var c=t.path,s=t.position;B.equals(c,n)||B.endsBefore(c,n)?n[c.length-1]-=1:B.isAncestor(c,n)&&(n[c.length-1]-=1,n[c.length]+=s);break;case"split_node":var f=t.path,l=t.position;if(B.equals(f,n)){if("forward"===o)n[n.length-1]+=1;else if("backward"!==o)return null}else B.endsBefore(f,n)?n[f.length-1]+=1:B.isAncestor(f,n)&&e[f.length]>=l&&(n[f.length-1]+=1,n[f.length]-=l);break;case"move_node":var D=t.path,d=t.newPath;if(B.equals(D,d))return n;if(B.isAncestor(D,n)||B.equals(D,n)){var p=d.slice();return B.endsBefore(D,d)&&D.length<d.length&&(p[D.length-1]-=1),p.concat(n.slice(D.length))}B.isSibling(D,d)&&(B.isAncestor(d,n)||B.equals(d,n))?B.endsBefore(D,n)?n[D.length-1]-=1:n[D.length-1]+=1:B.endsBefore(d,n)||B.equals(d,n)||B.isAncestor(d,n)?(B.endsBefore(D,n)&&(n[D.length-1]-=1),n[d.length-1]+=1):B.endsBefore(D,n)&&(B.equals(d,n)&&(n[d.length-1]+=1),n[D.length-1]-=1)}return n}},A=D((function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})),g=l(A),m=D((function(e){var t=A.default;e.exports=function(e,r){if("object"!==t(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var u=n.call(e,r||"default");if("object"!==t(u))return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports}));l(m);var E=D((function(e){var t=A.default;e.exports=function(e){var r=m(e,"string");return"symbol"===t(r)?r:String(r)},e.exports.__esModule=!0,e.exports.default=e.exports}));l(E);var F=l(D((function(e){e.exports=function(e,t,r){return(t=E(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}))),b=D((function(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports}));l(b);var w=D((function(e){e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,u,o,i,a=[],c=!0,s=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){s=!0,u=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw u}}return a}},e.exports.__esModule=!0,e.exports.default=e.exports}));l(w);var x=D((function(e){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports}));l(x);var O=l(D((function(e){e.exports=function(e,t){return b(e)||w(e,t)||h(e,t)||x()},e.exports.__esModule=!0,e.exports.default=e.exports})));function j(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,u=function(){};return{s:u,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw o}}}}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function k(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var S=function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),u=2;u<r;u++)n[u-2]=arguments[u];return[].concat(y(e.slice(0,t)),n,y(e.slice(t)))},N=function(e,t,r){for(var n=arguments.length,u=new Array(n>3?n-3:0),o=3;o<n;o++)u[o-3]=arguments[o];return[].concat(y(e.slice(0,t)),u,y(e.slice(t+r)))},R=N,T=function(e,t,r){if(0===t.length)throw new Error("Cannot modify the editor");for(var n=Ye.get(e,t),u=t.slice(),o=r(n);u.length>1;){var i=u.pop(),a=Ye.get(e,u);o=k(k({},a),{},{children:N(a.children,i,1,o)})}var c=u.pop();e.children=N(e.children,c,1,o)},I=function(e,t,r){0===t.length?e.children=r(e.children):T(e,t,(function(e){if(vt.isText(e))throw new Error("Cannot get the element at path [".concat(t,"] because it refers to a leaf node: ").concat(ct.stringify(e)));return k(k({},e),{},{children:r(e.children)})}))},M=function(e,t,r){return T(e,t,(function(e){if(!vt.isText(e))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(ct.stringify(e)));return r(e)}))},z={transform:function(e,t){var r=!1;switch(t.type){case"insert_node":var n=t.path,u=t.node;I(e,B.parent(n),(function(e){var t=n[n.length-1];if(t>e.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(n,"] because the destination is past the end of the node."));return S(e,t,u)})),r=!0;break;case"insert_text":var o=t.path,i=t.offset,a=t.text;if(0===a.length)break;M(e,o,(function(e){var t=e.text.slice(0,i),r=e.text.slice(i);return k(k({},e),{},{text:t+a+r})})),r=!0;break;case"merge_node":var c=t.path,s=c[c.length-1],f=B.previous(c),l=f[f.length-1];I(e,B.parent(c),(function(e){var t,r=e[s],n=e[l];if(vt.isText(r)&&vt.isText(n))t=k(k({},n),{},{text:n.text+r.text});else{if(vt.isText(r)||vt.isText(n))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(c,"] to nodes of different interfaces: ").concat(ct.stringify(r)," ").concat(ct.stringify(n)));t=k(k({},n),{},{children:n.children.concat(r.children)})}return N(e,l,2,t)})),r=!0;break;case"move_node":var D=t.path,d=t.newPath,p=D[D.length-1];if(B.isAncestor(D,d))throw new Error("Cannot move a path [".concat(D,"] to new path [").concat(d,"] because the destination is inside itself."));var v=Ye.get(e,D);I(e,B.parent(D),(function(e){return R(e,p,1)}));var h=B.transform(D,t),C=h[h.length-1];I(e,B.parent(h),(function(e){return S(e,C,v)})),r=!0;break;case"remove_node":var y=t.path,A=y[y.length-1];if(I(e,B.parent(y),(function(e){return R(e,A,1)})),e.selection){var g,m=k({},e.selection),E=j(K.points(m));try{for(E.s();!(g=E.n()).done;){var F=O(g.value,2),b=F[0],w=F[1],x=it.transform(b,t);if(null!=m&&null!=x)m[w]=x;else{var P,_=void 0,z=void 0,L=j(Ye.texts(e));try{for(L.s();!(P=L.n()).done;){var q=O(P.value,2),V=q[0],$=q[1];if(-1!==B.compare($,y)){z=[V,$];break}_=[V,$]}}catch(e){L.e(e)}finally{L.f()}var U=!1;_&&z&&(U=B.equals(z[1],y)?!B.hasPrevious(z[1]):B.common(_[1],y).length<B.common(z[1],y).length),_&&!U?m[w]={path:_[1],offset:_[0].text.length}:z?m[w]={path:z[1],offset:0}:m=null}}}catch(e){E.e(e)}finally{E.f()}m&&K.equals(m,e.selection)||(e.selection=m)}break;case"remove_text":var W=t.path,G=t.offset,J=t.text;if(0===J.length)break;M(e,W,(function(e){var t=e.text.slice(0,G),r=e.text.slice(G+J.length);return k(k({},e),{},{text:t+r})})),r=!0;break;case"set_node":var Z=t.path,Y=t.properties,X=t.newProperties;if(0===Z.length)throw new Error("Cannot set properties on the root node!");T(e,Z,(function(e){var t=k({},e);for(var r in X){if("children"===r||"text"===r)throw new Error('Cannot set the "'.concat(r,'" property of nodes!'));var n=X[r];null==n?delete t[r]:t[r]=n}for(var u in Y)X.hasOwnProperty(u)||delete t[u];return t}));break;case"set_selection":var H=t.newProperties;if(null==H){e.selection=null;break}if(null==e.selection){if(!K.isRange(H))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(ct.stringify(H)," when there is no current selection."));e.selection=k({},H);break}var Q=k({},e.selection);for(var ee in H){var te=H[ee];if(null==te){if("anchor"===ee||"focus"===ee)throw new Error('Cannot remove the "'.concat(ee,'" selection property'));delete Q[ee]}else Q[ee]=te}e.selection=Q;break;case"split_node":var re=t.path,ne=t.position,ue=t.properties,oe=re[re.length-1];if(0===re.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(re,"] because the root node cannot be split."));I(e,B.parent(re),(function(e){var t,r,n=e[oe];if(vt.isText(n)){var u=n.text.slice(0,ne),o=n.text.slice(ne);t=k(k({},n),{},{text:u}),r=k(k({},ue),{},{text:o})}else{var i=n.children.slice(0,ne),a=n.children.slice(ne);t=k(k({},n),{},{children:i}),r=k(k({},ue),{},{children:a})}return N(e,oe,1,t,r)})),r=!0}if(r&&e.selection){var ie,ae=k({},e.selection),ce=j(K.points(ae));try{for(ce.s();!(ie=ce.n()).done;){var se=O(ie.value,2),fe=se[0];ae[se[1]]=it.transform(fe,t)}}catch(e){ce.e(e)}finally{ce.f()}K.equals(ae,e.selection)||(e.selection=ae)}}},L=function(e){return"object"===g(e)&&null!==e},q=function e(t,r){for(var n in t){var u=t[n],o=r[n];if(Array.isArray(u)&&Array.isArray(o)){if(u.length!==o.length)return!1;for(var i=0;i<u.length;i++)if(u[i]!==o[i])return!1}else if(L(u)&&L(o)){if(!e(u,o))return!1}else if(u!==o)return!1}for(var a in r)if(void 0===t[a]&&void 0!==r[a])return!1;return!0},V=D((function(e){e.exports=function(e,t){if(null==e)return{};var r,n,u={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(u[r]=e[r]);return u},e.exports.__esModule=!0,e.exports.default=e.exports}));l(V);var $=l(D((function(e){e.exports=function(e,t){if(null==e)return{};var r,n,u=V(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(u[r]=e[r])}return u},e.exports.__esModule=!0,e.exports.default=e.exports}))),U=D((function(e){var t=A.default;function r(){e.exports=r=function(){return u},e.exports.__esModule=!0,e.exports.default=e.exports;var n,u={},o=Object.prototype,i=o.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",f=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function D(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{D({},"")}catch(n){D=function(e,t,r){return e[t]=r}}function d(e,t,r,n){var u=t&&t.prototype instanceof B?t:B,o=Object.create(u.prototype),i=new k(n||[]);return a(o,"_invoke",{value:O(e,r,i)}),o}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}u.wrap=d;var v="suspendedStart",h="executing",C="completed",y={};function B(){}function A(){}function g(){}var m={};D(m,s,(function(){return this}));var E=Object.getPrototypeOf,F=E&&E(E(S([])));F&&F!==o&&i.call(F,s)&&(m=F);var b=g.prototype=B.prototype=Object.create(m);function w(e){["next","throw","return"].forEach((function(t){D(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,r){function n(u,o,a,c){var s=p(e[u],e,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==t(l)&&i.call(l,"__await")?r.resolve(l.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):r.resolve(l).then((function(e){f.value=e,a(f)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var u;a(this,"_invoke",{value:function(e,t){function o(){return new r((function(r,u){n(e,t,r,u)}))}return u=u?u.then(o,o):o()}})}function O(e,t,r){var u=v;return function(o,i){if(u===h)throw new Error("Generator is already running");if(u===C){if("throw"===o)throw i;return{value:n,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=j(a,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(u===v)throw u=C,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);u=h;var s=p(e,t,r);if("normal"===s.type){if(u=r.done?C:"suspendedYield",s.arg===y)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(u=C,r.method="throw",r.arg=s.arg)}}}function j(e,t){var r=t.method,u=e.iterator[r];if(u===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=n,j(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=p(u,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,y;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function S(e){if(e||""===e){var r=e[s];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var u=-1,o=function t(){for(;++u<e.length;)if(i.call(e,u))return t.value=e[u],t.done=!1,t;return t.value=n,t.done=!0,t};return o.next=o}}throw new TypeError(t(e)+" is not iterable")}return A.prototype=g,a(b,"constructor",{value:g,configurable:!0}),a(g,"constructor",{value:A,configurable:!0}),A.displayName=D(g,l,"GeneratorFunction"),u.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===A||"GeneratorFunction"===(t.displayName||t.name))},u.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,D(e,l,"GeneratorFunction")),e.prototype=Object.create(b),e},u.awrap=function(e){return{__await:e}},w(x.prototype),D(x.prototype,f,(function(){return this})),u.AsyncIterator=x,u.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new x(d(e,t,r,n),o);return u.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},w(b),D(b,l,"Generator"),D(b,s,(function(){return this})),D(b,"toString",(function(){return"[object Generator]"})),u.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},u.values=S,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(_),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,u){return a.type="throw",a.arg=e,t.next=r,u&&(t.method="next",t.arg=n),!!u}for(var u=this.tryEntries.length-1;u>=0;--u){var o=this.tryEntries[u],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=i.call(o,"catchLoc"),s=i.call(o,"finallyLoc");if(c&&s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var u=n;break}}u&&("break"===e||"continue"===e)&&u.tryLoc<=t&&t<=u.finallyLoc&&(u=null);var o=u?u.completion:{};return o.type=e,o.arg=t,u?(this.method="next",this.next=u.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),_(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var u=n.arg;_(r)}return u}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}},u}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}));l(U);var W=U(),G=W;try{regeneratorRuntime=W}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=W:Function("r","regeneratorRuntime = r")(W)}var J=["anchor","focus"];function Z(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var K={edges:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.reverse,n=void 0!==r&&r,u=e.anchor,o=e.focus;return K.isBackward(e)===n?[u,o]:[o,u]},end:function(e){var t=K.edges(e),r=O(t,2)[1];return r},equals:function(e,t){return it.equals(e.anchor,t.anchor)&&it.equals(e.focus,t.focus)},surrounds:function(e,t){var r=K.intersection(e,t);return!!r&&K.equals(r,t)},includes:function(e,t){if(K.isRange(t)){if(K.includes(e,t.anchor)||K.includes(e,t.focus))return!0;var r=K.edges(e),n=O(r,2),u=n[0],o=n[1],i=K.edges(t),a=O(i,2),c=a[0],s=a[1];return it.isBefore(u,c)&&it.isAfter(o,s)}var f=K.edges(e),l=O(f,2),D=l[0],d=l[1],p=!1,v=!1;return it.isPoint(t)?(p=it.compare(t,D)>=0,v=it.compare(t,d)<=0):(p=B.compare(t,D.path)>=0,v=B.compare(t,d.path)<=0),p&&v},intersection:function(e,t){e.anchor,e.focus;var r=$(e,J),n=K.edges(e),u=O(n,2),o=u[0],i=u[1],a=K.edges(t),c=O(a,2),s=c[0],f=c[1],l=it.isBefore(o,s)?s:o,D=it.isBefore(i,f)?i:f;return it.isBefore(D,l)?null:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Z(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({anchor:l,focus:D},r)},isBackward:function(e){var t=e.anchor,r=e.focus;return it.isAfter(t,r)},isCollapsed:function(e){var t=e.anchor,r=e.focus;return it.equals(t,r)},isExpanded:function(e){return!K.isCollapsed(e)},isForward:function(e){return!K.isBackward(e)},isRange:function(e){return L(e)&&it.isPoint(e.anchor)&&it.isPoint(e.focus)},points:G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,[t.anchor,"anchor"];case 2:return e.next=4,[t.focus,"focus"];case 4:case"end":return e.stop()}}),e)})),start:function(e){var t=K.edges(e),r=O(t,1)[0];return r},transform:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var n,u,o=r.affinity,i=void 0===o?"inward":o;if("inward"===i){var a=K.isCollapsed(e);K.isForward(e)?(n="forward",u=a?n:"backward"):(n="backward",u=a?n:"forward")}else"outward"===i?K.isForward(e)?(n="backward",u="forward"):(n="forward",u="backward"):(n=i,u=i);var c=it.transform(e.anchor,t,{affinity:n}),s=it.transform(e.focus,t,{affinity:u});return c&&s?{anchor:c,focus:s}:null}},Y=Object.defineProperty,X=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,ee=(e,t,r)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,te=Symbol.for("immer-nothing"),re=Symbol.for("immer-draftable"),ne=Symbol.for("immer-state");function ue(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var oe=Object.getPrototypeOf;function ie(e){return!!e&&!!e[ne]}function ae(e){var t;return!!e&&(se(e)||Array.isArray(e)||!!e[re]||!!(null==(t=e.constructor)?void 0:t[re])||pe(e)||ve(e))}var ce=Object.prototype.constructor.toString();function se(e){if(!e||"object"!=typeof e)return!1;const t=oe(e);if(null===t)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===ce}function fe(e,t){0===le(e)?Object.entries(e).forEach((([r,n])=>{t(r,n,e)})):e.forEach(((r,n)=>t(n,r,e)))}function le(e){const t=e[ne];return t?t.type_:Array.isArray(e)?1:pe(e)?2:ve(e)?3:0}function De(e,t){return 2===le(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function de(e,t,r){const n=le(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function pe(e){return e instanceof Map}function ve(e){return e instanceof Set}function he(e){return e.copy_||e.base_}function Ce(e,t){if(pe(e))return new Map(e);if(ve(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&se(e)){if(!oe(e)){const t=Object.create(null);return Object.assign(t,e)}return((e,t)=>{for(var r in t||(t={}))H.call(t,r)&&ee(e,r,t[r]);if(X)for(var r of X(t))Q.call(t,r)&&ee(e,r,t[r]);return e})({},e)}const r=Object.getOwnPropertyDescriptors(e);delete r[ne];let n=Reflect.ownKeys(r);for(let t=0;t<n.length;t++){const u=n[t],o=r[u];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[u]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[u]})}return Object.create(oe(e),r)}function ye(e,t=!1){return Ae(e)||ie(e)||!ae(e)||(le(e)>1&&(e.set=e.add=e.clear=e.delete=Be),Object.freeze(e),t&&fe(e,((e,t)=>ye(t,!0)))),e}function Be(){ue(2)}function Ae(e){return Object.isFrozen(e)}var ge,me={};function Ee(e){const t=me[e];return t||ue(0),t}function Fe(){return ge}function be(e,t){t&&(Ee("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function we(e){xe(e),e.drafts_.forEach(je),e.drafts_=null}function xe(e){e===ge&&(ge=e.parent_)}function Oe(e){return ge={drafts_:[],parent_:ge,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function je(e){const t=e[ne];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Pe(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[ne].modified_&&(we(t),ue(4)),ae(e)&&(e=_e(t,e),t.parent_||Se(t,e)),t.patches_&&Ee("Patches").generateReplacementPatches_(r[ne].base_,e,t.patches_,t.inversePatches_)):e=_e(t,r,[]),we(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==te?e:void 0}function _e(e,t,r){if(Ae(t))return t;const n=t[ne];if(!n)return fe(t,((u,o)=>ke(e,n,t,u,o,r))),t;if(n.scope_!==e)return t;if(!n.modified_)return Se(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const t=n.copy_;let u=t,o=!1;3===n.type_&&(u=new Set(t),t.clear(),o=!0),fe(u,((u,i)=>ke(e,n,t,u,i,r,o))),Se(e,t,!1),r&&e.patches_&&Ee("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function ke(e,t,r,n,u,o,i){if(ie(u)){const i=_e(e,u,o&&t&&3!==t.type_&&!De(t.assigned_,n)?o.concat(n):void 0);if(de(r,n,i),!ie(i))return;e.canAutoFreeze_=!1}else i&&r.add(u);if(ae(u)&&!Ae(u)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;_e(e,u),t&&t.scope_.parent_||Se(e,u)}}function Se(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ye(t,r)}var Ne={get(e,t){if(t===ne)return e;const r=he(e);if(!De(r,t))return function(e,t,r){var n;const u=Ie(t,r);return u?"value"in u?u.value:null==(n=u.get)?void 0:n.call(e.draft_):void 0}(e,r,t);const n=r[t];return e.finalized_||!ae(n)?n:n===Te(e.base_,t)?(ze(e),e.copy_[t]=Le(n,e)):n},has:(e,t)=>t in he(e),ownKeys:e=>Reflect.ownKeys(he(e)),set(e,t,r){const n=Ie(he(e),t);if(null==n?void 0:n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=Te(he(e),t),i=null==n?void 0:n[ne];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(((u=r)===(o=n)?0!==u||1/u==1/o:u!=u&&o!=o)&&(void 0!==r||De(e.base_,t)))return!0;ze(e),Me(e)}var u,o;return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Te(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ze(e),Me(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=he(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){ue(11)},getPrototypeOf:e=>oe(e.base_),setPrototypeOf(){ue(12)}},Re={};function Te(e,t){const r=e[ne];return(r?he(r):e)[t]}function Ie(e,t){if(!(t in e))return;let r=oe(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=oe(r)}}function Me(e){e.modified_||(e.modified_=!0,e.parent_&&Me(e.parent_))}function ze(e){e.copy_||(e.copy_=Ce(e.base_,e.scope_.immer_.useStrictShallowCopy_))}fe(Ne,((e,t)=>{Re[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Re.deleteProperty=function(e,t){return Re.set.call(this,e,t,void 0)},Re.set=function(e,t,r){return Ne.set.call(this,e[0],t,r,e[0])};function Le(e,t){const r=pe(e)?Ee("MapSet").proxyMap_(e,t):ve(e)?Ee("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Fe(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let u=n,o=Ne;r&&(u=[n],o=Re);const{revoke:i,proxy:a}=Proxy.revocable(u,o);return n.draft_=a,n.revoke_=i,a}(e,t);return(t?t.scope_:Fe()).drafts_.push(r),r}function qe(e){if(!ae(e)||Ae(e))return e;const t=e[ne];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ce(e,t.scope_.immer_.useStrictShallowCopy_)}else r=Ce(e,!0);return fe(r,((e,t)=>{de(r,e,qe(t))})),t&&(t.finalized_=!1),r}var Ve=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,r)=>{if("function"==typeof e&&"function"!=typeof t){const r=t;t=e;const n=this;return function(e=r,...u){return n.produce(e,(e=>t.call(this,e,...u)))}}let n;if("function"!=typeof t&&ue(6),void 0!==r&&"function"!=typeof r&&ue(7),ae(e)){const u=Oe(this),o=Le(e,void 0);let i=!0;try{n=t(o),i=!1}finally{i?we(u):xe(u)}return be(u,r),Pe(n,u)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===te&&(n=void 0),this.autoFreeze_&&ye(n,!0),r){const t=[],u=[];Ee("Patches").generateReplacementPatches_(e,n,t,u),r(t,u)}return n}ue(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,(t=>e(t,...r)));let r,n;return[this.produce(e,t,((e,t)=>{r=e,n=t})),r,n]},"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof(null==e?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ae(e)||ue(8),ie(e)&&(e=function(e){ie(e)||ue(10);return qe(e)}(e));const t=Oe(this),r=Le(e,void 0);return r[ne].isManual_=!0,xe(t),r}finishDraft(e,t){const r=e&&e[ne];r&&r.isManual_||ue(9);const{scope_:n}=r;return be(n,t),Pe(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=Ee("Patches").applyPatches_;return ie(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},$e=Ve.produce;Ve.produceWithPatches.bind(Ve),Ve.setAutoFreeze.bind(Ve),Ve.setUseStrictShallowCopy.bind(Ve),Ve.applyPatches.bind(Ve),Ve.createDraft.bind(Ve),Ve.finishDraft.bind(Ve);var Ue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.deep,n=void 0!==r&&r;if(!L(e))return!1;var u="function"==typeof e.apply;if(u)return!1;var o=n?Ye.isNodeList(e.children):Array.isArray(e.children);return o},We={isAncestor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.deep,n=void 0!==r&&r;return L(e)&&Ye.isNodeList(e.children,{deep:n})},isElement:Ue,isElementList:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.deep,n=void 0!==r&&r;return Array.isArray(e)&&e.every((function(e){return We.isElement(e,{deep:n})}))},isElementProps:function(e){return void 0!==e.children},isElementType:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return Ue(e)&&e[r]===t},matches:function(e,t){for(var r in t)if("children"!==r&&e[r]!==t[r])return!1;return!0}},Ge=["children"],Je=["text"];function Ze(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Ke(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ke(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,u=function(){};return{s:u,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw o}}}}function Ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Ye={ancestor:function(e,t){var r=Ye.get(e,t);if(vt.isText(r))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(ct.stringify(r)));return r},ancestors:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return G.mark((function n(){var u,o,i,a,c;return G.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:u=Ze(B.ancestors(t,r)),n.prev=1,u.s();case 3:if((o=u.n()).done){n.next=11;break}return i=o.value,a=Ye.ancestor(e,i),c=[a,i],n.next=9,c;case 9:n.next=3;break;case 11:n.next=16;break;case 13:n.prev=13,n.t0=n.catch(1),u.e(n.t0);case 16:return n.prev=16,u.f(),n.finish(16);case 19:case"end":return n.stop()}}),n,null,[[1,13,16,19]])}))()},child:function(e,t){if(vt.isText(e))throw new Error("Cannot get the child of a text node: ".concat(ct.stringify(e)));var r=e.children[t];if(null==r)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(ct.stringify(e)));return r},children:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return G.mark((function n(){var u,o,i,a,c,s,f;return G.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:u=r.reverse,o=void 0!==u&&u,i=Ye.ancestor(e,t),a=i.children,c=o?a.length-1:0;case 4:if(!(o?c>=0:c<a.length)){n.next=12;break}return s=Ye.child(i,c),f=t.concat(c),n.next=9,[s,f];case 9:c=o?c-1:c+1,n.next=4;break;case 12:case"end":return n.stop()}}),n)}))()},common:function(e,t,r){var n=B.common(t,r);return[Ye.get(e,n),n]},descendant:function(e,t){var r=Ye.get(e,t);if(tt.isEditor(r))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(ct.stringify(r)));return r},descendants:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return G.mark((function r(){var n,u,o,i,a;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:n=Ze(Ye.nodes(e,t)),r.prev=1,n.s();case 3:if((u=n.n()).done){r.next=10;break}if(o=O(u.value,2),i=o[0],0===(a=o[1]).length){r.next=8;break}return r.next=8,[i,a];case 8:r.next=3;break;case 10:r.next=15;break;case 12:r.prev=12,r.t0=r.catch(1),n.e(r.t0);case 15:return r.prev=15,n.f(),r.finish(15);case 18:case"end":return r.stop()}}),r,null,[[1,12,15,18]])}))()},elements:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return G.mark((function r(){var n,u,o,i,a;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:n=Ze(Ye.nodes(e,t)),r.prev=1,n.s();case 3:if((u=n.n()).done){r.next=10;break}if(o=O(u.value,2),i=o[0],a=o[1],!We.isElement(i)){r.next=8;break}return r.next=8,[i,a];case 8:r.next=3;break;case 10:r.next=15;break;case 12:r.prev=12,r.t0=r.catch(1),n.e(r.t0);case 15:return r.prev=15,n.f(),r.finish(15);case 18:case"end":return r.stop()}}),r,null,[[1,12,15,18]])}))()},extractProps:function(e){return We.isAncestor(e)?(e.children,$(e,Ge)):(e.text,$(e,Je))},first:function(e,t){for(var r=t.slice(),n=Ye.get(e,r);n&&!vt.isText(n)&&0!==n.children.length;)n=n.children[0],r.push(0);return[n,r]},fragment:function(e,t){if(vt.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(ct.stringify(e)));var r=$e({children:e.children},(function(e){var r,n=K.edges(t),u=O(n,2),o=u[0],i=u[1],a=Ye.nodes(e,{reverse:!0,pass:function(e){var r=O(e,2)[1];return!K.includes(t,r)}}),c=Ze(a);try{for(c.s();!(r=c.n()).done;){var s=O(r.value,2)[1];if(!K.includes(t,s)){var f=Ye.parent(e,s),l=s[s.length-1];f.children.splice(l,1)}if(B.equals(s,i.path)){var D=Ye.leaf(e,s);D.text=D.text.slice(0,i.offset)}if(B.equals(s,o.path)){var d=Ye.leaf(e,s);d.text=d.text.slice(o.offset)}}}catch(e){c.e(e)}finally{c.f()}tt.isEditor(e)&&(e.selection=null)}));return r.children},get:function(e,t){var r=Ye.getIf(e,t);if(void 0===r)throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(ct.stringify(e)));return r},getIf:function(e,t){for(var r=e,n=0;n<t.length;n++){var u=t[n];if(vt.isText(r)||!r.children[u])return;r=r.children[u]}return r},has:function(e,t){for(var r=e,n=0;n<t.length;n++){var u=t[n];if(vt.isText(r)||!r.children[u])return!1;r=r.children[u]}return!0},isNode:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.deep,n=void 0!==r&&r;return vt.isText(e)||We.isElement(e,{deep:n})||tt.isEditor(e,{deep:n})},isNodeList:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.deep,n=void 0!==r&&r;return Array.isArray(e)&&e.every((function(e){return Ye.isNode(e,{deep:n})}))},last:function(e,t){for(var r=t.slice(),n=Ye.get(e,r);n&&!vt.isText(n)&&0!==n.children.length;){var u=n.children.length-1;n=n.children[u],r.push(u)}return[n,r]},leaf:function(e,t){var r=Ye.get(e,t);if(!vt.isText(r))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(ct.stringify(r)));return r},levels:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return G.mark((function n(){var u,o,i,a;return G.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:u=Ze(B.levels(t,r)),n.prev=1,u.s();case 3:if((o=u.n()).done){n.next=10;break}return i=o.value,a=Ye.get(e,i),n.next=8,[a,i];case 8:n.next=3;break;case 10:n.next=15;break;case 12:n.prev=12,n.t0=n.catch(1),u.e(n.t0);case 15:return n.prev=15,u.f(),n.finish(15);case 18:case"end":return n.stop()}}),n,null,[[1,12,15,18]])}))()},matches:function(e,t){return We.isElement(e)&&We.isElementProps(t)&&We.matches(e,t)||vt.isText(e)&&vt.isTextProps(t)&&vt.matches(e,t)},nodes:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return G.mark((function r(){var n,u,o,i,a,c,s,f,l,D,d,p;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:n=t.pass,u=t.reverse,o=void 0!==u&&u,i=t.from,a=void 0===i?[]:i,c=t.to,s=new Set,f=[],l=e;case 5:if(!c||!(o?B.isBefore(f,c):B.isAfter(f,c))){r.next=8;break}return r.abrupt("break",36);case 8:if(s.has(l)){r.next=11;break}return r.next=11,[l,f];case 11:if(s.has(l)||vt.isText(l)||0===l.children.length||null!=n&&!1!==n([l,f])){r.next=18;break}return s.add(l),D=o?l.children.length-1:0,B.isAncestor(f,a)&&(D=a[f.length]),f=f.concat(D),l=Ye.get(e,f),r.abrupt("continue",5);case 18:if(0!==f.length){r.next=20;break}return r.abrupt("break",36);case 20:if(o){r.next=26;break}if(d=B.next(f),!Ye.has(e,d)){r.next=26;break}return f=d,l=Ye.get(e,f),r.abrupt("continue",5);case 26:if(!o||0===f[f.length-1]){r.next=31;break}return p=B.previous(f),f=p,l=Ye.get(e,f),r.abrupt("continue",5);case 31:f=B.parent(f),l=Ye.get(e,f),s.add(l),r.next=5;break;case 36:case"end":return r.stop()}}),r)}))()},parent:function(e,t){var r=B.parent(t),n=Ye.get(e,r);if(vt.isText(n))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return n},string:function(e){return vt.isText(e)?e.text:e.children.map(Ye.string).join("")},texts:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return G.mark((function r(){var n,u,o,i,a;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:n=Ze(Ye.nodes(e,t)),r.prev=1,n.s();case 3:if((u=n.n()).done){r.next=10;break}if(o=O(u.value,2),i=o[0],a=o[1],!vt.isText(i)){r.next=8;break}return r.next=8,[i,a];case 8:r.next=3;break;case 10:r.next=15;break;case 12:r.prev=12,r.t0=r.catch(1),n.e(r.t0);case 15:return r.prev=15,n.f(),r.finish(15);case 18:case"end":return r.stop()}}),r,null,[[1,12,15,18]])}))()}};function Xe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function He(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xe(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Qe={isNodeOperation:function(e){return Qe.isOperation(e)&&e.type.endsWith("_node")},isOperation:function(e){if(!L(e))return!1;switch(e.type){case"insert_node":case"remove_node":return B.isPath(e.path)&&Ye.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&B.isPath(e.path);case"merge_node":return"number"==typeof e.position&&B.isPath(e.path)&&L(e.properties);case"move_node":return B.isPath(e.path)&&B.isPath(e.newPath);case"set_node":return B.isPath(e.path)&&L(e.properties)&&L(e.newProperties);case"set_selection":return null===e.properties&&K.isRange(e.newProperties)||null===e.newProperties&&K.isRange(e.properties)||L(e.properties)&&L(e.newProperties);case"split_node":return B.isPath(e.path)&&"number"==typeof e.position&&L(e.properties);default:return!1}},isOperationList:function(e){return Array.isArray(e)&&e.every((function(e){return Qe.isOperation(e)}))},isSelectionOperation:function(e){return Qe.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation:function(e){return Qe.isOperation(e)&&e.type.endsWith("_text")},inverse:function(e){switch(e.type){case"insert_node":return He(He({},e),{},{type:"remove_node"});case"insert_text":return He(He({},e),{},{type:"remove_text"});case"merge_node":return He(He({},e),{},{type:"split_node",path:B.previous(e.path)});case"move_node":var t=e.newPath,r=e.path;if(B.equals(t,r))return e;if(B.isSibling(r,t))return He(He({},e),{},{path:t,newPath:r});var n=B.transform(r,e),u=B.transform(B.next(r),e);return He(He({},e),{},{path:n,newPath:u});case"remove_node":return He(He({},e),{},{type:"insert_node"});case"remove_text":return He(He({},e),{},{type:"insert_text"});case"set_node":var o=e.properties,i=e.newProperties;return He(He({},e),{},{properties:i,newProperties:o});case"set_selection":var a=e.properties,c=e.newProperties;return He(He({},e),{},null==a?{properties:c,newProperties:null}:null==c?{properties:null,newProperties:a}:{properties:c,newProperties:a});case"split_node":return He(He({},e),{},{type:"merge_node",path:B.next(e.path)})}}},et=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.deep,n=void 0!==r&&r;if(!L(e))return!1;var u="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||L(e.marks))&&(null===e.selection||K.isRange(e.selection))&&(!n||Ye.isNodeList(e.children))&&Qe.isOperationList(e.operations);return u},tt={above:function(e,t){return e.above(t)},addMark:function(e,t,r){e.addMark(t,r)},after:function(e,t,r){return e.after(t,r)},before:function(e,t,r){return e.before(t,r)},deleteBackward:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.unit,n=void 0===r?"character":r;e.deleteBackward(n)},deleteForward:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.unit,n=void 0===r?"character":r;e.deleteForward(n)},deleteFragment:function(e,t){e.deleteFragment(t)},edges:function(e,t){return e.edges(t)},elementReadOnly:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:function(e,t){return e.end(t)},first:function(e,t){return e.first(t)},fragment:function(e,t){return e.fragment(t)},hasBlocks:function(e,t){return e.hasBlocks(t)},hasInlines:function(e,t){return e.hasInlines(t)},hasPath:function(e,t){return e.hasPath(t)},hasTexts:function(e,t){return e.hasTexts(t)},insertBreak:function(e){e.insertBreak()},insertFragment:function(e,t,r){e.insertFragment(t,r)},insertNode:function(e,t){e.insertNode(t)},insertSoftBreak:function(e){e.insertSoftBreak()},insertText:function(e,t){e.insertText(t)},isBlock:function(e,t){return e.isBlock(t)},isEdge:function(e,t,r){return e.isEdge(t,r)},isEditor:function(e){return et(e)},isElementReadOnly:function(e,t){return e.isElementReadOnly(t)},isEmpty:function(e,t){return e.isEmpty(t)},isEnd:function(e,t,r){return e.isEnd(t,r)},isInline:function(e,t){return e.isInline(t)},isNormalizing:function(e){return e.isNormalizing()},isSelectable:function(e,t){return e.isSelectable(t)},isStart:function(e,t,r){return e.isStart(t,r)},isVoid:function(e,t){return e.isVoid(t)},last:function(e,t){return e.last(t)},leaf:function(e,t,r){return e.leaf(t,r)},levels:function(e,t){return e.levels(t)},marks:function(e){return e.getMarks()},next:function(e,t){return e.next(t)},node:function(e,t,r){return e.node(t,r)},nodes:function(e,t){return e.nodes(t)},normalize:function(e,t){e.normalize(t)},parent:function(e,t,r){return e.parent(t,r)},path:function(e,t,r){return e.path(t,r)},pathRef:function(e,t,r){return e.pathRef(t,r)},pathRefs:function(e){return e.pathRefs()},point:function(e,t,r){return e.point(t,r)},pointRef:function(e,t,r){return e.pointRef(t,r)},pointRefs:function(e){return e.pointRefs()},positions:function(e,t){return e.positions(t)},previous:function(e,t){return e.previous(t)},range:function(e,t,r){return e.range(t,r)},rangeRef:function(e,t,r){return e.rangeRef(t,r)},rangeRefs:function(e){return e.rangeRefs()},removeMark:function(e,t){e.removeMark(t)},setNormalizing:function(e,t){e.setNormalizing(t)},start:function(e,t){return e.start(t)},string:function(e,t,r){return e.string(t,r)},unhangRange:function(e,t,r){return e.unhangRange(t,r)},void:function(e,t){return e.void(t)},withoutNormalizing:function(e,t){e.withoutNormalizing(t)},shouldMergeNodesRemovePrevNode:function(e,t,r){return e.shouldMergeNodesRemovePrevNode(t,r)}},rt={isLocation:function(e){return B.isPath(e)||it.isPoint(e)||K.isRange(e)}},nt={isSpan:function(e){return Array.isArray(e)&&2===e.length&&e.every(B.isPath)}};function ut(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ot(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(r),!0).forEach((function(t){F(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ut(Object(r)).forEach((function(t){Object.defineProperty(e,t,Ob