@wangeditor-next/yjs 0.1.50 → 1.0.1

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