@wangeditor-next/yjs 0.1.0

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/README.md ADDED
@@ -0,0 +1,4 @@
1
+ base on [slate-yjs](https://github.com/BitPhinix/slate-yjs?tab=readme-ov-file)
2
+ This package contains the Core slate-yjs binding. Feel free to poke around to learn more!
3
+
4
+ Docs: https://docs.slate-yjs.dev/api/slate-yjs-core
@@ -0,0 +1,19 @@
1
+ import { Editor, Operation } from 'slate';
2
+ import * as Y from 'yjs';
3
+ /**
4
+ * Translate a yjs event into slate operations. The editor state has to match the
5
+ * yText state before the event occurred.
6
+ *
7
+ * @param sharedType
8
+ * @param op
9
+ */
10
+ export declare function translateYjsEvent(sharedRoot: Y.XmlText, editor: Editor, event: Y.YEvent<Y.XmlText>): Operation[];
11
+ /**
12
+ * Translates yjs events into slate operations and applies them to the editor. The
13
+ * editor state has to match the yText state before the events occurred.
14
+ *
15
+ * @param sharedRoot
16
+ * @param editor
17
+ * @param events
18
+ */
19
+ export declare function applyYjsEvents(sharedRoot: Y.XmlText, editor: Editor, events: Y.YEvent<Y.XmlText>[]): void;
@@ -0,0 +1,3 @@
1
+ import { Editor, Operation } from 'slate';
2
+ import * as Y from 'yjs';
3
+ export declare function translateYTextEvent(sharedRoot: Y.XmlText, editor: Editor, event: Y.YTextEvent): Operation[];
@@ -0,0 +1,3 @@
1
+ import { Node, Operation } from 'slate';
2
+ import * as Y from 'yjs';
3
+ export declare function applySlateOp(sharedRoot: Y.XmlText, slateRoot: Node, op: Operation): void;
@@ -0,0 +1,3 @@
1
+ import { NodeOperation } from 'slate';
2
+ import { OpMapper } from '../types';
3
+ export declare const NODE_MAPPER: OpMapper<NodeOperation>;
@@ -0,0 +1,3 @@
1
+ import { InsertNodeOperation, Node } from 'slate';
2
+ import * as Y from 'yjs';
3
+ export declare function insertNode(sharedRoot: Y.XmlText, slateRoot: Node, op: InsertNodeOperation): void;
@@ -0,0 +1,3 @@
1
+ import { MergeNodeOperation, Node } from 'slate';
2
+ import * as Y from 'yjs';
3
+ export declare function mergeNode(sharedRoot: Y.XmlText, slateRoot: Node, op: MergeNodeOperation): void;
@@ -0,0 +1,3 @@
1
+ import { MoveNodeOperation, Node } from 'slate';
2
+ import * as Y from 'yjs';
3
+ export declare function moveNode(sharedRoot: Y.XmlText, slateRoot: Node, op: MoveNodeOperation): void;
@@ -0,0 +1,3 @@
1
+ import { Node, RemoveNodeOperation } from 'slate';
2
+ import * as Y from 'yjs';
3
+ export declare function removeNode(sharedRoot: Y.XmlText, slateRoot: Node, op: RemoveNodeOperation): void;
@@ -0,0 +1,3 @@
1
+ import { Node, SetNodeOperation } from 'slate';
2
+ import * as Y from 'yjs';
3
+ export declare function setNode(sharedRoot: Y.XmlText, slateRoot: Node, op: SetNodeOperation): void;
@@ -0,0 +1,3 @@
1
+ import { Node, SplitNodeOperation } from 'slate';
2
+ import * as Y from 'yjs';
3
+ export declare function splitNode(sharedRoot: Y.XmlText, slateRoot: Node, op: SplitNodeOperation): void;
@@ -0,0 +1,3 @@
1
+ import { TextOperation } from 'slate';
2
+ import { OpMapper } from '../types';
3
+ export declare const TEXT_MAPPER: OpMapper<TextOperation>;
@@ -0,0 +1,3 @@
1
+ import { InsertTextOperation, Node } from 'slate';
2
+ import type Y from 'yjs';
3
+ export declare function insertText(sharedRoot: Y.XmlText, slateRoot: Node, op: InsertTextOperation): void;
@@ -0,0 +1,3 @@
1
+ import { Node, RemoveTextOperation } from 'slate';
2
+ import type Y from 'yjs';
3
+ export declare function removeText(sharedRoot: Y.XmlText, slateRoot: Node, op: RemoveTextOperation): void;
@@ -0,0 +1,8 @@
1
+ import { Node, Operation } from 'slate';
2
+ import * as Y from 'yjs';
3
+ export declare type ApplyFunc<O extends Operation = Operation> = (sharedRoot: Y.XmlText, slateRoot: Node, op: O) => void;
4
+ export declare type OpMapper<O extends Operation = Operation> = {
5
+ [K in O['type']]: O extends {
6
+ type: K;
7
+ } ? ApplyFunc<O> : never;
8
+ };
@@ -0,0 +1,5 @@
1
+ import { RelativeRange } from './module/custom-types';
2
+ import { CursorEditor, CursorState, CursorStateChangeEvent, RemoteCursorChangeEventListener, withCursors, WithCursorsOptions, withYHistory, WithYHistoryOptions, withYjs, WithYjsOptions, YHistoryEditor, YjsEditor } from './plugins';
3
+ import { slateNodesToInsertDelta, yTextToSlateElement } from './utils/convert';
4
+ import { relativePositionToSlatePoint, relativeRangeToSlateRange, slatePointToRelativePosition, slateRangeToRelativeRange } from './utils/position';
5
+ export { withYjs, WithYjsOptions, YjsEditor, withYHistory, WithYHistoryOptions, YHistoryEditor, CursorEditor, WithCursorsOptions, withCursors, CursorState, RemoteCursorChangeEventListener, CursorStateChangeEvent, RelativeRange, yTextToSlateElement, slateNodesToInsertDelta, slateRangeToRelativeRange, relativeRangeToSlateRange, slatePointToRelativePosition, relativePositionToSlatePoint, };
@@ -0,0 +1,2 @@
1
+ import{Text as t,Node as e,Path as n,Editor as r,Transforms as o}from"slate";import*as i from"yjs";var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(t){var e={exports:{}};return t(e,e.exports),e.exports}var c,s,f=function(t){return t&&t.Math==Math&&t},l=f("object"==typeof globalThis&&globalThis)||f("object"==typeof window&&window)||f("object"==typeof self&&self)||f("object"==typeof a&&a)||function(){return this}()||Function("return this")(),d=function(t){try{return!!t()}catch(t){return!0}},h=!d((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),p=Function.prototype.call,v=p.bind?p.bind(p):function(){return p.apply(p,arguments)},g={}.propertyIsEnumerable,y=Object.getOwnPropertyDescriptor,b=y&&!g.call({1:2},1)?function(t){var e=y(this,t);return!!e&&e.enumerable}:g,m={f:b},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},O=Function.prototype,S=O.bind,x=O.call,E=S&&S.bind(x),j=S?function(t){return t&&E(x,t)}:function(t){return t&&function(){return x.apply(t,arguments)}},T=j({}.toString),P=j("".slice),R=function(t){return P(T(t),8,-1)},A=l.Object,k=j("".split),C=d((function(){return!A("z").propertyIsEnumerable(0)}))?function(t){return"String"==R(t)?k(t,""):A(t)}:A,L=l.TypeError,_=function(t){if(null==t)throw L("Can't call method on "+t);return t},M=function(t){return C(_(t))},F=function(t){return"function"==typeof t},I=function(t){return"object"==typeof t?null!==t:F(t)},D=function(t,e){return arguments.length<2?(n=l[t],F(n)?n:void 0):l[t]&&l[t][e];var n},z=j({}.isPrototypeOf),N=D("navigator","userAgent")||"",W=l.process,G=l.Deno,X=W&&W.versions||G&&G.version,B=X&&X.v8;B&&(s=(c=B.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!s&&N&&(!(c=N.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=N.match(/Chrome\/(\d+)/))&&(s=+c[1]);var U=s,Y=!!Object.getOwnPropertySymbols&&!d((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&U&&U<41})),V=Y&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,q=l.Object,H=V?function(t){return"symbol"==typeof t}:function(t){var e=D("Symbol");return F(e)&&z(e.prototype,q(t))},J=l.String,K=function(t){try{return J(t)}catch(t){return"Object"}},$=l.TypeError,Q=function(t){if(F(t))return t;throw $(K(t)+" is not a function")},Z=function(t,e){var n=t[e];return null==n?void 0:Q(n)},tt=l.TypeError,et=Object.defineProperty,nt=function(t,e){try{et(l,t,{value:e,configurable:!0,writable:!0})}catch(n){l[t]=e}return e},rt="__core-js_shared__",ot=l[rt]||nt(rt,{}),it=u((function(t){(t.exports=function(t,e){return ot[t]||(ot[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),at=l.Object,ut=function(t){return at(_(t))},ct=j({}.hasOwnProperty),st=Object.hasOwn||function(t,e){return ct(ut(t),e)},ft=0,lt=Math.random(),dt=j(1..toString),ht=function(t){return"Symbol("+(void 0===t?"":t)+")_"+dt(++ft+lt,36)},pt=it("wks"),vt=l.Symbol,gt=vt&&vt.for,yt=V?vt:vt&&vt.withoutSetter||ht,bt=function(t){if(!st(pt,t)||!Y&&"string"!=typeof pt[t]){var e="Symbol."+t;Y&&st(vt,t)?pt[t]=vt[t]:pt[t]=V&&gt?gt(e):yt(e)}return pt[t]},mt=l.TypeError,wt=bt("toPrimitive"),Ot=function(t,e){if(!I(t)||H(t))return t;var n,r=Z(t,wt);if(r){if(void 0===e&&(e="default"),n=v(r,t,e),!I(n)||H(n))return n;throw mt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,r;if("string"===e&&F(n=t.toString)&&!I(r=v(n,t)))return r;if(F(n=t.valueOf)&&!I(r=v(n,t)))return r;if("string"!==e&&F(n=t.toString)&&!I(r=v(n,t)))return r;throw tt("Can't convert object to primitive value")}(t,e)},St=function(t){var e=Ot(t,"string");return H(e)?e:e+""},xt=l.document,Et=I(xt)&&I(xt.createElement),jt=function(t){return Et?xt.createElement(t):{}},Tt=!h&&!d((function(){return 7!=Object.defineProperty(jt("div"),"a",{get:function(){return 7}}).a})),Pt=Object.getOwnPropertyDescriptor,Rt={f:h?Pt:function(t,e){if(t=M(t),e=St(e),Tt)try{return Pt(t,e)}catch(t){}if(st(t,e))return w(!v(m.f,t,e),t[e])}},At=l.String,kt=l.TypeError,Ct=function(t){if(I(t))return t;throw kt(At(t)+" is not an object")},Lt=l.TypeError,_t=Object.defineProperty,Mt={f:h?_t:function(t,e,n){if(Ct(t),e=St(e),Ct(n),Tt)try{return _t(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Lt("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},Ft=h?function(t,e,n){return Mt.f(t,e,w(1,n))}:function(t,e,n){return t[e]=n,t},It=j(Function.toString);F(ot.inspectSource)||(ot.inspectSource=function(t){return It(t)});var Dt,zt,Nt,Wt=ot.inspectSource,Gt=l.WeakMap,Xt=F(Gt)&&/native code/.test(Wt(Gt)),Bt=it("keys"),Ut=function(t){return Bt[t]||(Bt[t]=ht(t))},Yt={},Vt="Object already initialized",qt=l.TypeError,Ht=l.WeakMap;if(Xt||ot.state){var Jt=ot.state||(ot.state=new Ht),Kt=j(Jt.get),$t=j(Jt.has),Qt=j(Jt.set);Dt=function(t,e){if($t(Jt,t))throw new qt(Vt);return e.facade=t,Qt(Jt,t,e),e},zt=function(t){return Kt(Jt,t)||{}},Nt=function(t){return $t(Jt,t)}}else{var Zt=Ut("state");Yt[Zt]=!0,Dt=function(t,e){if(st(t,Zt))throw new qt(Vt);return e.facade=t,Ft(t,Zt,e),e},zt=function(t){return st(t,Zt)?t[Zt]:{}},Nt=function(t){return st(t,Zt)}}var te={set:Dt,get:zt,has:Nt,enforce:function(t){return Nt(t)?zt(t):Dt(t,{})},getterFor:function(t){return function(e){var n;if(!I(e)||(n=zt(e)).type!==t)throw qt("Incompatible receiver, "+t+" required");return n}}},ee=Function.prototype,ne=h&&Object.getOwnPropertyDescriptor,re=st(ee,"name"),oe={EXISTS:re,PROPER:re&&"something"===function(){}.name,CONFIGURABLE:re&&(!h||h&&ne(ee,"name").configurable)},ie=u((function(t){var e=oe.CONFIGURABLE,n=te.get,r=te.enforce,o=String(String).split("String");(t.exports=function(t,n,i,a){var u,c=!!a&&!!a.unsafe,s=!!a&&!!a.enumerable,f=!!a&&!!a.noTargetGet,d=a&&void 0!==a.name?a.name:n;F(i)&&("Symbol("===String(d).slice(0,7)&&(d="["+String(d).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!st(i,"name")||e&&i.name!==d)&&Ft(i,"name",d),(u=r(i)).source||(u.source=o.join("string"==typeof d?d:""))),t!==l?(c?!f&&t[n]&&(s=!0):delete t[n],s?t[n]=i:Ft(t,n,i)):s?t[n]=i:nt(n,i)})(Function.prototype,"toString",(function(){return F(this)&&n(this).source||Wt(this)}))})),ae=Math.ceil,ue=Math.floor,ce=function(t){var e=+t;return e!=e||0===e?0:(e>0?ue:ae)(e)},se=Math.max,fe=Math.min,le=function(t,e){var n=ce(t);return n<0?se(n+e,0):fe(n,e)},de=Math.min,he=function(t){return t>0?de(ce(t),9007199254740991):0},pe=function(t){return he(t.length)},ve=function(t){return function(e,n,r){var o,i=M(e),a=pe(i),u=le(r,a);if(t&&n!=n){for(;a>u;)if((o=i[u++])!=o)return!0}else for(;a>u;u++)if((t||u in i)&&i[u]===n)return t||u||0;return!t&&-1}},ge={includes:ve(!0),indexOf:ve(!1)},ye=ge.indexOf,be=j([].push),me=function(t,e){var n,r=M(t),o=0,i=[];for(n in r)!st(Yt,n)&&st(r,n)&&be(i,n);for(;e.length>o;)st(r,n=e[o++])&&(~ye(i,n)||be(i,n));return i},we=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Oe=we.concat("length","prototype"),Se={f:Object.getOwnPropertyNames||function(t){return me(t,Oe)}},xe={f:Object.getOwnPropertySymbols},Ee=j([].concat),je=D("Reflect","ownKeys")||function(t){var e=Se.f(Ct(t)),n=xe.f;return n?Ee(e,n(t)):e},Te=function(t,e){for(var n=je(e),r=Mt.f,o=Rt.f,i=0;i<n.length;i++){var a=n[i];st(t,a)||r(t,a,o(e,a))}},Pe=/#|\.prototype\./,Re=function(t,e){var n=ke[Ae(t)];return n==Le||n!=Ce&&(F(e)?d(e):!!e)},Ae=Re.normalize=function(t){return String(t).replace(Pe,".").toLowerCase()},ke=Re.data={},Ce=Re.NATIVE="N",Le=Re.POLYFILL="P",_e=Re,Me=Rt.f,Fe=function(t,e){var n,r,o,i,a,u=t.target,c=t.global,s=t.stat;if(n=c?l:s?l[u]||nt(u,{}):(l[u]||{}).prototype)for(r in e){if(i=e[r],o=t.noTargetGet?(a=Me(n,r))&&a.value:n[r],!_e(c?r:u+(s?".":"#")+r,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;Te(i,o)}(t.sham||o&&o.sham)&&Ft(i,"sham",!0),ie(n,r,i,t)}},Ie=Function.prototype,De=Ie.apply,ze=Ie.bind,Ne=Ie.call,We="object"==typeof Reflect&&Reflect.apply||(ze?Ne.bind(De):function(){return Ne.apply(De,arguments)}),Ge=Array.isArray||function(t){return"Array"==R(t)},Xe={};Xe[bt("toStringTag")]="z";var Be,Ue="[object z]"===String(Xe),Ye=bt("toStringTag"),Ve=l.Object,qe="Arguments"==R(function(){return arguments}()),He=Ue?R:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ve(t),Ye))?n:qe?R(e):"Object"==(r=R(e))&&F(e.callee)?"Arguments":r},Je=l.String,Ke=function(t){if("Symbol"===He(t))throw TypeError("Cannot convert a Symbol value to a string");return Je(t)},$e=Object.keys||function(t){return me(t,we)},Qe=h?Object.defineProperties:function(t,e){Ct(t);for(var n,r=M(e),o=$e(e),i=o.length,a=0;i>a;)Mt.f(t,n=o[a++],r[n]);return t},Ze=D("document","documentElement"),tn="prototype",en="script",nn=Ut("IE_PROTO"),rn=function(){},on=function(t){return"<"+en+">"+t+"</"+en+">"},an=function(t){t.write(on("")),t.close();var e=t.parentWindow.Object;return t=null,e},un=function(){try{Be=new ActiveXObject("htmlfile")}catch(t){}var t,e,n;un="undefined"!=typeof document?document.domain&&Be?an(Be):(e=jt("iframe"),n="java"+en+":",e.style.display="none",Ze.appendChild(e),e.src=String(n),(t=e.contentWindow.document).open(),t.write(on("document.F=Object")),t.close(),t.F):an(Be);for(var r=we.length;r--;)delete un[tn][we[r]];return un()};Yt[nn]=!0;var cn=Object.create||function(t,e){var n;return null!==t?(rn[tn]=Ct(t),n=new rn,rn[tn]=null,n[nn]=t):n=un(),void 0===e?n:Qe(n,e)},sn=function(t,e,n){var r=St(e);r in t?Mt.f(t,r,w(0,n)):t[r]=n},fn=l.Array,ln=Math.max,dn=Se.f,hn="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],pn=function(t){try{return dn(t)}catch(t){return function(t,e,n){for(var r=pe(t),o=le(e,r),i=le(void 0===n?r:n,r),a=fn(ln(i-o,0)),u=0;o<i;o++,u++)sn(a,u,t[o]);return a.length=u,a}(hn)}},vn={f:function(t){return hn&&"Window"==R(t)?pn(t):dn(M(t))}},gn=j([].slice),yn={f:bt},bn=l,mn=Mt.f,wn=Mt.f,On=bt("toStringTag"),Sn=function(t,e,n){t&&!st(t=n?t:t.prototype,On)&&wn(t,On,{configurable:!0,value:e})},xn=j(j.bind),En=function(t,e){return Q(t),void 0===e?t:xn?xn(t,e):function(){return t.apply(e,arguments)}},jn=function(){},Tn=[],Pn=D("Reflect","construct"),Rn=/^\s*(?:class|function)\b/,An=j(Rn.exec),kn=!Rn.exec(jn),Cn=function(t){if(!F(t))return!1;try{return Pn(jn,Tn,t),!0}catch(t){return!1}},Ln=!Pn||d((function(){var t;return Cn(Cn.call)||!Cn(Object)||!Cn((function(){t=!0}))||t}))?function(t){if(!F(t))return!1;switch(He(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return kn||!!An(Rn,Wt(t))}:Cn,_n=bt("species"),Mn=l.Array,Fn=function(t,e){return new(function(t){var e;return Ge(t)&&(e=t.constructor,(Ln(e)&&(e===Mn||Ge(e.prototype))||I(e)&&null===(e=e[_n]))&&(e=void 0)),void 0===e?Mn:e}(t))(0===e?0:e)},In=j([].push),Dn=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,a=7==t,u=5==t||i;return function(c,s,f,l){for(var d,h,p=ut(c),v=C(p),g=En(s,f),y=pe(v),b=0,m=l||Fn,w=e?m(c,y):n||a?m(c,0):void 0;y>b;b++)if((u||b in v)&&(h=g(d=v[b],b,p),t))if(e)w[b]=h;else if(h)switch(t){case 3:return!0;case 5:return d;case 6:return b;case 2:In(w,d)}else switch(t){case 4:return!1;case 7:In(w,d)}return i?-1:r||o?o:w}},zn={forEach:Dn(0),map:Dn(1),filter:Dn(2),some:Dn(3),every:Dn(4),find:Dn(5),findIndex:Dn(6),filterReject:Dn(7)},Nn=zn.forEach,Wn=Ut("hidden"),Gn="Symbol",Xn="prototype",Bn=bt("toPrimitive"),Un=te.set,Yn=te.getterFor(Gn),Vn=Object[Xn],qn=l.Symbol,Hn=qn&&qn[Xn],Jn=l.TypeError,Kn=l.QObject,$n=D("JSON","stringify"),Qn=Rt.f,Zn=Mt.f,tr=vn.f,er=m.f,nr=j([].push),rr=it("symbols"),or=it("op-symbols"),ir=it("string-to-symbol-registry"),ar=it("symbol-to-string-registry"),ur=it("wks"),cr=!Kn||!Kn[Xn]||!Kn[Xn].findChild,sr=h&&d((function(){return 7!=cn(Zn({},"a",{get:function(){return Zn(this,"a",{value:7}).a}})).a}))?function(t,e,n){var r=Qn(Vn,e);r&&delete Vn[e],Zn(t,e,n),r&&t!==Vn&&Zn(Vn,e,r)}:Zn,fr=function(t,e){var n=rr[t]=cn(Hn);return Un(n,{type:Gn,tag:t,description:e}),h||(n.description=e),n},lr=function(t,e,n){t===Vn&&lr(or,e,n),Ct(t);var r=St(e);return Ct(n),st(rr,r)?(n.enumerable?(st(t,Wn)&&t[Wn][r]&&(t[Wn][r]=!1),n=cn(n,{enumerable:w(0,!1)})):(st(t,Wn)||Zn(t,Wn,w(1,{})),t[Wn][r]=!0),sr(t,r,n)):Zn(t,r,n)},dr=function(t,e){Ct(t);var n=M(e),r=$e(n).concat(gr(n));return Nn(r,(function(e){h&&!v(hr,n,e)||lr(t,e,n[e])})),t},hr=function(t){var e=St(t),n=v(er,this,e);return!(this===Vn&&st(rr,e)&&!st(or,e))&&(!(n||!st(this,e)||!st(rr,e)||st(this,Wn)&&this[Wn][e])||n)},pr=function(t,e){var n=M(t),r=St(e);if(n!==Vn||!st(rr,r)||st(or,r)){var o=Qn(n,r);return!o||!st(rr,r)||st(n,Wn)&&n[Wn][r]||(o.enumerable=!0),o}},vr=function(t){var e=tr(M(t)),n=[];return Nn(e,(function(t){st(rr,t)||st(Yt,t)||nr(n,t)})),n},gr=function(t){var e=t===Vn,n=tr(e?or:M(t)),r=[];return Nn(n,(function(t){!st(rr,t)||e&&!st(Vn,t)||nr(r,rr[t])})),r};if(Y||(Hn=(qn=function(){if(z(Hn,this))throw Jn("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?Ke(arguments[0]):void 0,e=ht(t),n=function(t){this===Vn&&v(n,or,t),st(this,Wn)&&st(this[Wn],e)&&(this[Wn][e]=!1),sr(this,e,w(1,t))};return h&&cr&&sr(Vn,e,{configurable:!0,set:n}),fr(e,t)})[Xn],ie(Hn,"toString",(function(){return Yn(this).tag})),ie(qn,"withoutSetter",(function(t){return fr(ht(t),t)})),m.f=hr,Mt.f=lr,Rt.f=pr,Se.f=vn.f=vr,xe.f=gr,yn.f=function(t){return fr(bt(t),t)},h&&(Zn(Hn,"description",{configurable:!0,get:function(){return Yn(this).description}}),ie(Vn,"propertyIsEnumerable",hr,{unsafe:!0}))),Fe({global:!0,wrap:!0,forced:!Y,sham:!Y},{Symbol:qn}),Nn($e(ur),(function(t){!function(t){var e=bn.Symbol||(bn.Symbol={});st(e,t)||mn(e,t,{value:yn.f(t)})}(t)})),Fe({target:Gn,stat:!0,forced:!Y},{for:function(t){var e=Ke(t);if(st(ir,e))return ir[e];var n=qn(e);return ir[e]=n,ar[n]=e,n},keyFor:function(t){if(!H(t))throw Jn(t+" is not a symbol");if(st(ar,t))return ar[t]},useSetter:function(){cr=!0},useSimple:function(){cr=!1}}),Fe({target:"Object",stat:!0,forced:!Y,sham:!h},{create:function(t,e){return void 0===e?cn(t):dr(cn(t),e)},defineProperty:lr,defineProperties:dr,getOwnPropertyDescriptor:pr}),Fe({target:"Object",stat:!0,forced:!Y},{getOwnPropertyNames:vr,getOwnPropertySymbols:gr}),Fe({target:"Object",stat:!0,forced:d((function(){xe.f(1)}))},{getOwnPropertySymbols:function(t){return xe.f(ut(t))}}),$n){var yr=!Y||d((function(){var t=qn();return"[null]"!=$n([t])||"{}"!=$n({a:t})||"{}"!=$n(Object(t))}));Fe({target:"JSON",stat:!0,forced:yr},{stringify:function(t,e,n){var r=gn(arguments),o=e;if((I(e)||void 0!==t)&&!H(t))return Ge(e)||(e=function(t,e){if(F(o)&&(e=v(o,this,t,e)),!H(e))return e}),r[1]=e,We($n,null,r)}})}if(!Hn[Bn]){var br=Hn.valueOf;ie(Hn,Bn,(function(t){return v(br,this)}))}Sn(qn,Gn),Yt[Wn]=!0;var mr=Mt.f,wr=l.Symbol,Or=wr&&wr.prototype;if(h&&F(wr)&&(!("description"in Or)||void 0!==wr().description)){var Sr={},xr=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:Ke(arguments[0]),e=z(Or,this)?new wr(t):void 0===t?wr():wr(t);return""===t&&(Sr[e]=!0),e};Te(xr,wr),xr.prototype=Or,Or.constructor=xr;var Er="Symbol(test)"==String(wr("test")),jr=j(Or.toString),Tr=j(Or.valueOf),Pr=/^Symbol\((.*)\)[^)]+$/,Rr=j("".replace),Ar=j("".slice);mr(Or,"description",{configurable:!0,get:function(){var t=Tr(this),e=jr(t);if(st(Sr,t))return"";var n=Er?Ar(e,7,-1):Rr(e,Pr,"$1");return""===n?void 0:n}}),Fe({global:!0,forced:!0},{Symbol:xr})}var kr=bt("unscopables"),Cr=Array.prototype;null==Cr[kr]&&Mt.f(Cr,kr,{configurable:!0,value:cn(null)});var Lr,_r,Mr,Fr=function(t){Cr[kr][t]=!0},Ir={},Dr=!d((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),zr=Ut("IE_PROTO"),Nr=l.Object,Wr=Nr.prototype,Gr=Dr?Nr.getPrototypeOf:function(t){var e=ut(t);if(st(e,zr))return e[zr];var n=e.constructor;return F(n)&&e instanceof n?n.prototype:e instanceof Nr?Wr:null},Xr=bt("iterator"),Br=!1;[].keys&&("next"in(Mr=[].keys())?(_r=Gr(Gr(Mr)))!==Object.prototype&&(Lr=_r):Br=!0);var Ur=null==Lr||d((function(){var t={};return Lr[Xr].call(t)!==t}));Ur&&(Lr={}),F(Lr[Xr])||ie(Lr,Xr,(function(){return this}));var Yr={IteratorPrototype:Lr,BUGGY_SAFARI_ITERATORS:Br},Vr=Yr.IteratorPrototype,qr=function(){return this},Hr=l.String,Jr=l.TypeError,Kr=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=j(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),e=n instanceof Array}catch(t){}return function(n,r){return Ct(n),function(t){if("object"==typeof t||F(t))return t;throw Jr("Can't set "+Hr(t)+" as a prototype")}(r),e?t(n,r):n.__proto__=r,n}}():void 0),$r=oe.PROPER,Qr=oe.CONFIGURABLE,Zr=Yr.IteratorPrototype,to=Yr.BUGGY_SAFARI_ITERATORS,eo=bt("iterator"),no="keys",ro="values",oo="entries",io=function(){return this},ao=function(t,e,n,r,o,i,a){!function(t,e,n,r){var o=e+" Iterator";t.prototype=cn(Vr,{next:w(+!r,n)}),Sn(t,o,!1),Ir[o]=qr}(n,e,r);var u,c,s,f=function(t){if(t===o&&g)return g;if(!to&&t in h)return h[t];switch(t){case no:case ro:case oo:return function(){return new n(this,t)}}return function(){return new n(this)}},l=e+" Iterator",d=!1,h=t.prototype,p=h[eo]||h["@@iterator"]||o&&h[o],g=!to&&p||f(o),y="Array"==e&&h.entries||p;if(y&&(u=Gr(y.call(new t)))!==Object.prototype&&u.next&&(Gr(u)!==Zr&&(Kr?Kr(u,Zr):F(u[eo])||ie(u,eo,io)),Sn(u,l,!0)),$r&&o==ro&&p&&p.name!==ro&&(Qr?Ft(h,"name",ro):(d=!0,g=function(){return v(p,this)})),o)if(c={values:f(ro),keys:i?g:f(no),entries:f(oo)},a)for(s in c)(to||d||!(s in h))&&ie(h,s,c[s]);else Fe({target:e,proto:!0,forced:to||d},c);return h[eo]!==g&&ie(h,eo,g,{name:o}),Ir[e]=g,c},uo="Array Iterator",co=te.set,so=te.getterFor(uo),fo=ao(Array,"Array",(function(t,e){co(this,{type:uo,target:M(t),index:0,kind:e})}),(function(){var t=so(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}}),"values");Ir.Arguments=Ir.Array,Fr("keys"),Fr("values"),Fr("entries");var lo=Ue?{}.toString:function(){return"[object "+He(this)+"]"};Ue||ie(Object.prototype,"toString",lo,{unsafe:!0});var ho=j("".charAt),po=j("".charCodeAt),vo=j("".slice),go=function(t){return function(e,n){var r,o,i=Ke(_(e)),a=ce(n),u=i.length;return a<0||a>=u?t?"":void 0:(r=po(i,a))<55296||r>56319||a+1===u||(o=po(i,a+1))<56320||o>57343?t?ho(i,a):r:t?vo(i,a,a+2):o-56320+(r-55296<<10)+65536}},yo={codeAt:go(!1),charAt:go(!0)}.charAt,bo="String Iterator",mo=te.set,wo=te.getterFor(bo);ao(String,"String",(function(t){mo(this,{type:bo,string:Ke(t),index:0})}),(function(){var t,e=wo(this),n=e.string,r=e.index;return r>=n.length?{value:void 0,done:!0}:(t=yo(n,r),e.index+=t.length,{value:t,done:!1})}));var Oo=function(t,e,n){for(var r in e)ie(t,r,e[r],n);return t},So=d((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})),xo=Object.isExtensible,Eo=d((function(){xo(1)}))||So?function(t){return!!I(t)&&((!So||"ArrayBuffer"!=R(t))&&(!xo||xo(t)))}:xo,jo=!d((function(){return Object.isExtensible(Object.preventExtensions({}))})),To=u((function(t){var e=Mt.f,n=!1,r=ht("meta"),o=0,i=function(t){e(t,r,{value:{objectID:"O"+o++,weakData:{}}})},a=t.exports={enable:function(){a.enable=function(){},n=!0;var t=Se.f,e=j([].splice),o={};o[r]=1,t(o).length&&(Se.f=function(n){for(var o=t(n),i=0,a=o.length;i<a;i++)if(o[i]===r){e(o,i,1);break}return o},Fe({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:vn.f}))},fastKey:function(t,e){if(!I(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!st(t,r)){if(!Eo(t))return"F";if(!e)return"E";i(t)}return t[r].objectID},getWeakData:function(t,e){if(!st(t,r)){if(!Eo(t))return!0;if(!e)return!1;i(t)}return t[r].weakData},onFreeze:function(t){return jo&&n&&Eo(t)&&!st(t,r)&&i(t),t}};Yt[r]=!0})),Po=bt("iterator"),Ro=Array.prototype,Ao=function(t){return void 0!==t&&(Ir.Array===t||Ro[Po]===t)},ko=bt("iterator"),Co=function(t){if(null!=t)return Z(t,ko)||Z(t,"@@iterator")||Ir[He(t)]},Lo=l.TypeError,_o=function(t,e){var n=arguments.length<2?Co(t):e;if(Q(n))return Ct(v(n,t));throw Lo(K(t)+" is not iterable")},Mo=function(t,e,n){var r,o;Ct(t);try{if(!(r=Z(t,"return"))){if("throw"===e)throw n;return n}r=v(r,t)}catch(t){o=!0,r=t}if("throw"===e)throw n;if(o)throw r;return Ct(r),n},Fo=l.TypeError,Io=function(t,e){this.stopped=t,this.result=e},Do=Io.prototype,zo=function(t,e,n){var r,o,i,a,u,c,s,f=n&&n.that,l=!(!n||!n.AS_ENTRIES),d=!(!n||!n.IS_ITERATOR),h=!(!n||!n.INTERRUPTED),p=En(e,f),g=function(t){return r&&Mo(r,"normal",t),new Io(!0,t)},y=function(t){return l?(Ct(t),h?p(t[0],t[1],g):p(t[0],t[1])):h?p(t,g):p(t)};if(d)r=t;else{if(!(o=Co(t)))throw Fo(K(t)+" is not iterable");if(Ao(o)){for(i=0,a=pe(t);a>i;i++)if((u=y(t[i]))&&z(Do,u))return u;return new Io(!1)}r=_o(t,o)}for(c=r.next;!(s=v(c,r)).done;){try{u=y(s.value)}catch(t){Mo(r,"throw",t)}if("object"==typeof u&&u&&z(Do,u))return u}return new Io(!1)},No=l.TypeError,Wo=function(t,e){if(z(e,t))return t;throw No("Incorrect invocation")},Go=bt("iterator"),Xo=!1;try{var Bo=0,Uo={next:function(){return{done:!!Bo++}},return:function(){Xo=!0}};Uo[Go]=function(){return this},Array.from(Uo,(function(){throw 2}))}catch(t){}var Yo=function(t,e){if(!e&&!Xo)return!1;var n=!1;try{var r={};r[Go]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n},Vo=function(t,e,n){var r=-1!==t.indexOf("Map"),o=-1!==t.indexOf("Weak"),i=r?"set":"add",a=l[t],u=a&&a.prototype,c=a,s={},f=function(t){var e=j(u[t]);ie(u,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(o&&!I(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return o&&!I(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(o&&!I(t))&&e(this,0===t?0:t)}:function(t,n){return e(this,0===t?0:t,n),this})};if(_e(t,!F(a)||!(o||u.forEach&&!d((function(){(new a).entries().next()})))))c=n.getConstructor(e,t,r,i),To.enable();else if(_e(t,!0)){var h=new c,p=h[i](o?{}:-0,1)!=h,v=d((function(){h.has(1)})),g=Yo((function(t){new a(t)})),y=!o&&d((function(){for(var t=new a,e=5;e--;)t[i](e,e);return!t.has(-0)}));g||((c=e((function(t,e){Wo(t,u);var n=function(t,e,n){var r,o;return Kr&&F(r=e.constructor)&&r!==n&&I(o=r.prototype)&&o!==n.prototype&&Kr(t,o),t}(new a,t,c);return null!=e&&zo(e,n[i],{that:n,AS_ENTRIES:r}),n}))).prototype=u,u.constructor=c),(v||y)&&(f("delete"),f("has"),r&&f("get")),(y||p)&&f(i),o&&u.clear&&delete u.clear}return s[t]=c,Fe({global:!0,forced:c!=a},s),Sn(c,t),o||n.setStrong(c,t,r),c},qo=To.getWeakData,Ho=te.set,Jo=te.getterFor,Ko=zn.find,$o=zn.findIndex,Qo=j([].splice),Zo=0,ti=function(t){return t.frozen||(t.frozen=new ei)},ei=function(){this.entries=[]},ni=function(t,e){return Ko(t.entries,(function(t){return t[0]===e}))};ei.prototype={get:function(t){var e=ni(this,t);if(e)return e[1]},has:function(t){return!!ni(this,t)},set:function(t,e){var n=ni(this,t);n?n[1]=e:this.entries.push([t,e])},delete:function(t){var e=$o(this.entries,(function(e){return e[0]===t}));return~e&&Qo(this.entries,e,1),!!~e}};var ri,oi={getConstructor:function(t,e,n,r){var o=t((function(t,o){Wo(t,i),Ho(t,{type:e,id:Zo++,frozen:void 0}),null!=o&&zo(o,t[r],{that:t,AS_ENTRIES:n})})),i=o.prototype,a=Jo(e),u=function(t,e,n){var r=a(t),o=qo(Ct(e),!0);return!0===o?ti(r).set(e,n):o[r.id]=n,t};return Oo(i,{delete:function(t){var e=a(this);if(!I(t))return!1;var n=qo(t);return!0===n?ti(e).delete(t):n&&st(n,e.id)&&delete n[e.id]},has:function(t){var e=a(this);if(!I(t))return!1;var n=qo(t);return!0===n?ti(e).has(t):n&&st(n,e.id)}}),Oo(i,n?{get:function(t){var e=a(this);if(I(t)){var n=qo(t);return!0===n?ti(e).get(t):n?n[e.id]:void 0}},set:function(t,e){return u(this,t,e)}}:{add:function(t){return u(this,t,!0)}}),o}},ii=te.enforce,ai=!l.ActiveXObject&&"ActiveXObject"in l,ui=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},ci=Vo("WeakMap",ui,oi);if(Xt&&ai){ri=oi.getConstructor(ui,"WeakMap",!0),To.enable();var si=ci.prototype,fi=j(si.delete),li=j(si.has),di=j(si.get),hi=j(si.set);Oo(si,{delete:function(t){if(I(t)&&!Eo(t)){var e=ii(this);return e.frozen||(e.frozen=new ri),fi(this,t)||e.frozen.delete(t)}return fi(this,t)},has:function(t){if(I(t)&&!Eo(t)){var e=ii(this);return e.frozen||(e.frozen=new ri),li(this,t)||e.frozen.has(t)}return li(this,t)},get:function(t){if(I(t)&&!Eo(t)){var e=ii(this);return e.frozen||(e.frozen=new ri),li(this,t)?di(this,t):e.frozen.get(t)}return di(this,t)},set:function(t,e){if(I(t)&&!Eo(t)){var n=ii(this);n.frozen||(n.frozen=new ri),li(this,t)?hi(this,t,e):n.frozen.set(t,e)}else hi(this,t,e);return this}})}Vo("WeakSet",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),oi);var pi,vi,gi={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},yi=jt("span").classList,bi=yi&&yi.constructor&&yi.constructor.prototype,mi=bi===Object.prototype?void 0:bi,wi=zn.forEach,Oi=!!(vi=[]["forEach"])&&d((function(){vi.call(null,pi||function(){throw 1},1)}))?[].forEach:function(t){return wi(this,t,arguments.length>1?arguments[1]:void 0)},Si=function(t){if(t&&t.forEach!==Oi)try{Ft(t,"forEach",Oi)}catch(e){t.forEach=Oi}};for(var xi in gi)gi[xi]&&Si(l[xi]&&l[xi].prototype);Si(mi);var Ei=bt("iterator"),ji=bt("toStringTag"),Ti=fo.values,Pi=function(t,e){if(t){if(t[Ei]!==Ti)try{Ft(t,Ei,Ti)}catch(e){t[Ei]=Ti}if(t[ji]||Ft(t,ji,e),gi[e])for(var n in fo)if(t[n]!==fo[n])try{Ft(t,n,fo[n])}catch(e){t[n]=fo[n]}}};for(var Ri in gi)Pi(l[Ri]&&l[Ri].prototype,Ri);Pi(mi,"DOMTokenList");var Ai=function(){return Ai=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Ai.apply(this,arguments)};function ki(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function Ci(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Li(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function _i(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var Mi=function(t,e,n,r){try{return r?e(Ct(n)[0],n[1]):e(n)}catch(e){Mo(t,"throw",e)}},Fi=l.Array,Ii=!Yo((function(t){Array.from(t)}));Fe({target:"Array",stat:!0,forced:Ii},{from:function(t){var e=ut(t),n=Ln(this),r=arguments.length,o=r>1?arguments[1]:void 0,i=void 0!==o;i&&(o=En(o,r>2?arguments[2]:void 0));var a,u,c,s,f,l,d=Co(e),h=0;if(!d||this==Fi&&Ao(d))for(a=pe(e),u=n?new this(a):Fi(a);a>h;h++)l=i?o(e[h],h):e[h],sn(u,h,l);else for(f=(s=_o(e,d)).next,u=n?new this:[];!(c=v(f,s)).done;h++)l=i?Mi(s,o,[c.value,h],!0):c.value,sn(u,h,l);return u.length=h,u}});var Di=bt("species"),zi=function(t){return U>=51||!d((function(){var e=[];return(e.constructor={})[Di]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},Ni=zn.map,Wi=zi("map");Fe({target:"Array",proto:!0,forced:!Wi},{map:function(t){return Ni(this,t,arguments.length>1?arguments[1]:void 0)}});var Gi=zi("slice"),Xi=bt("species"),Bi=l.Array,Ui=Math.max;Fe({target:"Array",proto:!0,forced:!Gi},{slice:function(t,e){var n,r,o,i=M(this),a=pe(i),u=le(t,a),c=le(void 0===e?a:e,a);if(Ge(i)&&(n=i.constructor,(Ln(n)&&(n===Bi||Ge(n.prototype))||I(n)&&null===(n=n[Xi]))&&(n=void 0),n===Bi||void 0===n))return gn(i,u,c);for(r=new(void 0===n?Bi:n)(Ui(c-u,0)),o=0;u<c;u++,o++)u in i&&sn(r,o,i[u]);return r.length=o,r}}),Fe({target:"Object",stat:!0},{fromEntries:function(t){var e={};return zo(t,(function(t,n){sn(e,t,n)}),{AS_ENTRIES:!0}),e}});var Yi=d((function(){$e(1)}));Fe({target:"Object",stat:!0,forced:Yi},{keys:function(t){return $e(ut(t))}});var Vi=m.f,qi=j(Vi),Hi=j([].push),Ji=function(t){return function(e){for(var n,r=M(e),o=$e(r),i=o.length,a=0,u=[];i>a;)n=o[a++],h&&!qi(r,n)||Hi(u,t?[n,r[n]]:r[n]);return u}},Ki={entries:Ji(!0),values:Ji(!1)}.entries;Fe({target:"Object",stat:!0},{entries:function(t){return Ki(t)}});var $i=zn.filter,Qi=zi("filter");Fe({target:"Array",proto:!0,forced:!Qi},{filter:function(t){return $i(this,t,arguments.length>1?arguments[1]:void 0)}});var Zi=ge.includes;Fe({target:"Array",proto:!0},{includes:function(t){return Zi(this,t,arguments.length>1?arguments[1]:void 0)}}),Fr("includes");var ta=oe.PROPER,ea="toString",na=RegExp.prototype,ra=na[ea],oa=j((function(){var t=Ct(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e})),ia=d((function(){return"/a/b"!=ra.call({source:"a",flags:"b"})})),aa=ta&&ra.name!=ea;function ua(t){return"[object Object]"===Object.prototype.toString.call(t)}function ca(t){if(!ua(t))return!1;var e=t.constructor;if(void 0===e)return!0;var n=e.prototype;return!1!==ua(n)&&!Object.prototype.hasOwnProperty.call(n,"isPrototypeOfOf")}function sa(t,e){for(var n in t){var r=t[n],o=e[n];if(ca(r)&&ca(o)){if(!sa(r,o))return!1}else if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==o[i])return!1}else if(r!==o)return!1}for(var n in e)if(void 0===t[n]&&void 0!==e[n])return!1;return!0}function fa(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return Object.fromEntries(Object.entries(t).filter((function(t){var n=Li(t,1)[0];return e.includes(n)})))}function la(t){return function(t){var e,n,r,o,i=[];try{for(var a=Ci(t),u=a.next();!u.done;u=a.next()){var c=u.value;if("string"!=typeof c.insert||0!==c.insert.length){var s=i[i.length-1];s&&"string"==typeof s.insert&&"string"==typeof c.insert&&(s.attributes===c.attributes||!s.attributes==!c.attributes&&sa(null!==(r=s.attributes)&&void 0!==r?r:{},null!==(o=c.attributes)&&void 0!==o?o:{}))?s.insert+=c.insert:i.push(c)}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return i}(t.toDelta())}function da(t){var e=t.insert;return"string"==typeof e?e.length:1}function ha(t){return t.reduce((function(t,e){return t+da(e)}),0)}function pa(t,e,n){if(n<1)return[];for(var r=0,o=[],i=e+n,a=0;a<t.length&&!(r>=i);a++){var u=t[a],c=da(u);if(r+c<=e)r+=c;else if("string"==typeof u.insert){var s=Math.max(0,e-r),f=Math.min(c,c-(r+c-i));o.push(Ai(Ai({},u),{insert:u.insert.slice(s,f)})),r+=c}else r+=c,o.push(u)}return o}function va(e){return function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return Object.fromEntries(Object.entries(t).filter((function(t){var n=Li(t,1)[0];return!e.includes(n)})))}(e,t.isText(e)?"text":"children")}function ga(t){var e=la(t),n=e.length>0?e.map(ya):[{text:""}];return Ai(Ai({},t.getAttributes()),{children:n})}function ya(t){return"string"==typeof t.insert?Ai(Ai({},t.attributes),{text:t.insert}):ga(t.insert)}function ba(e){return e.map((function(e){return t.isText(e)?{insert:e.text,attributes:va(e)}:{insert:ma(e)}}))}function ma(t){var e=t.children,n=ki(t,["children"]),r=new i.XmlText;return Object.entries(n).forEach((function(t){var e=Li(t,2),n=e[0],o=e[1];r.setAttribute(n,o)})),r.applyDelta(ba(e),{sanitize:!1}),r}(ia||aa)&&ie(RegExp.prototype,ea,(function(){var t=Ct(this),e=Ke(t.source),n=t.flags;return"/"+e+"/"+Ke(void 0===n&&z(na,t)&&!("flags"in na)?oa(t):n)}),{unsafe:!0});var wa=bt("isConcatSpreadable"),Oa=9007199254740991,Sa="Maximum allowed index exceeded",xa=l.TypeError,Ea=U>=51||!d((function(){var t=[];return t[wa]=!1,t.concat()[0]!==t})),ja=zi("concat"),Ta=function(t){if(!I(t))return!1;var e=t[wa];return void 0!==e?!!e:Ge(t)};function Pa(e){return e?t.isText(e)?e.text.length:1:0}function Ra(e,n,r){var o;if(0===r.length)throw new Error("Path has to a have a length >= 1");if(t.isText(n))throw new Error("Cannot descent into slate text");var a=Li(r),u=a[0],c=a.slice(1),s=function(t,e){return t.children.slice(0,e).reduce((function(t,e){return t+Pa(e)}),0)}(n,u),f=n.children[u],l=la(e),d=Pa(f),h=pa(l,s,d);if(h.length>1)throw new Error("Path doesn't match yText, yTarget spans multiple nodes");var p=null===(o=h[0])||void 0===o?void 0:o.insert;if(c.length>0){if(!(p instanceof i.XmlText))throw new Error("Path doesn't match yText, cannot descent into non-yText");return Ra(p,f,c)}return{yParent:e,textRange:{start:s,end:s+d},yTarget:p instanceof i.XmlText?p:void 0,slateParent:n,slateTarget:f,targetDelta:h}}function Aa(e,n,r){void 0===r&&(r={});for(var o=r.assoc,i=void 0===o?0:o,a=r.insert,u=void 0!==a&&a,c=0,s=0,f=0;f<e.children.length;f++){var l=e.children[f],d=t.isText(l)?l.text.length:1;d>0&&(s=f);var h=c+d;if(d>0&&(i>=0?h>n:h>=n))return[f,n-c];c+=d}if(n>c+(u?1:0))throw new Error("yOffset out of bounds");if(u)return[e.children.length,0];var p=e.children[s];return[s,t.isText(p)?p.text.length:1]}function ka(e,n,r){for(var o=[r];o[0]!==e;){var a=o[0].parent;if(!a)throw new Error("yText isn't a descendant of root element");if(!(a instanceof i.XmlText))throw new Error("Unexpected y parent type");o.unshift(a)}if(o.length<2)return[];var u=n;return o.reduce((function(e,n,r){var i,a,c=o[r+1];if(!c)return e;var s=0,f=la(n);try{for(var l=Ci(f),d=l.next();!d.done;d=l.next()){var h=d.value;if(h.insert===c)break;s+="string"==typeof h.insert?h.insert.length:1}}catch(t){i={error:t}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}if(t.isText(u))throw new Error("Cannot descent into slate text");var p=Li(Aa(u,s),1)[0];return u=u.children[p],e.concat(p)}),[])}function Ca(r,o,a){var u=a.target,c=a.changes,s=a.delta;if(!(u instanceof i.XmlText))throw new Error("Unexpected target node type");var f=[],l=ka(r,o,u),d=e.get(o,l);if(t.isText(d))throw new Error("Cannot apply yTextEvent to text node");var h=Array.from(c.keys.entries());if(l.length>0&&h.length>0){var p=Object.fromEntries(h.map((function(t){var e=Li(t,2),n=e[0];return[n,"delete"===e[1].action?null:u.getAttribute(n)]}))),v=Object.fromEntries(h.map((function(t){var e=Li(t,1)[0];return[e,d[e]]})));f.push({type:"set_node",newProperties:p,properties:v,path:l})}return s.length>0&&f.push.apply(f,_i([],Li(function(e,r,o){var i=[],a=o.reduce((function(t,e){return"retain"in e?t+e.retain:"delete"in e?t+e.delete:t}),0);return o.reverse().forEach((function(o){var u,c;if("attributes"in o&&"retain"in o)for(var s=Li(Aa(e,a-o.retain),2),f=s[0],l=s[1],d=Li(Aa(e,a,{assoc:-1}),2),h=d[0],p=d[1],v=h;v>=f;v--){var g=e.children[v],y=_i(_i([],Li(r)),[v]);if(t.isText(g)){var b=o.attributes,m=fa.apply(void 0,_i([e],Li(Object.keys(o.attributes))));if(v===f||v===h){var w=v===f?l:0;if((x=v===h?p:g.text.length)!==g.text.length&&i.push({type:"split_node",path:y,position:x,properties:va(g)}),0!==w){i.push({type:"split_node",path:y,position:w,properties:(c=Ai(Ai({},va(g)),b),Object.fromEntries(Object.entries(c).filter((function(t){return null!==Li(t,2)[1]}))))});continue}}i.push({type:"set_node",newProperties:b,path:y,properties:m})}}if("retain"in o&&(a-=o.retain),"delete"in o){var O=Li(Aa(e,a-o.delete),2),S=(f=O[0],l=O[1],Li(Aa(e,a,{assoc:-1}),2));for(h=S[0],v=0===(p=S[1])?h-1:h;v>=f;v--)if(g=e.children[v],y=_i(_i([],Li(r)),[v]),!t.isText(g)||v!==f&&v!==h)i.push({type:"remove_node",node:g,path:y}),a-=Pa(g);else{w=v===f?l:0;var x=v===h?p:g.text.length;i.push({type:"remove_text",offset:w,text:g.text.slice(w,x),path:y}),a-=x-w}}else if("insert"in o){var E=Li(Aa(e,a,{insert:!0}),2),j=(v=E[0],E[1]);if(g=e.children[v],y=_i(_i([],Li(r)),[v]),t.isText(g)){var T=i[i.length-1],P=null!=T&&"insert_node"===T.type?T.node:va(g),R=[];if(null==T||"insert_node"!==T.type&&"insert_text"!==T.type&&"split_node"!==T.type&&"set_node"!==T.type||(R=T.path),"string"==typeof o.insert&&sa(null!==(u=o.attributes)&&void 0!==u?u:{},P)&&n.equals(y,R))return i.push({type:"insert_text",offset:j,text:o.insert,path:y});var A=ya(o);return 0===j?i.push({type:"insert_node",path:y,node:A}):(j<g.text.length&&i.push({type:"split_node",path:y,position:j,properties:va(g)}),i.push({type:"insert_node",path:n.next(y),node:A}))}return i.push({type:"insert_node",path:y,node:ya(o)})}})),i}(d,l,s)))),f}function La(t,e,n){r.withoutNormalizing(e,(function(){n.forEach((function(n){(function(t,e,n){if(n instanceof i.YTextEvent)return Ca(t,e,n);throw new Error("Unexpected Y event type")})(t,e,n).forEach((function(t){e.apply(t)}))}))}))}function _a(t){return t.map((function(t){return"string"==typeof t.insert?t:Ai(Ai({},t),{insert:Ma(t.insert)})}))}function Ma(t){var e=new i.XmlText,n=t.getAttributes();return Object.entries(n).forEach((function(t){var n=Li(t,2),r=n[0],o=n[1];e.setAttribute(r,o)})),e.applyDelta(_a(la(t)),{sanitize:!1}),e}Fe({target:"Array",proto:!0,forced:!Ea||!ja},{concat:function(t){var e,n,r,o,i,a=ut(this),u=Fn(a,0),c=0;for(e=-1,r=arguments.length;e<r;e++)if(Ta(i=-1===e?a:arguments[e])){if(c+(o=pe(i))>Oa)throw xa(Sa);for(n=0;n<o;n++,c++)n in i&&sn(u,c,i[n])}else{if(c>=Oa)throw xa(Sa);sn(u,c++,i)}return u.length=c,u}});var Fa=Object.assign,Ia=Object.defineProperty,Da=j([].concat),za=!Fa||d((function(){if(h&&1!==Fa({b:1},Fa(Ia({},"a",{enumerable:!0,get:function(){Ia(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!=Fa({},t)[n]||$e(Fa({},e)).join("")!=r}))?function(t,e){for(var n=ut(t),r=arguments.length,o=1,i=xe.f,a=m.f;r>o;)for(var u,c=C(arguments[o++]),s=i?Da($e(c),i(c)):$e(c),f=s.length,l=0;f>l;)u=s[l++],h&&!v(a,c,u)||(n[u]=c[u]);return n}:Fa;Fe({target:"Object",stat:!0,forced:Object.assign!==za},{assign:za});var Na,Wa=bt("match"),Ga=l.TypeError,Xa=function(t){if(function(t){var e;return I(t)&&(void 0!==(e=t[Wa])?!!e:"RegExp"==R(t))}(t))throw Ga("The method doesn't accept regular expressions");return t},Ba=bt("match"),Ua=Rt.f,Ya=j("".startsWith),Va=j("".slice),qa=Math.min,Ha=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[Ba]=!1,"/./"[t](e)}catch(t){}}return!1}("startsWith"),Ja=!(Ha||(Na=Ua(String.prototype,"startsWith"),!Na||Na.writable));Fe({target:"String",proto:!0,forced:!Ja&&!Ha},{startsWith:function(t){var e=Ke(_(this));Xa(t);var n=he(qa(arguments.length>1?arguments[1]:void 0,e.length)),r=Ke(t);return Ya?Ya(e,r,n):Va(e,n,n+r.length)===r}});var Ka=/"/g,$a=j("".replace);function Qa(t){if(!t.doc)throw new Error("shared type isn't attached to a document")}Fe({target:"String",proto:!0,forced:function(t){return d((function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3}))}("anchor")},{anchor:function(t){return e="a",n="name",r=t,o=Ke(_(this)),i="<"+e,""!==n&&(i+=" "+n+'="'+$a(Ke(r),Ka,"&quot;")+'"'),i+">"+o+"</"+e+">";var e,n,r,o,i}});var Za="__slateYjsStoredPosition_";function tu(t,e,n){var r=Ra(t,e,n.path),o=r.yTarget,a=r.yParent,u=r.textRange;if(o)throw new Error("Slate point points to a non-text element inside sharedRoot");var c=u.start+n.offset;return i.createRelativePositionFromTypeIndex(a,c,c===u.end?-1:0)}function eu(n,r,o){if(!n.doc)throw new Error("sharedRoot isn't attach to a yDoc");var a=i.createAbsolutePositionFromRelativePosition(o,n.doc);return a&&function(n,r,o){var a=o.type,u=o.index,c=o.assoc;if(!(a instanceof i.XmlText))throw new Error("Absolute position points to a non-XMLText");var s=ka(n,r,a),f=e.get(r,s);if(t.isText(f))throw new Error("Absolute position doesn't match slateRoot, cannot descent into text");var l=Li(Aa(f,u,{assoc:c}),2),d=l[0],h=l[1],p=f.children[d];return t.isText(p)?{path:_i(_i([],Li(s)),[d]),offset:h}:null}(n,r,a)}function nu(t,e,n){t.setAttribute(Za+e,i.encodeRelativePosition(n))}function ru(t,e,n){return Object.fromEntries(Object.entries(t).filter((function(t){var r=Li(t,2)[1];return r.type===e&&(!n||(r.assoc>=0?r.index>=n.start&&r.index<n.end:r.index>n.start&&r.index>=n.end))})))}function ou(t,e,n){var r;void 0===n&&(n="");var o=((r={})[n]=ru(t,e),r);return la(e).forEach((function(e,r){var a=e.insert;a instanceof i.XmlText&&Object.assign(o,ou(t,a,n?n+"."+r:r.toString()))})),o}function iu(t,e,n,r){void 0===r&&(r=0);var o=function(t){return Qa(t),Object.fromEntries(Object.entries(t.getAttributes()).filter((function(t){return Li(t,1)[0].startsWith(Za)})).map((function(e){var n=Li(e,2),r=n[0],o=n[1];return[r.slice(Za.length),i.createAbsolutePositionFromRelativePosition(i.decodeRelativePosition(o),t.doc)]})).filter((function(t){return Li(t,2)[1]})))}(t),a={"":ru(o,e,{start:r,end:r+ha(n)})};return n.forEach((function(t,e){var n=t.insert;n instanceof i.XmlText&&Object.assign(a,ou(o,n,e.toString()))})),a}function au(t,e,n,r,o,a,u){void 0===o&&(o=0),void 0===a&&(a=0),void 0===u&&(u="");var c=n[u];c&&Object.entries(c).forEach((function(n){var r=Li(n,2),u=r[0],c=r[1];nu(t,u,i.createRelativePositionFromTypeIndex(e,c.index-a+o,c.assoc))})),r.forEach((function(e,r){var o=e.insert;o instanceof i.XmlText&&au(t,o,n,la(o),0,0,u?u+"."+r:r.toString())}))}function uu(t,e,n){return{anchor:tu(t,e,n.anchor),focus:tu(t,e,n.focus)}}function cu(t,e,n){var r=eu(t,e,n.anchor);if(!r)return null;var o=eu(t,e,n.focus);return o?{anchor:r,focus:o}:null}var su={insert_node:function(e,n,r){var o=Ra(e,n,r.path),i=o.yParent,a=o.textRange;if(t.isText(r.node))return i.insert(a.start,r.node.text,va(r.node));i.insertEmbed(a.start,ma(r.node))},remove_node:function(t,e,n){var r=Ra(t,e,n.path),o=r.yParent,i=r.textRange;o.delete(i.start,i.end-i.start)},set_node:function(t,e,n){var r=Ra(t,e,n.path),o=r.yTarget,i=r.textRange,a=r.yParent;if(o)return Object.entries(n.newProperties).forEach((function(t){var e=Li(t,2),n=e[0],r=e[1];if(null===r)return o.removeAttribute(n);o.setAttribute(n,r)})),Object.entries(n.properties).forEach((function(t){var e=Li(t,1)[0];Object.prototype.hasOwnProperty.call(n.newProperties,e)||o.removeAttribute(e)}));var u=Object.fromEntries(Object.keys(n.properties).map((function(t){return[t,null]}))),c=Ai(Ai({},u),n.newProperties);a.format(i.start,i.end-i.start,c)},merge_node:function(r,o,i){var a=Ra(r,o,i.path),u=Ra(a.yParent,a.slateParent,n.previous(i.path.slice(-1)));if(!a.yTarget!=!u.yTarget)throw new Error("Cannot merge y text with y element");if(!u.yTarget||!a.yTarget){var c=a.yParent,s=a.textRange,f=a.slateTarget;if(!f)throw new Error("Expected Slate target node for merge op.");var l=e.get(o,n.previous(i.path));if(!t.isText(l))throw new Error("Path points to Y.Text but not a Slate text node.");var d=va(f),h=va(l),p=Object.keys(d).reduce((function(t,e){var n;return e in h?t:Ai(Ai({},t),((n={})[e]=null,n))}),{});return c.format(s.start,s.end-s.start,Ai(Ai({},p),h))}var v=u.yTarget.length,g=la(a.yTarget),y=_a(g),b=iu(r,a.yTarget,g,v),m=_i([{retain:v}],Li(y));u.yTarget.applyDelta(m,{sanitize:!1}),a.yParent.delete(a.textRange.start,a.textRange.end-a.textRange.start),au(r,u.yTarget,b,y,v)},move_node:function(r,o,i){var a=n.parent(i.newPath),u=i.newPath[i.newPath.length-1],c=e.get(o,a);if(t.isText(c))throw new Error("Cannot move slate node into text element");var s=_i(_i([],Li(a)),[Math.min(u,c.children.length)]),f=Ra(r,o,i.path),l=Ra(r,o,s),d=_a(f.targetDelta),h=iu(r,f.yParent,f.targetDelta);f.yParent.delete(f.textRange.start,f.textRange.end-f.textRange.start);var p=ha(la(l.yParent)),v=Math.min(l.textRange.start,p),g=_i([{retain:v}],Li(d));l.yParent.applyDelta(g,{sanitize:!1}),au(r,l.yParent,h,d,v,f.textRange.start)},split_node:function(e,n,r){var o=Ra(e,n,r.path);if(!o.slateTarget)throw new Error("Y target without corresponding slate node");if(!o.yTarget){if(!t.isText(o.slateTarget))throw new Error("Mismatch node type between y target and slate node");var a={};return o.targetDelta.forEach((function(t){t.attributes&&Object.keys(t.attributes).forEach((function(t){a[t]=null}))})),o.yParent.format(o.textRange.start,o.textRange.end-o.textRange.start,Ai(Ai({},a),r.properties))}if(t.isText(o.slateTarget))throw new Error("Mismatch node type between y target and slate node");var u=Ra(o.yTarget,o.slateTarget,[r.position]),c=o.slateTarget.children.slice(0,r.position).reduce((function(t,e){return t+Pa(e)}),0),s=o.slateTarget.children.reduce((function(t,e){return t+Pa(e)}),0),f=pa(la(o.yTarget),c,s-c),l=_a(f),d=iu(e,o.yTarget,f,c),h=new i.XmlText;h.applyDelta(l,{sanitize:!1}),Object.entries(r.properties).forEach((function(t){var e=Li(t,2),n=e[0],r=e[1];h.setAttribute(n,r)})),o.yTarget.delete(u.textRange.start,o.yTarget.length-u.textRange.start),o.yParent.insertEmbed(o.textRange.end,h),au(e,h,d,l,0,c)}};var fu=Ai(Ai(Ai({},{insert_text:function(n,r,o){var i=Ra(n,r,o.path),a=i.yParent,u=i.textRange,c=e.get(r,o.path);if(!t.isText(c))throw new Error("Cannot insert text into non-text node");a.insert(u.start+o.offset,o.text,va(c))},remove_text:function(t,e,n){var r=Ra(t,e,n.path),o=r.yParent,i=r.textRange;o.delete(i.start+n.offset,n.text.length)}}),su),{set_selection:function(){}});var lu=Symbol("slate-yjs-operation"),du=Symbol("slate-yjs-position-storage"),hu=new WeakMap,pu=new WeakMap,vu=new WeakSet,gu={isYjsEditor:function(t){return r.isEditor(t)&&t.sharedRoot instanceof i.XmlText&&"localOrigin"in t&&"positionStorageOrigin"in t&&"function"==typeof t.applyRemoteEvents&&"function"==typeof t.storeLocalChange&&"function"==typeof t.flushLocalChanges&&"function"==typeof t.isLocalOrigin&&"function"==typeof t.connect&&"function"==typeof t.disconnect},localChanges:function(t){var e;return null!==(e=pu.get(t))&&void 0!==e?e:[]},applyRemoteEvents:function(t,e,n){t.applyRemoteEvents(e,n)},storeLocalChange:function(t,e){t.storeLocalChange(e)},flushLocalChanges:function(t){t.flushLocalChanges()},connected:function(t){return vu.has(t)},connect:function(t){t.connect()},disconnect:function(t){t.disconnect()},isLocal:function(t){return t.isLocalOrigin(gu.origin(t))},origin:function(t){var e=hu.get(t);return void 0!==e?e:t.localOrigin},withOrigin:function(t,e,n){var r=gu.origin(t);hu.set(t,e),n(),hu.set(t,r)},storePosition:function(t,e,n){var r=t.sharedRoot,o=t.positionStorageOrigin;Qa(r);var i=tu(r,t,n);r.doc.transact((function(){nu(r,e,i)}),o)},removeStoredPosition:function(t,e){var n=t.sharedRoot,r=t.positionStorageOrigin;Qa(n),n.doc.transact((function(){!function(t,e){t.removeAttribute(Za+e)}(n,e)}),r)},position:function(t,e){var n=function(t,e){var n=t.getAttribute(Za+e);return n?i.decodeRelativePosition(n):null}(t.sharedRoot,e);if(n)return eu(t.sharedRoot,t,n)},storedPositionsRelative:function(t){return e=t.sharedRoot,Object.fromEntries(Object.entries(e.getAttributes()).filter((function(t){return Li(t,1)[0].startsWith(Za)})).map((function(t){var e=Li(t,2),n=e[0],r=e[1];return[n.slice(Za.length),i.createRelativePositionFromJSON(r)]})));var e}};function yu(t,e){return void 0===e&&(e={}),function(n){var o,i,a=n;a.sharedRoot=t,a.localOrigin=null!==(o=e.localOrigin)&&void 0!==o?o:lu,a.positionStorageOrigin=null!==(i=e.positionStorageOrigin)&&void 0!==i?i:du,a.applyRemoteEvents=function(t,e){gu.flushLocalChanges(a),r.withoutNormalizing(a,(function(){gu.withOrigin(a,e,(function(){La(a.sharedRoot,a,t)}))}))},a.isLocalOrigin=function(t){return t===a.localOrigin};var u=function(t,e){a.isLocalOrigin(e.origin)||gu.applyRemoteEvents(a,t,e.origin)},c=null;e.autoConnect&&(c=setTimeout((function(){c=null,gu.connect(a)}))),a.connect=function(){if(gu.connected(a))throw new Error("already connected");a.sharedRoot.observeDeep(u);var t=ga(a.sharedRoot);a.children=t.children,vu.add(a),r.normalize(n,{force:!0}),n.operations.length||n.onChange()},a.disconnect=function(){c&&clearTimeout(c),gu.flushLocalChanges(a),a.sharedRoot.unobserveDeep(u),vu.delete(a)},a.storeLocalChange=function(t){pu.set(a,_i(_i([],Li(gu.localChanges(a))),[{op:t,doc:n.children,origin:gu.origin(a)}]))},a.flushLocalChanges=function(){Qa(a.sharedRoot);var t=gu.localChanges(a);pu.delete(a);var e=[];t.forEach((function(t){var n=e[e.length-1];if(n&&n[0].origin===t.origin)return n.push(t);e.push([t])})),e.forEach((function(t){Qa(a.sharedRoot),a.sharedRoot.doc.transact((function(){t.forEach((function(t){Qa(a.sharedRoot),function(t,e,n){var r=fu[n.type];if(!r)throw new Error("Unknown operation: "+n.type);r(t,e,n)}(a.sharedRoot,{children:t.doc},t.op)}))}),t[0].origin)}))};var s=a.apply,f=a.onChange;return a.apply=function(t){gu.connected(a)&&gu.isLocal(a)&&gu.storeLocalChange(a,t),s(t)},a.onChange=function(){gu.connected(a)&&gu.flushLocalChanges(a),f()},a}}var bu=bt("species"),mu=Mt.f,wu=To.fastKey,Ou=te.set,Su=te.getterFor,xu={getConstructor:function(t,e,n,r){var o=t((function(t,o){Wo(t,i),Ou(t,{type:e,index:cn(null),first:void 0,last:void 0,size:0}),h||(t.size=0),null!=o&&zo(o,t[r],{that:t,AS_ENTRIES:n})})),i=o.prototype,a=Su(e),u=function(t,e,n){var r,o,i=a(t),u=c(t,e);return u?u.value=n:(i.last=u={index:o=wu(e,!0),key:e,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=u),r&&(r.next=u),h?i.size++:t.size++,"F"!==o&&(i.index[o]=u)),t},c=function(t,e){var n,r=a(t),o=wu(e);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==e)return n};return Oo(i,{clear:function(){for(var t=a(this),e=t.index,n=t.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete e[n.index],n=n.next;t.first=t.last=void 0,h?t.size=0:this.size=0},delete:function(t){var e=this,n=a(e),r=c(e,t);if(r){var o=r.next,i=r.previous;delete n.index[r.index],r.removed=!0,i&&(i.next=o),o&&(o.previous=i),n.first==r&&(n.first=o),n.last==r&&(n.last=i),h?n.size--:e.size--}return!!r},forEach:function(t){for(var e,n=a(this),r=En(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:n.first;)for(r(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!c(this,t)}}),Oo(i,n?{get:function(t){var e=c(this,t);return e&&e.value},set:function(t,e){return u(this,0===t?0:t,e)}}:{add:function(t){return u(this,t=0===t?0:t,t)}}),h&&mu(i,"size",{get:function(){return a(this).size}}),o},setStrong:function(t,e,n){var r=e+" Iterator",o=Su(e),i=Su(r);ao(t,e,(function(t,e){Ou(this,{type:r,target:t,state:o(t),kind:e,last:void 0})}),(function(){for(var t=i(this),e=t.kind,n=t.last;n&&n.removed;)n=n.previous;return t.target&&(t.last=n=n?n.next:t.state.first)?"keys"==e?{value:n.key,done:!1}:"values"==e?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),function(t){var e=D(t),n=Mt.f;h&&e&&!e[bu]&&n(e,bu,{configurable:!0,get:function(){return this}})}(e)}};Vo("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),xu);var Eu=new WeakMap,ju=Symbol("slate-yjs-history-without-saving"),Tu={isYHistoryEditor:function(t){return gu.isYjsEditor(t)&&t.undoManager instanceof i.UndoManager&&"function"==typeof t.undo&&"function"==typeof t.redo&&"withoutSavingOrigin"in t},canUndo:function(t){return t.undoManager.undoStack.length>0},canRedo:function(t){return t.undoManager.redoStack.length>0},isSaving:function(t){return t.undoManager.trackedOrigins.has(gu.origin(t))},withoutSaving:function(t,e){gu.withOrigin(t,t.withoutSavingOrigin,e)}};function Pu(t){return void 0===t&&(t={}),function(e){var n=e,r=t.withoutSavingOrigin,a=void 0===r?ju:r,u=t.trackedOrigins,c=void 0===u?new Set([n.localOrigin]):u,s=ki(t,["withoutSavingOrigin","trackedOrigins"]),f=new i.UndoManager(n.sharedRoot,Ai({trackedOrigins:c},s));n.undoManager=f,n.withoutSavingOrigin=a;var l=n.onChange,d=n.isLocalOrigin;n.onChange=function(){l(),Eu.set(n,n.selection&&uu(n.sharedRoot,n,n.selection))},n.isLocalOrigin=function(t){return t===n.withoutSavingOrigin||d(t)};var h=function(t){var e=t.stackItem;e.meta.set("selection",n.selection&&uu(n.sharedRoot,n,n.selection)),e.meta.set("selectionBefore",Eu.get(n))},p=function(t){t.stackItem.meta.set("selection",n.selection&&uu(n.sharedRoot,n,n.selection))},v=function(t){var e=t.stackItem,r="undo"===t.type?n.undoManager.redoStack:n.undoManager.undoStack,i=r[r.length-1];i&&(i.meta.set("selection",e.meta.get("selectionBefore")),i.meta.set("selectionBefore",e.meta.get("selection")));var a=e.meta.get("selectionBefore");if(a){var u=cu(n.sharedRoot,n,a);u&&o.select(n,u)}},g=n.connect,y=n.disconnect;return n.connect=function(){g(),n.undoManager.on("stack-item-added",h),n.undoManager.on("stack-item-popped",v),n.undoManager.on("stack-item-updated",p)},n.disconnect=function(){n.undoManager.off("stack-item-added",h),n.undoManager.off("stack-item-popped",v),n.undoManager.off("stack-item-updated",p),y()},n.undo=function(){gu.connected(n)&&(gu.flushLocalChanges(n),n.undoManager.undo())},n.redo=function(){gu.connected(n)&&(gu.flushLocalChanges(n),n.undoManager.redo())},n}}var Ru=new WeakMap,Au={isCursorEditor:function(t){return gu.isYjsEditor(t)&&t.awareness&&"string"==typeof t.cursorDataField&&"string"==typeof t.selectionStateField&&"function"==typeof t.sendCursorPosition&&"function"==typeof t.sendCursorData},sendCursorPosition:function(t,e){void 0===e&&(e=t.selection),t.sendCursorPosition(e)},sendCursorData:function(t,e){t.sendCursorData(e)},on:function(t,e,n){var r;if("change"===e){var o=null!==(r=Ru.get(t))&&void 0!==r?r:new Set;o.add(n),t&&Ru.set(t,o)}},off:function(t,e,n){if("change"===e){var r=Ru.get(t);r&&r.delete(n)}},cursorState:function(t,e){var n;if(e===t.awareness.clientID||!gu.connected(t))return null;var r=t.awareness.getStates().get(e);return r?{relativeSelection:null!==(n=r[t.selectionStateField])&&void 0!==n?n:null,data:r[t.cursorDataField],clientId:e}:null},cursorStates:function(t){return gu.connected(t)?Object.fromEntries(Array.from(t.awareness.getStates().entries(),(function(e){var n=Li(e,2),r=n[0],o=n[1];return r!==t.awareness.clientID&&o?[r,{relativeSelection:o[t.selectionStateField],data:o[t.cursorDataField]}]:null})).filter(Array.isArray)):{}}};function ku(t,e){return void 0===e&&(e={}),function(n){var r=e.cursorStateField,o=void 0===r?"selection":r,a=e.cursorDataField,u=void 0===a?"data":a,c=e.autoSend,s=void 0===c||c,f=e.data,l=n;l.awareness=t,l.cursorDataField=u,l.selectionStateField=o,l.sendCursorData=function(t){l.awareness.setLocalStateField(l.cursorDataField,t)},l.sendCursorPosition=function(t){var e=l.awareness.getLocalState(),n=null==e?void 0:e[o];if(t){var r=uu(l.sharedRoot,l,t),a=r.anchor,u=r.focus;n&&i.compareRelativePositions(a,n)&&i.compareRelativePositions(u,n)||l.awareness.setLocalStateField(l.selectionStateField,{anchor:a,focus:u})}else n&&l.awareness.setLocalStateField(l.selectionStateField,null)};var d=function(t){var e=Ru.get(l);if(e){var n=l.awareness.clientID,r={added:t.added.filter((function(t){return t!==n})),removed:t.removed.filter((function(t){return t!==n})),updated:t.updated.filter((function(t){return t!==n}))};(r.added.length>0||r.removed.length>0||r.updated.length>0)&&e.forEach((function(t){return t(r)}))}},h=l.connect,p=l.disconnect;return l.connect=function(){if(h(),l.awareness.on("change",d),d({removed:[],added:Array.from(l.awareness.getStates().keys()),updated:[]}),s){f&&Au.sendCursorData(l,f);var t=l.onChange;l.onChange=function(){t(),gu.connected(l)&&Au.sendCursorPosition(l)}}},l.disconnect=function(){l.awareness.off("change",d),d({removed:Array.from(l.awareness.getStates().keys()),added:[],updated:[]}),p()},l}}export{Au as CursorEditor,Tu as YHistoryEditor,gu as YjsEditor,eu as relativePositionToSlatePoint,cu as relativeRangeToSlateRange,ba as slateNodesToInsertDelta,tu as slatePointToRelativePosition,uu as slateRangeToRelativeRange,ku as withCursors,Pu as withYHistory,yu as withYjs,ga as yTextToSlateElement};
2
+ //# sourceMappingURL=index.esm.js.map