@yoopta/lists 4.9.7 → 4.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import{generateId as e,Blocks as t,Elements as r,useBlockData as n,findPluginBlo
5
5
  * Copyright (c) 2014-2017, Jon Schlinkert.
6
6
  * Released under the MIT License.
7
7
  */
8
- function x(e){return"[object Object]"===Object.prototype.toString.call(e)}function O(e){var t,r;return!1!==x(e)&&(void 0===(t=e.constructor)||!1!==x(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf"))}var _=Symbol.for("immer-nothing"),k=Symbol.for("immer-draftable"),P=Symbol.for("immer-state");function j(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var N=Object.getPrototypeOf;function E(e){return!!e&&!!e[P]}function S(e){return!!e&&(A(e)||Array.isArray(e)||!!e[k]||!!e.constructor?.[k]||D(e)||$(e))}var L=Object.prototype.constructor.toString();function A(e){if(!e||"object"!=typeof e)return!1;const t=N(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)===L}function T(e,t){0===B(e)?Reflect.ownKeys(e).forEach((r=>{t(r,e[r],e)})):e.forEach(((r,n)=>t(n,r,e)))}function B(e){const t=e[P];return t?t.type_:Array.isArray(e)?1:D(e)?2:$(e)?3:0}function z(e,t){return 2===B(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function C(e,t,r){const n=B(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function D(e){return e instanceof Map}function $(e){return e instanceof Set}function R(e){return e.copy_||e.base_}function q(e,t){if(D(e))return new Map(e);if($(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&A(e)){if(!N(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const r=Object.getOwnPropertyDescriptors(e);delete r[P];let n=Reflect.ownKeys(r);for(let t=0;t<n.length;t++){const o=n[t],i=r[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(r[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(N(e),r)}function F(e,t=!1){return I(e)||E(e)||!S(e)||(B(e)>1&&(e.set=e.add=e.clear=e.delete=M),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>F(t,!0)))),e}function M(){j(2)}function I(e){return Object.isFrozen(e)}var W,V={};function U(e){const t=V[e];return t||j(0),t}function K(){return W}function J(e,t){t&&(U("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Z(e){X(e),e.drafts_.forEach(G),e.drafts_=null}function X(e){e===W&&(W=e.parent_)}function H(e){return W={drafts_:[],parent_:W,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function G(e){const t=e[P];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Q(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[P].modified_&&(Z(t),j(4)),S(e)&&(e=Y(t,e),t.parent_||te(t,e)),t.patches_&&U("Patches").generateReplacementPatches_(r[P].base_,e,t.patches_,t.inversePatches_)):e=Y(t,r,[]),Z(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==_?e:void 0}function Y(e,t,r){if(I(t))return t;const n=t[P];if(!n)return T(t,((o,i)=>ee(e,n,t,o,i,r))),t;if(n.scope_!==e)return t;if(!n.modified_)return te(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const t=n.copy_;let o=t,i=!1;3===n.type_&&(o=new Set(t),t.clear(),i=!0),T(o,((o,a)=>ee(e,n,t,o,a,r,i))),te(e,t,!1),r&&e.patches_&&U("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function ee(e,t,r,n,o,i,a){if(E(o)){const a=Y(e,o,i&&t&&3!==t.type_&&!z(t.assigned_,n)?i.concat(n):void 0);if(C(r,n,a),!E(a))return;e.canAutoFreeze_=!1}else a&&r.add(o);if(S(o)&&!I(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Y(e,o),t&&t.scope_.parent_||"symbol"==typeof n||!Object.prototype.propertyIsEnumerable.call(r,n)||te(e,o)}}function te(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&F(t,r)}var re={get(e,t){if(t===P)return e;const r=R(e);if(!z(r,t))return function(e,t,r){const n=ie(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,r,t);const n=r[t];return e.finalized_||!S(n)?n:n===oe(e.base_,t)?(se(e),e.copy_[t]=le(n,e)):n},has:(e,t)=>t in R(e),ownKeys:e=>Reflect.ownKeys(R(e)),set(e,t,r){const n=ie(R(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=oe(R(e),t),a=n?.[P];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(((o=r)===(i=n)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==r||z(e.base_,t)))return!0;se(e),ae(e)}var o,i;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!==oe(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,se(e),ae(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=R(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){j(11)},getPrototypeOf:e=>N(e.base_),setPrototypeOf(){j(12)}},ne={};function oe(e,t){const r=e[P];return(r?R(r):e)[t]}function ie(e,t){if(!(t in e))return;let r=N(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=N(r)}}function ae(e){e.modified_||(e.modified_=!0,e.parent_&&ae(e.parent_))}function se(e){e.copy_||(e.copy_=q(e.base_,e.scope_.immer_.useStrictShallowCopy_))}T(re,((e,t)=>{ne[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),ne.deleteProperty=function(e,t){return ne.set.call(this,e,t,void 0)},ne.set=function(e,t,r){return re.set.call(this,e[0],t,r,e[0])};function le(e,t){const r=D(e)?U("MapSet").proxyMap_(e,t):$(e)?U("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:K(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,i=re;r&&(o=[n],i=ne);const{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,s}(e,t);return(t?t.scope_:K()).drafts_.push(r),r}function ce(e){if(!S(e)||I(e))return e;const t=e[P];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=q(e,t.scope_.immer_.useStrictShallowCopy_)}else r=q(e,!0);return T(r,((e,t)=>{C(r,e,ce(t))})),t&&(t.finalized_=!1),r}var de=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,...o){return n.produce(e,(e=>t.call(this,e,...o)))}}let n;if("function"!=typeof t&&j(6),void 0!==r&&"function"!=typeof r&&j(7),S(e)){const o=H(this),i=le(e,void 0);let a=!0;try{n=t(i),a=!1}finally{a?Z(o):X(o)}return J(o,r),Q(n,o)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===_&&(n=void 0),this.autoFreeze_&&F(n,!0),r){const t=[],o=[];U("Patches").generateReplacementPatches_(e,n,t,o),r(t,o)}return n}j(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 e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){S(e)||j(8),E(e)&&(e=function(e){E(e)||j(10);return ce(e)}(e));const t=H(this),r=le(e,void 0);return r[P].isManual_=!0,X(t),r}finishDraft(e,t){const r=e&&e[P];r&&r.isManual_||j(9);const{scope_:n}=r;return J(n,t),Q(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=U("Patches").applyPatches_;return E(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},pe=de.produce;de.produceWithPatches.bind(de),de.setAutoFreeze.bind(de),de.setUseStrictShallowCopy.bind(de),de.applyPatches.bind(de);var fe=de.createDraft.bind(de),ue=de.finishDraft.bind(de),he={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,n=he.levels(e,t);return n=r?n.slice(1):n.slice(0,-1)},common(e,t){for(var r=[],n=0;n<e.length&&n<t.length;n++){var o=e[n];if(o!==t[n])break;r.push(o)}return r},compare(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(e,t){var r=e.length-1,n=e.slice(0,r),o=t.slice(0,r),i=e[r],a=t[r];return he.equals(n,o)&&i>a},endsAt(e,t){var r=e.length,n=e.slice(0,r),o=t.slice(0,r);return he.equals(n,o)},endsBefore(e,t){var r=e.length-1,n=e.slice(0,r),o=t.slice(0,r),i=e[r],a=t[r];return he.equals(n,o)&&i<a},equals:(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r])),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===he.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===he.compare(e,t),isBefore:(e,t)=>-1===he.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===he.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===he.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===he.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===he.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var r=e.slice(0,-1),n=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&he.equals(r,n)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,n=[],o=0;o<=e.length;o++)n.push(e.slice(0,o));return r&&n.reverse(),n},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!he.isAncestor(t,e)&&!he.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var n=[...e],{affinity:o="forward"}=r;if(0===e.length)return n;switch(t.type){case"insert_node":var{path:i}=t;(he.equals(i,n)||he.endsBefore(i,n)||he.isAncestor(i,n))&&(n[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(he.equals(a,n)||he.isAncestor(a,n))return null;he.endsBefore(a,n)&&(n[a.length-1]-=1);break;case"merge_node":var{path:s,position:l}=t;he.equals(s,n)||he.endsBefore(s,n)?n[s.length-1]-=1:he.isAncestor(s,n)&&(n[s.length-1]-=1,n[s.length]+=l);break;case"split_node":var{path:c,position:d}=t;if(he.equals(c,n)){if("forward"===o)n[n.length-1]+=1;else if("backward"!==o)return null}else he.endsBefore(c,n)?n[c.length-1]+=1:he.isAncestor(c,n)&&e[c.length]>=d&&(n[c.length-1]+=1,n[c.length]-=d);break;case"move_node":var{path:p,newPath:f}=t;if(he.equals(p,f))return n;if(he.isAncestor(p,n)||he.equals(p,n)){var u=f.slice();return he.endsBefore(p,f)&&p.length<f.length&&(u[p.length-1]-=1),u.concat(n.slice(p.length))}he.isSibling(p,f)&&(he.isAncestor(f,n)||he.equals(f,n))?he.endsBefore(p,n)?n[p.length-1]-=1:n[p.length-1]+=1:he.endsBefore(f,n)||he.equals(f,n)||he.isAncestor(f,n)?(he.endsBefore(p,n)&&(n[p.length-1]-=1),n[f.length-1]+=1):he.endsBefore(p,n)&&(he.equals(f,n)&&(n[f.length-1]+=1),n[p.length-1]-=1)}return n}};function ge(e){return ge="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},ge(e)}function ye(e){var t=function(e,t){if("object"!==ge(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ge(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ge(t)?t:String(t)}function me(e,t,r){return(t=ye(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function be(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 ve(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?be(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):be(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var we={transform(e,t){e.children=fe(e.children);var r=e.selection&&fe(e.selection);try{r=((e,t,r)=>{switch(r.type){case"insert_node":var{path:n,node:o}=r,i=Be.parent(e,n),a=n[n.length-1];if(a>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(n,"] because the destination is past the end of the node."));if(i.children.splice(a,0,o),t)for(var[s,l]of Ne.points(t))t[l]=Me.transform(s,r);break;case"insert_text":var{path:c,offset:d,text:p}=r;if(0===p.length)break;var f=Be.leaf(e,c),u=f.text.slice(0,d),h=f.text.slice(d);if(f.text=u+p+h,t)for(var[g,y]of Ne.points(t))t[y]=Me.transform(g,r);break;case"merge_node":var{path:m}=r,b=Be.get(e,m),v=he.previous(m),w=Be.get(e,v),x=Be.parent(e,m),O=m[m.length-1];if(Xe.isText(b)&&Xe.isText(w))w.text+=b.text;else{if(Xe.isText(b)||Xe.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(m,"] to nodes of different interfaces: ").concat(We.stringify(b)," ").concat(We.stringify(w)));w.children.push(...b.children)}if(x.children.splice(O,1),t)for(var[_,k]of Ne.points(t))t[k]=Me.transform(_,r);break;case"move_node":var{path:P,newPath:j}=r;if(he.isAncestor(P,j))throw new Error("Cannot move a path [".concat(P,"] to new path [").concat(j,"] because the destination is inside itself."));var N=Be.get(e,P),E=Be.parent(e,P),S=P[P.length-1];E.children.splice(S,1);var L=he.transform(P,r),A=Be.get(e,he.parent(L)),T=L[L.length-1];if(A.children.splice(T,0,N),t)for(var[B,z]of Ne.points(t))t[z]=Me.transform(B,r);break;case"remove_node":var{path:C}=r,D=C[C.length-1];if(Be.parent(e,C).children.splice(D,1),t)for(var[$,R]of Ne.points(t)){var q=Me.transform($,r);if(null!=t&&null!=q)t[R]=q;else{var F=void 0,M=void 0;for(var[I,W]of Be.texts(e)){if(-1!==he.compare(W,C)){M=[I,W];break}F=[I,W]}var V=!1;F&&M&&(V=he.equals(M[1],C)?!he.hasPrevious(M[1]):he.common(F[1],C).length<he.common(M[1],C).length),F&&!V?($.path=F[1],$.offset=F[0].text.length):M?($.path=M[1],$.offset=0):t=null}}break;case"remove_text":var{path:U,offset:K,text:J}=r;if(0===J.length)break;var Z=Be.leaf(e,U),X=Z.text.slice(0,K),H=Z.text.slice(K+J.length);if(Z.text=X+H,t)for(var[G,Q]of Ne.points(t))t[Q]=Me.transform(G,r);break;case"set_node":var{path:Y,properties:ee,newProperties:te}=r;if(0===Y.length)throw new Error("Cannot set properties on the root node!");var re=Be.get(e,Y);for(var ne in te){if("children"===ne||"text"===ne)throw new Error('Cannot set the "'.concat(ne,'" property of nodes!'));var oe=te[ne];null==oe?delete re[ne]:re[ne]=oe}for(var ie in ee)te.hasOwnProperty(ie)||delete re[ie];break;case"set_selection":var{newProperties:ae}=r;if(null==ae)t=ae;else{if(null==t){if(!Ne.isRange(ae))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(We.stringify(ae)," when there is no current selection."));t=ve({},ae)}for(var se in ae){var le=ae[se];if(null==le){if("anchor"===se||"focus"===se)throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=le}}break;case"split_node":var{path:ce,position:de,properties:pe}=r;if(0===ce.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ce,"] because the root node cannot be split."));var fe,ue=Be.get(e,ce),ge=Be.parent(e,ce),ye=ce[ce.length-1];if(Xe.isText(ue)){var me=ue.text.slice(0,de),be=ue.text.slice(de);ue.text=me,fe=ve(ve({},pe),{},{text:be})}else{var we=ue.children.slice(0,de),xe=ue.children.slice(de);ue.children=we,fe=ve(ve({},pe),{},{children:xe})}if(ge.children.splice(ye+1,0,fe),t)for(var[Oe,_e]of Ne.points(t))t[_e]=Me.transform(Oe,r)}return t})(e,r,t)}finally{e.children=ue(e.children),e.selection=r?E(r)?ue(r):r:null}}},xe={insertNodes(e,t,r){e.insertNodes(t,r)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,r){e.setNodes(t,r)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,r){e.unsetNodes(t,r)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,r){e.wrapNodes(t,r)}},Oe={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,r){e.setPoint(t,r)},setSelection(e,t){e.setSelection(t)}},_e=(e,t)=>{for(var r in e){var n=e[r],o=t[r];if(O(n)&&O(o)){if(!_e(n,o))return!1}else if(Array.isArray(n)&&Array.isArray(o)){if(n.length!==o.length)return!1;for(var i=0;i<n.length;i++)if(n[i]!==o[i])return!1}else if(n!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0};function ke(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var Pe=["anchor","focus"];function je(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 Ne={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,{anchor:n,focus:o}=e;return Ne.isBackward(e)===r?[n,o]:[o,n]},end(e){var[,t]=Ne.edges(e);return t},equals:(e,t)=>Me.equals(e.anchor,t.anchor)&&Me.equals(e.focus,t.focus),includes(e,t){if(Ne.isRange(t)){if(Ne.includes(e,t.anchor)||Ne.includes(e,t.focus))return!0;var[r,n]=Ne.edges(e),[o,i]=Ne.edges(t);return Me.isBefore(r,o)&&Me.isAfter(n,i)}var[a,s]=Ne.edges(e),l=!1,c=!1;return Me.isPoint(t)?(l=Me.compare(t,a)>=0,c=Me.compare(t,s)<=0):(l=he.compare(t,a.path)>=0,c=he.compare(t,s.path)<=0),l&&c},intersection(e,t){var r=ke(e,Pe),[n,o]=Ne.edges(e),[i,a]=Ne.edges(t),s=Me.isBefore(n,i)?i:n,l=Me.isBefore(o,a)?o:a;return Me.isBefore(l,s)?null:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?je(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):je(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({anchor:s,focus:l},r)},isBackward(e){var{anchor:t,focus:r}=e;return Me.isAfter(t,r)},isCollapsed(e){var{anchor:t,focus:r}=e;return Me.equals(t,r)},isExpanded:e=>!Ne.isCollapsed(e),isForward:e=>!Ne.isBackward(e),isRange:e=>O(e)&&Me.isPoint(e.anchor)&&Me.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Ne.edges(e);return t},transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return pe(e,(e=>{if(null===e)return null;var n,o,{affinity:i="inward"}=r;if("inward"===i){var a=Ne.isCollapsed(e);Ne.isForward(e)?(n="forward",o=a?n:"backward"):(n="backward",o=a?n:"forward")}else"outward"===i?Ne.isForward(e)?(n="backward",o="forward"):(n="forward",o="backward"):(n=i,o=i);var s=Me.transform(e.anchor,t,{affinity:n}),l=Me.transform(e.focus,t,{affinity:o});if(!s||!l)return null;e.anchor=s,e.focus=l}))}},Ee=e=>O(e)&&Be.isNodeList(e.children)&&!Re.isEditor(e),Se={isAncestor:e=>O(e)&&Be.isNodeList(e.children),isElement:Ee,isElementList:e=>Array.isArray(e)&&e.every((e=>Se.isElement(e))),isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return Ee(e)&&e[r]===t},matches(e,t){for(var r in t)if("children"!==r&&e[r]!==t[r])return!1;return!0}},Le=["children"],Ae=["text"],Te=new WeakMap,Be={ancestor(e,t){var r=Be.get(e,t);if(Xe.isText(r))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(We.stringify(r)));return r},ancestors(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of he.ancestors(t,r)){var o=[Be.ancestor(e,n),n];yield o}}()},child(e,t){if(Xe.isText(e))throw new Error("Cannot get the child of a text node: ".concat(We.stringify(e)));var r=e.children[t];if(null==r)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(We.stringify(e)));return r},children(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:n=!1}=r,o=Be.ancestor(e,t),{children:i}=o,a=n?i.length-1:0;n?a>=0:a<i.length;){var s=Be.child(o,a),l=t.concat(a);yield[s,l],a=n?a-1:a+1}}()},common(e,t,r){var n=he.common(t,r);return[Be.get(e,n),n]},descendant(e,t){var r=Be.get(e,t);if(Re.isEditor(r))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(We.stringify(r)));return r},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of Be.nodes(e,t))0!==n.length&&(yield[r,n])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of Be.nodes(e,t))Se.isElement(r)&&(yield[r,n])}()},extractProps:e=>Se.isAncestor(e)?ke(e,Le):ke(e,Ae),first(e,t){for(var r=t.slice(),n=Be.get(e,r);n&&!Xe.isText(n)&&0!==n.children.length;)n=n.children[0],r.push(0);return[n,r]},fragment(e,t){if(Xe.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(We.stringify(e)));return pe({children:e.children},(e=>{var[r,n]=Ne.edges(t),o=Be.nodes(e,{reverse:!0,pass:e=>{var[,r]=e;return!Ne.includes(t,r)}});for(var[,i]of o){if(!Ne.includes(t,i)){var a=Be.parent(e,i),s=i[i.length-1];a.children.splice(s,1)}if(he.equals(i,n.path)){var l=Be.leaf(e,i);l.text=l.text.slice(0,n.offset)}if(he.equals(i,r.path)){var c=Be.leaf(e,i);c.text=c.text.slice(r.offset)}}Re.isEditor(e)&&(e.selection=null)})).children},get(e,t){for(var r=e,n=0;n<t.length;n++){var o=t[n];if(Xe.isText(r)||!r.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(We.stringify(e)));r=r.children[o]}return r},has(e,t){for(var r=e,n=0;n<t.length;n++){var o=t[n];if(Xe.isText(r)||!r.children[o])return!1;r=r.children[o]}return!0},isNode:e=>Xe.isText(e)||Se.isElement(e)||Re.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=Te.get(e);if(void 0!==t)return t;var r=e.every((e=>Be.isNode(e)));return Te.set(e,r),r},last(e,t){for(var r=t.slice(),n=Be.get(e,r);n&&!Xe.isText(n)&&0!==n.children.length;){var o=n.children.length-1;n=n.children[o],r.push(o)}return[n,r]},leaf(e,t){var r=Be.get(e,t);if(!Xe.isText(r))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(We.stringify(r)));return r},levels(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of he.levels(t,r)){var o=Be.get(e,n);yield[o,n]}}()},matches:(e,t)=>Se.isElement(e)&&Se.isElementProps(t)&&Se.matches(e,t)||Xe.isText(e)&&Xe.isTextProps(t)&&Xe.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:r,reverse:n=!1}=t,{from:o=[],to:i}=t,a=new Set,s=[],l=e;!i||!(n?he.isBefore(s,i):he.isAfter(s,i));)if(a.has(l)||(yield[l,s]),a.has(l)||Xe.isText(l)||0===l.children.length||null!=r&&!1!==r([l,s])){if(0===s.length)break;if(!n){var c=he.next(s);if(Be.has(e,c)){s=c,l=Be.get(e,s);continue}}if(n&&0!==s[s.length-1])s=he.previous(s),l=Be.get(e,s);else s=he.parent(s),l=Be.get(e,s),a.add(l)}else{a.add(l);var d=n?l.children.length-1:0;he.isAncestor(s,o)&&(d=o[s.length]),s=s.concat(d),l=Be.get(e,s)}}()},parent(e,t){var r=he.parent(t),n=Be.get(e,r);if(Xe.isText(n))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return n},string:e=>Xe.isText(e)?e.text:e.children.map(Be.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of Be.nodes(e,t))Xe.isText(r)&&(yield[r,n])}()}};function ze(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 Ce(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ze(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ze(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var De={isNodeOperation:e=>De.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!O(e))return!1;switch(e.type){case"insert_node":case"remove_node":return he.isPath(e.path)&&Be.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&he.isPath(e.path);case"merge_node":return"number"==typeof e.position&&he.isPath(e.path)&&O(e.properties);case"move_node":return he.isPath(e.path)&&he.isPath(e.newPath);case"set_node":return he.isPath(e.path)&&O(e.properties)&&O(e.newProperties);case"set_selection":return null===e.properties&&Ne.isRange(e.newProperties)||null===e.newProperties&&Ne.isRange(e.properties)||O(e.properties)&&O(e.newProperties);case"split_node":return he.isPath(e.path)&&"number"==typeof e.position&&O(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>De.isOperation(e))),isSelectionOperation:e=>De.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>De.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return Ce(Ce({},e),{},{type:"remove_node"});case"insert_text":return Ce(Ce({},e),{},{type:"remove_text"});case"merge_node":return Ce(Ce({},e),{},{type:"split_node",path:he.previous(e.path)});case"move_node":var{newPath:t,path:r}=e;if(he.equals(t,r))return e;if(he.isSibling(r,t))return Ce(Ce({},e),{},{path:t,newPath:r});var n=he.transform(r,e),o=he.transform(he.next(r),e);return Ce(Ce({},e),{},{path:n,newPath:o});case"remove_node":return Ce(Ce({},e),{},{type:"insert_node"});case"remove_text":return Ce(Ce({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return Ce(Ce({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:s,newProperties:l}=e;return Ce(Ce({},e),{},null==s?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:s}:{properties:l,newProperties:s});case"split_node":return Ce(Ce({},e),{},{type:"merge_node",path:he.next(e.path)})}}},$e=new WeakMap,Re={above:(e,t)=>e.above(t),addMark(e,t,r){e.addMark(t,r)},after:(e,t,r)=>e.after(t,r),before:(e,t,r)=>e.before(t,r),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:r="character"}=t;e.deleteBackward(r)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:r="character"}=t;e.deleteForward(r)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,r){e.insertFragment(t,r)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,r)=>e.isEdge(t,r),isEditor:e=>(e=>{var t=$e.get(e);if(void 0!==t)return t;if(!O(e))return!1;var r="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||O(e.marks))&&(null===e.selection||Ne.isRange(e.selection))&&Be.isNodeList(e.children)&&De.isOperationList(e.operations);return $e.set(e,r),r})(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,r)=>e.isEnd(t,r),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,r)=>e.isStart(t,r),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,r)=>e.leaf(t,r),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,r)=>e.node(t,r),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,r)=>e.parent(t,r),path:(e,t,r)=>e.path(t,r),pathRef:(e,t,r)=>e.pathRef(t,r),pathRefs:e=>e.pathRefs(),point:(e,t,r)=>e.point(t,r),pointRef:(e,t,r)=>e.pointRef(t,r),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,r)=>e.range(t,r),rangeRef:(e,t,r)=>e.rangeRef(t,r),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,r)=>e.string(t,r),unhangRange:(e,t,r)=>e.unhangRange(t,r),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)}};function qe(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 Fe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qe(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Me={compare(e,t){var r=he.compare(e.path,t.path);return 0===r?e.offset<t.offset?-1:e.offset>t.offset?1:0:r},isAfter:(e,t)=>1===Me.compare(e,t),isBefore:(e,t)=>-1===Me.compare(e,t),equals:(e,t)=>e.offset===t.offset&&he.equals(e.path,t.path),isPoint:e=>O(e)&&"number"==typeof e.offset&&he.isPath(e.path),transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return pe(e,(e=>{if(null===e)return null;var{affinity:n="forward"}=r,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=he.transform(o,t,r);break;case"insert_text":he.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===n)&&(e.offset+=t.text.length);break;case"merge_node":he.equals(t.path,o)&&(e.offset+=t.position),e.path=he.transform(o,t,r);break;case"remove_text":he.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(he.equals(t.path,o)||he.isAncestor(t.path,o))return null;e.path=he.transform(o,t,r);break;case"split_node":if(he.equals(t.path,o)){if(t.position===i&&null==n)return null;(t.position<i||t.position===i&&"forward"===n)&&(e.offset-=t.position,e.path=he.transform(o,t,Fe(Fe({},r),{},{affinity:"forward"})))}else e.path=he.transform(o,t,r)}}))}},Ie=void 0,We={setScrubber(e){Ie=e},stringify:e=>JSON.stringify(e,Ie)},Ve=["text"],Ue=["anchor","focus"];function Ke(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 Je(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ke(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ke(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ze,Xe={equals(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:n=!1}=r;function o(e){return ke(e,Ve)}return _e(n?o(e):e,n?o(t):t)},isText:e=>O(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>Xe.isText(e))),isTextProps:e=>void 0!==e.text,matches(e,t){for(var r in t)if("text"!==r&&(!e.hasOwnProperty(r)||e[r]!==t[r]))return!1;return!0},decorations(e,t){var r=[Je({},e)];for(var n of t){var o=ke(n,Ue),[i,a]=Ne.edges(n),s=[],l=0,c=i.offset,d=a.offset;for(var p of r){var{length:f}=p.text,u=l;if(l+=f,c<=u&&l<=d)Object.assign(p,o),s.push(p);else if(c!==d&&(c===l||d===u)||c>l||d<u||d===u&&0!==u)s.push(p);else{var h=p,g=void 0,y=void 0;if(d<l){var m=d-u;y=Je(Je({},h),{},{text:h.text.slice(m)}),h=Je(Je({},h),{},{text:h.text.slice(0,m)})}if(c>u){var b=c-u;g=Je(Je({},h),{},{text:h.text.slice(0,b)}),h=Je(Je({},h),{},{text:h.text.slice(b)})}Object.assign(h,o),g&&s.push(g),s.push(h),y&&s.push(y)}}r=s}return r}},He=e=>e.selection?e.selection:e.children.length>0?Re.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(Ze||(Ze={})),Ze.L,Ze.L,Ze.V,Ze.LV,Ze.LVT,Ze.LV,Ze.V,Ze.V,Ze.T,Ze.LVT,Ze.T,Ze.T,Ze.Any,Ze.Extend,Ze.ZWJ,Ze.Any,Ze.SpacingMark,Ze.Prepend,Ze.Any,Ze.ZWJ,Ze.ExtPict,Ze.RI,Ze.RI;var Ge={delete(e,t){e.delete(t)},insertFragment(e,t,r){e.insertFragment(t,r)},insertText(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Re.withoutNormalizing(e,(()=>{var{voids:n=!1}=r,{at:o=He(e)}=r;if(he.isPath(o)&&(o=Re.range(e,o)),Ne.isRange(o))if(Ne.isCollapsed(o))o=o.anchor;else{var i=Ne.end(o);if(!n&&Re.void(e,{at:i}))return;var a=Ne.start(o),s=Re.pointRef(e,a),l=Re.pointRef(e,i);et.delete(e,{at:o,voids:n});var c=s.unref(),d=l.unref();o=c||d,et.setSelection(e,{anchor:o,focus:o})}if(!(!n&&Re.void(e,{at:o})||Re.elementReadOnly(e,{at:o}))){var{path:p,offset:f}=o;t.length>0&&e.apply({type:"insert_text",path:p,offset:f,text:t})}}))}};function Qe(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 Ye(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var et=Ye(Ye(Ye(Ye({},we),xe),Oe),Ge);function tt(e,t,{hotkeys:n,defaultBlock:s}){return l=>{Re.withoutNormalizing(t,(()=>{var c;const d=o(e);if(!t.selection||!d)return;const p=t.selection,{anchor:f}=p;if(n.isCmdEnter(l)){const n=Re.above(t,{at:f,match:e=>!Re.isEditor(e)&&Se.isElement(e)&&"todo-list"===e.type,mode:"highest"});if(!n)return;const[o]=n,i=(null===(c=o.props)||void 0===c?void 0:c.checked)||!1;r.updateElement(e,d.id,{type:"todo-list",props:{checked:!i}})}else if(n.isEnter(l)){l.preventDefault();const r=Re.above(t,{at:f,match:e=>!Re.isEditor(e)&&Se.isElement(e)&&("numbered-list"===e.type||"bulleted-list"===e.type||"todo-list"===e.type),mode:"highest"});if(!r)return;const[n,o]=r,c=Re.isEnd(t,f,o),p=Re.isStart(t,f,o),u=Re.string(t,o),h=0===d.meta.depth,g=u.trim().length>0;if(!g){if(h){const t=d.meta.order;return void e.batchOperations((()=>{e.deleteBlock({blockId:d.id}),e.insertBlock(s.type,{at:t,focus:!0,blockData:s})}))}return void e.decreaseBlockDepth({blockId:d.id})}if(p){const t=i({type:d.type,meta:{order:d.meta.order,depth:d.meta.depth},value:[a({type:n.type,props:{nodeType:"block"}})]});return e.insertBlock(t.type,{at:d.meta.order,focus:!1,blockData:t}),void e.setPath({current:t.meta.order+1})}if(g&&!p&&!c)return void e.splitBlock({slate:t,focus:!0});const y=i({type:d.type,meta:{order:d.meta.order+1,depth:d.meta.depth},value:[a({type:n.type,props:{nodeType:"block"}})]});e.insertBlock(y.type,{at:d.meta.order+1,focus:!0,blockData:y})}else;}))}}function rt(t,r,n){const o=[],i="number"==typeof n.depth?n.depth:0;if("UL"===r.nodeName||"OL"===r.nodeName){const a=Array.from(r.children).filter((e=>"LI"===e.nodeName)),l=a.some((e=>{const t=e.querySelector('input[type="checkbox"]'),r=e.textContent||"",n=/\[\s*[xX\s]?\s*\]/.test(r);return t||n}));if(l&&"TodoList"!==n.type)return o;if(!l&&"TodoList"===n.type)return o;a.forEach((r=>{const a=r.textContent||"";let l=null;if("TodoList"===n.type){const o=r.querySelector('input[type="checkbox"]'),c=o?o.checked:/\[\s*[xX]\s*\]/.test(a);l={id:e(),type:"TodoList",value:[{id:e(),type:"todo-list",children:s(t,r.childNodes),props:{nodeType:"block",checked:c}}],meta:{order:0,depth:i,align:n.align}}}else{const o="NumberedList"===n.type?"numbered-list":"bulleted-list";l={id:e(),type:n.type,value:[{id:e(),type:o,children:s(t,r.childNodes),props:{nodeType:"block"}}],meta:{order:0,depth:i,align:n.align}}}if(l){const e=nt(l.value).map((e=>Se.isElement(e)?e.children.length>0?e:Object.assign(Object.assign({},e),{children:[{text:""}]}):e)),t=Object.assign(Object.assign({},l),{value:e});o.push(t)}const c=Array.from(r.children).filter((e=>"UL"===e.nodeName||"OL"===e.nodeName));c.length>0&&c.forEach((e=>{const r=rt(t,e,Object.assign(Object.assign({},n),{depth:i+1}));o.push(...r)}))}))}return o}function nt(e){return e.map((e=>{if("children"in e)return Object.assign(Object.assign({},e),{children:nt(e.children)});if("text"in e){const t=e.text.replace(/\[\s*[xX\s]?\s*\]/,"").replace(/\u00a0/g," ");return t?Object.assign(Object.assign({},e),{text:t}):null}return e})).filter(Boolean)}const ot=new l({type:"BulletedList",elements:{"bulleted-list":{render:e=>{var t,r=w(e,["extendRender"]);const{blockId:o,HTMLAttributes:i={},attributes:a,children:s}=r,{className:l=""}=i,c=w(i,["className"]),d=n(o),p=`yoopta-align-${(null===(t=null==d?void 0:d.meta)||void 0===t?void 0:t.align)||"left"}`;return f("div",Object.assign({className:`yoopta-bulleted-list ${p} ${l}`},c,a,{children:[u("span",Object.assign({className:"yoopta-bulleted-list-bullet",contentEditable:!1},{children:"•"})),u("span",Object.assign({className:"yoopta-bulleted-list-content"},{children:s}))]}))}}},options:{display:{title:"Bulleted List",description:"Create bullet list"},shortcuts:["-"]},events:{onKeyDown:tt},commands:m,parsers:{html:{deserialize:{nodeNames:["UL"],parse(e,t){if("UL"===e.nodeName){const r=e.getAttribute("data-meta-align")||"left",n=parseInt(e.getAttribute("data-meta-depth")||"0",10),o=rt(t,e,{type:"BulletedList",depth:n,align:r});if(o.length>0)return o}}},serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`<ul data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${20*o}px; text-align: ${n}"><li>${c(e.children)}</li></ul>`}},markdown:{serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`${" ".repeat(o)}- ${d(e.children)}`}},email:{serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`\n <table style="width:100%;">\n <tbody style="width:100%;">\n <tr>\n <td>\n <ul data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${20*o}px; text-align: ${n}; \n font-size: 16px;\n line-height: 1.75rem;\n padding-bottom: 2px;\n padding-left: 1rem;\n padding-top: 2px;\n margin: 0;\n "><li style="margin: 0">${c(e.children)}</li></ul>\n </td>\n </tr>\n </tbody>\n </table>\n `}}}});const it=new l({type:"NumberedList",elements:{"numbered-list":{render:e=>{var t,{extendRender:r}=e,o=w(e,["extendRender"]);const{attributes:i,children:a,blockId:s,HTMLAttributes:l={}}=o,{className:c=""}=l,d=w(l,["className"]),g=n(s),y=p(),m=h((()=>function(e,t){const r=Object.keys(e.children).sort(((t,r)=>{const n=e.children[t],o=e.children[r];return n.meta.order-o.meta.order})),n={},o={},i=t.meta.depth;for(let a of r){const r=e.children[a],s=r.meta.depth,l=r.type;if(a===t.id)break;if("NumberedList"===l&&(void 0===n[s]&&(n[s]=0),"NumberedList"!==o[s]&&(n[s]=0),n[s]++),o[s]=l,s<i)for(let e in n)Number(e)>s&&(n[e]=0,o[e]="")}return void 0===n[i]&&(n[i]=0),"NumberedList"!==o[i]&&(n[i]=0),n[i]++,n[i]}(y,g)),[g,y.children]),b=`yoopta-align-${(null===(t=null==g?void 0:g.meta)||void 0===t?void 0:t.align)||"left"}`;return r?r(Object.assign(Object.assign({},o),{count:m})):f("div",Object.assign({className:`yoopta-numbered-list ${b} ${c}`},d,i,{children:[f("span",Object.assign({className:"yoopta-numbered-list-count",contentEditable:!1},{children:[m,"."]})),u("span",Object.assign({className:"yoopta-numbered-list-content"},{children:a}))]}))},props:{nodeType:"block"}}},options:{display:{title:"Numbered List",description:"Create list with numbering"},shortcuts:["1."]},events:{onKeyDown:tt},commands:b,parsers:{html:{deserialize:{nodeNames:["OL"],parse(e,t){if("OL"===e.nodeName){const r=e.getAttribute("data-meta-align")||"left",n=parseInt(e.getAttribute("data-meta-depth")||"0",10),o=rt(t,e,{type:"NumberedList",depth:n,align:r});if(o.length>0)return o}}},serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`<ol data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${20*o}px; text-align: ${n}"><li>${c(e.children)}</li></ol>`}},markdown:{serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`${" ".repeat(o)}- ${d(e.children)}`}},email:{serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`\n <table style="width:100%;">\n <tbody style="width:100%;">\n <tr>\n <td>\n <ol data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${o}px; text-align: ${n}; font-size: 16px;\n line-height: 28px;\n padding-bottom: 2px;\n padding-left: 1rem;\n padding-top: 2px;\n margin: 0;\n "><li>${c(e.children)}</li></ol>\n </td>\n </tr>\n </tbody>\n </table>\n `}}}}),at=(...e)=>e.filter(((e,t,r)=>Boolean(e)&&r.indexOf(e)===t)).join(" ")
8
+ function x(e){return"[object Object]"===Object.prototype.toString.call(e)}function O(e){var t,r;return!1!==x(e)&&(void 0===(t=e.constructor)||!1!==x(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf"))}var _=Symbol.for("immer-nothing"),k=Symbol.for("immer-draftable"),P=Symbol.for("immer-state");function j(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var N=Object.getPrototypeOf;function E(e){return!!e&&!!e[P]}function S(e){return!!e&&(T(e)||Array.isArray(e)||!!e[k]||!!e.constructor?.[k]||C(e)||$(e))}var L=Object.prototype.constructor.toString();function T(e){if(!e||"object"!=typeof e)return!1;const t=N(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)===L}function A(e,t){0===B(e)?Reflect.ownKeys(e).forEach((r=>{t(r,e[r],e)})):e.forEach(((r,n)=>t(n,r,e)))}function B(e){const t=e[P];return t?t.type_:Array.isArray(e)?1:C(e)?2:$(e)?3:0}function z(e,t){return 2===B(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function D(e,t,r){const n=B(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function C(e){return e instanceof Map}function $(e){return e instanceof Set}function R(e){return e.copy_||e.base_}function q(e,t){if(C(e))return new Map(e);if($(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&T(e)){if(!N(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const r=Object.getOwnPropertyDescriptors(e);delete r[P];let n=Reflect.ownKeys(r);for(let t=0;t<n.length;t++){const o=n[t],i=r[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(r[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(N(e),r)}function F(e,t=!1){return I(e)||E(e)||!S(e)||(B(e)>1&&(e.set=e.add=e.clear=e.delete=M),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>F(t,!0)))),e}function M(){j(2)}function I(e){return Object.isFrozen(e)}var W,V={};function U(e){const t=V[e];return t||j(0),t}function K(){return W}function J(e,t){t&&(U("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function X(e){Z(e),e.drafts_.forEach(G),e.drafts_=null}function Z(e){e===W&&(W=e.parent_)}function H(e){return W={drafts_:[],parent_:W,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function G(e){const t=e[P];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Q(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[P].modified_&&(X(t),j(4)),S(e)&&(e=Y(t,e),t.parent_||te(t,e)),t.patches_&&U("Patches").generateReplacementPatches_(r[P].base_,e,t.patches_,t.inversePatches_)):e=Y(t,r,[]),X(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==_?e:void 0}function Y(e,t,r){if(I(t))return t;const n=t[P];if(!n)return A(t,((o,i)=>ee(e,n,t,o,i,r))),t;if(n.scope_!==e)return t;if(!n.modified_)return te(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const t=n.copy_;let o=t,i=!1;3===n.type_&&(o=new Set(t),t.clear(),i=!0),A(o,((o,a)=>ee(e,n,t,o,a,r,i))),te(e,t,!1),r&&e.patches_&&U("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function ee(e,t,r,n,o,i,a){if(E(o)){const a=Y(e,o,i&&t&&3!==t.type_&&!z(t.assigned_,n)?i.concat(n):void 0);if(D(r,n,a),!E(a))return;e.canAutoFreeze_=!1}else a&&r.add(o);if(S(o)&&!I(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Y(e,o),t&&t.scope_.parent_||"symbol"==typeof n||!Object.prototype.propertyIsEnumerable.call(r,n)||te(e,o)}}function te(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&F(t,r)}var re={get(e,t){if(t===P)return e;const r=R(e);if(!z(r,t))return function(e,t,r){const n=ie(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,r,t);const n=r[t];return e.finalized_||!S(n)?n:n===oe(e.base_,t)?(se(e),e.copy_[t]=le(n,e)):n},has:(e,t)=>t in R(e),ownKeys:e=>Reflect.ownKeys(R(e)),set(e,t,r){const n=ie(R(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=oe(R(e),t),a=n?.[P];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(((o=r)===(i=n)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==r||z(e.base_,t)))return!0;se(e),ae(e)}var o,i;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!==oe(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,se(e),ae(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=R(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){j(11)},getPrototypeOf:e=>N(e.base_),setPrototypeOf(){j(12)}},ne={};function oe(e,t){const r=e[P];return(r?R(r):e)[t]}function ie(e,t){if(!(t in e))return;let r=N(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=N(r)}}function ae(e){e.modified_||(e.modified_=!0,e.parent_&&ae(e.parent_))}function se(e){e.copy_||(e.copy_=q(e.base_,e.scope_.immer_.useStrictShallowCopy_))}A(re,((e,t)=>{ne[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),ne.deleteProperty=function(e,t){return ne.set.call(this,e,t,void 0)},ne.set=function(e,t,r){return re.set.call(this,e[0],t,r,e[0])};function le(e,t){const r=C(e)?U("MapSet").proxyMap_(e,t):$(e)?U("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:K(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,i=re;r&&(o=[n],i=ne);const{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,s}(e,t);return(t?t.scope_:K()).drafts_.push(r),r}function ce(e){if(!S(e)||I(e))return e;const t=e[P];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=q(e,t.scope_.immer_.useStrictShallowCopy_)}else r=q(e,!0);return A(r,((e,t)=>{D(r,e,ce(t))})),t&&(t.finalized_=!1),r}var de=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,...o){return n.produce(e,(e=>t.call(this,e,...o)))}}let n;if("function"!=typeof t&&j(6),void 0!==r&&"function"!=typeof r&&j(7),S(e)){const o=H(this),i=le(e,void 0);let a=!0;try{n=t(i),a=!1}finally{a?X(o):Z(o)}return J(o,r),Q(n,o)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===_&&(n=void 0),this.autoFreeze_&&F(n,!0),r){const t=[],o=[];U("Patches").generateReplacementPatches_(e,n,t,o),r(t,o)}return n}j(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 e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){S(e)||j(8),E(e)&&(e=function(e){E(e)||j(10);return ce(e)}(e));const t=H(this),r=le(e,void 0);return r[P].isManual_=!0,Z(t),r}finishDraft(e,t){const r=e&&e[P];r&&r.isManual_||j(9);const{scope_:n}=r;return J(n,t),Q(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=U("Patches").applyPatches_;return E(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},pe=de.produce;de.produceWithPatches.bind(de),de.setAutoFreeze.bind(de),de.setUseStrictShallowCopy.bind(de),de.applyPatches.bind(de);var fe=de.createDraft.bind(de),ue=de.finishDraft.bind(de),he={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,n=he.levels(e,t);return n=r?n.slice(1):n.slice(0,-1)},common(e,t){for(var r=[],n=0;n<e.length&&n<t.length;n++){var o=e[n];if(o!==t[n])break;r.push(o)}return r},compare(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(e,t){var r=e.length-1,n=e.slice(0,r),o=t.slice(0,r),i=e[r],a=t[r];return he.equals(n,o)&&i>a},endsAt(e,t){var r=e.length,n=e.slice(0,r),o=t.slice(0,r);return he.equals(n,o)},endsBefore(e,t){var r=e.length-1,n=e.slice(0,r),o=t.slice(0,r),i=e[r],a=t[r];return he.equals(n,o)&&i<a},equals:(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r])),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===he.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===he.compare(e,t),isBefore:(e,t)=>-1===he.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===he.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===he.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===he.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===he.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var r=e.slice(0,-1),n=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&he.equals(r,n)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,n=[],o=0;o<=e.length;o++)n.push(e.slice(0,o));return r&&n.reverse(),n},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!he.isAncestor(t,e)&&!he.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var n=[...e],{affinity:o="forward"}=r;if(0===e.length)return n;switch(t.type){case"insert_node":var{path:i}=t;(he.equals(i,n)||he.endsBefore(i,n)||he.isAncestor(i,n))&&(n[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(he.equals(a,n)||he.isAncestor(a,n))return null;he.endsBefore(a,n)&&(n[a.length-1]-=1);break;case"merge_node":var{path:s,position:l}=t;he.equals(s,n)||he.endsBefore(s,n)?n[s.length-1]-=1:he.isAncestor(s,n)&&(n[s.length-1]-=1,n[s.length]+=l);break;case"split_node":var{path:c,position:d}=t;if(he.equals(c,n)){if("forward"===o)n[n.length-1]+=1;else if("backward"!==o)return null}else he.endsBefore(c,n)?n[c.length-1]+=1:he.isAncestor(c,n)&&e[c.length]>=d&&(n[c.length-1]+=1,n[c.length]-=d);break;case"move_node":var{path:p,newPath:f}=t;if(he.equals(p,f))return n;if(he.isAncestor(p,n)||he.equals(p,n)){var u=f.slice();return he.endsBefore(p,f)&&p.length<f.length&&(u[p.length-1]-=1),u.concat(n.slice(p.length))}he.isSibling(p,f)&&(he.isAncestor(f,n)||he.equals(f,n))?he.endsBefore(p,n)?n[p.length-1]-=1:n[p.length-1]+=1:he.endsBefore(f,n)||he.equals(f,n)||he.isAncestor(f,n)?(he.endsBefore(p,n)&&(n[p.length-1]-=1),n[f.length-1]+=1):he.endsBefore(p,n)&&(he.equals(f,n)&&(n[f.length-1]+=1),n[p.length-1]-=1)}return n}};function ge(e){return ge="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},ge(e)}function ye(e){var t=function(e,t){if("object"!==ge(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ge(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ge(t)?t:String(t)}function me(e,t,r){return(t=ye(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function be(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 ve(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?be(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):be(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var we={transform(e,t){e.children=fe(e.children);var r=e.selection&&fe(e.selection);try{r=((e,t,r)=>{switch(r.type){case"insert_node":var{path:n,node:o}=r,i=Be.parent(e,n),a=n[n.length-1];if(a>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(n,"] because the destination is past the end of the node."));if(i.children.splice(a,0,o),t)for(var[s,l]of Ne.points(t))t[l]=Me.transform(s,r);break;case"insert_text":var{path:c,offset:d,text:p}=r;if(0===p.length)break;var f=Be.leaf(e,c),u=f.text.slice(0,d),h=f.text.slice(d);if(f.text=u+p+h,t)for(var[g,y]of Ne.points(t))t[y]=Me.transform(g,r);break;case"merge_node":var{path:m}=r,b=Be.get(e,m),v=he.previous(m),w=Be.get(e,v),x=Be.parent(e,m),O=m[m.length-1];if(Ze.isText(b)&&Ze.isText(w))w.text+=b.text;else{if(Ze.isText(b)||Ze.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(m,"] to nodes of different interfaces: ").concat(We.stringify(b)," ").concat(We.stringify(w)));w.children.push(...b.children)}if(x.children.splice(O,1),t)for(var[_,k]of Ne.points(t))t[k]=Me.transform(_,r);break;case"move_node":var{path:P,newPath:j}=r;if(he.isAncestor(P,j))throw new Error("Cannot move a path [".concat(P,"] to new path [").concat(j,"] because the destination is inside itself."));var N=Be.get(e,P),E=Be.parent(e,P),S=P[P.length-1];E.children.splice(S,1);var L=he.transform(P,r),T=Be.get(e,he.parent(L)),A=L[L.length-1];if(T.children.splice(A,0,N),t)for(var[B,z]of Ne.points(t))t[z]=Me.transform(B,r);break;case"remove_node":var{path:D}=r,C=D[D.length-1];if(Be.parent(e,D).children.splice(C,1),t)for(var[$,R]of Ne.points(t)){var q=Me.transform($,r);if(null!=t&&null!=q)t[R]=q;else{var F=void 0,M=void 0;for(var[I,W]of Be.texts(e)){if(-1!==he.compare(W,D)){M=[I,W];break}F=[I,W]}var V=!1;F&&M&&(V=he.equals(M[1],D)?!he.hasPrevious(M[1]):he.common(F[1],D).length<he.common(M[1],D).length),F&&!V?($.path=F[1],$.offset=F[0].text.length):M?($.path=M[1],$.offset=0):t=null}}break;case"remove_text":var{path:U,offset:K,text:J}=r;if(0===J.length)break;var X=Be.leaf(e,U),Z=X.text.slice(0,K),H=X.text.slice(K+J.length);if(X.text=Z+H,t)for(var[G,Q]of Ne.points(t))t[Q]=Me.transform(G,r);break;case"set_node":var{path:Y,properties:ee,newProperties:te}=r;if(0===Y.length)throw new Error("Cannot set properties on the root node!");var re=Be.get(e,Y);for(var ne in te){if("children"===ne||"text"===ne)throw new Error('Cannot set the "'.concat(ne,'" property of nodes!'));var oe=te[ne];null==oe?delete re[ne]:re[ne]=oe}for(var ie in ee)te.hasOwnProperty(ie)||delete re[ie];break;case"set_selection":var{newProperties:ae}=r;if(null==ae)t=ae;else{if(null==t){if(!Ne.isRange(ae))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(We.stringify(ae)," when there is no current selection."));t=ve({},ae)}for(var se in ae){var le=ae[se];if(null==le){if("anchor"===se||"focus"===se)throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=le}}break;case"split_node":var{path:ce,position:de,properties:pe}=r;if(0===ce.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ce,"] because the root node cannot be split."));var fe,ue=Be.get(e,ce),ge=Be.parent(e,ce),ye=ce[ce.length-1];if(Ze.isText(ue)){var me=ue.text.slice(0,de),be=ue.text.slice(de);ue.text=me,fe=ve(ve({},pe),{},{text:be})}else{var we=ue.children.slice(0,de),xe=ue.children.slice(de);ue.children=we,fe=ve(ve({},pe),{},{children:xe})}if(ge.children.splice(ye+1,0,fe),t)for(var[Oe,_e]of Ne.points(t))t[_e]=Me.transform(Oe,r)}return t})(e,r,t)}finally{e.children=ue(e.children),e.selection=r?E(r)?ue(r):r:null}}},xe={insertNodes(e,t,r){e.insertNodes(t,r)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,r){e.setNodes(t,r)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,r){e.unsetNodes(t,r)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,r){e.wrapNodes(t,r)}},Oe={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,r){e.setPoint(t,r)},setSelection(e,t){e.setSelection(t)}},_e=(e,t)=>{for(var r in e){var n=e[r],o=t[r];if(O(n)&&O(o)){if(!_e(n,o))return!1}else if(Array.isArray(n)&&Array.isArray(o)){if(n.length!==o.length)return!1;for(var i=0;i<n.length;i++)if(n[i]!==o[i])return!1}else if(n!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0};function ke(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var Pe=["anchor","focus"];function je(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 Ne={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,{anchor:n,focus:o}=e;return Ne.isBackward(e)===r?[n,o]:[o,n]},end(e){var[,t]=Ne.edges(e);return t},equals:(e,t)=>Me.equals(e.anchor,t.anchor)&&Me.equals(e.focus,t.focus),includes(e,t){if(Ne.isRange(t)){if(Ne.includes(e,t.anchor)||Ne.includes(e,t.focus))return!0;var[r,n]=Ne.edges(e),[o,i]=Ne.edges(t);return Me.isBefore(r,o)&&Me.isAfter(n,i)}var[a,s]=Ne.edges(e),l=!1,c=!1;return Me.isPoint(t)?(l=Me.compare(t,a)>=0,c=Me.compare(t,s)<=0):(l=he.compare(t,a.path)>=0,c=he.compare(t,s.path)<=0),l&&c},intersection(e,t){var r=ke(e,Pe),[n,o]=Ne.edges(e),[i,a]=Ne.edges(t),s=Me.isBefore(n,i)?i:n,l=Me.isBefore(o,a)?o:a;return Me.isBefore(l,s)?null:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?je(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):je(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({anchor:s,focus:l},r)},isBackward(e){var{anchor:t,focus:r}=e;return Me.isAfter(t,r)},isCollapsed(e){var{anchor:t,focus:r}=e;return Me.equals(t,r)},isExpanded:e=>!Ne.isCollapsed(e),isForward:e=>!Ne.isBackward(e),isRange:e=>O(e)&&Me.isPoint(e.anchor)&&Me.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Ne.edges(e);return t},transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return pe(e,(e=>{if(null===e)return null;var n,o,{affinity:i="inward"}=r;if("inward"===i){var a=Ne.isCollapsed(e);Ne.isForward(e)?(n="forward",o=a?n:"backward"):(n="backward",o=a?n:"forward")}else"outward"===i?Ne.isForward(e)?(n="backward",o="forward"):(n="forward",o="backward"):(n=i,o=i);var s=Me.transform(e.anchor,t,{affinity:n}),l=Me.transform(e.focus,t,{affinity:o});if(!s||!l)return null;e.anchor=s,e.focus=l}))}},Ee=e=>O(e)&&Be.isNodeList(e.children)&&!Re.isEditor(e),Se={isAncestor:e=>O(e)&&Be.isNodeList(e.children),isElement:Ee,isElementList:e=>Array.isArray(e)&&e.every((e=>Se.isElement(e))),isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return Ee(e)&&e[r]===t},matches(e,t){for(var r in t)if("children"!==r&&e[r]!==t[r])return!1;return!0}},Le=["children"],Te=["text"],Ae=new WeakMap,Be={ancestor(e,t){var r=Be.get(e,t);if(Ze.isText(r))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(We.stringify(r)));return r},ancestors(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of he.ancestors(t,r)){var o=[Be.ancestor(e,n),n];yield o}}()},child(e,t){if(Ze.isText(e))throw new Error("Cannot get the child of a text node: ".concat(We.stringify(e)));var r=e.children[t];if(null==r)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(We.stringify(e)));return r},children(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:n=!1}=r,o=Be.ancestor(e,t),{children:i}=o,a=n?i.length-1:0;n?a>=0:a<i.length;){var s=Be.child(o,a),l=t.concat(a);yield[s,l],a=n?a-1:a+1}}()},common(e,t,r){var n=he.common(t,r);return[Be.get(e,n),n]},descendant(e,t){var r=Be.get(e,t);if(Re.isEditor(r))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(We.stringify(r)));return r},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of Be.nodes(e,t))0!==n.length&&(yield[r,n])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of Be.nodes(e,t))Se.isElement(r)&&(yield[r,n])}()},extractProps:e=>Se.isAncestor(e)?ke(e,Le):ke(e,Te),first(e,t){for(var r=t.slice(),n=Be.get(e,r);n&&!Ze.isText(n)&&0!==n.children.length;)n=n.children[0],r.push(0);return[n,r]},fragment(e,t){if(Ze.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(We.stringify(e)));return pe({children:e.children},(e=>{var[r,n]=Ne.edges(t),o=Be.nodes(e,{reverse:!0,pass:e=>{var[,r]=e;return!Ne.includes(t,r)}});for(var[,i]of o){if(!Ne.includes(t,i)){var a=Be.parent(e,i),s=i[i.length-1];a.children.splice(s,1)}if(he.equals(i,n.path)){var l=Be.leaf(e,i);l.text=l.text.slice(0,n.offset)}if(he.equals(i,r.path)){var c=Be.leaf(e,i);c.text=c.text.slice(r.offset)}}Re.isEditor(e)&&(e.selection=null)})).children},get(e,t){for(var r=e,n=0;n<t.length;n++){var o=t[n];if(Ze.isText(r)||!r.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(We.stringify(e)));r=r.children[o]}return r},has(e,t){for(var r=e,n=0;n<t.length;n++){var o=t[n];if(Ze.isText(r)||!r.children[o])return!1;r=r.children[o]}return!0},isNode:e=>Ze.isText(e)||Se.isElement(e)||Re.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=Ae.get(e);if(void 0!==t)return t;var r=e.every((e=>Be.isNode(e)));return Ae.set(e,r),r},last(e,t){for(var r=t.slice(),n=Be.get(e,r);n&&!Ze.isText(n)&&0!==n.children.length;){var o=n.children.length-1;n=n.children[o],r.push(o)}return[n,r]},leaf(e,t){var r=Be.get(e,t);if(!Ze.isText(r))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(We.stringify(r)));return r},levels(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of he.levels(t,r)){var o=Be.get(e,n);yield[o,n]}}()},matches:(e,t)=>Se.isElement(e)&&Se.isElementProps(t)&&Se.matches(e,t)||Ze.isText(e)&&Ze.isTextProps(t)&&Ze.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:r,reverse:n=!1}=t,{from:o=[],to:i}=t,a=new Set,s=[],l=e;!i||!(n?he.isBefore(s,i):he.isAfter(s,i));)if(a.has(l)||(yield[l,s]),a.has(l)||Ze.isText(l)||0===l.children.length||null!=r&&!1!==r([l,s])){if(0===s.length)break;if(!n){var c=he.next(s);if(Be.has(e,c)){s=c,l=Be.get(e,s);continue}}if(n&&0!==s[s.length-1])s=he.previous(s),l=Be.get(e,s);else s=he.parent(s),l=Be.get(e,s),a.add(l)}else{a.add(l);var d=n?l.children.length-1:0;he.isAncestor(s,o)&&(d=o[s.length]),s=s.concat(d),l=Be.get(e,s)}}()},parent(e,t){var r=he.parent(t),n=Be.get(e,r);if(Ze.isText(n))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return n},string:e=>Ze.isText(e)?e.text:e.children.map(Be.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of Be.nodes(e,t))Ze.isText(r)&&(yield[r,n])}()}};function ze(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 De(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ze(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ze(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ce={isNodeOperation:e=>Ce.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!O(e))return!1;switch(e.type){case"insert_node":case"remove_node":return he.isPath(e.path)&&Be.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&he.isPath(e.path);case"merge_node":return"number"==typeof e.position&&he.isPath(e.path)&&O(e.properties);case"move_node":return he.isPath(e.path)&&he.isPath(e.newPath);case"set_node":return he.isPath(e.path)&&O(e.properties)&&O(e.newProperties);case"set_selection":return null===e.properties&&Ne.isRange(e.newProperties)||null===e.newProperties&&Ne.isRange(e.properties)||O(e.properties)&&O(e.newProperties);case"split_node":return he.isPath(e.path)&&"number"==typeof e.position&&O(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>Ce.isOperation(e))),isSelectionOperation:e=>Ce.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>Ce.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return De(De({},e),{},{type:"remove_node"});case"insert_text":return De(De({},e),{},{type:"remove_text"});case"merge_node":return De(De({},e),{},{type:"split_node",path:he.previous(e.path)});case"move_node":var{newPath:t,path:r}=e;if(he.equals(t,r))return e;if(he.isSibling(r,t))return De(De({},e),{},{path:t,newPath:r});var n=he.transform(r,e),o=he.transform(he.next(r),e);return De(De({},e),{},{path:n,newPath:o});case"remove_node":return De(De({},e),{},{type:"insert_node"});case"remove_text":return De(De({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return De(De({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:s,newProperties:l}=e;return De(De({},e),{},null==s?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:s}:{properties:l,newProperties:s});case"split_node":return De(De({},e),{},{type:"merge_node",path:he.next(e.path)})}}},$e=new WeakMap,Re={above:(e,t)=>e.above(t),addMark(e,t,r){e.addMark(t,r)},after:(e,t,r)=>e.after(t,r),before:(e,t,r)=>e.before(t,r),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:r="character"}=t;e.deleteBackward(r)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:r="character"}=t;e.deleteForward(r)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,r){e.insertFragment(t,r)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,r)=>e.isEdge(t,r),isEditor:e=>(e=>{var t=$e.get(e);if(void 0!==t)return t;if(!O(e))return!1;var r="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||O(e.marks))&&(null===e.selection||Ne.isRange(e.selection))&&Be.isNodeList(e.children)&&Ce.isOperationList(e.operations);return $e.set(e,r),r})(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,r)=>e.isEnd(t,r),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,r)=>e.isStart(t,r),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,r)=>e.leaf(t,r),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,r)=>e.node(t,r),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,r)=>e.parent(t,r),path:(e,t,r)=>e.path(t,r),pathRef:(e,t,r)=>e.pathRef(t,r),pathRefs:e=>e.pathRefs(),point:(e,t,r)=>e.point(t,r),pointRef:(e,t,r)=>e.pointRef(t,r),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,r)=>e.range(t,r),rangeRef:(e,t,r)=>e.rangeRef(t,r),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,r)=>e.string(t,r),unhangRange:(e,t,r)=>e.unhangRange(t,r),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)}};function qe(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 Fe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qe(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Me={compare(e,t){var r=he.compare(e.path,t.path);return 0===r?e.offset<t.offset?-1:e.offset>t.offset?1:0:r},isAfter:(e,t)=>1===Me.compare(e,t),isBefore:(e,t)=>-1===Me.compare(e,t),equals:(e,t)=>e.offset===t.offset&&he.equals(e.path,t.path),isPoint:e=>O(e)&&"number"==typeof e.offset&&he.isPath(e.path),transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return pe(e,(e=>{if(null===e)return null;var{affinity:n="forward"}=r,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=he.transform(o,t,r);break;case"insert_text":he.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===n)&&(e.offset+=t.text.length);break;case"merge_node":he.equals(t.path,o)&&(e.offset+=t.position),e.path=he.transform(o,t,r);break;case"remove_text":he.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(he.equals(t.path,o)||he.isAncestor(t.path,o))return null;e.path=he.transform(o,t,r);break;case"split_node":if(he.equals(t.path,o)){if(t.position===i&&null==n)return null;(t.position<i||t.position===i&&"forward"===n)&&(e.offset-=t.position,e.path=he.transform(o,t,Fe(Fe({},r),{},{affinity:"forward"})))}else e.path=he.transform(o,t,r)}}))}},Ie=void 0,We={setScrubber(e){Ie=e},stringify:e=>JSON.stringify(e,Ie)},Ve=["text"],Ue=["anchor","focus"];function Ke(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 Je(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ke(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ke(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Xe,Ze={equals(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:n=!1}=r;function o(e){return ke(e,Ve)}return _e(n?o(e):e,n?o(t):t)},isText:e=>O(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>Ze.isText(e))),isTextProps:e=>void 0!==e.text,matches(e,t){for(var r in t)if("text"!==r&&(!e.hasOwnProperty(r)||e[r]!==t[r]))return!1;return!0},decorations(e,t){var r=[Je({},e)];for(var n of t){var o=ke(n,Ue),[i,a]=Ne.edges(n),s=[],l=0,c=i.offset,d=a.offset;for(var p of r){var{length:f}=p.text,u=l;if(l+=f,c<=u&&l<=d)Object.assign(p,o),s.push(p);else if(c!==d&&(c===l||d===u)||c>l||d<u||d===u&&0!==u)s.push(p);else{var h=p,g=void 0,y=void 0;if(d<l){var m=d-u;y=Je(Je({},h),{},{text:h.text.slice(m)}),h=Je(Je({},h),{},{text:h.text.slice(0,m)})}if(c>u){var b=c-u;g=Je(Je({},h),{},{text:h.text.slice(0,b)}),h=Je(Je({},h),{},{text:h.text.slice(b)})}Object.assign(h,o),g&&s.push(g),s.push(h),y&&s.push(y)}}r=s}return r}},He=e=>e.selection?e.selection:e.children.length>0?Re.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(Xe||(Xe={})),Xe.L,Xe.L,Xe.V,Xe.LV,Xe.LVT,Xe.LV,Xe.V,Xe.V,Xe.T,Xe.LVT,Xe.T,Xe.T,Xe.Any,Xe.Extend,Xe.ZWJ,Xe.Any,Xe.SpacingMark,Xe.Prepend,Xe.Any,Xe.ZWJ,Xe.ExtPict,Xe.RI,Xe.RI;var Ge={delete(e,t){e.delete(t)},insertFragment(e,t,r){e.insertFragment(t,r)},insertText(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Re.withoutNormalizing(e,(()=>{var{voids:n=!1}=r,{at:o=He(e)}=r;if(he.isPath(o)&&(o=Re.range(e,o)),Ne.isRange(o))if(Ne.isCollapsed(o))o=o.anchor;else{var i=Ne.end(o);if(!n&&Re.void(e,{at:i}))return;var a=Ne.start(o),s=Re.pointRef(e,a),l=Re.pointRef(e,i);et.delete(e,{at:o,voids:n});var c=s.unref(),d=l.unref();o=c||d,et.setSelection(e,{anchor:o,focus:o})}if(!(!n&&Re.void(e,{at:o})||Re.elementReadOnly(e,{at:o}))){var{path:p,offset:f}=o;t.length>0&&e.apply({type:"insert_text",path:p,offset:f,text:t})}}))}};function Qe(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 Ye(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var et=Ye(Ye(Ye(Ye({},we),xe),Oe),Ge);function tt(e,t,{hotkeys:n,defaultBlock:s}){return l=>{Re.withoutNormalizing(t,(()=>{var c;const d=o(e);if(!t.selection||!d)return;const p=t.selection,{anchor:f}=p;if(n.isCmdEnter(l)){const n=Re.above(t,{at:f,match:e=>!Re.isEditor(e)&&Se.isElement(e)&&"todo-list"===e.type,mode:"highest"});if(!n)return;const[o]=n,i=(null===(c=o.props)||void 0===c?void 0:c.checked)||!1;r.updateElement(e,d.id,{type:"todo-list",props:{checked:!i}})}else if(n.isEnter(l)){l.preventDefault();const r=Re.above(t,{at:f,match:e=>!Re.isEditor(e)&&Se.isElement(e)&&("numbered-list"===e.type||"bulleted-list"===e.type||"todo-list"===e.type),mode:"highest"});if(!r)return;const[n,o]=r,c=Re.isEnd(t,f,o),p=Re.isStart(t,f,o),u=Re.string(t,o),h=0===d.meta.depth,g=u.trim().length>0;if(!g){if(h){const t=d.meta.order;return void e.batchOperations((()=>{e.deleteBlock({blockId:d.id}),e.insertBlock(s.type,{at:t,focus:!0,blockData:s})}))}return void e.decreaseBlockDepth({blockId:d.id})}if(p){const t=i({type:d.type,meta:{order:d.meta.order,depth:d.meta.depth},value:[a({type:n.type,props:{nodeType:"block"}})]});return e.insertBlock(t.type,{at:d.meta.order,focus:!1,blockData:t}),void e.setPath({current:t.meta.order+1})}if(g&&!p&&!c)return void e.splitBlock({slate:t,focus:!0});const y=i({type:d.type,meta:{order:d.meta.order+1,depth:d.meta.depth},value:[a({type:n.type,props:{nodeType:"block"}})]});e.insertBlock(y.type,{at:d.meta.order+1,focus:!0,blockData:y})}else;}))}}function rt(t,r,n){const o=[],i="number"==typeof n.depth?n.depth:0;if("UL"===r.nodeName||"OL"===r.nodeName){const a=Array.from(r.children).filter((e=>"LI"===e.nodeName)),l=a.some((e=>{const t=e.querySelector('input[type="checkbox"]'),r=e.textContent||"",n=/\[\s*[xX\s]?\s*\]/.test(r);return t||n}));if(l&&"TodoList"!==n.type)return o;if(!l&&"TodoList"===n.type)return o;a.forEach((r=>{const a=r.textContent||"";let l=null;if("TodoList"===n.type){const o=r.querySelector('input[type="checkbox"]'),c=o?o.checked:/\[\s*[xX]\s*\]/.test(a);l={id:e(),type:"TodoList",value:[{id:e(),type:"todo-list",children:s(t,r.childNodes),props:{nodeType:"block",checked:c}}],meta:{order:0,depth:i,align:n.align}}}else{const o="NumberedList"===n.type?"numbered-list":"bulleted-list",a=Array.from(r.childNodes).reduce(((e,r)=>{var n;if(r.nodeType===Node.TEXT_NODE){const t=null===(n=r.textContent)||void 0===n?void 0:n.trim();return t?[...e,{text:t}]:e}if(r.nodeType===Node.ELEMENT_NODE){const n=r;return n.nodeName,[...e,...s(t,n.childNodes)]}return e}),[]);l={id:e(),type:n.type,value:[{id:e(),type:o,children:a.length>0?a:[{text:""}],props:{nodeType:"block"}}],meta:{order:0,depth:i,align:n.align}}}if(l){const e=nt(l.value).map((e=>Se.isElement(e)?e.children.length>0?e:Object.assign(Object.assign({},e),{children:[{text:""}]}):e)),t=Object.assign(Object.assign({},l),{value:e});o.push(t)}const c=Array.from(r.children).filter((e=>"UL"===e.nodeName||"OL"===e.nodeName));c.length>0&&c.forEach((e=>{const r=rt(t,e,Object.assign(Object.assign({},n),{depth:i+1}));o.push(...r)}))}))}return o}function nt(e){return e.map((e=>{if("children"in e)return Object.assign(Object.assign({},e),{children:nt(e.children)});if("text"in e){const t=e.text.replace(/\[\s*[xX\s]?\s*\]/,"").replace(/\u00a0/g," ");return t?Object.assign(Object.assign({},e),{text:t}):null}return e})).filter(Boolean)}const ot=new l({type:"BulletedList",elements:{"bulleted-list":{render:e=>{var t,r=w(e,["extendRender"]);const{blockId:o,HTMLAttributes:i={},attributes:a,children:s}=r,{className:l=""}=i,c=w(i,["className"]),d=n(o),p=`yoopta-align-${(null===(t=null==d?void 0:d.meta)||void 0===t?void 0:t.align)||"left"}`;return f("div",Object.assign({className:`yoopta-bulleted-list ${p} ${l}`},c,a,{children:[u("span",Object.assign({className:"yoopta-bulleted-list-bullet",contentEditable:!1},{children:"•"})),u("span",Object.assign({className:"yoopta-bulleted-list-content"},{children:s}))]}))}}},options:{display:{title:"Bulleted List",description:"Create bullet list"},shortcuts:["-"]},events:{onKeyDown:tt},commands:m,parsers:{html:{deserialize:{nodeNames:["UL"],parse(e,t){if("UL"===e.nodeName){const r=e.getAttribute("data-meta-align")||"left",n=parseInt(e.getAttribute("data-meta-depth")||"0",10),o=rt(t,e,{type:"BulletedList",depth:n,align:r});if(o.length>0)return o}}},serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`<ul data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${20*o}px; text-align: ${n}"><li>${c(e.children)}</li></ul>`}},markdown:{serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`${" ".repeat(o)}- ${d(e.children)}`}},email:{serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`\n <table style="width:100%;">\n <tbody style="width:100%;">\n <tr>\n <td>\n <ul data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${20*o}px; text-align: ${n}; \n font-size: 16px;\n line-height: 1.75rem;\n padding-bottom: 2px;\n padding-left: 1rem;\n padding-top: 2px;\n margin: 0;\n "><li style="margin: 0">${c(e.children)}</li></ul>\n </td>\n </tr>\n </tbody>\n </table>\n `}}}});const it=new l({type:"NumberedList",elements:{"numbered-list":{render:e=>{var t,{extendRender:r}=e,o=w(e,["extendRender"]);const{attributes:i,children:a,blockId:s,HTMLAttributes:l={}}=o,{className:c=""}=l,d=w(l,["className"]),g=n(s),y=p(),m=h((()=>function(e,t){const r=Object.keys(e.children).sort(((t,r)=>{const n=e.children[t],o=e.children[r];return n.meta.order-o.meta.order})),n={},o={},i=t.meta.depth;for(let a of r){const r=e.children[a],s=r.meta.depth,l=r.type;if(a===t.id)break;if("NumberedList"===l&&(void 0===n[s]&&(n[s]=0),"NumberedList"!==o[s]&&(n[s]=0),n[s]++),o[s]=l,s<i)for(let e in n)Number(e)>s&&(n[e]=0,o[e]="")}return void 0===n[i]&&(n[i]=0),"NumberedList"!==o[i]&&(n[i]=0),n[i]++,n[i]}(y,g)),[g,y.children]),b=`yoopta-align-${(null===(t=null==g?void 0:g.meta)||void 0===t?void 0:t.align)||"left"}`;return r?r(Object.assign(Object.assign({},o),{count:m})):f("div",Object.assign({className:`yoopta-numbered-list ${b} ${c}`},d,i,{children:[f("span",Object.assign({className:"yoopta-numbered-list-count",contentEditable:!1},{children:[m,"."]})),u("span",Object.assign({className:"yoopta-numbered-list-content"},{children:a}))]}))},props:{nodeType:"block"}}},options:{display:{title:"Numbered List",description:"Create list with numbering"},shortcuts:["1."]},events:{onKeyDown:tt},commands:b,parsers:{html:{deserialize:{nodeNames:["OL"],parse(e,t){if("OL"===e.nodeName){const r=e.getAttribute("data-meta-align")||"left",n=parseInt(e.getAttribute("data-meta-depth")||"0",10),o=rt(t,e,{type:"NumberedList",depth:n,align:r});if(o.length>0)return o}}},serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`<ol data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${20*o}px; text-align: ${n}"><li>${c(e.children)}</li></ol>`}},markdown:{serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`${" ".repeat(o)}- ${d(e.children)}`}},email:{serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`\n <table style="width:100%;">\n <tbody style="width:100%;">\n <tr>\n <td>\n <ol data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${o}px; text-align: ${n}; font-size: 16px;\n line-height: 28px;\n padding-bottom: 2px;\n padding-left: 1rem;\n padding-top: 2px;\n margin: 0;\n "><li>${c(e.children)}</li></ol>\n </td>\n </tr>\n </tbody>\n </table>\n `}}}}),at=(...e)=>e.filter(((e,t,r)=>Boolean(e)&&r.indexOf(e)===t)).join(" ")
9
9
  /**
10
10
  * @license lucide-react v0.453.0 - ISC
11
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"deserializeListNodes.d.ts","sourceRoot":"","sources":["../../src/utils/deserializeListNodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAoC,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE9F,KAAK,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,WAAW,CAAC;AAEzE,KAAK,2BAA2B,GAAG;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,cAAc,CAAC;IACnD,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;CACzC,CAAC;AAGF,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,2BAA2B,GACnC,eAAe,EAAE,CA8FnB"}
1
+ {"version":3,"file":"deserializeListNodes.d.ts","sourceRoot":"","sources":["../../src/utils/deserializeListNodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAoC,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE9F,KAAK,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,WAAW,CAAC;AAEzE,KAAK,2BAA2B,GAAG;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,cAAc,CAAC;IACnD,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;CACzC,CAAC;AAGF,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,2BAA2B,GACnC,eAAe,EAAE,CAoHnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/lists",
3
- "version": "4.9.7",
3
+ "version": "4.9.9",
4
4
  "description": "Lists plugin for Yoopta Editor",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
@@ -34,5 +34,5 @@
34
34
  "bugs": {
35
35
  "url": "https://github.com/Darginec05/Yoopta-Editor/issues"
36
36
  },
37
- "gitHead": "64c31820942608637d52766e09c741a8634519dc"
37
+ "gitHead": "e8260945d74e2b26e8c66a3ddf4da8ceb45bc74d"
38
38
  }