@wangeditor-next/yjs 0.1.4 → 0.1.6

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